WordPress/wp-includes/js/dist/components.js
youknowriad 1516d05128 Block Editor: Package updates for 5.8 beta 1.
This includes the following fixes:


Widgets Editor:
  - Load widgets.php https://github.com/WordPress/gutenberg/pull/32299
 - Fix Legacy Widget Preview https://github.com/WordPress/gutenberg/pull/32300
 - Fix error when saving empty Legacy Widget block https://github.com/WordPress/gutenberg/pull/32359

Widget blocks in the customizer: 
 - Fix deselection blocks when the inspector is open https://github.com/WordPress/gutenberg/pull/32361
 - Display wide widgets as popovers https://github.com/WordPress/gutenberg/pull/31736

Global Styles:
 - Align classNames generation between client and server https://github.com/WordPress/gutenberg/pull/32352
 - Group typography block supports https://github.com/WordPress/gutenberg/pull/32252 https://github.com/WordPress/gutenberg/pull/32444 https://github.com/WordPress/gutenberg/pull/32459
 - Make theme.json syntax errors more visible to the users https://github.com/WordPress/gutenberg/pull/32404


Template Editor:
  - Update the appearance of the template details https://github.com/WordPress/gutenberg/pull/32042
  - Fix layout definition https://github.com/WordPress/gutenberg/pull/32425
  - Fix grouping post content block https://github.com/WordPress/gutenberg/pull/32453

Miscellaneous:
 - Prevent saving when the post is locked https://github.com/WordPress/gutenberg/pull/32341
 - Fix allowed block patterns selector https://github.com/WordPress/gutenberg/pull/32376
 - Fix wrong results in the Post Author picker https://github.com/WordPress/gutenberg/pull/32344
 - Fix notices position in top toolbar mode https://github.com/WordPress/gutenberg/pull/32238
 - Allow non-latin characters in post slugs https://github.com/WordPress/gutenberg/pull/32232
 - Fix Random collapse of the color settings panel https://github.com/WordPress/gutenberg/pull/32388
 - Fix theme logo theme mode not being removed on theme removal https://github.com/WordPress/gutenberg/pull/32370
 - Fix block alignment styles in the editor https://github.com/WordPress/gutenberg/pull/32454
 - Fix some block toolbar overlaps https://github.com/WordPress/gutenberg/pull/32424
 - Fix content loss when switching list types https://github.com/WordPress/gutenberg/pull/32432


Performance:
 - Improve the performance of buttons block https://github.com/WordPress/gutenberg/pull/32356
 - Improve the performance of the container blocks https://github.com/WordPress/gutenberg/pull/32380

Props noisysocks, nosolosw, jorgefilipecosta.
See #52991.

Built from https://develop.svn.wordpress.org/trunk@51089


git-svn-id: http://core.svn.wordpress.org/trunk@50698 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2021-06-08 08:09:53 +00:00

60022 lines
1.8 MiB
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

this["wp"] = this["wp"] || {}; this["wp"]["components"] =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = "SB3u");
/******/ })
/************************************************************************/
/******/ ({
/***/ "+51k":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = getActiveElement;
function getActiveElement() {
return typeof document !== 'undefined' && document.activeElement;
}
/***/ }),
/***/ "+WFq":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useSlot; });
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _slot_fill_context__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("JYkG");
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useSlot(name) {
const registry = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useContext"])(_slot_fill_context__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"]);
const slot = registry.slots[name] || {};
const slotFills = registry.fills[name];
const fills = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useMemo"])(() => slotFills || [], [slotFills]);
const updateSlot = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useCallback"])(fillProps => {
registry.updateSlot(name, fillProps);
}, [name, registry.updateSlot]);
const unregisterSlot = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useCallback"])(slotRef => {
registry.unregisterSlot(name, slotRef);
}, [name, registry.unregisterSlot]);
const registerFill = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useCallback"])(fillRef => {
registry.registerFill(name, fillRef);
}, [name, registry.registerFill]);
const unregisterFill = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useCallback"])(fillRef => {
registry.unregisterFill(name, fillRef);
}, [name, registry.unregisterFill]);
return { ...slot,
updateSlot,
unregisterSlot,
fills,
registerFill,
unregisterFill
};
}
/***/ }),
/***/ "+ipW":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return canUseDOM; });
/* harmony import */ var _getWindow_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("SyVe");
function checkIsBrowser() {
var _window = Object(_getWindow_js__WEBPACK_IMPORTED_MODULE_0__[/* getWindow */ "a"])();
return Boolean(typeof _window !== "undefined" && _window.document && _window.document.createElement);
}
/**
* It's `true` if it is running in a browser environment or `false` if it is not (SSR).
*
* @example
* import { canUseDOM } from "reakit-utils";
*
* const title = canUseDOM ? document.title : "";
*/
var canUseDOM = checkIsBrowser();
/***/ }),
/***/ "/9aa":
/***/ (function(module, exports, __webpack_require__) {
var baseGetTag = __webpack_require__("NykK"),
isObjectLike = __webpack_require__("ExA7");
/** `Object#toString` result references. */
var symbolTag = '[object Symbol]';
/**
* Checks if `value` is classified as a `Symbol` primitive or object.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
* @example
*
* _.isSymbol(Symbol.iterator);
* // => true
*
* _.isSymbol('abc');
* // => false
*/
function isSymbol(value) {
return typeof value == 'symbol' ||
(isObjectLike(value) && baseGetTag(value) == symbolTag);
}
module.exports = isSymbol;
/***/ }),
/***/ "/ZKw":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var define = __webpack_require__("82c2");
var callBind = __webpack_require__("PrET");
var implementation = __webpack_require__("yN6O");
var getPolyfill = __webpack_require__("22yB");
var polyfill = getPolyfill();
var shim = __webpack_require__("v3P4");
var boundFlat = callBind(polyfill);
define(boundFlat, {
getPolyfill: getPolyfill,
implementation: implementation,
shim: shim
});
module.exports = boundFlat;
/***/ }),
/***/ "/sVA":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var toStr = Object.prototype.toString;
var hasSymbols = __webpack_require__("UVaH")();
if (hasSymbols) {
var symToStr = Symbol.prototype.toString;
var symStringRegex = /^Symbol\(.*\)$/;
var isSymbolObject = function isRealSymbolObject(value) {
if (typeof value.valueOf() !== 'symbol') {
return false;
}
return symStringRegex.test(symToStr.call(value));
};
module.exports = function isSymbol(value) {
if (typeof value === 'symbol') {
return true;
}
if (toStr.call(value) !== '[object Symbol]') {
return false;
}
try {
return isSymbolObject(value);
} catch (e) {
return false;
}
};
} else {
module.exports = function isSymbol(value) {
// this environment does not support Symbols.
return false && false;
};
}
/***/ }),
/***/ 0:
/***/ (function(module, exports) {
/* (ignored) */
/***/ }),
/***/ "030x":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var styleInterface = void 0;
var styleTheme = void 0;
var START_MARK = 'react-with-styles.resolve.start';
var END_MARK = 'react-with-styles.resolve.end';
var MEASURE_MARK = '\uD83D\uDC69\u200D\uD83C\uDFA8 [resolve]';
function registerTheme(theme) {
styleTheme = theme;
}
function registerInterface(interfaceToRegister) {
styleInterface = interfaceToRegister;
}
function create(makeFromTheme, createWithDirection) {
var styles = createWithDirection(makeFromTheme(styleTheme));
return function () {
return styles;
};
}
function createLTR(makeFromTheme) {
return create(makeFromTheme, styleInterface.createLTR || styleInterface.create);
}
function createRTL(makeFromTheme) {
return create(makeFromTheme, styleInterface.createRTL || styleInterface.create);
}
function get() {
return styleTheme;
}
function resolve() {
if (false) {}
for (var _len = arguments.length, styles = Array(_len), _key = 0; _key < _len; _key++) {
styles[_key] = arguments[_key];
}
var result = styleInterface.resolve(styles);
if (false) {}
return result;
}
function resolveLTR() {
for (var _len2 = arguments.length, styles = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
styles[_key2] = arguments[_key2];
}
if (styleInterface.resolveLTR) {
return styleInterface.resolveLTR(styles);
}
return resolve(styles);
}
function resolveRTL() {
for (var _len3 = arguments.length, styles = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
styles[_key3] = arguments[_key3];
}
if (styleInterface.resolveRTL) {
return styleInterface.resolveRTL(styles);
}
return resolve(styles);
}
function flush() {
if (styleInterface.flush) {
styleInterface.flush();
}
}
exports['default'] = {
registerTheme: registerTheme,
registerInterface: registerInterface,
create: createLTR,
createLTR: createLTR,
createRTL: createRTL,
get: get,
resolve: resolveLTR,
resolveLTR: resolveLTR,
resolveRTL: resolveRTL,
flush: flush
};
/***/ }),
/***/ "0Dl3":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = getNumberOfCalendarMonthWeeks;
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function getBlankDaysBeforeFirstDay(firstDayOfMonth, firstDayOfWeek) {
var weekDayDiff = firstDayOfMonth.day() - firstDayOfWeek;
return (weekDayDiff + 7) % 7;
}
function getNumberOfCalendarMonthWeeks(month) {
var firstDayOfWeek = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _moment2['default'].localeData().firstDayOfWeek();
var firstDayOfMonth = month.clone().startOf('month');
var numBlankDays = getBlankDaysBeforeFirstDay(firstDayOfMonth, firstDayOfWeek);
return Math.ceil((numBlankDays + month.daysInMonth()) / 7);
}
/***/ }),
/***/ "0HL0":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return setTextFieldValue; });
/* harmony import */ var reakit_utils_fireEvent__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("qOxZ");
function setTextFieldValue(element, value) {
if (element instanceof HTMLInputElement || element instanceof HTMLTextAreaElement) {
var _Object$getOwnPropert;
var proto = Object.getPrototypeOf(element);
var setValue = (_Object$getOwnPropert = Object.getOwnPropertyDescriptor(proto, "value")) === null || _Object$getOwnPropert === void 0 ? void 0 : _Object$getOwnPropert.set;
if (setValue) {
setValue.call(element, value);
Object(reakit_utils_fireEvent__WEBPACK_IMPORTED_MODULE_0__[/* fireEvent */ "a"])(element, "input", {
bubbles: true
});
}
}
}
/***/ }),
/***/ "0XP8":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var LeftArrow = function () {
function LeftArrow(props) {
return _react2['default'].createElement(
'svg',
props,
_react2['default'].createElement('path', {
d: 'M336.2 274.5l-210.1 210h805.4c13 0 23 10 23 23s-10 23-23 23H126.1l210.1 210.1c11 11 11 21 0 32-5 5-10 7-16 7s-11-2-16-7l-249.1-249c-11-11-11-21 0-32l249.1-249.1c21-21.1 53 10.9 32 32z'
})
);
}
return LeftArrow;
}();
LeftArrow.defaultProps = {
viewBox: '0 0 1000 1000'
};
exports['default'] = LeftArrow;
/***/ }),
/***/ "1+Kn":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.BOTTOM_RIGHT = exports.TOP_RIGHT = exports.TOP_LEFT = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _object = __webpack_require__("Koq/");
var _object2 = _interopRequireDefault(_object);
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _airbnbPropTypes = __webpack_require__("Hsqg");
var _reactWithStyles = __webpack_require__("TG4+");
var _defaultPhrases = __webpack_require__("vV+G");
var _getPhrasePropTypes = __webpack_require__("yc2e");
var _getPhrasePropTypes2 = _interopRequireDefault(_getPhrasePropTypes);
var _KeyboardShortcutRow = __webpack_require__("zN8g");
var _KeyboardShortcutRow2 = _interopRequireDefault(_KeyboardShortcutRow);
var _CloseButton = __webpack_require__("xEte");
var _CloseButton2 = _interopRequireDefault(_CloseButton);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var TOP_LEFT = exports.TOP_LEFT = 'top-left';
var TOP_RIGHT = exports.TOP_RIGHT = 'top-right';
var BOTTOM_RIGHT = exports.BOTTOM_RIGHT = 'bottom-right';
var propTypes = (0, _airbnbPropTypes.forbidExtraProps)((0, _object2['default'])({}, _reactWithStyles.withStylesPropTypes, {
block: _propTypes2['default'].bool,
buttonLocation: _propTypes2['default'].oneOf([TOP_LEFT, TOP_RIGHT, BOTTOM_RIGHT]),
showKeyboardShortcutsPanel: _propTypes2['default'].bool,
openKeyboardShortcutsPanel: _propTypes2['default'].func,
closeKeyboardShortcutsPanel: _propTypes2['default'].func,
phrases: _propTypes2['default'].shape((0, _getPhrasePropTypes2['default'])(_defaultPhrases.DayPickerKeyboardShortcutsPhrases))
}));
var defaultProps = {
block: false,
buttonLocation: BOTTOM_RIGHT,
showKeyboardShortcutsPanel: false,
openKeyboardShortcutsPanel: function () {
function openKeyboardShortcutsPanel() {}
return openKeyboardShortcutsPanel;
}(),
closeKeyboardShortcutsPanel: function () {
function closeKeyboardShortcutsPanel() {}
return closeKeyboardShortcutsPanel;
}(),
phrases: _defaultPhrases.DayPickerKeyboardShortcutsPhrases
};
function getKeyboardShortcuts(phrases) {
return [{
unicode: '↵',
label: phrases.enterKey,
action: phrases.selectFocusedDate
}, {
unicode: '←/→',
label: phrases.leftArrowRightArrow,
action: phrases.moveFocusByOneDay
}, {
unicode: '↑/↓',
label: phrases.upArrowDownArrow,
action: phrases.moveFocusByOneWeek
}, {
unicode: 'PgUp/PgDn',
label: phrases.pageUpPageDown,
action: phrases.moveFocusByOneMonth
}, {
unicode: 'Home/End',
label: phrases.homeEnd,
action: phrases.moveFocustoStartAndEndOfWeek
}, {
unicode: 'Esc',
label: phrases.escape,
action: phrases.returnFocusToInput
}, {
unicode: '?',
label: phrases.questionMark,
action: phrases.openThisPanel
}];
}
var DayPickerKeyboardShortcuts = function (_React$Component) {
_inherits(DayPickerKeyboardShortcuts, _React$Component);
function DayPickerKeyboardShortcuts() {
var _ref;
_classCallCheck(this, DayPickerKeyboardShortcuts);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var _this = _possibleConstructorReturn(this, (_ref = DayPickerKeyboardShortcuts.__proto__ || Object.getPrototypeOf(DayPickerKeyboardShortcuts)).call.apply(_ref, [this].concat(args)));
var phrases = _this.props.phrases;
_this.keyboardShortcuts = getKeyboardShortcuts(phrases);
_this.onShowKeyboardShortcutsButtonClick = _this.onShowKeyboardShortcutsButtonClick.bind(_this);
_this.setShowKeyboardShortcutsButtonRef = _this.setShowKeyboardShortcutsButtonRef.bind(_this);
_this.setHideKeyboardShortcutsButtonRef = _this.setHideKeyboardShortcutsButtonRef.bind(_this);
_this.handleFocus = _this.handleFocus.bind(_this);
_this.onKeyDown = _this.onKeyDown.bind(_this);
return _this;
}
_createClass(DayPickerKeyboardShortcuts, [{
key: 'componentWillReceiveProps',
value: function () {
function componentWillReceiveProps(nextProps) {
var phrases = this.props.phrases;
if (nextProps.phrases !== phrases) {
this.keyboardShortcuts = getKeyboardShortcuts(nextProps.phrases);
}
}
return componentWillReceiveProps;
}()
}, {
key: 'componentDidUpdate',
value: function () {
function componentDidUpdate() {
this.handleFocus();
}
return componentDidUpdate;
}()
}, {
key: 'onKeyDown',
value: function () {
function onKeyDown(e) {
e.stopPropagation();
var closeKeyboardShortcutsPanel = this.props.closeKeyboardShortcutsPanel;
// Because the close button is the only focusable element inside of the panel, this
// amounts to a very basic focus trap. The user can exit the panel by "pressing" the
// close button or hitting escape
switch (e.key) {
case 'Enter':
case ' ':
case 'Spacebar': // for older browsers
case 'Escape':
closeKeyboardShortcutsPanel();
break;
// do nothing - this allows the up and down arrows continue their
// default behavior of scrolling the content of the Keyboard Shortcuts Panel
// which is needed when only a single month is shown for instance.
case 'ArrowUp':
case 'ArrowDown':
break;
// completely block the rest of the keys that have functionality outside of this panel
case 'Tab':
case 'Home':
case 'End':
case 'PageUp':
case 'PageDown':
case 'ArrowLeft':
case 'ArrowRight':
e.preventDefault();
break;
default:
break;
}
}
return onKeyDown;
}()
}, {
key: 'onShowKeyboardShortcutsButtonClick',
value: function () {
function onShowKeyboardShortcutsButtonClick() {
var _this2 = this;
var openKeyboardShortcutsPanel = this.props.openKeyboardShortcutsPanel;
// we want to return focus to this button after closing the keyboard shortcuts panel
openKeyboardShortcutsPanel(function () {
_this2.showKeyboardShortcutsButton.focus();
});
}
return onShowKeyboardShortcutsButtonClick;
}()
}, {
key: 'setShowKeyboardShortcutsButtonRef',
value: function () {
function setShowKeyboardShortcutsButtonRef(ref) {
this.showKeyboardShortcutsButton = ref;
}
return setShowKeyboardShortcutsButtonRef;
}()
}, {
key: 'setHideKeyboardShortcutsButtonRef',
value: function () {
function setHideKeyboardShortcutsButtonRef(ref) {
this.hideKeyboardShortcutsButton = ref;
}
return setHideKeyboardShortcutsButtonRef;
}()
}, {
key: 'handleFocus',
value: function () {
function handleFocus() {
if (this.hideKeyboardShortcutsButton) {
// automatically move focus into the dialog by moving
// to the only interactive element, the hide button
this.hideKeyboardShortcutsButton.focus();
}
}
return handleFocus;
}()
}, {
key: 'render',
value: function () {
function render() {
var _this3 = this;
var _props = this.props,
block = _props.block,
buttonLocation = _props.buttonLocation,
showKeyboardShortcutsPanel = _props.showKeyboardShortcutsPanel,
closeKeyboardShortcutsPanel = _props.closeKeyboardShortcutsPanel,
styles = _props.styles,
phrases = _props.phrases;
var toggleButtonText = showKeyboardShortcutsPanel ? phrases.hideKeyboardShortcutsPanel : phrases.showKeyboardShortcutsPanel;
var bottomRight = buttonLocation === BOTTOM_RIGHT;
var topRight = buttonLocation === TOP_RIGHT;
var topLeft = buttonLocation === TOP_LEFT;
return _react2['default'].createElement(
'div',
null,
_react2['default'].createElement(
'button',
_extends({
ref: this.setShowKeyboardShortcutsButtonRef
}, (0, _reactWithStyles.css)(styles.DayPickerKeyboardShortcuts_buttonReset, styles.DayPickerKeyboardShortcuts_show, bottomRight && styles.DayPickerKeyboardShortcuts_show__bottomRight, topRight && styles.DayPickerKeyboardShortcuts_show__topRight, topLeft && styles.DayPickerKeyboardShortcuts_show__topLeft), {
type: 'button',
'aria-label': toggleButtonText,
onClick: this.onShowKeyboardShortcutsButtonClick,
onKeyDown: function () {
function onKeyDown(e) {
if (e.key === 'Enter') {
e.preventDefault();
} else if (e.key === 'Space') {
_this3.onShowKeyboardShortcutsButtonClick(e);
}
}
return onKeyDown;
}(),
onMouseUp: function () {
function onMouseUp(e) {
e.currentTarget.blur();
}
return onMouseUp;
}()
}),
_react2['default'].createElement(
'span',
(0, _reactWithStyles.css)(styles.DayPickerKeyboardShortcuts_showSpan, bottomRight && styles.DayPickerKeyboardShortcuts_showSpan__bottomRight, topRight && styles.DayPickerKeyboardShortcuts_showSpan__topRight, topLeft && styles.DayPickerKeyboardShortcuts_showSpan__topLeft),
'?'
)
),
showKeyboardShortcutsPanel && _react2['default'].createElement(
'div',
_extends({}, (0, _reactWithStyles.css)(styles.DayPickerKeyboardShortcuts_panel), {
role: 'dialog',
'aria-labelledby': 'DayPickerKeyboardShortcuts_title',
'aria-describedby': 'DayPickerKeyboardShortcuts_description'
}),
_react2['default'].createElement(
'div',
_extends({}, (0, _reactWithStyles.css)(styles.DayPickerKeyboardShortcuts_title), {
id: 'DayPickerKeyboardShortcuts_title'
}),
phrases.keyboardShortcuts
),
_react2['default'].createElement(
'button',
_extends({
ref: this.setHideKeyboardShortcutsButtonRef
}, (0, _reactWithStyles.css)(styles.DayPickerKeyboardShortcuts_buttonReset, styles.DayPickerKeyboardShortcuts_close), {
type: 'button',
tabIndex: '0',
'aria-label': phrases.hideKeyboardShortcutsPanel,
onClick: closeKeyboardShortcutsPanel,
onKeyDown: this.onKeyDown
}),
_react2['default'].createElement(_CloseButton2['default'], (0, _reactWithStyles.css)(styles.DayPickerKeyboardShortcuts_closeSvg))
),
_react2['default'].createElement(
'ul',
_extends({}, (0, _reactWithStyles.css)(styles.DayPickerKeyboardShortcuts_list), {
id: 'DayPickerKeyboardShortcuts_description'
}),
this.keyboardShortcuts.map(function (_ref2) {
var unicode = _ref2.unicode,
label = _ref2.label,
action = _ref2.action;
return _react2['default'].createElement(_KeyboardShortcutRow2['default'], {
key: label,
unicode: unicode,
label: label,
action: action,
block: block
});
})
)
)
);
}
return render;
}()
}]);
return DayPickerKeyboardShortcuts;
}(_react2['default'].Component);
DayPickerKeyboardShortcuts.propTypes = propTypes;
DayPickerKeyboardShortcuts.defaultProps = defaultProps;
exports['default'] = (0, _reactWithStyles.withStyles)(function (_ref3) {
var _ref3$reactDates = _ref3.reactDates,
color = _ref3$reactDates.color,
font = _ref3$reactDates.font,
zIndex = _ref3$reactDates.zIndex;
return {
DayPickerKeyboardShortcuts_buttonReset: {
background: 'none',
border: 0,
borderRadius: 0,
color: 'inherit',
font: 'inherit',
lineHeight: 'normal',
overflow: 'visible',
padding: 0,
cursor: 'pointer',
fontSize: font.size,
':active': {
outline: 'none'
}
},
DayPickerKeyboardShortcuts_show: {
width: 22,
position: 'absolute',
zIndex: zIndex + 2
},
DayPickerKeyboardShortcuts_show__bottomRight: {
borderTop: '26px solid transparent',
borderRight: '33px solid ' + String(color.core.primary),
bottom: 0,
right: 0,
':hover': {
borderRight: '33px solid ' + String(color.core.primary_dark)
}
},
DayPickerKeyboardShortcuts_show__topRight: {
borderBottom: '26px solid transparent',
borderRight: '33px solid ' + String(color.core.primary),
top: 0,
right: 0,
':hover': {
borderRight: '33px solid ' + String(color.core.primary_dark)
}
},
DayPickerKeyboardShortcuts_show__topLeft: {
borderBottom: '26px solid transparent',
borderLeft: '33px solid ' + String(color.core.primary),
top: 0,
left: 0,
':hover': {
borderLeft: '33px solid ' + String(color.core.primary_dark)
}
},
DayPickerKeyboardShortcuts_showSpan: {
color: color.core.white,
position: 'absolute'
},
DayPickerKeyboardShortcuts_showSpan__bottomRight: {
bottom: 0,
right: -28
},
DayPickerKeyboardShortcuts_showSpan__topRight: {
top: 1,
right: -28
},
DayPickerKeyboardShortcuts_showSpan__topLeft: {
top: 1,
left: -28
},
DayPickerKeyboardShortcuts_panel: {
overflow: 'auto',
background: color.background,
border: '1px solid ' + String(color.core.border),
borderRadius: 2,
position: 'absolute',
top: 0,
bottom: 0,
right: 0,
left: 0,
zIndex: zIndex + 2,
padding: 22,
margin: 33
},
DayPickerKeyboardShortcuts_title: {
fontSize: 16,
fontWeight: 'bold',
margin: 0
},
DayPickerKeyboardShortcuts_list: {
listStyle: 'none',
padding: 0,
fontSize: font.size
},
DayPickerKeyboardShortcuts_close: {
position: 'absolute',
right: 22,
top: 22,
zIndex: zIndex + 2,
':active': {
outline: 'none'
}
},
DayPickerKeyboardShortcuts_closeSvg: {
height: 15,
width: 15,
fill: color.core.grayLighter,
':hover': {
fill: color.core.grayLight
},
':focus': {
fill: color.core.grayLight
}
}
};
})(DayPickerKeyboardShortcuts);
/***/ }),
/***/ "10Kj":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $TypeError = GetIntrinsic('%TypeError%');
var $SyntaxError = GetIntrinsic('%SyntaxError%');
var has = __webpack_require__("oNNP");
var predicates = {
// https://262.ecma-international.org/6.0/#sec-property-descriptor-specification-type
'Property Descriptor': function isPropertyDescriptor(Type, Desc) {
if (Type(Desc) !== 'Object') {
return false;
}
var allowed = {
'[[Configurable]]': true,
'[[Enumerable]]': true,
'[[Get]]': true,
'[[Set]]': true,
'[[Value]]': true,
'[[Writable]]': true
};
for (var key in Desc) { // eslint-disable-line
if (has(Desc, key) && !allowed[key]) {
return false;
}
}
var isData = has(Desc, '[[Value]]');
var IsAccessor = has(Desc, '[[Get]]') || has(Desc, '[[Set]]');
if (isData && IsAccessor) {
throw new $TypeError('Property Descriptors may not be both accessor and data descriptors');
}
return true;
}
};
module.exports = function assertRecord(Type, recordType, argumentName, value) {
var predicate = predicates[recordType];
if (typeof predicate !== 'function') {
throw new $SyntaxError('unknown record type: ' + recordType);
}
if (!predicate(Type, value)) {
throw new $TypeError(argumentName + ' must be a ' + recordType);
}
};
/***/ }),
/***/ "16Al":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ReactPropTypesSecret = __webpack_require__("WbBG");
function emptyFunction() {}
function emptyFunctionWithReset() {}
emptyFunctionWithReset.resetWarningCache = emptyFunction;
module.exports = function() {
function shim(props, propName, componentName, location, propFullName, secret) {
if (secret === ReactPropTypesSecret) {
// It is still safe when called from React.
return;
}
var err = new Error(
'Calling PropTypes validators directly is not supported by the `prop-types` package. ' +
'Use PropTypes.checkPropTypes() to call them. ' +
'Read more at http://fb.me/use-check-prop-types'
);
err.name = 'Invariant Violation';
throw err;
};
shim.isRequired = shim;
function getShim() {
return shim;
};
// Important!
// Keep this list in sync with production version in `./factoryWithTypeCheckers.js`.
var ReactPropTypes = {
array: shim,
bool: shim,
func: shim,
number: shim,
object: shim,
string: shim,
symbol: shim,
any: shim,
arrayOf: getShim,
element: shim,
elementType: shim,
instanceOf: getShim,
node: shim,
objectOf: getShim,
oneOf: getShim,
oneOfType: getShim,
shape: getShim,
exact: getShim,
checkPropTypes: emptyFunctionWithReset,
resetWarningCache: emptyFunction
};
ReactPropTypes.PropTypes = ReactPropTypes;
return ReactPropTypes;
};
/***/ }),
/***/ "17x9":
/***/ (function(module, exports, __webpack_require__) {
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
if (false) { var throwOnDirectAccess, ReactIs; } else {
// By explicitly using `prop-types` you are opting into new production behavior.
// http://fb.me/prop-types-in-prod
module.exports = __webpack_require__("16Al")();
}
/***/ }),
/***/ "1CF3":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["dom"]; }());
/***/ }),
/***/ "1KsK":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var toStr = Object.prototype.toString;
module.exports = function isArguments(value) {
var str = toStr.call(value);
var isArgs = str === '[object Arguments]';
if (!isArgs) {
isArgs = str !== '[object Array]' &&
value !== null &&
typeof value === 'object' &&
typeof value.length === 'number' &&
value.length >= 0 &&
toStr.call(value.callee) === '[object Function]';
}
return isArgs;
};
/***/ }),
/***/ "1LY1":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var bind = __webpack_require__("D3zA");
var GetIntrinsic = __webpack_require__("rZ7t");
var $apply = GetIntrinsic('%Function.prototype.apply%');
var $call = GetIntrinsic('%Function.prototype.call%');
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
var $max = GetIntrinsic('%Math.max%');
if ($defineProperty) {
try {
$defineProperty({}, 'a', { value: 1 });
} catch (e) {
// IE 8 has a broken defineProperty
$defineProperty = null;
}
}
module.exports = function callBind(originalFunction) {
var func = $reflectApply(bind, $call, arguments);
if ($gOPD && $defineProperty) {
var desc = $gOPD(func, 'length');
if (desc.configurable) {
// original length, plus the receiver, minus any additional arguments (after the receiver)
$defineProperty(
func,
'length',
{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
);
}
}
return func;
};
var applyBind = function applyBind() {
return $reflectApply(bind, $apply, arguments);
};
if ($defineProperty) {
$defineProperty(module.exports, 'apply', { value: applyBind });
} else {
module.exports.apply = applyBind;
}
/***/ }),
/***/ "1TsT":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "addEventListener", function() { return addEventListener; });
var CAN_USE_DOM = !!(typeof window !== 'undefined' && window.document && window.document.createElement);
// Adapted from Modernizr
// https://github.com/Modernizr/Modernizr/blob/acb3f0d9/feature-detects/dom/passiveeventlisteners.js#L26-L37
function testPassiveEventListeners() {
if (!CAN_USE_DOM) {
return false;
}
if (!window.addEventListener || !window.removeEventListener || !Object.defineProperty) {
return false;
}
var supportsPassiveOption = false;
try {
var opts = Object.defineProperty({}, 'passive', {
// eslint-disable-next-line getter-return
get: function () {
function get() {
supportsPassiveOption = true;
}
return get;
}()
});
var noop = function noop() {};
window.addEventListener('testPassiveEventSupport', noop, opts);
window.removeEventListener('testPassiveEventSupport', noop, opts);
} catch (e) {
// do nothing
}
return supportsPassiveOption;
}
var memoized = void 0;
function canUsePassiveEventListeners() {
if (memoized === undefined) {
memoized = testPassiveEventListeners();
}
return memoized;
}
function normalizeEventOptions(eventOptions) {
if (!eventOptions) {
return undefined;
}
if (!canUsePassiveEventListeners()) {
// If the browser does not support the passive option, then it is expecting
// a boolean for the options argument to specify whether it should use
// capture or not. In more modern browsers, this is passed via the `capture`
// option, so let's just hoist that value up.
return !!eventOptions.capture;
}
return eventOptions;
}
/* eslint-disable no-bitwise */
/**
* Generate a unique key for any set of event options
*/
function eventOptionsKey(normalizedEventOptions) {
if (!normalizedEventOptions) {
return 0;
}
// If the browser does not support passive event listeners, the normalized
// event options will be a boolean.
if (normalizedEventOptions === true) {
return 100;
}
// At this point, the browser supports passive event listeners, so we expect
// the event options to be an object with possible properties of capture,
// passive, and once.
//
// We want to consistently return the same value, regardless of the order of
// these properties, so let's use binary maths to assign each property to a
// bit, and then add those together (with an offset to account for the
// booleans at the beginning of this function).
var capture = normalizedEventOptions.capture << 0;
var passive = normalizedEventOptions.passive << 1;
var once = normalizedEventOptions.once << 2;
return capture + passive + once;
}
function ensureCanMutateNextEventHandlers(eventHandlers) {
if (eventHandlers.handlers === eventHandlers.nextHandlers) {
// eslint-disable-next-line no-param-reassign
eventHandlers.nextHandlers = eventHandlers.handlers.slice();
}
}
function TargetEventHandlers(target) {
this.target = target;
this.events = {};
}
TargetEventHandlers.prototype.getEventHandlers = function () {
function getEventHandlers(eventName, options) {
var key = String(eventName) + ' ' + String(eventOptionsKey(options));
if (!this.events[key]) {
this.events[key] = {
handlers: [],
handleEvent: undefined
};
this.events[key].nextHandlers = this.events[key].handlers;
}
return this.events[key];
}
return getEventHandlers;
}();
TargetEventHandlers.prototype.handleEvent = function () {
function handleEvent(eventName, options, event) {
var eventHandlers = this.getEventHandlers(eventName, options);
eventHandlers.handlers = eventHandlers.nextHandlers;
eventHandlers.handlers.forEach(function (handler) {
if (handler) {
// We need to check for presence here because a handler function may
// cause later handlers to get removed. This can happen if you for
// instance have a waypoint that unmounts another waypoint as part of an
// onEnter/onLeave handler.
handler(event);
}
});
}
return handleEvent;
}();
TargetEventHandlers.prototype.add = function () {
function add(eventName, listener, options) {
var _this = this;
// options has already been normalized at this point.
var eventHandlers = this.getEventHandlers(eventName, options);
ensureCanMutateNextEventHandlers(eventHandlers);
if (eventHandlers.nextHandlers.length === 0) {
eventHandlers.handleEvent = this.handleEvent.bind(this, eventName, options);
this.target.addEventListener(eventName, eventHandlers.handleEvent, options);
}
eventHandlers.nextHandlers.push(listener);
var isSubscribed = true;
var unsubscribe = function () {
function unsubscribe() {
if (!isSubscribed) {
return;
}
isSubscribed = false;
ensureCanMutateNextEventHandlers(eventHandlers);
var index = eventHandlers.nextHandlers.indexOf(listener);
eventHandlers.nextHandlers.splice(index, 1);
if (eventHandlers.nextHandlers.length === 0) {
// All event handlers have been removed, so we want to remove the event
// listener from the target node.
if (_this.target) {
// There can be a race condition where the target may no longer exist
// when this function is called, e.g. when a React component is
// unmounting. Guarding against this prevents the following error:
//
// Cannot read property 'removeEventListener' of undefined
_this.target.removeEventListener(eventName, eventHandlers.handleEvent, options);
}
eventHandlers.handleEvent = undefined;
}
}
return unsubscribe;
}();
return unsubscribe;
}
return add;
}();
var EVENT_HANDLERS_KEY = '__consolidated_events_handlers__';
// eslint-disable-next-line import/prefer-default-export
function addEventListener(target, eventName, listener, options) {
if (!target[EVENT_HANDLERS_KEY]) {
// eslint-disable-next-line no-param-reassign
target[EVENT_HANDLERS_KEY] = new TargetEventHandlers(target);
}
var normalizedEventOptions = normalizeEventOptions(options);
return target[EVENT_HANDLERS_KEY].add(eventName, listener, normalizedEventOptions);
}
/***/ }),
/***/ "1iEr":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const chevronRight = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M10.6 6L9.4 7l4.6 5-4.6 5 1.2 1 5.4-6z"
}));
/* harmony default export */ __webpack_exports__["a"] = (chevronRight);
/***/ }),
/***/ "1seS":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var slice = Array.prototype.slice;
var isArgs = __webpack_require__("1KsK");
var origKeys = Object.keys;
var keysShim = origKeys ? function keys(o) { return origKeys(o); } : __webpack_require__("sYn3");
var originalKeys = Object.keys;
keysShim.shim = function shimObjectKeys() {
if (Object.keys) {
var keysWorksWithArguments = (function () {
// Safari 5.0 bug
var args = Object.keys(arguments);
return args && args.length === arguments.length;
}(1, 2));
if (!keysWorksWithArguments) {
Object.keys = function keys(object) { // eslint-disable-line func-name-matching
if (isArgs(object)) {
return originalKeys(slice.call(object));
}
return originalKeys(object);
};
}
} else {
Object.keys = keysShim;
}
return Object.keys || keysShim;
};
module.exports = keysShim;
/***/ }),
/***/ "22yB":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var implementation = __webpack_require__("yN6O");
module.exports = function getPolyfill() {
return Array.prototype.flat || implementation;
};
/***/ }),
/***/ "25kQ":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = __webpack_require__("aUaa");
/***/ }),
/***/ "2Q00":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = CalendarWeek;
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
var _airbnbPropTypes = __webpack_require__("Hsqg");
var _CalendarDay = __webpack_require__("N3k4");
var _CalendarDay2 = _interopRequireDefault(_CalendarDay);
var _CustomizableCalendarDay = __webpack_require__("GET3");
var _CustomizableCalendarDay2 = _interopRequireDefault(_CustomizableCalendarDay);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var propTypes = (0, _airbnbPropTypes.forbidExtraProps)({
children: (0, _airbnbPropTypes.or)([(0, _airbnbPropTypes.childrenOfType)(_CalendarDay2['default']), (0, _airbnbPropTypes.childrenOfType)(_CustomizableCalendarDay2['default'])]).isRequired
});
function CalendarWeek(_ref) {
var children = _ref.children;
return _react2['default'].createElement(
'tr',
null,
children
);
}
CalendarWeek.propTypes = propTypes;
/***/ }),
/***/ "2S2E":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _constants = __webpack_require__("Fv1B");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
exports['default'] = _propTypes2['default'].oneOf(_constants.WEEKDAYS);
/***/ }),
/***/ "2gm7":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const chevronLeft = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M14.6 7l-1.2-1L8 12l5.4 6 1.2-1-4.6-5z"
}));
/* harmony default export */ __webpack_exports__["a"] = (chevronLeft);
/***/ }),
/***/ "2mql":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var reactIs = __webpack_require__("TOwV");
/**
* Copyright 2015, Yahoo! Inc.
* Copyrights licensed under the New BSD License. See the accompanying LICENSE file for terms.
*/
var REACT_STATICS = {
childContextTypes: true,
contextType: true,
contextTypes: true,
defaultProps: true,
displayName: true,
getDefaultProps: true,
getDerivedStateFromError: true,
getDerivedStateFromProps: true,
mixins: true,
propTypes: true,
type: true
};
var KNOWN_STATICS = {
name: true,
length: true,
prototype: true,
caller: true,
callee: true,
arguments: true,
arity: true
};
var FORWARD_REF_STATICS = {
'$$typeof': true,
render: true,
defaultProps: true,
displayName: true,
propTypes: true
};
var MEMO_STATICS = {
'$$typeof': true,
compare: true,
defaultProps: true,
displayName: true,
propTypes: true,
type: true
};
var TYPE_STATICS = {};
TYPE_STATICS[reactIs.ForwardRef] = FORWARD_REF_STATICS;
TYPE_STATICS[reactIs.Memo] = MEMO_STATICS;
function getStatics(component) {
// React v16.11 and below
if (reactIs.isMemo(component)) {
return MEMO_STATICS;
} // React v16.12 and above
return TYPE_STATICS[component['$$typeof']] || REACT_STATICS;
}
var defineProperty = Object.defineProperty;
var getOwnPropertyNames = Object.getOwnPropertyNames;
var getOwnPropertySymbols = Object.getOwnPropertySymbols;
var getOwnPropertyDescriptor = Object.getOwnPropertyDescriptor;
var getPrototypeOf = Object.getPrototypeOf;
var objectPrototype = Object.prototype;
function hoistNonReactStatics(targetComponent, sourceComponent, blacklist) {
if (typeof sourceComponent !== 'string') {
// don't hoist over string (html) components
if (objectPrototype) {
var inheritedComponent = getPrototypeOf(sourceComponent);
if (inheritedComponent && inheritedComponent !== objectPrototype) {
hoistNonReactStatics(targetComponent, inheritedComponent, blacklist);
}
}
var keys = getOwnPropertyNames(sourceComponent);
if (getOwnPropertySymbols) {
keys = keys.concat(getOwnPropertySymbols(sourceComponent));
}
var targetStatics = getStatics(targetComponent);
var sourceStatics = getStatics(sourceComponent);
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
if (!KNOWN_STATICS[key] && !(blacklist && blacklist[key]) && !(sourceStatics && sourceStatics[key]) && !(targetStatics && targetStatics[key])) {
var descriptor = getOwnPropertyDescriptor(sourceComponent, key);
try {
// Avoid failures from read-only properties
defineProperty(targetComponent, key, descriptor);
} catch (e) {}
}
}
}
return targetComponent;
}
module.exports = hoistNonReactStatics;
/***/ }),
/***/ "3HjQ":
/***/ (function(module, exports) {
Object.defineProperty(exports, "__esModule", {
value: true
});
// This function takes an array of styles and separates them into styles that
// are handled by Aphrodite and inline styles.
function separateStyles(stylesArray) {
var classNames = [];
// Since determining if an Object is empty requires collecting all of its
// keys, and we want the best performance in this code because we are in the
// render path, we are going to do a little bookkeeping ourselves.
var hasInlineStyles = false;
var inlineStyles = {};
// This is run on potentially every node in the tree when rendering, where
// performance is critical. Normally we would prefer using `forEach`, but
// old-fashioned for loops are faster so that's what we have chosen here.
for (var i = 0; i < stylesArray.length; i++) {
// eslint-disable-line no-plusplus
var style = stylesArray[i];
// If this style is falsy, we just want to disregard it. This allows for
// syntax like:
//
// css(isFoo && styles.foo)
if (style) {
if (typeof style === 'string') {
classNames.push(style);
} else {
Object.assign(inlineStyles, style);
hasInlineStyles = true;
}
}
}
return {
classNames: classNames,
hasInlineStyles: hasInlineStyles,
inlineStyles: inlineStyles
};
}
exports['default'] = separateStyles;
/***/ }),
/***/ "3aeR":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $TypeError = GetIntrinsic('%TypeError%');
var inspect = __webpack_require__("4qvr");
var IsPropertyKey = __webpack_require__("i10q");
var Type = __webpack_require__("V1cy");
/**
* 7.3.1 Get (O, P) - https://ecma-international.org/ecma-262/6.0/#sec-get-o-p
* 1. Assert: Type(O) is Object.
* 2. Assert: IsPropertyKey(P) is true.
* 3. Return O.[[Get]](P, O).
*/
module.exports = function Get(O, P) {
// 7.3.1.1
if (Type(O) !== 'Object') {
throw new $TypeError('Assertion failed: Type(O) is not Object');
}
// 7.3.1.2
if (!IsPropertyKey(P)) {
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true, got ' + inspect(P));
}
// 7.3.1.3
return O[P];
};
/***/ }),
/***/ "3gBW":
/***/ (function(module, exports, __webpack_require__) {
// eslint-disable-next-line import/no-unresolved
module.exports = __webpack_require__("50qU");
/***/ }),
/***/ "4HRn":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// var modulo = require('./modulo');
var $floor = Math.floor;
// http://262.ecma-international.org/5.1/#sec-5.2
module.exports = function floor(x) {
// return x - modulo(x, 1);
return $floor(x);
};
/***/ }),
/***/ "4cSd":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var define = __webpack_require__("82c2");
var callBind = __webpack_require__("PrET");
var implementation = __webpack_require__("rQy3");
var getPolyfill = __webpack_require__("xoj2");
var shim = __webpack_require__("ib7Q");
var polyfill = callBind(getPolyfill(), Object);
define(polyfill, {
getPolyfill: getPolyfill,
implementation: implementation,
shim: shim
});
module.exports = polyfill;
/***/ }),
/***/ "4eJC":
/***/ (function(module, exports, __webpack_require__) {
/**
* Memize options object.
*
* @typedef MemizeOptions
*
* @property {number} [maxSize] Maximum size of the cache.
*/
/**
* Internal cache entry.
*
* @typedef MemizeCacheNode
*
* @property {?MemizeCacheNode|undefined} [prev] Previous node.
* @property {?MemizeCacheNode|undefined} [next] Next node.
* @property {Array<*>} args Function arguments for cache
* entry.
* @property {*} val Function result.
*/
/**
* Properties of the enhanced function for controlling cache.
*
* @typedef MemizeMemoizedFunction
*
* @property {()=>void} clear Clear the cache.
*/
/**
* Accepts a function to be memoized, and returns a new memoized function, with
* optional options.
*
* @template {Function} F
*
* @param {F} fn Function to memoize.
* @param {MemizeOptions} [options] Options object.
*
* @return {F & MemizeMemoizedFunction} Memoized function.
*/
function memize( fn, options ) {
var size = 0;
/** @type {?MemizeCacheNode|undefined} */
var head;
/** @type {?MemizeCacheNode|undefined} */
var tail;
options = options || {};
function memoized( /* ...args */ ) {
var node = head,
len = arguments.length,
args, i;
searchCache: while ( node ) {
// Perform a shallow equality test to confirm that whether the node
// under test is a candidate for the arguments passed. Two arrays
// are shallowly equal if their length matches and each entry is
// strictly equal between the two sets. Avoid abstracting to a
// function which could incur an arguments leaking deoptimization.
// Check whether node arguments match arguments length
if ( node.args.length !== arguments.length ) {
node = node.next;
continue;
}
// Check whether node arguments match arguments values
for ( i = 0; i < len; i++ ) {
if ( node.args[ i ] !== arguments[ i ] ) {
node = node.next;
continue searchCache;
}
}
// At this point we can assume we've found a match
// Surface matched node to head if not already
if ( node !== head ) {
// As tail, shift to previous. Must only shift if not also
// head, since if both head and tail, there is no previous.
if ( node === tail ) {
tail = node.prev;
}
// Adjust siblings to point to each other. If node was tail,
// this also handles new tail's empty `next` assignment.
/** @type {MemizeCacheNode} */ ( node.prev ).next = node.next;
if ( node.next ) {
node.next.prev = node.prev;
}
node.next = head;
node.prev = null;
/** @type {MemizeCacheNode} */ ( head ).prev = node;
head = node;
}
// Return immediately
return node.val;
}
// No cached value found. Continue to insertion phase:
// Create a copy of arguments (avoid leaking deoptimization)
args = new Array( len );
for ( i = 0; i < len; i++ ) {
args[ i ] = arguments[ i ];
}
node = {
args: args,
// Generate the result from original function
val: fn.apply( null, args ),
};
// Don't need to check whether node is already head, since it would
// have been returned above already if it was
// Shift existing head down list
if ( head ) {
head.prev = node;
node.next = head;
} else {
// If no head, follows that there's no tail (at initial or reset)
tail = node;
}
// Trim tail if we're reached max size and are pending cache insertion
if ( size === /** @type {MemizeOptions} */ ( options ).maxSize ) {
tail = /** @type {MemizeCacheNode} */ ( tail ).prev;
/** @type {MemizeCacheNode} */ ( tail ).next = null;
} else {
size++;
}
head = node;
return node.val;
}
memoized.clear = function() {
head = null;
tail = null;
size = 0;
};
if ( false ) {}
// Ignore reason: There's not a clear solution to create an intersection of
// the function with additional properties, where the goal is to retain the
// function signature of the incoming argument and add control properties
// on the return value.
// @ts-ignore
return memoized;
}
module.exports = memize;
/***/ }),
/***/ "4po3":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isTextField; });
/**
* Check whether the given element is a text field, where text field is defined
* by the ability to select within the input, or that it is contenteditable.
*
* @example
* import { isTextField } from "reakit-utils";
*
* isTextField(document.querySelector("div")); // false
* isTextField(document.querySelector("input")); // true
* isTextField(document.querySelector("input[type='button']")); // false
* isTextField(document.querySelector("textarea")); // true
* isTextField(document.querySelector("div[contenteditable='true']")); // true
*/
function isTextField(element) {
try {
var isTextInput = element instanceof HTMLInputElement && element.selectionStart !== null;
var isTextArea = element.tagName === "TEXTAREA";
var isContentEditable = element.contentEditable === "true";
return isTextInput || isTextArea || isContentEditable || false;
} catch (error) {
// Safari throws an exception when trying to get `selectionStart`
// on non-text <input> elements (which, understandably, don't
// have the text selection API). We catch this via a try/catch
// block, as opposed to a more explicit check of the element's
// input types, because of Safari's non-standard behavior. This
// also means we don't have to worry about the list of input
// types that support `selectionStart` changing as the HTML spec
// evolves over time.
return false;
}
}
/***/ }),
/***/ "4qRI":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
function memoize(fn) {
var cache = {};
return function (arg) {
if (cache[arg] === undefined) cache[arg] = fn(arg);
return cache[arg];
};
}
/* harmony default export */ __webpack_exports__["a"] = (memoize);
/***/ }),
/***/ "4qvr":
/***/ (function(module, exports, __webpack_require__) {
var hasMap = typeof Map === 'function' && Map.prototype;
var mapSizeDescriptor = Object.getOwnPropertyDescriptor && hasMap ? Object.getOwnPropertyDescriptor(Map.prototype, 'size') : null;
var mapSize = hasMap && mapSizeDescriptor && typeof mapSizeDescriptor.get === 'function' ? mapSizeDescriptor.get : null;
var mapForEach = hasMap && Map.prototype.forEach;
var hasSet = typeof Set === 'function' && Set.prototype;
var setSizeDescriptor = Object.getOwnPropertyDescriptor && hasSet ? Object.getOwnPropertyDescriptor(Set.prototype, 'size') : null;
var setSize = hasSet && setSizeDescriptor && typeof setSizeDescriptor.get === 'function' ? setSizeDescriptor.get : null;
var setForEach = hasSet && Set.prototype.forEach;
var hasWeakMap = typeof WeakMap === 'function' && WeakMap.prototype;
var weakMapHas = hasWeakMap ? WeakMap.prototype.has : null;
var hasWeakSet = typeof WeakSet === 'function' && WeakSet.prototype;
var weakSetHas = hasWeakSet ? WeakSet.prototype.has : null;
var hasWeakRef = typeof WeakRef === 'function' && WeakRef.prototype;
var weakRefDeref = hasWeakRef ? WeakRef.prototype.deref : null;
var booleanValueOf = Boolean.prototype.valueOf;
var objectToString = Object.prototype.toString;
var functionToString = Function.prototype.toString;
var match = String.prototype.match;
var bigIntValueOf = typeof BigInt === 'function' ? BigInt.prototype.valueOf : null;
var gOPS = Object.getOwnPropertySymbols;
var symToString = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol' ? Symbol.prototype.toString : null;
var hasShammedSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'object';
var isEnumerable = Object.prototype.propertyIsEnumerable;
var gPO = (typeof Reflect === 'function' ? Reflect.getPrototypeOf : Object.getPrototypeOf) || (
[].__proto__ === Array.prototype // eslint-disable-line no-proto
? function (O) {
return O.__proto__; // eslint-disable-line no-proto
}
: null
);
var inspectCustom = __webpack_require__(0).custom;
var inspectSymbol = inspectCustom && isSymbol(inspectCustom) ? inspectCustom : null;
var toStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag !== 'undefined' ? Symbol.toStringTag : null;
module.exports = function inspect_(obj, options, depth, seen) {
var opts = options || {};
if (has(opts, 'quoteStyle') && (opts.quoteStyle !== 'single' && opts.quoteStyle !== 'double')) {
throw new TypeError('option "quoteStyle" must be "single" or "double"');
}
if (
has(opts, 'maxStringLength') && (typeof opts.maxStringLength === 'number'
? opts.maxStringLength < 0 && opts.maxStringLength !== Infinity
: opts.maxStringLength !== null
)
) {
throw new TypeError('option "maxStringLength", if provided, must be a positive integer, Infinity, or `null`');
}
var customInspect = has(opts, 'customInspect') ? opts.customInspect : true;
if (typeof customInspect !== 'boolean') {
throw new TypeError('option "customInspect", if provided, must be `true` or `false`');
}
if (
has(opts, 'indent')
&& opts.indent !== null
&& opts.indent !== '\t'
&& !(parseInt(opts.indent, 10) === opts.indent && opts.indent > 0)
) {
throw new TypeError('options "indent" must be "\\t", an integer > 0, or `null`');
}
if (typeof obj === 'undefined') {
return 'undefined';
}
if (obj === null) {
return 'null';
}
if (typeof obj === 'boolean') {
return obj ? 'true' : 'false';
}
if (typeof obj === 'string') {
return inspectString(obj, opts);
}
if (typeof obj === 'number') {
if (obj === 0) {
return Infinity / obj > 0 ? '0' : '-0';
}
return String(obj);
}
if (typeof obj === 'bigint') {
return String(obj) + 'n';
}
var maxDepth = typeof opts.depth === 'undefined' ? 5 : opts.depth;
if (typeof depth === 'undefined') { depth = 0; }
if (depth >= maxDepth && maxDepth > 0 && typeof obj === 'object') {
return isArray(obj) ? '[Array]' : '[Object]';
}
var indent = getIndent(opts, depth);
if (typeof seen === 'undefined') {
seen = [];
} else if (indexOf(seen, obj) >= 0) {
return '[Circular]';
}
function inspect(value, from, noIndent) {
if (from) {
seen = seen.slice();
seen.push(from);
}
if (noIndent) {
var newOpts = {
depth: opts.depth
};
if (has(opts, 'quoteStyle')) {
newOpts.quoteStyle = opts.quoteStyle;
}
return inspect_(value, newOpts, depth + 1, seen);
}
return inspect_(value, opts, depth + 1, seen);
}
if (typeof obj === 'function') {
var name = nameOf(obj);
var keys = arrObjKeys(obj, inspect);
return '[Function' + (name ? ': ' + name : ' (anonymous)') + ']' + (keys.length > 0 ? ' { ' + keys.join(', ') + ' }' : '');
}
if (isSymbol(obj)) {
var symString = hasShammedSymbols ? String(obj).replace(/^(Symbol\(.*\))_[^)]*$/, '$1') : symToString.call(obj);
return typeof obj === 'object' && !hasShammedSymbols ? markBoxed(symString) : symString;
}
if (isElement(obj)) {
var s = '<' + String(obj.nodeName).toLowerCase();
var attrs = obj.attributes || [];
for (var i = 0; i < attrs.length; i++) {
s += ' ' + attrs[i].name + '=' + wrapQuotes(quote(attrs[i].value), 'double', opts);
}
s += '>';
if (obj.childNodes && obj.childNodes.length) { s += '...'; }
s += '</' + String(obj.nodeName).toLowerCase() + '>';
return s;
}
if (isArray(obj)) {
if (obj.length === 0) { return '[]'; }
var xs = arrObjKeys(obj, inspect);
if (indent && !singleLineValues(xs)) {
return '[' + indentedJoin(xs, indent) + ']';
}
return '[ ' + xs.join(', ') + ' ]';
}
if (isError(obj)) {
var parts = arrObjKeys(obj, inspect);
if (parts.length === 0) { return '[' + String(obj) + ']'; }
return '{ [' + String(obj) + '] ' + parts.join(', ') + ' }';
}
if (typeof obj === 'object' && customInspect) {
if (inspectSymbol && typeof obj[inspectSymbol] === 'function') {
return obj[inspectSymbol]();
} else if (typeof obj.inspect === 'function') {
return obj.inspect();
}
}
if (isMap(obj)) {
var mapParts = [];
mapForEach.call(obj, function (value, key) {
mapParts.push(inspect(key, obj, true) + ' => ' + inspect(value, obj));
});
return collectionOf('Map', mapSize.call(obj), mapParts, indent);
}
if (isSet(obj)) {
var setParts = [];
setForEach.call(obj, function (value) {
setParts.push(inspect(value, obj));
});
return collectionOf('Set', setSize.call(obj), setParts, indent);
}
if (isWeakMap(obj)) {
return weakCollectionOf('WeakMap');
}
if (isWeakSet(obj)) {
return weakCollectionOf('WeakSet');
}
if (isWeakRef(obj)) {
return weakCollectionOf('WeakRef');
}
if (isNumber(obj)) {
return markBoxed(inspect(Number(obj)));
}
if (isBigInt(obj)) {
return markBoxed(inspect(bigIntValueOf.call(obj)));
}
if (isBoolean(obj)) {
return markBoxed(booleanValueOf.call(obj));
}
if (isString(obj)) {
return markBoxed(inspect(String(obj)));
}
if (!isDate(obj) && !isRegExp(obj)) {
var ys = arrObjKeys(obj, inspect);
var isPlainObject = gPO ? gPO(obj) === Object.prototype : obj instanceof Object || obj.constructor === Object;
var protoTag = obj instanceof Object ? '' : 'null prototype';
var stringTag = !isPlainObject && toStringTag && Object(obj) === obj && toStringTag in obj ? toStr(obj).slice(8, -1) : protoTag ? 'Object' : '';
var constructorTag = isPlainObject || typeof obj.constructor !== 'function' ? '' : obj.constructor.name ? obj.constructor.name + ' ' : '';
var tag = constructorTag + (stringTag || protoTag ? '[' + [].concat(stringTag || [], protoTag || []).join(': ') + '] ' : '');
if (ys.length === 0) { return tag + '{}'; }
if (indent) {
return tag + '{' + indentedJoin(ys, indent) + '}';
}
return tag + '{ ' + ys.join(', ') + ' }';
}
return String(obj);
};
function wrapQuotes(s, defaultStyle, opts) {
var quoteChar = (opts.quoteStyle || defaultStyle) === 'double' ? '"' : "'";
return quoteChar + s + quoteChar;
}
function quote(s) {
return String(s).replace(/"/g, '&quot;');
}
function isArray(obj) { return toStr(obj) === '[object Array]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
function isDate(obj) { return toStr(obj) === '[object Date]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
function isRegExp(obj) { return toStr(obj) === '[object RegExp]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
function isError(obj) { return toStr(obj) === '[object Error]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
function isString(obj) { return toStr(obj) === '[object String]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
function isNumber(obj) { return toStr(obj) === '[object Number]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
function isBoolean(obj) { return toStr(obj) === '[object Boolean]' && (!toStringTag || !(typeof obj === 'object' && toStringTag in obj)); }
// Symbol and BigInt do have Symbol.toStringTag by spec, so that can't be used to eliminate false positives
function isSymbol(obj) {
if (hasShammedSymbols) {
return obj && typeof obj === 'object' && obj instanceof Symbol;
}
if (typeof obj === 'symbol') {
return true;
}
if (!obj || typeof obj !== 'object' || !symToString) {
return false;
}
try {
symToString.call(obj);
return true;
} catch (e) {}
return false;
}
function isBigInt(obj) {
if (!obj || typeof obj !== 'object' || !bigIntValueOf) {
return false;
}
try {
bigIntValueOf.call(obj);
return true;
} catch (e) {}
return false;
}
var hasOwn = Object.prototype.hasOwnProperty || function (key) { return key in this; };
function has(obj, key) {
return hasOwn.call(obj, key);
}
function toStr(obj) {
return objectToString.call(obj);
}
function nameOf(f) {
if (f.name) { return f.name; }
var m = match.call(functionToString.call(f), /^function\s*([\w$]+)/);
if (m) { return m[1]; }
return null;
}
function indexOf(xs, x) {
if (xs.indexOf) { return xs.indexOf(x); }
for (var i = 0, l = xs.length; i < l; i++) {
if (xs[i] === x) { return i; }
}
return -1;
}
function isMap(x) {
if (!mapSize || !x || typeof x !== 'object') {
return false;
}
try {
mapSize.call(x);
try {
setSize.call(x);
} catch (s) {
return true;
}
return x instanceof Map; // core-js workaround, pre-v2.5.0
} catch (e) {}
return false;
}
function isWeakMap(x) {
if (!weakMapHas || !x || typeof x !== 'object') {
return false;
}
try {
weakMapHas.call(x, weakMapHas);
try {
weakSetHas.call(x, weakSetHas);
} catch (s) {
return true;
}
return x instanceof WeakMap; // core-js workaround, pre-v2.5.0
} catch (e) {}
return false;
}
function isWeakRef(x) {
if (!weakRefDeref || !x || typeof x !== 'object') {
return false;
}
try {
weakRefDeref.call(x);
return true;
} catch (e) {}
return false;
}
function isSet(x) {
if (!setSize || !x || typeof x !== 'object') {
return false;
}
try {
setSize.call(x);
try {
mapSize.call(x);
} catch (m) {
return true;
}
return x instanceof Set; // core-js workaround, pre-v2.5.0
} catch (e) {}
return false;
}
function isWeakSet(x) {
if (!weakSetHas || !x || typeof x !== 'object') {
return false;
}
try {
weakSetHas.call(x, weakSetHas);
try {
weakMapHas.call(x, weakMapHas);
} catch (s) {
return true;
}
return x instanceof WeakSet; // core-js workaround, pre-v2.5.0
} catch (e) {}
return false;
}
function isElement(x) {
if (!x || typeof x !== 'object') { return false; }
if (typeof HTMLElement !== 'undefined' && x instanceof HTMLElement) {
return true;
}
return typeof x.nodeName === 'string' && typeof x.getAttribute === 'function';
}
function inspectString(str, opts) {
if (str.length > opts.maxStringLength) {
var remaining = str.length - opts.maxStringLength;
var trailer = '... ' + remaining + ' more character' + (remaining > 1 ? 's' : '');
return inspectString(str.slice(0, opts.maxStringLength), opts) + trailer;
}
// eslint-disable-next-line no-control-regex
var s = str.replace(/(['\\])/g, '\\$1').replace(/[\x00-\x1f]/g, lowbyte);
return wrapQuotes(s, 'single', opts);
}
function lowbyte(c) {
var n = c.charCodeAt(0);
var x = {
8: 'b',
9: 't',
10: 'n',
12: 'f',
13: 'r'
}[n];
if (x) { return '\\' + x; }
return '\\x' + (n < 0x10 ? '0' : '') + n.toString(16).toUpperCase();
}
function markBoxed(str) {
return 'Object(' + str + ')';
}
function weakCollectionOf(type) {
return type + ' { ? }';
}
function collectionOf(type, size, entries, indent) {
var joinedEntries = indent ? indentedJoin(entries, indent) : entries.join(', ');
return type + ' (' + size + ') {' + joinedEntries + '}';
}
function singleLineValues(xs) {
for (var i = 0; i < xs.length; i++) {
if (indexOf(xs[i], '\n') >= 0) {
return false;
}
}
return true;
}
function getIndent(opts, depth) {
var baseIndent;
if (opts.indent === '\t') {
baseIndent = '\t';
} else if (typeof opts.indent === 'number' && opts.indent > 0) {
baseIndent = Array(opts.indent + 1).join(' ');
} else {
return null;
}
return {
base: baseIndent,
prev: Array(depth + 1).join(baseIndent)
};
}
function indentedJoin(xs, indent) {
if (xs.length === 0) { return ''; }
var lineJoiner = '\n' + indent.prev + indent.base;
return lineJoiner + xs.join(',' + lineJoiner) + '\n' + indent.prev;
}
function arrObjKeys(obj, inspect) {
var isArr = isArray(obj);
var xs = [];
if (isArr) {
xs.length = obj.length;
for (var i = 0; i < obj.length; i++) {
xs[i] = has(obj, i) ? inspect(obj[i], obj) : '';
}
}
var syms = typeof gOPS === 'function' ? gOPS(obj) : [];
var symMap;
if (hasShammedSymbols) {
symMap = {};
for (var k = 0; k < syms.length; k++) {
symMap['$' + syms[k]] = syms[k];
}
}
for (var key in obj) { // eslint-disable-line no-restricted-syntax
if (!has(obj, key)) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
if (isArr && String(Number(key)) === key && key < obj.length) { continue; } // eslint-disable-line no-restricted-syntax, no-continue
if (hasShammedSymbols && symMap['$' + key] instanceof Symbol) {
// this is to prevent shammed Symbols, which are stored as strings, from being included in the string key section
continue; // eslint-disable-line no-restricted-syntax, no-continue
} else if ((/[^\w$]/).test(key)) {
xs.push(inspect(key, obj) + ': ' + inspect(obj[key], obj));
} else {
xs.push(key + ': ' + inspect(obj[key], obj));
}
}
if (typeof gOPS === 'function') {
for (var j = 0; j < syms.length; j++) {
if (isEnumerable.call(obj, syms[j])) {
xs.push('[' + inspect(syms[j]) + ']: ' + inspect(obj[syms[j]], obj));
}
}
}
return xs;
}
/***/ }),
/***/ "50qU":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _airbnbPropTypes = __webpack_require__("Hsqg");
var _consolidatedEvents = __webpack_require__("1TsT");
var _object = __webpack_require__("4cSd");
var _object2 = _interopRequireDefault(_object);
var _document = __webpack_require__("n1Y7");
var _document2 = _interopRequireDefault(_document);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var DISPLAY = {
BLOCK: 'block',
FLEX: 'flex',
INLINE: 'inline',
INLINE_BLOCK: 'inline-block',
CONTENTS: 'contents'
};
var propTypes = (0, _airbnbPropTypes.forbidExtraProps)({
children: _propTypes2['default'].node.isRequired,
onOutsideClick: _propTypes2['default'].func.isRequired,
disabled: _propTypes2['default'].bool,
useCapture: _propTypes2['default'].bool,
display: _propTypes2['default'].oneOf((0, _object2['default'])(DISPLAY))
});
var defaultProps = {
disabled: false,
// `useCapture` is set to true by default so that a `stopPropagation` in the
// children will not prevent all outside click handlers from firing - maja
useCapture: true,
display: DISPLAY.BLOCK
};
var OutsideClickHandler = function (_React$Component) {
_inherits(OutsideClickHandler, _React$Component);
function OutsideClickHandler() {
var _ref;
_classCallCheck(this, OutsideClickHandler);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var _this = _possibleConstructorReturn(this, (_ref = OutsideClickHandler.__proto__ || Object.getPrototypeOf(OutsideClickHandler)).call.apply(_ref, [this].concat(args)));
_this.onMouseDown = _this.onMouseDown.bind(_this);
_this.onMouseUp = _this.onMouseUp.bind(_this);
_this.setChildNodeRef = _this.setChildNodeRef.bind(_this);
return _this;
}
_createClass(OutsideClickHandler, [{
key: 'componentDidMount',
value: function () {
function componentDidMount() {
var _props = this.props,
disabled = _props.disabled,
useCapture = _props.useCapture;
if (!disabled) this.addMouseDownEventListener(useCapture);
}
return componentDidMount;
}()
}, {
key: 'componentDidUpdate',
value: function () {
function componentDidUpdate(_ref2) {
var prevDisabled = _ref2.disabled;
var _props2 = this.props,
disabled = _props2.disabled,
useCapture = _props2.useCapture;
if (prevDisabled !== disabled) {
if (disabled) {
this.removeEventListeners();
} else {
this.addMouseDownEventListener(useCapture);
}
}
}
return componentDidUpdate;
}()
}, {
key: 'componentWillUnmount',
value: function () {
function componentWillUnmount() {
this.removeEventListeners();
}
return componentWillUnmount;
}()
// Use mousedown/mouseup to enforce that clicks remain outside the root's
// descendant tree, even when dragged. This should also get triggered on
// touch devices.
}, {
key: 'onMouseDown',
value: function () {
function onMouseDown(e) {
var useCapture = this.props.useCapture;
var isDescendantOfRoot = this.childNode && (0, _document2['default'])(this.childNode, e.target);
if (!isDescendantOfRoot) {
if (this.removeMouseUp) {
this.removeMouseUp();
this.removeMouseUp = null;
}
this.removeMouseUp = (0, _consolidatedEvents.addEventListener)(document, 'mouseup', this.onMouseUp, { capture: useCapture });
}
}
return onMouseDown;
}()
// Use mousedown/mouseup to enforce that clicks remain outside the root's
// descendant tree, even when dragged. This should also get triggered on
// touch devices.
}, {
key: 'onMouseUp',
value: function () {
function onMouseUp(e) {
var onOutsideClick = this.props.onOutsideClick;
var isDescendantOfRoot = this.childNode && (0, _document2['default'])(this.childNode, e.target);
if (this.removeMouseUp) {
this.removeMouseUp();
this.removeMouseUp = null;
}
if (!isDescendantOfRoot) {
onOutsideClick(e);
}
}
return onMouseUp;
}()
}, {
key: 'setChildNodeRef',
value: function () {
function setChildNodeRef(ref) {
this.childNode = ref;
}
return setChildNodeRef;
}()
}, {
key: 'addMouseDownEventListener',
value: function () {
function addMouseDownEventListener(useCapture) {
this.removeMouseDown = (0, _consolidatedEvents.addEventListener)(document, 'mousedown', this.onMouseDown, { capture: useCapture });
}
return addMouseDownEventListener;
}()
}, {
key: 'removeEventListeners',
value: function () {
function removeEventListeners() {
if (this.removeMouseDown) this.removeMouseDown();
if (this.removeMouseUp) this.removeMouseUp();
}
return removeEventListeners;
}()
}, {
key: 'render',
value: function () {
function render() {
var _props3 = this.props,
children = _props3.children,
display = _props3.display;
return _react2['default'].createElement(
'div',
{
ref: this.setChildNodeRef,
style: display !== DISPLAY.BLOCK && (0, _object2['default'])(DISPLAY).includes(display) ? { display: display } : undefined
},
children
);
}
return render;
}()
}]);
return OutsideClickHandler;
}(_react2['default'].Component);
exports['default'] = OutsideClickHandler;
OutsideClickHandler.propTypes = propTypes;
OutsideClickHandler.defaultProps = defaultProps;
/***/ }),
/***/ "5V/u":
/***/ (function(module, exports) {
module.exports =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId])
/******/ return installedModules[moduleId].exports;
/******/
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ exports: {},
/******/ id: moduleId,
/******/ loaded: false
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.loaded = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(0);
/******/ })
/************************************************************************/
/******/ ([
/* 0 */
/***/ (function(module, exports, __webpack_require__) {
module.exports = __webpack_require__(1);
/***/ }),
/* 1 */
/***/ (function(module, exports, __webpack_require__) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _utils = __webpack_require__(2);
Object.defineProperty(exports, 'combineChunks', {
enumerable: true,
get: function get() {
return _utils.combineChunks;
}
});
Object.defineProperty(exports, 'fillInChunks', {
enumerable: true,
get: function get() {
return _utils.fillInChunks;
}
});
Object.defineProperty(exports, 'findAll', {
enumerable: true,
get: function get() {
return _utils.findAll;
}
});
Object.defineProperty(exports, 'findChunks', {
enumerable: true,
get: function get() {
return _utils.findChunks;
}
});
/***/ }),
/* 2 */
/***/ (function(module, exports) {
'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* Creates an array of chunk objects representing both higlightable and non highlightable pieces of text that match each search word.
* @return Array of "chunks" (where a Chunk is { start:number, end:number, highlight:boolean })
*/
var findAll = exports.findAll = function findAll(_ref) {
var autoEscape = _ref.autoEscape,
_ref$caseSensitive = _ref.caseSensitive,
caseSensitive = _ref$caseSensitive === undefined ? false : _ref$caseSensitive,
_ref$findChunks = _ref.findChunks,
findChunks = _ref$findChunks === undefined ? defaultFindChunks : _ref$findChunks,
sanitize = _ref.sanitize,
searchWords = _ref.searchWords,
textToHighlight = _ref.textToHighlight;
return fillInChunks({
chunksToHighlight: combineChunks({
chunks: findChunks({
autoEscape: autoEscape,
caseSensitive: caseSensitive,
sanitize: sanitize,
searchWords: searchWords,
textToHighlight: textToHighlight
})
}),
totalLength: textToHighlight ? textToHighlight.length : 0
});
};
/**
* Takes an array of {start:number, end:number} objects and combines chunks that overlap into single chunks.
* @return {start:number, end:number}[]
*/
var combineChunks = exports.combineChunks = function combineChunks(_ref2) {
var chunks = _ref2.chunks;
chunks = chunks.sort(function (first, second) {
return first.start - second.start;
}).reduce(function (processedChunks, nextChunk) {
// First chunk just goes straight in the array...
if (processedChunks.length === 0) {
return [nextChunk];
} else {
// ... subsequent chunks get checked to see if they overlap...
var prevChunk = processedChunks.pop();
if (nextChunk.start <= prevChunk.end) {
// It may be the case that prevChunk completely surrounds nextChunk, so take the
// largest of the end indeces.
var endIndex = Math.max(prevChunk.end, nextChunk.end);
processedChunks.push({ highlight: false, start: prevChunk.start, end: endIndex });
} else {
processedChunks.push(prevChunk, nextChunk);
}
return processedChunks;
}
}, []);
return chunks;
};
/**
* Examine text for any matches.
* If we find matches, add them to the returned array as a "chunk" object ({start:number, end:number}).
* @return {start:number, end:number}[]
*/
var defaultFindChunks = function defaultFindChunks(_ref3) {
var autoEscape = _ref3.autoEscape,
caseSensitive = _ref3.caseSensitive,
_ref3$sanitize = _ref3.sanitize,
sanitize = _ref3$sanitize === undefined ? defaultSanitize : _ref3$sanitize,
searchWords = _ref3.searchWords,
textToHighlight = _ref3.textToHighlight;
textToHighlight = sanitize(textToHighlight);
return searchWords.filter(function (searchWord) {
return searchWord;
}) // Remove empty words
.reduce(function (chunks, searchWord) {
searchWord = sanitize(searchWord);
if (autoEscape) {
searchWord = escapeRegExpFn(searchWord);
}
var regex = new RegExp(searchWord, caseSensitive ? 'g' : 'gi');
var match = void 0;
while (match = regex.exec(textToHighlight)) {
var _start = match.index;
var _end = regex.lastIndex;
// We do not return zero-length matches
if (_end > _start) {
chunks.push({ highlight: false, start: _start, end: _end });
}
// Prevent browsers like Firefox from getting stuck in an infinite loop
// See http://www.regexguru.com/2008/04/watch-out-for-zero-length-matches/
if (match.index === regex.lastIndex) {
regex.lastIndex++;
}
}
return chunks;
}, []);
};
// Allow the findChunks to be overridden in findAll,
// but for backwards compatibility we export as the old name
exports.findChunks = defaultFindChunks;
/**
* Given a set of chunks to highlight, create an additional set of chunks
* to represent the bits of text between the highlighted text.
* @param chunksToHighlight {start:number, end:number}[]
* @param totalLength number
* @return {start:number, end:number, highlight:boolean}[]
*/
var fillInChunks = exports.fillInChunks = function fillInChunks(_ref4) {
var chunksToHighlight = _ref4.chunksToHighlight,
totalLength = _ref4.totalLength;
var allChunks = [];
var append = function append(start, end, highlight) {
if (end - start > 0) {
allChunks.push({
start: start,
end: end,
highlight: highlight
});
}
};
if (chunksToHighlight.length === 0) {
append(0, totalLength, false);
} else {
var lastIndex = 0;
chunksToHighlight.forEach(function (chunk) {
append(lastIndex, chunk.start, false);
append(chunk.start, chunk.end, true);
lastIndex = chunk.end;
});
append(lastIndex, totalLength, false);
}
return allChunks;
};
function defaultSanitize(string) {
return string;
}
function escapeRegExpFn(string) {
return string.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g, '\\$&');
}
/***/ })
/******/ ]);
/***/ }),
/***/ "5aBA":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/** @license React v17.0.2
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var b=60103,c=60106,d=60107,e=60108,f=60114,g=60109,h=60110,k=60112,l=60113,m=60120,n=60115,p=60116,q=60121,r=60122,u=60117,v=60129,w=60131;
if("function"===typeof Symbol&&Symbol.for){var x=Symbol.for;b=x("react.element");c=x("react.portal");d=x("react.fragment");e=x("react.strict_mode");f=x("react.profiler");g=x("react.provider");h=x("react.context");k=x("react.forward_ref");l=x("react.suspense");m=x("react.suspense_list");n=x("react.memo");p=x("react.lazy");q=x("react.block");r=x("react.server.block");u=x("react.fundamental");v=x("react.debug_trace_mode");w=x("react.legacy_hidden")}
function y(a){if("object"===typeof a&&null!==a){var t=a.$$typeof;switch(t){case b:switch(a=a.type,a){case d:case f:case e:case l:case m:return a;default:switch(a=a&&a.$$typeof,a){case h:case k:case p:case n:case g:return a;default:return t}}case c:return t}}}var z=g,A=b,B=k,C=d,D=p,E=n,F=c,G=f,H=e,I=l;exports.ContextConsumer=h;exports.ContextProvider=z;exports.Element=A;exports.ForwardRef=B;exports.Fragment=C;exports.Lazy=D;exports.Memo=E;exports.Portal=F;exports.Profiler=G;exports.StrictMode=H;
exports.Suspense=I;exports.isAsyncMode=function(){return!1};exports.isConcurrentMode=function(){return!1};exports.isContextConsumer=function(a){return y(a)===h};exports.isContextProvider=function(a){return y(a)===g};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===b};exports.isForwardRef=function(a){return y(a)===k};exports.isFragment=function(a){return y(a)===d};exports.isLazy=function(a){return y(a)===p};exports.isMemo=function(a){return y(a)===n};
exports.isPortal=function(a){return y(a)===c};exports.isProfiler=function(a){return y(a)===f};exports.isStrictMode=function(a){return y(a)===e};exports.isSuspense=function(a){return y(a)===l};exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===d||a===f||a===v||a===e||a===l||a===m||a===w||"object"===typeof a&&null!==a&&(a.$$typeof===p||a.$$typeof===n||a.$$typeof===g||a.$$typeof===h||a.$$typeof===k||a.$$typeof===u||a.$$typeof===q||a[0]===r)?!0:!1};
exports.typeOf=y;
/***/ }),
/***/ "5yQQ":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var implementation = __webpack_require__("nRDI");
module.exports = function getPolyfill() {
if (typeof document !== 'undefined') {
if (document.contains) {
return document.contains;
}
if (document.body && document.body.contains) {
try {
if (typeof document.body.contains.call(document, '') === 'boolean') {
return document.body.contains;
}
} catch (e) { /**/ }
}
}
return implementation;
};
/***/ }),
/***/ "60zJ":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// https://262.ecma-international.org/5.1/#sec-8
module.exports = function Type(x) {
if (x === null) {
return 'Null';
}
if (typeof x === 'undefined') {
return 'Undefined';
}
if (typeof x === 'function' || typeof x === 'object') {
return 'Object';
}
if (typeof x === 'number') {
return 'Number';
}
if (typeof x === 'boolean') {
return 'Boolean';
}
if (typeof x === 'string') {
return 'String';
}
};
/***/ }),
/***/ "6HWY":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = isNextMonth;
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _isSameMonth = __webpack_require__("ulUS");
var _isSameMonth2 = _interopRequireDefault(_isSameMonth);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function isNextMonth(a, b) {
if (!_moment2['default'].isMoment(a) || !_moment2['default'].isMoment(b)) return false;
return (0, _isSameMonth2['default'])(a.clone().add(1, 'month'), b);
}
/***/ }),
/***/ "6I5v":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = function sign(number) {
return number >= 0 ? 1 : -1;
};
/***/ }),
/***/ "6ZB3":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var callBind = __webpack_require__("1LY1");
var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
module.exports = function callBoundIntrinsic(name, allowMissing) {
var intrinsic = GetIntrinsic(name, !!allowMissing);
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
return callBind(intrinsic);
}
return intrinsic;
};
/***/ }),
/***/ "6zzY":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ useComponentsContext; });
// UNUSED EXPORTS: ComponentsContext, ContextSystemProvider
// EXTERNAL MODULE: external ["wp","element"]
var external_wp_element_ = __webpack_require__("GRId");
// EXTERNAL MODULE: external "lodash"
var external_lodash_ = __webpack_require__("YLtl");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/use-isomorphic-layout-effect.js
/**
* WordPress dependencies
*/
/**
* Copied from `@wordpress/compose` in order for us to be able to maintain all the types for the ui folder
*/
const useIsomorphicLayoutEffect = typeof window !== 'undefined' ? external_wp_element_["useLayoutEffect"] : external_wp_element_["useEffect"];
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/context/context-system-provider.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const ComponentsContext = Object(external_wp_element_["createContext"])(
/** @type {Record<string, any>} */
{});
const useComponentsContext = () => Object(external_wp_element_["useContext"])(ComponentsContext);
/**
* Consolidates incoming ContextSystem values with a (potential) parent ContextSystem value.
*
* @param {Object} props
* @param {Record<string, any>} props.value
* @return {Record<string, any>} The consolidated value.
*/
function useContextSystemBridge({
value
}) {
const parentContext = useComponentsContext();
const parentContextRef = Object(external_wp_element_["useRef"])(parentContext);
const valueRef = Object(external_wp_element_["useRef"])(Object(external_lodash_["merge"])(parentContext, value));
const [config, setConfig] = Object(external_wp_element_["useState"])(valueRef.current);
useIsomorphicLayoutEffect(() => {
let hasChange = false;
if (!Object(external_lodash_["isEqual"])(value, valueRef.current)) {
valueRef.current = value;
hasChange = true;
}
if (!Object(external_lodash_["isEqual"])(parentContext, parentContextRef.current)) {
valueRef.current = Object(external_lodash_["merge"])(parentContext, valueRef.current);
parentContextRef.current = parentContext;
hasChange = true;
}
if (hasChange) {
setConfig(prev => ({ ...prev,
...valueRef.current
}));
}
}, [value, parentContext]);
return config;
}
/**
* A Provider component that can modify props for connected components within
* the Context system.
*
* @example
* ```jsx
* <ContextSystemProvider value={{ Button: { size: 'small' }}}>
* <Button>...</Button>
* </ContextSystemProvider>
* ```
*
* @template {Record<string, any>} T
* @param {Object} options
* @param {import('react').ReactNode} options.children Children to render.
* @param {T} options.value Props to render into connected components.
* @return {JSX.Element} A Provider wrapped component.
*/
const BaseContextSystemProvider = ({
children,
value
}) => {
const contextValue = useContextSystemBridge({
value
});
return Object(external_wp_element_["createElement"])(ComponentsContext.Provider, {
value: contextValue
}, children);
};
const ContextSystemProvider = Object(external_wp_element_["memo"])(BaseContextSystemProvider);
/***/ }),
/***/ "71Og":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isButton; });
var buttonInputTypes = ["button", "color", "file", "image", "reset", "submit"];
/**
* Checks whether `element` is a native HTML button element.
*
* @example
* import { isButton } from "reakit-utils";
*
* isButton(document.querySelector("button")); // true
* isButton(document.querySelector("input[type='button']")); // true
* isButton(document.querySelector("div")); // false
* isButton(document.querySelector("input[type='text']")); // false
* isButton(document.querySelector("div[role='button']")); // false
*
* @returns {boolean}
*/
function isButton(element) {
if (element.tagName === "BUTTON") return true;
if (element.tagName === "INPUT") {
var input = element;
return buttonInputTypes.indexOf(input.type) !== -1;
}
return false;
}
/***/ }),
/***/ "75pU":
/***/ (function(module, exports) {
//
// Main
//
function memoize (fn, options) {
var cache = options && options.cache
? options.cache
: cacheDefault
var serializer = options && options.serializer
? options.serializer
: serializerDefault
var strategy = options && options.strategy
? options.strategy
: strategyDefault
return strategy(fn, {
cache: cache,
serializer: serializer
})
}
//
// Strategy
//
function isPrimitive (value) {
return value == null || typeof value === 'number' || typeof value === 'boolean' // || typeof value === "string" 'unsafe' primitive for our needs
}
function monadic (fn, cache, serializer, arg) {
var cacheKey = isPrimitive(arg) ? arg : serializer(arg)
var computedValue = cache.get(cacheKey)
if (typeof computedValue === 'undefined') {
computedValue = fn.call(this, arg)
cache.set(cacheKey, computedValue)
}
return computedValue
}
function variadic (fn, cache, serializer) {
var args = Array.prototype.slice.call(arguments, 3)
var cacheKey = serializer(args)
var computedValue = cache.get(cacheKey)
if (typeof computedValue === 'undefined') {
computedValue = fn.apply(this, args)
cache.set(cacheKey, computedValue)
}
return computedValue
}
function assemble (fn, context, strategy, cache, serialize) {
return strategy.bind(
context,
fn,
cache,
serialize
)
}
function strategyDefault (fn, options) {
var strategy = fn.length === 1 ? monadic : variadic
return assemble(
fn,
this,
strategy,
options.cache.create(),
options.serializer
)
}
function strategyVariadic (fn, options) {
var strategy = variadic
return assemble(
fn,
this,
strategy,
options.cache.create(),
options.serializer
)
}
function strategyMonadic (fn, options) {
var strategy = monadic
return assemble(
fn,
this,
strategy,
options.cache.create(),
options.serializer
)
}
//
// Serializer
//
function serializerDefault () {
return JSON.stringify(arguments)
}
//
// Cache
//
function ObjectWithoutPrototypeCache () {
this.cache = Object.create(null)
}
ObjectWithoutPrototypeCache.prototype.has = function (key) {
return (key in this.cache)
}
ObjectWithoutPrototypeCache.prototype.get = function (key) {
return this.cache[key]
}
ObjectWithoutPrototypeCache.prototype.set = function (key, value) {
this.cache[key] = value
}
var cacheDefault = {
create: function create () {
return new ObjectWithoutPrototypeCache()
}
}
//
// API
//
module.exports = memoize
module.exports.strategies = {
variadic: strategyVariadic,
monadic: strategyMonadic
}
/***/ }),
/***/ "7Cbv":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/rng.js
// Unique ID creation requires a high quality random # generator. In the browser we therefore
// require the crypto API and do not support built-in fallback to lower quality random number
// generators (like Math.random()).
var getRandomValues;
var rnds8 = new Uint8Array(16);
function rng() {
// lazy load so that environments that need to polyfill have a chance to do so
if (!getRandomValues) {
// getRandomValues needs to be invoked in a context where "this" is a Crypto implementation. Also,
// find the complete implementation of crypto (msCrypto) on IE11.
getRandomValues = typeof crypto !== 'undefined' && crypto.getRandomValues && crypto.getRandomValues.bind(crypto) || typeof msCrypto !== 'undefined' && typeof msCrypto.getRandomValues === 'function' && msCrypto.getRandomValues.bind(msCrypto);
if (!getRandomValues) {
throw new Error('crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported');
}
}
return getRandomValues(rnds8);
}
// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/regex.js
/* harmony default export */ var regex = (/^(?:[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}|00000000-0000-0000-0000-000000000000)$/i);
// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/validate.js
function validate(uuid) {
return typeof uuid === 'string' && regex.test(uuid);
}
/* harmony default export */ var esm_browser_validate = (validate);
// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/stringify.js
/**
* Convert array of 16 byte values to UUID string format of the form:
* XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
*/
var byteToHex = [];
for (var stringify_i = 0; stringify_i < 256; ++stringify_i) {
byteToHex.push((stringify_i + 0x100).toString(16).substr(1));
}
function stringify(arr) {
var offset = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
// Note: Be careful editing this code! It's been tuned for performance
// and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
var uuid = (byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]]).toLowerCase(); // Consistency check for valid UUID. If this throws, it's likely due to one
// of the following:
// - One or more input array values don't map to a hex octet (leading to
// "undefined" in the uuid)
// - Invalid input values for the RFC `version` or `variant` fields
if (!esm_browser_validate(uuid)) {
throw TypeError('Stringified UUID is invalid');
}
return uuid;
}
/* harmony default export */ var esm_browser_stringify = (stringify);
// CONCATENATED MODULE: ./node_modules/uuid/dist/esm-browser/v4.js
function v4(options, buf, offset) {
options = options || {};
var rnds = options.random || (options.rng || rng)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
rnds[6] = rnds[6] & 0x0f | 0x40;
rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
if (buf) {
offset = offset || 0;
for (var i = 0; i < 16; ++i) {
buf[offset + i] = rnds[i];
}
return buf;
}
return esm_browser_stringify(rnds);
}
/* harmony default export */ var esm_browser_v4 = __webpack_exports__["a"] = (v4);
/***/ }),
/***/ "7Ji+":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $Array = GetIntrinsic('%Array%');
var $species = GetIntrinsic('%Symbol.species%', true);
var $TypeError = GetIntrinsic('%TypeError%');
var Get = __webpack_require__("3aeR");
var IsArray = __webpack_require__("9cOx");
var IsConstructor = __webpack_require__("kuGu");
var IsInteger = __webpack_require__("R/b7");
var Type = __webpack_require__("V1cy");
// https://ecma-international.org/ecma-262/6.0/#sec-arrayspeciescreate
module.exports = function ArraySpeciesCreate(originalArray, length) {
if (!IsInteger(length) || length < 0) {
throw new $TypeError('Assertion failed: length must be an integer >= 0');
}
var len = length === 0 ? 0 : length;
var C;
var isArray = IsArray(originalArray);
if (isArray) {
C = Get(originalArray, 'constructor');
// TODO: figure out how to make a cross-realm normal Array, a same-realm Array
// if (IsConstructor(C)) {
// if C is another realm's Array, C = undefined
// Object.getPrototypeOf(Object.getPrototypeOf(Object.getPrototypeOf(Array))) === null ?
// }
if ($species && Type(C) === 'Object') {
C = Get(C, $species);
if (C === null) {
C = void 0;
}
}
}
if (typeof C === 'undefined') {
return $Array(len);
}
if (!IsConstructor(C)) {
throw new $TypeError('C must be a constructor');
}
return new C(len); // Construct(C, len);
};
/***/ }),
/***/ "7Jlx":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return contextConnect; });
/* unused harmony export getConnectNamespace */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return hasConnectNamespace; });
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("YLtl");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _wordpress_warning__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("Z23Y");
/* harmony import */ var _wordpress_warning__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_warning__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("tQ+x");
/* harmony import */ var _get_styled_class_name_from_key__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("UAm0");
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/* eslint-disable jsdoc/valid-types */
/**
* Forwards ref (React.ForwardRef) and "Connects" (or registers) a component
* within the Context system under a specified namespace.
*
* This is an (experimental) evolution of the initial connect() HOC.
* The hope is that we can improve render performance by removing functional
* component wrappers.
*
* @template {import('./polymorphic-component').ViewOwnProps<{}, any>} P
* @param {(props: P, ref: import('react').Ref<any>) => JSX.Element | null} Component The component to register into the Context system.
* @param {string} namespace The namespace to register the component under.
* @param {Object} options
* @param {boolean} [options.memo=false]
* @return {import('./polymorphic-component').PolymorphicComponent<import('./polymorphic-component').ElementTypeFromViewOwnProps<P>, import('./polymorphic-component').PropsFromViewOwnProps<P>>} The connected PolymorphicComponent
*/
function contextConnect(Component, namespace, options = {}) {
/* eslint-enable jsdoc/valid-types */
const {
memo: memoProp = false
} = options;
let WrappedComponent = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(Component);
if (memoProp) {
// @ts-ignore
WrappedComponent = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["memo"])(WrappedComponent);
}
if (typeof namespace === 'undefined') {
typeof process !== "undefined" && process.env && "production" !== "production" ? _wordpress_warning__WEBPACK_IMPORTED_MODULE_2___default()('contextConnect: Please provide a namespace') : void 0;
} // @ts-ignore internal property
let mergedNamespace = WrappedComponent[_constants__WEBPACK_IMPORTED_MODULE_3__[/* CONNECT_STATIC_NAMESPACE */ "c"]] || [namespace];
/**
* Consolidate (merge) namespaces before attaching it to the WrappedComponent.
*/
if (Array.isArray(namespace)) {
mergedNamespace = [...mergedNamespace, ...namespace];
}
if (typeof namespace === 'string') {
mergedNamespace = [...mergedNamespace, namespace];
}
WrappedComponent.displayName = namespace; // @ts-ignore internal property
WrappedComponent[_constants__WEBPACK_IMPORTED_MODULE_3__[/* CONNECT_STATIC_NAMESPACE */ "c"]] = Object(lodash__WEBPACK_IMPORTED_MODULE_0__["uniq"])(mergedNamespace); // @ts-ignore PolymorphicComponent property
WrappedComponent.selector = `.${Object(_get_styled_class_name_from_key__WEBPACK_IMPORTED_MODULE_4__[/* getStyledClassNameFromKey */ "a"])(namespace)}`; // @ts-ignore
return WrappedComponent;
}
/**
* Attempts to retrieve the connected namespace from a component.
*
* @param {import('react').ReactChild | undefined | {}} Component The component to retrieve a namespace from.
* @return {Array<string>} The connected namespaces.
*/
function getConnectNamespace(Component) {
if (!Component) return [];
let namespaces = []; // @ts-ignore internal property
if (Component[_constants__WEBPACK_IMPORTED_MODULE_3__[/* CONNECT_STATIC_NAMESPACE */ "c"]]) {
// @ts-ignore internal property
namespaces = Component[_constants__WEBPACK_IMPORTED_MODULE_3__[/* CONNECT_STATIC_NAMESPACE */ "c"]];
} // @ts-ignore
if (Component.type && Component.type[_constants__WEBPACK_IMPORTED_MODULE_3__[/* CONNECT_STATIC_NAMESPACE */ "c"]]) {
// @ts-ignore
namespaces = Component.type[_constants__WEBPACK_IMPORTED_MODULE_3__[/* CONNECT_STATIC_NAMESPACE */ "c"]];
}
return namespaces;
}
/**
* Checks to see if a component is connected within the Context system.
*
* @param {import('react').ReactNode} Component The component to retrieve a namespace from.
* @param {Array<string>|string} match The namespace to check.
* @return {boolean} The result.
*/
function hasConnectNamespace(Component, match) {
if (!Component) return false;
if (typeof match === 'string') {
return getConnectNamespace(Component).includes(match);
}
if (Array.isArray(match)) {
return match.some(result => getConnectNamespace(Component).includes(result));
}
return false;
}
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("8oxB")))
/***/ }),
/***/ "82c2":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var keys = __webpack_require__("1seS");
var hasSymbols = typeof Symbol === 'function' && typeof Symbol('foo') === 'symbol';
var toStr = Object.prototype.toString;
var concat = Array.prototype.concat;
var origDefineProperty = Object.defineProperty;
var isFunction = function (fn) {
return typeof fn === 'function' && toStr.call(fn) === '[object Function]';
};
var arePropertyDescriptorsSupported = function () {
var obj = {};
try {
origDefineProperty(obj, 'x', { enumerable: false, value: obj });
// eslint-disable-next-line no-unused-vars, no-restricted-syntax
for (var _ in obj) { // jscs:ignore disallowUnusedVariables
return false;
}
return obj.x === obj;
} catch (e) { /* this is IE 8. */
return false;
}
};
var supportsDescriptors = origDefineProperty && arePropertyDescriptorsSupported();
var defineProperty = function (object, name, value, predicate) {
if (name in object && (!isFunction(predicate) || !predicate())) {
return;
}
if (supportsDescriptors) {
origDefineProperty(object, name, {
configurable: true,
enumerable: false,
value: value,
writable: true
});
} else {
object[name] = value;
}
};
var defineProperties = function (object, map) {
var predicates = arguments.length > 2 ? arguments[2] : {};
var props = keys(map);
if (hasSymbols) {
props = concat.call(props, Object.getOwnPropertySymbols(map));
}
for (var i = 0; i < props.length; i += 1) {
defineProperty(object, props[i], map[props[i]], predicates[props[i]]);
}
};
defineProperties.supportsDescriptors = !!supportsDescriptors;
module.exports = defineProperties;
/***/ }),
/***/ "8OQS":
/***/ (function(module, exports) {
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
module.exports = _objectWithoutPropertiesLoose;
module.exports["default"] = module.exports, module.exports.__esModule = true;
/***/ }),
/***/ "8R9v":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var define = __webpack_require__("82c2");
var getPolyfill = __webpack_require__("yLpt");
module.exports = function shimAssign() {
var polyfill = getPolyfill();
define(
Object,
{ assign: polyfill },
{ assign: function () { return Object.assign !== polyfill; } }
);
return polyfill;
};
/***/ }),
/***/ "8oxB":
/***/ (function(module, exports) {
// shim for using process in browser
var process = module.exports = {};
// cached from whatever global is present so that test runners that stub it
// don't break things. But we need to wrap it in a try catch in case it is
// wrapped in strict mode code which doesn't define any globals. It's inside a
// function because try/catches deoptimize in certain engines.
var cachedSetTimeout;
var cachedClearTimeout;
function defaultSetTimout() {
throw new Error('setTimeout has not been defined');
}
function defaultClearTimeout () {
throw new Error('clearTimeout has not been defined');
}
(function () {
try {
if (typeof setTimeout === 'function') {
cachedSetTimeout = setTimeout;
} else {
cachedSetTimeout = defaultSetTimout;
}
} catch (e) {
cachedSetTimeout = defaultSetTimout;
}
try {
if (typeof clearTimeout === 'function') {
cachedClearTimeout = clearTimeout;
} else {
cachedClearTimeout = defaultClearTimeout;
}
} catch (e) {
cachedClearTimeout = defaultClearTimeout;
}
} ())
function runTimeout(fun) {
if (cachedSetTimeout === setTimeout) {
//normal enviroments in sane situations
return setTimeout(fun, 0);
}
// if setTimeout wasn't available but was latter defined
if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
cachedSetTimeout = setTimeout;
return setTimeout(fun, 0);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedSetTimeout(fun, 0);
} catch(e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedSetTimeout.call(null, fun, 0);
} catch(e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
return cachedSetTimeout.call(this, fun, 0);
}
}
}
function runClearTimeout(marker) {
if (cachedClearTimeout === clearTimeout) {
//normal enviroments in sane situations
return clearTimeout(marker);
}
// if clearTimeout wasn't available but was latter defined
if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
cachedClearTimeout = clearTimeout;
return clearTimeout(marker);
}
try {
// when when somebody has screwed with setTimeout but no I.E. maddness
return cachedClearTimeout(marker);
} catch (e){
try {
// When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
return cachedClearTimeout.call(null, marker);
} catch (e){
// same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
// Some versions of I.E. have different rules for clearTimeout vs setTimeout
return cachedClearTimeout.call(this, marker);
}
}
}
var queue = [];
var draining = false;
var currentQueue;
var queueIndex = -1;
function cleanUpNextTick() {
if (!draining || !currentQueue) {
return;
}
draining = false;
if (currentQueue.length) {
queue = currentQueue.concat(queue);
} else {
queueIndex = -1;
}
if (queue.length) {
drainQueue();
}
}
function drainQueue() {
if (draining) {
return;
}
var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
while(len) {
currentQueue = queue;
queue = [];
while (++queueIndex < len) {
if (currentQueue) {
currentQueue[queueIndex].run();
}
}
queueIndex = -1;
len = queue.length;
}
currentQueue = null;
draining = false;
runClearTimeout(timeout);
}
process.nextTick = function (fun) {
var args = new Array(arguments.length - 1);
if (arguments.length > 1) {
for (var i = 1; i < arguments.length; i++) {
args[i - 1] = arguments[i];
}
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
runTimeout(drainQueue);
}
};
// v8 likes predictible objects
function Item(fun, array) {
this.fun = fun;
this.array = array;
}
Item.prototype.run = function () {
this.fun.apply(null, this.array);
};
process.title = 'browser';
process.browser = true;
process.env = {};
process.argv = [];
process.version = ''; // empty string to avoid regexp issues
process.versions = {};
function noop() {}
process.on = noop;
process.addListener = noop;
process.once = noop;
process.off = noop;
process.removeListener = noop;
process.removeAllListeners = noop;
process.emit = noop;
process.prependListener = noop;
process.prependOnceListener = noop;
process.listeners = function (name) { return [] }
process.binding = function (name) {
throw new Error('process.binding is not supported');
};
process.cwd = function () { return '/' };
process.chdir = function (dir) {
throw new Error('process.chdir is not supported');
};
process.umask = function() { return 0; };
/***/ }),
/***/ "9Do8":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = __webpack_require__("zt9T");
/***/ }),
/***/ "9NHk":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return withNext; });
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("wx14");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);
/**
* Internal dependencies
*/
/**
* @template {{}} TCurrentProps
* @template {{}} TNextProps
* @param {import('react').ForwardRefExoticComponent<TCurrentProps>} CurrentComponent
* @param {import('react').ComponentType<TNextProps>} NextComponent
* @param {string} namespace
* @param {(props: TCurrentProps) => TNextProps} adapter
*/
function withNext(CurrentComponent, NextComponent = () => null, namespace = 'Component', adapter = p =>
/** @type {any} */
p) {
if (false) {}
return CurrentComponent;
}
/***/ }),
/***/ "9VDH":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("wx14");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _dashicon__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("vUUf");
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Icon({
icon = null,
size,
...additionalProps
}) {
if ('string' === typeof icon) {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_dashicon__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"], Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])({
icon: icon
}, additionalProps));
}
if (icon && _dashicon__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"] === icon.type) {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["cloneElement"])(icon, { ...additionalProps
});
} // Icons should be 24x24 by default.
const iconSize = size || 24;
if ('function' === typeof icon) {
if (icon.prototype instanceof _wordpress_element__WEBPACK_IMPORTED_MODULE_1__["Component"]) {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(icon, {
size: iconSize,
...additionalProps
});
}
return icon({
size: iconSize,
...additionalProps
});
}
if (icon && (icon.type === 'svg' || icon.type === _wordpress_primitives__WEBPACK_IMPORTED_MODULE_2__["SVG"])) {
const appliedProps = {
width: iconSize,
height: iconSize,
...icon.props,
...additionalProps
};
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_2__["SVG"], appliedProps);
}
if (Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["isValidElement"])(icon)) {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["cloneElement"])(icon, {
size: iconSize,
...additionalProps
});
}
return icon;
}
/* harmony default export */ __webpack_exports__["a"] = (Icon);
/***/ }),
/***/ "9cOx":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $Array = GetIntrinsic('%Array%');
// eslint-disable-next-line global-require
var toStr = !$Array.isArray && __webpack_require__("EXo9")('Object.prototype.toString');
// https://ecma-international.org/ecma-262/6.0/#sec-isarray
module.exports = $Array.isArray || function IsArray(argument) {
return toStr(argument) === '[object Array]';
};
/***/ }),
/***/ "9gmn":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var ChevronUp = function () {
function ChevronUp(props) {
return _react2['default'].createElement(
'svg',
props,
_react2['default'].createElement('path', {
d: 'M32.1 712.6l453.2-452.2c11-11 21-11 32 0l453.2 452.2c4 5 6 10 6 16 0 13-10 23-22 23-7 0-12-2-16-7L501.3 308.5 64.1 744.7c-4 5-9 7-15 7-7 0-12-2-17-7-9-11-9-21 0-32.1z'
})
);
}
return ChevronUp;
}();
ChevronUp.defaultProps = {
viewBox: '0 0 1000 1000'
};
exports['default'] = ChevronUp;
/***/ }),
/***/ "9pTB":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {
var define = __webpack_require__("82c2");
var isSymbol = __webpack_require__("/sVA");
var globalKey = '__ global cache key __';
/* istanbul ignore else */
// eslint-disable-next-line no-restricted-properties
if (typeof Symbol === 'function' && isSymbol(Symbol('foo')) && typeof Symbol['for'] === 'function') {
// eslint-disable-next-line no-restricted-properties
globalKey = Symbol['for'](globalKey);
}
var trueThunk = function () {
return true;
};
var ensureCache = function ensureCache() {
if (!global[globalKey]) {
var properties = {};
properties[globalKey] = {};
var predicates = {};
predicates[globalKey] = trueThunk;
define(global, properties, predicates);
}
return global[globalKey];
};
var cache = ensureCache();
var isPrimitive = function isPrimitive(val) {
return val === null || (typeof val !== 'object' && typeof val !== 'function');
};
var getPrimitiveKey = function getPrimitiveKey(val) {
if (isSymbol(val)) {
return Symbol.prototype.valueOf.call(val);
}
return typeof val + ' | ' + String(val);
};
var requirePrimitiveKey = function requirePrimitiveKey(val) {
if (!isPrimitive(val)) {
throw new TypeError('key must not be an object');
}
};
var globalCache = {
clear: function clear() {
delete global[globalKey];
cache = ensureCache();
},
'delete': function deleteKey(key) {
requirePrimitiveKey(key);
delete cache[getPrimitiveKey(key)];
return !globalCache.has(key);
},
get: function get(key) {
requirePrimitiveKey(key);
return cache[getPrimitiveKey(key)];
},
has: function has(key) {
requirePrimitiveKey(key);
return getPrimitiveKey(key) in cache;
},
set: function set(key, value) {
requirePrimitiveKey(key);
var primitiveKey = getPrimitiveKey(key);
var props = {};
props[primitiveKey] = value;
var predicates = {};
predicates[primitiveKey] = trueThunk;
define(cache, props, predicates);
return globalCache.has(key);
},
setIfMissingThenGet: function setIfMissingThenGet(key, valueThunk) {
if (globalCache.has(key)) {
return globalCache.get(key);
}
var item = valueThunk();
globalCache.set(key, item);
return item;
}
};
module.exports = globalCache;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("yLpj")))
/***/ }),
/***/ "9uj6":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _emotion_memoize__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("4qRI");
var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|inert|itemProp|itemScope|itemType|itemID|itemRef|on|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/; // https://esbench.com/bench/5bfee68a4cd7e6009ef61d23
var index = Object(_emotion_memoize__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(function (prop) {
return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111
/* o */
&& prop.charCodeAt(1) === 110
/* n */
&& prop.charCodeAt(2) < 91;
}
/* Z+1 */
);
/* harmony default export */ __webpack_exports__["default"] = (index);
/***/ }),
/***/ "AClM":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ ensureFocus; });
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/getActiveElement.js
var getActiveElement = __webpack_require__("Nym8");
// CONCATENATED MODULE: ./node_modules/reakit-utils/es/hasFocus.js
/**
* Checks if `element` has focus. Elements that are referenced by
* `aria-activedescendant` are also considered.
*
* @example
* import { hasFocus } from "reakit-utils";
*
* hasFocus(document.getElementById("id"));
*/
function hasFocus(element) {
var activeElement = Object(getActiveElement["a" /* getActiveElement */])(element);
if (!activeElement) return false;
if (activeElement === element) return true;
var activeDescendant = activeElement.getAttribute("aria-activedescendant");
if (!activeDescendant) return false;
return activeDescendant === element.id;
}
// CONCATENATED MODULE: ./node_modules/reakit-utils/es/ensureFocus.js
/**
* Ensures `element` will receive focus if it's not already.
*
* @example
* import { ensureFocus } from "reakit-utils";
*
* ensureFocus(document.activeElement); // does nothing
*
* const element = document.querySelector("input");
*
* ensureFocus(element); // focuses element
* ensureFocus(element, { preventScroll: true }); // focuses element preventing scroll jump
*
* function isActive(el) {
* return el.dataset.active === "true";
* }
*
* ensureFocus(document.querySelector("[data-active='true']"), { isActive }); // does nothing
*
* @returns {number} `requestAnimationFrame` call ID so it can be passed to `cancelAnimationFrame` if needed.
*/
function ensureFocus(element, _temp) {
var _ref = _temp === void 0 ? {} : _temp,
preventScroll = _ref.preventScroll,
_ref$isActive = _ref.isActive,
isActive = _ref$isActive === void 0 ? hasFocus : _ref$isActive;
if (isActive(element)) return -1;
element.focus({
preventScroll: preventScroll
});
if (isActive(element)) return -1;
return requestAnimationFrame(function () {
element.focus({
preventScroll: preventScroll
});
});
}
/***/ }),
/***/ "AM7I":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* globals
AggregateError,
Atomics,
FinalizationRegistry,
SharedArrayBuffer,
WeakRef,
*/
var undefined;
var $SyntaxError = SyntaxError;
var $Function = Function;
var $TypeError = TypeError;
// eslint-disable-next-line consistent-return
var getEvalledConstructor = function (expressionSyntax) {
try {
// eslint-disable-next-line no-new-func
return Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
} catch (e) {}
};
var $gOPD = Object.getOwnPropertyDescriptor;
if ($gOPD) {
try {
$gOPD({}, '');
} catch (e) {
$gOPD = null; // this is IE 8, which has a broken gOPD
}
}
var throwTypeError = function () {
throw new $TypeError();
};
var ThrowTypeError = $gOPD
? (function () {
try {
// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
arguments.callee; // IE 8 does not throw here
return throwTypeError;
} catch (calleeThrows) {
try {
// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
return $gOPD(arguments, 'callee').get;
} catch (gOPDthrows) {
return throwTypeError;
}
}
}())
: throwTypeError;
var hasSymbols = __webpack_require__("UVaH")();
var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
var asyncGenFunction = getEvalledConstructor('async function* () {}');
var asyncGenFunctionPrototype = asyncGenFunction ? asyncGenFunction.prototype : undefined;
var asyncGenPrototype = asyncGenFunctionPrototype ? asyncGenFunctionPrototype.prototype : undefined;
var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
var INTRINSICS = {
'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
'%Array%': Array,
'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
'%AsyncFromSyncIteratorPrototype%': undefined,
'%AsyncFunction%': getEvalledConstructor('async function () {}'),
'%AsyncGenerator%': asyncGenFunctionPrototype,
'%AsyncGeneratorFunction%': asyncGenFunction,
'%AsyncIteratorPrototype%': asyncGenPrototype ? getProto(asyncGenPrototype) : undefined,
'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
'%Boolean%': Boolean,
'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
'%Date%': Date,
'%decodeURI%': decodeURI,
'%decodeURIComponent%': decodeURIComponent,
'%encodeURI%': encodeURI,
'%encodeURIComponent%': encodeURIComponent,
'%Error%': Error,
'%eval%': eval, // eslint-disable-line no-eval
'%EvalError%': EvalError,
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
'%Function%': $Function,
'%GeneratorFunction%': getEvalledConstructor('function* () {}'),
'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
'%isFinite%': isFinite,
'%isNaN%': isNaN,
'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
'%JSON%': typeof JSON === 'object' ? JSON : undefined,
'%Map%': typeof Map === 'undefined' ? undefined : Map,
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
'%Math%': Math,
'%Number%': Number,
'%Object%': Object,
'%parseFloat%': parseFloat,
'%parseInt%': parseInt,
'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
'%RangeError%': RangeError,
'%ReferenceError%': ReferenceError,
'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
'%RegExp%': RegExp,
'%Set%': typeof Set === 'undefined' ? undefined : Set,
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
'%String%': String,
'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
'%Symbol%': hasSymbols ? Symbol : undefined,
'%SyntaxError%': $SyntaxError,
'%ThrowTypeError%': ThrowTypeError,
'%TypedArray%': TypedArray,
'%TypeError%': $TypeError,
'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
'%URIError%': URIError,
'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
};
var LEGACY_ALIASES = {
'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
'%ArrayPrototype%': ['Array', 'prototype'],
'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
'%ArrayProto_values%': ['Array', 'prototype', 'values'],
'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
'%BooleanPrototype%': ['Boolean', 'prototype'],
'%DataViewPrototype%': ['DataView', 'prototype'],
'%DatePrototype%': ['Date', 'prototype'],
'%ErrorPrototype%': ['Error', 'prototype'],
'%EvalErrorPrototype%': ['EvalError', 'prototype'],
'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
'%FunctionPrototype%': ['Function', 'prototype'],
'%Generator%': ['GeneratorFunction', 'prototype'],
'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
'%JSONParse%': ['JSON', 'parse'],
'%JSONStringify%': ['JSON', 'stringify'],
'%MapPrototype%': ['Map', 'prototype'],
'%NumberPrototype%': ['Number', 'prototype'],
'%ObjectPrototype%': ['Object', 'prototype'],
'%ObjProto_toString%': ['Object', 'prototype', 'toString'],
'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
'%PromisePrototype%': ['Promise', 'prototype'],
'%PromiseProto_then%': ['Promise', 'prototype', 'then'],
'%Promise_all%': ['Promise', 'all'],
'%Promise_reject%': ['Promise', 'reject'],
'%Promise_resolve%': ['Promise', 'resolve'],
'%RangeErrorPrototype%': ['RangeError', 'prototype'],
'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
'%RegExpPrototype%': ['RegExp', 'prototype'],
'%SetPrototype%': ['Set', 'prototype'],
'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
'%StringPrototype%': ['String', 'prototype'],
'%SymbolPrototype%': ['Symbol', 'prototype'],
'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
'%TypedArrayPrototype%': ['TypedArray', 'prototype'],
'%TypeErrorPrototype%': ['TypeError', 'prototype'],
'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
'%URIErrorPrototype%': ['URIError', 'prototype'],
'%WeakMapPrototype%': ['WeakMap', 'prototype'],
'%WeakSetPrototype%': ['WeakSet', 'prototype']
};
var bind = __webpack_require__("D3zA");
var hasOwn = __webpack_require__("oNNP");
var $concat = bind.call(Function.call, Array.prototype.concat);
var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
var $replace = bind.call(Function.call, String.prototype.replace);
var $strSlice = bind.call(Function.call, String.prototype.slice);
/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
var stringToPath = function stringToPath(string) {
var first = $strSlice(string, 0, 1);
var last = $strSlice(string, -1);
if (first === '%' && last !== '%') {
throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
} else if (last === '%' && first !== '%') {
throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
}
var result = [];
$replace(string, rePropName, function (match, number, quote, subString) {
result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
});
return result;
};
/* end adaptation */
var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
var intrinsicName = name;
var alias;
if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
alias = LEGACY_ALIASES[intrinsicName];
intrinsicName = '%' + alias[0] + '%';
}
if (hasOwn(INTRINSICS, intrinsicName)) {
var value = INTRINSICS[intrinsicName];
if (typeof value === 'undefined' && !allowMissing) {
throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
}
return {
alias: alias,
name: intrinsicName,
value: value
};
}
throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
};
module.exports = function GetIntrinsic(name, allowMissing) {
if (typeof name !== 'string' || name.length === 0) {
throw new $TypeError('intrinsic name must be a non-empty string');
}
if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
throw new $TypeError('"allowMissing" argument must be a boolean');
}
var parts = stringToPath(name);
var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
var intrinsicRealName = intrinsic.name;
var value = intrinsic.value;
var skipFurtherCaching = false;
var alias = intrinsic.alias;
if (alias) {
intrinsicBaseName = alias[0];
$spliceApply(parts, $concat([0, 1], alias));
}
for (var i = 1, isOwn = true; i < parts.length; i += 1) {
var part = parts[i];
var first = $strSlice(part, 0, 1);
var last = $strSlice(part, -1);
if (
(
(first === '"' || first === "'" || first === '`')
|| (last === '"' || last === "'" || last === '`')
)
&& first !== last
) {
throw new $SyntaxError('property names with quotes must have matching quotes');
}
if (part === 'constructor' || !isOwn) {
skipFurtherCaching = true;
}
intrinsicBaseName += '.' + part;
intrinsicRealName = '%' + intrinsicBaseName + '%';
if (hasOwn(INTRINSICS, intrinsicRealName)) {
value = INTRINSICS[intrinsicRealName];
} else if (value != null) {
if (!(part in value)) {
if (!allowMissing) {
throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
}
return void undefined;
}
if ($gOPD && (i + 1) >= parts.length) {
var desc = $gOPD(value, part);
isOwn = !!desc;
// By convention, when a data property is converted to an accessor
// property to emulate a data property that does not suffer from
// the override mistake, that accessor's getter is marked with
// an `originalValue` property. Here, when we detect this, we
// uphold the illusion by pretending to see that original data
// property, i.e., returning the value rather than the getter
// itself.
if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
value = desc.get;
} else {
value = value[part];
}
} else {
isOwn = hasOwn(value, part);
value = value[part];
}
if (isOwn && !skipFurtherCaching) {
INTRINSICS[intrinsicRealName] = value;
}
}
}
return value;
};
/***/ }),
/***/ "AP2z":
/***/ (function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__("nmnc");
/** Used for built-in method references. */
var objectProto = Object.prototype;
/** Used to check objects for own properties. */
var hasOwnProperty = objectProto.hasOwnProperty;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/** Built-in value references. */
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
/**
* A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the raw `toStringTag`.
*/
function getRawTag(value) {
var isOwn = hasOwnProperty.call(value, symToStringTag),
tag = value[symToStringTag];
try {
value[symToStringTag] = undefined;
var unmasked = true;
} catch (e) {}
var result = nativeObjectToString.call(value);
if (unmasked) {
if (isOwn) {
value[symToStringTag] = tag;
} else {
delete value[symToStringTag];
}
}
return result;
}
module.exports = getRawTag;
/***/ }),
/***/ "AXvK":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useIsomorphicEffect; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("cDcd");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _canUseDOM_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("+ipW");
/**
* `React.useLayoutEffect` that fallbacks to `React.useEffect` on server side
* rendering.
*/
var useIsomorphicEffect = !_canUseDOM_js__WEBPACK_IMPORTED_MODULE_1__[/* canUseDOM */ "a"] ? react__WEBPACK_IMPORTED_MODULE_0__["useEffect"] : react__WEBPACK_IMPORTED_MODULE_0__["useLayoutEffect"];
/***/ }),
/***/ "Ae65":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = getCalendarDaySettings;
var _getPhrase = __webpack_require__("oOcr");
var _getPhrase2 = _interopRequireDefault(_getPhrase);
var _constants = __webpack_require__("Fv1B");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function getCalendarDaySettings(day, ariaLabelFormat, daySize, modifiers, phrases) {
var chooseAvailableDate = phrases.chooseAvailableDate,
dateIsUnavailable = phrases.dateIsUnavailable,
dateIsSelected = phrases.dateIsSelected;
var daySizeStyles = {
width: daySize,
height: daySize - 1
};
var useDefaultCursor = modifiers.has('blocked-minimum-nights') || modifiers.has('blocked-calendar') || modifiers.has('blocked-out-of-range');
var selected = modifiers.has('selected') || modifiers.has('selected-start') || modifiers.has('selected-end');
var hoveredSpan = !selected && (modifiers.has('hovered-span') || modifiers.has('after-hovered-start'));
var isOutsideRange = modifiers.has('blocked-out-of-range');
var formattedDate = { date: day.format(ariaLabelFormat) };
var ariaLabel = (0, _getPhrase2['default'])(chooseAvailableDate, formattedDate);
if (modifiers.has(_constants.BLOCKED_MODIFIER)) {
ariaLabel = (0, _getPhrase2['default'])(dateIsUnavailable, formattedDate);
} else if (selected) {
ariaLabel = (0, _getPhrase2['default'])(dateIsSelected, formattedDate);
}
return {
daySizeStyles: daySizeStyles,
useDefaultCursor: useDefaultCursor,
selected: selected,
hoveredSpan: hoveredSpan,
isOutsideRange: isOutsideRange,
ariaLabel: ariaLabel
};
}
/***/ }),
/***/ "Asd8":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var fnToStr = Function.prototype.toString;
var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
var badArrayLike;
var isCallableMarker;
if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
try {
badArrayLike = Object.defineProperty({}, 'length', {
get: function () {
throw isCallableMarker;
}
});
isCallableMarker = {};
// eslint-disable-next-line no-throw-literal
reflectApply(function () { throw 42; }, null, badArrayLike);
} catch (_) {
if (_ !== isCallableMarker) {
reflectApply = null;
}
}
} else {
reflectApply = null;
}
var constructorRegex = /^\s*class\b/;
var isES6ClassFn = function isES6ClassFunction(value) {
try {
var fnStr = fnToStr.call(value);
return constructorRegex.test(fnStr);
} catch (e) {
return false; // not a function
}
};
var tryFunctionObject = function tryFunctionToStr(value) {
try {
if (isES6ClassFn(value)) { return false; }
fnToStr.call(value);
return true;
} catch (e) {
return false;
}
};
var toStr = Object.prototype.toString;
var fnClass = '[object Function]';
var genClass = '[object GeneratorFunction]';
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
/* globals document: false */
var documentDotAll = typeof document === 'object' && typeof document.all === 'undefined' && document.all !== undefined ? document.all : {};
module.exports = reflectApply
? function isCallable(value) {
if (value === documentDotAll) { return true; }
if (!value) { return false; }
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
if (typeof value === 'function' && !value.prototype) { return true; }
try {
reflectApply(value, null, badArrayLike);
} catch (e) {
if (e !== isCallableMarker) { return false; }
}
return !isES6ClassFn(value);
}
: function isCallable(value) {
if (value === documentDotAll) { return true; }
if (!value) { return false; }
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
if (typeof value === 'function' && !value.prototype) { return true; }
if (hasToStringTag) { return tryFunctionObject(value); }
if (isES6ClassFn(value)) { return false; }
var strClass = toStr.call(value);
return strClass === fnClass || strClass === genClass;
};
/***/ }),
/***/ "B9Az":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXTERNAL MODULE: external ["wp","element"]
var external_wp_element_ = __webpack_require__("GRId");
// EXTERNAL MODULE: external ["wp","primitives"]
var external_wp_primitives_ = __webpack_require__("Tqx9");
// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/pencil.js
/**
* WordPress dependencies
*/
const pencil = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
d: "M20.1 5.1L16.9 2 6.2 12.7l-1.3 4.4 4.5-1.3L20.1 5.1zM4 20.8h8v-1.5H4v1.5z"
}));
/* harmony default export */ var library_pencil = (pencil);
// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js
/**
* Internal dependencies
*/
/* harmony default export */ var edit = __webpack_exports__["a"] = (library_pencil);
/***/ }),
/***/ "BZp5":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutPropertiesLoose; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return _objectSpread2; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return _createForOfIteratorHelperLoose; });
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
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);
}
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;
}
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it;
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
it = o[Symbol.iterator]();
return it.next.bind(it);
}
/***/ }),
/***/ "BeK9":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = function isPrimitive(value) {
return value === null || (typeof value !== 'function' && typeof value !== 'object');
};
/***/ }),
/***/ "Bpkj":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const link = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M15.6 7.2H14v1.5h1.6c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.8 0 5.2-2.3 5.2-5.2 0-2.9-2.3-5.2-5.2-5.2zM4.7 12.4c0-2 1.7-3.7 3.7-3.7H10V7.2H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H10v-1.5H8.4c-2 0-3.7-1.7-3.7-3.7zm4.6.9h5.3v-1.5H9.3v1.5z"
}));
/* harmony default export */ __webpack_exports__["a"] = (link);
/***/ }),
/***/ "C6yU":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useContextSystem; });
/* harmony import */ var emotion__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("kDDq");
/* harmony import */ var _wordpress_warning__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Z23Y");
/* harmony import */ var _wordpress_warning__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_warning__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var _context_system_provider__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("6zzY");
/* harmony import */ var _utils__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("Ohaz");
/* harmony import */ var _get_styled_class_name_from_key__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("UAm0");
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/* eslint-disable jsdoc/valid-types */
/**
* @template TProps
* @typedef {TProps & { className: string; children?: import('react').ReactNode }} ConnectedProps
*/
/* eslint-enable jsdoc/valid-types */
/**
* Custom hook that derives registered props from the Context system.
* These derived props are then consolidated with incoming component props.
*
* @template {{ className?: string }} P
* @param {P} props Incoming props from the component.
* @param {string} namespace The namespace to register and to derive context props from.
* @return {ConnectedProps<P>} The connected props.
*/
function useContextSystem(props, namespace) {
const contextSystemProps = Object(_context_system_provider__WEBPACK_IMPORTED_MODULE_2__[/* useComponentsContext */ "a"])();
if (typeof namespace === 'undefined') {
typeof process !== "undefined" && process.env && "production" !== "production" ? _wordpress_warning__WEBPACK_IMPORTED_MODULE_1___default()('useContextSystem: Please provide a namespace') : void 0;
}
const contextProps = (contextSystemProps === null || contextSystemProps === void 0 ? void 0 : contextSystemProps[namespace]) || {};
/* eslint-disable jsdoc/no-undefined-types */
/** @type {ConnectedProps<P>} */
// @ts-ignore We fill in the missing properties below
const finalComponentProps = { ...Object(_utils__WEBPACK_IMPORTED_MODULE_3__[/* getConnectedNamespace */ "a"])(),
...Object(_utils__WEBPACK_IMPORTED_MODULE_3__[/* getNamespace */ "b"])(namespace)
};
/* eslint-enable jsdoc/no-undefined-types */
const {
_overrides: overrideProps,
...otherContextProps
} = contextProps;
const initialMergedProps = Object.entries(otherContextProps).length ? Object.assign({}, otherContextProps, props) : props;
const classes = Object(emotion__WEBPACK_IMPORTED_MODULE_0__[/* cx */ "b"])(Object(_get_styled_class_name_from_key__WEBPACK_IMPORTED_MODULE_4__[/* getStyledClassNameFromKey */ "a"])(namespace), props.className); // Provides the ability to customize the render of the component.
const rendered = typeof initialMergedProps.renderChildren === 'function' ? initialMergedProps.renderChildren(initialMergedProps) : initialMergedProps.children;
for (const key in initialMergedProps) {
// @ts-ignore filling in missing props
finalComponentProps[key] = initialMergedProps[key];
}
for (const key in overrideProps) {
// @ts-ignore filling in missing props
finalComponentProps[key] = overrideProps[key];
}
finalComponentProps.children = rendered;
finalComponentProps.className = classes;
return finalComponentProps;
}
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("8oxB")))
/***/ }),
/***/ "CGNl":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var has = __webpack_require__("oNNP");
var assertRecord = __webpack_require__("10Kj");
var Type = __webpack_require__("V1cy");
// https://ecma-international.org/ecma-262/6.0/#sec-isdatadescriptor
module.exports = function IsDataDescriptor(Desc) {
if (typeof Desc === 'undefined') {
return false;
}
assertRecord(Type, 'Property Descriptor', 'Desc', Desc);
if (!has(Desc, '[[Value]]') && !has(Desc, '[[Writable]]')) {
return false;
}
return true;
};
/***/ }),
/***/ "Cw+6":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("YLtl");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__);
/**
* External dependencies
*/
/** @typedef {string | { display: string, ariaLabel: string }} Shortcut */
/**
* @typedef Props
* @property {Shortcut} shortcut Shortcut configuration
* @property {string} [className] Classname
*/
/**
* @param {Props} props Props
* @return {JSX.Element | null} Element
*/
function Shortcut({
shortcut,
className
}) {
if (!shortcut) {
return null;
}
let displayText;
let ariaLabel;
if (Object(lodash__WEBPACK_IMPORTED_MODULE_1__["isString"])(shortcut)) {
displayText = shortcut;
}
if (Object(lodash__WEBPACK_IMPORTED_MODULE_1__["isObject"])(shortcut)) {
displayText = shortcut.display;
ariaLabel = shortcut.ariaLabel;
}
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("span", {
className: className,
"aria-label": ariaLabel
}, displayText);
}
/* harmony default export */ __webpack_exports__["a"] = (Shortcut);
/***/ }),
/***/ "D3zA":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var implementation = __webpack_require__("aI7X");
module.exports = Function.prototype.bind || implementation;
/***/ }),
/***/ "DHWS":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var ChevronDown = function () {
function ChevronDown(props) {
return _react2['default'].createElement(
'svg',
props,
_react2['default'].createElement('path', {
d: 'M967.5 288.5L514.3 740.7c-11 11-21 11-32 0L29.1 288.5c-4-5-6-11-6-16 0-13 10-23 23-23 6 0 11 2 15 7l437.2 436.2 437.2-436.2c4-5 9-7 16-7 6 0 11 2 16 7 9 10.9 9 21 0 32z'
})
);
}
return ChevronDown;
}();
ChevronDown.defaultProps = {
viewBox: '0 0 1000 1000'
};
exports['default'] = ChevronDown;
/***/ }),
/***/ "DciD":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
function noop() {
return null;
}
noop.isRequired = noop;
function noopThunk() {
return noop;
}
module.exports = {
and: noopThunk,
between: noopThunk,
booleanSome: noopThunk,
childrenHavePropXorChildren: noopThunk,
childrenOf: noopThunk,
childrenOfType: noopThunk,
childrenSequenceOf: noopThunk,
componentWithName: noopThunk,
disallowedIf: noopThunk,
elementType: noopThunk,
empty: noopThunk,
explicitNull: noopThunk,
forbidExtraProps: Object,
integer: noopThunk,
keysOf: noopThunk,
mutuallyExclusiveProps: noopThunk,
mutuallyExclusiveTrueProps: noopThunk,
nChildren: noopThunk,
nonNegativeInteger: noop,
nonNegativeNumber: noopThunk,
numericString: noopThunk,
object: noopThunk,
or: noopThunk,
predicate: noopThunk,
range: noopThunk,
ref: noopThunk,
requiredBy: noopThunk,
restrictedProp: noopThunk,
sequenceOf: noopThunk,
shape: noopThunk,
stringEndsWith: noopThunk,
stringStartsWith: noopThunk,
uniqueArray: noopThunk,
uniqueArrayOf: noopThunk,
valuesOf: noopThunk,
withShape: noopThunk
};
/***/ }),
/***/ "DmXP":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var getDay = Date.prototype.getDay;
var tryDateObject = function tryDateGetDayCall(value) {
try {
getDay.call(value);
return true;
} catch (e) {
return false;
}
};
var toStr = Object.prototype.toString;
var dateClass = '[object Date]';
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
module.exports = function isDateObject(value) {
if (typeof value !== 'object' || value === null) {
return false;
}
return hasToStringTag ? tryDateObject(value) : toStr.call(value) === dateClass;
};
/***/ }),
/***/ "DvWQ":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $TypeError = GetIntrinsic('%TypeError%');
var DefineOwnProperty = __webpack_require__("wTIp");
var FromPropertyDescriptor = __webpack_require__("zYbv");
var OrdinaryGetOwnProperty = __webpack_require__("kgBv");
var IsDataDescriptor = __webpack_require__("CGNl");
var IsExtensible = __webpack_require__("rDFq");
var IsPropertyKey = __webpack_require__("i10q");
var SameValue = __webpack_require__("HI8u");
var Type = __webpack_require__("V1cy");
// https://ecma-international.org/ecma-262/6.0/#sec-createdataproperty
module.exports = function CreateDataProperty(O, P, V) {
if (Type(O) !== 'Object') {
throw new $TypeError('Assertion failed: Type(O) is not Object');
}
if (!IsPropertyKey(P)) {
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
}
var oldDesc = OrdinaryGetOwnProperty(O, P);
var extensible = !oldDesc || IsExtensible(O);
var immutable = oldDesc && (!oldDesc['[[Writable]]'] || !oldDesc['[[Configurable]]']);
if (immutable || !extensible) {
return false;
}
return DefineOwnProperty(
IsDataDescriptor,
SameValue,
FromPropertyDescriptor,
O,
P,
{
'[[Configurable]]': true,
'[[Enumerable]]': true,
'[[Value]]': V,
'[[Writable]]': true
}
);
};
/***/ }),
/***/ "DzJC":
/***/ (function(module, exports, __webpack_require__) {
var debounce = __webpack_require__("sEfC"),
isObject = __webpack_require__("GoyQ");
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';
/**
* Creates a throttled function that only invokes `func` at most once per
* every `wait` milliseconds. The throttled function comes with a `cancel`
* method to cancel delayed `func` invocations and a `flush` method to
* immediately invoke them. Provide `options` to indicate whether `func`
* should be invoked on the leading and/or trailing edge of the `wait`
* timeout. The `func` is invoked with the last arguments provided to the
* throttled function. Subsequent calls to the throttled function return the
* result of the last `func` invocation.
*
* **Note:** If `leading` and `trailing` options are `true`, `func` is
* invoked on the trailing edge of the timeout only if the throttled function
* is invoked more than once during the `wait` timeout.
*
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
*
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
* for details over the differences between `_.throttle` and `_.debounce`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to throttle.
* @param {number} [wait=0] The number of milliseconds to throttle invocations to.
* @param {Object} [options={}] The options object.
* @param {boolean} [options.leading=true]
* Specify invoking on the leading edge of the timeout.
* @param {boolean} [options.trailing=true]
* Specify invoking on the trailing edge of the timeout.
* @returns {Function} Returns the new throttled function.
* @example
*
* // Avoid excessively updating the position while scrolling.
* jQuery(window).on('scroll', _.throttle(updatePosition, 100));
*
* // Invoke `renewToken` when the click event is fired, but not more than once every 5 minutes.
* var throttled = _.throttle(renewToken, 300000, { 'trailing': false });
* jQuery(element).on('click', throttled);
*
* // Cancel the trailing throttled invocation.
* jQuery(window).on('popstate', throttled.cancel);
*/
function throttle(func, wait, options) {
var leading = true,
trailing = true;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
if (isObject(options)) {
leading = 'leading' in options ? !!options.leading : leading;
trailing = 'trailing' in options ? !!options.trailing : trailing;
}
return debounce(func, wait, {
'leading': leading,
'maxWait': wait,
'trailing': trailing
});
}
module.exports = throttle;
/***/ }),
/***/ "EXo9":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var callBind = __webpack_require__("hZ2/");
var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
module.exports = function callBoundIntrinsic(name, allowMissing) {
var intrinsic = GetIntrinsic(name, !!allowMissing);
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
return callBind(intrinsic);
}
return intrinsic;
};
/***/ }),
/***/ "ExA7":
/***/ (function(module, exports) {
/**
* Checks if `value` is object-like. A value is object-like if it's not `null`
* and has a `typeof` result of "object".
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
* @example
*
* _.isObjectLike({});
* // => true
*
* _.isObjectLike([1, 2, 3]);
* // => true
*
* _.isObjectLike(_.noop);
* // => false
*
* _.isObjectLike(null);
* // => false
*/
function isObjectLike(value) {
return value != null && typeof value == 'object';
}
module.exports = isObjectLike;
/***/ }),
/***/ "F7ZS":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = getCalendarMonthWeeks;
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _constants = __webpack_require__("Fv1B");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function getCalendarMonthWeeks(month, enableOutsideDays) {
var firstDayOfWeek = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _moment2['default'].localeData().firstDayOfWeek();
if (!_moment2['default'].isMoment(month) || !month.isValid()) {
throw new TypeError('`month` must be a valid moment object');
}
if (_constants.WEEKDAYS.indexOf(firstDayOfWeek) === -1) {
throw new TypeError('`firstDayOfWeek` must be an integer between 0 and 6');
}
// set utc offset to get correct dates in future (when timezone changes)
var firstOfMonth = month.clone().startOf('month').hour(12);
var lastOfMonth = month.clone().endOf('month').hour(12);
// calculate the exact first and last days to fill the entire matrix
// (considering days outside month)
var prevDays = (firstOfMonth.day() + 7 - firstDayOfWeek) % 7;
var nextDays = (firstDayOfWeek + 6 - lastOfMonth.day()) % 7;
var firstDay = firstOfMonth.clone().subtract(prevDays, 'day');
var lastDay = lastOfMonth.clone().add(nextDays, 'day');
var totalDays = lastDay.diff(firstDay, 'days') + 1;
var currentDay = firstDay.clone();
var weeksInMonth = [];
for (var i = 0; i < totalDays; i += 1) {
if (i % 7 === 0) {
weeksInMonth.push([]);
}
var day = null;
if (i >= prevDays && i < totalDays - nextDays || enableOutsideDays) {
day = currentDay.clone();
}
weeksInMonth[weeksInMonth.length - 1].push(day);
currentDay.add(1, 'day');
}
return weeksInMonth;
}
/***/ }),
/***/ "FpZJ":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* eslint complexity: [2, 18], max-statements: [2, 33] */
module.exports = function hasSymbols() {
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
if (typeof Symbol.iterator === 'symbol') { return true; }
var obj = {};
var sym = Symbol('test');
var symObj = Object(sym);
if (typeof sym === 'string') { return false; }
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
// temp disabled per https://github.com/ljharb/object.assign/issues/17
// if (sym instanceof Symbol) { return false; }
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
// if (!(symObj instanceof Symbol)) { return false; }
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
var symVal = 42;
obj[sym] = symVal;
for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
var syms = Object.getOwnPropertySymbols(obj);
if (syms.length !== 1 || syms[0] !== sym) { return false; }
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
if (typeof Object.getOwnPropertyDescriptor === 'function') {
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
}
return true;
};
/***/ }),
/***/ "FqII":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["date"]; }());
/***/ }),
/***/ "FufO":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// modified from https://github.com/es-shims/es6-shim
var keys = __webpack_require__("1seS");
var canBeObject = function (obj) {
return typeof obj !== 'undefined' && obj !== null;
};
var hasSymbols = __webpack_require__("FpZJ")();
var callBound = __webpack_require__("VF6F");
var toObject = Object;
var $push = callBound('Array.prototype.push');
var $propIsEnumerable = callBound('Object.prototype.propertyIsEnumerable');
var originalGetSymbols = hasSymbols ? Object.getOwnPropertySymbols : null;
// eslint-disable-next-line no-unused-vars
module.exports = function assign(target, source1) {
if (!canBeObject(target)) { throw new TypeError('target must be an object'); }
var objTarget = toObject(target);
var s, source, i, props, syms, value, key;
for (s = 1; s < arguments.length; ++s) {
source = toObject(arguments[s]);
props = keys(source);
var getSymbols = hasSymbols && (Object.getOwnPropertySymbols || originalGetSymbols);
if (getSymbols) {
syms = getSymbols(source);
for (i = 0; i < syms.length; ++i) {
key = syms[i];
if ($propIsEnumerable(source, key)) {
$push(props, key);
}
}
}
for (i = 0; i < props.length; ++i) {
key = props[i];
value = source[key];
if ($propIsEnumerable(source, key)) {
objTarget[key] = value;
}
}
}
return objTarget;
};
/***/ }),
/***/ "Fv1B":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var DISPLAY_FORMAT = exports.DISPLAY_FORMAT = 'L';
var ISO_FORMAT = exports.ISO_FORMAT = 'YYYY-MM-DD';
var ISO_MONTH_FORMAT = exports.ISO_MONTH_FORMAT = 'YYYY-MM';
var START_DATE = exports.START_DATE = 'startDate';
var END_DATE = exports.END_DATE = 'endDate';
var HORIZONTAL_ORIENTATION = exports.HORIZONTAL_ORIENTATION = 'horizontal';
var VERTICAL_ORIENTATION = exports.VERTICAL_ORIENTATION = 'vertical';
var VERTICAL_SCROLLABLE = exports.VERTICAL_SCROLLABLE = 'verticalScrollable';
var ICON_BEFORE_POSITION = exports.ICON_BEFORE_POSITION = 'before';
var ICON_AFTER_POSITION = exports.ICON_AFTER_POSITION = 'after';
var INFO_POSITION_TOP = exports.INFO_POSITION_TOP = 'top';
var INFO_POSITION_BOTTOM = exports.INFO_POSITION_BOTTOM = 'bottom';
var INFO_POSITION_BEFORE = exports.INFO_POSITION_BEFORE = 'before';
var INFO_POSITION_AFTER = exports.INFO_POSITION_AFTER = 'after';
var ANCHOR_LEFT = exports.ANCHOR_LEFT = 'left';
var ANCHOR_RIGHT = exports.ANCHOR_RIGHT = 'right';
var OPEN_DOWN = exports.OPEN_DOWN = 'down';
var OPEN_UP = exports.OPEN_UP = 'up';
var DAY_SIZE = exports.DAY_SIZE = 39;
var BLOCKED_MODIFIER = exports.BLOCKED_MODIFIER = 'blocked';
var WEEKDAYS = exports.WEEKDAYS = [0, 1, 2, 3, 4, 5, 6];
var FANG_WIDTH_PX = exports.FANG_WIDTH_PX = 20;
var FANG_HEIGHT_PX = exports.FANG_HEIGHT_PX = 10;
var DEFAULT_VERTICAL_SPACING = exports.DEFAULT_VERTICAL_SPACING = 22;
var MODIFIER_KEY_NAMES = exports.MODIFIER_KEY_NAMES = new Set(['Shift', 'Control', 'Alt', 'Meta']);
/***/ }),
/***/ "G3V0":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export Tabbable */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useTabbable; });
/* harmony import */ var _rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("BZp5");
/* harmony import */ var reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("hE48");
/* harmony import */ var reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("qdes");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("cDcd");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var reakit_utils_useForkRef__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("aU41");
/* harmony import */ var reakit_utils_isButton__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("71Og");
/* harmony import */ var reakit_warning__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("KA1K");
/* harmony import */ var reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("eNtd");
/* harmony import */ var reakit_utils_useIsomorphicEffect__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("AXvK");
/* harmony import */ var reakit_utils_hasFocusWithin__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("PcHe");
/* harmony import */ var reakit_utils_isPortalEvent__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("Vq1w");
/* harmony import */ var reakit_utils_dom__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("reMF");
/* harmony import */ var reakit_utils_tabbable__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("kqkJ");
/* harmony import */ var _Role_Role_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__("zGFp");
// Automatically generated
var TABBABLE_KEYS = ["disabled", "focusable"];
var isSafariOrFirefoxOnMac = Object(reakit_utils_dom__WEBPACK_IMPORTED_MODULE_11__[/* isUA */ "a"])("Mac") && !Object(reakit_utils_dom__WEBPACK_IMPORTED_MODULE_11__[/* isUA */ "a"])("Chrome") && (Object(reakit_utils_dom__WEBPACK_IMPORTED_MODULE_11__[/* isUA */ "a"])("Safari") || Object(reakit_utils_dom__WEBPACK_IMPORTED_MODULE_11__[/* isUA */ "a"])("Firefox"));
function focusIfNeeded(element) {
if (!Object(reakit_utils_hasFocusWithin__WEBPACK_IMPORTED_MODULE_9__[/* hasFocusWithin */ "a"])(element) && Object(reakit_utils_tabbable__WEBPACK_IMPORTED_MODULE_12__[/* isFocusable */ "a"])(element)) {
element.focus();
}
}
function isNativeTabbable(element) {
return element.tagName === "BUTTON" || element.tagName === "INPUT" || element.tagName === "SELECT" || element.tagName === "TEXTAREA" || element.tagName === "A";
}
function supportsDisabledAttribute(element) {
return element.tagName === "BUTTON" || element.tagName === "INPUT" || element.tagName === "SELECT" || element.tagName === "TEXTAREA";
}
function getTabIndex(trulyDisabled, nativeTabbable, supportsDisabled, htmlTabIndex) {
if (trulyDisabled) {
if (nativeTabbable && !supportsDisabled) {
// Anchor, audio and video tags don't support the `disabled` attribute.
// We must pass tabIndex={-1} so they don't receive focus on tab.
return -1;
} // Elements that support the `disabled` attribute don't need tabIndex.
return undefined;
}
if (nativeTabbable) {
// If the element is enabled and it's natively tabbable, we don't need to
// specify a tabIndex attribute unless it's explicitly set by the user.
return htmlTabIndex;
} // If the element is enabled and is not natively tabbable, we have to
// fallback tabIndex={0}.
return htmlTabIndex || 0;
}
function useDisableEvent(htmlEventRef, disabled) {
return Object(react__WEBPACK_IMPORTED_MODULE_3__["useCallback"])(function (event) {
var _htmlEventRef$current;
(_htmlEventRef$current = htmlEventRef.current) === null || _htmlEventRef$current === void 0 ? void 0 : _htmlEventRef$current.call(htmlEventRef, event);
if (event.defaultPrevented) return;
if (disabled) {
event.stopPropagation();
event.preventDefault();
}
}, [htmlEventRef, disabled]);
}
var useTabbable = Object(reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__[/* createHook */ "a"])({
name: "Tabbable",
compose: _Role_Role_js__WEBPACK_IMPORTED_MODULE_13__[/* useRole */ "a"],
keys: TABBABLE_KEYS,
useOptions: function useOptions(options, _ref) {
var disabled = _ref.disabled;
return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({
disabled: disabled
}, options);
},
useProps: function useProps(options, _ref2) {
var htmlRef = _ref2.ref,
htmlTabIndex = _ref2.tabIndex,
htmlOnClickCapture = _ref2.onClickCapture,
htmlOnMouseDownCapture = _ref2.onMouseDownCapture,
htmlOnMouseDown = _ref2.onMouseDown,
htmlOnKeyPressCapture = _ref2.onKeyPressCapture,
htmlStyle = _ref2.style,
htmlProps = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(_ref2, ["ref", "tabIndex", "onClickCapture", "onMouseDownCapture", "onMouseDown", "onKeyPressCapture", "style"]);
var ref = Object(react__WEBPACK_IMPORTED_MODULE_3__["useRef"])(null);
var onClickCaptureRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_7__[/* useLiveRef */ "a"])(htmlOnClickCapture);
var onMouseDownCaptureRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_7__[/* useLiveRef */ "a"])(htmlOnMouseDownCapture);
var onMouseDownRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_7__[/* useLiveRef */ "a"])(htmlOnMouseDown);
var onKeyPressCaptureRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_7__[/* useLiveRef */ "a"])(htmlOnKeyPressCapture);
var trulyDisabled = !!options.disabled && !options.focusable;
var _React$useState = Object(react__WEBPACK_IMPORTED_MODULE_3__["useState"])(true),
nativeTabbable = _React$useState[0],
setNativeTabbable = _React$useState[1];
var _React$useState2 = Object(react__WEBPACK_IMPORTED_MODULE_3__["useState"])(true),
supportsDisabled = _React$useState2[0],
setSupportsDisabled = _React$useState2[1];
var style = options.disabled ? Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({
pointerEvents: "none"
}, htmlStyle) : htmlStyle;
Object(reakit_utils_useIsomorphicEffect__WEBPACK_IMPORTED_MODULE_8__[/* useIsomorphicEffect */ "a"])(function () {
var tabbable = ref.current;
if (!tabbable) {
false ? undefined : void 0;
return;
}
if (!isNativeTabbable(tabbable)) {
setNativeTabbable(false);
}
if (!supportsDisabledAttribute(tabbable)) {
setSupportsDisabled(false);
}
}, []);
var onClickCapture = useDisableEvent(onClickCaptureRef, options.disabled);
var onMouseDownCapture = useDisableEvent(onMouseDownCaptureRef, options.disabled);
var onKeyPressCapture = useDisableEvent(onKeyPressCaptureRef, options.disabled);
var onMouseDown = Object(react__WEBPACK_IMPORTED_MODULE_3__["useCallback"])(function (event) {
var _onMouseDownRef$curre;
(_onMouseDownRef$curre = onMouseDownRef.current) === null || _onMouseDownRef$curre === void 0 ? void 0 : _onMouseDownRef$curre.call(onMouseDownRef, event);
var element = event.currentTarget;
if (event.defaultPrevented) return; // Safari and Firefox on MacOS don't focus on buttons on mouse down
// like other browsers/platforms. Instead, they focus on the closest
// focusable ancestor element, which is ultimately the body element. So
// we make sure to give focus to the tabbable element on mouse down so
// it works consistently across browsers.
if (!isSafariOrFirefoxOnMac) return;
if (Object(reakit_utils_isPortalEvent__WEBPACK_IMPORTED_MODULE_10__[/* isPortalEvent */ "a"])(event)) return;
if (!Object(reakit_utils_isButton__WEBPACK_IMPORTED_MODULE_5__[/* isButton */ "a"])(element)) return; // We can't focus right away after on mouse down, otherwise it would
// prevent drag events from happening. So we schedule the focus to the
// next animation frame.
var raf = requestAnimationFrame(function () {
element.removeEventListener("mouseup", focusImmediately, true);
focusIfNeeded(element);
}); // If mouseUp happens before the next animation frame (which is common
// on touch screens or by just tapping the trackpad on MacBook's), we
// cancel the animation frame and immediately focus on the element.
var focusImmediately = function focusImmediately() {
cancelAnimationFrame(raf);
focusIfNeeded(element);
}; // By listening to the event in the capture phase, we make sure the
// focus event is fired before the onMouseUp and onMouseUpCapture React
// events, which is aligned with the default browser behavior.
element.addEventListener("mouseup", focusImmediately, {
once: true,
capture: true
});
}, []);
return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({
ref: Object(reakit_utils_useForkRef__WEBPACK_IMPORTED_MODULE_4__[/* useForkRef */ "a"])(ref, htmlRef),
style: style,
tabIndex: getTabIndex(trulyDisabled, nativeTabbable, supportsDisabled, htmlTabIndex),
disabled: trulyDisabled && supportsDisabled ? true : undefined,
"aria-disabled": options.disabled ? true : undefined,
onClickCapture: onClickCapture,
onMouseDownCapture: onMouseDownCapture,
onMouseDown: onMouseDown,
onKeyPressCapture: onKeyPressCapture
}, htmlProps);
}
});
var Tabbable = Object(reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__[/* createComponent */ "a"])({
as: "div",
useHook: useTabbable
});
/***/ }),
/***/ "GET3":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PureCustomizableCalendarDay = exports.selectedStyles = exports.lastInRangeStyles = exports.selectedSpanStyles = exports.hoveredSpanStyles = exports.blockedOutOfRangeStyles = exports.blockedCalendarStyles = exports.blockedMinNightsStyles = exports.highlightedCalendarStyles = exports.outsideStyles = exports.defaultStyles = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _object = __webpack_require__("Koq/");
var _object2 = _interopRequireDefault(_object);
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactAddonsShallowCompare = __webpack_require__("YZDV");
var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare);
var _reactMomentProptypes = __webpack_require__("XGBb");
var _reactMomentProptypes2 = _interopRequireDefault(_reactMomentProptypes);
var _airbnbPropTypes = __webpack_require__("Hsqg");
var _reactWithStyles = __webpack_require__("TG4+");
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _defaultPhrases = __webpack_require__("vV+G");
var _getPhrasePropTypes = __webpack_require__("yc2e");
var _getPhrasePropTypes2 = _interopRequireDefault(_getPhrasePropTypes);
var _getCalendarDaySettings = __webpack_require__("Ae65");
var _getCalendarDaySettings2 = _interopRequireDefault(_getCalendarDaySettings);
var _constants = __webpack_require__("Fv1B");
var _DefaultTheme = __webpack_require__("xOhs");
var _DefaultTheme2 = _interopRequireDefault(_DefaultTheme);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var color = _DefaultTheme2['default'].reactDates.color;
function getStyles(stylesObj, isHovered) {
if (!stylesObj) return null;
var hover = stylesObj.hover;
if (isHovered && hover) {
return hover;
}
return stylesObj;
}
var DayStyleShape = _propTypes2['default'].shape({
background: _propTypes2['default'].string,
border: (0, _airbnbPropTypes.or)([_propTypes2['default'].string, _propTypes2['default'].number]),
color: _propTypes2['default'].string,
hover: _propTypes2['default'].shape({
background: _propTypes2['default'].string,
border: (0, _airbnbPropTypes.or)([_propTypes2['default'].string, _propTypes2['default'].number]),
color: _propTypes2['default'].string
})
});
var propTypes = (0, _airbnbPropTypes.forbidExtraProps)((0, _object2['default'])({}, _reactWithStyles.withStylesPropTypes, {
day: _reactMomentProptypes2['default'].momentObj,
daySize: _airbnbPropTypes.nonNegativeInteger,
isOutsideDay: _propTypes2['default'].bool,
modifiers: _propTypes2['default'].instanceOf(Set),
isFocused: _propTypes2['default'].bool,
tabIndex: _propTypes2['default'].oneOf([0, -1]),
onDayClick: _propTypes2['default'].func,
onDayMouseEnter: _propTypes2['default'].func,
onDayMouseLeave: _propTypes2['default'].func,
renderDayContents: _propTypes2['default'].func,
ariaLabelFormat: _propTypes2['default'].string,
// style overrides
defaultStyles: DayStyleShape,
outsideStyles: DayStyleShape,
todayStyles: DayStyleShape,
firstDayOfWeekStyles: DayStyleShape,
lastDayOfWeekStyles: DayStyleShape,
highlightedCalendarStyles: DayStyleShape,
blockedMinNightsStyles: DayStyleShape,
blockedCalendarStyles: DayStyleShape,
blockedOutOfRangeStyles: DayStyleShape,
hoveredSpanStyles: DayStyleShape,
selectedSpanStyles: DayStyleShape,
lastInRangeStyles: DayStyleShape,
selectedStyles: DayStyleShape,
selectedStartStyles: DayStyleShape,
selectedEndStyles: DayStyleShape,
afterHoveredStartStyles: DayStyleShape,
// internationalization
phrases: _propTypes2['default'].shape((0, _getPhrasePropTypes2['default'])(_defaultPhrases.CalendarDayPhrases))
}));
var defaultStyles = exports.defaultStyles = {
border: '1px solid ' + String(color.core.borderLight),
color: color.text,
background: color.background,
hover: {
background: color.core.borderLight,
border: '1px double ' + String(color.core.borderLight),
color: 'inherit'
}
};
var outsideStyles = exports.outsideStyles = {
background: color.outside.backgroundColor,
border: 0,
color: color.outside.color
};
var highlightedCalendarStyles = exports.highlightedCalendarStyles = {
background: color.highlighted.backgroundColor,
color: color.highlighted.color,
hover: {
background: color.highlighted.backgroundColor_hover,
color: color.highlighted.color_active
}
};
var blockedMinNightsStyles = exports.blockedMinNightsStyles = {
background: color.minimumNights.backgroundColor,
border: '1px solid ' + String(color.minimumNights.borderColor),
color: color.minimumNights.color,
hover: {
background: color.minimumNights.backgroundColor_hover,
color: color.minimumNights.color_active
}
};
var blockedCalendarStyles = exports.blockedCalendarStyles = {
background: color.blocked_calendar.backgroundColor,
border: '1px solid ' + String(color.blocked_calendar.borderColor),
color: color.blocked_calendar.color,
hover: {
background: color.blocked_calendar.backgroundColor_hover,
border: '1px solid ' + String(color.blocked_calendar.borderColor),
color: color.blocked_calendar.color_active
}
};
var blockedOutOfRangeStyles = exports.blockedOutOfRangeStyles = {
background: color.blocked_out_of_range.backgroundColor,
border: '1px solid ' + String(color.blocked_out_of_range.borderColor),
color: color.blocked_out_of_range.color,
hover: {
background: color.blocked_out_of_range.backgroundColor_hover,
border: '1px solid ' + String(color.blocked_out_of_range.borderColor),
color: color.blocked_out_of_range.color_active
}
};
var hoveredSpanStyles = exports.hoveredSpanStyles = {
background: color.hoveredSpan.backgroundColor,
border: '1px solid ' + String(color.hoveredSpan.borderColor),
color: color.hoveredSpan.color,
hover: {
background: color.hoveredSpan.backgroundColor_hover,
border: '1px solid ' + String(color.hoveredSpan.borderColor),
color: color.hoveredSpan.color_active
}
};
var selectedSpanStyles = exports.selectedSpanStyles = {
background: color.selectedSpan.backgroundColor,
border: '1px solid ' + String(color.selectedSpan.borderColor),
color: color.selectedSpan.color,
hover: {
background: color.selectedSpan.backgroundColor_hover,
border: '1px solid ' + String(color.selectedSpan.borderColor),
color: color.selectedSpan.color_active
}
};
var lastInRangeStyles = exports.lastInRangeStyles = {
borderRight: color.core.primary
};
var selectedStyles = exports.selectedStyles = {
background: color.selected.backgroundColor,
border: '1px solid ' + String(color.selected.borderColor),
color: color.selected.color,
hover: {
background: color.selected.backgroundColor_hover,
border: '1px solid ' + String(color.selected.borderColor),
color: color.selected.color_active
}
};
var defaultProps = {
day: (0, _moment2['default'])(),
daySize: _constants.DAY_SIZE,
isOutsideDay: false,
modifiers: new Set(),
isFocused: false,
tabIndex: -1,
onDayClick: function () {
function onDayClick() {}
return onDayClick;
}(),
onDayMouseEnter: function () {
function onDayMouseEnter() {}
return onDayMouseEnter;
}(),
onDayMouseLeave: function () {
function onDayMouseLeave() {}
return onDayMouseLeave;
}(),
renderDayContents: null,
ariaLabelFormat: 'dddd, LL',
// style defaults
defaultStyles: defaultStyles,
outsideStyles: outsideStyles,
todayStyles: {},
highlightedCalendarStyles: highlightedCalendarStyles,
blockedMinNightsStyles: blockedMinNightsStyles,
blockedCalendarStyles: blockedCalendarStyles,
blockedOutOfRangeStyles: blockedOutOfRangeStyles,
hoveredSpanStyles: hoveredSpanStyles,
selectedSpanStyles: selectedSpanStyles,
lastInRangeStyles: lastInRangeStyles,
selectedStyles: selectedStyles,
selectedStartStyles: {},
selectedEndStyles: {},
afterHoveredStartStyles: {},
firstDayOfWeekStyles: {},
lastDayOfWeekStyles: {},
// internationalization
phrases: _defaultPhrases.CalendarDayPhrases
};
var CustomizableCalendarDay = function (_React$Component) {
_inherits(CustomizableCalendarDay, _React$Component);
function CustomizableCalendarDay() {
var _ref;
_classCallCheck(this, CustomizableCalendarDay);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var _this = _possibleConstructorReturn(this, (_ref = CustomizableCalendarDay.__proto__ || Object.getPrototypeOf(CustomizableCalendarDay)).call.apply(_ref, [this].concat(args)));
_this.state = {
isHovered: false
};
_this.setButtonRef = _this.setButtonRef.bind(_this);
return _this;
}
_createClass(CustomizableCalendarDay, [{
key: 'shouldComponentUpdate',
value: function () {
function shouldComponentUpdate(nextProps, nextState) {
return (0, _reactAddonsShallowCompare2['default'])(this, nextProps, nextState);
}
return shouldComponentUpdate;
}()
}, {
key: 'componentDidUpdate',
value: function () {
function componentDidUpdate(prevProps) {
var _props = this.props,
isFocused = _props.isFocused,
tabIndex = _props.tabIndex;
if (tabIndex === 0) {
if (isFocused || tabIndex !== prevProps.tabIndex) {
this.buttonRef.focus();
}
}
}
return componentDidUpdate;
}()
}, {
key: 'onDayClick',
value: function () {
function onDayClick(day, e) {
var onDayClick = this.props.onDayClick;
onDayClick(day, e);
}
return onDayClick;
}()
}, {
key: 'onDayMouseEnter',
value: function () {
function onDayMouseEnter(day, e) {
var onDayMouseEnter = this.props.onDayMouseEnter;
this.setState({ isHovered: true });
onDayMouseEnter(day, e);
}
return onDayMouseEnter;
}()
}, {
key: 'onDayMouseLeave',
value: function () {
function onDayMouseLeave(day, e) {
var onDayMouseLeave = this.props.onDayMouseLeave;
this.setState({ isHovered: false });
onDayMouseLeave(day, e);
}
return onDayMouseLeave;
}()
}, {
key: 'onKeyDown',
value: function () {
function onKeyDown(day, e) {
var onDayClick = this.props.onDayClick;
var key = e.key;
if (key === 'Enter' || key === ' ') {
onDayClick(day, e);
}
}
return onKeyDown;
}()
}, {
key: 'setButtonRef',
value: function () {
function setButtonRef(ref) {
this.buttonRef = ref;
}
return setButtonRef;
}()
}, {
key: 'render',
value: function () {
function render() {
var _this2 = this;
var _props2 = this.props,
day = _props2.day,
ariaLabelFormat = _props2.ariaLabelFormat,
daySize = _props2.daySize,
isOutsideDay = _props2.isOutsideDay,
modifiers = _props2.modifiers,
tabIndex = _props2.tabIndex,
renderDayContents = _props2.renderDayContents,
styles = _props2.styles,
phrases = _props2.phrases,
defaultStylesWithHover = _props2.defaultStyles,
outsideStylesWithHover = _props2.outsideStyles,
todayStylesWithHover = _props2.todayStyles,
firstDayOfWeekStylesWithHover = _props2.firstDayOfWeekStyles,
lastDayOfWeekStylesWithHover = _props2.lastDayOfWeekStyles,
highlightedCalendarStylesWithHover = _props2.highlightedCalendarStyles,
blockedMinNightsStylesWithHover = _props2.blockedMinNightsStyles,
blockedCalendarStylesWithHover = _props2.blockedCalendarStyles,
blockedOutOfRangeStylesWithHover = _props2.blockedOutOfRangeStyles,
hoveredSpanStylesWithHover = _props2.hoveredSpanStyles,
selectedSpanStylesWithHover = _props2.selectedSpanStyles,
lastInRangeStylesWithHover = _props2.lastInRangeStyles,
selectedStylesWithHover = _props2.selectedStyles,
selectedStartStylesWithHover = _props2.selectedStartStyles,
selectedEndStylesWithHover = _props2.selectedEndStyles,
afterHoveredStartStylesWithHover = _props2.afterHoveredStartStyles;
var isHovered = this.state.isHovered;
if (!day) return _react2['default'].createElement('td', null);
var _getCalendarDaySettin = (0, _getCalendarDaySettings2['default'])(day, ariaLabelFormat, daySize, modifiers, phrases),
daySizeStyles = _getCalendarDaySettin.daySizeStyles,
useDefaultCursor = _getCalendarDaySettin.useDefaultCursor,
selected = _getCalendarDaySettin.selected,
hoveredSpan = _getCalendarDaySettin.hoveredSpan,
isOutsideRange = _getCalendarDaySettin.isOutsideRange,
ariaLabel = _getCalendarDaySettin.ariaLabel;
return _react2['default'].createElement(
'td',
_extends({}, (0, _reactWithStyles.css)(styles.CalendarDay, useDefaultCursor && styles.CalendarDay__defaultCursor, daySizeStyles, getStyles(defaultStylesWithHover, isHovered), isOutsideDay && getStyles(outsideStylesWithHover, isHovered), modifiers.has('today') && getStyles(todayStylesWithHover, isHovered), modifiers.has('first-day-of-week') && getStyles(firstDayOfWeekStylesWithHover, isHovered), modifiers.has('last-day-of-week') && getStyles(lastDayOfWeekStylesWithHover, isHovered), modifiers.has('highlighted-calendar') && getStyles(highlightedCalendarStylesWithHover, isHovered), modifiers.has('blocked-minimum-nights') && getStyles(blockedMinNightsStylesWithHover, isHovered), modifiers.has('blocked-calendar') && getStyles(blockedCalendarStylesWithHover, isHovered), hoveredSpan && getStyles(hoveredSpanStylesWithHover, isHovered), modifiers.has('after-hovered-start') && getStyles(afterHoveredStartStylesWithHover, isHovered), modifiers.has('selected-span') && getStyles(selectedSpanStylesWithHover, isHovered), modifiers.has('last-in-range') && getStyles(lastInRangeStylesWithHover, isHovered), selected && getStyles(selectedStylesWithHover, isHovered), modifiers.has('selected-start') && getStyles(selectedStartStylesWithHover, isHovered), modifiers.has('selected-end') && getStyles(selectedEndStylesWithHover, isHovered), isOutsideRange && getStyles(blockedOutOfRangeStylesWithHover, isHovered)), {
role: 'button' // eslint-disable-line jsx-a11y/no-noninteractive-element-to-interactive-role
, ref: this.setButtonRef,
'aria-label': ariaLabel,
onMouseEnter: function () {
function onMouseEnter(e) {
_this2.onDayMouseEnter(day, e);
}
return onMouseEnter;
}(),
onMouseLeave: function () {
function onMouseLeave(e) {
_this2.onDayMouseLeave(day, e);
}
return onMouseLeave;
}(),
onMouseUp: function () {
function onMouseUp(e) {
e.currentTarget.blur();
}
return onMouseUp;
}(),
onClick: function () {
function onClick(e) {
_this2.onDayClick(day, e);
}
return onClick;
}(),
onKeyDown: function () {
function onKeyDown(e) {
_this2.onKeyDown(day, e);
}
return onKeyDown;
}(),
tabIndex: tabIndex
}),
renderDayContents ? renderDayContents(day, modifiers) : day.format('D')
);
}
return render;
}()
}]);
return CustomizableCalendarDay;
}(_react2['default'].Component);
CustomizableCalendarDay.propTypes = propTypes;
CustomizableCalendarDay.defaultProps = defaultProps;
exports.PureCustomizableCalendarDay = CustomizableCalendarDay;
exports['default'] = (0, _reactWithStyles.withStyles)(function (_ref2) {
var font = _ref2.reactDates.font;
return {
CalendarDay: {
boxSizing: 'border-box',
cursor: 'pointer',
fontSize: font.size,
textAlign: 'center',
':active': {
outline: 0
}
},
CalendarDay__defaultCursor: {
cursor: 'default'
}
};
})(CustomizableCalendarDay);
/***/ }),
/***/ "GG7f":
/***/ (function(module, exports, __webpack_require__) {
// eslint-disable-next-line import/no-unresolved
__webpack_require__("H24B");
/***/ }),
/***/ "GK4x":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/**
* WordPress dependencies
*/
const ToolbarContext = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createContext"])();
/* harmony default export */ __webpack_exports__["a"] = (ToolbarContext);
/***/ }),
/***/ "GRId":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["element"]; }());
/***/ }),
/***/ "Gn0q":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var define = __webpack_require__("82c2");
var getPolyfill = __webpack_require__("5yQQ");
module.exports = function shimContains() {
var polyfill = getPolyfill();
if (typeof document !== 'undefined') {
define(
document,
{ contains: polyfill },
{ contains: function () { return document.contains !== polyfill; } }
);
if (typeof Element !== 'undefined') {
define(
Element.prototype,
{ contains: polyfill },
{ contains: function () { return Element.prototype.contains !== polyfill; } }
);
}
}
return polyfill;
};
/***/ }),
/***/ "GoyQ":
/***/ (function(module, exports) {
/**
* Checks if `value` is the
* [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
* of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
* @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
* @example
*
* _.isObject({});
* // => true
*
* _.isObject([1, 2, 3]);
* // => true
*
* _.isObject(_.noop);
* // => true
*
* _.isObject(null);
* // => false
*/
function isObject(value) {
var type = typeof value;
return value != null && (type == 'object' || type == 'function');
}
module.exports = isObject;
/***/ }),
/***/ "H24B":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _registerCSSInterfaceWithDefaultTheme = __webpack_require__("TUyu");
var _registerCSSInterfaceWithDefaultTheme2 = _interopRequireDefault(_registerCSSInterfaceWithDefaultTheme);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
(0, _registerCSSInterfaceWithDefaultTheme2['default'])();
/***/ }),
/***/ "HI8u":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $isNaN = __webpack_require__("HwJD");
// http://262.ecma-international.org/5.1/#sec-9.12
module.exports = function SameValue(x, y) {
if (x === y) { // 0 === -0, but they are not identical.
if (x === 0) { return 1 / x === 1 / y; }
return true;
}
return $isNaN(x) && $isNaN(y);
};
/***/ }),
/***/ "Hsqg":
/***/ (function(module, exports, __webpack_require__) {
module.exports = true ? __webpack_require__("DciD") : undefined;
/***/ }),
/***/ "HwJD":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = Number.isNaN || function isNaN(a) {
return a !== a;
};
/***/ }),
/***/ "Hx/O":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $String = GetIntrinsic('%String%');
var $TypeError = GetIntrinsic('%TypeError%');
// https://ecma-international.org/ecma-262/6.0/#sec-tostring
module.exports = function ToString(argument) {
if (typeof argument === 'symbol') {
throw new $TypeError('Cannot convert a Symbol value to a string');
}
return $String(argument);
};
/***/ }),
/***/ "HyUg":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var origSymbol = typeof Symbol !== 'undefined' && Symbol;
var hasSymbolSham = __webpack_require__("eJkf");
module.exports = function hasNativeSymbols() {
if (typeof origSymbol !== 'function') { return false; }
if (typeof Symbol !== 'function') { return false; }
if (typeof origSymbol('foo') !== 'symbol') { return false; }
if (typeof Symbol('bar') !== 'symbol') { return false; }
return hasSymbolSham();
};
/***/ }),
/***/ "I/A+":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutPropertiesLoose; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return _objectSpread2; });
/* unused harmony export b */
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
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);
}
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;
}
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it;
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
it = o[Symbol.iterator]();
return it.next.bind(it);
}
/***/ }),
/***/ "IVEb":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useCreateElement; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("cDcd");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _SystemContext_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("eUCI");
/* harmony import */ var _rollupPluginBabelHelpers_0c84a174_js__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("RDTF");
function isRenderProp(children) {
return typeof children === "function";
}
/**
* Custom hook that will call `children` if it's a function. If
* `useCreateElement` has been passed to the context, it'll be used instead.
*
* @example
* import React from "react";
* import { SystemProvider, useCreateElement } from "reakit-system";
*
* const system = {
* useCreateElement(type, props, children = props.children) {
* // very similar to what `useCreateElement` does already
* if (typeof children === "function") {
* const { children: _, ...rest } = props;
* return children(rest);
* }
* return React.createElement(type, props, children);
* },
* };
*
* function Component(props) {
* return useCreateElement("div", props);
* }
*
* function App() {
* return (
* <SystemProvider unstable_system={system}>
* <Component url="url">{({ url }) => <a href={url}>link</a>}</Component>
* </SystemProvider>
* );
* }
*/
var useCreateElement = function useCreateElement(type, props, children) {
if (children === void 0) {
children = props.children;
}
var context = Object(react__WEBPACK_IMPORTED_MODULE_0__["useContext"])(_SystemContext_js__WEBPACK_IMPORTED_MODULE_1__[/* SystemContext */ "a"]);
if (context.useCreateElement) {
return context.useCreateElement(type, props, children);
}
if (typeof type === "string" && isRenderProp(children)) {
var _ = props.children,
rest = Object(_rollupPluginBabelHelpers_0c84a174_js__WEBPACK_IMPORTED_MODULE_2__[/* a */ "b"])(props, ["children"]);
return children(rest);
}
return /*#__PURE__*/Object(react__WEBPACK_IMPORTED_MODULE_0__["createElement"])(type, props, children);
};
/***/ }),
/***/ "IdCN":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var fnToStr = Function.prototype.toString;
var reflectApply = typeof Reflect === 'object' && Reflect !== null && Reflect.apply;
var badArrayLike;
var isCallableMarker;
if (typeof reflectApply === 'function' && typeof Object.defineProperty === 'function') {
try {
badArrayLike = Object.defineProperty({}, 'length', {
get: function () {
throw isCallableMarker;
}
});
isCallableMarker = {};
// eslint-disable-next-line no-throw-literal
reflectApply(function () { throw 42; }, null, badArrayLike);
} catch (_) {
if (_ !== isCallableMarker) {
reflectApply = null;
}
}
} else {
reflectApply = null;
}
var constructorRegex = /^\s*class\b/;
var isES6ClassFn = function isES6ClassFunction(value) {
try {
var fnStr = fnToStr.call(value);
return constructorRegex.test(fnStr);
} catch (e) {
return false; // not a function
}
};
var tryFunctionObject = function tryFunctionToStr(value) {
try {
if (isES6ClassFn(value)) { return false; }
fnToStr.call(value);
return true;
} catch (e) {
return false;
}
};
var toStr = Object.prototype.toString;
var fnClass = '[object Function]';
var genClass = '[object GeneratorFunction]';
var hasToStringTag = typeof Symbol === 'function' && typeof Symbol.toStringTag === 'symbol';
module.exports = reflectApply
? function isCallable(value) {
if (!value) { return false; }
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
if (typeof value === 'function' && !value.prototype) { return true; }
try {
reflectApply(value, null, badArrayLike);
} catch (e) {
if (e !== isCallableMarker) { return false; }
}
return !isES6ClassFn(value);
}
: function isCallable(value) {
if (!value) { return false; }
if (typeof value !== 'function' && typeof value !== 'object') { return false; }
if (typeof value === 'function' && !value.prototype) { return true; }
if (hasToStringTag) { return tryFunctionObject(value); }
if (isES6ClassFn(value)) { return false; }
var strClass = toStr.call(value);
return strClass === fnClass || strClass === genClass;
};
/***/ }),
/***/ "IgE5":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = isDayVisible;
var _isBeforeDay = __webpack_require__("h6xH");
var _isBeforeDay2 = _interopRequireDefault(_isBeforeDay);
var _isAfterDay = __webpack_require__("Nho6");
var _isAfterDay2 = _interopRequireDefault(_isAfterDay);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function isDayVisible(day, month, numberOfMonths, enableOutsideDays) {
var firstDayOfFirstMonth = month.clone().startOf('month');
if (enableOutsideDays) firstDayOfFirstMonth = firstDayOfFirstMonth.startOf('week');
if ((0, _isBeforeDay2['default'])(day, firstDayOfFirstMonth)) return false;
var lastDayOfLastMonth = month.clone().add(numberOfMonths - 1, 'months').endOf('month');
if (enableOutsideDays) lastDayOfLastMonth = lastDayOfLastMonth.endOf('week');
return !(0, _isAfterDay2['default'])(day, lastDayOfLastMonth);
}
/***/ }),
/***/ "In1I":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $abs = GetIntrinsic('%Math.abs%');
// http://262.ecma-international.org/5.1/#sec-5.2
module.exports = function abs(x) {
return $abs(x);
};
/***/ }),
/***/ "J7JS":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _airbnbPropTypes = __webpack_require__("Hsqg");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
exports['default'] = (0, _airbnbPropTypes.and)([_propTypes2['default'].instanceOf(Set), function () {
function modifiers(props, propName) {
for (var _len = arguments.length, rest = Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
rest[_key - 2] = arguments[_key];
}
var propValue = props[propName];
var firstError = void 0;
[].concat(_toConsumableArray(propValue)).some(function (v, i) {
var _PropTypes$string;
var fakePropName = String(propName) + ': index ' + String(i);
firstError = (_PropTypes$string = _propTypes2['default'].string).isRequired.apply(_PropTypes$string, [_defineProperty({}, fakePropName, v), fakePropName].concat(rest));
return firstError != null;
});
return firstError == null ? null : firstError;
}
return modifiers;
}()], 'Modifiers (Set of Strings)');
/***/ }),
/***/ "JLmN":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export Clickable */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useClickable; });
/* harmony import */ var _rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("BZp5");
/* harmony import */ var reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("hE48");
/* harmony import */ var reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("qdes");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("cDcd");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var reakit_utils_isButton__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("71Og");
/* harmony import */ var reakit_warning__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("KA1K");
/* harmony import */ var reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("eNtd");
/* harmony import */ var reakit_utils_isSelfTarget__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("k2cL");
/* harmony import */ var _Tabbable_Tabbable_js__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("G3V0");
// Automatically generated
var CLICKABLE_KEYS = ["unstable_clickOnEnter", "unstable_clickOnSpace"];
function isNativeClick(event) {
var element = event.currentTarget;
if (!event.isTrusted) return false; // istanbul ignore next: can't test trusted events yet
return Object(reakit_utils_isButton__WEBPACK_IMPORTED_MODULE_4__[/* isButton */ "a"])(element) || element.tagName === "INPUT" || element.tagName === "TEXTAREA" || element.tagName === "A" || element.tagName === "SELECT";
}
var useClickable = Object(reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__[/* createHook */ "a"])({
name: "Clickable",
compose: _Tabbable_Tabbable_js__WEBPACK_IMPORTED_MODULE_8__[/* useTabbable */ "a"],
keys: CLICKABLE_KEYS,
useOptions: function useOptions(_ref) {
var _ref$unstable_clickOn = _ref.unstable_clickOnEnter,
unstable_clickOnEnter = _ref$unstable_clickOn === void 0 ? true : _ref$unstable_clickOn,
_ref$unstable_clickOn2 = _ref.unstable_clickOnSpace,
unstable_clickOnSpace = _ref$unstable_clickOn2 === void 0 ? true : _ref$unstable_clickOn2,
options = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(_ref, ["unstable_clickOnEnter", "unstable_clickOnSpace"]);
return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({
unstable_clickOnEnter: unstable_clickOnEnter,
unstable_clickOnSpace: unstable_clickOnSpace
}, options);
},
useProps: function useProps(options, _ref2) {
var htmlOnKeyDown = _ref2.onKeyDown,
htmlOnKeyUp = _ref2.onKeyUp,
htmlProps = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(_ref2, ["onKeyDown", "onKeyUp"]);
var _React$useState = Object(react__WEBPACK_IMPORTED_MODULE_3__["useState"])(false),
active = _React$useState[0],
setActive = _React$useState[1];
var onKeyDownRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_6__[/* useLiveRef */ "a"])(htmlOnKeyDown);
var onKeyUpRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_6__[/* useLiveRef */ "a"])(htmlOnKeyUp);
var onKeyDown = Object(react__WEBPACK_IMPORTED_MODULE_3__["useCallback"])(function (event) {
var _onKeyDownRef$current;
(_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);
if (event.defaultPrevented) return;
if (options.disabled) return;
if (event.metaKey) return;
if (!Object(reakit_utils_isSelfTarget__WEBPACK_IMPORTED_MODULE_7__[/* isSelfTarget */ "a"])(event)) return;
var isEnter = options.unstable_clickOnEnter && event.key === "Enter";
var isSpace = options.unstable_clickOnSpace && event.key === " ";
if (isEnter || isSpace) {
if (isNativeClick(event)) return;
event.preventDefault();
if (isEnter) {
event.currentTarget.click();
} else if (isSpace) {
setActive(true);
}
}
}, [options.disabled, options.unstable_clickOnEnter, options.unstable_clickOnSpace]);
var onKeyUp = Object(react__WEBPACK_IMPORTED_MODULE_3__["useCallback"])(function (event) {
var _onKeyUpRef$current;
(_onKeyUpRef$current = onKeyUpRef.current) === null || _onKeyUpRef$current === void 0 ? void 0 : _onKeyUpRef$current.call(onKeyUpRef, event);
if (event.defaultPrevented) return;
if (options.disabled) return;
if (event.metaKey) return;
var isSpace = options.unstable_clickOnSpace && event.key === " ";
if (active && isSpace) {
setActive(false);
event.currentTarget.click();
}
}, [options.disabled, options.unstable_clickOnSpace, active]);
return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({
"data-active": active || undefined,
onKeyDown: onKeyDown,
onKeyUp: onKeyUp
}, htmlProps);
}
});
var Clickable = Object(reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__[/* createComponent */ "a"])({
as: "button",
memo: true,
useHook: useClickable
});
/***/ }),
/***/ "JYkG":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_warning__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Z23Y");
/* harmony import */ var _wordpress_warning__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_warning__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const SlotFillContext = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createContext"])({
slots: {},
fills: {},
registerSlot: () => {
typeof process !== "undefined" && process.env && "production" !== "production" ? _wordpress_warning__WEBPACK_IMPORTED_MODULE_1___default()('Components must be wrapped within `SlotFillProvider`. ' + 'See https://developer.wordpress.org/block-editor/components/slot-fill/') : void 0;
},
updateSlot: () => {},
unregisterSlot: () => {},
registerFill: () => {},
unregisterFill: () => {}
});
/* harmony default export */ __webpack_exports__["a"] = (SlotFillContext);
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("8oxB")))
/***/ }),
/***/ "Jt44":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// TODO: remove, semver-major
module.exports = __webpack_require__("rZ7t");
/***/ }),
/***/ "Jx1U":
/***/ (function(module, exports) {
// Copyright (c) 2014 Rafael Caricio. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
var GradientParser = {};
GradientParser.parse = (function() {
var tokens = {
linearGradient: /^(\-(webkit|o|ms|moz)\-)?(linear\-gradient)/i,
repeatingLinearGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-linear\-gradient)/i,
radialGradient: /^(\-(webkit|o|ms|moz)\-)?(radial\-gradient)/i,
repeatingRadialGradient: /^(\-(webkit|o|ms|moz)\-)?(repeating\-radial\-gradient)/i,
sideOrCorner: /^to (left (top|bottom)|right (top|bottom)|left|right|top|bottom)/i,
extentKeywords: /^(closest\-side|closest\-corner|farthest\-side|farthest\-corner|contain|cover)/,
positionKeywords: /^(left|center|right|top|bottom)/i,
pixelValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))px/,
percentageValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))\%/,
emValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))em/,
angleValue: /^(-?(([0-9]*\.[0-9]+)|([0-9]+\.?)))deg/,
startCall: /^\(/,
endCall: /^\)/,
comma: /^,/,
hexColor: /^\#([0-9a-fA-F]+)/,
literalColor: /^([a-zA-Z]+)/,
rgbColor: /^rgb/i,
rgbaColor: /^rgba/i,
number: /^(([0-9]*\.[0-9]+)|([0-9]+\.?))/
};
var input = '';
function error(msg) {
var err = new Error(input + ': ' + msg);
err.source = input;
throw err;
}
function getAST() {
var ast = matchListDefinitions();
if (input.length > 0) {
error('Invalid input not EOF');
}
return ast;
}
function matchListDefinitions() {
return matchListing(matchDefinition);
}
function matchDefinition() {
return matchGradient(
'linear-gradient',
tokens.linearGradient,
matchLinearOrientation) ||
matchGradient(
'repeating-linear-gradient',
tokens.repeatingLinearGradient,
matchLinearOrientation) ||
matchGradient(
'radial-gradient',
tokens.radialGradient,
matchListRadialOrientations) ||
matchGradient(
'repeating-radial-gradient',
tokens.repeatingRadialGradient,
matchListRadialOrientations);
}
function matchGradient(gradientType, pattern, orientationMatcher) {
return matchCall(pattern, function(captures) {
var orientation = orientationMatcher();
if (orientation) {
if (!scan(tokens.comma)) {
error('Missing comma before color stops');
}
}
return {
type: gradientType,
orientation: orientation,
colorStops: matchListing(matchColorStop)
};
});
}
function matchCall(pattern, callback) {
var captures = scan(pattern);
if (captures) {
if (!scan(tokens.startCall)) {
error('Missing (');
}
result = callback(captures);
if (!scan(tokens.endCall)) {
error('Missing )');
}
return result;
}
}
function matchLinearOrientation() {
return matchSideOrCorner() ||
matchAngle();
}
function matchSideOrCorner() {
return match('directional', tokens.sideOrCorner, 1);
}
function matchAngle() {
return match('angular', tokens.angleValue, 1);
}
function matchListRadialOrientations() {
var radialOrientations,
radialOrientation = matchRadialOrientation(),
lookaheadCache;
if (radialOrientation) {
radialOrientations = [];
radialOrientations.push(radialOrientation);
lookaheadCache = input;
if (scan(tokens.comma)) {
radialOrientation = matchRadialOrientation();
if (radialOrientation) {
radialOrientations.push(radialOrientation);
} else {
input = lookaheadCache;
}
}
}
return radialOrientations;
}
function matchRadialOrientation() {
var radialType = matchCircle() ||
matchEllipse();
if (radialType) {
radialType.at = matchAtPosition();
} else {
var defaultPosition = matchPositioning();
if (defaultPosition) {
radialType = {
type: 'default-radial',
at: defaultPosition
};
}
}
return radialType;
}
function matchCircle() {
var circle = match('shape', /^(circle)/i, 0);
if (circle) {
circle.style = matchLength() || matchExtentKeyword();
}
return circle;
}
function matchEllipse() {
var ellipse = match('shape', /^(ellipse)/i, 0);
if (ellipse) {
ellipse.style = matchDistance() || matchExtentKeyword();
}
return ellipse;
}
function matchExtentKeyword() {
return match('extent-keyword', tokens.extentKeywords, 1);
}
function matchAtPosition() {
if (match('position', /^at/, 0)) {
var positioning = matchPositioning();
if (!positioning) {
error('Missing positioning value');
}
return positioning;
}
}
function matchPositioning() {
var location = matchCoordinates();
if (location.x || location.y) {
return {
type: 'position',
value: location
};
}
}
function matchCoordinates() {
return {
x: matchDistance(),
y: matchDistance()
};
}
function matchListing(matcher) {
var captures = matcher(),
result = [];
if (captures) {
result.push(captures);
while (scan(tokens.comma)) {
captures = matcher();
if (captures) {
result.push(captures);
} else {
error('One extra comma');
}
}
}
return result;
}
function matchColorStop() {
var color = matchColor();
if (!color) {
error('Expected color definition');
}
color.length = matchDistance();
return color;
}
function matchColor() {
return matchHexColor() ||
matchRGBAColor() ||
matchRGBColor() ||
matchLiteralColor();
}
function matchLiteralColor() {
return match('literal', tokens.literalColor, 0);
}
function matchHexColor() {
return match('hex', tokens.hexColor, 1);
}
function matchRGBColor() {
return matchCall(tokens.rgbColor, function() {
return {
type: 'rgb',
value: matchListing(matchNumber)
};
});
}
function matchRGBAColor() {
return matchCall(tokens.rgbaColor, function() {
return {
type: 'rgba',
value: matchListing(matchNumber)
};
});
}
function matchNumber() {
return scan(tokens.number)[1];
}
function matchDistance() {
return match('%', tokens.percentageValue, 1) ||
matchPositionKeyword() ||
matchLength();
}
function matchPositionKeyword() {
return match('position-keyword', tokens.positionKeywords, 1);
}
function matchLength() {
return match('px', tokens.pixelValue, 1) ||
match('em', tokens.emValue, 1);
}
function match(type, pattern, captureIndex) {
var captures = scan(pattern);
if (captures) {
return {
type: type,
value: captures[captureIndex]
};
}
}
function scan(regexp) {
var captures,
blankCaptures;
blankCaptures = /^[\n\r\t\s]+/.exec(input);
if (blankCaptures) {
consume(blankCaptures[0].length);
}
captures = regexp.exec(input);
if (captures) {
consume(captures[0].length);
}
return captures;
}
function consume(size) {
input = input.substr(size);
}
return function(code) {
input = code.toString();
return getAST();
};
})();
exports.parse = (GradientParser || {}).parse;
/***/ }),
/***/ "K+tz":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const external = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M18.2 17c0 .7-.6 1.2-1.2 1.2H7c-.7 0-1.2-.6-1.2-1.2V7c0-.7.6-1.2 1.2-1.2h3.2V4.2H7C5.5 4.2 4.2 5.5 4.2 7v10c0 1.5 1.2 2.8 2.8 2.8h10c1.5 0 2.8-1.2 2.8-2.8v-3.6h-1.5V17zM14.9 3v1.5h3.7l-6.4 6.4 1.1 1.1 6.4-6.4v3.7h1.5V3h-6.3z"
}));
/* harmony default export */ __webpack_exports__["a"] = (external);
/***/ }),
/***/ "K9lf":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["compose"]; }());
/***/ }),
/***/ "KA1K":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// UNUSED EXPORTS: warning, useWarning
// EXTERNAL MODULE: ./node_modules/reakit-warning/es/warning.js
var warning = __webpack_require__("WnOg");
// EXTERNAL MODULE: external "React"
var external_React_ = __webpack_require__("cDcd");
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/isObject.js
var isObject = __webpack_require__("Ptb8");
// CONCATENATED MODULE: ./node_modules/reakit-warning/es/useWarning.js
function isRefObject(ref) {
return Object(isObject["a" /* isObject */])(ref) && "current" in ref;
}
/**
* Logs `messages` to the console using `console.warn` based on a `condition`.
* This should be used inside components.
*/
function useWarning(condition) {
for (var _len = arguments.length, messages = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
messages[_key - 1] = arguments[_key];
}
if (false) {}
}
// CONCATENATED MODULE: ./node_modules/reakit-warning/es/index.js
/***/ }),
/***/ "KCH1":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return unstable_IdContext; });
/* unused harmony export unstable_IdProvider */
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("cDcd");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
var defaultPrefix = "id";
function generateRandomString(prefix) {
if (prefix === void 0) {
prefix = defaultPrefix;
}
return "" + (prefix ? prefix + "-" : "") + Math.random().toString(32).substr(2, 6);
}
var unstable_IdContext = /*#__PURE__*/Object(react__WEBPACK_IMPORTED_MODULE_0__["createContext"])(generateRandomString);
function unstable_IdProvider(_ref) {
var children = _ref.children,
_ref$prefix = _ref.prefix,
prefix = _ref$prefix === void 0 ? defaultPrefix : _ref$prefix;
var count = Object(react__WEBPACK_IMPORTED_MODULE_0__["useRef"])(0);
var generateId = Object(react__WEBPACK_IMPORTED_MODULE_0__["useCallback"])(function (localPrefix) {
if (localPrefix === void 0) {
localPrefix = prefix;
}
return "" + (localPrefix ? localPrefix + "-" : "") + ++count.current;
}, [prefix]);
return /*#__PURE__*/Object(react__WEBPACK_IMPORTED_MODULE_0__["createElement"])(unstable_IdContext.Provider, {
value: generateId
}, children);
}
/***/ }),
/***/ "KfNM":
/***/ (function(module, exports) {
/** Used for built-in method references. */
var objectProto = Object.prototype;
/**
* Used to resolve the
* [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var nativeObjectToString = objectProto.toString;
/**
* Converts `value` to a string using `Object.prototype.toString`.
*
* @private
* @param {*} value The value to convert.
* @returns {string} Returns the converted string.
*/
function objectToString(value) {
return nativeObjectToString.call(value);
}
module.exports = objectToString;
/***/ }),
/***/ "Koq/":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var defineProperties = __webpack_require__("82c2");
var callBind = __webpack_require__("PrET");
var implementation = __webpack_require__("FufO");
var getPolyfill = __webpack_require__("yLpt");
var shim = __webpack_require__("8R9v");
var polyfill = callBind.apply(getPolyfill());
// eslint-disable-next-line no-unused-vars
var bound = function assign(target, source1) {
return polyfill(Object, arguments);
};
defineProperties(bound, {
getPolyfill: getPolyfill,
implementation: implementation,
shim: shim
});
module.exports = bound;
/***/ }),
/***/ "Kz5y":
/***/ (function(module, exports, __webpack_require__) {
var freeGlobal = __webpack_require__("WFqU");
/** Detect free variable `self`. */
var freeSelf = typeof self == 'object' && self && self.Object === Object && self;
/** Used as a reference to the global object. */
var root = freeGlobal || freeSelf || Function('return this')();
module.exports = root;
/***/ }),
/***/ "L7Wv":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var toPrimitive = __webpack_require__("WZeS");
// https://ecma-international.org/ecma-262/6.0/#sec-toprimitive
module.exports = function ToPrimitive(input) {
if (arguments.length > 1) {
return toPrimitive(input, arguments[1]);
}
return toPrimitive(input);
};
/***/ }),
/***/ "L8Kx":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getAnimateClassName; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Animate; });
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("TSYQ");
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_0__);
/**
* External dependencies
*/
/**
* @typedef {'top' | 'top left' | 'top right' | 'middle' | 'middle left' | 'middle right' | 'bottom' | 'bottom left' | 'bottom right'} AppearOrigin
* @typedef {'left' | 'right'} SlideInOrigin
* @typedef {{ type: 'appear'; origin?: AppearOrigin }} AppearOptions
* @typedef {{ type: 'slide-in'; origin?: SlideInOrigin }} SlideInOptions
* @typedef {{ type: 'loading'; }} LoadingOptions
* @typedef {AppearOptions | SlideInOptions | LoadingOptions} GetAnimateOptions
*/
/* eslint-disable jsdoc/valid-types */
/**
* @param {GetAnimateOptions['type']} type The animation type
* @return {'top' | 'left'} Default origin
*/
function getDefaultOrigin(type) {
return type === 'appear' ? 'top' : 'left';
}
/* eslint-enable jsdoc/valid-types */
/**
* @param {GetAnimateOptions} options
*
* @return {string | void} ClassName that applies the animations
*/
function getAnimateClassName(options) {
if (options.type === 'loading') {
return classnames__WEBPACK_IMPORTED_MODULE_0___default()('components-animate__loading');
}
const {
type,
origin = getDefaultOrigin(type)
} = options;
if (type === 'appear') {
const [yAxis, xAxis = 'center'] = origin.split(' ');
return classnames__WEBPACK_IMPORTED_MODULE_0___default()('components-animate__appear', {
['is-from-' + xAxis]: xAxis !== 'center',
['is-from-' + yAxis]: yAxis !== 'middle'
});
}
if (type === 'slide-in') {
return classnames__WEBPACK_IMPORTED_MODULE_0___default()('components-animate__slide-in', 'is-from-' + origin);
}
} // @ts-ignore Reason: Planned for deprecation
function Animate({
type,
options = {},
children
}) {
return children({
className: getAnimateClassName({
type,
...options
})
});
}
/***/ }),
/***/ "LTAC":
/***/ (function(module, exports) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = isTouchDevice;
function isTouchDevice() {
return !!(typeof window !== 'undefined' && ('ontouchstart' in window || window.DocumentTouch && typeof document !== 'undefined' && document instanceof window.DocumentTouch)) || !!(typeof navigator !== 'undefined' && (navigator.maxTouchPoints || navigator.msMaxTouchPoints));
}
module.exports = exports['default'];
/***/ }),
/***/ "Lxf3":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var toStr = Object.prototype.toString;
var isPrimitive = __webpack_require__("Teho");
var isCallable = __webpack_require__("IdCN");
// http://ecma-international.org/ecma-262/5.1/#sec-8.12.8
var ES5internalSlots = {
'[[DefaultValue]]': function (O) {
var actualHint;
if (arguments.length > 1) {
actualHint = arguments[1];
} else {
actualHint = toStr.call(O) === '[object Date]' ? String : Number;
}
if (actualHint === String || actualHint === Number) {
var methods = actualHint === String ? ['toString', 'valueOf'] : ['valueOf', 'toString'];
var value, i;
for (i = 0; i < methods.length; ++i) {
if (isCallable(O[methods[i]])) {
value = O[methods[i]]();
if (isPrimitive(value)) {
return value;
}
}
}
throw new TypeError('No default value');
}
throw new TypeError('invalid [[DefaultValue]] hint supplied');
}
};
// http://ecma-international.org/ecma-262/5.1/#sec-9.1
module.exports = function ToPrimitive(input) {
if (isPrimitive(input)) {
return input;
}
if (arguments.length > 1) {
return ES5internalSlots['[[DefaultValue]]'](input, arguments[1]);
}
return ES5internalSlots['[[DefaultValue]]'](input);
};
/***/ }),
/***/ "MiSq":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ serialize_browser_esm_serializeStyles; });
// CONCATENATED MODULE: ./node_modules/@emotion/hash/dist/hash.browser.esm.js
/* eslint-disable */
// Inspired by https://github.com/garycourt/murmurhash-js
// Ported from https://github.com/aappleby/smhasher/blob/61a0530f28277f2e850bfc39600ce61d02b518de/src/MurmurHash2.cpp#L37-L86
function murmur2(str) {
// 'm' and 'r' are mixing constants generated offline.
// They're not really 'magic', they just happen to work well.
// const m = 0x5bd1e995;
// const r = 24;
// Initialize the hash
var h = 0; // Mix 4 bytes at a time into the hash
var k,
i = 0,
len = str.length;
for (; len >= 4; ++i, len -= 4) {
k = str.charCodeAt(i) & 0xff | (str.charCodeAt(++i) & 0xff) << 8 | (str.charCodeAt(++i) & 0xff) << 16 | (str.charCodeAt(++i) & 0xff) << 24;
k =
/* Math.imul(k, m): */
(k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16);
k ^=
/* k >>> r: */
k >>> 24;
h =
/* Math.imul(k, m): */
(k & 0xffff) * 0x5bd1e995 + ((k >>> 16) * 0xe995 << 16) ^
/* Math.imul(h, m): */
(h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
} // Handle the last few bytes of the input array
switch (len) {
case 3:
h ^= (str.charCodeAt(i + 2) & 0xff) << 16;
case 2:
h ^= (str.charCodeAt(i + 1) & 0xff) << 8;
case 1:
h ^= str.charCodeAt(i) & 0xff;
h =
/* Math.imul(h, m): */
(h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
} // Do a few final mixes of the hash to ensure the last few
// bytes are well-incorporated.
h ^= h >>> 13;
h =
/* Math.imul(h, m): */
(h & 0xffff) * 0x5bd1e995 + ((h >>> 16) * 0xe995 << 16);
return ((h ^ h >>> 15) >>> 0).toString(36);
}
/* harmony default export */ var hash_browser_esm = (murmur2);
// CONCATENATED MODULE: ./node_modules/@emotion/unitless/dist/unitless.browser.esm.js
var unitlessKeys = {
animationIterationCount: 1,
borderImageOutset: 1,
borderImageSlice: 1,
borderImageWidth: 1,
boxFlex: 1,
boxFlexGroup: 1,
boxOrdinalGroup: 1,
columnCount: 1,
columns: 1,
flex: 1,
flexGrow: 1,
flexPositive: 1,
flexShrink: 1,
flexNegative: 1,
flexOrder: 1,
gridRow: 1,
gridRowEnd: 1,
gridRowSpan: 1,
gridRowStart: 1,
gridColumn: 1,
gridColumnEnd: 1,
gridColumnSpan: 1,
gridColumnStart: 1,
msGridRow: 1,
msGridRowSpan: 1,
msGridColumn: 1,
msGridColumnSpan: 1,
fontWeight: 1,
lineHeight: 1,
opacity: 1,
order: 1,
orphans: 1,
tabSize: 1,
widows: 1,
zIndex: 1,
zoom: 1,
WebkitLineClamp: 1,
// SVG-related properties
fillOpacity: 1,
floodOpacity: 1,
stopOpacity: 1,
strokeDasharray: 1,
strokeDashoffset: 1,
strokeMiterlimit: 1,
strokeOpacity: 1,
strokeWidth: 1
};
/* harmony default export */ var unitless_browser_esm = (unitlessKeys);
// EXTERNAL MODULE: ./node_modules/@emotion/memoize/dist/memoize.browser.esm.js
var memoize_browser_esm = __webpack_require__("4qRI");
// CONCATENATED MODULE: ./node_modules/@emotion/serialize/dist/serialize.browser.esm.js
var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences";
var UNDEFINED_AS_OBJECT_KEY_ERROR = "You have passed in falsy value as style object's key (can happen when in example you pass unexported component as computed key).";
var hyphenateRegex = /[A-Z]|^ms/g;
var animationRegex = /_EMO_([^_]+?)_([^]*?)_EMO_/g;
var isCustomProperty = function isCustomProperty(property) {
return property.charCodeAt(1) === 45;
};
var isProcessableValue = function isProcessableValue(value) {
return value != null && typeof value !== 'boolean';
};
var processStyleName = Object(memoize_browser_esm["a" /* default */])(function (styleName) {
return isCustomProperty(styleName) ? styleName : styleName.replace(hyphenateRegex, '-$&').toLowerCase();
});
var serialize_browser_esm_processStyleValue = function processStyleValue(key, value) {
switch (key) {
case 'animation':
case 'animationName':
{
if (typeof value === 'string') {
return value.replace(animationRegex, function (match, p1, p2) {
cursor = {
name: p1,
styles: p2,
next: cursor
};
return p1;
});
}
}
}
if (unitless_browser_esm[key] !== 1 && !isCustomProperty(key) && typeof value === 'number' && value !== 0) {
return value + 'px';
}
return value;
};
if (false) { var hyphenatedCache, hyphenPattern, msPattern, oldProcessStyleValue, contentValues, contentValuePattern; }
var shouldWarnAboutInterpolatingClassNameFromCss = true;
function handleInterpolation(mergedProps, registered, interpolation, couldBeSelectorInterpolation) {
if (interpolation == null) {
return '';
}
if (interpolation.__emotion_styles !== undefined) {
if (false) {}
return interpolation;
}
switch (typeof interpolation) {
case 'boolean':
{
return '';
}
case 'object':
{
if (interpolation.anim === 1) {
cursor = {
name: interpolation.name,
styles: interpolation.styles,
next: cursor
};
return interpolation.name;
}
if (interpolation.styles !== undefined) {
var next = interpolation.next;
if (next !== undefined) {
// not the most efficient thing ever but this is a pretty rare case
// and there will be very few iterations of this generally
while (next !== undefined) {
cursor = {
name: next.name,
styles: next.styles,
next: cursor
};
next = next.next;
}
}
var styles = interpolation.styles + ";";
if (false) {}
return styles;
}
return createStringFromObject(mergedProps, registered, interpolation);
}
case 'function':
{
if (mergedProps !== undefined) {
var previousCursor = cursor;
var result = interpolation(mergedProps);
cursor = previousCursor;
return handleInterpolation(mergedProps, registered, result, couldBeSelectorInterpolation);
} else if (false) {}
break;
}
case 'string':
if (false) { var replaced, matched; }
break;
} // finalize string values (regular strings and functions interpolated into css calls)
if (registered == null) {
return interpolation;
}
var cached = registered[interpolation];
if (false) {}
return cached !== undefined && !couldBeSelectorInterpolation ? cached : interpolation;
}
function createStringFromObject(mergedProps, registered, obj) {
var string = '';
if (Array.isArray(obj)) {
for (var i = 0; i < obj.length; i++) {
string += handleInterpolation(mergedProps, registered, obj[i], false);
}
} else {
for (var _key in obj) {
var value = obj[_key];
if (typeof value !== 'object') {
if (registered != null && registered[value] !== undefined) {
string += _key + "{" + registered[value] + "}";
} else if (isProcessableValue(value)) {
string += processStyleName(_key) + ":" + serialize_browser_esm_processStyleValue(_key, value) + ";";
}
} else {
if (_key === 'NO_COMPONENT_SELECTOR' && "production" !== 'production') {
throw new Error('Component selectors can only be used in conjunction with babel-plugin-emotion.');
}
if (Array.isArray(value) && typeof value[0] === 'string' && (registered == null || registered[value[0]] === undefined)) {
for (var _i = 0; _i < value.length; _i++) {
if (isProcessableValue(value[_i])) {
string += processStyleName(_key) + ":" + serialize_browser_esm_processStyleValue(_key, value[_i]) + ";";
}
}
} else {
var interpolated = handleInterpolation(mergedProps, registered, value, false);
switch (_key) {
case 'animation':
case 'animationName':
{
string += processStyleName(_key) + ":" + interpolated + ";";
break;
}
default:
{
if (false) {}
string += _key + "{" + interpolated + "}";
}
}
}
}
}
}
return string;
}
var labelPattern = /label:\s*([^\s;\n{]+)\s*;/g;
var sourceMapPattern;
if (false) {} // this is the cursor for keyframes
// keyframes are stored on the SerializedStyles object as a linked list
var cursor;
var serialize_browser_esm_serializeStyles = function serializeStyles(args, registered, mergedProps) {
if (args.length === 1 && typeof args[0] === 'object' && args[0] !== null && args[0].styles !== undefined) {
return args[0];
}
var stringMode = true;
var styles = '';
cursor = undefined;
var strings = args[0];
if (strings == null || strings.raw === undefined) {
stringMode = false;
styles += handleInterpolation(mergedProps, registered, strings, false);
} else {
if (false) {}
styles += strings[0];
} // we start at 1 since we've already handled the first arg
for (var i = 1; i < args.length; i++) {
styles += handleInterpolation(mergedProps, registered, args[i], styles.charCodeAt(styles.length - 1) === 46);
if (stringMode) {
if (false) {}
styles += strings[i];
}
}
var sourceMap;
if (false) {} // using a global regex with .exec is stateful so lastIndex has to be reset each time
labelPattern.lastIndex = 0;
var identifierName = '';
var match; // https://esbench.com/bench/5b809c2cf2949800a0f61fb5
while ((match = labelPattern.exec(styles)) !== null) {
identifierName += '-' + // $FlowFixMe we know it's not null
match[1];
}
var name = hash_browser_esm(styles) + identifierName;
if (false) {}
return {
name: name,
styles: styles,
next: cursor
};
};
/***/ }),
/***/ "Mih7":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hasUserFocus; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return setUserFocus; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return userFocus; });
function userFocus(element) {
element.userFocus = true;
element.focus();
element.userFocus = false;
}
function hasUserFocus(element) {
return !!element.userFocus;
}
function setUserFocus(element, value) {
element.userFocus = value;
}
/***/ }),
/***/ "Mp0b":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const linkOff = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M15.6 7.3h-.7l1.6-3.5-.9-.4-3.9 8.5H9v1.5h2l-1.3 2.8H8.4c-2 0-3.7-1.7-3.7-3.7s1.7-3.7 3.7-3.7H10V7.3H8.4c-2.9 0-5.2 2.3-5.2 5.2 0 2.9 2.3 5.2 5.2 5.2H9l-1.4 3.2.9.4 5.7-12.5h1.4c2 0 3.7 1.7 3.7 3.7s-1.7 3.7-3.7 3.7H14v1.5h1.6c2.9 0 5.2-2.3 5.2-5.2 0-2.9-2.4-5.2-5.2-5.2z"
}));
/* harmony default export */ __webpack_exports__["a"] = (linkOff);
/***/ }),
/***/ "N3k4":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PureCalendarDay = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _object = __webpack_require__("Koq/");
var _object2 = _interopRequireDefault(_object);
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactAddonsShallowCompare = __webpack_require__("YZDV");
var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare);
var _reactMomentProptypes = __webpack_require__("XGBb");
var _reactMomentProptypes2 = _interopRequireDefault(_reactMomentProptypes);
var _airbnbPropTypes = __webpack_require__("Hsqg");
var _reactWithStyles = __webpack_require__("TG4+");
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _defaultPhrases = __webpack_require__("vV+G");
var _getPhrasePropTypes = __webpack_require__("yc2e");
var _getPhrasePropTypes2 = _interopRequireDefault(_getPhrasePropTypes);
var _getCalendarDaySettings = __webpack_require__("Ae65");
var _getCalendarDaySettings2 = _interopRequireDefault(_getCalendarDaySettings);
var _ModifiersShape = __webpack_require__("J7JS");
var _ModifiersShape2 = _interopRequireDefault(_ModifiersShape);
var _constants = __webpack_require__("Fv1B");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var propTypes = (0, _airbnbPropTypes.forbidExtraProps)((0, _object2['default'])({}, _reactWithStyles.withStylesPropTypes, {
day: _reactMomentProptypes2['default'].momentObj,
daySize: _airbnbPropTypes.nonNegativeInteger,
isOutsideDay: _propTypes2['default'].bool,
modifiers: _ModifiersShape2['default'],
isFocused: _propTypes2['default'].bool,
tabIndex: _propTypes2['default'].oneOf([0, -1]),
onDayClick: _propTypes2['default'].func,
onDayMouseEnter: _propTypes2['default'].func,
onDayMouseLeave: _propTypes2['default'].func,
renderDayContents: _propTypes2['default'].func,
ariaLabelFormat: _propTypes2['default'].string,
// internationalization
phrases: _propTypes2['default'].shape((0, _getPhrasePropTypes2['default'])(_defaultPhrases.CalendarDayPhrases))
}));
var defaultProps = {
day: (0, _moment2['default'])(),
daySize: _constants.DAY_SIZE,
isOutsideDay: false,
modifiers: new Set(),
isFocused: false,
tabIndex: -1,
onDayClick: function () {
function onDayClick() {}
return onDayClick;
}(),
onDayMouseEnter: function () {
function onDayMouseEnter() {}
return onDayMouseEnter;
}(),
onDayMouseLeave: function () {
function onDayMouseLeave() {}
return onDayMouseLeave;
}(),
renderDayContents: null,
ariaLabelFormat: 'dddd, LL',
// internationalization
phrases: _defaultPhrases.CalendarDayPhrases
};
var CalendarDay = function (_React$Component) {
_inherits(CalendarDay, _React$Component);
function CalendarDay() {
var _ref;
_classCallCheck(this, CalendarDay);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var _this = _possibleConstructorReturn(this, (_ref = CalendarDay.__proto__ || Object.getPrototypeOf(CalendarDay)).call.apply(_ref, [this].concat(args)));
_this.setButtonRef = _this.setButtonRef.bind(_this);
return _this;
}
_createClass(CalendarDay, [{
key: 'shouldComponentUpdate',
value: function () {
function shouldComponentUpdate(nextProps, nextState) {
return (0, _reactAddonsShallowCompare2['default'])(this, nextProps, nextState);
}
return shouldComponentUpdate;
}()
}, {
key: 'componentDidUpdate',
value: function () {
function componentDidUpdate(prevProps) {
var _props = this.props,
isFocused = _props.isFocused,
tabIndex = _props.tabIndex;
if (tabIndex === 0) {
if (isFocused || tabIndex !== prevProps.tabIndex) {
this.buttonRef.focus();
}
}
}
return componentDidUpdate;
}()
}, {
key: 'onDayClick',
value: function () {
function onDayClick(day, e) {
var onDayClick = this.props.onDayClick;
onDayClick(day, e);
}
return onDayClick;
}()
}, {
key: 'onDayMouseEnter',
value: function () {
function onDayMouseEnter(day, e) {
var onDayMouseEnter = this.props.onDayMouseEnter;
onDayMouseEnter(day, e);
}
return onDayMouseEnter;
}()
}, {
key: 'onDayMouseLeave',
value: function () {
function onDayMouseLeave(day, e) {
var onDayMouseLeave = this.props.onDayMouseLeave;
onDayMouseLeave(day, e);
}
return onDayMouseLeave;
}()
}, {
key: 'onKeyDown',
value: function () {
function onKeyDown(day, e) {
var onDayClick = this.props.onDayClick;
var key = e.key;
if (key === 'Enter' || key === ' ') {
onDayClick(day, e);
}
}
return onKeyDown;
}()
}, {
key: 'setButtonRef',
value: function () {
function setButtonRef(ref) {
this.buttonRef = ref;
}
return setButtonRef;
}()
}, {
key: 'render',
value: function () {
function render() {
var _this2 = this;
var _props2 = this.props,
day = _props2.day,
ariaLabelFormat = _props2.ariaLabelFormat,
daySize = _props2.daySize,
isOutsideDay = _props2.isOutsideDay,
modifiers = _props2.modifiers,
renderDayContents = _props2.renderDayContents,
tabIndex = _props2.tabIndex,
styles = _props2.styles,
phrases = _props2.phrases;
if (!day) return _react2['default'].createElement('td', null);
var _getCalendarDaySettin = (0, _getCalendarDaySettings2['default'])(day, ariaLabelFormat, daySize, modifiers, phrases),
daySizeStyles = _getCalendarDaySettin.daySizeStyles,
useDefaultCursor = _getCalendarDaySettin.useDefaultCursor,
selected = _getCalendarDaySettin.selected,
hoveredSpan = _getCalendarDaySettin.hoveredSpan,
isOutsideRange = _getCalendarDaySettin.isOutsideRange,
ariaLabel = _getCalendarDaySettin.ariaLabel;
return _react2['default'].createElement(
'td',
_extends({}, (0, _reactWithStyles.css)(styles.CalendarDay, useDefaultCursor && styles.CalendarDay__defaultCursor, styles.CalendarDay__default, isOutsideDay && styles.CalendarDay__outside, modifiers.has('today') && styles.CalendarDay__today, modifiers.has('first-day-of-week') && styles.CalendarDay__firstDayOfWeek, modifiers.has('last-day-of-week') && styles.CalendarDay__lastDayOfWeek, modifiers.has('hovered-offset') && styles.CalendarDay__hovered_offset, modifiers.has('highlighted-calendar') && styles.CalendarDay__highlighted_calendar, modifiers.has('blocked-minimum-nights') && styles.CalendarDay__blocked_minimum_nights, modifiers.has('blocked-calendar') && styles.CalendarDay__blocked_calendar, hoveredSpan && styles.CalendarDay__hovered_span, modifiers.has('selected-span') && styles.CalendarDay__selected_span, modifiers.has('last-in-range') && styles.CalendarDay__last_in_range, modifiers.has('selected-start') && styles.CalendarDay__selected_start, modifiers.has('selected-end') && styles.CalendarDay__selected_end, selected && styles.CalendarDay__selected, isOutsideRange && styles.CalendarDay__blocked_out_of_range, daySizeStyles), {
role: 'button' // eslint-disable-line jsx-a11y/no-noninteractive-element-to-interactive-role
, ref: this.setButtonRef,
'aria-label': ariaLabel,
onMouseEnter: function () {
function onMouseEnter(e) {
_this2.onDayMouseEnter(day, e);
}
return onMouseEnter;
}(),
onMouseLeave: function () {
function onMouseLeave(e) {
_this2.onDayMouseLeave(day, e);
}
return onMouseLeave;
}(),
onMouseUp: function () {
function onMouseUp(e) {
e.currentTarget.blur();
}
return onMouseUp;
}(),
onClick: function () {
function onClick(e) {
_this2.onDayClick(day, e);
}
return onClick;
}(),
onKeyDown: function () {
function onKeyDown(e) {
_this2.onKeyDown(day, e);
}
return onKeyDown;
}(),
tabIndex: tabIndex
}),
renderDayContents ? renderDayContents(day, modifiers) : day.format('D')
);
}
return render;
}()
}]);
return CalendarDay;
}(_react2['default'].Component);
CalendarDay.propTypes = propTypes;
CalendarDay.defaultProps = defaultProps;
exports.PureCalendarDay = CalendarDay;
exports['default'] = (0, _reactWithStyles.withStyles)(function (_ref2) {
var _ref2$reactDates = _ref2.reactDates,
color = _ref2$reactDates.color,
font = _ref2$reactDates.font;
return {
CalendarDay: {
boxSizing: 'border-box',
cursor: 'pointer',
fontSize: font.size,
textAlign: 'center',
':active': {
outline: 0
}
},
CalendarDay__defaultCursor: {
cursor: 'default'
},
CalendarDay__default: {
border: '1px solid ' + String(color.core.borderLight),
color: color.text,
background: color.background,
':hover': {
background: color.core.borderLight,
border: '1px double ' + String(color.core.borderLight),
color: 'inherit'
}
},
CalendarDay__hovered_offset: {
background: color.core.borderBright,
border: '1px double ' + String(color.core.borderLight),
color: 'inherit'
},
CalendarDay__outside: {
border: 0,
background: color.outside.backgroundColor,
color: color.outside.color,
':hover': {
border: 0
}
},
CalendarDay__blocked_minimum_nights: {
background: color.minimumNights.backgroundColor,
border: '1px solid ' + String(color.minimumNights.borderColor),
color: color.minimumNights.color,
':hover': {
background: color.minimumNights.backgroundColor_hover,
color: color.minimumNights.color_active
},
':active': {
background: color.minimumNights.backgroundColor_active,
color: color.minimumNights.color_active
}
},
CalendarDay__highlighted_calendar: {
background: color.highlighted.backgroundColor,
color: color.highlighted.color,
':hover': {
background: color.highlighted.backgroundColor_hover,
color: color.highlighted.color_active
},
':active': {
background: color.highlighted.backgroundColor_active,
color: color.highlighted.color_active
}
},
CalendarDay__selected_span: {
background: color.selectedSpan.backgroundColor,
border: '1px solid ' + String(color.selectedSpan.borderColor),
color: color.selectedSpan.color,
':hover': {
background: color.selectedSpan.backgroundColor_hover,
border: '1px solid ' + String(color.selectedSpan.borderColor),
color: color.selectedSpan.color_active
},
':active': {
background: color.selectedSpan.backgroundColor_active,
border: '1px solid ' + String(color.selectedSpan.borderColor),
color: color.selectedSpan.color_active
}
},
CalendarDay__last_in_range: {
borderRight: color.core.primary
},
CalendarDay__selected: {
background: color.selected.backgroundColor,
border: '1px solid ' + String(color.selected.borderColor),
color: color.selected.color,
':hover': {
background: color.selected.backgroundColor_hover,
border: '1px solid ' + String(color.selected.borderColor),
color: color.selected.color_active
},
':active': {
background: color.selected.backgroundColor_active,
border: '1px solid ' + String(color.selected.borderColor),
color: color.selected.color_active
}
},
CalendarDay__hovered_span: {
background: color.hoveredSpan.backgroundColor,
border: '1px solid ' + String(color.hoveredSpan.borderColor),
color: color.hoveredSpan.color,
':hover': {
background: color.hoveredSpan.backgroundColor_hover,
border: '1px solid ' + String(color.hoveredSpan.borderColor),
color: color.hoveredSpan.color_active
},
':active': {
background: color.hoveredSpan.backgroundColor_active,
border: '1px solid ' + String(color.hoveredSpan.borderColor),
color: color.hoveredSpan.color_active
}
},
CalendarDay__blocked_calendar: {
background: color.blocked_calendar.backgroundColor,
border: '1px solid ' + String(color.blocked_calendar.borderColor),
color: color.blocked_calendar.color,
':hover': {
background: color.blocked_calendar.backgroundColor_hover,
border: '1px solid ' + String(color.blocked_calendar.borderColor),
color: color.blocked_calendar.color_active
},
':active': {
background: color.blocked_calendar.backgroundColor_active,
border: '1px solid ' + String(color.blocked_calendar.borderColor),
color: color.blocked_calendar.color_active
}
},
CalendarDay__blocked_out_of_range: {
background: color.blocked_out_of_range.backgroundColor,
border: '1px solid ' + String(color.blocked_out_of_range.borderColor),
color: color.blocked_out_of_range.color,
':hover': {
background: color.blocked_out_of_range.backgroundColor_hover,
border: '1px solid ' + String(color.blocked_out_of_range.borderColor),
color: color.blocked_out_of_range.color_active
},
':active': {
background: color.blocked_out_of_range.backgroundColor_active,
border: '1px solid ' + String(color.blocked_out_of_range.borderColor),
color: color.blocked_out_of_range.color_active
}
},
CalendarDay__selected_start: {},
CalendarDay__selected_end: {},
CalendarDay__today: {},
CalendarDay__firstDayOfWeek: {},
CalendarDay__lastDayOfWeek: {}
};
})(CalendarDay);
/***/ }),
/***/ "NMb1":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["deprecated"]; }());
/***/ }),
/***/ "NTP4":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const upload = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M18.5 15v3.5H13V6.7l4.5 4.1 1-1.1-6.2-5.8-5.8 5.8 1 1.1 4-4v11.7h-6V15H4v5h16v-5z"
}));
/* harmony default export */ __webpack_exports__["a"] = (upload);
/***/ }),
/***/ "NWDH":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const chevronDown = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M17.5 11.6L12 16l-5.5-4.4.9-1.2L12 14l4.5-3.6 1 1.2z"
}));
/* harmony default export */ __webpack_exports__["a"] = (chevronDown);
/***/ }),
/***/ "Nho6":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = isAfterDay;
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _isBeforeDay = __webpack_require__("h6xH");
var _isBeforeDay2 = _interopRequireDefault(_isBeforeDay);
var _isSameDay = __webpack_require__("pRvc");
var _isSameDay2 = _interopRequireDefault(_isSameDay);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function isAfterDay(a, b) {
if (!_moment2['default'].isMoment(a) || !_moment2['default'].isMoment(b)) return false;
return !(0, _isBeforeDay2['default'])(a, b) && !(0, _isSameDay2['default'])(a, b);
}
/***/ }),
/***/ "Nloh":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.PureDayPicker = exports.defaultProps = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _object = __webpack_require__("Koq/");
var _object2 = _interopRequireDefault(_object);
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactAddonsShallowCompare = __webpack_require__("YZDV");
var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare);
var _airbnbPropTypes = __webpack_require__("Hsqg");
var _reactWithStyles = __webpack_require__("TG4+");
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _throttle = __webpack_require__("DzJC");
var _throttle2 = _interopRequireDefault(_throttle);
var _isTouchDevice = __webpack_require__("LTAC");
var _isTouchDevice2 = _interopRequireDefault(_isTouchDevice);
var _reactOutsideClickHandler = __webpack_require__("3gBW");
var _reactOutsideClickHandler2 = _interopRequireDefault(_reactOutsideClickHandler);
var _defaultPhrases = __webpack_require__("vV+G");
var _getPhrasePropTypes = __webpack_require__("yc2e");
var _getPhrasePropTypes2 = _interopRequireDefault(_getPhrasePropTypes);
var _CalendarMonthGrid = __webpack_require__("Thzv");
var _CalendarMonthGrid2 = _interopRequireDefault(_CalendarMonthGrid);
var _DayPickerNavigation = __webpack_require__("zfJ5");
var _DayPickerNavigation2 = _interopRequireDefault(_DayPickerNavigation);
var _DayPickerKeyboardShortcuts = __webpack_require__("1+Kn");
var _DayPickerKeyboardShortcuts2 = _interopRequireDefault(_DayPickerKeyboardShortcuts);
var _getNumberOfCalendarMonthWeeks = __webpack_require__("0Dl3");
var _getNumberOfCalendarMonthWeeks2 = _interopRequireDefault(_getNumberOfCalendarMonthWeeks);
var _getCalendarMonthWidth = __webpack_require__("m2ax");
var _getCalendarMonthWidth2 = _interopRequireDefault(_getCalendarMonthWidth);
var _calculateDimension = __webpack_require__("ixyq");
var _calculateDimension2 = _interopRequireDefault(_calculateDimension);
var _getActiveElement = __webpack_require__("+51k");
var _getActiveElement2 = _interopRequireDefault(_getActiveElement);
var _isDayVisible = __webpack_require__("IgE5");
var _isDayVisible2 = _interopRequireDefault(_isDayVisible);
var _ModifiersShape = __webpack_require__("J7JS");
var _ModifiersShape2 = _interopRequireDefault(_ModifiersShape);
var _ScrollableOrientationShape = __webpack_require__("aE6U");
var _ScrollableOrientationShape2 = _interopRequireDefault(_ScrollableOrientationShape);
var _DayOfWeekShape = __webpack_require__("2S2E");
var _DayOfWeekShape2 = _interopRequireDefault(_DayOfWeekShape);
var _CalendarInfoPositionShape = __webpack_require__("oR9Z");
var _CalendarInfoPositionShape2 = _interopRequireDefault(_CalendarInfoPositionShape);
var _constants = __webpack_require__("Fv1B");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var MONTH_PADDING = 23;
var PREV_TRANSITION = 'prev';
var NEXT_TRANSITION = 'next';
var MONTH_SELECTION_TRANSITION = 'month_selection';
var YEAR_SELECTION_TRANSITION = 'year_selection';
var propTypes = (0, _airbnbPropTypes.forbidExtraProps)((0, _object2['default'])({}, _reactWithStyles.withStylesPropTypes, {
// calendar presentation props
enableOutsideDays: _propTypes2['default'].bool,
numberOfMonths: _propTypes2['default'].number,
orientation: _ScrollableOrientationShape2['default'],
withPortal: _propTypes2['default'].bool,
onOutsideClick: _propTypes2['default'].func,
hidden: _propTypes2['default'].bool,
initialVisibleMonth: _propTypes2['default'].func,
firstDayOfWeek: _DayOfWeekShape2['default'],
renderCalendarInfo: _propTypes2['default'].func,
calendarInfoPosition: _CalendarInfoPositionShape2['default'],
hideKeyboardShortcutsPanel: _propTypes2['default'].bool,
daySize: _airbnbPropTypes.nonNegativeInteger,
isRTL: _propTypes2['default'].bool,
verticalHeight: _airbnbPropTypes.nonNegativeInteger,
noBorder: _propTypes2['default'].bool,
transitionDuration: _airbnbPropTypes.nonNegativeInteger,
verticalBorderSpacing: _airbnbPropTypes.nonNegativeInteger,
horizontalMonthPadding: _airbnbPropTypes.nonNegativeInteger,
// navigation props
navPrev: _propTypes2['default'].node,
navNext: _propTypes2['default'].node,
noNavButtons: _propTypes2['default'].bool,
onPrevMonthClick: _propTypes2['default'].func,
onNextMonthClick: _propTypes2['default'].func,
onMonthChange: _propTypes2['default'].func,
onYearChange: _propTypes2['default'].func,
onMultiplyScrollableMonths: _propTypes2['default'].func, // VERTICAL_SCROLLABLE daypickers only
// month props
renderMonthText: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes2['default'].func, 'renderMonthText', 'renderMonthElement'),
renderMonthElement: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes2['default'].func, 'renderMonthText', 'renderMonthElement'),
// day props
modifiers: _propTypes2['default'].objectOf(_propTypes2['default'].objectOf(_ModifiersShape2['default'])),
renderCalendarDay: _propTypes2['default'].func,
renderDayContents: _propTypes2['default'].func,
onDayClick: _propTypes2['default'].func,
onDayMouseEnter: _propTypes2['default'].func,
onDayMouseLeave: _propTypes2['default'].func,
// accessibility props
isFocused: _propTypes2['default'].bool,
getFirstFocusableDay: _propTypes2['default'].func,
onBlur: _propTypes2['default'].func,
showKeyboardShortcuts: _propTypes2['default'].bool,
// internationalization
monthFormat: _propTypes2['default'].string,
weekDayFormat: _propTypes2['default'].string,
phrases: _propTypes2['default'].shape((0, _getPhrasePropTypes2['default'])(_defaultPhrases.DayPickerPhrases)),
dayAriaLabelFormat: _propTypes2['default'].string
}));
var defaultProps = exports.defaultProps = {
// calendar presentation props
enableOutsideDays: false,
numberOfMonths: 2,
orientation: _constants.HORIZONTAL_ORIENTATION,
withPortal: false,
onOutsideClick: function () {
function onOutsideClick() {}
return onOutsideClick;
}(),
hidden: false,
initialVisibleMonth: function () {
function initialVisibleMonth() {
return (0, _moment2['default'])();
}
return initialVisibleMonth;
}(),
firstDayOfWeek: null,
renderCalendarInfo: null,
calendarInfoPosition: _constants.INFO_POSITION_BOTTOM,
hideKeyboardShortcutsPanel: false,
daySize: _constants.DAY_SIZE,
isRTL: false,
verticalHeight: null,
noBorder: false,
transitionDuration: undefined,
verticalBorderSpacing: undefined,
horizontalMonthPadding: 13,
// navigation props
navPrev: null,
navNext: null,
noNavButtons: false,
onPrevMonthClick: function () {
function onPrevMonthClick() {}
return onPrevMonthClick;
}(),
onNextMonthClick: function () {
function onNextMonthClick() {}
return onNextMonthClick;
}(),
onMonthChange: function () {
function onMonthChange() {}
return onMonthChange;
}(),
onYearChange: function () {
function onYearChange() {}
return onYearChange;
}(),
onMultiplyScrollableMonths: function () {
function onMultiplyScrollableMonths() {}
return onMultiplyScrollableMonths;
}(),
// month props
renderMonthText: null,
renderMonthElement: null,
// day props
modifiers: {},
renderCalendarDay: undefined,
renderDayContents: null,
onDayClick: function () {
function onDayClick() {}
return onDayClick;
}(),
onDayMouseEnter: function () {
function onDayMouseEnter() {}
return onDayMouseEnter;
}(),
onDayMouseLeave: function () {
function onDayMouseLeave() {}
return onDayMouseLeave;
}(),
// accessibility props
isFocused: false,
getFirstFocusableDay: null,
onBlur: function () {
function onBlur() {}
return onBlur;
}(),
showKeyboardShortcuts: false,
// internationalization
monthFormat: 'MMMM YYYY',
weekDayFormat: 'dd',
phrases: _defaultPhrases.DayPickerPhrases,
dayAriaLabelFormat: undefined
};
var DayPicker = function (_React$Component) {
_inherits(DayPicker, _React$Component);
function DayPicker(props) {
_classCallCheck(this, DayPicker);
var _this = _possibleConstructorReturn(this, (DayPicker.__proto__ || Object.getPrototypeOf(DayPicker)).call(this, props));
var currentMonth = props.hidden ? (0, _moment2['default'])() : props.initialVisibleMonth();
var focusedDate = currentMonth.clone().startOf('month');
if (props.getFirstFocusableDay) {
focusedDate = props.getFirstFocusableDay(currentMonth);
}
var horizontalMonthPadding = props.horizontalMonthPadding;
var translationValue = props.isRTL && _this.isHorizontal() ? -(0, _getCalendarMonthWidth2['default'])(props.daySize, horizontalMonthPadding) : 0;
_this.hasSetInitialVisibleMonth = !props.hidden;
_this.state = {
currentMonth: currentMonth,
monthTransition: null,
translationValue: translationValue,
scrollableMonthMultiple: 1,
calendarMonthWidth: (0, _getCalendarMonthWidth2['default'])(props.daySize, horizontalMonthPadding),
focusedDate: !props.hidden || props.isFocused ? focusedDate : null,
nextFocusedDate: null,
showKeyboardShortcuts: props.showKeyboardShortcuts,
onKeyboardShortcutsPanelClose: function () {
function onKeyboardShortcutsPanelClose() {}
return onKeyboardShortcutsPanelClose;
}(),
isTouchDevice: (0, _isTouchDevice2['default'])(),
withMouseInteractions: true,
calendarInfoWidth: 0,
monthTitleHeight: null,
hasSetHeight: false
};
_this.setCalendarMonthWeeks(currentMonth);
_this.calendarMonthGridHeight = 0;
_this.setCalendarInfoWidthTimeout = null;
_this.onKeyDown = _this.onKeyDown.bind(_this);
_this.throttledKeyDown = (0, _throttle2['default'])(_this.onFinalKeyDown, 200, { trailing: false });
_this.onPrevMonthClick = _this.onPrevMonthClick.bind(_this);
_this.onNextMonthClick = _this.onNextMonthClick.bind(_this);
_this.onMonthChange = _this.onMonthChange.bind(_this);
_this.onYearChange = _this.onYearChange.bind(_this);
_this.multiplyScrollableMonths = _this.multiplyScrollableMonths.bind(_this);
_this.updateStateAfterMonthTransition = _this.updateStateAfterMonthTransition.bind(_this);
_this.openKeyboardShortcutsPanel = _this.openKeyboardShortcutsPanel.bind(_this);
_this.closeKeyboardShortcutsPanel = _this.closeKeyboardShortcutsPanel.bind(_this);
_this.setCalendarInfoRef = _this.setCalendarInfoRef.bind(_this);
_this.setContainerRef = _this.setContainerRef.bind(_this);
_this.setTransitionContainerRef = _this.setTransitionContainerRef.bind(_this);
_this.setMonthTitleHeight = _this.setMonthTitleHeight.bind(_this);
return _this;
}
_createClass(DayPicker, [{
key: 'componentDidMount',
value: function () {
function componentDidMount() {
var currentMonth = this.state.currentMonth;
if (this.calendarInfo) {
this.setState({
isTouchDevice: (0, _isTouchDevice2['default'])(),
calendarInfoWidth: (0, _calculateDimension2['default'])(this.calendarInfo, 'width', true, true)
});
} else {
this.setState({ isTouchDevice: (0, _isTouchDevice2['default'])() });
}
this.setCalendarMonthWeeks(currentMonth);
}
return componentDidMount;
}()
}, {
key: 'componentWillReceiveProps',
value: function () {
function componentWillReceiveProps(nextProps) {
var hidden = nextProps.hidden,
isFocused = nextProps.isFocused,
showKeyboardShortcuts = nextProps.showKeyboardShortcuts,
onBlur = nextProps.onBlur,
renderMonthText = nextProps.renderMonthText,
horizontalMonthPadding = nextProps.horizontalMonthPadding;
var currentMonth = this.state.currentMonth;
if (!hidden) {
if (!this.hasSetInitialVisibleMonth) {
this.hasSetInitialVisibleMonth = true;
this.setState({
currentMonth: nextProps.initialVisibleMonth()
});
}
}
var _props = this.props,
daySize = _props.daySize,
prevIsFocused = _props.isFocused,
prevRenderMonthText = _props.renderMonthText;
if (nextProps.daySize !== daySize) {
this.setState({
calendarMonthWidth: (0, _getCalendarMonthWidth2['default'])(nextProps.daySize, horizontalMonthPadding)
});
}
if (isFocused !== prevIsFocused) {
if (isFocused) {
var focusedDate = this.getFocusedDay(currentMonth);
var onKeyboardShortcutsPanelClose = this.state.onKeyboardShortcutsPanelClose;
if (nextProps.showKeyboardShortcuts) {
// the ? shortcut came from the input and we should return input there once it is close
onKeyboardShortcutsPanelClose = onBlur;
}
this.setState({
showKeyboardShortcuts: showKeyboardShortcuts,
onKeyboardShortcutsPanelClose: onKeyboardShortcutsPanelClose,
focusedDate: focusedDate,
withMouseInteractions: false
});
} else {
this.setState({ focusedDate: null });
}
}
if (renderMonthText !== prevRenderMonthText) {
this.setState({
monthTitleHeight: null
});
}
}
return componentWillReceiveProps;
}()
}, {
key: 'shouldComponentUpdate',
value: function () {
function shouldComponentUpdate(nextProps, nextState) {
return (0, _reactAddonsShallowCompare2['default'])(this, nextProps, nextState);
}
return shouldComponentUpdate;
}()
}, {
key: 'componentWillUpdate',
value: function () {
function componentWillUpdate() {
var _this2 = this;
var transitionDuration = this.props.transitionDuration;
// Calculating the dimensions trigger a DOM repaint which
// breaks the CSS transition.
// The setTimeout will wait until the transition ends.
if (this.calendarInfo) {
this.setCalendarInfoWidthTimeout = setTimeout(function () {
var calendarInfoWidth = _this2.state.calendarInfoWidth;
var calendarInfoPanelWidth = (0, _calculateDimension2['default'])(_this2.calendarInfo, 'width', true, true);
if (calendarInfoWidth !== calendarInfoPanelWidth) {
_this2.setState({
calendarInfoWidth: calendarInfoPanelWidth
});
}
}, transitionDuration);
}
}
return componentWillUpdate;
}()
}, {
key: 'componentDidUpdate',
value: function () {
function componentDidUpdate(prevProps) {
var _props2 = this.props,
orientation = _props2.orientation,
daySize = _props2.daySize,
isFocused = _props2.isFocused,
numberOfMonths = _props2.numberOfMonths;
var _state = this.state,
focusedDate = _state.focusedDate,
monthTitleHeight = _state.monthTitleHeight;
if (this.isHorizontal() && (orientation !== prevProps.orientation || daySize !== prevProps.daySize)) {
var visibleCalendarWeeks = this.calendarMonthWeeks.slice(1, numberOfMonths + 1);
var calendarMonthWeeksHeight = Math.max.apply(Math, [0].concat(_toConsumableArray(visibleCalendarWeeks))) * (daySize - 1);
var newMonthHeight = monthTitleHeight + calendarMonthWeeksHeight + 1;
this.adjustDayPickerHeight(newMonthHeight);
}
if (!prevProps.isFocused && isFocused && !focusedDate) {
this.container.focus();
}
}
return componentDidUpdate;
}()
}, {
key: 'componentWillUnmount',
value: function () {
function componentWillUnmount() {
clearTimeout(this.setCalendarInfoWidthTimeout);
}
return componentWillUnmount;
}()
}, {
key: 'onKeyDown',
value: function () {
function onKeyDown(e) {
e.stopPropagation();
if (!_constants.MODIFIER_KEY_NAMES.has(e.key)) {
this.throttledKeyDown(e);
}
}
return onKeyDown;
}()
}, {
key: 'onFinalKeyDown',
value: function () {
function onFinalKeyDown(e) {
this.setState({ withMouseInteractions: false });
var _props3 = this.props,
onBlur = _props3.onBlur,
isRTL = _props3.isRTL;
var _state2 = this.state,
focusedDate = _state2.focusedDate,
showKeyboardShortcuts = _state2.showKeyboardShortcuts;
if (!focusedDate) return;
var newFocusedDate = focusedDate.clone();
var didTransitionMonth = false;
// focus might be anywhere when the keyboard shortcuts panel is opened so we want to
// return it to wherever it was before when the panel was opened
var activeElement = (0, _getActiveElement2['default'])();
var onKeyboardShortcutsPanelClose = function () {
function onKeyboardShortcutsPanelClose() {
if (activeElement) activeElement.focus();
}
return onKeyboardShortcutsPanelClose;
}();
switch (e.key) {
case 'ArrowUp':
e.preventDefault();
newFocusedDate.subtract(1, 'week');
didTransitionMonth = this.maybeTransitionPrevMonth(newFocusedDate);
break;
case 'ArrowLeft':
e.preventDefault();
if (isRTL) {
newFocusedDate.add(1, 'day');
} else {
newFocusedDate.subtract(1, 'day');
}
didTransitionMonth = this.maybeTransitionPrevMonth(newFocusedDate);
break;
case 'Home':
e.preventDefault();
newFocusedDate.startOf('week');
didTransitionMonth = this.maybeTransitionPrevMonth(newFocusedDate);
break;
case 'PageUp':
e.preventDefault();
newFocusedDate.subtract(1, 'month');
didTransitionMonth = this.maybeTransitionPrevMonth(newFocusedDate);
break;
case 'ArrowDown':
e.preventDefault();
newFocusedDate.add(1, 'week');
didTransitionMonth = this.maybeTransitionNextMonth(newFocusedDate);
break;
case 'ArrowRight':
e.preventDefault();
if (isRTL) {
newFocusedDate.subtract(1, 'day');
} else {
newFocusedDate.add(1, 'day');
}
didTransitionMonth = this.maybeTransitionNextMonth(newFocusedDate);
break;
case 'End':
e.preventDefault();
newFocusedDate.endOf('week');
didTransitionMonth = this.maybeTransitionNextMonth(newFocusedDate);
break;
case 'PageDown':
e.preventDefault();
newFocusedDate.add(1, 'month');
didTransitionMonth = this.maybeTransitionNextMonth(newFocusedDate);
break;
case '?':
this.openKeyboardShortcutsPanel(onKeyboardShortcutsPanelClose);
break;
case 'Escape':
if (showKeyboardShortcuts) {
this.closeKeyboardShortcutsPanel();
} else {
onBlur();
}
break;
default:
break;
}
// If there was a month transition, do not update the focused date until the transition has
// completed. Otherwise, attempting to focus on a DOM node may interrupt the CSS animation. If
// didTransitionMonth is true, the focusedDate gets updated in #updateStateAfterMonthTransition
if (!didTransitionMonth) {
this.setState({
focusedDate: newFocusedDate
});
}
}
return onFinalKeyDown;
}()
}, {
key: 'onPrevMonthClick',
value: function () {
function onPrevMonthClick(nextFocusedDate, e) {
var _props4 = this.props,
daySize = _props4.daySize,
isRTL = _props4.isRTL,
numberOfMonths = _props4.numberOfMonths;
var _state3 = this.state,
calendarMonthWidth = _state3.calendarMonthWidth,
monthTitleHeight = _state3.monthTitleHeight;
if (e) e.preventDefault();
var translationValue = void 0;
if (this.isVertical()) {
var calendarMonthWeeksHeight = this.calendarMonthWeeks[0] * (daySize - 1);
translationValue = monthTitleHeight + calendarMonthWeeksHeight + 1;
} else if (this.isHorizontal()) {
translationValue = calendarMonthWidth;
if (isRTL) {
translationValue = -2 * calendarMonthWidth;
}
var visibleCalendarWeeks = this.calendarMonthWeeks.slice(0, numberOfMonths);
var _calendarMonthWeeksHeight = Math.max.apply(Math, [0].concat(_toConsumableArray(visibleCalendarWeeks))) * (daySize - 1);
var newMonthHeight = monthTitleHeight + _calendarMonthWeeksHeight + 1;
this.adjustDayPickerHeight(newMonthHeight);
}
this.setState({
monthTransition: PREV_TRANSITION,
translationValue: translationValue,
focusedDate: null,
nextFocusedDate: nextFocusedDate
});
}
return onPrevMonthClick;
}()
}, {
key: 'onMonthChange',
value: function () {
function onMonthChange(currentMonth) {
this.setCalendarMonthWeeks(currentMonth);
this.calculateAndSetDayPickerHeight();
// Translation value is a hack to force an invisible transition that
// properly rerenders the CalendarMonthGrid
this.setState({
monthTransition: MONTH_SELECTION_TRANSITION,
translationValue: 0.00001,
focusedDate: null,
nextFocusedDate: currentMonth,
currentMonth: currentMonth
});
}
return onMonthChange;
}()
}, {
key: 'onYearChange',
value: function () {
function onYearChange(currentMonth) {
this.setCalendarMonthWeeks(currentMonth);
this.calculateAndSetDayPickerHeight();
// Translation value is a hack to force an invisible transition that
// properly rerenders the CalendarMonthGrid
this.setState({
monthTransition: YEAR_SELECTION_TRANSITION,
translationValue: 0.0001,
focusedDate: null,
nextFocusedDate: currentMonth,
currentMonth: currentMonth
});
}
return onYearChange;
}()
}, {
key: 'onNextMonthClick',
value: function () {
function onNextMonthClick(nextFocusedDate, e) {
var _props5 = this.props,
isRTL = _props5.isRTL,
numberOfMonths = _props5.numberOfMonths,
daySize = _props5.daySize;
var _state4 = this.state,
calendarMonthWidth = _state4.calendarMonthWidth,
monthTitleHeight = _state4.monthTitleHeight;
if (e) e.preventDefault();
var translationValue = void 0;
if (this.isVertical()) {
var firstVisibleMonthWeeks = this.calendarMonthWeeks[1];
var calendarMonthWeeksHeight = firstVisibleMonthWeeks * (daySize - 1);
translationValue = -(monthTitleHeight + calendarMonthWeeksHeight + 1);
}
if (this.isHorizontal()) {
translationValue = -calendarMonthWidth;
if (isRTL) {
translationValue = 0;
}
var visibleCalendarWeeks = this.calendarMonthWeeks.slice(2, numberOfMonths + 2);
var _calendarMonthWeeksHeight2 = Math.max.apply(Math, [0].concat(_toConsumableArray(visibleCalendarWeeks))) * (daySize - 1);
var newMonthHeight = monthTitleHeight + _calendarMonthWeeksHeight2 + 1;
this.adjustDayPickerHeight(newMonthHeight);
}
this.setState({
monthTransition: NEXT_TRANSITION,
translationValue: translationValue,
focusedDate: null,
nextFocusedDate: nextFocusedDate
});
}
return onNextMonthClick;
}()
}, {
key: 'getFirstDayOfWeek',
value: function () {
function getFirstDayOfWeek() {
var firstDayOfWeek = this.props.firstDayOfWeek;
if (firstDayOfWeek == null) {
return _moment2['default'].localeData().firstDayOfWeek();
}
return firstDayOfWeek;
}
return getFirstDayOfWeek;
}()
}, {
key: 'getFirstVisibleIndex',
value: function () {
function getFirstVisibleIndex() {
var orientation = this.props.orientation;
var monthTransition = this.state.monthTransition;
if (orientation === _constants.VERTICAL_SCROLLABLE) return 0;
var firstVisibleMonthIndex = 1;
if (monthTransition === PREV_TRANSITION) {
firstVisibleMonthIndex -= 1;
} else if (monthTransition === NEXT_TRANSITION) {
firstVisibleMonthIndex += 1;
}
return firstVisibleMonthIndex;
}
return getFirstVisibleIndex;
}()
}, {
key: 'getFocusedDay',
value: function () {
function getFocusedDay(newMonth) {
var _props6 = this.props,
getFirstFocusableDay = _props6.getFirstFocusableDay,
numberOfMonths = _props6.numberOfMonths;
var focusedDate = void 0;
if (getFirstFocusableDay) {
focusedDate = getFirstFocusableDay(newMonth);
}
if (newMonth && (!focusedDate || !(0, _isDayVisible2['default'])(focusedDate, newMonth, numberOfMonths))) {
focusedDate = newMonth.clone().startOf('month');
}
return focusedDate;
}
return getFocusedDay;
}()
}, {
key: 'setMonthTitleHeight',
value: function () {
function setMonthTitleHeight(monthTitleHeight) {
var _this3 = this;
this.setState({
monthTitleHeight: monthTitleHeight
}, function () {
_this3.calculateAndSetDayPickerHeight();
});
}
return setMonthTitleHeight;
}()
}, {
key: 'setCalendarMonthWeeks',
value: function () {
function setCalendarMonthWeeks(currentMonth) {
var numberOfMonths = this.props.numberOfMonths;
this.calendarMonthWeeks = [];
var month = currentMonth.clone().subtract(1, 'months');
var firstDayOfWeek = this.getFirstDayOfWeek();
for (var i = 0; i < numberOfMonths + 2; i += 1) {
var numberOfWeeks = (0, _getNumberOfCalendarMonthWeeks2['default'])(month, firstDayOfWeek);
this.calendarMonthWeeks.push(numberOfWeeks);
month = month.add(1, 'months');
}
}
return setCalendarMonthWeeks;
}()
}, {
key: 'setContainerRef',
value: function () {
function setContainerRef(ref) {
this.container = ref;
}
return setContainerRef;
}()
}, {
key: 'setCalendarInfoRef',
value: function () {
function setCalendarInfoRef(ref) {
this.calendarInfo = ref;
}
return setCalendarInfoRef;
}()
}, {
key: 'setTransitionContainerRef',
value: function () {
function setTransitionContainerRef(ref) {
this.transitionContainer = ref;
}
return setTransitionContainerRef;
}()
}, {
key: 'maybeTransitionNextMonth',
value: function () {
function maybeTransitionNextMonth(newFocusedDate) {
var numberOfMonths = this.props.numberOfMonths;
var _state5 = this.state,
currentMonth = _state5.currentMonth,
focusedDate = _state5.focusedDate;
var newFocusedDateMonth = newFocusedDate.month();
var focusedDateMonth = focusedDate.month();
var isNewFocusedDateVisible = (0, _isDayVisible2['default'])(newFocusedDate, currentMonth, numberOfMonths);
if (newFocusedDateMonth !== focusedDateMonth && !isNewFocusedDateVisible) {
this.onNextMonthClick(newFocusedDate);
return true;
}
return false;
}
return maybeTransitionNextMonth;
}()
}, {
key: 'maybeTransitionPrevMonth',
value: function () {
function maybeTransitionPrevMonth(newFocusedDate) {
var numberOfMonths = this.props.numberOfMonths;
var _state6 = this.state,
currentMonth = _state6.currentMonth,
focusedDate = _state6.focusedDate;
var newFocusedDateMonth = newFocusedDate.month();
var focusedDateMonth = focusedDate.month();
var isNewFocusedDateVisible = (0, _isDayVisible2['default'])(newFocusedDate, currentMonth, numberOfMonths);
if (newFocusedDateMonth !== focusedDateMonth && !isNewFocusedDateVisible) {
this.onPrevMonthClick(newFocusedDate);
return true;
}
return false;
}
return maybeTransitionPrevMonth;
}()
}, {
key: 'multiplyScrollableMonths',
value: function () {
function multiplyScrollableMonths(e) {
var onMultiplyScrollableMonths = this.props.onMultiplyScrollableMonths;
if (e) e.preventDefault();
if (onMultiplyScrollableMonths) onMultiplyScrollableMonths(e);
this.setState(function (_ref) {
var scrollableMonthMultiple = _ref.scrollableMonthMultiple;
return {
scrollableMonthMultiple: scrollableMonthMultiple + 1
};
});
}
return multiplyScrollableMonths;
}()
}, {
key: 'isHorizontal',
value: function () {
function isHorizontal() {
var orientation = this.props.orientation;
return orientation === _constants.HORIZONTAL_ORIENTATION;
}
return isHorizontal;
}()
}, {
key: 'isVertical',
value: function () {
function isVertical() {
var orientation = this.props.orientation;
return orientation === _constants.VERTICAL_ORIENTATION || orientation === _constants.VERTICAL_SCROLLABLE;
}
return isVertical;
}()
}, {
key: 'updateStateAfterMonthTransition',
value: function () {
function updateStateAfterMonthTransition() {
var _this4 = this;
var _props7 = this.props,
onPrevMonthClick = _props7.onPrevMonthClick,
onNextMonthClick = _props7.onNextMonthClick,
numberOfMonths = _props7.numberOfMonths,
onMonthChange = _props7.onMonthChange,
onYearChange = _props7.onYearChange,
isRTL = _props7.isRTL;
var _state7 = this.state,
currentMonth = _state7.currentMonth,
monthTransition = _state7.monthTransition,
focusedDate = _state7.focusedDate,
nextFocusedDate = _state7.nextFocusedDate,
withMouseInteractions = _state7.withMouseInteractions,
calendarMonthWidth = _state7.calendarMonthWidth;
if (!monthTransition) return;
var newMonth = currentMonth.clone();
var firstDayOfWeek = this.getFirstDayOfWeek();
if (monthTransition === PREV_TRANSITION) {
newMonth.subtract(1, 'month');
if (onPrevMonthClick) onPrevMonthClick(newMonth);
var newInvisibleMonth = newMonth.clone().subtract(1, 'month');
var numberOfWeeks = (0, _getNumberOfCalendarMonthWeeks2['default'])(newInvisibleMonth, firstDayOfWeek);
this.calendarMonthWeeks = [numberOfWeeks].concat(_toConsumableArray(this.calendarMonthWeeks.slice(0, -1)));
} else if (monthTransition === NEXT_TRANSITION) {
newMonth.add(1, 'month');
if (onNextMonthClick) onNextMonthClick(newMonth);
var _newInvisibleMonth = newMonth.clone().add(numberOfMonths, 'month');
var _numberOfWeeks = (0, _getNumberOfCalendarMonthWeeks2['default'])(_newInvisibleMonth, firstDayOfWeek);
this.calendarMonthWeeks = [].concat(_toConsumableArray(this.calendarMonthWeeks.slice(1)), [_numberOfWeeks]);
} else if (monthTransition === MONTH_SELECTION_TRANSITION) {
if (onMonthChange) onMonthChange(newMonth);
} else if (monthTransition === YEAR_SELECTION_TRANSITION) {
if (onYearChange) onYearChange(newMonth);
}
var newFocusedDate = null;
if (nextFocusedDate) {
newFocusedDate = nextFocusedDate;
} else if (!focusedDate && !withMouseInteractions) {
newFocusedDate = this.getFocusedDay(newMonth);
}
this.setState({
currentMonth: newMonth,
monthTransition: null,
translationValue: isRTL && this.isHorizontal() ? -calendarMonthWidth : 0,
nextFocusedDate: null,
focusedDate: newFocusedDate
}, function () {
// we don't want to focus on the relevant calendar day after a month transition
// if the user is navigating around using a mouse
if (withMouseInteractions) {
var activeElement = (0, _getActiveElement2['default'])();
if (activeElement && activeElement !== document.body && _this4.container.contains(activeElement)) {
activeElement.blur();
}
}
});
}
return updateStateAfterMonthTransition;
}()
}, {
key: 'adjustDayPickerHeight',
value: function () {
function adjustDayPickerHeight(newMonthHeight) {
var _this5 = this;
var monthHeight = newMonthHeight + MONTH_PADDING;
if (monthHeight !== this.calendarMonthGridHeight) {
this.transitionContainer.style.height = String(monthHeight) + 'px';
if (!this.calendarMonthGridHeight) {
setTimeout(function () {
_this5.setState({ hasSetHeight: true });
}, 0);
}
this.calendarMonthGridHeight = monthHeight;
}
}
return adjustDayPickerHeight;
}()
}, {
key: 'calculateAndSetDayPickerHeight',
value: function () {
function calculateAndSetDayPickerHeight() {
var _props8 = this.props,
daySize = _props8.daySize,
numberOfMonths = _props8.numberOfMonths;
var monthTitleHeight = this.state.monthTitleHeight;
var visibleCalendarWeeks = this.calendarMonthWeeks.slice(1, numberOfMonths + 1);
var calendarMonthWeeksHeight = Math.max.apply(Math, [0].concat(_toConsumableArray(visibleCalendarWeeks))) * (daySize - 1);
var newMonthHeight = monthTitleHeight + calendarMonthWeeksHeight + 1;
if (this.isHorizontal()) {
this.adjustDayPickerHeight(newMonthHeight);
}
}
return calculateAndSetDayPickerHeight;
}()
}, {
key: 'openKeyboardShortcutsPanel',
value: function () {
function openKeyboardShortcutsPanel(onCloseCallBack) {
this.setState({
showKeyboardShortcuts: true,
onKeyboardShortcutsPanelClose: onCloseCallBack
});
}
return openKeyboardShortcutsPanel;
}()
}, {
key: 'closeKeyboardShortcutsPanel',
value: function () {
function closeKeyboardShortcutsPanel() {
var onKeyboardShortcutsPanelClose = this.state.onKeyboardShortcutsPanelClose;
if (onKeyboardShortcutsPanelClose) {
onKeyboardShortcutsPanelClose();
}
this.setState({
onKeyboardShortcutsPanelClose: null,
showKeyboardShortcuts: false
});
}
return closeKeyboardShortcutsPanel;
}()
}, {
key: 'renderNavigation',
value: function () {
function renderNavigation() {
var _this6 = this;
var _props9 = this.props,
navPrev = _props9.navPrev,
navNext = _props9.navNext,
noNavButtons = _props9.noNavButtons,
orientation = _props9.orientation,
phrases = _props9.phrases,
isRTL = _props9.isRTL;
if (noNavButtons) {
return null;
}
var onNextMonthClick = void 0;
if (orientation === _constants.VERTICAL_SCROLLABLE) {
onNextMonthClick = this.multiplyScrollableMonths;
} else {
onNextMonthClick = function () {
function onNextMonthClick(e) {
_this6.onNextMonthClick(null, e);
}
return onNextMonthClick;
}();
}
return _react2['default'].createElement(_DayPickerNavigation2['default'], {
onPrevMonthClick: function () {
function onPrevMonthClick(e) {
_this6.onPrevMonthClick(null, e);
}
return onPrevMonthClick;
}(),
onNextMonthClick: onNextMonthClick,
navPrev: navPrev,
navNext: navNext,
orientation: orientation,
phrases: phrases,
isRTL: isRTL
});
}
return renderNavigation;
}()
}, {
key: 'renderWeekHeader',
value: function () {
function renderWeekHeader(index) {
var _props10 = this.props,
daySize = _props10.daySize,
horizontalMonthPadding = _props10.horizontalMonthPadding,
orientation = _props10.orientation,
weekDayFormat = _props10.weekDayFormat,
styles = _props10.styles;
var calendarMonthWidth = this.state.calendarMonthWidth;
var verticalScrollable = orientation === _constants.VERTICAL_SCROLLABLE;
var horizontalStyle = {
left: index * calendarMonthWidth
};
var verticalStyle = {
marginLeft: -calendarMonthWidth / 2
};
var weekHeaderStyle = {}; // no styles applied to the vertical-scrollable orientation
if (this.isHorizontal()) {
weekHeaderStyle = horizontalStyle;
} else if (this.isVertical() && !verticalScrollable) {
weekHeaderStyle = verticalStyle;
}
var firstDayOfWeek = this.getFirstDayOfWeek();
var header = [];
for (var i = 0; i < 7; i += 1) {
header.push(_react2['default'].createElement(
'li',
_extends({ key: i }, (0, _reactWithStyles.css)(styles.DayPicker_weekHeader_li, { width: daySize })),
_react2['default'].createElement(
'small',
null,
(0, _moment2['default'])().day((i + firstDayOfWeek) % 7).format(weekDayFormat)
)
));
}
return _react2['default'].createElement(
'div',
_extends({}, (0, _reactWithStyles.css)(styles.DayPicker_weekHeader, this.isVertical() && styles.DayPicker_weekHeader__vertical, verticalScrollable && styles.DayPicker_weekHeader__verticalScrollable, weekHeaderStyle, { padding: '0 ' + String(horizontalMonthPadding) + 'px' }), {
key: 'week-' + String(index)
}),
_react2['default'].createElement(
'ul',
(0, _reactWithStyles.css)(styles.DayPicker_weekHeader_ul),
header
)
);
}
return renderWeekHeader;
}()
}, {
key: 'render',
value: function () {
function render() {
var _this7 = this;
var _state8 = this.state,
calendarMonthWidth = _state8.calendarMonthWidth,
currentMonth = _state8.currentMonth,
monthTransition = _state8.monthTransition,
translationValue = _state8.translationValue,
scrollableMonthMultiple = _state8.scrollableMonthMultiple,
focusedDate = _state8.focusedDate,
showKeyboardShortcuts = _state8.showKeyboardShortcuts,
isTouch = _state8.isTouchDevice,
hasSetHeight = _state8.hasSetHeight,
calendarInfoWidth = _state8.calendarInfoWidth,
monthTitleHeight = _state8.monthTitleHeight;
var _props11 = this.props,
enableOutsideDays = _props11.enableOutsideDays,
numberOfMonths = _props11.numberOfMonths,
orientation = _props11.orientation,
modifiers = _props11.modifiers,
withPortal = _props11.withPortal,
onDayClick = _props11.onDayClick,
onDayMouseEnter = _props11.onDayMouseEnter,
onDayMouseLeave = _props11.onDayMouseLeave,
firstDayOfWeek = _props11.firstDayOfWeek,
renderMonthText = _props11.renderMonthText,
renderCalendarDay = _props11.renderCalendarDay,
renderDayContents = _props11.renderDayContents,
renderCalendarInfo = _props11.renderCalendarInfo,
renderMonthElement = _props11.renderMonthElement,
calendarInfoPosition = _props11.calendarInfoPosition,
hideKeyboardShortcutsPanel = _props11.hideKeyboardShortcutsPanel,
onOutsideClick = _props11.onOutsideClick,
monthFormat = _props11.monthFormat,
daySize = _props11.daySize,
isFocused = _props11.isFocused,
isRTL = _props11.isRTL,
styles = _props11.styles,
theme = _props11.theme,
phrases = _props11.phrases,
verticalHeight = _props11.verticalHeight,
dayAriaLabelFormat = _props11.dayAriaLabelFormat,
noBorder = _props11.noBorder,
transitionDuration = _props11.transitionDuration,
verticalBorderSpacing = _props11.verticalBorderSpacing,
horizontalMonthPadding = _props11.horizontalMonthPadding;
var dayPickerHorizontalPadding = theme.reactDates.spacing.dayPickerHorizontalPadding;
var isHorizontal = this.isHorizontal();
var numOfWeekHeaders = this.isVertical() ? 1 : numberOfMonths;
var weekHeaders = [];
for (var i = 0; i < numOfWeekHeaders; i += 1) {
weekHeaders.push(this.renderWeekHeader(i));
}
var verticalScrollable = orientation === _constants.VERTICAL_SCROLLABLE;
var height = void 0;
if (isHorizontal) {
height = this.calendarMonthGridHeight;
} else if (this.isVertical() && !verticalScrollable && !withPortal) {
// If the user doesn't set a desired height,
// we default back to this kind of made-up value that generally looks good
height = verticalHeight || 1.75 * calendarMonthWidth;
}
var isCalendarMonthGridAnimating = monthTransition !== null;
var shouldFocusDate = !isCalendarMonthGridAnimating && isFocused;
var keyboardShortcutButtonLocation = _DayPickerKeyboardShortcuts.BOTTOM_RIGHT;
if (this.isVertical()) {
keyboardShortcutButtonLocation = withPortal ? _DayPickerKeyboardShortcuts.TOP_LEFT : _DayPickerKeyboardShortcuts.TOP_RIGHT;
}
var shouldAnimateHeight = isHorizontal && hasSetHeight;
var calendarInfoPositionTop = calendarInfoPosition === _constants.INFO_POSITION_TOP;
var calendarInfoPositionBottom = calendarInfoPosition === _constants.INFO_POSITION_BOTTOM;
var calendarInfoPositionBefore = calendarInfoPosition === _constants.INFO_POSITION_BEFORE;
var calendarInfoPositionAfter = calendarInfoPosition === _constants.INFO_POSITION_AFTER;
var calendarInfoIsInline = calendarInfoPositionBefore || calendarInfoPositionAfter;
var calendarInfo = renderCalendarInfo && _react2['default'].createElement(
'div',
_extends({
ref: this.setCalendarInfoRef
}, (0, _reactWithStyles.css)(calendarInfoIsInline && styles.DayPicker_calendarInfo__horizontal)),
renderCalendarInfo()
);
var calendarInfoPanelWidth = renderCalendarInfo && calendarInfoIsInline ? calendarInfoWidth : 0;
var firstVisibleMonthIndex = this.getFirstVisibleIndex();
var wrapperHorizontalWidth = calendarMonthWidth * numberOfMonths + 2 * dayPickerHorizontalPadding;
// Adding `1px` because of whitespace between 2 inline-block
var fullHorizontalWidth = wrapperHorizontalWidth + calendarInfoPanelWidth + 1;
var transitionContainerStyle = {
width: isHorizontal && wrapperHorizontalWidth,
height: height
};
var dayPickerWrapperStyle = {
width: isHorizontal && wrapperHorizontalWidth
};
var dayPickerStyle = {
width: isHorizontal && fullHorizontalWidth,
// These values are to center the datepicker (approximately) on the page
marginLeft: isHorizontal && withPortal ? -fullHorizontalWidth / 2 : null,
marginTop: isHorizontal && withPortal ? -calendarMonthWidth / 2 : null
};
return _react2['default'].createElement(
'div',
_extends({
role: 'application',
'aria-label': phrases.calendarLabel
}, (0, _reactWithStyles.css)(styles.DayPicker, isHorizontal && styles.DayPicker__horizontal, verticalScrollable && styles.DayPicker__verticalScrollable, isHorizontal && withPortal && styles.DayPicker_portal__horizontal, this.isVertical() && withPortal && styles.DayPicker_portal__vertical, dayPickerStyle, !monthTitleHeight && styles.DayPicker__hidden, !noBorder && styles.DayPicker__withBorder)),
_react2['default'].createElement(
_reactOutsideClickHandler2['default'],
{ onOutsideClick: onOutsideClick },
(calendarInfoPositionTop || calendarInfoPositionBefore) && calendarInfo,
_react2['default'].createElement(
'div',
(0, _reactWithStyles.css)(dayPickerWrapperStyle, calendarInfoIsInline && isHorizontal && styles.DayPicker_wrapper__horizontal),
_react2['default'].createElement(
'div',
_extends({}, (0, _reactWithStyles.css)(styles.DayPicker_weekHeaders, isHorizontal && styles.DayPicker_weekHeaders__horizontal), {
'aria-hidden': 'true',
role: 'presentation'
}),
weekHeaders
),
_react2['default'].createElement(
'div',
_extends({}, (0, _reactWithStyles.css)(styles.DayPicker_focusRegion), {
ref: this.setContainerRef,
onClick: function () {
function onClick(e) {
e.stopPropagation();
}
return onClick;
}(),
onKeyDown: this.onKeyDown,
onMouseUp: function () {
function onMouseUp() {
_this7.setState({ withMouseInteractions: true });
}
return onMouseUp;
}(),
role: 'region',
tabIndex: -1
}),
!verticalScrollable && this.renderNavigation(),
_react2['default'].createElement(
'div',
_extends({}, (0, _reactWithStyles.css)(styles.DayPicker_transitionContainer, shouldAnimateHeight && styles.DayPicker_transitionContainer__horizontal, this.isVertical() && styles.DayPicker_transitionContainer__vertical, verticalScrollable && styles.DayPicker_transitionContainer__verticalScrollable, transitionContainerStyle), {
ref: this.setTransitionContainerRef
}),
_react2['default'].createElement(_CalendarMonthGrid2['default'], {
setMonthTitleHeight: !monthTitleHeight ? this.setMonthTitleHeight : undefined,
translationValue: translationValue,
enableOutsideDays: enableOutsideDays,
firstVisibleMonthIndex: firstVisibleMonthIndex,
initialMonth: currentMonth,
isAnimating: isCalendarMonthGridAnimating,
modifiers: modifiers,
orientation: orientation,
numberOfMonths: numberOfMonths * scrollableMonthMultiple,
onDayClick: onDayClick,
onDayMouseEnter: onDayMouseEnter,
onDayMouseLeave: onDayMouseLeave,
onMonthChange: this.onMonthChange,
onYearChange: this.onYearChange,
renderMonthText: renderMonthText,
renderCalendarDay: renderCalendarDay,
renderDayContents: renderDayContents,
renderMonthElement: renderMonthElement,
onMonthTransitionEnd: this.updateStateAfterMonthTransition,
monthFormat: monthFormat,
daySize: daySize,
firstDayOfWeek: firstDayOfWeek,
isFocused: shouldFocusDate,
focusedDate: focusedDate,
phrases: phrases,
isRTL: isRTL,
dayAriaLabelFormat: dayAriaLabelFormat,
transitionDuration: transitionDuration,
verticalBorderSpacing: verticalBorderSpacing,
horizontalMonthPadding: horizontalMonthPadding
}),
verticalScrollable && this.renderNavigation()
),
!isTouch && !hideKeyboardShortcutsPanel && _react2['default'].createElement(_DayPickerKeyboardShortcuts2['default'], {
block: this.isVertical() && !withPortal,
buttonLocation: keyboardShortcutButtonLocation,
showKeyboardShortcutsPanel: showKeyboardShortcuts,
openKeyboardShortcutsPanel: this.openKeyboardShortcutsPanel,
closeKeyboardShortcutsPanel: this.closeKeyboardShortcutsPanel,
phrases: phrases
})
)
),
(calendarInfoPositionBottom || calendarInfoPositionAfter) && calendarInfo
)
);
}
return render;
}()
}]);
return DayPicker;
}(_react2['default'].Component);
DayPicker.propTypes = propTypes;
DayPicker.defaultProps = defaultProps;
exports.PureDayPicker = DayPicker;
exports['default'] = (0, _reactWithStyles.withStyles)(function (_ref2) {
var _ref2$reactDates = _ref2.reactDates,
color = _ref2$reactDates.color,
font = _ref2$reactDates.font,
noScrollBarOnVerticalScrollable = _ref2$reactDates.noScrollBarOnVerticalScrollable,
spacing = _ref2$reactDates.spacing,
zIndex = _ref2$reactDates.zIndex;
return {
DayPicker: {
background: color.background,
position: 'relative',
textAlign: 'left'
},
DayPicker__horizontal: {
background: color.background
},
DayPicker__verticalScrollable: {
height: '100%'
},
DayPicker__hidden: {
visibility: 'hidden'
},
DayPicker__withBorder: {
boxShadow: '0 2px 6px rgba(0, 0, 0, 0.05), 0 0 0 1px rgba(0, 0, 0, 0.07)',
borderRadius: 3
},
DayPicker_portal__horizontal: {
boxShadow: 'none',
position: 'absolute',
left: '50%',
top: '50%'
},
DayPicker_portal__vertical: {
position: 'initial'
},
DayPicker_focusRegion: {
outline: 'none'
},
DayPicker_calendarInfo__horizontal: {
display: 'inline-block',
verticalAlign: 'top'
},
DayPicker_wrapper__horizontal: {
display: 'inline-block',
verticalAlign: 'top'
},
DayPicker_weekHeaders: {
position: 'relative'
},
DayPicker_weekHeaders__horizontal: {
marginLeft: spacing.dayPickerHorizontalPadding
},
DayPicker_weekHeader: {
color: color.placeholderText,
position: 'absolute',
top: 62,
zIndex: zIndex + 2,
textAlign: 'left'
},
DayPicker_weekHeader__vertical: {
left: '50%'
},
DayPicker_weekHeader__verticalScrollable: {
top: 0,
display: 'table-row',
borderBottom: '1px solid ' + String(color.core.border),
background: color.background,
marginLeft: 0,
left: 0,
width: '100%',
textAlign: 'center'
},
DayPicker_weekHeader_ul: {
listStyle: 'none',
margin: '1px 0',
paddingLeft: 0,
paddingRight: 0,
fontSize: font.size
},
DayPicker_weekHeader_li: {
display: 'inline-block',
textAlign: 'center'
},
DayPicker_transitionContainer: {
position: 'relative',
overflow: 'hidden',
borderRadius: 3
},
DayPicker_transitionContainer__horizontal: {
transition: 'height 0.2s ease-in-out'
},
DayPicker_transitionContainer__vertical: {
width: '100%'
},
DayPicker_transitionContainer__verticalScrollable: (0, _object2['default'])({
paddingTop: 20,
height: '100%',
position: 'absolute',
top: 0,
bottom: 0,
right: 0,
left: 0,
overflowY: 'scroll'
}, noScrollBarOnVerticalScrollable && {
'-webkitOverflowScrolling': 'touch',
'::-webkit-scrollbar': {
'-webkit-appearance': 'none',
display: 'none'
}
})
};
})(DayPicker);
/***/ }),
/***/ "NykK":
/***/ (function(module, exports, __webpack_require__) {
var Symbol = __webpack_require__("nmnc"),
getRawTag = __webpack_require__("AP2z"),
objectToString = __webpack_require__("KfNM");
/** `Object#toString` result references. */
var nullTag = '[object Null]',
undefinedTag = '[object Undefined]';
/** Built-in value references. */
var symToStringTag = Symbol ? Symbol.toStringTag : undefined;
/**
* The base implementation of `getTag` without fallbacks for buggy environments.
*
* @private
* @param {*} value The value to query.
* @returns {string} Returns the `toStringTag`.
*/
function baseGetTag(value) {
if (value == null) {
return value === undefined ? undefinedTag : nullTag;
}
return (symToStringTag && symToStringTag in Object(value))
? getRawTag(value)
: objectToString(value);
}
module.exports = baseGetTag;
/***/ }),
/***/ "Nym8":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getActiveElement; });
/* harmony import */ var _getDocument_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("ouKs");
/**
* Returns `element.ownerDocument.activeElement`.
*/
function getActiveElement(element) {
var _getDocument = Object(_getDocument_js__WEBPACK_IMPORTED_MODULE_0__[/* getDocument */ "a"])(element),
activeElement = _getDocument.activeElement;
if (!(activeElement !== null && activeElement !== void 0 && activeElement.nodeName)) {
// In IE11, activeElement might be an empty object if we're interacting
// with elements inside of an iframe.
return null;
}
return activeElement;
}
/***/ }),
/***/ "Ohaz":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getNamespace; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getConnectedNamespace; });
/* harmony import */ var _constants__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("tQ+x");
/**
* Internal dependencies
*/
/**
* Creates a dedicated context namespace HTML attribute for components.
* ns is short for "namespace"
*
* @example
* ```jsx
* <div {...ns('Container')} />
* ```
*
* @param {string} componentName The name for the component.
* @return {Record<string, any>} A props object with the namespaced HTML attribute.
*/
function getNamespace(componentName) {
return {
[_constants__WEBPACK_IMPORTED_MODULE_0__[/* COMPONENT_NAMESPACE */ "a"]]: componentName
};
}
/**
* Creates a dedicated connected context namespace HTML attribute for components.
* ns is short for "namespace"
*
* @example
* ```jsx
* <div {...cns()} />
* ```
*
* @return {Record<string, any>} A props object with the namespaced HTML attribute.
*/
function getConnectedNamespace() {
return {
[_constants__WEBPACK_IMPORTED_MODULE_0__[/* CONNECTED_NAMESPACE */ "b"]]: true
};
}
/***/ }),
/***/ "PJYZ":
/***/ (function(module, exports) {
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
module.exports = _assertThisInitialized;
module.exports["default"] = module.exports, module.exports.__esModule = true;
/***/ }),
/***/ "PcHe":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return hasFocusWithin; });
/* harmony import */ var _getActiveElement_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("Nym8");
/* harmony import */ var _contains_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("utzN");
/**
* Checks if `element` has focus within. Elements that are referenced by
* `aria-activedescendant` are also considered.
*
* @example
* import { hasFocusWithin } from "reakit-utils";
*
* hasFocusWithin(document.getElementById("id"));
*/
function hasFocusWithin(element) {
var activeElement = Object(_getActiveElement_js__WEBPACK_IMPORTED_MODULE_0__[/* getActiveElement */ "a"])(element);
if (!activeElement) return false;
if (Object(_contains_js__WEBPACK_IMPORTED_MODULE_1__[/* contains */ "a"])(element, activeElement)) return true;
var activeDescendant = activeElement.getAttribute("aria-activedescendant");
if (!activeDescendant) return false;
if (activeDescendant === element.id) return true;
return !!element.querySelector("#" + activeDescendant);
}
/***/ }),
/***/ "Pjai":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var ToPrimitive = __webpack_require__("vLdR");
// http://262.ecma-international.org/5.1/#sec-9.3
module.exports = function ToNumber(value) {
var prim = ToPrimitive(value, Number);
if (typeof prim !== 'string') {
return +prim; // eslint-disable-line no-implicit-coercion
}
// eslint-disable-next-line no-control-regex
var trimmed = prim.replace(/^[ \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u0085]+|[ \t\x0b\f\xa0\ufeff\n\r\u2028\u2029\u1680\u180e\u2000\u2001\u2002\u2003\u2004\u2005\u2006\u2007\u2008\u2009\u200a\u202f\u205f\u3000\u0085]+$/g, '');
if ((/^0[ob]|^[+-]0x/).test(trimmed)) {
return NaN;
}
return +trimmed; // eslint-disable-line no-implicit-coercion
};
/***/ }),
/***/ "Pq96":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = isPrevMonth;
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _isSameMonth = __webpack_require__("ulUS");
var _isSameMonth2 = _interopRequireDefault(_isSameMonth);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function isPrevMonth(a, b) {
if (!_moment2['default'].isMoment(a) || !_moment2['default'].isMoment(b)) return false;
return (0, _isSameMonth2['default'])(a.clone().subtract(1, 'month'), b);
}
/***/ }),
/***/ "PrET":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var bind = __webpack_require__("D3zA");
var GetIntrinsic = __webpack_require__("AM7I");
var $apply = GetIntrinsic('%Function.prototype.apply%');
var $call = GetIntrinsic('%Function.prototype.call%');
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
if ($defineProperty) {
try {
$defineProperty({}, 'a', { value: 1 });
} catch (e) {
// IE 8 has a broken defineProperty
$defineProperty = null;
}
}
module.exports = function callBind() {
return $reflectApply(bind, $call, arguments);
};
var applyBind = function applyBind() {
return $reflectApply(bind, $apply, arguments);
};
if ($defineProperty) {
$defineProperty(module.exports, 'apply', { value: applyBind });
} else {
module.exports.apply = applyBind;
}
/***/ }),
/***/ "Ptb8":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isObject; });
/**
* Checks whether `arg` is an object or not.
*
* @returns {boolean}
*/
function isObject(arg) {
return typeof arg === "object" && arg != null;
}
/***/ }),
/***/ "Q4Sy":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const plus = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M18 11.2h-5.2V6h-1.6v5.2H6v1.6h5.2V18h1.6v-5.2H18z"
}));
/* harmony default export */ __webpack_exports__["a"] = (plus);
/***/ }),
/***/ "QEu6":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var CHANNEL = exports.CHANNEL = '__direction__';
var DIRECTIONS = exports.DIRECTIONS = {
LTR: 'ltr',
RTL: 'rtl'
};
/***/ }),
/***/ "QIyF":
/***/ (function(module, exports, __webpack_require__) {
var root = __webpack_require__("Kz5y");
/**
* Gets the timestamp of the number of milliseconds that have elapsed since
* the Unix epoch (1 January 1970 00:00:00 UTC).
*
* @static
* @memberOf _
* @since 2.4.0
* @category Date
* @returns {number} Returns the timestamp.
* @example
*
* _.defer(function(stamp) {
* console.log(_.now() - stamp);
* }, _.now());
* // => Logs the number of milliseconds it took for the deferred invocation.
*/
var now = function() {
return root.Date.now();
};
module.exports = now;
/***/ }),
/***/ "Qmvf":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var has = __webpack_require__("oNNP");
var $TypeError = GetIntrinsic('%TypeError%');
module.exports = function IsPropertyDescriptor(ES, Desc) {
if (ES.Type(Desc) !== 'Object') {
return false;
}
var allowed = {
'[[Configurable]]': true,
'[[Enumerable]]': true,
'[[Get]]': true,
'[[Set]]': true,
'[[Value]]': true,
'[[Writable]]': true
};
for (var key in Desc) { // eslint-disable-line no-restricted-syntax
if (has(Desc, key) && !allowed[key]) {
return false;
}
}
if (ES.IsDataDescriptor(Desc) && ES.IsAccessorDescriptor(Desc)) {
throw new $TypeError('Property Descriptors may not be both accessor and data descriptors');
}
return true;
};
/***/ }),
/***/ "R/b7":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var abs = __webpack_require__("In1I");
var floor = __webpack_require__("4HRn");
var $isNaN = __webpack_require__("HwJD");
var $isFinite = __webpack_require__("ald4");
// https://ecma-international.org/ecma-262/6.0/#sec-isinteger
module.exports = function IsInteger(argument) {
if (typeof argument !== 'number' || $isNaN(argument) || !$isFinite(argument)) {
return false;
}
var absValue = abs(argument);
return floor(absValue) === absValue;
};
/***/ }),
/***/ "RDTF":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectSpread2; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return _objectWithoutPropertiesLoose; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return _createForOfIteratorHelperLoose; });
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
function ownKeys(object, enumerableOnly) {
var keys = Object.keys(object);
if (Object.getOwnPropertySymbols) {
var symbols = Object.getOwnPropertySymbols(object);
if (enumerableOnly) symbols = symbols.filter(function (sym) {
return Object.getOwnPropertyDescriptor(object, sym).enumerable;
});
keys.push.apply(keys, symbols);
}
return keys;
}
function _objectSpread2(target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i] != null ? arguments[i] : {};
if (i % 2) {
ownKeys(Object(source), true).forEach(function (key) {
_defineProperty(target, key, source[key]);
});
} else if (Object.getOwnPropertyDescriptors) {
Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
} else {
ownKeys(Object(source)).forEach(function (key) {
Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
});
}
}
return target;
}
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
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);
}
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;
}
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it;
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
it = o[Symbol.iterator]();
return it.next.bind(it);
}
/***/ }),
/***/ "RMJe":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const check = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M18.3 5.6L9.9 16.9l-4.6-3.4-.9 1.2 5.8 4.3 9.3-12.6z"
}));
/* harmony default export */ __webpack_exports__["a"] = (check);
/***/ }),
/***/ "RxS6":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["keycodes"]; }());
/***/ }),
/***/ "S0jC":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = __webpack_require__("laOf");
/***/ }),
/***/ "SB3u":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, "SVG", function() { return /* reexport */ external_wp_primitives_["SVG"]; });
__webpack_require__.d(__webpack_exports__, "Path", function() { return /* reexport */ external_wp_primitives_["Path"]; });
__webpack_require__.d(__webpack_exports__, "Circle", function() { return /* reexport */ external_wp_primitives_["Circle"]; });
__webpack_require__.d(__webpack_exports__, "Polygon", function() { return /* reexport */ external_wp_primitives_["Polygon"]; });
__webpack_require__.d(__webpack_exports__, "Rect", function() { return /* reexport */ external_wp_primitives_["Rect"]; });
__webpack_require__.d(__webpack_exports__, "G", function() { return /* reexport */ external_wp_primitives_["G"]; });
__webpack_require__.d(__webpack_exports__, "HorizontalRule", function() { return /* reexport */ external_wp_primitives_["HorizontalRule"]; });
__webpack_require__.d(__webpack_exports__, "BlockQuotation", function() { return /* reexport */ external_wp_primitives_["BlockQuotation"]; });
__webpack_require__.d(__webpack_exports__, "__experimentalAlignmentMatrixControl", function() { return /* reexport */ AlignmentMatrixControl; });
__webpack_require__.d(__webpack_exports__, "Animate", function() { return /* reexport */ animate["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "__unstableGetAnimateClassName", function() { return /* reexport */ animate["b" /* getAnimateClassName */]; });
__webpack_require__.d(__webpack_exports__, "AnglePickerControl", function() { return /* reexport */ AnglePickerControl; });
__webpack_require__.d(__webpack_exports__, "Autocomplete", function() { return /* reexport */ Autocomplete; });
__webpack_require__.d(__webpack_exports__, "__unstableUseAutocompleteProps", function() { return /* reexport */ useAutocompleteProps; });
__webpack_require__.d(__webpack_exports__, "BaseControl", function() { return /* reexport */ base_control; });
__webpack_require__.d(__webpack_exports__, "__experimentalBoxControl", function() { return /* reexport */ BoxControl; });
__webpack_require__.d(__webpack_exports__, "Button", function() { return /* reexport */ build_module_button["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "ButtonGroup", function() { return /* reexport */ button_group; });
__webpack_require__.d(__webpack_exports__, "Card", function() { return /* reexport */ card; });
__webpack_require__.d(__webpack_exports__, "CardBody", function() { return /* reexport */ card_body; });
__webpack_require__.d(__webpack_exports__, "CardDivider", function() { return /* reexport */ divider; });
__webpack_require__.d(__webpack_exports__, "CardFooter", function() { return /* reexport */ footer; });
__webpack_require__.d(__webpack_exports__, "CardHeader", function() { return /* reexport */ card_header; });
__webpack_require__.d(__webpack_exports__, "CardMedia", function() { return /* reexport */ media; });
__webpack_require__.d(__webpack_exports__, "CheckboxControl", function() { return /* reexport */ CheckboxControl; });
__webpack_require__.d(__webpack_exports__, "ClipboardButton", function() { return /* reexport */ ClipboardButton; });
__webpack_require__.d(__webpack_exports__, "__experimentalColorEdit", function() { return /* reexport */ ColorEdit; });
__webpack_require__.d(__webpack_exports__, "ColorIndicator", function() { return /* reexport */ color_indicator; });
__webpack_require__.d(__webpack_exports__, "ColorPalette", function() { return /* reexport */ ColorPalette; });
__webpack_require__.d(__webpack_exports__, "ColorPicker", function() { return /* reexport */ color_picker_ColorPicker; });
__webpack_require__.d(__webpack_exports__, "ComboboxControl", function() { return /* reexport */ combobox_control; });
__webpack_require__.d(__webpack_exports__, "__unstableComposite", function() { return /* reexport */ Composite; });
__webpack_require__.d(__webpack_exports__, "__unstableCompositeGroup", function() { return /* reexport */ CompositeGroup; });
__webpack_require__.d(__webpack_exports__, "__unstableCompositeItem", function() { return /* reexport */ CompositeItem["a" /* CompositeItem */]; });
__webpack_require__.d(__webpack_exports__, "__unstableUseCompositeState", function() { return /* reexport */ useCompositeState; });
__webpack_require__.d(__webpack_exports__, "CustomSelectControl", function() { return /* reexport */ CustomSelectControl; });
__webpack_require__.d(__webpack_exports__, "Dashicon", function() { return /* reexport */ dashicon["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "DateTimePicker", function() { return /* reexport */ date_time; });
__webpack_require__.d(__webpack_exports__, "DatePicker", function() { return /* reexport */ date_time_date; });
__webpack_require__.d(__webpack_exports__, "TimePicker", function() { return /* reexport */ time; });
__webpack_require__.d(__webpack_exports__, "__experimentalDimensionControl", function() { return /* reexport */ dimension_control; });
__webpack_require__.d(__webpack_exports__, "Disabled", function() { return /* reexport */ build_module_disabled; });
__webpack_require__.d(__webpack_exports__, "__unstableDisclosureContent", function() { return /* reexport */ DisclosureContent; });
__webpack_require__.d(__webpack_exports__, "__experimentalDivider", function() { return /* reexport */ divider_component; });
__webpack_require__.d(__webpack_exports__, "Draggable", function() { return /* reexport */ Draggable; });
__webpack_require__.d(__webpack_exports__, "DropZone", function() { return /* reexport */ DropZoneComponent; });
__webpack_require__.d(__webpack_exports__, "DropZoneProvider", function() { return /* reexport */ DropZoneProvider; });
__webpack_require__.d(__webpack_exports__, "Dropdown", function() { return /* reexport */ Dropdown; });
__webpack_require__.d(__webpack_exports__, "DropdownMenu", function() { return /* reexport */ dropdown_menu; });
__webpack_require__.d(__webpack_exports__, "DuotoneSwatch", function() { return /* reexport */ duotone_swatch; });
__webpack_require__.d(__webpack_exports__, "DuotonePicker", function() { return /* reexport */ duotone_picker; });
__webpack_require__.d(__webpack_exports__, "ExternalLink", function() { return /* reexport */ external_link; });
__webpack_require__.d(__webpack_exports__, "Flex", function() { return /* reexport */ flex_component; });
__webpack_require__.d(__webpack_exports__, "FlexBlock", function() { return /* reexport */ flex_block_component; });
__webpack_require__.d(__webpack_exports__, "FlexItem", function() { return /* reexport */ flex_item_component; });
__webpack_require__.d(__webpack_exports__, "FocalPointPicker", function() { return /* reexport */ focal_point_picker; });
__webpack_require__.d(__webpack_exports__, "FocusableIframe", function() { return /* reexport */ FocusableIframe; });
__webpack_require__.d(__webpack_exports__, "FontSizePicker", function() { return /* reexport */ font_size_picker; });
__webpack_require__.d(__webpack_exports__, "FormFileUpload", function() { return /* reexport */ form_file_upload; });
__webpack_require__.d(__webpack_exports__, "FormToggle", function() { return /* reexport */ form_toggle; });
__webpack_require__.d(__webpack_exports__, "FormTokenField", function() { return /* reexport */ form_token_field; });
__webpack_require__.d(__webpack_exports__, "__experimentalGradientPicker", function() { return /* reexport */ GradientPicker; });
__webpack_require__.d(__webpack_exports__, "__experimentalCustomGradientPicker", function() { return /* reexport */ CustomGradientPicker; });
__webpack_require__.d(__webpack_exports__, "__experimentalGrid", function() { return /* reexport */ grid_component; });
__webpack_require__.d(__webpack_exports__, "Guide", function() { return /* reexport */ Guide; });
__webpack_require__.d(__webpack_exports__, "GuidePage", function() { return /* reexport */ GuidePage; });
__webpack_require__.d(__webpack_exports__, "__experimentalHeading", function() { return /* reexport */ heading_component; });
__webpack_require__.d(__webpack_exports__, "__experimentalHStack", function() { return /* reexport */ h_stack_component; });
__webpack_require__.d(__webpack_exports__, "Icon", function() { return /* reexport */ components_build_module_icon["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "IconButton", function() { return /* reexport */ deprecated; });
__webpack_require__.d(__webpack_exports__, "__experimentalInputControl", function() { return /* reexport */ input_control; });
__webpack_require__.d(__webpack_exports__, "KeyboardShortcuts", function() { return /* reexport */ keyboard_shortcuts; });
__webpack_require__.d(__webpack_exports__, "MenuGroup", function() { return /* reexport */ menu_group; });
__webpack_require__.d(__webpack_exports__, "MenuItem", function() { return /* reexport */ menu_item; });
__webpack_require__.d(__webpack_exports__, "MenuItemsChoice", function() { return /* reexport */ MenuItemsChoice; });
__webpack_require__.d(__webpack_exports__, "Modal", function() { return /* reexport */ modal; });
__webpack_require__.d(__webpack_exports__, "ScrollLock", function() { return /* reexport */ scroll_lock["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "NavigableMenu", function() { return /* reexport */ navigable_container_menu; });
__webpack_require__.d(__webpack_exports__, "TabbableContainer", function() { return /* reexport */ tabbable; });
__webpack_require__.d(__webpack_exports__, "__experimentalNavigation", function() { return /* reexport */ Navigation; });
__webpack_require__.d(__webpack_exports__, "__experimentalNavigationBackButton", function() { return /* reexport */ back_button; });
__webpack_require__.d(__webpack_exports__, "__experimentalNavigationGroup", function() { return /* reexport */ NavigationGroup; });
__webpack_require__.d(__webpack_exports__, "__experimentalNavigationItem", function() { return /* reexport */ NavigationItem; });
__webpack_require__.d(__webpack_exports__, "__experimentalNavigationMenu", function() { return /* reexport */ NavigationMenu; });
__webpack_require__.d(__webpack_exports__, "Notice", function() { return /* reexport */ build_module_notice; });
__webpack_require__.d(__webpack_exports__, "__experimentalNumberControl", function() { return /* reexport */ number_control; });
__webpack_require__.d(__webpack_exports__, "NoticeList", function() { return /* reexport */ list; });
__webpack_require__.d(__webpack_exports__, "Panel", function() { return /* reexport */ panel; });
__webpack_require__.d(__webpack_exports__, "PanelBody", function() { return /* reexport */ panel_body; });
__webpack_require__.d(__webpack_exports__, "PanelHeader", function() { return /* reexport */ panel_header; });
__webpack_require__.d(__webpack_exports__, "PanelRow", function() { return /* reexport */ panel_row; });
__webpack_require__.d(__webpack_exports__, "Placeholder", function() { return /* reexport */ build_module_placeholder; });
__webpack_require__.d(__webpack_exports__, "Popover", function() { return /* reexport */ build_module_popover["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "QueryControls", function() { return /* reexport */ QueryControls; });
__webpack_require__.d(__webpack_exports__, "__experimentalRadio", function() { return /* reexport */ build_module_radio; });
__webpack_require__.d(__webpack_exports__, "__experimentalRadioGroup", function() { return /* reexport */ radio_group; });
__webpack_require__.d(__webpack_exports__, "RadioControl", function() { return /* reexport */ RadioControl; });
__webpack_require__.d(__webpack_exports__, "RangeControl", function() { return /* reexport */ range_control; });
__webpack_require__.d(__webpack_exports__, "ResizableBox", function() { return /* reexport */ resizable_box; });
__webpack_require__.d(__webpack_exports__, "ResponsiveWrapper", function() { return /* reexport */ responsive_wrapper; });
__webpack_require__.d(__webpack_exports__, "SandBox", function() { return /* reexport */ Sandbox; });
__webpack_require__.d(__webpack_exports__, "SelectControl", function() { return /* reexport */ select_control; });
__webpack_require__.d(__webpack_exports__, "Snackbar", function() { return /* reexport */ snackbar["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "SnackbarList", function() { return /* reexport */ snackbar_list; });
__webpack_require__.d(__webpack_exports__, "__experimentalSpacer", function() { return /* reexport */ spacer_component; });
__webpack_require__.d(__webpack_exports__, "Spinner", function() { return /* reexport */ Spinner; });
__webpack_require__.d(__webpack_exports__, "TabPanel", function() { return /* reexport */ TabPanel; });
__webpack_require__.d(__webpack_exports__, "__experimentalText", function() { return /* reexport */ text_component; });
__webpack_require__.d(__webpack_exports__, "TextControl", function() { return /* reexport */ text_control; });
__webpack_require__.d(__webpack_exports__, "TextareaControl", function() { return /* reexport */ TextareaControl; });
__webpack_require__.d(__webpack_exports__, "TextHighlight", function() { return /* reexport */ text_highlight; });
__webpack_require__.d(__webpack_exports__, "Tip", function() { return /* reexport */ tip; });
__webpack_require__.d(__webpack_exports__, "ToggleControl", function() { return /* reexport */ ToggleControl; });
__webpack_require__.d(__webpack_exports__, "Toolbar", function() { return /* reexport */ toolbar; });
__webpack_require__.d(__webpack_exports__, "ToolbarButton", function() { return /* reexport */ toolbar_button; });
__webpack_require__.d(__webpack_exports__, "ToolbarDropdownMenu", function() { return /* reexport */ toolbar_dropdown_menu; });
__webpack_require__.d(__webpack_exports__, "__experimentalToolbarContext", function() { return /* reexport */ toolbar_context["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "ToolbarGroup", function() { return /* reexport */ toolbar_group; });
__webpack_require__.d(__webpack_exports__, "ToolbarItem", function() { return /* reexport */ toolbar_item["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "Tooltip", function() { return /* reexport */ build_module_tooltip["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "__experimentalTreeGrid", function() { return /* reexport */ tree_grid; });
__webpack_require__.d(__webpack_exports__, "__experimentalTreeGridRow", function() { return /* reexport */ tree_grid_row; });
__webpack_require__.d(__webpack_exports__, "__experimentalTreeGridCell", function() { return /* reexport */ tree_grid_cell; });
__webpack_require__.d(__webpack_exports__, "__experimentalTreeGridItem", function() { return /* reexport */ tree_grid_item; });
__webpack_require__.d(__webpack_exports__, "TreeSelect", function() { return /* reexport */ TreeSelect; });
__webpack_require__.d(__webpack_exports__, "__experimentalTruncate", function() { return /* reexport */ truncate_component; });
__webpack_require__.d(__webpack_exports__, "__experimentalUnitControl", function() { return /* reexport */ unit_control; });
__webpack_require__.d(__webpack_exports__, "__experimentalUseCustomUnits", function() { return /* reexport */ useCustomUnits; });
__webpack_require__.d(__webpack_exports__, "VisuallyHidden", function() { return /* reexport */ visually_hidden["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "__experimentalVStack", function() { return /* reexport */ v_stack_component; });
__webpack_require__.d(__webpack_exports__, "IsolatedEventContainer", function() { return /* reexport */ isolated_event_container; });
__webpack_require__.d(__webpack_exports__, "createSlotFill", function() { return /* reexport */ slot_fill["d" /* createSlotFill */]; });
__webpack_require__.d(__webpack_exports__, "Slot", function() { return /* reexport */ slot_fill["c" /* Slot */]; });
__webpack_require__.d(__webpack_exports__, "Fill", function() { return /* reexport */ slot_fill["a" /* Fill */]; });
__webpack_require__.d(__webpack_exports__, "SlotFillProvider", function() { return /* reexport */ slot_fill["b" /* Provider */]; });
__webpack_require__.d(__webpack_exports__, "__experimentalUseSlot", function() { return /* reexport */ use_slot["a" /* default */]; });
__webpack_require__.d(__webpack_exports__, "__experimentalStyleProvider", function() { return /* reexport */ StyleProvider; });
__webpack_require__.d(__webpack_exports__, "navigateRegions", function() { return /* reexport */ navigate_regions; });
__webpack_require__.d(__webpack_exports__, "__unstableUseNavigateRegions", function() { return /* reexport */ useNavigateRegions; });
__webpack_require__.d(__webpack_exports__, "withConstrainedTabbing", function() { return /* reexport */ with_constrained_tabbing; });
__webpack_require__.d(__webpack_exports__, "withFallbackStyles", function() { return /* reexport */ with_fallback_styles; });
__webpack_require__.d(__webpack_exports__, "withFilters", function() { return /* reexport */ withFilters; });
__webpack_require__.d(__webpack_exports__, "withFocusOutside", function() { return /* reexport */ with_focus_outside; });
__webpack_require__.d(__webpack_exports__, "withFocusReturn", function() { return /* reexport */ with_focus_return; });
__webpack_require__.d(__webpack_exports__, "FocusReturnProvider", function() { return /* reexport */ with_focus_return_Provider; });
__webpack_require__.d(__webpack_exports__, "withNotices", function() { return /* reexport */ with_notices; });
__webpack_require__.d(__webpack_exports__, "withSpokenMessages", function() { return /* reexport */ with_spoken_messages; });
__webpack_require__.d(__webpack_exports__, "__unstableWithNext", function() { return /* reexport */ with_next["a" /* withNext */]; });
__webpack_require__.d(__webpack_exports__, "__unstableComponentSystemProvider", function() { return /* reexport */ ComponentSystemProvider; });
// NAMESPACE OBJECT: ./node_modules/@wordpress/components/build-module/text/styles.js
var text_styles_namespaceObject = {};
__webpack_require__.r(text_styles_namespaceObject);
__webpack_require__.d(text_styles_namespaceObject, "Text", function() { return Text; });
__webpack_require__.d(text_styles_namespaceObject, "block", function() { return styles_block; });
__webpack_require__.d(text_styles_namespaceObject, "positive", function() { return positive; });
__webpack_require__.d(text_styles_namespaceObject, "destructive", function() { return destructive; });
__webpack_require__.d(text_styles_namespaceObject, "muted", function() { return styles_muted; });
__webpack_require__.d(text_styles_namespaceObject, "highlighterText", function() { return highlighterText; });
__webpack_require__.d(text_styles_namespaceObject, "upperCase", function() { return styles_upperCase; });
// EXTERNAL MODULE: external ["wp","primitives"]
var external_wp_primitives_ = __webpack_require__("Tqx9");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
var esm_extends = __webpack_require__("wx14");
// EXTERNAL MODULE: external ["wp","element"]
var external_wp_element_ = __webpack_require__("GRId");
// EXTERNAL MODULE: external "lodash"
var external_lodash_ = __webpack_require__("YLtl");
// EXTERNAL MODULE: ./node_modules/classnames/index.js
var classnames = __webpack_require__("TSYQ");
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
// EXTERNAL MODULE: external ["wp","i18n"]
var external_wp_i18n_ = __webpack_require__("l3Sj");
// EXTERNAL MODULE: external ["wp","compose"]
var external_wp_compose_ = __webpack_require__("K9lf");
// EXTERNAL MODULE: ./node_modules/reakit/es/Composite/CompositeItem.js
var CompositeItem = __webpack_require__("kTC8");
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/tooltip/index.js + 1 modules
var build_module_tooltip = __webpack_require__("W/NR");
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/visually-hidden/index.js + 2 modules
var visually_hidden = __webpack_require__("ldlY");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/utils.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const GRID = [['top left', 'top center', 'top right'], ['center left', 'center center', 'center right'], ['bottom left', 'bottom center', 'bottom right']]; // Stored as map as i18n __() only accepts strings (not variables)
const ALIGNMENT_LABEL = {
'top left': Object(external_wp_i18n_["__"])('Top Left'),
'top center': Object(external_wp_i18n_["__"])('Top Center'),
'top right': Object(external_wp_i18n_["__"])('Top Right'),
'center left': Object(external_wp_i18n_["__"])('Center Left'),
'center center': Object(external_wp_i18n_["__"])('Center Center'),
'center right': Object(external_wp_i18n_["__"])('Center Right'),
'bottom left': Object(external_wp_i18n_["__"])('Bottom Left'),
'bottom center': Object(external_wp_i18n_["__"])('Bottom Center'),
'bottom right': Object(external_wp_i18n_["__"])('Bottom Right')
}; // Transforms GRID into a flat Array of values
const ALIGNMENTS = Object(external_lodash_["flattenDeep"])(GRID);
/**
* Parses and transforms an incoming value to better match the alignment values
*
* @param {string} value An alignment value to parse.
*
* @return {string} The parsed value.
*/
function transformValue(value) {
const nextValue = value === 'center' ? 'center center' : value;
return nextValue.replace('-', ' ');
}
/**
* Creates an item ID based on a prefix ID and an alignment value.
*
* @param {string} prefixId An ID to prefix.
* @param {string} value An alignment value.
*
* @return {string} The item id.
*/
function utils_getItemId(prefixId, value) {
const valueId = transformValue(value).replace(' ', '-');
return `${prefixId}-${valueId}`;
}
/**
* Retrieves the alignment index from a value.
*
* @param {string} alignment Value to check.
*
* @return {number} The index of a matching alignment.
*/
function getAlignmentIndex(alignment = 'center') {
const item = transformValue(alignment).replace('-', ' ');
const index = ALIGNMENTS.indexOf(item);
return index > -1 ? index : undefined;
}
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/defineProperty.js
var defineProperty = __webpack_require__("lSNA");
var defineProperty_default = /*#__PURE__*/__webpack_require__.n(defineProperty);
// EXTERNAL MODULE: external "React"
var external_React_ = __webpack_require__("cDcd");
var external_React_default = /*#__PURE__*/__webpack_require__.n(external_React_);
// EXTERNAL MODULE: ./node_modules/@emotion/is-prop-valid/dist/is-prop-valid.browser.esm.js
var is_prop_valid_browser_esm = __webpack_require__("9uj6");
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/setPrototypeOf.js
function _setPrototypeOf(o, p) {
_setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
return _setPrototypeOf(o, p);
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/inheritsLoose.js
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
_setPrototypeOf(subClass, superClass);
}
// EXTERNAL MODULE: ./node_modules/@emotion/cache/dist/cache.browser.esm.js + 2 modules
var cache_browser_esm = __webpack_require__("TqVZ");
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/inheritsLoose.js
var inheritsLoose = __webpack_require__("VbXa");
// EXTERNAL MODULE: ./node_modules/@emotion/utils/dist/utils.browser.esm.js
var utils_browser_esm = __webpack_require__("SIPS");
// EXTERNAL MODULE: ./node_modules/@emotion/serialize/dist/serialize.browser.esm.js + 2 modules
var serialize_browser_esm = __webpack_require__("MiSq");
// CONCATENATED MODULE: ./node_modules/@emotion/core/dist/emotion-element-57a3a7a3.browser.esm.js
var emotion_element_57a3a7a3_browser_esm_hasOwnProperty = Object.prototype.hasOwnProperty;
var EmotionCacheContext = /*#__PURE__*/Object(external_React_["createContext"])( // we're doing this to avoid preconstruct's dead code elimination in this one case
// because this module is primarily intended for the browser and node
// but it's also required in react native and similar environments sometimes
// and we could have a special build just for that
// but this is much easier and the native packages
// might use a different theme context in the future anyway
typeof HTMLElement !== 'undefined' ? Object(cache_browser_esm["a" /* default */])() : null);
var ThemeContext = /*#__PURE__*/Object(external_React_["createContext"])({});
var CacheProvider = EmotionCacheContext.Provider;
var emotion_element_57a3a7a3_browser_esm_withEmotionCache = function withEmotionCache(func) {
var render = function render(props, ref) {
return /*#__PURE__*/Object(external_React_["createElement"])(EmotionCacheContext.Consumer, null, function (cache) {
return func(props, cache, ref);
});
}; // $FlowFixMe
return /*#__PURE__*/Object(external_React_["forwardRef"])(render);
};
// thus we only need to replace what is a valid character for JS, but not for CSS
var sanitizeIdentifier = function sanitizeIdentifier(identifier) {
return identifier.replace(/\$/g, '-');
};
var typePropName = '__EMOTION_TYPE_PLEASE_DO_NOT_USE__';
var labelPropName = '__EMOTION_LABEL_PLEASE_DO_NOT_USE__';
var createEmotionProps = function createEmotionProps(type, props) {
if (false) {}
var newProps = {};
for (var key in props) {
if (emotion_element_57a3a7a3_browser_esm_hasOwnProperty.call(props, key)) {
newProps[key] = props[key];
}
}
newProps[typePropName] = type; // TODO: check if this still works with all of those different JSX functions
if (false) { var match, error; }
return newProps;
};
var emotion_element_57a3a7a3_browser_esm_render = function render(cache, props, theme, ref) {
var cssProp = theme === null ? props.css : props.css(theme); // so that using `css` from `emotion` and passing the result to the css prop works
// not passing the registered cache to serializeStyles because it would
// make certain babel optimisations not possible
if (typeof cssProp === 'string' && cache.registered[cssProp] !== undefined) {
cssProp = cache.registered[cssProp];
}
var type = props[typePropName];
var registeredStyles = [cssProp];
var className = '';
if (typeof props.className === 'string') {
className = Object(utils_browser_esm["a" /* getRegisteredStyles */])(cache.registered, registeredStyles, props.className);
} else if (props.className != null) {
className = props.className + " ";
}
var serialized = Object(serialize_browser_esm["a" /* serializeStyles */])(registeredStyles);
if (false) { var labelFromStack; }
var rules = Object(utils_browser_esm["b" /* insertStyles */])(cache, serialized, typeof type === 'string');
className += cache.key + "-" + serialized.name;
var newProps = {};
for (var key in props) {
if (emotion_element_57a3a7a3_browser_esm_hasOwnProperty.call(props, key) && key !== 'css' && key !== typePropName && ( true || false)) {
newProps[key] = props[key];
}
}
newProps.ref = ref;
newProps.className = className;
var ele = /*#__PURE__*/Object(external_React_["createElement"])(type, newProps);
return ele;
}; // eslint-disable-next-line no-undef
var Emotion = /* #__PURE__ */emotion_element_57a3a7a3_browser_esm_withEmotionCache(function (props, cache, ref) {
if (typeof props.css === 'function') {
return /*#__PURE__*/Object(external_React_["createElement"])(ThemeContext.Consumer, null, function (theme) {
return emotion_element_57a3a7a3_browser_esm_render(cache, props, theme, ref);
});
}
return emotion_element_57a3a7a3_browser_esm_render(cache, props, null, ref);
});
if (false) {}
// EXTERNAL MODULE: ./node_modules/@emotion/sheet/dist/sheet.browser.esm.js
var sheet_browser_esm = __webpack_require__("z9I/");
// CONCATENATED MODULE: ./node_modules/@emotion/css/dist/css.browser.esm.js
function css_browser_esm_css() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return Object(serialize_browser_esm["a" /* serializeStyles */])(args);
}
/* harmony default export */ var css_browser_esm = (css_browser_esm_css);
// CONCATENATED MODULE: ./node_modules/@emotion/core/dist/core.browser.esm.js
var core_browser_esm_jsx = function jsx(type, props) {
var args = arguments;
if (props == null || !emotion_element_57a3a7a3_browser_esm_hasOwnProperty.call(props, 'css')) {
// $FlowFixMe
return external_React_["createElement"].apply(undefined, args);
}
var argsLength = args.length;
var createElementArgArray = new Array(argsLength);
createElementArgArray[0] = Emotion;
createElementArgArray[1] = createEmotionProps(type, props);
for (var i = 2; i < argsLength; i++) {
createElementArgArray[i] = args[i];
} // $FlowFixMe
return external_React_["createElement"].apply(null, createElementArgArray);
};
var warnedAboutCssPropForGlobal = false;
var Global = /* #__PURE__ */emotion_element_57a3a7a3_browser_esm_withEmotionCache(function (props, cache) {
if (false) {}
var styles = props.styles;
if (typeof styles === 'function') {
return /*#__PURE__*/Object(external_React_["createElement"])(ThemeContext.Consumer, null, function (theme) {
var serialized = Object(serialize_browser_esm["a" /* serializeStyles */])([styles(theme)]);
return /*#__PURE__*/Object(external_React_["createElement"])(core_browser_esm_InnerGlobal, {
serialized: serialized,
cache: cache
});
});
}
var serialized = Object(serialize_browser_esm["a" /* serializeStyles */])([styles]);
return /*#__PURE__*/Object(external_React_["createElement"])(core_browser_esm_InnerGlobal, {
serialized: serialized,
cache: cache
});
});
// maintain place over rerenders.
// initial render from browser, insertBefore context.sheet.tags[0] or if a style hasn't been inserted there yet, appendChild
// initial client-side render from SSR, use place of hydrating tag
var core_browser_esm_InnerGlobal = /*#__PURE__*/function (_React$Component) {
_inheritsLoose(InnerGlobal, _React$Component);
function InnerGlobal(props, context, updater) {
return _React$Component.call(this, props, context, updater) || this;
}
var _proto = InnerGlobal.prototype;
_proto.componentDidMount = function componentDidMount() {
this.sheet = new sheet_browser_esm["a" /* StyleSheet */]({
key: this.props.cache.key + "-global",
nonce: this.props.cache.sheet.nonce,
container: this.props.cache.sheet.container
}); // $FlowFixMe
var node = document.querySelector("style[data-emotion-" + this.props.cache.key + "=\"" + this.props.serialized.name + "\"]");
if (node !== null) {
this.sheet.tags.push(node);
}
if (this.props.cache.sheet.tags.length) {
this.sheet.before = this.props.cache.sheet.tags[0];
}
this.insertStyles();
};
_proto.componentDidUpdate = function componentDidUpdate(prevProps) {
if (prevProps.serialized.name !== this.props.serialized.name) {
this.insertStyles();
}
};
_proto.insertStyles = function insertStyles$1() {
if (this.props.serialized.next !== undefined) {
// insert keyframes
Object(utils_browser_esm["b" /* insertStyles */])(this.props.cache, this.props.serialized.next, true);
}
if (this.sheet.tags.length) {
// if this doesn't exist then it will be null so the style element will be appended
var element = this.sheet.tags[this.sheet.tags.length - 1].nextElementSibling;
this.sheet.before = element;
this.sheet.flush();
}
this.props.cache.insert("", this.props.serialized, this.sheet, false);
};
_proto.componentWillUnmount = function componentWillUnmount() {
this.sheet.flush();
};
_proto.render = function render() {
return null;
};
return InnerGlobal;
}(external_React_["Component"]);
var core_browser_esm_keyframes = function keyframes() {
var insertable = css_browser_esm.apply(void 0, arguments);
var name = "animation-" + insertable.name; // $FlowFixMe
return {
name: name,
styles: "@keyframes " + name + "{" + insertable.styles + "}",
anim: 1,
toString: function toString() {
return "_EMO_" + this.name + "_" + this.styles + "_EMO_";
}
};
};
var core_browser_esm_classnames = function classnames(args) {
var len = args.length;
var i = 0;
var cls = '';
for (; i < len; i++) {
var arg = args[i];
if (arg == null) continue;
var toAdd = void 0;
switch (typeof arg) {
case 'boolean':
break;
case 'object':
{
if (Array.isArray(arg)) {
toAdd = classnames(arg);
} else {
toAdd = '';
for (var k in arg) {
if (arg[k] && k) {
toAdd && (toAdd += ' ');
toAdd += k;
}
}
}
break;
}
default:
{
toAdd = arg;
}
}
if (toAdd) {
cls && (cls += ' ');
cls += toAdd;
}
}
return cls;
};
function merge(registered, css, className) {
var registeredStyles = [];
var rawClassName = Object(utils_browser_esm["a" /* getRegisteredStyles */])(registered, registeredStyles, className);
if (registeredStyles.length < 2) {
return className;
}
return rawClassName + css(registeredStyles);
}
var ClassNames = emotion_element_57a3a7a3_browser_esm_withEmotionCache(function (props, context) {
return /*#__PURE__*/Object(external_React_["createElement"])(ThemeContext.Consumer, null, function (theme) {
var hasRendered = false;
var css = function css() {
if (hasRendered && "production" !== 'production') {
throw new Error('css can only be used during render');
}
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var serialized = Object(serialize_browser_esm["a" /* serializeStyles */])(args, context.registered);
{
Object(utils_browser_esm["b" /* insertStyles */])(context, serialized, false);
}
return context.key + "-" + serialized.name;
};
var cx = function cx() {
if (hasRendered && "production" !== 'production') {
throw new Error('cx can only be used during render');
}
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
return merge(context.registered, css, core_browser_esm_classnames(args));
};
var content = {
css: css,
cx: cx,
theme: theme
};
var ele = props.children(content);
hasRendered = true;
return ele;
});
});
// CONCATENATED MODULE: ./node_modules/@emotion/styled-base/dist/styled-base.browser.esm.js
var testOmitPropsOnStringTag = is_prop_valid_browser_esm["default"];
var testOmitPropsOnComponent = function testOmitPropsOnComponent(key) {
return key !== 'theme' && key !== 'innerRef';
};
var getDefaultShouldForwardProp = function getDefaultShouldForwardProp(tag) {
return typeof tag === 'string' && // 96 is one less than the char code
// for "a" so this is checking that
// it's a lowercase character
tag.charCodeAt(0) > 96 ? testOmitPropsOnStringTag : testOmitPropsOnComponent;
};
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(source, true).forEach(function (key) { defineProperty_default()(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(source).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
var ILLEGAL_ESCAPE_SEQUENCE_ERROR = "You have illegal escape sequence in your template literal, most likely inside content's property value.\nBecause you write your CSS inside a JavaScript string you actually have to do double escaping, so for example \"content: '\\00d7';\" should become \"content: '\\\\00d7';\".\nYou can read more about this here:\nhttps://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Template_literals#ES2018_revision_of_illegal_escape_sequences";
var styled_base_browser_esm_createStyled = function createStyled(tag, options) {
if (false) {}
var identifierName;
var shouldForwardProp;
var targetClassName;
if (options !== undefined) {
identifierName = options.label;
targetClassName = options.target;
shouldForwardProp = tag.__emotion_forwardProp && options.shouldForwardProp ? function (propName) {
return tag.__emotion_forwardProp(propName) && // $FlowFixMe
options.shouldForwardProp(propName);
} : options.shouldForwardProp;
}
var isReal = tag.__emotion_real === tag;
var baseTag = isReal && tag.__emotion_base || tag;
if (typeof shouldForwardProp !== 'function' && isReal) {
shouldForwardProp = tag.__emotion_forwardProp;
}
var defaultShouldForwardProp = shouldForwardProp || getDefaultShouldForwardProp(baseTag);
var shouldUseAs = !defaultShouldForwardProp('as');
return function () {
var args = arguments;
var styles = isReal && tag.__emotion_styles !== undefined ? tag.__emotion_styles.slice(0) : [];
if (identifierName !== undefined) {
styles.push("label:" + identifierName + ";");
}
if (args[0] == null || args[0].raw === undefined) {
styles.push.apply(styles, args);
} else {
if (false) {}
styles.push(args[0][0]);
var len = args.length;
var i = 1;
for (; i < len; i++) {
if (false) {}
styles.push(args[i], args[0][i]);
}
} // $FlowFixMe: we need to cast StatelessFunctionalComponent to our PrivateStyledComponent class
var Styled = emotion_element_57a3a7a3_browser_esm_withEmotionCache(function (props, context, ref) {
return Object(external_React_["createElement"])(ThemeContext.Consumer, null, function (theme) {
var finalTag = shouldUseAs && props.as || baseTag;
var className = '';
var classInterpolations = [];
var mergedProps = props;
if (props.theme == null) {
mergedProps = {};
for (var key in props) {
mergedProps[key] = props[key];
}
mergedProps.theme = theme;
}
if (typeof props.className === 'string') {
className = Object(utils_browser_esm["a" /* getRegisteredStyles */])(context.registered, classInterpolations, props.className);
} else if (props.className != null) {
className = props.className + " ";
}
var serialized = Object(serialize_browser_esm["a" /* serializeStyles */])(styles.concat(classInterpolations), context.registered, mergedProps);
var rules = Object(utils_browser_esm["b" /* insertStyles */])(context, serialized, typeof finalTag === 'string');
className += context.key + "-" + serialized.name;
if (targetClassName !== undefined) {
className += " " + targetClassName;
}
var finalShouldForwardProp = shouldUseAs && shouldForwardProp === undefined ? getDefaultShouldForwardProp(finalTag) : defaultShouldForwardProp;
var newProps = {};
for (var _key in props) {
if (shouldUseAs && _key === 'as') continue;
if ( // $FlowFixMe
finalShouldForwardProp(_key)) {
newProps[_key] = props[_key];
}
}
newProps.className = className;
newProps.ref = ref || props.innerRef;
if (false) {}
var ele = Object(external_React_["createElement"])(finalTag, newProps);
return ele;
});
});
Styled.displayName = identifierName !== undefined ? identifierName : "Styled(" + (typeof baseTag === 'string' ? baseTag : baseTag.displayName || baseTag.name || 'Component') + ")";
Styled.defaultProps = tag.defaultProps;
Styled.__emotion_real = Styled;
Styled.__emotion_base = baseTag;
Styled.__emotion_styles = styles;
Styled.__emotion_forwardProp = shouldForwardProp;
Object.defineProperty(Styled, 'toString', {
value: function value() {
if (targetClassName === undefined && "production" !== 'production') {
return 'NO_COMPONENT_SELECTOR';
} // $FlowFixMe: coerce undefined to string
return "." + targetClassName;
}
});
Styled.withComponent = function (nextTag, nextOptions) {
return createStyled(nextTag, nextOptions !== undefined ? _objectSpread({}, options || {}, {}, nextOptions) : options).apply(void 0, styles);
};
return Styled;
};
};
/* harmony default export */ var styled_base_browser_esm = (styled_base_browser_esm_createStyled);
// EXTERNAL MODULE: ./node_modules/tinycolor2/tinycolor.js
var tinycolor = __webpack_require__("Zss7");
var tinycolor_default = /*#__PURE__*/__webpack_require__.n(tinycolor);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/colors.js
/**
* External dependencies
*/
/**
* Generating a CSS compliant rgba() color value.
*
* @param {string} hexValue The hex value to convert to rgba().
* @param {number} alpha The alpha value for opacity.
* @return {string} The converted rgba() color value.
*
* @example
* rgba( '#000000', 0.5 )
* // rgba(0, 0, 0, 0.5)
*/
function rgba(hexValue = '', alpha = 1) {
const {
r,
g,
b
} = tinycolor_default()(hexValue).toRgb();
return `rgba(${r}, ${g}, ${b}, ${alpha})`;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/colors-values.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const BASE = {
black: '#000',
white: '#fff'
};
/**
* TODO: Continue to update values as "G2" design evolves.
*
* "G2" refers to the movement to advance the interface of the block editor.
* https://github.com/WordPress/gutenberg/issues/18667
*/
const G2 = {
blue: {
medium: {
focus: '#007cba',
focusDark: '#fff'
}
},
gray: {
900: '#1e1e1e',
700: '#757575',
// Meets 4.6:1 text contrast against white.
600: '#949494',
// Meets 3:1 UI or large text contrast against white.
400: '#ccc',
200: '#ddd',
// Used for most borders.
100: '#f0f0f0'
},
darkGray: {
primary: '#1e1e1e',
heading: '#050505'
},
mediumGray: {
text: '#757575'
},
lightGray: {
ui: '#949494',
secondary: '#ccc',
tertiary: '#e7e8e9'
}
};
const DARK_GRAY = {
900: '#191e23',
800: '#23282d',
700: '#32373c',
600: '#40464d',
500: '#555d66',
// Use this most of the time for dark items.
400: '#606a73',
300: '#6c7781',
// Lightest gray that can be used for AA text contrast.
200: '#7e8993',
150: '#8d96a0',
// Lightest gray that can be used for AA non-text contrast.
100: '#8f98a1',
placeholder: rgba(G2.gray[900], 0.62)
};
const DARK_OPACITY = {
900: rgba('#000510', 0.9),
800: rgba('#00000a', 0.85),
700: rgba('#06060b', 0.8),
600: rgba('#000913', 0.75),
500: rgba('#0a1829', 0.7),
400: rgba('#0a1829', 0.65),
300: rgba('#0e1c2e', 0.62),
200: rgba('#162435', 0.55),
100: rgba('#223443', 0.5),
backgroundFill: rgba(DARK_GRAY[700], 0.7)
};
const DARK_OPACITY_LIGHT = {
900: rgba('#304455', 0.45),
800: rgba('#425863', 0.4),
700: rgba('#667886', 0.35),
600: rgba('#7b86a2', 0.3),
500: rgba('#9197a2', 0.25),
400: rgba('#95959c', 0.2),
300: rgba('#829493', 0.15),
200: rgba('#8b8b96', 0.1),
100: rgba('#747474', 0.05)
};
const LIGHT_GRAY = {
900: '#a2aab2',
800: '#b5bcc2',
700: '#ccd0d4',
600: '#d7dade',
500: '#e2e4e7',
// Good for "grayed" items and borders.
400: '#e8eaeb',
// Good for "readonly" input fields and special text selection.
300: '#edeff0',
200: '#f3f4f5',
100: '#f8f9f9',
placeholder: rgba(BASE.white, 0.65)
};
const LIGHT_OPACITY_LIGHT = {
900: rgba(BASE.white, 0.5),
800: rgba(BASE.white, 0.45),
700: rgba(BASE.white, 0.4),
600: rgba(BASE.white, 0.35),
500: rgba(BASE.white, 0.3),
400: rgba(BASE.white, 0.25),
300: rgba(BASE.white, 0.2),
200: rgba(BASE.white, 0.15),
100: rgba(BASE.white, 0.1),
backgroundFill: rgba(LIGHT_GRAY[300], 0.8)
}; // Additional colors.
// Some are from https://make.wordpress.org/design/handbook/foundations/colors/.
const BLUE = {
wordpress: {
700: '#00669b'
},
dark: {
900: '#0071a1'
},
medium: {
900: '#006589',
800: '#00739c',
700: '#007fac',
600: '#008dbe',
500: '#00a0d2',
400: '#33b3db',
300: '#66c6e4',
200: '#bfe7f3',
100: '#e5f5fa',
highlight: '#b3e7fe',
focus: '#007cba'
}
};
const ALERT = {
yellow: '#f0b849',
red: '#d94f4f',
green: '#4ab866'
};
const ADMIN = {
theme: `var( --wp-admin-theme-color, ${BLUE.wordpress[700]})`,
themeDark10: `var( --wp-admin-theme-color-darker-10, ${BLUE.medium.focus})`
}; // Namespaced values for raw colors hex codes
const UI = {
theme: ADMIN.theme,
background: BASE.white,
backgroundDisabled: LIGHT_GRAY[200],
border: G2.gray[700],
borderFocus: ADMIN.themeDark10,
borderDisabled: G2.gray[400],
borderLight: G2.gray[200],
label: DARK_GRAY[500],
textDisabled: DARK_GRAY[150],
textDark: BASE.white,
textLight: BASE.black
};
const COLORS = { ...BASE,
darkGray: Object(external_lodash_["merge"])({}, DARK_GRAY, G2.darkGray),
darkOpacity: DARK_OPACITY,
darkOpacityLight: DARK_OPACITY_LIGHT,
mediumGray: G2.mediumGray,
gray: G2.gray,
lightGray: Object(external_lodash_["merge"])({}, LIGHT_GRAY, G2.lightGray),
lightGrayLight: LIGHT_OPACITY_LIGHT,
blue: Object(external_lodash_["merge"])({}, BLUE, G2.blue),
alert: ALERT,
admin: ADMIN,
ui: UI
};
/* harmony default export */ var colors_values = (COLORS);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/reduce-motion.js
/**
* Allows users to opt-out of animations via OS-level preferences.
*
* @param {'transition' | 'animation' | string} [prop='transition'] CSS Property name
* @return {string} Generated CSS code for the reduced style
*/
function reduceMotion(prop = 'transition') {
let style;
switch (prop) {
case 'transition':
style = 'transition-duration: 0ms;';
break;
case 'animation':
style = 'animation-duration: 1ms;';
break;
default:
style = `
animation-duration: 1ms;
transition-duration: 0ms;
`;
}
return `
@media ( prefers-reduced-motion: reduce ) {
${style};
}
`;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/styles/alignment-matrix-control-styles.js
function _EMOTION_STRINGIFIED_CSS_ERROR__() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* Internal dependencies
*/
var alignment_matrix_control_styles_ref = true ? {
name: "1xiracb",
styles: "border-radius:2px;box-sizing:border-box;display:grid;grid-template-columns:repeat( 3,1fr );outline:none;"
} : undefined;
const rootBase = () => {
return alignment_matrix_control_styles_ref;
};
const rootSize = ({
size = 92
}) => {
return /*#__PURE__*/css_browser_esm("grid-template-rows:repeat( 3,calc( ", size, "px / 3 ) );width:", size, "px;" + ( true ? "" : undefined));
};
const Root = styled_base_browser_esm("div", {
target: "e1od1u4s0",
label: "Root"
})(rootBase, ";border:1px solid transparent;cursor:pointer;grid-template-columns:auto;", rootSize, ";" + ( true ? "" : undefined));
const Row = styled_base_browser_esm("div", {
target: "e1od1u4s1",
label: "Row"
})( true ? {
name: "1177s8r",
styles: "box-sizing:border-box;display:grid;grid-template-columns:repeat( 3,1fr );"
} : undefined);
const pointActive = ({
isActive
}) => {
const boxShadow = isActive ? `0 0 0 2px ${COLORS.black}` : null;
const pointColor = isActive ? COLORS.black : COLORS.lightGray[800];
const pointColorHover = isActive ? COLORS.black : COLORS.blue.medium.focus;
return /*#__PURE__*/css_browser_esm("box-shadow:", boxShadow, ";color:", pointColor, ";*:hover > &{color:", pointColorHover, ";}" + ( true ? "" : undefined));
};
const pointBase = props => {
return /*#__PURE__*/css_browser_esm("background:currentColor;box-sizing:border-box;display:grid;margin:auto;transition:all 120ms linear;", reduceMotion('transition'), " ", pointActive(props), true ? "" : undefined);
};
const Point = styled_base_browser_esm("span", {
target: "e1od1u4s2",
label: "Point"
})("height:6px;width:6px;", pointBase, true ? "" : undefined);
const Cell = styled_base_browser_esm("span", {
target: "e1od1u4s3",
label: "Cell"
})( true ? {
name: "10ro24i",
styles: "appearance:none;border:none;box-sizing:border-box;margin:0;display:flex;position:relative;outline:none;align-items:center;justify-content:center;padding:0;"
} : undefined);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/cell.js
/**
* Internal dependencies
*/
/**
* Internal dependencies
*/
function cell_Cell({
isActive = false,
value,
...props
}) {
const tooltipText = ALIGNMENT_LABEL[value];
return Object(external_wp_element_["createElement"])(build_module_tooltip["a" /* default */], {
text: tooltipText
}, Object(external_wp_element_["createElement"])(CompositeItem["a" /* CompositeItem */], Object(esm_extends["a" /* default */])({
as: Cell,
role: "gridcell"
}, props), Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], null, value), Object(external_wp_element_["createElement"])(Point, {
isActive: isActive,
role: "presentation"
})));
}
// EXTERNAL MODULE: ./node_modules/reakit/es/_rollupPluginBabelHelpers-1f0bf8c2.js
var _rollupPluginBabelHelpers_1f0bf8c2 = __webpack_require__("BZp5");
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/useIsomorphicEffect.js
var useIsomorphicEffect = __webpack_require__("AXvK");
// CONCATENATED MODULE: ./node_modules/reakit-utils/es/useSealedState.js
/**
* React custom hook that returns the very first value passed to `initialState`,
* even if it changes between re-renders.
*/
function useSealedState(initialState) {
var _React$useState = Object(external_React_["useState"])(initialState),
sealed = _React$useState[0];
return sealed;
}
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/getDocument.js
var getDocument = __webpack_require__("ouKs");
// CONCATENATED MODULE: ./node_modules/reakit/es/reverse-30eaa122.js
function groupItems(items) {
var groups = [[]];
var _loop = function _loop() {
var item = _step.value;
var group = groups.find(function (g) {
return !g[0] || g[0].groupId === item.groupId;
});
if (group) {
group.push(item);
} else {
groups.push([item]);
}
};
for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2["c" /* b */])(items), _step; !(_step = _iterator()).done;) {
_loop();
}
return groups;
}
function flatten(grid) {
var flattened = [];
for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2["c" /* b */])(grid), _step; !(_step = _iterator()).done;) {
var row = _step.value;
flattened.push.apply(flattened, row);
}
return flattened;
}
function reverse(array) {
return array.slice().reverse();
}
// EXTERNAL MODULE: ./node_modules/reakit/es/getCurrentId-5aa9849e.js
var getCurrentId_5aa9849e = __webpack_require__("iYXd");
// CONCATENATED MODULE: ./node_modules/reakit/es/findEnabledItemById-8ddca752.js
function findEnabledItemById(items, id) {
if (!id) return undefined;
return items === null || items === void 0 ? void 0 : items.find(function (item) {
return item.id === id && !item.disabled;
});
}
// CONCATENATED MODULE: ./node_modules/reakit-utils/es/applyState.js
function isUpdater(argument) {
return typeof argument === "function";
}
/**
* Receives a `setState` argument and calls it with `currentValue` if it's a
* function. Otherwise return the argument as the new value.
*
* @example
* import { applyState } from "reakit-utils";
*
* applyState((value) => value + 1, 1); // 2
* applyState(2, 1); // 2
*/
function applyState(argument, currentValue) {
if (isUpdater(argument)) {
return argument(currentValue);
}
return argument;
}
// EXTERNAL MODULE: ./node_modules/reakit/es/Id/IdProvider.js
var IdProvider = __webpack_require__("KCH1");
// CONCATENATED MODULE: ./node_modules/reakit/es/Id/IdState.js
function unstable_useIdState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var _useSealedState = useSealedState(initialState),
initialBaseId = _useSealedState.baseId;
var generateId = Object(external_React_["useContext"])(IdProvider["a" /* unstable_IdContext */]);
var idCountRef = Object(external_React_["useRef"])(0);
var _React$useState = Object(external_React_["useState"])(function () {
return initialBaseId || generateId();
}),
baseId = _React$useState[0],
setBaseId = _React$useState[1];
return {
baseId: baseId,
setBaseId: setBaseId,
unstable_idCountRef: idCountRef
};
}
// CONCATENATED MODULE: ./node_modules/reakit/es/Composite/CompositeState.js
function isElementPreceding(element1, element2) {
return Boolean(element2.compareDocumentPosition(element1) & Node.DOCUMENT_POSITION_PRECEDING);
}
function findDOMIndex(items, item) {
return items.findIndex(function (currentItem) {
if (!currentItem.ref.current || !item.ref.current) {
return false;
}
return isElementPreceding(item.ref.current, currentItem.ref.current);
});
}
function getMaxLength(rows) {
var maxLength = 0;
for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2["c" /* b */])(rows), _step; !(_step = _iterator()).done;) {
var length = _step.value.length;
if (length > maxLength) {
maxLength = length;
}
}
return maxLength;
}
/**
* Turns [row1, row1, row2, row2] into [row1, row2, row1, row2]
*/
function verticalizeItems(items) {
var groups = groupItems(items);
var maxLength = getMaxLength(groups);
var verticalized = [];
for (var i = 0; i < maxLength; i += 1) {
for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2["c" /* b */])(groups), _step; !(_step = _iterator()).done;) {
var group = _step.value;
if (group[i]) {
verticalized.push(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, group[i]), {}, {
// If there's no groupId, it means that it's not a grid composite,
// but a single row instead. So, instead of verticalizing it, that
// is, assigning a different groupId based on the column index, we
// keep it undefined so they will be part of the same group.
// It's useful when using up/down on one-dimensional composites.
groupId: group[i].groupId ? "" + i : undefined
}));
}
}
}
return verticalized;
}
function createEmptyItem(groupId) {
return {
id: "__EMPTY_ITEM__",
disabled: true,
ref: {
current: null
},
groupId: groupId
};
}
/**
* Turns [[row1, row1], [row2]] into [[row1, row1], [row2, row2]]
*/
function fillGroups(groups, currentId, shift) {
var maxLength = getMaxLength(groups);
for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2["c" /* b */])(groups), _step; !(_step = _iterator()).done;) {
var group = _step.value;
for (var i = 0; i < maxLength; i += 1) {
var item = group[i];
if (!item || shift && item.disabled) {
var isFrist = i === 0;
var previousItem = isFrist && shift ? Object(getCurrentId_5aa9849e["a" /* f */])(group) : group[i - 1];
group[i] = previousItem && currentId !== (previousItem === null || previousItem === void 0 ? void 0 : previousItem.id) && shift ? previousItem : createEmptyItem(previousItem === null || previousItem === void 0 ? void 0 : previousItem.groupId);
}
}
}
return groups;
}
var nullItem = {
id: null,
ref: {
current: null
}
};
function placeItemsAfter(items, id, shouldInsertNullItem) {
var index = items.findIndex(function (item) {
return item.id === id;
});
return [].concat(items.slice(index + 1), shouldInsertNullItem ? [nullItem] : [], items.slice(0, index));
}
function getItemsInGroup(items, groupId) {
return items.filter(function (item) {
return item.groupId === groupId;
});
}
var map = {
horizontal: "vertical",
vertical: "horizontal"
};
function getOppositeOrientation(orientation) {
return orientation && map[orientation];
}
function addItemAtIndex(array, item, index) {
if (!(index in array)) {
return [].concat(array, [item]);
}
return [].concat(array.slice(0, index), [item], array.slice(index));
}
function sortBasedOnDOMPosition(items) {
var pairs = items.map(function (item, index) {
return [index, item];
});
var isOrderDifferent = false;
pairs.sort(function (_ref, _ref2) {
var indexA = _ref[0],
a = _ref[1];
var indexB = _ref2[0],
b = _ref2[1];
var elementA = a.ref.current;
var elementB = b.ref.current;
if (!elementA || !elementB) return 0; // a before b
if (isElementPreceding(elementA, elementB)) {
if (indexA > indexB) {
isOrderDifferent = true;
}
return -1;
} // a after b
if (indexA < indexB) {
isOrderDifferent = true;
}
return 1;
});
if (isOrderDifferent) {
return pairs.map(function (_ref3) {
var _ = _ref3[0],
item = _ref3[1];
return item;
});
}
return items;
}
function setItemsBasedOnDOMPosition(items, setItems) {
var sortedItems = sortBasedOnDOMPosition(items);
if (items !== sortedItems) {
setItems(sortedItems);
}
}
function getCommonParent(items) {
var _firstItem$ref$curren;
var firstItem = items[0],
nextItems = items.slice(1);
var parentElement = firstItem === null || firstItem === void 0 ? void 0 : (_firstItem$ref$curren = firstItem.ref.current) === null || _firstItem$ref$curren === void 0 ? void 0 : _firstItem$ref$curren.parentElement;
var _loop = function _loop() {
var parent = parentElement;
if (nextItems.every(function (item) {
return parent.contains(item.ref.current);
})) {
return {
v: parentElement
};
}
parentElement = parentElement.parentElement;
};
while (parentElement) {
var _ret = _loop();
if (typeof _ret === "object") return _ret.v;
}
return Object(getDocument["a" /* getDocument */])(parentElement).body;
} // istanbul ignore next: JSDOM doesn't support IntersectionObverser
// See https://github.com/jsdom/jsdom/issues/2032
function useIntersectionObserver(items, setItems) {
var previousItems = Object(external_React_["useRef"])([]);
Object(external_React_["useEffect"])(function () {
var callback = function callback() {
var hasPreviousItems = !!previousItems.current.length; // We don't want to sort items if items have been just registered.
if (hasPreviousItems) {
setItemsBasedOnDOMPosition(items, setItems);
}
previousItems.current = items;
};
var root = getCommonParent(items);
var observer = new IntersectionObserver(callback, {
root: root
});
for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2["c" /* b */])(items), _step; !(_step = _iterator()).done;) {
var item = _step.value;
if (item.ref.current) {
observer.observe(item.ref.current);
}
}
return function () {
observer.disconnect();
};
}, [items]);
}
function useTimeoutObserver(items, setItems) {
Object(external_React_["useEffect"])(function () {
var callback = function callback() {
return setItemsBasedOnDOMPosition(items, setItems);
};
var timeout = setTimeout(callback, 250);
return function () {
return clearTimeout(timeout);
};
});
}
function useSortBasedOnDOMPosition(items, setItems) {
if (typeof IntersectionObserver === "function") {
useIntersectionObserver(items, setItems);
} else {
useTimeoutObserver(items, setItems);
}
}
function CompositeState_reducer(state, action) {
var virtual = state.unstable_virtual,
rtl = state.rtl,
orientation = state.orientation,
items = state.items,
groups = state.groups,
currentId = state.currentId,
loop = state.loop,
wrap = state.wrap,
pastIds = state.pastIds,
shift = state.shift,
moves = state.unstable_moves,
includesBaseElement = state.unstable_includesBaseElement,
initialVirtual = state.initialVirtual,
initialRTL = state.initialRTL,
initialOrientation = state.initialOrientation,
initialCurrentId = state.initialCurrentId,
initialLoop = state.initialLoop,
initialWrap = state.initialWrap,
initialShift = state.initialShift,
hasSetCurrentId = state.hasSetCurrentId;
switch (action.type) {
case "registerGroup":
{
var _group = action.group; // If there are no groups yet, just add it as the first one
if (groups.length === 0) {
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
groups: [_group]
});
} // Finds the group index based on DOM position
var index = findDOMIndex(groups, _group);
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
groups: addItemAtIndex(groups, _group, index)
});
}
case "unregisterGroup":
{
var _id = action.id;
var nextGroups = groups.filter(function (group) {
return group.id !== _id;
}); // The group isn't registered, so do nothing
if (nextGroups.length === groups.length) {
return state;
}
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
groups: nextGroups
});
}
case "registerItem":
{
var _item = action.item; // Finds the item group based on the DOM hierarchy
var _group2 = groups.find(function (r) {
var _r$ref$current;
return (_r$ref$current = r.ref.current) === null || _r$ref$current === void 0 ? void 0 : _r$ref$current.contains(_item.ref.current);
}); // Group will be null if it's a one-dimensional composite
var nextItem = Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({
groupId: _group2 === null || _group2 === void 0 ? void 0 : _group2.id
}, _item);
var _index = findDOMIndex(items, nextItem);
var nextState = Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
items: addItemAtIndex(items, nextItem, _index)
});
if (!hasSetCurrentId && !moves && initialCurrentId === undefined) {
var _findFirstEnabledItem;
// Sets currentId to the first enabled item. This runs whenever an item
// is registered because the first enabled item may be registered
// asynchronously.
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, nextState), {}, {
currentId: (_findFirstEnabledItem = Object(getCurrentId_5aa9849e["a" /* f */])(nextState.items)) === null || _findFirstEnabledItem === void 0 ? void 0 : _findFirstEnabledItem.id
});
}
return nextState;
}
case "unregisterItem":
{
var _id2 = action.id;
var nextItems = items.filter(function (item) {
return item.id !== _id2;
}); // The item isn't registered, so do nothing
if (nextItems.length === items.length) {
return state;
} // Filters out the item that is being removed from the pastIds list
var nextPastIds = pastIds.filter(function (pastId) {
return pastId !== _id2;
});
var _nextState = Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
pastIds: nextPastIds,
items: nextItems
}); // If the current item is the item that is being removed, focus pastId
if (currentId && currentId === _id2) {
var nextId = includesBaseElement ? null : Object(getCurrentId_5aa9849e["b" /* g */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, _nextState), {}, {
currentId: nextPastIds[0]
}));
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, _nextState), {}, {
currentId: nextId
});
}
return _nextState;
}
case "move":
{
var _id3 = action.id; // move() does nothing
if (_id3 === undefined) {
return state;
} // Removes the current item and the item that is receiving focus from the
// pastIds list
var filteredPastIds = pastIds.filter(function (pastId) {
return pastId !== currentId && pastId !== _id3;
}); // If there's a currentId, add it to the pastIds list so it can be focused
// if the new item gets removed or disabled
var _nextPastIds = currentId ? [currentId].concat(filteredPastIds) : filteredPastIds;
var _nextState2 = Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
pastIds: _nextPastIds
}); // move(null) will focus the composite element itself, not an item
if (_id3 === null) {
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, _nextState2), {}, {
unstable_moves: moves + 1,
currentId: Object(getCurrentId_5aa9849e["b" /* g */])(_nextState2, _id3)
});
}
var _item2 = findEnabledItemById(items, _id3);
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, _nextState2), {}, {
unstable_moves: _item2 ? moves + 1 : moves,
currentId: Object(getCurrentId_5aa9849e["b" /* g */])(_nextState2, _item2 === null || _item2 === void 0 ? void 0 : _item2.id)
});
}
case "next":
{
// If there's no item focused, we just move the first one
if (currentId == null) {
return CompositeState_reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "first"
}));
} // RTL doesn't make sense on vertical navigation
var isHorizontal = orientation !== "vertical";
var isRTL = rtl && isHorizontal;
var allItems = isRTL ? reverse(items) : items;
var currentItem = allItems.find(function (item) {
return item.id === currentId;
}); // If there's no item focused, we just move the first one
if (!currentItem) {
return CompositeState_reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "first"
}));
}
var isGrid = !!currentItem.groupId;
var currentIndex = allItems.indexOf(currentItem);
var _nextItems = allItems.slice(currentIndex + 1);
var nextItemsInGroup = getItemsInGroup(_nextItems, currentItem.groupId); // Home, End
if (action.allTheWay) {
// We reverse so we can get the last enabled item in the group. If it's
// RTL, nextItems and nextItemsInGroup are already reversed and don't
// have the items before the current one anymore. So we have to get
// items in group again with allItems.
var _nextItem2 = Object(getCurrentId_5aa9849e["a" /* f */])(isRTL ? getItemsInGroup(allItems, currentItem.groupId) : reverse(nextItemsInGroup));
return CompositeState_reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "move",
id: _nextItem2 === null || _nextItem2 === void 0 ? void 0 : _nextItem2.id
}));
}
var oppositeOrientation = getOppositeOrientation( // If it's a grid and orientation is not set, it's a next/previous
// call, which is inherently horizontal. up/down will call next with
// orientation set to vertical by default (see below on up/down cases).
isGrid ? orientation || "horizontal" : orientation);
var canLoop = loop && loop !== oppositeOrientation;
var canWrap = isGrid && wrap && wrap !== oppositeOrientation;
var hasNullItem = // `previous` and `up` will set action.hasNullItem, but when calling
// next directly, hasNullItem will only be true if it's not a grid and
// loop is set to true, which means that pressing right or down keys on
// grids will never focus the composite element. On one-dimensional
// composites that don't loop, pressing right or down keys also doesn't
// focus the composite element.
action.hasNullItem || !isGrid && canLoop && includesBaseElement;
if (canLoop) {
var loopItems = canWrap && !hasNullItem ? allItems : getItemsInGroup(allItems, currentItem.groupId); // Turns [0, 1, current, 3, 4] into [3, 4, 0, 1]
var sortedItems = placeItemsAfter(loopItems, currentId, hasNullItem);
var _nextItem3 = Object(getCurrentId_5aa9849e["a" /* f */])(sortedItems, currentId);
return CompositeState_reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "move",
id: _nextItem3 === null || _nextItem3 === void 0 ? void 0 : _nextItem3.id
}));
}
if (canWrap) {
var _nextItem4 = Object(getCurrentId_5aa9849e["a" /* f */])( // We can use nextItems, which contains all the next items, including
// items from other groups, to wrap between groups. However, if there
// is a null item (the composite element), we'll only use the next
// items in the group. So moving next from the last item will focus
// the composite element (null). On grid composites, horizontal
// navigation never focuses the composite element, only vertical.
hasNullItem ? nextItemsInGroup : _nextItems, currentId);
var _nextId = hasNullItem ? (_nextItem4 === null || _nextItem4 === void 0 ? void 0 : _nextItem4.id) || null : _nextItem4 === null || _nextItem4 === void 0 ? void 0 : _nextItem4.id;
return CompositeState_reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "move",
id: _nextId
}));
}
var _nextItem = Object(getCurrentId_5aa9849e["a" /* f */])(nextItemsInGroup, currentId);
if (!_nextItem && hasNullItem) {
return CompositeState_reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "move",
id: null
}));
}
return CompositeState_reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "move",
id: _nextItem === null || _nextItem === void 0 ? void 0 : _nextItem.id
}));
}
case "previous":
{
// If currentId is initially set to null, the composite element will be
// focusable while navigating with arrow keys. But, if it's a grid, we
// don't want to focus the composite element with horizontal navigation.
var _isGrid = !!groups.length;
var _hasNullItem = !_isGrid && includesBaseElement;
var _nextState3 = CompositeState_reducer(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
items: reverse(items)
}), Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "next",
hasNullItem: _hasNullItem
}));
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, _nextState3), {}, {
items: items
});
}
case "down":
{
var shouldShift = shift && !action.allTheWay; // First, we make sure groups have the same number of items by filling it
// with disabled fake items. Then, we reorganize the items list so
// [1-1, 1-2, 2-1, 2-2] becomes [1-1, 2-1, 1-2, 2-2].
var verticalItems = verticalizeItems(flatten(fillGroups(groupItems(items), currentId, shouldShift)));
var _canLoop = loop && loop !== "horizontal"; // Pressing down arrow key will only focus the composite element if loop
// is true or vertical.
var _hasNullItem2 = _canLoop && includesBaseElement;
var _nextState4 = CompositeState_reducer(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
orientation: "vertical",
items: verticalItems
}), Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "next",
hasNullItem: _hasNullItem2
}));
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, _nextState4), {}, {
orientation: orientation,
items: items
});
}
case "up":
{
var _shouldShift = shift && !action.allTheWay;
var _verticalItems = verticalizeItems(reverse(flatten(fillGroups(groupItems(items), currentId, _shouldShift)))); // If currentId is initially set to null, we'll always focus the
// composite element when the up arrow key is pressed in the first row.
var _hasNullItem3 = includesBaseElement;
var _nextState5 = CompositeState_reducer(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
orientation: "vertical",
items: _verticalItems
}), Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "next",
hasNullItem: _hasNullItem3
}));
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, _nextState5), {}, {
orientation: orientation,
items: items
});
}
case "first":
{
var firstItem = Object(getCurrentId_5aa9849e["a" /* f */])(items);
return CompositeState_reducer(state, Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "move",
id: firstItem === null || firstItem === void 0 ? void 0 : firstItem.id
}));
}
case "last":
{
var _nextState6 = CompositeState_reducer(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
items: reverse(items)
}), Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, action), {}, {
type: "first"
}));
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, _nextState6), {}, {
items: items
});
}
case "sort":
{
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
items: sortBasedOnDOMPosition(items),
groups: sortBasedOnDOMPosition(groups)
});
}
case "setVirtual":
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
unstable_virtual: applyState(action.virtual, virtual)
});
case "setRTL":
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
rtl: applyState(action.rtl, rtl)
});
case "setOrientation":
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
orientation: applyState(action.orientation, orientation)
});
case "setCurrentId":
{
var nextCurrentId = Object(getCurrentId_5aa9849e["b" /* g */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
currentId: applyState(action.currentId, currentId)
}));
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
currentId: nextCurrentId,
hasSetCurrentId: true
});
}
case "setLoop":
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
loop: applyState(action.loop, loop)
});
case "setWrap":
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
wrap: applyState(action.wrap, wrap)
});
case "setShift":
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
shift: applyState(action.shift, shift)
});
case "setIncludesBaseElement":
{
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
unstable_includesBaseElement: applyState(action.includesBaseElement, includesBaseElement)
});
}
case "reset":
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
unstable_virtual: initialVirtual,
rtl: initialRTL,
orientation: initialOrientation,
currentId: Object(getCurrentId_5aa9849e["b" /* g */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
currentId: initialCurrentId
})),
loop: initialLoop,
wrap: initialWrap,
shift: initialShift,
unstable_moves: 0,
pastIds: []
});
case "setItems":
{
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), {}, {
items: action.items
});
}
default:
throw new Error();
}
}
function useAction(fn) {
return Object(external_React_["useCallback"])(fn, []);
}
function useIsUnmountedRef() {
var isUnmountedRef = Object(external_React_["useRef"])(false);
Object(useIsomorphicEffect["a" /* useIsomorphicEffect */])(function () {
return function () {
isUnmountedRef.current = true;
};
}, []);
return isUnmountedRef;
}
function useCompositeState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var _useSealedState = useSealedState(initialState),
_useSealedState$unsta = _useSealedState.unstable_virtual,
virtual = _useSealedState$unsta === void 0 ? false : _useSealedState$unsta,
_useSealedState$rtl = _useSealedState.rtl,
rtl = _useSealedState$rtl === void 0 ? false : _useSealedState$rtl,
orientation = _useSealedState.orientation,
currentId = _useSealedState.currentId,
_useSealedState$loop = _useSealedState.loop,
loop = _useSealedState$loop === void 0 ? false : _useSealedState$loop,
_useSealedState$wrap = _useSealedState.wrap,
wrap = _useSealedState$wrap === void 0 ? false : _useSealedState$wrap,
_useSealedState$shift = _useSealedState.shift,
shift = _useSealedState$shift === void 0 ? false : _useSealedState$shift,
unstable_includesBaseElement = _useSealedState.unstable_includesBaseElement,
sealed = Object(_rollupPluginBabelHelpers_1f0bf8c2["a" /* _ */])(_useSealedState, ["unstable_virtual", "rtl", "orientation", "currentId", "loop", "wrap", "shift", "unstable_includesBaseElement"]);
var idState = unstable_useIdState(sealed);
var _React$useReducer = Object(external_React_["useReducer"])(CompositeState_reducer, {
unstable_virtual: virtual,
rtl: rtl,
orientation: orientation,
items: [],
groups: [],
currentId: currentId,
loop: loop,
wrap: wrap,
shift: shift,
unstable_moves: 0,
pastIds: [],
unstable_includesBaseElement: unstable_includesBaseElement != null ? unstable_includesBaseElement : currentId === null,
initialVirtual: virtual,
initialRTL: rtl,
initialOrientation: orientation,
initialCurrentId: currentId,
initialLoop: loop,
initialWrap: wrap,
initialShift: shift
}),
_React$useReducer$ = _React$useReducer[0],
pastIds = _React$useReducer$.pastIds,
initialVirtual = _React$useReducer$.initialVirtual,
initialRTL = _React$useReducer$.initialRTL,
initialOrientation = _React$useReducer$.initialOrientation,
initialCurrentId = _React$useReducer$.initialCurrentId,
initialLoop = _React$useReducer$.initialLoop,
initialWrap = _React$useReducer$.initialWrap,
initialShift = _React$useReducer$.initialShift,
hasSetCurrentId = _React$useReducer$.hasSetCurrentId,
state = Object(_rollupPluginBabelHelpers_1f0bf8c2["a" /* _ */])(_React$useReducer$, ["pastIds", "initialVirtual", "initialRTL", "initialOrientation", "initialCurrentId", "initialLoop", "initialWrap", "initialShift", "hasSetCurrentId"]),
dispatch = _React$useReducer[1];
var _React$useState = Object(external_React_["useState"])(false),
hasActiveWidget = _React$useState[0],
setHasActiveWidget = _React$useState[1]; // register/unregister may be called when this component is unmounted. We
// store the unmounted state here so we don't update the state if it's true.
// This only happens in a very specific situation.
// See https://github.com/reakit/reakit/issues/650
var isUnmountedRef = useIsUnmountedRef();
var setItems = Object(external_React_["useCallback"])(function (items) {
return dispatch({
type: "setItems",
items: items
});
}, []);
useSortBasedOnDOMPosition(state.items, setItems);
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, idState), state), {}, {
unstable_hasActiveWidget: hasActiveWidget,
unstable_setHasActiveWidget: setHasActiveWidget,
registerItem: useAction(function (item) {
if (isUnmountedRef.current) return;
dispatch({
type: "registerItem",
item: item
});
}),
unregisterItem: useAction(function (id) {
if (isUnmountedRef.current) return;
dispatch({
type: "unregisterItem",
id: id
});
}),
registerGroup: useAction(function (group) {
if (isUnmountedRef.current) return;
dispatch({
type: "registerGroup",
group: group
});
}),
unregisterGroup: useAction(function (id) {
if (isUnmountedRef.current) return;
dispatch({
type: "unregisterGroup",
id: id
});
}),
move: useAction(function (id) {
return dispatch({
type: "move",
id: id
});
}),
next: useAction(function (allTheWay) {
return dispatch({
type: "next",
allTheWay: allTheWay
});
}),
previous: useAction(function (allTheWay) {
return dispatch({
type: "previous",
allTheWay: allTheWay
});
}),
up: useAction(function (allTheWay) {
return dispatch({
type: "up",
allTheWay: allTheWay
});
}),
down: useAction(function (allTheWay) {
return dispatch({
type: "down",
allTheWay: allTheWay
});
}),
first: useAction(function () {
return dispatch({
type: "first"
});
}),
last: useAction(function () {
return dispatch({
type: "last"
});
}),
sort: useAction(function () {
return dispatch({
type: "sort"
});
}),
unstable_setVirtual: useAction(function (value) {
return dispatch({
type: "setVirtual",
virtual: value
});
}),
setRTL: useAction(function (value) {
return dispatch({
type: "setRTL",
rtl: value
});
}),
setOrientation: useAction(function (value) {
return dispatch({
type: "setOrientation",
orientation: value
});
}),
setCurrentId: useAction(function (value) {
return dispatch({
type: "setCurrentId",
currentId: value
});
}),
setLoop: useAction(function (value) {
return dispatch({
type: "setLoop",
loop: value
});
}),
setWrap: useAction(function (value) {
return dispatch({
type: "setWrap",
wrap: value
});
}),
setShift: useAction(function (value) {
return dispatch({
type: "setShift",
shift: value
});
}),
unstable_setIncludesBaseElement: useAction(function (value) {
return dispatch({
type: "setIncludesBaseElement",
includesBaseElement: value
});
}),
reset: useAction(function () {
return dispatch({
type: "reset"
});
})
});
}
// EXTERNAL MODULE: ./node_modules/reakit-system/es/createComponent.js + 3 modules
var createComponent = __webpack_require__("hE48");
// EXTERNAL MODULE: ./node_modules/reakit-system/es/createHook.js + 4 modules
var createHook = __webpack_require__("qdes");
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/useForkRef.js
var useForkRef = __webpack_require__("aU41");
// EXTERNAL MODULE: ./node_modules/reakit-warning/es/index.js + 1 modules
var es = __webpack_require__("KA1K");
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/useLiveRef.js
var useLiveRef = __webpack_require__("eNtd");
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/isSelfTarget.js
var isSelfTarget = __webpack_require__("k2cL");
// EXTERNAL MODULE: ./node_modules/reakit/es/Role/Role.js
var Role = __webpack_require__("zGFp");
// EXTERNAL MODULE: ./node_modules/reakit/es/Tabbable/Tabbable.js
var Tabbable = __webpack_require__("G3V0");
// EXTERNAL MODULE: ./node_modules/reakit-system/es/useCreateElement.js
var useCreateElement = __webpack_require__("IVEb");
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/_rollupPluginBabelHelpers-1f0bf8c2.js
var es_rollupPluginBabelHelpers_1f0bf8c2 = __webpack_require__("I/A+");
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/createEvent.js
var createEvent = __webpack_require__("khzz");
// CONCATENATED MODULE: ./node_modules/reakit-utils/es/fireBlurEvent.js
function createFocusEvent(element, type, eventInit) {
if (eventInit === void 0) {
eventInit = {};
}
if (typeof FocusEvent === "function") {
return new FocusEvent(type, eventInit);
}
return Object(createEvent["a" /* createEvent */])(element, type, eventInit);
}
/**
* Creates and dispatches a blur event in a way that also works on IE 11.
*
* @example
* import { fireBlurEvent } from "reakit-utils";
*
* fireBlurEvent(document.getElementById("id"));
*/
function fireBlurEvent(element, eventInit) {
var event = createFocusEvent(element, "blur", eventInit);
var defaultAllowed = element.dispatchEvent(event);
var bubbleInit = Object(es_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(es_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, eventInit), {}, {
bubbles: true
});
element.dispatchEvent(createFocusEvent(element, "focusout", bubbleInit));
return defaultAllowed;
}
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/getWindow.js
var getWindow = __webpack_require__("SyVe");
// CONCATENATED MODULE: ./node_modules/reakit-utils/es/fireKeyboardEvent.js
function createKeyboardEvent(element, type, eventInit) {
if (eventInit === void 0) {
eventInit = {};
}
if (typeof KeyboardEvent === "function") {
return new KeyboardEvent(type, eventInit);
} // IE 11 doesn't support Event constructors
var event = Object(getDocument["a" /* getDocument */])(element).createEvent("KeyboardEvent");
event.initKeyboardEvent(type, eventInit.bubbles, eventInit.cancelable, Object(getWindow["a" /* getWindow */])(element), eventInit.key, eventInit.location, eventInit.ctrlKey, eventInit.altKey, eventInit.shiftKey, eventInit.metaKey);
return event;
}
/**
* Creates and dispatches `KeyboardEvent` in a way that also works on IE 11.
*
* @example
* import { fireKeyboardEvent } from "reakit-utils";
*
* fireKeyboardEvent(document.getElementById("id"), "keydown", {
* key: "ArrowDown",
* shiftKey: true,
* });
*/
function fireKeyboardEvent(element, type, eventInit) {
return element.dispatchEvent(createKeyboardEvent(element, type, eventInit));
}
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/canUseDOM.js
var canUseDOM = __webpack_require__("+ipW");
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/getActiveElement.js
var getActiveElement = __webpack_require__("Nym8");
// CONCATENATED MODULE: ./node_modules/reakit-utils/es/getNextActiveElementOnBlur.js
var isIE11 = canUseDOM["a" /* canUseDOM */] && "msCrypto" in window;
/**
* Cross-browser method that returns the next active element (the element that
* is receiving focus) after a blur event is dispatched. It receives the blur
* event object as the argument.
*
* @example
* import { getNextActiveElementOnBlur } from "reakit-utils";
*
* const element = document.getElementById("id");
* element.addEventListener("blur", (event) => {
* const nextActiveElement = getNextActiveElementOnBlur(event);
* });
*/
function getNextActiveElementOnBlur(event) {
// IE 11 doesn't support event.relatedTarget on blur.
// document.activeElement points the the next active element.
// On modern browsers, document.activeElement points to the current target.
if (isIE11) {
var activeElement = Object(getActiveElement["a" /* getActiveElement */])(event.currentTarget);
return activeElement;
}
return event.relatedTarget;
}
// EXTERNAL MODULE: ./node_modules/reakit/es/__keys-6742f591.js
var _keys_6742f591 = __webpack_require__("TFuP");
// EXTERNAL MODULE: ./node_modules/reakit/es/userFocus-e16425e3.js
var userFocus_e16425e3 = __webpack_require__("Mih7");
// CONCATENATED MODULE: ./node_modules/reakit/es/Composite/Composite.js
var Composite_isIE11 = canUseDOM["a" /* canUseDOM */] && "msCrypto" in window;
function canProxyKeyboardEvent(event) {
if (!Object(isSelfTarget["a" /* isSelfTarget */])(event)) return false;
if (event.metaKey) return false;
if (event.key === "Tab") return false;
return true;
}
function useKeyboardEventProxy(virtual, currentItem, htmlEventHandler) {
var eventHandlerRef = Object(useLiveRef["a" /* useLiveRef */])(htmlEventHandler);
return Object(external_React_["useCallback"])(function (event) {
var _eventHandlerRef$curr;
(_eventHandlerRef$curr = eventHandlerRef.current) === null || _eventHandlerRef$curr === void 0 ? void 0 : _eventHandlerRef$curr.call(eventHandlerRef, event);
if (event.defaultPrevented) return;
if (virtual && canProxyKeyboardEvent(event)) {
var currentElement = currentItem === null || currentItem === void 0 ? void 0 : currentItem.ref.current;
if (currentElement) {
if (!fireKeyboardEvent(currentElement, event.type, event)) {
event.preventDefault();
} // The event will be triggered on the composite item and then
// propagated up to this composite element again, so we can pretend
// that it wasn't called on this component in the first place.
if (event.currentTarget.contains(currentElement)) {
event.stopPropagation();
}
}
}
}, [virtual, currentItem]);
} // istanbul ignore next
function useActiveElementRef(elementRef) {
var activeElementRef = Object(external_React_["useRef"])(null);
Object(external_React_["useEffect"])(function () {
var document = Object(getDocument["a" /* getDocument */])(elementRef.current);
var onFocus = function onFocus(event) {
var target = event.target;
activeElementRef.current = target;
};
document.addEventListener("focus", onFocus, true);
return function () {
document.removeEventListener("focus", onFocus, true);
};
}, []);
return activeElementRef;
}
function findFirstEnabledItemInTheLastRow(items) {
return Object(getCurrentId_5aa9849e["a" /* f */])(flatten(reverse(groupItems(items))));
}
function isItem(items, element) {
return items === null || items === void 0 ? void 0 : items.some(function (item) {
return !!element && item.ref.current === element;
});
}
function useScheduleUserFocus(currentItem) {
var currentItemRef = Object(useLiveRef["a" /* useLiveRef */])(currentItem);
var _React$useReducer = Object(external_React_["useReducer"])(function (n) {
return n + 1;
}, 0),
scheduled = _React$useReducer[0],
schedule = _React$useReducer[1];
Object(external_React_["useEffect"])(function () {
var _currentItemRef$curre;
var currentElement = (_currentItemRef$curre = currentItemRef.current) === null || _currentItemRef$curre === void 0 ? void 0 : _currentItemRef$curre.ref.current;
if (scheduled && currentElement) {
Object(userFocus_e16425e3["c" /* u */])(currentElement);
}
}, [scheduled]);
return schedule;
}
var useComposite = Object(createHook["a" /* createHook */])({
name: "Composite",
compose: [Tabbable["a" /* useTabbable */]],
keys: _keys_6742f591["a" /* C */],
useOptions: function useOptions(options) {
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, options), {}, {
currentId: Object(getCurrentId_5aa9849e["b" /* g */])(options)
});
},
useProps: function useProps(options, _ref) {
var htmlRef = _ref.ref,
htmlOnFocusCapture = _ref.onFocusCapture,
htmlOnFocus = _ref.onFocus,
htmlOnBlurCapture = _ref.onBlurCapture,
htmlOnKeyDown = _ref.onKeyDown,
htmlOnKeyDownCapture = _ref.onKeyDownCapture,
htmlOnKeyUpCapture = _ref.onKeyUpCapture,
htmlProps = Object(_rollupPluginBabelHelpers_1f0bf8c2["a" /* _ */])(_ref, ["ref", "onFocusCapture", "onFocus", "onBlurCapture", "onKeyDown", "onKeyDownCapture", "onKeyUpCapture"]);
var ref = Object(external_React_["useRef"])(null);
var currentItem = findEnabledItemById(options.items, options.currentId);
var previousElementRef = Object(external_React_["useRef"])(null);
var onFocusCaptureRef = Object(useLiveRef["a" /* useLiveRef */])(htmlOnFocusCapture);
var onFocusRef = Object(useLiveRef["a" /* useLiveRef */])(htmlOnFocus);
var onBlurCaptureRef = Object(useLiveRef["a" /* useLiveRef */])(htmlOnBlurCapture);
var onKeyDownRef = Object(useLiveRef["a" /* useLiveRef */])(htmlOnKeyDown);
var scheduleUserFocus = useScheduleUserFocus(currentItem); // IE 11 doesn't support event.relatedTarget, so we use the active element
// ref instead.
var activeElementRef = Composite_isIE11 ? useActiveElementRef(ref) : undefined;
Object(external_React_["useEffect"])(function () {
var element = ref.current;
if (options.unstable_moves && !currentItem) {
false ? undefined : void 0; // If composite.move(null) has been called, the composite container
// will receive focus.
element === null || element === void 0 ? void 0 : element.focus();
}
}, [options.unstable_moves, currentItem]);
var onKeyDownCapture = useKeyboardEventProxy(options.unstable_virtual, currentItem, htmlOnKeyDownCapture);
var onKeyUpCapture = useKeyboardEventProxy(options.unstable_virtual, currentItem, htmlOnKeyUpCapture);
var onFocusCapture = Object(external_React_["useCallback"])(function (event) {
var _onFocusCaptureRef$cu;
(_onFocusCaptureRef$cu = onFocusCaptureRef.current) === null || _onFocusCaptureRef$cu === void 0 ? void 0 : _onFocusCaptureRef$cu.call(onFocusCaptureRef, event);
if (event.defaultPrevented) return;
if (!options.unstable_virtual) return; // IE11 doesn't support event.relatedTarget, so we use the active
// element ref instead.
var previousActiveElement = (activeElementRef === null || activeElementRef === void 0 ? void 0 : activeElementRef.current) || event.relatedTarget;
var previousActiveElementWasItem = isItem(options.items, previousActiveElement);
if (Object(isSelfTarget["a" /* isSelfTarget */])(event) && previousActiveElementWasItem) {
// Composite has been focused as a result of an item receiving focus.
// The composite item will move focus back to the composite
// container. In this case, we don't want to propagate this
// additional event nor call the onFocus handler passed to
// <Composite onFocus={...} />.
event.stopPropagation(); // We keep track of the previous active item element so we can
// manually fire a blur event on it later when the focus is moved to
// another item on the onBlurCapture event below.
previousElementRef.current = previousActiveElement;
}
}, [options.unstable_virtual, options.items]);
var onFocus = Object(external_React_["useCallback"])(function (event) {
var _onFocusRef$current;
(_onFocusRef$current = onFocusRef.current) === null || _onFocusRef$current === void 0 ? void 0 : _onFocusRef$current.call(onFocusRef, event);
if (event.defaultPrevented) return;
if (options.unstable_virtual) {
if (Object(isSelfTarget["a" /* isSelfTarget */])(event)) {
// This means that the composite element has been focused while the
// composite item has not. For example, by clicking on the
// composite element without touching any item, or by tabbing into
// the composite element. In this case, we want to trigger focus on
// the item, just like it would happen with roving tabindex.
// When it receives focus, the composite item will put focus back
// on the composite element, in which case hasItemWithFocus will be
// true.
scheduleUserFocus();
}
} else if (Object(isSelfTarget["a" /* isSelfTarget */])(event)) {
var _options$setCurrentId;
// When the roving tabindex composite gets intentionally focused (for
// example, by clicking directly on it, and not on an item), we make
// sure to set the current id to null (which means the composite
// itself is focused).
(_options$setCurrentId = options.setCurrentId) === null || _options$setCurrentId === void 0 ? void 0 : _options$setCurrentId.call(options, null);
}
}, [options.unstable_virtual, options.setCurrentId]);
var onBlurCapture = Object(external_React_["useCallback"])(function (event) {
var _onBlurCaptureRef$cur;
(_onBlurCaptureRef$cur = onBlurCaptureRef.current) === null || _onBlurCaptureRef$cur === void 0 ? void 0 : _onBlurCaptureRef$cur.call(onBlurCaptureRef, event);
if (event.defaultPrevented) return;
if (!options.unstable_virtual) return; // When virtual is set to true, we move focus from the composite
// container (this component) to the composite item that is being
// selected. Then we move focus back to the composite container. This
// is so we can provide the same API as the roving tabindex method,
// which means people can attach onFocus/onBlur handlers on the
// CompositeItem component regardless of whether it's virtual or not.
// This sequence of blurring and focusing items and composite may be
// confusing, so we ignore intermediate focus and blurs by stopping its
// propagation and not calling the passed onBlur handler (htmlOnBlur).
var currentElement = (currentItem === null || currentItem === void 0 ? void 0 : currentItem.ref.current) || null;
var nextActiveElement = getNextActiveElementOnBlur(event);
var nextActiveElementIsItem = isItem(options.items, nextActiveElement);
if (Object(isSelfTarget["a" /* isSelfTarget */])(event) && nextActiveElementIsItem) {
// This is an intermediate blur event: blurring the composite
// container to focus an item (nextActiveElement).
if (nextActiveElement === currentElement) {
// The next active element will be the same as the current item in
// the state in two scenarios:
// - Moving focus with keyboard: the state is updated before the
// blur event is triggered, so here the current item is already
// pointing to the next active element.
// - Clicking on the current active item with a pointer: this
// will trigger blur on the composite element and then the next
// active element will be the same as the current item. Clicking on
// an item other than the current one doesn't end up here as the
// currentItem state will be updated only after it.
if (previousElementRef.current && previousElementRef.current !== nextActiveElement) {
// If there's a previous active item and it's not a click action,
// then we fire a blur event on it so it will work just like if
// it had DOM focus before (like when using roving tabindex).
fireBlurEvent(previousElementRef.current, event);
}
} else if (currentElement) {
// This will be true when the next active element is not the
// current element, but there's a current item. This will only
// happen when clicking with a pointer on a different item, when
// there's already an item selected, in which case currentElement
// is the item that is getting blurred, and nextActiveElement is
// the item that is being clicked.
fireBlurEvent(currentElement, event);
} // We want to ignore intermediate blur events, so we stop its
// propagation and return early so onFocus will not be called.
event.stopPropagation();
} else {
var targetIsItem = isItem(options.items, event.target);
if (!targetIsItem && currentElement) {
// If target is not a composite item, it may be the composite
// element itself (isSelfTarget) or a tabbable element inside the
// composite widget. This may be triggered by clicking outside the
// composite widget or by tabbing out of it. In either cases we
// want to fire a blur event on the current item.
fireBlurEvent(currentElement, event);
}
}
}, [options.unstable_virtual, options.items, currentItem]);
var onKeyDown = Object(external_React_["useCallback"])(function (event) {
var _onKeyDownRef$current, _options$groups;
(_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);
if (event.defaultPrevented) return;
if (options.currentId !== null) return;
if (!Object(isSelfTarget["a" /* isSelfTarget */])(event)) return;
var isVertical = options.orientation !== "horizontal";
var isHorizontal = options.orientation !== "vertical";
var isGrid = !!((_options$groups = options.groups) !== null && _options$groups !== void 0 && _options$groups.length);
var up = function up() {
if (isGrid) {
var item = findFirstEnabledItemInTheLastRow(options.items);
if (item !== null && item !== void 0 && item.id) {
var _options$move;
(_options$move = options.move) === null || _options$move === void 0 ? void 0 : _options$move.call(options, item.id);
}
} else {
var _options$last;
(_options$last = options.last) === null || _options$last === void 0 ? void 0 : _options$last.call(options);
}
};
var keyMap = {
ArrowUp: (isGrid || isVertical) && up,
ArrowRight: (isGrid || isHorizontal) && options.first,
ArrowDown: (isGrid || isVertical) && options.first,
ArrowLeft: (isGrid || isHorizontal) && options.last,
Home: options.first,
End: options.last,
PageUp: options.first,
PageDown: options.last
};
var action = keyMap[event.key];
if (action) {
event.preventDefault();
action();
}
}, [options.currentId, options.orientation, options.groups, options.items, options.move, options.last, options.first]);
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({
ref: Object(useForkRef["a" /* useForkRef */])(ref, htmlRef),
id: options.baseId,
onFocus: onFocus,
onFocusCapture: onFocusCapture,
onBlurCapture: onBlurCapture,
onKeyDownCapture: onKeyDownCapture,
onKeyDown: onKeyDown,
onKeyUpCapture: onKeyUpCapture,
"aria-activedescendant": options.unstable_virtual ? (currentItem === null || currentItem === void 0 ? void 0 : currentItem.id) || undefined : undefined
}, htmlProps);
},
useComposeProps: function useComposeProps(options, htmlProps) {
htmlProps = Object(Role["a" /* useRole */])(options, htmlProps, true);
var tabbableHTMLProps = Object(Tabbable["a" /* useTabbable */])(options, htmlProps, true);
if (options.unstable_virtual || options.currentId === null) {
// Composite will only be tabbable by default if the focus is managed
// using aria-activedescendant, which requires DOM focus on the container
// element (the composite)
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({
tabIndex: 0
}, tabbableHTMLProps);
}
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, htmlProps), {}, {
ref: tabbableHTMLProps.ref
});
}
});
var Composite = Object(createComponent["a" /* createComponent */])({
as: "div",
useHook: useComposite,
useCreateElement: function useCreateElement$1(type, props, children) {
false ? undefined : void 0;
return Object(useCreateElement["a" /* useCreateElement */])(type, props, children);
}
});
// EXTERNAL MODULE: ./node_modules/reakit/es/Id/Id.js
var Id = __webpack_require__("ym77");
// CONCATENATED MODULE: ./node_modules/reakit/es/Group/Group.js
// Automatically generated
var GROUP_KEYS = [];
var useGroup = Object(createHook["a" /* createHook */])({
name: "Group",
compose: Role["a" /* useRole */],
keys: GROUP_KEYS,
useProps: function useProps(_, htmlProps) {
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({
role: "group"
}, htmlProps);
}
});
var Group = Object(createComponent["a" /* createComponent */])({
as: "div",
useHook: useGroup
});
// CONCATENATED MODULE: ./node_modules/reakit/es/Composite/CompositeGroup.js
var useCompositeGroup = Object(createHook["a" /* createHook */])({
name: "CompositeGroup",
compose: [useGroup, Id["a" /* unstable_useId */]],
keys: _keys_6742f591["b" /* a */],
propsAreEqual: function propsAreEqual(prev, next) {
if (!next.id || prev.id !== next.id) {
return useGroup.unstable_propsAreEqual(prev, next);
}
var prevCurrentId = prev.currentId,
prevMoves = prev.unstable_moves,
prevProps = Object(_rollupPluginBabelHelpers_1f0bf8c2["a" /* _ */])(prev, ["currentId", "unstable_moves"]);
var nextCurrentId = next.currentId,
nextMoves = next.unstable_moves,
nextProps = Object(_rollupPluginBabelHelpers_1f0bf8c2["a" /* _ */])(next, ["currentId", "unstable_moves"]);
if (prev.items && next.items) {
var prevCurrentItem = findEnabledItemById(prev.items, prevCurrentId);
var nextCurrentItem = findEnabledItemById(next.items, nextCurrentId);
var prevGroupId = prevCurrentItem === null || prevCurrentItem === void 0 ? void 0 : prevCurrentItem.groupId;
var nextGroupId = nextCurrentItem === null || nextCurrentItem === void 0 ? void 0 : nextCurrentItem.groupId;
if (next.id === nextGroupId || next.id === prevGroupId) {
return false;
}
}
return useGroup.unstable_propsAreEqual(prevProps, nextProps);
},
useProps: function useProps(options, _ref) {
var htmlRef = _ref.ref,
htmlProps = Object(_rollupPluginBabelHelpers_1f0bf8c2["a" /* _ */])(_ref, ["ref"]);
var ref = Object(external_React_["useRef"])(null);
var id = options.id; // We need this to be called before CompositeItems' register
Object(useIsomorphicEffect["a" /* useIsomorphicEffect */])(function () {
var _options$registerGrou;
if (!id) return undefined;
(_options$registerGrou = options.registerGroup) === null || _options$registerGrou === void 0 ? void 0 : _options$registerGrou.call(options, {
id: id,
ref: ref
});
return function () {
var _options$unregisterGr;
(_options$unregisterGr = options.unregisterGroup) === null || _options$unregisterGr === void 0 ? void 0 : _options$unregisterGr.call(options, id);
};
}, [id, options.registerGroup, options.unregisterGroup]);
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({
ref: Object(useForkRef["a" /* useForkRef */])(ref, htmlRef)
}, htmlProps);
}
});
var CompositeGroup = Object(createComponent["a" /* createComponent */])({
as: "div",
useHook: useCompositeGroup
});
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/styles/alignment-matrix-control-icon-styles.js
function alignment_matrix_control_icon_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* Internal dependencies
*/
const alignment_matrix_control_icon_styles_rootSize = () => {
const padding = 1.5;
const size = 24;
return /*#__PURE__*/css_browser_esm({
gridTemplateRows: `repeat( 3, calc( ${size - padding * 2}px / 3))`,
padding,
maxHeight: size,
maxWidth: size
}, true ? "" : undefined);
};
const rootPointerEvents = ({
disablePointerEvents
}) => {
return /*#__PURE__*/css_browser_esm({
pointerEvents: disablePointerEvents ? 'none' : null
}, true ? "" : undefined);
};
const alignment_matrix_control_icon_styles_Wrapper = styled_base_browser_esm("div", {
target: "elqsdmc0",
label: "Wrapper"
})( true ? {
name: "co61ta",
styles: "box-sizing:border-box;padding:2px;"
} : undefined);
const alignment_matrix_control_icon_styles_Root = styled_base_browser_esm("div", {
target: "elqsdmc1",
label: "Root"
})("transform-origin:top left;height:100%;width:100%;", rootBase, ";", alignment_matrix_control_icon_styles_rootSize, ";", rootPointerEvents, ";" + ( true ? "" : undefined));
const alignment_matrix_control_icon_styles_pointActive = ({
isActive
}) => {
const boxShadow = isActive ? `0 0 0 1px currentColor` : null;
return /*#__PURE__*/css_browser_esm("box-shadow:", boxShadow, ";color:currentColor;*:hover > &{color:currentColor;}" + ( true ? "" : undefined));
};
const alignment_matrix_control_icon_styles_Point = styled_base_browser_esm("span", {
target: "elqsdmc2",
label: "Point"
})("height:2px;width:2px;", pointBase, ";", alignment_matrix_control_icon_styles_pointActive, ";" + ( true ? "" : undefined));
const alignment_matrix_control_icon_styles_Cell = Cell;
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/icon.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const BASE_SIZE = 24;
function AlignmentMatrixControlIcon({
className,
disablePointerEvents = true,
size = BASE_SIZE,
style = {},
value = 'center',
...props
}) {
const alignIndex = getAlignmentIndex(value);
const scale = (size / BASE_SIZE).toFixed(2);
const classes = classnames_default()('component-alignment-matrix-control-icon', className);
const styles = { ...style,
transform: `scale(${scale})`
};
return Object(external_wp_element_["createElement"])(alignment_matrix_control_icon_styles_Root, Object(esm_extends["a" /* default */])({}, props, {
className: classes,
disablePointerEvents: disablePointerEvents,
role: "presentation",
size: size,
style: styles
}), ALIGNMENTS.map((align, index) => {
const isActive = alignIndex === index;
return Object(external_wp_element_["createElement"])(alignment_matrix_control_icon_styles_Cell, {
key: align
}, Object(external_wp_element_["createElement"])(alignment_matrix_control_icon_styles_Point, {
isActive: isActive
}));
}));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/alignment-matrix-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useBaseId(id) {
const instanceId = Object(external_wp_compose_["useInstanceId"])(AlignmentMatrixControl, 'alignment-matrix-control');
return id || instanceId;
}
function AlignmentMatrixControl({
className,
id,
label = Object(external_wp_i18n_["__"])('Alignment Matrix Control'),
defaultValue = 'center center',
value,
onChange = external_lodash_["noop"],
width = 92,
...props
}) {
const [immutableDefaultValue] = Object(external_wp_element_["useState"])(value !== null && value !== void 0 ? value : defaultValue);
const baseId = useBaseId(id);
const initialCurrentId = utils_getItemId(baseId, immutableDefaultValue);
const composite = useCompositeState({
baseId,
currentId: initialCurrentId,
rtl: Object(external_wp_i18n_["isRTL"])()
});
const handleOnChange = nextValue => {
onChange(nextValue);
};
Object(external_wp_element_["useEffect"])(() => {
if (typeof value !== 'undefined') {
composite.setCurrentId(utils_getItemId(baseId, value));
}
}, [value, composite.setCurrentId]);
const classes = classnames_default()('component-alignment-matrix-control', className);
return Object(external_wp_element_["createElement"])(Composite, Object(esm_extends["a" /* default */])({}, props, composite, {
"aria-label": label,
as: Root,
className: classes,
role: "grid",
width: width
}), GRID.map((cells, index) => Object(external_wp_element_["createElement"])(CompositeGroup, Object(esm_extends["a" /* default */])({}, composite, {
as: Row,
role: "row",
key: index
}), cells.map(cell => {
const cellId = utils_getItemId(baseId, cell);
const isActive = composite.currentId === cellId;
return Object(external_wp_element_["createElement"])(cell_Cell, Object(esm_extends["a" /* default */])({}, composite, {
id: cellId,
isActive: isActive,
key: cell,
value: cell,
onFocus: () => handleOnChange(cell),
tabIndex: isActive ? 0 : -1
}));
}))));
}
AlignmentMatrixControl.Icon = AlignmentMatrixControlIcon;
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/animate/index.js
var animate = __webpack_require__("L8Kx");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/font-values.js
/* harmony default export */ var font_values = ({
'default.fontFamily': "-apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen-Sans, Ubuntu, Cantarell, 'Helvetica Neue', sans-serif",
'default.fontSize': '13px',
'helpText.fontSize': '12px',
mobileTextMinFontSize: '16px'
});
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/font.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
/**
*
* @param {keyof FONT} value Path of value from `FONT`
* @return {string} Font rule value
*/
function font(value) {
return Object(external_lodash_["get"])(font_values, value, '');
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/space.js
const SPACE_GRID_BASE = 8;
/**
* Creates a spacing CSS value (px) based on grid system values.
*
* @param {number} [value=1] Multiplier against the grid base value (8)
* @return {string} The spacing value (px).
*/
function space(value = 1) {
if (isNaN(value)) return `${SPACE_GRID_BASE}px`;
return `${SPACE_GRID_BASE * value}px`;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/base-control/styles/base-control-styles.js
/**
* Internal dependencies
*/
const base_control_styles_Wrapper = styled_base_browser_esm("div", {
target: "e1puf3u0",
label: "Wrapper"
})("font-family:", font('default.fontFamily'), ";font-size:", font('default.fontSize'), ";" + ( true ? "" : undefined));
const StyledField = styled_base_browser_esm("div", {
target: "e1puf3u1",
label: "StyledField"
})("margin-bottom:", space(1), ";.components-panel__row &{margin-bottom:inherit;}" + ( true ? "" : undefined));
const StyledLabel = styled_base_browser_esm("label", {
target: "e1puf3u2",
label: "StyledLabel"
})("display:inline-block;margin-bottom:", space(1), ";" + ( true ? "" : undefined));
const StyledHelp = styled_base_browser_esm("p", {
target: "e1puf3u3",
label: "StyledHelp"
})("font-size:", font('helpText.fontSize'), ";font-style:normal;color:", COLORS.mediumGray.text, ";" + ( true ? "" : undefined));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/base-control/index.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
/**
* @typedef Props
* @property {string} id The id of the element to which labels and help text are being generated.
* That element should be passed as a child.
* @property {import('react').ReactNode} help If this property is added, a help text will be
* generated using help property as the content.
* @property {import('react').ReactNode} label If this property is added, a label will be generated
* using label property as the content.
* @property {boolean} [hideLabelFromVision] If true, the label will only be visible to screen readers.
* @property {string} [className] The class that will be added with "components-base-control" to the
* classes of the wrapper div. If no className is passed only
* components-base-control is used.
* @property {import('react').ReactNode} [children] The content to be displayed within
* the BaseControl.
*/
/**
* @param {Props} props
* @return {JSX.Element} Element
*/
function BaseControl({
id,
label,
hideLabelFromVision,
help,
className,
children
}) {
return Object(external_wp_element_["createElement"])(base_control_styles_Wrapper, {
className: classnames_default()('components-base-control', className)
}, Object(external_wp_element_["createElement"])(StyledField, {
className: "components-base-control__field"
}, label && id && (hideLabelFromVision ? Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], {
as: "label",
htmlFor: id
}, label) : Object(external_wp_element_["createElement"])(StyledLabel, {
className: "components-base-control__label",
htmlFor: id
}, label)), label && !id && (hideLabelFromVision ? Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], {
as: "label"
}, label) : Object(external_wp_element_["createElement"])(BaseControl.VisualLabel, null, label)), children), !!help && Object(external_wp_element_["createElement"])(StyledHelp, {
id: id + '__help',
className: "components-base-control__help"
}, help));
}
/**
* @typedef VisualLabelProps
* @property {string} [className] Class name
* @property {import('react').ReactNode} [children] Children
*/
/**
* @param {VisualLabelProps} Props
* @return {JSX.Element} Element
*/
BaseControl.VisualLabel = ({
className,
children
}) => {
className = classnames_default()('components-base-control__label', className);
return Object(external_wp_element_["createElement"])("span", {
className: className
}, children);
};
/* harmony default export */ var base_control = (BaseControl);
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/ui/context/context-connect.js
var context_connect = __webpack_require__("7Jlx");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/view/component.js
/**
* `View` is a core component that renders everything in the library.
* It is the principle component in the entire library.
*
* @example
* ```jsx
* import { View } from `@wordpress/components`;
*
* function Example() {
* return (
* <View>
* Code is Poetry
* </View>
* );
* }
* ```
*/
const View = styled_base_browser_esm("div", {
target: "em57xhy0",
label: "View"
})( true ? "" : undefined);
View.displayName = 'View';
/* harmony default export */ var component = (View);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/create-component.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* Internal dependencies
*/
// eslint-disable-next-line no-duplicate-imports
/**
* Factory that creates a React component from a hook
*
* @param options
* @param options.as The element to render for the component.
* @param options.name The name of the component.
* @param options.useHook The hook to use for the component
* @param options.memo Whether to memo the component.
* @return A polymorphic component that uses the hook to process props.
*/
const create_component_createComponent = ({
as,
name,
useHook,
memo = false
}) => {
function Component(props, forwardedRef) {
const otherProps = useHook(props);
return Object(external_wp_element_["createElement"])(component, Object(esm_extends["a" /* default */])({
as: as || 'div'
}, otherProps, {
ref: forwardedRef
}));
}
Component.displayName = name;
return Object(context_connect["a" /* contextConnect */])(Component, name, {
memo
});
};
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/ui/context/use-context-system.js
var use_context_system = __webpack_require__("C6yU");
// EXTERNAL MODULE: ./node_modules/emotion/dist/emotion.esm.js + 1 modules
var emotion_esm = __webpack_require__("kDDq");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/context.js
/**
* WordPress dependencies
*/
const FlexContext = Object(external_wp_element_["createContext"])({
flexItemDisplay: undefined
});
const useFlexContext = () => Object(external_wp_element_["useContext"])(FlexContext);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/styles.js
function styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
const Flex = /*#__PURE__*/Object(emotion_esm["a" /* css */])( true ? {
name: "142v397-Flex",
styles: "display:flex;;label:Flex;"
} : undefined);
const Item = /*#__PURE__*/Object(emotion_esm["a" /* css */])( true ? {
name: "1636tkh-Item",
styles: "display:block;max-height:100%;max-width:100%;min-height:0;min-width:0;;label:Item;"
} : undefined);
const block = /*#__PURE__*/Object(emotion_esm["a" /* css */])( true ? {
name: "jhhyjf-block",
styles: "flex:1;;label:block;"
} : undefined);
/**
* Workaround to optimize DOM rendering.
* We'll enhance alignment with naive parent flex assumptions.
*
* Trade-off:
* Far less DOM less. However, UI rendering is not as reliable.
*/
/**
* Improves stability of width/height rendering.
* https://github.com/ItsJonQ/g2/pull/149
*/
const ItemsColumn = /*#__PURE__*/Object(emotion_esm["a" /* css */])( true ? {
name: "1u16kd2-ItemsColumn",
styles: "> *{min-height:0;};label:ItemsColumn;"
} : undefined);
const ItemsRow = /*#__PURE__*/Object(emotion_esm["a" /* css */])( true ? {
name: "1yewyqa-ItemsRow",
styles: "> *{min-width:0;};label:ItemsRow;"
} : undefined);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex-item/hook.js
/**
* Internal dependencies
*/
/**
* @param {import('../../ui/context').ViewOwnProps<import('../types').FlexItemProps, 'div'>} props
*/
function useFlexItem(props) {
const {
className,
display: displayProp,
isBlock = false,
...otherProps
} = Object(use_context_system["a" /* useContextSystem */])(props, 'FlexItem');
const sx = {};
const contextDisplay = useFlexContext().flexItemDisplay;
sx.Base = /*#__PURE__*/Object(emotion_esm["a" /* css */])({
display: displayProp || contextDisplay
}, true ? "" : undefined);
const classes = Object(emotion_esm["b" /* cx */])(Item, sx.Base, isBlock && block, className);
return { ...otherProps,
className: classes
};
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex-block/hook.js
/**
* Internal dependencies
*/
/**
* @param {import('../../ui/context').ViewOwnProps<import('../types').FlexBlockProps, 'div'>} props
*/
function useFlexBlock(props) {
const otherProps = Object(use_context_system["a" /* useContextSystem */])(props, 'FlexBlock');
const flexItemProps = useFlexItem({
isBlock: true,
...otherProps
});
return flexItemProps;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex-block/component.js
/**
* Internal dependencies
*/
/**
* `FlexBlock` is a primitive layout component that adaptively resizes content within layout containers like `Flex`.
*
* @example
* ```jsx
* <Flex>
* <FlexBlock>...</FlexBlock>
* </Flex>
* ```
*/
const FlexBlock = create_component_createComponent({
as: 'div',
useHook: useFlexBlock,
name: 'FlexBlock'
});
/* harmony default export */ var flex_block_component = (FlexBlock);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex-item/component.js
/**
* Internal dependencies
*/
/**
* `FlexItem` is a primitive layout component that aligns content within layout containers like `Flex`.
*
* @example
* ```jsx
* <Flex>
* <FlexItem>...</FlexItem>
* </Flex>
* ```
*/
const FlexItem = create_component_createComponent({
as: 'div',
useHook: useFlexItem,
name: 'FlexItem'
});
/* harmony default export */ var flex_item_component = (FlexItem);
// EXTERNAL MODULE: external ["wp","deprecated"]
var external_wp_deprecated_ = __webpack_require__("NMb1");
var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/use-responsive-value.js
/**
* WordPress dependencies
*/
const breakpoints = ['40em', '52em', '64em'];
const useBreakpointIndex = (options = {}) => {
const {
defaultIndex = 0
} = options;
if (typeof defaultIndex !== 'number') {
throw new TypeError(`Default breakpoint index should be a number. Got: ${defaultIndex}, ${typeof defaultIndex}`);
} else if (defaultIndex < 0 || defaultIndex > breakpoints.length - 1) {
throw new RangeError(`Default breakpoint index out of range. Theme has ${breakpoints.length} breakpoints, got index ${defaultIndex}`);
}
const [value, setValue] = Object(external_wp_element_["useState"])(defaultIndex);
Object(external_wp_element_["useEffect"])(() => {
const getIndex = () => breakpoints.filter(bp => {
return typeof window !== 'undefined' ? window.matchMedia(`screen and (min-width: ${bp})`).matches : false;
}).length;
const onResize = () => {
const newValue = getIndex();
if (value !== newValue) {
setValue(newValue);
}
};
onResize();
if (typeof document !== 'undefined') {
// Disable reason: We don't really care about what document we listen to, we just want to know that we're resizing.
/* eslint-disable @wordpress/no-global-event-listener */
document.addEventListener('resize', onResize);
}
return () => {
if (typeof document !== 'undefined') {
document.removeEventListener('resize', onResize);
/* eslint-enable @wordpress/no-global-event-listener */
}
};
}, [value]);
return value;
};
function useResponsiveValue(values, options = {}) {
const index = useBreakpointIndex(options); // Allow calling the function with a "normal" value without having to check on the outside.
if (!Array.isArray(values) && typeof values !== 'function') return values;
const array = values || [];
/* eslint-disable jsdoc/no-undefined-types */
return (
/** @type {T[]} */
array[
/* eslint-enable jsdoc/no-undefined-types */
index >= array.length ? array.length - 1 : index]
);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/space.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* Internal dependencies
*/
const GRID_BASE = '4px';
function space_space(value) {
return typeof value === 'number' ? `calc(${GRID_BASE} * ${value})` : value;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
*
* @param {import('../../ui/context').ViewOwnProps<import('../types').FlexProps, 'div'>} props
* @return {import('../../ui/context').ViewOwnProps<import('../types').FlexProps, 'div'>} Props with the deprecated props removed.
*/
function useDeprecatedProps({
isReversed,
...otherProps
}) {
if (typeof isReversed !== 'undefined') {
external_wp_deprecated_default()('Flex isReversed', {
alternative: 'Flex direction="row-reverse" or "column-reverse"',
since: '5.9'
});
return { ...otherProps,
direction: isReversed ? 'row-reverse' : 'row'
};
}
return otherProps;
}
/**
* @param {import('../../ui/context').ViewOwnProps<import('../types').FlexProps, 'div'>} props
*/
function useFlex(props) {
const {
align = 'center',
className,
direction: directionProp = 'row',
expanded = true,
gap = 2,
justify = 'space-between',
wrap = false,
...otherProps
} = Object(use_context_system["a" /* useContextSystem */])(useDeprecatedProps(props), 'Flex');
const directionAsArray = Array.isArray(directionProp) ? directionProp : [directionProp];
const direction = useResponsiveValue(directionAsArray);
const isColumn = typeof direction === 'string' && !!direction.includes('column');
const isReverse = typeof direction === 'string' && direction.includes('reverse');
const classes = Object(external_wp_element_["useMemo"])(() => {
const sx = {};
sx.Base = /*#__PURE__*/Object(emotion_esm["a" /* css */])({
alignItems: isColumn ? 'normal' : align,
flexDirection: direction,
flexWrap: wrap ? 'wrap' : undefined,
justifyContent: justify,
height: isColumn && expanded ? '100%' : undefined,
width: !isColumn && expanded ? '100%' : undefined,
marginBottom: wrap ? `calc(${space_space(gap)} * -1)` : undefined
}, true ? "" : undefined);
sx.Items = /*#__PURE__*/Object(emotion_esm["a" /* css */])({
/**
* Workaround to optimize DOM rendering.
* We'll enhance alignment with naive parent flex assumptions.
*
* Trade-off:
* Far less DOM less. However, UI rendering is not as reliable.
*/
'> * + *:not(marquee)': {
marginTop: isColumn ? space_space(gap) : undefined,
marginRight: !isColumn && isReverse ? space_space(gap) : undefined,
marginLeft: !isColumn && !isReverse ? space_space(gap) : undefined
}
}, true ? "" : undefined);
sx.WrapItems = /*#__PURE__*/Object(emotion_esm["a" /* css */])({
'> *:not(marquee)': {
marginBottom: space_space(gap),
marginLeft: !isColumn && isReverse ? space_space(gap) : undefined,
marginRight: !isColumn && !isReverse ? space_space(gap) : undefined
},
'> *:last-child:not(marquee)': {
marginLeft: !isColumn && isReverse ? 0 : undefined,
marginRight: !isColumn && !isReverse ? 0 : undefined
}
}, true ? "" : undefined);
return Object(emotion_esm["b" /* cx */])(Flex, sx.Base, wrap ? sx.WrapItems : sx.Items, isColumn ? ItemsColumn : ItemsRow, className);
}, [align, className, direction, expanded, gap, isColumn, isReverse, justify, wrap]);
return { ...otherProps,
className: classes,
isColumn
};
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/flex/flex/component.js
/**
* Internal dependencies
*/
/**
* @param {import('../../ui/context').ViewOwnProps<import('../types').FlexProps, 'div'>} props
* @param {import('react').Ref<any>} forwardedRef
*/
function component_Flex(props, forwardedRef) {
const {
children,
isColumn,
...otherProps
} = useFlex(props);
return Object(external_wp_element_["createElement"])(FlexContext.Provider, {
value: {
flexItemDisplay: isColumn ? 'block' : undefined
}
}, Object(external_wp_element_["createElement"])(component, Object(esm_extends["a" /* default */])({}, otherProps, {
ref: forwardedRef
}), children));
}
/**
* `Flex` is a primitive layout component that adaptively aligns child content
* horizontally or vertically. `Flex` powers components like `HStack` and
* `VStack`.
*
* `Flex` is used with any of it's two sub-components, `FlexItem` and `FlexBlock`.
*
* @example
* ```jsx
* import {
* __experimentalFlex as Flex,
* __experimentalFlexBlock as FlexBlock,
* __experimentalFlexItem as FlexItem,
* __experimentalText as Text
* } from `@wordpress/components`;
*
* function Example() {
* return (
* <Flex>
* <FlexItem>
* <Text>Code</Text>
* </FlexItem>
* <FlexBlock>
* <Text>Poetry</Text>
* </FlexBlock>
* </Flex>
* );
* }
* ```
*
*/
const ConnectedFlex = Object(context_connect["a" /* contextConnect */])(component_Flex, 'Flex');
/* harmony default export */ var flex_component = (ConnectedFlex);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/truncate/styles.js
function truncate_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
const Truncate = /*#__PURE__*/Object(emotion_esm["a" /* css */])( true ? {
name: "w4wjp3-Truncate",
styles: "display:block;overflow:hidden;text-overflow:ellipsis;white-space:nowrap;;label:Truncate;"
} : undefined);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/truncate/utils.js
/**
* External dependencies
*/
const TRUNCATE_ELLIPSIS = '…';
const TRUNCATE_TYPE = {
auto: 'auto',
head: 'head',
middle: 'middle',
tail: 'tail',
none: 'none'
};
const TRUNCATE_DEFAULT_PROPS = {
ellipsis: TRUNCATE_ELLIPSIS,
ellipsizeMode: TRUNCATE_TYPE.auto,
limit: 0,
numberOfLines: 0
}; // Source
// https://github.com/kahwee/truncate-middle
/**
* @param {string} word
* @param {number} headLength
* @param {number} tailLength
* @param {string} ellipsis
*/
function truncateMiddle(word, headLength, tailLength, ellipsis) {
if (typeof word !== 'string') {
return '';
}
const wordLength = word.length; // Setting default values
// eslint-disable-next-line no-bitwise
const frontLength = ~~headLength; // will cast to integer
// eslint-disable-next-line no-bitwise
const backLength = ~~tailLength;
/* istanbul ignore next */
const truncateStr = !Object(external_lodash_["isNil"])(ellipsis) ? ellipsis : TRUNCATE_ELLIPSIS;
if (frontLength === 0 && backLength === 0 || frontLength >= wordLength || backLength >= wordLength || frontLength + backLength >= wordLength) {
return word;
} else if (backLength === 0) {
return word.slice(0, frontLength) + truncateStr;
}
return word.slice(0, frontLength) + truncateStr + word.slice(wordLength - backLength);
}
/**
*
* @param {string} words
* @param {typeof TRUNCATE_DEFAULT_PROPS} props
*/
function truncateContent(words = '', props) {
const mergedProps = { ...TRUNCATE_DEFAULT_PROPS,
...props
};
const {
ellipsis,
ellipsizeMode,
limit
} = mergedProps;
if (ellipsizeMode === TRUNCATE_TYPE.none) {
return words;
}
let truncateHead;
let truncateTail;
switch (ellipsizeMode) {
case TRUNCATE_TYPE.head:
truncateHead = 0;
truncateTail = limit;
break;
case TRUNCATE_TYPE.middle:
truncateHead = Math.floor(limit / 2);
truncateTail = Math.floor(limit / 2);
break;
default:
truncateHead = limit;
truncateTail = 0;
}
const truncatedContent = ellipsizeMode !== TRUNCATE_TYPE.auto ? truncateMiddle(words, truncateHead, truncateTail, ellipsis) : words;
return truncatedContent;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/truncate/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* @param {import('../ui/context').ViewOwnProps<import('./types').Props, 'span'>} props
*/
function useTruncate(props) {
const {
className,
children,
ellipsis = TRUNCATE_ELLIPSIS,
ellipsizeMode = TRUNCATE_TYPE.auto,
limit = 0,
numberOfLines = 0,
...otherProps
} = Object(use_context_system["a" /* useContextSystem */])(props, 'Truncate');
const truncatedContent = truncateContent(typeof children === 'string' ?
/** @type {string} */
children : '', {
ellipsis,
ellipsizeMode,
limit,
numberOfLines
});
const shouldTruncate = ellipsizeMode === TRUNCATE_TYPE.auto;
const classes = Object(external_wp_element_["useMemo"])(() => {
const sx = {};
sx.numberOfLines = /*#__PURE__*/Object(emotion_esm["a" /* css */])("-webkit-box-orient:vertical;-webkit-line-clamp:", numberOfLines, ";display:-webkit-box;overflow:hidden;" + ( true ? "" : undefined));
return Object(emotion_esm["b" /* cx */])(shouldTruncate && !numberOfLines && Truncate, shouldTruncate && !!numberOfLines && sx.numberOfLines, className);
}, [className, numberOfLines, shouldTruncate]);
return { ...otherProps,
className: classes,
children: truncatedContent
};
}
// EXTERNAL MODULE: ./node_modules/memize/index.js
var memize = __webpack_require__("4eJC");
var memize_default = /*#__PURE__*/__webpack_require__.n(memize);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/colors.js
/**
* External dependencies
*/
/** @type {HTMLDivElement} */
let colorComputationNode;
/**
* @return {HTMLDivElement | undefined} The HTML element for color computation.
*/
function getColorComputationNode() {
if (typeof document === 'undefined') return;
if (!colorComputationNode) {
// Create a temporary element for style computation.
const el = document.createElement('div');
el.setAttribute('data-g2-color-computation-node', ''); // Inject for window computed style.
document.body.appendChild(el);
colorComputationNode = el;
}
return colorComputationNode;
}
/**
* @param {string | unknown} value
*
* @return {boolean} Whether the value is a valid color.
*/
function isColor(value) {
if (typeof value !== 'string') return false;
const test = tinycolor_default()(value);
return test.isValid();
}
/**
* Retrieves the computed background color. This is useful for getting the
* value of a CSS variable color.
*
* @param {string | unknown} backgroundColor The background color to compute.
*
* @return {string} The computed background color.
*/
function _getComputedBackgroundColor(backgroundColor) {
var _window;
if (typeof backgroundColor !== 'string') return '';
if (isColor(backgroundColor)) return backgroundColor;
if (!backgroundColor.includes('var(')) return '';
if (typeof document === 'undefined') return ''; // Attempts to gracefully handle CSS variables color values.
const el = getColorComputationNode();
if (!el) return '';
el.style.background = backgroundColor; // Grab the style
const computedColor = (_window = window) === null || _window === void 0 ? void 0 : _window.getComputedStyle(el).background; // Reset
el.style.background = '';
return computedColor || '';
}
const getComputedBackgroundColor = memize_default()(_getComputedBackgroundColor);
/**
* Get the text shade optimized for readability, based on a background color.
*
* @param {string | unknown} backgroundColor The background color.
*
* @return {string} The optimized text color (black or white).
*/
function getOptimalTextColor(backgroundColor) {
const background = getComputedBackgroundColor(backgroundColor);
const isReadableWithBlackText = tinycolor_default.a.isReadable(background, '#000000');
return isReadableWithBlackText ? '#000000' : '#ffffff';
}
/**
* Get the text shade optimized for readability, based on a background color.
*
* @param {string | unknown} backgroundColor The background color.
*
* @return {string} The optimized text shade (dark or light).
*/
function getOptimalTextShade(backgroundColor) {
const result = getOptimalTextColor(backgroundColor);
return result === '#000000' ? 'dark' : 'light';
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/config-values.js
/**
* Internal dependencies
*/
const CONTROL_HEIGHT = '30px';
const CARD_PADDING_X = space_space(3);
const CARD_PADDING_Y = space_space(3);
/* harmony default export */ var config_values = ({
colorDivider: 'rgba(0, 0, 0, 0.1)',
colorScrollbarThumb: 'rgba(0, 0, 0, 0.2)',
colorScrollbarThumbHover: 'rgba(0, 0, 0, 0.5)',
colorScrollbarTrack: 'rgba(0, 0, 0, 0.04)',
elevationIntensity: 1,
radiusBlockUi: '2px',
borderWidth: '1px',
borderWidthFocus: '1.5px',
borderWidthTab: '4px',
spinnerSize: '18px',
fontSize: '13px',
fontSizeH1: 'calc(2.44 * 13px)',
fontSizeH2: 'calc(1.95 * 13px)',
fontSizeH3: 'calc(1.56 * 13px)',
fontSizeH4: 'calc(1.25 * 13px)',
fontSizeH5: '13px',
fontSizeH6: 'calc(0.8 * 13px)',
fontSizeInputMobile: '16px',
fontSizeMobile: '15px',
fontSizeSmall: 'calc(0.92 * 13px)',
fontSizeXSmall: 'calc(0.75 * 13px)',
fontLineHeightBase: '1.2',
fontWeight: 'normal',
fontWeightHeading: '600',
gridBase: '4px',
controlHeight: CONTROL_HEIGHT,
controlHeightLarge: `calc( ${CONTROL_HEIGHT} * 1.2 )`,
controlHeightSmall: `calc( ${CONTROL_HEIGHT} * 0.8 )`,
controlHeightXSmall: `calc( ${CONTROL_HEIGHT} * 0.6 )`,
cardBorderRadius: '2px',
cardPaddingX: CARD_PADDING_X,
cardPaddingY: CARD_PADDING_Y,
cardPadding: `${CARD_PADDING_X} ${CARD_PADDING_Y}`,
cardHeaderFooterPaddingY: space_space(1),
cardHeaderHeight: '44px',
surfaceBackgroundColor: COLORS.white,
surfaceBackgroundSubtleColor: '#F3F3F3',
surfaceBackgroundTintColor: '#F5F5F5',
surfaceBorderColor: 'rgba(0, 0, 0, 0.1)',
surfaceBorderBoldColor: 'rgba(0, 0, 0, 0.15)',
surfaceBorderSubtleColor: 'rgba(0, 0, 0, 0.05)',
surfaceBackgroundTertiaryColor: COLORS.white,
surfaceColor: COLORS.white,
transitionDuration: '200ms',
transitionDurationFast: '160ms',
transitionDurationFaster: '120ms',
transitionDurationFastest: '100ms',
transitionTimingFunction: 'cubic-bezier(0.08, 0.52, 0.52, 1)',
transitionTimingFunctionControl: 'cubic-bezier(0.12, 0.8, 0.32, 1)'
});
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/styles.js
function text_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* Internal dependencies
*/
const Text = /*#__PURE__*/Object(emotion_esm["a" /* css */])("color:", COLORS.black, ";line-height:", config_values.fontLineHeightBase, ";margin:0;;label:Text;" + ( true ? "" : undefined));
const styles_block = /*#__PURE__*/Object(emotion_esm["a" /* css */])( true ? {
name: "w2ur5d-block",
styles: "display:block;;label:block;"
} : undefined);
const positive = /*#__PURE__*/Object(emotion_esm["a" /* css */])("color:", COLORS.alert.green, ";;label:positive;" + ( true ? "" : undefined));
const destructive = /*#__PURE__*/Object(emotion_esm["a" /* css */])("color:", COLORS.alert.red, ";;label:destructive;" + ( true ? "" : undefined));
const styles_muted = /*#__PURE__*/Object(emotion_esm["a" /* css */])("color:", COLORS.mediumGray.text, ";;label:muted;" + ( true ? "" : undefined));
const highlighterText = /*#__PURE__*/Object(emotion_esm["a" /* css */])("mark{background:", COLORS.alert.yellow, ";border-radius:2px;box-shadow:0 0 0 1px rgba( 0,0,0,0.05 ) inset,0 -1px 0 rgba( 0,0,0,0.1 ) inset;};label:highlighterText;" + ( true ? "" : undefined));
const styles_upperCase = /*#__PURE__*/Object(emotion_esm["a" /* css */])( true ? {
name: "a0nhhd-upperCase",
styles: "text-transform:uppercase;;label:upperCase;"
} : undefined);
// EXTERNAL MODULE: ./node_modules/highlight-words-core/dist/index.js
var dist = __webpack_require__("5V/u");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/utils.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Source:
* https://github.com/bvaughn/react-highlight-words/blob/HEAD/src/Highlighter.js
*/
/* eslint-disable jsdoc/valid-types */
/**
* @typedef Options
* @property {string} [activeClassName=''] Classname for active highlighted areas.
* @property {number} [activeIndex=-1] The index of the active highlighted area.
* @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [activeStyle] Styles to apply to the active highlighted area.
* @property {boolean} [autoEscape] Whether to automatically escape text.
* @property {boolean} [caseSensitive=false] Whether to highlight in a case-sensitive manner.
* @property {string} children Children to highlight.
* @property {import('highlight-words-core').FindAllArgs['findChunks']} [findChunks] Custom `findChunks` function to pass to `highlight-words-core`.
* @property {string | Record<string, unknown>} [highlightClassName=''] Classname to apply to highlighted text or a Record of classnames to apply to given text (which should be the key).
* @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [highlightStyle={}] Styles to apply to highlighted text.
* @property {keyof JSX.IntrinsicElements} [highlightTag='mark'] Tag to use for the highlighted text.
* @property {import('highlight-words-core').FindAllArgs['sanitize']} [sanitize] Custom `santize` function to pass to `highlight-words-core`.
* @property {string[]} [searchWords=[]] Words to search for and highlight.
* @property {string} [unhighlightClassName=''] Classname to apply to unhighlighted text.
* @property {import('react').AllHTMLAttributes<HTMLDivElement>['style']} [unhighlightStyle] Style to apply to unhighlighted text.
*/
/**
* Maps props to lowercase names.
*
* @template {Record<string, unknown>} T
* @param {T} object Props to map.
* @return {{[K in keyof T as Lowercase<string & K>]: T[K]}} The mapped props.
*/
/* eslint-enable jsdoc/valid-types */
const lowercaseProps = object => {
/** @type {any} */
const mapped = {};
for (const key in object) {
mapped[key.toLowerCase()] = object[key];
}
return mapped;
};
const memoizedLowercaseProps = memize_default()(lowercaseProps);
/**
*
* @param {Options} options
*/
function createHighlighterText({
activeClassName = '',
activeIndex = -1,
activeStyle,
autoEscape,
caseSensitive = false,
children,
findChunks,
highlightClassName = '',
highlightStyle = {},
highlightTag = 'mark',
sanitize,
searchWords = [],
unhighlightClassName = '',
unhighlightStyle
}) {
if (!children) return null;
if (typeof children !== 'string') return children;
const textToHighlight = children;
const chunks = Object(dist["findAll"])({
autoEscape,
caseSensitive,
findChunks,
sanitize,
searchWords,
textToHighlight
});
const HighlightTag = highlightTag;
let highlightIndex = -1;
let highlightClassNames = '';
let highlightStyles;
const textContent = chunks.map((chunk, index) => {
const text = textToHighlight.substr(chunk.start, chunk.end - chunk.start);
if (chunk.highlight) {
highlightIndex++;
let highlightClass;
if (typeof highlightClassName === 'object') {
if (!caseSensitive) {
highlightClassName = memoizedLowercaseProps(highlightClassName);
highlightClass = highlightClassName[text.toLowerCase()];
} else {
highlightClass = highlightClassName[text];
}
} else {
highlightClass = highlightClassName;
}
const isActive = highlightIndex === +activeIndex;
highlightClassNames = `${highlightClass} ${isActive ? activeClassName : ''}`;
highlightStyles = isActive === true && activeStyle !== null ? Object.assign({}, highlightStyle, activeStyle) : highlightStyle;
/** @type {Record<string, any>} */
const props = {
children: text,
className: highlightClassNames,
key: index,
style: highlightStyles
}; // Don't attach arbitrary props to DOM elements; this triggers React DEV warnings (https://fb.me/react-unknown-prop)
// Only pass through the highlightIndex attribute for custom components.
if (typeof HighlightTag !== 'string') {
props.highlightIndex = highlightIndex;
}
return Object(external_wp_element_["createElement"])(HighlightTag, props);
}
return Object(external_wp_element_["createElement"])('span', {
children: text,
className: unhighlightClassName,
key: index,
style: unhighlightStyle
});
});
return textContent;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/font-size.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* Internal dependencies
*/
const BASE_FONT_SIZE = 13;
const PRESET_FONT_SIZES = {
body: BASE_FONT_SIZE,
caption: 10,
footnote: 11,
largeTitle: 28,
subheadline: 12,
title: 20
};
const HEADING_FONT_SIZES = [1, 2, 3, 4, 5, 6].flatMap(n => [n, n.toString()]);
function getFontSize(size = BASE_FONT_SIZE) {
if (size in PRESET_FONT_SIZES) {
return getFontSize(PRESET_FONT_SIZES[size]);
}
if (typeof size !== 'number') {
const parsed = parseFloat(size);
if (Number.isNaN(parsed)) return size;
size = parsed;
}
const ratio = `(${size} / ${BASE_FONT_SIZE})`;
return `calc(${ratio} * ${config_values.fontSize})`;
}
function getHeadingFontSize(size = 3) {
if (!HEADING_FONT_SIZES.includes(size)) {
return getFontSize(size);
}
const headingSize = `fontSizeH${size}`;
return config_values[headingSize];
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/get-line-height.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* Internal dependencies
*/
function getLineHeight(adjustLineHeightForInnerControls, lineHeight) {
if (lineHeight) return lineHeight;
if (!adjustLineHeightForInnerControls) return;
let value = `calc(${config_values.controlHeight} + ${space_space(2)})`;
switch (adjustLineHeightForInnerControls) {
case 'large':
value = `calc(${config_values.controlHeightLarge} + ${space_space(2)})`;
break;
case 'small':
value = `calc(${config_values.controlHeightSmall} + ${space_space(2)})`;
break;
case 'xSmall':
value = `calc(${config_values.controlHeightXSmall} + ${space_space(2)})`;
break;
default:
break;
}
return value;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/hook.js
function hook_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* @param {import('../ui/context').ViewOwnProps<import('./types').Props, 'span'>} props
*/
function useText(props) {
const {
adjustLineHeightForInnerControls,
align,
children,
className,
color,
ellipsizeMode,
isDestructive = false,
display,
highlightEscape = false,
highlightCaseSensitive = false,
highlightWords,
highlightSanitize,
isBlock = false,
letterSpacing,
lineHeight: lineHeightProp,
optimizeReadabilityFor,
size,
truncate = false,
upperCase = false,
variant,
weight = config_values.fontWeight,
...otherProps
} = Object(use_context_system["a" /* useContextSystem */])(props, 'Text');
/** @type {import('react').ReactNode} */
let content = children;
const isHighlighter = Array.isArray(highlightWords);
const isCaption = size === 'caption';
if (isHighlighter) {
if (typeof children !== 'string') {
throw new TypeError('`children` of `Text` must only be `string` types when `highlightWords` is defined');
}
content = createHighlighterText({
autoEscape: highlightEscape,
// Disable reason: We need to disable this otherwise it erases the cast
// eslint-disable-next-line object-shorthand
children:
/** @type {string} */
children,
caseSensitive: highlightCaseSensitive,
searchWords: highlightWords,
sanitize: highlightSanitize
});
}
const classes = Object(external_wp_element_["useMemo"])(() => {
const sx = {};
const lineHeight = getLineHeight(adjustLineHeightForInnerControls, lineHeightProp);
sx.Base = /*#__PURE__*/Object(emotion_esm["a" /* css */])({
color,
display,
fontSize: getFontSize(size),
/* eslint-disable jsdoc/valid-types */
fontWeight:
/** @type {import('react').CSSProperties['fontWeight']} */
weight,
/* eslint-enable jsdoc/valid-types */
lineHeight,
letterSpacing,
textAlign: align
}, true ? "" : undefined);
sx.upperCase = /*#__PURE__*/Object(emotion_esm["a" /* css */])( true ? {
name: "1lejymi",
styles: "text-transform:uppercase;"
} : undefined);
sx.optimalTextColor = null;
if (optimizeReadabilityFor) {
const isOptimalTextColorDark = getOptimalTextShade(optimizeReadabilityFor) === 'dark';
sx.optimalTextColor = isOptimalTextColorDark ? /*#__PURE__*/Object(emotion_esm["a" /* css */])({
color: COLORS.black
}, true ? "" : undefined) : /*#__PURE__*/Object(emotion_esm["a" /* css */])({
color: COLORS.white
}, true ? "" : undefined);
}
return Object(emotion_esm["b" /* cx */])(Text, sx.Base, sx.optimalTextColor, isDestructive && destructive, !!isHighlighter && highlighterText, isBlock && styles_block, isCaption && styles_muted, variant && text_styles_namespaceObject[variant], upperCase && sx.upperCase, className);
}, [adjustLineHeightForInnerControls, align, className, color, display, isBlock, isCaption, isDestructive, isHighlighter, letterSpacing, lineHeightProp, optimizeReadabilityFor, size, upperCase, variant, weight]);
/** @type {undefined | 'auto' | 'none'} */
let finalEllipsizeMode;
if (truncate === true) {
finalEllipsizeMode = 'auto';
}
if (truncate === false) {
finalEllipsizeMode = 'none';
}
const finalComponentProps = { ...otherProps,
className: classes,
children,
ellipsizeMode: ellipsizeMode || finalEllipsizeMode
};
const truncateProps = useTruncate(finalComponentProps);
/**
* Enhance child `<Link />` components to inherit font size.
*/
if (!truncate && Array.isArray(children)) {
content = external_wp_element_["Children"].map(children, child => {
// @ts-ignore
if (!Object(external_lodash_["isPlainObject"])(child) || !('props' in child)) {
return child;
}
const isLink = Object(context_connect["b" /* hasConnectNamespace */])(child, ['Link']);
if (isLink) {
return Object(external_wp_element_["cloneElement"])(child, {
size: child.props.size || 'inherit'
});
}
return child;
});
}
return { ...truncateProps,
children: truncate ? truncateProps.children : content
};
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text/component.js
/**
* Internal dependencies
*/
/**
* `Text` is a core component that renders text in the library, using the
* library's typography system.
*
* `Text` can be used to render any text-content, like an HTML `p` or `span`.
*
* @example
*
* ```jsx
* import { __experimentalText as Text } from `@wordpress/components`;
*
* function Example() {
* return <Text>Code is Poetry</Text>;
* }
* ```
*/
const component_Text = create_component_createComponent({
as: 'span',
useHook: useText,
name: 'Text'
});
/* harmony default export */ var text_component = (component_Text);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/rtl.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const LOWER_LEFT_REGEXP = new RegExp(/-left/g);
const LOWER_RIGHT_REGEXP = new RegExp(/-right/g);
const UPPER_LEFT_REGEXP = new RegExp(/Left/g);
const UPPER_RIGHT_REGEXP = new RegExp(/Right/g);
/**
* Flips a CSS property from left <-> right.
*
* @param {string} key The CSS property name.
*
* @return {string} The flipped CSS property name, if applicable.
*/
function getConvertedKey(key) {
if (key === 'left') {
return 'right';
}
if (key === 'right') {
return 'left';
}
if (LOWER_LEFT_REGEXP.test(key)) {
return key.replace(LOWER_LEFT_REGEXP, '-right');
}
if (LOWER_RIGHT_REGEXP.test(key)) {
return key.replace(LOWER_RIGHT_REGEXP, '-left');
}
if (UPPER_LEFT_REGEXP.test(key)) {
return key.replace(UPPER_LEFT_REGEXP, 'Right');
}
if (UPPER_RIGHT_REGEXP.test(key)) {
return key.replace(UPPER_RIGHT_REGEXP, 'Left');
}
return key;
}
/**
* An incredibly basic ltr -> rtl converter for style properties
*
* @param {import('react').CSSProperties} ltrStyles
*
* @return {import('react').CSSProperties} Converted ltr -> rtl styles
*/
const convertLTRToRTL = (ltrStyles = {}) => {
return Object(external_lodash_["mapKeys"])(ltrStyles, (_value, key) => getConvertedKey(key));
};
/**
* A higher-order function that create an incredibly basic ltr -> rtl style converter for CSS objects.
*
* @param {import('react').CSSProperties} ltrStyles Ltr styles. Converts and renders from ltr -> rtl styles, if applicable.
* @param {import('react').CSSProperties} [rtlStyles] Rtl styles. Renders if provided.
*
* @return {Function} A function to output CSS styles for Emotion's renderer
*/
function rtl_rtl(ltrStyles = {}, rtlStyles) {
return () => {
if (rtlStyles) {
// @ts-ignore: `css` types are wrong, it can accept an object: https://emotion.sh/docs/object-styles#with-css
return Object(external_wp_i18n_["isRTL"])() ? /*#__PURE__*/css_browser_esm(rtlStyles, true ? "" : undefined) : /*#__PURE__*/css_browser_esm(ltrStyles, true ? "" : undefined);
} // @ts-ignore: `css` types are wrong, it can accept an object: https://emotion.sh/docs/object-styles#with-css
return Object(external_wp_i18n_["isRTL"])() ? /*#__PURE__*/css_browser_esm(convertLTRToRTL(ltrStyles), true ? "" : undefined) : /*#__PURE__*/css_browser_esm(ltrStyles, true ? "" : undefined);
};
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/styles/input-control-styles.js
function input_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
var input_control_styles_ref = true ? {
name: "1dacand",
styles: "padding-top:0;"
} : undefined;
const rootFloatLabelStyles = () => {
return input_control_styles_ref;
};
var input_control_styles_ref2 = true ? {
name: "r6z5ec",
styles: "z-index:1;"
} : undefined;
const rootFocusedStyles = ({
isFocused
}) => {
if (!isFocused) return '';
return input_control_styles_ref2;
};
var input_control_styles_ref3 = true ? {
name: "uz6002",
styles: "align-items:flex-start;flex-direction:column;"
} : undefined;
var input_control_styles_ref4 = true ? {
name: "53hdd7",
styles: "align-items:flex-start;flex-direction:column-reverse;"
} : undefined;
var input_control_styles_ref5 = true ? {
name: "x4dmss",
styles: "justify-content:space-between;"
} : undefined;
const rootLabelPositionStyles = ({
labelPosition
}) => {
switch (labelPosition) {
case 'top':
return input_control_styles_ref3;
case 'bottom':
return input_control_styles_ref4;
case 'edge':
return input_control_styles_ref5;
default:
return '';
}
};
const input_control_styles_Root = /*#__PURE__*/styled_base_browser_esm(flex_component, {
target: "e1cr7zh10",
label: "Root"
})("position:relative;border-radius:2px;", rootFloatLabelStyles, " ", rootFocusedStyles, " ", rootLabelPositionStyles, true ? "" : undefined);
const containerDisabledStyles = ({
disabled
}) => {
const backgroundColor = disabled ? COLORS.ui.backgroundDisabled : COLORS.ui.background;
return /*#__PURE__*/css_browser_esm({
backgroundColor
}, true ? "" : undefined);
}; // Normalizes the margins from the <Flex /> (components/ui/flex/) container.
var input_control_styles_ref6 = true ? {
name: "1ibawvu",
styles: "margin:0 !important;"
} : undefined;
const containerMarginStyles = ({
hideLabel
}) => {
return hideLabel ? input_control_styles_ref6 : null;
};
var input_control_styles_ref7 = true ? {
name: "8atqhb",
styles: "width:100%;"
} : undefined;
const containerWidthStyles = ({
__unstableInputWidth,
labelPosition
}) => {
if (!__unstableInputWidth) return input_control_styles_ref7;
if (labelPosition === 'side') return '';
if (labelPosition === 'edge') {
return /*#__PURE__*/css_browser_esm({
flex: `0 0 ${__unstableInputWidth}`
}, true ? "" : undefined);
}
return /*#__PURE__*/css_browser_esm({
width: __unstableInputWidth
}, true ? "" : undefined);
};
const Container = styled_base_browser_esm("div", {
target: "e1cr7zh11",
label: "Container"
})("align-items:center;box-sizing:border-box;border-radius:inherit;display:flex;flex:1;position:relative;", containerDisabledStyles, " ", containerMarginStyles, " ", containerWidthStyles, true ? "" : undefined);
const disabledStyles = ({
disabled
}) => {
if (!disabled) return '';
return /*#__PURE__*/css_browser_esm({
color: COLORS.ui.textDisabled
}, true ? "" : undefined);
};
const fontSizeStyles = ({
size
}) => {
const sizes = {
default: '13px',
small: '11px'
};
const fontSize = sizes[size];
const fontSizeMobile = '16px';
if (!fontSize) return '';
return /*#__PURE__*/css_browser_esm("font-size:", fontSizeMobile, ";@media ( min-width:600px ){font-size:", fontSize, ";}" + ( true ? "" : undefined));
};
const sizeStyles = ({
size
}) => {
const sizes = {
default: {
height: 30,
lineHeight: 1,
minHeight: 30
},
small: {
height: 24,
lineHeight: 1,
minHeight: 24
}
};
const style = sizes[size] || sizes.default;
return /*#__PURE__*/css_browser_esm(style, true ? "" : undefined);
};
var input_control_styles_ref8 = true ? {
name: "103r1kr",
styles: "&::-webkit-input-placeholder{line-height:normal;}"
} : undefined;
const placeholderStyles = () => {
return input_control_styles_ref8;
};
const dragStyles = ({
isDragging,
dragCursor
}) => {
let defaultArrowStyles = '';
let activeDragCursorStyles = '';
if (isDragging) {
defaultArrowStyles = /*#__PURE__*/css_browser_esm("cursor:", dragCursor, ";user-select:none;&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none !important;margin:0 !important;}" + ( true ? "" : undefined));
}
if (isDragging && dragCursor) {
activeDragCursorStyles = /*#__PURE__*/css_browser_esm("&:active{cursor:", dragCursor, ";}" + ( true ? "" : undefined));
}
return /*#__PURE__*/css_browser_esm(defaultArrowStyles, " ", activeDragCursorStyles, true ? "" : undefined);
}; // TODO: Resolve need to use &&& to increase specificity
// https://github.com/WordPress/gutenberg/issues/18483
const input_control_styles_Input = styled_base_browser_esm("input", {
target: "e1cr7zh12",
label: "Input"
})("&&&{background-color:transparent;box-sizing:border-box;border:none;box-shadow:none !important;color:", COLORS.black, ";display:block;margin:0;outline:none;padding-left:8px;padding-right:8px;width:100%;", dragStyles, " ", disabledStyles, " ", fontSizeStyles, " ", sizeStyles, " ", placeholderStyles, "}" + ( true ? "" : undefined));
var input_control_styles_ref9 = true ? {
name: "8uhtka",
styles: "overflow:hidden;text-overflow:ellipsis;white-space:nowrap;"
} : undefined;
const labelTruncation = () => {
return input_control_styles_ref9;
};
const labelPadding = ({
labelPosition
}) => {
let paddingBottom = 4;
if (labelPosition === 'edge' || labelPosition === 'side') {
paddingBottom = 0;
}
return /*#__PURE__*/css_browser_esm({
paddingTop: 0,
paddingBottom
}, true ? "" : undefined);
};
const BaseLabel = /*#__PURE__*/styled_base_browser_esm(text_component, {
target: "e1cr7zh13",
label: "BaseLabel"
})("&&&{box-sizing:border-box;color:currentColor;display:block;margin:0;max-width:100%;z-index:1;", labelPadding, " ", labelTruncation, "}" + ( true ? "" : undefined));
const Label = props => Object(external_wp_element_["createElement"])(BaseLabel, Object(esm_extends["a" /* default */])({}, props, {
as: "label"
}));
const LabelWrapper = /*#__PURE__*/styled_base_browser_esm(flex_item_component, {
target: "e1cr7zh14",
label: "LabelWrapper"
})( true ? {
name: "120o8im",
styles: "max-width:calc( 100% - 10px );"
} : undefined);
const backdropFocusedStyles = ({
disabled,
isFocused
}) => {
let borderColor = isFocused ? COLORS.ui.borderFocus : COLORS.ui.border;
let boxShadow = null;
if (isFocused) {
boxShadow = `0 0 0 1px ${COLORS.ui.borderFocus} inset`;
}
if (disabled) {
borderColor = COLORS.ui.borderDisabled;
}
return /*#__PURE__*/css_browser_esm({
boxShadow,
borderColor,
borderStyle: 'solid',
borderWidth: 1
}, true ? "" : undefined);
};
const BackdropUI = styled_base_browser_esm("div", {
target: "e1cr7zh15",
label: "BackdropUI"
})("&&&{box-sizing:border-box;border-radius:inherit;bottom:0;left:0;margin:0;padding:0;pointer-events:none;position:absolute;right:0;top:0;", backdropFocusedStyles, " ", rtl_rtl({
paddingLeft: 2
}), "}" + ( true ? "" : undefined));
const Prefix = styled_base_browser_esm("span", {
target: "e1cr7zh16",
label: "Prefix"
})( true ? {
name: "1pxuk39",
styles: "box-sizing:border-box;display:block;"
} : undefined);
const Suffix = styled_base_browser_esm("span", {
target: "e1cr7zh17",
label: "Suffix"
})( true ? {
name: "1pxuk39",
styles: "box-sizing:border-box;display:block;"
} : undefined);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/backdrop.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Backdrop({
disabled = false,
isFocused = false
}) {
return Object(external_wp_element_["createElement"])(BackdropUI, {
"aria-hidden": "true",
className: "components-input-control__backdrop",
disabled: disabled,
isFocused: isFocused
});
}
const MemoizedBackdrop = Object(external_wp_element_["memo"])(Backdrop);
/* harmony default export */ var backdrop = (MemoizedBackdrop);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/label.js
/**
* Internal dependencies
*/
function label_Label({
children,
hideLabelFromVision,
htmlFor,
...props
}) {
if (!children) return null;
if (hideLabelFromVision) {
return Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], {
as: "label",
htmlFor: htmlFor
}, children);
}
return Object(external_wp_element_["createElement"])(Label, Object(esm_extends["a" /* default */])({
htmlFor: htmlFor
}, props), children);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/input-base.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useUniqueId(idProp) {
const instanceId = Object(external_wp_compose_["useInstanceId"])(InputBase);
const id = `input-base-control-${instanceId}`;
return idProp || id;
} // Adapter to map props for the new ui/flex compopnent.
function getUIFlexProps({
labelPosition
}) {
const props = {};
switch (labelPosition) {
case 'top':
props.direction = 'column';
props.gap = 0;
break;
case 'bottom':
props.direction = 'column-reverse';
props.gap = 0;
break;
case 'edge':
props.justify = 'space-between';
break;
}
return props;
}
function InputBase({
__unstableInputWidth,
children,
className,
disabled = false,
hideLabelFromVision = false,
labelPosition,
id: idProp,
isFocused = false,
label,
prefix,
size = 'default',
suffix,
...props
}, ref) {
const id = useUniqueId(idProp);
const hideLabel = hideLabelFromVision || !label;
return Object(external_wp_element_["createElement"])(input_control_styles_Root, Object(esm_extends["a" /* default */])({}, props, getUIFlexProps({
labelPosition
}), {
className: className,
isFocused: isFocused,
labelPosition: labelPosition,
ref: ref,
__unstableVersion: "next"
}), Object(external_wp_element_["createElement"])(LabelWrapper, null, Object(external_wp_element_["createElement"])(label_Label, {
className: "components-input-control__label",
hideLabelFromVision: hideLabelFromVision,
labelPosition: labelPosition,
htmlFor: id,
size: size
}, label)), Object(external_wp_element_["createElement"])(Container, {
__unstableInputWidth: __unstableInputWidth,
className: "components-input-control__container",
disabled: disabled,
hideLabel: hideLabel,
isFocused: isFocused,
labelPosition: labelPosition
}, prefix && Object(external_wp_element_["createElement"])(Prefix, {
className: "components-input-control__prefix"
}, prefix), children, suffix && Object(external_wp_element_["createElement"])(Suffix, {
className: "components-input-control__suffix"
}, suffix), Object(external_wp_element_["createElement"])(backdrop, {
"aria-hidden": "true",
disabled: disabled,
isFocused: isFocused,
label: label,
size: size
})));
}
/* harmony default export */ var input_base = (Object(external_wp_element_["forwardRef"])(InputBase));
// CONCATENATED MODULE: ./node_modules/react-use-gesture/dist/reactusegesture.esm.js
// vector add
function addV(v1, v2) {
return v1.map(function (v, i) {
return v + v2[i];
});
} // vector substract
function subV(v1, v2) {
return v1.map(function (v, i) {
return v - v2[i];
});
}
/**
* Calculates distance
* @param movement the difference between current and initial vectors
* @returns distance
*/
function calculateDistance(movement) {
return Math.hypot.apply(Math, movement);
}
function calculateAllGeometry(movement, delta) {
if (delta === void 0) {
delta = movement;
}
var dl = calculateDistance(delta);
var alpha = dl === 0 ? 0 : 1 / dl;
var direction = delta.map(function (v) {
return alpha * v;
});
var distance = calculateDistance(movement);
return {
distance: distance,
direction: direction
};
}
/**
* Calculates all kinematics
* @template T the expected vector type
* @param movement the difference between current and initial vectors
* @param delta the difference between current and previous vectors
* @param delta_t the time difference between current and previous timestamps
* @returns all kinematics
*/
function calculateAllKinematics(movement, delta, dt) {
var dl = calculateDistance(delta);
var alpha = dl === 0 ? 0 : 1 / dl;
var beta = dt === 0 ? 0 : 1 / dt;
var velocity = beta * dl;
var velocities = delta.map(function (v) {
return beta * v;
});
var direction = delta.map(function (v) {
return alpha * v;
});
var distance = calculateDistance(movement);
return {
velocities: velocities,
velocity: velocity,
distance: distance,
direction: direction
};
}
/**
* Because IE doesn't support `Math.sign` function, so we use the polyfill version of the function.
* This polyfill function is suggested by Mozilla:
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Math/sign#Polyfill
* @param x target number
*/
function sign(x) {
if (Math.sign) return Math.sign(x);
return Number(x > 0) - Number(x < 0) || +x;
}
function minMax(value, min, max) {
return Math.max(min, Math.min(value, max));
} // Based on @aholachek ;)
// https://twitter.com/chpwn/status/285540192096497664
// iOS constant = 0.55
// https://medium.com/@nathangitter/building-fluid-interfaces-ios-swift-9732bb934bf5
function rubberband2(distance, constant) {
// default constant from the article is 0.7
return Math.pow(distance, constant * 5);
}
function rubberband(distance, dimension, constant) {
if (dimension === 0 || Math.abs(dimension) === Infinity) return rubberband2(distance, constant);
return distance * dimension * constant / (dimension + constant * distance);
}
function rubberbandIfOutOfBounds(position, min, max, constant) {
if (constant === void 0) {
constant = 0.15;
}
if (constant === 0) return minMax(position, min, max);
if (position < min) return -rubberband(min - position, max - min, constant) + min;
if (position > max) return +rubberband(position - max, max - min, constant) + max;
return position;
}
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
function reactusegesture_esm_inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
subClass.__proto__ = superClass;
}
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
function _assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
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);
}
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;
}
function _createForOfIteratorHelperLoose(o, allowArrayLike) {
var it;
if (typeof Symbol === "undefined" || o[Symbol.iterator] == null) {
if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === "number") {
if (it) o = it;
var i = 0;
return function () {
if (i >= o.length) return {
done: true
};
return {
done: false,
value: o[i++]
};
};
}
throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
}
it = o[Symbol.iterator]();
return it.next.bind(it);
}
function noop() {}
/**
* TODO Beware that only optimized cases are covered in tests =)
* TODO Need to cover general case as well
*
* @param fns
*/
function chainFns() {
for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {
fns[_key] = arguments[_key];
}
if (fns.length === 0) return noop;
if (fns.length === 1) return fns[0];
return function () {
var result;
for (var _iterator = _createForOfIteratorHelperLoose(fns), _step; !(_step = _iterator()).done;) {
var fn = _step.value;
result = fn.apply(this, arguments) || result;
}
return result;
};
}
/**
* Expects a simple value or 2D vector (an array with 2 elements) and
* always returns 2D vector. If simple value is passed, returns a
* vector with this value as both coordinates.
*
* @param value
*/
function ensureVector(value, fallback) {
if (value === undefined) {
if (fallback === undefined) {
throw new Error('Must define fallback value if undefined is expected');
}
value = fallback;
}
if (Array.isArray(value)) return value;
return [value, value];
}
/**
* Helper for defining a default value
*
* @param value
* @param fallback
*/
function assignDefault(value, fallback) {
return Object.assign({}, fallback, value || {});
}
/**
* Resolves getters (functions) by calling them
* If simple value is given it just passes through
*
* @param v
*/
function valueFn(v) {
if (typeof v === 'function') {
for (var _len2 = arguments.length, args = new Array(_len2 > 1 ? _len2 - 1 : 0), _key2 = 1; _key2 < _len2; _key2++) {
args[_key2 - 1] = arguments[_key2];
}
// @ts-ignore
return v.apply(void 0, args);
} else {
return v;
}
}
function resolveWith(config, resolvers) {
if (config === void 0) {
config = {};
}
var result = {};
for (var _i = 0, _Object$entries = Object.entries(resolvers); _i < _Object$entries.length; _i++) {
var _Object$entries$_i = _Object$entries[_i],
key = _Object$entries$_i[0],
resolver = _Object$entries$_i[1];
switch (typeof resolver) {
case 'function':
result[key] = resolver.call(result, config[key], key, config);
break;
case 'object':
result[key] = resolveWith(config[key], resolver);
break;
case 'boolean':
if (resolver) result[key] = config[key];
break;
}
}
return result;
}
/**
* Whether the browser supports GestureEvent (ie Safari)
* @returns true if the browser supports gesture event
*/
function supportsGestureEvents() {
try {
// TODO [TS] possibly find GestureEvent definitions?
// @ts-ignore: no type definitions for webkit GestureEvents
return 'constructor' in GestureEvent;
} catch (e) {
return false;
}
}
function supportsTouchEvents() {
return typeof window !== 'undefined' && 'ontouchstart' in window;
}
function supportsPointerEvents() {
return typeof window !== 'undefined' && 'onpointerdown' in window;
}
function getEventTouches(event) {
if ('pointerId' in event) return null;
return event.type === 'touchend' ? event.changedTouches : event.targetTouches;
}
function getTouchIds(event) {
return Array.from(getEventTouches(event)).map(function (t) {
return t.identifier;
});
}
function getGenericEventData(event) {
var buttons = 'buttons' in event ? event.buttons : 0;
var shiftKey = event.shiftKey,
altKey = event.altKey,
metaKey = event.metaKey,
ctrlKey = event.ctrlKey; // TODO check if this might create some overrides?
return {
buttons: buttons,
shiftKey: shiftKey,
altKey: altKey,
metaKey: metaKey,
ctrlKey: ctrlKey
};
}
var identity = function identity(xy) {
return xy;
};
/**
* Gets pointer event values.
* @param event
* @returns pointer event values
*/
function getPointerEventValues(event, transform) {
if (transform === void 0) {
transform = identity;
}
var touchEvents = getEventTouches(event);
var _ref = touchEvents ? touchEvents[0] : event,
clientX = _ref.clientX,
clientY = _ref.clientY;
return transform([clientX, clientY]);
}
/**
* Gets two touches event data
* @param event
* @returns two touches event data
*/
function getTwoTouchesEventValues(event, pointerIds, transform) {
if (transform === void 0) {
transform = identity;
}
var _Array$from$filter = Array.from(event.touches).filter(function (t) {
return pointerIds.includes(t.identifier);
}),
A = _Array$from$filter[0],
B = _Array$from$filter[1];
if (!A || !B) throw Error("The event doesn't have two pointers matching the pointerIds");
var dx = B.clientX - A.clientX;
var dy = B.clientY - A.clientY;
var cx = (B.clientX + A.clientX) / 2;
var cy = (B.clientY + A.clientY) / 2; // const e: any = 'nativeEvent' in event ? event.nativeEvent : event
var distance = Math.hypot(dx, dy); // FIXME rotation has inconsistant values so we're not using it atm
// const angle = (e.rotation as number) ?? -(Math.atan2(dx, dy) * 180) / Math.PI
var angle = -(Math.atan2(dx, dy) * 180) / Math.PI;
var values = transform([distance, angle]);
var origin = transform([cx, cy]);
return {
values: values,
origin: origin
};
}
/**
* Gets scroll event values
* @param event
* @returns scroll event values
*/
function getScrollEventValues(event, transform) {
if (transform === void 0) {
transform = identity;
}
// If the currentTarget is the window then we return the scrollX/Y position.
// If not (ie the currentTarget is a DOM element), then we return scrollLeft/Top
var _event$currentTarget = event.currentTarget,
scrollX = _event$currentTarget.scrollX,
scrollY = _event$currentTarget.scrollY,
scrollLeft = _event$currentTarget.scrollLeft,
scrollTop = _event$currentTarget.scrollTop;
return transform([scrollX || scrollLeft || 0, scrollY || scrollTop || 0]);
} // wheel delta defaults from https://github.com/facebookarchive/fixed-data-table/blob/master/src/vendor_upstream/dom/normalizeWheel.js
var LINE_HEIGHT = 40;
var PAGE_HEIGHT = 800;
/**
* Gets wheel event values.
* @param event
* @returns wheel event values
*/
function getWheelEventValues(event, transform) {
if (transform === void 0) {
transform = identity;
}
var deltaX = event.deltaX,
deltaY = event.deltaY,
deltaMode = event.deltaMode; // normalize wheel values, especially for Firefox
if (deltaMode === 1) {
deltaX *= LINE_HEIGHT;
deltaY *= LINE_HEIGHT;
} else if (deltaMode === 2) {
deltaX *= PAGE_HEIGHT;
deltaY *= PAGE_HEIGHT;
}
return transform([deltaX, deltaY]);
}
/**
* Gets webkit gesture event values.
* @param event
* @returns webkit gesture event values
*/
function getWebkitGestureEventValues(event, transform) {
if (transform === void 0) {
transform = identity;
}
return transform([event.scale, event.rotation]);
}
var DEFAULT_DRAG_DELAY = 180;
var DEFAULT_RUBBERBAND = 0.15;
var DEFAULT_SWIPE_VELOCITY = 0.5;
var DEFAULT_SWIPE_DISTANCE = 50;
var DEFAULT_SWIPE_DURATION = 250;
var InternalGestureOptionsNormalizers = {
threshold: function threshold(value) {
if (value === void 0) {
value = 0;
}
return ensureVector(value);
},
rubberband: function rubberband(value) {
if (value === void 0) {
value = 0;
}
switch (value) {
case true:
return ensureVector(DEFAULT_RUBBERBAND);
case false:
return ensureVector(0);
default:
return ensureVector(value);
}
},
enabled: function enabled(value) {
if (value === void 0) {
value = true;
}
return value;
},
triggerAllEvents: function triggerAllEvents(value) {
if (value === void 0) {
value = false;
}
return value;
},
initial: function initial(value) {
if (value === void 0) {
value = 0;
}
if (typeof value === 'function') return value;
return ensureVector(value);
},
transform: true
};
var InternalCoordinatesOptionsNormalizers = /*#__PURE__*/_extends({}, InternalGestureOptionsNormalizers, {
axis: true,
lockDirection: function lockDirection(value) {
if (value === void 0) {
value = false;
}
return value;
},
bounds: function bounds(value) {
if (value === void 0) {
value = {};
}
if (typeof value === 'function') return function (state) {
return InternalCoordinatesOptionsNormalizers.bounds(value(state));
};
var _value2 = value,
_value2$left = _value2.left,
left = _value2$left === void 0 ? -Infinity : _value2$left,
_value2$right = _value2.right,
right = _value2$right === void 0 ? Infinity : _value2$right,
_value2$top = _value2.top,
top = _value2$top === void 0 ? -Infinity : _value2$top,
_value2$bottom = _value2.bottom,
bottom = _value2$bottom === void 0 ? Infinity : _value2$bottom;
return [[left, right], [top, bottom]];
}
});
var isBrowser = typeof window !== 'undefined' && window.document && window.document.createElement;
var InternalGenericOptionsNormalizers = {
enabled: function enabled(value) {
if (value === void 0) {
value = true;
}
return value;
},
domTarget: true,
window: /*#__PURE__*/function (_window) {
function window(_x) {
return _window.apply(this, arguments);
}
window.toString = function () {
return _window.toString();
};
return window;
}(function (value) {
if (value === void 0) {
value = isBrowser ? window : undefined;
}
return value;
}),
eventOptions: function eventOptions(_temp) {
var _ref = _temp === void 0 ? {} : _temp,
_ref$passive = _ref.passive,
passive = _ref$passive === void 0 ? true : _ref$passive,
_ref$capture = _ref.capture,
capture = _ref$capture === void 0 ? false : _ref$capture;
return {
passive: passive,
capture: capture
};
},
transform: true
};
var InternalDistanceAngleOptionsNormalizers = /*#__PURE__*/_extends({}, InternalGestureOptionsNormalizers, {
bounds: function bounds(_value, _key, _ref2) {
var _ref2$distanceBounds = _ref2.distanceBounds,
distanceBounds = _ref2$distanceBounds === void 0 ? {} : _ref2$distanceBounds,
_ref2$angleBounds = _ref2.angleBounds,
angleBounds = _ref2$angleBounds === void 0 ? {} : _ref2$angleBounds;
var _distanceBounds = function _distanceBounds(state) {
var D = assignDefault(valueFn(distanceBounds, state), {
min: -Infinity,
max: Infinity
});
return [D.min, D.max];
};
var _angleBounds = function _angleBounds(state) {
var A = assignDefault(valueFn(angleBounds, state), {
min: -Infinity,
max: Infinity
});
return [A.min, A.max];
};
if (typeof distanceBounds !== 'function' && typeof angleBounds !== 'function') return [_distanceBounds(), _angleBounds()];
return function (state) {
return [_distanceBounds(state), _angleBounds(state)];
};
}
});
var InternalDragOptionsNormalizers = /*#__PURE__*/_extends({}, InternalCoordinatesOptionsNormalizers, {
useTouch: function useTouch(value) {
if (value === void 0) {
value = false;
}
var supportsTouch = supportsTouchEvents();
var supportsPointer = supportsPointerEvents();
if (value && supportsTouch) return true;
if (supportsTouch && !supportsPointer) return true;
return false;
},
experimental_preventWindowScrollY: function experimental_preventWindowScrollY(value) {
if (value === void 0) {
value = false;
}
return value;
},
threshold: function threshold(v, _k, _ref3) {
var _ref3$filterTaps = _ref3.filterTaps,
filterTaps = _ref3$filterTaps === void 0 ? false : _ref3$filterTaps,
_ref3$lockDirection = _ref3.lockDirection,
lockDirection = _ref3$lockDirection === void 0 ? false : _ref3$lockDirection,
_ref3$axis = _ref3.axis,
axis = _ref3$axis === void 0 ? undefined : _ref3$axis;
var A = ensureVector(v, filterTaps ? 3 : lockDirection ? 1 : axis ? 1 : 0);
this.filterTaps = filterTaps;
return A;
},
swipeVelocity: function swipeVelocity(v) {
if (v === void 0) {
v = DEFAULT_SWIPE_VELOCITY;
}
return ensureVector(v);
},
swipeDistance: function swipeDistance(v) {
if (v === void 0) {
v = DEFAULT_SWIPE_DISTANCE;
}
return ensureVector(v);
},
swipeDuration: function swipeDuration(value) {
if (value === void 0) {
value = DEFAULT_SWIPE_DURATION;
}
return value;
},
delay: function delay(value) {
if (value === void 0) {
value = 0;
}
switch (value) {
case true:
return DEFAULT_DRAG_DELAY;
case false:
return 0;
default:
return value;
}
}
});
function getInternalGenericOptions(config) {
if (config === void 0) {
config = {};
}
// TODO warn when passive is set to true and domTarget is undefined
return resolveWith(config, InternalGenericOptionsNormalizers);
}
function getInternalCoordinatesOptions(config) {
if (config === void 0) {
config = {};
}
return resolveWith(config, InternalCoordinatesOptionsNormalizers);
}
function getInternalDistanceAngleOptions(config) {
if (config === void 0) {
config = {};
}
return resolveWith(config, InternalDistanceAngleOptionsNormalizers);
}
function getInternalDragOptions(config) {
if (config === void 0) {
config = {};
}
return resolveWith(config, InternalDragOptionsNormalizers);
}
function _buildMoveConfig(_ref) {
var domTarget = _ref.domTarget,
eventOptions = _ref.eventOptions,
window = _ref.window,
enabled = _ref.enabled,
rest = _objectWithoutPropertiesLoose(_ref, ["domTarget", "eventOptions", "window", "enabled"]);
var opts = getInternalGenericOptions({
domTarget: domTarget,
eventOptions: eventOptions,
window: window,
enabled: enabled
});
opts.move = getInternalCoordinatesOptions(rest);
return opts;
}
function _buildHoverConfig(_ref2) {
var domTarget = _ref2.domTarget,
eventOptions = _ref2.eventOptions,
window = _ref2.window,
enabled = _ref2.enabled,
rest = _objectWithoutPropertiesLoose(_ref2, ["domTarget", "eventOptions", "window", "enabled"]);
var opts = getInternalGenericOptions({
domTarget: domTarget,
eventOptions: eventOptions,
window: window,
enabled: enabled
});
opts.hover = _extends({
enabled: true
}, rest);
return opts;
}
function _buildDragConfig(_ref3) {
var domTarget = _ref3.domTarget,
eventOptions = _ref3.eventOptions,
window = _ref3.window,
enabled = _ref3.enabled,
rest = _objectWithoutPropertiesLoose(_ref3, ["domTarget", "eventOptions", "window", "enabled"]);
var opts = getInternalGenericOptions({
domTarget: domTarget,
eventOptions: eventOptions,
window: window,
enabled: enabled
});
opts.drag = getInternalDragOptions(rest);
return opts;
}
function _buildPinchConfig(_ref4) {
var domTarget = _ref4.domTarget,
eventOptions = _ref4.eventOptions,
window = _ref4.window,
enabled = _ref4.enabled,
rest = _objectWithoutPropertiesLoose(_ref4, ["domTarget", "eventOptions", "window", "enabled"]);
var opts = getInternalGenericOptions({
domTarget: domTarget,
eventOptions: eventOptions,
window: window,
enabled: enabled
});
opts.pinch = getInternalDistanceAngleOptions(rest);
return opts;
}
function _buildScrollConfig(_ref5) {
var domTarget = _ref5.domTarget,
eventOptions = _ref5.eventOptions,
window = _ref5.window,
enabled = _ref5.enabled,
rest = _objectWithoutPropertiesLoose(_ref5, ["domTarget", "eventOptions", "window", "enabled"]);
var opts = getInternalGenericOptions({
domTarget: domTarget,
eventOptions: eventOptions,
window: window,
enabled: enabled
});
opts.scroll = getInternalCoordinatesOptions(rest);
return opts;
}
function _buildWheelConfig(_ref6) {
var domTarget = _ref6.domTarget,
eventOptions = _ref6.eventOptions,
window = _ref6.window,
enabled = _ref6.enabled,
rest = _objectWithoutPropertiesLoose(_ref6, ["domTarget", "eventOptions", "window", "enabled"]);
var opts = getInternalGenericOptions({
domTarget: domTarget,
eventOptions: eventOptions,
window: window,
enabled: enabled
});
opts.wheel = getInternalCoordinatesOptions(rest);
return opts;
}
function buildComplexConfig(config, actions) {
if (config === void 0) {
config = {};
}
if (actions === void 0) {
actions = new Set();
}
var _config = config,
drag = _config.drag,
wheel = _config.wheel,
move = _config.move,
scroll = _config.scroll,
pinch = _config.pinch,
hover = _config.hover,
eventOptions = _config.eventOptions,
window = _config.window,
transform = _config.transform,
domTarget = _config.domTarget,
enabled = _config.enabled;
var mergedConfig = getInternalGenericOptions({
domTarget: domTarget,
eventOptions: eventOptions,
transform: transform,
window: window,
enabled: enabled
});
if (actions.has('onDrag')) mergedConfig.drag = getInternalDragOptions(drag);
if (actions.has('onWheel')) mergedConfig.wheel = getInternalCoordinatesOptions(wheel);
if (actions.has('onScroll')) mergedConfig.scroll = getInternalCoordinatesOptions(scroll);
if (actions.has('onMove')) mergedConfig.move = getInternalCoordinatesOptions(move);
if (actions.has('onPinch')) mergedConfig.pinch = getInternalDistanceAngleOptions(pinch);
if (actions.has('onHover')) mergedConfig.hover = _extends({
enabled: true
}, hover);
return mergedConfig;
}
function getInitial(mixed) {
return _extends({
_active: false,
_blocked: false,
_intentional: [false, false],
_movement: [0, 0],
_initial: [0, 0],
_bounds: [[-Infinity, Infinity], [-Infinity, Infinity]],
_threshold: [0, 0],
_lastEventType: undefined,
_dragStarted: false,
_dragPreventScroll: false,
_dragIsTap: true,
_dragDelayed: false,
event: undefined,
intentional: false,
values: [0, 0],
velocities: [0, 0],
delta: [0, 0],
movement: [0, 0],
offset: [0, 0],
lastOffset: [0, 0],
direction: [0, 0],
initial: [0, 0],
previous: [0, 0],
first: false,
last: false,
active: false,
timeStamp: 0,
startTime: 0,
elapsedTime: 0,
cancel: noop,
canceled: false,
memo: undefined,
args: undefined
}, mixed);
}
function getInitialState() {
var shared = {
hovering: false,
scrolling: false,
wheeling: false,
dragging: false,
moving: false,
pinching: false,
touches: 0,
buttons: 0,
down: false,
shiftKey: false,
altKey: false,
metaKey: false,
ctrlKey: false,
locked: false
};
var drag = getInitial({
_pointerId: undefined,
axis: undefined,
xy: [0, 0],
vxvy: [0, 0],
velocity: 0,
distance: 0,
tap: false,
swipe: [0, 0]
});
var pinch = getInitial({
// @ts-expect-error when used _pointerIds we can assert its type will be [number, number]
_pointerIds: [],
da: [0, 0],
vdva: [0, 0],
// @ts-expect-error origin can never be passed as undefined in userland
origin: undefined,
turns: 0
});
var wheel = getInitial({
axis: undefined,
xy: [0, 0],
vxvy: [0, 0],
velocity: 0,
distance: 0
});
var move = getInitial({
axis: undefined,
xy: [0, 0],
vxvy: [0, 0],
velocity: 0,
distance: 0
});
var scroll = getInitial({
axis: undefined,
xy: [0, 0],
vxvy: [0, 0],
velocity: 0,
distance: 0
});
return {
shared: shared,
drag: drag,
pinch: pinch,
wheel: wheel,
move: move,
scroll: scroll
};
}
var RecognizersMap = /*#__PURE__*/new Map();
var identity$1 = function identity(xy) {
return xy;
};
/**
* @private
* Recognizer abstract class.
*/
var Recognizer = /*#__PURE__*/function () {
/**
* Creates an instance of a gesture recognizer.
* @param stateKey drag, move, pinch, etc.
* @param controller the controller attached to the gesture
* @param [args] the args that should be passed to the gesture handler
*/
function Recognizer(controller, args) {
var _this = this;
if (args === void 0) {
args = [];
}
this.controller = controller;
this.args = args;
this.debounced = true; // Convenience method to set a timeout for a given gesture
this.setTimeout = function (callback, ms) {
var _window;
if (ms === void 0) {
ms = 140;
}
clearTimeout(_this.controller.timeouts[_this.stateKey]);
for (var _len = arguments.length, args = new Array(_len > 2 ? _len - 2 : 0), _key = 2; _key < _len; _key++) {
args[_key - 2] = arguments[_key];
}
_this.controller.timeouts[_this.stateKey] = (_window = window).setTimeout.apply(_window, [callback, ms].concat(args));
}; // Convenience method to clear a timeout for a given gesture
this.clearTimeout = function () {
clearTimeout(_this.controller.timeouts[_this.stateKey]);
};
/**
* Fires the gesture handler
*/
this.fireGestureHandler = function (forceFlag) {
if (forceFlag === void 0) {
forceFlag = false;
}
/**
* If the gesture has been blocked (this can happen when the gesture has started in an unwanted direction),
* clean everything and don't do anything.
*/
if (_this.state._blocked) {
// we need debounced gestures to end by themselves
if (!_this.debounced) {
_this.state._active = false;
_this.clean();
}
return null;
} // If the gesture has no intentional dimension, don't fire the handler.
if (!forceFlag && !_this.state.intentional && !_this.config.triggerAllEvents) return null;
if (_this.state.intentional) {
var prev_active = _this.state.active;
var next_active = _this.state._active;
_this.state.active = next_active;
_this.state.first = next_active && !prev_active;
_this.state.last = prev_active && !next_active;
_this.controller.state.shared[_this.ingKey] = next_active; // Sets dragging, pinching, etc. to the gesture active state
}
var touches = _this.controller.pointerIds.size || _this.controller.touchIds.size;
var down = _this.controller.state.shared.buttons > 0 || touches > 0;
var state = _extends({}, _this.controller.state.shared, _this.state, _this.mapStateValues(_this.state), {
locked: !!document.pointerLockElement,
touches: touches,
down: down
}); // @ts-expect-error
var newMemo = _this.handler(state); // Sets memo to the returned value of the handler (unless it's not undefined)
_this.state.memo = newMemo !== void 0 ? newMemo : _this.state.memo;
return state;
};
this.controller = controller;
this.args = args;
} // Returns the gesture config
var _proto = Recognizer.prototype;
// Convenience method to update the shared state
_proto.updateSharedState = function updateSharedState(sharedState) {
Object.assign(this.controller.state.shared, sharedState);
} // Convenience method to update the gesture state
;
_proto.updateGestureState = function updateGestureState(gestureState) {
Object.assign(this.state, gestureState);
}
/**
* Returns state properties depending on the movement and state.
*
* Should be overriden for custom behavior, doesn't do anything in the implementation
* below.
*/
;
_proto.checkIntentionality = function checkIntentionality(_intentional, _movement) {
return {
_intentional: _intentional,
_blocked: false
};
}
/**
* Returns basic movement properties for the gesture based on the next values and current state.
*/
;
_proto.getMovement = function getMovement(values) {
var rubberband = this.config.rubberband;
var _this$state = this.state,
_bounds = _this$state._bounds,
_initial = _this$state._initial,
_active = _this$state._active,
wasIntentional = _this$state._intentional,
lastOffset = _this$state.lastOffset,
prevMovement = _this$state.movement,
_T = _this$state._threshold;
var M = this.getInternalMovement(values, this.state);
var i0 = wasIntentional[0] === false ? getIntentionalDisplacement(M[0], _T[0]) : wasIntentional[0];
var i1 = wasIntentional[1] === false ? getIntentionalDisplacement(M[1], _T[1]) : wasIntentional[1]; // Get gesture specific state properties based on intentionality and movement.
var intentionalityCheck = this.checkIntentionality([i0, i1], M);
if (intentionalityCheck._blocked) {
return _extends({}, intentionalityCheck, {
_movement: M,
delta: [0, 0]
});
}
var _intentional = intentionalityCheck._intentional;
var _movement = M;
/**
* The movement sent to the handler has 0 in its dimensions when intentionality is false.
* It is calculated from the actual movement minus the threshold.
*/
var movement = [_intentional[0] !== false ? M[0] - _intentional[0] : 0, _intentional[1] !== false ? M[1] - _intentional[1] : 0];
var offset = addV(movement, lastOffset);
/**
* Rubberband should be 0 when the gesture is no longer active, so that movement
* and offset can return within their bounds.
*/
var _rubberband = _active ? rubberband : [0, 0];
movement = computeRubberband(_bounds, addV(movement, _initial), _rubberband);
return _extends({}, intentionalityCheck, {
intentional: _intentional[0] !== false || _intentional[1] !== false,
_initial: _initial,
_movement: _movement,
movement: movement,
values: values,
offset: computeRubberband(_bounds, offset, _rubberband),
delta: subV(movement, prevMovement)
});
} // Cleans the gesture. Can be overriden by gestures.
;
_proto.clean = function clean() {
this.clearTimeout();
};
_createClass(Recognizer, [{
key: "config",
get: function get() {
return this.controller.config[this.stateKey];
} // Is the gesture enabled
}, {
key: "enabled",
get: function get() {
return this.controller.config.enabled && this.config.enabled;
} // Returns the controller state for a given gesture
}, {
key: "state",
get: function get() {
return this.controller.state[this.stateKey];
} // Returns the gesture handler
}, {
key: "handler",
get: function get() {
return this.controller.handlers[this.stateKey];
}
}, {
key: "transform",
get: function get() {
return this.config.transform || this.controller.config.transform || identity$1;
}
}]);
return Recognizer;
}(); //--------------------------------------------
function getIntentionalDisplacement(movement, threshold) {
if (Math.abs(movement) >= threshold) {
return sign(movement) * threshold;
} else {
return false;
}
}
function computeRubberband(bounds, _ref, _ref2) {
var Vx = _ref[0],
Vy = _ref[1];
var Rx = _ref2[0],
Ry = _ref2[1];
var _bounds$ = bounds[0],
X1 = _bounds$[0],
X2 = _bounds$[1],
_bounds$2 = bounds[1],
Y1 = _bounds$2[0],
Y2 = _bounds$2[1];
return [rubberbandIfOutOfBounds(Vx, X1, X2, Rx), rubberbandIfOutOfBounds(Vy, Y1, Y2, Ry)];
}
/**
* Returns a generic, common payload for all gestures from an event.
*/
function getGenericPayload(_ref3, event, isStartEvent) {
var state = _ref3.state;
var timeStamp = event.timeStamp,
_lastEventType = event.type;
var previous = state.values;
var elapsedTime = isStartEvent ? 0 : timeStamp - state.startTime;
return {
_lastEventType: _lastEventType,
event: event,
timeStamp: timeStamp,
elapsedTime: elapsedTime,
previous: previous
};
}
/**
* Returns the reinitialized start state for the gesture.
* Should be common to all gestures.
*/
function getStartGestureState(_ref4, values, event, initial) {
var state = _ref4.state,
config = _ref4.config,
stateKey = _ref4.stateKey,
args = _ref4.args,
transform = _ref4.transform;
var offset = state.offset;
var startTime = event.timeStamp;
var initialFn = config.initial,
bounds = config.bounds,
threshold = config.threshold; // the _threshold is the difference between a [0,0] offset converted to
// its new space coordinates
var _threshold = subV(transform(threshold), transform([0, 0])).map(Math.abs);
var _state = _extends({}, getInitialState()[stateKey], {
_active: true,
args: args,
values: values,
initial: initial != null ? initial : values,
_threshold: _threshold,
offset: offset,
lastOffset: offset,
startTime: startTime
});
return _extends({}, _state, {
_initial: valueFn(initialFn, _state),
_bounds: valueFn(bounds, _state)
});
}
/**
* The controller will keep track of the state for all gestures and also keep
* track of timeouts, and window listeners.
*/
var Controller = function Controller(classes) {
var _this = this;
this.classes = classes;
this.pointerIds = new Set(); // register Pointer Events pointerIds
this.touchIds = new Set(); // register Touch Events identifiers
this.supportsTouchEvents = supportsTouchEvents();
this.supportsGestureEvents = supportsGestureEvents();
this.bind = function () {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var bindings = {};
for (var _iterator = _createForOfIteratorHelperLoose(_this.classes), _step; !(_step = _iterator()).done;) {
var RecognizerClass = _step.value;
new RecognizerClass(_this, args).addBindings(bindings);
} // // we also add event bindings for native handlers
var _loop = function _loop(eventKey) {
addBindings(bindings, eventKey, function (event) {
return _this.nativeRefs[eventKey](_extends({}, _this.state.shared, {
event: event,
args: args
}));
});
};
for (var eventKey in _this.nativeRefs) {
_loop(eventKey);
}
if (_this.config.domTarget) {
// If config.domTarget is set we add event listeners to it and return the clean function.
return updateDomListeners(_this, bindings);
} else {
// If not, we return an object that contains gesture handlers mapped to react handler event keys.
return getPropsListener(_this, bindings);
}
};
this.effect = function () {
if (_this.config.domTarget) _this.bind();
return _this.clean;
};
/**
* Function ran on component unmount: cleans timeouts and removes dom listeners set by the bind function.
*/
this.clean = function () {
var domTarget = getDomTargetFromConfig(_this.config);
var eventOptions = _this.config.eventOptions;
if (domTarget) removeListeners(domTarget, takeAll(_this.domListeners), eventOptions);
Object.values(_this.timeouts).forEach(clearTimeout);
clearAllWindowListeners(_this);
};
this.classes = classes;
this.state = getInitialState();
this.timeouts = {};
this.domListeners = [];
this.windowListeners = {};
};
function addEventIds(controller, event) {
if ('pointerId' in event) {
controller.pointerIds.add(event.pointerId);
} else {
controller.touchIds = new Set(getTouchIds(event));
}
}
function removeEventIds(controller, event) {
if ('pointerId' in event) {
controller.pointerIds["delete"](event.pointerId);
} else {
getTouchIds(event).forEach(function (id) {
return controller.touchIds["delete"](id);
});
}
}
function clearAllWindowListeners(controller) {
var _controller$config = controller.config,
el = _controller$config.window,
eventOptions = _controller$config.eventOptions,
windowListeners = controller.windowListeners;
if (!el) return;
for (var stateKey in windowListeners) {
var handlers = windowListeners[stateKey];
removeListeners(el, handlers, eventOptions);
}
controller.windowListeners = {};
}
function clearWindowListeners(_ref, stateKey, options) {
var config = _ref.config,
windowListeners = _ref.windowListeners;
if (options === void 0) {
options = config.eventOptions;
}
if (!config.window) return;
removeListeners(config.window, windowListeners[stateKey], options);
delete windowListeners[stateKey];
}
function updateWindowListeners(_ref2, stateKey, listeners, options) {
var config = _ref2.config,
windowListeners = _ref2.windowListeners;
if (listeners === void 0) {
listeners = [];
}
if (options === void 0) {
options = config.eventOptions;
}
if (!config.window) return;
removeListeners(config.window, windowListeners[stateKey], options);
addListeners(config.window, windowListeners[stateKey] = listeners, options);
}
function updateDomListeners(_ref3, bindings) {
var config = _ref3.config,
domListeners = _ref3.domListeners;
var domTarget = getDomTargetFromConfig(config);
if (!domTarget) throw new Error('domTarget must be defined');
var eventOptions = config.eventOptions;
removeListeners(domTarget, takeAll(domListeners), eventOptions);
for (var _i = 0, _Object$entries = Object.entries(bindings); _i < _Object$entries.length; _i++) {
var _Object$entries$_i = _Object$entries[_i],
key = _Object$entries$_i[0],
fns = _Object$entries$_i[1];
var name = key.slice(2).toLowerCase();
domListeners.push([name, chainFns.apply(void 0, fns)]);
}
addListeners(domTarget, domListeners, eventOptions);
}
function getPropsListener(_ref4, bindings) {
var config = _ref4.config;
var props = {};
var captureString = config.eventOptions.capture ? 'Capture' : '';
for (var _i2 = 0, _Object$entries2 = Object.entries(bindings); _i2 < _Object$entries2.length; _i2++) {
var _Object$entries2$_i = _Object$entries2[_i2],
event = _Object$entries2$_i[0],
fns = _Object$entries2$_i[1];
var fnsArray = Array.isArray(fns) ? fns : [fns];
var key = event + captureString;
props[key] = chainFns.apply(void 0, fnsArray);
}
return props;
}
function takeAll(array) {
if (array === void 0) {
array = [];
}
return array.splice(0, array.length);
}
function getDomTargetFromConfig(_ref5) {
var domTarget = _ref5.domTarget;
return domTarget && 'current' in domTarget ? domTarget.current : domTarget;
}
/**
* bindings is an object which keys match ReactEventHandlerKeys.
* Since a recognizer might want to bind a handler function to an event key already used by a previously
* added recognizer, we need to make sure that each event key is an array of all the functions mapped for
* that key.
*/
function addBindings(bindings, name, fn) {
if (!bindings[name]) bindings[name] = [];
bindings[name].push(fn);
}
function addListeners(el, listeners, options) {
if (listeners === void 0) {
listeners = [];
}
if (options === void 0) {
options = {};
}
for (var _iterator2 = _createForOfIteratorHelperLoose(listeners), _step2; !(_step2 = _iterator2()).done;) {
var _step2$value = _step2.value,
eventName = _step2$value[0],
eventHandler = _step2$value[1];
el.addEventListener(eventName, eventHandler, options);
}
}
function removeListeners(el, listeners, options) {
if (listeners === void 0) {
listeners = [];
}
if (options === void 0) {
options = {};
}
for (var _iterator3 = _createForOfIteratorHelperLoose(listeners), _step3; !(_step3 = _iterator3()).done;) {
var _step3$value = _step3.value,
eventName = _step3$value[0],
eventHandler = _step3$value[1];
el.removeEventListener(eventName, eventHandler, options);
}
}
/* eslint-disable react-hooks/exhaustive-deps */
/**
* Utility hook called by all gesture hooks and that will be responsible for the internals.
*
* @param handlers
* @param classes
* @param config
* @param nativeHandlers - native handlers such as onClick, onMouseDown, etc.
*/
function useRecognizers(handlers, config, nativeHandlers) {
if (nativeHandlers === void 0) {
nativeHandlers = {};
}
var classes = resolveClasses(handlers);
var controller = external_React_default.a.useMemo(function () {
return new Controller(classes);
}, []);
controller.config = config;
controller.handlers = handlers;
controller.nativeRefs = nativeHandlers;
external_React_default.a.useEffect(controller.effect, []); // @ts-ignore
if (controller.config.domTarget) return deprecationNoticeForDomTarget; // @ts-ignore
return controller.bind;
}
function deprecationNoticeForDomTarget() {
if (false) {}
}
function resolveClasses(internalHandlers) {
var classes = new Set();
if (internalHandlers.drag) classes.add(RecognizersMap.get('drag'));
if (internalHandlers.wheel) classes.add(RecognizersMap.get('wheel'));
if (internalHandlers.scroll) classes.add(RecognizersMap.get('scroll'));
if (internalHandlers.move) classes.add(RecognizersMap.get('move'));
if (internalHandlers.pinch) classes.add(RecognizersMap.get('pinch'));
if (internalHandlers.hover) classes.add(RecognizersMap.get('hover'));
return classes;
}
/**
* @private
* Abstract class for coordinates-based gesture recongizers
*/
var CoordinatesRecognizer = /*#__PURE__*/function (_Recognizer) {
reactusegesture_esm_inheritsLoose(CoordinatesRecognizer, _Recognizer);
function CoordinatesRecognizer() {
return _Recognizer.apply(this, arguments) || this;
}
var _proto = CoordinatesRecognizer.prototype;
/**
* Returns the real movement (without taking intentionality into account)
*/
_proto.getInternalMovement = function getInternalMovement(values, state) {
return subV(values, state.initial);
}
/**
* In coordinates-based gesture, this function will detect the first intentional axis,
* lock the gesture axis if lockDirection is specified in the config, block the gesture
* if the first intentional axis doesn't match the specified axis in config.
*/
;
_proto.checkIntentionality = function checkIntentionality(_intentional, _movement) {
if (_intentional[0] === false && _intentional[1] === false) {
return {
_intentional: _intentional,
axis: this.state.axis
};
}
var _movement$map = _movement.map(Math.abs),
absX = _movement$map[0],
absY = _movement$map[1];
var axis = this.state.axis || (absX > absY ? 'x' : absX < absY ? 'y' : undefined);
if (!this.config.axis && !this.config.lockDirection) return {
_intentional: _intentional,
_blocked: false,
axis: axis
};
if (!axis) return {
_intentional: [false, false],
_blocked: false,
axis: axis
};
if (!!this.config.axis && axis !== this.config.axis) return {
_intentional: _intentional,
_blocked: true,
axis: axis
};
_intentional[axis === 'x' ? 1 : 0] = false;
return {
_intentional: _intentional,
_blocked: false,
axis: axis
};
};
_proto.getKinematics = function getKinematics(values, event) {
var state = this.getMovement(values);
if (!state._blocked) {
var dt = event.timeStamp - this.state.timeStamp;
Object.assign(state, calculateAllKinematics(state.movement, state.delta, dt));
}
return state;
};
_proto.mapStateValues = function mapStateValues(state) {
return {
xy: state.values,
vxvy: state.velocities
};
};
return CoordinatesRecognizer;
}(Recognizer);
var TAP_DISTANCE_THRESHOLD = 3;
function persistEvent(event) {
'persist' in event && typeof event.persist === 'function' && event.persist();
}
var DragRecognizer = /*#__PURE__*/function (_CoordinatesRecognize) {
reactusegesture_esm_inheritsLoose(DragRecognizer, _CoordinatesRecognize);
function DragRecognizer() {
var _this;
_this = _CoordinatesRecognize.apply(this, arguments) || this;
_this.ingKey = 'dragging';
_this.stateKey = 'drag'; // TODO add back when setPointerCapture is widely wupported
// https://caniuse.com/#search=setPointerCapture
_this.setPointerCapture = function (event) {
// don't perform pointere capture when user wants to use touch events or
// when a pointerLockElement exists as this would throw an error
if (_this.config.useTouch || document.pointerLockElement) return;
var target = event.target,
pointerId = event.pointerId;
if (target && 'setPointerCapture' in target) {
// this would work in the DOM but doesn't with react three fiber
// target.addEventListener('pointermove', this.onDragChange, this.controller.config.eventOptions)
// @ts-expect-error
target.setPointerCapture(pointerId);
}
_this.updateGestureState({
_dragTarget: target,
_dragPointerId: pointerId
});
};
_this.releasePointerCapture = function () {
if (_this.config.useTouch || document.pointerLockElement) return;
var _this$state = _this.state,
_dragTarget = _this$state._dragTarget,
_dragPointerId = _this$state._dragPointerId;
if (_dragPointerId && _dragTarget && 'releasePointerCapture' in _dragTarget) {
// this would work in the DOM but doesn't with react three fiber
// target.removeEventListener('pointermove', this.onDragChange, this.controller.config.eventOptions)
if (!('hasPointerCapture' in _dragTarget) || _dragTarget.hasPointerCapture(_dragPointerId)) try {
_dragTarget.releasePointerCapture(_dragPointerId);
} catch (e) {}
}
};
_this.preventScroll = function (event) {
if (_this.state._dragPreventScroll && event.cancelable) {
event.preventDefault();
}
};
_this.getEventId = function (event) {
if (_this.config.useTouch) return event.changedTouches[0].identifier;
return event.pointerId;
};
_this.isValidEvent = function (event) {
// if we were using pointer events only event.isPrimary === 1 would suffice
return _this.state._pointerId === _this.getEventId(event);
};
_this.shouldPreventWindowScrollY = _this.config.experimental_preventWindowScrollY && _this.controller.supportsTouchEvents;
_this.setUpWindowScrollDetection = function (event) {
persistEvent(event); // we add window listeners that will prevent the scroll when the user has started dragging
updateWindowListeners(_this.controller, _this.stateKey, [['touchmove', _this.preventScroll], ['touchend', _this.clean.bind(_assertThisInitialized(_this))], ['touchcancel', _this.clean.bind(_assertThisInitialized(_this))]], {
passive: false
});
_this.setTimeout(_this.startDrag.bind(_assertThisInitialized(_this)), 250, event);
};
_this.setUpDelayedDragTrigger = function (event) {
_this.state._dragDelayed = true;
persistEvent(event);
_this.setTimeout(_this.startDrag.bind(_assertThisInitialized(_this)), _this.config.delay, event);
};
_this.setStartState = function (event) {
var values = getPointerEventValues(event, _this.transform);
_this.updateSharedState(getGenericEventData(event));
_this.updateGestureState(_extends({}, getStartGestureState(_assertThisInitialized(_this), values, event), getGenericPayload(_assertThisInitialized(_this), event, true), {
_pointerId: _this.getEventId(event)
}));
_this.updateGestureState(_this.getMovement(values));
};
_this.onDragStart = function (event) {
addEventIds(_this.controller, event);
if (!_this.enabled || _this.state._active) return;
_this.setStartState(event);
_this.setPointerCapture(event);
if (_this.shouldPreventWindowScrollY) _this.setUpWindowScrollDetection(event);else if (_this.config.delay > 0) _this.setUpDelayedDragTrigger(event);else _this.startDrag(event, true); // we pass the values to the startDrag event
};
_this.onDragChange = function (event) {
if ( // if the gesture was canceled or
_this.state.canceled || // if onDragStart wasn't fired or
!_this.state._active || // if the event pointerId doesn't match the one that initiated the drag
!_this.isValidEvent(event) || // if the event has the same timestamp as the previous event
// note that checking type equality is ONLY for tests ¯\_(ツ)_/¯
_this.state._lastEventType === event.type && event.timeStamp === _this.state.timeStamp) return;
var values;
if (document.pointerLockElement) {
var movementX = event.movementX,
movementY = event.movementY;
values = addV(_this.transform([movementX, movementY]), _this.state.values);
} else values = getPointerEventValues(event, _this.transform);
var kinematics = _this.getKinematics(values, event); // if startDrag hasn't fired
if (!_this.state._dragStarted) {
// If the gesture isn't active then respond to the event only if
// it's been delayed via the `delay` option, in which case start
// the gesture immediately.
if (_this.state._dragDelayed) {
_this.startDrag(event);
return;
} // if the user wants to prevent vertical window scroll when user starts dragging
if (_this.shouldPreventWindowScrollY) {
if (!_this.state._dragPreventScroll && kinematics.axis) {
// if the user is dragging horizontally then we should allow the drag
if (kinematics.axis === 'x') {
_this.startDrag(event);
} else {
_this.state._active = false;
return;
}
} else return;
} else return;
}
var genericEventData = getGenericEventData(event);
_this.updateSharedState(genericEventData);
var genericPayload = getGenericPayload(_assertThisInitialized(_this), event); // This verifies if the drag can be assimilated to a tap by checking
// if the real distance of the drag (ie not accounting for the threshold) is
// greater than the TAP_DISTANCE_THRESHOLD.
var realDistance = calculateDistance(kinematics._movement);
var _dragIsTap = _this.state._dragIsTap;
if (_dragIsTap && realDistance >= TAP_DISTANCE_THRESHOLD) _dragIsTap = false;
_this.updateGestureState(_extends({}, genericPayload, kinematics, {
_dragIsTap: _dragIsTap
}));
_this.fireGestureHandler();
};
_this.onDragEnd = function (event) {
removeEventIds(_this.controller, event); // if the event pointerId doesn't match the one that initiated the drag
// we don't want to end the drag
if (!_this.isValidEvent(event)) return;
_this.clean(); // if the gesture is no longer active (ie canceled)
// don't do anything
if (!_this.state._active) return;
_this.state._active = false;
var tap = _this.state._dragIsTap;
var _this$state$velocitie = _this.state.velocities,
vx = _this$state$velocitie[0],
vy = _this$state$velocitie[1];
var _this$state$movement = _this.state.movement,
mx = _this$state$movement[0],
my = _this$state$movement[1];
var _this$state$_intentio = _this.state._intentional,
ix = _this$state$_intentio[0],
iy = _this$state$_intentio[1];
var _this$config$swipeVel = _this.config.swipeVelocity,
svx = _this$config$swipeVel[0],
svy = _this$config$swipeVel[1];
var _this$config$swipeDis = _this.config.swipeDistance,
sx = _this$config$swipeDis[0],
sy = _this$config$swipeDis[1];
var sd = _this.config.swipeDuration;
var endState = _extends({}, getGenericPayload(_assertThisInitialized(_this), event), _this.getMovement(_this.state.values));
var swipe = [0, 0];
if (endState.elapsedTime < sd) {
if (ix !== false && Math.abs(vx) > svx && Math.abs(mx) > sx) swipe[0] = sign(vx);
if (iy !== false && Math.abs(vy) > svy && Math.abs(my) > sy) swipe[1] = sign(vy);
}
_this.updateSharedState({
buttons: 0
});
_this.updateGestureState(_extends({}, endState, {
tap: tap,
swipe: swipe
}));
_this.fireGestureHandler(_this.config.filterTaps && tap === true);
};
_this.clean = function () {
_CoordinatesRecognize.prototype.clean.call(_assertThisInitialized(_this));
_this.state._dragStarted = false;
_this.releasePointerCapture();
clearWindowListeners(_this.controller, _this.stateKey);
};
_this.onCancel = function () {
if (_this.state.canceled) return;
_this.updateGestureState({
canceled: true,
_active: false
});
_this.updateSharedState({
buttons: 0
});
setTimeout(function () {
return _this.fireGestureHandler();
}, 0);
};
_this.onClick = function (event) {
if (!_this.state._dragIsTap) event.stopPropagation();
};
return _this;
}
var _proto = DragRecognizer.prototype;
_proto.startDrag = function startDrag(event, onDragIsStart) {
if (onDragIsStart === void 0) {
onDragIsStart = false;
}
// startDrag can happen after a timeout, so we need to check if the gesture is still active
// as the user might have lift up the pointer in between.
if ( // if the gesture isn't active (probably means)
!this.state._active || // if the drag has already started we should ignore subsequent attempts
this.state._dragStarted) return;
if (!onDragIsStart) this.setStartState(event);
this.updateGestureState({
_dragStarted: true,
_dragPreventScroll: true,
cancel: this.onCancel
});
this.clearTimeout();
this.fireGestureHandler();
};
_proto.addBindings = function addBindings$1(bindings) {
if (this.config.useTouch) {
addBindings(bindings, 'onTouchStart', this.onDragStart);
addBindings(bindings, 'onTouchMove', this.onDragChange); // this is needed for react-three-fiber
addBindings(bindings, 'onTouchEnd', this.onDragEnd);
addBindings(bindings, 'onTouchCancel', this.onDragEnd);
} else {
addBindings(bindings, 'onPointerDown', this.onDragStart);
addBindings(bindings, 'onPointerMove', this.onDragChange); // this is needed for react-three-fiber
addBindings(bindings, 'onPointerUp', this.onDragEnd);
addBindings(bindings, 'onPointerCancel', this.onDragEnd);
}
if (this.config.filterTaps) {
var handler = this.controller.config.eventOptions.capture ? 'onClick' : 'onClickCapture';
addBindings(bindings, handler, this.onClick);
}
};
return DragRecognizer;
}(CoordinatesRecognizer);
/**
* Inlined from https://github.com/alexreardon/memoize-one
*/
function memoizeOne(resultFn, isEqual) {
var lastThis;
var lastArgs = [];
var lastResult;
var calledOnce = false;
function memoized() {
for (var _len = arguments.length, newArgs = new Array(_len), _key = 0; _key < _len; _key++) {
newArgs[_key] = arguments[_key];
}
if (calledOnce && lastThis === this && isEqual(newArgs, lastArgs)) {
return lastResult;
}
lastResult = resultFn.apply(this, newArgs);
calledOnce = true;
lastThis = this;
lastArgs = newArgs;
return lastResult;
}
return memoized;
}
/**
* Taken from https://github.com/FormidableLabs/react-fast-compare
*
* Dropped comments and ArrayBuffer handling
*/
function equal(a, b) {
if (a === b) return true;
if (a && b && typeof a == 'object' && typeof b == 'object') {
if (a.constructor !== b.constructor) return false;
var length, i, keys;
if (Array.isArray(a)) {
length = a.length;
if (length !== b.length) return false;
for (i = length; i-- !== 0;) {
if (!equal(a[i], b[i])) return false;
}
return true;
}
var it;
if (typeof Map === 'function' && a instanceof Map && b instanceof Map) {
if (a.size !== b.size) return false;
it = a.entries();
while (!(i = it.next()).done) {
if (!b.has(i.value[0])) return false;
}
it = a.entries();
while (!(i = it.next()).done) {
if (!equal(i.value[1], b.get(i.value[0]))) return false;
}
return true;
}
if (typeof Set === 'function' && a instanceof Set && b instanceof Set) {
if (a.size !== b.size) return false;
it = a.entries();
while (!(i = it.next()).done) {
if (!b.has(i.value[0])) return false;
}
return true;
}
if (a.constructor === RegExp) return a.source === b.source && a.flags === b.flags;
if (a.valueOf !== Object.prototype.valueOf) return a.valueOf() === b.valueOf();
if (a.toString !== Object.prototype.toString) return a.toString() === b.toString();
keys = Object.keys(a);
length = keys.length;
if (length !== Object.keys(b).length) return false;
for (i = length; i-- !== 0;) {
if (!Object.prototype.hasOwnProperty.call(b, keys[i])) return false;
}
if (typeof Element !== 'undefined' && a instanceof Element) return false;
for (i = length; i-- !== 0;) {
if (keys[i] === '_owner' && a.$$typeof) continue;
if (!equal(a[keys[i]], b[keys[i]])) return false;
}
return true;
} // true if both NaN, false otherwise — NaN !== NaN → true
// eslint-disable-next-line no-self-compare
return a !== a && b !== b;
}
function isEqual(a, b) {
try {
return equal(a, b);
} catch (error) {
if ((error.message || '').match(/stack|recursion/i)) {
// eslint-disable-next-line no-console
console.warn('react-fast-compare cannot handle circular refs');
return false;
}
throw error;
}
}
/**
* Drag hook.
*
* @param handler - the function fired every time the drag gesture updates
* @param [config={}] - the config object including generic options and drag options
*/
function useDrag(handler, config) {
if (config === void 0) {
config = {};
}
RecognizersMap.set('drag', DragRecognizer);
var buildDragConfig = Object(external_React_["useRef"])();
if (!buildDragConfig.current) {
buildDragConfig.current = memoizeOne(_buildDragConfig, isEqual);
}
return useRecognizers({
drag: handler
}, buildDragConfig.current(config));
}
/**
* @private
* Abstract class for distance/angle-based gesture recongizers
*/
var DistanceAngleRecognizer = /*#__PURE__*/function (_Recognizer) {
reactusegesture_esm_inheritsLoose(DistanceAngleRecognizer, _Recognizer);
function DistanceAngleRecognizer() {
return _Recognizer.apply(this, arguments) || this;
}
var _proto = DistanceAngleRecognizer.prototype;
_proto.getInternalMovement = function getInternalMovement(values, state) {
var prev_a = state.values[1]; // not be defined if ctrl+wheel is used for zoom only
var d = values[0],
_values$ = values[1],
a = _values$ === void 0 ? prev_a : _values$;
var delta_a = a - prev_a;
var next_turns = state.turns;
if (Math.abs(delta_a) > 270) next_turns += sign(delta_a);
return subV([d, a - 360 * next_turns], state.initial);
};
_proto.getKinematics = function getKinematics(values, event) {
var state = this.getMovement(values);
var turns = (values[1] - state._movement[1] - this.state.initial[1]) / 360;
var dt = event.timeStamp - this.state.timeStamp;
var _calculateAllKinemati = calculateAllKinematics(state.movement, state.delta, dt),
kinematics = _objectWithoutPropertiesLoose(_calculateAllKinemati, ["distance", "velocity"]);
return _extends({
turns: turns
}, state, kinematics);
};
_proto.mapStateValues = function mapStateValues(state) {
return {
da: state.values,
vdva: state.velocities
};
};
return DistanceAngleRecognizer;
}(Recognizer);
var ZOOM_CONSTANT = 7;
var WEBKIT_DISTANCE_SCALE_FACTOR = 260;
var PinchRecognizer = /*#__PURE__*/function (_DistanceAngleRecogni) {
reactusegesture_esm_inheritsLoose(PinchRecognizer, _DistanceAngleRecogni);
function PinchRecognizer() {
var _this;
_this = _DistanceAngleRecogni.apply(this, arguments) || this;
_this.ingKey = 'pinching';
_this.stateKey = 'pinch';
_this.onPinchStart = function (event) {
addEventIds(_this.controller, event);
var touchIds = _this.controller.touchIds;
if (!_this.enabled) return;
if (_this.state._active) {
// check that the pointerIds that initiated the gesture
// are still enabled. This is useful for when the page
// loses track of the pointers (minifying gesture on iPad).
if (_this.state._pointerIds.every(function (id) {
return touchIds.has(id);
})) return; // something was wrong with the pointers but we let it go.
} // until we reach two fingers on the target don't react
if (touchIds.size < 2) return;
var _pointerIds = Array.from(touchIds).slice(0, 2);
var _getTwoTouchesEventVa = getTwoTouchesEventValues(event, _pointerIds, _this.transform),
values = _getTwoTouchesEventVa.values,
origin = _getTwoTouchesEventVa.origin;
_this.updateSharedState(getGenericEventData(event));
_this.updateGestureState(_extends({}, getStartGestureState(_assertThisInitialized(_this), values, event), getGenericPayload(_assertThisInitialized(_this), event, true), {
_pointerIds: _pointerIds,
cancel: _this.onCancel,
origin: origin
}));
_this.updateGestureState(_this.getMovement(values));
_this.fireGestureHandler();
};
_this.onPinchChange = function (event) {
var _this$state = _this.state,
canceled = _this$state.canceled,
_active = _this$state._active;
if (canceled || !_active || // if the event has the same timestamp as the previous event
event.timeStamp === _this.state.timeStamp) return;
var genericEventData = getGenericEventData(event);
_this.updateSharedState(genericEventData);
try {
var _getTwoTouchesEventVa2 = getTwoTouchesEventValues(event, _this.state._pointerIds, _this.transform),
values = _getTwoTouchesEventVa2.values,
origin = _getTwoTouchesEventVa2.origin;
var kinematics = _this.getKinematics(values, event);
_this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), kinematics, {
origin: origin
}));
_this.fireGestureHandler();
} catch (e) {
_this.onPinchEnd(event);
}
};
_this.onPinchEnd = function (event) {
removeEventIds(_this.controller, event);
var pointerIds = getTouchIds(event); // if none of the lifted pointerIds is in the state pointerIds don't do anything
if (_this.state._pointerIds.every(function (id) {
return !pointerIds.includes(id);
})) return;
_this.clean();
if (!_this.state._active) return;
_this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), _this.getMovement(_this.state.values), {
_active: false
}));
_this.fireGestureHandler();
};
_this.onCancel = function () {
if (_this.state.canceled) return;
_this.updateGestureState({
_active: false,
canceled: true
});
setTimeout(function () {
return _this.fireGestureHandler();
}, 0);
};
/**
* PINCH WITH WEBKIT GESTURES
*/
_this.onGestureStart = function (event) {
if (!_this.enabled) return;
event.preventDefault();
var values = getWebkitGestureEventValues(event, _this.transform);
_this.updateSharedState(getGenericEventData(event));
_this.updateGestureState(_extends({}, getStartGestureState(_assertThisInitialized(_this), values, event), getGenericPayload(_assertThisInitialized(_this), event, true), {
origin: [event.clientX, event.clientY],
cancel: _this.onCancel
}));
_this.updateGestureState(_this.getMovement(values));
_this.fireGestureHandler();
};
_this.onGestureChange = function (event) {
var _this$state2 = _this.state,
canceled = _this$state2.canceled,
_active = _this$state2._active;
if (canceled || !_active) return;
event.preventDefault();
var genericEventData = getGenericEventData(event);
_this.updateSharedState(genericEventData); // this normalizes the values of the Safari's WebKitEvent by calculating
// the delta and then multiplying it by a constant.
var values = getWebkitGestureEventValues(event, _this.transform);
values[0] = (values[0] - _this.state.event.scale) * WEBKIT_DISTANCE_SCALE_FACTOR + _this.state.values[0];
var kinematics = _this.getKinematics(values, event);
_this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), kinematics, {
origin: [event.clientX, event.clientY]
}));
_this.fireGestureHandler();
};
_this.onGestureEnd = function (event) {
_this.clean();
if (!_this.state._active) return;
_this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), _this.getMovement(_this.state.values), {
_active: false,
origin: [event.clientX, event.clientY]
}));
_this.fireGestureHandler();
};
/**
* PINCH WITH WHEEL
*/
_this.wheelShouldRun = function (event) {
return _this.enabled && event.ctrlKey;
};
_this.getWheelValuesFromEvent = function (event) {
var _getWheelEventValues = getWheelEventValues(event, _this.transform),
delta_d = _getWheelEventValues[1];
var _this$state$values = _this.state.values,
prev_d = _this$state$values[0],
prev_a = _this$state$values[1]; // ZOOM_CONSTANT is based on Safari trackpad natural zooming
var _delta_d = -delta_d * ZOOM_CONSTANT; // new distance is the previous state distance added to the delta
var d = prev_d + _delta_d;
var a = prev_a !== void 0 ? prev_a : 0;
return {
values: [d, a],
origin: [event.clientX, event.clientY],
delta: [_delta_d, a]
};
};
_this.onWheel = function (event) {
if (!_this.wheelShouldRun(event)) return;
_this.setTimeout(_this.onWheelEnd);
if (!_this.state._active) _this.onWheelStart(event);else _this.onWheelChange(event);
};
_this.onWheelStart = function (event) {
var _this$getWheelValuesF = _this.getWheelValuesFromEvent(event),
values = _this$getWheelValuesF.values,
delta = _this$getWheelValuesF.delta,
origin = _this$getWheelValuesF.origin;
if (event.cancelable) event.preventDefault();else if (false) {}
_this.updateSharedState(getGenericEventData(event));
_this.updateGestureState(_extends({}, getStartGestureState(_assertThisInitialized(_this), values, event, _this.state.values), getGenericPayload(_assertThisInitialized(_this), event, true), {
offset: values,
delta: delta,
origin: origin
}));
_this.updateGestureState(_this.getMovement(values));
_this.fireGestureHandler();
};
_this.onWheelChange = function (event) {
if (event.cancelable) event.preventDefault();
_this.updateSharedState(getGenericEventData(event));
var _this$getWheelValuesF2 = _this.getWheelValuesFromEvent(event),
values = _this$getWheelValuesF2.values,
origin = _this$getWheelValuesF2.origin,
delta = _this$getWheelValuesF2.delta;
_this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), _this.getKinematics(values, event), {
origin: origin,
delta: delta
}));
_this.fireGestureHandler();
};
_this.onWheelEnd = function () {
_this.clean();
if (!_this.state._active) return;
_this.state._active = false;
_this.updateGestureState(_this.getMovement(_this.state.values));
_this.fireGestureHandler();
};
return _this;
}
var _proto = PinchRecognizer.prototype;
_proto.addBindings = function addBindings$1(bindings) {
// Only try to use gesture events when they are supported and domTarget is set
// as React doesn't support gesture handlers.
if (this.controller.config.domTarget && !this.controller.supportsTouchEvents && this.controller.supportsGestureEvents) {
addBindings(bindings, 'onGestureStart', this.onGestureStart);
addBindings(bindings, 'onGestureChange', this.onGestureChange);
addBindings(bindings, 'onGestureEnd', this.onGestureEnd);
} else {
addBindings(bindings, 'onTouchStart', this.onPinchStart);
addBindings(bindings, 'onTouchMove', this.onPinchChange);
addBindings(bindings, 'onTouchEnd', this.onPinchEnd);
addBindings(bindings, 'onTouchCancel', this.onPinchEnd);
addBindings(bindings, 'onWheel', this.onWheel);
}
};
return PinchRecognizer;
}(DistanceAngleRecognizer);
/**
* Pinch hook.
*
* @param handler - the function fired every time the pinch gesture updates
* @param [config={}] - the config object including generic options and pinch options
*/
function usePinch(handler, config) {
if (config === void 0) {
config = {};
}
RecognizersMap.set('pinch', PinchRecognizer);
var buildPinchConfig = Object(external_React_["useRef"])();
if (!buildPinchConfig.current) {
buildPinchConfig.current = memoizeOne(_buildPinchConfig, isEqual);
}
return useRecognizers({
pinch: handler
}, buildPinchConfig.current(config));
}
var WheelRecognizer = /*#__PURE__*/function (_CoordinatesRecognize) {
reactusegesture_esm_inheritsLoose(WheelRecognizer, _CoordinatesRecognize);
function WheelRecognizer() {
var _this;
_this = _CoordinatesRecognize.apply(this, arguments) || this;
_this.ingKey = 'wheeling';
_this.stateKey = 'wheel';
_this.debounced = true;
_this.handleEvent = function (event) {
if (event.ctrlKey && 'pinch' in _this.controller.handlers) return;
if (!_this.enabled) return;
_this.setTimeout(_this.onEnd);
_this.updateSharedState(getGenericEventData(event));
var values = addV(getWheelEventValues(event, _this.transform), _this.state.values);
if (!_this.state._active) {
_this.updateGestureState(_extends({}, getStartGestureState(_assertThisInitialized(_this), values, event, _this.state.values), getGenericPayload(_assertThisInitialized(_this), event, true)));
var movement = _this.getMovement(values);
var geometry = calculateAllGeometry(movement.delta);
_this.updateGestureState(movement);
_this.updateGestureState(geometry);
} else {
_this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), _this.getKinematics(values, event)));
}
_this.fireGestureHandler();
};
_this.onEnd = function () {
_this.clean();
if (!_this.state._active) return;
var movement = _this.getMovement(_this.state.values);
_this.updateGestureState(movement);
_this.updateGestureState({
_active: false,
velocities: [0, 0],
velocity: 0
});
_this.fireGestureHandler();
};
return _this;
}
var _proto = WheelRecognizer.prototype;
_proto.addBindings = function addBindings$1(bindings) {
addBindings(bindings, 'onWheel', this.handleEvent);
};
return WheelRecognizer;
}(CoordinatesRecognizer);
/**
* Wheel hook.
*
* @param handler - the function fired every time the wheel gesture updates
* @param the config object including generic options and wheel options
*/
function useWheel(handler, config) {
if (config === void 0) {
config = {};
}
RecognizersMap.set('wheel', WheelRecognizer);
var buildWheelConfig = Object(external_React_["useRef"])();
if (!buildWheelConfig.current) {
buildWheelConfig.current = memoizeOne(_buildWheelConfig, isEqual);
}
return useRecognizers({
wheel: handler
}, buildWheelConfig.current(config));
}
var MoveRecognizer = /*#__PURE__*/function (_CoordinatesRecognize) {
reactusegesture_esm_inheritsLoose(MoveRecognizer, _CoordinatesRecognize);
function MoveRecognizer() {
var _this;
_this = _CoordinatesRecognize.apply(this, arguments) || this;
_this.ingKey = 'moving';
_this.stateKey = 'move';
_this.debounced = true;
_this.onMove = function (event) {
if (!_this.enabled) return;
_this.setTimeout(_this.onMoveEnd);
if (!_this.state._active) _this.onMoveStart(event);else _this.onMoveChange(event);
};
_this.onMoveStart = function (event) {
_this.updateSharedState(getGenericEventData(event));
var values = getPointerEventValues(event, _this.transform);
_this.updateGestureState(_extends({}, getStartGestureState(_assertThisInitialized(_this), values, event), getGenericPayload(_assertThisInitialized(_this), event, true)));
_this.updateGestureState(_this.getMovement(values));
_this.fireGestureHandler();
};
_this.onMoveChange = function (event) {
_this.updateSharedState(getGenericEventData(event));
var values = getPointerEventValues(event, _this.transform);
_this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), _this.getKinematics(values, event)));
_this.fireGestureHandler();
};
_this.onMoveEnd = function () {
_this.clean();
if (!_this.state._active) return;
var values = _this.state.values;
_this.updateGestureState(_this.getMovement(values));
_this.updateGestureState({
velocities: [0, 0],
velocity: 0,
_active: false
});
_this.fireGestureHandler();
};
_this.hoverTransform = function () {
return _this.controller.config.hover.transform || _this.controller.config.transform;
};
_this.onPointerEnter = function (event) {
_this.controller.state.shared.hovering = true;
if (!_this.controller.config.enabled) return;
if (_this.controller.config.hover.enabled) {
var values = getPointerEventValues(event, _this.hoverTransform());
var state = _extends({}, _this.controller.state.shared, _this.state, getGenericPayload(_assertThisInitialized(_this), event, true), {
args: _this.args,
values: values,
active: true,
hovering: true
});
_this.controller.handlers.hover(_extends({}, state, _this.mapStateValues(state)));
}
if ('move' in _this.controller.handlers) _this.onMoveStart(event);
};
_this.onPointerLeave = function (event) {
_this.controller.state.shared.hovering = false;
if ('move' in _this.controller.handlers) _this.onMoveEnd();
if (!_this.controller.config.hover.enabled) return;
var values = getPointerEventValues(event, _this.hoverTransform());
var state = _extends({}, _this.controller.state.shared, _this.state, getGenericPayload(_assertThisInitialized(_this), event), {
args: _this.args,
values: values,
active: false
});
_this.controller.handlers.hover(_extends({}, state, _this.mapStateValues(state)));
};
return _this;
}
var _proto = MoveRecognizer.prototype;
_proto.addBindings = function addBindings$1(bindings) {
if ('move' in this.controller.handlers) {
addBindings(bindings, 'onPointerMove', this.onMove);
}
if ('hover' in this.controller.handlers) {
addBindings(bindings, 'onPointerEnter', this.onPointerEnter);
addBindings(bindings, 'onPointerLeave', this.onPointerLeave);
}
};
return MoveRecognizer;
}(CoordinatesRecognizer);
/**
* Move hook.
*
* @param handler - the function fired every time the move gesture updates
* @param [config={}] - the config object including generic options and move options
*/
function useMove(handler, config) {
if (config === void 0) {
config = {};
}
RecognizersMap.set('move', MoveRecognizer);
var buildMoveConfig = Object(external_React_["useRef"])();
if (!buildMoveConfig.current) {
buildMoveConfig.current = memoizeOne(_buildMoveConfig, isEqual);
}
return useRecognizers({
move: handler
}, buildMoveConfig.current(config));
}
/**
* Hover hook.
*
* @param handler - the function fired every time the hover gesture updates
* @param [config={}] - the config object including generic options and hover options
*/
function useHover(handler, config) {
if (config === void 0) {
config = {};
}
RecognizersMap.set('hover', MoveRecognizer);
var buildHoverConfig = Object(external_React_["useRef"])();
if (!buildHoverConfig.current) {
buildHoverConfig.current = memoizeOne(_buildHoverConfig, isEqual);
}
return useRecognizers({
hover: handler
}, buildHoverConfig.current(config));
}
var ScrollRecognizer = /*#__PURE__*/function (_CoordinatesRecognize) {
reactusegesture_esm_inheritsLoose(ScrollRecognizer, _CoordinatesRecognize);
function ScrollRecognizer() {
var _this;
_this = _CoordinatesRecognize.apply(this, arguments) || this;
_this.ingKey = 'scrolling';
_this.stateKey = 'scroll';
_this.debounced = true;
_this.handleEvent = function (event) {
if (!_this.enabled) return;
_this.clearTimeout();
_this.setTimeout(_this.onEnd);
var values = getScrollEventValues(event, _this.transform);
_this.updateSharedState(getGenericEventData(event));
if (!_this.state._active) {
_this.updateGestureState(_extends({}, getStartGestureState(_assertThisInitialized(_this), values, event, _this.state.values), getGenericPayload(_assertThisInitialized(_this), event, true)));
var movementDetection = _this.getMovement(values);
var geometry = calculateAllGeometry(movementDetection.delta);
_this.updateGestureState(movementDetection);
_this.updateGestureState(geometry);
} else {
_this.updateGestureState(_extends({}, getGenericPayload(_assertThisInitialized(_this), event), _this.getKinematics(values, event)));
}
_this.fireGestureHandler();
};
_this.onEnd = function () {
_this.clean();
if (!_this.state._active) return;
_this.updateGestureState(_extends({}, _this.getMovement(_this.state.values), {
_active: false,
velocities: [0, 0],
velocity: 0
}));
_this.fireGestureHandler();
};
return _this;
}
var _proto = ScrollRecognizer.prototype;
_proto.addBindings = function addBindings$1(bindings) {
addBindings(bindings, 'onScroll', this.handleEvent);
};
return ScrollRecognizer;
}(CoordinatesRecognizer);
/**
* Scroll hook.
*
* @param handler - the function fired every time the scroll gesture updates
* @param [config={}] - the config object including generic options and scroll options
*/
function useScroll(handler, config) {
if (config === void 0) {
config = {};
}
RecognizersMap.set('scroll', ScrollRecognizer);
var buildScrollConfig = Object(external_React_["useRef"])();
if (!buildScrollConfig.current) {
buildScrollConfig.current = memoizeOne(_buildScrollConfig, isEqual);
}
return useRecognizers({
scroll: handler
}, buildScrollConfig.current(config));
}
var RE_NOT_NATIVE = /^on(Drag|Wheel|Scroll|Move|Pinch|Hover)/;
function sortHandlers(handlers) {
var _native = {};
var handle = {};
var actions = new Set();
for (var key in handlers) {
if (RE_NOT_NATIVE.test(key)) {
actions.add(RegExp.lastMatch);
handle[key] = handlers[key];
} else {
_native[key] = handlers[key];
}
}
return [handle, _native, actions];
}
/**
* @public
*
* The most complete gesture hook, allowing support for multiple gestures.
*
* @param {Handlers} handlers - an object with on[Gesture] keys containg gesture handlers
* @param {UseGestureConfig} [config={}] - the full config object
* @returns {(...args: any[]) => HookReturnType<Config>}
*/
function useGesture(_handlers, config) {
if (config === void 0) {
config = {};
}
var _sortHandlers = sortHandlers(_handlers),
handlers = _sortHandlers[0],
nativeHandlers = _sortHandlers[1],
actions = _sortHandlers[2];
RecognizersMap.set('drag', DragRecognizer);
RecognizersMap.set('hover', MoveRecognizer);
RecognizersMap.set('move', MoveRecognizer);
RecognizersMap.set('pinch', PinchRecognizer);
RecognizersMap.set('scroll', ScrollRecognizer);
RecognizersMap.set('wheel', WheelRecognizer);
var mergedConfig = buildComplexConfig(config, actions);
var internalHandlers = {};
if (actions.has('onDrag')) internalHandlers.drag = includeStartEndHandlers(handlers, 'onDrag');
if (actions.has('onWheel')) internalHandlers.wheel = includeStartEndHandlers(handlers, 'onWheel');
if (actions.has('onScroll')) internalHandlers.scroll = includeStartEndHandlers(handlers, 'onScroll');
if (actions.has('onMove')) internalHandlers.move = includeStartEndHandlers(handlers, 'onMove');
if (actions.has('onPinch')) internalHandlers.pinch = includeStartEndHandlers(handlers, 'onPinch');
if (actions.has('onHover')) internalHandlers.hover = handlers.onHover;
return useRecognizers(internalHandlers, mergedConfig, nativeHandlers);
}
function includeStartEndHandlers(handlers, handlerKey) {
var startKey = handlerKey + 'Start';
var endKey = handlerKey + 'End';
var fn = function fn(state) {
var memo = undefined;
if (state.first && startKey in handlers) handlers[startKey](state);
if (handlerKey in handlers) memo = handlers[handlerKey](state);
if (state.last && endKey in handlers) handlers[endKey](state);
return memo;
};
return fn;
}
// EXTERNAL MODULE: external ["wp","keycodes"]
var external_wp_keycodes_ = __webpack_require__("RxS6");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/utils.js
/**
* WordPress dependencies
*/
/**
* Gets a CSS cursor value based on a drag direction.
*
* @param {string} dragDirection The drag direction.
* @return {string} The CSS cursor value.
*/
function getDragCursor(dragDirection) {
let dragCursor = 'ns-resize';
switch (dragDirection) {
case 'n':
case 's':
dragCursor = 'ns-resize';
break;
case 'e':
case 'w':
dragCursor = 'ew-resize';
break;
}
return dragCursor;
}
/**
* Custom hook that renders a drag cursor when dragging.
*
* @param {boolean} isDragging The dragging state.
* @param {string} dragDirection The drag direction.
*
* @return {string} The CSS cursor value.
*/
function useDragCursor(isDragging, dragDirection) {
const dragCursor = getDragCursor(dragDirection);
Object(external_wp_element_["useEffect"])(() => {
if (isDragging) {
document.documentElement.style.cursor = dragCursor;
} else {
document.documentElement.style.cursor = null;
}
}, [isDragging]);
return dragCursor;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/state.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const initialStateReducer = state => state;
const initialInputControlState = {
_event: {},
error: null,
initialValue: '',
isDirty: false,
isDragEnabled: false,
isDragging: false,
isPressEnterToChange: false,
value: ''
};
const actionTypes = {
CHANGE: 'CHANGE',
COMMIT: 'COMMIT',
DRAG_END: 'DRAG_END',
DRAG_START: 'DRAG_START',
DRAG: 'DRAG',
INVALIDATE: 'INVALIDATE',
PRESS_DOWN: 'PRESS_DOWN',
PRESS_ENTER: 'PRESS_ENTER',
PRESS_UP: 'PRESS_UP',
RESET: 'RESET',
UPDATE: 'UPDATE'
};
const inputControlActionTypes = actionTypes;
/**
* Prepares initialState for the reducer.
*
* @param {Object} initialState The initial state.
* @return {Object} Prepared initialState for the reducer
*/
function mergeInitialState(initialState = initialInputControlState) {
const {
value
} = initialState;
return { ...initialInputControlState,
...initialState,
initialValue: value
};
}
/**
* Composes multiple stateReducers into a single stateReducer, building
* the pipeline to control the flow for state and actions.
*
* @param {...Function} fns State reducers.
* @return {Function} The single composed stateReducer.
*/
const composeStateReducers = (...fns) => {
return (...args) => {
return fns.reduceRight((state, fn) => {
const fnState = fn(...args);
return Object(external_lodash_["isEmpty"])(fnState) ? state : { ...state,
...fnState
};
}, {});
};
};
/**
* Creates a reducer that opens the channel for external state subscription
* and modification.
*
* This technique uses the "stateReducer" design pattern:
* https://kentcdodds.com/blog/the-state-reducer-pattern/
*
* @param {Function} composedStateReducers A custom reducer that can subscribe and modify state.
* @return {Function} The reducer.
*/
function inputControlStateReducer(composedStateReducers) {
return (state, action) => {
const nextState = { ...state
};
const {
type,
payload
} = action;
switch (type) {
/**
* Keyboard events
*/
case actionTypes.PRESS_UP:
nextState.isDirty = false;
break;
case actionTypes.PRESS_DOWN:
nextState.isDirty = false;
break;
/**
* Drag events
*/
case actionTypes.DRAG_START:
nextState.isDragging = true;
break;
case actionTypes.DRAG_END:
nextState.isDragging = false;
break;
/**
* Input events
*/
case actionTypes.CHANGE:
nextState.error = null;
nextState.value = payload.value;
if (state.isPressEnterToChange) {
nextState.isDirty = true;
}
break;
case actionTypes.COMMIT:
nextState.value = payload.value;
nextState.isDirty = false;
break;
case actionTypes.RESET:
nextState.error = null;
nextState.isDirty = false;
nextState.value = payload.value || state.initialValue;
break;
case actionTypes.UPDATE:
nextState.value = payload.value;
nextState.isDirty = false;
break;
/**
* Validation
*/
case actionTypes.INVALIDATE:
nextState.error = payload.error;
break;
}
if (payload.event) {
nextState._event = payload.event;
}
/**
* Send the nextState + action to the composedReducers via
* this "bridge" mechanism. This allows external stateReducers
* to hook into actions, and modify state if needed.
*/
return composedStateReducers(nextState, action);
};
}
/**
* A custom hook that connects and external stateReducer with an internal
* reducer. This hook manages the internal state of InputControl.
* However, by connecting an external stateReducer function, other
* components can react to actions as well as modify state before it is
* applied.
*
* This technique uses the "stateReducer" design pattern:
* https://kentcdodds.com/blog/the-state-reducer-pattern/
*
* @param {Function} stateReducer An external state reducer.
* @param {Object} initialState The initial state for the reducer.
* @return {Object} State, dispatch, and a collection of actions.
*/
function useInputControlStateReducer(stateReducer = initialStateReducer, initialState = initialInputControlState) {
const [state, dispatch] = Object(external_wp_element_["useReducer"])(inputControlStateReducer(stateReducer), mergeInitialState(initialState));
const createChangeEvent = type => (nextValue, event) => {
/**
* Persist allows for the (Synthetic) event to be used outside of
* this function call.
* https://reactjs.org/docs/events.html#event-pooling
*/
if (event && event.persist) {
event.persist();
}
dispatch({
type,
payload: {
value: nextValue,
event
}
});
};
const createKeyEvent = type => event => {
/**
* Persist allows for the (Synthetic) event to be used outside of
* this function call.
* https://reactjs.org/docs/events.html#event-pooling
*/
if (event && event.persist) {
event.persist();
}
dispatch({
type,
payload: {
event
}
});
};
const createDragEvent = type => dragProps => {
dispatch({
type,
payload: dragProps
});
};
/**
* Actions for the reducer
*/
const change = createChangeEvent(actionTypes.CHANGE);
const invalidate = createChangeEvent(actionTypes.INVALIDATE);
const reset = createChangeEvent(actionTypes.RESET);
const commit = createChangeEvent(actionTypes.COMMIT);
const update = createChangeEvent(actionTypes.UPDATE);
const dragStart = createDragEvent(actionTypes.DRAG_START);
const drag = createDragEvent(actionTypes.DRAG);
const dragEnd = createDragEvent(actionTypes.DRAG_END);
const pressUp = createKeyEvent(actionTypes.PRESS_UP);
const pressDown = createKeyEvent(actionTypes.PRESS_DOWN);
const pressEnter = createKeyEvent(actionTypes.PRESS_ENTER);
return {
change,
commit,
dispatch,
drag,
dragEnd,
dragStart,
invalidate,
pressDown,
pressEnter,
pressUp,
reset,
state,
update
};
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/values.js
/* eslint-disable jsdoc/valid-types */
/**
* Determines if a value is null or undefined.
*
* @template T
*
* @param {T | null | undefined} value The value to check.
* @return {value is T} Whether value is not null or undefined.
*/
function isValueDefined(value) {
return value !== undefined && value !== null;
}
/* eslint-enable jsdoc/valid-types */
/* eslint-disable jsdoc/valid-types */
/**
* Determines if a value is empty, null, or undefined.
*
* @template T
*
* @param {T | "" | null | undefined} value The value to check.
* @return {value is T} Whether value is empty.
*/
function isValueEmpty(value) {
const isEmptyString = value === '';
return !isValueDefined(value) || isEmptyString;
}
/* eslint-enable jsdoc/valid-types */
/**
* Get the first defined/non-null value from an array.
*
* @template T
*
* @param {Array<T | null | undefined>} values Values to derive from.
* @param {T} fallbackValue Fallback value if there are no defined values.
* @return {T} A defined value or the fallback value.
*/
function getDefinedValue(values = [], fallbackValue) {
var _values$find;
return (_values$find = values.find(isValueDefined)) !== null && _values$find !== void 0 ? _values$find : fallbackValue;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/hooks/use-update-effect.js
/**
* WordPress dependencies
*/
/**
* A `React.useEffect` that will not run on the first render.
* Source:
* https://github.com/reakit/reakit/blob/HEAD/packages/reakit-utils/src/useUpdateEffect.ts
*
* @param {import('react').EffectCallback} effect
* @param {import('react').DependencyList} deps
*/
function useUpdateEffect(effect, deps) {
const mounted = Object(external_wp_element_["useRef"])(false);
Object(external_wp_element_["useEffect"])(() => {
if (mounted.current) {
return effect();
}
mounted.current = true;
return undefined;
}, deps);
}
/* harmony default export */ var use_update_effect = (useUpdateEffect);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/input-field.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function InputField({
disabled = false,
dragDirection = 'n',
dragThreshold = 10,
id,
isDragEnabled = false,
isFocused,
isPressEnterToChange = false,
onBlur = external_lodash_["noop"],
onChange = external_lodash_["noop"],
onDrag = external_lodash_["noop"],
onDragEnd = external_lodash_["noop"],
onDragStart = external_lodash_["noop"],
onFocus = external_lodash_["noop"],
onKeyDown = external_lodash_["noop"],
onValidate = external_lodash_["noop"],
size = 'default',
setIsFocused,
stateReducer = state => state,
value: valueProp,
type,
...props
}, ref) {
const {
// State
state,
// Actions
change,
commit,
drag,
dragEnd,
dragStart,
invalidate,
pressDown,
pressEnter,
pressUp,
reset,
update
} = useInputControlStateReducer(stateReducer, {
isDragEnabled,
value: valueProp,
isPressEnterToChange
});
const {
_event,
value,
isDragging,
isDirty
} = state;
const wasDirtyOnBlur = Object(external_wp_element_["useRef"])(false);
const dragCursor = useDragCursor(isDragging, dragDirection);
/*
* Handles synchronization of external and internal value state.
* If not focused and did not hold a dirty value[1] on blur
* updates the value from the props. Otherwise if not holding
* a dirty value[1] propagates the value and event through onChange.
* [1] value is only made dirty if isPressEnterToChange is true
*/
use_update_effect(() => {
if (valueProp === value) {
return;
}
if (!isFocused && !wasDirtyOnBlur.current) {
update(valueProp);
} else if (!isDirty) {
onChange(value, {
event: _event
});
wasDirtyOnBlur.current = false;
}
}, [value, isDirty, isFocused, valueProp]);
const handleOnBlur = event => {
onBlur(event);
setIsFocused(false);
/**
* If isPressEnterToChange is set, this commits the value to
* the onChange callback.
*/
if (isPressEnterToChange && isDirty) {
wasDirtyOnBlur.current = true;
if (!isValueEmpty(value)) {
handleOnCommit(event);
} else {
reset(valueProp);
}
}
};
const handleOnFocus = event => {
onFocus(event);
setIsFocused(true);
};
const handleOnChange = event => {
const nextValue = event.target.value;
change(nextValue, event);
};
const handleOnCommit = event => {
const nextValue = event.target.value;
try {
onValidate(nextValue, event);
commit(nextValue, event);
} catch (err) {
invalidate(err, event);
}
};
const handleOnKeyDown = event => {
const {
keyCode
} = event;
onKeyDown(event);
switch (keyCode) {
case external_wp_keycodes_["UP"]:
pressUp(event);
break;
case external_wp_keycodes_["DOWN"]:
pressDown(event);
break;
case external_wp_keycodes_["ENTER"]:
pressEnter(event);
if (isPressEnterToChange) {
event.preventDefault();
handleOnCommit(event);
}
break;
}
};
const dragGestureProps = useDrag(dragProps => {
const {
distance,
dragging,
event
} = dragProps; // The event is persisted to prevent errors in components using this
// to check if a modifier key was held while dragging.
event.persist();
if (!distance) return;
event.stopPropagation();
/**
* Quick return if no longer dragging.
* This prevents unnecessary value calculations.
*/
if (!dragging) {
onDragEnd(dragProps);
dragEnd(dragProps);
return;
}
onDrag(dragProps);
drag(dragProps);
if (!isDragging) {
onDragStart(dragProps);
dragStart(dragProps);
}
}, {
threshold: dragThreshold,
enabled: isDragEnabled
});
const dragProps = isDragEnabled ? dragGestureProps() : {};
/*
* Works around the odd UA (e.g. Firefox) that does not focus inputs of
* type=number when their spinner arrows are pressed.
*/
let handleOnMouseDown;
if (type === 'number') {
handleOnMouseDown = event => {
var _props$onMouseDown;
(_props$onMouseDown = props.onMouseDown) === null || _props$onMouseDown === void 0 ? void 0 : _props$onMouseDown.call(props, event);
if (event.target !== event.target.ownerDocument.activeElement) {
event.target.focus();
}
};
}
return Object(external_wp_element_["createElement"])(input_control_styles_Input, Object(esm_extends["a" /* default */])({}, props, dragProps, {
className: "components-input-control__input",
disabled: disabled,
dragCursor: dragCursor,
isDragging: isDragging,
id: id,
onBlur: handleOnBlur,
onChange: handleOnChange,
onFocus: handleOnFocus,
onKeyDown: handleOnKeyDown,
onMouseDown: handleOnMouseDown,
ref: ref,
size: size,
value: value,
type: type
}));
}
const ForwardedComponent = Object(external_wp_element_["forwardRef"])(InputField);
/* harmony default export */ var input_field = (ForwardedComponent);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/input-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function input_control_useUniqueId(idProp) {
const instanceId = Object(external_wp_compose_["useInstanceId"])(InputControl);
const id = `inspector-input-control-${instanceId}`;
return idProp || id;
}
function InputControl({
__unstableStateReducer: stateReducer = state => state,
__unstableInputWidth,
className,
disabled = false,
hideLabelFromVision = false,
id: idProp,
isPressEnterToChange = false,
label,
labelPosition = 'top',
onChange = external_lodash_["noop"],
onValidate = external_lodash_["noop"],
onKeyDown = external_lodash_["noop"],
prefix,
size = 'default',
suffix,
value,
...props
}, ref) {
const [isFocused, setIsFocused] = Object(external_wp_element_["useState"])(false);
const id = input_control_useUniqueId(idProp);
const classes = classnames_default()('components-input-control', className);
return Object(external_wp_element_["createElement"])(input_base, {
__unstableInputWidth: __unstableInputWidth,
className: classes,
disabled: disabled,
gap: 3,
hideLabelFromVision: hideLabelFromVision,
id: id,
isFocused: isFocused,
justify: "left",
label: label,
labelPosition: labelPosition,
prefix: prefix,
size: size,
suffix: suffix
}, Object(external_wp_element_["createElement"])(input_field, Object(esm_extends["a" /* default */])({}, props, {
className: "components-input-control__input",
disabled: disabled,
id: id,
isFocused: isFocused,
isPressEnterToChange: isPressEnterToChange,
onChange: onChange,
onKeyDown: onKeyDown,
onValidate: onValidate,
ref: ref,
setIsFocused: setIsFocused,
size: size,
stateReducer: stateReducer,
value: value
})));
}
const input_control_ForwardedComponent = Object(external_wp_element_["forwardRef"])(InputControl);
/* harmony default export */ var input_control = (input_control_ForwardedComponent);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/number-control/styles/number-control-styles.js
function number_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
var number_control_styles_ref = true ? {
name: "1b9wwt5",
styles: "&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none !important;margin:0 !important;}"
} : undefined;
const htmlArrowStyles = ({
hideHTMLArrows
}) => {
if (!hideHTMLArrows) return ``;
return number_control_styles_ref;
};
const number_control_styles_Input = /*#__PURE__*/styled_base_browser_esm(input_control, {
target: "ep48uk90",
label: "Input"
})(htmlArrowStyles, ";" + ( true ? "" : undefined));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/math.js
/**
* External dependencies
*/
/**
* Parses and retrieves a number value.
*
* @param {unknown} value The incoming value.
*
* @return {number} The parsed number value.
*/
function getNumber(value) {
const number = Number(value);
return isNaN(number) ? 0 : number;
}
/**
* Safely adds 2 values.
*
* @param {Array<number|string>} args Values to add together.
*
* @return {number} The sum of values.
*/
function add(...args) {
return args.reduce(
/** @type {(sum:number, arg: number|string) => number} */
(sum, arg) => sum + getNumber(arg), 0);
}
/**
* Safely subtracts 2 values.
*
* @param {Array<number|string>} args Values to subtract together.
*
* @return {number} The difference of the values.
*/
function subtract(...args) {
return args.reduce(
/** @type {(diff:number, arg: number|string, index:number) => number} */
(diff, arg, index) => {
const value = getNumber(arg);
return index === 0 ? value : diff - value;
}, 0);
}
/**
* Determines the decimal position of a number value.
*
* @param {number} value The number to evaluate.
*
* @return {number} The number of decimal places.
*/
function getPrecision(value) {
const split = (value + '').split('.');
return split[1] !== undefined ? split[1].length : 0;
}
/**
* Clamps a value based on a min/max range with rounding
*
* @param {number} value The value.
* @param {number} min The minimum range.
* @param {number} max The maximum range.
* @param {number} step A multiplier for the value.
*
* @return {number} The rounded and clamped value.
*/
function roundClamp(value = 0, min = Infinity, max = Infinity, step = 1) {
const baseValue = getNumber(value);
const stepValue = getNumber(step);
const precision = getPrecision(step);
const rounded = Math.round(baseValue / stepValue) * stepValue;
const clampedValue = Object(external_lodash_["clamp"])(rounded, min, max);
return precision ? getNumber(clampedValue.toFixed(precision)) : clampedValue;
}
/**
* Clamps a value based on a min/max range with rounding.
* Returns a string.
*
* @param {Parameters<typeof roundClamp>} args Arguments for roundClamp().
* @return {string} The rounded and clamped value.
*/
function roundClampString(...args) {
return roundClamp(...args).toString();
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/hooks/use-jump-step.js
/**
* WordPress dependencies
*/
/**
* A custom hook that calculates a step value (used by elements like input
* [type="number"]). This value can be modified based on whether the Shift
* key is being held down.
*
* For example, a shiftStep of 10, and a step of 1...
* Starting from 10, the next incremented value will be 11.
*
* Holding down shift...
* Starting from 10, the next incremented value will be 20.
*
* @param {Object} props Properties for the hook.
* @param {boolean} [props.isShiftStepEnabled=true] Determines if jumping values with shift is enabled
* @param {number} [props.shiftStep=10] Multiplier to jump by, when holding shift key.
* @param {number} [props.step=1] Multiplier to jump by, when not-holding shift key.
*
* @return {number} The jump step value.
*/
function useJumpStep({
isShiftStepEnabled = true,
shiftStep = 10,
step = 1
}) {
const [isShiftKey, setIsShiftKey] = Object(external_wp_element_["useState"])(false);
Object(external_wp_element_["useEffect"])(() => {
/** @type {(event: KeyboardEvent)=>void} */
const handleShiftKeyToggle = event => {
setIsShiftKey(event.shiftKey);
};
window.addEventListener('keydown', handleShiftKeyToggle);
window.addEventListener('keyup', handleShiftKeyToggle);
return () => {
window.removeEventListener('keydown', handleShiftKeyToggle);
window.removeEventListener('keyup', handleShiftKeyToggle);
};
}, []);
const isEnabled = isShiftStepEnabled && isShiftKey;
return isEnabled ? shiftStep * step : step;
}
/* harmony default export */ var use_jump_step = (useJumpStep);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/number-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function NumberControl({
__unstableStateReducer: stateReducer = state => state,
className,
dragDirection = 'n',
hideHTMLArrows = false,
isDragEnabled = true,
isShiftStepEnabled = true,
label,
max = Infinity,
min = -Infinity,
shiftStep = 10,
step = 1,
type: typeProp = 'number',
value: valueProp,
...props
}, ref) {
const baseValue = roundClamp(0, min, max, step);
const jumpStep = use_jump_step({
step,
shiftStep,
isShiftStepEnabled
});
const autoComplete = typeProp === 'number' ? 'off' : null;
const classes = classnames_default()('components-number-control', className);
/**
* "Middleware" function that intercepts updates from InputControl.
* This allows us to tap into actions to transform the (next) state for
* InputControl.
*
* @param {Object} state State from InputControl
* @param {Object} action Action triggering state change
* @return {Object} The updated state to apply to InputControl
*/
const numberControlStateReducer = (state, action) => {
const {
type,
payload
} = action;
const event = payload === null || payload === void 0 ? void 0 : payload.event;
const currentValue = state.value;
/**
* Handles custom UP and DOWN Keyboard events
*/
if (type === inputControlActionTypes.PRESS_UP || type === inputControlActionTypes.PRESS_DOWN) {
const enableShift = event.shiftKey && isShiftStepEnabled;
const incrementalValue = enableShift ? parseFloat(shiftStep) * parseFloat(step) : parseFloat(step);
let nextValue = isValueEmpty(currentValue) ? baseValue : currentValue;
if (event !== null && event !== void 0 && event.preventDefault) {
event.preventDefault();
}
if (type === inputControlActionTypes.PRESS_UP) {
nextValue = add(nextValue, incrementalValue);
}
if (type === inputControlActionTypes.PRESS_DOWN) {
nextValue = subtract(nextValue, incrementalValue);
}
nextValue = roundClamp(nextValue, min, max, incrementalValue);
state.value = nextValue;
}
/**
* Handles drag to update events
*/
if (type === inputControlActionTypes.DRAG && isDragEnabled) {
const {
delta,
shiftKey
} = payload;
const [x, y] = delta;
const modifier = shiftKey ? parseFloat(shiftStep) * parseFloat(step) : parseFloat(step);
let directionModifier;
let directionBaseValue;
switch (dragDirection) {
case 'n':
directionBaseValue = y;
directionModifier = -1;
break;
case 'e':
directionBaseValue = x;
directionModifier = Object(external_wp_i18n_["isRTL"])() ? -1 : 1;
break;
case 's':
directionBaseValue = y;
directionModifier = 1;
break;
case 'w':
directionBaseValue = x;
directionModifier = Object(external_wp_i18n_["isRTL"])() ? 1 : -1;
break;
}
const distance = directionBaseValue * modifier * directionModifier;
let nextValue;
if (distance !== 0) {
nextValue = roundClamp(add(currentValue, distance), min, max, modifier);
state.value = nextValue;
}
}
/**
* Handles commit (ENTER key press or on blur if isPressEnterToChange)
*/
if (type === inputControlActionTypes.PRESS_ENTER || type === inputControlActionTypes.COMMIT) {
state.value = roundClamp(currentValue, min, max);
}
return state;
};
return Object(external_wp_element_["createElement"])(number_control_styles_Input, Object(esm_extends["a" /* default */])({
autoComplete: autoComplete,
inputMode: "numeric"
}, props, {
className: classes,
dragDirection: dragDirection,
hideHTMLArrows: hideHTMLArrows,
isDragEnabled: isDragEnabled,
label: label,
max: max,
min: min,
ref: ref,
step: jumpStep,
type: typeProp,
value: valueProp,
__unstableStateReducer: composeStateReducers(numberControlStateReducer, stateReducer)
}));
}
/* harmony default export */ var number_control = (Object(external_wp_element_["forwardRef"])(NumberControl));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/angle-picker-control/styles/angle-picker-control-styles.js
function angle_picker_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* Internal dependencies
*/
const CIRCLE_SIZE = 30;
const angle_picker_control_styles_Root = /*#__PURE__*/styled_base_browser_esm(flex_component, {
target: "e65ony40",
label: "Root"
})( true ? {
name: "tn9ygg",
styles: "max-width:200px;"
} : undefined);
const CircleRoot = styled_base_browser_esm("div", {
target: "e65ony41",
label: "CircleRoot"
})("border-radius:50%;border:1px solid ", COLORS.ui.borderLight, ";box-sizing:border-box;cursor:grab;height:", CIRCLE_SIZE, "px;overflow:hidden;width:", CIRCLE_SIZE, "px;" + ( true ? "" : undefined));
const CircleIndicatorWrapper = styled_base_browser_esm("div", {
target: "e65ony42",
label: "CircleIndicatorWrapper"
})( true ? {
name: "11t5m37",
styles: "box-sizing:border-box;position:relative;width:100%;height:100%;"
} : undefined);
const CircleIndicator = styled_base_browser_esm("div", {
target: "e65ony43",
label: "CircleIndicator"
})("background:", COLORS.ui.border, ";border-radius:50%;border:3px solid ", COLORS.ui.border, ";bottom:0;box-sizing:border-box;display:block;height:1px;left:0;margin:auto;position:absolute;right:0;top:-", CIRCLE_SIZE / 2, "px;width:1px;" + ( true ? "" : undefined));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/angle-picker-control/angle-circle.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function AngleCircle({
value,
onChange,
...props
}) {
const angleCircleRef = Object(external_wp_element_["useRef"])();
const angleCircleCenter = Object(external_wp_element_["useRef"])();
const previousCursorValue = Object(external_wp_element_["useRef"])();
const setAngleCircleCenter = () => {
const rect = angleCircleRef.current.getBoundingClientRect();
angleCircleCenter.current = {
x: rect.x + rect.width / 2,
y: rect.y + rect.height / 2
};
};
const changeAngleToPosition = event => {
const {
x: centerX,
y: centerY
} = angleCircleCenter.current;
const {
ownerDocument
} = angleCircleRef.current; // Prevent (drag) mouse events from selecting and accidentally
// triggering actions from other elements.
event.preventDefault(); // Ensure the input isn't focused as preventDefault would leave it
ownerDocument.activeElement.blur();
onChange(getAngle(centerX, centerY, event.clientX, event.clientY));
};
const {
startDrag,
isDragging
} = Object(external_wp_compose_["__experimentalUseDragging"])({
onDragStart: event => {
setAngleCircleCenter();
changeAngleToPosition(event);
},
onDragMove: changeAngleToPosition,
onDragEnd: changeAngleToPosition
});
Object(external_wp_element_["useEffect"])(() => {
if (isDragging) {
if (previousCursorValue.current === undefined) {
previousCursorValue.current = document.body.style.cursor;
}
document.body.style.cursor = 'grabbing';
} else {
document.body.style.cursor = previousCursorValue.current || null;
previousCursorValue.current = undefined;
}
}, [isDragging]);
return (
/* eslint-disable jsx-a11y/no-static-element-interactions */
Object(external_wp_element_["createElement"])(CircleRoot, Object(esm_extends["a" /* default */])({
ref: angleCircleRef,
onMouseDown: startDrag,
className: "components-angle-picker-control__angle-circle",
style: isDragging ? {
cursor: 'grabbing'
} : undefined
}, props), Object(external_wp_element_["createElement"])(CircleIndicatorWrapper, {
style: value ? {
transform: `rotate(${value}deg)`
} : undefined,
className: "components-angle-picker-control__angle-circle-indicator-wrapper"
}, Object(external_wp_element_["createElement"])(CircleIndicator, {
className: "components-angle-picker-control__angle-circle-indicator"
})))
/* eslint-enable jsx-a11y/no-static-element-interactions */
);
}
function getAngle(centerX, centerY, pointX, pointY) {
const y = pointY - centerY;
const x = pointX - centerX;
const angleInRadians = Math.atan2(y, x);
const angleInDeg = Math.round(angleInRadians * (180 / Math.PI)) + 90;
if (angleInDeg < 0) {
return 360 + angleInDeg;
}
return angleInDeg;
}
/* harmony default export */ var angle_circle = (AngleCircle);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/angle-picker-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function AnglePickerControl({
className,
hideLabelFromVision,
id: idProp,
label = Object(external_wp_i18n_["__"])('Angle'),
onChange,
value,
...props
}) {
const instanceId = Object(external_wp_compose_["useInstanceId"])(AnglePickerControl, 'components-angle-picker-control__input');
const id = idProp || instanceId;
const handleOnNumberChange = unprocessedValue => {
const inputValue = unprocessedValue !== '' ? parseInt(unprocessedValue, 10) : 0;
onChange(inputValue);
};
const classes = classnames_default()('components-angle-picker-control', className);
return Object(external_wp_element_["createElement"])(base_control, Object(esm_extends["a" /* default */])({
className: classes,
hideLabelFromVision: hideLabelFromVision,
id: id,
label: label
}, props), Object(external_wp_element_["createElement"])(angle_picker_control_styles_Root, null, Object(external_wp_element_["createElement"])(flex_block_component, null, Object(external_wp_element_["createElement"])(number_control, {
className: "components-angle-picker-control__input-field",
id: id,
max: 360,
min: 0,
onChange: handleOnNumberChange,
step: "1",
value: value
})), Object(external_wp_element_["createElement"])(flex_item_component, null, Object(external_wp_element_["createElement"])(angle_circle, {
"aria-hidden": "true",
value: value,
onChange: onChange
}))));
}
// EXTERNAL MODULE: external ["wp","richText"]
var external_wp_richText_ = __webpack_require__("qRz9");
// EXTERNAL MODULE: external ["wp","a11y"]
var external_wp_a11y_ = __webpack_require__("gdqT");
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/button/index.js
var build_module_button = __webpack_require__("kA6J");
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/popover/index.js + 1 modules
var build_module_popover = __webpack_require__("oXO/");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/autocomplete/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* A raw completer option.
*
* @typedef {*} CompleterOption
*/
/**
* @callback FnGetOptions
*
* @return {(CompleterOption[]|Promise.<CompleterOption[]>)} The completer options or a promise for them.
*/
/**
* @callback FnGetOptionKeywords
* @param {CompleterOption} option a completer option.
*
* @return {string[]} list of key words to search.
*/
/**
* @callback FnIsOptionDisabled
* @param {CompleterOption} option a completer option.
*
* @return {string[]} whether or not the given option is disabled.
*/
/**
* @callback FnGetOptionLabel
* @param {CompleterOption} option a completer option.
*
* @return {(string|Array.<(string|WPElement)>)} list of react components to render.
*/
/**
* @callback FnAllowContext
* @param {string} before the string before the auto complete trigger and query.
* @param {string} after the string after the autocomplete trigger and query.
*
* @return {boolean} true if the completer can handle.
*/
/**
* @typedef {Object} OptionCompletion
* @property {'insert-at-caret'|'replace'} action the intended placement of the completion.
* @property {OptionCompletionValue} value the completion value.
*/
/**
* A completion value.
*
* @typedef {(string|WPElement|Object)} OptionCompletionValue
*/
/**
* @callback FnGetOptionCompletion
* @param {CompleterOption} value the value of the completer option.
* @param {string} query the text value of the autocomplete query.
*
* @return {(OptionCompletion|OptionCompletionValue)} the completion for the given option. If an
* OptionCompletionValue is returned, the
* completion action defaults to `insert-at-caret`.
*/
/**
* @typedef {Object} WPCompleter
* @property {string} name a way to identify a completer, useful for selective overriding.
* @property {?string} className A class to apply to the popup menu.
* @property {string} triggerPrefix the prefix that will display the menu.
* @property {(CompleterOption[]|FnGetOptions)} options the completer options or a function to get them.
* @property {?FnGetOptionKeywords} getOptionKeywords get the keywords for a given option.
* @property {?FnIsOptionDisabled} isOptionDisabled get whether or not the given option is disabled.
* @property {FnGetOptionLabel} getOptionLabel get the label for a given option.
* @property {?FnAllowContext} allowContext filter the context under which the autocomplete activates.
* @property {FnGetOptionCompletion} getOptionCompletion get the completion associated with a given option.
*/
function filterOptions(search, options = [], maxResults = 10) {
const filtered = [];
for (let i = 0; i < options.length; i++) {
const option = options[i]; // Merge label into keywords
let {
keywords = []
} = option;
if ('string' === typeof option.label) {
keywords = [...keywords, option.label];
}
const isMatch = keywords.some(keyword => search.test(Object(external_lodash_["deburr"])(keyword)));
if (!isMatch) {
continue;
}
filtered.push(option); // Abort early if max reached
if (filtered.length === maxResults) {
break;
}
}
return filtered;
}
const getAutoCompleterUI = autocompleter => {
const useItems = autocompleter.useItems ? autocompleter.useItems : filterValue => {
const [items, setItems] = Object(external_wp_element_["useState"])([]);
/*
* We support both synchronous and asynchronous retrieval of completer options
* but internally treat all as async so we maintain a single, consistent code path.
*
* Because networks can be slow, and the internet is wonderfully unpredictable,
* we don't want two promises updating the state at once. This ensures that only
* the most recent promise will act on `optionsData`. This doesn't use the state
* because `setState` is batched, and so there's no guarantee that setting
* `activePromise` in the state would result in it actually being in `this.state`
* before the promise resolves and we check to see if this is the active promise or not.
*/
Object(external_wp_element_["useLayoutEffect"])(() => {
const {
options,
isDebounced
} = autocompleter;
const loadOptions = Object(external_lodash_["debounce"])(() => {
const promise = Promise.resolve(typeof options === 'function' ? options(filterValue) : options).then(optionsData => {
if (promise.canceled) {
return;
}
const keyedOptions = optionsData.map((optionData, optionIndex) => ({
key: `${autocompleter.name}-${optionIndex}`,
value: optionData,
label: autocompleter.getOptionLabel(optionData),
keywords: autocompleter.getOptionKeywords ? autocompleter.getOptionKeywords(optionData) : [],
isDisabled: autocompleter.isOptionDisabled ? autocompleter.isOptionDisabled(optionData) : false
})); // create a regular expression to filter the options
const search = new RegExp('(?:\\b|\\s|^)' + Object(external_lodash_["escapeRegExp"])(filterValue), 'i');
setItems(filterOptions(search, keyedOptions));
});
return promise;
}, isDebounced ? 250 : 0);
const promise = loadOptions();
return () => {
loadOptions.cancel();
if (promise) {
promise.canceled = true;
}
};
}, [filterValue]);
return [items];
};
function AutocompleterUI({
filterValue,
instanceId,
listBoxId,
className,
selectedIndex,
onChangeOptions,
onSelect,
onReset,
value,
contentRef
}) {
const [items] = useItems(filterValue);
const anchorRef = Object(external_wp_richText_["useAnchorRef"])({
ref: contentRef,
value
});
Object(external_wp_element_["useLayoutEffect"])(() => {
onChangeOptions(items);
}, [items]);
if (!items.length > 0) {
return null;
}
return Object(external_wp_element_["createElement"])(build_module_popover["a" /* default */], {
focusOnMount: false,
onClose: onReset,
position: "top right",
className: "components-autocomplete__popover",
anchorRef: anchorRef
}, Object(external_wp_element_["createElement"])("div", {
id: listBoxId,
role: "listbox",
className: "components-autocomplete__results"
}, Object(external_lodash_["map"])(items, (option, index) => Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
key: option.key,
id: `components-autocomplete-item-${instanceId}-${option.key}`,
role: "option",
"aria-selected": index === selectedIndex,
disabled: option.isDisabled,
className: classnames_default()('components-autocomplete__result', className, {
'is-selected': index === selectedIndex
}),
onClick: () => onSelect(option)
}, option.label))));
}
return AutocompleterUI;
};
function useAutocomplete({
record,
onChange,
onReplace,
completers,
contentRef
}) {
const debouncedSpeak = Object(external_wp_compose_["useDebounce"])(external_wp_a11y_["speak"], 500);
const instanceId = Object(external_wp_compose_["useInstanceId"])(useAutocomplete);
const [selectedIndex, setSelectedIndex] = Object(external_wp_element_["useState"])(0);
const [filteredOptions, setFilteredOptions] = Object(external_wp_element_["useState"])([]);
const [filterValue, setFilterValue] = Object(external_wp_element_["useState"])('');
const [autocompleter, setAutocompleter] = Object(external_wp_element_["useState"])(null);
const [AutocompleterUI, setAutocompleterUI] = Object(external_wp_element_["useState"])(null);
const [backspacing, setBackspacing] = Object(external_wp_element_["useState"])(false);
function insertCompletion(replacement) {
const end = record.start;
const start = end - autocompleter.triggerPrefix.length - filterValue.length;
const toInsert = Object(external_wp_richText_["create"])({
html: Object(external_wp_element_["renderToString"])(replacement)
});
onChange(Object(external_wp_richText_["insert"])(record, toInsert, start, end));
}
function select(option) {
const {
getOptionCompletion
} = autocompleter || {};
if (option.isDisabled) {
return;
}
if (getOptionCompletion) {
const completion = getOptionCompletion(option.value, filterValue);
const {
action,
value
} = undefined === completion.action || undefined === completion.value ? {
action: 'insert-at-caret',
value: completion
} : completion;
if ('replace' === action) {
onReplace([value]);
} else if ('insert-at-caret' === action) {
insertCompletion(value);
}
} // Reset autocomplete state after insertion rather than before
// so insertion events don't cause the completion menu to redisplay.
reset();
}
function reset() {
setSelectedIndex(0);
setFilteredOptions([]);
setFilterValue('');
setAutocompleter(null);
setAutocompleterUI(null);
}
function announce(options) {
if (!debouncedSpeak) {
return;
}
if (!!options.length) {
debouncedSpeak(Object(external_wp_i18n_["sprintf"])(
/* translators: %d: number of results. */
Object(external_wp_i18n_["_n"])('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', options.length), options.length), 'assertive');
} else {
debouncedSpeak(Object(external_wp_i18n_["__"])('No results.'), 'assertive');
}
}
/**
* Load options for an autocompleter.
*
* @param {Array} options
*/
function onChangeOptions(options) {
setSelectedIndex(options.length === filteredOptions.length ? selectedIndex : 0);
setFilteredOptions(options);
announce(options);
}
function handleKeyDown(event) {
setBackspacing(event.keyCode === external_wp_keycodes_["BACKSPACE"]);
if (!autocompleter) {
return;
}
if (filteredOptions.length === 0) {
return;
}
switch (event.keyCode) {
case external_wp_keycodes_["UP"]:
setSelectedIndex((selectedIndex === 0 ? filteredOptions.length : selectedIndex) - 1);
break;
case external_wp_keycodes_["DOWN"]:
setSelectedIndex((selectedIndex + 1) % filteredOptions.length);
break;
case external_wp_keycodes_["ESCAPE"]:
setAutocompleter(null);
setAutocompleterUI(null);
break;
case external_wp_keycodes_["ENTER"]:
select(filteredOptions[selectedIndex]);
break;
case external_wp_keycodes_["LEFT"]:
case external_wp_keycodes_["RIGHT"]:
reset();
return;
default:
return;
} // Any handled keycode should prevent original behavior. This relies on
// the early return in the default case.
event.preventDefault();
event.stopPropagation();
}
let textContent;
if (Object(external_wp_richText_["isCollapsed"])(record)) {
textContent = Object(external_wp_richText_["getTextContent"])(Object(external_wp_richText_["slice"])(record, 0));
}
Object(external_wp_element_["useEffect"])(() => {
if (!textContent) {
return;
}
const text = Object(external_lodash_["deburr"])(textContent);
const textAfterSelection = Object(external_wp_richText_["getTextContent"])(Object(external_wp_richText_["slice"])(record, undefined, Object(external_wp_richText_["getTextContent"])(record).length));
const completer = Object(external_lodash_["find"])(completers, ({
triggerPrefix,
allowContext
}) => {
const index = text.lastIndexOf(triggerPrefix);
if (index === -1) {
return false;
}
const textWithoutTrigger = text.slice(index + triggerPrefix.length);
const tooDistantFromTrigger = textWithoutTrigger.length > 50; // 50 chars seems to be a good limit.
// This is a final barrier to prevent the effect from completing with
// an extremely long string, which causes the editor to slow-down
// significantly. This could happen, for example, if `matchingWhileBackspacing`
// is true and one of the "words" end up being too long. If that's the case,
// it will be caught by this guard.
if (tooDistantFromTrigger) return false;
const mismatch = filteredOptions.length === 0;
const wordsFromTrigger = textWithoutTrigger.split(/\s/); // We need to allow the effect to run when not backspacing and if there
// was a mismatch. i.e when typing a trigger + the match string or when
// clicking in an existing trigger word on the page. We do that if we
// detect that we have one word from trigger in the current textual context.
//
// Ex.: "Some text @a" <-- "@a" will be detected as the trigger word and
// allow the effect to run. It will run until there's a mismatch.
const hasOneTriggerWord = wordsFromTrigger.length === 1; // This is used to allow the effect to run when backspacing and if
// "touching" a word that "belongs" to a trigger. We consider a "trigger
// word" any word up to the limit of 3 from the trigger character.
// Anything beyond that is ignored if there's a mismatch. This allows
// us to "escape" a mismatch when backspacing, but still imposing some
// sane limits.
//
// Ex: "Some text @marcelo sekkkk" <--- "kkkk" caused a mismatch, but
// if the user presses backspace here, it will show the completion popup again.
const matchingWhileBackspacing = backspacing && textWithoutTrigger.split(/\s/).length <= 3;
if (mismatch && !(matchingWhileBackspacing || hasOneTriggerWord)) {
return false;
}
if (allowContext && !allowContext(text.slice(0, index), textAfterSelection)) {
return false;
}
if (/^\s/.test(textWithoutTrigger) || /\s\s+$/.test(textWithoutTrigger)) {
return false;
}
return /[\u0000-\uFFFF]*$/.test(textWithoutTrigger);
});
if (!completer) {
reset();
return;
}
const safeTrigger = Object(external_lodash_["escapeRegExp"])(completer.triggerPrefix);
const match = text.slice(text.lastIndexOf(completer.triggerPrefix)).match(new RegExp(`${safeTrigger}([\u0000-\uFFFF]*)$`));
const query = match && match[1];
setAutocompleter(completer);
setAutocompleterUI(() => completer !== autocompleter ? getAutoCompleterUI(completer) : AutocompleterUI);
setFilterValue(query);
}, [textContent]);
const {
key: selectedKey = ''
} = filteredOptions[selectedIndex] || {};
const {
className
} = autocompleter || {};
const isExpanded = !!autocompleter && filteredOptions.length > 0;
const listBoxId = isExpanded ? `components-autocomplete-listbox-${instanceId}` : null;
const activeId = isExpanded ? `components-autocomplete-item-${instanceId}-${selectedKey}` : null;
return {
listBoxId,
activeId,
onKeyDown: handleKeyDown,
popover: AutocompleterUI && Object(external_wp_element_["createElement"])(AutocompleterUI, {
className: className,
filterValue: filterValue,
instanceId: instanceId,
listBoxId: listBoxId,
selectedIndex: selectedIndex,
onChangeOptions: onChangeOptions,
onSelect: select,
value: record,
contentRef: contentRef
})
};
}
function useAutocompleteProps(options) {
const ref = Object(external_wp_element_["useRef"])();
const onKeyDownRef = Object(external_wp_element_["useRef"])();
const {
popover,
listBoxId,
activeId,
onKeyDown
} = useAutocomplete({ ...options,
contentRef: ref
});
onKeyDownRef.current = onKeyDown;
return {
ref: Object(external_wp_compose_["useMergeRefs"])([ref, Object(external_wp_compose_["useRefEffect"])(element => {
function _onKeyDown(event) {
onKeyDownRef.current(event);
}
element.addEventListener('keydown', _onKeyDown);
return () => {
element.removeEventListener('keydown', _onKeyDown);
};
}, [])]),
children: popover,
'aria-autocomplete': listBoxId ? 'list' : undefined,
'aria-owns': listBoxId,
'aria-activedescendant': activeId
};
}
function Autocomplete({
children,
isSelected,
...options
}) {
const {
popover,
...props
} = useAutocomplete(options);
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, children(props), isSelected && popover);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/styles/unit-control-styles.js
function unit_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const unit_control_styles_Root = styled_base_browser_esm("div", {
target: "e1agakv00",
label: "Root"
})( true ? {
name: "1bt0omd",
styles: "box-sizing:border-box;position:relative;"
} : undefined);
const paddingStyles = ({
disableUnits
}) => {
const value = disableUnits ? 3 : 24;
return /*#__PURE__*/css_browser_esm(rtl_rtl({
paddingRight: value
})(), ";" + ( true ? "" : undefined));
};
var unit_control_styles_ref = true ? {
name: "1y65o8",
styles: "&::-webkit-outer-spin-button,&::-webkit-inner-spin-button{-webkit-appearance:none;margin:0;}"
} : undefined;
const arrowStyles = ({
disableUnits
}) => {
if (disableUnits) return '';
return unit_control_styles_ref;
}; // TODO: Resolve need to use &&& to increase specificity
// https://github.com/WordPress/gutenberg/issues/18483
const ValueInput = /*#__PURE__*/styled_base_browser_esm(number_control, {
target: "e1agakv01",
label: "ValueInput"
})("&&&{input{appearance:none;-moz-appearance:textfield;display:block;width:100%;", arrowStyles, ";", paddingStyles, ";}}" + ( true ? "" : undefined));
const unitSizeStyles = ({
size
}) => {
const sizes = {
default: {
height: 28,
lineHeight: '24px',
minHeight: 28,
top: 1
},
small: {
height: 22,
lineHeight: '18px',
minHeight: 22,
top: 1
}
};
return /*#__PURE__*/css_browser_esm(sizes[size], true ? "" : undefined);
};
const baseUnitLabelStyles = props => {
return /*#__PURE__*/css_browser_esm("appearance:none;background:transparent;border-radius:2px;border:none;box-sizing:border-box;color:", COLORS.darkGray[500], ";display:block;font-size:8px;line-height:1;letter-spacing:-0.5px;outline:none;padding:2px 1px;position:absolute;text-align-last:center;text-transform:uppercase;width:20px;", rtl_rtl({
borderTopLeftRadius: 0,
borderBottomLeftRadius: 0
})(), " ", rtl_rtl({
right: 0
})(), " ", unitSizeStyles(props), true ? "" : undefined);
};
const UnitLabel = styled_base_browser_esm("div", {
target: "e1agakv02",
label: "UnitLabel"
})("&&&{pointer-events:none;", baseUnitLabelStyles, ";}" + ( true ? "" : undefined));
const UnitSelect = styled_base_browser_esm("select", {
target: "e1agakv03",
label: "UnitSelect"
})("&&&{", baseUnitLabelStyles, ";cursor:pointer;border:1px solid transparent;&:hover{background-color:", COLORS.lightGray[300], ";}&:focus{border-color:", COLORS.ui.borderFocus, ";outline:2px solid transparent;outline-offset:0;}&:disabled{cursor:initial;&:hover{background-color:transparent;}}}" + ( true ? "" : undefined));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/utils.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const isWeb = external_wp_element_["Platform"].OS === 'web';
/**
* An array of all available CSS length units.
*/
const ALL_CSS_UNITS = [{
value: 'px',
label: isWeb ? 'px' : Object(external_wp_i18n_["__"])('Pixels (px)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Pixels (px)')
}, {
value: '%',
label: isWeb ? '%' : Object(external_wp_i18n_["__"])('Percentage (%)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Percent (%)')
}, {
value: 'em',
label: isWeb ? 'em' : Object(external_wp_i18n_["__"])('Relative to parent font size (em)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Relative to parent font size (em)')
}, {
value: 'rem',
label: isWeb ? 'rem' : Object(external_wp_i18n_["__"])('Relative to root font size (rem)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Relative to root font size (rem)')
}, {
value: 'vw',
label: isWeb ? 'vw' : Object(external_wp_i18n_["__"])('Viewport width (vw)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Viewport width (vw)')
}, {
value: 'vh',
label: isWeb ? 'vh' : Object(external_wp_i18n_["__"])('Viewport height (vh)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Viewport height (vh)')
}, {
value: 'vmin',
label: isWeb ? 'vmin' : Object(external_wp_i18n_["__"])('Viewport smallest dimension (vmin)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Viewport smallest dimension (vmin)')
}, {
value: 'vmax',
label: isWeb ? 'vmax' : Object(external_wp_i18n_["__"])('Viewport largest dimension (vmax)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Viewport largest dimension (vmax)')
}, {
value: 'ch',
label: isWeb ? 'ch' : Object(external_wp_i18n_["__"])('Width of the zero (0) character (ch)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Width of the zero (0) character (ch)')
}, {
value: 'ex',
label: isWeb ? 'ex' : Object(external_wp_i18n_["__"])('x-height of the font (ex)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('x-height of the font (ex)')
}, {
value: 'cm',
label: isWeb ? 'cm' : Object(external_wp_i18n_["__"])('Centimeters (cm)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Centimeters (cm)')
}, {
value: 'mm',
label: isWeb ? 'mm' : Object(external_wp_i18n_["__"])('Millimeters (mm)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Millimeters (mm)')
}, {
value: 'in',
label: isWeb ? 'in' : Object(external_wp_i18n_["__"])('Inches (in)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Inches (in)')
}, {
value: 'pc',
label: isWeb ? 'pc' : Object(external_wp_i18n_["__"])('Picas (pc)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Picas (pc)')
}, {
value: 'pt',
label: isWeb ? 'pt' : Object(external_wp_i18n_["__"])('Points (pt)'),
default: '',
a11yLabel: Object(external_wp_i18n_["__"])('Points (pt)')
}];
/**
* Units of measurements. `a11yLabel` is used by screenreaders.
*/
const CSS_UNITS = [{
value: 'px',
label: 'px',
default: 0,
a11yLabel: Object(external_wp_i18n_["__"])('pixels')
}, {
value: '%',
label: '%',
default: 10,
a11yLabel: Object(external_wp_i18n_["__"])('percent')
}, {
value: 'em',
label: 'em',
default: 0,
a11yLabel: Object(external_wp_i18n_["_x"])('ems', 'Relative to parent font size (em)')
}, {
value: 'rem',
label: 'rem',
default: 0,
a11yLabel: Object(external_wp_i18n_["_x"])('rems', 'Relative to root font size (rem)')
}, {
value: 'vw',
label: 'vw',
default: 10,
a11yLabel: Object(external_wp_i18n_["__"])('viewport widths')
}, {
value: 'vh',
label: 'vh',
default: 10,
a11yLabel: Object(external_wp_i18n_["__"])('viewport heights')
}];
const DEFAULT_UNIT = CSS_UNITS[0];
/**
* Handles legacy value + unit handling.
* This component use to manage both incoming value and units separately.
*
* Moving forward, ideally the value should be a string that contains both
* the value and unit, example: '10px'
*
* @param {number|string} value Value
* @param {string} unit Unit value
* @param {Array<Object>} units Units to derive from.
* @return {Array<number, string>} The extracted number and unit.
*/
function getParsedValue(value, unit, units) {
const initialValue = unit ? `${value}${unit}` : value;
return parseUnit(initialValue, units);
}
/**
* Checks if units are defined.
*
* @param {any} units Units to check.
* @return {boolean} Whether units are defined.
*/
function utils_hasUnits(units) {
return !Object(external_lodash_["isEmpty"])(units) && units.length > 1 && units !== false;
}
/**
* Parses a number and unit from a value.
*
* @param {string} initialValue Value to parse
* @param {Array<Object>} units Units to derive from.
* @return {Array<number, string>} The extracted number and unit.
*/
function parseUnit(initialValue, units = ALL_CSS_UNITS) {
const value = String(initialValue).trim();
let num = parseFloat(value, 10);
num = isNaN(num) ? '' : num;
const unitMatch = value.match(/[\d.\-\+]*\s*(.*)/)[1];
let unit = unitMatch !== undefined ? unitMatch : '';
unit = unit.toLowerCase();
if (utils_hasUnits(units)) {
const match = units.find(item => item.value === unit);
unit = match === null || match === void 0 ? void 0 : match.value;
} else {
unit = DEFAULT_UNIT.value;
}
return [num, unit];
}
/**
* Parses a number and unit from a value. Validates parsed value, using fallback
* value if invalid.
*
* @param {number|string} next The next value.
* @param {Array<Object>} units Units to derive from.
* @param {number|string} fallbackValue The fallback value.
* @param {string} fallbackUnit The fallback value.
* @return {Array<number, string>} The extracted number and unit.
*/
function getValidParsedUnit(next, units, fallbackValue, fallbackUnit) {
const [parsedValue, parsedUnit] = parseUnit(next, units);
let baseValue = parsedValue;
let baseUnit;
if (isNaN(parsedValue) || parsedValue === '') {
baseValue = fallbackValue;
}
baseUnit = parsedUnit || fallbackUnit;
/**
* If no unit is found, attempt to use the first value from the collection
* of units as a default fallback.
*/
if (utils_hasUnits(units) && !baseUnit) {
var _units$;
baseUnit = (_units$ = units[0]) === null || _units$ === void 0 ? void 0 : _units$.value;
}
return [baseValue, baseUnit];
}
/**
* Takes a unit value and finds the matching accessibility label for the
* unit abbreviation.
*
* @param {string} unit Unit value (example: px)
* @return {string} a11y label for the unit abbreviation
*/
function parseA11yLabelForUnit(unit) {
const match = ALL_CSS_UNITS.find(item => item.value === unit);
return match !== null && match !== void 0 && match.a11yLabel ? match === null || match === void 0 ? void 0 : match.a11yLabel : match === null || match === void 0 ? void 0 : match.value;
}
/**
* Filters available units based on values defined by settings.
*
* @param {Array} settings Collection of preferred units.
* @param {Array} units Collection of available units.
*
* @return {Array} Filtered units based on settings.
*/
function filterUnitsWithSettings(settings = [], units = []) {
return units.filter(unit => {
return settings.includes(unit.value);
});
}
/**
* Custom hook to retrieve and consolidate units setting from add_theme_support().
* TODO: ideally this hook shouldn't be needed
* https://github.com/WordPress/gutenberg/pull/31822#discussion_r633280823
*
* @param {Object} args An object containing units, settingPath & defaultUnits.
* @param {Object} args.units Collection of available units.
* @param {string} args.availableUnits The setting path. Defaults to 'spacing.units'.
* @param {Object} args.defaultValues Collection of default values for defined units. Example: { px: '350', em: '15' }.
*
* @return {Array} Filtered units based on settings.
*/
const useCustomUnits = ({
units,
availableUnits,
defaultValues
}) => {
units = units || ALL_CSS_UNITS;
const usedUnits = filterUnitsWithSettings(!availableUnits ? [] : availableUnits, units);
if (defaultValues) {
usedUnits.forEach((unit, i) => {
if (defaultValues[unit.value]) {
usedUnits[i].default = defaultValues[unit.value];
}
});
}
return usedUnits.length === 0 ? false : usedUnits;
};
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/unit-select-control.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
/**
* Renders a `select` if there are multiple units.
* Otherwise, renders a non-selectable label.
*
* @param {Object} props Component props.
* @param {string} [props.className] Class to set on the `select` element.
* @param {boolean} [props.isTabbable=true] Whether the control can be focused via keyboard navigation.
* @param {Array} [props.options=CSS_UNITS] Available units to select from.
* @param {Function} [props.onChange=noop] A callback function invoked when the value is changed.
* @param {string} [props.size="default"] Size of the control option. Supports "default" and "small".
* @param {string} [props.value="px"] Current unit.
*/
function UnitSelectControl({
className,
isTabbable = true,
options = CSS_UNITS,
onChange = external_lodash_["noop"],
size = 'default',
value = 'px',
...props
}) {
if (!utils_hasUnits(options)) {
return Object(external_wp_element_["createElement"])(UnitLabel, {
className: "components-unit-control__unit-label",
size: size
}, value);
}
const handleOnChange = event => {
const {
value: unitValue
} = event.target;
const data = options.find(option => option.value === unitValue);
onChange(unitValue, {
event,
data
});
};
const classes = classnames_default()('components-unit-control__select', className);
return Object(external_wp_element_["createElement"])(UnitSelect, Object(esm_extends["a" /* default */])({
className: classes,
onChange: handleOnChange,
size: size,
tabIndex: isTabbable ? null : '-1',
value: value
}, props), options.map(option => Object(external_wp_element_["createElement"])("option", {
value: option.value,
key: option.value
}, option.label)));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/hooks/use-controlled-state.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* @template T
* @typedef Options
* @property {T | undefined} initial Initial value
* @property {T | ""} fallback Fallback value
*/
/** @type {Readonly<{ initial: undefined, fallback: '' }>} */
const defaultOptions = {
initial: undefined,
/**
* Defaults to empty string, as that is preferred for usage with
* <input />, <textarea />, and <select /> form elements.
*/
fallback: ''
};
/**
* Custom hooks for "controlled" components to track and consolidate internal
* state and incoming values. This is useful for components that render
* `input`, `textarea`, or `select` HTML elements.
*
* https://reactjs.org/docs/forms.html#controlled-components
*
* At first, a component using useControlledState receives an initial prop
* value, which is used as initial internal state.
*
* This internal state can be maintained and updated without
* relying on new incoming prop values.
*
* Unlike the basic useState hook, useControlledState's state can
* be updated if a new incoming prop value is changed.
*
* @template T
*
* @param {T | undefined} currentState The current value.
* @param {Options<T>} [options=defaultOptions] Additional options for the hook.
*
* @return {[T | "", (nextState: T) => void]} The controlled value and the value setter.
*/
function useControlledState(currentState, options = defaultOptions) {
const {
initial,
fallback
} = { ...defaultOptions,
...options
};
const [internalState, setInternalState] = Object(external_wp_element_["useState"])(currentState);
const hasCurrentState = isValueDefined(currentState);
/*
* Resets internal state if value every changes from uncontrolled <-> controlled.
*/
Object(external_wp_element_["useEffect"])(() => {
if (hasCurrentState && internalState) {
setInternalState(undefined);
}
}, [hasCurrentState, internalState]);
const state = getDefinedValue([currentState, internalState, initial], fallback);
/* eslint-disable jsdoc/no-undefined-types */
/** @type {(nextState: T) => void} */
const setState = nextState => {
if (!hasCurrentState) {
setInternalState(nextState);
}
};
/* eslint-enable jsdoc/no-undefined-types */
return [state, setState];
}
/* harmony default export */ var use_controlled_state = (useControlledState);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/unit-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function UnitControl({
__unstableStateReducer: stateReducer = state => state,
autoComplete = 'off',
className,
disabled = false,
disableUnits = false,
isPressEnterToChange = false,
isResetValueOnUnitChange = false,
isUnitSelectTabbable = true,
label,
onChange = external_lodash_["noop"],
onUnitChange = external_lodash_["noop"],
size = 'default',
style,
unit: unitProp,
units = CSS_UNITS,
value: valueProp,
...props
}, ref) {
const [value, initialUnit] = getParsedValue(valueProp, unitProp, units);
const [unit, setUnit] = use_controlled_state(unitProp, {
initial: initialUnit
}); // Stores parsed value for hand-off in state reducer
const refParsedValue = Object(external_wp_element_["useRef"])(null);
const classes = classnames_default()('components-unit-control', className);
const handleOnChange = (next, changeProps) => {
if (next === '') {
onChange('', changeProps);
return;
}
/*
* Customizing the onChange callback.
* This allows as to broadcast a combined value+unit to onChange.
*/
next = getValidParsedUnit(next, units, value, unit).join('');
onChange(next, changeProps);
};
const handleOnUnitChange = (next, changeProps) => {
const {
data
} = changeProps;
let nextValue = `${value}${next}`;
if (isResetValueOnUnitChange && (data === null || data === void 0 ? void 0 : data.default) !== undefined) {
nextValue = `${data.default}${next}`;
}
onChange(nextValue, changeProps);
onUnitChange(next, changeProps);
setUnit(next);
};
const mayUpdateUnit = event => {
if (!isNaN(event.target.value)) {
refParsedValue.current = null;
return;
}
const [parsedValue, parsedUnit] = getValidParsedUnit(event.target.value, units, value, unit);
refParsedValue.current = parsedValue;
if (isPressEnterToChange && parsedUnit !== unit) {
const data = units.find(option => option.value === parsedUnit);
const changeProps = {
event,
data
};
onChange(`${parsedValue}${parsedUnit}`, changeProps);
onUnitChange(parsedUnit, changeProps);
setUnit(parsedUnit);
}
};
const handleOnBlur = mayUpdateUnit;
const handleOnKeyDown = event => {
const {
keyCode
} = event;
if (keyCode === external_wp_keycodes_["ENTER"]) {
mayUpdateUnit(event);
}
};
/**
* "Middleware" function that intercepts updates from InputControl.
* This allows us to tap into actions to transform the (next) state for
* InputControl.
*
* @param {Object} state State from InputControl
* @param {Object} action Action triggering state change
* @return {Object} The updated state to apply to InputControl
*/
const unitControlStateReducer = (state, action) => {
/*
* On commits (when pressing ENTER and on blur if
* isPressEnterToChange is true), if a parse has been performed
* then use that result to update the state.
*/
if (action.type === inputControlActionTypes.COMMIT) {
if (refParsedValue.current !== null) {
state.value = refParsedValue.current;
refParsedValue.current = null;
}
}
return state;
};
const inputSuffix = !disableUnits ? Object(external_wp_element_["createElement"])(UnitSelectControl, {
"aria-label": Object(external_wp_i18n_["__"])('Select unit'),
disabled: disabled,
isTabbable: isUnitSelectTabbable,
options: units,
onChange: handleOnUnitChange,
size: size,
value: unit
}) : null;
let step = props.step;
/*
* If no step prop has been passed, lookup the active unit and
* try to get step from `units`, or default to a value of `1`
*/
if (!step && units) {
var _activeUnit$step;
const activeUnit = units.find(option => option.value === unit);
step = (_activeUnit$step = activeUnit === null || activeUnit === void 0 ? void 0 : activeUnit.step) !== null && _activeUnit$step !== void 0 ? _activeUnit$step : 1;
}
return Object(external_wp_element_["createElement"])(unit_control_styles_Root, {
className: "components-unit-control-wrapper",
style: style
}, Object(external_wp_element_["createElement"])(ValueInput, Object(esm_extends["a" /* default */])({
"aria-label": label,
type: isPressEnterToChange ? 'text' : 'number'
}, Object(external_lodash_["omit"])(props, ['children']), {
autoComplete: autoComplete,
className: classes,
disabled: disabled,
disableUnits: disableUnits,
isPressEnterToChange: isPressEnterToChange,
label: label,
onBlur: handleOnBlur,
onKeyDown: handleOnKeyDown,
onChange: handleOnChange,
ref: ref,
size: size,
suffix: inputSuffix,
value: value,
step: step,
__unstableStateReducer: composeStateReducers(unitControlStateReducer, stateReducer)
})));
}
const ForwardedUnitControl = Object(external_wp_element_["forwardRef"])(UnitControl);
/* harmony default export */ var unit_control = (ForwardedUnitControl);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/styles/box-control-styles.js
function box_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const box_control_styles_Root = styled_base_browser_esm("div", {
target: "e7pk0lh0",
label: "Root"
})( true ? {
name: "vho1ao",
styles: "box-sizing:border-box;max-width:235px;padding-bottom:12px;width:100%;"
} : undefined);
const Header = /*#__PURE__*/styled_base_browser_esm(flex_component, {
target: "e7pk0lh1",
label: "Header"
})("color:", COLORS.ui.label, ";padding-bottom:8px;" + ( true ? "" : undefined));
const HeaderControlWrapper = /*#__PURE__*/styled_base_browser_esm(flex_component, {
target: "e7pk0lh2",
label: "HeaderControlWrapper"
})( true ? {
name: "19de7qh",
styles: "min-height:30px;"
} : undefined);
const UnitControlWrapper = styled_base_browser_esm("div", {
target: "e7pk0lh3",
label: "UnitControlWrapper"
})( true ? {
name: "zypm0w",
styles: "box-sizing:border-box;max-width:80px;"
} : undefined);
const LayoutContainer = /*#__PURE__*/styled_base_browser_esm(flex_component, {
target: "e7pk0lh4",
label: "LayoutContainer"
})( true ? {
name: "39f89t",
styles: "justify-content:center;padding-top:8px;"
} : undefined);
const Layout = /*#__PURE__*/styled_base_browser_esm(flex_component, {
target: "e7pk0lh5",
label: "Layout"
})( true ? {
name: "qpveuy",
styles: "position:relative;height:100%;width:100%;justify-content:flex-start;"
} : undefined);
var box_control_styles_ref = true ? {
name: "icip60",
styles: "border-radius:2px;"
} : undefined;
var box_control_styles_ref2 = true ? {
name: "1k07npk",
styles: "border-radius:0;"
} : undefined;
const unitControlBorderRadiusStyles = ({
isFirst,
isLast,
isOnly
}) => {
if (isFirst) {
return rtl_rtl({
borderTopRightRadius: 0,
borderBottomRightRadius: 0
})();
}
if (isLast) {
return rtl_rtl({
borderTopLeftRadius: 0,
borderBottomLeftRadius: 0
})();
}
if (isOnly) {
return box_control_styles_ref;
}
return box_control_styles_ref2;
};
const unitControlMarginStyles = ({
isFirst
}) => {
const marginLeft = isFirst ? 0 : -1;
return rtl_rtl({
marginLeft
})();
};
const box_control_styles_UnitControl = /*#__PURE__*/styled_base_browser_esm(unit_control, {
target: "e7pk0lh6",
label: "UnitControl"
})("max-width:60px;", unitControlBorderRadiusStyles, ";", unitControlMarginStyles, ";" + ( true ? "" : undefined));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/unit-control.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function BoxUnitControl({
isFirst,
isLast,
isOnly,
onHoverOn = external_lodash_["noop"],
onHoverOff = external_lodash_["noop"],
label,
value,
...props
}) {
const bindHoverGesture = useHover(({
event,
...state
}) => {
if (state.hovering) {
onHoverOn(event, state);
} else {
onHoverOff(event, state);
}
});
return Object(external_wp_element_["createElement"])(UnitControlWrapper, bindHoverGesture(), Object(external_wp_element_["createElement"])(Tooltip, {
text: label
}, Object(external_wp_element_["createElement"])(box_control_styles_UnitControl, Object(esm_extends["a" /* default */])({
"aria-label": label,
className: "component-box-control__unit-control",
hideHTMLArrows: true,
isFirst: isFirst,
isLast: isLast,
isOnly: isOnly,
isPressEnterToChange: true,
isResetValueOnUnitChange: false,
value: value
}, props))));
}
function Tooltip({
children,
text
}) {
if (!text) return children;
/**
* Wrapping the children in a `<div />` as Tooltip as it attempts
* to render the <UnitControl />. Using a plain `<div />` appears to
* resolve this issue.
*
* Originally discovered and referenced here:
* https://github.com/WordPress/gutenberg/pull/24966#issuecomment-685875026
*/
return Object(external_wp_element_["createElement"])(build_module_tooltip["a" /* default */], {
text: text,
position: "top"
}, Object(external_wp_element_["createElement"])("div", null, children));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/utils.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const LABELS = {
all: Object(external_wp_i18n_["__"])('All'),
top: Object(external_wp_i18n_["__"])('Top'),
bottom: Object(external_wp_i18n_["__"])('Bottom'),
left: Object(external_wp_i18n_["__"])('Left'),
right: Object(external_wp_i18n_["__"])('Right'),
mixed: Object(external_wp_i18n_["__"])('Mixed')
};
const DEFAULT_VALUES = {
top: null,
right: null,
bottom: null,
left: null
};
const DEFAULT_VISUALIZER_VALUES = {
top: false,
right: false,
bottom: false,
left: false
};
/**
* Gets an items with the most occurance within an array
* https://stackoverflow.com/a/20762713
*
* @param {Array<any>} arr Array of items to check.
* @return {any} The item with the most occurances.
*/
function mode(arr) {
return arr.sort((a, b) => arr.filter(v => v === a).length - arr.filter(v => v === b).length).pop();
}
/**
* Gets the 'all' input value and unit from values data.
*
* @param {Object} values Box values.
* @return {string} A value + unit for the 'all' input.
*/
function getAllValue(values = {}) {
const parsedValues = Object.values(values).map(value => parseUnit(value));
const allValues = parsedValues.map(value => value[0]);
const allUnits = parsedValues.map(value => value[1]);
const value = allValues.every(v => v === allValues[0]) ? allValues[0] : '';
const unit = mode(allUnits);
/**
* The isNumber check is important. On reset actions, the incoming value
* may be null or an empty string.
*
* Also, the value may also be zero (0), which is considered a valid unit value.
*
* isNumber() is more specific for these cases, rather than relying on a
* simple truthy check.
*/
const allValue = Object(external_lodash_["isNumber"])(value) ? `${value}${unit}` : null;
return allValue;
}
/**
* Checks to determine if values are mixed.
*
* @param {Object} values Box values.
* @return {boolean} Whether values are mixed.
*/
function isValuesMixed(values = {}) {
const allValue = getAllValue(values);
const isMixed = isNaN(parseFloat(allValue));
return isMixed;
}
/**
* Checks to determine if values are defined.
*
* @param {Object} values Box values.
*
* @return {boolean} Whether values are mixed.
*/
function isValuesDefined(values) {
return values !== undefined && !Object(external_lodash_["isEmpty"])(Object.values(values).filter( // Switching units when input is empty causes values only
// containing units. This gives false positive on mixed values
// unless filtered.
value => !!value && /\d/.test(value)));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/all-input-control.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function AllInputControl({
onChange = external_lodash_["noop"],
onFocus = external_lodash_["noop"],
onHoverOn = external_lodash_["noop"],
onHoverOff = external_lodash_["noop"],
values,
sides,
...props
}) {
const allValue = getAllValue(values);
const hasValues = isValuesDefined(values);
const isMixed = hasValues && isValuesMixed(values);
const allPlaceholder = isMixed ? LABELS.mixed : null;
const handleOnFocus = event => {
onFocus(event, {
side: 'all'
});
};
const handleOnChange = next => {
const nextValues = { ...values
};
const selectedSides = sides !== null && sides !== void 0 && sides.length ? sides : ['top', 'right', 'bottom', 'left'];
selectedSides.forEach(side => nextValues[side] = next);
onChange(nextValues);
};
const handleOnHoverOn = () => {
onHoverOn({
top: true,
bottom: true,
left: true,
right: true
});
};
const handleOnHoverOff = () => {
onHoverOff({
top: false,
bottom: false,
left: false,
right: false
});
};
return Object(external_wp_element_["createElement"])(BoxUnitControl, Object(esm_extends["a" /* default */])({}, props, {
disableUnits: isMixed,
isOnly: true,
value: allValue,
onChange: handleOnChange,
onFocus: handleOnFocus,
onHoverOn: handleOnHoverOn,
onHoverOff: handleOnHoverOff,
placeholder: allPlaceholder
}));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/input-controls.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const allSides = ['top', 'right', 'bottom', 'left'];
function BoxInputControls({
onChange = external_lodash_["noop"],
onFocus = external_lodash_["noop"],
onHoverOn = external_lodash_["noop"],
onHoverOff = external_lodash_["noop"],
values,
sides,
...props
}) {
const createHandleOnFocus = side => event => {
onFocus(event, {
side
});
};
const createHandleOnHoverOn = side => () => {
onHoverOn({
[side]: true
});
};
const createHandleOnHoverOff = side => () => {
onHoverOff({
[side]: false
});
};
const handleOnChange = nextValues => {
onChange(nextValues);
};
const createHandleOnChange = side => (next, {
event
}) => {
const {
altKey
} = event;
const nextValues = { ...values
};
nextValues[side] = next;
/**
* Supports changing pair sides. For example, holding the ALT key
* when changing the TOP will also update BOTTOM.
*/
if (altKey) {
switch (side) {
case 'top':
nextValues.bottom = next;
break;
case 'bottom':
nextValues.top = next;
break;
case 'left':
nextValues.right = next;
break;
case 'right':
nextValues.left = next;
break;
}
}
handleOnChange(nextValues);
}; // Filter sides if custom configuration provided, maintaining default order.
const filteredSides = sides !== null && sides !== void 0 && sides.length ? allSides.filter(side => sides.includes(side)) : allSides;
const first = filteredSides[0];
const last = filteredSides[filteredSides.length - 1];
const only = first === last && first;
return Object(external_wp_element_["createElement"])(LayoutContainer, {
className: "component-box-control__input-controls-wrapper"
}, Object(external_wp_element_["createElement"])(Layout, {
gap: 0,
align: "top",
className: "component-box-control__input-controls"
}, filteredSides.map(side => Object(external_wp_element_["createElement"])(BoxUnitControl, Object(esm_extends["a" /* default */])({}, props, {
isFirst: first === side,
isLast: last === side,
isOnly: only === side,
value: values[side],
onChange: createHandleOnChange(side),
onFocus: createHandleOnFocus(side),
onHoverOn: createHandleOnHoverOn(side),
onHoverOff: createHandleOnHoverOff(side),
label: LABELS[side],
key: `box-control-${side}`
})))));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/styles/box-control-icon-styles.js
function box_control_icon_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
const box_control_icon_styles_Root = styled_base_browser_esm("span", {
target: "eaw9yqk0",
label: "Root"
})( true ? {
name: "1qtciqq",
styles: "box-sizing:border-box;display:block;width:24px;height:24px;position:relative;padding:4px;"
} : undefined);
const Viewbox = styled_base_browser_esm("span", {
target: "eaw9yqk1",
label: "Viewbox"
})( true ? {
name: "be7uli",
styles: "box-sizing:border-box;display:block;position:relative;width:100%;height:100%;"
} : undefined);
const strokeFocus = ({
isFocused
}) => {
return /*#__PURE__*/css_browser_esm({
backgroundColor: 'currentColor',
opacity: isFocused ? 1 : 0.3
}, true ? "" : undefined);
};
const Stroke = styled_base_browser_esm("span", {
target: "eaw9yqk2",
label: "Stroke"
})("box-sizing:border-box;display:block;pointer-events:none;position:absolute;", strokeFocus, ";" + ( true ? "" : undefined));
const VerticalStroke = /*#__PURE__*/styled_base_browser_esm(Stroke, {
target: "eaw9yqk3",
label: "VerticalStroke"
})( true ? {
name: "r820ty",
styles: "bottom:3px;top:3px;width:2px;"
} : undefined);
const HorizontalStroke = /*#__PURE__*/styled_base_browser_esm(Stroke, {
target: "eaw9yqk4",
label: "HorizontalStroke"
})( true ? {
name: "1gteeqa",
styles: "height:2px;left:3px;right:3px;"
} : undefined);
const TopStroke = /*#__PURE__*/styled_base_browser_esm(HorizontalStroke, {
target: "eaw9yqk5",
label: "TopStroke"
})( true ? {
name: "1etxbbi",
styles: "top:0;"
} : undefined);
const RightStroke = /*#__PURE__*/styled_base_browser_esm(VerticalStroke, {
target: "eaw9yqk6",
label: "RightStroke"
})( true ? {
name: "19zs6va",
styles: "right:0;"
} : undefined);
const BottomStroke = /*#__PURE__*/styled_base_browser_esm(HorizontalStroke, {
target: "eaw9yqk7",
label: "BottomStroke"
})( true ? {
name: "lh0t43",
styles: "bottom:0;"
} : undefined);
const LeftStroke = /*#__PURE__*/styled_base_browser_esm(VerticalStroke, {
target: "eaw9yqk8",
label: "LeftStroke"
})( true ? {
name: "260zpl",
styles: "left:0;"
} : undefined);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/icon.js
/**
* Internal dependencies
*/
const BASE_ICON_SIZE = 24;
function BoxControlIcon({
size = 24,
side = 'all',
sides,
...props
}) {
const isSideDisabled = value => (sides === null || sides === void 0 ? void 0 : sides.length) && !sides.includes(value);
const getSide = value => {
if (isSideDisabled(value)) {
return false;
}
return side === 'all' || side === value;
};
const top = getSide('top');
const right = getSide('right');
const bottom = getSide('bottom');
const left = getSide('left'); // Simulates SVG Icon scaling
const scale = size / BASE_ICON_SIZE;
return Object(external_wp_element_["createElement"])(box_control_icon_styles_Root, Object(esm_extends["a" /* default */])({
style: {
transform: `scale(${scale})`
}
}, props), Object(external_wp_element_["createElement"])(Viewbox, null, Object(external_wp_element_["createElement"])(TopStroke, {
isFocused: top
}), Object(external_wp_element_["createElement"])(RightStroke, {
isFocused: right
}), Object(external_wp_element_["createElement"])(BottomStroke, {
isFocused: bottom
}), Object(external_wp_element_["createElement"])(LeftStroke, {
isFocused: left
})));
}
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/link.js
var library_link = __webpack_require__("Bpkj");
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/link-off.js
var link_off = __webpack_require__("Mp0b");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/linked-button.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function LinkedButton({
isLinked,
...props
}) {
const label = isLinked ? Object(external_wp_i18n_["__"])('Unlink Sides') : Object(external_wp_i18n_["__"])('Link Sides');
return Object(external_wp_element_["createElement"])(build_module_tooltip["a" /* default */], {
text: label
}, Object(external_wp_element_["createElement"])("span", null, Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], Object(esm_extends["a" /* default */])({}, props, {
className: "component-box-control__linked-button",
isPrimary: isLinked,
isSecondary: !isLinked,
isSmall: true,
icon: isLinked ? library_link["a" /* default */] : link_off["a" /* default */],
iconSize: 16,
"aria-label": label
}))));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/styles/box-control-visualizer-styles.js
function box_control_visualizer_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
var box_control_visualizer_styles_ref = true ? {
name: "tbck19",
styles: "bottom:0;left:0;pointer-events:none;position:absolute;right:0;top:0;z-index:1;"
} : undefined;
const containerPositionStyles = ({
isPositionAbsolute
}) => {
if (!isPositionAbsolute) return '';
return box_control_visualizer_styles_ref;
};
const box_control_visualizer_styles_Container = styled_base_browser_esm("div", {
target: "e1df9b4q0",
label: "Container"
})("box-sizing:border-box;position:relative;", containerPositionStyles, ";" + ( true ? "" : undefined));
const Side = styled_base_browser_esm("div", {
target: "e1df9b4q1",
label: "Side"
})("box-sizing:border-box;background:", COLORS.blue.wordpress[700], ";background:", COLORS.ui.theme, ";filter:brightness( 1 );opacity:0;position:absolute;pointer-events:none;transition:opacity 120ms linear;z-index:1;", ({
isActive
}) => isActive && `
opacity: 0.3;
`, true ? "" : undefined);
const TopView = /*#__PURE__*/styled_base_browser_esm(Side, {
target: "e1df9b4q2",
label: "TopView"
})( true ? {
name: "1pb21am",
styles: "top:0;left:0;right:0;"
} : undefined);
const RightView = /*#__PURE__*/styled_base_browser_esm(Side, {
target: "e1df9b4q3",
label: "RightView"
})("top:0;bottom:0;", rtl_rtl({
right: 0
}), ";" + ( true ? "" : undefined));
const BottomView = /*#__PURE__*/styled_base_browser_esm(Side, {
target: "e1df9b4q4",
label: "BottomView"
})( true ? {
name: "w87m56",
styles: "bottom:0;left:0;right:0;"
} : undefined);
const LeftView = /*#__PURE__*/styled_base_browser_esm(Side, {
target: "e1df9b4q5",
label: "LeftView"
})("top:0;bottom:0;", rtl_rtl({
left: 0
}), ";" + ( true ? "" : undefined));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/visualizer.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function BoxControlVisualizer({
children,
showValues = DEFAULT_VISUALIZER_VALUES,
values: valuesProp = DEFAULT_VALUES,
...props
}) {
const isPositionAbsolute = !children;
return Object(external_wp_element_["createElement"])(box_control_visualizer_styles_Container, Object(esm_extends["a" /* default */])({}, props, {
isPositionAbsolute: isPositionAbsolute,
"aria-hidden": "true"
}), Object(external_wp_element_["createElement"])(Sides, {
showValues: showValues,
values: valuesProp
}), children);
}
function Sides({
showValues = DEFAULT_VISUALIZER_VALUES,
values
}) {
const {
top,
right,
bottom,
left
} = values;
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(Top, {
isVisible: showValues.top,
value: top
}), Object(external_wp_element_["createElement"])(Right, {
isVisible: showValues.right,
value: right
}), Object(external_wp_element_["createElement"])(Bottom, {
isVisible: showValues.bottom,
value: bottom
}), Object(external_wp_element_["createElement"])(Left, {
isVisible: showValues.left,
value: left
}));
}
function Top({
isVisible = false,
value
}) {
const height = value;
const animationProps = useSideAnimation(height);
const isActive = animationProps.isActive || isVisible;
return Object(external_wp_element_["createElement"])(TopView, {
isActive: isActive,
style: {
height
}
});
}
function Right({
isVisible = false,
value
}) {
const width = value;
const animationProps = useSideAnimation(width);
const isActive = animationProps.isActive || isVisible;
return Object(external_wp_element_["createElement"])(RightView, {
isActive: isActive,
style: {
width
}
});
}
function Bottom({
isVisible = false,
value
}) {
const height = value;
const animationProps = useSideAnimation(height);
const isActive = animationProps.isActive || isVisible;
return Object(external_wp_element_["createElement"])(BottomView, {
isActive: isActive,
style: {
height
}
});
}
function Left({
isVisible = false,
value
}) {
const width = value;
const animationProps = useSideAnimation(width);
const isActive = animationProps.isActive || isVisible;
return Object(external_wp_element_["createElement"])(LeftView, {
isActive: isActive,
style: {
width
}
});
}
/**
* Custom hook that renders the "flash" animation whenever the value changes.
*
* @param {string} value Value of (box) side.
*/
function useSideAnimation(value) {
const [isActive, setIsActive] = Object(external_wp_element_["useState"])(false);
const valueRef = Object(external_wp_element_["useRef"])(value);
const timeoutRef = Object(external_wp_element_["useRef"])();
const clearTimer = () => {
if (timeoutRef.current) {
window.clearTimeout(timeoutRef.current);
}
};
Object(external_wp_element_["useEffect"])(() => {
if (value !== valueRef.current) {
setIsActive(true);
valueRef.current = value;
clearTimer();
timeoutRef.current = setTimeout(() => {
setIsActive(false);
}, 400);
}
return () => clearTimer();
}, [value]);
return {
isActive
};
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/box-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const defaultInputProps = {
min: 0
};
function box_control_useUniqueId(idProp) {
const instanceId = Object(external_wp_compose_["useInstanceId"])(BoxControl, 'inspector-box-control');
return idProp || instanceId;
}
function BoxControl({
id: idProp,
inputProps = defaultInputProps,
onChange = external_lodash_["noop"],
onChangeShowVisualizer = external_lodash_["noop"],
label = Object(external_wp_i18n_["__"])('Box Control'),
values: valuesProp,
units,
sides,
resetValues = DEFAULT_VALUES
}) {
const [values, setValues] = use_controlled_state(valuesProp, {
fallback: DEFAULT_VALUES
});
const inputValues = values || DEFAULT_VALUES;
const hasInitialValue = isValuesDefined(valuesProp);
const hasOneSide = (sides === null || sides === void 0 ? void 0 : sides.length) === 1;
const [isDirty, setIsDirty] = Object(external_wp_element_["useState"])(hasInitialValue);
const [isLinked, setIsLinked] = Object(external_wp_element_["useState"])(!hasInitialValue || !isValuesMixed(inputValues) || hasOneSide);
const [side, setSide] = Object(external_wp_element_["useState"])(isLinked ? 'all' : 'top');
const id = box_control_useUniqueId(idProp);
const headingId = `${id}-heading`;
const toggleLinked = () => {
setIsLinked(!isLinked);
setSide(!isLinked ? 'all' : 'top');
};
const handleOnFocus = (event, {
side: nextSide
}) => {
setSide(nextSide);
};
const handleOnChange = nextValues => {
onChange(nextValues);
setValues(nextValues);
setIsDirty(true);
};
const handleOnHoverOn = (next = {}) => {
onChangeShowVisualizer({ ...DEFAULT_VISUALIZER_VALUES,
...next
});
};
const handleOnHoverOff = (next = {}) => {
onChangeShowVisualizer({ ...DEFAULT_VISUALIZER_VALUES,
...next
});
};
const handleOnReset = () => {
onChange(resetValues);
setValues(resetValues);
setIsDirty(false);
};
const inputControlProps = { ...inputProps,
onChange: handleOnChange,
onFocus: handleOnFocus,
onHoverOn: handleOnHoverOn,
onHoverOff: handleOnHoverOff,
isLinked,
units,
sides,
values: inputValues
};
return Object(external_wp_element_["createElement"])(box_control_styles_Root, {
id: id,
role: "region",
"aria-labelledby": headingId
}, Object(external_wp_element_["createElement"])(Header, {
className: "component-box-control__header"
}, Object(external_wp_element_["createElement"])(flex_item_component, null, Object(external_wp_element_["createElement"])(text_component, {
id: headingId,
className: "component-box-control__label"
}, label)), Object(external_wp_element_["createElement"])(flex_item_component, null, Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
className: "component-box-control__reset-button",
isSecondary: true,
isSmall: true,
onClick: handleOnReset,
disabled: !isDirty
}, Object(external_wp_i18n_["__"])('Reset')))), Object(external_wp_element_["createElement"])(HeaderControlWrapper, {
className: "component-box-control__header-control-wrapper"
}, Object(external_wp_element_["createElement"])(flex_item_component, null, Object(external_wp_element_["createElement"])(BoxControlIcon, {
side: side,
sides: sides
})), isLinked && Object(external_wp_element_["createElement"])(flex_block_component, null, Object(external_wp_element_["createElement"])(AllInputControl, Object(esm_extends["a" /* default */])({
"aria-label": label
}, inputControlProps))), !hasOneSide && Object(external_wp_element_["createElement"])(flex_item_component, null, Object(external_wp_element_["createElement"])(LinkedButton, {
onClick: toggleLinked,
isLinked: isLinked
}))), !isLinked && Object(external_wp_element_["createElement"])(BoxInputControls, inputControlProps));
}
BoxControl.__Visualizer = BoxControlVisualizer;
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/button-group/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function ButtonGroup({
className,
...props
}, ref) {
const classes = classnames_default()('components-button-group', className);
return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({
ref: ref,
role: "group",
className: classes
}, props));
}
/* harmony default export */ var button_group = (Object(external_wp_element_["forwardRef"])(ButtonGroup));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/context.js
/**
* WordPress dependencies
*/
const CardContext = Object(external_wp_element_["createContext"])({});
const useCardContext = () => Object(external_wp_element_["useContext"])(CardContext);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/styles/card-styles.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const styleProps = {
borderColor: COLORS.lightGray[500],
borderRadius: '3px',
backgroundShady: COLORS.lightGray[200]
};
const {
borderColor: card_styles_borderColor,
borderRadius,
backgroundShady
} = styleProps;
const CardUI = styled_base_browser_esm("div", {
target: "e1q7k77g0",
label: "CardUI"
})("background:", COLORS.white, ";box-sizing:border-box;border-radius:", borderRadius, ";border:1px solid ", card_styles_borderColor, ";", handleBorderless, ";&.is-elevated{box-shadow:0px 1px 3px 0px rgba( 0,0,0,0.2 ),0px 1px 1px 0px rgba( 0,0,0,0.14 ),0px 2px 1px -1px rgba( 0,0,0,0.12 );}" + ( true ? "" : undefined));
const HeaderUI = /*#__PURE__*/styled_base_browser_esm(flex_component, {
target: "e1q7k77g1",
label: "HeaderUI"
})("border-bottom:1px solid ", card_styles_borderColor, ";border-top-left-radius:", borderRadius, ";border-top-right-radius:", borderRadius, ";box-sizing:border-box;&:last-child{border-bottom:none;}", headerFooterSizes, ";", handleBorderless, ";", handleShady, ";" + ( true ? "" : undefined));
const MediaUI = styled_base_browser_esm("div", {
target: "e1q7k77g2",
label: "MediaUI"
})("box-sizing:border-box;overflow:hidden;& > img,& > iframe{display:block;height:auto;max-width:100%;width:100%;}&:first-of-type{border-top-left-radius:", borderRadius, ";border-top-right-radius:", borderRadius, ";}&:last-of-type{border-bottom-left-radius:", borderRadius, ";border-bottom-right-radius:", borderRadius, ";}" + ( true ? "" : undefined));
const BodyUI = styled_base_browser_esm("div", {
target: "e1q7k77g3",
label: "BodyUI"
})("box-sizing:border-box;", bodySize, ";", handleShady, ";" + ( true ? "" : undefined));
const FooterUI = /*#__PURE__*/styled_base_browser_esm(flex_component, {
target: "e1q7k77g4",
label: "FooterUI"
})("border-top:1px solid ", card_styles_borderColor, ";border-bottom-left-radius:", borderRadius, ";border-bottom-right-radius:", borderRadius, ";box-sizing:border-box;&:first-of-type{border-top:none;}", headerFooterSizes, ";", handleBorderless, ";", handleShady, ";" + ( true ? "" : undefined));
const DividerUI = /*#__PURE__*/styled_base_browser_esm(external_wp_primitives_["HorizontalRule"], {
target: "e1q7k77g5",
label: "DividerUI"
})("all:unset;border-top:1px solid ", card_styles_borderColor, ";box-sizing:border-box;display:block;height:0;width:100%;" + ( true ? "" : undefined));
function bodySize() {
return `
&.is-size {
&-large {
padding: ${space(3)} ${space(4)};
}
&-medium {
padding: ${space(2)} ${space(3)};
}
&-small {
padding: ${space(2)};
}
&-extraSmall {
padding: ${space(1)};
}
}
`;
}
function headerFooterSizes() {
return `
&.is-size {
&-large {
padding: ${space(3)} ${space(4)};
}
&-medium {
padding: ${space(2)} ${space(3)};
}
&-small {
padding: ${space(2)};
}
&-extraSmall {
padding: ${space(1)};
}
}
`;
}
function handleBorderless() {
return `
&.is-borderless {
border: none;
}
`;
}
function handleShady() {
return `
&.is-shady {
background: ${backgroundShady};
}
`;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/index.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const card_defaultProps = {
isBorderless: false,
isElevated: false,
size: 'medium'
};
function Card(props) {
const {
className,
isBorderless,
isElevated,
size,
...additionalProps
} = props;
const {
Provider
} = CardContext;
const contextProps = {
isBorderless,
isElevated,
size
};
const classes = classnames_default()('components-card', isBorderless && 'is-borderless', isElevated && 'is-elevated', size && `is-size-${size}`, className);
return Object(external_wp_element_["createElement"])(Provider, {
value: contextProps
}, Object(external_wp_element_["createElement"])(CardUI, Object(esm_extends["a" /* default */])({}, additionalProps, {
className: classes
})));
}
Card.defaultProps = card_defaultProps;
/* harmony default export */ var card = (Card);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/body.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const body_defaultProps = {
isShady: false,
size: 'medium'
};
function CardBody(props) {
const {
className,
isShady,
...additionalProps
} = props;
const mergedProps = { ...body_defaultProps,
...useCardContext(),
...props
};
const {
size
} = mergedProps;
const classes = classnames_default()('components-card__body', isShady && 'is-shady', size && `is-size-${size}`, className);
return Object(external_wp_element_["createElement"])(BodyUI, Object(esm_extends["a" /* default */])({}, additionalProps, {
className: classes
}));
}
/* harmony default export */ var card_body = (CardBody);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/divider.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function CardDivider(props) {
const {
className,
...additionalProps
} = props;
const classes = classnames_default()('components-card__divider', className);
return Object(external_wp_element_["createElement"])(DividerUI, Object(esm_extends["a" /* default */])({}, additionalProps, {
children: null,
className: classes,
role: "separator"
}));
}
/* harmony default export */ var divider = (CardDivider);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/footer.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const footer_defaultProps = {
isBorderless: false,
isShady: false,
size: 'medium'
};
function CardFooter(props) {
const {
className,
isShady,
...additionalProps
} = props;
const mergedProps = { ...footer_defaultProps,
...useCardContext(),
...props
};
const {
isBorderless,
size
} = mergedProps;
const classes = classnames_default()('components-card__footer', isBorderless && 'is-borderless', isShady && 'is-shady', size && `is-size-${size}`, className);
return Object(external_wp_element_["createElement"])(FooterUI, Object(esm_extends["a" /* default */])({}, additionalProps, {
className: classes
}));
}
/* harmony default export */ var footer = (CardFooter);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/header.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const header_defaultProps = {
isBorderless: false,
isShady: false,
size: 'medium'
};
function CardHeader(props) {
const {
className,
isShady,
...additionalProps
} = props;
const mergedProps = { ...header_defaultProps,
...useCardContext(),
...props
};
const {
isBorderless,
size
} = mergedProps;
const classes = classnames_default()('components-card__header', isBorderless && 'is-borderless', isShady && 'is-shady', size && `is-size-${size}`, className);
return Object(external_wp_element_["createElement"])(HeaderUI, Object(esm_extends["a" /* default */])({}, additionalProps, {
className: classes
}));
}
/* harmony default export */ var card_header = (CardHeader);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/card/media.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function CardMedia(props) {
const {
className,
...additionalProps
} = props;
const classes = classnames_default()('components-card__media', className);
return Object(external_wp_element_["createElement"])(MediaUI, Object(esm_extends["a" /* default */])({}, additionalProps, {
className: classes
}));
}
/* harmony default export */ var media = (CardMedia);
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/icon/index.js
var build_module_icon = __webpack_require__("iClF");
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/check.js
var check = __webpack_require__("RMJe");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/checkbox-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function CheckboxControl({
label,
className,
heading,
checked,
help,
onChange,
...props
}) {
if (heading) {
external_wp_deprecated_default()('`heading` prop in `CheckboxControl`', {
alternative: 'a separate element to implement a heading',
plugin: 'Gutenberg'
});
}
const instanceId = Object(external_wp_compose_["useInstanceId"])(CheckboxControl);
const id = `inspector-checkbox-control-${instanceId}`;
const onChangeValue = event => onChange(event.target.checked);
return Object(external_wp_element_["createElement"])(base_control, {
label: heading,
id: id,
help: help,
className: classnames_default()('components-checkbox-control', className)
}, Object(external_wp_element_["createElement"])("span", {
className: "components-checkbox-control__input-container"
}, Object(external_wp_element_["createElement"])("input", Object(esm_extends["a" /* default */])({
id: id,
className: "components-checkbox-control__input",
type: "checkbox",
value: "1",
onChange: onChangeValue,
checked: checked,
"aria-describedby": !!help ? id + '__help' : undefined
}, props)), checked ? Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], {
icon: check["a" /* default */],
className: "components-checkbox-control__checked",
role: "presentation"
}) : null), Object(external_wp_element_["createElement"])("label", {
className: "components-checkbox-control__label",
htmlFor: id
}, label));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/clipboard-button/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const TIMEOUT = 4000;
function ClipboardButton({
className,
children,
onCopy,
onFinishCopy,
text,
...buttonProps
}) {
external_wp_deprecated_default()('wp.components.ClipboardButton', {
since: '10.3',
plugin: 'Gutenberg',
alternative: 'wp.compose.useCopyToClipboard'
});
const timeoutId = Object(external_wp_element_["useRef"])();
const ref = Object(external_wp_compose_["useCopyToClipboard"])(text, () => {
onCopy();
clearTimeout(timeoutId.current);
if (onFinishCopy) {
timeoutId.current = setTimeout(() => onFinishCopy(), TIMEOUT);
}
});
Object(external_wp_element_["useEffect"])(() => {
clearTimeout(timeoutId.current);
}, []);
const classes = classnames_default()('components-clipboard-button', className); // Workaround for inconsistent behavior in Safari, where <textarea> is not
// the document.activeElement at the moment when the copy event fires.
// This causes documentHasSelection() in the copy-handler component to
// mistakenly override the ClipboardButton, and copy a serialized string
// of the current block instead.
const focusOnCopyEventTarget = event => {
event.target.focus();
};
return Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], Object(esm_extends["a" /* default */])({}, buttonProps, {
className: classes,
ref: ref,
onCopy: focusOnCopyEventTarget
}), children);
}
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/edit.js + 1 modules
var edit = __webpack_require__("B9Az");
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js
var library_close = __webpack_require__("w95h");
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-up.js
var chevron_up = __webpack_require__("XgzB");
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-down.js
var chevron_down = __webpack_require__("NWDH");
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/plus.js
var plus = __webpack_require__("Q4Sy");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dropdown/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useObservableState(initialState, onStateChange) {
const [state, setState] = Object(external_wp_element_["useState"])(initialState);
return [state, value => {
setState(value);
if (onStateChange) {
onStateChange(value);
}
}];
}
function Dropdown({
renderContent,
renderToggle,
position = 'bottom right',
className,
contentClassName,
expandOnMobile,
headerTitle,
focusOnMount,
popoverProps,
onClose,
onToggle
}) {
var _popoverProps$anchorR;
const containerRef = Object(external_wp_element_["useRef"])();
const [isOpen, setIsOpen] = useObservableState(false, onToggle);
Object(external_wp_element_["useEffect"])(() => () => {
if (onToggle) {
onToggle(false);
}
}, []);
function toggle() {
setIsOpen(!isOpen);
}
/**
* Closes the dropdown if a focus leaves the dropdown wrapper. This is
* intentionally distinct from `onClose` since focus loss from the popover
* is expected to occur when using the Dropdown's toggle button, in which
* case the correct behavior is to keep the dropdown closed. The same applies
* in case when focus is moved to the modal dialog.
*/
function closeIfFocusOutside() {
const {
ownerDocument
} = containerRef.current;
if (!containerRef.current.contains(ownerDocument.activeElement) && !ownerDocument.activeElement.closest('[role="dialog"]')) {
close();
}
}
function close() {
if (onClose) {
onClose();
}
setIsOpen(false);
}
const args = {
isOpen,
onToggle: toggle,
onClose: close
};
return Object(external_wp_element_["createElement"])("div", {
className: classnames_default()('components-dropdown', className),
ref: containerRef
}, renderToggle(args), isOpen && Object(external_wp_element_["createElement"])(build_module_popover["a" /* default */], Object(esm_extends["a" /* default */])({
position: position,
onClose: close,
onFocusOutside: closeIfFocusOutside,
expandOnMobile: expandOnMobile,
headerTitle: headerTitle,
focusOnMount: focusOnMount
}, popoverProps, {
anchorRef: (_popoverProps$anchorR = popoverProps === null || popoverProps === void 0 ? void 0 : popoverProps.anchorRef) !== null && _popoverProps$anchorR !== void 0 ? _popoverProps$anchorR : containerRef.current,
className: classnames_default()('components-dropdown__content', popoverProps ? popoverProps.className : undefined, contentClassName)
}), renderContent(args)));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/circular-option-picker/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Option({
className,
isSelected,
selectedIconProps,
tooltipText,
...additionalProps
}) {
const optionButton = Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], Object(esm_extends["a" /* default */])({
isPressed: isSelected,
className: classnames_default()(className, 'components-circular-option-picker__option')
}, additionalProps));
return Object(external_wp_element_["createElement"])("div", {
className: "components-circular-option-picker__option-wrapper"
}, tooltipText ? Object(external_wp_element_["createElement"])(build_module_tooltip["a" /* default */], {
text: tooltipText
}, optionButton) : optionButton, isSelected && Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], Object(esm_extends["a" /* default */])({
icon: check["a" /* default */]
}, selectedIconProps ? selectedIconProps : {})));
}
function DropdownLinkAction({
buttonProps,
className,
dropdownProps,
linkText
}) {
return Object(external_wp_element_["createElement"])(Dropdown, Object(esm_extends["a" /* default */])({
className: classnames_default()('components-circular-option-picker__dropdown-link-action', className),
renderToggle: ({
isOpen,
onToggle
}) => Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], Object(esm_extends["a" /* default */])({
"aria-expanded": isOpen,
"aria-haspopup": "true",
onClick: onToggle,
isLink: true
}, buttonProps), linkText)
}, dropdownProps));
}
function ButtonAction({
className,
children,
...additionalProps
}) {
return Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], Object(esm_extends["a" /* default */])({
className: classnames_default()('components-circular-option-picker__clear', className),
isSmall: true,
isSecondary: true
}, additionalProps), children);
}
function CircularOptionPicker({
actions,
className,
options,
children
}) {
return Object(external_wp_element_["createElement"])("div", {
className: classnames_default()('components-circular-option-picker', className)
}, Object(external_wp_element_["createElement"])("div", {
className: "components-circular-option-picker__swatches"
}, options), children, actions && Object(external_wp_element_["createElement"])("div", {
className: "components-circular-option-picker__custom-clear-wrapper"
}, actions));
}
CircularOptionPicker.Option = Option;
CircularOptionPicker.ButtonAction = ButtonAction;
CircularOptionPicker.DropdownLinkAction = DropdownLinkAction;
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/utils.js
/**
* Parts of this source were derived and modified from react-color,
* released under the MIT license.
*
* https://github.com/casesandberg/react-color/
*
* Copyright (c) 2015 Case Sandberg
*
* 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.
*/
/**
* External dependencies
*/
/**
* Given a hex color, get all other color properties (rgb, alpha, etc).
*
* @param {Object|string} data A hex color string or an object with a hex property
* @param {string} oldHue A reference to the hue of the previous color, otherwise dragging the saturation to zero will reset the current hue to zero as well. See https://github.com/casesandberg/react-color/issues/29#issuecomment-132686909.
* @return {Object} An object of different color representations.
*/
function colorToState(data = {}, oldHue = false) {
const color = data.hex ? tinycolor_default()(data.hex) : tinycolor_default()(data);
const hsl = color.toHsl();
hsl.h = Math.round(hsl.h);
hsl.s = Math.round(hsl.s * 100);
hsl.l = Math.round(hsl.l * 100);
const hsv = color.toHsv();
hsv.h = Math.round(hsv.h);
hsv.s = Math.round(hsv.s * 100);
hsv.v = Math.round(hsv.v * 100);
const rgb = color.toRgb();
const hex = color.toHex();
if (hsl.s === 0) {
hsl.h = oldHue || 0;
hsv.h = oldHue || 0;
}
const transparent = hex === '000000' && rgb.a === 0;
return {
color,
hex: transparent ? 'transparent' : `#${hex}`,
hsl,
hsv,
oldHue: data.h || oldHue || hsl.h,
rgb,
source: data.source
};
}
/**
* Get the top/left offsets of a point in a container, also returns the container width/height.
*
* @param {Event} e Mouse or touch event with a location coordinate.
* @param {HTMLElement} container The container div, returned point is relative to this container.
* @return {Object} An object of the offset positions & container size.
*/
function getPointOffset(e, container) {
e.preventDefault();
const {
left: containerLeft,
top: containerTop,
width,
height
} = container.getBoundingClientRect();
const x = typeof e.pageX === 'number' ? e.pageX : e.touches[0].pageX;
const y = typeof e.pageY === 'number' ? e.pageY : e.touches[0].pageY;
let left = x - (containerLeft + window.pageXOffset);
let top = y - (containerTop + window.pageYOffset);
if (left < 0) {
left = 0;
} else if (left > width) {
left = width;
} else if (top < 0) {
top = 0;
} else if (top > height) {
top = height;
}
return {
top,
left,
width,
height
};
}
/**
* Check if a string is a valid hex color code.
*
* @param {string} hex A possible hex color.
* @return {boolean} True if the color is a valid hex color.
*/
function isValidHex(hex) {
// disable hex4 and hex8
const lh = String(hex).charAt(0) === '#' ? 1 : 0;
return hex.length !== 4 + lh && hex.length < 7 + lh && tinycolor_default()(hex).isValid();
}
/**
* Check an object for any valid color properties.
*
* @param {Object} data A possible object representing a color.
* @return {Object|boolean} If a valid representation of color, returns the data object. Otherwise returns false.
*/
function simpleCheckForValidColor(data) {
const keysToCheck = ['r', 'g', 'b', 'a', 'h', 's', 'l', 'v'];
let checked = 0;
let passed = 0;
Object(external_lodash_["each"])(keysToCheck, letter => {
if (data[letter]) {
checked += 1;
if (!isNaN(data[letter])) {
passed += 1;
}
}
});
return checked === passed ? data : false;
}
/**
* Calculate the current alpha based on a mouse or touch event
*
* @param {Event} e A mouse or touch event on the alpha bar.
* @param {Object} props The current component props
* @param {HTMLElement} container The container div for the alpha bar graph.
* @return {Object|null} If the alpha value has changed, returns a new color object.
*/
function calculateAlphaChange(e, props, container) {
const {
left,
width
} = getPointOffset(e, container);
const a = left < 0 ? 0 : Math.round(left * 100 / width) / 100;
if (props.hsl.a !== a) {
return {
h: props.hsl.h,
s: props.hsl.s,
l: props.hsl.l,
a,
source: 'rgb'
};
}
return null;
}
/**
* Calculate the current hue based on a mouse or touch event
*
* @param {Event} e A mouse or touch event on the hue bar.
* @param {Object} props The current component props
* @param {HTMLElement} container The container div for the hue bar graph.
* @return {Object|null} If the hue value has changed, returns a new color object.
*/
function calculateHueChange(e, props, container) {
const {
left,
width
} = getPointOffset(e, container);
const percent = left * 100 / width;
const h = left >= width ? 359 : 360 * percent / 100;
if (props.hsl.h !== h) {
return {
h,
s: props.hsl.s,
l: props.hsl.l,
a: props.hsl.a,
source: 'rgb'
};
}
return null;
}
/**
* Calculate the current saturation & brightness based on a mouse or touch event
*
* @param {Event} e A mouse or touch event on the saturation graph.
* @param {Object} props The current component props
* @param {HTMLElement} container The container div for the 2D saturation graph.
* @return {Object} Returns a new color object.
*/
function calculateSaturationChange(e, props, container) {
const {
top,
left,
width,
height
} = getPointOffset(e, container);
const saturation = left < 0 ? 0 : left * 100 / width;
let bright = top >= height ? 0 : -(top * 100 / height) + 100; // `v` values less than 1 are considered in the [0,1] range, causing unexpected behavior at the bottom
// of the chart. To fix this, we assume any value less than 1 should be 0 brightness.
if (bright < 1) {
bright = 0;
}
return {
h: props.hsl.h,
s: saturation,
v: bright,
a: props.hsl.a,
source: 'rgb'
};
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/keyboard-shortcuts/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function KeyboardShortcut({
target,
callback,
shortcut,
bindGlobal,
eventName
}) {
Object(external_wp_compose_["useKeyboardShortcut"])(shortcut, callback, {
bindGlobal,
target,
eventName
});
return null;
}
function KeyboardShortcuts({
children,
shortcuts,
bindGlobal,
eventName
}) {
const target = Object(external_wp_element_["useRef"])();
const element = Object(external_lodash_["map"])(shortcuts, (callback, shortcut) => Object(external_wp_element_["createElement"])(KeyboardShortcut, {
key: shortcut,
shortcut: shortcut,
callback: callback,
bindGlobal: bindGlobal,
eventName: eventName,
target: target
})); // Render as non-visual if there are no children pressed. Keyboard
// events will be bound to the document instead.
if (!external_wp_element_["Children"].count(children)) {
return element;
}
return Object(external_wp_element_["createElement"])("div", {
ref: target
}, element, children);
}
/* harmony default export */ var keyboard_shortcuts = (KeyboardShortcuts);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/alpha.js
/**
* Parts of this source were derived and modified from react-color,
* released under the MIT license.
*
* https://github.com/casesandberg/react-color/
*
* Copyright (c) 2015 Case Sandberg
*
* 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.
*/
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
class alpha_Alpha extends external_wp_element_["Component"] {
constructor() {
super(...arguments);
this.container = Object(external_wp_element_["createRef"])();
this.increase = this.increase.bind(this);
this.decrease = this.decrease.bind(this);
this.handleChange = this.handleChange.bind(this);
this.handleMouseDown = this.handleMouseDown.bind(this);
this.handleMouseUp = this.handleMouseUp.bind(this);
}
componentWillUnmount() {
this.unbindEventListeners();
}
increase(amount = 0.01) {
const {
hsl,
onChange = external_lodash_["noop"]
} = this.props;
amount = parseInt(amount * 100, 10);
const change = {
h: hsl.h,
s: hsl.s,
l: hsl.l,
a: (parseInt(hsl.a * 100, 10) + amount) / 100,
source: 'rgb'
};
onChange(change);
}
decrease(amount = 0.01) {
const {
hsl,
onChange = external_lodash_["noop"]
} = this.props;
const intValue = parseInt(hsl.a * 100, 10) - parseInt(amount * 100, 10);
const change = {
h: hsl.h,
s: hsl.s,
l: hsl.l,
a: hsl.a <= amount ? 0 : intValue / 100,
source: 'rgb'
};
onChange(change);
}
handleChange(e) {
const {
onChange = external_lodash_["noop"]
} = this.props;
const change = calculateAlphaChange(e, this.props, this.container.current);
if (change) {
onChange(change, e);
}
}
handleMouseDown(e) {
this.handleChange(e);
window.addEventListener('mousemove', this.handleChange);
window.addEventListener('mouseup', this.handleMouseUp);
}
handleMouseUp() {
this.unbindEventListeners();
}
preventKeyEvents(event) {
if (event.keyCode === external_wp_keycodes_["TAB"]) {
return;
}
event.preventDefault();
}
unbindEventListeners() {
window.removeEventListener('mousemove', this.handleChange);
window.removeEventListener('mouseup', this.handleMouseUp);
}
render() {
const {
rgb
} = this.props;
const rgbString = `${rgb.r},${rgb.g},${rgb.b}`;
const gradient = {
background: `linear-gradient(to right, rgba(${rgbString}, 0) 0%, rgba(${rgbString}, 1) 100%)`
};
const pointerLocation = {
left: `${rgb.a * 100}%`
};
const shortcuts = {
up: () => this.increase(),
right: () => this.increase(),
'shift+up': () => this.increase(0.1),
'shift+right': () => this.increase(0.1),
pageup: () => this.increase(0.1),
end: () => this.increase(1),
down: () => this.decrease(),
left: () => this.decrease(),
'shift+down': () => this.decrease(0.1),
'shift+left': () => this.decrease(0.1),
pagedown: () => this.decrease(0.1),
home: () => this.decrease(1)
};
return Object(external_wp_element_["createElement"])(keyboard_shortcuts, {
shortcuts: shortcuts
}, Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__alpha"
}, Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__alpha-gradient",
style: gradient
}), Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__alpha-bar",
ref: this.container,
onMouseDown: this.handleMouseDown,
onTouchMove: this.handleChange,
onTouchStart: this.handleChange
}, Object(external_wp_element_["createElement"])("div", {
tabIndex: "0",
role: "slider",
"aria-valuemax": "1",
"aria-valuemin": "0",
"aria-valuenow": rgb.a,
"aria-orientation": "horizontal",
"aria-label": Object(external_wp_i18n_["__"])('Alpha value, from 0 (transparent) to 1 (fully opaque).'),
className: "components-color-picker__alpha-pointer",
style: pointerLocation,
onKeyDown: this.preventKeyEvents
}))));
}
}
/* harmony default export */ var color_picker_alpha = (Object(external_wp_compose_["pure"])(alpha_Alpha));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/hue.js
/**
* Parts of this source were derived and modified from react-color,
* released under the MIT license.
*
* https://github.com/casesandberg/react-color/
*
* Copyright (c) 2015 Case Sandberg
*
* 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.
*/
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
class hue_Hue extends external_wp_element_["Component"] {
constructor() {
super(...arguments);
this.container = Object(external_wp_element_["createRef"])();
this.increase = this.increase.bind(this);
this.decrease = this.decrease.bind(this);
this.handleChange = this.handleChange.bind(this);
this.handleMouseDown = this.handleMouseDown.bind(this);
this.handleMouseUp = this.handleMouseUp.bind(this);
}
componentWillUnmount() {
this.unbindEventListeners();
}
increase(amount = 1) {
const {
hsl,
onChange = external_lodash_["noop"]
} = this.props;
const change = {
h: hsl.h + amount >= 359 ? 359 : hsl.h + amount,
s: hsl.s,
l: hsl.l,
a: hsl.a,
source: 'rgb'
};
onChange(change);
}
decrease(amount = 1) {
const {
hsl,
onChange = external_lodash_["noop"]
} = this.props;
const change = {
h: hsl.h <= amount ? 0 : hsl.h - amount,
s: hsl.s,
l: hsl.l,
a: hsl.a,
source: 'rgb'
};
onChange(change);
}
handleChange(e) {
const {
onChange = external_lodash_["noop"]
} = this.props;
const change = calculateHueChange(e, this.props, this.container.current);
if (change) {
onChange(change, e);
}
}
handleMouseDown(e) {
this.handleChange(e);
window.addEventListener('mousemove', this.handleChange);
window.addEventListener('mouseup', this.handleMouseUp);
}
handleMouseUp() {
this.unbindEventListeners();
}
preventKeyEvents(event) {
if (event.keyCode === external_wp_keycodes_["TAB"]) {
return;
}
event.preventDefault();
}
unbindEventListeners() {
window.removeEventListener('mousemove', this.handleChange);
window.removeEventListener('mouseup', this.handleMouseUp);
}
render() {
const {
hsl = {},
instanceId
} = this.props;
const pointerLocation = {
left: `${hsl.h * 100 / 360}%`
};
const shortcuts = {
up: () => this.increase(),
right: () => this.increase(),
'shift+up': () => this.increase(10),
'shift+right': () => this.increase(10),
pageup: () => this.increase(10),
end: () => this.increase(359),
down: () => this.decrease(),
left: () => this.decrease(),
'shift+down': () => this.decrease(10),
'shift+left': () => this.decrease(10),
pagedown: () => this.decrease(10),
home: () => this.decrease(359)
};
return Object(external_wp_element_["createElement"])(keyboard_shortcuts, {
shortcuts: shortcuts
}, Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__hue"
}, Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__hue-gradient"
}), Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__hue-bar",
ref: this.container,
onMouseDown: this.handleMouseDown,
onTouchMove: this.handleChange,
onTouchStart: this.handleChange
}, Object(external_wp_element_["createElement"])("div", {
tabIndex: "0",
role: "slider",
"aria-valuemax": "1",
"aria-valuemin": "359",
"aria-valuenow": hsl.h,
"aria-orientation": "horizontal",
"aria-label": Object(external_wp_i18n_["__"])('Hue value in degrees, from 0 to 359.'),
"aria-describedby": `components-color-picker__hue-description-${instanceId}`,
className: "components-color-picker__hue-pointer",
style: pointerLocation,
onKeyDown: this.preventKeyEvents
}), Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], {
as: "p",
id: `components-color-picker__hue-description-${instanceId}`
}, Object(external_wp_i18n_["__"])('Move the arrow left or right to change hue.')))));
}
}
/* harmony default export */ var hue = (Object(external_wp_compose_["compose"])(external_wp_compose_["pure"], external_wp_compose_["withInstanceId"])(hue_Hue));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text-control/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* @typedef OwnProps
* @property {string} label Label for the control.
* @property {boolean} [hideLabelFromVision] Whether to accessibly hide the label.
* @property {string} value Value of the input.
* @property {string} [help] Optional help text for the control.
* @property {string} [className] Classname passed to BaseControl wrapper
* @property {(value: string) => void} onChange Handle changes.
* @property {string} [type='text'] Type of the input.
*/
/** @typedef {OwnProps & import('react').ComponentProps<'input'>} Props */
/**
*
* @param {Props} props Props
* @param {import('react').Ref<HTMLInputElement>} [ref]
*/
function TextControl({
label,
hideLabelFromVision,
value,
help,
className,
onChange,
type = 'text',
...props
}, ref) {
const instanceId = Object(external_wp_compose_["useInstanceId"])(TextControl);
const id = `inspector-text-control-${instanceId}`;
const onChangeValue =
/** @type {import('react').ChangeEvent<HTMLInputElement>} */
event => onChange(event.target.value);
return Object(external_wp_element_["createElement"])(base_control, {
label: label,
hideLabelFromVision: hideLabelFromVision,
id: id,
help: help,
className: className
}, Object(external_wp_element_["createElement"])("input", Object(esm_extends["a" /* default */])({
className: "components-text-control__input",
type: type,
id: id,
value: value,
onChange: onChangeValue,
"aria-describedby": !!help ? id + '__help' : undefined,
ref: ref
}, props)));
}
/* harmony default export */ var text_control = (Object(external_wp_element_["forwardRef"])(TextControl));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/inputs.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/* Wrapper for TextControl, only used to handle intermediate state while typing. */
class inputs_Input extends external_wp_element_["Component"] {
constructor() {
super(...arguments);
this.handleBlur = this.handleBlur.bind(this);
this.handleChange = this.handleChange.bind(this);
this.handleKeyDown = this.handleKeyDown.bind(this);
}
handleBlur() {
const {
value,
valueKey,
onChange,
source
} = this.props;
onChange({
source,
state: 'commit',
value,
valueKey
});
}
handleChange(value) {
const {
valueKey,
onChange,
source
} = this.props;
if (value.length > 4 && isValidHex(value)) {
onChange({
source,
state: 'commit',
value,
valueKey
});
} else {
onChange({
source,
state: 'draft',
value,
valueKey
});
}
}
handleKeyDown({
keyCode
}) {
if (keyCode !== external_wp_keycodes_["ENTER"] && keyCode !== external_wp_keycodes_["UP"] && keyCode !== external_wp_keycodes_["DOWN"]) {
return;
}
const {
value,
valueKey,
onChange,
source
} = this.props;
onChange({
source,
state: 'commit',
value,
valueKey
});
}
render() {
const {
label,
value,
...props
} = this.props;
return Object(external_wp_element_["createElement"])(text_control, Object(esm_extends["a" /* default */])({
className: "components-color-picker__inputs-field",
label: label,
value: value,
onChange: newValue => this.handleChange(newValue),
onBlur: this.handleBlur,
onKeyDown: this.handleKeyDown
}, Object(external_lodash_["omit"])(props, ['onChange', 'valueKey', 'source'])));
}
}
const PureButton = Object(external_wp_compose_["pure"])(build_module_button["a" /* default */]);
class inputs_Inputs extends external_wp_element_["Component"] {
constructor({
hsl
}) {
super(...arguments);
const view = hsl.a === 1 ? 'hex' : 'rgb';
this.state = {
view
};
this.toggleViews = this.toggleViews.bind(this);
this.resetDraftValues = this.resetDraftValues.bind(this);
this.handleChange = this.handleChange.bind(this);
this.normalizeValue = this.normalizeValue.bind(this);
}
static getDerivedStateFromProps(props, state) {
if (props.hsl.a !== 1 && state.view === 'hex') {
return {
view: 'rgb'
};
}
return null;
}
toggleViews() {
if (this.state.view === 'hex') {
this.setState({
view: 'rgb'
}, this.resetDraftValues);
Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('RGB mode active'));
} else if (this.state.view === 'rgb') {
this.setState({
view: 'hsl'
}, this.resetDraftValues);
Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('Hue/saturation/lightness mode active'));
} else if (this.state.view === 'hsl') {
if (this.props.hsl.a === 1) {
this.setState({
view: 'hex'
}, this.resetDraftValues);
Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('Hex color mode active'));
} else {
this.setState({
view: 'rgb'
}, this.resetDraftValues);
Object(external_wp_a11y_["speak"])(Object(external_wp_i18n_["__"])('RGB mode active'));
}
}
}
resetDraftValues() {
return this.props.onChange({
state: 'reset'
});
}
normalizeValue(valueKey, value) {
if (valueKey !== 'a') {
return value;
}
if (value < 0) {
return 0;
} else if (value > 1) {
return 1;
}
return Math.round(value * 100) / 100;
}
handleChange({
source,
state,
value,
valueKey
}) {
this.props.onChange({
source,
state,
valueKey,
value: this.normalizeValue(valueKey, value)
});
}
renderFields() {
const {
disableAlpha = false
} = this.props;
if (this.state.view === 'hex') {
return Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__inputs-fields"
}, Object(external_wp_element_["createElement"])(inputs_Input, {
source: this.state.view,
label: Object(external_wp_i18n_["__"])('Color value in hexadecimal'),
valueKey: "hex",
value: this.props.hex,
onChange: this.handleChange
}));
} else if (this.state.view === 'rgb') {
const legend = disableAlpha ? Object(external_wp_i18n_["__"])('Color value in RGB') : Object(external_wp_i18n_["__"])('Color value in RGBA');
return Object(external_wp_element_["createElement"])("fieldset", null, Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], {
as: "legend"
}, legend), Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__inputs-fields"
}, Object(external_wp_element_["createElement"])(inputs_Input, {
source: this.state.view,
label: "r",
valueKey: "r",
value: this.props.rgb.r,
onChange: this.handleChange,
type: "number",
min: "0",
max: "255"
}), Object(external_wp_element_["createElement"])(inputs_Input, {
source: this.state.view,
label: "g",
valueKey: "g",
value: this.props.rgb.g,
onChange: this.handleChange,
type: "number",
min: "0",
max: "255"
}), Object(external_wp_element_["createElement"])(inputs_Input, {
source: this.state.view,
label: "b",
valueKey: "b",
value: this.props.rgb.b,
onChange: this.handleChange,
type: "number",
min: "0",
max: "255"
}), disableAlpha ? null : Object(external_wp_element_["createElement"])(inputs_Input, {
source: this.state.view,
label: "a",
valueKey: "a",
value: this.props.rgb.a,
onChange: this.handleChange,
type: "number",
min: "0",
max: "1",
step: "0.01"
})));
} else if (this.state.view === 'hsl') {
const legend = disableAlpha ? Object(external_wp_i18n_["__"])('Color value in HSL') : Object(external_wp_i18n_["__"])('Color value in HSLA');
return Object(external_wp_element_["createElement"])("fieldset", null, Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], {
as: "legend"
}, legend), Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__inputs-fields"
}, Object(external_wp_element_["createElement"])(inputs_Input, {
source: this.state.view,
label: "h",
valueKey: "h",
value: this.props.hsl.h,
onChange: this.handleChange,
type: "number",
min: "0",
max: "359"
}), Object(external_wp_element_["createElement"])(inputs_Input, {
source: this.state.view,
label: "s",
valueKey: "s",
value: this.props.hsl.s,
onChange: this.handleChange,
type: "number",
min: "0",
max: "100"
}), Object(external_wp_element_["createElement"])(inputs_Input, {
source: this.state.view,
label: "l",
valueKey: "l",
value: this.props.hsl.l,
onChange: this.handleChange,
type: "number",
min: "0",
max: "100"
}), disableAlpha ? null : Object(external_wp_element_["createElement"])(inputs_Input, {
source: this.state.view,
label: "a",
valueKey: "a",
value: this.props.hsl.a,
onChange: this.handleChange,
type: "number",
min: "0",
max: "1",
step: "0.05"
})));
}
}
render() {
return Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__inputs-wrapper"
}, this.renderFields(), Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__inputs-toggle-wrapper"
}, Object(external_wp_element_["createElement"])(PureButton, {
className: "components-color-picker__inputs-toggle",
icon: chevron_down["a" /* default */],
label: Object(external_wp_i18n_["__"])('Change color format'),
onClick: this.toggleViews
})));
}
}
/* harmony default export */ var inputs = (inputs_Inputs);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/saturation.js
/**
* Parts of this source were derived and modified from react-color,
* released under the MIT license.
*
* https://github.com/casesandberg/react-color/
*
* Copyright (c) 2015 Case Sandberg
*
* 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.
*/
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
class saturation_Saturation extends external_wp_element_["Component"] {
constructor(props) {
super(props);
this.throttle = Object(external_lodash_["throttle"])((fn, data, e) => {
fn(data, e);
}, 50);
this.container = Object(external_wp_element_["createRef"])();
this.saturate = this.saturate.bind(this);
this.brighten = this.brighten.bind(this);
this.handleChange = this.handleChange.bind(this);
this.handleMouseDown = this.handleMouseDown.bind(this);
this.handleMouseUp = this.handleMouseUp.bind(this);
}
componentWillUnmount() {
this.throttle.cancel();
this.unbindEventListeners();
}
saturate(amount = 0.01) {
const {
hsv,
onChange = external_lodash_["noop"]
} = this.props;
const intSaturation = Object(external_lodash_["clamp"])(hsv.s + Math.round(amount * 100), 0, 100);
const change = {
h: hsv.h,
s: intSaturation,
v: hsv.v,
a: hsv.a,
source: 'rgb'
};
onChange(change);
}
brighten(amount = 0.01) {
const {
hsv,
onChange = external_lodash_["noop"]
} = this.props;
const intValue = Object(external_lodash_["clamp"])(hsv.v + Math.round(amount * 100), 0, 100);
const change = {
h: hsv.h,
s: hsv.s,
v: intValue,
a: hsv.a,
source: 'rgb'
};
onChange(change);
}
handleChange(e) {
const {
onChange = external_lodash_["noop"]
} = this.props;
const change = calculateSaturationChange(e, this.props, this.container.current);
this.throttle(onChange, change, e);
}
handleMouseDown(e) {
this.handleChange(e);
window.addEventListener('mousemove', this.handleChange);
window.addEventListener('mouseup', this.handleMouseUp);
}
handleMouseUp() {
this.unbindEventListeners();
}
preventKeyEvents(event) {
if (event.keyCode === external_wp_keycodes_["TAB"]) {
return;
}
event.preventDefault();
}
unbindEventListeners() {
window.removeEventListener('mousemove', this.handleChange);
window.removeEventListener('mouseup', this.handleMouseUp);
}
render() {
const {
hsv,
hsl,
instanceId
} = this.props;
const pointerLocation = {
top: `${-hsv.v + 100}%`,
left: `${hsv.s}%`
};
const shortcuts = {
up: () => this.brighten(),
'shift+up': () => this.brighten(0.1),
pageup: () => this.brighten(1),
down: () => this.brighten(-0.01),
'shift+down': () => this.brighten(-0.1),
pagedown: () => this.brighten(-1),
right: () => this.saturate(),
'shift+right': () => this.saturate(0.1),
end: () => this.saturate(1),
left: () => this.saturate(-0.01),
'shift+left': () => this.saturate(-0.1),
home: () => this.saturate(-1)
};
/* eslint-disable jsx-a11y/no-noninteractive-element-interactions */
return Object(external_wp_element_["createElement"])(keyboard_shortcuts, {
shortcuts: shortcuts
}, Object(external_wp_element_["createElement"])("div", {
style: {
background: `hsl(${hsl.h},100%, 50%)`
},
className: "components-color-picker__saturation-color",
ref: this.container,
onMouseDown: this.handleMouseDown,
onTouchMove: this.handleChange,
onTouchStart: this.handleChange,
role: "application"
}, Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__saturation-white"
}), Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__saturation-black"
}), Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
"aria-label": Object(external_wp_i18n_["__"])('Choose a shade'),
"aria-describedby": `color-picker-saturation-${instanceId}`,
className: "components-color-picker__saturation-pointer",
style: pointerLocation,
onKeyDown: this.preventKeyEvents
}), Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], {
id: `color-picker-saturation-${instanceId}`
}, Object(external_wp_i18n_["__"])('Use your arrow keys to change the base color. Move up to lighten the color, down to darken, left to decrease saturation, and right to increase saturation.'))));
/* eslint-enable jsx-a11y/no-noninteractive-element-interactions */
}
}
/* harmony default export */ var saturation = (Object(external_wp_compose_["compose"])(external_wp_compose_["pure"], external_wp_compose_["withInstanceId"])(saturation_Saturation));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-picker/index.js
/**
* Parts of this source were derived and modified from react-color,
* released under the MIT license.
*
* https://github.com/casesandberg/react-color/
*
* Copyright (c) 2015 Case Sandberg
*
* 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.
*/
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const toLowerCase = value => String(value).toLowerCase();
const color_picker_isValueEmpty = data => {
if (data.source === 'hex' && data.hex === undefined) {
return true;
}
if (data.source === 'hsl' && (data.h === undefined || data.s === undefined || data.l === undefined)) {
return true;
}
/**
* Check that if source is `rgb`:
* `r`, `g` or `b` properties are not undefined
* OR (||) `h`, `s`, `v` or `a` properties are not undefined
* OR (||) `h`, `s`, `l` or `a` properties are not undefined
*
* before it was checking with NOT(!) statement witch for `0` (bool|int) values returns `true`
* this is a typecasting issue only visible for hex values that derive from #000000
*/
return data.source === 'rgb' && (data.r === undefined || data.g === undefined || data.b === undefined) && (data.h === undefined || data.s === undefined || data.v === undefined || data.a === undefined) && (data.h === undefined || data.s === undefined || data.l === undefined || data.a === undefined);
};
const isValidColor = colors => colors.hex ? isValidHex(colors.hex) : simpleCheckForValidColor(colors);
/**
* Function that creates the new color object
* from old data and the new value.
*
* @param {Object} oldColors The old color object.
* @param {string} oldColors.hex
* @param {Object} oldColors.rgb
* @param {number} oldColors.rgb.r
* @param {number} oldColors.rgb.g
* @param {number} oldColors.rgb.b
* @param {number} oldColors.rgb.a
* @param {Object} oldColors.hsl
* @param {number} oldColors.hsl.h
* @param {number} oldColors.hsl.s
* @param {number} oldColors.hsl.l
* @param {number} oldColors.hsl.a
* @param {string} oldColors.draftHex Same format as oldColors.hex
* @param {Object} oldColors.draftRgb Same format as oldColors.rgb
* @param {Object} oldColors.draftHsl Same format as oldColors.hsl
* @param {Object} data Data containing the new value to update.
* @param {Object} data.source One of `hex`, `rgb`, `hsl`.
* @param {string|number} data.value Value to update.
* @param {string} data.valueKey Depends on `data.source` values:
* - when source = `rgb`, valuKey can be `r`, `g`, `b`, or `a`.
* - when source = `hsl`, valuKey can be `h`, `s`, `l`, or `a`.
* @return {Object} A new color object for a specific source. For example:
* { source: 'rgb', r: 1, g: 2, b:3, a:0 }
*/
const dataToColors = (oldColors, {
source,
valueKey,
value
}) => {
if (source === 'hex') {
return {
source,
[source]: value
};
}
return {
source,
...{ ...oldColors[source],
...{
[valueKey]: value
}
}
};
};
class color_picker_ColorPicker extends external_wp_element_["Component"] {
constructor({
color = '0071a1'
}) {
super(...arguments);
const colors = colorToState(color);
this.state = { ...colors,
draftHex: toLowerCase(colors.hex),
draftRgb: colors.rgb,
draftHsl: colors.hsl
};
this.commitValues = this.commitValues.bind(this);
this.setDraftValues = this.setDraftValues.bind(this);
this.resetDraftValues = this.resetDraftValues.bind(this);
this.handleInputChange = this.handleInputChange.bind(this);
}
commitValues(data) {
const {
oldHue,
onChangeComplete = external_lodash_["noop"]
} = this.props;
if (isValidColor(data)) {
const colors = colorToState(data, data.h || oldHue);
this.setState({ ...colors,
draftHex: toLowerCase(colors.hex),
draftHsl: colors.hsl,
draftRgb: colors.rgb
}, Object(external_lodash_["debounce"])(Object(external_lodash_["partial"])(onChangeComplete, colors), 100));
}
}
resetDraftValues() {
this.setState({
draftHex: this.state.hex,
draftHsl: this.state.hsl,
draftRgb: this.state.rgb
});
}
setDraftValues(data) {
switch (data.source) {
case 'hex':
this.setState({
draftHex: toLowerCase(data.hex)
});
break;
case 'rgb':
this.setState({
draftRgb: data
});
break;
case 'hsl':
this.setState({
draftHsl: data
});
break;
}
}
handleInputChange(data) {
switch (data.state) {
case 'reset':
this.resetDraftValues();
break;
case 'commit':
const colors = dataToColors(this.state, data);
if (!color_picker_isValueEmpty(colors)) {
this.commitValues(colors);
}
break;
case 'draft':
this.setDraftValues(dataToColors(this.state, data));
break;
}
}
render() {
const {
className,
disableAlpha
} = this.props;
const {
color,
hsl,
hsv,
rgb,
draftHex,
draftHsl,
draftRgb
} = this.state;
const classes = classnames_default()(className, {
'components-color-picker': true,
'is-alpha-disabled': disableAlpha,
'is-alpha-enabled': !disableAlpha
});
return Object(external_wp_element_["createElement"])("div", {
className: classes
}, Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__saturation"
}, Object(external_wp_element_["createElement"])(saturation, {
hsl: hsl,
hsv: hsv,
onChange: this.commitValues
})), Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__body"
}, Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__controls"
}, Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__swatch"
}, Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__active",
style: {
backgroundColor: color && color.toRgbString()
}
})), Object(external_wp_element_["createElement"])("div", {
className: "components-color-picker__toggles"
}, Object(external_wp_element_["createElement"])(hue, {
hsl: hsl,
onChange: this.commitValues
}), disableAlpha ? null : Object(external_wp_element_["createElement"])(color_picker_alpha, {
rgb: rgb,
hsl: hsl,
onChange: this.commitValues
}))), Object(external_wp_element_["createElement"])(inputs, {
rgb: draftRgb,
hsl: draftHsl,
hex: draftHex,
onChange: this.handleInputChange,
disableAlpha: disableAlpha
})));
}
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-edit/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function DropdownOpenOnMount({
shouldOpen,
isOpen,
onToggle
}) {
Object(external_wp_element_["useEffect"])(() => {
if (shouldOpen && !isOpen) {
onToggle();
}
}, []);
return null;
}
function ColorOption({
color,
name,
slug,
onChange,
onRemove,
onConfirm,
confirmLabel = Object(external_wp_i18n_["__"])('OK'),
isEditingNameOnMount = false,
isEditingColorOnMount = false,
onCancel,
immutableColorSlugs = []
}) {
const [isHover, setIsHover] = Object(external_wp_element_["useState"])(false);
const [isFocused, setIsFocused] = Object(external_wp_element_["useState"])(false);
const [isEditingName, setIsEditingName] = Object(external_wp_element_["useState"])(isEditingNameOnMount);
const [isShowingAdvancedPanel, setIsShowingAdvancedPanel] = Object(external_wp_element_["useState"])(false);
const isShowingControls = (isHover || isFocused || isEditingName || isShowingAdvancedPanel) && !immutableColorSlugs.includes(slug);
return Object(external_wp_element_["createElement"])("div", {
tabIndex: 0,
className: classnames_default()('components-color-edit__color-option', {
'is-hover': isHover && !isEditingName && !isShowingAdvancedPanel
}),
onMouseEnter: () => setIsHover(true),
onMouseLeave: () => setIsHover(false),
onFocus: () => setIsFocused(true),
onBlur: () => setIsFocused(false),
"aria-label": name ? // translators: %s: The name of the color e.g: "vivid red".
Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('Color: %s'), name) : // translators: %s: color hex code e.g: "#f00".
Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('Color code: %s'), color)
}, Object(external_wp_element_["createElement"])("div", {
className: "components-color-edit__color-option-main-area"
}, Object(external_wp_element_["createElement"])(Dropdown, {
renderToggle: ({
isOpen,
onToggle
}) => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(DropdownOpenOnMount, {
shouldOpen: isEditingColorOnMount,
isOpen: isOpen,
onToggle: onToggle
}), Object(external_wp_element_["createElement"])(CircularOptionPicker.Option, {
style: {
backgroundColor: color,
color
},
"aria-expanded": isOpen,
"aria-haspopup": "true",
onClick: onToggle,
"aria-label": Object(external_wp_i18n_["__"])('Edit color value')
})),
renderContent: () => Object(external_wp_element_["createElement"])(color_picker_ColorPicker, {
color: color,
onChangeComplete: newColor => onChange({
color: newColor.hex,
slug,
name
}),
disableAlpha: true
})
}), !isEditingName && Object(external_wp_element_["createElement"])("div", {
className: "components-color-edit__color-option-color-name"
}, name), isEditingName && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(text_control, {
className: "components-color-edit__color-option-color-name-input",
hideLabelFromVision: true,
onChange: newColorName => onChange({
color,
slug: Object(external_lodash_["kebabCase"])(newColorName),
name: newColorName
}),
label: Object(external_wp_i18n_["__"])('Color name'),
placeholder: Object(external_wp_i18n_["__"])('Name'),
value: name
}), Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
onClick: () => {
setIsEditingName(false);
setIsFocused(false);
if (onConfirm) {
onConfirm();
}
},
isPrimary: true
}, confirmLabel)), !isEditingName && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
className: classnames_default()({
'components-color-edit__hidden-control': !isShowingControls
}),
icon: edit["a" /* default */],
label: Object(external_wp_i18n_["__"])('Edit color name'),
onClick: () => setIsEditingName(true)
}), Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
className: classnames_default()({
'components-color-edit__hidden-control': !isShowingControls
}),
icon: library_close["a" /* default */],
label: Object(external_wp_i18n_["__"])('Remove color'),
onClick: onRemove
})), Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
className: classnames_default()({
'components-color-edit__hidden-control': !isShowingControls
}),
icon: isShowingAdvancedPanel ? chevron_up["a" /* default */] : chevron_down["a" /* default */],
label: Object(external_wp_i18n_["__"])('Additional color settings'),
onClick: () => {
if (isShowingAdvancedPanel) {
setIsFocused(false);
}
setIsShowingAdvancedPanel(!isShowingAdvancedPanel);
},
"aria-expanded": isShowingAdvancedPanel
})), onCancel && Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
className: "components-color-edit__cancel-button",
onClick: onCancel
}, Object(external_wp_i18n_["__"])('Cancel')), isShowingAdvancedPanel && Object(external_wp_element_["createElement"])(text_control, {
className: "components-color-edit__slug-input",
onChange: newSlug => onChange({
color,
slug: newSlug,
name
}),
label: Object(external_wp_i18n_["__"])('Slug'),
value: slug
}));
}
function ColorInserter({
onInsert,
onCancel
}) {
const [color, setColor] = Object(external_wp_element_["useState"])({
color: '#fff',
name: '',
slug: ''
});
return Object(external_wp_element_["createElement"])(ColorOption, {
color: color.color,
name: color.name,
slug: color.slug,
onChange: setColor,
confirmLabel: Object(external_wp_i18n_["__"])('Save'),
onConfirm: () => onInsert(color),
isEditingNameOnMount: true,
isEditingColorOnMount: true,
onCancel: onCancel
});
}
function ColorEdit({
colors,
onChange,
emptyUI,
immutableColorSlugs,
canReset = true
}) {
const [isInsertingColor, setIsInsertingColor] = Object(external_wp_element_["useState"])(false);
return Object(external_wp_element_["createElement"])(base_control, null, Object(external_wp_element_["createElement"])("fieldset", null, Object(external_wp_element_["createElement"])("div", {
className: "components-color-edit__label-and-insert-container"
}, Object(external_wp_element_["createElement"])("legend", null, Object(external_wp_element_["createElement"])("div", null, Object(external_wp_element_["createElement"])(base_control.VisualLabel, null, Object(external_wp_i18n_["__"])('Color palette')))), !isInsertingColor && Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
onClick: () => {
setIsInsertingColor(true);
},
className: "components-color-edit__insert-button",
icon: plus["a" /* default */]
})), Object(external_wp_element_["createElement"])("div", null, !Object(external_lodash_["isEmpty"])(colors) && colors.map((color, index) => {
return Object(external_wp_element_["createElement"])(ColorOption, {
key: index,
color: color.color,
name: color.name,
slug: color.slug,
immutableColorSlugs: immutableColorSlugs,
onChange: newColor => {
onChange(colors.map((currentColor, currentIndex) => {
if (currentIndex === index) {
return newColor;
}
return currentColor;
}));
},
onRemove: () => {
onChange(colors.filter((_currentColor, currentIndex) => {
if (currentIndex === index) {
return false;
}
return true;
}));
}
});
}), isInsertingColor && Object(external_wp_element_["createElement"])(ColorInserter, {
onInsert: newColor => {
setIsInsertingColor(false);
onChange([...(colors || []), newColor]);
},
onCancel: () => setIsInsertingColor(false)
}), !isInsertingColor && Object(external_lodash_["isEmpty"])(colors) && emptyUI), !!canReset && Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
isSmall: true,
isSecondary: true,
className: "components-color-edit__reset-button",
onClick: () => onChange()
}, Object(external_wp_i18n_["__"])('Reset'))));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-indicator/index.js
/**
* External dependencies
*/
const ColorIndicator = ({
className,
colorValue,
...props
}) => Object(external_wp_element_["createElement"])("span", Object(esm_extends["a" /* default */])({
className: classnames_default()('component-color-indicator', className),
style: {
background: colorValue
}
}, props));
/* harmony default export */ var color_indicator = (ColorIndicator);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-palette/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ColorPalette({
clearable = true,
className,
colors,
disableCustomColors = false,
onChange,
value
}) {
const clearColor = Object(external_wp_element_["useCallback"])(() => onChange(undefined), [onChange]);
const colorOptions = Object(external_wp_element_["useMemo"])(() => {
return Object(external_lodash_["map"])(colors, ({
color,
name
}) => Object(external_wp_element_["createElement"])(CircularOptionPicker.Option, {
key: color,
isSelected: value === color,
selectedIconProps: value === color ? {
fill: tinycolor_default.a.mostReadable(color, ['#000', '#fff']).toHexString()
} : {},
tooltipText: name || // translators: %s: color hex code e.g: "#f00".
Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('Color code: %s'), color),
style: {
backgroundColor: color,
color
},
onClick: value === color ? clearColor : () => onChange(color),
"aria-label": name ? // translators: %s: The name of the color e.g: "vivid red".
Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('Color: %s'), name) : // translators: %s: color hex code e.g: "#f00".
Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('Color code: %s'), color)
}));
}, [colors, value, onChange, clearColor]);
const renderCustomColorPicker = () => Object(external_wp_element_["createElement"])(color_picker_ColorPicker, {
color: value,
onChangeComplete: color => onChange(color.hex),
disableAlpha: true
});
return Object(external_wp_element_["createElement"])(CircularOptionPicker, {
className: className,
options: colorOptions,
actions: Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, !disableCustomColors && Object(external_wp_element_["createElement"])(CircularOptionPicker.DropdownLinkAction, {
dropdownProps: {
renderContent: renderCustomColorPicker,
contentClassName: 'components-color-palette__picker'
},
buttonProps: {
'aria-label': Object(external_wp_i18n_["__"])('Custom color picker')
},
linkText: Object(external_wp_i18n_["__"])('Custom color')
}), !!clearable && Object(external_wp_element_["createElement"])(CircularOptionPicker.ButtonAction, {
onClick: clearColor
}, Object(external_wp_i18n_["__"])('Clear')))
});
}
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close-small.js
var close_small = __webpack_require__("bWcr");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-token-field/token-input.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
class token_input_TokenInput extends external_wp_element_["Component"] {
constructor() {
super(...arguments);
this.onChange = this.onChange.bind(this);
this.bindInput = this.bindInput.bind(this);
}
focus() {
this.input.focus();
}
hasFocus() {
return this.input === this.input.ownerDocument.activeElement;
}
bindInput(ref) {
this.input = ref;
}
onChange(event) {
this.props.onChange({
value: event.target.value
});
}
render() {
const {
value,
isExpanded,
instanceId,
selectedSuggestionIndex,
className,
...props
} = this.props;
const size = value ? value.length + 1 : 0;
return Object(external_wp_element_["createElement"])("input", Object(esm_extends["a" /* default */])({
ref: this.bindInput,
id: `components-form-token-input-${instanceId}`,
type: "text"
}, props, {
value: value || '',
onChange: this.onChange,
size: size,
className: classnames_default()(className, 'components-form-token-field__input'),
autoComplete: "off",
role: "combobox",
"aria-expanded": isExpanded,
"aria-autocomplete": "list",
"aria-owns": isExpanded ? `components-form-token-suggestions-${instanceId}` : undefined,
"aria-activedescendant": selectedSuggestionIndex !== -1 ? `components-form-token-suggestions-${instanceId}-${selectedSuggestionIndex}` : undefined,
"aria-describedby": `components-form-token-suggestions-howto-${instanceId}`
}));
}
}
/* harmony default export */ var token_input = (token_input_TokenInput);
// EXTERNAL MODULE: ./node_modules/dom-scroll-into-view/lib/index.js
var lib = __webpack_require__("9Do8");
var lib_default = /*#__PURE__*/__webpack_require__.n(lib);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-token-field/suggestions-list.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
class suggestions_list_SuggestionsList extends external_wp_element_["Component"] {
constructor() {
super(...arguments);
this.handleMouseDown = this.handleMouseDown.bind(this);
this.bindList = this.bindList.bind(this);
}
componentDidUpdate() {
// only have to worry about scrolling selected suggestion into view
// when already expanded
if (this.props.selectedIndex > -1 && this.props.scrollIntoView) {
this.scrollingIntoView = true;
lib_default()(this.list.children[this.props.selectedIndex], this.list, {
onlyScrollIfNeeded: true
});
this.props.setTimeout(() => {
this.scrollingIntoView = false;
}, 100);
}
}
bindList(ref) {
this.list = ref;
}
handleHover(suggestion) {
return () => {
if (!this.scrollingIntoView) {
this.props.onHover(suggestion);
}
};
}
handleClick(suggestion) {
return () => {
this.props.onSelect(suggestion);
};
}
handleMouseDown(e) {
// By preventing default here, we will not lose focus of <input> when clicking a suggestion
e.preventDefault();
}
computeSuggestionMatch(suggestion) {
const match = this.props.displayTransform(this.props.match || '').toLocaleLowerCase();
if (match.length === 0) {
return null;
}
suggestion = this.props.displayTransform(suggestion);
const indexOfMatch = suggestion.toLocaleLowerCase().indexOf(match);
return {
suggestionBeforeMatch: suggestion.substring(0, indexOfMatch),
suggestionMatch: suggestion.substring(indexOfMatch, indexOfMatch + match.length),
suggestionAfterMatch: suggestion.substring(indexOfMatch + match.length)
};
}
render() {
// We set `tabIndex` here because otherwise Firefox sets focus on this
// div when tabbing off of the input in `TokenField` -- not really sure
// why, since usually a div isn't focusable by default
// TODO does this still apply now that it's a <ul> and not a <div>?
return Object(external_wp_element_["createElement"])("ul", {
ref: this.bindList,
className: "components-form-token-field__suggestions-list",
id: `components-form-token-suggestions-${this.props.instanceId}`,
role: "listbox"
}, Object(external_lodash_["map"])(this.props.suggestions, (suggestion, index) => {
const match = this.computeSuggestionMatch(suggestion);
const classeName = classnames_default()('components-form-token-field__suggestion', {
'is-selected': index === this.props.selectedIndex
});
/* eslint-disable jsx-a11y/click-events-have-key-events */
return Object(external_wp_element_["createElement"])("li", {
id: `components-form-token-suggestions-${this.props.instanceId}-${index}`,
role: "option",
className: classeName,
key: suggestion !== null && suggestion !== void 0 && suggestion.value ? suggestion.value : this.props.displayTransform(suggestion),
onMouseDown: this.handleMouseDown,
onClick: this.handleClick(suggestion),
onMouseEnter: this.handleHover(suggestion),
"aria-selected": index === this.props.selectedIndex
}, match ? Object(external_wp_element_["createElement"])("span", {
"aria-label": this.props.displayTransform(suggestion)
}, match.suggestionBeforeMatch, Object(external_wp_element_["createElement"])("strong", {
className: "components-form-token-field__suggestion-match"
}, match.suggestionMatch), match.suggestionAfterMatch) : this.props.displayTransform(suggestion));
/* eslint-enable jsx-a11y/click-events-have-key-events */
}));
}
}
suggestions_list_SuggestionsList.defaultProps = {
match: '',
onHover: () => {},
onSelect: () => {},
suggestions: Object.freeze([])
};
/* harmony default export */ var suggestions_list = (Object(external_wp_compose_["withSafeTimeout"])(suggestions_list_SuggestionsList));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-focus-outside/index.js
/**
* WordPress dependencies
*/
/* harmony default export */ var with_focus_outside = (Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => props => {
const [handleFocusOutside, setHandleFocusOutside] = Object(external_wp_element_["useState"])();
const bindFocusOutsideHandler = Object(external_wp_element_["useCallback"])(node => setHandleFocusOutside(() => node !== null && node !== void 0 && node.handleFocusOutside ? node.handleFocusOutside.bind(node) : undefined), []);
return Object(external_wp_element_["createElement"])("div", Object(external_wp_compose_["__experimentalUseFocusOutside"])(handleFocusOutside), Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({
ref: bindFocusOutsideHandler
}, props)));
}, 'withFocusOutside'));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/combobox-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const DetectOutside = with_focus_outside(class extends external_wp_element_["Component"] {
handleFocusOutside(event) {
this.props.onFocusOutside(event);
}
render() {
return this.props.children;
}
});
function ComboboxControl({
value,
label,
options,
onChange,
onFilterValueChange = external_lodash_["noop"],
hideLabelFromVision,
help,
allowReset = true,
className,
messages = {
selected: Object(external_wp_i18n_["__"])('Item selected.')
}
}) {
var _currentOption$label;
const instanceId = Object(external_wp_compose_["useInstanceId"])(ComboboxControl);
const [selectedSuggestion, setSelectedSuggestion] = Object(external_wp_element_["useState"])(null);
const [isExpanded, setIsExpanded] = Object(external_wp_element_["useState"])(false);
const [inputValue, setInputValue] = Object(external_wp_element_["useState"])('');
const inputContainer = Object(external_wp_element_["useRef"])();
const currentOption = options.find(option => option.value === value);
const currentLabel = (_currentOption$label = currentOption === null || currentOption === void 0 ? void 0 : currentOption.label) !== null && _currentOption$label !== void 0 ? _currentOption$label : '';
const matchingSuggestions = Object(external_wp_element_["useMemo"])(() => {
const startsWithMatch = [];
const containsMatch = [];
const match = Object(external_lodash_["deburr"])(inputValue.toLocaleLowerCase());
options.forEach(option => {
const index = Object(external_lodash_["deburr"])(option.label).toLocaleLowerCase().indexOf(match);
if (index === 0) {
startsWithMatch.push(option);
} else if (index > 0) {
containsMatch.push(option);
}
});
return startsWithMatch.concat(containsMatch);
}, [inputValue, options, value]);
const onSuggestionSelected = newSelectedSuggestion => {
onChange(newSelectedSuggestion.value);
Object(external_wp_a11y_["speak"])(messages.selected, 'assertive');
setSelectedSuggestion(newSelectedSuggestion);
setInputValue('');
setIsExpanded(false);
};
const handleArrowNavigation = (offset = 1) => {
const index = matchingSuggestions.indexOf(selectedSuggestion);
let nextIndex = index + offset;
if (nextIndex < 0) {
nextIndex = matchingSuggestions.length - 1;
} else if (nextIndex >= matchingSuggestions.length) {
nextIndex = 0;
}
setSelectedSuggestion(matchingSuggestions[nextIndex]);
setIsExpanded(true);
};
const onKeyDown = event => {
let preventDefault = false;
switch (event.keyCode) {
case external_wp_keycodes_["ENTER"]:
if (selectedSuggestion) {
onSuggestionSelected(selectedSuggestion);
preventDefault = true;
}
break;
case external_wp_keycodes_["UP"]:
handleArrowNavigation(-1);
preventDefault = true;
break;
case external_wp_keycodes_["DOWN"]:
handleArrowNavigation(1);
preventDefault = true;
break;
case external_wp_keycodes_["ESCAPE"]:
setIsExpanded(false);
setSelectedSuggestion(null);
preventDefault = true;
event.stopPropagation();
break;
default:
break;
}
if (preventDefault) {
event.preventDefault();
}
};
const onFocus = () => {
setIsExpanded(true);
onFilterValueChange('');
setInputValue('');
};
const onFocusOutside = () => {
setIsExpanded(false);
};
const onInputChange = event => {
const text = event.value;
setInputValue(text);
onFilterValueChange(text);
setIsExpanded(true);
};
const handleOnReset = () => {
onChange(null);
inputContainer.current.input.focus();
}; // Announcements
Object(external_wp_element_["useEffect"])(() => {
const hasMatchingSuggestions = matchingSuggestions.length > 0;
if (isExpanded) {
const message = hasMatchingSuggestions ? Object(external_wp_i18n_["sprintf"])(
/* translators: %d: number of results. */
Object(external_wp_i18n_["_n"])('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', matchingSuggestions.length), matchingSuggestions.length) : Object(external_wp_i18n_["__"])('No results.');
Object(external_wp_a11y_["speak"])(message, 'polite');
}
}, [matchingSuggestions, isExpanded]); // Disable reason: There is no appropriate role which describes the
// input container intended accessible usability.
// TODO: Refactor click detection to use blur to stop propagation.
/* eslint-disable jsx-a11y/no-static-element-interactions */
return Object(external_wp_element_["createElement"])(DetectOutside, {
onFocusOutside: onFocusOutside
}, Object(external_wp_element_["createElement"])(base_control, {
className: classnames_default()(className, 'components-combobox-control'),
tabIndex: "-1",
label: label,
id: `components-form-token-input-${instanceId}`,
hideLabelFromVision: hideLabelFromVision,
help: help
}, Object(external_wp_element_["createElement"])("div", {
className: "components-combobox-control__suggestions-container",
tabIndex: "-1",
onKeyDown: onKeyDown
}, Object(external_wp_element_["createElement"])(flex_component, null, Object(external_wp_element_["createElement"])(flex_block_component, null, Object(external_wp_element_["createElement"])(token_input, {
className: "components-combobox-control__input",
instanceId: instanceId,
ref: inputContainer,
value: isExpanded ? inputValue : currentLabel,
"aria-label": currentLabel ? `${currentLabel}, ${label}` : null,
onFocus: onFocus,
isExpanded: isExpanded,
selectedSuggestionIndex: matchingSuggestions.indexOf(selectedSuggestion),
onChange: onInputChange
})), allowReset && Object(external_wp_element_["createElement"])(flex_item_component, null, Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
className: "components-combobox-control__reset",
icon: close_small["a" /* default */],
disabled: !value,
onClick: handleOnReset,
label: Object(external_wp_i18n_["__"])('Reset')
}))), isExpanded && Object(external_wp_element_["createElement"])(suggestions_list, {
instanceId: instanceId,
match: {
label: inputValue
},
displayTransform: suggestion => suggestion.label,
suggestions: matchingSuggestions,
selectedIndex: matchingSuggestions.indexOf(selectedSuggestion),
onHover: setSelectedSuggestion,
onSelect: onSuggestionSelected,
scrollIntoView: true
}))));
/* eslint-enable jsx-a11y/no-static-element-interactions */
}
/* harmony default export */ var combobox_control = (ComboboxControl);
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutPropertiesLoose.js
function objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
// CONCATENATED MODULE: ./node_modules/@babel/runtime/helpers/esm/assertThisInitialized.js
function assertThisInitialized_assertThisInitialized(self) {
if (self === void 0) {
throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
}
return self;
}
// EXTERNAL MODULE: ./node_modules/prop-types/index.js
var prop_types = __webpack_require__("17x9");
var prop_types_default = /*#__PURE__*/__webpack_require__.n(prop_types);
// EXTERNAL MODULE: ./node_modules/downshift/node_modules/react-is/index.js
var react_is = __webpack_require__("cD2C");
// CONCATENATED MODULE: ./node_modules/compute-scroll-into-view/dist/index.module.js
function t(t){return"object"==typeof t&&null!=t&&1===t.nodeType}function index_module_e(t,e){return(!e||"hidden"!==t)&&"visible"!==t&&"clip"!==t}function n(t,n){if(t.clientHeight<t.scrollHeight||t.clientWidth<t.scrollWidth){var r=getComputedStyle(t,null);return index_module_e(r.overflowY,n)||index_module_e(r.overflowX,n)||function(t){var e=function(t){if(!t.ownerDocument||!t.ownerDocument.defaultView)return null;try{return t.ownerDocument.defaultView.frameElement}catch(t){return null}}(t);return!!e&&(e.clientHeight<t.scrollHeight||e.clientWidth<t.scrollWidth)}(t)}return!1}function index_module_r(t,e,n,r,i,o,l,d){return o<t&&l>e||o>t&&l<e?0:o<=t&&d<=n||l>=e&&d>=n?o-t-r:l>e&&d<n||o<t&&d>n?l-e+i:0}/* harmony default export */ var index_module = (function(e,i){var o=window,l=i.scrollMode,d=i.block,u=i.inline,h=i.boundary,a=i.skipOverflowHiddenElements,c="function"==typeof h?h:function(t){return t!==h};if(!t(e))throw new TypeError("Invalid target");for(var f=document.scrollingElement||document.documentElement,s=[],p=e;t(p)&&c(p);){if((p=p.parentElement)===f){s.push(p);break}null!=p&&p===document.body&&n(p)&&!n(document.documentElement)||null!=p&&n(p,a)&&s.push(p)}for(var m=o.visualViewport?o.visualViewport.width:innerWidth,g=o.visualViewport?o.visualViewport.height:innerHeight,w=window.scrollX||pageXOffset,v=window.scrollY||pageYOffset,W=e.getBoundingClientRect(),b=W.height,H=W.width,y=W.top,E=W.right,M=W.bottom,V=W.left,x="start"===d||"nearest"===d?y:"end"===d?M:y+b/2,I="center"===u?V+H/2:"end"===u?E:V,C=[],T=0;T<s.length;T++){var k=s[T],B=k.getBoundingClientRect(),D=B.height,O=B.width,R=B.top,X=B.right,Y=B.bottom,L=B.left;if("if-needed"===l&&y>=0&&V>=0&&M<=g&&E<=m&&y>=R&&M<=Y&&V>=L&&E<=X)return C;var S=getComputedStyle(k),j=parseInt(S.borderLeftWidth,10),q=parseInt(S.borderTopWidth,10),z=parseInt(S.borderRightWidth,10),A=parseInt(S.borderBottomWidth,10),F=0,G=0,J="offsetWidth"in k?k.offsetWidth-k.clientWidth-j-z:0,K="offsetHeight"in k?k.offsetHeight-k.clientHeight-q-A:0;if(f===k)F="start"===d?x:"end"===d?x-g:"nearest"===d?index_module_r(v,v+g,g,q,A,v+x,v+x+b,b):x-g/2,G="start"===u?I:"center"===u?I-m/2:"end"===u?I-m:index_module_r(w,w+m,m,j,z,w+I,w+I+H,H),F=Math.max(0,F+v),G=Math.max(0,G+w);else{F="start"===d?x-R-q:"end"===d?x-Y+A+K:"nearest"===d?index_module_r(R,Y,D,q,A+K,x,x+b,b):x-(R+D/2)+K/2,G="start"===u?I-L-j:"center"===u?I-(L+O/2)+J/2:"end"===u?I-X+z+J:index_module_r(L,X,O,j,z+J,I,I+H,H);var N=k.scrollLeft,P=k.scrollTop;x+=P-(F=Math.max(0,Math.min(P+F,k.scrollHeight-D+K))),I+=N-(G=Math.max(0,Math.min(N+G,k.scrollWidth-O+J)))}C.push({el:k,top:F,left:G})}return C});
// CONCATENATED MODULE: ./node_modules/downshift/dist/downshift.esm.js
var idCounter = 0;
/**
* Accepts a parameter and returns it if it's a function
* or a noop function if it's not. This allows us to
* accept a callback, but not worry about it if it's not
* passed.
* @param {Function} cb the callback
* @return {Function} a function
*/
function cbToCb(cb) {
return typeof cb === 'function' ? cb : downshift_esm_noop;
}
function downshift_esm_noop() {}
/**
* Scroll node into view if necessary
* @param {HTMLElement} node the element that should scroll into view
* @param {HTMLElement} menuNode the menu element of the component
*/
function downshift_esm_scrollIntoView(node, menuNode) {
if (!node) {
return;
}
var actions = index_module(node, {
boundary: menuNode,
block: 'nearest',
scrollMode: 'if-needed'
});
actions.forEach(function (_ref) {
var el = _ref.el,
top = _ref.top,
left = _ref.left;
el.scrollTop = top;
el.scrollLeft = left;
});
}
/**
* @param {HTMLElement} parent the parent node
* @param {HTMLElement} child the child node
* @param {Window} environment The window context where downshift renders.
* @return {Boolean} whether the parent is the child or the child is in the parent
*/
function isOrContainsNode(parent, child, environment) {
var result = parent === child || child instanceof environment.Node && parent.contains && parent.contains(child);
return result;
}
/**
* Simple debounce implementation. Will call the given
* function once after the time given has passed since
* it was last called.
* @param {Function} fn the function to call after the time
* @param {Number} time the time to wait
* @return {Function} the debounced function
*/
function debounce(fn, time) {
var timeoutId;
function cancel() {
if (timeoutId) {
clearTimeout(timeoutId);
}
}
function wrapper() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
cancel();
timeoutId = setTimeout(function () {
timeoutId = null;
fn.apply(void 0, args);
}, time);
}
wrapper.cancel = cancel;
return wrapper;
}
/**
* This is intended to be used to compose event handlers.
* They are executed in order until one of them sets
* `event.preventDownshiftDefault = true`.
* @param {...Function} fns the event handler functions
* @return {Function} the event handler to add to an element
*/
function callAllEventHandlers() {
for (var _len2 = arguments.length, fns = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
fns[_key2] = arguments[_key2];
}
return function (event) {
for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) {
args[_key3 - 1] = arguments[_key3];
}
return fns.some(function (fn) {
if (fn) {
fn.apply(void 0, [event].concat(args));
}
return event.preventDownshiftDefault || event.hasOwnProperty('nativeEvent') && event.nativeEvent.preventDownshiftDefault;
});
};
}
function handleRefs() {
for (var _len4 = arguments.length, refs = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
refs[_key4] = arguments[_key4];
}
return function (node) {
refs.forEach(function (ref) {
if (typeof ref === 'function') {
ref(node);
} else if (ref) {
ref.current = node;
}
});
};
}
/**
* This generates a unique ID for an instance of Downshift
* @return {String} the unique ID
*/
function downshift_esm_generateId() {
return String(idCounter++);
}
/**
* Resets idCounter to 0. Used for SSR.
*/
function resetIdCounter() {
idCounter = 0;
}
/**
* Default implementation for status message. Only added when menu is open.
* Will specift if there are results in the list, and if so, how many,
* and what keys are relevant.
*
* @param {Object} param the downshift state and other relevant properties
* @return {String} the a11y status message
*/
function getA11yStatusMessage$1(_ref2) {
var isOpen = _ref2.isOpen,
resultCount = _ref2.resultCount,
previousResultCount = _ref2.previousResultCount;
if (!isOpen) {
return '';
}
if (!resultCount) {
return 'No results are available.';
}
if (resultCount !== previousResultCount) {
return resultCount + " result" + (resultCount === 1 ? ' is' : 's are') + " available, use up and down arrow keys to navigate. Press Enter key to select.";
}
return '';
}
/**
* Takes an argument and if it's an array, returns the first item in the array
* otherwise returns the argument
* @param {*} arg the maybe-array
* @param {*} defaultValue the value if arg is falsey not defined
* @return {*} the arg or it's first item
*/
function unwrapArray(arg, defaultValue) {
arg = Array.isArray(arg) ?
/* istanbul ignore next (preact) */
arg[0] : arg;
if (!arg && defaultValue) {
return defaultValue;
} else {
return arg;
}
}
/**
* @param {Object} element (P)react element
* @return {Boolean} whether it's a DOM element
*/
function isDOMElement(element) {
return typeof element.type === 'string';
}
/**
* @param {Object} element (P)react element
* @return {Object} the props
*/
function getElementProps(element) {
return element.props;
}
/**
* Throws a helpful error message for required properties. Useful
* to be used as a default in destructuring or object params.
* @param {String} fnName the function name
* @param {String} propName the prop name
*/
function requiredProp(fnName, propName) {
// eslint-disable-next-line no-console
console.error("The property \"" + propName + "\" is required in \"" + fnName + "\"");
}
var stateKeys = ['highlightedIndex', 'inputValue', 'isOpen', 'selectedItem', 'type'];
/**
* @param {Object} state the state object
* @return {Object} state that is relevant to downshift
*/
function pickState(state) {
if (state === void 0) {
state = {};
}
var result = {};
stateKeys.forEach(function (k) {
if (state.hasOwnProperty(k)) {
result[k] = state[k];
}
});
return result;
}
/**
* This will perform a shallow merge of the given state object
* with the state coming from props
* (for the controlled component scenario)
* This is used in state updater functions so they're referencing
* the right state regardless of where it comes from.
*
* @param {Object} state The state of the component/hook.
* @param {Object} props The props that may contain controlled values.
* @returns {Object} The merged controlled state.
*/
function getState(state, props) {
return Object.keys(state).reduce(function (prevState, key) {
prevState[key] = isControlledProp(props, key) ? props[key] : state[key];
return prevState;
}, {});
}
/**
* This determines whether a prop is a "controlled prop" meaning it is
* state which is controlled by the outside of this component rather
* than within this component.
*
* @param {Object} props The props that may contain controlled values.
* @param {String} key the key to check
* @return {Boolean} whether it is a controlled controlled prop
*/
function isControlledProp(props, key) {
return props[key] !== undefined;
}
/**
* Normalizes the 'key' property of a KeyboardEvent in IE/Edge
* @param {Object} event a keyboardEvent object
* @return {String} keyboard key
*/
function normalizeArrowKey(event) {
var key = event.key,
keyCode = event.keyCode;
/* istanbul ignore next (ie) */
if (keyCode >= 37 && keyCode <= 40 && key.indexOf('Arrow') !== 0) {
return "Arrow" + key;
}
return key;
}
/**
* Simple check if the value passed is object literal
* @param {*} obj any things
* @return {Boolean} whether it's object literal
*/
function isPlainObject(obj) {
return Object.prototype.toString.call(obj) === '[object Object]';
}
/**
* Returns the new index in the list, in a circular way. If next value is out of bonds from the total,
* it will wrap to either 0 or itemCount - 1.
*
* @param {number} moveAmount Number of positions to move. Negative to move backwards, positive forwards.
* @param {number} baseIndex The initial position to move from.
* @param {number} itemCount The total number of items.
* @param {Function} getItemNodeFromIndex Used to check if item is disabled.
* @param {boolean} circular Specify if navigation is circular. Default is true.
* @returns {number} The new index after the move.
*/
function getNextWrappingIndex(moveAmount, baseIndex, itemCount, getItemNodeFromIndex, circular) {
if (circular === void 0) {
circular = true;
}
if (itemCount === 0) {
return -1;
}
var itemsLastIndex = itemCount - 1;
if (typeof baseIndex !== 'number' || baseIndex < 0 || baseIndex >= itemCount) {
baseIndex = moveAmount > 0 ? -1 : itemsLastIndex + 1;
}
var newIndex = baseIndex + moveAmount;
if (newIndex < 0) {
newIndex = circular ? itemsLastIndex : 0;
} else if (newIndex > itemsLastIndex) {
newIndex = circular ? 0 : itemsLastIndex;
}
var nonDisabledNewIndex = getNextNonDisabledIndex(moveAmount, newIndex, itemCount, getItemNodeFromIndex, circular);
if (nonDisabledNewIndex === -1) {
return baseIndex >= itemCount ? -1 : baseIndex;
}
return nonDisabledNewIndex;
}
/**
* Returns the next index in the list of an item that is not disabled.
*
* @param {number} moveAmount Number of positions to move. Negative to move backwards, positive forwards.
* @param {number} baseIndex The initial position to move from.
* @param {number} itemCount The total number of items.
* @param {Function} getItemNodeFromIndex Used to check if item is disabled.
* @param {boolean} circular Specify if navigation is circular. Default is true.
* @returns {number} The new index. Returns baseIndex if item is not disabled. Returns next non-disabled item otherwise. If no non-disabled found it will return -1.
*/
function getNextNonDisabledIndex(moveAmount, baseIndex, itemCount, getItemNodeFromIndex, circular) {
var currentElementNode = getItemNodeFromIndex(baseIndex);
if (!currentElementNode || !currentElementNode.hasAttribute('disabled')) {
return baseIndex;
}
if (moveAmount > 0) {
for (var index = baseIndex + 1; index < itemCount; index++) {
if (!getItemNodeFromIndex(index).hasAttribute('disabled')) {
return index;
}
}
} else {
for (var _index = baseIndex - 1; _index >= 0; _index--) {
if (!getItemNodeFromIndex(_index).hasAttribute('disabled')) {
return _index;
}
}
}
if (circular) {
return moveAmount > 0 ? getNextNonDisabledIndex(1, 0, itemCount, getItemNodeFromIndex, false) : getNextNonDisabledIndex(-1, itemCount - 1, itemCount, getItemNodeFromIndex, false);
}
return -1;
}
/**
* Checks if event target is within the downshift elements.
*
* @param {EventTarget} target Target to check.
* @param {HTMLElement[]} downshiftElements The elements that form downshift (list, toggle button etc).
* @param {Window} environment The window context where downshift renders.
* @param {boolean} checkActiveElement Whether to also check activeElement.
*
* @returns {boolean} Whether or not the target is within downshift elements.
*/
function targetWithinDownshift(target, downshiftElements, environment, checkActiveElement) {
if (checkActiveElement === void 0) {
checkActiveElement = true;
}
return downshiftElements.some(function (contextNode) {
return contextNode && (isOrContainsNode(contextNode, target, environment) || checkActiveElement && isOrContainsNode(contextNode, environment.document.activeElement, environment));
});
} // eslint-disable-next-line import/no-mutable-exports
var validateControlledUnchanged = downshift_esm_noop;
/* istanbul ignore next */
if (false) {}
var cleanupStatus = debounce(function (documentProp) {
getStatusDiv(documentProp).textContent = '';
}, 500);
/**
* @param {String} status the status message
* @param {Object} documentProp document passed by the user.
*/
function setStatus(status, documentProp) {
var div = getStatusDiv(documentProp);
if (!status) {
return;
}
div.textContent = status;
cleanupStatus(documentProp);
}
/**
* Get the status node or create it if it does not already exist.
* @param {Object} documentProp document passed by the user.
* @return {HTMLElement} the status node.
*/
function getStatusDiv(documentProp) {
if (documentProp === void 0) {
documentProp = document;
}
var statusDiv = documentProp.getElementById('a11y-status-message');
if (statusDiv) {
return statusDiv;
}
statusDiv = documentProp.createElement('div');
statusDiv.setAttribute('id', 'a11y-status-message');
statusDiv.setAttribute('role', 'status');
statusDiv.setAttribute('aria-live', 'polite');
statusDiv.setAttribute('aria-relevant', 'additions text');
Object.assign(statusDiv.style, {
border: '0',
clip: 'rect(0 0 0 0)',
height: '1px',
margin: '-1px',
overflow: 'hidden',
padding: '0',
position: 'absolute',
width: '1px'
});
documentProp.body.appendChild(statusDiv);
return statusDiv;
}
var unknown = false ? undefined : 0;
var mouseUp = false ? undefined : 1;
var itemMouseEnter = false ? undefined : 2;
var keyDownArrowUp = false ? undefined : 3;
var keyDownArrowDown = false ? undefined : 4;
var keyDownEscape = false ? undefined : 5;
var keyDownEnter = false ? undefined : 6;
var keyDownHome = false ? undefined : 7;
var keyDownEnd = false ? undefined : 8;
var clickItem = false ? undefined : 9;
var blurInput = false ? undefined : 10;
var changeInput = false ? undefined : 11;
var keyDownSpaceButton = false ? undefined : 12;
var clickButton = false ? undefined : 13;
var blurButton = false ? undefined : 14;
var controlledPropUpdatedSelectedItem = false ? undefined : 15;
var touchEnd = false ? undefined : 16;
var stateChangeTypes$3 = /*#__PURE__*/Object.freeze({
__proto__: null,
unknown: unknown,
mouseUp: mouseUp,
itemMouseEnter: itemMouseEnter,
keyDownArrowUp: keyDownArrowUp,
keyDownArrowDown: keyDownArrowDown,
keyDownEscape: keyDownEscape,
keyDownEnter: keyDownEnter,
keyDownHome: keyDownHome,
keyDownEnd: keyDownEnd,
clickItem: clickItem,
blurInput: blurInput,
changeInput: changeInput,
keyDownSpaceButton: keyDownSpaceButton,
clickButton: clickButton,
blurButton: blurButton,
controlledPropUpdatedSelectedItem: controlledPropUpdatedSelectedItem,
touchEnd: touchEnd
});
var downshift_esm_Downshift = /*#__PURE__*/function () {
var Downshift = /*#__PURE__*/function (_Component) {
_inheritsLoose(Downshift, _Component);
function Downshift(_props) {
var _this;
_this = _Component.call(this, _props) || this; // fancy destructuring + defaults + aliases
// this basically says each value of state should either be set to
// the initial value or the default value if the initial value is not provided
_this.id = _this.props.id || "downshift-" + downshift_esm_generateId();
_this.menuId = _this.props.menuId || _this.id + "-menu";
_this.labelId = _this.props.labelId || _this.id + "-label";
_this.inputId = _this.props.inputId || _this.id + "-input";
_this.getItemId = _this.props.getItemId || function (index) {
return _this.id + "-item-" + index;
};
_this.input = null;
_this.items = [];
_this.itemCount = null;
_this.previousResultCount = 0;
_this.timeoutIds = [];
_this.internalSetTimeout = function (fn, time) {
var id = setTimeout(function () {
_this.timeoutIds = _this.timeoutIds.filter(function (i) {
return i !== id;
});
fn();
}, time);
_this.timeoutIds.push(id);
};
_this.setItemCount = function (count) {
_this.itemCount = count;
};
_this.unsetItemCount = function () {
_this.itemCount = null;
};
_this.setHighlightedIndex = function (highlightedIndex, otherStateToSet) {
if (highlightedIndex === void 0) {
highlightedIndex = _this.props.defaultHighlightedIndex;
}
if (otherStateToSet === void 0) {
otherStateToSet = {};
}
otherStateToSet = pickState(otherStateToSet);
_this.internalSetState(Object(esm_extends["a" /* default */])({
highlightedIndex: highlightedIndex
}, otherStateToSet));
};
_this.clearSelection = function (cb) {
_this.internalSetState({
selectedItem: null,
inputValue: '',
highlightedIndex: _this.props.defaultHighlightedIndex,
isOpen: _this.props.defaultIsOpen
}, cb);
};
_this.selectItem = function (item, otherStateToSet, cb) {
otherStateToSet = pickState(otherStateToSet);
_this.internalSetState(Object(esm_extends["a" /* default */])({
isOpen: _this.props.defaultIsOpen,
highlightedIndex: _this.props.defaultHighlightedIndex,
selectedItem: item,
inputValue: _this.props.itemToString(item)
}, otherStateToSet), cb);
};
_this.selectItemAtIndex = function (itemIndex, otherStateToSet, cb) {
var item = _this.items[itemIndex];
if (item == null) {
return;
}
_this.selectItem(item, otherStateToSet, cb);
};
_this.selectHighlightedItem = function (otherStateToSet, cb) {
return _this.selectItemAtIndex(_this.getState().highlightedIndex, otherStateToSet, cb);
};
_this.internalSetState = function (stateToSet, cb) {
var isItemSelected, onChangeArg;
var onStateChangeArg = {};
var isStateToSetFunction = typeof stateToSet === 'function'; // we want to call `onInputValueChange` before the `setState` call
// so someone controlling the `inputValue` state gets notified of
// the input change as soon as possible. This avoids issues with
// preserving the cursor position.
// See https://github.com/downshift-js/downshift/issues/217 for more info.
if (!isStateToSetFunction && stateToSet.hasOwnProperty('inputValue')) {
_this.props.onInputValueChange(stateToSet.inputValue, Object(esm_extends["a" /* default */])({}, _this.getStateAndHelpers(), stateToSet));
}
return _this.setState(function (state) {
state = _this.getState(state);
var newStateToSet = isStateToSetFunction ? stateToSet(state) : stateToSet; // Your own function that could modify the state that will be set.
newStateToSet = _this.props.stateReducer(state, newStateToSet); // checks if an item is selected, regardless of if it's different from
// what was selected before
// used to determine if onSelect and onChange callbacks should be called
isItemSelected = newStateToSet.hasOwnProperty('selectedItem'); // this keeps track of the object we want to call with setState
var nextState = {}; // this is just used to tell whether the state changed
// and we're trying to update that state. OR if the selection has changed and we're
// trying to update the selection
if (isItemSelected && newStateToSet.selectedItem !== state.selectedItem) {
onChangeArg = newStateToSet.selectedItem;
}
newStateToSet.type = newStateToSet.type || unknown;
Object.keys(newStateToSet).forEach(function (key) {
// onStateChangeArg should only have the state that is
// actually changing
if (state[key] !== newStateToSet[key]) {
onStateChangeArg[key] = newStateToSet[key];
} // the type is useful for the onStateChangeArg
// but we don't actually want to set it in internal state.
// this is an undocumented feature for now... Not all internalSetState
// calls support it and I'm not certain we want them to yet.
// But it enables users controlling the isOpen state to know when
// the isOpen state changes due to mouseup events which is quite handy.
if (key === 'type') {
return;
}
newStateToSet[key]; // if it's coming from props, then we don't care to set it internally
if (!isControlledProp(_this.props, key)) {
nextState[key] = newStateToSet[key];
}
}); // if stateToSet is a function, then we weren't able to call onInputValueChange
// earlier, so we'll call it now that we know what the inputValue state will be.
if (isStateToSetFunction && newStateToSet.hasOwnProperty('inputValue')) {
_this.props.onInputValueChange(newStateToSet.inputValue, Object(esm_extends["a" /* default */])({}, _this.getStateAndHelpers(), newStateToSet));
}
return nextState;
}, function () {
// call the provided callback if it's a function
cbToCb(cb)(); // only call the onStateChange and onChange callbacks if
// we have relevant information to pass them.
var hasMoreStateThanType = Object.keys(onStateChangeArg).length > 1;
if (hasMoreStateThanType) {
_this.props.onStateChange(onStateChangeArg, _this.getStateAndHelpers());
}
if (isItemSelected) {
_this.props.onSelect(stateToSet.selectedItem, _this.getStateAndHelpers());
}
if (onChangeArg !== undefined) {
_this.props.onChange(onChangeArg, _this.getStateAndHelpers());
} // this is currently undocumented and therefore subject to change
// We'll try to not break it, but just be warned.
_this.props.onUserAction(onStateChangeArg, _this.getStateAndHelpers());
});
};
_this.rootRef = function (node) {
return _this._rootNode = node;
};
_this.getRootProps = function (_temp, _temp2) {
var _extends2;
var _ref = _temp === void 0 ? {} : _temp,
_ref$refKey = _ref.refKey,
refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,
ref = _ref.ref,
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref, ["refKey", "ref"]);
var _ref2 = _temp2 === void 0 ? {} : _temp2,
_ref2$suppressRefErro = _ref2.suppressRefError,
suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro;
// this is used in the render to know whether the user has called getRootProps.
// It uses that to know whether to apply the props automatically
_this.getRootProps.called = true;
_this.getRootProps.refKey = refKey;
_this.getRootProps.suppressRefError = suppressRefError;
var _this$getState = _this.getState(),
isOpen = _this$getState.isOpen;
return Object(esm_extends["a" /* default */])((_extends2 = {}, _extends2[refKey] = handleRefs(ref, _this.rootRef), _extends2.role = 'combobox', _extends2['aria-expanded'] = isOpen, _extends2['aria-haspopup'] = 'listbox', _extends2['aria-owns'] = isOpen ? _this.menuId : null, _extends2['aria-labelledby'] = _this.labelId, _extends2), rest);
};
_this.keyDownHandlers = {
ArrowDown: function ArrowDown(event) {
var _this2 = this;
event.preventDefault();
if (this.getState().isOpen) {
var amount = event.shiftKey ? 5 : 1;
this.moveHighlightedIndex(amount, {
type: keyDownArrowDown
});
} else {
this.internalSetState({
isOpen: true,
type: keyDownArrowDown
}, function () {
var itemCount = _this2.getItemCount();
if (itemCount > 0) {
var _this2$getState = _this2.getState(),
highlightedIndex = _this2$getState.highlightedIndex;
var nextHighlightedIndex = getNextWrappingIndex(1, highlightedIndex, itemCount, function (index) {
return _this2.getItemNodeFromIndex(index);
});
_this2.setHighlightedIndex(nextHighlightedIndex, {
type: keyDownArrowDown
});
}
});
}
},
ArrowUp: function ArrowUp(event) {
var _this3 = this;
event.preventDefault();
if (this.getState().isOpen) {
var amount = event.shiftKey ? -5 : -1;
this.moveHighlightedIndex(amount, {
type: keyDownArrowUp
});
} else {
this.internalSetState({
isOpen: true,
type: keyDownArrowUp
}, function () {
var itemCount = _this3.getItemCount();
if (itemCount > 0) {
var _this3$getState = _this3.getState(),
highlightedIndex = _this3$getState.highlightedIndex;
var nextHighlightedIndex = getNextWrappingIndex(-1, highlightedIndex, itemCount, function (index) {
return _this3.getItemNodeFromIndex(index);
});
_this3.setHighlightedIndex(nextHighlightedIndex, {
type: keyDownArrowUp
});
}
});
}
},
Enter: function Enter(event) {
if (event.which === 229) {
return;
}
var _this$getState2 = this.getState(),
isOpen = _this$getState2.isOpen,
highlightedIndex = _this$getState2.highlightedIndex;
if (isOpen && highlightedIndex != null) {
event.preventDefault();
var item = this.items[highlightedIndex];
var itemNode = this.getItemNodeFromIndex(highlightedIndex);
if (item == null || itemNode && itemNode.hasAttribute('disabled')) {
return;
}
this.selectHighlightedItem({
type: keyDownEnter
});
}
},
Escape: function Escape(event) {
event.preventDefault();
this.reset(Object(esm_extends["a" /* default */])({
type: keyDownEscape
}, !this.state.isOpen && {
selectedItem: null,
inputValue: ''
}));
}
};
_this.buttonKeyDownHandlers = Object(esm_extends["a" /* default */])({}, _this.keyDownHandlers, {
' ': function _(event) {
event.preventDefault();
this.toggleMenu({
type: keyDownSpaceButton
});
}
});
_this.inputKeyDownHandlers = Object(esm_extends["a" /* default */])({}, _this.keyDownHandlers, {
Home: function Home(event) {
var _this4 = this;
var _this$getState3 = this.getState(),
isOpen = _this$getState3.isOpen;
if (!isOpen) {
return;
}
event.preventDefault();
var itemCount = this.getItemCount();
if (itemCount <= 0 || !isOpen) {
return;
} // get next non-disabled starting downwards from 0 if that's disabled.
var newHighlightedIndex = getNextNonDisabledIndex(1, 0, itemCount, function (index) {
return _this4.getItemNodeFromIndex(index);
}, false);
this.setHighlightedIndex(newHighlightedIndex, {
type: keyDownHome
});
},
End: function End(event) {
var _this5 = this;
var _this$getState4 = this.getState(),
isOpen = _this$getState4.isOpen;
if (!isOpen) {
return;
}
event.preventDefault();
var itemCount = this.getItemCount();
if (itemCount <= 0 || !isOpen) {
return;
} // get next non-disabled starting upwards from last index if that's disabled.
var newHighlightedIndex = getNextNonDisabledIndex(-1, itemCount - 1, itemCount, function (index) {
return _this5.getItemNodeFromIndex(index);
}, false);
this.setHighlightedIndex(newHighlightedIndex, {
type: keyDownEnd
});
}
});
_this.getToggleButtonProps = function (_temp3) {
var _ref3 = _temp3 === void 0 ? {} : _temp3,
onClick = _ref3.onClick;
_ref3.onPress;
var onKeyDown = _ref3.onKeyDown,
onKeyUp = _ref3.onKeyUp,
onBlur = _ref3.onBlur,
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref3, ["onClick", "onPress", "onKeyDown", "onKeyUp", "onBlur"]);
var _this$getState5 = _this.getState(),
isOpen = _this$getState5.isOpen;
var enabledEventHandlers = {
onClick: callAllEventHandlers(onClick, _this.buttonHandleClick),
onKeyDown: callAllEventHandlers(onKeyDown, _this.buttonHandleKeyDown),
onKeyUp: callAllEventHandlers(onKeyUp, _this.buttonHandleKeyUp),
onBlur: callAllEventHandlers(onBlur, _this.buttonHandleBlur)
};
var eventHandlers = rest.disabled ? {} : enabledEventHandlers;
return Object(esm_extends["a" /* default */])({
type: 'button',
role: 'button',
'aria-label': isOpen ? 'close menu' : 'open menu',
'aria-haspopup': true,
'data-toggle': true
}, eventHandlers, rest);
};
_this.buttonHandleKeyUp = function (event) {
// Prevent click event from emitting in Firefox
event.preventDefault();
};
_this.buttonHandleKeyDown = function (event) {
var key = normalizeArrowKey(event);
if (_this.buttonKeyDownHandlers[key]) {
_this.buttonKeyDownHandlers[key].call(assertThisInitialized_assertThisInitialized(_this), event);
}
};
_this.buttonHandleClick = function (event) {
event.preventDefault(); // handle odd case for Safari and Firefox which
// don't give the button the focus properly.
/* istanbul ignore if (can't reasonably test this) */
if (_this.props.environment.document.activeElement === _this.props.environment.document.body) {
event.target.focus();
} // to simplify testing components that use downshift, we'll not wrap this in a setTimeout
// if the NODE_ENV is test. With the proper build system, this should be dead code eliminated
// when building for production and should therefore have no impact on production code.
if (false) {} else {
// Ensure that toggle of menu occurs after the potential blur event in iOS
_this.internalSetTimeout(function () {
return _this.toggleMenu({
type: clickButton
});
});
}
};
_this.buttonHandleBlur = function (event) {
var blurTarget = event.target; // Save blur target for comparison with activeElement later
// Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not body element
_this.internalSetTimeout(function () {
if (!_this.isMouseDown && (_this.props.environment.document.activeElement == null || _this.props.environment.document.activeElement.id !== _this.inputId) && _this.props.environment.document.activeElement !== blurTarget // Do nothing if we refocus the same element again (to solve issue in Safari on iOS)
) {
_this.reset({
type: blurButton
});
}
});
};
_this.getLabelProps = function (props) {
return Object(esm_extends["a" /* default */])({
htmlFor: _this.inputId,
id: _this.labelId
}, props);
};
_this.getInputProps = function (_temp4) {
var _ref4 = _temp4 === void 0 ? {} : _temp4,
onKeyDown = _ref4.onKeyDown,
onBlur = _ref4.onBlur,
onChange = _ref4.onChange,
onInput = _ref4.onInput;
_ref4.onChangeText;
var rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref4, ["onKeyDown", "onBlur", "onChange", "onInput", "onChangeText"]);
var onChangeKey;
var eventHandlers = {};
/* istanbul ignore next (preact) */
{
onChangeKey = 'onChange';
}
var _this$getState6 = _this.getState(),
inputValue = _this$getState6.inputValue,
isOpen = _this$getState6.isOpen,
highlightedIndex = _this$getState6.highlightedIndex;
if (!rest.disabled) {
var _eventHandlers;
eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = callAllEventHandlers(onChange, onInput, _this.inputHandleChange), _eventHandlers.onKeyDown = callAllEventHandlers(onKeyDown, _this.inputHandleKeyDown), _eventHandlers.onBlur = callAllEventHandlers(onBlur, _this.inputHandleBlur), _eventHandlers);
}
return Object(esm_extends["a" /* default */])({
'aria-autocomplete': 'list',
'aria-activedescendant': isOpen && typeof highlightedIndex === 'number' && highlightedIndex >= 0 ? _this.getItemId(highlightedIndex) : null,
'aria-controls': isOpen ? _this.menuId : null,
'aria-labelledby': _this.labelId,
// https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
// revert back since autocomplete="nope" is ignored on latest Chrome and Opera
autoComplete: 'off',
value: inputValue,
id: _this.inputId
}, eventHandlers, rest);
};
_this.inputHandleKeyDown = function (event) {
var key = normalizeArrowKey(event);
if (key && _this.inputKeyDownHandlers[key]) {
_this.inputKeyDownHandlers[key].call(assertThisInitialized_assertThisInitialized(_this), event);
}
};
_this.inputHandleChange = function (event) {
_this.internalSetState({
type: changeInput,
isOpen: true,
inputValue: event.target.value,
highlightedIndex: _this.props.defaultHighlightedIndex
});
};
_this.inputHandleBlur = function () {
// Need setTimeout, so that when the user presses Tab, the activeElement is the next focused element, not the body element
_this.internalSetTimeout(function () {
var downshiftButtonIsActive = _this.props.environment.document && !!_this.props.environment.document.activeElement && !!_this.props.environment.document.activeElement.dataset && _this.props.environment.document.activeElement.dataset.toggle && _this._rootNode && _this._rootNode.contains(_this.props.environment.document.activeElement);
if (!_this.isMouseDown && !downshiftButtonIsActive) {
_this.reset({
type: blurInput
});
}
});
};
_this.menuRef = function (node) {
_this._menuNode = node;
};
_this.getMenuProps = function (_temp5, _temp6) {
var _extends3;
var _ref5 = _temp5 === void 0 ? {} : _temp5,
_ref5$refKey = _ref5.refKey,
refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
ref = _ref5.ref,
props = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref5, ["refKey", "ref"]);
var _ref6 = _temp6 === void 0 ? {} : _temp6,
_ref6$suppressRefErro = _ref6.suppressRefError,
suppressRefError = _ref6$suppressRefErro === void 0 ? false : _ref6$suppressRefErro;
_this.getMenuProps.called = true;
_this.getMenuProps.refKey = refKey;
_this.getMenuProps.suppressRefError = suppressRefError;
return Object(esm_extends["a" /* default */])((_extends3 = {}, _extends3[refKey] = handleRefs(ref, _this.menuRef), _extends3.role = 'listbox', _extends3['aria-labelledby'] = props && props['aria-label'] ? null : _this.labelId, _extends3.id = _this.menuId, _extends3), props);
};
_this.getItemProps = function (_temp7) {
var _enabledEventHandlers;
var _ref7 = _temp7 === void 0 ? {} : _temp7,
onMouseMove = _ref7.onMouseMove,
onMouseDown = _ref7.onMouseDown,
onClick = _ref7.onClick;
_ref7.onPress;
var index = _ref7.index,
_ref7$item = _ref7.item,
item = _ref7$item === void 0 ? true ?
/* istanbul ignore next */
undefined : undefined : _ref7$item,
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref7, ["onMouseMove", "onMouseDown", "onClick", "onPress", "index", "item"]);
if (index === undefined) {
_this.items.push(item);
index = _this.items.indexOf(item);
} else {
_this.items[index] = item;
}
var onSelectKey = 'onClick';
var customClickHandler = onClick;
var enabledEventHandlers = (_enabledEventHandlers = {
// onMouseMove is used over onMouseEnter here. onMouseMove
// is only triggered on actual mouse movement while onMouseEnter
// can fire on DOM changes, interrupting keyboard navigation
onMouseMove: callAllEventHandlers(onMouseMove, function () {
if (index === _this.getState().highlightedIndex) {
return;
}
_this.setHighlightedIndex(index, {
type: itemMouseEnter
}); // We never want to manually scroll when changing state based
// on `onMouseMove` because we will be moving the element out
// from under the user which is currently scrolling/moving the
// cursor
_this.avoidScrolling = true;
_this.internalSetTimeout(function () {
return _this.avoidScrolling = false;
}, 250);
}),
onMouseDown: callAllEventHandlers(onMouseDown, function (event) {
// This prevents the activeElement from being changed
// to the item so it can remain with the current activeElement
// which is a more common use case.
event.preventDefault();
})
}, _enabledEventHandlers[onSelectKey] = callAllEventHandlers(customClickHandler, function () {
_this.selectItemAtIndex(index, {
type: clickItem
});
}), _enabledEventHandlers); // Passing down the onMouseDown handler to prevent redirect
// of the activeElement if clicking on disabled items
var eventHandlers = rest.disabled ? {
onMouseDown: enabledEventHandlers.onMouseDown
} : enabledEventHandlers;
return Object(esm_extends["a" /* default */])({
id: _this.getItemId(index),
role: 'option',
'aria-selected': _this.getState().highlightedIndex === index
}, eventHandlers, rest);
};
_this.clearItems = function () {
_this.items = [];
};
_this.reset = function (otherStateToSet, cb) {
if (otherStateToSet === void 0) {
otherStateToSet = {};
}
otherStateToSet = pickState(otherStateToSet);
_this.internalSetState(function (_ref8) {
var selectedItem = _ref8.selectedItem;
return Object(esm_extends["a" /* default */])({
isOpen: _this.props.defaultIsOpen,
highlightedIndex: _this.props.defaultHighlightedIndex,
inputValue: _this.props.itemToString(selectedItem)
}, otherStateToSet);
}, cb);
};
_this.toggleMenu = function (otherStateToSet, cb) {
if (otherStateToSet === void 0) {
otherStateToSet = {};
}
otherStateToSet = pickState(otherStateToSet);
_this.internalSetState(function (_ref9) {
var isOpen = _ref9.isOpen;
return Object(esm_extends["a" /* default */])({
isOpen: !isOpen
}, isOpen && {
highlightedIndex: _this.props.defaultHighlightedIndex
}, otherStateToSet);
}, function () {
var _this$getState7 = _this.getState(),
isOpen = _this$getState7.isOpen,
highlightedIndex = _this$getState7.highlightedIndex;
if (isOpen) {
if (_this.getItemCount() > 0 && typeof highlightedIndex === 'number') {
_this.setHighlightedIndex(highlightedIndex, otherStateToSet);
}
}
cbToCb(cb)();
});
};
_this.openMenu = function (cb) {
_this.internalSetState({
isOpen: true
}, cb);
};
_this.closeMenu = function (cb) {
_this.internalSetState({
isOpen: false
}, cb);
};
_this.updateStatus = debounce(function () {
var state = _this.getState();
var item = _this.items[state.highlightedIndex];
var resultCount = _this.getItemCount();
var status = _this.props.getA11yStatusMessage(Object(esm_extends["a" /* default */])({
itemToString: _this.props.itemToString,
previousResultCount: _this.previousResultCount,
resultCount: resultCount,
highlightedItem: item
}, state));
_this.previousResultCount = resultCount;
setStatus(status, _this.props.environment.document);
}, 200);
var _this$props = _this.props,
defaultHighlightedIndex = _this$props.defaultHighlightedIndex,
_this$props$initialHi = _this$props.initialHighlightedIndex,
_highlightedIndex = _this$props$initialHi === void 0 ? defaultHighlightedIndex : _this$props$initialHi,
defaultIsOpen = _this$props.defaultIsOpen,
_this$props$initialIs = _this$props.initialIsOpen,
_isOpen = _this$props$initialIs === void 0 ? defaultIsOpen : _this$props$initialIs,
_this$props$initialIn = _this$props.initialInputValue,
_inputValue = _this$props$initialIn === void 0 ? '' : _this$props$initialIn,
_this$props$initialSe = _this$props.initialSelectedItem,
_selectedItem = _this$props$initialSe === void 0 ? null : _this$props$initialSe;
var _state = _this.getState({
highlightedIndex: _highlightedIndex,
isOpen: _isOpen,
inputValue: _inputValue,
selectedItem: _selectedItem
});
if (_state.selectedItem != null && _this.props.initialInputValue === undefined) {
_state.inputValue = _this.props.itemToString(_state.selectedItem);
}
_this.state = _state;
return _this;
}
var _proto = Downshift.prototype;
/**
* Clear all running timeouts
*/
_proto.internalClearTimeouts = function internalClearTimeouts() {
this.timeoutIds.forEach(function (id) {
clearTimeout(id);
});
this.timeoutIds = [];
}
/**
* Gets the state based on internal state or props
* If a state value is passed via props, then that
* is the value given, otherwise it's retrieved from
* stateToMerge
*
* @param {Object} stateToMerge defaults to this.state
* @return {Object} the state
*/
;
_proto.getState = function getState$1(stateToMerge) {
if (stateToMerge === void 0) {
stateToMerge = this.state;
}
return getState(stateToMerge, this.props);
};
_proto.getItemCount = function getItemCount() {
// things read better this way. They're in priority order:
// 1. `this.itemCount`
// 2. `this.props.itemCount`
// 3. `this.items.length`
var itemCount = this.items.length;
if (this.itemCount != null) {
itemCount = this.itemCount;
} else if (this.props.itemCount !== undefined) {
itemCount = this.props.itemCount;
}
return itemCount;
};
_proto.getItemNodeFromIndex = function getItemNodeFromIndex(index) {
return this.props.environment.document.getElementById(this.getItemId(index));
};
_proto.scrollHighlightedItemIntoView = function scrollHighlightedItemIntoView() {
/* istanbul ignore else (react-native) */
{
var node = this.getItemNodeFromIndex(this.getState().highlightedIndex);
this.props.scrollIntoView(node, this._menuNode);
}
};
_proto.moveHighlightedIndex = function moveHighlightedIndex(amount, otherStateToSet) {
var _this6 = this;
var itemCount = this.getItemCount();
var _this$getState8 = this.getState(),
highlightedIndex = _this$getState8.highlightedIndex;
if (itemCount > 0) {
var nextHighlightedIndex = getNextWrappingIndex(amount, highlightedIndex, itemCount, function (index) {
return _this6.getItemNodeFromIndex(index);
});
this.setHighlightedIndex(nextHighlightedIndex, otherStateToSet);
}
};
_proto.getStateAndHelpers = function getStateAndHelpers() {
var _this$getState9 = this.getState(),
highlightedIndex = _this$getState9.highlightedIndex,
inputValue = _this$getState9.inputValue,
selectedItem = _this$getState9.selectedItem,
isOpen = _this$getState9.isOpen;
var itemToString = this.props.itemToString;
var id = this.id;
var getRootProps = this.getRootProps,
getToggleButtonProps = this.getToggleButtonProps,
getLabelProps = this.getLabelProps,
getMenuProps = this.getMenuProps,
getInputProps = this.getInputProps,
getItemProps = this.getItemProps,
openMenu = this.openMenu,
closeMenu = this.closeMenu,
toggleMenu = this.toggleMenu,
selectItem = this.selectItem,
selectItemAtIndex = this.selectItemAtIndex,
selectHighlightedItem = this.selectHighlightedItem,
setHighlightedIndex = this.setHighlightedIndex,
clearSelection = this.clearSelection,
clearItems = this.clearItems,
reset = this.reset,
setItemCount = this.setItemCount,
unsetItemCount = this.unsetItemCount,
setState = this.internalSetState;
return {
// prop getters
getRootProps: getRootProps,
getToggleButtonProps: getToggleButtonProps,
getLabelProps: getLabelProps,
getMenuProps: getMenuProps,
getInputProps: getInputProps,
getItemProps: getItemProps,
// actions
reset: reset,
openMenu: openMenu,
closeMenu: closeMenu,
toggleMenu: toggleMenu,
selectItem: selectItem,
selectItemAtIndex: selectItemAtIndex,
selectHighlightedItem: selectHighlightedItem,
setHighlightedIndex: setHighlightedIndex,
clearSelection: clearSelection,
clearItems: clearItems,
setItemCount: setItemCount,
unsetItemCount: unsetItemCount,
setState: setState,
// props
itemToString: itemToString,
// derived
id: id,
// state
highlightedIndex: highlightedIndex,
inputValue: inputValue,
isOpen: isOpen,
selectedItem: selectedItem
};
} //////////////////////////// ROOT
;
_proto.componentDidMount = function componentDidMount() {
var _this7 = this;
/* istanbul ignore if (react-native) */
if (false) {}
/* istanbul ignore if (react-native) */
{
// this.isMouseDown helps us track whether the mouse is currently held down.
// This is useful when the user clicks on an item in the list, but holds the mouse
// down long enough for the list to disappear (because the blur event fires on the input)
// this.isMouseDown is used in the blur handler on the input to determine whether the blur event should
// trigger hiding the menu.
var onMouseDown = function onMouseDown() {
_this7.isMouseDown = true;
};
var onMouseUp = function onMouseUp(event) {
_this7.isMouseDown = false; // if the target element or the activeElement is within a downshift node
// then we don't want to reset downshift
var contextWithinDownshift = targetWithinDownshift(event.target, [_this7._rootNode, _this7._menuNode], _this7.props.environment);
if (!contextWithinDownshift && _this7.getState().isOpen) {
_this7.reset({
type: mouseUp
}, function () {
return _this7.props.onOuterClick(_this7.getStateAndHelpers());
});
}
}; // Touching an element in iOS gives focus and hover states, but touching out of
// the element will remove hover, and persist the focus state, resulting in the
// blur event not being triggered.
// this.isTouchMove helps us track whether the user is tapping or swiping on a touch screen.
// If the user taps outside of Downshift, the component should be reset,
// but not if the user is swiping
var onTouchStart = function onTouchStart() {
_this7.isTouchMove = false;
};
var onTouchMove = function onTouchMove() {
_this7.isTouchMove = true;
};
var onTouchEnd = function onTouchEnd(event) {
var contextWithinDownshift = targetWithinDownshift(event.target, [_this7._rootNode, _this7._menuNode], _this7.props.environment, false);
if (!_this7.isTouchMove && !contextWithinDownshift && _this7.getState().isOpen) {
_this7.reset({
type: touchEnd
}, function () {
return _this7.props.onOuterClick(_this7.getStateAndHelpers());
});
}
};
var environment = this.props.environment;
environment.addEventListener('mousedown', onMouseDown);
environment.addEventListener('mouseup', onMouseUp);
environment.addEventListener('touchstart', onTouchStart);
environment.addEventListener('touchmove', onTouchMove);
environment.addEventListener('touchend', onTouchEnd);
this.cleanup = function () {
_this7.internalClearTimeouts();
_this7.updateStatus.cancel();
environment.removeEventListener('mousedown', onMouseDown);
environment.removeEventListener('mouseup', onMouseUp);
environment.removeEventListener('touchstart', onTouchStart);
environment.removeEventListener('touchmove', onTouchMove);
environment.removeEventListener('touchend', onTouchEnd);
};
}
};
_proto.shouldScroll = function shouldScroll(prevState, prevProps) {
var _ref10 = this.props.highlightedIndex === undefined ? this.getState() : this.props,
currentHighlightedIndex = _ref10.highlightedIndex;
var _ref11 = prevProps.highlightedIndex === undefined ? prevState : prevProps,
prevHighlightedIndex = _ref11.highlightedIndex;
var scrollWhenOpen = currentHighlightedIndex && this.getState().isOpen && !prevState.isOpen;
var scrollWhenNavigating = currentHighlightedIndex !== prevHighlightedIndex;
return scrollWhenOpen || scrollWhenNavigating;
};
_proto.componentDidUpdate = function componentDidUpdate(prevProps, prevState) {
if (false) {}
if (isControlledProp(this.props, 'selectedItem') && this.props.selectedItemChanged(prevProps.selectedItem, this.props.selectedItem)) {
this.internalSetState({
type: controlledPropUpdatedSelectedItem,
inputValue: this.props.itemToString(this.props.selectedItem)
});
}
if (!this.avoidScrolling && this.shouldScroll(prevState, prevProps)) {
this.scrollHighlightedItemIntoView();
}
/* istanbul ignore else (react-native) */
{
this.updateStatus();
}
};
_proto.componentWillUnmount = function componentWillUnmount() {
this.cleanup(); // avoids memory leak
};
_proto.render = function render() {
var children = unwrapArray(this.props.children, downshift_esm_noop); // because the items are rerendered every time we call the children
// we clear this out each render and it will be populated again as
// getItemProps is called.
this.clearItems(); // we reset this so we know whether the user calls getRootProps during
// this render. If they do then we don't need to do anything,
// if they don't then we need to clone the element they return and
// apply the props for them.
this.getRootProps.called = false;
this.getRootProps.refKey = undefined;
this.getRootProps.suppressRefError = undefined; // we do something similar for getMenuProps
this.getMenuProps.called = false;
this.getMenuProps.refKey = undefined;
this.getMenuProps.suppressRefError = undefined; // we do something similar for getLabelProps
this.getLabelProps.called = false; // and something similar for getInputProps
this.getInputProps.called = false;
var element = unwrapArray(children(this.getStateAndHelpers()));
if (!element) {
return null;
}
if (this.getRootProps.called || this.props.suppressRefError) {
if (false) {}
return element;
} else if (isDOMElement(element)) {
// they didn't apply the root props, but we can clone
// this and apply the props ourselves
return /*#__PURE__*/Object(external_React_["cloneElement"])(element, this.getRootProps(getElementProps(element)));
}
/* istanbul ignore else */
if (false) {}
/* istanbul ignore next */
return undefined;
};
return Downshift;
}(external_React_["Component"]);
Downshift.defaultProps = {
defaultHighlightedIndex: null,
defaultIsOpen: false,
getA11yStatusMessage: getA11yStatusMessage$1,
itemToString: function itemToString(i) {
if (i == null) {
return '';
}
if (false) {}
return String(i);
},
onStateChange: downshift_esm_noop,
onInputValueChange: downshift_esm_noop,
onUserAction: downshift_esm_noop,
onChange: downshift_esm_noop,
onSelect: downshift_esm_noop,
onOuterClick: downshift_esm_noop,
selectedItemChanged: function selectedItemChanged(prevItem, item) {
return prevItem !== item;
},
environment: typeof window === 'undefined'
/* istanbul ignore next (ssr) */
? {} : window,
stateReducer: function stateReducer(state, stateToSet) {
return stateToSet;
},
suppressRefError: false,
scrollIntoView: downshift_esm_scrollIntoView
};
Downshift.stateChangeTypes = stateChangeTypes$3;
return Downshift;
}();
false ? undefined : void 0;
function validateGetMenuPropsCalledCorrectly(node, _ref12) {
var refKey = _ref12.refKey;
if (!node) {
// eslint-disable-next-line no-console
console.error("downshift: The ref prop \"" + refKey + "\" from getMenuProps was not applied correctly on your menu element.");
}
}
function validateGetRootPropsCalledCorrectly(element, _ref13) {
var refKey = _ref13.refKey;
var refKeySpecified = refKey !== 'ref';
var isComposite = !isDOMElement(element);
if (isComposite && !refKeySpecified && !Object(react_is["isForwardRef"])(element)) {
// eslint-disable-next-line no-console
console.error('downshift: You returned a non-DOM element. You must specify a refKey in getRootProps');
} else if (!isComposite && refKeySpecified) {
// eslint-disable-next-line no-console
console.error("downshift: You returned a DOM element. You should not specify a refKey in getRootProps. You specified \"" + refKey + "\"");
}
if (!Object(react_is["isForwardRef"])(element) && !getElementProps(element)[refKey]) {
// eslint-disable-next-line no-console
console.error("downshift: You must apply the ref prop \"" + refKey + "\" from getRootProps onto your root element.");
}
}
var dropdownDefaultStateValues = {
highlightedIndex: -1,
isOpen: false,
selectedItem: null,
inputValue: ''
};
function callOnChangeProps(action, state, newState) {
var props = action.props,
type = action.type;
var changes = {};
Object.keys(state).forEach(function (key) {
invokeOnChangeHandler(key, action, state, newState);
if (newState[key] !== state[key]) {
changes[key] = newState[key];
}
});
if (props.onStateChange && Object.keys(changes).length) {
props.onStateChange(Object(esm_extends["a" /* default */])({
type: type
}, changes));
}
}
function invokeOnChangeHandler(key, action, state, newState) {
var props = action.props,
type = action.type;
var handler = "on" + capitalizeString(key) + "Change";
if (props[handler] && newState[key] !== undefined && newState[key] !== state[key]) {
props[handler](Object(esm_extends["a" /* default */])({
type: type
}, newState));
}
}
/**
* Default state reducer that returns the changes.
*
* @param {Object} s state.
* @param {Object} a action with changes.
* @returns {Object} changes.
*/
function downshift_esm_stateReducer(s, a) {
return a.changes;
}
/**
* Returns a message to be added to aria-live region when item is selected.
*
* @param {Object} selectionParameters Parameters required to build the message.
* @returns {string} The a11y message.
*/
function downshift_esm_getA11ySelectionMessage(selectionParameters) {
var selectedItem = selectionParameters.selectedItem,
itemToStringLocal = selectionParameters.itemToString;
return selectedItem ? itemToStringLocal(selectedItem) + " has been selected." : '';
}
/**
* Debounced call for updating the a11y message.
*/
var updateA11yStatus = debounce(function (getA11yMessage, document) {
setStatus(getA11yMessage(), document);
}, 200); // istanbul ignore next
var useIsomorphicLayoutEffect = typeof window !== 'undefined' && typeof window.document !== 'undefined' && typeof window.document.createElement !== 'undefined' ? external_React_["useLayoutEffect"] : external_React_["useEffect"];
function useElementIds(_ref) {
var _ref$id = _ref.id,
id = _ref$id === void 0 ? "downshift-" + downshift_esm_generateId() : _ref$id,
labelId = _ref.labelId,
menuId = _ref.menuId,
getItemId = _ref.getItemId,
toggleButtonId = _ref.toggleButtonId,
inputId = _ref.inputId;
var elementIdsRef = Object(external_React_["useRef"])({
labelId: labelId || id + "-label",
menuId: menuId || id + "-menu",
getItemId: getItemId || function (index) {
return id + "-item-" + index;
},
toggleButtonId: toggleButtonId || id + "-toggle-button",
inputId: inputId || id + "-input"
});
return elementIdsRef.current;
}
function getItemIndex(index, item, items) {
if (index !== undefined) {
return index;
}
if (items.length === 0) {
return -1;
}
return items.indexOf(item);
}
function downshift_esm_itemToString(item) {
return item ? String(item) : '';
}
function isAcceptedCharacterKey(key) {
return /^\S{1}$/.test(key);
}
function capitalizeString(string) {
return "" + string.slice(0, 1).toUpperCase() + string.slice(1);
}
function useLatestRef(val) {
var ref = Object(external_React_["useRef"])(val); // technically this is not "concurrent mode safe" because we're manipulating
// the value during render (so it's not idempotent). However, the places this
// hook is used is to support memoizing callbacks which will be called
// *during* render, so we need the latest values *during* render.
// If not for this, then we'd probably want to use useLayoutEffect instead.
ref.current = val;
return ref;
}
/**
* Computes the controlled state using a the previous state, props,
* two reducers, one from downshift and an optional one from the user.
* Also calls the onChange handlers for state values that have changed.
*
* @param {Function} reducer Reducer function from downshift.
* @param {Object} initialState Initial state of the hook.
* @param {Object} props The hook props.
* @returns {Array} An array with the state and an action dispatcher.
*/
function useEnhancedReducer(reducer, initialState, props) {
var prevStateRef = Object(external_React_["useRef"])();
var actionRef = Object(external_React_["useRef"])();
var enhancedReducer = Object(external_React_["useCallback"])(function (state, action) {
actionRef.current = action;
state = getState(state, action.props);
var changes = reducer(state, action);
var newState = action.props.stateReducer(state, Object(esm_extends["a" /* default */])({}, action, {
changes: changes
}));
return newState;
}, [reducer]);
var _useReducer = Object(external_React_["useReducer"])(enhancedReducer, initialState),
state = _useReducer[0],
dispatch = _useReducer[1];
var propsRef = useLatestRef(props);
var dispatchWithProps = Object(external_React_["useCallback"])(function (action) {
return dispatch(Object(esm_extends["a" /* default */])({
props: propsRef.current
}, action));
}, [propsRef]);
var action = actionRef.current;
Object(external_React_["useEffect"])(function () {
if (action && prevStateRef.current && prevStateRef.current !== state) {
callOnChangeProps(action, getState(prevStateRef.current, action.props), state);
}
prevStateRef.current = state;
}, [state, props, action]);
return [state, dispatchWithProps];
}
/**
* Wraps the useEnhancedReducer and applies the controlled prop values before
* returning the new state.
*
* @param {Function} reducer Reducer function from downshift.
* @param {Object} initialState Initial state of the hook.
* @param {Object} props The hook props.
* @returns {Array} An array with the state and an action dispatcher.
*/
function useControlledReducer$1(reducer, initialState, props) {
var _useEnhancedReducer = useEnhancedReducer(reducer, initialState, props),
state = _useEnhancedReducer[0],
dispatch = _useEnhancedReducer[1];
return [getState(state, props), dispatch];
}
var defaultProps$3 = {
itemToString: downshift_esm_itemToString,
stateReducer: downshift_esm_stateReducer,
getA11ySelectionMessage: downshift_esm_getA11ySelectionMessage,
scrollIntoView: downshift_esm_scrollIntoView,
circularNavigation: false,
environment: typeof window === 'undefined'
/* istanbul ignore next (ssr) */
? {} : window
};
function getDefaultValue$1(props, propKey, defaultStateValues) {
if (defaultStateValues === void 0) {
defaultStateValues = dropdownDefaultStateValues;
}
var defaultPropKey = "default" + capitalizeString(propKey);
if (defaultPropKey in props) {
return props[defaultPropKey];
}
return defaultStateValues[propKey];
}
function getInitialValue$1(props, propKey, defaultStateValues) {
if (defaultStateValues === void 0) {
defaultStateValues = dropdownDefaultStateValues;
}
if (propKey in props) {
return props[propKey];
}
var initialPropKey = "initial" + capitalizeString(propKey);
if (initialPropKey in props) {
return props[initialPropKey];
}
return getDefaultValue$1(props, propKey, defaultStateValues);
}
function getInitialState$2(props) {
var selectedItem = getInitialValue$1(props, 'selectedItem');
var isOpen = getInitialValue$1(props, 'isOpen');
var highlightedIndex = getInitialValue$1(props, 'highlightedIndex');
var inputValue = getInitialValue$1(props, 'inputValue');
return {
highlightedIndex: highlightedIndex < 0 && selectedItem && isOpen ? props.items.indexOf(selectedItem) : highlightedIndex,
isOpen: isOpen,
selectedItem: selectedItem,
inputValue: inputValue
};
}
function getHighlightedIndexOnOpen(props, state, offset, getItemNodeFromIndex) {
var items = props.items,
initialHighlightedIndex = props.initialHighlightedIndex,
defaultHighlightedIndex = props.defaultHighlightedIndex;
var selectedItem = state.selectedItem,
highlightedIndex = state.highlightedIndex;
if (items.length === 0) {
return -1;
} // initialHighlightedIndex will give value to highlightedIndex on initial state only.
if (initialHighlightedIndex !== undefined && highlightedIndex === initialHighlightedIndex) {
return initialHighlightedIndex;
}
if (defaultHighlightedIndex !== undefined) {
return defaultHighlightedIndex;
}
if (selectedItem) {
if (offset === 0) {
return items.indexOf(selectedItem);
}
return getNextWrappingIndex(offset, items.indexOf(selectedItem), items.length, getItemNodeFromIndex, false);
}
if (offset === 0) {
return -1;
}
return offset < 0 ? items.length - 1 : 0;
}
/**
* Reuse the movement tracking of mouse and touch events.
*
* @param {boolean} isOpen Whether the dropdown is open or not.
* @param {Array<Object>} downshiftElementRefs Downshift element refs to track movement (toggleButton, menu etc.)
* @param {Object} environment Environment where component/hook exists.
* @param {Function} handleBlur Handler on blur from mouse or touch.
* @returns {Object} Ref containing whether mouseDown or touchMove event is happening
*/
function useMouseAndTouchTracker(isOpen, downshiftElementRefs, environment, handleBlur) {
var mouseAndTouchTrackersRef = Object(external_React_["useRef"])({
isMouseDown: false,
isTouchMove: false
});
Object(external_React_["useEffect"])(function () {
// The same strategy for checking if a click occurred inside or outside downsift
// as in downshift.js.
var onMouseDown = function onMouseDown() {
mouseAndTouchTrackersRef.current.isMouseDown = true;
};
var onMouseUp = function onMouseUp(event) {
mouseAndTouchTrackersRef.current.isMouseDown = false;
if (isOpen && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {
return ref.current;
}), environment)) {
handleBlur();
}
};
var onTouchStart = function onTouchStart() {
mouseAndTouchTrackersRef.current.isTouchMove = false;
};
var onTouchMove = function onTouchMove() {
mouseAndTouchTrackersRef.current.isTouchMove = true;
};
var onTouchEnd = function onTouchEnd(event) {
if (isOpen && !mouseAndTouchTrackersRef.current.isTouchMove && !targetWithinDownshift(event.target, downshiftElementRefs.map(function (ref) {
return ref.current;
}), environment, false)) {
handleBlur();
}
};
environment.addEventListener('mousedown', onMouseDown);
environment.addEventListener('mouseup', onMouseUp);
environment.addEventListener('touchstart', onTouchStart);
environment.addEventListener('touchmove', onTouchMove);
environment.addEventListener('touchend', onTouchEnd);
return function cleanup() {
environment.removeEventListener('mousedown', onMouseDown);
environment.removeEventListener('mouseup', onMouseUp);
environment.removeEventListener('touchstart', onTouchStart);
environment.removeEventListener('touchmove', onTouchMove);
environment.removeEventListener('touchend', onTouchEnd);
}; // eslint-disable-next-line react-hooks/exhaustive-deps
}, [isOpen, environment]);
return mouseAndTouchTrackersRef;
}
/* istanbul ignore next */
// eslint-disable-next-line import/no-mutable-exports
var useGetterPropsCalledChecker = function useGetterPropsCalledChecker() {
return downshift_esm_noop;
};
/**
* Custom hook that checks if getter props are called correctly.
*
* @param {...any} propKeys Getter prop names to be handled.
* @returns {Function} Setter function called inside getter props to set call information.
*/
/* istanbul ignore next */
if (false) {}
function useA11yMessageSetter(getA11yMessage, dependencyArray, _ref2) {
var isInitialMount = _ref2.isInitialMount,
highlightedIndex = _ref2.highlightedIndex,
items = _ref2.items,
environment = _ref2.environment,
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref2, ["isInitialMount", "highlightedIndex", "items", "environment"]);
// Sets a11y status message on changes in state.
Object(external_React_["useEffect"])(function () {
if (isInitialMount) {
return;
}
updateA11yStatus(function () {
return getA11yMessage(Object(esm_extends["a" /* default */])({
highlightedIndex: highlightedIndex,
highlightedItem: items[highlightedIndex],
resultCount: items.length
}, rest));
}, environment.document); // eslint-disable-next-line react-hooks/exhaustive-deps
}, dependencyArray);
}
function useScrollIntoView(_ref3) {
var highlightedIndex = _ref3.highlightedIndex,
isOpen = _ref3.isOpen,
itemRefs = _ref3.itemRefs,
getItemNodeFromIndex = _ref3.getItemNodeFromIndex,
menuElement = _ref3.menuElement,
scrollIntoViewProp = _ref3.scrollIntoView;
// used not to scroll on highlight by mouse.
var shouldScrollRef = Object(external_React_["useRef"])(true); // Scroll on highlighted item if change comes from keyboard.
useIsomorphicLayoutEffect(function () {
if (highlightedIndex < 0 || !isOpen || !Object.keys(itemRefs.current).length) {
return;
}
if (shouldScrollRef.current === false) {
shouldScrollRef.current = true;
} else {
scrollIntoViewProp(getItemNodeFromIndex(highlightedIndex), menuElement);
} // eslint-disable-next-line react-hooks/exhaustive-deps
}, [highlightedIndex]);
return shouldScrollRef;
} // eslint-disable-next-line import/no-mutable-exports
var useControlPropsValidator = downshift_esm_noop;
/* istanbul ignore next */
if (false) {}
/* eslint-disable complexity */
function downshiftCommonReducer(state, action, stateChangeTypes) {
var type = action.type,
props = action.props;
var changes;
switch (type) {
case stateChangeTypes.ItemMouseMove:
changes = {
highlightedIndex: action.index
};
break;
case stateChangeTypes.MenuMouseLeave:
changes = {
highlightedIndex: -1
};
break;
case stateChangeTypes.ToggleButtonClick:
case stateChangeTypes.FunctionToggleMenu:
changes = {
isOpen: !state.isOpen,
highlightedIndex: state.isOpen ? -1 : getHighlightedIndexOnOpen(props, state, 0)
};
break;
case stateChangeTypes.FunctionOpenMenu:
changes = {
isOpen: true,
highlightedIndex: getHighlightedIndexOnOpen(props, state, 0)
};
break;
case stateChangeTypes.FunctionCloseMenu:
changes = {
isOpen: false
};
break;
case stateChangeTypes.FunctionSetHighlightedIndex:
changes = {
highlightedIndex: action.highlightedIndex
};
break;
case stateChangeTypes.FunctionSetInputValue:
changes = {
inputValue: action.inputValue
};
break;
case stateChangeTypes.FunctionReset:
changes = {
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
isOpen: getDefaultValue$1(props, 'isOpen'),
selectedItem: getDefaultValue$1(props, 'selectedItem'),
inputValue: getDefaultValue$1(props, 'inputValue')
};
break;
default:
throw new Error('Reducer called without proper action type.');
}
return Object(esm_extends["a" /* default */])({}, state, changes);
}
/* eslint-enable complexity */
function getItemIndexByCharacterKey(keysSoFar, highlightedIndex, items, itemToString, getItemNodeFromIndex) {
var lowerCasedKeysSoFar = keysSoFar.toLowerCase();
for (var index = 0; index < items.length; index++) {
var offsetIndex = (index + highlightedIndex + 1) % items.length;
if (itemToString(items[offsetIndex]).toLowerCase().startsWith(lowerCasedKeysSoFar)) {
var element = getItemNodeFromIndex(offsetIndex);
if (!(element && element.hasAttribute('disabled'))) {
return offsetIndex;
}
}
}
return highlightedIndex;
}
var propTypes$2 = {
items: prop_types_default.a.array.isRequired,
itemToString: prop_types_default.a.func,
getA11yStatusMessage: prop_types_default.a.func,
getA11ySelectionMessage: prop_types_default.a.func,
circularNavigation: prop_types_default.a.bool,
highlightedIndex: prop_types_default.a.number,
defaultHighlightedIndex: prop_types_default.a.number,
initialHighlightedIndex: prop_types_default.a.number,
isOpen: prop_types_default.a.bool,
defaultIsOpen: prop_types_default.a.bool,
initialIsOpen: prop_types_default.a.bool,
selectedItem: prop_types_default.a.any,
initialSelectedItem: prop_types_default.a.any,
defaultSelectedItem: prop_types_default.a.any,
id: prop_types_default.a.string,
labelId: prop_types_default.a.string,
menuId: prop_types_default.a.string,
getItemId: prop_types_default.a.func,
toggleButtonId: prop_types_default.a.string,
stateReducer: prop_types_default.a.func,
onSelectedItemChange: prop_types_default.a.func,
onHighlightedIndexChange: prop_types_default.a.func,
onStateChange: prop_types_default.a.func,
onIsOpenChange: prop_types_default.a.func,
environment: prop_types_default.a.shape({
addEventListener: prop_types_default.a.func,
removeEventListener: prop_types_default.a.func,
document: prop_types_default.a.shape({
getElementById: prop_types_default.a.func,
activeElement: prop_types_default.a.any,
body: prop_types_default.a.any
})
})
};
/**
* Default implementation for status message. Only added when menu is open.
* Will specift if there are results in the list, and if so, how many,
* and what keys are relevant.
*
* @param {Object} param the downshift state and other relevant properties
* @return {String} the a11y status message
*/
function downshift_esm_getA11yStatusMessage(_ref) {
var isOpen = _ref.isOpen,
resultCount = _ref.resultCount,
previousResultCount = _ref.previousResultCount;
if (!isOpen) {
return '';
}
if (!resultCount) {
return 'No results are available.';
}
if (resultCount !== previousResultCount) {
return resultCount + " result" + (resultCount === 1 ? ' is' : 's are') + " available, use up and down arrow keys to navigate. Press Enter or Space Bar keys to select.";
}
return '';
}
var defaultProps$2 = Object(esm_extends["a" /* default */])({}, defaultProps$3, {
getA11yStatusMessage: downshift_esm_getA11yStatusMessage
}); // eslint-disable-next-line import/no-mutable-exports
var validatePropTypes$2 = downshift_esm_noop;
/* istanbul ignore next */
if (false) {}
var MenuKeyDownArrowDown = false ? undefined : 0;
var MenuKeyDownArrowUp = false ? undefined : 1;
var MenuKeyDownEscape = false ? undefined : 2;
var MenuKeyDownHome = false ? undefined : 3;
var MenuKeyDownEnd = false ? undefined : 4;
var MenuKeyDownEnter = false ? undefined : 5;
var MenuKeyDownSpaceButton = false ? undefined : 6;
var MenuKeyDownCharacter = false ? undefined : 7;
var MenuBlur = false ? undefined : 8;
var MenuMouseLeave$1 = false ? undefined : 9;
var ItemMouseMove$1 = false ? undefined : 10;
var ItemClick$1 = false ? undefined : 11;
var ToggleButtonClick$1 = false ? undefined : 12;
var ToggleButtonKeyDownArrowDown = false ? undefined : 13;
var ToggleButtonKeyDownArrowUp = false ? undefined : 14;
var ToggleButtonKeyDownCharacter = false ? undefined : 15;
var FunctionToggleMenu$1 = false ? undefined : 16;
var FunctionOpenMenu$1 = false ? undefined : 17;
var FunctionCloseMenu$1 = false ? undefined : 18;
var FunctionSetHighlightedIndex$1 = false ? undefined : 19;
var FunctionSelectItem$1 = false ? undefined : 20;
var FunctionSetInputValue$1 = false ? undefined : 21;
var FunctionReset$2 = false ? undefined : 22;
var stateChangeTypes$2 = /*#__PURE__*/Object.freeze({
__proto__: null,
MenuKeyDownArrowDown: MenuKeyDownArrowDown,
MenuKeyDownArrowUp: MenuKeyDownArrowUp,
MenuKeyDownEscape: MenuKeyDownEscape,
MenuKeyDownHome: MenuKeyDownHome,
MenuKeyDownEnd: MenuKeyDownEnd,
MenuKeyDownEnter: MenuKeyDownEnter,
MenuKeyDownSpaceButton: MenuKeyDownSpaceButton,
MenuKeyDownCharacter: MenuKeyDownCharacter,
MenuBlur: MenuBlur,
MenuMouseLeave: MenuMouseLeave$1,
ItemMouseMove: ItemMouseMove$1,
ItemClick: ItemClick$1,
ToggleButtonClick: ToggleButtonClick$1,
ToggleButtonKeyDownArrowDown: ToggleButtonKeyDownArrowDown,
ToggleButtonKeyDownArrowUp: ToggleButtonKeyDownArrowUp,
ToggleButtonKeyDownCharacter: ToggleButtonKeyDownCharacter,
FunctionToggleMenu: FunctionToggleMenu$1,
FunctionOpenMenu: FunctionOpenMenu$1,
FunctionCloseMenu: FunctionCloseMenu$1,
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex$1,
FunctionSelectItem: FunctionSelectItem$1,
FunctionSetInputValue: FunctionSetInputValue$1,
FunctionReset: FunctionReset$2
});
/* eslint-disable complexity */
function downshiftSelectReducer(state, action) {
var type = action.type,
props = action.props,
shiftKey = action.shiftKey;
var changes;
switch (type) {
case ItemClick$1:
changes = {
isOpen: getDefaultValue$1(props, 'isOpen'),
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
selectedItem: props.items[action.index]
};
break;
case ToggleButtonKeyDownCharacter:
{
var lowercasedKey = action.key;
var inputValue = "" + state.inputValue + lowercasedKey;
var itemIndex = getItemIndexByCharacterKey(inputValue, state.selectedItem ? props.items.indexOf(state.selectedItem) : -1, props.items, props.itemToString, action.getItemNodeFromIndex);
changes = Object(esm_extends["a" /* default */])({
inputValue: inputValue
}, itemIndex >= 0 && {
selectedItem: props.items[itemIndex]
});
}
break;
case ToggleButtonKeyDownArrowDown:
changes = {
highlightedIndex: getHighlightedIndexOnOpen(props, state, 1, action.getItemNodeFromIndex),
isOpen: true
};
break;
case ToggleButtonKeyDownArrowUp:
changes = {
highlightedIndex: getHighlightedIndexOnOpen(props, state, -1, action.getItemNodeFromIndex),
isOpen: true
};
break;
case MenuKeyDownEnter:
case MenuKeyDownSpaceButton:
changes = Object(esm_extends["a" /* default */])({
isOpen: getDefaultValue$1(props, 'isOpen'),
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex')
}, state.highlightedIndex >= 0 && {
selectedItem: props.items[state.highlightedIndex]
});
break;
case MenuKeyDownHome:
changes = {
highlightedIndex: getNextNonDisabledIndex(1, 0, props.items.length, action.getItemNodeFromIndex, false)
};
break;
case MenuKeyDownEnd:
changes = {
highlightedIndex: getNextNonDisabledIndex(-1, props.items.length - 1, props.items.length, action.getItemNodeFromIndex, false)
};
break;
case MenuKeyDownEscape:
changes = {
isOpen: false,
highlightedIndex: -1
};
break;
case MenuBlur:
changes = {
isOpen: false,
highlightedIndex: -1
};
break;
case MenuKeyDownCharacter:
{
var _lowercasedKey = action.key;
var _inputValue = "" + state.inputValue + _lowercasedKey;
var highlightedIndex = getItemIndexByCharacterKey(_inputValue, state.highlightedIndex, props.items, props.itemToString, action.getItemNodeFromIndex);
changes = Object(esm_extends["a" /* default */])({
inputValue: _inputValue
}, highlightedIndex >= 0 && {
highlightedIndex: highlightedIndex
});
}
break;
case MenuKeyDownArrowDown:
changes = {
highlightedIndex: getNextWrappingIndex(shiftKey ? 5 : 1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, props.circularNavigation)
};
break;
case MenuKeyDownArrowUp:
changes = {
highlightedIndex: getNextWrappingIndex(shiftKey ? -5 : -1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, props.circularNavigation)
};
break;
case FunctionSelectItem$1:
changes = {
selectedItem: action.selectedItem
};
break;
default:
return downshiftCommonReducer(state, action, stateChangeTypes$2);
}
return Object(esm_extends["a" /* default */])({}, state, changes);
}
/* eslint-enable complexity */
useSelect.stateChangeTypes = stateChangeTypes$2;
function useSelect(userProps) {
if (userProps === void 0) {
userProps = {};
}
validatePropTypes$2(userProps, useSelect); // Props defaults and destructuring.
var props = Object(esm_extends["a" /* default */])({}, defaultProps$2, userProps);
var items = props.items,
scrollIntoView = props.scrollIntoView,
environment = props.environment,
initialIsOpen = props.initialIsOpen,
defaultIsOpen = props.defaultIsOpen,
itemToString = props.itemToString,
getA11ySelectionMessage = props.getA11ySelectionMessage,
getA11yStatusMessage = props.getA11yStatusMessage; // Initial state depending on controlled props.
var initialState = getInitialState$2(props);
var _useControlledReducer = useControlledReducer$1(downshiftSelectReducer, initialState, props),
state = _useControlledReducer[0],
dispatch = _useControlledReducer[1];
var isOpen = state.isOpen,
highlightedIndex = state.highlightedIndex,
selectedItem = state.selectedItem,
inputValue = state.inputValue; // Element efs.
var toggleButtonRef = Object(external_React_["useRef"])(null);
var menuRef = Object(external_React_["useRef"])(null);
var itemRefs = Object(external_React_["useRef"])({}); // used not to trigger menu blur action in some scenarios.
var shouldBlurRef = Object(external_React_["useRef"])(true); // used to keep the inputValue clearTimeout object between renders.
var clearTimeoutRef = Object(external_React_["useRef"])(null); // prevent id re-generation between renders.
var elementIds = useElementIds(props); // used to keep track of how many items we had on previous cycle.
var previousResultCountRef = Object(external_React_["useRef"])();
var isInitialMountRef = Object(external_React_["useRef"])(true); // utility callback to get item element.
var latest = useLatestRef({
state: state,
props: props
}); // Some utils.
var getItemNodeFromIndex = Object(external_React_["useCallback"])(function (index) {
return itemRefs.current[elementIds.getItemId(index)];
}, [elementIds]); // Effects.
// Sets a11y status message on changes in state.
useA11yMessageSetter(getA11yStatusMessage, [isOpen, highlightedIndex, inputValue, items], Object(esm_extends["a" /* default */])({
isInitialMount: isInitialMountRef.current,
previousResultCount: previousResultCountRef.current,
items: items,
environment: environment,
itemToString: itemToString
}, state)); // Sets a11y status message on changes in selectedItem.
useA11yMessageSetter(getA11ySelectionMessage, [selectedItem], Object(esm_extends["a" /* default */])({
isInitialMount: isInitialMountRef.current,
previousResultCount: previousResultCountRef.current,
items: items,
environment: environment,
itemToString: itemToString
}, state)); // Scroll on highlighted item if change comes from keyboard.
var shouldScrollRef = useScrollIntoView({
menuElement: menuRef.current,
highlightedIndex: highlightedIndex,
isOpen: isOpen,
itemRefs: itemRefs,
scrollIntoView: scrollIntoView,
getItemNodeFromIndex: getItemNodeFromIndex
}); // Sets cleanup for the keysSoFar callback, debounded after 500ms.
Object(external_React_["useEffect"])(function () {
// init the clean function here as we need access to dispatch.
clearTimeoutRef.current = debounce(function (outerDispatch) {
outerDispatch({
type: FunctionSetInputValue$1,
inputValue: ''
});
}, 500); // Cancel any pending debounced calls on mount
return function () {
clearTimeoutRef.current.cancel();
};
}, []); // Invokes the keysSoFar callback set up above.
Object(external_React_["useEffect"])(function () {
if (!inputValue) {
return;
}
clearTimeoutRef.current(dispatch);
}, [dispatch, inputValue]);
useControlPropsValidator({
isInitialMount: isInitialMountRef.current,
props: props,
state: state
});
/* Controls the focus on the menu or the toggle button. */
Object(external_React_["useEffect"])(function () {
// Don't focus menu on first render.
if (isInitialMountRef.current) {
// Unless it was initialised as open.
if ((initialIsOpen || defaultIsOpen || isOpen) && menuRef.current) {
menuRef.current.focus();
}
return;
} // Focus menu on open.
if (isOpen) {
// istanbul ignore else
if (menuRef.current) {
menuRef.current.focus();
}
return;
} // Focus toggleButton on close, but not if it was closed with (Shift+)Tab.
if (environment.document.activeElement === menuRef.current) {
// istanbul ignore else
if (toggleButtonRef.current) {
shouldBlurRef.current = false;
toggleButtonRef.current.focus();
}
} // eslint-disable-next-line react-hooks/exhaustive-deps
}, [isOpen]);
Object(external_React_["useEffect"])(function () {
if (isInitialMountRef.current) {
return;
}
previousResultCountRef.current = items.length;
}); // Add mouse/touch events to document.
var mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [menuRef, toggleButtonRef], environment, function () {
dispatch({
type: MenuBlur
});
});
var setGetterPropCallInfo = useGetterPropsCalledChecker('getMenuProps', 'getToggleButtonProps'); // Make initial ref false.
Object(external_React_["useEffect"])(function () {
isInitialMountRef.current = false;
}, []); // Reset itemRefs on close.
Object(external_React_["useEffect"])(function () {
if (!isOpen) {
itemRefs.current = {};
}
}, [isOpen]); // Event handler functions.
var toggleButtonKeyDownHandlers = Object(external_React_["useMemo"])(function () {
return {
ArrowDown: function ArrowDown(event) {
event.preventDefault();
dispatch({
type: ToggleButtonKeyDownArrowDown,
getItemNodeFromIndex: getItemNodeFromIndex,
shiftKey: event.shiftKey
});
},
ArrowUp: function ArrowUp(event) {
event.preventDefault();
dispatch({
type: ToggleButtonKeyDownArrowUp,
getItemNodeFromIndex: getItemNodeFromIndex,
shiftKey: event.shiftKey
});
}
};
}, [dispatch, getItemNodeFromIndex]);
var menuKeyDownHandlers = Object(external_React_["useMemo"])(function () {
return {
ArrowDown: function ArrowDown(event) {
event.preventDefault();
dispatch({
type: MenuKeyDownArrowDown,
getItemNodeFromIndex: getItemNodeFromIndex,
shiftKey: event.shiftKey
});
},
ArrowUp: function ArrowUp(event) {
event.preventDefault();
dispatch({
type: MenuKeyDownArrowUp,
getItemNodeFromIndex: getItemNodeFromIndex,
shiftKey: event.shiftKey
});
},
Home: function Home(event) {
event.preventDefault();
dispatch({
type: MenuKeyDownHome,
getItemNodeFromIndex: getItemNodeFromIndex
});
},
End: function End(event) {
event.preventDefault();
dispatch({
type: MenuKeyDownEnd,
getItemNodeFromIndex: getItemNodeFromIndex
});
},
Escape: function Escape() {
dispatch({
type: MenuKeyDownEscape
});
},
Enter: function Enter(event) {
event.preventDefault();
dispatch({
type: MenuKeyDownEnter
});
},
' ': function _(event) {
event.preventDefault();
dispatch({
type: MenuKeyDownSpaceButton
});
}
};
}, [dispatch, getItemNodeFromIndex]); // Action functions.
var toggleMenu = Object(external_React_["useCallback"])(function () {
dispatch({
type: FunctionToggleMenu$1
});
}, [dispatch]);
var closeMenu = Object(external_React_["useCallback"])(function () {
dispatch({
type: FunctionCloseMenu$1
});
}, [dispatch]);
var openMenu = Object(external_React_["useCallback"])(function () {
dispatch({
type: FunctionOpenMenu$1
});
}, [dispatch]);
var setHighlightedIndex = Object(external_React_["useCallback"])(function (newHighlightedIndex) {
dispatch({
type: FunctionSetHighlightedIndex$1,
highlightedIndex: newHighlightedIndex
});
}, [dispatch]);
var selectItem = Object(external_React_["useCallback"])(function (newSelectedItem) {
dispatch({
type: FunctionSelectItem$1,
selectedItem: newSelectedItem
});
}, [dispatch]);
var reset = Object(external_React_["useCallback"])(function () {
dispatch({
type: FunctionReset$2
});
}, [dispatch]);
var setInputValue = Object(external_React_["useCallback"])(function (newInputValue) {
dispatch({
type: FunctionSetInputValue$1,
inputValue: newInputValue
});
}, [dispatch]); // Getter functions.
var getLabelProps = Object(external_React_["useCallback"])(function (labelProps) {
return Object(esm_extends["a" /* default */])({
id: elementIds.labelId,
htmlFor: elementIds.toggleButtonId
}, labelProps);
}, [elementIds]);
var getMenuProps = Object(external_React_["useCallback"])(function (_temp, _temp2) {
var _extends2;
var _ref = _temp === void 0 ? {} : _temp,
onMouseLeave = _ref.onMouseLeave,
_ref$refKey = _ref.refKey,
refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,
onKeyDown = _ref.onKeyDown,
onBlur = _ref.onBlur,
ref = _ref.ref,
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref, ["onMouseLeave", "refKey", "onKeyDown", "onBlur", "ref"]);
var _ref2 = _temp2 === void 0 ? {} : _temp2,
_ref2$suppressRefErro = _ref2.suppressRefError,
suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro;
var latestState = latest.current.state;
var menuHandleKeyDown = function menuHandleKeyDown(event) {
var key = normalizeArrowKey(event);
if (key && menuKeyDownHandlers[key]) {
menuKeyDownHandlers[key](event);
} else if (isAcceptedCharacterKey(key)) {
dispatch({
type: MenuKeyDownCharacter,
key: key,
getItemNodeFromIndex: getItemNodeFromIndex
});
}
};
var menuHandleBlur = function menuHandleBlur() {
// if the blur was a result of selection, we don't trigger this action.
if (shouldBlurRef.current === false) {
shouldBlurRef.current = true;
return;
}
var shouldBlur = !mouseAndTouchTrackersRef.current.isMouseDown;
/* istanbul ignore else */
if (shouldBlur) {
dispatch({
type: MenuBlur
});
}
};
var menuHandleMouseLeave = function menuHandleMouseLeave() {
dispatch({
type: MenuMouseLeave$1
});
};
setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef);
return Object(esm_extends["a" /* default */])((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (menuNode) {
menuRef.current = menuNode;
}), _extends2.id = elementIds.menuId, _extends2.role = 'listbox', _extends2['aria-labelledby'] = elementIds.labelId, _extends2.tabIndex = -1, _extends2), latestState.isOpen && latestState.highlightedIndex > -1 && {
'aria-activedescendant': elementIds.getItemId(latestState.highlightedIndex)
}, {
onMouseLeave: callAllEventHandlers(onMouseLeave, menuHandleMouseLeave),
onKeyDown: callAllEventHandlers(onKeyDown, menuHandleKeyDown),
onBlur: callAllEventHandlers(onBlur, menuHandleBlur)
}, rest);
}, [dispatch, latest, menuKeyDownHandlers, mouseAndTouchTrackersRef, setGetterPropCallInfo, elementIds, getItemNodeFromIndex]);
var getToggleButtonProps = Object(external_React_["useCallback"])(function (_temp3, _temp4) {
var _extends3;
var _ref3 = _temp3 === void 0 ? {} : _temp3,
onClick = _ref3.onClick,
onKeyDown = _ref3.onKeyDown,
_ref3$refKey = _ref3.refKey,
refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
ref = _ref3.ref,
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref3, ["onClick", "onKeyDown", "refKey", "ref"]);
var _ref4 = _temp4 === void 0 ? {} : _temp4,
_ref4$suppressRefErro = _ref4.suppressRefError,
suppressRefError = _ref4$suppressRefErro === void 0 ? false : _ref4$suppressRefErro;
var toggleButtonHandleClick = function toggleButtonHandleClick() {
dispatch({
type: ToggleButtonClick$1
});
};
var toggleButtonHandleKeyDown = function toggleButtonHandleKeyDown(event) {
var key = normalizeArrowKey(event);
if (key && toggleButtonKeyDownHandlers[key]) {
toggleButtonKeyDownHandlers[key](event);
} else if (isAcceptedCharacterKey(key)) {
dispatch({
type: ToggleButtonKeyDownCharacter,
key: key,
getItemNodeFromIndex: getItemNodeFromIndex
});
}
};
var toggleProps = Object(esm_extends["a" /* default */])((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (toggleButtonNode) {
toggleButtonRef.current = toggleButtonNode;
}), _extends3.id = elementIds.toggleButtonId, _extends3['aria-haspopup'] = 'listbox', _extends3['aria-expanded'] = latest.current.state.isOpen, _extends3['aria-labelledby'] = elementIds.labelId + " " + elementIds.toggleButtonId, _extends3), rest);
if (!rest.disabled) {
toggleProps.onClick = callAllEventHandlers(onClick, toggleButtonHandleClick);
toggleProps.onKeyDown = callAllEventHandlers(onKeyDown, toggleButtonHandleKeyDown);
}
setGetterPropCallInfo('getToggleButtonProps', suppressRefError, refKey, toggleButtonRef);
return toggleProps;
}, [dispatch, latest, toggleButtonKeyDownHandlers, setGetterPropCallInfo, elementIds, getItemNodeFromIndex]);
var getItemProps = Object(external_React_["useCallback"])(function (_temp5) {
var _extends4;
var _ref5 = _temp5 === void 0 ? {} : _temp5,
item = _ref5.item,
index = _ref5.index,
onMouseMove = _ref5.onMouseMove,
onClick = _ref5.onClick,
_ref5$refKey = _ref5.refKey,
refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
ref = _ref5.ref,
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref5, ["item", "index", "onMouseMove", "onClick", "refKey", "ref"]);
var _latest$current = latest.current,
latestState = _latest$current.state,
latestProps = _latest$current.props;
var itemHandleMouseMove = function itemHandleMouseMove() {
if (index === latestState.highlightedIndex) {
return;
}
shouldScrollRef.current = false;
dispatch({
type: ItemMouseMove$1,
index: index
});
};
var itemHandleClick = function itemHandleClick() {
dispatch({
type: ItemClick$1,
index: index
});
};
var itemIndex = getItemIndex(index, item, latestProps.items);
if (itemIndex < 0) {
throw new Error('Pass either item or item index in getItemProps!');
}
var itemProps = Object(esm_extends["a" /* default */])((_extends4 = {
role: 'option',
'aria-selected': "" + (itemIndex === latestState.highlightedIndex),
id: elementIds.getItemId(itemIndex)
}, _extends4[refKey] = handleRefs(ref, function (itemNode) {
if (itemNode) {
itemRefs.current[elementIds.getItemId(itemIndex)] = itemNode;
}
}), _extends4), rest);
if (!rest.disabled) {
itemProps.onMouseMove = callAllEventHandlers(onMouseMove, itemHandleMouseMove);
itemProps.onClick = callAllEventHandlers(onClick, itemHandleClick);
}
return itemProps;
}, [dispatch, latest, shouldScrollRef, elementIds]);
return {
// prop getters.
getToggleButtonProps: getToggleButtonProps,
getLabelProps: getLabelProps,
getMenuProps: getMenuProps,
getItemProps: getItemProps,
// actions.
toggleMenu: toggleMenu,
openMenu: openMenu,
closeMenu: closeMenu,
setHighlightedIndex: setHighlightedIndex,
selectItem: selectItem,
reset: reset,
setInputValue: setInputValue,
// state.
highlightedIndex: highlightedIndex,
isOpen: isOpen,
selectedItem: selectedItem,
inputValue: inputValue
};
}
var InputKeyDownArrowDown = false ? undefined : 0;
var InputKeyDownArrowUp = false ? undefined : 1;
var InputKeyDownEscape = false ? undefined : 2;
var InputKeyDownHome = false ? undefined : 3;
var InputKeyDownEnd = false ? undefined : 4;
var InputKeyDownEnter = false ? undefined : 5;
var InputChange = false ? undefined : 6;
var InputBlur = false ? undefined : 7;
var MenuMouseLeave = false ? undefined : 8;
var ItemMouseMove = false ? undefined : 9;
var ItemClick = false ? undefined : 10;
var ToggleButtonClick = false ? undefined : 11;
var FunctionToggleMenu = false ? undefined : 12;
var FunctionOpenMenu = false ? undefined : 13;
var FunctionCloseMenu = false ? undefined : 14;
var FunctionSetHighlightedIndex = false ? undefined : 15;
var FunctionSelectItem = false ? undefined : 16;
var FunctionSetInputValue = false ? undefined : 17;
var FunctionReset$1 = false ? undefined : 18;
var ControlledPropUpdatedSelectedItem = false ? undefined : 19;
var stateChangeTypes$1 = /*#__PURE__*/Object.freeze({
__proto__: null,
InputKeyDownArrowDown: InputKeyDownArrowDown,
InputKeyDownArrowUp: InputKeyDownArrowUp,
InputKeyDownEscape: InputKeyDownEscape,
InputKeyDownHome: InputKeyDownHome,
InputKeyDownEnd: InputKeyDownEnd,
InputKeyDownEnter: InputKeyDownEnter,
InputChange: InputChange,
InputBlur: InputBlur,
MenuMouseLeave: MenuMouseLeave,
ItemMouseMove: ItemMouseMove,
ItemClick: ItemClick,
ToggleButtonClick: ToggleButtonClick,
FunctionToggleMenu: FunctionToggleMenu,
FunctionOpenMenu: FunctionOpenMenu,
FunctionCloseMenu: FunctionCloseMenu,
FunctionSetHighlightedIndex: FunctionSetHighlightedIndex,
FunctionSelectItem: FunctionSelectItem,
FunctionSetInputValue: FunctionSetInputValue,
FunctionReset: FunctionReset$1,
ControlledPropUpdatedSelectedItem: ControlledPropUpdatedSelectedItem
});
function getInitialState$1(props) {
var initialState = getInitialState$2(props);
var selectedItem = initialState.selectedItem;
var inputValue = initialState.inputValue;
if (inputValue === '' && selectedItem && props.defaultInputValue === undefined && props.initialInputValue === undefined && props.inputValue === undefined) {
inputValue = props.itemToString(selectedItem);
}
return Object(esm_extends["a" /* default */])({}, initialState, {
inputValue: inputValue
});
}
var propTypes$1 = {
items: prop_types_default.a.array.isRequired,
itemToString: prop_types_default.a.func,
getA11yStatusMessage: prop_types_default.a.func,
getA11ySelectionMessage: prop_types_default.a.func,
circularNavigation: prop_types_default.a.bool,
highlightedIndex: prop_types_default.a.number,
defaultHighlightedIndex: prop_types_default.a.number,
initialHighlightedIndex: prop_types_default.a.number,
isOpen: prop_types_default.a.bool,
defaultIsOpen: prop_types_default.a.bool,
initialIsOpen: prop_types_default.a.bool,
selectedItem: prop_types_default.a.any,
initialSelectedItem: prop_types_default.a.any,
defaultSelectedItem: prop_types_default.a.any,
inputValue: prop_types_default.a.string,
defaultInputValue: prop_types_default.a.string,
initialInputValue: prop_types_default.a.string,
id: prop_types_default.a.string,
labelId: prop_types_default.a.string,
menuId: prop_types_default.a.string,
getItemId: prop_types_default.a.func,
inputId: prop_types_default.a.string,
toggleButtonId: prop_types_default.a.string,
stateReducer: prop_types_default.a.func,
onSelectedItemChange: prop_types_default.a.func,
onHighlightedIndexChange: prop_types_default.a.func,
onStateChange: prop_types_default.a.func,
onIsOpenChange: prop_types_default.a.func,
onInputValueChange: prop_types_default.a.func,
environment: prop_types_default.a.shape({
addEventListener: prop_types_default.a.func,
removeEventListener: prop_types_default.a.func,
document: prop_types_default.a.shape({
getElementById: prop_types_default.a.func,
activeElement: prop_types_default.a.any,
body: prop_types_default.a.any
})
})
};
/**
* The useCombobox version of useControlledReducer, which also
* checks if the controlled prop selectedItem changed between
* renders. If so, it will also update inputValue with its
* string equivalent. It uses the common useEnhancedReducer to
* compute the rest of the state.
*
* @param {Function} reducer Reducer function from downshift.
* @param {Object} initialState Initial state of the hook.
* @param {Object} props The hook props.
* @returns {Array} An array with the state and an action dispatcher.
*/
function useControlledReducer(reducer, initialState, props) {
var previousSelectedItemRef = Object(external_React_["useRef"])();
var _useEnhancedReducer = useEnhancedReducer(reducer, initialState, props),
state = _useEnhancedReducer[0],
dispatch = _useEnhancedReducer[1]; // ToDo: if needed, make same approach as selectedItemChanged from Downshift.
Object(external_React_["useEffect"])(function () {
if (isControlledProp(props, 'selectedItem')) {
if (previousSelectedItemRef.current !== props.selectedItem) {
dispatch({
type: ControlledPropUpdatedSelectedItem,
inputValue: props.itemToString(props.selectedItem)
});
}
previousSelectedItemRef.current = state.selectedItem === previousSelectedItemRef.current ? props.selectedItem : state.selectedItem;
}
});
return [getState(state, props), dispatch];
} // eslint-disable-next-line import/no-mutable-exports
var validatePropTypes$1 = downshift_esm_noop;
/* istanbul ignore next */
if (false) {}
var defaultProps$1 = Object(esm_extends["a" /* default */])({}, defaultProps$3, {
getA11yStatusMessage: getA11yStatusMessage$1,
circularNavigation: true
});
/* eslint-disable complexity */
function downshiftUseComboboxReducer(state, action) {
var type = action.type,
props = action.props,
shiftKey = action.shiftKey;
var changes;
switch (type) {
case ItemClick:
changes = {
isOpen: getDefaultValue$1(props, 'isOpen'),
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
selectedItem: props.items[action.index],
inputValue: props.itemToString(props.items[action.index])
};
break;
case InputKeyDownArrowDown:
if (state.isOpen) {
changes = {
highlightedIndex: getNextWrappingIndex(shiftKey ? 5 : 1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, props.circularNavigation)
};
} else {
changes = {
highlightedIndex: getHighlightedIndexOnOpen(props, state, 1, action.getItemNodeFromIndex),
isOpen: props.items.length >= 0
};
}
break;
case InputKeyDownArrowUp:
if (state.isOpen) {
changes = {
highlightedIndex: getNextWrappingIndex(shiftKey ? -5 : -1, state.highlightedIndex, props.items.length, action.getItemNodeFromIndex, props.circularNavigation)
};
} else {
changes = {
highlightedIndex: getHighlightedIndexOnOpen(props, state, -1, action.getItemNodeFromIndex),
isOpen: props.items.length >= 0
};
}
break;
case InputKeyDownEnter:
changes = Object(esm_extends["a" /* default */])({}, state.isOpen && state.highlightedIndex >= 0 && {
selectedItem: props.items[state.highlightedIndex],
isOpen: getDefaultValue$1(props, 'isOpen'),
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
inputValue: props.itemToString(props.items[state.highlightedIndex])
});
break;
case InputKeyDownEscape:
changes = Object(esm_extends["a" /* default */])({
isOpen: false,
highlightedIndex: -1
}, !state.isOpen && {
selectedItem: null,
inputValue: ''
});
break;
case InputKeyDownHome:
changes = {
highlightedIndex: getNextNonDisabledIndex(1, 0, props.items.length, action.getItemNodeFromIndex, false)
};
break;
case InputKeyDownEnd:
changes = {
highlightedIndex: getNextNonDisabledIndex(-1, props.items.length - 1, props.items.length, action.getItemNodeFromIndex, false)
};
break;
case InputBlur:
changes = Object(esm_extends["a" /* default */])({
isOpen: false,
highlightedIndex: -1
}, state.highlightedIndex >= 0 && action.selectItem && {
selectedItem: props.items[state.highlightedIndex],
inputValue: props.itemToString(props.items[state.highlightedIndex])
});
break;
case InputChange:
changes = {
isOpen: true,
highlightedIndex: getDefaultValue$1(props, 'highlightedIndex'),
inputValue: action.inputValue
};
break;
case FunctionSelectItem:
changes = {
selectedItem: action.selectedItem,
inputValue: props.itemToString(action.selectedItem)
};
break;
case ControlledPropUpdatedSelectedItem:
changes = {
inputValue: action.inputValue
};
break;
default:
return downshiftCommonReducer(state, action, stateChangeTypes$1);
}
return Object(esm_extends["a" /* default */])({}, state, changes);
}
/* eslint-enable complexity */
useCombobox.stateChangeTypes = stateChangeTypes$1;
function useCombobox(userProps) {
if (userProps === void 0) {
userProps = {};
}
validatePropTypes$1(userProps, useCombobox); // Props defaults and destructuring.
var props = Object(esm_extends["a" /* default */])({}, defaultProps$1, userProps);
var initialIsOpen = props.initialIsOpen,
defaultIsOpen = props.defaultIsOpen,
items = props.items,
scrollIntoView = props.scrollIntoView,
environment = props.environment,
getA11yStatusMessage = props.getA11yStatusMessage,
getA11ySelectionMessage = props.getA11ySelectionMessage,
itemToString = props.itemToString; // Initial state depending on controlled props.
var initialState = getInitialState$1(props);
var _useControlledReducer = useControlledReducer(downshiftUseComboboxReducer, initialState, props),
state = _useControlledReducer[0],
dispatch = _useControlledReducer[1];
var isOpen = state.isOpen,
highlightedIndex = state.highlightedIndex,
selectedItem = state.selectedItem,
inputValue = state.inputValue; // Element refs.
var menuRef = Object(external_React_["useRef"])(null);
var itemRefs = Object(external_React_["useRef"])({});
var inputRef = Object(external_React_["useRef"])(null);
var toggleButtonRef = Object(external_React_["useRef"])(null);
var comboboxRef = Object(external_React_["useRef"])(null);
var isInitialMountRef = Object(external_React_["useRef"])(true); // prevent id re-generation between renders.
var elementIds = useElementIds(props); // used to keep track of how many items we had on previous cycle.
var previousResultCountRef = Object(external_React_["useRef"])(); // utility callback to get item element.
var latest = useLatestRef({
state: state,
props: props
});
var getItemNodeFromIndex = Object(external_React_["useCallback"])(function (index) {
return itemRefs.current[elementIds.getItemId(index)];
}, [elementIds]); // Effects.
// Sets a11y status message on changes in state.
useA11yMessageSetter(getA11yStatusMessage, [isOpen, highlightedIndex, inputValue, items], Object(esm_extends["a" /* default */])({
isInitialMount: isInitialMountRef.current,
previousResultCount: previousResultCountRef.current,
items: items,
environment: environment,
itemToString: itemToString
}, state)); // Sets a11y status message on changes in selectedItem.
useA11yMessageSetter(getA11ySelectionMessage, [selectedItem], Object(esm_extends["a" /* default */])({
isInitialMount: isInitialMountRef.current,
previousResultCount: previousResultCountRef.current,
items: items,
environment: environment,
itemToString: itemToString
}, state)); // Scroll on highlighted item if change comes from keyboard.
var shouldScrollRef = useScrollIntoView({
menuElement: menuRef.current,
highlightedIndex: highlightedIndex,
isOpen: isOpen,
itemRefs: itemRefs,
scrollIntoView: scrollIntoView,
getItemNodeFromIndex: getItemNodeFromIndex
});
useControlPropsValidator({
isInitialMount: isInitialMountRef.current,
props: props,
state: state
}); // Focus the input on first render if required.
Object(external_React_["useEffect"])(function () {
var focusOnOpen = initialIsOpen || defaultIsOpen || isOpen;
if (focusOnOpen && inputRef.current) {
inputRef.current.focus();
} // eslint-disable-next-line react-hooks/exhaustive-deps
}, []);
Object(external_React_["useEffect"])(function () {
if (isInitialMountRef.current) {
return;
}
previousResultCountRef.current = items.length;
}); // Add mouse/touch events to document.
var mouseAndTouchTrackersRef = useMouseAndTouchTracker(isOpen, [comboboxRef, menuRef, toggleButtonRef], environment, function () {
dispatch({
type: InputBlur,
selectItem: false
});
});
var setGetterPropCallInfo = useGetterPropsCalledChecker('getInputProps', 'getComboboxProps', 'getMenuProps'); // Make initial ref false.
Object(external_React_["useEffect"])(function () {
isInitialMountRef.current = false;
}, []); // Reset itemRefs on close.
Object(external_React_["useEffect"])(function () {
if (!isOpen) {
itemRefs.current = {};
}
}, [isOpen]);
/* Event handler functions */
var inputKeyDownHandlers = Object(external_React_["useMemo"])(function () {
return {
ArrowDown: function ArrowDown(event) {
event.preventDefault();
dispatch({
type: InputKeyDownArrowDown,
shiftKey: event.shiftKey,
getItemNodeFromIndex: getItemNodeFromIndex
});
},
ArrowUp: function ArrowUp(event) {
event.preventDefault();
dispatch({
type: InputKeyDownArrowUp,
shiftKey: event.shiftKey,
getItemNodeFromIndex: getItemNodeFromIndex
});
},
Home: function Home(event) {
if (!latest.current.state.isOpen) {
return;
}
event.preventDefault();
dispatch({
type: InputKeyDownHome,
getItemNodeFromIndex: getItemNodeFromIndex
});
},
End: function End(event) {
if (!latest.current.state.isOpen) {
return;
}
event.preventDefault();
dispatch({
type: InputKeyDownEnd,
getItemNodeFromIndex: getItemNodeFromIndex
});
},
Escape: function Escape() {
var latestState = latest.current.state;
if (latestState.isOpen || latestState.inputValue || latestState.selectedItem || latestState.highlightedIndex > -1) {
dispatch({
type: InputKeyDownEscape
});
}
},
Enter: function Enter(event) {
var latestState = latest.current.state; // if closed or no highlighted index, do nothing.
if (!latestState.isOpen || latestState.highlightedIndex < 0 || event.which === 229 // if IME composing, wait for next Enter keydown event.
) {
return;
}
event.preventDefault();
dispatch({
type: InputKeyDownEnter,
getItemNodeFromIndex: getItemNodeFromIndex
});
}
};
}, [dispatch, latest, getItemNodeFromIndex]); // Getter props.
var getLabelProps = Object(external_React_["useCallback"])(function (labelProps) {
return Object(esm_extends["a" /* default */])({
id: elementIds.labelId,
htmlFor: elementIds.inputId
}, labelProps);
}, [elementIds]);
var getMenuProps = Object(external_React_["useCallback"])(function (_temp, _temp2) {
var _extends2;
var _ref = _temp === void 0 ? {} : _temp,
onMouseLeave = _ref.onMouseLeave,
_ref$refKey = _ref.refKey,
refKey = _ref$refKey === void 0 ? 'ref' : _ref$refKey,
ref = _ref.ref,
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref, ["onMouseLeave", "refKey", "ref"]);
var _ref2 = _temp2 === void 0 ? {} : _temp2,
_ref2$suppressRefErro = _ref2.suppressRefError,
suppressRefError = _ref2$suppressRefErro === void 0 ? false : _ref2$suppressRefErro;
setGetterPropCallInfo('getMenuProps', suppressRefError, refKey, menuRef);
return Object(esm_extends["a" /* default */])((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (menuNode) {
menuRef.current = menuNode;
}), _extends2.id = elementIds.menuId, _extends2.role = 'listbox', _extends2['aria-labelledby'] = elementIds.labelId, _extends2.onMouseLeave = callAllEventHandlers(onMouseLeave, function () {
dispatch({
type: MenuMouseLeave
});
}), _extends2), rest);
}, [dispatch, setGetterPropCallInfo, elementIds]);
var getItemProps = Object(external_React_["useCallback"])(function (_temp3) {
var _extends3, _ref4;
var _ref3 = _temp3 === void 0 ? {} : _temp3,
item = _ref3.item,
index = _ref3.index,
_ref3$refKey = _ref3.refKey,
refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
ref = _ref3.ref,
onMouseMove = _ref3.onMouseMove,
onClick = _ref3.onClick;
_ref3.onPress;
var rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref3, ["item", "index", "refKey", "ref", "onMouseMove", "onClick", "onPress"]);
var _latest$current = latest.current,
latestProps = _latest$current.props,
latestState = _latest$current.state;
var itemIndex = getItemIndex(index, item, latestProps.items);
if (itemIndex < 0) {
throw new Error('Pass either item or item index in getItemProps!');
}
var onSelectKey = 'onClick';
var customClickHandler = onClick;
var itemHandleMouseMove = function itemHandleMouseMove() {
if (index === latestState.highlightedIndex) {
return;
}
shouldScrollRef.current = false;
dispatch({
type: ItemMouseMove,
index: index
});
};
var itemHandleClick = function itemHandleClick() {
dispatch({
type: ItemClick,
index: index
});
if (inputRef.current) {
inputRef.current.focus();
}
};
return Object(esm_extends["a" /* default */])((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (itemNode) {
if (itemNode) {
itemRefs.current[elementIds.getItemId(itemIndex)] = itemNode;
}
}), _extends3.role = 'option', _extends3['aria-selected'] = "" + (itemIndex === latestState.highlightedIndex), _extends3.id = elementIds.getItemId(itemIndex), _extends3), !rest.disabled && (_ref4 = {
onMouseMove: callAllEventHandlers(onMouseMove, itemHandleMouseMove)
}, _ref4[onSelectKey] = callAllEventHandlers(customClickHandler, itemHandleClick), _ref4), rest);
}, [dispatch, latest, shouldScrollRef, elementIds]);
var getToggleButtonProps = Object(external_React_["useCallback"])(function (_temp4) {
var _extends4;
var _ref5 = _temp4 === void 0 ? {} : _temp4,
onClick = _ref5.onClick;
_ref5.onPress;
var _ref5$refKey = _ref5.refKey,
refKey = _ref5$refKey === void 0 ? 'ref' : _ref5$refKey,
ref = _ref5.ref,
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref5, ["onClick", "onPress", "refKey", "ref"]);
var toggleButtonHandleClick = function toggleButtonHandleClick() {
dispatch({
type: ToggleButtonClick
});
if (!latest.current.state.isOpen && inputRef.current) {
inputRef.current.focus();
}
};
return Object(esm_extends["a" /* default */])((_extends4 = {}, _extends4[refKey] = handleRefs(ref, function (toggleButtonNode) {
toggleButtonRef.current = toggleButtonNode;
}), _extends4.id = elementIds.toggleButtonId, _extends4.tabIndex = -1, _extends4), !rest.disabled && Object(esm_extends["a" /* default */])({}, {
onClick: callAllEventHandlers(onClick, toggleButtonHandleClick)
}), rest);
}, [dispatch, latest, elementIds]);
var getInputProps = Object(external_React_["useCallback"])(function (_temp5, _temp6) {
var _extends5;
var _ref6 = _temp5 === void 0 ? {} : _temp5,
onKeyDown = _ref6.onKeyDown,
onChange = _ref6.onChange,
onInput = _ref6.onInput,
onBlur = _ref6.onBlur;
_ref6.onChangeText;
var _ref6$refKey = _ref6.refKey,
refKey = _ref6$refKey === void 0 ? 'ref' : _ref6$refKey,
ref = _ref6.ref,
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref6, ["onKeyDown", "onChange", "onInput", "onBlur", "onChangeText", "refKey", "ref"]);
var _ref7 = _temp6 === void 0 ? {} : _temp6,
_ref7$suppressRefErro = _ref7.suppressRefError,
suppressRefError = _ref7$suppressRefErro === void 0 ? false : _ref7$suppressRefErro;
setGetterPropCallInfo('getInputProps', suppressRefError, refKey, inputRef);
var latestState = latest.current.state;
var inputHandleKeyDown = function inputHandleKeyDown(event) {
var key = normalizeArrowKey(event);
if (key && inputKeyDownHandlers[key]) {
inputKeyDownHandlers[key](event);
}
};
var inputHandleChange = function inputHandleChange(event) {
dispatch({
type: InputChange,
inputValue: event.target.value
});
};
var inputHandleBlur = function inputHandleBlur() {
/* istanbul ignore else */
if (latestState.isOpen && !mouseAndTouchTrackersRef.current.isMouseDown) {
dispatch({
type: InputBlur,
selectItem: true
});
}
};
/* istanbul ignore next (preact) */
var onChangeKey = 'onChange';
var eventHandlers = {};
if (!rest.disabled) {
var _eventHandlers;
eventHandlers = (_eventHandlers = {}, _eventHandlers[onChangeKey] = callAllEventHandlers(onChange, onInput, inputHandleChange), _eventHandlers.onKeyDown = callAllEventHandlers(onKeyDown, inputHandleKeyDown), _eventHandlers.onBlur = callAllEventHandlers(onBlur, inputHandleBlur), _eventHandlers);
}
return Object(esm_extends["a" /* default */])((_extends5 = {}, _extends5[refKey] = handleRefs(ref, function (inputNode) {
inputRef.current = inputNode;
}), _extends5.id = elementIds.inputId, _extends5['aria-autocomplete'] = 'list', _extends5['aria-controls'] = elementIds.menuId, _extends5), latestState.isOpen && latestState.highlightedIndex > -1 && {
'aria-activedescendant': elementIds.getItemId(latestState.highlightedIndex)
}, {
'aria-labelledby': elementIds.labelId,
// https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion
// revert back since autocomplete="nope" is ignored on latest Chrome and Opera
autoComplete: 'off',
value: latestState.inputValue
}, eventHandlers, rest);
}, [dispatch, inputKeyDownHandlers, latest, mouseAndTouchTrackersRef, setGetterPropCallInfo, elementIds]);
var getComboboxProps = Object(external_React_["useCallback"])(function (_temp7, _temp8) {
var _extends6;
var _ref8 = _temp7 === void 0 ? {} : _temp7,
_ref8$refKey = _ref8.refKey,
refKey = _ref8$refKey === void 0 ? 'ref' : _ref8$refKey,
ref = _ref8.ref,
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref8, ["refKey", "ref"]);
var _ref9 = _temp8 === void 0 ? {} : _temp8,
_ref9$suppressRefErro = _ref9.suppressRefError,
suppressRefError = _ref9$suppressRefErro === void 0 ? false : _ref9$suppressRefErro;
setGetterPropCallInfo('getComboboxProps', suppressRefError, refKey, comboboxRef);
return Object(esm_extends["a" /* default */])((_extends6 = {}, _extends6[refKey] = handleRefs(ref, function (comboboxNode) {
comboboxRef.current = comboboxNode;
}), _extends6.role = 'combobox', _extends6['aria-haspopup'] = 'listbox', _extends6['aria-owns'] = elementIds.menuId, _extends6['aria-expanded'] = latest.current.state.isOpen, _extends6), rest);
}, [latest, setGetterPropCallInfo, elementIds]); // returns
var toggleMenu = Object(external_React_["useCallback"])(function () {
dispatch({
type: FunctionToggleMenu
});
}, [dispatch]);
var closeMenu = Object(external_React_["useCallback"])(function () {
dispatch({
type: FunctionCloseMenu
});
}, [dispatch]);
var openMenu = Object(external_React_["useCallback"])(function () {
dispatch({
type: FunctionOpenMenu
});
}, [dispatch]);
var setHighlightedIndex = Object(external_React_["useCallback"])(function (newHighlightedIndex) {
dispatch({
type: FunctionSetHighlightedIndex,
highlightedIndex: newHighlightedIndex
});
}, [dispatch]);
var selectItem = Object(external_React_["useCallback"])(function (newSelectedItem) {
dispatch({
type: FunctionSelectItem,
selectedItem: newSelectedItem
});
}, [dispatch]);
var setInputValue = Object(external_React_["useCallback"])(function (newInputValue) {
dispatch({
type: FunctionSetInputValue,
inputValue: newInputValue
});
}, [dispatch]);
var reset = Object(external_React_["useCallback"])(function () {
dispatch({
type: FunctionReset$1
});
}, [dispatch]);
return {
// prop getters.
getItemProps: getItemProps,
getLabelProps: getLabelProps,
getMenuProps: getMenuProps,
getInputProps: getInputProps,
getComboboxProps: getComboboxProps,
getToggleButtonProps: getToggleButtonProps,
// actions.
toggleMenu: toggleMenu,
openMenu: openMenu,
closeMenu: closeMenu,
setHighlightedIndex: setHighlightedIndex,
setInputValue: setInputValue,
selectItem: selectItem,
reset: reset,
// state.
highlightedIndex: highlightedIndex,
isOpen: isOpen,
selectedItem: selectedItem,
inputValue: inputValue
};
}
var defaultStateValues = {
activeIndex: -1,
selectedItems: []
};
/**
* Returns the initial value for a state key in the following order:
* 1. controlled prop, 2. initial prop, 3. default prop, 4. default
* value from Downshift.
*
* @param {Object} props Props passed to the hook.
* @param {string} propKey Props key to generate the value for.
* @returns {any} The initial value for that prop.
*/
function getInitialValue(props, propKey) {
return getInitialValue$1(props, propKey, defaultStateValues);
}
/**
* Returns the default value for a state key in the following order:
* 1. controlled prop, 2. default prop, 3. default value from Downshift.
*
* @param {Object} props Props passed to the hook.
* @param {string} propKey Props key to generate the value for.
* @returns {any} The initial value for that prop.
*/
function getDefaultValue(props, propKey) {
return getDefaultValue$1(props, propKey, defaultStateValues);
}
/**
* Gets the initial state based on the provided props. It uses initial, default
* and controlled props related to state in order to compute the initial value.
*
* @param {Object} props Props passed to the hook.
* @returns {Object} The initial state.
*/
function downshift_esm_getInitialState(props) {
var activeIndex = getInitialValue(props, 'activeIndex');
var selectedItems = getInitialValue(props, 'selectedItems');
return {
activeIndex: activeIndex,
selectedItems: selectedItems
};
}
/**
* Returns true if dropdown keydown operation is permitted. Should not be
* allowed on keydown with modifier keys (ctrl, alt, shift, meta), on
* input element with text content that is either highlighted or selection
* cursor is not at the starting position.
*
* @param {KeyboardEvent} event The event from keydown.
* @returns {boolean} Whether the operation is allowed.
*/
function isKeyDownOperationPermitted(event) {
if (event.shiftKey || event.metaKey || event.ctrlKey || event.altKey) {
return false;
}
var element = event.target;
if (element instanceof HTMLInputElement && // if element is a text input
element.value !== '' && ( // and we have text in it
// and cursor is either not at the start or is currently highlighting text.
element.selectionStart !== 0 || element.selectionEnd !== 0)) {
return false;
}
return true;
}
/**
* Returns a message to be added to aria-live region when item is removed.
*
* @param {Object} selectionParameters Parameters required to build the message.
* @returns {string} The a11y message.
*/
function downshift_esm_getA11yRemovalMessage(selectionParameters) {
var removedSelectedItem = selectionParameters.removedSelectedItem,
itemToStringLocal = selectionParameters.itemToString;
return itemToStringLocal(removedSelectedItem) + " has been removed.";
}
var propTypes = {
selectedItems: prop_types_default.a.array,
initialSelectedItems: prop_types_default.a.array,
defaultSelectedItems: prop_types_default.a.array,
itemToString: prop_types_default.a.func,
getA11yRemovalMessage: prop_types_default.a.func,
stateReducer: prop_types_default.a.func,
activeIndex: prop_types_default.a.number,
initialActiveIndex: prop_types_default.a.number,
defaultActiveIndex: prop_types_default.a.number,
onActiveIndexChange: prop_types_default.a.func,
onSelectedItemsChange: prop_types_default.a.func,
keyNavigationNext: prop_types_default.a.string,
keyNavigationPrevious: prop_types_default.a.string,
environment: prop_types_default.a.shape({
addEventListener: prop_types_default.a.func,
removeEventListener: prop_types_default.a.func,
document: prop_types_default.a.shape({
getElementById: prop_types_default.a.func,
activeElement: prop_types_default.a.any,
body: prop_types_default.a.any
})
})
};
var downshift_esm_defaultProps = {
itemToString: defaultProps$3.itemToString,
stateReducer: defaultProps$3.stateReducer,
environment: defaultProps$3.environment,
getA11yRemovalMessage: downshift_esm_getA11yRemovalMessage,
keyNavigationNext: 'ArrowRight',
keyNavigationPrevious: 'ArrowLeft'
}; // eslint-disable-next-line import/no-mutable-exports
var validatePropTypes = downshift_esm_noop;
/* istanbul ignore next */
if (false) {}
var SelectedItemClick = false ? undefined : 0;
var SelectedItemKeyDownDelete = false ? undefined : 1;
var SelectedItemKeyDownBackspace = false ? undefined : 2;
var SelectedItemKeyDownNavigationNext = false ? undefined : 3;
var SelectedItemKeyDownNavigationPrevious = false ? undefined : 4;
var DropdownKeyDownNavigationPrevious = false ? undefined : 5;
var DropdownKeyDownBackspace = false ? undefined : 6;
var DropdownClick = false ? undefined : 7;
var FunctionAddSelectedItem = false ? undefined : 8;
var FunctionRemoveSelectedItem = false ? undefined : 9;
var FunctionSetSelectedItems = false ? undefined : 10;
var FunctionSetActiveIndex = false ? undefined : 11;
var FunctionReset = false ? undefined : 12;
var downshift_esm_stateChangeTypes = /*#__PURE__*/Object.freeze({
__proto__: null,
SelectedItemClick: SelectedItemClick,
SelectedItemKeyDownDelete: SelectedItemKeyDownDelete,
SelectedItemKeyDownBackspace: SelectedItemKeyDownBackspace,
SelectedItemKeyDownNavigationNext: SelectedItemKeyDownNavigationNext,
SelectedItemKeyDownNavigationPrevious: SelectedItemKeyDownNavigationPrevious,
DropdownKeyDownNavigationPrevious: DropdownKeyDownNavigationPrevious,
DropdownKeyDownBackspace: DropdownKeyDownBackspace,
DropdownClick: DropdownClick,
FunctionAddSelectedItem: FunctionAddSelectedItem,
FunctionRemoveSelectedItem: FunctionRemoveSelectedItem,
FunctionSetSelectedItems: FunctionSetSelectedItems,
FunctionSetActiveIndex: FunctionSetActiveIndex,
FunctionReset: FunctionReset
});
/* eslint-disable complexity */
function downshiftMultipleSelectionReducer(state, action) {
var type = action.type,
index = action.index,
props = action.props,
selectedItem = action.selectedItem;
var activeIndex = state.activeIndex,
selectedItems = state.selectedItems;
var changes;
switch (type) {
case SelectedItemClick:
changes = {
activeIndex: index
};
break;
case SelectedItemKeyDownNavigationPrevious:
changes = {
activeIndex: activeIndex - 1 < 0 ? 0 : activeIndex - 1
};
break;
case SelectedItemKeyDownNavigationNext:
changes = {
activeIndex: activeIndex + 1 >= selectedItems.length ? -1 : activeIndex + 1
};
break;
case SelectedItemKeyDownBackspace:
case SelectedItemKeyDownDelete:
{
var newActiveIndex = activeIndex;
if (selectedItems.length === 1) {
newActiveIndex = -1;
} else if (activeIndex === selectedItems.length - 1) {
newActiveIndex = selectedItems.length - 2;
}
changes = Object(esm_extends["a" /* default */])({
selectedItems: [].concat(selectedItems.slice(0, activeIndex), selectedItems.slice(activeIndex + 1))
}, {
activeIndex: newActiveIndex
});
break;
}
case DropdownKeyDownNavigationPrevious:
changes = {
activeIndex: selectedItems.length - 1
};
break;
case DropdownKeyDownBackspace:
changes = {
selectedItems: selectedItems.slice(0, selectedItems.length - 1)
};
break;
case FunctionAddSelectedItem:
changes = {
selectedItems: [].concat(selectedItems, [selectedItem])
};
break;
case DropdownClick:
changes = {
activeIndex: -1
};
break;
case FunctionRemoveSelectedItem:
{
var _newActiveIndex = activeIndex;
var selectedItemIndex = selectedItems.indexOf(selectedItem);
if (selectedItems.length === 1) {
_newActiveIndex = -1;
} else if (selectedItemIndex === selectedItems.length - 1) {
_newActiveIndex = selectedItems.length - 2;
}
changes = Object(esm_extends["a" /* default */])({
selectedItems: [].concat(selectedItems.slice(0, selectedItemIndex), selectedItems.slice(selectedItemIndex + 1))
}, {
activeIndex: _newActiveIndex
});
break;
}
case FunctionSetSelectedItems:
{
var newSelectedItems = action.selectedItems;
changes = {
selectedItems: newSelectedItems
};
break;
}
case FunctionSetActiveIndex:
{
var _newActiveIndex2 = action.activeIndex;
changes = {
activeIndex: _newActiveIndex2
};
break;
}
case FunctionReset:
changes = {
activeIndex: getDefaultValue(props, 'activeIndex'),
selectedItems: getDefaultValue(props, 'selectedItems')
};
break;
default:
throw new Error('Reducer called without proper action type.');
}
return Object(esm_extends["a" /* default */])({}, state, changes);
}
useMultipleSelection.stateChangeTypes = downshift_esm_stateChangeTypes;
function useMultipleSelection(userProps) {
if (userProps === void 0) {
userProps = {};
}
validatePropTypes(userProps, useMultipleSelection); // Props defaults and destructuring.
var props = Object(esm_extends["a" /* default */])({}, downshift_esm_defaultProps, userProps);
var getA11yRemovalMessage = props.getA11yRemovalMessage,
itemToString = props.itemToString,
environment = props.environment,
keyNavigationNext = props.keyNavigationNext,
keyNavigationPrevious = props.keyNavigationPrevious; // Reducer init.
var _useControlledReducer = useControlledReducer$1(downshiftMultipleSelectionReducer, downshift_esm_getInitialState(props), props),
state = _useControlledReducer[0],
dispatch = _useControlledReducer[1];
var activeIndex = state.activeIndex,
selectedItems = state.selectedItems; // Refs.
var isInitialMountRef = Object(external_React_["useRef"])(true);
var dropdownRef = Object(external_React_["useRef"])(null);
var previousSelectedItemsRef = Object(external_React_["useRef"])(selectedItems);
var selectedItemRefs = Object(external_React_["useRef"])();
selectedItemRefs.current = [];
var latest = useLatestRef({
state: state,
props: props
}); // Effects.
/* Sets a11y status message on changes in selectedItem. */
Object(external_React_["useEffect"])(function () {
if (isInitialMountRef.current) {
return;
}
if (selectedItems.length < previousSelectedItemsRef.current.length) {
var removedSelectedItem = previousSelectedItemsRef.current.find(function (item) {
return selectedItems.indexOf(item) < 0;
});
setStatus(getA11yRemovalMessage({
itemToString: itemToString,
resultCount: selectedItems.length,
removedSelectedItem: removedSelectedItem,
activeIndex: activeIndex,
activeSelectedItem: selectedItems[activeIndex]
}), environment.document);
}
previousSelectedItemsRef.current = selectedItems; // eslint-disable-next-line react-hooks/exhaustive-deps
}, [selectedItems.length]); // Sets focus on active item.
Object(external_React_["useEffect"])(function () {
if (isInitialMountRef.current) {
return;
}
if (activeIndex === -1 && dropdownRef.current) {
dropdownRef.current.focus();
} else if (selectedItemRefs.current[activeIndex]) {
selectedItemRefs.current[activeIndex].focus();
}
}, [activeIndex]);
useControlPropsValidator({
isInitialMount: isInitialMountRef.current,
props: props,
state: state
});
var setGetterPropCallInfo = useGetterPropsCalledChecker('getDropdownProps'); // Make initial ref false.
Object(external_React_["useEffect"])(function () {
isInitialMountRef.current = false;
}, []); // Event handler functions.
var selectedItemKeyDownHandlers = Object(external_React_["useMemo"])(function () {
var _ref;
return _ref = {}, _ref[keyNavigationPrevious] = function () {
dispatch({
type: SelectedItemKeyDownNavigationPrevious
});
}, _ref[keyNavigationNext] = function () {
dispatch({
type: SelectedItemKeyDownNavigationNext
});
}, _ref.Delete = function Delete() {
dispatch({
type: SelectedItemKeyDownDelete
});
}, _ref.Backspace = function Backspace() {
dispatch({
type: SelectedItemKeyDownBackspace
});
}, _ref;
}, [dispatch, keyNavigationNext, keyNavigationPrevious]);
var dropdownKeyDownHandlers = Object(external_React_["useMemo"])(function () {
var _ref2;
return _ref2 = {}, _ref2[keyNavigationPrevious] = function (event) {
if (isKeyDownOperationPermitted(event)) {
dispatch({
type: DropdownKeyDownNavigationPrevious
});
}
}, _ref2.Backspace = function Backspace(event) {
if (isKeyDownOperationPermitted(event)) {
dispatch({
type: DropdownKeyDownBackspace
});
}
}, _ref2;
}, [dispatch, keyNavigationPrevious]); // Getter props.
var getSelectedItemProps = Object(external_React_["useCallback"])(function (_temp) {
var _extends2;
var _ref3 = _temp === void 0 ? {} : _temp,
_ref3$refKey = _ref3.refKey,
refKey = _ref3$refKey === void 0 ? 'ref' : _ref3$refKey,
ref = _ref3.ref,
onClick = _ref3.onClick,
onKeyDown = _ref3.onKeyDown,
selectedItem = _ref3.selectedItem,
index = _ref3.index,
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref3, ["refKey", "ref", "onClick", "onKeyDown", "selectedItem", "index"]);
var latestState = latest.current.state;
var itemIndex = getItemIndex(index, selectedItem, latestState.selectedItems);
if (itemIndex < 0) {
throw new Error('Pass either selectedItem or index in getSelectedItemProps!');
}
var selectedItemHandleClick = function selectedItemHandleClick() {
dispatch({
type: SelectedItemClick,
index: index
});
};
var selectedItemHandleKeyDown = function selectedItemHandleKeyDown(event) {
var key = normalizeArrowKey(event);
if (key && selectedItemKeyDownHandlers[key]) {
selectedItemKeyDownHandlers[key](event);
}
};
return Object(esm_extends["a" /* default */])((_extends2 = {}, _extends2[refKey] = handleRefs(ref, function (selectedItemNode) {
if (selectedItemNode) {
selectedItemRefs.current.push(selectedItemNode);
}
}), _extends2.tabIndex = index === latestState.activeIndex ? 0 : -1, _extends2.onClick = callAllEventHandlers(onClick, selectedItemHandleClick), _extends2.onKeyDown = callAllEventHandlers(onKeyDown, selectedItemHandleKeyDown), _extends2), rest);
}, [dispatch, latest, selectedItemKeyDownHandlers]);
var getDropdownProps = Object(external_React_["useCallback"])(function (_temp2, _temp3) {
var _extends3;
var _ref4 = _temp2 === void 0 ? {} : _temp2,
_ref4$refKey = _ref4.refKey,
refKey = _ref4$refKey === void 0 ? 'ref' : _ref4$refKey,
ref = _ref4.ref,
onKeyDown = _ref4.onKeyDown,
onClick = _ref4.onClick,
_ref4$preventKeyActio = _ref4.preventKeyAction,
preventKeyAction = _ref4$preventKeyActio === void 0 ? false : _ref4$preventKeyActio,
rest = objectWithoutPropertiesLoose_objectWithoutPropertiesLoose(_ref4, ["refKey", "ref", "onKeyDown", "onClick", "preventKeyAction"]);
var _ref5 = _temp3 === void 0 ? {} : _temp3,
_ref5$suppressRefErro = _ref5.suppressRefError,
suppressRefError = _ref5$suppressRefErro === void 0 ? false : _ref5$suppressRefErro;
setGetterPropCallInfo('getDropdownProps', suppressRefError, refKey, dropdownRef);
var dropdownHandleKeyDown = function dropdownHandleKeyDown(event) {
var key = normalizeArrowKey(event);
if (key && dropdownKeyDownHandlers[key]) {
dropdownKeyDownHandlers[key](event);
}
};
var dropdownHandleClick = function dropdownHandleClick() {
dispatch({
type: DropdownClick
});
};
return Object(esm_extends["a" /* default */])((_extends3 = {}, _extends3[refKey] = handleRefs(ref, function (dropdownNode) {
if (dropdownNode) {
dropdownRef.current = dropdownNode;
}
}), _extends3), !preventKeyAction && {
onKeyDown: callAllEventHandlers(onKeyDown, dropdownHandleKeyDown),
onClick: callAllEventHandlers(onClick, dropdownHandleClick)
}, rest);
}, [dispatch, dropdownKeyDownHandlers, setGetterPropCallInfo]); // returns
var addSelectedItem = Object(external_React_["useCallback"])(function (selectedItem) {
dispatch({
type: FunctionAddSelectedItem,
selectedItem: selectedItem
});
}, [dispatch]);
var removeSelectedItem = Object(external_React_["useCallback"])(function (selectedItem) {
dispatch({
type: FunctionRemoveSelectedItem,
selectedItem: selectedItem
});
}, [dispatch]);
var setSelectedItems = Object(external_React_["useCallback"])(function (newSelectedItems) {
dispatch({
type: FunctionSetSelectedItems,
selectedItems: newSelectedItems
});
}, [dispatch]);
var setActiveIndex = Object(external_React_["useCallback"])(function (newActiveIndex) {
dispatch({
type: FunctionSetActiveIndex,
activeIndex: newActiveIndex
});
}, [dispatch]);
var reset = Object(external_React_["useCallback"])(function () {
dispatch({
type: FunctionReset
});
}, [dispatch]);
return {
getSelectedItemProps: getSelectedItemProps,
getDropdownProps: getDropdownProps,
addSelectedItem: addSelectedItem,
removeSelectedItem: removeSelectedItem,
setSelectedItems: setSelectedItems,
setActiveIndex: setActiveIndex,
reset: reset,
selectedItems: selectedItems,
activeIndex: activeIndex
};
}
/* harmony default export */ var downshift_esm = (downshift_esm_Downshift);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-select-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const custom_select_control_itemToString = item => item && item.name; // This is needed so that in Windows, where
// the menu does not necessarily open on
// key up/down, you can still switch between
// options with the menu closed.
const custom_select_control_stateReducer = ({
selectedItem
}, {
type,
changes,
props: {
items
}
}) => {
switch (type) {
case useSelect.stateChangeTypes.ToggleButtonKeyDownArrowDown:
// If we already have a selected item, try to select the next one,
// without circular navigation. Otherwise, select the first item.
return {
selectedItem: items[selectedItem ? Math.min(items.indexOf(selectedItem) + 1, items.length - 1) : 0]
};
case useSelect.stateChangeTypes.ToggleButtonKeyDownArrowUp:
// If we already have a selected item, try to select the previous one,
// without circular navigation. Otherwise, select the last item.
return {
selectedItem: items[selectedItem ? Math.max(items.indexOf(selectedItem) - 1, 0) : items.length - 1]
};
default:
return changes;
}
};
function CustomSelectControl({
className,
hideLabelFromVision,
label,
options: items,
onChange: onSelectedItemChange,
value: _selectedItem
}) {
const {
getLabelProps,
getToggleButtonProps,
getMenuProps,
getItemProps,
isOpen,
highlightedIndex,
selectedItem
} = useSelect({
initialSelectedItem: items[0],
items,
itemToString: custom_select_control_itemToString,
onSelectedItemChange,
selectedItem: _selectedItem,
stateReducer: custom_select_control_stateReducer
});
const menuProps = getMenuProps({
className: 'components-custom-select-control__menu',
'aria-hidden': !isOpen
}); // We need this here, because the null active descendant is not
// fully ARIA compliant.
if (menuProps['aria-activedescendant'] && menuProps['aria-activedescendant'].slice(0, 'downshift-null'.length) === 'downshift-null') {
delete menuProps['aria-activedescendant'];
}
return Object(external_wp_element_["createElement"])("div", {
className: classnames_default()('components-custom-select-control', className)
}, hideLabelFromVision ? Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], Object(esm_extends["a" /* default */])({
as: "label"
}, getLabelProps()), label) :
/* eslint-disable-next-line jsx-a11y/label-has-associated-control, jsx-a11y/label-has-for */
Object(external_wp_element_["createElement"])("label", getLabelProps({
className: 'components-custom-select-control__label'
}), label), Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], getToggleButtonProps({
// This is needed because some speech recognition software don't support `aria-labelledby`.
'aria-label': label,
'aria-labelledby': undefined,
className: 'components-custom-select-control__button',
isSmall: true
}), custom_select_control_itemToString(selectedItem), Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], {
icon: chevron_down["a" /* default */],
className: "components-custom-select-control__button-icon"
})), Object(external_wp_element_["createElement"])("ul", menuProps, isOpen && items.map((item, index) => // eslint-disable-next-line react/jsx-key
Object(external_wp_element_["createElement"])("li", getItemProps({
item,
index,
key: item.key,
className: classnames_default()(item.className, 'components-custom-select-control__item', {
'is-highlighted': index === highlightedIndex
}),
style: item.style
}), item.name, item === selectedItem && Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], {
icon: check["a" /* default */],
className: "components-custom-select-control__item-icon"
})))));
}
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/dashicon/index.js
var dashicon = __webpack_require__("vUUf");
// EXTERNAL MODULE: ./node_modules/react-dates/initialize.js
var initialize = __webpack_require__("GG7f");
// EXTERNAL MODULE: external "moment"
var external_moment_ = __webpack_require__("wy2R");
var external_moment_default = /*#__PURE__*/__webpack_require__.n(external_moment_);
// EXTERNAL MODULE: ./node_modules/react-dates/lib/components/DayPickerSingleDateController.js
var DayPickerSingleDateController = __webpack_require__("Xtko");
var DayPickerSingleDateController_default = /*#__PURE__*/__webpack_require__.n(DayPickerSingleDateController);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/date.js
/**
* External dependencies
*/
// react-dates doesn't tree-shake correctly, so we import from the individual
// component here, to avoid including too much of the library
/**
* WordPress dependencies
*/
/**
* Module Constants
*/
const TIMEZONELESS_FORMAT = 'YYYY-MM-DDTHH:mm:ss';
const ARIAL_LABEL_TIME_FORMAT = 'dddd, LL';
function DatePickerDay({
day,
events = []
}) {
const ref = Object(external_wp_element_["useRef"])();
/*
* a11y hack to make the `There is/are n events` string
* available speaking for readers,
* re-defining the aria-label attribute.
* This attribute is handled by the react-dates component.
*/
Object(external_wp_element_["useEffect"])(() => {
var _ref$current;
// Bail when no parent node.
if (!(ref !== null && ref !== void 0 && (_ref$current = ref.current) !== null && _ref$current !== void 0 && _ref$current.parentNode)) {
return;
}
const {
parentNode
} = ref.current;
const dayAriaLabel = external_moment_default()(day).format(ARIAL_LABEL_TIME_FORMAT);
if (!events.length) {
// Set aria-label without event description.
parentNode.setAttribute('aria-label', dayAriaLabel);
return;
}
const dayWithEventsDescription = Object(external_wp_i18n_["sprintf"])( // translators: 1: Calendar day format, 2: Calendar event number.
Object(external_wp_i18n_["_n"])('%1$s. There is %2$d event.', '%1$s. There are %2$d events.', events.length), dayAriaLabel, events.length);
parentNode.setAttribute('aria-label', dayWithEventsDescription);
}, [events.length]);
return Object(external_wp_element_["createElement"])("div", {
ref: ref,
className: classnames_default()('components-datetime__date__day', {
'has-events': events === null || events === void 0 ? void 0 : events.length
})
}, day.format('D'));
}
class date_DatePicker extends external_wp_element_["Component"] {
constructor() {
super(...arguments);
this.onChangeMoment = this.onChangeMoment.bind(this);
this.nodeRef = Object(external_wp_element_["createRef"])();
this.onMonthPreviewedHandler = this.onMonthPreviewedHandler.bind(this);
}
onMonthPreviewedHandler(newMonthDate) {
var _this$props;
(_this$props = this.props) === null || _this$props === void 0 ? void 0 : _this$props.onMonthPreviewed(newMonthDate.toISOString());
this.keepFocusInside();
}
/*
* Todo: We should remove this function ASAP.
* It is kept because focus is lost when we click on the previous and next month buttons.
* This focus loss closes the date picker popover.
* Ideally we should add an upstream commit on react-dates to fix this issue.
*/
keepFocusInside() {
if (!this.nodeRef.current) {
return;
}
const {
ownerDocument
} = this.nodeRef.current;
const {
activeElement
} = ownerDocument; // If focus was lost.
if (!activeElement || !this.nodeRef.current.contains(ownerDocument.activeElement)) {
// Retrieve the focus region div.
const focusRegion = this.nodeRef.current.querySelector('.DayPicker_focusRegion');
if (!focusRegion) {
return;
} // Keep the focus on focus region.
focusRegion.focus();
}
}
onChangeMoment(newDate) {
const {
currentDate,
onChange
} = this.props; // If currentDate is null, use now as momentTime to designate hours, minutes, seconds.
const momentDate = currentDate ? external_moment_default()(currentDate) : external_moment_default()();
const momentTime = {
hours: momentDate.hours(),
minutes: momentDate.minutes(),
seconds: 0
};
onChange(newDate.set(momentTime).format(TIMEZONELESS_FORMAT)); // Keep focus on the date picker.
this.keepFocusInside();
}
/**
* Create a Moment object from a date string. With no currentDate supplied, default to a Moment
* object representing now. If a null value is passed, return a null value.
*
* @param {?string} currentDate Date representing the currently selected date or null to signify no selection.
* @return {?moment.Moment} Moment object for selected date or null.
*/
getMomentDate(currentDate) {
if (null === currentDate) {
return null;
}
return currentDate ? external_moment_default()(currentDate) : external_moment_default()();
}
getEventsPerDay(day) {
var _this$props$events;
if (!((_this$props$events = this.props.events) !== null && _this$props$events !== void 0 && _this$props$events.length)) {
return [];
}
return this.props.events.filter(eventDay => day.isSame(eventDay.date, 'day'));
}
render() {
const {
currentDate,
isInvalidDate
} = this.props;
const momentDate = this.getMomentDate(currentDate);
return Object(external_wp_element_["createElement"])("div", {
className: "components-datetime__date",
ref: this.nodeRef
}, Object(external_wp_element_["createElement"])(DayPickerSingleDateController_default.a, {
date: momentDate,
daySize: 30,
focused: true,
hideKeyboardShortcutsPanel: true // This is a hack to force the calendar to update on month or year change
// https://github.com/airbnb/react-dates/issues/240#issuecomment-361776665
,
key: `datepicker-controller-${momentDate ? momentDate.format('MM-YYYY') : 'null'}`,
noBorder: true,
numberOfMonths: 1,
onDateChange: this.onChangeMoment,
transitionDuration: 0,
weekDayFormat: "ddd",
dayAriaLabelFormat: ARIAL_LABEL_TIME_FORMAT,
isRTL: Object(external_wp_i18n_["isRTL"])(),
isOutsideRange: date => {
return isInvalidDate && isInvalidDate(date.toDate());
},
onPrevMonthClick: this.onMonthPreviewedHandler,
onNextMonthClick: this.onMonthPreviewedHandler,
renderDayContents: day => Object(external_wp_element_["createElement"])(DatePickerDay, {
day: day,
events: this.getEventsPerDay(day)
})
}));
}
}
/* harmony default export */ var date_time_date = (date_DatePicker);
// EXTERNAL MODULE: external ["wp","date"]
var external_wp_date_ = __webpack_require__("FqII");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/timezone.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Displays timezone information when user timezone is different from site timezone.
*/
const TimeZone = () => {
const {
timezone
} = Object(external_wp_date_["__experimentalGetSettings"])(); // Convert timezone offset to hours.
const userTimezoneOffset = -1 * (new Date().getTimezoneOffset() / 60); // System timezone and user timezone match, nothing needed.
// Compare as numbers because it comes over as string.
if (Number(timezone.offset) === userTimezoneOffset) {
return null;
}
const offsetSymbol = timezone.offset >= 0 ? '+' : '';
const zoneAbbr = '' !== timezone.abbr && isNaN(timezone.abbr) ? timezone.abbr : `UTC${offsetSymbol}${timezone.offset}`;
const timezoneDetail = 'UTC' === timezone.string ? Object(external_wp_i18n_["__"])('Coordinated Universal Time') : `(${zoneAbbr}) ${timezone.string.replace('_', ' ')}`;
return Object(external_wp_element_["createElement"])(build_module_tooltip["a" /* default */], {
position: "top center",
text: timezoneDetail
}, Object(external_wp_element_["createElement"])("div", {
className: "components-datetime__timezone"
}, zoneAbbr));
};
/* harmony default export */ var date_time_timezone = (TimeZone);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/time.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Module Constants
*/
const time_TIMEZONELESS_FORMAT = 'YYYY-MM-DDTHH:mm:ss';
/**
* <UpdateOnBlurAsIntegerField>
* A shared component to parse, validate, and handle remounting of the underlying form field element like <input> and <select>.
*
* @param {Object} props Component props.
* @param {string} props.as Render the component as specific element tag, defaults to "input".
* @param {number|string} props.value The default value of the component which will be parsed to integer.
* @param {Function} props.onUpdate Call back when blurred and validated.
*/
function UpdateOnBlurAsIntegerField({
as,
value,
onUpdate,
...props
}) {
function handleBlur(event) {
const {
target
} = event;
if (value === target.value) {
return;
}
const parsedValue = parseInt(target.value, 10); // Run basic number validation on the input.
if (!Object(external_lodash_["isInteger"])(parsedValue) || typeof props.max !== 'undefined' && parsedValue > props.max || typeof props.min !== 'undefined' && parsedValue < props.min) {
// If validation failed, reset the value to the previous valid value.
target.value = value;
} else {
// Otherwise, it's valid, call onUpdate.
onUpdate(target.name, parsedValue);
}
}
return Object(external_wp_element_["createElement"])(as || 'input', {
// Re-mount the input value to accept the latest value as the defaultValue.
key: value,
defaultValue: value,
onBlur: handleBlur,
...props
});
}
/**
* <TimePicker>
*
* @typedef {Date|string|number} WPValidDateTimeFormat
*
* @param {Object} props Component props.
* @param {boolean} props.is12Hour Should the time picker showed in 12 hour format or 24 hour format.
* @param {WPValidDateTimeFormat} props.currentTime The initial current time the time picker should render.
* @param {Function} props.onChange Callback function when the date changed.
*/
function TimePicker({
is12Hour,
currentTime,
onChange
}) {
const [date, setDate] = Object(external_wp_element_["useState"])(() => // Truncate the date at the minutes, see: #15495.
external_moment_default()(currentTime).startOf('minutes')); // Reset the state when currentTime changed.
Object(external_wp_element_["useEffect"])(() => {
setDate(currentTime ? external_moment_default()(currentTime).startOf('minutes') : external_moment_default()());
}, [currentTime]);
const {
day,
month,
year,
minutes,
hours,
am
} = Object(external_wp_element_["useMemo"])(() => ({
day: date.format('DD'),
month: date.format('MM'),
year: date.format('YYYY'),
minutes: date.format('mm'),
hours: date.format(is12Hour ? 'hh' : 'HH'),
am: date.format('H') <= 11 ? 'AM' : 'PM'
}), [date, is12Hour]);
/**
* Function that sets the date state and calls the onChange with a new date.
* The date is truncated at the minutes.
*
* @param {Object} newDate The date object.
*/
function changeDate(newDate) {
setDate(newDate);
onChange(newDate.format(time_TIMEZONELESS_FORMAT));
}
function update(name, value) {
// Clone the date and call the specific setter function according to `name`.
const newDate = date.clone()[name](value);
changeDate(newDate);
}
function updateAmPm(value) {
return () => {
if (am === value) {
return;
}
const parsedHours = parseInt(hours, 10);
const newDate = date.clone().hours(value === 'PM' ? (parsedHours % 12 + 12) % 24 : parsedHours % 12);
changeDate(newDate);
};
}
const dayFormat = Object(external_wp_element_["createElement"])("div", {
className: "components-datetime__time-field components-datetime__time-field-day"
}, Object(external_wp_element_["createElement"])(UpdateOnBlurAsIntegerField, {
"aria-label": Object(external_wp_i18n_["__"])('Day'),
className: "components-datetime__time-field-day-input",
type: "number" // The correct function to call in moment.js is "date" not "day".
,
name: "date",
value: day,
step: 1,
min: 1,
max: 31,
onUpdate: update
}));
const monthFormat = Object(external_wp_element_["createElement"])("div", {
className: "components-datetime__time-field components-datetime__time-field-month"
}, Object(external_wp_element_["createElement"])(UpdateOnBlurAsIntegerField, {
as: "select",
"aria-label": Object(external_wp_i18n_["__"])('Month'),
className: "components-datetime__time-field-month-select",
name: "month",
value: month // The value starts from 0, so we have to -1 when setting month.
,
onUpdate: (key, value) => update(key, value - 1)
}, Object(external_wp_element_["createElement"])("option", {
value: "01"
}, Object(external_wp_i18n_["__"])('January')), Object(external_wp_element_["createElement"])("option", {
value: "02"
}, Object(external_wp_i18n_["__"])('February')), Object(external_wp_element_["createElement"])("option", {
value: "03"
}, Object(external_wp_i18n_["__"])('March')), Object(external_wp_element_["createElement"])("option", {
value: "04"
}, Object(external_wp_i18n_["__"])('April')), Object(external_wp_element_["createElement"])("option", {
value: "05"
}, Object(external_wp_i18n_["__"])('May')), Object(external_wp_element_["createElement"])("option", {
value: "06"
}, Object(external_wp_i18n_["__"])('June')), Object(external_wp_element_["createElement"])("option", {
value: "07"
}, Object(external_wp_i18n_["__"])('July')), Object(external_wp_element_["createElement"])("option", {
value: "08"
}, Object(external_wp_i18n_["__"])('August')), Object(external_wp_element_["createElement"])("option", {
value: "09"
}, Object(external_wp_i18n_["__"])('September')), Object(external_wp_element_["createElement"])("option", {
value: "10"
}, Object(external_wp_i18n_["__"])('October')), Object(external_wp_element_["createElement"])("option", {
value: "11"
}, Object(external_wp_i18n_["__"])('November')), Object(external_wp_element_["createElement"])("option", {
value: "12"
}, Object(external_wp_i18n_["__"])('December'))));
const dayMonthFormat = is12Hour ? Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, dayFormat, monthFormat) : Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, monthFormat, dayFormat);
return Object(external_wp_element_["createElement"])("div", {
className: classnames_default()('components-datetime__time')
}, Object(external_wp_element_["createElement"])("fieldset", null, Object(external_wp_element_["createElement"])("legend", {
className: "components-datetime__time-legend invisible"
}, Object(external_wp_i18n_["__"])('Date')), Object(external_wp_element_["createElement"])("div", {
className: "components-datetime__time-wrapper"
}, dayMonthFormat, Object(external_wp_element_["createElement"])("div", {
className: "components-datetime__time-field components-datetime__time-field-year"
}, Object(external_wp_element_["createElement"])(UpdateOnBlurAsIntegerField, {
"aria-label": Object(external_wp_i18n_["__"])('Year'),
className: "components-datetime__time-field-year-input",
type: "number",
name: "year",
step: 1,
min: 0,
max: 9999,
value: year,
onUpdate: update
})))), Object(external_wp_element_["createElement"])("fieldset", null, Object(external_wp_element_["createElement"])("legend", {
className: "components-datetime__time-legend invisible"
}, Object(external_wp_i18n_["__"])('Time')), Object(external_wp_element_["createElement"])("div", {
className: "components-datetime__time-wrapper"
}, Object(external_wp_element_["createElement"])("div", {
className: "components-datetime__time-field components-datetime__time-field-time"
}, Object(external_wp_element_["createElement"])(UpdateOnBlurAsIntegerField, {
"aria-label": Object(external_wp_i18n_["__"])('Hours'),
className: "components-datetime__time-field-hours-input",
type: "number",
name: "hours",
step: 1,
min: is12Hour ? 1 : 0,
max: is12Hour ? 12 : 23,
value: hours,
onUpdate: update
}), Object(external_wp_element_["createElement"])("span", {
className: "components-datetime__time-separator",
"aria-hidden": "true"
}, ":"), Object(external_wp_element_["createElement"])(UpdateOnBlurAsIntegerField, {
"aria-label": Object(external_wp_i18n_["__"])('Minutes'),
className: "components-datetime__time-field-minutes-input",
type: "number",
name: "minutes",
step: 1,
min: 0,
max: 59,
value: minutes,
onUpdate: update
})), is12Hour && Object(external_wp_element_["createElement"])(button_group, {
className: "components-datetime__time-field components-datetime__time-field-am-pm"
}, Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
isPrimary: am === 'AM',
isSecondary: am !== 'AM',
onClick: updateAmPm('AM'),
className: "components-datetime__time-am-button"
}, Object(external_wp_i18n_["__"])('AM')), Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
isPrimary: am === 'PM',
isSecondary: am !== 'PM',
onClick: updateAmPm('PM'),
className: "components-datetime__time-pm-button"
}, Object(external_wp_i18n_["__"])('PM'))), Object(external_wp_element_["createElement"])(date_time_timezone, null))));
}
/* harmony default export */ var time = (TimePicker);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/date-time/index.js
/**
* External dependencies
*/
// Needed to initialise the default datepicker styles.
// See: https://github.com/airbnb/react-dates#initialize
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function DateTimePicker({
currentDate,
is12Hour,
isInvalidDate,
onMonthPreviewed = external_lodash_["noop"],
onChange,
events
}, ref) {
const [calendarHelpIsVisible, setCalendarHelpIsVisible] = Object(external_wp_element_["useState"])(false);
function onClickDescriptionToggle() {
setCalendarHelpIsVisible(!calendarHelpIsVisible);
}
return Object(external_wp_element_["createElement"])("div", {
ref: ref,
className: "components-datetime"
}, !calendarHelpIsVisible && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(time, {
currentTime: currentDate,
onChange: onChange,
is12Hour: is12Hour
}), Object(external_wp_element_["createElement"])(date_time_date, {
currentDate: currentDate,
onChange: onChange,
isInvalidDate: isInvalidDate,
events: events,
onMonthPreviewed: onMonthPreviewed
})), calendarHelpIsVisible && Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])("div", {
className: "components-datetime__calendar-help"
}, Object(external_wp_element_["createElement"])("h4", null, Object(external_wp_i18n_["__"])('Click to Select')), Object(external_wp_element_["createElement"])("ul", null, Object(external_wp_element_["createElement"])("li", null, Object(external_wp_i18n_["__"])('Click the right or left arrows to select other months in the past or the future.')), Object(external_wp_element_["createElement"])("li", null, Object(external_wp_i18n_["__"])('Click the desired day to select it.'))), Object(external_wp_element_["createElement"])("h4", null, Object(external_wp_i18n_["__"])('Navigating with a keyboard')), Object(external_wp_element_["createElement"])("ul", null, Object(external_wp_element_["createElement"])("li", null, Object(external_wp_element_["createElement"])("abbr", {
"aria-label": Object(external_wp_i18n_["_x"])('Enter', 'keyboard button')
}, "\u21B5"), ' '
/* JSX removes whitespace, but a space is required for screen readers. */
, Object(external_wp_element_["createElement"])("span", null, Object(external_wp_i18n_["__"])('Select the date in focus.'))), Object(external_wp_element_["createElement"])("li", null, Object(external_wp_element_["createElement"])("abbr", {
"aria-label": Object(external_wp_i18n_["__"])('Left and Right Arrows')
}, "\u2190/\u2192"), ' '
/* JSX removes whitespace, but a space is required for screen readers. */
, Object(external_wp_i18n_["__"])('Move backward (left) or forward (right) by one day.')), Object(external_wp_element_["createElement"])("li", null, Object(external_wp_element_["createElement"])("abbr", {
"aria-label": Object(external_wp_i18n_["__"])('Up and Down Arrows')
}, "\u2191/\u2193"), ' '
/* JSX removes whitespace, but a space is required for screen readers. */
, Object(external_wp_i18n_["__"])('Move backward (up) or forward (down) by one week.')), Object(external_wp_element_["createElement"])("li", null, Object(external_wp_element_["createElement"])("abbr", {
"aria-label": Object(external_wp_i18n_["__"])('Page Up and Page Down')
}, Object(external_wp_i18n_["__"])('PgUp/PgDn')), ' '
/* JSX removes whitespace, but a space is required for screen readers. */
, Object(external_wp_i18n_["__"])('Move backward (PgUp) or forward (PgDn) by one month.')), Object(external_wp_element_["createElement"])("li", null, Object(external_wp_element_["createElement"])("abbr", {
"aria-label": Object(external_wp_i18n_["__"])('Home and End')
}, Object(external_wp_i18n_["__"])('Home/End')), ' '
/* JSX removes whitespace, but a space is required for screen readers. */
, Object(external_wp_i18n_["__"])('Go to the first (home) or last (end) day of a week.'))))), Object(external_wp_element_["createElement"])("div", {
className: "components-datetime__buttons"
}, !calendarHelpIsVisible && currentDate && Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
className: "components-datetime__date-reset-button",
isLink: true,
onClick: () => onChange(null)
}, Object(external_wp_i18n_["__"])('Reset')), Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
className: "components-datetime__date-help-toggle",
isLink: true,
onClick: onClickDescriptionToggle
}, calendarHelpIsVisible ? Object(external_wp_i18n_["__"])('Close') : Object(external_wp_i18n_["__"])('Calendar Help'))));
}
/* harmony default export */ var date_time = (Object(external_wp_element_["forwardRef"])(DateTimePicker));
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/icon/index.js
var components_build_module_icon = __webpack_require__("9VDH");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/select-control/styles/select-control-styles.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const select_control_styles_disabledStyles = ({
disabled
}) => {
if (!disabled) return '';
return /*#__PURE__*/css_browser_esm({
color: COLORS.ui.textDisabled
}, true ? "" : undefined);
};
const select_control_styles_fontSizeStyles = ({
size
}) => {
const sizes = {
default: '13px',
small: '11px'
};
const fontSize = sizes[size];
const fontSizeMobile = '16px';
if (!fontSize) return '';
return /*#__PURE__*/css_browser_esm("font-size:", fontSizeMobile, ";@media ( min-width:600px ){font-size:", fontSize, ";}" + ( true ? "" : undefined));
};
const select_control_styles_sizeStyles = ({
size
}) => {
const sizes = {
default: {
height: 30,
lineHeight: 1,
minHeight: 30
},
small: {
height: 24,
lineHeight: 1,
minHeight: 24
}
};
const style = sizes[size] || sizes.default;
return /*#__PURE__*/css_browser_esm(style, true ? "" : undefined);
}; // TODO: Resolve need to use &&& to increase specificity
// https://github.com/WordPress/gutenberg/issues/18483
const Select = styled_base_browser_esm("select", {
target: "e12x0a390",
label: "Select"
})("&&&{appearance:none;background:transparent;box-sizing:border-box;border:none;box-shadow:none !important;color:", COLORS.black, ";display:block;margin:0;width:100%;", select_control_styles_disabledStyles, ";", select_control_styles_fontSizeStyles, ";", select_control_styles_sizeStyles, ";", rtl_rtl({
paddingLeft: 8,
paddingRight: 24
})(), "}" + ( true ? "" : undefined));
const DownArrowWrapper = styled_base_browser_esm("div", {
target: "e12x0a391",
label: "DownArrowWrapper"
})("align-items:center;bottom:0;box-sizing:border-box;display:flex;padding:0 4px;pointer-events:none;position:absolute;top:0;", rtl_rtl({
right: 0
})(), " svg{display:block;}" + ( true ? "" : undefined));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/select-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function select_control_useUniqueId(idProp) {
const instanceId = Object(external_wp_compose_["useInstanceId"])(SelectControl);
const id = `inspector-select-control-${instanceId}`;
return idProp || id;
}
function SelectControl({
className,
disabled = false,
help,
hideLabelFromVision,
id: idProp,
label,
multiple = false,
onBlur = external_lodash_["noop"],
onChange = external_lodash_["noop"],
onFocus = external_lodash_["noop"],
options = [],
size = 'default',
value: valueProp,
labelPosition = 'top',
...props
}, ref) {
const [isFocused, setIsFocused] = Object(external_wp_element_["useState"])(false);
const id = select_control_useUniqueId(idProp);
const helpId = help ? `${id}__help` : undefined; // Disable reason: A select with an onchange throws a warning
if (Object(external_lodash_["isEmpty"])(options)) return null;
const handleOnBlur = event => {
onBlur(event);
setIsFocused(false);
};
const handleOnFocus = event => {
onFocus(event);
setIsFocused(true);
};
const handleOnChange = event => {
if (multiple) {
const selectedOptions = [...event.target.options].filter(({
selected
}) => selected);
const newValues = selectedOptions.map(({
value
}) => value);
onChange(newValues);
return;
}
onChange(event.target.value, {
event
});
};
const classes = classnames_default()('components-select-control', className);
/* eslint-disable jsx-a11y/no-onchange */
return Object(external_wp_element_["createElement"])(base_control, {
help: help
}, Object(external_wp_element_["createElement"])(input_base, Object(esm_extends["a" /* default */])({
className: classes,
disabled: disabled,
hideLabelFromVision: hideLabelFromVision,
id: id,
isFocused: isFocused,
label: label,
size: size,
suffix: Object(external_wp_element_["createElement"])(DownArrowWrapper, null, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], {
icon: chevron_down["a" /* default */],
size: 18
})),
labelPosition: labelPosition
}, props), Object(external_wp_element_["createElement"])(Select, Object(esm_extends["a" /* default */])({}, props, {
"aria-describedby": helpId,
className: "components-select-control__input",
disabled: disabled,
id: id,
multiple: multiple,
onBlur: handleOnBlur,
onChange: handleOnChange,
onFocus: handleOnFocus,
ref: ref,
size: size,
value: valueProp
}), options.map((option, index) => {
const key = option.id || `${option.label}-${option.value}-${index}`;
return Object(external_wp_element_["createElement"])("option", {
key: key,
value: option.value,
disabled: option.disabled
}, option.label);
}))));
/* eslint-enable jsx-a11y/no-onchange */
}
const select_control_ForwardedComponent = Object(external_wp_element_["forwardRef"])(SelectControl);
/* harmony default export */ var select_control = (select_control_ForwardedComponent);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dimension-control/sizes.js
/**
* Sizes
*
* defines the sizes used in dimension controls
* all hardcoded `size` values are based on the value of
* the Sass variable `$block-padding` from
* `packages/block-editor/src/components/dimension-control/sizes.js`.
*/
/**
* WordPress dependencies
*/
/**
* Finds the correct size object from the provided sizes
* table by size slug (eg: `medium`)
*
* @param {Array} sizes containing objects for each size definition
* @param {string} slug a string representation of the size (eg: `medium`)
* @return {Object} the matching size definition
*/
const findSizeBySlug = (sizes, slug) => sizes.find(size => slug === size.slug);
/* harmony default export */ var dimension_control_sizes = ([{
name: Object(external_wp_i18n_["__"])('None'),
slug: 'none'
}, {
name: Object(external_wp_i18n_["__"])('Small'),
slug: 'small'
}, {
name: Object(external_wp_i18n_["__"])('Medium'),
slug: 'medium'
}, {
name: Object(external_wp_i18n_["__"])('Large'),
slug: 'large'
}, {
name: Object(external_wp_i18n_["__"])('Extra Large'),
slug: 'xlarge'
}]);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dimension-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Internal dependencies
*/
function DimensionControl(props) {
const {
label,
value,
sizes = dimension_control_sizes,
icon,
onChange,
className = ''
} = props;
const onChangeSpacingSize = val => {
const theSize = findSizeBySlug(sizes, val);
if (!theSize || value === theSize.slug) {
onChange(undefined);
} else if (Object(external_lodash_["isFunction"])(onChange)) {
onChange(theSize.slug);
}
};
const formatSizesAsOptions = theSizes => {
const options = theSizes.map(({
name,
slug
}) => ({
label: name,
value: slug
}));
return [{
label: Object(external_wp_i18n_["__"])('Default'),
value: ''
}].concat(options);
};
const selectLabel = Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, icon && Object(external_wp_element_["createElement"])(components_build_module_icon["a" /* default */], {
icon: icon
}), label);
return Object(external_wp_element_["createElement"])(select_control, {
className: classnames_default()(className, 'block-editor-dimension-control'),
label: selectLabel,
hideLabelFromVision: false,
value: value,
onChange: onChangeSpacingSize,
options: formatSizesAsOptions(sizes)
});
}
/* harmony default export */ var dimension_control = (DimensionControl);
// EXTERNAL MODULE: external ["wp","dom"]
var external_wp_dom_ = __webpack_require__("1CF3");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/disabled/styles/disabled-styles.js
function disabled_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
const StyledWrapper = styled_base_browser_esm("div", {
target: "e1ac3xxk0",
label: "StyledWrapper"
})( true ? {
name: "u2jump",
styles: "position:relative;pointer-events:none;&::after{content:'';position:absolute;top:0;right:0;bottom:0;left:0;}*{pointer-events:none;}"
} : undefined);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/disabled/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const Context = Object(external_wp_element_["createContext"])(false);
const {
Consumer,
Provider: disabled_Provider
} = Context;
/**
* Names of control nodes which qualify for disabled behavior.
*
* See WHATWG HTML Standard: 4.10.18.5: "Enabling and disabling form controls: the disabled attribute".
*
* @see https://html.spec.whatwg.org/multipage/form-control-infrastructure.html#enabling-and-disabling-form-controls:-the-disabled-attribute
*
* @type {string[]}
*/
const DISABLED_ELIGIBLE_NODE_NAMES = ['BUTTON', 'FIELDSET', 'INPUT', 'OPTGROUP', 'OPTION', 'SELECT', 'TEXTAREA'];
function Disabled({
className,
children,
isDisabled = true,
...props
}) {
const node = Object(external_wp_element_["useRef"])();
const disable = () => {
external_wp_dom_["focus"].focusable.find(node.current).forEach(focusable => {
if (Object(external_lodash_["includes"])(DISABLED_ELIGIBLE_NODE_NAMES, focusable.nodeName)) {
focusable.setAttribute('disabled', '');
}
if (focusable.nodeName === 'A') {
focusable.setAttribute('tabindex', -1);
}
const tabIndex = focusable.getAttribute('tabindex');
if (tabIndex !== null && tabIndex !== '-1') {
focusable.removeAttribute('tabindex');
}
if (focusable.hasAttribute('contenteditable')) {
focusable.setAttribute('contenteditable', 'false');
}
});
}; // Debounce re-disable since disabling process itself will incur
// additional mutations which should be ignored.
const debouncedDisable = Object(external_wp_element_["useCallback"])(Object(external_lodash_["debounce"])(disable, {
leading: true
}), []);
Object(external_wp_element_["useLayoutEffect"])(() => {
if (!isDisabled) {
return;
}
disable();
const observer = new window.MutationObserver(debouncedDisable);
observer.observe(node.current, {
childList: true,
attributes: true,
subtree: true
});
return () => {
observer.disconnect();
debouncedDisable.cancel();
};
}, []);
if (!isDisabled) {
return Object(external_wp_element_["createElement"])(disabled_Provider, {
value: false
}, children);
}
return Object(external_wp_element_["createElement"])(disabled_Provider, {
value: true
}, Object(external_wp_element_["createElement"])(StyledWrapper, Object(esm_extends["a" /* default */])({
ref: node,
className: classnames_default()(className, 'components-disabled')
}, props), children));
}
Disabled.Context = Context;
Disabled.Consumer = Consumer;
/* harmony default export */ var build_module_disabled = (Disabled);
// CONCATENATED MODULE: ./node_modules/reakit/es/__keys-e6a5cfbe.js
// Automatically generated
var DISCLOSURE_STATE_KEYS = ["baseId", "unstable_idCountRef", "visible", "animated", "animating", "setBaseId", "show", "hide", "toggle", "setVisible", "setAnimated", "stopAnimation"];
var DISCLOSURE_KEYS = DISCLOSURE_STATE_KEYS;
var DISCLOSURE_CONTENT_KEYS = DISCLOSURE_KEYS;
// CONCATENATED MODULE: ./node_modules/reakit/es/Disclosure/DisclosureContent.js
var useDisclosureContent = Object(createHook["a" /* createHook */])({
name: "DisclosureContent",
compose: Role["a" /* useRole */],
keys: DISCLOSURE_CONTENT_KEYS,
useProps: function useProps(options, _ref) {
var htmlOnTransitionEnd = _ref.onTransitionEnd,
htmlOnAnimationEnd = _ref.onAnimationEnd,
htmlStyle = _ref.style,
htmlProps = Object(_rollupPluginBabelHelpers_1f0bf8c2["a" /* _ */])(_ref, ["onTransitionEnd", "onAnimationEnd", "style"]);
var animating = options.animated && options.animating;
var _React$useState = Object(external_React_["useState"])(null),
transition = _React$useState[0],
setTransition = _React$useState[1];
var hidden = !options.visible && !animating;
var style = hidden ? Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({
display: "none"
}, htmlStyle) : htmlStyle;
var onTransitionEndRef = Object(useLiveRef["a" /* useLiveRef */])(htmlOnTransitionEnd);
var onAnimationEndRef = Object(useLiveRef["a" /* useLiveRef */])(htmlOnAnimationEnd);
var raf = Object(external_React_["useRef"])(0);
Object(external_React_["useEffect"])(function () {
if (!options.animated) return undefined; // Double RAF is needed so the browser has enough time to paint the
// default styles before processing the `data-enter` attribute. Otherwise
// it wouldn't be considered a transition.
// See https://github.com/reakit/reakit/issues/643
raf.current = window.requestAnimationFrame(function () {
raf.current = window.requestAnimationFrame(function () {
if (options.visible) {
setTransition("enter");
} else if (animating) {
setTransition("leave");
} else {
setTransition(null);
}
});
});
return function () {
return window.cancelAnimationFrame(raf.current);
};
}, [options.animated, options.visible, animating]);
var onEnd = Object(external_React_["useCallback"])(function (event) {
if (!Object(isSelfTarget["a" /* isSelfTarget */])(event)) return;
if (!animating) return; // Ignores number animated
if (options.animated === true) {
var _options$stopAnimatio;
(_options$stopAnimatio = options.stopAnimation) === null || _options$stopAnimatio === void 0 ? void 0 : _options$stopAnimatio.call(options);
}
}, [options.animated, animating, options.stopAnimation]);
var onTransitionEnd = Object(external_React_["useCallback"])(function (event) {
var _onTransitionEndRef$c;
(_onTransitionEndRef$c = onTransitionEndRef.current) === null || _onTransitionEndRef$c === void 0 ? void 0 : _onTransitionEndRef$c.call(onTransitionEndRef, event);
onEnd(event);
}, [onEnd]);
var onAnimationEnd = Object(external_React_["useCallback"])(function (event) {
var _onAnimationEndRef$cu;
(_onAnimationEndRef$cu = onAnimationEndRef.current) === null || _onAnimationEndRef$cu === void 0 ? void 0 : _onAnimationEndRef$cu.call(onAnimationEndRef, event);
onEnd(event);
}, [onEnd]);
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({
id: options.baseId,
"data-enter": transition === "enter" ? "" : undefined,
"data-leave": transition === "leave" ? "" : undefined,
onTransitionEnd: onTransitionEnd,
onAnimationEnd: onAnimationEnd,
hidden: hidden,
style: style
}, htmlProps);
}
});
var DisclosureContent = Object(createComponent["a" /* createComponent */])({
as: "div",
useHook: useDisclosureContent
});
// CONCATENATED MODULE: ./node_modules/reakit/es/Separator/Separator.js
// Automatically generated
var SEPARATOR_KEYS = ["orientation"];
var useSeparator = Object(createHook["a" /* createHook */])({
name: "Separator",
compose: Role["a" /* useRole */],
keys: SEPARATOR_KEYS,
useOptions: function useOptions(_ref) {
var _ref$orientation = _ref.orientation,
orientation = _ref$orientation === void 0 ? "horizontal" : _ref$orientation,
options = Object(_rollupPluginBabelHelpers_1f0bf8c2["a" /* _ */])(_ref, ["orientation"]);
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({
orientation: orientation
}, options);
},
useProps: function useProps(options, htmlProps) {
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({
role: "separator",
"aria-orientation": options.orientation
}, htmlProps);
}
});
var Separator = Object(createComponent["a" /* createComponent */])({
as: "hr",
memo: true,
useHook: useSeparator
});
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/divider/styles.js
/**
* Internal dependencies
*/
const Divider = /*#__PURE__*/Object(emotion_esm["a" /* css */])("border-color:", config_values.colorDivider, ";border-width:0 0 1px 0;height:0;margin:0;width:auto;;label:Divider;" + ( true ? "" : undefined));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/divider/component.js
// eslint-disable-next-line no-restricted-imports
// eslint-disable-next-line no-restricted-imports, no-duplicate-imports
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// eslint-disable-next-line no-duplicate-imports
function component_Divider(props, forwardedRef) {
const {
className,
margin,
marginBottom,
marginTop,
...otherProps
} = Object(use_context_system["a" /* useContextSystem */])(props, 'Divider');
const classes = Object(external_wp_element_["useMemo"])(() => {
const sx = {};
if (typeof margin !== 'undefined') {
sx.margin = /*#__PURE__*/Object(emotion_esm["a" /* css */])("margin-bottom:", space_space(margin), ";margin-top:", space_space(margin), ";" + ( true ? "" : undefined));
} else {
if (typeof marginTop !== 'undefined') {
sx.marginTop = /*#__PURE__*/Object(emotion_esm["a" /* css */])("margin-top:", space_space(marginTop), ";" + ( true ? "" : undefined));
}
if (typeof marginBottom !== 'undefined') {
sx.marginBottom = /*#__PURE__*/Object(emotion_esm["a" /* css */])("margin-bottom:", space_space(marginBottom), ";" + ( true ? "" : undefined));
}
}
return Object(emotion_esm["b" /* cx */])(Divider, sx.marginBottom, sx.marginTop, sx.margin, className);
}, [className, margin, marginBottom, marginTop]);
return Object(external_wp_element_["createElement"])(Separator, Object(esm_extends["a" /* default */])({
as: "hr"
}, otherProps, {
className: classes,
ref: forwardedRef
}));
}
/**
* `Divider` is a layout component that separates groups of related content.
*
* @example
* ```js
* import {
* __experimentalDivider as Divider,
* __experimentalText as Text }
* from `@wordpress/components`;
*
* function Example() {
* return (
* <ListGroup>
* <FormGroup>...</FormGroup>
* <Divider />
* <FormGroup>...</FormGroup>
* </ListGroup>
* );
* }
* ```
*/
const ConnectedDivider = Object(context_connect["a" /* contextConnect */])(component_Divider, 'Divider');
/* harmony default export */ var divider_component = (ConnectedDivider);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/draggable/index.js
/**
* WordPress dependencies
*/
const dragImageClass = 'components-draggable__invisible-drag-image';
const cloneWrapperClass = 'components-draggable__clone';
const cloneHeightTransformationBreakpoint = 700;
const clonePadding = 0;
const bodyClass = 'is-dragging-components-draggable';
/**
* @typedef RenderProp
* @property {(event: import('react').DragEvent) => void} onDraggableStart `onDragStart` handler.
* @property {(event: import('react').DragEvent) => void} onDraggableEnd `onDragEnd` handler.
*/
/**
* @typedef Props
* @property {(props: RenderProp) => JSX.Element | null} children Children.
* @property {(event: import('react').DragEvent) => void} [onDragStart] Callback when dragging starts.
* @property {(event: import('react').DragEvent) => void} [onDragOver] Callback when dragging happens over the document.
* @property {(event: import('react').DragEvent) => void} [onDragEnd] Callback when dragging ends.
* @property {string} [cloneClassname] Classname for the cloned element.
* @property {string} [elementId] ID for the element.
* @property {any} [transferData] Transfer data for the drag event.
* @property {string} [__experimentalTransferDataType] The transfer data type to set.
* @property {import('react').ReactNode} __experimentalDragComponent Component to show when dragging.
*/
/**
* @param {Props} props
* @return {JSX.Element} A draggable component.
*/
function Draggable({
children,
onDragStart,
onDragOver,
onDragEnd,
cloneClassname,
elementId,
transferData,
__experimentalTransferDataType: transferDataType = 'text',
__experimentalDragComponent: dragComponent
}) {
/** @type {import('react').MutableRefObject<HTMLDivElement | null>} */
const dragComponentRef = Object(external_wp_element_["useRef"])(null);
const cleanup = Object(external_wp_element_["useRef"])(() => {});
/**
* Removes the element clone, resets cursor, and removes drag listener.
*
* @param {import('react').DragEvent} event The non-custom DragEvent.
*/
function end(event) {
event.preventDefault();
cleanup.current();
if (onDragEnd) {
onDragEnd(event);
}
}
/**
* This method does a couple of things:
*
* - Clones the current element and spawns clone over original element.
* - Adds a fake temporary drag image to avoid browser defaults.
* - Sets transfer data.
* - Adds dragover listener.
*
* @param {import('react').DragEvent} event The non-custom DragEvent.
*/
function start(event) {
// @ts-ignore We know that ownerDocument does exist on an Element
const {
ownerDocument
} = event.target;
event.dataTransfer.setData(transferDataType, JSON.stringify(transferData));
const cloneWrapper = ownerDocument.createElement('div');
const dragImage = ownerDocument.createElement('div'); // Set a fake drag image to avoid browser defaults. Remove from DOM
// right after. event.dataTransfer.setDragImage is not supported yet in
// IE, we need to check for its existence first.
if ('function' === typeof event.dataTransfer.setDragImage) {
dragImage.classList.add(dragImageClass);
ownerDocument.body.appendChild(dragImage);
event.dataTransfer.setDragImage(dragImage, 0, 0);
}
cloneWrapper.classList.add(cloneWrapperClass);
if (cloneClassname) {
cloneWrapper.classList.add(cloneClassname);
} // If a dragComponent is defined, the following logic will clone the
// HTML node and inject it into the cloneWrapper.
if (dragComponentRef.current) {
// Position dragComponent at the same position as the cursor.
cloneWrapper.style.top = `${event.clientY}px`;
cloneWrapper.style.left = `${event.clientX}px`;
const clonedDragComponent = ownerDocument.createElement('div');
clonedDragComponent.innerHTML = dragComponentRef.current.innerHTML;
cloneWrapper.appendChild(clonedDragComponent); // Inject the cloneWrapper into the DOM.
ownerDocument.body.appendChild(cloneWrapper);
} else {
const element = ownerDocument.getElementById(elementId); // Prepare element clone and append to element wrapper.
const elementRect = element.getBoundingClientRect();
const elementWrapper = element.parentNode;
const elementTopOffset = parseInt(elementRect.top, 10);
const elementLeftOffset = parseInt(elementRect.left, 10);
cloneWrapper.style.width = `${elementRect.width + clonePadding * 2}px`;
const clone = element.cloneNode(true);
clone.id = `clone-${elementId}`;
if (elementRect.height > cloneHeightTransformationBreakpoint) {
// Scale down clone if original element is larger than 700px.
cloneWrapper.style.transform = 'scale(0.5)';
cloneWrapper.style.transformOrigin = 'top left'; // Position clone near the cursor.
cloneWrapper.style.top = `${event.clientY - 100}px`;
cloneWrapper.style.left = `${event.clientX}px`;
} else {
// Position clone right over the original element (20px padding).
cloneWrapper.style.top = `${elementTopOffset - clonePadding}px`;
cloneWrapper.style.left = `${elementLeftOffset - clonePadding}px`;
} // Hack: Remove iFrames as it's causing the embeds drag clone to freeze
Array.from(clone.querySelectorAll('iframe')).forEach(child => child.parentNode.removeChild(child));
cloneWrapper.appendChild(clone); // Inject the cloneWrapper into the DOM.
elementWrapper.appendChild(cloneWrapper);
} // Mark the current cursor coordinates.
let cursorLeft = event.clientX;
let cursorTop = event.clientY;
/**
* @param {import('react').DragEvent} e
*/
function over(e) {
cloneWrapper.style.top = `${parseInt(cloneWrapper.style.top, 10) + e.clientY - cursorTop}px`;
cloneWrapper.style.left = `${parseInt(cloneWrapper.style.left, 10) + e.clientX - cursorLeft}px`; // Update cursor coordinates.
cursorLeft = e.clientX;
cursorTop = e.clientY;
if (onDragOver) {
onDragOver(e);
}
}
ownerDocument.addEventListener('dragover', over); // Update cursor to 'grabbing', document wide.
ownerDocument.body.classList.add(bodyClass); // Allow the Synthetic Event to be accessed from asynchronous code.
// https://reactjs.org/docs/events.html#event-pooling
event.persist();
/** @type {number | undefined} */
let timerId;
if (onDragStart) {
timerId = setTimeout(() => onDragStart(event));
}
cleanup.current = () => {
// Remove drag clone
if (cloneWrapper && cloneWrapper.parentNode) {
cloneWrapper.parentNode.removeChild(cloneWrapper);
}
if (dragImage && dragImage.parentNode) {
dragImage.parentNode.removeChild(dragImage);
} // Reset cursor.
ownerDocument.body.classList.remove(bodyClass);
ownerDocument.removeEventListener('dragover', over);
clearTimeout(timerId);
};
}
Object(external_wp_element_["useEffect"])(() => () => {
cleanup.current();
}, []);
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, children({
onDraggableStart: start,
onDraggableEnd: end
}), dragComponent && Object(external_wp_element_["createElement"])("div", {
className: "components-draggable-drag-component-root",
style: {
display: 'none'
},
ref: dragComponentRef
}, dragComponent));
}
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/upload.js
var upload = __webpack_require__("NTP4");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/drop-zone/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function DropZoneComponent({
className,
label,
onFilesDrop,
onHTMLDrop,
onDrop
}) {
const [isDraggingOverDocument, setIsDraggingOverDocument] = Object(external_wp_element_["useState"])();
const [isDraggingOverElement, setIsDraggingOverElement] = Object(external_wp_element_["useState"])();
const [type, setType] = Object(external_wp_element_["useState"])();
const ref = Object(external_wp_compose_["__experimentalUseDropZone"])({
onDrop(event) {
const files = Object(external_wp_dom_["getFilesFromDataTransfer"])(event.dataTransfer);
const html = event.dataTransfer.getData('text/html');
if (files.length && onFilesDrop) {
onFilesDrop(files);
} else if (html && onHTMLDrop) {
onHTMLDrop(html);
} else if (onDrop) {
onDrop(event);
}
},
onDragStart(event) {
setIsDraggingOverDocument(true);
let _type = 'default';
if ( // Check for the types because sometimes the files themselves
// are only available on drop.
Object(external_lodash_["includes"])(event.dataTransfer.types, 'Files') || Object(external_wp_dom_["getFilesFromDataTransfer"])(event.dataTransfer).length > 0) {
_type = 'file';
} else if (Object(external_lodash_["includes"])(event.dataTransfer.types, 'text/html')) {
_type = 'html';
}
setType(_type);
},
onDragEnd() {
setIsDraggingOverDocument(false);
setType();
},
onDragEnter() {
setIsDraggingOverElement(true);
},
onDragLeave() {
setIsDraggingOverElement(false);
}
});
let children;
if (isDraggingOverElement) {
children = Object(external_wp_element_["createElement"])("div", {
className: "components-drop-zone__content"
}, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], {
icon: upload["a" /* default */],
className: "components-drop-zone__content-icon"
}), Object(external_wp_element_["createElement"])("span", {
className: "components-drop-zone__content-text"
}, label ? label : Object(external_wp_i18n_["__"])('Drop files to upload')));
}
const classes = classnames_default()('components-drop-zone', className, {
'is-active': (isDraggingOverDocument || isDraggingOverElement) && (type === 'file' && onFilesDrop || type === 'html' && onHTMLDrop || type === 'default' && onDrop),
'is-dragging-over-document': isDraggingOverDocument,
'is-dragging-over-element': isDraggingOverElement,
[`is-dragging-${type}`]: !!type
});
return Object(external_wp_element_["createElement"])("div", {
ref: ref,
className: classes
}, children);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/drop-zone/provider.js
/**
* WordPress dependencies
*/
function DropZoneProvider({
children
}) {
external_wp_deprecated_default()('wp.components.DropZoneProvider', {
hint: 'wp.component.DropZone no longer needs a provider. wp.components.DropZoneProvider is safe to remove from your code.'
});
return children;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/menu.js
/**
* WordPress dependencies
*/
const menu_menu = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
d: "M5 5v1.5h14V5H5zm0 7.8h14v-1.5H5v1.5zM5 19h14v-1.5H5V19z"
}));
/* harmony default export */ var library_menu = (menu_menu);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigable-container/container.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const MENU_ITEM_ROLES = ['menuitem', 'menuitemradio', 'menuitemcheckbox'];
function cycleValue(value, total, offset) {
const nextValue = value + offset;
if (nextValue < 0) {
return total + nextValue;
} else if (nextValue >= total) {
return nextValue - total;
}
return nextValue;
}
class container_NavigableContainer extends external_wp_element_["Component"] {
constructor() {
super(...arguments);
this.onKeyDown = this.onKeyDown.bind(this);
this.bindContainer = this.bindContainer.bind(this);
this.getFocusableContext = this.getFocusableContext.bind(this);
this.getFocusableIndex = this.getFocusableIndex.bind(this);
}
componentDidMount() {
// We use DOM event listeners instead of React event listeners
// because we want to catch events from the underlying DOM tree
// The React Tree can be different from the DOM tree when using
// portals. Block Toolbars for instance are rendered in a separate
// React Trees.
this.container.addEventListener('keydown', this.onKeyDown);
this.container.addEventListener('focus', this.onFocus);
}
componentWillUnmount() {
this.container.removeEventListener('keydown', this.onKeyDown);
this.container.removeEventListener('focus', this.onFocus);
}
bindContainer(ref) {
const {
forwardedRef
} = this.props;
this.container = ref;
if (Object(external_lodash_["isFunction"])(forwardedRef)) {
forwardedRef(ref);
} else if (forwardedRef && 'current' in forwardedRef) {
forwardedRef.current = ref;
}
}
getFocusableContext(target) {
const {
onlyBrowserTabstops
} = this.props;
const finder = onlyBrowserTabstops ? external_wp_dom_["focus"].tabbable : external_wp_dom_["focus"].focusable;
const focusables = finder.find(this.container);
const index = this.getFocusableIndex(focusables, target);
if (index > -1 && target) {
return {
index,
target,
focusables
};
}
return null;
}
getFocusableIndex(focusables, target) {
const directIndex = focusables.indexOf(target);
if (directIndex !== -1) {
return directIndex;
}
}
onKeyDown(event) {
if (this.props.onKeyDown) {
this.props.onKeyDown(event);
}
const {
getFocusableContext
} = this;
const {
cycle = true,
eventToOffset,
onNavigate = external_lodash_["noop"],
stopNavigationEvents
} = this.props;
const offset = eventToOffset(event); // eventToOffset returns undefined if the event is not handled by the component
if (offset !== undefined && stopNavigationEvents) {
// Prevents arrow key handlers bound to the document directly interfering
event.stopImmediatePropagation(); // When navigating a collection of items, prevent scroll containers
// from scrolling. The preventDefault also prevents Voiceover from
// 'handling' the event, as voiceover will try to use arrow keys
// for highlighting text.
const targetRole = event.target.getAttribute('role');
if (MENU_ITEM_ROLES.includes(targetRole)) {
event.preventDefault();
}
}
if (!offset) {
return;
}
const context = getFocusableContext(event.target.ownerDocument.activeElement);
if (!context) {
return;
}
const {
index,
focusables
} = context;
const nextIndex = cycle ? cycleValue(index, focusables.length, offset) : index + offset;
if (nextIndex >= 0 && nextIndex < focusables.length) {
focusables[nextIndex].focus();
onNavigate(nextIndex, focusables[nextIndex]);
}
}
render() {
const {
children,
...props
} = this.props;
return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({
ref: this.bindContainer
}, Object(external_lodash_["omit"])(props, ['stopNavigationEvents', 'eventToOffset', 'onNavigate', 'onKeyDown', 'cycle', 'onlyBrowserTabstops', 'forwardedRef'])), children);
}
}
const forwardedNavigableContainer = (props, ref) => {
return Object(external_wp_element_["createElement"])(container_NavigableContainer, Object(esm_extends["a" /* default */])({}, props, {
forwardedRef: ref
}));
};
forwardedNavigableContainer.displayName = 'NavigableContainer';
/* harmony default export */ var navigable_container_container = (Object(external_wp_element_["forwardRef"])(forwardedNavigableContainer));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigable-container/menu.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function NavigableMenu({
role = 'menu',
orientation = 'vertical',
...rest
}, ref) {
const eventToOffset = evt => {
const {
keyCode
} = evt;
let next = [external_wp_keycodes_["DOWN"]];
let previous = [external_wp_keycodes_["UP"]];
if (orientation === 'horizontal') {
next = [external_wp_keycodes_["RIGHT"]];
previous = [external_wp_keycodes_["LEFT"]];
}
if (orientation === 'both') {
next = [external_wp_keycodes_["RIGHT"], external_wp_keycodes_["DOWN"]];
previous = [external_wp_keycodes_["LEFT"], external_wp_keycodes_["UP"]];
}
if (Object(external_lodash_["includes"])(next, keyCode)) {
return 1;
} else if (Object(external_lodash_["includes"])(previous, keyCode)) {
return -1;
} else if (Object(external_lodash_["includes"])([external_wp_keycodes_["DOWN"], external_wp_keycodes_["UP"], external_wp_keycodes_["LEFT"], external_wp_keycodes_["RIGHT"]], keyCode)) {
// Key press should be handled, e.g. have event propagation and
// default behavior handled by NavigableContainer but not result
// in an offset.
return 0;
}
};
return Object(external_wp_element_["createElement"])(navigable_container_container, Object(esm_extends["a" /* default */])({
ref: ref,
stopNavigationEvents: true,
onlyBrowserTabstops: false,
role: role,
"aria-orientation": role === 'presentation' ? null : orientation,
eventToOffset: eventToOffset
}, rest));
}
/* harmony default export */ var navigable_container_menu = (Object(external_wp_element_["forwardRef"])(NavigableMenu));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/dropdown-menu/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function mergeProps(defaultProps = {}, props = {}) {
const mergedProps = { ...defaultProps,
...props
};
if (props.className && defaultProps.className) {
mergedProps.className = classnames_default()(props.className, defaultProps.className);
}
return mergedProps;
}
function DropdownMenu({
children,
className,
controls,
icon = library_menu,
label,
popoverProps,
toggleProps,
menuProps,
disableOpenOnArrowDown = false,
text,
// The following props exist for backward compatibility.
menuLabel,
position,
noIcons
}) {
if (menuLabel) {
external_wp_deprecated_default()('`menuLabel` prop in `DropdownComponent`', {
since: '5.3',
alternative: '`menuProps` object and its `aria-label` property'
});
}
if (position) {
external_wp_deprecated_default()('`position` prop in `DropdownComponent`', {
since: '5.3',
alternative: '`popoverProps` object and its `position` property'
});
}
if (Object(external_lodash_["isEmpty"])(controls) && !Object(external_lodash_["isFunction"])(children)) {
return null;
} // Normalize controls to nested array of objects (sets of controls)
let controlSets;
if (!Object(external_lodash_["isEmpty"])(controls)) {
controlSets = controls;
if (!Array.isArray(controlSets[0])) {
controlSets = [controlSets];
}
}
const mergedPopoverProps = mergeProps({
className: 'components-dropdown-menu__popover',
position
}, popoverProps);
return Object(external_wp_element_["createElement"])(Dropdown, {
className: classnames_default()('components-dropdown-menu', className),
popoverProps: mergedPopoverProps,
renderToggle: ({
isOpen,
onToggle
}) => {
var _toggleProps$showTool;
const openOnArrowDown = event => {
if (disableOpenOnArrowDown) {
return;
}
if (!isOpen && event.keyCode === external_wp_keycodes_["DOWN"]) {
event.preventDefault();
event.stopPropagation();
onToggle();
}
};
const mergedToggleProps = mergeProps({
className: classnames_default()('components-dropdown-menu__toggle', {
'is-opened': isOpen
})
}, toggleProps);
return Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], Object(esm_extends["a" /* default */])({}, mergedToggleProps, {
icon: icon,
onClick: event => {
onToggle(event);
if (mergedToggleProps.onClick) {
mergedToggleProps.onClick(event);
}
},
onKeyDown: event => {
openOnArrowDown(event);
if (mergedToggleProps.onKeyDown) {
mergedToggleProps.onKeyDown(event);
}
},
"aria-haspopup": "true",
"aria-expanded": isOpen,
label: label,
text: text,
showTooltip: (_toggleProps$showTool = toggleProps === null || toggleProps === void 0 ? void 0 : toggleProps.showTooltip) !== null && _toggleProps$showTool !== void 0 ? _toggleProps$showTool : true
}), mergedToggleProps.children);
},
renderContent: props => {
const mergedMenuProps = mergeProps({
'aria-label': menuLabel || label,
className: classnames_default()('components-dropdown-menu__menu', {
'no-icons': noIcons
})
}, menuProps);
return Object(external_wp_element_["createElement"])(navigable_container_menu, Object(esm_extends["a" /* default */])({}, mergedMenuProps, {
role: "menu"
}), Object(external_lodash_["isFunction"])(children) ? children(props) : null, Object(external_lodash_["flatMap"])(controlSets, (controlSet, indexOfSet) => controlSet.map((control, indexOfControl) => Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
key: [indexOfSet, indexOfControl].join(),
onClick: event => {
event.stopPropagation();
props.onClose();
if (control.onClick) {
control.onClick();
}
},
className: classnames_default()('components-dropdown-menu__menu-item', {
'has-separator': indexOfSet > 0 && indexOfControl === 0,
'is-active': control.isActive
}),
icon: control.icon,
"aria-checked": control.role === 'menuitemcheckbox' || control.role === 'menuitemradio' ? control.isActive : undefined,
role: control.role === 'menuitemcheckbox' || control.role === 'menuitemradio' ? control.role : 'menuitem',
disabled: control.isDisabled
}, control.title))));
}
});
}
/* harmony default export */ var dropdown_menu = (DropdownMenu);
// CONCATENATED MODULE: ./node_modules/@wordpress/icons/build-module/library/swatch.js
/**
* WordPress dependencies
*/
const swatch = Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
d: "M5 17.7c.4.5.8.9 1.2 1.2l1.1-1.4c-.4-.3-.7-.6-1-1L5 17.7zM5 6.3l1.4 1.1c.3-.4.6-.7 1-1L6.3 5c-.5.4-.9.8-1.3 1.3zm.1 7.8l-1.7.5c.2.6.4 1.1.7 1.6l1.5-.8c-.2-.4-.4-.8-.5-1.3zM4.8 12v-.7L3 11.1v1.8l1.7-.2c.1-.2.1-.5.1-.7zm3 7.9c.5.3 1.1.5 1.6.7l.5-1.7c-.5-.1-.9-.3-1.3-.5l-.8 1.5zM19 6.3c-.4-.5-.8-.9-1.2-1.2l-1.1 1.4c.4.3.7.6 1 1L19 6.3zm-.1 3.6l1.7-.5c-.2-.6-.4-1.1-.7-1.6l-1.5.8c.2.4.4.8.5 1.3zM5.6 8.6l-1.5-.8c-.3.5-.5 1-.7 1.6l1.7.5c.1-.5.3-.9.5-1.3zm2.2-4.5l.8 1.5c.4-.2.8-.4 1.3-.5l-.5-1.7c-.6.2-1.1.4-1.6.7zm8.8 13.5l1.1 1.4c.5-.4.9-.8 1.2-1.2l-1.4-1.1c-.2.3-.5.6-.9.9zm1.8-2.2l1.5.8c.3-.5.5-1.1.7-1.6l-1.7-.5c-.1.5-.3.9-.5 1.3zm2.6-4.3l-1.7.2v1.4l1.7.2V12v-.9zM11.1 3l.2 1.7h1.4l.2-1.7h-1.8zm3 2.1c.5.1.9.3 1.3.5l.8-1.5c-.5-.3-1.1-.5-1.6-.7l-.5 1.7zM12 19.2h-.7l-.2 1.8h1.8l-.2-1.7c-.2-.1-.5-.1-.7-.1zm2.1-.3l.5 1.7c.6-.2 1.1-.4 1.6-.7l-.8-1.5c-.4.2-.8.4-1.3.5z"
}));
/* harmony default export */ var library_swatch = (swatch);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/swatch/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Swatch({
fill
}) {
return fill ? Object(external_wp_element_["createElement"])("span", {
className: "components-swatch",
style: {
background: fill
}
}) : Object(external_wp_element_["createElement"])(components_build_module_icon["a" /* default */], {
icon: library_swatch
});
}
/* harmony default export */ var build_module_swatch = (Swatch);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/duotone-picker/utils.js
/**
* External dependencies
*/
/**
* Object representation for a color.
*
* @typedef {Object} RGBColor
* @property {number} r Red component of the color in the range [0,1].
* @property {number} g Green component of the color in the range [0,1].
* @property {number} b Blue component of the color in the range [0,1].
*/
/**
* Calculate the brightest and darkest values from a color palette.
*
* @param {Object[]} palette Color palette for the theme.
*
* @return {string[]} Tuple of the darkest color and brightest color.
*/
function getDefaultColors(palette) {
// A default dark and light color are required.
if (!palette || palette.length < 2) return ['#000', '#fff'];
return palette.map(({
color
}) => ({
color,
brightness: tinycolor_default()(color).getBrightness() / 255
})).reduce(([min, max], current) => {
return [current.brightness <= min.brightness ? current : min, current.brightness >= max.brightness ? current : max];
}, [{
brightness: 1
}, {
brightness: 0
}]).map(({
color
}) => color);
}
/**
* Generate a duotone gradient from a list of colors.
*
* @param {string[]} colors CSS color strings.
* @param {string} angle CSS gradient angle.
*
* @return {string} CSS gradient string for the duotone swatch.
*/
function getGradientFromCSSColors(colors = [], angle = '90deg') {
const l = 100 / colors.length;
const stops = colors.map((c, i) => `${c} ${i * l}%, ${c} ${(i + 1) * l}%`).join(', ');
return `linear-gradient( ${angle}, ${stops} )`;
}
/**
* Convert a color array to an array of color stops.
*
* @param {string[]} colors CSS colors array
*
* @return {Object[]} Color stop information.
*/
function getColorStopsFromColors(colors) {
return colors.map((color, i) => ({
position: i * 100 / (colors.length - 1),
color
}));
}
/**
* Convert a color stop array to an array colors.
*
* @param {Object[]} colorStops Color stop information.
*
* @return {string[]} CSS colors array.
*/
function getColorsFromColorStops(colorStops = []) {
return colorStops.map(({
color
}) => color);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/duotone-picker/duotone-swatch.js
/**
* Internal dependencies
*/
function DuotoneSwatch({
values
}) {
return Object(external_wp_element_["createElement"])(build_module_swatch, {
fill: values && getGradientFromCSSColors(values, '135deg')
});
}
/* harmony default export */ var duotone_swatch = (DuotoneSwatch);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/color-list-picker/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function color_list_picker_ColorOption({
label,
value,
colors,
disableCustomColors,
onChange
}) {
const [isOpen, setIsOpen] = Object(external_wp_element_["useState"])(false);
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
className: "components-color-list-picker__swatch-button",
icon: Object(external_wp_element_["createElement"])(build_module_swatch, {
fill: value
}),
onClick: () => setIsOpen(prev => !prev)
}, label), isOpen && Object(external_wp_element_["createElement"])(ColorPalette, {
colors: colors,
value: value,
clearable: false,
onChange: onChange,
disableCustomColors: disableCustomColors
}));
}
function ColorListPicker({
colors,
labels,
value = [],
disableCustomColors,
onChange
}) {
return Object(external_wp_element_["createElement"])("div", {
className: "components-color-list-picker"
}, labels.map((label, index) => Object(external_wp_element_["createElement"])(color_list_picker_ColorOption, {
key: index,
label: label,
value: value[index],
colors: colors,
disableCustomColors: disableCustomColors,
onChange: newColor => {
const newColors = value.slice();
newColors[index] = newColor;
onChange(newColors);
}
})));
}
/* harmony default export */ var color_list_picker = (ColorListPicker);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-bar/constants.js
const COLOR_POPOVER_PROPS = {
className: 'components-custom-gradient-picker__color-picker-popover',
position: 'top'
};
const GRADIENT_MARKERS_WIDTH = 18;
const INSERT_POINT_WIDTH = 23;
const MINIMUM_ABSOLUTE_LEFT_POSITION = 5;
const MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT = 10;
const MINIMUM_DISTANCE_BETWEEN_POINTS = 0;
const MINIMUM_SIGNIFICANT_MOVE = 5;
const KEYBOARD_CONTROL_POINT_VARIATION = MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT;
const MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_MARKER = (INSERT_POINT_WIDTH + GRADIENT_MARKERS_WIDTH) / 2;
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-bar/utils.js
/**
* Internal dependencies
*/
/**
* Control point for the gradient bar.
*
* @typedef {Object} ControlPoint
* @property {string} color Color of the control point.
* @property {number} position Integer position of the control point as a percentage.
*/
/**
* Color as parsed from the gradient by gradient-parser.
*
* @typedef {Object} Color
* @property {string} r Red component.
* @property {string} g Green component.
* @property {string} b Green component.
* @property {string} [a] Optional alpha component.
*/
/**
* Clamps a number between 0 and 100.
*
* @param {number} value Value to clamp.
*
* @return {number} Value clamped between 0 and 100.
*/
function clampPercent(value) {
return Math.max(0, Math.min(100, value));
}
/**
* Check if a control point is overlapping with another.
*
* @param {ControlPoint[]} value Array of control points.
* @param {number} initialIndex Index of the position to test.
* @param {number} newPosition New position of the control point.
* @param {number} minDistance Distance considered to be overlapping.
*
* @return {boolean} True if the point is overlapping.
*/
function isOverlapping(value, initialIndex, newPosition, minDistance = MINIMUM_DISTANCE_BETWEEN_POINTS) {
const initialPosition = value[initialIndex].position;
const minPosition = Math.min(initialPosition, newPosition);
const maxPosition = Math.max(initialPosition, newPosition);
return value.some(({
position
}, index) => {
return index !== initialIndex && (Math.abs(position - newPosition) < minDistance || minPosition < position && position < maxPosition);
});
}
/**
* Adds a control point from an array and returns the new array.
*
* @param {ControlPoint[]} points Array of control points.
* @param {number} position Position to insert the new point.
* @param {Color} color Color to update the control point at index.
*
* @return {ControlPoint[]} New array of control points.
*/
function addControlPoint(points, position, color) {
const nextIndex = points.findIndex(point => point.position > position);
const newPoint = {
color,
position
};
const newPoints = points.slice();
newPoints.splice(nextIndex - 1, 0, newPoint);
return newPoints;
}
/**
* Removes a control point from an array and returns the new array.
*
* @param {ControlPoint[]} points Array of control points.
* @param {number} index Index to remove.
*
* @return {ControlPoint[]} New array of control points.
*/
function removeControlPoint(points, index) {
return points.filter((point, pointIndex) => {
return pointIndex !== index;
});
}
/**
* Updates a control point from an array and returns the new array.
*
* @param {ControlPoint[]} points Array of control points.
* @param {number} index Index to update.
* @param {ControlPoint[]} newPoint New control point to replace the index.
*
* @return {ControlPoint[]} New array of control points.
*/
function updateControlPoint(points, index, newPoint) {
const newValue = points.slice();
newValue[index] = newPoint;
return newValue;
}
/**
* Updates the position of a control point from an array and returns the new array.
*
* @param {ControlPoint[]} points Array of control points.
* @param {number} index Index to update.
* @param {number} newPosition Position to move the control point at index.
*
* @return {ControlPoint[]} New array of control points.
*/
function updateControlPointPosition(points, index, newPosition) {
if (isOverlapping(points, index, newPosition)) {
return points;
}
const newPoint = { ...points[index],
position: newPosition
};
return updateControlPoint(points, index, newPoint);
}
/**
* Updates the position of a control point from an array and returns the new array.
*
* @param {ControlPoint[]} points Array of control points.
* @param {number} index Index to update.
* @param {Color} newColor Color to update the control point at index.
*
* @return {ControlPoint[]} New array of control points.
*/
function updateControlPointColor(points, index, newColor) {
const newPoint = { ...points[index],
color: newColor
};
return updateControlPoint(points, index, newPoint);
}
/**
* Updates the position of a control point from an array and returns the new array.
*
* @param {ControlPoint[]} points Array of control points.
* @param {number} position Position of the color stop.
* @param {string} newColor Color to update the control point at index.
*
* @return {ControlPoint[]} New array of control points.
*/
function updateControlPointColorByPosition(points, position, newColor) {
const index = points.findIndex(point => point.position === position);
return updateControlPointColor(points, index, newColor);
}
/**
* Gets the horizontal coordinate when dragging a control point with the mouse.
*
* @param {number} mouseXCoordinate Horizontal coordinate of the mouse position.
* @param {Element} containerElement Container for the gradient picker.
* @param {number} positionedElementWidth Width of the positioned element.
*
* @return {number} Whole number percentage from the left.
*/
function getHorizontalRelativeGradientPosition(mouseXCoordinate, containerElement, positionedElementWidth) {
if (!containerElement) {
return;
}
const {
x,
width
} = containerElement.getBoundingClientRect();
const absolutePositionValue = mouseXCoordinate - x - MINIMUM_ABSOLUTE_LEFT_POSITION - positionedElementWidth / 2;
const availableWidth = width - MINIMUM_ABSOLUTE_LEFT_POSITION - INSERT_POINT_WIDTH;
return Math.round(clampPercent(absolutePositionValue * 100 / availableWidth));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-bar/control-points.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ControlPointKeyboardMove({
value: position,
onChange,
children
}) {
const shortcuts = {
right(event) {
// Stop propagation of the key press event to avoid focus moving
// to another editor area.
event.stopPropagation();
const newPosition = clampPercent(position + KEYBOARD_CONTROL_POINT_VARIATION);
onChange(newPosition);
},
left(event) {
// Stop propagation of the key press event to avoid focus moving
// to another editor area.
event.stopPropagation();
const newPosition = clampPercent(position - KEYBOARD_CONTROL_POINT_VARIATION);
onChange(newPosition);
}
};
return Object(external_wp_element_["createElement"])(keyboard_shortcuts, {
shortcuts: shortcuts
}, children);
}
function ControlPointButton({
isOpen,
position,
color,
onChange,
...additionalProps
}) {
const instanceId = Object(external_wp_compose_["useInstanceId"])(ControlPointButton);
const descriptionId = `components-custom-gradient-picker__control-point-button-description-${instanceId}`;
return Object(external_wp_element_["createElement"])(ControlPointKeyboardMove, {
value: position,
onChange: onChange
}, Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], Object(esm_extends["a" /* default */])({
"aria-label": Object(external_wp_i18n_["sprintf"])( // translators: %1$s: gradient position e.g: 70, %2$s: gradient color code e.g: rgb(52,121,151).
Object(external_wp_i18n_["__"])('Gradient control point at position %1$s%% with color code %2$s.'), position, color),
"aria-describedby": descriptionId,
"aria-haspopup": "true",
"aria-expanded": isOpen,
className: classnames_default()('components-custom-gradient-picker__control-point-button', {
'is-active': isOpen
}),
style: {
left: `${position}%`
}
}, additionalProps)), Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], {
id: descriptionId
}, Object(external_wp_i18n_["__"])('Use your left or right arrow keys or drag and drop with the mouse to change the gradient position. Press the button to change the color or remove the control point.')));
}
function ControlPoints({
disableRemove,
disableAlpha,
gradientPickerDomRef,
ignoreMarkerPosition,
value: controlPoints,
onChange,
onStartControlPointChange,
onStopControlPointChange
}) {
const controlPointMoveState = Object(external_wp_element_["useRef"])();
const onMouseMove = event => {
const relativePosition = getHorizontalRelativeGradientPosition(event.clientX, gradientPickerDomRef.current, GRADIENT_MARKERS_WIDTH);
const {
initialPosition,
index,
significantMoveHappened
} = controlPointMoveState.current;
if (!significantMoveHappened && Math.abs(initialPosition - relativePosition) >= MINIMUM_SIGNIFICANT_MOVE) {
controlPointMoveState.current.significantMoveHappened = true;
}
onChange(updateControlPointPosition(controlPoints, index, relativePosition));
};
const cleanEventListeners = () => {
if (window && window.removeEventListener && controlPointMoveState.current && controlPointMoveState.current.listenersActivated) {
window.removeEventListener('mousemove', onMouseMove);
window.removeEventListener('mouseup', cleanEventListeners);
onStopControlPointChange();
controlPointMoveState.current.listenersActivated = false;
}
};
Object(external_wp_element_["useEffect"])(() => {
return () => {
cleanEventListeners();
};
}, []);
return controlPoints.map((point, index) => {
const initialPosition = point === null || point === void 0 ? void 0 : point.position;
return ignoreMarkerPosition !== initialPosition && Object(external_wp_element_["createElement"])(Dropdown, {
key: index,
onClose: onStopControlPointChange,
renderToggle: ({
isOpen,
onToggle
}) => Object(external_wp_element_["createElement"])(ControlPointButton, {
key: index,
onClick: () => {
if (controlPointMoveState.current && controlPointMoveState.current.significantMoveHappened) {
return;
}
if (isOpen) {
onStopControlPointChange();
} else {
onStartControlPointChange();
}
onToggle();
},
onMouseDown: () => {
if (window && window.addEventListener) {
controlPointMoveState.current = {
initialPosition,
index,
significantMoveHappened: false,
listenersActivated: true
};
onStartControlPointChange();
window.addEventListener('mousemove', onMouseMove);
window.addEventListener('mouseup', cleanEventListeners);
}
},
isOpen: isOpen,
position: point.position,
color: point.color,
onChange: newPosition => {
onChange(updateControlPointPosition(controlPoints, index, newPosition));
}
}),
renderContent: ({
onClose
}) => Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(color_picker_ColorPicker, {
disableAlpha: disableAlpha,
color: point.color,
onChangeComplete: ({
color
}) => {
onChange(updateControlPointColor(controlPoints, index, color.toRgbString()));
}
}), !disableRemove && Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
className: "components-custom-gradient-picker__remove-control-point",
onClick: () => {
onChange(removeControlPoint(controlPoints, index));
onClose();
},
isLink: true
}, Object(external_wp_i18n_["__"])('Remove Control Point'))),
popoverProps: COLOR_POPOVER_PROPS
});
});
}
function InsertPoint({
value: controlPoints,
onChange,
onOpenInserter,
onCloseInserter,
insertPosition,
disableAlpha
}) {
const [alreadyInsertedPoint, setAlreadyInsertedPoint] = Object(external_wp_element_["useState"])(false);
return Object(external_wp_element_["createElement"])(Dropdown, {
className: "components-custom-gradient-picker__inserter",
onClose: () => {
onCloseInserter();
},
renderToggle: ({
isOpen,
onToggle
}) => Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
"aria-expanded": isOpen,
"aria-haspopup": "true",
onClick: () => {
if (isOpen) {
onCloseInserter();
} else {
setAlreadyInsertedPoint(false);
onOpenInserter();
}
onToggle();
},
className: "components-custom-gradient-picker__insert-point",
icon: plus["a" /* default */],
style: {
left: insertPosition !== null ? `${insertPosition}%` : undefined
}
}),
renderContent: () => Object(external_wp_element_["createElement"])(color_picker_ColorPicker, {
disableAlpha: disableAlpha,
onChangeComplete: ({
color
}) => {
if (!alreadyInsertedPoint) {
onChange(addControlPoint(controlPoints, insertPosition, color.toRgbString()));
setAlreadyInsertedPoint(true);
} else {
onChange(updateControlPointColorByPosition(controlPoints, insertPosition, color.toRgbString()));
}
}
}),
popoverProps: COLOR_POPOVER_PROPS
});
}
ControlPoints.InsertPoint = InsertPoint;
/* harmony default export */ var control_points = (ControlPoints);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-bar/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function customGradientBarReducer(state, action) {
switch (action.type) {
case 'MOVE_INSERTER':
if (state.id === 'IDLE' || state.id === 'MOVING_INSERTER') {
return {
id: 'MOVING_INSERTER',
insertPosition: action.insertPosition
};
}
break;
case 'STOP_INSERTER_MOVE':
if (state.id === 'MOVING_INSERTER') {
return {
id: 'IDLE'
};
}
break;
case 'OPEN_INSERTER':
if (state.id === 'MOVING_INSERTER') {
return {
id: 'INSERTING_CONTROL_POINT',
insertPosition: state.insertPosition
};
}
break;
case 'CLOSE_INSERTER':
if (state.id === 'INSERTING_CONTROL_POINT') {
return {
id: 'IDLE'
};
}
break;
case 'START_CONTROL_CHANGE':
if (state.id === 'IDLE') {
return {
id: 'MOVING_CONTROL_POINT'
};
}
break;
case 'STOP_CONTROL_CHANGE':
if (state.id === 'MOVING_CONTROL_POINT') {
return {
id: 'IDLE'
};
}
break;
}
return state;
}
const customGradientBarReducerInitialState = {
id: 'IDLE'
};
function CustomGradientBar({
background,
hasGradient,
value: controlPoints,
onChange,
disableInserter = false,
disableAlpha = false
}) {
const gradientPickerDomRef = Object(external_wp_element_["useRef"])();
const [gradientBarState, gradientBarStateDispatch] = Object(external_wp_element_["useReducer"])(customGradientBarReducer, customGradientBarReducerInitialState);
const onMouseEnterAndMove = event => {
const insertPosition = getHorizontalRelativeGradientPosition(event.clientX, gradientPickerDomRef.current, INSERT_POINT_WIDTH); // If the insert point is close to an existing control point don't show it.
if (Object(external_lodash_["some"])(controlPoints, ({
position
}) => {
return Math.abs(insertPosition - position) < MINIMUM_DISTANCE_BETWEEN_INSERTER_AND_POINT;
})) {
if (gradientBarState.id === 'MOVING_INSERTER') {
gradientBarStateDispatch({
type: 'STOP_INSERTER_MOVE'
});
}
return;
}
gradientBarStateDispatch({
type: 'MOVE_INSERTER',
insertPosition
});
};
const onMouseLeave = () => {
gradientBarStateDispatch({
type: 'STOP_INSERTER_MOVE'
});
};
const isMovingInserter = gradientBarState.id === 'MOVING_INSERTER';
const isInsertingControlPoint = gradientBarState.id === 'INSERTING_CONTROL_POINT';
return Object(external_wp_element_["createElement"])("div", {
ref: gradientPickerDomRef,
className: classnames_default()('components-custom-gradient-picker__gradient-bar', {
'has-gradient': hasGradient
}),
onMouseEnter: onMouseEnterAndMove,
onMouseMove: onMouseEnterAndMove,
style: {
background
},
onMouseLeave: onMouseLeave
}, Object(external_wp_element_["createElement"])("div", {
className: "components-custom-gradient-picker__markers-container"
}, !disableInserter && (isMovingInserter || isInsertingControlPoint) && Object(external_wp_element_["createElement"])(control_points.InsertPoint, {
disableAlpha: disableAlpha,
insertPosition: gradientBarState.insertPosition,
value: controlPoints,
onChange: onChange,
onOpenInserter: () => {
gradientBarStateDispatch({
type: 'OPEN_INSERTER'
});
},
onCloseInserter: () => {
gradientBarStateDispatch({
type: 'CLOSE_INSERTER'
});
}
}), Object(external_wp_element_["createElement"])(control_points, {
disableAlpha: disableAlpha,
disableRemove: disableInserter,
gradientPickerDomRef: gradientPickerDomRef,
ignoreMarkerPosition: isInsertingControlPoint ? gradientBarState.insertPosition : undefined,
value: controlPoints,
onChange: onChange,
onStartControlPointChange: () => {
gradientBarStateDispatch({
type: 'START_CONTROL_CHANGE'
});
},
onStopControlPointChange: () => {
gradientBarStateDispatch({
type: 'STOP_CONTROL_CHANGE'
});
}
})));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/duotone-picker/custom-duotone-bar.js
/**
* Internal dependencies
*/
const PLACEHOLDER_VALUES = ['#333', '#CCC'];
function CustomDuotoneBar({
value,
onChange
}) {
const hasGradient = !!value;
const values = hasGradient ? value : PLACEHOLDER_VALUES;
const background = getGradientFromCSSColors(values);
const controlPoints = getColorStopsFromColors(values);
return Object(external_wp_element_["createElement"])(CustomGradientBar, {
disableInserter: true,
disableAlpha: true,
background: background,
hasGradient: hasGradient,
value: controlPoints,
onChange: newColorStops => {
const newValue = getColorsFromColorStops(newColorStops);
onChange(newValue);
}
});
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/duotone-picker/duotone-picker.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function DuotonePicker({
colorPalette,
duotonePalette,
disableCustomColors,
value,
onChange
}) {
const [defaultDark, defaultLight] = Object(external_wp_element_["useMemo"])(() => getDefaultColors(colorPalette), [colorPalette]);
return Object(external_wp_element_["createElement"])(CircularOptionPicker, {
options: duotonePalette.map(({
colors,
slug,
name
}) => {
const style = {
background: getGradientFromCSSColors(colors, '135deg'),
color: 'transparent'
};
const tooltipText = name !== null && name !== void 0 ? name : Object(external_wp_i18n_["sprintf"])( // translators: %s: duotone code e.g: "dark-grayscale" or "7f7f7f-ffffff".
Object(external_wp_i18n_["__"])('Duotone code: %s'), slug);
const label = name ? Object(external_wp_i18n_["sprintf"])( // translators: %s: The name of the option e.g: "Dark grayscale".
Object(external_wp_i18n_["__"])('Duotone: %s'), name) : tooltipText;
const isSelected = Object(external_lodash_["isEqual"])(colors, value);
return Object(external_wp_element_["createElement"])(CircularOptionPicker.Option, {
key: slug,
value: colors,
isSelected: isSelected,
"aria-label": label,
tooltipText: tooltipText,
style: style,
onClick: () => {
onChange(isSelected ? undefined : colors);
}
});
}),
actions: Object(external_wp_element_["createElement"])(CircularOptionPicker.ButtonAction, {
onClick: () => onChange(undefined)
}, Object(external_wp_i18n_["__"])('Clear'))
}, !disableCustomColors && Object(external_wp_element_["createElement"])(CustomDuotoneBar, {
value: value,
onChange: onChange
}), colorPalette && Object(external_wp_element_["createElement"])(color_list_picker, {
labels: [Object(external_wp_i18n_["__"])('Shadows'), Object(external_wp_i18n_["__"])('Highlights')],
colors: colorPalette,
value: value,
disableCustomColors: disableCustomColors,
onChange: newColors => {
if (!newColors[0]) {
newColors[0] = defaultDark;
}
if (!newColors[1]) {
newColors[1] = defaultLight;
}
const newValue = newColors.length >= 2 ? newColors : undefined;
onChange(newValue);
}
}));
}
/* harmony default export */ var duotone_picker = (DuotonePicker);
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/external.js
var external = __webpack_require__("K+tz");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/external-link/styles/external-link-styles.js
function external_link_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* WordPress dependencies
*/
const StyledIcon = /*#__PURE__*/styled_base_browser_esm(build_module_icon["a" /* default */], {
target: "etxm6pv0",
label: "StyledIcon"
})( true ? {
name: "i8uvf3",
styles: "width:1.4em;height:1.4em;margin:-0.2em 0.1em 0;vertical-align:middle;fill:currentColor;"
} : undefined);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/external-link/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ExternalLink({
href,
children,
className,
rel = '',
...additionalProps
}, ref) {
rel = Object(external_lodash_["uniq"])(Object(external_lodash_["compact"])([...rel.split(' '), 'external', 'noreferrer', 'noopener'])).join(' ');
const classes = classnames_default()('components-external-link', className);
return (
/* eslint-disable react/jsx-no-target-blank */
Object(external_wp_element_["createElement"])("a", Object(esm_extends["a" /* default */])({}, additionalProps, {
className: classes,
href: href,
target: "_blank",
rel: rel,
ref: ref
}), children, Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], {
as: "span"
},
/* translators: accessibility text */
Object(external_wp_i18n_["__"])('(opens in a new tab)')), Object(external_wp_element_["createElement"])(StyledIcon, {
icon: external["a" /* default */],
className: "components-external-link__icon"
}))
/* eslint-enable react/jsx-no-target-blank */
);
}
/* harmony default export */ var external_link = (Object(external_wp_element_["forwardRef"])(ExternalLink));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/styles/focal-point-picker-style.js
function focal_point_picker_style_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* Internal dependencies
*/
const MediaWrapper = styled_base_browser_esm("div", {
target: "e11wezi70",
label: "MediaWrapper"
})( true ? {
name: "4wwkjz",
styles: "background-color:transparent;box-sizing:border-box;text-align:center;width:100%;"
} : undefined);
const MediaContainer = styled_base_browser_esm("div", {
target: "e11wezi71",
label: "MediaContainer"
})( true ? {
name: "1q0l1fq",
styles: "align-items:center;box-sizing:border-box;box-shadow:0 0 0 1px rgba( 0,0,0,0.2 );cursor:pointer;display:inline-flex;justify-content:center;margin:auto;position:relative;height:100%;img,video{box-sizing:border-box;display:block;height:auto;margin:0;max-height:100%;max-width:100%;pointer-events:none;user-select:none;width:auto;}"
} : undefined);
const MediaPlaceholder = styled_base_browser_esm("div", {
target: "e11wezi72",
label: "MediaPlaceholder"
})("background:", COLORS.lightGray[300], ";box-sizing:border-box;height:170px;max-width:280px;min-width:200px;width:100%;" + ( true ? "" : undefined));
const focal_point_picker_style_UnitControl = /*#__PURE__*/styled_base_browser_esm(unit_control, {
target: "e11wezi73",
label: "UnitControl"
})( true ? {
name: "v7v99c",
styles: "width:100px;"
} : undefined);
const ControlWrapper = /*#__PURE__*/styled_base_browser_esm(flex_component, {
target: "e11wezi74",
label: "ControlWrapper"
})( true ? {
name: "lqoi1w",
styles: "max-width:320px;padding:1em 0;"
} : undefined);
const GridView = styled_base_browser_esm("div", {
target: "e11wezi75",
label: "GridView"
})("box-sizing:border-box;left:50%;opacity:0;overflow:hidden;pointer-events:none;position:absolute;top:50%;transform:translate3d( -50%,-50%,0 );transition:opacity 120ms linear;z-index:1;", ({
isActive
}) => isActive && `
opacity: 1;
`, true ? "" : undefined);
const GridLine = styled_base_browser_esm("div", {
target: "e11wezi76",
label: "GridLine"
})( true ? {
name: "18dz4sk",
styles: "box-sizing:border-box;background:white;box-shadow:0 0 2px rgba( 0,0,0,0.6 );position:absolute;opacity:0.4;transform:translateZ( 0 );"
} : undefined);
const GridLineX = /*#__PURE__*/styled_base_browser_esm(GridLine, {
target: "e11wezi77",
label: "GridLineX"
})( true ? {
name: "1u4twh6",
styles: "height:1px;left:0;right:0;"
} : undefined);
const GridLineY = /*#__PURE__*/styled_base_browser_esm(GridLine, {
target: "e11wezi78",
label: "GridLineY"
})( true ? {
name: "13gvipf",
styles: "width:1px;top:0;bottom:0;"
} : undefined);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/utils.js
const INITIAL_BOUNDS = {
top: 0,
left: 0,
bottom: 0,
right: 0,
width: 0,
height: 0
};
const VIDEO_EXTENSIONS = ['avi', 'mpg', 'mpeg', 'mov', 'mp4', 'm4v', 'ogg', 'ogv', 'webm', 'wmv'];
/**
* Gets the extension of a file name.
*
* @param {string} filename The file name.
* @return {string} The extension of the file name.
*/
function getExtension(filename = '') {
const parts = filename.split('.');
return parts[parts.length - 1];
}
/**
* Checks if a file is a video.
*
* @param {string} filename The file name.
* @return {boolean} Whether the file is a video.
*/
function isVideoType(filename = '') {
if (!filename) return false;
return VIDEO_EXTENSIONS.includes(getExtension(filename));
}
/**
* Transforms a fraction value to a percentage value.
*
* @param {number} fraction The fraction value.
* @return {number} A percentage value.
*/
function fractionToPercentage(fraction) {
return Math.round(fraction * 100);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/controls.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const TEXTCONTROL_MIN = 0;
const TEXTCONTROL_MAX = 100;
function FocalPointPickerControls({
onChange = external_lodash_["noop"],
percentages = {
x: 0.5,
y: 0.5
}
}) {
const valueX = fractionToPercentage(percentages.x);
const valueY = fractionToPercentage(percentages.y);
const handleOnXChange = next => {
onChange({ ...percentages,
x: parseInt(next) / 100
});
};
const handleOnYChange = next => {
onChange({ ...percentages,
y: parseInt(next) / 100
});
};
return Object(external_wp_element_["createElement"])(ControlWrapper, {
className: "focal-point-picker__controls"
}, Object(external_wp_element_["createElement"])(controls_UnitControl, {
label: Object(external_wp_i18n_["__"])('Left'),
value: valueX,
onChange: handleOnXChange,
dragDirection: "e"
}), Object(external_wp_element_["createElement"])(controls_UnitControl, {
label: Object(external_wp_i18n_["__"])('Top'),
value: valueY,
onChange: handleOnYChange,
dragDirection: "s"
}));
}
function controls_UnitControl(props) {
return Object(external_wp_element_["createElement"])(focal_point_picker_style_UnitControl, Object(esm_extends["a" /* default */])({
className: "focal-point-picker__controls-position-unit-control",
labelPosition: "side",
max: TEXTCONTROL_MAX,
min: TEXTCONTROL_MIN,
unit: "%",
units: [{
value: '%',
label: '%'
}]
}, props));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/styles/focal-point-style.js
function focal_point_style_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const FocalPointWrapper = styled_base_browser_esm("div", {
target: "eas61re0",
label: "FocalPointWrapper"
})("background-color:transparent;box-sizing:border-box;cursor:grab;height:30px;margin:-15px 0 0 -15px;opacity:0.8;position:absolute;user-select:none;width:30px;will-change:transform;z-index:10000;", ({
isDragging
}) => isDragging && 'cursor: grabbing;', true ? "" : undefined);
const PointerIconSVG = /*#__PURE__*/styled_base_browser_esm(external_wp_primitives_["SVG"], {
target: "eas61re1",
label: "PointerIconSVG"
})( true ? {
name: "1fp1hff",
styles: "display:block;height:100%;left:0;position:absolute;top:0;width:100%;"
} : undefined);
const PointerIconPathOutline = /*#__PURE__*/styled_base_browser_esm(external_wp_primitives_["Path"], {
target: "eas61re2",
label: "PointerIconPathOutline"
})( true ? {
name: "j4aqsr",
styles: "fill:white;"
} : undefined);
const PointerIconPathFill = /*#__PURE__*/styled_base_browser_esm(external_wp_primitives_["Path"], {
target: "eas61re3",
label: "PointerIconPathFill"
})("fill:", COLORS.blue.wordpress[700], ";fill:", COLORS.ui.theme, ";" + ( true ? "" : undefined));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/focal-point.js
/**
* Internal dependencies
*/
/**
* External dependencies
*/
function FocalPoint({
coordinates = {
left: '50%',
top: '50%'
},
...props
}) {
const classes = classnames_default()('components-focal-point-picker__icon_container');
const style = {
left: coordinates.left,
top: coordinates.top
};
return Object(external_wp_element_["createElement"])(FocalPointWrapper, Object(esm_extends["a" /* default */])({}, props, {
className: classes,
style: style
}), Object(external_wp_element_["createElement"])(PointerIconSVG, {
className: "components-focal-point-picker__icon",
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 30 30"
}, Object(external_wp_element_["createElement"])(PointerIconPathOutline, {
className: "components-focal-point-picker__icon-outline",
d: "M15 1C7.3 1 1 7.3 1 15s6.3 14 14 14 14-6.3 14-14S22.7 1 15 1zm0 22c-4.4 0-8-3.6-8-8s3.6-8 8-8 8 3.6 8 8-3.6 8-8 8z"
}), Object(external_wp_element_["createElement"])(PointerIconPathFill, {
className: "components-focal-point-picker__icon-fill",
d: "M15 3C8.4 3 3 8.4 3 15s5.4 12 12 12 12-5.4 12-12S21.6 3 15 3zm0 22C9.5 25 5 20.5 5 15S9.5 5 15 5s10 4.5 10 10-4.5 10-10 10z"
})));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/grid.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const {
clearTimeout: grid_clearTimeout,
setTimeout: grid_setTimeout
} = typeof window !== 'undefined' ? window : {};
function FocalPointPickerGrid({
bounds = {},
value,
...props
}) {
const animationProps = useRevealAnimation(value);
const style = {
width: bounds.width,
height: bounds.height
};
return Object(external_wp_element_["createElement"])(GridView, Object(esm_extends["a" /* default */])({}, props, animationProps, {
className: "components-focal-point-picker__grid",
style: style
}), Object(external_wp_element_["createElement"])(GridLineX, {
style: {
top: '33%'
}
}), Object(external_wp_element_["createElement"])(GridLineX, {
style: {
top: '66%'
}
}), Object(external_wp_element_["createElement"])(GridLineY, {
style: {
left: '33%'
}
}), Object(external_wp_element_["createElement"])(GridLineY, {
style: {
left: '66%'
}
}));
}
/**
* Custom hook that renders the "flash" animation whenever the value changes.
*
* @param {string} value Value of (box) side.
*/
function useRevealAnimation(value) {
const [isActive, setIsActive] = Object(external_wp_element_["useState"])(false);
use_update_effect(() => {
setIsActive(true);
const timeout = grid_setTimeout(() => {
setIsActive(false);
}, 600);
return () => grid_clearTimeout(timeout);
}, [value]);
return {
isActive
};
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/media.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Media({
alt,
autoPlay,
src,
onLoad = external_lodash_["noop"],
mediaRef,
// Exposing muted prop for test rendering purposes
// https://github.com/testing-library/react-testing-library/issues/470
muted = true,
...props
}) {
if (!src) {
return Object(external_wp_element_["createElement"])(MediaPlaceholderElement, {
className: "components-focal-point-picker__media components-focal-point-picker__media--placeholder",
onLoad: onLoad,
mediaRef: mediaRef
});
}
const isVideo = isVideoType(src);
return isVideo ? Object(external_wp_element_["createElement"])("video", Object(esm_extends["a" /* default */])({}, props, {
autoPlay: autoPlay,
className: "components-focal-point-picker__media components-focal-point-picker__media--video",
loop: true,
muted: muted,
onLoadedData: onLoad,
ref: mediaRef,
src: src
})) : Object(external_wp_element_["createElement"])("img", Object(esm_extends["a" /* default */])({}, props, {
alt: alt,
className: "components-focal-point-picker__media components-focal-point-picker__media--image",
onLoad: onLoad,
ref: mediaRef,
src: src
}));
}
function MediaPlaceholderElement({
mediaRef,
onLoad = external_lodash_["noop"],
...props
}) {
const onLoadRef = Object(external_wp_element_["useRef"])(onLoad);
/**
* This async callback mimics the onLoad (img) / onLoadedData (video) callback
* for media elements. It is used in the main <FocalPointPicker /> component
* to calculate the dimensions + boundaries for positioning.
*/
Object(external_wp_element_["useLayoutEffect"])(() => {
window.requestAnimationFrame(() => {
onLoadRef.current();
});
}, []);
return Object(external_wp_element_["createElement"])(MediaPlaceholder, Object(esm_extends["a" /* default */])({
ref: mediaRef
}, props));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focal-point-picker/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
class focal_point_picker_FocalPointPicker extends external_wp_element_["Component"] {
constructor(props) {
super(...arguments);
this.state = {
isDragging: false,
bounds: INITIAL_BOUNDS,
percentages: props.value
};
this.containerRef = Object(external_wp_element_["createRef"])();
this.mediaRef = Object(external_wp_element_["createRef"])();
this.onMouseDown = this.startDrag.bind(this);
this.onMouseUp = this.stopDrag.bind(this);
this.onKeyDown = this.onKeyDown.bind(this);
this.onMouseMove = this.doDrag.bind(this);
this.ifDraggingStop = () => {
if (this.state.isDragging) {
this.stopDrag();
}
};
this.onChangeAtControls = value => {
this.updateValue(value);
this.props.onChange(value);
};
this.updateBounds = this.updateBounds.bind(this);
this.updateValue = this.updateValue.bind(this);
}
componentDidMount() {
const {
defaultView
} = this.containerRef.current.ownerDocument;
defaultView.addEventListener('resize', this.updateBounds);
/*
* Set initial bound values.
*
* This is necessary for Safari:
* https://github.com/WordPress/gutenberg/issues/25814
*/
this.updateBounds();
}
componentDidUpdate(prevProps) {
if (prevProps.url !== this.props.url) {
this.ifDraggingStop();
}
/*
* Handles cases where the incoming value changes.
* An example is the values resetting based on an UNDO action.
*/
const {
isDragging,
percentages: {
x,
y
}
} = this.state;
const {
value
} = this.props;
if (!isDragging && (value.x !== x || value.y !== y)) {
this.setState({
percentages: this.props.value
});
}
}
componentWillUnmount() {
const {
defaultView
} = this.containerRef.current.ownerDocument;
defaultView.removeEventListener('resize', this.updateBounds);
this.ifDraggingStop();
}
calculateBounds() {
const bounds = INITIAL_BOUNDS;
if (!this.mediaRef.current) {
return bounds;
} // Prevent division by zero when updateBounds runs in componentDidMount
if (this.mediaRef.current.clientWidth === 0 || this.mediaRef.current.clientHeight === 0) {
return bounds;
}
const dimensions = {
width: this.mediaRef.current.clientWidth,
height: this.mediaRef.current.clientHeight
};
const pickerDimensions = this.pickerDimensions();
const widthRatio = pickerDimensions.width / dimensions.width;
const heightRatio = pickerDimensions.height / dimensions.height;
if (heightRatio >= widthRatio) {
bounds.width = bounds.right = pickerDimensions.width;
bounds.height = dimensions.height * widthRatio;
bounds.top = (pickerDimensions.height - bounds.height) / 2;
bounds.bottom = bounds.top + bounds.height;
} else {
bounds.height = bounds.bottom = pickerDimensions.height;
bounds.width = dimensions.width * heightRatio;
bounds.left = (pickerDimensions.width - bounds.width) / 2;
bounds.right = bounds.left + bounds.width;
}
return bounds;
}
updateValue(nextValue = {}) {
const {
x,
y
} = nextValue;
const nextPercentage = {
x: parseFloat(x).toFixed(2),
y: parseFloat(y).toFixed(2)
};
this.setState({
percentages: nextPercentage
});
}
updateBounds() {
this.setState({
bounds: this.calculateBounds()
});
}
startDrag(event) {
var _this$props$onDragSta, _this$props;
event.persist();
this.containerRef.current.focus();
this.setState({
isDragging: true
});
const {
ownerDocument
} = this.containerRef.current;
ownerDocument.addEventListener('mouseup', this.onMouseUp);
ownerDocument.addEventListener('mousemove', this.onMouseMove);
const value = this.getValueFromPoint({
x: event.pageX,
y: event.pageY
}, event.shiftKey);
this.updateValue(value);
(_this$props$onDragSta = (_this$props = this.props).onDragStart) === null || _this$props$onDragSta === void 0 ? void 0 : _this$props$onDragSta.call(_this$props, value, event);
}
stopDrag(event) {
var _this$props$onDragEnd, _this$props2;
const {
ownerDocument
} = this.containerRef.current;
ownerDocument.removeEventListener('mouseup', this.onMouseUp);
ownerDocument.removeEventListener('mousemove', this.onMouseMove);
this.setState({
isDragging: false
}, () => {
this.props.onChange(this.state.percentages);
});
(_this$props$onDragEnd = (_this$props2 = this.props).onDragEnd) === null || _this$props$onDragEnd === void 0 ? void 0 : _this$props$onDragEnd.call(_this$props2, event);
}
onKeyDown(event) {
const {
keyCode,
shiftKey
} = event;
if (![external_wp_keycodes_["UP"], external_wp_keycodes_["DOWN"], external_wp_keycodes_["LEFT"], external_wp_keycodes_["RIGHT"]].includes(keyCode)) return;
event.preventDefault();
const next = { ...this.state.percentages
};
const step = shiftKey ? 0.1 : 0.01;
const delta = keyCode === external_wp_keycodes_["UP"] || keyCode === external_wp_keycodes_["LEFT"] ? -1 * step : step;
const axis = keyCode === external_wp_keycodes_["UP"] || keyCode === external_wp_keycodes_["DOWN"] ? 'y' : 'x';
const value = parseFloat(next[axis]) + delta;
next[axis] = roundClamp(value, 0, 1, step);
this.updateValue(next);
this.props.onChange(next);
}
doDrag(event) {
var _this$props$onDrag, _this$props3;
// Prevents text-selection when dragging.
event.preventDefault();
const value = this.getValueFromPoint({
x: event.pageX,
y: event.pageY
}, event.shiftKey);
this.updateValue(value);
(_this$props$onDrag = (_this$props3 = this.props).onDrag) === null || _this$props$onDrag === void 0 ? void 0 : _this$props$onDrag.call(_this$props3, value, event);
}
getValueFromPoint(point, byTenths) {
const {
bounds
} = this.state;
const pickerDimensions = this.pickerDimensions();
const relativePoint = {
left: point.x - pickerDimensions.left,
top: point.y - pickerDimensions.top
};
const left = Math.max(bounds.left, Math.min(relativePoint.left, bounds.right));
const top = Math.max(bounds.top, Math.min(relativePoint.top, bounds.bottom));
let nextX = (left - bounds.left) / (pickerDimensions.width - bounds.left * 2);
let nextY = (top - bounds.top) / (pickerDimensions.height - bounds.top * 2); // Enables holding shift to jump values by 10%
const step = byTenths ? 0.1 : 0.01;
nextX = roundClamp(nextX, 0, 1, step);
nextY = roundClamp(nextY, 0, 1, step);
return {
x: nextX,
y: nextY
};
}
pickerDimensions() {
const containerNode = this.containerRef.current;
if (!containerNode) {
return {
width: 0,
height: 0,
left: 0,
top: 0
};
}
const {
clientHeight,
clientWidth
} = containerNode;
const {
top,
left
} = containerNode.getBoundingClientRect();
return {
width: clientWidth,
height: clientHeight,
top: top + document.body.scrollTop,
left
};
}
iconCoordinates() {
const {
bounds,
percentages: {
x,
y
}
} = this.state;
if (bounds.left === undefined || bounds.top === undefined) {
return {
left: '50%',
top: '50%'
};
}
const {
width,
height
} = this.pickerDimensions();
return {
left: x * (width - bounds.left * 2) + bounds.left,
top: y * (height - bounds.top * 2) + bounds.top
};
}
render() {
const {
autoPlay,
className,
help,
instanceId,
label,
url
} = this.props;
const {
bounds,
isDragging,
percentages
} = this.state;
const iconCoordinates = this.iconCoordinates();
const classes = classnames_default()('components-focal-point-picker-control', className);
const id = `inspector-focal-point-picker-control-${instanceId}`;
return Object(external_wp_element_["createElement"])(base_control, {
label: label,
id: id,
help: help,
className: classes
}, Object(external_wp_element_["createElement"])(MediaWrapper, {
className: "components-focal-point-picker-wrapper"
}, Object(external_wp_element_["createElement"])(MediaContainer, {
className: "components-focal-point-picker",
onKeyDown: this.onKeyDown,
onMouseDown: this.onMouseDown,
onBlur: this.ifDraggingStop,
ref: this.containerRef,
role: "button",
tabIndex: "-1"
}, Object(external_wp_element_["createElement"])(FocalPointPickerGrid, {
bounds: bounds,
value: percentages.x + percentages.y
}), Object(external_wp_element_["createElement"])(Media, {
alt: Object(external_wp_i18n_["__"])('Media preview'),
autoPlay: autoPlay,
mediaRef: this.mediaRef,
onLoad: this.updateBounds,
src: url
}), Object(external_wp_element_["createElement"])(FocalPoint, {
coordinates: iconCoordinates,
isDragging: isDragging
}))), Object(external_wp_element_["createElement"])(FocalPointPickerControls, {
percentages: percentages,
onChange: this.onChangeAtControls
}));
}
}
focal_point_picker_FocalPointPicker.defaultProps = {
autoPlay: true,
value: {
x: 0.5,
y: 0.5
},
url: null
};
/* harmony default export */ var focal_point_picker = (Object(external_wp_compose_["withInstanceId"])(focal_point_picker_FocalPointPicker));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/focusable-iframe/index.js
/**
* WordPress dependencies
*/
function FocusableIframe({
iframeRef,
...props
}) {
const fallbackRef = Object(external_wp_element_["useRef"])();
const ref = Object(external_wp_compose_["useMergeRefs"])([iframeRef, fallbackRef]);
Object(external_wp_element_["useEffect"])(() => {
const iframe = fallbackRef.current;
const {
ownerDocument
} = iframe;
const {
defaultView
} = ownerDocument;
/**
* Checks whether the iframe is the activeElement, inferring that it has
* then received focus, and calls the `onFocus` prop callback.
*/
function checkFocus() {
if (ownerDocument.activeElement !== iframe) {
return;
}
iframe.focus();
}
defaultView.addEventListener('blur', checkFocus);
return () => {
defaultView.removeEventListener('blur', checkFocus);
};
}, []); // Disable reason: The rendered iframe is a pass-through component,
// assigning props inherited from the rendering parent. It's the
// responsibility of the parent to assign a title.
// eslint-disable-next-line jsx-a11y/iframe-has-title
return Object(external_wp_element_["createElement"])("iframe", Object(esm_extends["a" /* default */])({
ref: ref
}, props));
}
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/text-color.js
var text_color = __webpack_require__("uGfJ");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/utils.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* A float supported clamp function for a specific value.
*
* @param {number|null} value The value to clamp.
* @param {number} min The minimum value.
* @param {number} max The maximum value.
*
* @return {number} A (float) number
*/
function floatClamp(value, min, max) {
if (typeof value !== 'number') {
return null;
}
return parseFloat(Object(external_lodash_["clamp"])(value, min, max));
}
/**
* Hook to store a clamped value, derived from props.
*
* @param {Object} settings Hook settings.
* @param {number} settings.min The minimum value.
* @param {number} settings.max The maximum value.
* @param {number} settings.value The current value.
* @param {any} settings.initial The initial value.
*
* @return {[*, Function]} The controlled value and the value setter.
*/
function useControlledRangeValue({
min,
max,
value: valueProp,
initial
}) {
const [state, setInternalState] = use_controlled_state(floatClamp(valueProp, min, max), {
initial,
fallback: null
});
const setState = Object(external_wp_element_["useCallback"])(nextValue => {
if (nextValue === null) {
setInternalState(null);
} else {
setInternalState(floatClamp(nextValue, min, max));
}
}, [min, max]);
return [state, setState];
}
/**
* Hook to encapsulate the debouncing "hover" to better handle the showing
* and hiding of the Tooltip.
*
* @param {Object} settings Hook settings.
* @param {Function} [settings.onShow=noop] A callback function invoked when the element is shown.
* @param {Function} [settings.onHide=noop] A callback function invoked when the element is hidden.
* @param {Function} [settings.onMouseMove=noop] A callback function invoked when the mouse is moved.
* @param {Function} [settings.onMouseLeave=noop] A callback function invoked when the mouse is moved out of the element.
* @param {number} [settings.timeout=300] Timeout before the element is shown or hidden.
*
* @return {Object} Bound properties for use on a React.Node.
*/
function useDebouncedHoverInteraction({
onHide = external_lodash_["noop"],
onMouseLeave = external_lodash_["noop"],
onMouseMove = external_lodash_["noop"],
onShow = external_lodash_["noop"],
timeout = 300
}) {
const [show, setShow] = Object(external_wp_element_["useState"])(false);
const timeoutRef = Object(external_wp_element_["useRef"])();
const setDebouncedTimeout = Object(external_wp_element_["useCallback"])(callback => {
window.clearTimeout(timeoutRef.current);
timeoutRef.current = setTimeout(callback, timeout);
}, [timeout]);
const handleOnMouseMove = Object(external_wp_element_["useCallback"])(event => {
onMouseMove(event);
setDebouncedTimeout(() => {
if (!show) {
setShow(true);
onShow();
}
});
}, []);
const handleOnMouseLeave = Object(external_wp_element_["useCallback"])(event => {
onMouseLeave(event);
setDebouncedTimeout(() => {
setShow(false);
onHide();
});
}, []);
Object(external_wp_element_["useEffect"])(() => {
return () => {
window.clearTimeout(timeoutRef.current);
};
});
return {
onMouseMove: handleOnMouseMove,
onMouseLeave: handleOnMouseLeave
};
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/styles/range-control-styles.js
function range_control_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* External dependencies
*/
/**
* Internal dependencies
*/
var range_control_styles_ref = true ? {
name: "tdik1c",
styles: "height:30px;min-height:30px;"
} : undefined;
const rangeHeight = () => range_control_styles_ref;
const thumbSize = 20;
const range_control_styles_Root = styled_base_browser_esm("div", {
target: "exqw8y20",
label: "Root"
})( true ? {
name: "44oaj8",
styles: "-webkit-tap-highlight-color:transparent;box-sizing:border-box;align-items:flex-start;display:inline-flex;justify-content:flex-start;padding:0;position:relative;touch-action:none;width:100%;"
} : undefined);
const wrapperColor = ({
color: colorProp = COLORS.ui.borderFocus
}) => {
return /*#__PURE__*/css_browser_esm({
color: colorProp
}, true ? "" : undefined);
};
const wrapperMargin = ({
marks
}) => /*#__PURE__*/css_browser_esm({
marginBottom: marks ? 16 : null
}, true ? "" : undefined);
const range_control_styles_Wrapper = styled_base_browser_esm("div", {
target: "exqw8y21",
label: "Wrapper"
})("box-sizing:border-box;color:", COLORS.blue.medium.focus, ";display:block;flex:1;padding-top:15px;position:relative;width:100%;", wrapperColor, ";", rangeHeight, ";", wrapperMargin, ";", rtl_rtl({
marginLeft: 10
}), true ? "" : undefined);
const BeforeIconWrapper = styled_base_browser_esm("span", {
target: "exqw8y22",
label: "BeforeIconWrapper"
})("margin-top:3px;", rtl_rtl({
marginRight: 6
}), true ? "" : undefined);
const AfterIconWrapper = styled_base_browser_esm("span", {
target: "exqw8y23",
label: "AfterIconWrapper"
})("margin-top:3px;", rtl_rtl({
marginLeft: 16
}), true ? "" : undefined);
const railBackgroundColor = ({
disabled,
railColor
}) => {
let background = railColor || null;
if (disabled) {
background = COLORS.lightGray[400];
}
return /*#__PURE__*/css_browser_esm({
background
}, true ? "" : undefined);
};
const Rail = styled_base_browser_esm("span", {
target: "exqw8y24",
label: "Rail"
})("background-color:", COLORS.lightGray[600], ";box-sizing:border-box;left:0;pointer-events:none;right:0;display:block;height:3px;position:absolute;margin-top:14px;top:0;", railBackgroundColor, ";" + ( true ? "" : undefined));
const trackBackgroundColor = ({
disabled,
trackColor
}) => {
let background = trackColor || 'currentColor';
if (disabled) {
background = COLORS.lightGray[800];
}
return /*#__PURE__*/css_browser_esm({
background
}, true ? "" : undefined);
};
const Track = styled_base_browser_esm("span", {
target: "exqw8y25",
label: "Track"
})("background-color:currentColor;border-radius:1px;box-sizing:border-box;height:3px;pointer-events:none;display:block;position:absolute;margin-top:14px;top:0;", trackBackgroundColor, ";" + ( true ? "" : undefined));
const MarksWrapper = styled_base_browser_esm("span", {
target: "exqw8y26",
label: "MarksWrapper"
})( true ? {
name: "8d21nl",
styles: "box-sizing:border-box;display:block;pointer-events:none;position:relative;width:100%;user-select:none;"
} : undefined);
const markFill = ({
disabled,
isFilled
}) => {
let backgroundColor = isFilled ? 'currentColor' : COLORS.lightGray[600];
if (disabled) {
backgroundColor = COLORS.lightGray[800];
}
return /*#__PURE__*/css_browser_esm({
backgroundColor
}, true ? "" : undefined);
};
const Mark = styled_base_browser_esm("span", {
target: "exqw8y27",
label: "Mark"
})("box-sizing:border-box;height:9px;left:0;position:absolute;top:-4px;width:1px;", markFill, ";" + ( true ? "" : undefined));
const markLabelFill = ({
isFilled
}) => {
return /*#__PURE__*/css_browser_esm({
color: isFilled ? COLORS.darkGray[300] : COLORS.lightGray[600]
}, true ? "" : undefined);
};
const MarkLabel = styled_base_browser_esm("span", {
target: "exqw8y28",
label: "MarkLabel"
})("box-sizing:border-box;color:", COLORS.lightGray[600], ";left:0;font-size:11px;position:absolute;top:12px;transform:translateX( -50% );white-space:nowrap;", markLabelFill, ";" + ( true ? "" : undefined));
const ThumbWrapper = styled_base_browser_esm("span", {
target: "exqw8y29",
label: "ThumbWrapper"
})("align-items:center;box-sizing:border-box;display:flex;height:", thumbSize, "px;justify-content:center;margin-top:5px;outline:0;pointer-events:none;position:absolute;top:0;user-select:none;width:", thumbSize, "px;", rtl_rtl({
marginLeft: -10
}), true ? "" : undefined);
const thumbFocus = ({
isFocused
}) => {
return /*#__PURE__*/css_browser_esm({
borderColor: isFocused ? COLORS.ui.borderFocus : COLORS.darkGray[200],
boxShadow: isFocused ? `
0 0 0 1px ${COLORS.ui.borderFocus}
` : `
0 0 0 rgba(0, 0, 0, 0)
`
}, true ? "" : undefined);
};
const Thumb = styled_base_browser_esm("span", {
target: "exqw8y210",
label: "Thumb"
})("align-items:center;background-color:white;border-radius:50%;border:1px solid ", COLORS.darkGray[200], ";box-sizing:border-box;height:100%;outline:0;position:absolute;user-select:none;width:100%;", thumbFocus, ";" + ( true ? "" : undefined));
const InputRange = styled_base_browser_esm("input", {
target: "exqw8y211",
label: "InputRange"
})("box-sizing:border-box;cursor:pointer;display:block;height:100%;left:0;margin:0 -", thumbSize / 2, "px;opacity:0;outline:none;position:absolute;right:0;top:0;width:calc( 100% + ", thumbSize, "px );" + ( true ? "" : undefined));
const tooltipShow = ({
show
}) => {
return /*#__PURE__*/css_browser_esm({
opacity: show ? 1 : 0
}, true ? "" : undefined);
};
var range_control_styles_ref2 = true ? {
name: "5qqmyx",
styles: "top:-80%;"
} : undefined;
var range_control_styles_ref3 = true ? {
name: "eda4eg",
styles: "bottom:-80%;"
} : undefined;
const tooltipPosition = ({
position
}) => {
const isTop = position === 'top';
if (isTop) {
return range_control_styles_ref2;
}
return range_control_styles_ref3;
};
const range_control_styles_Tooltip = styled_base_browser_esm("span", {
target: "exqw8y212",
label: "Tooltip"
})("background:", COLORS.ui.border, ";border-radius:2px;box-sizing:border-box;color:white;display:inline-block;font-size:12px;min-width:32px;opacity:0;padding:4px 8px;pointer-events:none;position:absolute;text-align:center;transition:opacity 120ms ease;user-select:none;line-height:1.4;", tooltipShow, ";", tooltipPosition, ";", reduceMotion('transition'), ";", rtl_rtl({
transform: 'translateX(-50%)'
}, {
transform: 'translateX(50%)'
}), true ? "" : undefined); // @todo: Refactor RangeControl with latest HStack configuration
// @wordpress/components/ui/hstack
const InputNumber = /*#__PURE__*/styled_base_browser_esm(number_control, {
target: "exqw8y213",
label: "InputNumber"
})("box-sizing:border-box;display:inline-block;font-size:13px;margin-top:0;width:", space(8), " !important;input[type='number']&{", rangeHeight, ";}", rtl_rtl({
marginLeft: `${space(2)} !important`
}), true ? "" : undefined);
const ActionRightWrapper = styled_base_browser_esm("span", {
target: "exqw8y214",
label: "ActionRightWrapper"
})("box-sizing:border-box;display:block;margin-top:0;button,button.is-small{margin-left:0;", rangeHeight, ";}", rtl_rtl({
marginLeft: 8
}), true ? "" : undefined);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/input-range.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function input_range_InputRange({
describedBy,
isShiftStepEnabled = true,
label,
onHideTooltip = external_lodash_["noop"],
onMouseLeave = external_lodash_["noop"],
step = 1,
onBlur = external_lodash_["noop"],
onChange = external_lodash_["noop"],
onFocus = external_lodash_["noop"],
onMouseMove = external_lodash_["noop"],
onShowTooltip = external_lodash_["noop"],
shiftStep = 10,
value,
...props
}, ref) {
const jumpStep = use_jump_step({
step,
shiftStep,
isShiftStepEnabled
});
const hoverInteractions = useDebouncedHoverInteraction({
onHide: onHideTooltip,
onMouseLeave,
onMouseMove,
onShow: onShowTooltip
});
return Object(external_wp_element_["createElement"])(InputRange, Object(esm_extends["a" /* default */])({}, props, hoverInteractions, {
"aria-describedby": describedBy,
"aria-label": label,
"aria-hidden": false,
onBlur: onBlur,
onChange: onChange,
onFocus: onFocus,
ref: ref,
step: jumpStep,
tabIndex: 0,
type: "range",
value: value
}));
}
const input_range_ForwardedComponent = Object(external_wp_element_["forwardRef"])(input_range_InputRange);
/* harmony default export */ var input_range = (input_range_ForwardedComponent);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/mark.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function RangeMark({
className,
isFilled = false,
label,
style = {},
...props
}) {
const classes = classnames_default()('components-range-control__mark', isFilled && 'is-filled', className);
const labelClasses = classnames_default()('components-range-control__mark-label', isFilled && 'is-filled');
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(Mark, Object(esm_extends["a" /* default */])({}, props, {
"aria-hidden": "true",
className: classes,
isFilled: isFilled,
style: style
})), label && Object(external_wp_element_["createElement"])(MarkLabel, {
"aria-hidden": "true",
className: labelClasses,
isFilled: isFilled,
style: style
}, label));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/rail.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function RangeRail({
disabled = false,
marks = false,
min = 0,
max = 100,
step = 1,
value = 0,
...restProps
}) {
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(Rail, Object(esm_extends["a" /* default */])({
disabled: disabled
}, restProps)), marks && Object(external_wp_element_["createElement"])(Marks, {
disabled: disabled,
marks: marks,
min: min,
max: max,
step: step,
value: value
}));
}
function Marks({
disabled = false,
marks = false,
min = 0,
max = 100,
step = 1,
value = 0
}) {
const marksData = useMarks({
marks,
min,
max,
step,
value
});
return Object(external_wp_element_["createElement"])(MarksWrapper, {
"aria-hidden": "true",
className: "components-range-control__marks"
}, marksData.map(mark => Object(external_wp_element_["createElement"])(RangeMark, Object(esm_extends["a" /* default */])({}, mark, {
key: mark.key,
"aria-hidden": "true",
disabled: disabled
}))));
}
function useMarks({
marks,
min = 0,
max = 100,
step = 1,
value = 0
}) {
if (!marks) {
return [];
}
const range = max - min;
if (!Array.isArray(marks)) {
marks = [];
const count = 1 + Math.round(range / step);
while (count > marks.push({
value: step * marks.length + min
}));
}
const placedMarks = [];
marks.forEach((mark, index) => {
if (mark.value < min || mark.value > max) {
return;
}
const key = `mark-${index}`;
const isFilled = mark.value <= value;
const offset = `${(mark.value - min) / range * 100}%`;
const offsetStyle = {
[Object(external_wp_i18n_["isRTL"])() ? 'right' : 'left']: offset
};
placedMarks.push({ ...mark,
isFilled,
key,
style: offsetStyle
});
});
return placedMarks;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/tooltip.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const TOOLTIP_OFFSET_HEIGHT = 32;
function SimpleTooltip({
className,
inputRef,
position: positionProp = 'auto',
show = false,
style = {},
value = 0,
renderTooltipContent = v => v,
zIndex = 100,
...restProps
}) {
const position = useTooltipPosition({
inputRef,
position: positionProp
});
const classes = classnames_default()('components-simple-tooltip', className);
const styles = { ...style,
zIndex
};
return Object(external_wp_element_["createElement"])(range_control_styles_Tooltip, Object(esm_extends["a" /* default */])({}, restProps, {
"aria-hidden": show,
className: classes,
position: position,
show: show,
role: "tooltip",
style: styles
}), renderTooltipContent(value));
}
function useTooltipPosition({
inputRef,
position: positionProp
}) {
const [position, setPosition] = Object(external_wp_element_["useState"])('top');
const calculatePosition = Object(external_wp_element_["useCallback"])(() => {
if (inputRef && inputRef.current) {
let nextPosition = positionProp;
if (positionProp === 'auto') {
const {
top
} = inputRef.current.getBoundingClientRect();
const isOffscreenTop = top - TOOLTIP_OFFSET_HEIGHT < 0;
nextPosition = isOffscreenTop ? 'bottom' : 'top';
}
setPosition(nextPosition);
}
}, [positionProp]);
Object(external_wp_element_["useEffect"])(() => {
calculatePosition();
}, [calculatePosition]);
Object(external_wp_element_["useEffect"])(() => {
window.addEventListener('resize', calculatePosition);
return () => {
window.removeEventListener('resize', calculatePosition);
};
});
return position;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/range-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function RangeControl({
afterIcon,
allowReset = false,
beforeIcon,
className,
currentInput,
color: colorProp = COLORS.ui.theme,
disabled = false,
help,
initialPosition,
isShiftStepEnabled = true,
label,
marks = false,
max = 100,
min = 0,
onBlur = external_lodash_["noop"],
onChange = external_lodash_["noop"],
onFocus = external_lodash_["noop"],
onMouseMove = external_lodash_["noop"],
onMouseLeave = external_lodash_["noop"],
railColor,
resetFallbackValue,
renderTooltipContent = v => v,
showTooltip: showTooltipProp,
shiftStep = 10,
step = 1,
trackColor,
value: valueProp,
withInputField = true,
...props
}, ref) {
var _inputRef$current;
const [value, setValue] = useControlledRangeValue({
min,
max,
value: valueProp,
initial: initialPosition
});
const isResetPendent = Object(external_wp_element_["useRef"])(false);
const [showTooltip, setShowTooltip] = Object(external_wp_element_["useState"])(showTooltipProp);
const [isFocused, setIsFocused] = Object(external_wp_element_["useState"])(false);
const inputRef = Object(external_wp_element_["useRef"])();
const setRef = nodeRef => {
inputRef.current = nodeRef;
if (ref) {
ref(nodeRef);
}
};
const isCurrentlyFocused = (_inputRef$current = inputRef.current) === null || _inputRef$current === void 0 ? void 0 : _inputRef$current.matches(':focus');
const isThumbFocused = !disabled && isFocused;
const isValueReset = value === null;
const currentValue = value !== undefined ? value : currentInput;
const inputSliderValue = isValueReset ? '' : currentValue;
const rangeFillValue = isValueReset ? (max - min) / 2 + min : value;
const calculatedFillValue = (value - min) / (max - min) * 100;
const fillValue = isValueReset ? 50 : calculatedFillValue;
const fillValueOffset = `${Object(external_lodash_["clamp"])(fillValue, 0, 100)}%`;
const classes = classnames_default()('components-range-control', className);
const wrapperClasses = classnames_default()('components-range-control__wrapper', !!marks && 'is-marked');
const id = Object(external_wp_compose_["useInstanceId"])(RangeControl, 'inspector-range-control');
const describedBy = !!help ? `${id}__help` : undefined;
const enableTooltip = showTooltipProp !== false && Object(external_lodash_["isFinite"])(value);
const handleOnRangeChange = event => {
const nextValue = parseFloat(event.target.value);
setValue(nextValue);
onChange(nextValue);
};
const handleOnChange = nextValue => {
nextValue = parseFloat(nextValue);
setValue(nextValue);
/*
* Calls onChange only when nextValue is numeric
* otherwise may queue a reset for the blur event.
*/
if (!isNaN(nextValue)) {
if (nextValue < min || nextValue > max) {
nextValue = floatClamp(nextValue, min, max);
}
onChange(nextValue);
isResetPendent.current = false;
} else if (allowReset) {
isResetPendent.current = true;
}
};
const handleOnInputNumberBlur = () => {
if (isResetPendent.current) {
handleOnReset();
isResetPendent.current = false;
}
};
const handleOnReset = () => {
let resetValue = parseFloat(resetFallbackValue);
let onChangeResetValue = resetValue;
if (isNaN(resetValue)) {
resetValue = null;
onChangeResetValue = undefined;
}
setValue(resetValue);
/**
* Previously, this callback would always receive undefined as
* an argument. This behavior is unexpected, specifically
* when resetFallbackValue is defined.
*
* The value of undefined is not ideal. Passing it through
* to internal <input /> elements would change it from a
* controlled component to an uncontrolled component.
*
* For now, to minimize unexpected regressions, we're going to
* preserve the undefined callback argument, except when a
* resetFallbackValue is defined.
*/
onChange(onChangeResetValue);
};
const handleShowTooltip = () => setShowTooltip(true);
const handleHideTooltip = () => setShowTooltip(false);
const handleOnBlur = event => {
onBlur(event);
setIsFocused(false);
handleHideTooltip();
};
const handleOnFocus = event => {
onFocus(event);
setIsFocused(true);
handleShowTooltip();
};
const offsetStyle = {
[Object(external_wp_i18n_["isRTL"])() ? 'right' : 'left']: fillValueOffset
};
return Object(external_wp_element_["createElement"])(base_control, {
className: classes,
label: label,
id: id,
help: help
}, Object(external_wp_element_["createElement"])(range_control_styles_Root, {
className: "components-range-control__root"
}, beforeIcon && Object(external_wp_element_["createElement"])(BeforeIconWrapper, null, Object(external_wp_element_["createElement"])(components_build_module_icon["a" /* default */], {
icon: beforeIcon
})), Object(external_wp_element_["createElement"])(range_control_styles_Wrapper, {
className: wrapperClasses,
color: colorProp,
marks: !!marks
}, Object(external_wp_element_["createElement"])(input_range, Object(esm_extends["a" /* default */])({}, props, {
className: "components-range-control__slider",
describedBy: describedBy,
disabled: disabled,
id: id,
isShiftStepEnabled: isShiftStepEnabled,
label: label,
max: max,
min: min,
onBlur: handleOnBlur,
onChange: handleOnRangeChange,
onFocus: handleOnFocus,
onMouseMove: onMouseMove,
onMouseLeave: onMouseLeave,
ref: setRef,
shiftStep: shiftStep,
step: step,
value: inputSliderValue
})), Object(external_wp_element_["createElement"])(RangeRail, {
"aria-hidden": true,
disabled: disabled,
marks: marks,
max: max,
min: min,
railColor: railColor,
step: step,
value: rangeFillValue
}), Object(external_wp_element_["createElement"])(Track, {
"aria-hidden": true,
className: "components-range-control__track",
disabled: disabled,
style: {
width: fillValueOffset
},
trackColor: trackColor
}), Object(external_wp_element_["createElement"])(ThumbWrapper, {
style: offsetStyle
}, Object(external_wp_element_["createElement"])(Thumb, {
"aria-hidden": true,
isFocused: isThumbFocused
})), enableTooltip && Object(external_wp_element_["createElement"])(SimpleTooltip, {
className: "components-range-control__tooltip",
inputRef: inputRef,
renderTooltipContent: renderTooltipContent,
show: isCurrentlyFocused || showTooltip,
style: offsetStyle,
value: value
})), afterIcon && Object(external_wp_element_["createElement"])(AfterIconWrapper, null, Object(external_wp_element_["createElement"])(components_build_module_icon["a" /* default */], {
icon: afterIcon
})), withInputField && Object(external_wp_element_["createElement"])(InputNumber, {
"aria-label": label,
className: "components-range-control__number",
disabled: disabled,
inputMode: "decimal",
isShiftStepEnabled: isShiftStepEnabled,
max: max,
min: min,
onBlur: handleOnInputNumberBlur,
onChange: handleOnChange,
shiftStep: shiftStep,
step: step,
value: inputSliderValue
}), allowReset && Object(external_wp_element_["createElement"])(ActionRightWrapper, null, Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
className: "components-range-control__reset",
disabled: disabled || value === undefined,
isSecondary: true,
isSmall: true,
onClick: handleOnReset
}, Object(external_wp_i18n_["__"])('Reset')))));
}
const range_control_ForwardedComponent = Object(external_wp_element_["forwardRef"])(RangeControl);
/* harmony default export */ var range_control = (range_control_ForwardedComponent);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/font-size-picker/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const DEFAULT_FONT_SIZE = 'default';
const CUSTOM_FONT_SIZE = 'custom';
const MAX_FONT_SIZE_DISPLAY = '25px';
function getSelectValueFromFontSize(fontSizes, value) {
if (value) {
const fontSizeValue = fontSizes.find(font => font.size === value);
return fontSizeValue ? fontSizeValue.slug : CUSTOM_FONT_SIZE;
}
return DEFAULT_FONT_SIZE;
}
function getSelectOptions(optionsArray, disableCustomFontSizes) {
if (disableCustomFontSizes && !optionsArray.length) {
return null;
}
optionsArray = [{
slug: DEFAULT_FONT_SIZE,
name: Object(external_wp_i18n_["__"])('Default')
}, ...optionsArray, ...(disableCustomFontSizes ? [] : [{
slug: CUSTOM_FONT_SIZE,
name: Object(external_wp_i18n_["__"])('Custom')
}])];
return optionsArray.map(option => ({
key: option.slug,
name: option.name,
size: option.size,
style: {
fontSize: `min( ${option.size}, ${MAX_FONT_SIZE_DISPLAY} )`
}
}));
}
function FontSizePicker({
fallbackFontSize,
fontSizes = [],
disableCustomFontSizes = false,
onChange,
value,
withSlider = false
}, ref) {
const hasUnits = Object(external_lodash_["isString"])(value) || fontSizes[0] && Object(external_lodash_["isString"])(fontSizes[0].size);
let noUnitsValue;
if (!hasUnits) {
noUnitsValue = value;
} else {
noUnitsValue = parseInt(value);
}
const isPixelValue = Object(external_lodash_["isNumber"])(value) || Object(external_lodash_["isString"])(value) && value.endsWith('px');
const units = useCustomUnits({
availableUnits: ['px', 'em', 'rem']
});
const options = Object(external_wp_element_["useMemo"])(() => getSelectOptions(fontSizes, disableCustomFontSizes), [fontSizes, disableCustomFontSizes]);
if (!options) {
return null;
}
const selectedFontSizeSlug = getSelectValueFromFontSize(fontSizes, value);
return Object(external_wp_element_["createElement"])("fieldset", Object(esm_extends["a" /* default */])({
className: "components-font-size-picker"
}, ref ? {} : {
ref
}), Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], {
as: "legend"
}, Object(external_wp_i18n_["__"])('Font size')), Object(external_wp_element_["createElement"])("div", {
className: "components-font-size-picker__controls"
}, fontSizes.length > 0 && Object(external_wp_element_["createElement"])(CustomSelectControl, {
className: 'components-font-size-picker__select',
label: Object(external_wp_i18n_["__"])('Font size'),
options: options,
value: options.find(option => option.key === selectedFontSizeSlug),
onChange: ({
selectedItem
}) => {
if (hasUnits) {
onChange(selectedItem.size);
} else {
onChange(Number(selectedItem.size));
}
}
}), !withSlider && !disableCustomFontSizes && Object(external_wp_element_["createElement"])(unit_control, {
label: Object(external_wp_i18n_["__"])('Custom'),
labelPosition: "top",
__unstableInputWidth: "60px",
value: value,
onChange: nextSize => {
if (0 === parseFloat(nextSize) || !nextSize) {
onChange(undefined);
} else {
onChange(nextSize);
}
},
units: units
}), Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
className: "components-color-palette__clear",
disabled: value === undefined,
onClick: () => {
onChange(undefined);
},
isSmall: true,
isSecondary: true
}, Object(external_wp_i18n_["__"])('Reset'))), withSlider && Object(external_wp_element_["createElement"])(range_control, {
className: "components-font-size-picker__custom-input",
label: Object(external_wp_i18n_["__"])('Custom Size'),
value: isPixelValue && noUnitsValue || '',
initialPosition: fallbackFontSize,
onChange: newValue => {
onChange(hasUnits ? newValue + 'px' : newValue);
},
min: 12,
max: 100,
beforeIcon: text_color["a" /* default */],
afterIcon: text_color["a" /* default */]
}));
}
/* harmony default export */ var font_size_picker = (Object(external_wp_element_["forwardRef"])(FontSizePicker));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-file-upload/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function FormFileUpload({
accept,
children,
multiple = false,
onChange,
render,
...props
}) {
const ref = Object(external_wp_element_["useRef"])();
const openFileDialog = () => {
ref.current.click();
};
const ui = render ? render({
openFileDialog
}) : Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], Object(esm_extends["a" /* default */])({
onClick: openFileDialog
}, props), children);
return Object(external_wp_element_["createElement"])("div", {
className: "components-form-file-upload"
}, ui, Object(external_wp_element_["createElement"])("input", {
type: "file",
ref: ref,
multiple: multiple,
style: {
display: 'none'
},
accept: accept,
onChange: onChange
}));
}
/* harmony default export */ var form_file_upload = (FormFileUpload);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-toggle/index.js
/**
* External dependencies
*/
function FormToggle({
className,
checked,
id,
disabled,
onChange = external_lodash_["noop"],
...props
}) {
const wrapperClasses = classnames_default()('components-form-toggle', className, {
'is-checked': checked,
'is-disabled': disabled
});
return Object(external_wp_element_["createElement"])("span", {
className: wrapperClasses
}, Object(external_wp_element_["createElement"])("input", Object(esm_extends["a" /* default */])({
className: "components-form-toggle__input",
id: id,
type: "checkbox",
checked: checked,
onChange: onChange,
disabled: disabled
}, props)), Object(external_wp_element_["createElement"])("span", {
className: "components-form-toggle__track"
}), Object(external_wp_element_["createElement"])("span", {
className: "components-form-toggle__thumb"
}));
}
/* harmony default export */ var form_toggle = (FormToggle);
// EXTERNAL MODULE: external ["wp","isShallowEqual"]
var external_wp_isShallowEqual_ = __webpack_require__("rl8x");
var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-token-field/token.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Token({
value,
status,
title,
displayTransform,
isBorderless = false,
disabled = false,
onClickRemove = external_lodash_["noop"],
onMouseEnter,
onMouseLeave,
messages,
termPosition,
termsCount
}) {
const instanceId = Object(external_wp_compose_["useInstanceId"])(Token);
const tokenClasses = classnames_default()('components-form-token-field__token', {
'is-error': 'error' === status,
'is-success': 'success' === status,
'is-validating': 'validating' === status,
'is-borderless': isBorderless,
'is-disabled': disabled
});
const onClick = () => onClickRemove({
value
});
const transformedValue = displayTransform(value);
const termPositionAndCount = Object(external_wp_i18n_["sprintf"])(
/* translators: 1: term name, 2: term position in a set of terms, 3: total term set count. */
Object(external_wp_i18n_["__"])('%1$s (%2$s of %3$s)'), transformedValue, termPosition, termsCount);
return Object(external_wp_element_["createElement"])("span", {
className: tokenClasses,
onMouseEnter: onMouseEnter,
onMouseLeave: onMouseLeave,
title: title
}, Object(external_wp_element_["createElement"])("span", {
className: "components-form-token-field__token-text",
id: `components-form-token-field__token-text-${instanceId}`
}, Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], {
as: "span"
}, termPositionAndCount), Object(external_wp_element_["createElement"])("span", {
"aria-hidden": "true"
}, transformedValue)), Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
className: "components-form-token-field__remove-token",
icon: close_small["a" /* default */],
onClick: !disabled && onClick,
label: messages.remove,
"aria-describedby": `components-form-token-field__token-text-${instanceId}`
}));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-spoken-messages/index.js
/**
* WordPress dependencies
*/
/**
* A Higher Order Component used to be provide speak and debounced speak
* functions.
*
* @see https://developer.wordpress.org/block-editor/packages/packages-a11y/#speak
*
* @param {WPComponent} Component The component to be wrapped.
*
* @return {WPComponent} The wrapped component.
*/
/* harmony default export */ var with_spoken_messages = (Object(external_wp_compose_["createHigherOrderComponent"])(Component => props => Object(external_wp_element_["createElement"])(Component, Object(esm_extends["a" /* default */])({}, props, {
speak: external_wp_a11y_["speak"],
debouncedSpeak: Object(external_wp_compose_["useDebounce"])(external_wp_a11y_["speak"], 500)
})), 'withSpokenMessages'));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/form-token-field/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const form_token_field_initialState = {
incompleteTokenValue: '',
inputOffsetFromEnd: 0,
isActive: false,
isExpanded: false,
selectedSuggestionIndex: -1,
selectedSuggestionScroll: false
};
class form_token_field_FormTokenField extends external_wp_element_["Component"] {
constructor() {
super(...arguments);
this.state = form_token_field_initialState;
this.onKeyDown = this.onKeyDown.bind(this);
this.onKeyPress = this.onKeyPress.bind(this);
this.onFocus = this.onFocus.bind(this);
this.onBlur = this.onBlur.bind(this);
this.deleteTokenBeforeInput = this.deleteTokenBeforeInput.bind(this);
this.deleteTokenAfterInput = this.deleteTokenAfterInput.bind(this);
this.addCurrentToken = this.addCurrentToken.bind(this);
this.onContainerTouched = this.onContainerTouched.bind(this);
this.renderToken = this.renderToken.bind(this);
this.onTokenClickRemove = this.onTokenClickRemove.bind(this);
this.onSuggestionHovered = this.onSuggestionHovered.bind(this);
this.onSuggestionSelected = this.onSuggestionSelected.bind(this);
this.onInputChange = this.onInputChange.bind(this);
this.bindInput = this.bindInput.bind(this);
this.bindTokensAndInput = this.bindTokensAndInput.bind(this);
this.updateSuggestions = this.updateSuggestions.bind(this);
}
componentDidUpdate(prevProps) {
// Make sure to focus the input when the isActive state is true.
if (this.state.isActive && !this.input.hasFocus()) {
this.input.focus();
}
const {
suggestions,
value
} = this.props;
const suggestionsDidUpdate = !external_wp_isShallowEqual_default()(suggestions, prevProps.suggestions);
if (suggestionsDidUpdate || value !== prevProps.value) {
this.updateSuggestions(suggestionsDidUpdate);
}
}
static getDerivedStateFromProps(props, state) {
if (!props.disabled || !state.isActive) {
return null;
}
return {
isActive: false,
incompleteTokenValue: ''
};
}
bindInput(ref) {
this.input = ref;
}
bindTokensAndInput(ref) {
this.tokensAndInput = ref;
}
onFocus(event) {
const {
__experimentalExpandOnFocus
} = this.props; // If focus is on the input or on the container, set the isActive state to true.
if (this.input.hasFocus() || event.target === this.tokensAndInput) {
this.setState({
isActive: true,
isExpanded: !!__experimentalExpandOnFocus || this.state.isExpanded
});
} else {
/*
* Otherwise, focus is on one of the token "remove" buttons and we
* set the isActive state to false to prevent the input to be
* re-focused, see componentDidUpdate().
*/
this.setState({
isActive: false
});
}
if ('function' === typeof this.props.onFocus) {
this.props.onFocus(event);
}
}
onBlur() {
if (this.inputHasValidValue()) {
this.setState({
isActive: false
});
} else {
this.setState(form_token_field_initialState);
}
}
onKeyDown(event) {
let preventDefault = false;
switch (event.keyCode) {
case external_wp_keycodes_["BACKSPACE"]:
preventDefault = this.handleDeleteKey(this.deleteTokenBeforeInput);
break;
case external_wp_keycodes_["ENTER"]:
preventDefault = this.addCurrentToken();
break;
case external_wp_keycodes_["LEFT"]:
preventDefault = this.handleLeftArrowKey();
break;
case external_wp_keycodes_["UP"]:
preventDefault = this.handleUpArrowKey();
break;
case external_wp_keycodes_["RIGHT"]:
preventDefault = this.handleRightArrowKey();
break;
case external_wp_keycodes_["DOWN"]:
preventDefault = this.handleDownArrowKey();
break;
case external_wp_keycodes_["DELETE"]:
preventDefault = this.handleDeleteKey(this.deleteTokenAfterInput);
break;
case external_wp_keycodes_["SPACE"]:
if (this.props.tokenizeOnSpace) {
preventDefault = this.addCurrentToken();
}
break;
case external_wp_keycodes_["ESCAPE"]:
preventDefault = this.handleEscapeKey(event);
event.stopPropagation();
break;
default:
break;
}
if (preventDefault) {
event.preventDefault();
}
}
onKeyPress(event) {
let preventDefault = false;
switch (event.charCode) {
case 44:
// comma
preventDefault = this.handleCommaKey();
break;
default:
break;
}
if (preventDefault) {
event.preventDefault();
}
}
onContainerTouched(event) {
// Prevent clicking/touching the tokensAndInput container from blurring
// the input and adding the current token.
if (event.target === this.tokensAndInput && this.state.isActive) {
event.preventDefault();
}
}
onTokenClickRemove(event) {
this.deleteToken(event.value);
this.input.focus();
}
onSuggestionHovered(suggestion) {
const index = this.getMatchingSuggestions().indexOf(suggestion);
if (index >= 0) {
this.setState({
selectedSuggestionIndex: index,
selectedSuggestionScroll: false
});
}
}
onSuggestionSelected(suggestion) {
this.addNewToken(suggestion);
}
onInputChange(event) {
const text = event.value;
const separator = this.props.tokenizeOnSpace ? /[ ,\t]+/ : /[,\t]+/;
const items = text.split(separator);
const tokenValue = Object(external_lodash_["last"])(items) || '';
if (items.length > 1) {
this.addNewTokens(items.slice(0, -1));
}
this.setState({
incompleteTokenValue: tokenValue
}, this.updateSuggestions);
this.props.onInputChange(tokenValue);
}
handleDeleteKey(deleteToken) {
let preventDefault = false;
if (this.input.hasFocus() && this.isInputEmpty()) {
deleteToken();
preventDefault = true;
}
return preventDefault;
}
handleLeftArrowKey() {
let preventDefault = false;
if (this.isInputEmpty()) {
this.moveInputBeforePreviousToken();
preventDefault = true;
}
return preventDefault;
}
handleRightArrowKey() {
let preventDefault = false;
if (this.isInputEmpty()) {
this.moveInputAfterNextToken();
preventDefault = true;
}
return preventDefault;
}
handleUpArrowKey() {
this.setState((state, props) => ({
selectedSuggestionIndex: (state.selectedSuggestionIndex === 0 ? this.getMatchingSuggestions(state.incompleteTokenValue, props.suggestions, props.value, props.maxSuggestions, props.saveTransform).length : state.selectedSuggestionIndex) - 1,
selectedSuggestionScroll: true
}));
return true; // preventDefault
}
handleDownArrowKey() {
this.setState((state, props) => ({
selectedSuggestionIndex: (state.selectedSuggestionIndex + 1) % this.getMatchingSuggestions(state.incompleteTokenValue, props.suggestions, props.value, props.maxSuggestions, props.saveTransform).length,
selectedSuggestionScroll: true
}));
return true; // preventDefault
}
handleEscapeKey(event) {
this.setState({
incompleteTokenValue: event.target.value,
isExpanded: false,
selectedSuggestionIndex: -1,
selectedSuggestionScroll: false
});
return true; // preventDefault
}
handleCommaKey() {
if (this.inputHasValidValue()) {
this.addNewToken(this.state.incompleteTokenValue);
}
return true; // preventDefault
}
moveInputToIndex(index) {
this.setState((state, props) => ({
inputOffsetFromEnd: props.value.length - Math.max(index, -1) - 1
}));
}
moveInputBeforePreviousToken() {
this.setState((state, props) => ({
inputOffsetFromEnd: Math.min(state.inputOffsetFromEnd + 1, props.value.length)
}));
}
moveInputAfterNextToken() {
this.setState(state => ({
inputOffsetFromEnd: Math.max(state.inputOffsetFromEnd - 1, 0)
}));
}
deleteTokenBeforeInput() {
const index = this.getIndexOfInput() - 1;
if (index > -1) {
this.deleteToken(this.props.value[index]);
}
}
deleteTokenAfterInput() {
const index = this.getIndexOfInput();
if (index < this.props.value.length) {
this.deleteToken(this.props.value[index]); // update input offset since it's the offset from the last token
this.moveInputToIndex(index);
}
}
addCurrentToken() {
let preventDefault = false;
const selectedSuggestion = this.getSelectedSuggestion();
if (selectedSuggestion) {
this.addNewToken(selectedSuggestion);
preventDefault = true;
} else if (this.inputHasValidValue()) {
this.addNewToken(this.state.incompleteTokenValue);
preventDefault = true;
}
return preventDefault;
}
addNewTokens(tokens) {
const tokensToAdd = Object(external_lodash_["uniq"])(tokens.map(this.props.saveTransform).filter(Boolean).filter(token => !this.valueContainsToken(token)));
if (tokensToAdd.length > 0) {
const newValue = Object(external_lodash_["clone"])(this.props.value);
newValue.splice.apply(newValue, [this.getIndexOfInput(), 0].concat(tokensToAdd));
this.props.onChange(newValue);
}
}
addNewToken(token) {
const {
__experimentalExpandOnFocus,
__experimentalValidateInput
} = this.props;
if (!__experimentalValidateInput(token)) {
this.props.speak(this.props.messages.__experimentalInvalid, 'assertive');
return;
}
this.addNewTokens([token]);
this.props.speak(this.props.messages.added, 'assertive');
this.setState({
incompleteTokenValue: '',
selectedSuggestionIndex: -1,
selectedSuggestionScroll: false,
isExpanded: !__experimentalExpandOnFocus
});
if (this.state.isActive) {
this.input.focus();
}
}
deleteToken(token) {
const newTokens = this.props.value.filter(item => {
return this.getTokenValue(item) !== this.getTokenValue(token);
});
this.props.onChange(newTokens);
this.props.speak(this.props.messages.removed, 'assertive');
}
getTokenValue(token) {
if ('object' === typeof token) {
return token.value;
}
return token;
}
getMatchingSuggestions(searchValue = this.state.incompleteTokenValue, suggestions = this.props.suggestions, value = this.props.value, maxSuggestions = this.props.maxSuggestions, saveTransform = this.props.saveTransform) {
let match = saveTransform(searchValue);
const startsWithMatch = [];
const containsMatch = [];
if (match.length === 0) {
suggestions = Object(external_lodash_["difference"])(suggestions, value);
} else {
match = match.toLocaleLowerCase();
Object(external_lodash_["each"])(suggestions, suggestion => {
const index = suggestion.toLocaleLowerCase().indexOf(match);
if (value.indexOf(suggestion) === -1) {
if (index === 0) {
startsWithMatch.push(suggestion);
} else if (index > 0) {
containsMatch.push(suggestion);
}
}
});
suggestions = startsWithMatch.concat(containsMatch);
}
return Object(external_lodash_["take"])(suggestions, maxSuggestions);
}
getSelectedSuggestion() {
if (this.state.selectedSuggestionIndex !== -1) {
return this.getMatchingSuggestions()[this.state.selectedSuggestionIndex];
}
}
valueContainsToken(token) {
return Object(external_lodash_["some"])(this.props.value, item => {
return this.getTokenValue(token) === this.getTokenValue(item);
});
}
getIndexOfInput() {
return this.props.value.length - this.state.inputOffsetFromEnd;
}
isInputEmpty() {
return this.state.incompleteTokenValue.length === 0;
}
inputHasValidValue() {
return this.props.saveTransform(this.state.incompleteTokenValue).length > 0;
}
updateSuggestions(resetSelectedSuggestion = true) {
const {
__experimentalExpandOnFocus
} = this.props;
const {
incompleteTokenValue
} = this.state;
const inputHasMinimumChars = incompleteTokenValue.trim().length > 1;
const matchingSuggestions = this.getMatchingSuggestions(incompleteTokenValue);
const hasMatchingSuggestions = matchingSuggestions.length > 0;
const newState = {
isExpanded: __experimentalExpandOnFocus || inputHasMinimumChars && hasMatchingSuggestions
};
if (resetSelectedSuggestion) {
newState.selectedSuggestionIndex = -1;
newState.selectedSuggestionScroll = false;
}
this.setState(newState);
if (inputHasMinimumChars) {
const {
debouncedSpeak
} = this.props;
const message = hasMatchingSuggestions ? Object(external_wp_i18n_["sprintf"])(
/* translators: %d: number of results. */
Object(external_wp_i18n_["_n"])('%d result found, use up and down arrow keys to navigate.', '%d results found, use up and down arrow keys to navigate.', matchingSuggestions.length), matchingSuggestions.length) : Object(external_wp_i18n_["__"])('No results.');
debouncedSpeak(message, 'assertive');
}
}
renderTokensAndInput() {
const components = Object(external_lodash_["map"])(this.props.value, this.renderToken);
components.splice(this.getIndexOfInput(), 0, this.renderInput());
return components;
}
renderToken(token, index, tokens) {
const value = this.getTokenValue(token);
const status = token.status ? token.status : undefined;
const termPosition = index + 1;
const termsCount = tokens.length;
return Object(external_wp_element_["createElement"])(Token, {
key: 'token-' + value,
value: value,
status: status,
title: token.title,
displayTransform: this.props.displayTransform,
onClickRemove: this.onTokenClickRemove,
isBorderless: token.isBorderless || this.props.isBorderless,
onMouseEnter: token.onMouseEnter,
onMouseLeave: token.onMouseLeave,
disabled: 'error' !== status && this.props.disabled,
messages: this.props.messages,
termsCount: termsCount,
termPosition: termPosition
});
}
renderInput() {
const {
autoCapitalize,
autoComplete,
maxLength,
placeholder,
value,
instanceId
} = this.props;
let props = {
instanceId,
autoCapitalize,
autoComplete,
placeholder: value.length === 0 ? placeholder : '',
ref: this.bindInput,
key: 'input',
disabled: this.props.disabled,
value: this.state.incompleteTokenValue,
onBlur: this.onBlur,
isExpanded: this.state.isExpanded,
selectedSuggestionIndex: this.state.selectedSuggestionIndex
};
if (!(maxLength && value.length >= maxLength)) {
props = { ...props,
onChange: this.onInputChange
};
}
return Object(external_wp_element_["createElement"])(token_input, props);
}
render() {
const {
disabled,
label = Object(external_wp_i18n_["__"])('Add item'),
instanceId,
className,
__experimentalShowHowTo
} = this.props;
const {
isExpanded
} = this.state;
const classes = classnames_default()(className, 'components-form-token-field__input-container', {
'is-active': this.state.isActive,
'is-disabled': disabled
});
let tokenFieldProps = {
className: 'components-form-token-field',
tabIndex: '-1'
};
const matchingSuggestions = this.getMatchingSuggestions();
if (!disabled) {
tokenFieldProps = Object.assign({}, tokenFieldProps, {
onKeyDown: this.onKeyDown,
onKeyPress: this.onKeyPress,
onFocus: this.onFocus
});
} // Disable reason: There is no appropriate role which describes the
// input container intended accessible usability.
// TODO: Refactor click detection to use blur to stop propagation.
/* eslint-disable jsx-a11y/no-static-element-interactions */
return Object(external_wp_element_["createElement"])("div", tokenFieldProps, Object(external_wp_element_["createElement"])("label", {
htmlFor: `components-form-token-input-${instanceId}`,
className: "components-form-token-field__label"
}, label), Object(external_wp_element_["createElement"])("div", {
ref: this.bindTokensAndInput,
className: classes,
tabIndex: "-1",
onMouseDown: this.onContainerTouched,
onTouchStart: this.onContainerTouched
}, this.renderTokensAndInput(), isExpanded && Object(external_wp_element_["createElement"])(suggestions_list, {
instanceId: instanceId,
match: this.props.saveTransform(this.state.incompleteTokenValue),
displayTransform: this.props.displayTransform,
suggestions: matchingSuggestions,
selectedIndex: this.state.selectedSuggestionIndex,
scrollIntoView: this.state.selectedSuggestionScroll,
onHover: this.onSuggestionHovered,
onSelect: this.onSuggestionSelected
})), __experimentalShowHowTo && Object(external_wp_element_["createElement"])("p", {
id: `components-form-token-suggestions-howto-${instanceId}`,
className: "components-form-token-field__help"
}, this.props.tokenizeOnSpace ? Object(external_wp_i18n_["__"])('Separate with commas, spaces, or the Enter key.') : Object(external_wp_i18n_["__"])('Separate with commas or the Enter key.')));
/* eslint-enable jsx-a11y/no-static-element-interactions */
}
}
form_token_field_FormTokenField.defaultProps = {
suggestions: Object.freeze([]),
maxSuggestions: 100,
value: Object.freeze([]),
displayTransform: external_lodash_["identity"],
saveTransform: token => token.trim(),
onChange: () => {},
onInputChange: () => {},
isBorderless: false,
disabled: false,
tokenizeOnSpace: false,
messages: {
added: Object(external_wp_i18n_["__"])('Item added.'),
removed: Object(external_wp_i18n_["__"])('Item removed.'),
remove: Object(external_wp_i18n_["__"])('Remove item'),
__experimentalInvalid: Object(external_wp_i18n_["__"])('Invalid item')
},
__experimentalExpandOnFocus: false,
__experimentalValidateInput: () => true,
__experimentalShowHowTo: true
};
/* harmony default export */ var form_token_field = (with_spoken_messages(Object(external_wp_compose_["withInstanceId"])(form_token_field_FormTokenField)));
// EXTERNAL MODULE: ./node_modules/gradient-parser/build/node.js
var build_node = __webpack_require__("Jx1U");
var node_default = /*#__PURE__*/__webpack_require__.n(build_node);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/constants.js
/**
* WordPress dependencies
*/
const DEFAULT_GRADIENT = 'linear-gradient(135deg, rgba(6, 147, 227, 1) 0%, rgb(155, 81, 224) 100%)';
const DEFAULT_LINEAR_GRADIENT_ANGLE = 180;
const HORIZONTAL_GRADIENT_ORIENTATION = {
type: 'angular',
value: 90
};
const GRADIENT_OPTIONS = [{
value: 'linear-gradient',
label: Object(external_wp_i18n_["__"])('Linear')
}, {
value: 'radial-gradient',
label: Object(external_wp_i18n_["__"])('Radial')
}];
const DIRECTIONAL_ORIENTATION_ANGLE_MAP = {
top: 0,
'top right': 45,
'right top': 45,
right: 90,
'right bottom': 135,
'bottom right': 135,
bottom: 180,
'bottom left': 225,
'left bottom': 225,
left: 270,
'top left': 315,
'left top': 315
};
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/serializer.js
/**
* External dependencies
*/
function serializeGradientColor({
type,
value
}) {
if (type === 'literal') {
return value;
}
if (type === 'hex') {
return `#${value}`;
}
return `${type}(${value.join(',')})`;
}
function serializeGradientPosition(position) {
if (!position) {
return '';
}
const {
value,
type
} = position;
return `${value}${type}`;
}
function serializeGradientColorStop({
type,
value,
length
}) {
return `${serializeGradientColor({
type,
value
})} ${serializeGradientPosition(length)}`;
}
function serializeGradientOrientation(orientation) {
if (!orientation || orientation.type !== 'angular') {
return;
}
return `${orientation.value}deg`;
}
function serializeGradient({
type,
orientation,
colorStops
}) {
const serializedOrientation = serializeGradientOrientation(orientation);
const serializedColorStops = colorStops.sort((colorStop1, colorStop2) => {
return Object(external_lodash_["get"])(colorStop1, ['length', 'value'], 0) - Object(external_lodash_["get"])(colorStop2, ['length', 'value'], 0);
}).map(serializeGradientColorStop);
return `${type}(${Object(external_lodash_["compact"])([serializedOrientation, ...serializedColorStops]).join(',')})`;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/utils.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function getLinearGradientRepresentationOfARadial(gradientAST) {
return serializeGradient({
type: 'linear-gradient',
orientation: HORIZONTAL_GRADIENT_ORIENTATION,
colorStops: gradientAST.colorStops
});
}
function hasUnsupportedLength(item) {
return item.length === undefined || item.length.type !== '%';
}
function getGradientAstWithDefault(value) {
var _gradientAST$orientat;
// gradientAST will contain the gradient AST as parsed by gradient-parser npm module.
// More information of its structure available at https://www.npmjs.com/package/gradient-parser#ast.
let gradientAST;
try {
gradientAST = node_default.a.parse(value)[0];
gradientAST.value = value;
} catch (error) {
gradientAST = node_default.a.parse(DEFAULT_GRADIENT)[0];
gradientAST.value = DEFAULT_GRADIENT;
}
if (((_gradientAST$orientat = gradientAST.orientation) === null || _gradientAST$orientat === void 0 ? void 0 : _gradientAST$orientat.type) === 'directional') {
gradientAST.orientation.type = 'angular';
gradientAST.orientation.value = DIRECTIONAL_ORIENTATION_ANGLE_MAP[gradientAST.orientation.value].toString();
}
if (gradientAST.colorStops.some(hasUnsupportedLength)) {
const {
colorStops
} = gradientAST;
const step = 100 / (colorStops.length - 1);
colorStops.forEach((stop, index) => {
stop.length = {
value: step * index,
type: '%'
};
});
gradientAST.value = serializeGradient(gradientAST);
}
return gradientAST;
}
function getGradientAstWithControlPoints(gradientAST, newControlPoints) {
return { ...gradientAST,
colorStops: newControlPoints.map(({
position,
color
}) => {
const {
r,
g,
b,
a
} = tinycolor_default()(color).toRgb();
return {
length: {
type: '%',
value: position.toString()
},
type: a < 1 ? 'rgba' : 'rgb',
value: a < 1 ? [r, g, b, a] : [r, g, b]
};
})
};
}
function getStopCssColor(colorStop) {
switch (colorStop.type) {
case 'hex':
return `#${colorStop.value}`;
case 'literal':
return colorStop.value;
case 'rgb':
case 'rgba':
return `${colorStop.type}(${colorStop.value.join(',')})`;
default:
// Should be unreachable if passing an AST from gradient-parser.
// See https://github.com/rafaelcaricio/gradient-parser#ast.
return 'transparent';
}
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/styles/custom-gradient-picker-styles.js
function custom_gradient_picker_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* Internal dependencies
*/
const SelectWrapper = /*#__PURE__*/styled_base_browser_esm(flex_block_component, {
target: "e99xvul0",
label: "SelectWrapper"
})( true ? {
name: "otv6bo",
styles: "flex-grow:5;"
} : undefined);
const AccessoryWrapper = /*#__PURE__*/styled_base_browser_esm(flex_block_component, {
target: "e99xvul1",
label: "AccessoryWrapper"
})( true ? {
name: "gmtefn",
styles: "flex-grow:4;"
} : undefined);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/custom-gradient-picker/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const GradientAnglePicker = ({
gradientAST,
hasGradient,
onChange
}) => {
const angle = Object(external_lodash_["get"])(gradientAST, ['orientation', 'value'], DEFAULT_LINEAR_GRADIENT_ANGLE);
const onAngleChange = newAngle => {
onChange(serializeGradient({ ...gradientAST,
orientation: {
type: 'angular',
value: newAngle
}
}));
};
return Object(external_wp_element_["createElement"])(AnglePickerControl, {
hideLabelFromVision: true,
onChange: onAngleChange,
value: hasGradient ? angle : ''
});
};
const GradientTypePicker = ({
gradientAST,
hasGradient,
onChange
}) => {
const {
type
} = gradientAST;
const onSetLinearGradient = () => {
onChange(serializeGradient({ ...gradientAST,
...(gradientAST.orientation ? {} : {
orientation: HORIZONTAL_GRADIENT_ORIENTATION
}),
type: 'linear-gradient'
}));
};
const onSetRadialGradient = () => {
onChange(serializeGradient({ ...Object(external_lodash_["omit"])(gradientAST, ['orientation']),
type: 'radial-gradient'
}));
};
const handleOnChange = next => {
if (next === 'linear-gradient') {
onSetLinearGradient();
}
if (next === 'radial-gradient') {
onSetRadialGradient();
}
};
return Object(external_wp_element_["createElement"])(select_control, {
className: "components-custom-gradient-picker__type-picker",
label: Object(external_wp_i18n_["__"])('Type'),
labelPosition: 'side',
onChange: handleOnChange,
options: GRADIENT_OPTIONS,
value: hasGradient && type
});
};
function CustomGradientPicker({
value,
onChange
}) {
const gradientAST = getGradientAstWithDefault(value); // On radial gradients the bar should display a linear gradient.
// On radial gradients the bar represents a slice of the gradient from the center until the outside.
const background = gradientAST.type === 'radial-gradient' ? getLinearGradientRepresentationOfARadial(gradientAST) : gradientAST.value;
const hasGradient = gradientAST.value !== DEFAULT_GRADIENT; // Control points color option may be hex from presets, custom colors will be rgb.
// The position should always be a percentage.
const controlPoints = gradientAST.colorStops.map(colorStop => ({
color: getStopCssColor(colorStop),
position: parseInt(colorStop.length.value)
}));
return Object(external_wp_element_["createElement"])("div", {
className: "components-custom-gradient-picker"
}, Object(external_wp_element_["createElement"])(CustomGradientBar, {
background: background,
hasGradient: hasGradient,
value: controlPoints,
onChange: newControlPoints => {
onChange(serializeGradient(getGradientAstWithControlPoints(gradientAST, newControlPoints)));
}
}), Object(external_wp_element_["createElement"])(flex_component, {
gap: 3,
className: "components-custom-gradient-picker__ui-line"
}, Object(external_wp_element_["createElement"])(SelectWrapper, null, Object(external_wp_element_["createElement"])(GradientTypePicker, {
gradientAST: gradientAST,
hasGradient: hasGradient,
onChange: onChange
})), Object(external_wp_element_["createElement"])(AccessoryWrapper, null, gradientAST.type === 'linear-gradient' && Object(external_wp_element_["createElement"])(GradientAnglePicker, {
gradientAST: gradientAST,
hasGradient: hasGradient,
onChange: onChange
}))));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/gradient-picker/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function GradientPicker({
className,
gradients,
onChange,
value,
clearable = true,
disableCustomGradients = false
}) {
const clearGradient = Object(external_wp_element_["useCallback"])(() => onChange(undefined), [onChange]);
const gradientOptions = Object(external_wp_element_["useMemo"])(() => {
return Object(external_lodash_["map"])(gradients, ({
gradient,
name
}) => Object(external_wp_element_["createElement"])(CircularOptionPicker.Option, {
key: gradient,
value: gradient,
isSelected: value === gradient,
tooltipText: name || // translators: %s: gradient code e.g: "linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);".
Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('Gradient code: %s'), gradient),
style: {
color: 'rgba( 0,0,0,0 )',
background: gradient
},
onClick: value === gradient ? clearGradient : () => onChange(gradient),
"aria-label": name ? // translators: %s: The name of the gradient e.g: "Angular red to blue".
Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('Gradient: %s'), name) : // translators: %s: gradient code e.g: "linear-gradient(90deg, rgba(98,16,153,1) 0%, rgba(172,110,22,1) 100%);".
Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('Gradient code: %s'), gradient)
}));
}, [gradients, value, onChange, clearGradient]);
return Object(external_wp_element_["createElement"])(CircularOptionPicker, {
className: className,
options: gradientOptions,
actions: clearable && Object(external_wp_element_["createElement"])(CircularOptionPicker.ButtonAction, {
onClick: clearGradient
}, Object(external_wp_i18n_["__"])('Clear'))
}, !disableCustomGradients && Object(external_wp_element_["createElement"])(CustomGradientPicker, {
value: value,
onChange: onChange
}));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/grid/utils.js
const utils_ALIGNMENTS = {
bottom: {
alignItems: 'flex-end',
justifyContent: 'center'
},
bottomLeft: {
alignItems: 'flex-start',
justifyContent: 'flex-end'
},
bottomRight: {
alignItems: 'flex-end',
justifyContent: 'flex-end'
},
center: {
alignItems: 'center',
justifyContent: 'center'
},
spaced: {
alignItems: 'center',
justifyContent: 'space-between'
},
left: {
alignItems: 'center',
justifyContent: 'flex-start'
},
right: {
alignItems: 'center',
justifyContent: 'flex-end'
},
stretch: {
alignItems: 'stretch'
},
top: {
alignItems: 'flex-start',
justifyContent: 'center'
},
topLeft: {
alignItems: 'flex-start',
justifyContent: 'flex-start'
},
topRight: {
alignItems: 'flex-start',
justifyContent: 'flex-end'
}
};
/* eslint-disable jsdoc/valid-types */
/**
* @param {keyof typeof ALIGNMENTS | undefined} alignment
* @return {{ alignItems?: import('react').CSSProperties['alignItems'], justifyContent?: import('react').CSSProperties['justifyContent']}} CSS props for alignment
*/
function getAlignmentProps(alignment) {
const alignmentProps = alignment ? utils_ALIGNMENTS[alignment] : {};
return alignmentProps;
}
/* eslint-enable jsdoc/valid-types */
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/grid/hook.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* @param {import('../ui/context').ViewOwnProps<import('./types').Props, 'div'>} props
*/
function useGrid(props) {
const {
align,
alignment,
className,
columnGap,
columns = 2,
gap = 3,
isInline = false,
justify,
rowGap,
rows,
templateColumns,
templateRows,
...otherProps
} = Object(use_context_system["a" /* useContextSystem */])(props, 'Grid');
const columnsAsArray = Array.isArray(columns) ? columns : [columns];
const column = useResponsiveValue(columnsAsArray);
const rowsAsArray = Array.isArray(rows) ? rows : [rows];
const row = useResponsiveValue(rowsAsArray);
const gridTemplateColumns = templateColumns || !!columns && `repeat(${column}, 1fr)`;
const gridTemplateRows = templateRows || !!rows && `repeat(${row}, 1fr)`;
const classes = Object(external_wp_element_["useMemo"])(() => {
const alignmentProps = getAlignmentProps(alignment);
const gridClasses = /*#__PURE__*/Object(emotion_esm["a" /* css */])({
alignItems: align,
display: isInline ? 'inline-grid' : 'grid',
gap: `calc( ${config_values.gridBase} * ${gap} )`,
gridTemplateColumns: gridTemplateColumns || undefined,
gridTemplateRows: gridTemplateRows || undefined,
gridRowGap: rowGap,
gridColumnGap: columnGap,
justifyContent: justify,
verticalAlign: isInline ? 'middle' : undefined,
...alignmentProps
}, ";label:gridClasses;" + ( true ? "" : undefined));
return Object(emotion_esm["b" /* cx */])(gridClasses, className);
}, [align, alignment, className, columnGap, gap, gridTemplateColumns, gridTemplateRows, isInline, justify, rowGap]);
return { ...otherProps,
className: classes
};
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/grid/component.js
/**
* Internal dependencies
*/
/**
* `Grid` is a primitive layout component that can arrange content in a grid configuration.
*
* @example
* ```jsx
* import {
* __experimentalGrid as Grid,
* __experimentalText as Text
* } from `@wordpress/components`;
*
* function Example() {
* return (
* <Grid columns={ 3 }>
* <Text>Code</Text>
* <Text>is</Text>
* <Text>Poetry</Text>
* </Grid>
* );
* }
* ```
*/
const Grid = create_component_createComponent({
as: 'div',
useHook: useGrid,
name: 'Grid'
});
/* harmony default export */ var grid_component = (Grid);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/modal/frame.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ModalFrameContent({
overlayClassName,
contentLabel,
aria: {
describedby,
labelledby
},
children,
className,
role,
style,
focusOnMount,
shouldCloseOnEsc,
onRequestClose
}) {
function handleEscapeKeyDown(event) {
if (shouldCloseOnEsc && event.keyCode === external_wp_keycodes_["ESCAPE"]) {
event.stopPropagation();
if (onRequestClose) {
onRequestClose(event);
}
}
}
const focusOnMountRef = Object(external_wp_compose_["useFocusOnMount"])(focusOnMount);
const constrainedTabbingRef = Object(external_wp_compose_["useConstrainedTabbing"])();
const focusReturnRef = Object(external_wp_compose_["useFocusReturn"])();
return (// eslint-disable-next-line jsx-a11y/no-static-element-interactions
Object(external_wp_element_["createElement"])("div", {
className: classnames_default()('components-modal__screen-overlay', overlayClassName),
onKeyDown: handleEscapeKeyDown
}, Object(external_wp_element_["createElement"])("div", {
className: classnames_default()('components-modal__frame', className),
style: style,
ref: Object(external_wp_compose_["useMergeRefs"])([constrainedTabbingRef, focusReturnRef, focusOnMountRef]),
role: role,
"aria-label": contentLabel,
"aria-labelledby": contentLabel ? null : labelledby,
"aria-describedby": describedby,
tabIndex: "-1"
}, children))
);
}
class frame_ModalFrame extends external_wp_element_["Component"] {
constructor() {
super(...arguments);
this.handleFocusOutside = this.handleFocusOutside.bind(this);
}
/**
* Callback function called when clicked outside the modal.
*
* @param {Object} event Mouse click event.
*/
handleFocusOutside(event) {
if (this.props.shouldCloseOnClickOutside && this.props.onRequestClose) {
this.props.onRequestClose(event);
}
}
/**
* Renders the modal frame element.
*
* @return {WPElement} The modal frame element.
*/
render() {
return Object(external_wp_element_["createElement"])(ModalFrameContent, this.props);
}
}
/* harmony default export */ var modal_frame = (with_focus_outside(frame_ModalFrame));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/modal/header.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const ModalHeader = ({
icon,
title,
onClose,
closeLabel,
headingId,
isDismissible
}) => {
const label = closeLabel ? closeLabel : Object(external_wp_i18n_["__"])('Close dialog');
return Object(external_wp_element_["createElement"])("div", {
className: "components-modal__header"
}, Object(external_wp_element_["createElement"])("div", {
className: "components-modal__header-heading-container"
}, icon && Object(external_wp_element_["createElement"])("span", {
className: "components-modal__icon-container",
"aria-hidden": true
}, icon), title && Object(external_wp_element_["createElement"])("h1", {
id: headingId,
className: "components-modal__header-heading"
}, title)), isDismissible && Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
onClick: onClose,
icon: close_small["a" /* default */],
label: label
}));
};
/* harmony default export */ var modal_header = (ModalHeader);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/modal/aria-helper.js
/**
* External dependencies
*/
const LIVE_REGION_ARIA_ROLES = new Set(['alert', 'status', 'log', 'marquee', 'timer']);
let hiddenElements = [],
isHidden = false;
/**
* Hides all elements in the body element from screen-readers except
* the provided element and elements that should not be hidden from
* screen-readers.
*
* The reason we do this is because `aria-modal="true"` currently is bugged
* in Safari, and support is spotty in other browsers overall. In the future
* we should consider removing these helper functions in favor of
* `aria-modal="true"`.
*
* @param {Element} unhiddenElement The element that should not be hidden.
*/
function hideApp(unhiddenElement) {
if (isHidden) {
return;
}
const elements = document.body.children;
Object(external_lodash_["forEach"])(elements, element => {
if (element === unhiddenElement) {
return;
}
if (elementShouldBeHidden(element)) {
element.setAttribute('aria-hidden', 'true');
hiddenElements.push(element);
}
});
isHidden = true;
}
/**
* Determines if the passed element should not be hidden from screen readers.
*
* @param {HTMLElement} element The element that should be checked.
*
* @return {boolean} Whether the element should not be hidden from screen-readers.
*/
function elementShouldBeHidden(element) {
const role = element.getAttribute('role');
return !(element.tagName === 'SCRIPT' || element.hasAttribute('aria-hidden') || element.hasAttribute('aria-live') || LIVE_REGION_ARIA_ROLES.has(role));
}
/**
* Makes all elements in the body that have been hidden by `hideApp`
* visible again to screen-readers.
*/
function showApp() {
if (!isHidden) {
return;
}
Object(external_lodash_["forEach"])(hiddenElements, element => {
element.removeAttribute('aria-hidden');
});
hiddenElements = [];
isHidden = false;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/modal/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
// Used to count the number of open modals.
let modal_parentElement,
openModalCount = 0;
class modal_Modal extends external_wp_element_["Component"] {
constructor(props) {
super(props);
this.prepareDOM();
}
/**
* Appends the modal's node to the DOM, so the portal can render the
* modal in it. Also calls the openFirstModal when this is the first modal to be
* opened.
*/
componentDidMount() {
openModalCount++;
if (openModalCount === 1) {
this.openFirstModal();
}
}
/**
* Removes the modal's node from the DOM. Also calls closeLastModal when this is
* the last modal to be closed.
*/
componentWillUnmount() {
openModalCount--;
if (openModalCount === 0) {
this.closeLastModal();
}
this.cleanDOM();
}
/**
* Prepares the DOM for the modals to be rendered.
*
* Every modal is mounted in a separate div appended to a parent div
* that is appended to the document body.
*
* The parent div will be created if it does not yet exist, and the
* separate div for this specific modal will be appended to that.
*/
prepareDOM() {
if (!modal_parentElement) {
modal_parentElement = document.createElement('div');
document.body.appendChild(modal_parentElement);
}
this.node = document.createElement('div');
modal_parentElement.appendChild(this.node);
}
/**
* Removes the specific mounting point for this modal from the DOM.
*/
cleanDOM() {
modal_parentElement.removeChild(this.node);
}
/**
* Prepares the DOM for this modal and any additional modal to be mounted.
*
* It appends an additional div to the body for the modals to be rendered in,
* it hides any other elements from screen-readers and adds an additional class
* to the body to prevent scrolling while the modal is open.
*/
openFirstModal() {
hideApp(modal_parentElement);
document.body.classList.add(this.props.bodyOpenClassName);
}
/**
* Cleans up the DOM after the last modal is closed and makes the app available
* for screen-readers again.
*/
closeLastModal() {
document.body.classList.remove(this.props.bodyOpenClassName);
showApp();
}
/**
* Renders the modal.
*
* @return {WPElement} The modal element.
*/
render() {
const {
onRequestClose,
title,
icon,
closeButtonLabel,
children,
aria,
instanceId,
isDismissible,
isDismissable,
//Deprecated
// Many of the documented props for Modal are passed straight through
// to the ModalFrame component and handled there.
...otherProps
} = this.props;
const headingId = title ? `components-modal-header-${instanceId}` : aria.labelledby;
if (isDismissable) {
external_wp_deprecated_default()('isDismissable prop of the Modal component', {
since: '5.4',
alternative: 'isDismissible prop (renamed) of the Modal component'
});
} // Disable reason: this stops mouse events from triggering tooltips and
// other elements underneath the modal overlay.
return Object(external_wp_element_["createPortal"])(Object(external_wp_element_["createElement"])(modal_frame, Object(esm_extends["a" /* default */])({
onRequestClose: onRequestClose,
aria: {
labelledby: headingId,
describedby: aria.describedby
}
}, otherProps), Object(external_wp_element_["createElement"])("div", {
className: 'components-modal__content',
role: "document"
}, Object(external_wp_element_["createElement"])(modal_header, {
closeLabel: closeButtonLabel,
headingId: title && headingId,
icon: icon,
isDismissible: isDismissible || isDismissable,
onClose: onRequestClose,
title: title
}), children)), this.node);
}
}
modal_Modal.defaultProps = {
bodyOpenClassName: 'modal-open',
role: 'dialog',
title: null,
focusOnMount: true,
shouldCloseOnEsc: true,
shouldCloseOnClickOutside: true,
isDismissible: true,
/* accessibility */
aria: {
labelledby: null,
describedby: null
}
};
/* harmony default export */ var modal = (Object(external_wp_compose_["withInstanceId"])(modal_Modal));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/guide/icons.js
/**
* WordPress dependencies
*/
const PageControlIcon = ({
isSelected
}) => Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
width: "8",
height: "8",
fill: "none",
xmlns: "http://www.w3.org/2000/svg"
}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Circle"], {
cx: "4",
cy: "4",
r: "4",
fill: isSelected ? '#419ECD' : '#E1E3E6'
}));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/guide/page-control.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PageControl({
currentPage,
numberOfPages,
setCurrentPage
}) {
return Object(external_wp_element_["createElement"])("ul", {
className: "components-guide__page-control",
"aria-label": Object(external_wp_i18n_["__"])('Guide controls')
}, Object(external_lodash_["times"])(numberOfPages, page => Object(external_wp_element_["createElement"])("li", {
key: page // Set aria-current="step" on the active page, see https://www.w3.org/TR/wai-aria-1.1/#aria-current
,
"aria-current": page === currentPage ? 'step' : undefined
}, Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
key: page,
icon: Object(external_wp_element_["createElement"])(PageControlIcon, {
isSelected: page === currentPage
}),
"aria-label": Object(external_wp_i18n_["sprintf"])(
/* translators: 1: current page number 2: total number of pages */
Object(external_wp_i18n_["__"])('Page %1$d of %2$d'), page + 1, numberOfPages),
onClick: () => setCurrentPage(page)
}))));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/guide/finish-button.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function FinishButton(props) {
const ref = Object(external_wp_element_["useRef"])(); // Focus the button on mount if nothing else is focused. This prevents a
// focus loss when the 'Next' button is swapped out.
Object(external_wp_element_["useLayoutEffect"])(() => {
const {
ownerDocument
} = ref.current;
const {
activeElement,
body
} = ownerDocument;
if (!activeElement || activeElement === body) {
ref.current.focus();
}
}, []);
return Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], Object(esm_extends["a" /* default */])({}, props, {
ref: ref
}));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/guide/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Guide({
children,
className,
contentLabel,
finishButtonText,
onFinish,
pages = []
}) {
const [currentPage, setCurrentPage] = Object(external_wp_element_["useState"])(0);
Object(external_wp_element_["useEffect"])(() => {
if (external_wp_element_["Children"].count(children)) {
external_wp_deprecated_default()('Passing children to <Guide>', {
since: '5.5',
alternative: 'the `pages` prop'
});
}
}, [children]);
if (external_wp_element_["Children"].count(children)) {
pages = external_wp_element_["Children"].map(children, child => ({
content: child
}));
}
const canGoBack = currentPage > 0;
const canGoForward = currentPage < pages.length - 1;
const goBack = () => {
if (canGoBack) {
setCurrentPage(currentPage - 1);
}
};
const goForward = () => {
if (canGoForward) {
setCurrentPage(currentPage + 1);
}
};
if (pages.length === 0) {
return null;
}
return Object(external_wp_element_["createElement"])(modal, {
className: classnames_default()('components-guide', className),
contentLabel: contentLabel,
onRequestClose: onFinish
}, Object(external_wp_element_["createElement"])(keyboard_shortcuts, {
key: currentPage,
shortcuts: {
left: goBack,
right: goForward
}
}), Object(external_wp_element_["createElement"])("div", {
className: "components-guide__container"
}, Object(external_wp_element_["createElement"])("div", {
className: "components-guide__page"
}, pages[currentPage].image, pages.length > 1 && Object(external_wp_element_["createElement"])(PageControl, {
currentPage: currentPage,
numberOfPages: pages.length,
setCurrentPage: setCurrentPage
}), pages[currentPage].content, !canGoForward && Object(external_wp_element_["createElement"])(FinishButton, {
className: "components-guide__inline-finish-button",
onClick: onFinish
}, finishButtonText || Object(external_wp_i18n_["__"])('Finish'))), Object(external_wp_element_["createElement"])("div", {
className: "components-guide__footer"
}, canGoBack && Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
className: "components-guide__back-button",
onClick: goBack
}, Object(external_wp_i18n_["__"])('Previous')), canGoForward && Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
className: "components-guide__forward-button",
onClick: goForward
}, Object(external_wp_i18n_["__"])('Next')), !canGoForward && Object(external_wp_element_["createElement"])(FinishButton, {
className: "components-guide__finish-button",
onClick: onFinish
}, finishButtonText || Object(external_wp_i18n_["__"])('Finish')))));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/guide/page.js
/**
* WordPress dependencies
*/
function GuidePage(props) {
Object(external_wp_element_["useEffect"])(() => {
external_wp_deprecated_default()('<GuidePage>', {
since: '5.5',
alternative: 'the `pages` prop in <Guide>'
});
}, []);
return Object(external_wp_element_["createElement"])("div", props);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/heading/hook.js
/**
* Internal dependencies
*/
// eslint-disable-next-line no-duplicate-imports
function useHeading(props) {
const {
as: asProp,
level = 2,
...otherProps
} = Object(use_context_system["a" /* useContextSystem */])(props, 'Heading');
const as = asProp || `h${level}`;
const a11yProps = {};
if (typeof as === 'string' && as[0] !== 'h') {
// if not a semantic `h` element, add a11y props:
a11yProps.role = 'heading';
a11yProps['aria-level'] = level;
}
const textProps = useText({
color: COLORS.darkGray.heading,
size: getHeadingFontSize(level),
isBlock: true,
weight: config_values.fontWeightHeading,
...otherProps
});
return { ...textProps,
...a11yProps,
as
};
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/heading/component.js
/**
* Internal dependencies
*/
/**
* `Heading` renders headings and titles using the library's typography system.
*
* @example
* ```jsx
* import { Heading } from `@wordpress/components/ui`
*
* function Example() {
* return <Heading>Code is Poetry</Heading>;
* }
* ```
*/
const Heading = create_component_createComponent({
as: 'h1',
useHook: useHeading,
name: 'Heading'
});
/* harmony default export */ var heading_component = (Heading);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/h-stack/utils.js
/**
* External dependencies
*/
/** @type {import('./types').Alignments} */
const h_stack_utils_ALIGNMENTS = {
bottom: {
align: 'flex-end',
justify: 'center'
},
bottomLeft: {
align: 'flex-start',
justify: 'flex-end'
},
bottomRight: {
align: 'flex-end',
justify: 'flex-end'
},
center: {
align: 'center',
justify: 'center'
},
edge: {
align: 'center',
justify: 'space-between'
},
left: {
align: 'center',
justify: 'flex-start'
},
right: {
align: 'center',
justify: 'flex-end'
},
stretch: {
align: 'stretch'
},
top: {
align: 'flex-start',
justify: 'center'
},
topLeft: {
align: 'flex-start',
justify: 'flex-start'
},
topRight: {
align: 'flex-start',
justify: 'flex-end'
}
};
/** @type {import('./types').Alignments} */
const V_ALIGNMENTS = {
bottom: {
justify: 'flex-end',
align: 'center'
},
bottomLeft: {
justify: 'flex-start',
align: 'flex-end'
},
bottomRight: {
justify: 'flex-end',
align: 'flex-end'
},
center: {
justify: 'center',
align: 'center'
},
edge: {
justify: 'space-between',
align: 'center'
},
left: {
justify: 'center',
align: 'flex-start'
},
right: {
justify: 'center',
align: 'flex-end'
},
stretch: {
justify: 'stretch'
},
top: {
justify: 'flex-start',
align: 'center'
},
topLeft: {
justify: 'flex-start',
align: 'flex-start'
},
topRight: {
justify: 'flex-start',
align: 'flex-end'
}
};
/* eslint-disable jsdoc/valid-types */
/**
* @param {import('./types').HStackAlignment | import('react').CSSProperties[ 'alignItems' ]} alignment Where to align.
* @param {import('../flex/types').FlexDirection} [direction='row'] Direction to align.
* @return {import('./types').AlignmentProps} Alignment props.
*/
/* eslint-enable jsdoc/valid-types */
function utils_getAlignmentProps(alignment, direction = 'row') {
if (Object(external_lodash_["isNil"])(alignment)) {
return {};
}
const isVertical = direction === 'column';
const props = isVertical ? V_ALIGNMENTS : h_stack_utils_ALIGNMENTS;
const alignmentProps = alignment in props ? props[
/** @type {keyof typeof ALIGNMENTS} */
alignment] : {
align: alignment
};
return alignmentProps;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/utils/get-valid-children.js
/**
* External dependencies
*/
// eslint-disable-next-line no-restricted-imports
/**
* WordPress dependencies
*/
/**
* Gets a collection of available children elements from a React component's children prop.
*
* @param {import('react').ReactNode} children
*
* @return {import('react').ReactNodeArray} An array of available children.
*/
function getValidChildren(children) {
if (typeof children === 'string') return [children];
return external_wp_element_["Children"].toArray(children).filter(child => Object(external_wp_element_["isValidElement"])(child));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/h-stack/hook.js
/**
* Internal dependencies
*/
/**
*
* @param {import('../ui/context').ViewOwnProps<import('./types').Props, 'div'>} props
*/
function useHStack(props) {
const {
alignment = 'edge',
children,
direction,
spacing = 2,
...otherProps
} = Object(use_context_system["a" /* useContextSystem */])(props, 'HStack');
const align = utils_getAlignmentProps(alignment, direction);
const validChildren = getValidChildren(children);
const clonedChildren = validChildren.map( // @ts-ignore
(
/** @type {import('react').ReactElement} */
child, index) => {
const _key = child.key || `hstack-${index}`;
const _isSpacer = Object(context_connect["b" /* hasConnectNamespace */])(child, ['Spacer']);
if (_isSpacer) {
return Object(external_wp_element_["createElement"])(flex_item_component, Object(esm_extends["a" /* default */])({
isBlock: true,
key: _key
}, child.props));
}
return child;
});
const propsForFlex = {
children: clonedChildren,
direction,
justify: 'center',
...align,
...otherProps,
gap: spacing
};
const flexProps = useFlex(propsForFlex);
return flexProps;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/h-stack/component.js
/**
* Internal dependencies
*/
/**
* `HStack` (Horizontal Stack) arranges child elements in a horizontal line.
*
* `HStack` can render anything inside.
*
* @example
* ```jsx
* import {
* __experimentalHStack as HStack,
* __experimentalText as Text,
* } from `@wordpress/components`;
*
* function Example() {
* return (
* <HStack>
* <Text>Code</Text>
* <Text>is</Text>
* <Text>Poetry</Text>
* </HStack>
* );
* }
* ```
*/
const HStack = create_component_createComponent({
as: 'div',
useHook: useHStack,
name: 'HStack'
});
/* harmony default export */ var h_stack_component = (HStack);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/button/deprecated.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function IconButton({
labelPosition,
size,
tooltip,
label,
...props
}, ref) {
external_wp_deprecated_default()('wp.components.IconButton', {
since: '5.4',
alternative: 'wp.components.Button'
});
return Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], Object(esm_extends["a" /* default */])({}, props, {
ref: ref,
tooltipPosition: labelPosition,
iconSize: size,
showTooltip: tooltip !== undefined ? !!tooltip : undefined,
label: tooltip || label
}));
}
/* harmony default export */ var deprecated = (Object(external_wp_element_["forwardRef"])(IconButton));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/menu-group/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function MenuGroup({
children,
className = '',
label,
hideSeparator
}) {
const instanceId = Object(external_wp_compose_["useInstanceId"])(MenuGroup);
if (!external_wp_element_["Children"].count(children)) {
return null;
}
const labelId = `components-menu-group-label-${instanceId}`;
const classNames = classnames_default()(className, 'components-menu-group', {
'has-hidden-separator': hideSeparator
});
return Object(external_wp_element_["createElement"])("div", {
className: classNames
}, label && Object(external_wp_element_["createElement"])("div", {
className: "components-menu-group__label",
id: labelId,
"aria-hidden": "true"
}, label), Object(external_wp_element_["createElement"])("div", {
role: "group",
"aria-labelledby": label ? labelId : null
}, children));
}
/* harmony default export */ var menu_group = (MenuGroup);
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/shortcut/index.js
var build_module_shortcut = __webpack_require__("Cw+6");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/menu-item/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Renders a generic menu item for use inside the more menu.
*
* @param {Object} props Component props.
* @param {WPElement} props.children Element to render as child of button.
* @param {string} props.info Text to use as description for button text.
* @param {string} props.className Class to set on the container.
* @param {WPIcon} props.icon Button's `icon` prop.
* @param {string|Object} props.shortcut Shortcut's `shortcut` prop.
* @param {boolean} props.isSelected Whether or not the menu item is currently selected.
* @param {string} [props.role="menuitem"] ARIA role of the menu item.
* @param {Object} ref React Element ref.
*
* @return {WPComponent} The component to be rendered.
*/
function MenuItem({
children,
info,
className,
icon,
shortcut,
isSelected,
role = 'menuitem',
...props
}, ref) {
className = classnames_default()('components-menu-item__button', className);
if (info) {
children = Object(external_wp_element_["createElement"])("span", {
className: "components-menu-item__info-wrapper"
}, Object(external_wp_element_["createElement"])("span", {
className: "components-menu-item__item"
}, children), Object(external_wp_element_["createElement"])("span", {
className: "components-menu-item__info"
}, info));
}
if (icon && !Object(external_lodash_["isString"])(icon)) {
icon = Object(external_wp_element_["cloneElement"])(icon, {
className: 'components-menu-items__item-icon'
});
}
return Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], Object(esm_extends["a" /* default */])({
ref: ref // Make sure aria-checked matches spec https://www.w3.org/TR/wai-aria-1.1/#aria-checked
,
"aria-checked": role === 'menuitemcheckbox' || role === 'menuitemradio' ? isSelected : undefined,
role: role,
className: className
}, props), Object(external_wp_element_["createElement"])("span", {
className: "components-menu-item__item"
}, children), Object(external_wp_element_["createElement"])(build_module_shortcut["a" /* default */], {
className: "components-menu-item__shortcut",
shortcut: shortcut
}), icon && Object(external_wp_element_["createElement"])(components_build_module_icon["a" /* default */], {
icon: icon
}));
}
/* harmony default export */ var menu_item = (Object(external_wp_element_["forwardRef"])(MenuItem));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/menu-items-choice/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function MenuItemsChoice({
choices = [],
onHover = external_lodash_["noop"],
onSelect,
value
}) {
return choices.map(item => {
const isSelected = value === item.value;
return Object(external_wp_element_["createElement"])(menu_item, {
key: item.value,
role: "menuitemradio",
icon: isSelected && check["a" /* default */],
info: item.info,
isSelected: isSelected,
shortcut: item.shortcut,
className: "components-menu-items-choice",
onClick: () => {
if (!isSelected) {
onSelect(item.value);
}
},
onMouseEnter: () => onHover(item.value),
onMouseLeave: () => onHover(null),
"aria-label": item['aria-label']
}, item.label);
});
}
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/scroll-lock/index.js
var scroll_lock = __webpack_require__("k8OV");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigable-container/tabbable.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function TabbableContainer({
eventToOffset,
...props
}, ref) {
const innerEventToOffset = evt => {
const {
keyCode,
shiftKey
} = evt;
if (external_wp_keycodes_["TAB"] === keyCode) {
return shiftKey ? -1 : 1;
} // Allow custom handling of keys besides Tab.
//
// By default, TabbableContainer will move focus forward on Tab and
// backward on Shift+Tab. The handler below will be used for all other
// events. The semantics for `eventToOffset`'s return
// values are the following:
//
// - +1: move focus forward
// - -1: move focus backward
// - 0: don't move focus, but acknowledge event and thus stop it
// - undefined: do nothing, let the event propagate
if (eventToOffset) {
return eventToOffset(evt);
}
};
return Object(external_wp_element_["createElement"])(navigable_container_container, Object(esm_extends["a" /* default */])({
ref: ref,
stopNavigationEvents: true,
onlyBrowserTabstops: true,
eventToOffset: innerEventToOffset
}, props));
}
/* harmony default export */ var tabbable = (Object(external_wp_element_["forwardRef"])(TabbableContainer));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/constants.js
const ROOT_MENU = 'root';
const SEARCH_FOCUS_DELAY = 100;
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/context.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const NavigationContext = Object(external_wp_element_["createContext"])({
activeItem: undefined,
activeMenu: ROOT_MENU,
setActiveMenu: external_lodash_["noop"],
isMenuEmpty: external_lodash_["noop"],
navigationTree: {
items: {},
getItem: external_lodash_["noop"],
addItem: external_lodash_["noop"],
removeItem: external_lodash_["noop"],
menus: {},
getMenu: external_lodash_["noop"],
addMenu: external_lodash_["noop"],
removeMenu: external_lodash_["noop"],
childMenu: {},
traverseMenu: external_lodash_["noop"],
isMenuEmpty: external_lodash_["noop"]
}
});
const useNavigationContext = () => Object(external_wp_element_["useContext"])(NavigationContext);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/styles/navigation-styles.js
function navigation_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const NavigationUI = styled_base_browser_esm("div", {
target: "ejwewyf0",
label: "NavigationUI"
})("width:100%;background-color:", G2.darkGray.primary, ";box-sizing:border-box;color:#f0f0f0;padding:0 ", space(2), ";overflow:hidden;" + ( true ? "" : undefined));
const MenuUI = styled_base_browser_esm("div", {
target: "ejwewyf1",
label: "MenuUI"
})("margin-top:", space(3), ";margin-bottom:", space(3), ";display:flex;flex-direction:column;ul{padding:0;margin:0;list-style:none;}.components-navigation__back-button{margin-bottom:", space(3), ";}.components-navigation__group + .components-navigation__group{margin-top:", space(3), ";}" + ( true ? "" : undefined));
const MenuBackButtonUI = /*#__PURE__*/styled_base_browser_esm(build_module_button["a" /* default */], {
target: "ejwewyf2",
label: "MenuBackButtonUI"
})("&.is-tertiary{color:", G2.lightGray.ui, ";&:hover:not(:disabled ){color:#ddd;box-shadow:none;}&:active:not(:disabled ){background:transparent;color:#ddd;}}" + ( true ? "" : undefined));
const MenuTitleUI = styled_base_browser_esm("div", {
target: "ejwewyf3",
label: "MenuTitleUI"
})( true ? {
name: "16agjqd",
styles: "overflow:hidden;width:100%;"
} : undefined);
const MenuTitleHeadingUI = /*#__PURE__*/styled_base_browser_esm(text_component, {
target: "ejwewyf4",
label: "MenuTitleHeadingUI"
})("align-items:center;color:", G2.gray[100], ";display:flex;justify-content:space-between;margin-bottom:", space(1), ";padding:", () => Object(external_wp_i18n_["isRTL"])() ? `${space(0.5)} ${space(2)} ${space(0.5)} ${space(1.5)}` : `${space(0.5)} ${space(1.5)} ${space(0.5)} ${space(2)}`, ";" + ( true ? "" : undefined));
const MenuTitleActionsUI = styled_base_browser_esm("span", {
target: "ejwewyf5",
label: "MenuTitleActionsUI"
})("height:", space(3), ";.components-button.is-small{color:", G2.lightGray.ui, ";margin-right:", space(0.5), ";padding:0;&:active:not(:disabled ){background:none;color:", G2.gray[200], ";}&:hover:not(:disabled ){box-shadow:none;color:", G2.gray[200], ";}}" + ( true ? "" : undefined));
const MenuTitleSearchUI = styled_base_browser_esm("div", {
target: "ejwewyf6",
label: "MenuTitleSearchUI"
})("padding:0;position:relative;input{height:", space(4.5), ";margin-bottom:", space(1), ";padding-left:", space(4), ";padding-right:", space(4), ";&::-webkit-search-decoration,&::-webkit-search-cancel-button,&::-webkit-search-results-button,&::-webkit-search-results-decoration{-webkit-appearance:none;}}> svg{left:", space(0.5), ";position:absolute;top:6px;}.components-button.is-small{height:30px;padding:0;position:absolute;right:", space(1), ";top:3px;&:active:not(:disabled ){background:none;}&:hover:not(:disabled ){box-shadow:none;}}" + ( true ? "" : undefined));
const GroupTitleUI = /*#__PURE__*/styled_base_browser_esm(text_component, {
target: "ejwewyf7",
label: "GroupTitleUI"
})("margin-top:", space(1), ";padding:", () => Object(external_wp_i18n_["isRTL"])() ? `${space(0.5)} ${space(2)} ${space(0.5)} 0` : `${space(0.5)} 0 ${space(0.5)} ${space(2)}`, ";text-transform:uppercase;color:", G2.gray[100], ";" + ( true ? "" : undefined));
const ItemBaseUI = styled_base_browser_esm("li", {
target: "ejwewyf8",
label: "ItemBaseUI"
})("border-radius:2px;color:", G2.lightGray.ui, ";margin-bottom:0;button,a.components-button,a{width:100%;color:", G2.lightGray.ui, ";padding:", space(1), " ", space(2), ";", rtl_rtl({
textAlign: 'left'
}, {
textAlign: 'right'
}), " &:hover,&:focus:not( [aria-disabled='true'] ):active,&:active:not( [aria-disabled='true'] ):active{color:#ddd;}}&.is-active{background-color:", UI.theme, ";color:", UI.textDark, ";button,a{color:", UI.textDark, ";}}svg path{color:", G2.lightGray.ui, ";}" + ( true ? "" : undefined));
const ItemUI = styled_base_browser_esm("div", {
target: "ejwewyf9",
label: "ItemUI"
})("display:flex;align-items:center;height:auto;min-height:40px;margin:0;padding:", space(0.75), " ", space(2), ";font-weight:400;line-height:20px;width:100%;color:", G2.lightGray.ui, ";" + ( true ? "" : undefined));
const ItemBadgeUI = styled_base_browser_esm("span", {
target: "ejwewyf10",
label: "ItemBadgeUI"
})("margin-left:", () => Object(external_wp_i18n_["isRTL"])() ? '0' : space(1), ";margin-right:", () => Object(external_wp_i18n_["isRTL"])() ? space(1) : '0', ";display:inline-flex;padding:", space(0.5), " ", space(1.5), ";border-radius:2px;animation:fade-in 250ms ease-out;@keyframes fade-in{from{opacity:0;}to{opacity:1;}}", reduceMotion('animation'), ";" + ( true ? "" : undefined));
const ItemTitleUI = /*#__PURE__*/styled_base_browser_esm(text_component, {
target: "ejwewyf11",
label: "ItemTitleUI"
})(() => Object(external_wp_i18n_["isRTL"])() ? 'margin-left: auto;' : 'margin-right: auto;', " font-size:14px;line-height:20px;color:inherit;" + ( true ? "" : undefined));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/use-navigation-tree-nodes.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const useNavigationTreeNodes = () => {
const [nodes, setNodes] = Object(external_wp_element_["useState"])({});
const getNode = key => nodes[key];
const addNode = (key, value) => setNodes(original => ({ ...original,
[key]: Object(external_lodash_["omit"])(value, 'children')
}));
const removeNode = key => setNodes(original => Object(external_lodash_["omit"])(original, key));
return {
nodes,
getNode,
addNode,
removeNode
};
};
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/use-create-navigation-tree.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const useCreateNavigationTree = () => {
const {
nodes: items,
getNode: getItem,
addNode: addItem,
removeNode: removeItem
} = useNavigationTreeNodes();
const {
nodes: menus,
getNode: getMenu,
addNode: addMenu,
removeNode: removeMenu
} = useNavigationTreeNodes();
/**
* Stores direct nested menus of menus
* This makes it easy to traverse menu tree
*
* Key is the menu prop of the menu
* Value is an array of menu keys
*/
const [childMenu, setChildMenu] = Object(external_wp_element_["useState"])({});
const getChildMenu = menu => childMenu[menu] || [];
const traverseMenu = (startMenu, callback) => {
const visited = [];
let queue = [startMenu];
let current;
while (queue.length > 0) {
current = getMenu(queue.shift());
if (!current || visited.includes(current.menu)) {
continue;
}
visited.push(current.menu);
queue = [...queue, ...getChildMenu(current.menu)];
if (callback(current) === false) {
break;
}
}
};
const isMenuEmpty = menuToCheck => {
let isEmpty = true;
traverseMenu(menuToCheck, current => {
if (!current.isEmpty) {
isEmpty = false;
return false;
}
});
return isEmpty;
};
return {
items,
getItem,
addItem,
removeItem,
menus,
getMenu,
addMenu: (key, value) => {
setChildMenu(state => {
const newState = { ...state
};
if (!newState[value.parentMenu]) {
newState[value.parentMenu] = [];
}
newState[value.parentMenu].push(key);
return newState;
});
addMenu(key, value);
},
removeMenu,
childMenu,
traverseMenu,
isMenuEmpty
};
};
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Navigation({
activeItem,
activeMenu = ROOT_MENU,
children,
className,
onActivateMenu = external_lodash_["noop"]
}) {
const [menu, setMenu] = Object(external_wp_element_["useState"])(activeMenu);
const [slideOrigin, setSlideOrigin] = Object(external_wp_element_["useState"])();
const navigationTree = useCreateNavigationTree();
const defaultSlideOrigin = Object(external_wp_i18n_["isRTL"])() ? 'right' : 'left';
const setActiveMenu = (menuId, slideInOrigin = defaultSlideOrigin) => {
if (!navigationTree.getMenu(menuId)) {
return;
}
setSlideOrigin(slideInOrigin);
setMenu(menuId);
onActivateMenu(menuId);
}; // Used to prevent the sliding animation on mount
const isMounted = Object(external_wp_element_["useRef"])(false);
Object(external_wp_element_["useEffect"])(() => {
if (!isMounted.current) {
isMounted.current = true;
}
}, []);
Object(external_wp_element_["useEffect"])(() => {
if (activeMenu !== menu) {
setActiveMenu(activeMenu);
}
}, [activeMenu]);
const context = {
activeItem,
activeMenu: menu,
setActiveMenu,
navigationTree
};
const classes = classnames_default()('components-navigation', className);
const animateClassName = Object(animate["b" /* getAnimateClassName */])({
type: 'slide-in',
origin: slideOrigin
});
return Object(external_wp_element_["createElement"])(NavigationUI, {
className: classes
}, Object(external_wp_element_["createElement"])("div", {
key: menu,
className: classnames_default()({
[animateClassName]: isMounted.current && slideOrigin
})
}, Object(external_wp_element_["createElement"])(NavigationContext.Provider, {
value: context
}, children)));
}
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-right.js
var chevron_right = __webpack_require__("1iEr");
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/chevron-left.js
var chevron_left = __webpack_require__("2gm7");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/back-button/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function NavigationBackButton({
backButtonLabel,
className,
href,
onClick,
parentMenu
}, ref) {
var _navigationTree$getMe;
const {
setActiveMenu,
navigationTree
} = useNavigationContext();
const classes = classnames_default()('components-navigation__back-button', className);
const parentMenuTitle = (_navigationTree$getMe = navigationTree.getMenu(parentMenu)) === null || _navigationTree$getMe === void 0 ? void 0 : _navigationTree$getMe.title;
const handleOnClick = event => {
if (typeof onClick === 'function') {
onClick(event);
}
const animationDirection = Object(external_wp_i18n_["isRTL"])() ? 'left' : 'right';
if (parentMenu && !event.defaultPrevented) {
setActiveMenu(parentMenu, animationDirection);
}
};
const icon = Object(external_wp_i18n_["isRTL"])() ? chevron_right["a" /* default */] : chevron_left["a" /* default */];
return Object(external_wp_element_["createElement"])(MenuBackButtonUI, {
className: classes,
href: href,
isTertiary: true,
ref: ref,
onClick: handleOnClick
}, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], {
icon: icon
}), backButtonLabel || parentMenuTitle || Object(external_wp_i18n_["__"])('Back'));
}
/* harmony default export */ var back_button = (Object(external_wp_element_["forwardRef"])(NavigationBackButton));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/group/context.js
/**
* WordPress dependencies
*/
const NavigationGroupContext = Object(external_wp_element_["createContext"])({
group: undefined
});
const useNavigationGroupContext = () => Object(external_wp_element_["useContext"])(NavigationGroupContext);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/group/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function NavigationGroup({
children,
className,
title
}) {
const [groupId] = Object(external_wp_element_["useState"])(Object(external_lodash_["uniqueId"])('group-'));
const {
navigationTree: {
items
}
} = useNavigationContext();
const context = {
group: groupId
}; // Keep the children rendered to make sure invisible items are included in the navigation tree.
if (!Object(external_lodash_["find"])(items, {
group: groupId,
_isVisible: true
})) {
return Object(external_wp_element_["createElement"])(NavigationGroupContext.Provider, {
value: context
}, children);
}
const groupTitleId = `components-navigation__group-title-${groupId}`;
const classes = classnames_default()('components-navigation__group', className);
return Object(external_wp_element_["createElement"])(NavigationGroupContext.Provider, {
value: context
}, Object(external_wp_element_["createElement"])("li", {
className: classes
}, title && Object(external_wp_element_["createElement"])(GroupTitleUI, {
as: "h3",
className: "components-navigation__group-title",
id: groupTitleId,
variant: "caption"
}, title), Object(external_wp_element_["createElement"])("ul", {
"aria-labelledby": groupTitleId,
role: "group"
}, children)));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/item/base-content.js
/**
* Internal dependencies
*/
function NavigationItemBaseContent(props) {
const {
badge,
title
} = props;
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, title && Object(external_wp_element_["createElement"])(ItemTitleUI, {
className: "components-navigation__item-title",
variant: "body.small",
as: "span"
}, title), badge && Object(external_wp_element_["createElement"])(ItemBadgeUI, {
className: "components-navigation__item-badge"
}, badge));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/context.js
/**
* WordPress dependencies
*/
const NavigationMenuContext = Object(external_wp_element_["createContext"])({
menu: undefined,
search: ''
});
const useNavigationMenuContext = () => Object(external_wp_element_["useContext"])(NavigationMenuContext);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/utils.js
/**
* External dependencies
*/
// @see packages/block-editor/src/components/inserter/search-items.js
const normalizeInput = input => Object(external_lodash_["deburr"])(input).replace(/^\//, '').toLowerCase();
const normalizedSearch = (title, search) => -1 !== normalizeInput(title).indexOf(normalizeInput(search));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/item/use-navigation-tree-item.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const useNavigationTreeItem = (itemId, props) => {
const {
activeMenu,
navigationTree: {
addItem,
removeItem
}
} = useNavigationContext();
const {
group
} = useNavigationGroupContext();
const {
menu,
search
} = useNavigationMenuContext();
Object(external_wp_element_["useEffect"])(() => {
const isMenuActive = activeMenu === menu;
const isItemVisible = !search || normalizedSearch(props.title, search);
addItem(itemId, { ...props,
group,
menu,
_isVisible: isMenuActive && isItemVisible
});
return () => {
removeItem(itemId);
};
}, [activeMenu, search]);
};
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/item/base.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function NavigationItemBase(props) {
var _navigationTree$getIt;
const {
children,
className,
...restProps
} = props;
const [itemId] = Object(external_wp_element_["useState"])(Object(external_lodash_["uniqueId"])('item-'));
useNavigationTreeItem(itemId, props);
const {
navigationTree
} = useNavigationContext();
if (!((_navigationTree$getIt = navigationTree.getItem(itemId)) !== null && _navigationTree$getIt !== void 0 && _navigationTree$getIt._isVisible)) {
return null;
}
const classes = classnames_default()('components-navigation__item', className);
return Object(external_wp_element_["createElement"])(ItemBaseUI, Object(esm_extends["a" /* default */])({
className: classes
}, restProps), children);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/item/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function NavigationItem(props) {
const {
badge,
children,
className,
href,
item,
navigateToMenu,
onClick = external_lodash_["noop"],
title,
hideIfTargetMenuEmpty,
isText,
...restProps
} = props;
const {
activeItem,
setActiveMenu,
navigationTree: {
isMenuEmpty
}
} = useNavigationContext(); // If hideIfTargetMenuEmpty prop is true
// And the menu we are supposed to navigate to
// Is marked as empty, then we skip rendering the item
if (hideIfTargetMenuEmpty && navigateToMenu && isMenuEmpty(navigateToMenu)) {
return null;
}
const classes = classnames_default()(className, {
'is-active': item && activeItem === item
});
const onItemClick = event => {
if (navigateToMenu) {
setActiveMenu(navigateToMenu);
}
onClick(event);
};
const icon = Object(external_wp_i18n_["isRTL"])() ? chevron_left["a" /* default */] : chevron_right["a" /* default */];
const baseProps = isText ? restProps : {
as: build_module_button["a" /* default */],
href,
onClick: onItemClick,
...restProps
};
return Object(external_wp_element_["createElement"])(NavigationItemBase, Object(esm_extends["a" /* default */])({}, props, {
className: classes
}), children || Object(external_wp_element_["createElement"])(ItemUI, baseProps, Object(external_wp_element_["createElement"])(NavigationItemBaseContent, {
title: title,
badge: badge
}), navigateToMenu && Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], {
icon: icon
})));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/use-navigation-tree-menu.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const useNavigationTreeMenu = props => {
const {
navigationTree: {
addMenu,
removeMenu
}
} = useNavigationContext();
const key = props.menu || ROOT_MENU;
Object(external_wp_element_["useEffect"])(() => {
addMenu(key, { ...props,
menu: key
});
return () => {
removeMenu(key);
};
}, []);
};
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/search.js
var library_search = __webpack_require__("cGtP");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/menu-title-search.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function MenuTitleSearch({
debouncedSpeak,
onCloseSearch,
onSearch,
search,
title
}) {
const {
navigationTree: {
items
}
} = useNavigationContext();
const {
menu
} = useNavigationMenuContext();
const inputRef = Object(external_wp_element_["useRef"])(); // Wait for the slide-in animation to complete before autofocusing the input.
// This prevents scrolling to the input during the animation.
Object(external_wp_element_["useEffect"])(() => {
const delayedFocus = setTimeout(() => {
inputRef.current.focus();
}, SEARCH_FOCUS_DELAY);
return () => {
clearTimeout(delayedFocus);
};
}, []);
Object(external_wp_element_["useEffect"])(() => {
if (!search) {
return;
}
const count = Object(external_lodash_["filter"])(items, '_isVisible').length;
const resultsFoundMessage = Object(external_wp_i18n_["sprintf"])(
/* translators: %d: number of results. */
Object(external_wp_i18n_["_n"])('%d result found.', '%d results found.', count), count);
debouncedSpeak(resultsFoundMessage);
}, [items, search]);
const onClose = () => {
onSearch('');
onCloseSearch();
};
function onKeyDown(event) {
if (event.keyCode === external_wp_keycodes_["ESCAPE"]) {
event.stopPropagation();
onClose();
}
}
const menuTitleId = `components-navigation__menu-title-${menu}`;
const inputId = `components-navigation__menu-title-search-${menu}`;
/* translators: placeholder for menu search box. %s: menu title */
const placeholder = Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('Search in %s'), title);
return Object(external_wp_element_["createElement"])(MenuTitleSearchUI, {
className: "components-navigation__menu-title-search"
}, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], {
icon: library_search["a" /* default */]
}), Object(external_wp_element_["createElement"])(visually_hidden["a" /* default */], {
as: "label",
htmlFor: inputId,
id: menuTitleId
}, placeholder), Object(external_wp_element_["createElement"])("input", {
autoComplete: "off",
className: "components-text-control__input",
id: inputId,
onChange: event => onSearch(event.target.value),
onKeyDown: onKeyDown,
placeholder: placeholder,
ref: inputRef,
type: "search",
value: search
}), Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
isSmall: true,
isTertiary: true,
label: Object(external_wp_i18n_["__"])('Close search'),
onClick: onClose
}, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], {
icon: close_small["a" /* default */]
})));
}
/* harmony default export */ var menu_title_search = (with_spoken_messages(MenuTitleSearch));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/menu-title.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function NavigationMenuTitle({
hasSearch,
onSearch,
search,
title,
titleAction
}) {
const [isSearching, setIsSearching] = Object(external_wp_element_["useState"])(false);
const {
menu
} = useNavigationMenuContext();
const searchButtonRef = Object(external_wp_element_["useRef"])();
if (!title) {
return null;
}
const onCloseSearch = () => {
setIsSearching(false); // Wait for the slide-in animation to complete before focusing the search button.
// eslint-disable-next-line @wordpress/react-no-unsafe-timeout
setTimeout(() => {
searchButtonRef.current.focus();
}, SEARCH_FOCUS_DELAY);
};
const menuTitleId = `components-navigation__menu-title-${menu}`;
/* translators: search button label for menu search box. %s: menu title */
const searchButtonLabel = Object(external_wp_i18n_["sprintf"])(Object(external_wp_i18n_["__"])('Search in %s'), title);
return Object(external_wp_element_["createElement"])(MenuTitleUI, {
className: "components-navigation__menu-title"
}, !isSearching && Object(external_wp_element_["createElement"])(MenuTitleHeadingUI, {
as: "h2",
className: "components-navigation__menu-title-heading",
variant: "title.small"
}, Object(external_wp_element_["createElement"])("span", {
id: menuTitleId
}, title), (hasSearch || titleAction) && Object(external_wp_element_["createElement"])(MenuTitleActionsUI, null, titleAction, hasSearch && Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
isSmall: true,
isTertiary: true,
label: searchButtonLabel,
onClick: () => setIsSearching(true),
ref: searchButtonRef
}, Object(external_wp_element_["createElement"])(build_module_icon["a" /* default */], {
icon: library_search["a" /* default */]
})))), isSearching && Object(external_wp_element_["createElement"])("div", {
className: Object(animate["b" /* getAnimateClassName */])({
type: 'slide-in',
origin: 'left'
})
}, Object(external_wp_element_["createElement"])(menu_title_search, {
onCloseSearch: onCloseSearch,
onSearch: onSearch,
search: search,
title: title
})));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/search-no-results-found.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function NavigationSearchNoResultsFound({
search
}) {
const {
navigationTree: {
items
}
} = useNavigationContext();
const resultsCount = Object(external_lodash_["filter"])(items, '_isVisible').length;
if (!search || !!resultsCount) {
return null;
}
return Object(external_wp_element_["createElement"])(ItemBaseUI, null, Object(external_wp_element_["createElement"])(ItemUI, null, Object(external_wp_i18n_["__"])('No results found.'), " "));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/navigation/menu/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function NavigationMenu(props) {
const {
backButtonLabel,
children,
className,
hasSearch,
menu = ROOT_MENU,
onBackButtonClick,
onSearch: setControlledSearch,
parentMenu,
search: controlledSearch,
isSearchDebouncing,
title,
titleAction
} = props;
const [uncontrolledSearch, setUncontrolledSearch] = Object(external_wp_element_["useState"])('');
useNavigationTreeMenu(props);
const {
activeMenu
} = useNavigationContext();
const context = {
menu,
search: uncontrolledSearch
}; // Keep the children rendered to make sure invisible items are included in the navigation tree
if (activeMenu !== menu) {
return Object(external_wp_element_["createElement"])(NavigationMenuContext.Provider, {
value: context
}, children);
}
const isControlledSearch = !!setControlledSearch;
const search = isControlledSearch ? controlledSearch : uncontrolledSearch;
const onSearch = isControlledSearch ? setControlledSearch : setUncontrolledSearch;
const menuTitleId = `components-navigation__menu-title-${menu}`;
const classes = classnames_default()('components-navigation__menu', className);
return Object(external_wp_element_["createElement"])(NavigationMenuContext.Provider, {
value: context
}, Object(external_wp_element_["createElement"])(MenuUI, {
className: classes
}, (parentMenu || onBackButtonClick) && Object(external_wp_element_["createElement"])(back_button, {
backButtonLabel: backButtonLabel,
parentMenu: parentMenu,
onClick: onBackButtonClick
}), Object(external_wp_element_["createElement"])(NavigationMenuTitle, {
hasSearch: hasSearch,
onSearch: onSearch,
search: search,
title: title,
titleAction: titleAction
}), Object(external_wp_element_["createElement"])(navigable_container_menu, null, Object(external_wp_element_["createElement"])("ul", {
"aria-labelledby": menuTitleId
}, children, search && !isSearchDebouncing && Object(external_wp_element_["createElement"])(NavigationSearchNoResultsFound, {
search: search
})))));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/notice/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/** @typedef {import('@wordpress/element').WPElement} WPElement */
/**
* Custom hook which announces the message with the given politeness, if a
* valid message is provided.
*
* @param {string|WPElement} [message] Message to announce.
* @param {'polite'|'assertive'} politeness Politeness to announce.
*/
function useSpokenMessage(message, politeness) {
const spokenMessage = typeof message === 'string' ? message : Object(external_wp_element_["renderToString"])(message);
Object(external_wp_element_["useEffect"])(() => {
if (spokenMessage) {
Object(external_wp_a11y_["speak"])(spokenMessage, politeness);
}
}, [spokenMessage, politeness]);
}
/**
* Given a notice status, returns an assumed default politeness for the status.
* Defaults to 'assertive'.
*
* @param {string} [status] Notice status.
*
* @return {'polite'|'assertive'} Notice politeness.
*/
function getDefaultPoliteness(status) {
switch (status) {
case 'success':
case 'warning':
case 'info':
return 'polite';
case 'error':
default:
return 'assertive';
}
}
function Notice({
className,
status = 'info',
children,
spokenMessage = children,
onRemove = external_lodash_["noop"],
isDismissible = true,
actions = [],
politeness = getDefaultPoliteness(status),
__unstableHTML
}) {
useSpokenMessage(spokenMessage, politeness);
const classes = classnames_default()(className, 'components-notice', 'is-' + status, {
'is-dismissible': isDismissible
});
if (__unstableHTML) {
children = Object(external_wp_element_["createElement"])(external_wp_element_["RawHTML"], null, children);
}
return Object(external_wp_element_["createElement"])("div", {
className: classes
}, Object(external_wp_element_["createElement"])("div", {
className: "components-notice__content"
}, children, Object(external_wp_element_["createElement"])("div", {
className: "components-notice__actions"
}, actions.map(({
className: buttonCustomClasses,
label,
isPrimary,
noDefaultClasses = false,
onClick,
url
}, index) => {
return Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
key: index,
href: url,
isPrimary: isPrimary,
isSecondary: !noDefaultClasses && !url,
isLink: !noDefaultClasses && !!url,
onClick: url ? undefined : onClick,
className: classnames_default()('components-notice__action', buttonCustomClasses)
}, label);
}))), isDismissible && Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
className: "components-notice__dismiss",
icon: library_close["a" /* default */],
label: Object(external_wp_i18n_["__"])('Dismiss this notice'),
onClick: onRemove,
showTooltip: false
}));
}
/* harmony default export */ var build_module_notice = (Notice);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/notice/list.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
/**
* Renders a list of notices.
*
* @param {Object} $0 Props passed to the component.
* @param {Array} $0.notices Array of notices to render.
* @param {Function} $0.onRemove Function called when a notice should be removed / dismissed.
* @param {Object} $0.className Name of the class used by the component.
* @param {Object} $0.children Array of children to be rendered inside the notice list.
* @return {Object} The rendered notices list.
*/
function NoticeList({
notices,
onRemove = external_lodash_["noop"],
className,
children
}) {
const removeNotice = id => () => onRemove(id);
className = classnames_default()('components-notice-list', className);
return Object(external_wp_element_["createElement"])("div", {
className: className
}, children, [...notices].reverse().map(notice => Object(external_wp_element_["createElement"])(build_module_notice, Object(esm_extends["a" /* default */])({}, Object(external_lodash_["omit"])(notice, ['content']), {
key: notice.id,
onRemove: removeNotice(notice.id)
}), notice.content)));
}
/* harmony default export */ var list = (NoticeList);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/panel/header.js
function PanelHeader({
label,
children
}) {
return Object(external_wp_element_["createElement"])("div", {
className: "components-panel__header"
}, label && Object(external_wp_element_["createElement"])("h2", null, label), children);
}
/* harmony default export */ var panel_header = (PanelHeader);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/panel/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function Panel({
header,
className,
children
}, ref) {
const classNames = classnames_default()(className, 'components-panel');
return Object(external_wp_element_["createElement"])("div", {
className: classNames,
ref: ref
}, header && Object(external_wp_element_["createElement"])(panel_header, {
label: header
}), children);
}
/* harmony default export */ var panel = (Object(external_wp_element_["forwardRef"])(Panel));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/panel/body.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function PanelBody({
buttonProps = {},
children,
className,
icon,
initialOpen,
onToggle = external_lodash_["noop"],
opened,
title,
scrollAfterOpen = true
}, ref) {
const [isOpened, setIsOpened] = use_controlled_state(opened, {
initial: initialOpen === undefined ? true : initialOpen
});
const nodeRef = Object(external_wp_element_["useRef"])(); // Defaults to 'smooth' scrolling
// https://developer.mozilla.org/en-US/docs/Web/API/Element/scrollIntoView
const scrollBehavior = Object(external_wp_compose_["useReducedMotion"])() ? 'auto' : 'smooth';
const handleOnToggle = event => {
event.preventDefault();
const next = !isOpened;
setIsOpened(next);
onToggle(next);
}; // Ref is used so that the effect does not re-run upon scrollAfterOpen changing value
const scrollAfterOpenRef = Object(external_wp_element_["useRef"])();
scrollAfterOpenRef.current = scrollAfterOpen; // Runs after initial render
use_update_effect(() => {
var _nodeRef$current;
if (isOpened && scrollAfterOpenRef.current && (_nodeRef$current = nodeRef.current) !== null && _nodeRef$current !== void 0 && _nodeRef$current.scrollIntoView) {
/*
* Scrolls the content into view when visible.
* This improves the UX when there are multiple stacking <PanelBody />
* components in a scrollable container.
*/
nodeRef.current.scrollIntoView({
inline: 'nearest',
block: 'nearest',
behavior: scrollBehavior
});
}
}, [isOpened, scrollBehavior]);
const classes = classnames_default()('components-panel__body', className, {
'is-opened': isOpened
});
return Object(external_wp_element_["createElement"])("div", {
className: classes,
ref: Object(external_wp_compose_["useMergeRefs"])([nodeRef, ref])
}, Object(external_wp_element_["createElement"])(PanelBodyTitle, Object(esm_extends["a" /* default */])({
icon: icon,
isOpened: isOpened,
onClick: handleOnToggle,
title: title
}, buttonProps)), typeof children === 'function' ? children({
opened: isOpened
}) : isOpened && children);
}
const PanelBodyTitle = Object(external_wp_element_["forwardRef"])(({
isOpened,
icon,
title,
...props
}, ref) => {
if (!title) return null;
return Object(external_wp_element_["createElement"])("h2", {
className: "components-panel__body-title"
}, Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], Object(esm_extends["a" /* default */])({
className: "components-panel__body-toggle",
"aria-expanded": isOpened,
ref: ref
}, props), Object(external_wp_element_["createElement"])("span", {
"aria-hidden": "true"
}, Object(external_wp_element_["createElement"])(components_build_module_icon["a" /* default */], {
className: "components-panel__arrow",
icon: isOpened ? chevron_up["a" /* default */] : chevron_down["a" /* default */]
})), title, icon && Object(external_wp_element_["createElement"])(components_build_module_icon["a" /* default */], {
icon: icon,
className: "components-panel__icon",
size: 20
})));
});
const body_ForwardedComponent = Object(external_wp_element_["forwardRef"])(PanelBody);
body_ForwardedComponent.displayName = 'PanelBody';
/* harmony default export */ var panel_body = (body_ForwardedComponent);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/panel/row.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const PanelRow = Object(external_wp_element_["forwardRef"])(({
className,
children
}, ref) => Object(external_wp_element_["createElement"])("div", {
className: classnames_default()('components-panel__row', className),
ref: ref
}, children));
/* harmony default export */ var panel_row = (PanelRow);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/placeholder/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Renders a placeholder. Normally used by blocks to render their empty state.
*
* @param {Object} props The component props.
* @param {WPIcon} props.icon An icon rendered before the label.
* @param {WPElement} props.children Children to be rendered.
* @param {string} props.label Title of the placeholder.
* @param {string} props.instructions Instructions of the placeholder.
* @param {string} props.className Class to set on the container div.
* @param {Object} props.notices A rendered notices list.
* @param {Object} props.preview Preview to be rendered in the placeholder.
* @param {boolean} props.isColumnLayout Whether a column layout should be used.
*
* @return {Object} The rendered placeholder.
*/
function Placeholder({
icon,
children,
label,
instructions,
className,
notices,
preview,
isColumnLayout,
...additionalProps
}) {
const [resizeListener, {
width
}] = Object(external_wp_compose_["useResizeObserver"])(); // Since `useResizeObserver` will report a width of `null` until after the
// first render, avoid applying any modifier classes until width is known.
let modifierClassNames;
if (typeof width === 'number') {
modifierClassNames = {
'is-large': width >= 480,
'is-medium': width >= 160 && width < 480,
'is-small': width < 160
};
}
const classes = classnames_default()('components-placeholder', className, modifierClassNames);
const fieldsetClasses = classnames_default()('components-placeholder__fieldset', {
'is-column-layout': isColumnLayout
});
return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({}, additionalProps, {
className: classes
}), resizeListener, notices, preview && Object(external_wp_element_["createElement"])("div", {
className: "components-placeholder__preview"
}, preview), Object(external_wp_element_["createElement"])("div", {
className: "components-placeholder__label"
}, Object(external_wp_element_["createElement"])(components_build_module_icon["a" /* default */], {
icon: icon
}), label), !!instructions && Object(external_wp_element_["createElement"])("div", {
className: "components-placeholder__instructions"
}, instructions), Object(external_wp_element_["createElement"])("div", {
className: fieldsetClasses
}, children));
}
/* harmony default export */ var build_module_placeholder = (Placeholder);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/query-controls/terms.js
/**
* External dependencies
*/
/**
* Returns terms in a tree form.
*
* @param {Array} flatTerms Array of terms in flat format.
*
* @return {Array} Array of terms in tree format.
*/
function buildTermsTree(flatTerms) {
const flatTermsWithParentAndChildren = flatTerms.map(term => {
return {
children: [],
parent: null,
...term
};
});
const termsByParent = Object(external_lodash_["groupBy"])(flatTermsWithParentAndChildren, 'parent');
if (termsByParent.null && termsByParent.null.length) {
return flatTermsWithParentAndChildren;
}
const fillWithChildren = terms => {
return terms.map(term => {
const children = termsByParent[term.id];
return { ...term,
children: children && children.length ? fillWithChildren(children) : []
};
});
};
return fillWithChildren(termsByParent['0'] || []);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-select/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function tree_select_getSelectOptions(tree, level = 0) {
return Object(external_lodash_["flatMap"])(tree, treeNode => [{
value: treeNode.id,
label: Object(external_lodash_["repeat"])('\u00A0', level * 3) + Object(external_lodash_["unescape"])(treeNode.name)
}, ...tree_select_getSelectOptions(treeNode.children || [], level + 1)]);
}
function TreeSelect({
label,
noOptionLabel,
onChange,
selectedId,
tree,
...props
}) {
const options = Object(external_wp_element_["useMemo"])(() => {
return Object(external_lodash_["compact"])([noOptionLabel && {
value: '',
label: noOptionLabel
}, ...tree_select_getSelectOptions(tree)]);
}, [noOptionLabel, tree]);
return Object(external_wp_element_["createElement"])(select_control, Object(esm_extends["a" /* default */])({
label,
options,
onChange,
value: selectedId
}, props));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/query-controls/category-select.js
/**
* Internal dependencies
*/
/**
* WordPress dependencies
*/
function CategorySelect({
label,
noOptionLabel,
categoriesList,
selectedCategoryId,
onChange,
...props
}) {
const termsTree = Object(external_wp_element_["useMemo"])(() => {
return buildTermsTree(categoriesList);
}, [categoriesList]);
return Object(external_wp_element_["createElement"])(TreeSelect, Object(esm_extends["a" /* default */])({
label,
noOptionLabel,
onChange,
tree: termsTree,
selectedId: selectedCategoryId
}, props));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/query-controls/author-select.js
/**
* Internal dependencies
*/
function AuthorSelect({
label,
noOptionLabel,
authorList,
selectedAuthorId,
onChange
}) {
if (!authorList) return null;
const termsTree = buildTermsTree(authorList);
return Object(external_wp_element_["createElement"])(TreeSelect, {
label,
noOptionLabel,
onChange,
tree: termsTree,
selectedId: selectedAuthorId
});
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/query-controls/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const DEFAULT_MIN_ITEMS = 1;
const DEFAULT_MAX_ITEMS = 100;
const MAX_CATEGORIES_SUGGESTIONS = 20;
function QueryControls({
authorList,
selectedAuthorId,
categoriesList,
selectedCategoryId,
categorySuggestions,
selectedCategories,
numberOfItems,
order,
orderBy,
maxItems = DEFAULT_MAX_ITEMS,
minItems = DEFAULT_MIN_ITEMS,
onCategoryChange,
onAuthorChange,
onNumberOfItemsChange,
onOrderChange,
onOrderByChange
}) {
return [onOrderChange && onOrderByChange && Object(external_wp_element_["createElement"])(select_control, {
key: "query-controls-order-select",
label: Object(external_wp_i18n_["__"])('Order by'),
value: `${orderBy}/${order}`,
options: [{
label: Object(external_wp_i18n_["__"])('Newest to oldest'),
value: 'date/desc'
}, {
label: Object(external_wp_i18n_["__"])('Oldest to newest'),
value: 'date/asc'
}, {
/* translators: label for ordering posts by title in ascending order */
label: Object(external_wp_i18n_["__"])('A → Z'),
value: 'title/asc'
}, {
/* translators: label for ordering posts by title in descending order */
label: Object(external_wp_i18n_["__"])('Z → A'),
value: 'title/desc'
}],
onChange: value => {
const [newOrderBy, newOrder] = value.split('/');
if (newOrder !== order) {
onOrderChange(newOrder);
}
if (newOrderBy !== orderBy) {
onOrderByChange(newOrderBy);
}
}
}), categoriesList && onCategoryChange && Object(external_wp_element_["createElement"])(CategorySelect, {
key: "query-controls-category-select",
categoriesList: categoriesList,
label: Object(external_wp_i18n_["__"])('Category'),
noOptionLabel: Object(external_wp_i18n_["__"])('All'),
selectedCategoryId: selectedCategoryId,
onChange: onCategoryChange
}), categorySuggestions && onCategoryChange && Object(external_wp_element_["createElement"])(form_token_field, {
key: "query-controls-categories-select",
label: Object(external_wp_i18n_["__"])('Categories'),
value: selectedCategories && selectedCategories.map(item => ({
id: item.id,
value: item.name || item.value
})),
suggestions: Object.keys(categorySuggestions),
onChange: onCategoryChange,
maxSuggestions: MAX_CATEGORIES_SUGGESTIONS
}), onAuthorChange && Object(external_wp_element_["createElement"])(AuthorSelect, {
key: "query-controls-author-select",
authorList: authorList,
label: Object(external_wp_i18n_["__"])('Author'),
noOptionLabel: Object(external_wp_i18n_["__"])('All'),
selectedAuthorId: selectedAuthorId,
onChange: onAuthorChange
}), onNumberOfItemsChange && Object(external_wp_element_["createElement"])(range_control, {
key: "query-controls-range-control",
label: Object(external_wp_i18n_["__"])('Number of items'),
value: numberOfItems,
onChange: onNumberOfItemsChange,
min: minItems,
max: maxItems,
required: true
})];
}
// EXTERNAL MODULE: ./node_modules/reakit-warning/es/warning.js
var warning = __webpack_require__("WnOg");
// CONCATENATED MODULE: ./node_modules/reakit/es/__keys-d251e56b.js
// Automatically generated
var RADIO_STATE_KEYS = ["baseId", "unstable_idCountRef", "unstable_virtual", "rtl", "orientation", "items", "groups", "currentId", "loop", "wrap", "shift", "unstable_moves", "unstable_hasActiveWidget", "unstable_includesBaseElement", "state", "setBaseId", "registerItem", "unregisterItem", "registerGroup", "unregisterGroup", "move", "next", "previous", "up", "down", "first", "last", "sort", "unstable_setVirtual", "setRTL", "setOrientation", "setCurrentId", "setLoop", "setWrap", "setShift", "reset", "unstable_setIncludesBaseElement", "unstable_setHasActiveWidget", "setState"];
var RADIO_KEYS = [].concat(RADIO_STATE_KEYS, ["value", "checked", "unstable_checkOnFocus"]);
var RADIO_GROUP_KEYS = RADIO_STATE_KEYS;
// CONCATENATED MODULE: ./node_modules/reakit/es/Radio/Radio.js
function getChecked(options) {
if (typeof options.checked !== "undefined") {
return options.checked;
}
return typeof options.value !== "undefined" && options.state === options.value;
}
function useInitialChecked(options) {
var _React$useState = Object(external_React_["useState"])(function () {
return getChecked(options);
}),
initialChecked = _React$useState[0];
var _React$useState2 = Object(external_React_["useState"])(options.currentId),
initialCurrentId = _React$useState2[0];
var id = options.id,
setCurrentId = options.setCurrentId;
Object(external_React_["useEffect"])(function () {
if (initialChecked && id && initialCurrentId !== id) {
setCurrentId === null || setCurrentId === void 0 ? void 0 : setCurrentId(id);
}
}, [initialChecked, id, setCurrentId, initialCurrentId]);
}
function fireChange(element, onChange) {
var event = Object(createEvent["a" /* createEvent */])(element, "change");
Object.defineProperties(event, {
type: {
value: "change"
},
target: {
value: element
},
currentTarget: {
value: element
}
});
onChange === null || onChange === void 0 ? void 0 : onChange(event);
}
var useRadio = Object(createHook["a" /* createHook */])({
name: "Radio",
compose: CompositeItem["b" /* useCompositeItem */],
keys: RADIO_KEYS,
useOptions: function useOptions(_ref, _ref2) {
var _options$value;
var value = _ref2.value,
checked = _ref2.checked;
var _ref$unstable_clickOn = _ref.unstable_clickOnEnter,
unstable_clickOnEnter = _ref$unstable_clickOn === void 0 ? false : _ref$unstable_clickOn,
_ref$unstable_checkOn = _ref.unstable_checkOnFocus,
unstable_checkOnFocus = _ref$unstable_checkOn === void 0 ? true : _ref$unstable_checkOn,
options = Object(_rollupPluginBabelHelpers_1f0bf8c2["a" /* _ */])(_ref, ["unstable_clickOnEnter", "unstable_checkOnFocus"]);
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({
checked: checked,
unstable_clickOnEnter: unstable_clickOnEnter,
unstable_checkOnFocus: unstable_checkOnFocus
}, options), {}, {
value: (_options$value = options.value) != null ? _options$value : value
});
},
useProps: function useProps(options, _ref3) {
var htmlRef = _ref3.ref,
htmlOnChange = _ref3.onChange,
htmlOnClick = _ref3.onClick,
htmlProps = Object(_rollupPluginBabelHelpers_1f0bf8c2["a" /* _ */])(_ref3, ["ref", "onChange", "onClick"]);
var ref = Object(external_React_["useRef"])(null);
var _React$useState3 = Object(external_React_["useState"])(true),
isNativeRadio = _React$useState3[0],
setIsNativeRadio = _React$useState3[1];
var checked = getChecked(options);
var isCurrentItemRef = Object(useLiveRef["a" /* useLiveRef */])(options.currentId === options.id);
var onChangeRef = Object(useLiveRef["a" /* useLiveRef */])(htmlOnChange);
var onClickRef = Object(useLiveRef["a" /* useLiveRef */])(htmlOnClick);
useInitialChecked(options);
Object(external_React_["useEffect"])(function () {
var element = ref.current;
if (!element) {
false ? undefined : void 0;
return;
}
if (element.tagName !== "INPUT" || element.type !== "radio") {
setIsNativeRadio(false);
}
}, []);
var onChange = Object(external_React_["useCallback"])(function (event) {
var _onChangeRef$current, _options$setState;
(_onChangeRef$current = onChangeRef.current) === null || _onChangeRef$current === void 0 ? void 0 : _onChangeRef$current.call(onChangeRef, event);
if (event.defaultPrevented) return;
if (options.disabled) return;
(_options$setState = options.setState) === null || _options$setState === void 0 ? void 0 : _options$setState.call(options, options.value);
}, [options.disabled, options.setState, options.value]);
var onClick = Object(external_React_["useCallback"])(function (event) {
var _onClickRef$current;
(_onClickRef$current = onClickRef.current) === null || _onClickRef$current === void 0 ? void 0 : _onClickRef$current.call(onClickRef, event);
if (event.defaultPrevented) return;
if (isNativeRadio) return;
fireChange(event.currentTarget, onChange);
}, [onChange, isNativeRadio]);
Object(external_React_["useEffect"])(function () {
var element = ref.current;
if (!element) return;
if (options.unstable_moves && isCurrentItemRef.current && options.unstable_checkOnFocus) {
fireChange(element, onChange);
}
}, [options.unstable_moves, options.unstable_checkOnFocus, onChange]);
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({
ref: Object(useForkRef["a" /* useForkRef */])(ref, htmlRef),
role: !isNativeRadio ? "radio" : undefined,
type: isNativeRadio ? "radio" : undefined,
value: isNativeRadio ? options.value : undefined,
name: isNativeRadio ? options.baseId : undefined,
"aria-checked": checked,
checked: checked,
onChange: onChange,
onClick: onClick
}, htmlProps);
}
});
var Radio = Object(createComponent["a" /* createComponent */])({
as: "input",
memo: true,
useHook: useRadio
});
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/radio-context/index.js
/**
* WordPress dependencies
*/
const RadioContext = Object(external_wp_element_["createContext"])({
state: null,
setState: () => {}
});
/* harmony default export */ var radio_context = (RadioContext);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/radio/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function radio_Radio({
children,
value,
...props
}, ref) {
const radioContext = Object(external_wp_element_["useContext"])(radio_context);
const checked = radioContext.state === value;
return Object(external_wp_element_["createElement"])(Radio, Object(esm_extends["a" /* default */])({
ref: ref,
as: build_module_button["a" /* default */],
isPrimary: checked,
isSecondary: !checked,
value: value
}, radioContext, props), children || value);
}
/* harmony default export */ var build_module_radio = (Object(external_wp_element_["forwardRef"])(radio_Radio));
// CONCATENATED MODULE: ./node_modules/reakit/es/Radio/RadioState.js
function useRadioState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var _useSealedState = useSealedState(initialState),
initialValue = _useSealedState.state,
_useSealedState$loop = _useSealedState.loop,
loop = _useSealedState$loop === void 0 ? true : _useSealedState$loop,
sealed = Object(_rollupPluginBabelHelpers_1f0bf8c2["a" /* _ */])(_useSealedState, ["state", "loop"]);
var _React$useState = Object(external_React_["useState"])(initialValue),
state = _React$useState[0],
setState = _React$useState[1];
var composite = useCompositeState(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, sealed), {}, {
loop: loop
}));
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, composite), {}, {
state: state,
setState: setState
});
}
// CONCATENATED MODULE: ./node_modules/reakit/es/Radio/RadioGroup.js
var useRadioGroup = Object(createHook["a" /* createHook */])({
name: "RadioGroup",
compose: useComposite,
keys: RADIO_GROUP_KEYS,
useProps: function useProps(_, htmlProps) {
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({
role: "radiogroup"
}, htmlProps);
}
});
var RadioGroup = Object(createComponent["a" /* createComponent */])({
as: "div",
useHook: useRadioGroup,
useCreateElement: function useCreateElement$1(type, props, children) {
false ? undefined : void 0;
return Object(useCreateElement["a" /* useCreateElement */])(type, props, children);
}
});
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/radio-group/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function radio_group_RadioGroup({
label,
checked,
defaultChecked,
disabled,
onChange,
...props
}, ref) {
const radioState = useRadioState({
state: defaultChecked,
baseId: props.id
});
const radioContext = { ...radioState,
disabled,
// controlled or uncontrolled
state: checked !== null && checked !== void 0 ? checked : radioState.state,
setState: onChange !== null && onChange !== void 0 ? onChange : radioState.setState
};
return Object(external_wp_element_["createElement"])(radio_context.Provider, {
value: radioContext
}, Object(external_wp_element_["createElement"])(RadioGroup, Object(esm_extends["a" /* default */])({
ref: ref,
as: button_group,
"aria-label": label
}, radioState, props)));
}
/* harmony default export */ var radio_group = (Object(external_wp_element_["forwardRef"])(radio_group_RadioGroup));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/radio-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function RadioControl({
label,
className,
selected,
help,
onChange,
options = [],
...props
}) {
const instanceId = Object(external_wp_compose_["useInstanceId"])(RadioControl);
const id = `inspector-radio-control-${instanceId}`;
const onChangeValue = event => onChange(event.target.value);
return !Object(external_lodash_["isEmpty"])(options) && Object(external_wp_element_["createElement"])(base_control, {
label: label,
id: id,
help: help,
className: classnames_default()(className, 'components-radio-control')
}, options.map((option, index) => Object(external_wp_element_["createElement"])("div", {
key: `${id}-${index}`,
className: "components-radio-control__option"
}, Object(external_wp_element_["createElement"])("input", Object(esm_extends["a" /* default */])({
id: `${id}-${index}`,
className: "components-radio-control__input",
type: "radio",
name: id,
value: option.value,
onChange: onChangeValue,
checked: option.value === selected,
"aria-describedby": !!help ? `${id}__help` : undefined
}, props)), Object(external_wp_element_["createElement"])("label", {
htmlFor: `${id}-${index}`
}, option.label))));
}
// CONCATENATED MODULE: ./node_modules/re-resizable/lib/resizer.js
var __extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __assign = (undefined && undefined.__assign) || function () {
__assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return __assign.apply(this, arguments);
};
var resizer_styles = {
top: {
width: '100%',
height: '10px',
top: '-5px',
left: '0px',
cursor: 'row-resize',
},
right: {
width: '10px',
height: '100%',
top: '0px',
right: '-5px',
cursor: 'col-resize',
},
bottom: {
width: '100%',
height: '10px',
bottom: '-5px',
left: '0px',
cursor: 'row-resize',
},
left: {
width: '10px',
height: '100%',
top: '0px',
left: '-5px',
cursor: 'col-resize',
},
topRight: {
width: '20px',
height: '20px',
position: 'absolute',
right: '-10px',
top: '-10px',
cursor: 'ne-resize',
},
bottomRight: {
width: '20px',
height: '20px',
position: 'absolute',
right: '-10px',
bottom: '-10px',
cursor: 'se-resize',
},
bottomLeft: {
width: '20px',
height: '20px',
position: 'absolute',
left: '-10px',
bottom: '-10px',
cursor: 'sw-resize',
},
topLeft: {
width: '20px',
height: '20px',
position: 'absolute',
left: '-10px',
top: '-10px',
cursor: 'nw-resize',
},
};
var resizer_Resizer = /** @class */ (function (_super) {
__extends(Resizer, _super);
function Resizer() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.onMouseDown = function (e) {
_this.props.onResizeStart(e, _this.props.direction);
};
_this.onTouchStart = function (e) {
_this.props.onResizeStart(e, _this.props.direction);
};
return _this;
}
Resizer.prototype.render = function () {
return (external_React_["createElement"]("div", { className: this.props.className || '', style: __assign(__assign({ position: 'absolute', userSelect: 'none' }, resizer_styles[this.props.direction]), (this.props.replaceStyles || {})), onMouseDown: this.onMouseDown, onTouchStart: this.onTouchStart }, this.props.children));
};
return Resizer;
}(external_React_["PureComponent"]));
// EXTERNAL MODULE: ./node_modules/fast-memoize/src/index.js
var fast_memoize_src = __webpack_require__("75pU");
var src_default = /*#__PURE__*/__webpack_require__.n(fast_memoize_src);
// CONCATENATED MODULE: ./node_modules/re-resizable/lib/index.js
var lib_extends = (undefined && undefined.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var lib_assign = (undefined && undefined.__assign) || function () {
lib_assign = Object.assign || function(t) {
for (var s, i = 1, n = arguments.length; i < n; i++) {
s = arguments[i];
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
t[p] = s[p];
}
return t;
};
return lib_assign.apply(this, arguments);
};
var DEFAULT_SIZE = {
width: 'auto',
height: 'auto',
};
var clamp = src_default()(function (n, min, max) { return Math.max(Math.min(n, max), min); });
var snap = src_default()(function (n, size) { return Math.round(n / size) * size; });
var hasDirection = src_default()(function (dir, target) {
return new RegExp(dir, 'i').test(target);
});
// INFO: In case of window is a Proxy and does not porxy Events correctly, use isTouchEvent & isMouseEvent to distinguish event type instead of `instanceof`.
var isTouchEvent = function (event) {
return Boolean(event.touches && event.touches.length);
};
var isMouseEvent = function (event) {
return Boolean((event.clientX || event.clientX === 0) &&
(event.clientY || event.clientY === 0));
};
var findClosestSnap = src_default()(function (n, snapArray, snapGap) {
if (snapGap === void 0) { snapGap = 0; }
var closestGapIndex = snapArray.reduce(function (prev, curr, index) { return (Math.abs(curr - n) < Math.abs(snapArray[prev] - n) ? index : prev); }, 0);
var gap = Math.abs(snapArray[closestGapIndex] - n);
return snapGap === 0 || gap < snapGap ? snapArray[closestGapIndex] : n;
});
var endsWith = src_default()(function (str, searchStr) {
return str.substr(str.length - searchStr.length, searchStr.length) === searchStr;
});
var getStringSize = src_default()(function (n) {
n = n.toString();
if (n === 'auto') {
return n;
}
if (endsWith(n, 'px')) {
return n;
}
if (endsWith(n, '%')) {
return n;
}
if (endsWith(n, 'vh')) {
return n;
}
if (endsWith(n, 'vw')) {
return n;
}
if (endsWith(n, 'vmax')) {
return n;
}
if (endsWith(n, 'vmin')) {
return n;
}
return n + "px";
});
var getPixelSize = function (size, parentSize, innerWidth, innerHeight) {
if (size && typeof size === 'string') {
if (endsWith(size, 'px')) {
return Number(size.replace('px', ''));
}
if (endsWith(size, '%')) {
var ratio = Number(size.replace('%', '')) / 100;
return parentSize * ratio;
}
if (endsWith(size, 'vw')) {
var ratio = Number(size.replace('vw', '')) / 100;
return innerWidth * ratio;
}
if (endsWith(size, 'vh')) {
var ratio = Number(size.replace('vh', '')) / 100;
return innerHeight * ratio;
}
}
return size;
};
var calculateNewMax = src_default()(function (parentSize, innerWidth, innerHeight, maxWidth, maxHeight, minWidth, minHeight) {
maxWidth = getPixelSize(maxWidth, parentSize.width, innerWidth, innerHeight);
maxHeight = getPixelSize(maxHeight, parentSize.height, innerWidth, innerHeight);
minWidth = getPixelSize(minWidth, parentSize.width, innerWidth, innerHeight);
minHeight = getPixelSize(minHeight, parentSize.height, innerWidth, innerHeight);
return {
maxWidth: typeof maxWidth === 'undefined' ? undefined : Number(maxWidth),
maxHeight: typeof maxHeight === 'undefined' ? undefined : Number(maxHeight),
minWidth: typeof minWidth === 'undefined' ? undefined : Number(minWidth),
minHeight: typeof minHeight === 'undefined' ? undefined : Number(minHeight),
};
});
var definedProps = [
'as',
'style',
'className',
'grid',
'snap',
'bounds',
'boundsByDirection',
'size',
'defaultSize',
'minWidth',
'minHeight',
'maxWidth',
'maxHeight',
'lockAspectRatio',
'lockAspectRatioExtraWidth',
'lockAspectRatioExtraHeight',
'enable',
'handleStyles',
'handleClasses',
'handleWrapperStyle',
'handleWrapperClass',
'children',
'onResizeStart',
'onResize',
'onResizeStop',
'handleComponent',
'scale',
'resizeRatio',
'snapGap',
];
// HACK: This class is used to calculate % size.
var baseClassName = '__resizable_base__';
var lib_Resizable = /** @class */ (function (_super) {
lib_extends(Resizable, _super);
function Resizable(props) {
var _this = _super.call(this, props) || this;
_this.ratio = 1;
_this.resizable = null;
// For parent boundary
_this.parentLeft = 0;
_this.parentTop = 0;
// For boundary
_this.resizableLeft = 0;
_this.resizableRight = 0;
_this.resizableTop = 0;
_this.resizableBottom = 0;
// For target boundary
_this.targetLeft = 0;
_this.targetTop = 0;
_this.appendBase = function () {
if (!_this.resizable || !_this.window) {
return null;
}
var parent = _this.parentNode;
if (!parent) {
return null;
}
var element = _this.window.document.createElement('div');
element.style.width = '100%';
element.style.height = '100%';
element.style.position = 'absolute';
element.style.transform = 'scale(0, 0)';
element.style.left = '0';
element.style.flex = '0';
if (element.classList) {
element.classList.add(baseClassName);
}
else {
element.className += baseClassName;
}
parent.appendChild(element);
return element;
};
_this.removeBase = function (base) {
var parent = _this.parentNode;
if (!parent) {
return;
}
parent.removeChild(base);
};
_this.ref = function (c) {
if (c) {
_this.resizable = c;
}
};
_this.state = {
isResizing: false,
width: typeof (_this.propsSize && _this.propsSize.width) === 'undefined'
? 'auto'
: _this.propsSize && _this.propsSize.width,
height: typeof (_this.propsSize && _this.propsSize.height) === 'undefined'
? 'auto'
: _this.propsSize && _this.propsSize.height,
direction: 'right',
original: {
x: 0,
y: 0,
width: 0,
height: 0,
},
backgroundStyle: {
height: '100%',
width: '100%',
backgroundColor: 'rgba(0,0,0,0)',
cursor: 'auto',
opacity: 0,
position: 'fixed',
zIndex: 9999,
top: '0',
left: '0',
bottom: '0',
right: '0',
},
flexBasis: undefined,
};
_this.onResizeStart = _this.onResizeStart.bind(_this);
_this.onMouseMove = _this.onMouseMove.bind(_this);
_this.onMouseUp = _this.onMouseUp.bind(_this);
return _this;
}
Object.defineProperty(Resizable.prototype, "parentNode", {
get: function () {
if (!this.resizable) {
return null;
}
return this.resizable.parentNode;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Resizable.prototype, "window", {
get: function () {
if (!this.resizable) {
return null;
}
if (!this.resizable.ownerDocument) {
return null;
}
return this.resizable.ownerDocument.defaultView;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Resizable.prototype, "propsSize", {
get: function () {
return this.props.size || this.props.defaultSize || DEFAULT_SIZE;
},
enumerable: false,
configurable: true
});
Object.defineProperty(Resizable.prototype, "size", {
get: function () {
var width = 0;
var height = 0;
if (this.resizable && this.window) {
var orgWidth = this.resizable.offsetWidth;
var orgHeight = this.resizable.offsetHeight;
// HACK: Set position `relative` to get parent size.
// This is because when re-resizable set `absolute`, I can not get base width correctly.
var orgPosition = this.resizable.style.position;
if (orgPosition !== 'relative') {
this.resizable.style.position = 'relative';
}
// INFO: Use original width or height if set auto.
width = this.resizable.style.width !== 'auto' ? this.resizable.offsetWidth : orgWidth;
height = this.resizable.style.height !== 'auto' ? this.resizable.offsetHeight : orgHeight;
// Restore original position
this.resizable.style.position = orgPosition;
}
return { width: width, height: height };
},
enumerable: false,
configurable: true
});
Object.defineProperty(Resizable.prototype, "sizeStyle", {
get: function () {
var _this = this;
var size = this.props.size;
var getSize = function (key) {
if (typeof _this.state[key] === 'undefined' || _this.state[key] === 'auto') {
return 'auto';
}
if (_this.propsSize && _this.propsSize[key] && endsWith(_this.propsSize[key].toString(), '%')) {
if (endsWith(_this.state[key].toString(), '%')) {
return _this.state[key].toString();
}
var parentSize = _this.getParentSize();
var value = Number(_this.state[key].toString().replace('px', ''));
var percent = (value / parentSize[key]) * 100;
return percent + "%";
}
return getStringSize(_this.state[key]);
};
var width = size && typeof size.width !== 'undefined' && !this.state.isResizing
? getStringSize(size.width)
: getSize('width');
var height = size && typeof size.height !== 'undefined' && !this.state.isResizing
? getStringSize(size.height)
: getSize('height');
return { width: width, height: height };
},
enumerable: false,
configurable: true
});
Resizable.prototype.getParentSize = function () {
if (!this.parentNode) {
if (!this.window) {
return { width: 0, height: 0 };
}
return { width: this.window.innerWidth, height: this.window.innerHeight };
}
var base = this.appendBase();
if (!base) {
return { width: 0, height: 0 };
}
// INFO: To calculate parent width with flex layout
var wrapChanged = false;
var wrap = this.parentNode.style.flexWrap;
if (wrap !== 'wrap') {
wrapChanged = true;
this.parentNode.style.flexWrap = 'wrap';
// HACK: Use relative to get parent padding size
}
base.style.position = 'relative';
base.style.minWidth = '100%';
var size = {
width: base.offsetWidth,
height: base.offsetHeight,
};
if (wrapChanged) {
this.parentNode.style.flexWrap = wrap;
}
this.removeBase(base);
return size;
};
Resizable.prototype.bindEvents = function () {
if (this.window) {
this.window.addEventListener('mouseup', this.onMouseUp);
this.window.addEventListener('mousemove', this.onMouseMove);
this.window.addEventListener('mouseleave', this.onMouseUp);
this.window.addEventListener('touchmove', this.onMouseMove, {
capture: true,
passive: false,
});
this.window.addEventListener('touchend', this.onMouseUp);
}
};
Resizable.prototype.unbindEvents = function () {
if (this.window) {
this.window.removeEventListener('mouseup', this.onMouseUp);
this.window.removeEventListener('mousemove', this.onMouseMove);
this.window.removeEventListener('mouseleave', this.onMouseUp);
this.window.removeEventListener('touchmove', this.onMouseMove, true);
this.window.removeEventListener('touchend', this.onMouseUp);
}
};
Resizable.prototype.componentDidMount = function () {
if (!this.resizable || !this.window) {
return;
}
var computedStyle = this.window.getComputedStyle(this.resizable);
this.setState({
width: this.state.width || this.size.width,
height: this.state.height || this.size.height,
flexBasis: computedStyle.flexBasis !== 'auto' ? computedStyle.flexBasis : undefined,
});
};
Resizable.prototype.componentWillUnmount = function () {
if (this.window) {
this.unbindEvents();
}
};
Resizable.prototype.createSizeForCssProperty = function (newSize, kind) {
var propsSize = this.propsSize && this.propsSize[kind];
return this.state[kind] === 'auto' &&
this.state.original[kind] === newSize &&
(typeof propsSize === 'undefined' || propsSize === 'auto')
? 'auto'
: newSize;
};
Resizable.prototype.calculateNewMaxFromBoundary = function (maxWidth, maxHeight) {
var boundsByDirection = this.props.boundsByDirection;
var direction = this.state.direction;
var widthByDirection = boundsByDirection && hasDirection('left', direction);
var heightByDirection = boundsByDirection && hasDirection('top', direction);
var boundWidth;
var boundHeight;
if (this.props.bounds === 'parent') {
var parent_1 = this.parentNode;
if (parent_1) {
boundWidth = widthByDirection
? this.resizableRight - this.parentLeft
: parent_1.offsetWidth + (this.parentLeft - this.resizableLeft);
boundHeight = heightByDirection
? this.resizableBottom - this.parentTop
: parent_1.offsetHeight + (this.parentTop - this.resizableTop);
}
}
else if (this.props.bounds === 'window') {
if (this.window) {
boundWidth = widthByDirection ? this.resizableRight : this.window.innerWidth - this.resizableLeft;
boundHeight = heightByDirection ? this.resizableBottom : this.window.innerHeight - this.resizableTop;
}
}
else if (this.props.bounds) {
boundWidth = widthByDirection
? this.resizableRight - this.targetLeft
: this.props.bounds.offsetWidth + (this.targetLeft - this.resizableLeft);
boundHeight = heightByDirection
? this.resizableBottom - this.targetTop
: this.props.bounds.offsetHeight + (this.targetTop - this.resizableTop);
}
if (boundWidth && Number.isFinite(boundWidth)) {
maxWidth = maxWidth && maxWidth < boundWidth ? maxWidth : boundWidth;
}
if (boundHeight && Number.isFinite(boundHeight)) {
maxHeight = maxHeight && maxHeight < boundHeight ? maxHeight : boundHeight;
}
return { maxWidth: maxWidth, maxHeight: maxHeight };
};
Resizable.prototype.calculateNewSizeFromDirection = function (clientX, clientY) {
var scale = this.props.scale || 1;
var resizeRatio = this.props.resizeRatio || 1;
var _a = this.state, direction = _a.direction, original = _a.original;
var _b = this.props, lockAspectRatio = _b.lockAspectRatio, lockAspectRatioExtraHeight = _b.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _b.lockAspectRatioExtraWidth;
var newWidth = original.width;
var newHeight = original.height;
var extraHeight = lockAspectRatioExtraHeight || 0;
var extraWidth = lockAspectRatioExtraWidth || 0;
if (hasDirection('right', direction)) {
newWidth = original.width + ((clientX - original.x) * resizeRatio) / scale;
if (lockAspectRatio) {
newHeight = (newWidth - extraWidth) / this.ratio + extraHeight;
}
}
if (hasDirection('left', direction)) {
newWidth = original.width - ((clientX - original.x) * resizeRatio) / scale;
if (lockAspectRatio) {
newHeight = (newWidth - extraWidth) / this.ratio + extraHeight;
}
}
if (hasDirection('bottom', direction)) {
newHeight = original.height + ((clientY - original.y) * resizeRatio) / scale;
if (lockAspectRatio) {
newWidth = (newHeight - extraHeight) * this.ratio + extraWidth;
}
}
if (hasDirection('top', direction)) {
newHeight = original.height - ((clientY - original.y) * resizeRatio) / scale;
if (lockAspectRatio) {
newWidth = (newHeight - extraHeight) * this.ratio + extraWidth;
}
}
return { newWidth: newWidth, newHeight: newHeight };
};
Resizable.prototype.calculateNewSizeFromAspectRatio = function (newWidth, newHeight, max, min) {
var _a = this.props, lockAspectRatio = _a.lockAspectRatio, lockAspectRatioExtraHeight = _a.lockAspectRatioExtraHeight, lockAspectRatioExtraWidth = _a.lockAspectRatioExtraWidth;
var computedMinWidth = typeof min.width === 'undefined' ? 10 : min.width;
var computedMaxWidth = typeof max.width === 'undefined' || max.width < 0 ? newWidth : max.width;
var computedMinHeight = typeof min.height === 'undefined' ? 10 : min.height;
var computedMaxHeight = typeof max.height === 'undefined' || max.height < 0 ? newHeight : max.height;
var extraHeight = lockAspectRatioExtraHeight || 0;
var extraWidth = lockAspectRatioExtraWidth || 0;
if (lockAspectRatio) {
var extraMinWidth = (computedMinHeight - extraHeight) * this.ratio + extraWidth;
var extraMaxWidth = (computedMaxHeight - extraHeight) * this.ratio + extraWidth;
var extraMinHeight = (computedMinWidth - extraWidth) / this.ratio + extraHeight;
var extraMaxHeight = (computedMaxWidth - extraWidth) / this.ratio + extraHeight;
var lockedMinWidth = Math.max(computedMinWidth, extraMinWidth);
var lockedMaxWidth = Math.min(computedMaxWidth, extraMaxWidth);
var lockedMinHeight = Math.max(computedMinHeight, extraMinHeight);
var lockedMaxHeight = Math.min(computedMaxHeight, extraMaxHeight);
newWidth = clamp(newWidth, lockedMinWidth, lockedMaxWidth);
newHeight = clamp(newHeight, lockedMinHeight, lockedMaxHeight);
}
else {
newWidth = clamp(newWidth, computedMinWidth, computedMaxWidth);
newHeight = clamp(newHeight, computedMinHeight, computedMaxHeight);
}
return { newWidth: newWidth, newHeight: newHeight };
};
Resizable.prototype.setBoundingClientRect = function () {
// For parent boundary
if (this.props.bounds === 'parent') {
var parent_2 = this.parentNode;
if (parent_2) {
var parentRect = parent_2.getBoundingClientRect();
this.parentLeft = parentRect.left;
this.parentTop = parentRect.top;
}
}
// For target(html element) boundary
if (this.props.bounds && typeof this.props.bounds !== 'string') {
var targetRect = this.props.bounds.getBoundingClientRect();
this.targetLeft = targetRect.left;
this.targetTop = targetRect.top;
}
// For boundary
if (this.resizable) {
var _a = this.resizable.getBoundingClientRect(), left = _a.left, top_1 = _a.top, right = _a.right, bottom = _a.bottom;
this.resizableLeft = left;
this.resizableRight = right;
this.resizableTop = top_1;
this.resizableBottom = bottom;
}
};
Resizable.prototype.onResizeStart = function (event, direction) {
if (!this.resizable || !this.window) {
return;
}
var clientX = 0;
var clientY = 0;
if (event.nativeEvent && isMouseEvent(event.nativeEvent)) {
clientX = event.nativeEvent.clientX;
clientY = event.nativeEvent.clientY;
// When user click with right button the resize is stuck in resizing mode
// until users clicks again, dont continue if right click is used.
// HACK: MouseEvent does not have `which` from flow-bin v0.68.
if (event.nativeEvent.which === 3) {
return;
}
}
else if (event.nativeEvent && isTouchEvent(event.nativeEvent)) {
clientX = event.nativeEvent.touches[0].clientX;
clientY = event.nativeEvent.touches[0].clientY;
}
if (this.props.onResizeStart) {
if (this.resizable) {
var startResize = this.props.onResizeStart(event, direction, this.resizable);
if (startResize === false) {
return;
}
}
}
// Fix #168
if (this.props.size) {
if (typeof this.props.size.height !== 'undefined' && this.props.size.height !== this.state.height) {
this.setState({ height: this.props.size.height });
}
if (typeof this.props.size.width !== 'undefined' && this.props.size.width !== this.state.width) {
this.setState({ width: this.props.size.width });
}
}
// For lockAspectRatio case
this.ratio =
typeof this.props.lockAspectRatio === 'number' ? this.props.lockAspectRatio : this.size.width / this.size.height;
var flexBasis;
var computedStyle = this.window.getComputedStyle(this.resizable);
if (computedStyle.flexBasis !== 'auto') {
var parent_3 = this.parentNode;
if (parent_3) {
var dir = this.window.getComputedStyle(parent_3).flexDirection;
this.flexDir = dir.startsWith('row') ? 'row' : 'column';
flexBasis = computedStyle.flexBasis;
}
}
// For boundary
this.setBoundingClientRect();
this.bindEvents();
var state = {
original: {
x: clientX,
y: clientY,
width: this.size.width,
height: this.size.height,
},
isResizing: true,
backgroundStyle: lib_assign(lib_assign({}, this.state.backgroundStyle), { cursor: this.window.getComputedStyle(event.target).cursor || 'auto' }),
direction: direction,
flexBasis: flexBasis,
};
this.setState(state);
};
Resizable.prototype.onMouseMove = function (event) {
if (!this.state.isResizing || !this.resizable || !this.window) {
return;
}
if (this.window.TouchEvent && isTouchEvent(event)) {
try {
event.preventDefault();
event.stopPropagation();
}
catch (e) {
// Ignore on fail
}
}
var _a = this.props, maxWidth = _a.maxWidth, maxHeight = _a.maxHeight, minWidth = _a.minWidth, minHeight = _a.minHeight;
var clientX = isTouchEvent(event) ? event.touches[0].clientX : event.clientX;
var clientY = isTouchEvent(event) ? event.touches[0].clientY : event.clientY;
var _b = this.state, direction = _b.direction, original = _b.original, width = _b.width, height = _b.height;
var parentSize = this.getParentSize();
var max = calculateNewMax(parentSize, this.window.innerWidth, this.window.innerHeight, maxWidth, maxHeight, minWidth, minHeight);
maxWidth = max.maxWidth;
maxHeight = max.maxHeight;
minWidth = max.minWidth;
minHeight = max.minHeight;
// Calculate new size
var _c = this.calculateNewSizeFromDirection(clientX, clientY), newHeight = _c.newHeight, newWidth = _c.newWidth;
// Calculate max size from boundary settings
var boundaryMax = this.calculateNewMaxFromBoundary(maxWidth, maxHeight);
// Calculate new size from aspect ratio
var newSize = this.calculateNewSizeFromAspectRatio(newWidth, newHeight, { width: boundaryMax.maxWidth, height: boundaryMax.maxHeight }, { width: minWidth, height: minHeight });
newWidth = newSize.newWidth;
newHeight = newSize.newHeight;
if (this.props.grid) {
var newGridWidth = snap(newWidth, this.props.grid[0]);
var newGridHeight = snap(newHeight, this.props.grid[1]);
var gap = this.props.snapGap || 0;
newWidth = gap === 0 || Math.abs(newGridWidth - newWidth) <= gap ? newGridWidth : newWidth;
newHeight = gap === 0 || Math.abs(newGridHeight - newHeight) <= gap ? newGridHeight : newHeight;
}
if (this.props.snap && this.props.snap.x) {
newWidth = findClosestSnap(newWidth, this.props.snap.x, this.props.snapGap);
}
if (this.props.snap && this.props.snap.y) {
newHeight = findClosestSnap(newHeight, this.props.snap.y, this.props.snapGap);
}
var delta = {
width: newWidth - original.width,
height: newHeight - original.height,
};
if (width && typeof width === 'string') {
if (endsWith(width, '%')) {
var percent = (newWidth / parentSize.width) * 100;
newWidth = percent + "%";
}
else if (endsWith(width, 'vw')) {
var vw = (newWidth / this.window.innerWidth) * 100;
newWidth = vw + "vw";
}
else if (endsWith(width, 'vh')) {
var vh = (newWidth / this.window.innerHeight) * 100;
newWidth = vh + "vh";
}
}
if (height && typeof height === 'string') {
if (endsWith(height, '%')) {
var percent = (newHeight / parentSize.height) * 100;
newHeight = percent + "%";
}
else if (endsWith(height, 'vw')) {
var vw = (newHeight / this.window.innerWidth) * 100;
newHeight = vw + "vw";
}
else if (endsWith(height, 'vh')) {
var vh = (newHeight / this.window.innerHeight) * 100;
newHeight = vh + "vh";
}
}
var newState = {
width: this.createSizeForCssProperty(newWidth, 'width'),
height: this.createSizeForCssProperty(newHeight, 'height'),
};
if (this.flexDir === 'row') {
newState.flexBasis = newState.width;
}
else if (this.flexDir === 'column') {
newState.flexBasis = newState.height;
}
this.setState(newState);
if (this.props.onResize) {
this.props.onResize(event, direction, this.resizable, delta);
}
};
Resizable.prototype.onMouseUp = function (event) {
var _a = this.state, isResizing = _a.isResizing, direction = _a.direction, original = _a.original;
if (!isResizing || !this.resizable) {
return;
}
var delta = {
width: this.size.width - original.width,
height: this.size.height - original.height,
};
if (this.props.onResizeStop) {
this.props.onResizeStop(event, direction, this.resizable, delta);
}
if (this.props.size) {
this.setState(this.props.size);
}
this.unbindEvents();
this.setState({
isResizing: false,
backgroundStyle: lib_assign(lib_assign({}, this.state.backgroundStyle), { cursor: 'auto' }),
});
};
Resizable.prototype.updateSize = function (size) {
this.setState({ width: size.width, height: size.height });
};
Resizable.prototype.renderResizer = function () {
var _this = this;
var _a = this.props, enable = _a.enable, handleStyles = _a.handleStyles, handleClasses = _a.handleClasses, handleWrapperStyle = _a.handleWrapperStyle, handleWrapperClass = _a.handleWrapperClass, handleComponent = _a.handleComponent;
if (!enable) {
return null;
}
var resizers = Object.keys(enable).map(function (dir) {
if (enable[dir] !== false) {
return (external_React_["createElement"](resizer_Resizer, { key: dir, direction: dir, onResizeStart: _this.onResizeStart, replaceStyles: handleStyles && handleStyles[dir], className: handleClasses && handleClasses[dir] }, handleComponent && handleComponent[dir] ? handleComponent[dir] : null));
}
return null;
});
// #93 Wrap the resize box in span (will not break 100% width/height)
return (external_React_["createElement"]("div", { className: handleWrapperClass, style: handleWrapperStyle }, resizers));
};
Resizable.prototype.render = function () {
var _this = this;
var extendsProps = Object.keys(this.props).reduce(function (acc, key) {
if (definedProps.indexOf(key) !== -1) {
return acc;
}
acc[key] = _this.props[key];
return acc;
}, {});
var style = lib_assign(lib_assign(lib_assign({ position: 'relative', userSelect: this.state.isResizing ? 'none' : 'auto' }, this.props.style), this.sizeStyle), { maxWidth: this.props.maxWidth, maxHeight: this.props.maxHeight, minWidth: this.props.minWidth, minHeight: this.props.minHeight, boxSizing: 'border-box', flexShrink: 0 });
if (this.state.flexBasis) {
style.flexBasis = this.state.flexBasis;
}
var Wrapper = this.props.as || 'div';
return (external_React_["createElement"](Wrapper, lib_assign({ ref: this.ref, style: style, className: this.props.className }, extendsProps),
this.state.isResizing && external_React_["createElement"]("div", { style: this.state.backgroundStyle }),
this.props.children,
this.renderResizer()));
};
Resizable.defaultProps = {
as: 'div',
onResizeStart: function () { },
onResize: function () { },
onResizeStop: function () { },
enable: {
top: true,
right: true,
bottom: true,
left: true,
topRight: true,
bottomRight: true,
bottomLeft: true,
topLeft: true,
},
style: {},
grid: [1, 1],
lockAspectRatio: false,
lockAspectRatioExtraWidth: 0,
lockAspectRatioExtraHeight: 0,
scale: 1,
resizeRatio: 1,
snapGap: 0,
};
return Resizable;
}(external_React_["PureComponent"]));
// EXTERNAL MODULE: ./node_modules/react-resize-aware/dist/index.js
var react_resize_aware_dist = __webpack_require__("SSiF");
var react_resize_aware_dist_default = /*#__PURE__*/__webpack_require__.n(react_resize_aware_dist);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/resizable-box/resize-tooltip/utils.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const {
clearTimeout: utils_clearTimeout,
setTimeout: utils_setTimeout
} = typeof window !== 'undefined' ? window : {};
const POSITIONS = {
bottom: 'bottom',
corner: 'corner'
};
/**
* @typedef {Object} UseResizeLabelProps
*
* @property {undefined|string} label The label value.
* @property {Function} resizeListener Element to be rendered for resize listening events.
*/
/**
* Custom hook that manages resize listener events. It also provides a label
* based on current resize width x height values.
*
* @param {Object} props
* @param {string} props.axis Only shows the label corresponding to the axis.
* @param {number} props.fadeTimeout Duration (ms) before deactivating the resize label.
* @param {boolean} props.onResize Callback when a resize occurs. Provides { width, height } callback.
* @param {string} props.position Adjusts label value.
* @param {boolean} props.showPx Whether to add `PX` to the label.
*
* @return {UseResizeLabelProps} Properties for hook.
*/
function useResizeLabel({
axis,
fadeTimeout = 180,
onResize = external_lodash_["noop"],
position = POSITIONS.bottom,
showPx = false
}) {
/*
* The width/height values derive from this special useResizeAware hook.
* This custom hook uses injects an iFrame into the element, allowing it
* to tap into the onResize (window) callback events.
*/
const [resizeListener, sizes] = react_resize_aware_dist_default()();
/*
* Indicates if the x/y axis is preferred.
* If set, we will avoid resetting the moveX and moveY values.
* This will allow for the preferred axis values to persist in the label.
*/
const isAxisControlled = !!axis;
/*
* The moveX and moveY values are used to track whether the label should
* display width, height, or width x height.
*/
const [moveX, setMoveX] = Object(external_wp_element_["useState"])(false);
const [moveY, setMoveY] = Object(external_wp_element_["useState"])(false);
/*
* Cached dimension values to check for width/height updates from the
* sizes property from useResizeAware()
*/
const {
width,
height
} = sizes;
const heightRef = Object(external_wp_element_["useRef"])(height);
const widthRef = Object(external_wp_element_["useRef"])(width);
/*
* This timeout is used with setMoveX and setMoveY to determine of
* both width and height values have changed at (roughly) the same time.
*/
const moveTimeoutRef = Object(external_wp_element_["useRef"])();
const unsetMoveXY = () => {
/*
* If axis is controlled, we will avoid resetting the moveX and moveY values.
* This will allow for the preferred axis values to persist in the label.
*/
if (isAxisControlled) return;
setMoveX(false);
setMoveY(false);
};
const debounceUnsetMoveXY = () => {
if (moveTimeoutRef.current) {
utils_clearTimeout(moveTimeoutRef.current);
}
moveTimeoutRef.current = utils_setTimeout(unsetMoveXY, fadeTimeout);
};
Object(external_wp_element_["useEffect"])(() => {
/*
* On the initial render of useResizeAware, the height and width values are
* null. They are calculated then set using via an internal useEffect hook.
*/
const isRendered = width !== null || height !== null;
if (!isRendered) return;
const didWidthChange = width !== widthRef.current;
const didHeightChange = height !== heightRef.current;
if (!didWidthChange && !didHeightChange) return;
/*
* After the initial render, the useResizeAware will set the first
* width and height values. We'll sync those values with our
* width and height refs. However, we shouldn't render our Tooltip
* label on this first cycle.
*/
if (width && !widthRef.current && height && !heightRef.current) {
widthRef.current = width;
heightRef.current = height;
return;
}
/*
* After the first cycle, we can track width and height changes.
*/
if (didWidthChange) {
setMoveX(true);
widthRef.current = width;
}
if (didHeightChange) {
setMoveY(true);
heightRef.current = height;
}
onResize({
width,
height
});
debounceUnsetMoveXY();
}, [width, height]);
const label = getSizeLabel({
axis,
height,
moveX,
moveY,
position,
showPx,
width
});
return {
label,
resizeListener
};
}
/**
* Gets the resize label based on width and height values (as well as recent changes).
*
* @param {Object} props
* @param {string} props.axis Only shows the label corresponding to the axis.
* @param {number} props.height Height value.
* @param {boolean} props.moveX Recent width (x axis) changes.
* @param {boolean} props.moveY Recent width (y axis) changes.
* @param {string} props.position Adjusts label value.
* @param {boolean} props.showPx Whether to add `PX` to the label.
* @param {number} props.width Width value.
*
* @return {undefined | string} The rendered label.
*/
function getSizeLabel({
axis,
height,
moveX = false,
moveY = false,
position = POSITIONS.bottom,
showPx = false,
width
}) {
if (!moveX && !moveY) return null;
/*
* Corner position...
* We want the label to appear like width x height.
*/
if (position === POSITIONS.corner) {
return `${width} x ${height}`;
}
/*
* Other POSITIONS...
* The label will combine both width x height values if both
* values have recently been changed.
*
* Otherwise, only width or height will be displayed.
* The `PX` unit will be added, if specified by the `showPx` prop.
*/
const labelUnit = showPx ? ' px' : '';
if (axis) {
if (axis === 'x' && moveX) {
return `${width}${labelUnit}`;
}
if (axis === 'y' && moveY) {
return `${height}${labelUnit}`;
}
}
if (moveX && moveY) {
return `${width} x ${height}`;
}
if (moveX) {
return `${width}${labelUnit}`;
}
if (moveY) {
return `${height}${labelUnit}`;
}
return null;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/resizable-box/resize-tooltip/styles/resize-tooltip.styles.js
function resize_tooltip_styles_EMOTION_STRINGIFIED_CSS_ERROR_() { return "You have tried to stringify object returned from `css` function. It isn't supposed to be used directly (e.g. as value of the `className` prop), but rather handed to emotion so it can handle it (e.g. as value of `css` prop)."; }
/**
* Internal dependencies
*/
const resize_tooltip_styles_Root = styled_base_browser_esm("div", {
target: "ekdag500",
label: "Root"
})( true ? {
name: "mt2ez5",
styles: "bottom:0;box-sizing:border-box;left:0;pointer-events:none;position:absolute;right:0;top:0;"
} : undefined);
const TooltipWrapper = styled_base_browser_esm("div", {
target: "ekdag501",
label: "TooltipWrapper"
})( true ? {
name: "1kllayo",
styles: "align-items:center;box-sizing:border-box;display:inline-flex;justify-content:center;opacity:0;pointer-events:none;transition:opacity 120ms linear;"
} : undefined);
const resize_tooltip_styles_Tooltip = styled_base_browser_esm("div", {
target: "ekdag502",
label: "Tooltip"
})("background:", COLORS.ui.border, ";border-radius:2px;box-sizing:border-box;font-size:12px;color:", COLORS.ui.textDark, ";padding:4px 8px;position:relative;" + ( true ? "" : undefined)); // TODO: Resolve need to use &&& to increase specificity
// https://github.com/WordPress/gutenberg/issues/18483
const LabelText = /*#__PURE__*/styled_base_browser_esm(text_component, {
target: "ekdag503",
label: "LabelText"
})( true ? {
name: "1kboj1g",
styles: "&&&{color:white;display:block;font-size:13px;line-height:1.4;}"
} : undefined);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/resizable-box/resize-tooltip/label.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const CORNER_OFFSET = 4;
const CURSOR_OFFSET_TOP = CORNER_OFFSET * 2.5;
function resize_tooltip_label_Label({
label,
position = POSITIONS.corner,
zIndex = 1000,
...props
}, ref) {
const showLabel = !!label;
const isBottom = position === POSITIONS.bottom;
const isCorner = position === POSITIONS.corner;
if (!showLabel) return null;
let style = {
opacity: showLabel ? 1 : null,
zIndex
};
let labelStyle = {};
if (isBottom) {
style = { ...style,
position: 'absolute',
bottom: CURSOR_OFFSET_TOP * -1,
left: '50%',
transform: 'translate(-50%, 0)'
};
labelStyle = {
transform: `translate(0, 100%)`
};
}
if (isCorner) {
style = { ...style,
position: 'absolute',
top: CORNER_OFFSET,
right: Object(external_wp_i18n_["isRTL"])() ? null : CORNER_OFFSET,
left: Object(external_wp_i18n_["isRTL"])() ? CORNER_OFFSET : null
};
}
return Object(external_wp_element_["createElement"])(TooltipWrapper, Object(esm_extends["a" /* default */])({
"aria-hidden": "true",
className: "components-resizable-tooltip__tooltip-wrapper",
isActive: showLabel,
ref: ref,
style: style
}, props), Object(external_wp_element_["createElement"])(resize_tooltip_styles_Tooltip, {
className: "components-resizable-tooltip__tooltip",
style: labelStyle
}, Object(external_wp_element_["createElement"])(LabelText, {
as: "span"
}, label)));
}
const label_ForwardedComponent = Object(external_wp_element_["forwardRef"])(resize_tooltip_label_Label);
/* harmony default export */ var resize_tooltip_label = (label_ForwardedComponent);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/resizable-box/resize-tooltip/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ResizeTooltip({
axis,
className,
fadeTimeout = 180,
isVisible = true,
labelRef,
onResize = external_lodash_["noop"],
position = POSITIONS.bottom,
showPx = true,
zIndex = 1000,
...props
}, ref) {
const {
label,
resizeListener
} = useResizeLabel({
axis,
fadeTimeout,
onResize,
showPx,
position
});
if (!isVisible) return null;
const classes = classnames_default()('components-resize-tooltip', className);
return Object(external_wp_element_["createElement"])(resize_tooltip_styles_Root, Object(esm_extends["a" /* default */])({
"aria-hidden": "true",
className: classes,
ref: ref
}, props), resizeListener, Object(external_wp_element_["createElement"])(resize_tooltip_label, {
"aria-hidden": props['aria-hidden'],
fadeTimeout: fadeTimeout,
isVisible: isVisible,
label: label,
position: position,
ref: labelRef,
zIndex: zIndex
}));
}
const resize_tooltip_ForwardedComponent = Object(external_wp_element_["forwardRef"])(ResizeTooltip);
/* harmony default export */ var resize_tooltip = (resize_tooltip_ForwardedComponent);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/resizable-box/index.js
/**
* WordPress dependencies
*/
/**
* External dependencies
*/
/**
* Internal dependencies
*/
function ResizableBox({
className,
children,
showHandle = true,
__experimentalShowTooltip: showTooltip = false,
__experimentalTooltipProps: tooltipProps = {},
...props
}, ref) {
// Removes the inline styles in the drag handles.
const handleStylesOverrides = {
width: null,
height: null,
top: null,
right: null,
bottom: null,
left: null
};
const handleClassName = 'components-resizable-box__handle';
const sideHandleClassName = 'components-resizable-box__side-handle';
const cornerHandleClassName = 'components-resizable-box__corner-handle';
return Object(external_wp_element_["createElement"])(lib_Resizable, Object(esm_extends["a" /* default */])({
className: classnames_default()('components-resizable-box__container', showHandle && 'has-show-handle', className),
handleClasses: {
top: classnames_default()(handleClassName, sideHandleClassName, 'components-resizable-box__handle-top'),
right: classnames_default()(handleClassName, sideHandleClassName, 'components-resizable-box__handle-right'),
bottom: classnames_default()(handleClassName, sideHandleClassName, 'components-resizable-box__handle-bottom'),
left: classnames_default()(handleClassName, sideHandleClassName, 'components-resizable-box__handle-left'),
topLeft: classnames_default()(handleClassName, cornerHandleClassName, 'components-resizable-box__handle-top', 'components-resizable-box__handle-left'),
topRight: classnames_default()(handleClassName, cornerHandleClassName, 'components-resizable-box__handle-top', 'components-resizable-box__handle-right'),
bottomRight: classnames_default()(handleClassName, cornerHandleClassName, 'components-resizable-box__handle-bottom', 'components-resizable-box__handle-right'),
bottomLeft: classnames_default()(handleClassName, cornerHandleClassName, 'components-resizable-box__handle-bottom', 'components-resizable-box__handle-left')
},
handleStyles: {
top: handleStylesOverrides,
right: handleStylesOverrides,
bottom: handleStylesOverrides,
left: handleStylesOverrides,
topLeft: handleStylesOverrides,
topRight: handleStylesOverrides,
bottomRight: handleStylesOverrides,
bottomLeft: handleStylesOverrides
},
ref: ref
}, props), children, showTooltip && Object(external_wp_element_["createElement"])(resize_tooltip, tooltipProps));
}
/* harmony default export */ var resizable_box = (Object(external_wp_element_["forwardRef"])(ResizableBox));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/responsive-wrapper/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
function ResponsiveWrapper({
naturalWidth,
naturalHeight,
children,
isInline = false
}) {
const [containerResizeListener, {
width: containerWidth
}] = Object(external_wp_compose_["useResizeObserver"])();
if (external_wp_element_["Children"].count(children) !== 1) {
return null;
}
const imageStyle = {
paddingBottom: naturalWidth < containerWidth ? naturalHeight : naturalHeight / naturalWidth * 100 + '%'
};
const TagName = isInline ? 'span' : 'div';
return Object(external_wp_element_["createElement"])(TagName, {
className: "components-responsive-wrapper"
}, containerResizeListener, Object(external_wp_element_["createElement"])(TagName, {
style: imageStyle
}), Object(external_wp_element_["cloneElement"])(children, {
className: classnames_default()('components-responsive-wrapper__content', children.props.className)
}));
}
/* harmony default export */ var responsive_wrapper = (ResponsiveWrapper);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/sandbox/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const observeAndResizeJS = `
( function() {
var observer;
if ( ! window.MutationObserver || ! document.body || ! window.parent ) {
return;
}
function sendResize() {
var clientBoundingRect = document.body.getBoundingClientRect();
window.parent.postMessage( {
action: 'resize',
width: clientBoundingRect.width,
height: clientBoundingRect.height,
}, '*' );
}
observer = new MutationObserver( sendResize );
observer.observe( document.body, {
attributes: true,
attributeOldValue: false,
characterData: true,
characterDataOldValue: false,
childList: true,
subtree: true
} );
window.addEventListener( 'load', sendResize, true );
// Hack: Remove viewport unit styles, as these are relative
// the iframe root and interfere with our mechanism for
// determining the unconstrained page bounds.
function removeViewportStyles( ruleOrNode ) {
if( ruleOrNode.style ) {
[ 'width', 'height', 'minHeight', 'maxHeight' ].forEach( function( style ) {
if ( /^\\d+(vmin|vmax|vh|vw)$/.test( ruleOrNode.style[ style ] ) ) {
ruleOrNode.style[ style ] = '';
}
} );
}
}
Array.prototype.forEach.call( document.querySelectorAll( '[style]' ), removeViewportStyles );
Array.prototype.forEach.call( document.styleSheets, function( stylesheet ) {
Array.prototype.forEach.call( stylesheet.cssRules || stylesheet.rules, removeViewportStyles );
} );
document.body.style.position = 'absolute';
document.body.style.width = '100%';
document.body.setAttribute( 'data-resizable-iframe-connected', '' );
sendResize();
// Resize events can change the width of elements with 100% width, but we don't
// get an DOM mutations for that, so do the resize when the window is resized, too.
window.addEventListener( 'resize', sendResize, true );
} )();`;
const sandbox_style = `
body {
margin: 0;
}
html,
body,
body > div,
body > div iframe {
width: 100%;
}
html.wp-has-aspect-ratio,
body.wp-has-aspect-ratio,
body.wp-has-aspect-ratio > div,
body.wp-has-aspect-ratio > div iframe {
height: 100%;
overflow: hidden; /* If it has an aspect ratio, it shouldn't scroll. */
}
body > div > * {
margin-top: 0 !important; /* Has to have !important to override inline styles. */
margin-bottom: 0 !important;
}
`;
function Sandbox({
html = '',
title = '',
type,
styles = [],
scripts = [],
onFocus
}) {
const ref = Object(external_wp_element_["useRef"])();
const [width, setWidth] = Object(external_wp_element_["useState"])(0);
const [height, setHeight] = Object(external_wp_element_["useState"])(0);
function isFrameAccessible() {
try {
return !!ref.current.contentDocument.body;
} catch (e) {
return false;
}
}
function trySandbox(forceRerender = false) {
if (!isFrameAccessible()) {
return;
}
const {
contentDocument,
ownerDocument
} = ref.current;
const {
body
} = contentDocument;
if (!forceRerender && null !== body.getAttribute('data-resizable-iframe-connected')) {
return;
} // put the html snippet into a html document, and then write it to the iframe's document
// we can use this in the future to inject custom styles or scripts.
// Scripts go into the body rather than the head, to support embedded content such as Instagram
// that expect the scripts to be part of the body.
const htmlDoc = Object(external_wp_element_["createElement"])("html", {
lang: ownerDocument.documentElement.lang,
className: type
}, Object(external_wp_element_["createElement"])("head", null, Object(external_wp_element_["createElement"])("title", null, title), Object(external_wp_element_["createElement"])("style", {
dangerouslySetInnerHTML: {
__html: sandbox_style
}
}), styles.map((rules, i) => Object(external_wp_element_["createElement"])("style", {
key: i,
dangerouslySetInnerHTML: {
__html: rules
}
}))), Object(external_wp_element_["createElement"])("body", {
"data-resizable-iframe-connected": "data-resizable-iframe-connected",
className: type
}, Object(external_wp_element_["createElement"])("div", {
dangerouslySetInnerHTML: {
__html: html
}
}), Object(external_wp_element_["createElement"])("script", {
type: "text/javascript",
dangerouslySetInnerHTML: {
__html: observeAndResizeJS
}
}), scripts.map(src => Object(external_wp_element_["createElement"])("script", {
key: src,
src: src
})))); // writing the document like this makes it act in the same way as if it was
// loaded over the network, so DOM creation and mutation, script execution, etc.
// all work as expected
contentDocument.open();
contentDocument.write('<!DOCTYPE html>' + Object(external_wp_element_["renderToString"])(htmlDoc));
contentDocument.close();
}
Object(external_wp_element_["useEffect"])(() => {
trySandbox();
function tryNoForceSandbox() {
trySandbox(false);
}
function checkMessageForResize(event) {
const iframe = ref.current; // Verify that the mounted element is the source of the message
if (!iframe || iframe.contentWindow !== event.source) {
return;
} // Attempt to parse the message data as JSON if passed as string
let data = event.data || {};
if ('string' === typeof data) {
try {
data = JSON.parse(data);
} catch (e) {}
} // Update the state only if the message is formatted as we expect,
// i.e. as an object with a 'resize' action.
if ('resize' !== data.action) {
return;
}
setWidth(data.width);
setHeight(data.height);
}
const {
ownerDocument
} = ref.current;
const {
defaultView
} = ownerDocument; // This used to be registered using <iframe onLoad={} />, but it made the iframe blank
// after reordering the containing block. See these two issues for more details:
// https://github.com/WordPress/gutenberg/issues/6146
// https://github.com/facebook/react/issues/18752
ref.current.addEventListener('load', tryNoForceSandbox, false);
defaultView.addEventListener('message', checkMessageForResize);
return () => {
ref.current.removeEventListener('load', tryNoForceSandbox, false);
defaultView.addEventListener('message', checkMessageForResize);
};
}, []);
Object(external_wp_element_["useEffect"])(() => {
trySandbox();
}, [title, type, styles, scripts]);
Object(external_wp_element_["useEffect"])(() => {
trySandbox(true);
}, [html]);
return Object(external_wp_element_["createElement"])(FocusableIframe, {
iframeRef: ref,
title: title,
className: "components-sandbox",
sandbox: "allow-scripts allow-same-origin allow-presentation",
onFocus: onFocus,
width: Math.ceil(width),
height: Math.ceil(height)
});
}
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/snackbar/index.js
var snackbar = __webpack_require__("iB/h");
// EXTERNAL MODULE: ./node_modules/react-spring/web.cjs.js
var web_cjs = __webpack_require__("ZO3Q");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/snackbar/list.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Renders a list of notices.
*
* @param {Object} $0 Props passed to the component.
* @param {Array} $0.notices Array of notices to render.
* @param {Function} $0.onRemove Function called when a notice should be removed / dismissed.
* @param {Object} $0.className Name of the class used by the component.
* @param {Object} $0.children Array of children to be rendered inside the notice list.
* @return {Object} The rendered notices list.
*/
function SnackbarList({
notices,
className,
children,
onRemove = external_lodash_["noop"]
}) {
const isReducedMotion = Object(external_wp_compose_["useReducedMotion"])();
const [refMap] = Object(external_wp_element_["useState"])(() => new WeakMap());
const transitions = Object(web_cjs["useTransition"])(notices, notice => notice.id, {
from: {
opacity: 0,
height: 0
},
enter: item => async (next) => await next({
opacity: 1,
height: refMap.get(item).offsetHeight
}),
leave: () => async next => {
await next({
opacity: 0
});
await next({
height: 0
});
},
immediate: isReducedMotion
});
className = classnames_default()('components-snackbar-list', className);
const removeNotice = notice => () => onRemove(notice.id);
return Object(external_wp_element_["createElement"])("div", {
className: className
}, children, transitions.map(({
item: notice,
key,
props: style
}) => Object(external_wp_element_["createElement"])(web_cjs["animated"].div, {
key: key,
style: style
}, Object(external_wp_element_["createElement"])("div", {
className: "components-snackbar-list__notice-container",
ref: ref => ref && refMap.set(notice, ref)
}, Object(external_wp_element_["createElement"])(snackbar["a" /* default */], Object(esm_extends["a" /* default */])({}, Object(external_lodash_["omit"])(notice, ['content']), {
onRemove: removeNotice(notice)
}), notice.content)))));
}
/* harmony default export */ var snackbar_list = (SnackbarList);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/spacer/hook.js
/**
* Internal dependencies
*/
// eslint-disable-next-line no-duplicate-imports
const isDefined = o => typeof o !== 'undefined' && o !== null;
function useSpacer(props) {
const {
className,
margin,
marginBottom = 2,
marginLeft,
marginRight,
marginTop,
marginX,
marginY,
padding,
paddingBottom,
paddingLeft,
paddingRight,
paddingTop,
paddingX,
paddingY,
...otherProps
} = Object(use_context_system["a" /* useContextSystem */])(props, 'Spacer');
const classes = Object(emotion_esm["b" /* cx */])(isDefined(marginTop) && /*#__PURE__*/Object(emotion_esm["a" /* css */])("margin-top:", space_space(marginTop), ";;label:classes;" + ( true ? "" : undefined)), isDefined(marginBottom) && /*#__PURE__*/Object(emotion_esm["a" /* css */])("margin-bottom:", space_space(marginBottom), ";;label:classes;" + ( true ? "" : undefined)), isDefined(marginLeft) && /*#__PURE__*/Object(emotion_esm["a" /* css */])("margin-left:", space_space(marginLeft), ";;label:classes;" + ( true ? "" : undefined)), isDefined(marginRight) && /*#__PURE__*/Object(emotion_esm["a" /* css */])("margin-right:", space_space(marginRight), ";;label:classes;" + ( true ? "" : undefined)), isDefined(marginX) && /*#__PURE__*/Object(emotion_esm["a" /* css */])("margin-left:", space_space(marginX), ";margin-right:", space_space(marginX), ";;label:classes;" + ( true ? "" : undefined)), isDefined(marginY) && /*#__PURE__*/Object(emotion_esm["a" /* css */])("margin-bottom:", space_space(marginY), ";margin-top:", space_space(marginY), ";;label:classes;" + ( true ? "" : undefined)), isDefined(margin) && /*#__PURE__*/Object(emotion_esm["a" /* css */])("margin:", space_space(margin), ";;label:classes;" + ( true ? "" : undefined)), isDefined(paddingTop) && /*#__PURE__*/Object(emotion_esm["a" /* css */])("padding-top:", space_space(paddingTop), ";;label:classes;" + ( true ? "" : undefined)), isDefined(paddingBottom) && /*#__PURE__*/Object(emotion_esm["a" /* css */])("padding-bottom:", space_space(paddingBottom), ";;label:classes;" + ( true ? "" : undefined)), isDefined(paddingLeft) && /*#__PURE__*/Object(emotion_esm["a" /* css */])("padding-left:", space_space(paddingLeft), ";;label:classes;" + ( true ? "" : undefined)), isDefined(paddingRight) && /*#__PURE__*/Object(emotion_esm["a" /* css */])("padding-right:", space_space(paddingRight), ";;label:classes;" + ( true ? "" : undefined)), isDefined(paddingX) && /*#__PURE__*/Object(emotion_esm["a" /* css */])("padding-left:", space_space(paddingX), ";padding-right:", space_space(paddingX), ";;label:classes;" + ( true ? "" : undefined)), isDefined(paddingY) && /*#__PURE__*/Object(emotion_esm["a" /* css */])("padding-bottom:", space_space(paddingY), ";padding-top:", space_space(paddingY), ";;label:classes;" + ( true ? "" : undefined)), isDefined(padding) && /*#__PURE__*/Object(emotion_esm["a" /* css */])("padding:", space_space(padding), ";;label:classes;" + ( true ? "" : undefined)), className);
return { ...otherProps,
className: classes
};
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/spacer/component.js
/**
* Internal dependencies
*/
/**
* `Spacer` is a primitive layout component that providers inner (`padding`) or outer (`margin`) space in-between components. It can also be used to adaptively provide space within an `HStack` or `VStack`.
*
* `Spacer` comes with a bunch of shorthand props to adjust `margin` and `padding`. The values of these props work as a multiplier to the library's grid system (base of `4px`).
*
* @example
* ```jsx
* import { Spacer } from `@wordpress/components`
*
* function Example() {
* return (
* <View>
* <Spacer>
* <Heading>WordPress.org</Heading>
* </Spacer>
* <Text>
* Code is Poetry
* </Text>
* </View>
* );
* }
* ```
*/
const Spacer = create_component_createComponent({
as: 'div',
useHook: useSpacer,
name: 'Spacer'
});
/* harmony default export */ var spacer_component = (Spacer);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/spinner/styles/spinner-styles.js
/**
* Internal dependencies
*/
const spinAnimation = core_browser_esm_keyframes`
from {
transform: rotate(0deg);
}
to {
transform: rotate(360deg);
}
`;
const topLeft = `calc( ( ${config_values.spinnerSize} - ${config_values.spinnerSize} * ( 2 / 3 ) ) / 2 )`;
const StyledSpinner = styled_base_browser_esm("span", {
target: "e1s472tg0",
label: "StyledSpinner"
})("display:inline-block;background-color:", COLORS.gray[600], ";width:", config_values.spinnerSize, ";height:", config_values.spinnerSize, ";opacity:0.7;margin:5px 11px 0;border-radius:100%;position:relative;&::before{content:'';position:absolute;background-color:", COLORS.white, ";top:", topLeft, ";left:", topLeft, ";width:calc( ", config_values.spinnerSize, " / 4.5 );height:calc( ", config_values.spinnerSize, " / 4.5 );border-radius:100%;transform-origin:calc( ", config_values.spinnerSize, " / 3 ) calc( ", config_values.spinnerSize, " / 3 );animation:", spinAnimation, " 1s infinite linear;}" + ( true ? "" : undefined));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/spinner/index.js
/**
* Internal dependencies
*/
function Spinner() {
return Object(external_wp_element_["createElement"])(StyledSpinner, {
className: "components-spinner"
});
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tab-panel/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const TabButton = ({
tabId,
onClick,
children,
selected,
...rest
}) => Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], Object(esm_extends["a" /* default */])({
role: "tab",
tabIndex: selected ? null : -1,
"aria-selected": selected,
id: tabId,
onClick: onClick
}, rest), children);
function TabPanel({
className,
children,
tabs,
initialTabName,
orientation = 'horizontal',
activeClass = 'is-active',
onSelect = external_lodash_["noop"]
}) {
var _selectedTab$name;
const instanceId = Object(external_wp_compose_["useInstanceId"])(TabPanel, 'tab-panel');
const [selected, setSelected] = Object(external_wp_element_["useState"])(null);
const handleClick = tabKey => {
setSelected(tabKey);
onSelect(tabKey);
};
const onNavigate = (childIndex, child) => {
child.click();
};
const selectedTab = Object(external_lodash_["find"])(tabs, {
name: selected
});
const selectedId = `${instanceId}-${(_selectedTab$name = selectedTab === null || selectedTab === void 0 ? void 0 : selectedTab.name) !== null && _selectedTab$name !== void 0 ? _selectedTab$name : 'none'}`;
Object(external_wp_element_["useEffect"])(() => {
const newSelectedTab = Object(external_lodash_["find"])(tabs, {
name: selected
});
if (!newSelectedTab) {
setSelected(initialTabName || (tabs.length > 0 ? tabs[0].name : null));
}
}, [tabs]);
return Object(external_wp_element_["createElement"])("div", {
className: className
}, Object(external_wp_element_["createElement"])(navigable_container_menu, {
role: "tablist",
orientation: orientation,
onNavigate: onNavigate,
className: "components-tab-panel__tabs"
}, tabs.map(tab => Object(external_wp_element_["createElement"])(TabButton, {
className: classnames_default()('components-tab-panel__tabs-item', tab.className, {
[activeClass]: tab.name === selected
}),
tabId: `${instanceId}-${tab.name}`,
"aria-controls": `${instanceId}-${tab.name}-view`,
selected: tab.name === selected,
key: tab.name,
onClick: Object(external_lodash_["partial"])(handleClick, tab.name)
}, tab.title))), selectedTab && Object(external_wp_element_["createElement"])("div", {
key: selectedId,
"aria-labelledby": selectedId,
role: "tabpanel",
id: `${selectedId}-view`,
className: "components-tab-panel__tab-content"
}, children(selectedTab)));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/input/base.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const inputStyleNeutral = /*#__PURE__*/css_browser_esm("box-shadow:0 0 0 transparent;transition:box-shadow 0.1s linear;border-radius:", config_values.radiusBlockUi, ";border:", config_values.borderWidth, " solid ", COLORS.ui.border, "};", reduceMotion('transition'), ";label:inputStyleNeutral;" + ( true ? "" : undefined));
const inputStyleFocus = /*#__PURE__*/css_browser_esm("border-color:var( --wp-admin-theme-color );box-shadow:0 0 0 calc( ", config_values.borderWidthFocus, " - ", config_values.borderWidth, " ) var( --wp-admin-theme-color );outline:2px solid transparent;;label:inputStyleFocus;" + ( true ? "" : undefined));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/breakpoint-values.js
/* harmony default export */ var breakpoint_values = ({
huge: '1440px',
wide: '1280px',
'x-large': '1080px',
large: '960px',
// admin sidebar auto folds
medium: '782px',
// adminbar goes big
small: '600px',
mobile: '480px',
'zoomed-in': '280px'
});
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/breakpoint.js
/**
* Internal dependencies
*/
/**
* @param {keyof breakpoints} point
* @return {string} Media query declaration.
*/
const breakpoint = point => `@media (min-width: ${breakpoint_values[point]})`;
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/utils/input/input-control.js
/**
* External dependencies
*/
/**
* Internal dependencies
*/
const inputControl = /*#__PURE__*/css_browser_esm("font-family:", font('default.fontFamily'), ";padding:6px 8px;", inputStyleNeutral, ";font-size:", font('mobileTextMinFontSize'), ";line-height:normal;", breakpoint('small'), "{font-size:", font('default.fontSize'), ";line-height:normal;}&:focus{", inputStyleFocus, "}&::-webkit-input-placeholder{color:", COLORS.darkGray.placeholder, ";}&::-moz-placeholder{opacity:1;color:", COLORS.darkGray.placeholder, ";}&:-ms-input-placeholder{color:", COLORS.darkGray.placeholder, ";}.is-dark-theme &{&::-webkit-input-placeholder{color:", COLORS.lightGray.placeholder, ";}&::-moz-placeholder{opacity:1;color:", COLORS.lightGray.placeholder, ";}&:-ms-input-placeholder{color:", COLORS.lightGray.placeholder, ";}};label:inputControl;" + ( true ? "" : undefined));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/textarea-control/styles/textarea-control-styles.js
/**
* Internal dependencies
*/
const StyledTextarea = styled_base_browser_esm("textarea", {
target: "ebk7yr50",
label: "StyledTextarea"
})("width:100%;", inputControl, true ? "" : undefined);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/textarea-control/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function TextareaControl({
label,
hideLabelFromVision,
value,
help,
onChange,
rows = 4,
className,
...props
}) {
const instanceId = Object(external_wp_compose_["useInstanceId"])(TextareaControl);
const id = `inspector-textarea-control-${instanceId}`;
const onChangeValue = event => onChange(event.target.value);
return Object(external_wp_element_["createElement"])(base_control, {
label: label,
hideLabelFromVision: hideLabelFromVision,
id: id,
help: help,
className: className
}, Object(external_wp_element_["createElement"])(StyledTextarea, Object(esm_extends["a" /* default */])({
className: "components-textarea-control__input",
id: id,
rows: rows,
onChange: onChangeValue,
"aria-describedby": !!help ? id + '__help' : undefined,
value: value
}, props)));
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/text-highlight/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const TextHighlight = ({
text = '',
highlight = ''
}) => {
const trimmedHighlightText = highlight.trim();
if (!trimmedHighlightText) {
return text;
}
const regex = new RegExp(`(${Object(external_lodash_["escapeRegExp"])(trimmedHighlightText)})`, 'gi');
return Object(external_wp_element_["createInterpolateElement"])(text.replace(regex, '<mark>$&</mark>'), {
mark: Object(external_wp_element_["createElement"])("mark", null)
});
};
/* harmony default export */ var text_highlight = (TextHighlight);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tip/index.js
/**
* WordPress dependencies
*/
/**
* @typedef Props
* @property {import('react').ReactNode} children Children to render in the tip.
*/
/**
* @param {Props} props
* @return {JSX.Element} Element
*/
function Tip(props) {
return Object(external_wp_element_["createElement"])("div", {
className: "components-tip"
}, Object(external_wp_element_["createElement"])(external_wp_primitives_["SVG"], {
width: "24",
height: "24",
viewBox: "0 0 24 24"
}, Object(external_wp_element_["createElement"])(external_wp_primitives_["Path"], {
d: "M12 15.8c-3.7 0-6.8-3-6.8-6.8s3-6.8 6.8-6.8c3.7 0 6.8 3 6.8 6.8s-3.1 6.8-6.8 6.8zm0-12C9.1 3.8 6.8 6.1 6.8 9s2.4 5.2 5.2 5.2c2.9 0 5.2-2.4 5.2-5.2S14.9 3.8 12 3.8zM8 17.5h8V19H8zM10 20.5h4V22h-4z"
})), Object(external_wp_element_["createElement"])("p", null, props.children));
}
/* harmony default export */ var tip = (Tip);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toggle-control/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ToggleControl({
label,
checked,
help,
className,
onChange,
disabled
}) {
function onChangeToggle(event) {
onChange(event.target.checked);
}
const instanceId = Object(external_wp_compose_["useInstanceId"])(ToggleControl);
const id = `inspector-toggle-control-${instanceId}`;
let describedBy, helpLabel;
if (help) {
describedBy = id + '__help';
helpLabel = Object(external_lodash_["isFunction"])(help) ? help(checked) : help;
}
return Object(external_wp_element_["createElement"])(base_control, {
id: id,
help: helpLabel,
className: classnames_default()('components-toggle-control', className)
}, Object(external_wp_element_["createElement"])(form_toggle, {
id: id,
checked: checked,
onChange: onChangeToggle,
"aria-describedby": describedBy,
disabled: disabled
}), Object(external_wp_element_["createElement"])("label", {
htmlFor: id,
className: "components-toggle-control__label"
}, label));
}
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/toolbar-item/index.js
var toolbar_item = __webpack_require__("aA0e");
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/toolbar-context/index.js
var toolbar_context = __webpack_require__("GK4x");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-button/toolbar-button-container.js
const ToolbarButtonContainer = props => Object(external_wp_element_["createElement"])("div", {
className: props.className
}, props.children);
/* harmony default export */ var toolbar_button_container = (ToolbarButtonContainer);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-button/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ToolbarButton({
containerClassName,
className,
extraProps,
children,
title,
isActive,
isDisabled,
...props
}, ref) {
const accessibleToolbarState = Object(external_wp_element_["useContext"])(toolbar_context["a" /* default */]);
if (!accessibleToolbarState) {
return Object(external_wp_element_["createElement"])(toolbar_button_container, {
className: containerClassName
}, Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], Object(esm_extends["a" /* default */])({
ref: ref,
icon: props.icon,
label: title,
shortcut: props.shortcut,
"data-subscript": props.subscript,
onClick: event => {
event.stopPropagation();
if (props.onClick) {
props.onClick(event);
}
},
className: classnames_default()('components-toolbar__control', className),
isPressed: isActive,
disabled: isDisabled,
"data-toolbar-item": true
}, extraProps, props), children));
} // ToobarItem will pass all props to the render prop child, which will pass
// all props to Button. This means that ToolbarButton has the same API as
// Button.
return Object(external_wp_element_["createElement"])(toolbar_item["a" /* default */], Object(esm_extends["a" /* default */])({
className: classnames_default()('components-toolbar-button', className)
}, extraProps, props, {
ref: ref
}), toolbarItemProps => Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], Object(esm_extends["a" /* default */])({
label: title,
isPressed: isActive,
disabled: isDisabled
}, toolbarItemProps), children));
}
/* harmony default export */ var toolbar_button = (Object(external_wp_element_["forwardRef"])(ToolbarButton));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-group/toolbar-group-container.js
const ToolbarGroupContainer = ({
className,
children,
...props
}) => Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({
className: className
}, props), children);
/* harmony default export */ var toolbar_group_container = (ToolbarGroupContainer);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-group/toolbar-group-collapsed.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ToolbarGroupCollapsed({
controls = [],
toggleProps,
...props
}) {
// It'll contain state if `ToolbarGroup` is being used within
// `<Toolbar label="label" />`
const accessibleToolbarState = Object(external_wp_element_["useContext"])(toolbar_context["a" /* default */]);
const renderDropdownMenu = internalToggleProps => Object(external_wp_element_["createElement"])(dropdown_menu, Object(esm_extends["a" /* default */])({
controls: controls,
toggleProps: { ...internalToggleProps,
'data-toolbar-item': true
}
}, props));
if (accessibleToolbarState) {
return Object(external_wp_element_["createElement"])(toolbar_item["a" /* default */], toggleProps, renderDropdownMenu);
}
return renderDropdownMenu(toggleProps);
}
/* harmony default export */ var toolbar_group_collapsed = (ToolbarGroupCollapsed);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-group/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Renders a collapsible group of controls
*
* The `controls` prop accepts an array of sets. A set is an array of controls.
* Controls have the following shape:
*
* ```
* {
* icon: string,
* title: string,
* subscript: string,
* onClick: Function,
* isActive: boolean,
* isDisabled: boolean
* }
* ```
*
* For convenience it is also possible to pass only an array of controls. It is
* then assumed this is the only set.
*
* Either `controls` or `children` is required, otherwise this components
* renders nothing.
*
* @param {Object} props Component props.
* @param {Array} [props.controls] The controls to render in this toolbar.
* @param {WPElement} [props.children] Any other things to render inside the toolbar besides the controls.
* @param {string} [props.className] Class to set on the container div.
* @param {boolean} [props.isCollapsed] Turns ToolbarGroup into a dropdown menu.
* @param {string} [props.title] ARIA label for dropdown menu if is collapsed.
*/
function ToolbarGroup({
controls = [],
children,
className,
isCollapsed,
title,
...props
}) {
// It'll contain state if `ToolbarGroup` is being used within
// `<Toolbar label="label" />`
const accessibleToolbarState = Object(external_wp_element_["useContext"])(toolbar_context["a" /* default */]);
if ((!controls || !controls.length) && !children) {
return null;
}
const finalClassName = classnames_default()( // Unfortunately, there's legacy code referencing to `.components-toolbar`
// So we can't get rid of it
accessibleToolbarState ? 'components-toolbar-group' : 'components-toolbar', className); // Normalize controls to nested array of objects (sets of controls)
let controlSets = controls;
if (!Array.isArray(controlSets[0])) {
controlSets = [controlSets];
}
if (isCollapsed) {
return Object(external_wp_element_["createElement"])(toolbar_group_collapsed, Object(esm_extends["a" /* default */])({
label: title,
controls: controlSets,
className: finalClassName,
children: children
}, props));
}
return Object(external_wp_element_["createElement"])(toolbar_group_container, Object(esm_extends["a" /* default */])({
className: finalClassName
}, props), Object(external_lodash_["flatMap"])(controlSets, (controlSet, indexOfSet) => controlSet.map((control, indexOfControl) => Object(external_wp_element_["createElement"])(toolbar_button, Object(esm_extends["a" /* default */])({
key: [indexOfSet, indexOfControl].join(),
containerClassName: indexOfSet > 0 && indexOfControl === 0 ? 'has-left-divider' : null
}, control)))), children);
}
/* harmony default export */ var toolbar_group = (ToolbarGroup);
// CONCATENATED MODULE: ./node_modules/reakit/es/Toolbar/ToolbarState.js
function useToolbarState(initialState) {
if (initialState === void 0) {
initialState = {};
}
var _useSealedState = useSealedState(initialState),
_useSealedState$orien = _useSealedState.orientation,
orientation = _useSealedState$orien === void 0 ? "horizontal" : _useSealedState$orien,
sealed = Object(_rollupPluginBabelHelpers_1f0bf8c2["a" /* _ */])(_useSealedState, ["orientation"]);
return useCompositeState(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({
orientation: orientation
}, sealed));
}
// EXTERNAL MODULE: ./node_modules/reakit/es/__keys-ae468c11.js
var _keys_ae468c11 = __webpack_require__("mjVI");
// CONCATENATED MODULE: ./node_modules/reakit/es/Toolbar/Toolbar.js
var useToolbar = Object(createHook["a" /* createHook */])({
name: "Toolbar",
compose: useComposite,
keys: _keys_ae468c11["a" /* T */],
useProps: function useProps(options, htmlProps) {
return Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({
role: "toolbar",
"aria-orientation": options.orientation
}, htmlProps);
}
});
var Toolbar = Object(createComponent["a" /* createComponent */])({
as: "div",
useHook: useToolbar,
useCreateElement: function useCreateElement$1(type, props, children) {
false ? undefined : void 0;
return Object(useCreateElement["a" /* useCreateElement */])(type, props, children);
}
});
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar/toolbar-container.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ToolbarContainer({
label,
...props
}, ref) {
// https://reakit.io/docs/basic-concepts/#state-hooks
// Passing baseId for server side rendering (which includes snapshots)
// If an id prop is passed to Toolbar, toolbar items will use it as a base for their ids
const toolbarState = useToolbarState({
loop: true,
baseId: props.id,
rtl: Object(external_wp_i18n_["isRTL"])()
});
return (// This will provide state for `ToolbarButton`'s
Object(external_wp_element_["createElement"])(toolbar_context["a" /* default */].Provider, {
value: toolbarState
}, Object(external_wp_element_["createElement"])(Toolbar, Object(esm_extends["a" /* default */])({
ref: ref,
"aria-label": label
}, toolbarState, props)))
);
}
/* harmony default export */ var toolbar_container = (Object(external_wp_element_["forwardRef"])(ToolbarContainer));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Renders a toolbar.
*
* To add controls, simply pass `ToolbarButton` components as children.
*
* @param {Object} props Component props.
* @param {string} [props.className] Class to set on the container div.
* @param {string} [props.label] ARIA label for toolbar container.
* @param {Object} ref React Element ref.
*/
function toolbar_Toolbar({
className,
label,
...props
}, ref) {
if (!label) {
external_wp_deprecated_default()('Using Toolbar without label prop', {
since: '5.6',
alternative: 'ToolbarGroup component',
link: 'https://developer.wordpress.org/block-editor/components/toolbar/'
});
return Object(external_wp_element_["createElement"])(toolbar_group, Object(esm_extends["a" /* default */])({}, props, {
className: className
}));
} // `ToolbarGroup` already uses components-toolbar for compatibility reasons
const finalClassName = classnames_default()('components-accessible-toolbar', className);
return Object(external_wp_element_["createElement"])(toolbar_container, Object(esm_extends["a" /* default */])({
className: finalClassName,
label: label,
ref: ref
}, props));
}
/* harmony default export */ var toolbar = (Object(external_wp_element_["forwardRef"])(toolbar_Toolbar));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/toolbar-dropdown-menu/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ToolbarDropdownMenu(props) {
const accessibleToolbarState = Object(external_wp_element_["useContext"])(toolbar_context["a" /* default */]);
if (!accessibleToolbarState) {
return Object(external_wp_element_["createElement"])(dropdown_menu, props);
} // ToobarItem will pass all props to the render prop child, which will pass
// all props to the toggle of DrpodownMenu. This means that ToolbarDropdownMenu has the same API as
// DrpodownMenu.
return Object(external_wp_element_["createElement"])(toolbar_item["a" /* default */], null, toolbarItemProps => Object(external_wp_element_["createElement"])(dropdown_menu, Object(esm_extends["a" /* default */])({}, props, {
toggleProps: props.toggleProps ? { ...props.toggleProps,
...toolbarItemProps
} : toolbarItemProps
})));
}
/* harmony default export */ var toolbar_dropdown_menu = (ToolbarDropdownMenu);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/roving-tab-index-context.js
/**
* WordPress dependencies
*/
const RovingTabIndexContext = Object(external_wp_element_["createContext"])();
const useRovingTabIndexContext = () => Object(external_wp_element_["useContext"])(RovingTabIndexContext);
const RovingTabIndexProvider = RovingTabIndexContext.Provider;
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/roving-tab-index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Provider for adding roving tab index behaviors to tree grid structures.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md
*
* @param {Object} props Component props.
* @param {WPElement} props.children Children to be rendered
*/
function RovingTabIndex({
children
}) {
const [lastFocusedElement, setLastFocusedElement] = Object(external_wp_element_["useState"])(); // Use `useMemo` to avoid creation of a new object for the providerValue
// on every render. Only create a new object when the `lastFocusedElement`
// value changes.
const providerValue = Object(external_wp_element_["useMemo"])(() => ({
lastFocusedElement,
setLastFocusedElement
}), [lastFocusedElement]);
return Object(external_wp_element_["createElement"])(RovingTabIndexProvider, {
value: providerValue
}, children);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Return focusables in a row element, excluding those from other branches
* nested within the row.
*
* @param {Element} rowElement The DOM element representing the row.
*
* @return {?Array} The array of focusables in the row.
*/
function getRowFocusables(rowElement) {
const focusablesInRow = external_wp_dom_["focus"].focusable.find(rowElement);
if (!focusablesInRow || !focusablesInRow.length) {
return;
}
return focusablesInRow.filter(focusable => {
return focusable.closest('[role="row"]') === rowElement;
});
}
/**
* Renders both a table and tbody element, used to create a tree hierarchy.
*
* @see https://github.com/WordPress/gutenberg/blob/HEAD/packages/components/src/tree-grid/README.md
* @param {Object} props Component props.
* @param {WPElement} props.children Children to be rendered.
* @param {Object} ref A ref to the underlying DOM table element.
*/
function TreeGrid({
children,
...props
}, ref) {
const onKeyDown = Object(external_wp_element_["useCallback"])(event => {
const {
keyCode,
metaKey,
ctrlKey,
altKey,
shiftKey
} = event;
const hasModifierKeyPressed = metaKey || ctrlKey || altKey || shiftKey;
if (hasModifierKeyPressed || !Object(external_lodash_["includes"])([external_wp_keycodes_["UP"], external_wp_keycodes_["DOWN"], external_wp_keycodes_["LEFT"], external_wp_keycodes_["RIGHT"]], keyCode)) {
return;
} // The event will be handled, stop propagation.
event.stopPropagation();
const {
activeElement
} = document;
const {
currentTarget: treeGridElement
} = event;
if (!treeGridElement.contains(activeElement)) {
return;
} // Calculate the columnIndex of the active element.
const activeRow = activeElement.closest('[role="row"]');
const focusablesInRow = getRowFocusables(activeRow);
const currentColumnIndex = focusablesInRow.indexOf(activeElement);
if (Object(external_lodash_["includes"])([external_wp_keycodes_["LEFT"], external_wp_keycodes_["RIGHT"]], keyCode)) {
// Calculate to the next element.
let nextIndex;
if (keyCode === external_wp_keycodes_["LEFT"]) {
nextIndex = Math.max(0, currentColumnIndex - 1);
} else {
nextIndex = Math.min(currentColumnIndex + 1, focusablesInRow.length - 1);
} // Focus is either at the left or right edge of the grid. Do nothing.
if (nextIndex === currentColumnIndex) {
// Prevent key use for anything else. For example, Voiceover
// will start reading text on continued use of left/right arrow
// keys.
event.preventDefault();
return;
} // Focus the next element.
focusablesInRow[nextIndex].focus(); // Prevent key use for anything else. This ensures Voiceover
// doesn't try to handle key navigation.
event.preventDefault();
} else if (Object(external_lodash_["includes"])([external_wp_keycodes_["UP"], external_wp_keycodes_["DOWN"]], keyCode)) {
// Calculate the rowIndex of the next row.
const rows = Array.from(treeGridElement.querySelectorAll('[role="row"]'));
const currentRowIndex = rows.indexOf(activeRow);
let nextRowIndex;
if (keyCode === external_wp_keycodes_["UP"]) {
nextRowIndex = Math.max(0, currentRowIndex - 1);
} else {
nextRowIndex = Math.min(currentRowIndex + 1, rows.length - 1);
} // Focus is either at the top or bottom edge of the grid. Do nothing.
if (nextRowIndex === currentRowIndex) {
// Prevent key use for anything else. For example, Voiceover
// will start navigating horizontally when reaching the vertical
// bounds of a table.
event.preventDefault();
return;
} // Get the focusables in the next row.
const focusablesInNextRow = getRowFocusables(rows[nextRowIndex]); // If for some reason there are no focusables in the next row, do nothing.
if (!focusablesInNextRow || !focusablesInNextRow.length) {
// Prevent key use for anything else. For example, Voiceover
// will still focus text when using arrow keys, while this
// component should limit navigation to focusables.
event.preventDefault();
return;
} // Try to focus the element in the next row that's at a similar column to the activeElement.
const nextIndex = Math.min(currentColumnIndex, focusablesInNextRow.length - 1);
focusablesInNextRow[nextIndex].focus(); // Prevent key use for anything else. This ensures Voiceover
// doesn't try to handle key navigation.
event.preventDefault();
}
}, []);
/* Disable reason: A treegrid is implemented using a table element. */
/* eslint-disable jsx-a11y/no-noninteractive-element-to-interactive-role */
return Object(external_wp_element_["createElement"])(RovingTabIndex, null, Object(external_wp_element_["createElement"])("table", Object(esm_extends["a" /* default */])({}, props, {
role: "treegrid",
onKeyDown: onKeyDown,
ref: ref
}), Object(external_wp_element_["createElement"])("tbody", null, children)));
/* eslint-enable jsx-a11y/no-noninteractive-element-to-interactive-role */
}
/* harmony default export */ var tree_grid = (Object(external_wp_element_["forwardRef"])(TreeGrid));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/row.js
/**
* WordPress dependencies
*/
function TreeGridRow({
children,
level,
positionInSet,
setSize,
isExpanded,
...props
}, ref) {
return (// Disable reason: Due to an error in the ARIA 1.1 specification, the
// aria-posinset and aria-setsize properties are not supported on row
// elements. This is being corrected in ARIA 1.2. Consequently, the
// linting rule fails when validating this markup.
//
// eslint-disable-next-line jsx-a11y/role-supports-aria-props
Object(external_wp_element_["createElement"])("tr", Object(esm_extends["a" /* default */])({}, props, {
ref: ref,
role: "row",
"aria-level": level,
"aria-posinset": positionInSet,
"aria-setsize": setSize,
"aria-expanded": isExpanded
}), children)
);
}
/* harmony default export */ var tree_grid_row = (Object(external_wp_element_["forwardRef"])(TreeGridRow));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/roving-tab-index-item.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/* harmony default export */ var roving_tab_index_item = (Object(external_wp_element_["forwardRef"])(function RovingTabIndexItem({
children,
as: Component,
...props
}, forwardedRef) {
const localRef = Object(external_wp_element_["useRef"])();
const ref = forwardedRef || localRef;
const {
lastFocusedElement,
setLastFocusedElement
} = useRovingTabIndexContext();
let tabIndex;
if (lastFocusedElement) {
tabIndex = lastFocusedElement === ref.current ? 0 : -1;
}
const onFocus = event => setLastFocusedElement(event.target);
const allProps = {
ref,
tabIndex,
onFocus,
...props
};
if (typeof children === 'function') {
return children(allProps);
}
return Object(external_wp_element_["createElement"])(Component, allProps, children);
}));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/item.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/* harmony default export */ var tree_grid_item = (Object(external_wp_element_["forwardRef"])(function TreeGridItem({
children,
...props
}, ref) {
return Object(external_wp_element_["createElement"])(roving_tab_index_item, Object(esm_extends["a" /* default */])({
ref: ref
}, props), children);
}));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-grid/cell.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/* harmony default export */ var tree_grid_cell = (Object(external_wp_element_["forwardRef"])(function TreeGridCell({
children,
withoutGridItem = false,
...props
}, ref) {
return Object(external_wp_element_["createElement"])("td", Object(esm_extends["a" /* default */])({}, props, {
role: "gridcell"
}), withoutGridItem ? children : Object(external_wp_element_["createElement"])(tree_grid_item, {
ref: ref
}, children));
}));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/truncate/component.js
/**
* Internal dependencies
*/
/**
* `Truncate` is a typography primitive that trims text content.
* For almost all cases, it is recommended that `Text`, `Heading`, or
* `Subheading` is used to render text content. However,`Truncate` is
* available for custom implementations.
*
* @example
* ```jsx
* import { __experimentalTruncate as Truncate } from `@wordpress/components`;
*
* function Example() {
* return (
* <Truncate>
* Lorem ipsum dolor sit amet, consectetur adipiscing elit. Nunc ex
* neque, vulputate a diam et, luctus convallis lacus. Vestibulum ac
* mollis mi. Morbi id elementum massa.
* </Truncate>
* );
* }
* ```
*/
const component_Truncate = create_component_createComponent({
as: 'span',
useHook: useTruncate,
name: 'Truncate'
});
/* harmony default export */ var truncate_component = (component_Truncate);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/v-stack/hook.js
/**
* Internal dependencies
*/
/**
*
* @param {import('../ui/context').ViewOwnProps<import('./types').Props, 'div'>} props
*/
function useVStack(props) {
const {
expanded = false,
...otherProps
} = Object(use_context_system["a" /* useContextSystem */])(props, 'VStack');
const hStackProps = useHStack({
direction: 'column',
expanded,
...otherProps
});
return hStackProps;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/v-stack/component.js
/**
* Internal dependencies
*/
/**
* `VStack` (or Vertical Stack) is a layout component that arranges child elements in a vertical line.
*
* `VStack` can render anything inside.
*
* @example
* ```jsx
* import {
* __experimentalText as Text,
* __experimentalVStack as VStack,
* } from `@wordpress/components`;
*
* function Example() {
* return (
* <VStack>
* <Text>Code</Text>
* <Text>is</Text>
* <Text>Poetry</Text>
* </VStack>
* );
* }
* ```
*/
const VStack = create_component_createComponent({
as: 'div',
useHook: useVStack,
name: 'VStack'
});
/* harmony default export */ var v_stack_component = (VStack);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/isolated-event-container/index.js
/**
* WordPress dependencies
*/
function stopPropagation(event) {
event.stopPropagation();
}
/* harmony default export */ var isolated_event_container = (Object(external_wp_element_["forwardRef"])(({
children,
...props
}, ref) => {
external_wp_deprecated_default()('wp.components.IsolatedEventContainer', {
since: '5.7'
}); // Disable reason: this stops certain events from propagating outside of the component.
// - onMouseDown is disabled as this can cause interactions with other DOM elements
/* eslint-disable jsx-a11y/no-static-element-interactions */
return Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({}, props, {
ref: ref,
onMouseDown: stopPropagation
}), children);
/* eslint-enable jsx-a11y/no-static-element-interactions */
}));
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/index.js + 8 modules
var slot_fill = __webpack_require__("dSD1");
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/use-slot.js
var use_slot = __webpack_require__("+WFq");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/style-provider/index.js
/**
* External dependencies
*/
const memoizedCreateCacheWithContainer = memize_default()(container => {
return Object(cache_browser_esm["a" /* default */])({
container
});
});
function StyleProvider({
children,
document
}) {
if (!document) {
return null;
}
const cache = memoizedCreateCacheWithContainer(document.head);
return Object(external_wp_element_["createElement"])(CacheProvider, {
value: cache
}, children);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/navigate-regions/index.js
/**
* WordPress dependencies
*/
const defaultShortcuts = {
previous: ['ctrl+shift+`', external_wp_keycodes_["rawShortcut"].access('p')],
next: ['ctrl+`', external_wp_keycodes_["rawShortcut"].access('n')]
};
function useNavigateRegions(ref, shortcuts = defaultShortcuts) {
const [isFocusingRegions, setIsFocusingRegions] = Object(external_wp_element_["useState"])(false);
function focusRegion(offset) {
const regions = Array.from(ref.current.querySelectorAll('[role="region"]'));
if (!regions.length) {
return;
}
let nextRegion = regions[0];
const selectedIndex = regions.indexOf(ref.current.ownerDocument.activeElement);
if (selectedIndex !== -1) {
let nextIndex = selectedIndex + offset;
nextIndex = nextIndex === -1 ? regions.length - 1 : nextIndex;
nextIndex = nextIndex === regions.length ? 0 : nextIndex;
nextRegion = regions[nextIndex];
}
nextRegion.focus();
setIsFocusingRegions(true);
}
const focusPrevious = Object(external_wp_element_["useCallback"])(() => focusRegion(-1), []);
const focusNext = Object(external_wp_element_["useCallback"])(() => focusRegion(1), []);
Object(external_wp_compose_["useKeyboardShortcut"])(shortcuts.previous, focusPrevious, {
bindGlobal: true
});
Object(external_wp_compose_["useKeyboardShortcut"])(shortcuts.next, focusNext, {
bindGlobal: true
});
Object(external_wp_element_["useEffect"])(() => {
function onClick() {
setIsFocusingRegions(false);
}
ref.current.addEventListener('click', onClick);
return () => {
ref.current.removeEventListener('click', onClick);
};
}, [setIsFocusingRegions]);
if (!isFocusingRegions) {
return;
}
return 'is-focusing-regions';
}
/* harmony default export */ var navigate_regions = (Object(external_wp_compose_["createHigherOrderComponent"])(Component => ({
shortcuts,
...props
}) => {
const ref = Object(external_wp_element_["useRef"])();
const className = useNavigateRegions(ref, shortcuts);
return Object(external_wp_element_["createElement"])("div", {
ref: ref,
className: className
}, Object(external_wp_element_["createElement"])(Component, props));
}, 'navigateRegions'));
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-constrained-tabbing/index.js
/**
* WordPress dependencies
*/
const withConstrainedTabbing = Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => function ComponentWithConstrainedTabbing(props) {
const ref = Object(external_wp_compose_["useConstrainedTabbing"])();
return Object(external_wp_element_["createElement"])("div", {
ref: ref,
tabIndex: "-1"
}, Object(external_wp_element_["createElement"])(WrappedComponent, props));
}, 'withConstrainedTabbing');
/* harmony default export */ var with_constrained_tabbing = (withConstrainedTabbing);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-fallback-styles/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/* harmony default export */ var with_fallback_styles = (mapNodeToProps => Object(external_wp_compose_["createHigherOrderComponent"])(WrappedComponent => {
return class extends external_wp_element_["Component"] {
constructor() {
super(...arguments);
this.nodeRef = this.props.node;
this.state = {
fallbackStyles: undefined,
grabStylesCompleted: false
};
this.bindRef = this.bindRef.bind(this);
}
bindRef(node) {
if (!node) {
return;
}
this.nodeRef = node;
}
componentDidMount() {
this.grabFallbackStyles();
}
componentDidUpdate() {
this.grabFallbackStyles();
}
grabFallbackStyles() {
const {
grabStylesCompleted,
fallbackStyles
} = this.state;
if (this.nodeRef && !grabStylesCompleted) {
const newFallbackStyles = mapNodeToProps(this.nodeRef, this.props);
if (!Object(external_lodash_["isEqual"])(newFallbackStyles, fallbackStyles)) {
this.setState({
fallbackStyles: newFallbackStyles,
grabStylesCompleted: !!Object(external_lodash_["every"])(newFallbackStyles)
});
}
}
}
render() {
const wrappedComponent = Object(external_wp_element_["createElement"])(WrappedComponent, Object(esm_extends["a" /* default */])({}, this.props, this.state.fallbackStyles));
return this.props.node ? wrappedComponent : Object(external_wp_element_["createElement"])("div", {
ref: this.bindRef
}, " ", wrappedComponent, " ");
}
};
}, 'withFallbackStyles'));
// EXTERNAL MODULE: external ["wp","hooks"]
var external_wp_hooks_ = __webpack_require__("g56x");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-filters/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
const ANIMATION_FRAME_PERIOD = 16;
/**
* Creates a higher-order component which adds filtering capability to the
* wrapped component. Filters get applied when the original component is about
* to be mounted. When a filter is added or removed that matches the hook name,
* the wrapped component re-renders.
*
* @param {string} hookName Hook name exposed to be used by filters.
*
* @return {Function} Higher-order component factory.
*/
function withFilters(hookName) {
return Object(external_wp_compose_["createHigherOrderComponent"])(OriginalComponent => {
const namespace = 'core/with-filters/' + hookName;
/**
* The component definition with current filters applied. Each instance
* reuse this shared reference as an optimization to avoid excessive
* calls to `applyFilters` when many instances exist.
*
* @type {?Component}
*/
let FilteredComponent;
/**
* Initializes the FilteredComponent variable once, if not already
* assigned. Subsequent calls are effectively a noop.
*/
function ensureFilteredComponent() {
if (FilteredComponent === undefined) {
FilteredComponent = Object(external_wp_hooks_["applyFilters"])(hookName, OriginalComponent);
}
}
class FilteredComponentRenderer extends external_wp_element_["Component"] {
constructor() {
super(...arguments);
ensureFilteredComponent();
}
componentDidMount() {
FilteredComponentRenderer.instances.push(this); // If there were previously no mounted instances for components
// filtered on this hook, add the hook handler.
if (FilteredComponentRenderer.instances.length === 1) {
Object(external_wp_hooks_["addAction"])('hookRemoved', namespace, onHooksUpdated);
Object(external_wp_hooks_["addAction"])('hookAdded', namespace, onHooksUpdated);
}
}
componentWillUnmount() {
FilteredComponentRenderer.instances = Object(external_lodash_["without"])(FilteredComponentRenderer.instances, this); // If this was the last of the mounted components filtered on
// this hook, remove the hook handler.
if (FilteredComponentRenderer.instances.length === 0) {
Object(external_wp_hooks_["removeAction"])('hookRemoved', namespace);
Object(external_wp_hooks_["removeAction"])('hookAdded', namespace);
}
}
render() {
return Object(external_wp_element_["createElement"])(FilteredComponent, this.props);
}
}
FilteredComponentRenderer.instances = [];
/**
* Updates the FilteredComponent definition, forcing a render for each
* mounted instance. This occurs a maximum of once per animation frame.
*/
const throttledForceUpdate = Object(external_lodash_["debounce"])(() => {
// Recreate the filtered component, only after delay so that it's
// computed once, even if many filters added.
FilteredComponent = Object(external_wp_hooks_["applyFilters"])(hookName, OriginalComponent); // Force each instance to render.
FilteredComponentRenderer.instances.forEach(instance => {
instance.forceUpdate();
});
}, ANIMATION_FRAME_PERIOD);
/**
* When a filter is added or removed for the matching hook name, each
* mounted instance should re-render with the new filters having been
* applied to the original component.
*
* @param {string} updatedHookName Name of the hook that was updated.
*/
function onHooksUpdated(updatedHookName) {
if (updatedHookName === hookName) {
throttledForceUpdate();
}
}
return FilteredComponentRenderer;
}, 'withFilters');
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-focus-return/index.js
/**
* WordPress dependencies
*/
/**
* Returns true if the given object is component-like. An object is component-
* like if it is an instance of wp.element.Component, or is a function.
*
* @param {*} object Object to test.
*
* @return {boolean} Whether object is component-like.
*/
function isComponentLike(object) {
return object instanceof external_wp_element_["Component"] || typeof object === 'function';
}
/**
* Higher Order Component used to be used to wrap disposable elements like
* sidebars, modals, dropdowns. When mounting the wrapped component, we track a
* reference to the current active element so we know where to restore focus
* when the component is unmounted.
*
* @param {(WPComponent|Object)} options The component to be enhanced with
* focus return behavior, or an object
* describing the component and the
* focus return characteristics.
*
* @return {Function} Higher Order Component with the focus restauration behaviour.
*/
/* harmony default export */ var with_focus_return = (Object(external_wp_compose_["createHigherOrderComponent"])(options => {
const HoC = ({
onFocusReturn
} = {}) => WrappedComponent => {
const WithFocusReturn = props => {
const ref = Object(external_wp_compose_["useFocusReturn"])(onFocusReturn);
return Object(external_wp_element_["createElement"])("div", {
ref: ref
}, Object(external_wp_element_["createElement"])(WrappedComponent, props));
};
return WithFocusReturn;
};
if (isComponentLike(options)) {
const WrappedComponent = options;
return HoC()(WrappedComponent);
}
return HoC(options);
}, 'withFocusReturn'));
const with_focus_return_Provider = ({
children
}) => {
external_wp_deprecated_default()('wp.components.FocusReturnProvider component', {
since: '5.7',
hint: 'This provider is not used anymore. You can just remove it from your codebase'
});
return children;
};
// EXTERNAL MODULE: ./node_modules/uuid/dist/esm-browser/v4.js + 4 modules
var v4 = __webpack_require__("7Cbv");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/higher-order/with-notices/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Override the default edit UI to include notices if supported.
*
* @param {WPComponent} OriginalComponent Original component.
*
* @return {WPComponent} Wrapped component.
*/
/* harmony default export */ var with_notices = (Object(external_wp_compose_["createHigherOrderComponent"])(OriginalComponent => {
function Component(props, ref) {
const [noticeList, setNoticeList] = Object(external_wp_element_["useState"])([]);
const noticeOperations = Object(external_wp_element_["useMemo"])(() => {
/**
* Function passed down as a prop that adds a new notice.
*
* @param {Object} notice Notice to add.
*/
const createNotice = notice => {
const noticeToAdd = notice.id ? notice : { ...notice,
id: Object(v4["a" /* default */])()
};
setNoticeList(current => [...current, noticeToAdd]);
};
return {
createNotice,
/**
* Function passed as a prop that adds a new error notice.
*
* @param {string} msg Error message of the notice.
*/
createErrorNotice: msg => {
createNotice({
status: 'error',
content: msg
});
},
/**
* Removes a notice by id.
*
* @param {string} id Id of the notice to remove.
*/
removeNotice: id => {
setNoticeList(current => current.filter(notice => notice.id !== id));
},
/**
* Removes all notices
*/
removeAllNotices: () => {
setNoticeList([]);
}
};
}, []);
const propsOut = { ...props,
noticeList,
noticeOperations,
noticeUI: noticeList.length > 0 && Object(external_wp_element_["createElement"])(list, {
className: "components-with-notices-ui",
notices: noticeList,
onRemove: noticeOperations.removeNotice
})
};
return isForwardRef ? Object(external_wp_element_["createElement"])(OriginalComponent, Object(esm_extends["a" /* default */])({}, propsOut, {
ref: ref
})) : Object(external_wp_element_["createElement"])(OriginalComponent, propsOut);
}
let isForwardRef;
const {
render
} = OriginalComponent; // Returns a forwardRef if OriginalComponent appears to be a forwardRef
if (typeof render === 'function') {
isForwardRef = true;
return Object(external_wp_element_["forwardRef"])(Component);
}
return Component;
}));
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/ui/context/with-next.js
var with_next = __webpack_require__("9NHk");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/ui/context/component-system-provider.js
/**
* Internal dependencies
*/
/**
* @param {Object} props
* @param {string[]} [props.__unstableNextInclude]
* @param {import('react').ReactNode} props.children
* @param {any} props.value
*/
function ComponentSystemProvider({
__unstableNextInclude = [],
children,
value = {}
}) {
if (false) {}
return children;
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/index.js
// Primitives
// Components
// Higher-Order Components
// Component System
/***/ }),
/***/ "SIPS":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getRegisteredStyles; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return insertStyles; });
var isBrowser = "object" !== 'undefined';
function getRegisteredStyles(registered, registeredStyles, classNames) {
var rawClassName = '';
classNames.split(' ').forEach(function (className) {
if (registered[className] !== undefined) {
registeredStyles.push(registered[className]);
} else {
rawClassName += className + " ";
}
});
return rawClassName;
}
var insertStyles = function insertStyles(cache, serialized, isStringTag) {
var className = cache.key + "-" + serialized.name;
if ( // we only need to add the styles to the registered cache if the
// class name could be used further down
// the tree but if it's a string tag, we know it won't
// so we don't have to add it to registered cache.
// this improves memory usage since we can avoid storing the whole style string
(isStringTag === false || // we need to always store it if we're in compat mode and
// in node since emotion-server relies on whether a style is in
// the registered cache to know whether a style is global or not
// also, note that this check will be dead code eliminated in the browser
isBrowser === false && cache.compat !== undefined) && cache.registered[className] === undefined) {
cache.registered[className] = serialized.styles;
}
if (cache.inserted[serialized.name] === undefined) {
var current = serialized;
do {
var maybeStyles = cache.insert("." + className, current, cache.sheet, true);
current = current.next;
} while (current !== undefined);
}
};
/***/ }),
/***/ "SSiF":
/***/ (function(module, exports, __webpack_require__) {
var e=__webpack_require__("cDcd"),n={display:"block",opacity:0,position:"absolute",top:0,left:0,height:"100%",width:"100%",overflow:"hidden",pointerEvents:"none",zIndex:-1},t=function(t){var r=t.onResize,u=e.useRef();return function(n,t){var r=function(){return n.current&&n.current.contentDocument&&n.current.contentDocument.defaultView};function u(){t();var e=r();e&&e.addEventListener("resize",t)}e.useEffect((function(){return r()?u():n.current&&n.current.addEventListener&&n.current.addEventListener("load",u),function(){var e=r();e&&"function"==typeof e.removeEventListener&&e.removeEventListener("resize",t)}}),[])}(u,(function(){return r(u)})),e.createElement("iframe",{style:n,src:"about:blank",ref:u,"aria-hidden":!0,tabIndex:-1,frameBorder:0})},r=function(e){return{width:null!=e?e.offsetWidth:null,height:null!=e?e.offsetHeight:null}};module.exports=function(n){void 0===n&&(n=r);var u=e.useState(n(null)),o=u[0],i=u[1],c=e.useCallback((function(e){return i(n(e.current))}),[n]);return[e.useMemo((function(){return e.createElement(t,{onResize:c})}),[c]),o]};
/***/ }),
/***/ "SegQ":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var callBound = __webpack_require__("6ZB3");
var hasSymbols = __webpack_require__("eJkf")();
var hasToStringTag = hasSymbols && !!Symbol.toStringTag;
var has;
var $exec;
var isRegexMarker;
var badStringifier;
if (hasToStringTag) {
has = callBound('Object.prototype.hasOwnProperty');
$exec = callBound('RegExp.prototype.exec');
isRegexMarker = {};
var throwRegexMarker = function () {
throw isRegexMarker;
};
badStringifier = {
toString: throwRegexMarker,
valueOf: throwRegexMarker
};
if (typeof Symbol.toPrimitive === 'symbol') {
badStringifier[Symbol.toPrimitive] = throwRegexMarker;
}
}
var $toString = callBound('Object.prototype.toString');
var gOPD = Object.getOwnPropertyDescriptor;
var regexClass = '[object RegExp]';
module.exports = hasToStringTag
// eslint-disable-next-line consistent-return
? function isRegex(value) {
if (!value || typeof value !== 'object') {
return false;
}
var descriptor = gOPD(value, 'lastIndex');
var hasLastIndexDataProperty = descriptor && has(descriptor, 'value');
if (!hasLastIndexDataProperty) {
return false;
}
try {
$exec(value, badStringifier);
} catch (e) {
return e === isRegexMarker;
}
}
: function isRegex(value) {
// In older browsers, typeof regex incorrectly returns 'function'
if (!value || (typeof value !== 'object' && typeof value !== 'function')) {
return false;
}
return $toString(value) === regexClass;
};
/***/ }),
/***/ "SksO":
/***/ (function(module, exports) {
function _setPrototypeOf(o, p) {
module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) {
o.__proto__ = p;
return o;
};
module.exports["default"] = module.exports, module.exports.__esModule = true;
return _setPrototypeOf(o, p);
}
module.exports = _setPrototypeOf;
module.exports["default"] = module.exports, module.exports.__esModule = true;
/***/ }),
/***/ "SyVe":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getWindow; });
/* harmony import */ var _getDocument_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("ouKs");
// Thanks to Fluent UI for doing the [research on IE11 memery leak](https://github.com/microsoft/fluentui/pull/9010#issuecomment-490768427)
var _window; // Note: Accessing "window" in IE11 is somewhat expensive, and calling "typeof window"
// hits a memory leak, whereas aliasing it and calling "typeof _window" does not.
// Caching the window value at the file scope lets us minimize the impact.
try {
_window = window;
} catch (e) {
/* no-op */
}
/**
* Returns `element.ownerDocument.defaultView || window`.
*/
function getWindow(element) {
if (!element) {
return _window;
}
return Object(_getDocument_js__WEBPACK_IMPORTED_MODULE_0__[/* getDocument */ "a"])(element).defaultView || _window;
}
/***/ }),
/***/ "TFuP":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return COMPOSITE_KEYS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return COMPOSITE_GROUP_KEYS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return COMPOSITE_ITEM_KEYS; });
/* unused harmony export c */
// Automatically generated
var COMPOSITE_STATE_KEYS = ["baseId", "unstable_idCountRef", "setBaseId", "unstable_virtual", "rtl", "orientation", "items", "groups", "currentId", "loop", "wrap", "shift", "unstable_moves", "unstable_hasActiveWidget", "unstable_includesBaseElement", "registerItem", "unregisterItem", "registerGroup", "unregisterGroup", "move", "next", "previous", "up", "down", "first", "last", "sort", "unstable_setVirtual", "setRTL", "setOrientation", "setCurrentId", "setLoop", "setWrap", "setShift", "reset", "unstable_setIncludesBaseElement", "unstable_setHasActiveWidget"];
var COMPOSITE_KEYS = COMPOSITE_STATE_KEYS;
var COMPOSITE_GROUP_KEYS = COMPOSITE_KEYS;
var COMPOSITE_ITEM_KEYS = COMPOSITE_GROUP_KEYS;
var COMPOSITE_ITEM_WIDGET_KEYS = COMPOSITE_ITEM_KEYS;
/***/ }),
/***/ "TG4+":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.withStylesPropTypes = exports.css = undefined;
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
exports.withStyles = withStyles;
var _object = __webpack_require__("Koq/");
var _object2 = _interopRequireDefault(_object);
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _hoistNonReactStatics = __webpack_require__("2mql");
var _hoistNonReactStatics2 = _interopRequireDefault(_hoistNonReactStatics);
var _constants = __webpack_require__("QEu6");
var _brcast = __webpack_require__("sDMB");
var _brcast2 = _interopRequireDefault(_brcast);
var _ThemedStyleSheet = __webpack_require__("030x");
var _ThemedStyleSheet2 = _interopRequireDefault(_ThemedStyleSheet);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } /* eslint react/forbid-foreign-prop-types: off */
// Add some named exports to assist in upgrading and for convenience
var css = exports.css = _ThemedStyleSheet2['default'].resolveLTR;
var withStylesPropTypes = exports.withStylesPropTypes = {
styles: _propTypes2['default'].object.isRequired, // eslint-disable-line react/forbid-prop-types
theme: _propTypes2['default'].object.isRequired, // eslint-disable-line react/forbid-prop-types
css: _propTypes2['default'].func.isRequired
};
var EMPTY_STYLES = {};
var EMPTY_STYLES_FN = function EMPTY_STYLES_FN() {
return EMPTY_STYLES;
};
var START_MARK = 'react-with-styles.createStyles.start';
var END_MARK = 'react-with-styles.createStyles.end';
function baseClass(pureComponent) {
if (pureComponent) {
if (!_react2['default'].PureComponent) {
throw new ReferenceError('withStyles() pureComponent option requires React 15.3.0 or later');
}
return _react2['default'].PureComponent;
}
return _react2['default'].Component;
}
var contextTypes = _defineProperty({}, _constants.CHANNEL, _brcast2['default']);
var defaultDirection = _constants.DIRECTIONS.LTR;
function withStyles(styleFn) {
var _ref = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {},
_ref$stylesPropName = _ref.stylesPropName,
stylesPropName = _ref$stylesPropName === undefined ? 'styles' : _ref$stylesPropName,
_ref$themePropName = _ref.themePropName,
themePropName = _ref$themePropName === undefined ? 'theme' : _ref$themePropName,
_ref$cssPropName = _ref.cssPropName,
cssPropName = _ref$cssPropName === undefined ? 'css' : _ref$cssPropName,
_ref$flushBefore = _ref.flushBefore,
flushBefore = _ref$flushBefore === undefined ? false : _ref$flushBefore,
_ref$pureComponent = _ref.pureComponent,
pureComponent = _ref$pureComponent === undefined ? false : _ref$pureComponent;
var styleDefLTR = void 0;
var styleDefRTL = void 0;
var currentThemeLTR = void 0;
var currentThemeRTL = void 0;
var BaseClass = baseClass(pureComponent);
function getResolveMethod(direction) {
return direction === _constants.DIRECTIONS.LTR ? _ThemedStyleSheet2['default'].resolveLTR : _ThemedStyleSheet2['default'].resolveRTL;
}
function getCurrentTheme(direction) {
return direction === _constants.DIRECTIONS.LTR ? currentThemeLTR : currentThemeRTL;
}
function getStyleDef(direction, wrappedComponentName) {
var currentTheme = getCurrentTheme(direction);
var styleDef = direction === _constants.DIRECTIONS.LTR ? styleDefLTR : styleDefRTL;
var registeredTheme = _ThemedStyleSheet2['default'].get();
// Return the existing styles if they've already been defined
// and if the theme used to create them corresponds to the theme
// registered with ThemedStyleSheet
if (styleDef && currentTheme === registeredTheme) {
return styleDef;
}
if (false) {}
var isRTL = direction === _constants.DIRECTIONS.RTL;
if (isRTL) {
styleDefRTL = styleFn ? _ThemedStyleSheet2['default'].createRTL(styleFn) : EMPTY_STYLES_FN;
currentThemeRTL = registeredTheme;
styleDef = styleDefRTL;
} else {
styleDefLTR = styleFn ? _ThemedStyleSheet2['default'].createLTR(styleFn) : EMPTY_STYLES_FN;
currentThemeLTR = registeredTheme;
styleDef = styleDefLTR;
}
if (false) { var measureName; }
return styleDef;
}
function getState(direction, wrappedComponentName) {
return {
resolveMethod: getResolveMethod(direction),
styleDef: getStyleDef(direction, wrappedComponentName)
};
}
return function () {
function withStylesHOC(WrappedComponent) {
var wrappedComponentName = WrappedComponent.displayName || WrappedComponent.name || 'Component';
// NOTE: Use a class here so components are ref-able if need be:
// eslint-disable-next-line react/prefer-stateless-function
var WithStyles = function (_BaseClass) {
_inherits(WithStyles, _BaseClass);
function WithStyles(props, context) {
_classCallCheck(this, WithStyles);
var _this = _possibleConstructorReturn(this, (WithStyles.__proto__ || Object.getPrototypeOf(WithStyles)).call(this, props, context));
var direction = _this.context[_constants.CHANNEL] ? _this.context[_constants.CHANNEL].getState() : defaultDirection;
_this.state = getState(direction, wrappedComponentName);
return _this;
}
_createClass(WithStyles, [{
key: 'componentDidMount',
value: function () {
function componentDidMount() {
var _this2 = this;
if (this.context[_constants.CHANNEL]) {
// subscribe to future direction changes
this.channelUnsubscribe = this.context[_constants.CHANNEL].subscribe(function (direction) {
_this2.setState(getState(direction, wrappedComponentName));
});
}
}
return componentDidMount;
}()
}, {
key: 'componentWillUnmount',
value: function () {
function componentWillUnmount() {
if (this.channelUnsubscribe) {
this.channelUnsubscribe();
}
}
return componentWillUnmount;
}()
}, {
key: 'render',
value: function () {
function render() {
var _ref2;
// As some components will depend on previous styles in
// the component tree, we provide the option of flushing the
// buffered styles (i.e. to a style tag) **before** the rendering
// cycle begins.
//
// The interfaces provide the optional "flush" method which
// is run in turn by ThemedStyleSheet.flush.
if (flushBefore) {
_ThemedStyleSheet2['default'].flush();
}
var _state = this.state,
resolveMethod = _state.resolveMethod,
styleDef = _state.styleDef;
return _react2['default'].createElement(WrappedComponent, _extends({}, this.props, (_ref2 = {}, _defineProperty(_ref2, themePropName, _ThemedStyleSheet2['default'].get()), _defineProperty(_ref2, stylesPropName, styleDef()), _defineProperty(_ref2, cssPropName, resolveMethod), _ref2)));
}
return render;
}()
}]);
return WithStyles;
}(BaseClass);
WithStyles.WrappedComponent = WrappedComponent;
WithStyles.displayName = 'withStyles(' + String(wrappedComponentName) + ')';
WithStyles.contextTypes = contextTypes;
if (WrappedComponent.propTypes) {
WithStyles.propTypes = (0, _object2['default'])({}, WrappedComponent.propTypes);
delete WithStyles.propTypes[stylesPropName];
delete WithStyles.propTypes[themePropName];
delete WithStyles.propTypes[cssPropName];
}
if (WrappedComponent.defaultProps) {
WithStyles.defaultProps = (0, _object2['default'])({}, WrappedComponent.defaultProps);
}
return (0, _hoistNonReactStatics2['default'])(WithStyles, WrappedComponent);
}
return withStylesHOC;
}();
}
/***/ }),
/***/ "TO8r":
/***/ (function(module, exports) {
/** Used to match a single whitespace character. */
var reWhitespace = /\s/;
/**
* Used by `_.trim` and `_.trimEnd` to get the index of the last non-whitespace
* character of `string`.
*
* @private
* @param {string} string The string to inspect.
* @returns {number} Returns the index of the last non-whitespace character.
*/
function trimmedEndIndex(string) {
var index = string.length;
while (index-- && reWhitespace.test(string.charAt(index))) {}
return index;
}
module.exports = trimmedEndIndex;
/***/ }),
/***/ "TOwV":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
if (true) {
module.exports = __webpack_require__("qT12");
} else {}
/***/ }),
/***/ "TSYQ":
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2018 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
function classNames() {
var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes.push(arg);
} else if (Array.isArray(arg)) {
if (arg.length) {
var inner = classNames.apply(null, arg);
if (inner) {
classes.push(inner);
}
}
} else if (argType === 'object') {
if (arg.toString === Object.prototype.toString) {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
} else {
classes.push(arg.toString());
}
}
}
return classes.join(' ');
}
if ( true && module.exports) {
classNames.default = classNames;
module.exports = classNames;
} else if (true) {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
return classNames;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}());
/***/ }),
/***/ "TUyu":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = registerCSSInterfaceWithDefaultTheme;
var _reactWithStylesInterfaceCss = __webpack_require__("lzPt");
var _reactWithStylesInterfaceCss2 = _interopRequireDefault(_reactWithStylesInterfaceCss);
var _registerInterfaceWithDefaultTheme = __webpack_require__("WI5Z");
var _registerInterfaceWithDefaultTheme2 = _interopRequireDefault(_registerInterfaceWithDefaultTheme);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function registerCSSInterfaceWithDefaultTheme() {
(0, _registerInterfaceWithDefaultTheme2['default'])(_reactWithStylesInterfaceCss2['default']);
}
/***/ }),
/***/ "Teho":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = function isPrimitive(value) {
return value === null || (typeof value !== 'function' && typeof value !== 'object');
};
/***/ }),
/***/ "Thzv":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _object = __webpack_require__("Koq/");
var _object2 = _interopRequireDefault(_object);
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactAddonsShallowCompare = __webpack_require__("YZDV");
var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare);
var _reactMomentProptypes = __webpack_require__("XGBb");
var _reactMomentProptypes2 = _interopRequireDefault(_reactMomentProptypes);
var _airbnbPropTypes = __webpack_require__("Hsqg");
var _reactWithStyles = __webpack_require__("TG4+");
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _consolidatedEvents = __webpack_require__("1TsT");
var _defaultPhrases = __webpack_require__("vV+G");
var _getPhrasePropTypes = __webpack_require__("yc2e");
var _getPhrasePropTypes2 = _interopRequireDefault(_getPhrasePropTypes);
var _CalendarMonth = __webpack_require__("mMiH");
var _CalendarMonth2 = _interopRequireDefault(_CalendarMonth);
var _isTransitionEndSupported = __webpack_require__("dRQD");
var _isTransitionEndSupported2 = _interopRequireDefault(_isTransitionEndSupported);
var _getTransformStyles = __webpack_require__("q86A");
var _getTransformStyles2 = _interopRequireDefault(_getTransformStyles);
var _getCalendarMonthWidth = __webpack_require__("m2ax");
var _getCalendarMonthWidth2 = _interopRequireDefault(_getCalendarMonthWidth);
var _toISOMonthString = __webpack_require__("jenk");
var _toISOMonthString2 = _interopRequireDefault(_toISOMonthString);
var _isPrevMonth = __webpack_require__("Pq96");
var _isPrevMonth2 = _interopRequireDefault(_isPrevMonth);
var _isNextMonth = __webpack_require__("6HWY");
var _isNextMonth2 = _interopRequireDefault(_isNextMonth);
var _ModifiersShape = __webpack_require__("J7JS");
var _ModifiersShape2 = _interopRequireDefault(_ModifiersShape);
var _ScrollableOrientationShape = __webpack_require__("aE6U");
var _ScrollableOrientationShape2 = _interopRequireDefault(_ScrollableOrientationShape);
var _DayOfWeekShape = __webpack_require__("2S2E");
var _DayOfWeekShape2 = _interopRequireDefault(_DayOfWeekShape);
var _constants = __webpack_require__("Fv1B");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var propTypes = (0, _airbnbPropTypes.forbidExtraProps)((0, _object2['default'])({}, _reactWithStyles.withStylesPropTypes, {
enableOutsideDays: _propTypes2['default'].bool,
firstVisibleMonthIndex: _propTypes2['default'].number,
horizontalMonthPadding: _airbnbPropTypes.nonNegativeInteger,
initialMonth: _reactMomentProptypes2['default'].momentObj,
isAnimating: _propTypes2['default'].bool,
numberOfMonths: _propTypes2['default'].number,
modifiers: _propTypes2['default'].objectOf(_propTypes2['default'].objectOf(_ModifiersShape2['default'])),
orientation: _ScrollableOrientationShape2['default'],
onDayClick: _propTypes2['default'].func,
onDayMouseEnter: _propTypes2['default'].func,
onDayMouseLeave: _propTypes2['default'].func,
onMonthTransitionEnd: _propTypes2['default'].func,
onMonthChange: _propTypes2['default'].func,
onYearChange: _propTypes2['default'].func,
renderMonthText: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes2['default'].func, 'renderMonthText', 'renderMonthElement'),
renderCalendarDay: _propTypes2['default'].func,
renderDayContents: _propTypes2['default'].func,
translationValue: _propTypes2['default'].number,
renderMonthElement: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes2['default'].func, 'renderMonthText', 'renderMonthElement'),
daySize: _airbnbPropTypes.nonNegativeInteger,
focusedDate: _reactMomentProptypes2['default'].momentObj, // indicates focusable day
isFocused: _propTypes2['default'].bool, // indicates whether or not to move focus to focusable day
firstDayOfWeek: _DayOfWeekShape2['default'],
setMonthTitleHeight: _propTypes2['default'].func,
isRTL: _propTypes2['default'].bool,
transitionDuration: _airbnbPropTypes.nonNegativeInteger,
verticalBorderSpacing: _airbnbPropTypes.nonNegativeInteger,
// i18n
monthFormat: _propTypes2['default'].string,
phrases: _propTypes2['default'].shape((0, _getPhrasePropTypes2['default'])(_defaultPhrases.CalendarDayPhrases)),
dayAriaLabelFormat: _propTypes2['default'].string
}));
var defaultProps = {
enableOutsideDays: false,
firstVisibleMonthIndex: 0,
horizontalMonthPadding: 13,
initialMonth: (0, _moment2['default'])(),
isAnimating: false,
numberOfMonths: 1,
modifiers: {},
orientation: _constants.HORIZONTAL_ORIENTATION,
onDayClick: function () {
function onDayClick() {}
return onDayClick;
}(),
onDayMouseEnter: function () {
function onDayMouseEnter() {}
return onDayMouseEnter;
}(),
onDayMouseLeave: function () {
function onDayMouseLeave() {}
return onDayMouseLeave;
}(),
onMonthChange: function () {
function onMonthChange() {}
return onMonthChange;
}(),
onYearChange: function () {
function onYearChange() {}
return onYearChange;
}(),
onMonthTransitionEnd: function () {
function onMonthTransitionEnd() {}
return onMonthTransitionEnd;
}(),
renderMonthText: null,
renderCalendarDay: undefined,
renderDayContents: null,
translationValue: null,
renderMonthElement: null,
daySize: _constants.DAY_SIZE,
focusedDate: null,
isFocused: false,
firstDayOfWeek: null,
setMonthTitleHeight: null,
isRTL: false,
transitionDuration: 200,
verticalBorderSpacing: undefined,
// i18n
monthFormat: 'MMMM YYYY', // english locale
phrases: _defaultPhrases.CalendarDayPhrases,
dayAriaLabelFormat: undefined
};
function getMonths(initialMonth, numberOfMonths, withoutTransitionMonths) {
var month = initialMonth.clone();
if (!withoutTransitionMonths) month = month.subtract(1, 'month');
var months = [];
for (var i = 0; i < (withoutTransitionMonths ? numberOfMonths : numberOfMonths + 2); i += 1) {
months.push(month);
month = month.clone().add(1, 'month');
}
return months;
}
var CalendarMonthGrid = function (_React$Component) {
_inherits(CalendarMonthGrid, _React$Component);
function CalendarMonthGrid(props) {
_classCallCheck(this, CalendarMonthGrid);
var _this = _possibleConstructorReturn(this, (CalendarMonthGrid.__proto__ || Object.getPrototypeOf(CalendarMonthGrid)).call(this, props));
var withoutTransitionMonths = props.orientation === _constants.VERTICAL_SCROLLABLE;
_this.state = {
months: getMonths(props.initialMonth, props.numberOfMonths, withoutTransitionMonths)
};
_this.isTransitionEndSupported = (0, _isTransitionEndSupported2['default'])();
_this.onTransitionEnd = _this.onTransitionEnd.bind(_this);
_this.setContainerRef = _this.setContainerRef.bind(_this);
_this.locale = _moment2['default'].locale();
_this.onMonthSelect = _this.onMonthSelect.bind(_this);
_this.onYearSelect = _this.onYearSelect.bind(_this);
return _this;
}
_createClass(CalendarMonthGrid, [{
key: 'componentDidMount',
value: function () {
function componentDidMount() {
this.removeEventListener = (0, _consolidatedEvents.addEventListener)(this.container, 'transitionend', this.onTransitionEnd);
}
return componentDidMount;
}()
}, {
key: 'componentWillReceiveProps',
value: function () {
function componentWillReceiveProps(nextProps) {
var _this2 = this;
var initialMonth = nextProps.initialMonth,
numberOfMonths = nextProps.numberOfMonths,
orientation = nextProps.orientation;
var months = this.state.months;
var _props = this.props,
prevInitialMonth = _props.initialMonth,
prevNumberOfMonths = _props.numberOfMonths;
var hasMonthChanged = !prevInitialMonth.isSame(initialMonth, 'month');
var hasNumberOfMonthsChanged = prevNumberOfMonths !== numberOfMonths;
var newMonths = months;
if (hasMonthChanged && !hasNumberOfMonthsChanged) {
if ((0, _isNextMonth2['default'])(prevInitialMonth, initialMonth)) {
newMonths = months.slice(1);
newMonths.push(months[months.length - 1].clone().add(1, 'month'));
} else if ((0, _isPrevMonth2['default'])(prevInitialMonth, initialMonth)) {
newMonths = months.slice(0, months.length - 1);
newMonths.unshift(months[0].clone().subtract(1, 'month'));
} else {
var withoutTransitionMonths = orientation === _constants.VERTICAL_SCROLLABLE;
newMonths = getMonths(initialMonth, numberOfMonths, withoutTransitionMonths);
}
}
if (hasNumberOfMonthsChanged) {
var _withoutTransitionMonths = orientation === _constants.VERTICAL_SCROLLABLE;
newMonths = getMonths(initialMonth, numberOfMonths, _withoutTransitionMonths);
}
var momentLocale = _moment2['default'].locale();
if (this.locale !== momentLocale) {
this.locale = momentLocale;
newMonths = newMonths.map(function (m) {
return m.locale(_this2.locale);
});
}
this.setState({
months: newMonths
});
}
return componentWillReceiveProps;
}()
}, {
key: 'shouldComponentUpdate',
value: function () {
function shouldComponentUpdate(nextProps, nextState) {
return (0, _reactAddonsShallowCompare2['default'])(this, nextProps, nextState);
}
return shouldComponentUpdate;
}()
}, {
key: 'componentDidUpdate',
value: function () {
function componentDidUpdate() {
var _props2 = this.props,
isAnimating = _props2.isAnimating,
transitionDuration = _props2.transitionDuration,
onMonthTransitionEnd = _props2.onMonthTransitionEnd;
// For IE9, immediately call onMonthTransitionEnd instead of
// waiting for the animation to complete. Similarly, if transitionDuration
// is set to 0, also immediately invoke the onMonthTransitionEnd callback
if ((!this.isTransitionEndSupported || !transitionDuration) && isAnimating) {
onMonthTransitionEnd();
}
}
return componentDidUpdate;
}()
}, {
key: 'componentWillUnmount',
value: function () {
function componentWillUnmount() {
if (this.removeEventListener) this.removeEventListener();
}
return componentWillUnmount;
}()
}, {
key: 'onTransitionEnd',
value: function () {
function onTransitionEnd() {
var onMonthTransitionEnd = this.props.onMonthTransitionEnd;
onMonthTransitionEnd();
}
return onTransitionEnd;
}()
}, {
key: 'onMonthSelect',
value: function () {
function onMonthSelect(currentMonth, newMonthVal) {
var newMonth = currentMonth.clone();
var _props3 = this.props,
onMonthChange = _props3.onMonthChange,
orientation = _props3.orientation;
var months = this.state.months;
var withoutTransitionMonths = orientation === _constants.VERTICAL_SCROLLABLE;
var initialMonthSubtraction = months.indexOf(currentMonth);
if (!withoutTransitionMonths) {
initialMonthSubtraction -= 1;
}
newMonth.set('month', newMonthVal).subtract(initialMonthSubtraction, 'months');
onMonthChange(newMonth);
}
return onMonthSelect;
}()
}, {
key: 'onYearSelect',
value: function () {
function onYearSelect(currentMonth, newYearVal) {
var newMonth = currentMonth.clone();
var _props4 = this.props,
onYearChange = _props4.onYearChange,
orientation = _props4.orientation;
var months = this.state.months;
var withoutTransitionMonths = orientation === _constants.VERTICAL_SCROLLABLE;
var initialMonthSubtraction = months.indexOf(currentMonth);
if (!withoutTransitionMonths) {
initialMonthSubtraction -= 1;
}
newMonth.set('year', newYearVal).subtract(initialMonthSubtraction, 'months');
onYearChange(newMonth);
}
return onYearSelect;
}()
}, {
key: 'setContainerRef',
value: function () {
function setContainerRef(ref) {
this.container = ref;
}
return setContainerRef;
}()
}, {
key: 'render',
value: function () {
function render() {
var _this3 = this;
var _props5 = this.props,
enableOutsideDays = _props5.enableOutsideDays,
firstVisibleMonthIndex = _props5.firstVisibleMonthIndex,
horizontalMonthPadding = _props5.horizontalMonthPadding,
isAnimating = _props5.isAnimating,
modifiers = _props5.modifiers,
numberOfMonths = _props5.numberOfMonths,
monthFormat = _props5.monthFormat,
orientation = _props5.orientation,
translationValue = _props5.translationValue,
daySize = _props5.daySize,
onDayMouseEnter = _props5.onDayMouseEnter,
onDayMouseLeave = _props5.onDayMouseLeave,
onDayClick = _props5.onDayClick,
renderMonthText = _props5.renderMonthText,
renderCalendarDay = _props5.renderCalendarDay,
renderDayContents = _props5.renderDayContents,
renderMonthElement = _props5.renderMonthElement,
onMonthTransitionEnd = _props5.onMonthTransitionEnd,
firstDayOfWeek = _props5.firstDayOfWeek,
focusedDate = _props5.focusedDate,
isFocused = _props5.isFocused,
isRTL = _props5.isRTL,
styles = _props5.styles,
phrases = _props5.phrases,
dayAriaLabelFormat = _props5.dayAriaLabelFormat,
transitionDuration = _props5.transitionDuration,
verticalBorderSpacing = _props5.verticalBorderSpacing,
setMonthTitleHeight = _props5.setMonthTitleHeight;
var months = this.state.months;
var isVertical = orientation === _constants.VERTICAL_ORIENTATION;
var isVerticalScrollable = orientation === _constants.VERTICAL_SCROLLABLE;
var isHorizontal = orientation === _constants.HORIZONTAL_ORIENTATION;
var calendarMonthWidth = (0, _getCalendarMonthWidth2['default'])(daySize, horizontalMonthPadding);
var width = isVertical || isVerticalScrollable ? calendarMonthWidth : (numberOfMonths + 2) * calendarMonthWidth;
var transformType = isVertical || isVerticalScrollable ? 'translateY' : 'translateX';
var transformValue = transformType + '(' + String(translationValue) + 'px)';
return _react2['default'].createElement(
'div',
_extends({}, (0, _reactWithStyles.css)(styles.CalendarMonthGrid, isHorizontal && styles.CalendarMonthGrid__horizontal, isVertical && styles.CalendarMonthGrid__vertical, isVerticalScrollable && styles.CalendarMonthGrid__vertical_scrollable, isAnimating && styles.CalendarMonthGrid__animating, isAnimating && transitionDuration && {
transition: 'transform ' + String(transitionDuration) + 'ms ease-in-out'
}, (0, _object2['default'])({}, (0, _getTransformStyles2['default'])(transformValue), {
width: width
})), {
ref: this.setContainerRef,
onTransitionEnd: onMonthTransitionEnd
}),
months.map(function (month, i) {
var isVisible = i >= firstVisibleMonthIndex && i < firstVisibleMonthIndex + numberOfMonths;
var hideForAnimation = i === 0 && !isVisible;
var showForAnimation = i === 0 && isAnimating && isVisible;
var monthString = (0, _toISOMonthString2['default'])(month);
return _react2['default'].createElement(
'div',
_extends({
key: monthString
}, (0, _reactWithStyles.css)(isHorizontal && styles.CalendarMonthGrid_month__horizontal, hideForAnimation && styles.CalendarMonthGrid_month__hideForAnimation, showForAnimation && !isVertical && !isRTL && {
position: 'absolute',
left: -calendarMonthWidth
}, showForAnimation && !isVertical && isRTL && {
position: 'absolute',
right: 0
}, showForAnimation && isVertical && {
position: 'absolute',
top: -translationValue
}, !isVisible && !isAnimating && styles.CalendarMonthGrid_month__hidden)),
_react2['default'].createElement(_CalendarMonth2['default'], {
month: month,
isVisible: isVisible,
enableOutsideDays: enableOutsideDays,
modifiers: modifiers[monthString],
monthFormat: monthFormat,
orientation: orientation,
onDayMouseEnter: onDayMouseEnter,
onDayMouseLeave: onDayMouseLeave,
onDayClick: onDayClick,
onMonthSelect: _this3.onMonthSelect,
onYearSelect: _this3.onYearSelect,
renderMonthText: renderMonthText,
renderCalendarDay: renderCalendarDay,
renderDayContents: renderDayContents,
renderMonthElement: renderMonthElement,
firstDayOfWeek: firstDayOfWeek,
daySize: daySize,
focusedDate: isVisible ? focusedDate : null,
isFocused: isFocused,
phrases: phrases,
setMonthTitleHeight: setMonthTitleHeight,
dayAriaLabelFormat: dayAriaLabelFormat,
verticalBorderSpacing: verticalBorderSpacing,
horizontalMonthPadding: horizontalMonthPadding
})
);
})
);
}
return render;
}()
}]);
return CalendarMonthGrid;
}(_react2['default'].Component);
CalendarMonthGrid.propTypes = propTypes;
CalendarMonthGrid.defaultProps = defaultProps;
exports['default'] = (0, _reactWithStyles.withStyles)(function (_ref) {
var _ref$reactDates = _ref.reactDates,
color = _ref$reactDates.color,
noScrollBarOnVerticalScrollable = _ref$reactDates.noScrollBarOnVerticalScrollable,
spacing = _ref$reactDates.spacing,
zIndex = _ref$reactDates.zIndex;
return {
CalendarMonthGrid: {
background: color.background,
textAlign: 'left',
zIndex: zIndex
},
CalendarMonthGrid__animating: {
zIndex: zIndex + 1
},
CalendarMonthGrid__horizontal: {
position: 'absolute',
left: spacing.dayPickerHorizontalPadding
},
CalendarMonthGrid__vertical: {
margin: '0 auto'
},
CalendarMonthGrid__vertical_scrollable: (0, _object2['default'])({
margin: '0 auto',
overflowY: 'scroll'
}, noScrollBarOnVerticalScrollable && {
'-webkitOverflowScrolling': 'touch',
'::-webkit-scrollbar': {
'-webkit-appearance': 'none',
display: 'none'
}
}),
CalendarMonthGrid_month__horizontal: {
display: 'inline-block',
verticalAlign: 'top',
minHeight: '100%'
},
CalendarMonthGrid_month__hideForAnimation: {
position: 'absolute',
zIndex: zIndex - 1,
opacity: 0,
pointerEvents: 'none'
},
CalendarMonthGrid_month__hidden: {
visibility: 'hidden'
}
};
})(CalendarMonthGrid);
/***/ }),
/***/ "TqVZ":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXTERNAL MODULE: ./node_modules/@emotion/sheet/dist/sheet.browser.esm.js
var sheet_browser_esm = __webpack_require__("z9I/");
// CONCATENATED MODULE: ./node_modules/@emotion/stylis/dist/stylis.browser.esm.js
function stylis_min (W) {
function M(d, c, e, h, a) {
for (var m = 0, b = 0, v = 0, n = 0, q, g, x = 0, K = 0, k, u = k = q = 0, l = 0, r = 0, I = 0, t = 0, B = e.length, J = B - 1, y, f = '', p = '', F = '', G = '', C; l < B;) {
g = e.charCodeAt(l);
l === J && 0 !== b + n + v + m && (0 !== b && (g = 47 === b ? 10 : 47), n = v = m = 0, B++, J++);
if (0 === b + n + v + m) {
if (l === J && (0 < r && (f = f.replace(N, '')), 0 < f.trim().length)) {
switch (g) {
case 32:
case 9:
case 59:
case 13:
case 10:
break;
default:
f += e.charAt(l);
}
g = 59;
}
switch (g) {
case 123:
f = f.trim();
q = f.charCodeAt(0);
k = 1;
for (t = ++l; l < B;) {
switch (g = e.charCodeAt(l)) {
case 123:
k++;
break;
case 125:
k--;
break;
case 47:
switch (g = e.charCodeAt(l + 1)) {
case 42:
case 47:
a: {
for (u = l + 1; u < J; ++u) {
switch (e.charCodeAt(u)) {
case 47:
if (42 === g && 42 === e.charCodeAt(u - 1) && l + 2 !== u) {
l = u + 1;
break a;
}
break;
case 10:
if (47 === g) {
l = u + 1;
break a;
}
}
}
l = u;
}
}
break;
case 91:
g++;
case 40:
g++;
case 34:
case 39:
for (; l++ < J && e.charCodeAt(l) !== g;) {
}
}
if (0 === k) break;
l++;
}
k = e.substring(t, l);
0 === q && (q = (f = f.replace(ca, '').trim()).charCodeAt(0));
switch (q) {
case 64:
0 < r && (f = f.replace(N, ''));
g = f.charCodeAt(1);
switch (g) {
case 100:
case 109:
case 115:
case 45:
r = c;
break;
default:
r = O;
}
k = M(c, r, k, g, a + 1);
t = k.length;
0 < A && (r = X(O, f, I), C = H(3, k, r, c, D, z, t, g, a, h), f = r.join(''), void 0 !== C && 0 === (t = (k = C.trim()).length) && (g = 0, k = ''));
if (0 < t) switch (g) {
case 115:
f = f.replace(da, ea);
case 100:
case 109:
case 45:
k = f + '{' + k + '}';
break;
case 107:
f = f.replace(fa, '$1 $2');
k = f + '{' + k + '}';
k = 1 === w || 2 === w && L('@' + k, 3) ? '@-webkit-' + k + '@' + k : '@' + k;
break;
default:
k = f + k, 112 === h && (k = (p += k, ''));
} else k = '';
break;
default:
k = M(c, X(c, f, I), k, h, a + 1);
}
F += k;
k = I = r = u = q = 0;
f = '';
g = e.charCodeAt(++l);
break;
case 125:
case 59:
f = (0 < r ? f.replace(N, '') : f).trim();
if (1 < (t = f.length)) switch (0 === u && (q = f.charCodeAt(0), 45 === q || 96 < q && 123 > q) && (t = (f = f.replace(' ', ':')).length), 0 < A && void 0 !== (C = H(1, f, c, d, D, z, p.length, h, a, h)) && 0 === (t = (f = C.trim()).length) && (f = '\x00\x00'), q = f.charCodeAt(0), g = f.charCodeAt(1), q) {
case 0:
break;
case 64:
if (105 === g || 99 === g) {
G += f + e.charAt(l);
break;
}
default:
58 !== f.charCodeAt(t - 1) && (p += P(f, q, g, f.charCodeAt(2)));
}
I = r = u = q = 0;
f = '';
g = e.charCodeAt(++l);
}
}
switch (g) {
case 13:
case 10:
47 === b ? b = 0 : 0 === 1 + q && 107 !== h && 0 < f.length && (r = 1, f += '\x00');
0 < A * Y && H(0, f, c, d, D, z, p.length, h, a, h);
z = 1;
D++;
break;
case 59:
case 125:
if (0 === b + n + v + m) {
z++;
break;
}
default:
z++;
y = e.charAt(l);
switch (g) {
case 9:
case 32:
if (0 === n + m + b) switch (x) {
case 44:
case 58:
case 9:
case 32:
y = '';
break;
default:
32 !== g && (y = ' ');
}
break;
case 0:
y = '\\0';
break;
case 12:
y = '\\f';
break;
case 11:
y = '\\v';
break;
case 38:
0 === n + b + m && (r = I = 1, y = '\f' + y);
break;
case 108:
if (0 === n + b + m + E && 0 < u) switch (l - u) {
case 2:
112 === x && 58 === e.charCodeAt(l - 3) && (E = x);
case 8:
111 === K && (E = K);
}
break;
case 58:
0 === n + b + m && (u = l);
break;
case 44:
0 === b + v + n + m && (r = 1, y += '\r');
break;
case 34:
case 39:
0 === b && (n = n === g ? 0 : 0 === n ? g : n);
break;
case 91:
0 === n + b + v && m++;
break;
case 93:
0 === n + b + v && m--;
break;
case 41:
0 === n + b + m && v--;
break;
case 40:
if (0 === n + b + m) {
if (0 === q) switch (2 * x + 3 * K) {
case 533:
break;
default:
q = 1;
}
v++;
}
break;
case 64:
0 === b + v + n + m + u + k && (k = 1);
break;
case 42:
case 47:
if (!(0 < n + m + v)) switch (b) {
case 0:
switch (2 * g + 3 * e.charCodeAt(l + 1)) {
case 235:
b = 47;
break;
case 220:
t = l, b = 42;
}
break;
case 42:
47 === g && 42 === x && t + 2 !== l && (33 === e.charCodeAt(t + 2) && (p += e.substring(t, l + 1)), y = '', b = 0);
}
}
0 === b && (f += y);
}
K = x;
x = g;
l++;
}
t = p.length;
if (0 < t) {
r = c;
if (0 < A && (C = H(2, p, r, d, D, z, t, h, a, h), void 0 !== C && 0 === (p = C).length)) return G + p + F;
p = r.join(',') + '{' + p + '}';
if (0 !== w * E) {
2 !== w || L(p, 2) || (E = 0);
switch (E) {
case 111:
p = p.replace(ha, ':-moz-$1') + p;
break;
case 112:
p = p.replace(Q, '::-webkit-input-$1') + p.replace(Q, '::-moz-$1') + p.replace(Q, ':-ms-input-$1') + p;
}
E = 0;
}
}
return G + p + F;
}
function X(d, c, e) {
var h = c.trim().split(ia);
c = h;
var a = h.length,
m = d.length;
switch (m) {
case 0:
case 1:
var b = 0;
for (d = 0 === m ? '' : d[0] + ' '; b < a; ++b) {
c[b] = Z(d, c[b], e).trim();
}
break;
default:
var v = b = 0;
for (c = []; b < a; ++b) {
for (var n = 0; n < m; ++n) {
c[v++] = Z(d[n] + ' ', h[b], e).trim();
}
}
}
return c;
}
function Z(d, c, e) {
var h = c.charCodeAt(0);
33 > h && (h = (c = c.trim()).charCodeAt(0));
switch (h) {
case 38:
return c.replace(F, '$1' + d.trim());
case 58:
return d.trim() + c.replace(F, '$1' + d.trim());
default:
if (0 < 1 * e && 0 < c.indexOf('\f')) return c.replace(F, (58 === d.charCodeAt(0) ? '' : '$1') + d.trim());
}
return d + c;
}
function P(d, c, e, h) {
var a = d + ';',
m = 2 * c + 3 * e + 4 * h;
if (944 === m) {
d = a.indexOf(':', 9) + 1;
var b = a.substring(d, a.length - 1).trim();
b = a.substring(0, d).trim() + b + ';';
return 1 === w || 2 === w && L(b, 1) ? '-webkit-' + b + b : b;
}
if (0 === w || 2 === w && !L(a, 1)) return a;
switch (m) {
case 1015:
return 97 === a.charCodeAt(10) ? '-webkit-' + a + a : a;
case 951:
return 116 === a.charCodeAt(3) ? '-webkit-' + a + a : a;
case 963:
return 110 === a.charCodeAt(5) ? '-webkit-' + a + a : a;
case 1009:
if (100 !== a.charCodeAt(4)) break;
case 969:
case 942:
return '-webkit-' + a + a;
case 978:
return '-webkit-' + a + '-moz-' + a + a;
case 1019:
case 983:
return '-webkit-' + a + '-moz-' + a + '-ms-' + a + a;
case 883:
if (45 === a.charCodeAt(8)) return '-webkit-' + a + a;
if (0 < a.indexOf('image-set(', 11)) return a.replace(ja, '$1-webkit-$2') + a;
break;
case 932:
if (45 === a.charCodeAt(4)) switch (a.charCodeAt(5)) {
case 103:
return '-webkit-box-' + a.replace('-grow', '') + '-webkit-' + a + '-ms-' + a.replace('grow', 'positive') + a;
case 115:
return '-webkit-' + a + '-ms-' + a.replace('shrink', 'negative') + a;
case 98:
return '-webkit-' + a + '-ms-' + a.replace('basis', 'preferred-size') + a;
}
return '-webkit-' + a + '-ms-' + a + a;
case 964:
return '-webkit-' + a + '-ms-flex-' + a + a;
case 1023:
if (99 !== a.charCodeAt(8)) break;
b = a.substring(a.indexOf(':', 15)).replace('flex-', '').replace('space-between', 'justify');
return '-webkit-box-pack' + b + '-webkit-' + a + '-ms-flex-pack' + b + a;
case 1005:
return ka.test(a) ? a.replace(aa, ':-webkit-') + a.replace(aa, ':-moz-') + a : a;
case 1e3:
b = a.substring(13).trim();
c = b.indexOf('-') + 1;
switch (b.charCodeAt(0) + b.charCodeAt(c)) {
case 226:
b = a.replace(G, 'tb');
break;
case 232:
b = a.replace(G, 'tb-rl');
break;
case 220:
b = a.replace(G, 'lr');
break;
default:
return a;
}
return '-webkit-' + a + '-ms-' + b + a;
case 1017:
if (-1 === a.indexOf('sticky', 9)) break;
case 975:
c = (a = d).length - 10;
b = (33 === a.charCodeAt(c) ? a.substring(0, c) : a).substring(d.indexOf(':', 7) + 1).trim();
switch (m = b.charCodeAt(0) + (b.charCodeAt(7) | 0)) {
case 203:
if (111 > b.charCodeAt(8)) break;
case 115:
a = a.replace(b, '-webkit-' + b) + ';' + a;
break;
case 207:
case 102:
a = a.replace(b, '-webkit-' + (102 < m ? 'inline-' : '') + 'box') + ';' + a.replace(b, '-webkit-' + b) + ';' + a.replace(b, '-ms-' + b + 'box') + ';' + a;
}
return a + ';';
case 938:
if (45 === a.charCodeAt(5)) switch (a.charCodeAt(6)) {
case 105:
return b = a.replace('-items', ''), '-webkit-' + a + '-webkit-box-' + b + '-ms-flex-' + b + a;
case 115:
return '-webkit-' + a + '-ms-flex-item-' + a.replace(ba, '') + a;
default:
return '-webkit-' + a + '-ms-flex-line-pack' + a.replace('align-content', '').replace(ba, '') + a;
}
break;
case 973:
case 989:
if (45 !== a.charCodeAt(3) || 122 === a.charCodeAt(4)) break;
case 931:
case 953:
if (!0 === la.test(d)) return 115 === (b = d.substring(d.indexOf(':') + 1)).charCodeAt(0) ? P(d.replace('stretch', 'fill-available'), c, e, h).replace(':fill-available', ':stretch') : a.replace(b, '-webkit-' + b) + a.replace(b, '-moz-' + b.replace('fill-', '')) + a;
break;
case 962:
if (a = '-webkit-' + a + (102 === a.charCodeAt(5) ? '-ms-' + a : '') + a, 211 === e + h && 105 === a.charCodeAt(13) && 0 < a.indexOf('transform', 10)) return a.substring(0, a.indexOf(';', 27) + 1).replace(ma, '$1-webkit-$2') + a;
}
return a;
}
function L(d, c) {
var e = d.indexOf(1 === c ? ':' : '{'),
h = d.substring(0, 3 !== c ? e : 10);
e = d.substring(e + 1, d.length - 1);
return R(2 !== c ? h : h.replace(na, '$1'), e, c);
}
function ea(d, c) {
var e = P(c, c.charCodeAt(0), c.charCodeAt(1), c.charCodeAt(2));
return e !== c + ';' ? e.replace(oa, ' or ($1)').substring(4) : '(' + c + ')';
}
function H(d, c, e, h, a, m, b, v, n, q) {
for (var g = 0, x = c, w; g < A; ++g) {
switch (w = S[g].call(B, d, x, e, h, a, m, b, v, n, q)) {
case void 0:
case !1:
case !0:
case null:
break;
default:
x = w;
}
}
if (x !== c) return x;
}
function T(d) {
switch (d) {
case void 0:
case null:
A = S.length = 0;
break;
default:
if ('function' === typeof d) S[A++] = d;else if ('object' === typeof d) for (var c = 0, e = d.length; c < e; ++c) {
T(d[c]);
} else Y = !!d | 0;
}
return T;
}
function U(d) {
d = d.prefix;
void 0 !== d && (R = null, d ? 'function' !== typeof d ? w = 1 : (w = 2, R = d) : w = 0);
return U;
}
function B(d, c) {
var e = d;
33 > e.charCodeAt(0) && (e = e.trim());
V = e;
e = [V];
if (0 < A) {
var h = H(-1, c, e, e, D, z, 0, 0, 0, 0);
void 0 !== h && 'string' === typeof h && (c = h);
}
var a = M(O, e, c, 0, 0);
0 < A && (h = H(-2, a, e, e, D, z, a.length, 0, 0, 0), void 0 !== h && (a = h));
V = '';
E = 0;
z = D = 1;
return a;
}
var ca = /^\0+/g,
N = /[\0\r\f]/g,
aa = /: */g,
ka = /zoo|gra/,
ma = /([,: ])(transform)/g,
ia = /,\r+?/g,
F = /([\t\r\n ])*\f?&/g,
fa = /@(k\w+)\s*(\S*)\s*/,
Q = /::(place)/g,
ha = /:(read-only)/g,
G = /[svh]\w+-[tblr]{2}/,
da = /\(\s*(.*)\s*\)/g,
oa = /([\s\S]*?);/g,
ba = /-self|flex-/g,
na = /[^]*?(:[rp][el]a[\w-]+)[^]*/,
la = /stretch|:\s*\w+\-(?:conte|avail)/,
ja = /([^-])(image-set\()/,
z = 1,
D = 1,
E = 0,
w = 1,
O = [],
S = [],
A = 0,
R = null,
Y = 0,
V = '';
B.use = T;
B.set = U;
void 0 !== W && U(W);
return B;
}
/* harmony default export */ var stylis_browser_esm = (stylis_min);
// CONCATENATED MODULE: ./node_modules/@emotion/weak-memoize/dist/weak-memoize.browser.esm.js
var weakMemoize = function weakMemoize(func) {
// $FlowFixMe flow doesn't include all non-primitive types as allowed for weakmaps
var cache = new WeakMap();
return function (arg) {
if (cache.has(arg)) {
// $FlowFixMe
return cache.get(arg);
}
var ret = func(arg);
cache.set(arg, ret);
return ret;
};
};
/* harmony default export */ var weak_memoize_browser_esm = (weakMemoize);
// CONCATENATED MODULE: ./node_modules/@emotion/cache/dist/cache.browser.esm.js
// https://github.com/thysultan/stylis.js/tree/master/plugins/rule-sheet
// inlined to avoid umd wrapper and peerDep warnings/installing stylis
// since we use stylis after closure compiler
var delimiter = '/*|*/';
var needle = delimiter + '}';
function toSheet(block) {
if (block) {
Sheet.current.insert(block + '}');
}
}
var Sheet = {
current: null
};
var ruleSheet = function ruleSheet(context, content, selectors, parents, line, column, length, ns, depth, at) {
switch (context) {
// property
case 1:
{
switch (content.charCodeAt(0)) {
case 64:
{
// @import
Sheet.current.insert(content + ';');
return '';
}
// charcode for l
case 108:
{
// charcode for b
// this ignores label
if (content.charCodeAt(2) === 98) {
return '';
}
}
}
break;
}
// selector
case 2:
{
if (ns === 0) return content + delimiter;
break;
}
// at-rule
case 3:
{
switch (ns) {
// @font-face, @page
case 102:
case 112:
{
Sheet.current.insert(selectors[0] + content);
return '';
}
default:
{
return content + (at === 0 ? delimiter : '');
}
}
}
case -2:
{
content.split(needle).forEach(toSheet);
}
}
};
var cache_browser_esm_createCache = function createCache(options) {
if (options === undefined) options = {};
var key = options.key || 'css';
var stylisOptions;
if (options.prefix !== undefined) {
stylisOptions = {
prefix: options.prefix
};
}
var stylis = new stylis_browser_esm(stylisOptions);
if (false) {}
var inserted = {}; // $FlowFixMe
var container;
{
container = options.container || document.head;
var nodes = document.querySelectorAll("style[data-emotion-" + key + "]");
Array.prototype.forEach.call(nodes, function (node) {
var attrib = node.getAttribute("data-emotion-" + key); // $FlowFixMe
attrib.split(' ').forEach(function (id) {
inserted[id] = true;
});
if (node.parentNode !== container) {
container.appendChild(node);
}
});
}
var _insert;
{
stylis.use(options.stylisPlugins)(ruleSheet);
_insert = function insert(selector, serialized, sheet, shouldCache) {
var name = serialized.name;
Sheet.current = sheet;
if (false) { var map; }
stylis(selector, serialized.styles);
if (shouldCache) {
cache.inserted[name] = true;
}
};
}
if (false) { var commentEnd, commentStart; }
var cache = {
key: key,
sheet: new sheet_browser_esm["a" /* StyleSheet */]({
key: key,
container: container,
nonce: options.nonce,
speedy: options.speedy
}),
nonce: options.nonce,
inserted: inserted,
registered: {},
insert: _insert
};
return cache;
};
/* harmony default export */ var cache_browser_esm = __webpack_exports__["a"] = (cache_browser_esm_createCache);
/***/ }),
/***/ "Tqx9":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["primitives"]; }());
/***/ }),
/***/ "UAm0":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getStyledClassNameFromKey; });
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("YLtl");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var memize__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("4eJC");
/* harmony import */ var memize__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(memize__WEBPACK_IMPORTED_MODULE_1__);
/**
* External dependencies
*/
/**
* Generates the connected component CSS className based on the namespace.
*
* @param namespace The name of the connected component.
* @return The generated CSS className.
*/
function getStyledClassName(namespace) {
const kebab = Object(lodash__WEBPACK_IMPORTED_MODULE_0__["kebabCase"])(namespace);
return `components-${kebab}`;
}
const getStyledClassNameFromKey = memize__WEBPACK_IMPORTED_MODULE_1___default()(getStyledClassName);
/***/ }),
/***/ "UFhG":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// var modulo = require('./modulo');
var $floor = Math.floor;
// http://262.ecma-international.org/5.1/#sec-5.2
module.exports = function floor(x) {
// return x - modulo(x, 1);
return $floor(x);
};
/***/ }),
/***/ "UVaH":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(global) {
var origSymbol = global.Symbol;
var hasSymbolSham = __webpack_require__("FpZJ");
module.exports = function hasNativeSymbols() {
if (typeof origSymbol !== 'function') { return false; }
if (typeof Symbol !== 'function') { return false; }
if (typeof origSymbol('foo') !== 'symbol') { return false; }
if (typeof Symbol('bar') !== 'symbol') { return false; }
return hasSymbolSham();
};
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("yLpj")))
/***/ }),
/***/ "V1cy":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var ES5Type = __webpack_require__("60zJ");
// https://262.ecma-international.org/11.0/#sec-ecmascript-data-types-and-values
module.exports = function Type(x) {
if (typeof x === 'symbol') {
return 'Symbol';
}
if (typeof x === 'bigint') {
return 'BigInt';
}
return ES5Type(x);
};
/***/ }),
/***/ "VDVV":
/***/ (function(module, exports, __webpack_require__) {
Object.defineProperty(exports, "__esModule", {
value: true
});
var _arrayPrototype = __webpack_require__("/ZKw");
var _arrayPrototype2 = _interopRequireDefault(_arrayPrototype);
var _globalCache = __webpack_require__("9pTB");
var _globalCache2 = _interopRequireDefault(_globalCache);
var _constants = __webpack_require__("kFtd");
var _getClassName = __webpack_require__("nLTY");
var _getClassName2 = _interopRequireDefault(_getClassName);
var _separateStyles2 = __webpack_require__("3HjQ");
var _separateStyles3 = _interopRequireDefault(_separateStyles2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
/**
* Function required as part of the react-with-styles interface. Parses the styles provided by
* react-with-styles to produce class names based on the style name and optionally the namespace if
* available.
*
* stylesObject {Object} The styles object passed to withStyles.
*
* Return an object mapping style names to class names.
*/
function create(stylesObject) {
var stylesToClasses = {};
var styleNames = Object.keys(stylesObject);
var sharedState = _globalCache2['default'].get(_constants.GLOBAL_CACHE_KEY) || {};
var _sharedState$namespac = sharedState.namespace,
namespace = _sharedState$namespac === undefined ? '' : _sharedState$namespac;
styleNames.forEach(function (styleName) {
var className = (0, _getClassName2['default'])(namespace, styleName);
stylesToClasses[styleName] = className;
});
return stylesToClasses;
}
/**
* Process styles to be consumed by a component.
*
* stylesArray {Array} Array of the following: values returned by create, plain JavaScript objects
* representing inline styles, or arrays thereof.
*
* Return an object with optional className and style properties to be spread on a component.
*/
function resolve(stylesArray) {
var flattenedStyles = (0, _arrayPrototype2['default'])(stylesArray, Infinity);
var _separateStyles = (0, _separateStyles3['default'])(flattenedStyles),
classNames = _separateStyles.classNames,
hasInlineStyles = _separateStyles.hasInlineStyles,
inlineStyles = _separateStyles.inlineStyles;
var specificClassNames = classNames.map(function (name, index) {
return String(name) + ' ' + String(name) + '_' + String(index + 1);
});
var className = specificClassNames.join(' ');
var result = { className: className };
if (hasInlineStyles) result.style = inlineStyles;
return result;
}
exports['default'] = { create: create, resolve: resolve };
/***/ }),
/***/ "VF6F":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("AM7I");
var callBind = __webpack_require__("PrET");
var $indexOf = callBind(GetIntrinsic('String.prototype.indexOf'));
module.exports = function callBoundIntrinsic(name, allowMissing) {
var intrinsic = GetIntrinsic(name, !!allowMissing);
if (typeof intrinsic === 'function' && $indexOf(name, '.prototype.') > -1) {
return callBind(intrinsic);
}
return intrinsic;
};
/***/ }),
/***/ "VbXa":
/***/ (function(module, exports, __webpack_require__) {
var setPrototypeOf = __webpack_require__("SksO");
function _inheritsLoose(subClass, superClass) {
subClass.prototype = Object.create(superClass.prototype);
subClass.prototype.constructor = subClass;
setPrototypeOf(subClass, superClass);
}
module.exports = _inheritsLoose;
module.exports["default"] = module.exports, module.exports.__esModule = true;
/***/ }),
/***/ "Vq1w":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isPortalEvent; });
/* harmony import */ var _contains_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("utzN");
/**
* Returns `true` if `event` has been fired within a React Portal element.
*/
function isPortalEvent(event) {
return !Object(_contains_js__WEBPACK_IMPORTED_MODULE_0__[/* contains */ "a"])(event.currentTarget, event.target);
}
/***/ }),
/***/ "W/NR":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// UNUSED EXPORTS: TOOLTIP_DELAY
// EXTERNAL MODULE: external ["wp","element"]
var external_wp_element_ = __webpack_require__("GRId");
// EXTERNAL MODULE: external "lodash"
var external_lodash_ = __webpack_require__("YLtl");
// EXTERNAL MODULE: external ["wp","compose"]
var external_wp_compose_ = __webpack_require__("K9lf");
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/popover/index.js + 1 modules
var popover = __webpack_require__("oXO/");
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/shortcut/index.js
var build_module_shortcut = __webpack_require__("Cw+6");
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/ui/context/with-next.js
var with_next = __webpack_require__("9NHk");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tooltip/next.js
/**
* Internal dependencies
*/
const Tooltip = false ? undefined : undefined;
const adapter = ({
text,
...props
}) => ({ ...props,
content: text
});
function withNextComponent(Component) {
return Object(with_next["a" /* withNext */])(Component, Tooltip, 'WPComponentsTooltip', adapter);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tooltip/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Time over children to wait before showing tooltip
*
* @type {number}
*/
const TOOLTIP_DELAY = 700;
const eventCatcher = Object(external_wp_element_["createElement"])("div", {
className: "event-catcher"
});
const getDisabledElement = ({
eventHandlers,
child,
childrenWithPopover
}) => Object(external_wp_element_["cloneElement"])(Object(external_wp_element_["createElement"])("span", {
className: "disabled-element-wrapper"
}, Object(external_wp_element_["cloneElement"])(eventCatcher, eventHandlers), Object(external_wp_element_["cloneElement"])(child, {
children: childrenWithPopover
}), ","), eventHandlers);
const getRegularElement = ({
child,
eventHandlers,
childrenWithPopover
}) => Object(external_wp_element_["cloneElement"])(child, { ...eventHandlers,
children: childrenWithPopover
});
const addPopoverToGrandchildren = ({
grandchildren,
isOver,
position,
text,
shortcut
}) => Object(external_wp_element_["concatChildren"])(grandchildren, isOver && Object(external_wp_element_["createElement"])(popover["a" /* default */], {
focusOnMount: false,
position: position,
className: "components-tooltip",
"aria-hidden": "true",
animate: false,
noArrow: true
}, text, Object(external_wp_element_["createElement"])(build_module_shortcut["a" /* default */], {
className: "components-tooltip__shortcut",
shortcut: shortcut
})));
const emitToChild = (children, eventName, event) => {
if (external_wp_element_["Children"].count(children) !== 1) {
return;
}
const child = external_wp_element_["Children"].only(children);
if (typeof child.props[eventName] === 'function') {
child.props[eventName](event);
}
};
function tooltip_Tooltip({
children,
position,
text,
shortcut
}) {
/**
* Whether a mouse is currently pressed, used in determining whether
* to handle a focus event as displaying the tooltip immediately.
*
* @type {boolean}
*/
const [isMouseDown, setIsMouseDown] = Object(external_wp_element_["useState"])(false);
const [isOver, setIsOver] = Object(external_wp_element_["useState"])(false);
const delayedSetIsOver = Object(external_wp_compose_["useDebounce"])(setIsOver, TOOLTIP_DELAY);
const createMouseDown = event => {
// Preserve original child callback behavior
emitToChild(children, 'onMouseDown', event); // On mouse down, the next `mouseup` should revert the value of the
// instance property and remove its own event handler. The bind is
// made on the document since the `mouseup` might not occur within
// the bounds of the element.
document.addEventListener('mouseup', cancelIsMouseDown);
setIsMouseDown(true);
};
const createMouseUp = event => {
emitToChild(children, 'onMouseUp', event);
document.removeEventListener('mouseup', cancelIsMouseDown);
setIsMouseDown(false);
};
const createMouseEvent = type => {
if (type === 'mouseUp') return createMouseUp;
if (type === 'mouseDown') return createMouseDown;
};
/**
* Prebound `isInMouseDown` handler, created as a constant reference to
* assure ability to remove in component unmount.
*
* @type {Function}
*/
const cancelIsMouseDown = createMouseEvent('mouseUp');
const createToggleIsOver = (eventName, isDelayed) => {
return event => {
// Preserve original child callback behavior
emitToChild(children, eventName, event); // Mouse events behave unreliably in React for disabled elements,
// firing on mouseenter but not mouseleave. Further, the default
// behavior for disabled elements in some browsers is to ignore
// mouse events. Don't bother trying to to handle them.
//
// See: https://github.com/facebook/react/issues/4251
if (event.currentTarget.disabled) {
return;
} // A focus event will occur as a result of a mouse click, but it
// should be disambiguated between interacting with the button and
// using an explicit focus shift as a cue to display the tooltip.
if ('focus' === event.type && isMouseDown) {
return;
} // Needed in case unsetting is over while delayed set pending, i.e.
// quickly blur/mouseleave before delayedSetIsOver is called
delayedSetIsOver.cancel();
const _isOver = Object(external_lodash_["includes"])(['focus', 'mouseenter'], event.type);
if (_isOver === isOver) {
return;
}
if (isDelayed) {
delayedSetIsOver(_isOver);
} else {
setIsOver(_isOver);
}
};
};
const clearOnUnmount = () => {
delayedSetIsOver.cancel();
};
Object(external_wp_element_["useEffect"])(() => clearOnUnmount, []);
if (external_wp_element_["Children"].count(children) !== 1) {
if (false) {}
return children;
}
const eventHandlers = {
onMouseEnter: createToggleIsOver('onMouseEnter', true),
onMouseLeave: createToggleIsOver('onMouseLeave'),
onClick: createToggleIsOver('onClick'),
onFocus: createToggleIsOver('onFocus'),
onBlur: createToggleIsOver('onBlur'),
onMouseDown: createMouseEvent('mouseDown')
};
const child = external_wp_element_["Children"].only(children);
const {
children: grandchildren,
disabled
} = child.props;
const getElementWithPopover = disabled ? getDisabledElement : getRegularElement;
const popoverData = {
isOver,
position,
text,
shortcut
};
const childrenWithPopover = addPopoverToGrandchildren({
grandchildren,
...popoverData
});
return getElementWithPopover({
child,
eventHandlers,
childrenWithPopover
});
}
/* harmony default export */ var tooltip = __webpack_exports__["a"] = (withNextComponent(tooltip_Tooltip));
/***/ }),
/***/ "WFqU":
/***/ (function(module, exports, __webpack_require__) {
/* WEBPACK VAR INJECTION */(function(global) {/** Detect free variable `global` from Node.js. */
var freeGlobal = typeof global == 'object' && global && global.Object === Object && global;
module.exports = freeGlobal;
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("yLpj")))
/***/ }),
/***/ "WI5Z":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = registerInterfaceWithDefaultTheme;
var _ThemedStyleSheet = __webpack_require__("030x");
var _ThemedStyleSheet2 = _interopRequireDefault(_ThemedStyleSheet);
var _DefaultTheme = __webpack_require__("xOhs");
var _DefaultTheme2 = _interopRequireDefault(_DefaultTheme);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function registerInterfaceWithDefaultTheme(reactWithStylesInterface) {
_ThemedStyleSheet2['default'].registerInterface(reactWithStylesInterface);
_ThemedStyleSheet2['default'].registerTheme(_DefaultTheme2['default']);
}
/***/ }),
/***/ "WZeS":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var hasSymbols = typeof Symbol === 'function' && typeof Symbol.iterator === 'symbol';
var isPrimitive = __webpack_require__("Teho");
var isCallable = __webpack_require__("IdCN");
var isDate = __webpack_require__("DmXP");
var isSymbol = __webpack_require__("/sVA");
var ordinaryToPrimitive = function OrdinaryToPrimitive(O, hint) {
if (typeof O === 'undefined' || O === null) {
throw new TypeError('Cannot call method on ' + O);
}
if (typeof hint !== 'string' || (hint !== 'number' && hint !== 'string')) {
throw new TypeError('hint must be "string" or "number"');
}
var methodNames = hint === 'string' ? ['toString', 'valueOf'] : ['valueOf', 'toString'];
var method, result, i;
for (i = 0; i < methodNames.length; ++i) {
method = O[methodNames[i]];
if (isCallable(method)) {
result = method.call(O);
if (isPrimitive(result)) {
return result;
}
}
}
throw new TypeError('No default value');
};
var GetMethod = function GetMethod(O, P) {
var func = O[P];
if (func !== null && typeof func !== 'undefined') {
if (!isCallable(func)) {
throw new TypeError(func + ' returned for property ' + P + ' of object ' + O + ' is not a function');
}
return func;
}
return void 0;
};
// http://www.ecma-international.org/ecma-262/6.0/#sec-toprimitive
module.exports = function ToPrimitive(input) {
if (isPrimitive(input)) {
return input;
}
var hint = 'default';
if (arguments.length > 1) {
if (arguments[1] === String) {
hint = 'string';
} else if (arguments[1] === Number) {
hint = 'number';
}
}
var exoticToPrim;
if (hasSymbols) {
if (Symbol.toPrimitive) {
exoticToPrim = GetMethod(input, Symbol.toPrimitive);
} else if (isSymbol(input)) {
exoticToPrim = Symbol.prototype.valueOf;
}
}
if (typeof exoticToPrim !== 'undefined') {
var result = exoticToPrim.call(input, hint);
if (isPrimitive(result)) {
return result;
}
throw new TypeError('unable to convert exotic object to primitive');
}
if (hint === 'default' && (isDate(input) || isSymbol(input))) {
hint = 'string';
}
return ordinaryToPrimitive(input, hint === 'default' ? 'number' : hint);
};
/***/ }),
/***/ "WbBG":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var ReactPropTypesSecret = 'SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED';
module.exports = ReactPropTypesSecret;
/***/ }),
/***/ "Wfh+":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var abs = __webpack_require__("nKkb");
var floor = __webpack_require__("UFhG");
var ToNumber = __webpack_require__("Pjai");
var $isNaN = __webpack_require__("HwJD");
var $isFinite = __webpack_require__("ald4");
var $sign = __webpack_require__("6I5v");
// http://262.ecma-international.org/5.1/#sec-9.4
module.exports = function ToInteger(value) {
var number = ToNumber(value);
if ($isNaN(number)) { return 0; }
if (number === 0 || !$isFinite(number)) { return number; }
return $sign(number) * floor(abs(number));
};
/***/ }),
/***/ "WmS1":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = toMomentObject;
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _constants = __webpack_require__("Fv1B");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function toMomentObject(dateString, customFormat) {
var dateFormats = customFormat ? [customFormat, _constants.DISPLAY_FORMAT, _constants.ISO_FORMAT] : [_constants.DISPLAY_FORMAT, _constants.ISO_FORMAT];
var date = (0, _moment2['default'])(dateString, dateFormats, true);
return date.isValid() ? date.hour(12) : null;
}
/***/ }),
/***/ "WnOg":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export warning */
/**
* Logs `messages` to the console using `console.warn` based on a `condition`.
*
* @example
* import { warning } from "reakit-warning";
*
* warning(true, "a", "b"); // console.warn("a", "\n", "b")
* warning(false, "a", "b"); // does nothing
*/
function warning(condition) {
if (false) { var warns, _len, messages, _key, _console; }
}
/***/ }),
/***/ "WvKp":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $TypeError = GetIntrinsic('%TypeError%');
var CreateDataProperty = __webpack_require__("DvWQ");
var IsPropertyKey = __webpack_require__("i10q");
var Type = __webpack_require__("V1cy");
// // https://ecma-international.org/ecma-262/6.0/#sec-createdatapropertyorthrow
module.exports = function CreateDataPropertyOrThrow(O, P, V) {
if (Type(O) !== 'Object') {
throw new $TypeError('Assertion failed: Type(O) is not Object');
}
if (!IsPropertyKey(P)) {
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
}
var success = CreateDataProperty(O, P, V);
if (!success) {
throw new $TypeError('unable to create data property');
}
return success;
};
/***/ }),
/***/ "XGBb":
/***/ (function(module, exports, __webpack_require__) {
var moment = __webpack_require__("wy2R");
var momentValidationWrapper = __webpack_require__("c6aN");
var core = __webpack_require__("iNdV");
module.exports = {
momentObj : core.createMomentChecker(
'object',
function(obj) {
return typeof obj === 'object';
},
function isValid(value) {
return momentValidationWrapper.isValidMoment(value);
},
'Moment'
),
momentString : core.createMomentChecker(
'string',
function(str) {
return typeof str === 'string';
},
function isValid(value) {
return momentValidationWrapper.isValidMoment(moment(value));
},
'Moment'
),
momentDurationObj : core.createMomentChecker(
'object',
function(obj) {
return typeof obj === 'object';
},
function isValid(value) {
return moment.isDuration(value);
},
'Duration'
),
};
/***/ }),
/***/ "XgzB":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const chevronUp = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
viewBox: "0 0 24 24",
xmlns: "http://www.w3.org/2000/svg"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M6.5 12.4L12 8l5.5 4.4-.9 1.2L12 10l-4.5 3.6-1-1.2z"
}));
/* harmony default export */ __webpack_exports__["a"] = (chevronUp);
/***/ }),
/***/ "Xtko":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _slicedToArray = function () { function sliceIterator(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"]) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } return function (arr, i) { if (Array.isArray(arr)) { return arr; } else if (Symbol.iterator in Object(arr)) { return sliceIterator(arr, i); } else { throw new TypeError("Invalid attempt to destructure non-iterable instance"); } }; }();
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _object = __webpack_require__("Koq/");
var _object2 = _interopRequireDefault(_object);
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactMomentProptypes = __webpack_require__("XGBb");
var _reactMomentProptypes2 = _interopRequireDefault(_reactMomentProptypes);
var _airbnbPropTypes = __webpack_require__("Hsqg");
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _object3 = __webpack_require__("4cSd");
var _object4 = _interopRequireDefault(_object3);
var _isTouchDevice = __webpack_require__("LTAC");
var _isTouchDevice2 = _interopRequireDefault(_isTouchDevice);
var _defaultPhrases = __webpack_require__("vV+G");
var _getPhrasePropTypes = __webpack_require__("yc2e");
var _getPhrasePropTypes2 = _interopRequireDefault(_getPhrasePropTypes);
var _isSameDay = __webpack_require__("pRvc");
var _isSameDay2 = _interopRequireDefault(_isSameDay);
var _isAfterDay = __webpack_require__("Nho6");
var _isAfterDay2 = _interopRequireDefault(_isAfterDay);
var _getVisibleDays = __webpack_require__("u5Fq");
var _getVisibleDays2 = _interopRequireDefault(_getVisibleDays);
var _isDayVisible = __webpack_require__("IgE5");
var _isDayVisible2 = _interopRequireDefault(_isDayVisible);
var _toISODateString = __webpack_require__("pYxT");
var _toISODateString2 = _interopRequireDefault(_toISODateString);
var _toISOMonthString = __webpack_require__("jenk");
var _toISOMonthString2 = _interopRequireDefault(_toISOMonthString);
var _ScrollableOrientationShape = __webpack_require__("aE6U");
var _ScrollableOrientationShape2 = _interopRequireDefault(_ScrollableOrientationShape);
var _DayOfWeekShape = __webpack_require__("2S2E");
var _DayOfWeekShape2 = _interopRequireDefault(_DayOfWeekShape);
var _CalendarInfoPositionShape = __webpack_require__("oR9Z");
var _CalendarInfoPositionShape2 = _interopRequireDefault(_CalendarInfoPositionShape);
var _constants = __webpack_require__("Fv1B");
var _DayPicker = __webpack_require__("Nloh");
var _DayPicker2 = _interopRequireDefault(_DayPicker);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; }
var propTypes = (0, _airbnbPropTypes.forbidExtraProps)({
date: _reactMomentProptypes2['default'].momentObj,
onDateChange: _propTypes2['default'].func,
focused: _propTypes2['default'].bool,
onFocusChange: _propTypes2['default'].func,
onClose: _propTypes2['default'].func,
keepOpenOnDateSelect: _propTypes2['default'].bool,
isOutsideRange: _propTypes2['default'].func,
isDayBlocked: _propTypes2['default'].func,
isDayHighlighted: _propTypes2['default'].func,
// DayPicker props
renderMonthText: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes2['default'].func, 'renderMonthText', 'renderMonthElement'),
renderMonthElement: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes2['default'].func, 'renderMonthText', 'renderMonthElement'),
enableOutsideDays: _propTypes2['default'].bool,
numberOfMonths: _propTypes2['default'].number,
orientation: _ScrollableOrientationShape2['default'],
withPortal: _propTypes2['default'].bool,
initialVisibleMonth: _propTypes2['default'].func,
firstDayOfWeek: _DayOfWeekShape2['default'],
hideKeyboardShortcutsPanel: _propTypes2['default'].bool,
daySize: _airbnbPropTypes.nonNegativeInteger,
verticalHeight: _airbnbPropTypes.nonNegativeInteger,
noBorder: _propTypes2['default'].bool,
verticalBorderSpacing: _airbnbPropTypes.nonNegativeInteger,
transitionDuration: _airbnbPropTypes.nonNegativeInteger,
horizontalMonthPadding: _airbnbPropTypes.nonNegativeInteger,
navPrev: _propTypes2['default'].node,
navNext: _propTypes2['default'].node,
onPrevMonthClick: _propTypes2['default'].func,
onNextMonthClick: _propTypes2['default'].func,
onOutsideClick: _propTypes2['default'].func,
renderCalendarDay: _propTypes2['default'].func,
renderDayContents: _propTypes2['default'].func,
renderCalendarInfo: _propTypes2['default'].func,
calendarInfoPosition: _CalendarInfoPositionShape2['default'],
// accessibility
onBlur: _propTypes2['default'].func,
isFocused: _propTypes2['default'].bool,
showKeyboardShortcuts: _propTypes2['default'].bool,
// i18n
monthFormat: _propTypes2['default'].string,
weekDayFormat: _propTypes2['default'].string,
phrases: _propTypes2['default'].shape((0, _getPhrasePropTypes2['default'])(_defaultPhrases.DayPickerPhrases)),
dayAriaLabelFormat: _propTypes2['default'].string,
isRTL: _propTypes2['default'].bool
});
var defaultProps = {
date: undefined, // TODO: use null
onDateChange: function () {
function onDateChange() {}
return onDateChange;
}(),
focused: false,
onFocusChange: function () {
function onFocusChange() {}
return onFocusChange;
}(),
onClose: function () {
function onClose() {}
return onClose;
}(),
keepOpenOnDateSelect: false,
isOutsideRange: function () {
function isOutsideRange() {}
return isOutsideRange;
}(),
isDayBlocked: function () {
function isDayBlocked() {}
return isDayBlocked;
}(),
isDayHighlighted: function () {
function isDayHighlighted() {}
return isDayHighlighted;
}(),
// DayPicker props
renderMonthText: null,
enableOutsideDays: false,
numberOfMonths: 1,
orientation: _constants.HORIZONTAL_ORIENTATION,
withPortal: false,
hideKeyboardShortcutsPanel: false,
initialVisibleMonth: null,
firstDayOfWeek: null,
daySize: _constants.DAY_SIZE,
verticalHeight: null,
noBorder: false,
verticalBorderSpacing: undefined,
transitionDuration: undefined,
horizontalMonthPadding: 13,
navPrev: null,
navNext: null,
onPrevMonthClick: function () {
function onPrevMonthClick() {}
return onPrevMonthClick;
}(),
onNextMonthClick: function () {
function onNextMonthClick() {}
return onNextMonthClick;
}(),
onOutsideClick: function () {
function onOutsideClick() {}
return onOutsideClick;
}(),
renderCalendarDay: undefined,
renderDayContents: null,
renderCalendarInfo: null,
renderMonthElement: null,
calendarInfoPosition: _constants.INFO_POSITION_BOTTOM,
// accessibility
onBlur: function () {
function onBlur() {}
return onBlur;
}(),
isFocused: false,
showKeyboardShortcuts: false,
// i18n
monthFormat: 'MMMM YYYY',
weekDayFormat: 'dd',
phrases: _defaultPhrases.DayPickerPhrases,
dayAriaLabelFormat: undefined,
isRTL: false
};
var DayPickerSingleDateController = function (_React$Component) {
_inherits(DayPickerSingleDateController, _React$Component);
function DayPickerSingleDateController(props) {
_classCallCheck(this, DayPickerSingleDateController);
var _this = _possibleConstructorReturn(this, (DayPickerSingleDateController.__proto__ || Object.getPrototypeOf(DayPickerSingleDateController)).call(this, props));
_this.isTouchDevice = false;
_this.today = (0, _moment2['default'])();
_this.modifiers = {
today: function () {
function today(day) {
return _this.isToday(day);
}
return today;
}(),
blocked: function () {
function blocked(day) {
return _this.isBlocked(day);
}
return blocked;
}(),
'blocked-calendar': function () {
function blockedCalendar(day) {
return props.isDayBlocked(day);
}
return blockedCalendar;
}(),
'blocked-out-of-range': function () {
function blockedOutOfRange(day) {
return props.isOutsideRange(day);
}
return blockedOutOfRange;
}(),
'highlighted-calendar': function () {
function highlightedCalendar(day) {
return props.isDayHighlighted(day);
}
return highlightedCalendar;
}(),
valid: function () {
function valid(day) {
return !_this.isBlocked(day);
}
return valid;
}(),
hovered: function () {
function hovered(day) {
return _this.isHovered(day);
}
return hovered;
}(),
selected: function () {
function selected(day) {
return _this.isSelected(day);
}
return selected;
}(),
'first-day-of-week': function () {
function firstDayOfWeek(day) {
return _this.isFirstDayOfWeek(day);
}
return firstDayOfWeek;
}(),
'last-day-of-week': function () {
function lastDayOfWeek(day) {
return _this.isLastDayOfWeek(day);
}
return lastDayOfWeek;
}()
};
var _this$getStateForNewM = _this.getStateForNewMonth(props),
currentMonth = _this$getStateForNewM.currentMonth,
visibleDays = _this$getStateForNewM.visibleDays;
_this.state = {
hoverDate: null,
currentMonth: currentMonth,
visibleDays: visibleDays
};
_this.onDayMouseEnter = _this.onDayMouseEnter.bind(_this);
_this.onDayMouseLeave = _this.onDayMouseLeave.bind(_this);
_this.onDayClick = _this.onDayClick.bind(_this);
_this.onPrevMonthClick = _this.onPrevMonthClick.bind(_this);
_this.onNextMonthClick = _this.onNextMonthClick.bind(_this);
_this.onMonthChange = _this.onMonthChange.bind(_this);
_this.onYearChange = _this.onYearChange.bind(_this);
_this.getFirstFocusableDay = _this.getFirstFocusableDay.bind(_this);
return _this;
}
_createClass(DayPickerSingleDateController, [{
key: 'componentDidMount',
value: function () {
function componentDidMount() {
this.isTouchDevice = (0, _isTouchDevice2['default'])();
}
return componentDidMount;
}()
}, {
key: 'componentWillReceiveProps',
value: function () {
function componentWillReceiveProps(nextProps) {
var _this2 = this;
var date = nextProps.date,
focused = nextProps.focused,
isOutsideRange = nextProps.isOutsideRange,
isDayBlocked = nextProps.isDayBlocked,
isDayHighlighted = nextProps.isDayHighlighted,
initialVisibleMonth = nextProps.initialVisibleMonth,
numberOfMonths = nextProps.numberOfMonths,
enableOutsideDays = nextProps.enableOutsideDays;
var _props = this.props,
prevIsOutsideRange = _props.isOutsideRange,
prevIsDayBlocked = _props.isDayBlocked,
prevIsDayHighlighted = _props.isDayHighlighted,
prevNumberOfMonths = _props.numberOfMonths,
prevEnableOutsideDays = _props.enableOutsideDays,
prevInitialVisibleMonth = _props.initialVisibleMonth,
prevFocused = _props.focused,
prevDate = _props.date;
var visibleDays = this.state.visibleDays;
var recomputeOutsideRange = false;
var recomputeDayBlocked = false;
var recomputeDayHighlighted = false;
if (isOutsideRange !== prevIsOutsideRange) {
this.modifiers['blocked-out-of-range'] = function (day) {
return isOutsideRange(day);
};
recomputeOutsideRange = true;
}
if (isDayBlocked !== prevIsDayBlocked) {
this.modifiers['blocked-calendar'] = function (day) {
return isDayBlocked(day);
};
recomputeDayBlocked = true;
}
if (isDayHighlighted !== prevIsDayHighlighted) {
this.modifiers['highlighted-calendar'] = function (day) {
return isDayHighlighted(day);
};
recomputeDayHighlighted = true;
}
var recomputePropModifiers = recomputeOutsideRange || recomputeDayBlocked || recomputeDayHighlighted;
if (numberOfMonths !== prevNumberOfMonths || enableOutsideDays !== prevEnableOutsideDays || initialVisibleMonth !== prevInitialVisibleMonth && !prevFocused && focused) {
var newMonthState = this.getStateForNewMonth(nextProps);
var currentMonth = newMonthState.currentMonth;
visibleDays = newMonthState.visibleDays;
this.setState({
currentMonth: currentMonth,
visibleDays: visibleDays
});
}
var didDateChange = date !== prevDate;
var didFocusChange = focused !== prevFocused;
var modifiers = {};
if (didDateChange) {
modifiers = this.deleteModifier(modifiers, prevDate, 'selected');
modifiers = this.addModifier(modifiers, date, 'selected');
}
if (didFocusChange || recomputePropModifiers) {
(0, _object4['default'])(visibleDays).forEach(function (days) {
Object.keys(days).forEach(function (day) {
var momentObj = (0, _moment2['default'])(day);
if (_this2.isBlocked(momentObj)) {
modifiers = _this2.addModifier(modifiers, momentObj, 'blocked');
} else {
modifiers = _this2.deleteModifier(modifiers, momentObj, 'blocked');
}
if (didFocusChange || recomputeOutsideRange) {
if (isOutsideRange(momentObj)) {
modifiers = _this2.addModifier(modifiers, momentObj, 'blocked-out-of-range');
} else {
modifiers = _this2.deleteModifier(modifiers, momentObj, 'blocked-out-of-range');
}
}
if (didFocusChange || recomputeDayBlocked) {
if (isDayBlocked(momentObj)) {
modifiers = _this2.addModifier(modifiers, momentObj, 'blocked-calendar');
} else {
modifiers = _this2.deleteModifier(modifiers, momentObj, 'blocked-calendar');
}
}
if (didFocusChange || recomputeDayHighlighted) {
if (isDayHighlighted(momentObj)) {
modifiers = _this2.addModifier(modifiers, momentObj, 'highlighted-calendar');
} else {
modifiers = _this2.deleteModifier(modifiers, momentObj, 'highlighted-calendar');
}
}
});
});
}
var today = (0, _moment2['default'])();
if (!(0, _isSameDay2['default'])(this.today, today)) {
modifiers = this.deleteModifier(modifiers, this.today, 'today');
modifiers = this.addModifier(modifiers, today, 'today');
this.today = today;
}
if (Object.keys(modifiers).length > 0) {
this.setState({
visibleDays: (0, _object2['default'])({}, visibleDays, modifiers)
});
}
}
return componentWillReceiveProps;
}()
}, {
key: 'componentWillUpdate',
value: function () {
function componentWillUpdate() {
this.today = (0, _moment2['default'])();
}
return componentWillUpdate;
}()
}, {
key: 'onDayClick',
value: function () {
function onDayClick(day, e) {
if (e) e.preventDefault();
if (this.isBlocked(day)) return;
var _props2 = this.props,
onDateChange = _props2.onDateChange,
keepOpenOnDateSelect = _props2.keepOpenOnDateSelect,
onFocusChange = _props2.onFocusChange,
onClose = _props2.onClose;
onDateChange(day);
if (!keepOpenOnDateSelect) {
onFocusChange({ focused: false });
onClose({ date: day });
}
}
return onDayClick;
}()
}, {
key: 'onDayMouseEnter',
value: function () {
function onDayMouseEnter(day) {
if (this.isTouchDevice) return;
var _state = this.state,
hoverDate = _state.hoverDate,
visibleDays = _state.visibleDays;
var modifiers = this.deleteModifier({}, hoverDate, 'hovered');
modifiers = this.addModifier(modifiers, day, 'hovered');
this.setState({
hoverDate: day,
visibleDays: (0, _object2['default'])({}, visibleDays, modifiers)
});
}
return onDayMouseEnter;
}()
}, {
key: 'onDayMouseLeave',
value: function () {
function onDayMouseLeave() {
var _state2 = this.state,
hoverDate = _state2.hoverDate,
visibleDays = _state2.visibleDays;
if (this.isTouchDevice || !hoverDate) return;
var modifiers = this.deleteModifier({}, hoverDate, 'hovered');
this.setState({
hoverDate: null,
visibleDays: (0, _object2['default'])({}, visibleDays, modifiers)
});
}
return onDayMouseLeave;
}()
}, {
key: 'onPrevMonthClick',
value: function () {
function onPrevMonthClick() {
var _props3 = this.props,
onPrevMonthClick = _props3.onPrevMonthClick,
numberOfMonths = _props3.numberOfMonths,
enableOutsideDays = _props3.enableOutsideDays;
var _state3 = this.state,
currentMonth = _state3.currentMonth,
visibleDays = _state3.visibleDays;
var newVisibleDays = {};
Object.keys(visibleDays).sort().slice(0, numberOfMonths + 1).forEach(function (month) {
newVisibleDays[month] = visibleDays[month];
});
var prevMonth = currentMonth.clone().subtract(1, 'month');
var prevMonthVisibleDays = (0, _getVisibleDays2['default'])(prevMonth, 1, enableOutsideDays);
this.setState({
currentMonth: prevMonth,
visibleDays: (0, _object2['default'])({}, newVisibleDays, this.getModifiers(prevMonthVisibleDays))
}, function () {
onPrevMonthClick(prevMonth.clone());
});
}
return onPrevMonthClick;
}()
}, {
key: 'onNextMonthClick',
value: function () {
function onNextMonthClick() {
var _props4 = this.props,
onNextMonthClick = _props4.onNextMonthClick,
numberOfMonths = _props4.numberOfMonths,
enableOutsideDays = _props4.enableOutsideDays;
var _state4 = this.state,
currentMonth = _state4.currentMonth,
visibleDays = _state4.visibleDays;
var newVisibleDays = {};
Object.keys(visibleDays).sort().slice(1).forEach(function (month) {
newVisibleDays[month] = visibleDays[month];
});
var nextMonth = currentMonth.clone().add(numberOfMonths, 'month');
var nextMonthVisibleDays = (0, _getVisibleDays2['default'])(nextMonth, 1, enableOutsideDays);
var newCurrentMonth = currentMonth.clone().add(1, 'month');
this.setState({
currentMonth: newCurrentMonth,
visibleDays: (0, _object2['default'])({}, newVisibleDays, this.getModifiers(nextMonthVisibleDays))
}, function () {
onNextMonthClick(newCurrentMonth.clone());
});
}
return onNextMonthClick;
}()
}, {
key: 'onMonthChange',
value: function () {
function onMonthChange(newMonth) {
var _props5 = this.props,
numberOfMonths = _props5.numberOfMonths,
enableOutsideDays = _props5.enableOutsideDays,
orientation = _props5.orientation;
var withoutTransitionMonths = orientation === _constants.VERTICAL_SCROLLABLE;
var newVisibleDays = (0, _getVisibleDays2['default'])(newMonth, numberOfMonths, enableOutsideDays, withoutTransitionMonths);
this.setState({
currentMonth: newMonth.clone(),
visibleDays: this.getModifiers(newVisibleDays)
});
}
return onMonthChange;
}()
}, {
key: 'onYearChange',
value: function () {
function onYearChange(newMonth) {
var _props6 = this.props,
numberOfMonths = _props6.numberOfMonths,
enableOutsideDays = _props6.enableOutsideDays,
orientation = _props6.orientation;
var withoutTransitionMonths = orientation === _constants.VERTICAL_SCROLLABLE;
var newVisibleDays = (0, _getVisibleDays2['default'])(newMonth, numberOfMonths, enableOutsideDays, withoutTransitionMonths);
this.setState({
currentMonth: newMonth.clone(),
visibleDays: this.getModifiers(newVisibleDays)
});
}
return onYearChange;
}()
}, {
key: 'getFirstFocusableDay',
value: function () {
function getFirstFocusableDay(newMonth) {
var _this3 = this;
var _props7 = this.props,
date = _props7.date,
numberOfMonths = _props7.numberOfMonths;
var focusedDate = newMonth.clone().startOf('month');
if (date) {
focusedDate = date.clone();
}
if (this.isBlocked(focusedDate)) {
var days = [];
var lastVisibleDay = newMonth.clone().add(numberOfMonths - 1, 'months').endOf('month');
var currentDay = focusedDate.clone();
while (!(0, _isAfterDay2['default'])(currentDay, lastVisibleDay)) {
currentDay = currentDay.clone().add(1, 'day');
days.push(currentDay);
}
var viableDays = days.filter(function (day) {
return !_this3.isBlocked(day) && (0, _isAfterDay2['default'])(day, focusedDate);
});
if (viableDays.length > 0) {
var _viableDays = _slicedToArray(viableDays, 1);
focusedDate = _viableDays[0];
}
}
return focusedDate;
}
return getFirstFocusableDay;
}()
}, {
key: 'getModifiers',
value: function () {
function getModifiers(visibleDays) {
var _this4 = this;
var modifiers = {};
Object.keys(visibleDays).forEach(function (month) {
modifiers[month] = {};
visibleDays[month].forEach(function (day) {
modifiers[month][(0, _toISODateString2['default'])(day)] = _this4.getModifiersForDay(day);
});
});
return modifiers;
}
return getModifiers;
}()
}, {
key: 'getModifiersForDay',
value: function () {
function getModifiersForDay(day) {
var _this5 = this;
return new Set(Object.keys(this.modifiers).filter(function (modifier) {
return _this5.modifiers[modifier](day);
}));
}
return getModifiersForDay;
}()
}, {
key: 'getStateForNewMonth',
value: function () {
function getStateForNewMonth(nextProps) {
var _this6 = this;
var initialVisibleMonth = nextProps.initialVisibleMonth,
date = nextProps.date,
numberOfMonths = nextProps.numberOfMonths,
enableOutsideDays = nextProps.enableOutsideDays;
var initialVisibleMonthThunk = initialVisibleMonth || (date ? function () {
return date;
} : function () {
return _this6.today;
});
var currentMonth = initialVisibleMonthThunk();
var visibleDays = this.getModifiers((0, _getVisibleDays2['default'])(currentMonth, numberOfMonths, enableOutsideDays));
return { currentMonth: currentMonth, visibleDays: visibleDays };
}
return getStateForNewMonth;
}()
}, {
key: 'addModifier',
value: function () {
function addModifier(updatedDays, day, modifier) {
var _props8 = this.props,
numberOfVisibleMonths = _props8.numberOfMonths,
enableOutsideDays = _props8.enableOutsideDays,
orientation = _props8.orientation;
var _state5 = this.state,
firstVisibleMonth = _state5.currentMonth,
visibleDays = _state5.visibleDays;
var currentMonth = firstVisibleMonth;
var numberOfMonths = numberOfVisibleMonths;
if (orientation === _constants.VERTICAL_SCROLLABLE) {
numberOfMonths = Object.keys(visibleDays).length;
} else {
currentMonth = currentMonth.clone().subtract(1, 'month');
numberOfMonths += 2;
}
if (!day || !(0, _isDayVisible2['default'])(day, currentMonth, numberOfMonths, enableOutsideDays)) {
return updatedDays;
}
var iso = (0, _toISODateString2['default'])(day);
var updatedDaysAfterAddition = (0, _object2['default'])({}, updatedDays);
if (enableOutsideDays) {
var monthsToUpdate = Object.keys(visibleDays).filter(function (monthKey) {
return Object.keys(visibleDays[monthKey]).indexOf(iso) > -1;
});
updatedDaysAfterAddition = monthsToUpdate.reduce(function (days, monthIso) {
var month = updatedDays[monthIso] || visibleDays[monthIso];
var modifiers = new Set(month[iso]);
modifiers.add(modifier);
return (0, _object2['default'])({}, days, _defineProperty({}, monthIso, (0, _object2['default'])({}, month, _defineProperty({}, iso, modifiers))));
}, updatedDaysAfterAddition);
} else {
var monthIso = (0, _toISOMonthString2['default'])(day);
var month = updatedDays[monthIso] || visibleDays[monthIso];
var modifiers = new Set(month[iso]);
modifiers.add(modifier);
updatedDaysAfterAddition = (0, _object2['default'])({}, updatedDaysAfterAddition, _defineProperty({}, monthIso, (0, _object2['default'])({}, month, _defineProperty({}, iso, modifiers))));
}
return updatedDaysAfterAddition;
}
return addModifier;
}()
}, {
key: 'deleteModifier',
value: function () {
function deleteModifier(updatedDays, day, modifier) {
var _props9 = this.props,
numberOfVisibleMonths = _props9.numberOfMonths,
enableOutsideDays = _props9.enableOutsideDays,
orientation = _props9.orientation;
var _state6 = this.state,
firstVisibleMonth = _state6.currentMonth,
visibleDays = _state6.visibleDays;
var currentMonth = firstVisibleMonth;
var numberOfMonths = numberOfVisibleMonths;
if (orientation === _constants.VERTICAL_SCROLLABLE) {
numberOfMonths = Object.keys(visibleDays).length;
} else {
currentMonth = currentMonth.clone().subtract(1, 'month');
numberOfMonths += 2;
}
if (!day || !(0, _isDayVisible2['default'])(day, currentMonth, numberOfMonths, enableOutsideDays)) {
return updatedDays;
}
var iso = (0, _toISODateString2['default'])(day);
var updatedDaysAfterDeletion = (0, _object2['default'])({}, updatedDays);
if (enableOutsideDays) {
var monthsToUpdate = Object.keys(visibleDays).filter(function (monthKey) {
return Object.keys(visibleDays[monthKey]).indexOf(iso) > -1;
});
updatedDaysAfterDeletion = monthsToUpdate.reduce(function (days, monthIso) {
var month = updatedDays[monthIso] || visibleDays[monthIso];
var modifiers = new Set(month[iso]);
modifiers['delete'](modifier);
return (0, _object2['default'])({}, days, _defineProperty({}, monthIso, (0, _object2['default'])({}, month, _defineProperty({}, iso, modifiers))));
}, updatedDaysAfterDeletion);
} else {
var monthIso = (0, _toISOMonthString2['default'])(day);
var month = updatedDays[monthIso] || visibleDays[monthIso];
var modifiers = new Set(month[iso]);
modifiers['delete'](modifier);
updatedDaysAfterDeletion = (0, _object2['default'])({}, updatedDaysAfterDeletion, _defineProperty({}, monthIso, (0, _object2['default'])({}, month, _defineProperty({}, iso, modifiers))));
}
return updatedDaysAfterDeletion;
}
return deleteModifier;
}()
}, {
key: 'isBlocked',
value: function () {
function isBlocked(day) {
var _props10 = this.props,
isDayBlocked = _props10.isDayBlocked,
isOutsideRange = _props10.isOutsideRange;
return isDayBlocked(day) || isOutsideRange(day);
}
return isBlocked;
}()
}, {
key: 'isHovered',
value: function () {
function isHovered(day) {
var _ref = this.state || {},
hoverDate = _ref.hoverDate;
return (0, _isSameDay2['default'])(day, hoverDate);
}
return isHovered;
}()
}, {
key: 'isSelected',
value: function () {
function isSelected(day) {
var date = this.props.date;
return (0, _isSameDay2['default'])(day, date);
}
return isSelected;
}()
}, {
key: 'isToday',
value: function () {
function isToday(day) {
return (0, _isSameDay2['default'])(day, this.today);
}
return isToday;
}()
}, {
key: 'isFirstDayOfWeek',
value: function () {
function isFirstDayOfWeek(day) {
var firstDayOfWeek = this.props.firstDayOfWeek;
return day.day() === (firstDayOfWeek || _moment2['default'].localeData().firstDayOfWeek());
}
return isFirstDayOfWeek;
}()
}, {
key: 'isLastDayOfWeek',
value: function () {
function isLastDayOfWeek(day) {
var firstDayOfWeek = this.props.firstDayOfWeek;
return day.day() === ((firstDayOfWeek || _moment2['default'].localeData().firstDayOfWeek()) + 6) % 7;
}
return isLastDayOfWeek;
}()
}, {
key: 'render',
value: function () {
function render() {
var _props11 = this.props,
numberOfMonths = _props11.numberOfMonths,
orientation = _props11.orientation,
monthFormat = _props11.monthFormat,
renderMonthText = _props11.renderMonthText,
navPrev = _props11.navPrev,
navNext = _props11.navNext,
onOutsideClick = _props11.onOutsideClick,
withPortal = _props11.withPortal,
focused = _props11.focused,
enableOutsideDays = _props11.enableOutsideDays,
hideKeyboardShortcutsPanel = _props11.hideKeyboardShortcutsPanel,
daySize = _props11.daySize,
firstDayOfWeek = _props11.firstDayOfWeek,
renderCalendarDay = _props11.renderCalendarDay,
renderDayContents = _props11.renderDayContents,
renderCalendarInfo = _props11.renderCalendarInfo,
renderMonthElement = _props11.renderMonthElement,
calendarInfoPosition = _props11.calendarInfoPosition,
isFocused = _props11.isFocused,
isRTL = _props11.isRTL,
phrases = _props11.phrases,
dayAriaLabelFormat = _props11.dayAriaLabelFormat,
onBlur = _props11.onBlur,
showKeyboardShortcuts = _props11.showKeyboardShortcuts,
weekDayFormat = _props11.weekDayFormat,
verticalHeight = _props11.verticalHeight,
noBorder = _props11.noBorder,
transitionDuration = _props11.transitionDuration,
verticalBorderSpacing = _props11.verticalBorderSpacing,
horizontalMonthPadding = _props11.horizontalMonthPadding;
var _state7 = this.state,
currentMonth = _state7.currentMonth,
visibleDays = _state7.visibleDays;
return _react2['default'].createElement(_DayPicker2['default'], {
orientation: orientation,
enableOutsideDays: enableOutsideDays,
modifiers: visibleDays,
numberOfMonths: numberOfMonths,
onDayClick: this.onDayClick,
onDayMouseEnter: this.onDayMouseEnter,
onDayMouseLeave: this.onDayMouseLeave,
onPrevMonthClick: this.onPrevMonthClick,
onNextMonthClick: this.onNextMonthClick,
onMonthChange: this.onMonthChange,
onYearChange: this.onYearChange,
monthFormat: monthFormat,
withPortal: withPortal,
hidden: !focused,
hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel,
initialVisibleMonth: function () {
function initialVisibleMonth() {
return currentMonth;
}
return initialVisibleMonth;
}(),
firstDayOfWeek: firstDayOfWeek,
onOutsideClick: onOutsideClick,
navPrev: navPrev,
navNext: navNext,
renderMonthText: renderMonthText,
renderCalendarDay: renderCalendarDay,
renderDayContents: renderDayContents,
renderCalendarInfo: renderCalendarInfo,
renderMonthElement: renderMonthElement,
calendarInfoPosition: calendarInfoPosition,
isFocused: isFocused,
getFirstFocusableDay: this.getFirstFocusableDay,
onBlur: onBlur,
phrases: phrases,
daySize: daySize,
isRTL: isRTL,
showKeyboardShortcuts: showKeyboardShortcuts,
weekDayFormat: weekDayFormat,
dayAriaLabelFormat: dayAriaLabelFormat,
verticalHeight: verticalHeight,
noBorder: noBorder,
transitionDuration: transitionDuration,
verticalBorderSpacing: verticalBorderSpacing,
horizontalMonthPadding: horizontalMonthPadding
});
}
return render;
}()
}]);
return DayPickerSingleDateController;
}(_react2['default'].Component);
exports['default'] = DayPickerSingleDateController;
DayPickerSingleDateController.propTypes = propTypes;
DayPickerSingleDateController.defaultProps = defaultProps;
/***/ }),
/***/ "YLtl":
/***/ (function(module, exports) {
(function() { module.exports = window["lodash"]; }());
/***/ }),
/***/ "YZDV":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/**
* Copyright (c) 2013-present, Facebook, Inc.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*
* @providesModule shallowCompare
*/
var hasOwnProperty = Object.prototype.hasOwnProperty;
/**
* inlined Object.is polyfill to avoid requiring consumers ship their own
* https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/is
*/
function is(x, y) {
// SameValue algorithm
if (x === y) {
// Steps 1-5, 7-10
// Steps 6.b-6.e: +0 != -0
// Added the nonzero y check to make Flow happy, but it is redundant
return x !== 0 || y !== 0 || 1 / x === 1 / y;
} else {
// Step 6.a: NaN == NaN
return x !== x && y !== y;
}
}
/**
* Performs equality by iterating through keys on an object and returning false
* when any key has values which are not strictly equal between the arguments.
* Returns true when the values of all keys are strictly equal.
*/
function shallowEqual(objA, objB) {
if (is(objA, objB)) {
return true;
}
if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) {
return false;
}
var keysA = Object.keys(objA);
var keysB = Object.keys(objB);
if (keysA.length !== keysB.length) {
return false;
}
// Test for A's keys different from B.
for (var i = 0; i < keysA.length; i++) {
if (!hasOwnProperty.call(objB, keysA[i]) || !is(objA[keysA[i]], objB[keysA[i]])) {
return false;
}
}
return true;
}
/**
* Does a shallow comparison for props and state.
* See ReactComponentWithPureRenderMixin
* See also https://facebook.github.io/react/docs/shallow-compare.html
*/
function shallowCompare(instance, nextProps, nextState) {
return (
!shallowEqual(instance.props, nextProps) ||
!shallowEqual(instance.state, nextState)
);
}
module.exports = shallowCompare;
/***/ }),
/***/ "Z23Y":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["warning"]; }());
/***/ }),
/***/ "ZO3Q":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, '__esModule', { value: true });
function _interopDefault (ex) { return (ex && (typeof ex === 'object') && 'default' in ex) ? ex['default'] : ex; }
var _extends = _interopDefault(__webpack_require__("pVnL"));
var _objectWithoutPropertiesLoose = _interopDefault(__webpack_require__("8OQS"));
var React = __webpack_require__("cDcd");
var React__default = _interopDefault(React);
var _inheritsLoose = _interopDefault(__webpack_require__("VbXa"));
var _assertThisInitialized = _interopDefault(__webpack_require__("PJYZ"));
var is = {
arr: Array.isArray,
obj: function obj(a) {
return Object.prototype.toString.call(a) === '[object Object]';
},
fun: function fun(a) {
return typeof a === 'function';
},
str: function str(a) {
return typeof a === 'string';
},
num: function num(a) {
return typeof a === 'number';
},
und: function und(a) {
return a === void 0;
},
nul: function nul(a) {
return a === null;
},
set: function set(a) {
return a instanceof Set;
},
map: function map(a) {
return a instanceof Map;
},
equ: function equ(a, b) {
if (typeof a !== typeof b) return false;
if (is.str(a) || is.num(a)) return a === b;
if (is.obj(a) && is.obj(b) && Object.keys(a).length + Object.keys(b).length === 0) return true;
var i;
for (i in a) {
if (!(i in b)) return false;
}
for (i in b) {
if (a[i] !== b[i]) return false;
}
return is.und(i) ? a === b : true;
}
};
function merge(target, lowercase) {
if (lowercase === void 0) {
lowercase = true;
}
return function (object) {
return (is.arr(object) ? object : Object.keys(object)).reduce(function (acc, element) {
var key = lowercase ? element[0].toLowerCase() + element.substring(1) : element;
acc[key] = target(key);
return acc;
}, target);
};
}
function useForceUpdate() {
var _useState = React.useState(false),
f = _useState[1];
var forceUpdate = React.useCallback(function () {
return f(function (v) {
return !v;
});
}, []);
return forceUpdate;
}
function withDefault(value, defaultValue) {
return is.und(value) || is.nul(value) ? defaultValue : value;
}
function toArray(a) {
return !is.und(a) ? is.arr(a) ? a : [a] : [];
}
function callProp(obj) {
for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
args[_key - 1] = arguments[_key];
}
return is.fun(obj) ? obj.apply(void 0, args) : obj;
}
function getForwardProps(props) {
var to = props.to,
from = props.from,
config = props.config,
onStart = props.onStart,
onRest = props.onRest,
onFrame = props.onFrame,
children = props.children,
reset = props.reset,
reverse = props.reverse,
force = props.force,
immediate = props.immediate,
delay = props.delay,
attach = props.attach,
destroyed = props.destroyed,
interpolateTo = props.interpolateTo,
ref = props.ref,
lazy = props.lazy,
forward = _objectWithoutPropertiesLoose(props, ["to", "from", "config", "onStart", "onRest", "onFrame", "children", "reset", "reverse", "force", "immediate", "delay", "attach", "destroyed", "interpolateTo", "ref", "lazy"]);
return forward;
}
function interpolateTo(props) {
var forward = getForwardProps(props);
if (is.und(forward)) return _extends({
to: forward
}, props);
var rest = Object.keys(props).reduce(function (a, k) {
var _extends2;
return !is.und(forward[k]) ? a : _extends({}, a, (_extends2 = {}, _extends2[k] = props[k], _extends2));
}, {});
return _extends({
to: forward
}, rest);
}
function handleRef(ref, forward) {
if (forward) {
// If it's a function, assume it's a ref callback
if (is.fun(forward)) forward(ref);else if (is.obj(forward)) {
forward.current = ref;
}
}
return ref;
}
var Animated =
/*#__PURE__*/
function () {
function Animated() {
this.payload = void 0;
this.children = [];
}
var _proto = Animated.prototype;
_proto.getAnimatedValue = function getAnimatedValue() {
return this.getValue();
};
_proto.getPayload = function getPayload() {
return this.payload || this;
};
_proto.attach = function attach() {};
_proto.detach = function detach() {};
_proto.getChildren = function getChildren() {
return this.children;
};
_proto.addChild = function addChild(child) {
if (this.children.length === 0) this.attach();
this.children.push(child);
};
_proto.removeChild = function removeChild(child) {
var index = this.children.indexOf(child);
this.children.splice(index, 1);
if (this.children.length === 0) this.detach();
};
return Animated;
}();
var AnimatedArray =
/*#__PURE__*/
function (_Animated) {
_inheritsLoose(AnimatedArray, _Animated);
function AnimatedArray() {
var _this;
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
_this = _Animated.call.apply(_Animated, [this].concat(args)) || this;
_this.payload = [];
_this.attach = function () {
return _this.payload.forEach(function (p) {
return p instanceof Animated && p.addChild(_assertThisInitialized(_this));
});
};
_this.detach = function () {
return _this.payload.forEach(function (p) {
return p instanceof Animated && p.removeChild(_assertThisInitialized(_this));
});
};
return _this;
}
return AnimatedArray;
}(Animated);
var AnimatedObject =
/*#__PURE__*/
function (_Animated2) {
_inheritsLoose(AnimatedObject, _Animated2);
function AnimatedObject() {
var _this2;
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
_this2 = _Animated2.call.apply(_Animated2, [this].concat(args)) || this;
_this2.payload = {};
_this2.attach = function () {
return Object.values(_this2.payload).forEach(function (s) {
return s instanceof Animated && s.addChild(_assertThisInitialized(_this2));
});
};
_this2.detach = function () {
return Object.values(_this2.payload).forEach(function (s) {
return s instanceof Animated && s.removeChild(_assertThisInitialized(_this2));
});
};
return _this2;
}
var _proto2 = AnimatedObject.prototype;
_proto2.getValue = function getValue(animated) {
if (animated === void 0) {
animated = false;
}
var payload = {};
for (var _key4 in this.payload) {
var value = this.payload[_key4];
if (animated && !(value instanceof Animated)) continue;
payload[_key4] = value instanceof Animated ? value[animated ? 'getAnimatedValue' : 'getValue']() : value;
}
return payload;
};
_proto2.getAnimatedValue = function getAnimatedValue() {
return this.getValue(true);
};
return AnimatedObject;
}(Animated);
var applyAnimatedValues;
function injectApplyAnimatedValues(fn, transform) {
applyAnimatedValues = {
fn: fn,
transform: transform
};
}
var colorNames;
function injectColorNames(names) {
colorNames = names;
}
var requestFrame = function requestFrame(cb) {
return typeof window !== 'undefined' ? window.requestAnimationFrame(cb) : -1;
};
var cancelFrame = function cancelFrame(id) {
typeof window !== 'undefined' && window.cancelAnimationFrame(id);
};
function injectFrame(raf, caf) {
requestFrame = raf;
cancelFrame = caf;
}
var interpolation;
function injectStringInterpolator(fn) {
interpolation = fn;
}
var now = function now() {
return Date.now();
};
function injectNow(nowFn) {
now = nowFn;
}
var defaultElement;
function injectDefaultElement(el) {
defaultElement = el;
}
var animatedApi = function animatedApi(node) {
return node.current;
};
function injectAnimatedApi(fn) {
animatedApi = fn;
}
var createAnimatedStyle;
function injectCreateAnimatedStyle(factory) {
createAnimatedStyle = factory;
}
var manualFrameloop;
function injectManualFrameloop(callback) {
manualFrameloop = callback;
}
var Globals = /*#__PURE__*/Object.freeze({
get applyAnimatedValues () { return applyAnimatedValues; },
injectApplyAnimatedValues: injectApplyAnimatedValues,
get colorNames () { return colorNames; },
injectColorNames: injectColorNames,
get requestFrame () { return requestFrame; },
get cancelFrame () { return cancelFrame; },
injectFrame: injectFrame,
get interpolation () { return interpolation; },
injectStringInterpolator: injectStringInterpolator,
get now () { return now; },
injectNow: injectNow,
get defaultElement () { return defaultElement; },
injectDefaultElement: injectDefaultElement,
get animatedApi () { return animatedApi; },
injectAnimatedApi: injectAnimatedApi,
get createAnimatedStyle () { return createAnimatedStyle; },
injectCreateAnimatedStyle: injectCreateAnimatedStyle,
get manualFrameloop () { return manualFrameloop; },
injectManualFrameloop: injectManualFrameloop
});
/**
* Wraps the `style` property with `AnimatedStyle`.
*/
var AnimatedProps =
/*#__PURE__*/
function (_AnimatedObject) {
_inheritsLoose(AnimatedProps, _AnimatedObject);
function AnimatedProps(props, callback) {
var _this;
_this = _AnimatedObject.call(this) || this;
_this.update = void 0;
_this.payload = !props.style ? props : _extends({}, props, {
style: createAnimatedStyle(props.style)
});
_this.update = callback;
_this.attach();
return _this;
}
return AnimatedProps;
}(AnimatedObject);
var isFunctionComponent = function isFunctionComponent(val) {
return is.fun(val) && !(val.prototype instanceof React__default.Component);
};
var createAnimatedComponent = function createAnimatedComponent(Component) {
var AnimatedComponent = React.forwardRef(function (props, ref) {
var forceUpdate = useForceUpdate();
var mounted = React.useRef(true);
var propsAnimated = React.useRef(null);
var node = React.useRef(null);
var attachProps = React.useCallback(function (props) {
var oldPropsAnimated = propsAnimated.current;
var callback = function callback() {
var didUpdate = false;
if (node.current) {
didUpdate = applyAnimatedValues.fn(node.current, propsAnimated.current.getAnimatedValue());
}
if (!node.current || didUpdate === false) {
// If no referenced node has been found, or the update target didn't have a
// native-responder, then forceUpdate the animation ...
forceUpdate();
}
};
propsAnimated.current = new AnimatedProps(props, callback);
oldPropsAnimated && oldPropsAnimated.detach();
}, []);
React.useEffect(function () {
return function () {
mounted.current = false;
propsAnimated.current && propsAnimated.current.detach();
};
}, []);
React.useImperativeHandle(ref, function () {
return animatedApi(node, mounted, forceUpdate);
});
attachProps(props);
var _getValue = propsAnimated.current.getValue(),
scrollTop = _getValue.scrollTop,
scrollLeft = _getValue.scrollLeft,
animatedProps = _objectWithoutPropertiesLoose(_getValue, ["scrollTop", "scrollLeft"]); // Functions cannot have refs, see:
// See: https://github.com/react-spring/react-spring/issues/569
var refFn = isFunctionComponent(Component) ? undefined : function (childRef) {
return node.current = handleRef(childRef, ref);
};
return React__default.createElement(Component, _extends({}, animatedProps, {
ref: refFn
}));
});
return AnimatedComponent;
};
var active = false;
var controllers = new Set();
var update = function update() {
if (!active) return false;
var time = now();
for (var _iterator = controllers, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref;
if (_isArray) {
if (_i >= _iterator.length) break;
_ref = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) break;
_ref = _i.value;
}
var controller = _ref;
var isActive = false;
for (var configIdx = 0; configIdx < controller.configs.length; configIdx++) {
var config = controller.configs[configIdx];
var endOfAnimation = void 0,
lastTime = void 0;
for (var valIdx = 0; valIdx < config.animatedValues.length; valIdx++) {
var animation = config.animatedValues[valIdx]; // If an animation is done, skip, until all of them conclude
if (animation.done) continue;
var from = config.fromValues[valIdx];
var to = config.toValues[valIdx];
var position = animation.lastPosition;
var isAnimated = to instanceof Animated;
var velocity = Array.isArray(config.initialVelocity) ? config.initialVelocity[valIdx] : config.initialVelocity;
if (isAnimated) to = to.getValue(); // Conclude animation if it's either immediate, or from-values match end-state
if (config.immediate) {
animation.setValue(to);
animation.done = true;
continue;
} // Break animation when string values are involved
if (typeof from === 'string' || typeof to === 'string') {
animation.setValue(to);
animation.done = true;
continue;
}
if (config.duration !== void 0) {
/** Duration easing */
position = from + config.easing((time - animation.startTime) / config.duration) * (to - from);
endOfAnimation = time >= animation.startTime + config.duration;
} else if (config.decay) {
/** Decay easing */
position = from + velocity / (1 - 0.998) * (1 - Math.exp(-(1 - 0.998) * (time - animation.startTime)));
endOfAnimation = Math.abs(animation.lastPosition - position) < 0.1;
if (endOfAnimation) to = position;
} else {
/** Spring easing */
lastTime = animation.lastTime !== void 0 ? animation.lastTime : time;
velocity = animation.lastVelocity !== void 0 ? animation.lastVelocity : config.initialVelocity; // If we lost a lot of frames just jump to the end.
if (time > lastTime + 64) lastTime = time; // http://gafferongames.com/game-physics/fix-your-timestep/
var numSteps = Math.floor(time - lastTime);
for (var i = 0; i < numSteps; ++i) {
var force = -config.tension * (position - to);
var damping = -config.friction * velocity;
var acceleration = (force + damping) / config.mass;
velocity = velocity + acceleration * 1 / 1000;
position = position + velocity * 1 / 1000;
} // Conditions for stopping the spring animation
var isOvershooting = config.clamp && config.tension !== 0 ? from < to ? position > to : position < to : false;
var isVelocity = Math.abs(velocity) <= config.precision;
var isDisplacement = config.tension !== 0 ? Math.abs(to - position) <= config.precision : true;
endOfAnimation = isOvershooting || isVelocity && isDisplacement;
animation.lastVelocity = velocity;
animation.lastTime = time;
} // Trails aren't done until their parents conclude
if (isAnimated && !config.toValues[valIdx].done) endOfAnimation = false;
if (endOfAnimation) {
// Ensure that we end up with a round value
if (animation.value !== to) position = to;
animation.done = true;
} else isActive = true;
animation.setValue(position);
animation.lastPosition = position;
} // Keep track of updated values only when necessary
if (controller.props.onFrame) controller.values[config.name] = config.interpolation.getValue();
} // Update callbacks in the end of the frame
if (controller.props.onFrame) controller.props.onFrame(controller.values); // Either call onEnd or next frame
if (!isActive) {
controllers.delete(controller);
controller.stop(true);
}
} // Loop over as long as there are controllers ...
if (controllers.size) {
if (manualFrameloop) manualFrameloop();else requestFrame(update);
} else {
active = false;
}
return active;
};
var start = function start(controller) {
if (!controllers.has(controller)) controllers.add(controller);
if (!active) {
active = true;
if (manualFrameloop) requestFrame(manualFrameloop);else requestFrame(update);
}
};
var stop = function stop(controller) {
if (controllers.has(controller)) controllers.delete(controller);
};
function createInterpolator(range, output, extrapolate) {
if (typeof range === 'function') {
return range;
}
if (Array.isArray(range)) {
return createInterpolator({
range: range,
output: output,
extrapolate: extrapolate
});
}
if (interpolation && typeof range.output[0] === 'string') {
return interpolation(range);
}
var config = range;
var outputRange = config.output;
var inputRange = config.range || [0, 1];
var extrapolateLeft = config.extrapolateLeft || config.extrapolate || 'extend';
var extrapolateRight = config.extrapolateRight || config.extrapolate || 'extend';
var easing = config.easing || function (t) {
return t;
};
return function (input) {
var range = findRange(input, inputRange);
return interpolate(input, inputRange[range], inputRange[range + 1], outputRange[range], outputRange[range + 1], easing, extrapolateLeft, extrapolateRight, config.map);
};
}
function interpolate(input, inputMin, inputMax, outputMin, outputMax, easing, extrapolateLeft, extrapolateRight, map) {
var result = map ? map(input) : input; // Extrapolate
if (result < inputMin) {
if (extrapolateLeft === 'identity') return result;else if (extrapolateLeft === 'clamp') result = inputMin;
}
if (result > inputMax) {
if (extrapolateRight === 'identity') return result;else if (extrapolateRight === 'clamp') result = inputMax;
}
if (outputMin === outputMax) return outputMin;
if (inputMin === inputMax) return input <= inputMin ? outputMin : outputMax; // Input Range
if (inputMin === -Infinity) result = -result;else if (inputMax === Infinity) result = result - inputMin;else result = (result - inputMin) / (inputMax - inputMin); // Easing
result = easing(result); // Output Range
if (outputMin === -Infinity) result = -result;else if (outputMax === Infinity) result = result + outputMin;else result = result * (outputMax - outputMin) + outputMin;
return result;
}
function findRange(input, inputRange) {
for (var i = 1; i < inputRange.length - 1; ++i) {
if (inputRange[i] >= input) break;
}
return i - 1;
}
var AnimatedInterpolation =
/*#__PURE__*/
function (_AnimatedArray) {
_inheritsLoose(AnimatedInterpolation, _AnimatedArray);
function AnimatedInterpolation(parents, range, output, extrapolate) {
var _this;
_this = _AnimatedArray.call(this) || this;
_this.calc = void 0;
_this.payload = parents instanceof AnimatedArray && !(parents instanceof AnimatedInterpolation) ? parents.getPayload() : Array.isArray(parents) ? parents : [parents];
_this.calc = createInterpolator(range, output, extrapolate);
return _this;
}
var _proto = AnimatedInterpolation.prototype;
_proto.getValue = function getValue() {
return this.calc.apply(this, this.payload.map(function (value) {
return value.getValue();
}));
};
_proto.updateConfig = function updateConfig(range, output, extrapolate) {
this.calc = createInterpolator(range, output, extrapolate);
};
_proto.interpolate = function interpolate(range, output, extrapolate) {
return new AnimatedInterpolation(this, range, output, extrapolate);
};
return AnimatedInterpolation;
}(AnimatedArray);
var interpolate$1 = function interpolate(parents, range, output) {
return parents && new AnimatedInterpolation(parents, range, output);
};
var config = {
default: {
tension: 170,
friction: 26
},
gentle: {
tension: 120,
friction: 14
},
wobbly: {
tension: 180,
friction: 12
},
stiff: {
tension: 210,
friction: 20
},
slow: {
tension: 280,
friction: 60
},
molasses: {
tension: 280,
friction: 120
}
};
/** API
* useChain(references, timeSteps, timeFrame)
*/
function useChain(refs, timeSteps, timeFrame) {
if (timeFrame === void 0) {
timeFrame = 1000;
}
var previous = React.useRef();
React.useEffect(function () {
if (is.equ(refs, previous.current)) refs.forEach(function (_ref) {
var current = _ref.current;
return current && current.start();
});else if (timeSteps) {
refs.forEach(function (_ref2, index) {
var current = _ref2.current;
if (current) {
var ctrls = current.controllers;
if (ctrls.length) {
var t = timeFrame * timeSteps[index];
ctrls.forEach(function (ctrl) {
ctrl.queue = ctrl.queue.map(function (e) {
return _extends({}, e, {
delay: e.delay + t
});
});
ctrl.start();
});
}
}
});
} else refs.reduce(function (q, _ref3, rI) {
var current = _ref3.current;
return q = q.then(function () {
return current.start();
});
}, Promise.resolve());
previous.current = refs;
});
}
/**
* Animated works by building a directed acyclic graph of dependencies
* transparently when you render your Animated components.
*
* new Animated.Value(0)
* .interpolate() .interpolate() new Animated.Value(1)
* opacity translateY scale
* style transform
* View#234 style
* View#123
*
* A) Top Down phase
* When an AnimatedValue is updated, we recursively go down through this
* graph in order to find leaf nodes: the views that we flag as needing
* an update.
*
* B) Bottom Up phase
* When a view is flagged as needing an update, we recursively go back up
* in order to build the new value that it needs. The reason why we need
* this two-phases process is to deal with composite props such as
* transform which can receive values from multiple parents.
*/
function addAnimatedStyles(node, styles) {
if ('update' in node) {
styles.add(node);
} else {
node.getChildren().forEach(function (child) {
return addAnimatedStyles(child, styles);
});
}
}
var AnimatedValue =
/*#__PURE__*/
function (_Animated) {
_inheritsLoose(AnimatedValue, _Animated);
function AnimatedValue(_value) {
var _this;
_this = _Animated.call(this) || this;
_this.animatedStyles = new Set();
_this.value = void 0;
_this.startPosition = void 0;
_this.lastPosition = void 0;
_this.lastVelocity = void 0;
_this.startTime = void 0;
_this.lastTime = void 0;
_this.done = false;
_this.setValue = function (value, flush) {
if (flush === void 0) {
flush = true;
}
_this.value = value;
if (flush) _this.flush();
};
_this.value = _value;
_this.startPosition = _value;
_this.lastPosition = _value;
return _this;
}
var _proto = AnimatedValue.prototype;
_proto.flush = function flush() {
if (this.animatedStyles.size === 0) {
addAnimatedStyles(this, this.animatedStyles);
}
this.animatedStyles.forEach(function (animatedStyle) {
return animatedStyle.update();
});
};
_proto.clearStyles = function clearStyles() {
this.animatedStyles.clear();
};
_proto.getValue = function getValue() {
return this.value;
};
_proto.interpolate = function interpolate(range, output, extrapolate) {
return new AnimatedInterpolation(this, range, output, extrapolate);
};
return AnimatedValue;
}(Animated);
var AnimatedValueArray =
/*#__PURE__*/
function (_AnimatedArray) {
_inheritsLoose(AnimatedValueArray, _AnimatedArray);
function AnimatedValueArray(values) {
var _this;
_this = _AnimatedArray.call(this) || this;
_this.payload = values.map(function (n) {
return new AnimatedValue(n);
});
return _this;
}
var _proto = AnimatedValueArray.prototype;
_proto.setValue = function setValue(value, flush) {
var _this2 = this;
if (flush === void 0) {
flush = true;
}
if (Array.isArray(value)) {
if (value.length === this.payload.length) {
value.forEach(function (v, i) {
return _this2.payload[i].setValue(v, flush);
});
}
} else {
this.payload.forEach(function (p) {
return p.setValue(value, flush);
});
}
};
_proto.getValue = function getValue() {
return this.payload.map(function (v) {
return v.getValue();
});
};
_proto.interpolate = function interpolate(range, output) {
return new AnimatedInterpolation(this, range, output);
};
return AnimatedValueArray;
}(AnimatedArray);
var G = 0;
var Controller =
/*#__PURE__*/
function () {
function Controller() {
var _this = this;
this.id = void 0;
this.idle = true;
this.hasChanged = false;
this.guid = 0;
this.local = 0;
this.props = {};
this.merged = {};
this.animations = {};
this.interpolations = {};
this.values = {};
this.configs = [];
this.listeners = [];
this.queue = [];
this.localQueue = void 0;
this.getValues = function () {
return _this.interpolations;
};
this.id = G++;
}
/** update(props)
* This function filters input props and creates an array of tasks which are executed in .start()
* Each task is allowed to carry a delay, which means it can execute asnychroneously */
var _proto = Controller.prototype;
_proto.update = function update$$1(args) {
//this._id = n + this.id
if (!args) return this; // Extract delay and the to-prop from props
var _ref = interpolateTo(args),
_ref$delay = _ref.delay,
delay = _ref$delay === void 0 ? 0 : _ref$delay,
to = _ref.to,
props = _objectWithoutPropertiesLoose(_ref, ["delay", "to"]);
if (is.arr(to) || is.fun(to)) {
// If config is either a function or an array queue it up as is
this.queue.push(_extends({}, props, {
delay: delay,
to: to
}));
} else if (to) {
// Otherwise go through each key since it could be delayed individually
var ops = {};
Object.entries(to).forEach(function (_ref2) {
var _to;
var k = _ref2[0],
v = _ref2[1];
// Fetch delay and create an entry, consisting of the to-props, the delay, and basic props
var entry = _extends({
to: (_to = {}, _to[k] = v, _to),
delay: callProp(delay, k)
}, props);
var previous = ops[entry.delay] && ops[entry.delay].to;
ops[entry.delay] = _extends({}, ops[entry.delay], entry, {
to: _extends({}, previous, entry.to)
});
});
this.queue = Object.values(ops);
} // Sort queue, so that async calls go last
this.queue = this.queue.sort(function (a, b) {
return a.delay - b.delay;
}); // Diff the reduced props immediately (they'll contain the from-prop and some config)
this.diff(props);
return this;
}
/** start(onEnd)
* This function either executes a queue, if present, or starts the frameloop, which animates */
;
_proto.start = function start$$1(onEnd) {
var _this2 = this;
// If a queue is present we must excecute it
if (this.queue.length) {
this.idle = false; // Updates can interrupt trailing queues, in that case we just merge values
if (this.localQueue) {
this.localQueue.forEach(function (_ref3) {
var _ref3$from = _ref3.from,
from = _ref3$from === void 0 ? {} : _ref3$from,
_ref3$to = _ref3.to,
to = _ref3$to === void 0 ? {} : _ref3$to;
if (is.obj(from)) _this2.merged = _extends({}, from, _this2.merged);
if (is.obj(to)) _this2.merged = _extends({}, _this2.merged, to);
});
} // The guid helps us tracking frames, a new queue over an old one means an override
// We discard async calls in that caseÍ
var local = this.local = ++this.guid;
var queue = this.localQueue = this.queue;
this.queue = []; // Go through each entry and execute it
queue.forEach(function (_ref4, index) {
var delay = _ref4.delay,
props = _objectWithoutPropertiesLoose(_ref4, ["delay"]);
var cb = function cb(finished) {
if (index === queue.length - 1 && local === _this2.guid && finished) {
_this2.idle = true;
if (_this2.props.onRest) _this2.props.onRest(_this2.merged);
}
if (onEnd) onEnd();
}; // Entries can be delayed, ansyc or immediate
var async = is.arr(props.to) || is.fun(props.to);
if (delay) {
setTimeout(function () {
if (local === _this2.guid) {
if (async) _this2.runAsync(props, cb);else _this2.diff(props).start(cb);
}
}, delay);
} else if (async) _this2.runAsync(props, cb);else _this2.diff(props).start(cb);
});
} // Otherwise we kick of the frameloop
else {
if (is.fun(onEnd)) this.listeners.push(onEnd);
if (this.props.onStart) this.props.onStart();
start(this);
}
return this;
};
_proto.stop = function stop$$1(finished) {
this.listeners.forEach(function (onEnd) {
return onEnd(finished);
});
this.listeners = [];
return this;
}
/** Pause sets onEnd listeners free, but also removes the controller from the frameloop */
;
_proto.pause = function pause(finished) {
this.stop(true);
if (finished) stop(this);
return this;
};
_proto.runAsync = function runAsync(_ref5, onEnd) {
var _this3 = this;
var delay = _ref5.delay,
props = _objectWithoutPropertiesLoose(_ref5, ["delay"]);
var local = this.local; // If "to" is either a function or an array it will be processed async, therefor "to" should be empty right now
// If the view relies on certain values "from" has to be present
var queue = Promise.resolve(undefined);
if (is.arr(props.to)) {
var _loop = function _loop(i) {
var index = i;
var fresh = _extends({}, props, interpolateTo(props.to[index]));
if (is.arr(fresh.config)) fresh.config = fresh.config[index];
queue = queue.then(function () {
//this.stop()
if (local === _this3.guid) return new Promise(function (r) {
return _this3.diff(fresh).start(r);
});
});
};
for (var i = 0; i < props.to.length; i++) {
_loop(i);
}
} else if (is.fun(props.to)) {
var index = 0;
var last;
queue = queue.then(function () {
return props.to( // next(props)
function (p) {
var fresh = _extends({}, props, interpolateTo(p));
if (is.arr(fresh.config)) fresh.config = fresh.config[index];
index++; //this.stop()
if (local === _this3.guid) return last = new Promise(function (r) {
return _this3.diff(fresh).start(r);
});
return;
}, // cancel()
function (finished) {
if (finished === void 0) {
finished = true;
}
return _this3.stop(finished);
}).then(function () {
return last;
});
});
}
queue.then(onEnd);
};
_proto.diff = function diff(props) {
var _this4 = this;
this.props = _extends({}, this.props, props);
var _this$props = this.props,
_this$props$from = _this$props.from,
from = _this$props$from === void 0 ? {} : _this$props$from,
_this$props$to = _this$props.to,
to = _this$props$to === void 0 ? {} : _this$props$to,
_this$props$config = _this$props.config,
config = _this$props$config === void 0 ? {} : _this$props$config,
reverse = _this$props.reverse,
attach = _this$props.attach,
reset = _this$props.reset,
immediate = _this$props.immediate; // Reverse values when requested
if (reverse) {
var _ref6 = [to, from];
from = _ref6[0];
to = _ref6[1];
} // This will collect all props that were ever set, reset merged props when necessary
this.merged = _extends({}, from, this.merged, to);
this.hasChanged = false; // Attachment handling, trailed springs can "attach" themselves to a previous spring
var target = attach && attach(this); // Reduces input { name: value } pairs into animated values
this.animations = Object.entries(this.merged).reduce(function (acc, _ref7) {
var name = _ref7[0],
value = _ref7[1];
// Issue cached entries, except on reset
var entry = acc[name] || {}; // Figure out what the value is supposed to be
var isNumber = is.num(value);
var isString = is.str(value) && !value.startsWith('#') && !/\d/.test(value) && !colorNames[value];
var isArray = is.arr(value);
var isInterpolation = !isNumber && !isArray && !isString;
var fromValue = !is.und(from[name]) ? from[name] : value;
var toValue = isNumber || isArray ? value : isString ? value : 1;
var toConfig = callProp(config, name);
if (target) toValue = target.animations[name].parent;
var parent = entry.parent,
interpolation$$1 = entry.interpolation,
toValues = toArray(target ? toValue.getPayload() : toValue),
animatedValues;
var newValue = value;
if (isInterpolation) newValue = interpolation({
range: [0, 1],
output: [value, value]
})(1);
var currentValue = interpolation$$1 && interpolation$$1.getValue(); // Change detection flags
var isFirst = is.und(parent);
var isActive = !isFirst && entry.animatedValues.some(function (v) {
return !v.done;
});
var currentValueDiffersFromGoal = !is.equ(newValue, currentValue);
var hasNewGoal = !is.equ(newValue, entry.previous);
var hasNewConfig = !is.equ(toConfig, entry.config); // Change animation props when props indicate a new goal (new value differs from previous one)
// and current values differ from it. Config changes trigger a new update as well (though probably shouldn't?)
if (reset || hasNewGoal && currentValueDiffersFromGoal || hasNewConfig) {
var _extends2;
// Convert regular values into animated values, ALWAYS re-use if possible
if (isNumber || isString) parent = interpolation$$1 = entry.parent || new AnimatedValue(fromValue);else if (isArray) parent = interpolation$$1 = entry.parent || new AnimatedValueArray(fromValue);else if (isInterpolation) {
var prev = entry.interpolation && entry.interpolation.calc(entry.parent.value);
prev = prev !== void 0 && !reset ? prev : fromValue;
if (entry.parent) {
parent = entry.parent;
parent.setValue(0, false);
} else parent = new AnimatedValue(0);
var range = {
output: [prev, value]
};
if (entry.interpolation) {
interpolation$$1 = entry.interpolation;
entry.interpolation.updateConfig(range);
} else interpolation$$1 = parent.interpolate(range);
}
toValues = toArray(target ? toValue.getPayload() : toValue);
animatedValues = toArray(parent.getPayload());
if (reset && !isInterpolation) parent.setValue(fromValue, false);
_this4.hasChanged = true; // Reset animated values
animatedValues.forEach(function (value) {
value.startPosition = value.value;
value.lastPosition = value.value;
value.lastVelocity = isActive ? value.lastVelocity : undefined;
value.lastTime = isActive ? value.lastTime : undefined;
value.startTime = now();
value.done = false;
value.animatedStyles.clear();
}); // Set immediate values
if (callProp(immediate, name)) {
parent.setValue(isInterpolation ? toValue : value, false);
}
return _extends({}, acc, (_extends2 = {}, _extends2[name] = _extends({}, entry, {
name: name,
parent: parent,
interpolation: interpolation$$1,
animatedValues: animatedValues,
toValues: toValues,
previous: newValue,
config: toConfig,
fromValues: toArray(parent.getValue()),
immediate: callProp(immediate, name),
initialVelocity: withDefault(toConfig.velocity, 0),
clamp: withDefault(toConfig.clamp, false),
precision: withDefault(toConfig.precision, 0.01),
tension: withDefault(toConfig.tension, 170),
friction: withDefault(toConfig.friction, 26),
mass: withDefault(toConfig.mass, 1),
duration: toConfig.duration,
easing: withDefault(toConfig.easing, function (t) {
return t;
}),
decay: toConfig.decay
}), _extends2));
} else {
if (!currentValueDiffersFromGoal) {
var _extends3;
// So ... the current target value (newValue) appears to be different from the previous value,
// which normally constitutes an update, but the actual value (currentValue) matches the target!
// In order to resolve this without causing an animation update we silently flag the animation as done,
// which it technically is. Interpolations also needs a config update with their target set to 1.
if (isInterpolation) {
parent.setValue(1, false);
interpolation$$1.updateConfig({
output: [newValue, newValue]
});
}
parent.done = true;
_this4.hasChanged = true;
return _extends({}, acc, (_extends3 = {}, _extends3[name] = _extends({}, acc[name], {
previous: newValue
}), _extends3));
}
return acc;
}
}, this.animations);
if (this.hasChanged) {
// Make animations available to frameloop
this.configs = Object.values(this.animations);
this.values = {};
this.interpolations = {};
for (var key in this.animations) {
this.interpolations[key] = this.animations[key].interpolation;
this.values[key] = this.animations[key].interpolation.getValue();
}
}
return this;
};
_proto.destroy = function destroy() {
this.stop();
this.props = {};
this.merged = {};
this.animations = {};
this.interpolations = {};
this.values = {};
this.configs = [];
this.local = 0;
};
return Controller;
}();
/** API
* const props = useSprings(number, [{ ... }, { ... }, ...])
* const [props, set] = useSprings(number, (i, controller) => ({ ... }))
*/
var useSprings = function useSprings(length, props) {
var mounted = React.useRef(false);
var ctrl = React.useRef();
var isFn = is.fun(props); // The controller maintains the animation values, starts and stops animations
var _useMemo = React.useMemo(function () {
// Remove old controllers
if (ctrl.current) {
ctrl.current.map(function (c) {
return c.destroy();
});
ctrl.current = undefined;
}
var ref;
return [new Array(length).fill().map(function (_, i) {
var ctrl = new Controller();
var newProps = isFn ? callProp(props, i, ctrl) : props[i];
if (i === 0) ref = newProps.ref;
ctrl.update(newProps);
if (!ref) ctrl.start();
return ctrl;
}), ref];
}, [length]),
controllers = _useMemo[0],
ref = _useMemo[1];
ctrl.current = controllers; // The hooks reference api gets defined here ...
var api = React.useImperativeHandle(ref, function () {
return {
start: function start() {
return Promise.all(ctrl.current.map(function (c) {
return new Promise(function (r) {
return c.start(r);
});
}));
},
stop: function stop(finished) {
return ctrl.current.forEach(function (c) {
return c.stop(finished);
});
},
get controllers() {
return ctrl.current;
}
};
}); // This function updates the controllers
var updateCtrl = React.useMemo(function () {
return function (updateProps) {
return ctrl.current.map(function (c, i) {
c.update(isFn ? callProp(updateProps, i, c) : updateProps[i]);
if (!ref) c.start();
});
};
}, [length]); // Update controller if props aren't functional
React.useEffect(function () {
if (mounted.current) {
if (!isFn) updateCtrl(props);
} else if (!ref) ctrl.current.forEach(function (c) {
return c.start();
});
}); // Update mounted flag and destroy controller on unmount
React.useEffect(function () {
return mounted.current = true, function () {
return ctrl.current.forEach(function (c) {
return c.destroy();
});
};
}, []); // Return animated props, or, anim-props + the update-setter above
var propValues = ctrl.current.map(function (c) {
return c.getValues();
});
return isFn ? [propValues, updateCtrl, function (finished) {
return ctrl.current.forEach(function (c) {
return c.pause(finished);
});
}] : propValues;
};
/** API
* const props = useSpring({ ... })
* const [props, set] = useSpring(() => ({ ... }))
*/
var useSpring = function useSpring(props) {
var isFn = is.fun(props);
var _useSprings = useSprings(1, isFn ? props : [props]),
result = _useSprings[0],
set = _useSprings[1],
pause = _useSprings[2];
return isFn ? [result[0], set, pause] : result;
};
/** API
* const trails = useTrail(number, { ... })
* const [trails, set] = useTrail(number, () => ({ ... }))
*/
var useTrail = function useTrail(length, props) {
var mounted = React.useRef(false);
var isFn = is.fun(props);
var updateProps = callProp(props);
var instances = React.useRef();
var _useSprings = useSprings(length, function (i, ctrl) {
if (i === 0) instances.current = [];
instances.current.push(ctrl);
return _extends({}, updateProps, {
config: callProp(updateProps.config, i),
attach: i > 0 && function () {
return instances.current[i - 1];
}
});
}),
result = _useSprings[0],
set = _useSprings[1],
pause = _useSprings[2]; // Set up function to update controller
var updateCtrl = React.useMemo(function () {
return function (props) {
return set(function (i, ctrl) {
var last = props.reverse ? i === 0 : length - 1 === i;
var attachIdx = props.reverse ? i + 1 : i - 1;
var attachController = instances.current[attachIdx];
return _extends({}, props, {
config: callProp(props.config || updateProps.config, i),
attach: attachController && function () {
return attachController;
}
});
});
};
}, [length, updateProps.reverse]); // Update controller if props aren't functional
React.useEffect(function () {
return void (mounted.current && !isFn && updateCtrl(props));
}); // Update mounted flag and destroy controller on unmount
React.useEffect(function () {
return void (mounted.current = true);
}, []);
return isFn ? [result, updateCtrl, pause] : result;
};
/** API
* const transitions = useTransition(items, itemKeys, { ... })
* const [transitions, update] = useTransition(items, itemKeys, () => ({ ... }))
*/
var guid = 0;
var ENTER = 'enter';
var LEAVE = 'leave';
var UPDATE = 'update';
var mapKeys = function mapKeys(items, keys) {
return (typeof keys === 'function' ? items.map(keys) : toArray(keys)).map(String);
};
var get = function get(props) {
var items = props.items,
_props$keys = props.keys,
keys = _props$keys === void 0 ? function (item) {
return item;
} : _props$keys,
rest = _objectWithoutPropertiesLoose(props, ["items", "keys"]);
items = toArray(items !== void 0 ? items : null);
return _extends({
items: items,
keys: mapKeys(items, keys)
}, rest);
};
function useTransition(input, keyTransform, config) {
var props = _extends({
items: input,
keys: keyTransform || function (i) {
return i;
}
}, config);
var _get = get(props),
_get$lazy = _get.lazy,
lazy = _get$lazy === void 0 ? false : _get$lazy,
_get$unique = _get.unique,
_get$reset = _get.reset,
reset = _get$reset === void 0 ? false : _get$reset,
enter = _get.enter,
leave = _get.leave,
update = _get.update,
onDestroyed = _get.onDestroyed,
keys = _get.keys,
items = _get.items,
onFrame = _get.onFrame,
_onRest = _get.onRest,
onStart = _get.onStart,
ref = _get.ref,
extra = _objectWithoutPropertiesLoose(_get, ["lazy", "unique", "reset", "enter", "leave", "update", "onDestroyed", "keys", "items", "onFrame", "onRest", "onStart", "ref"]);
var forceUpdate = useForceUpdate();
var mounted = React.useRef(false);
var state = React.useRef({
mounted: false,
first: true,
deleted: [],
current: {},
transitions: [],
prevProps: {},
paused: !!props.ref,
instances: !mounted.current && new Map(),
forceUpdate: forceUpdate
});
React.useImperativeHandle(props.ref, function () {
return {
start: function start() {
return Promise.all(Array.from(state.current.instances).map(function (_ref) {
var c = _ref[1];
return new Promise(function (r) {
return c.start(r);
});
}));
},
stop: function stop(finished) {
return Array.from(state.current.instances).forEach(function (_ref2) {
var c = _ref2[1];
return c.stop(finished);
});
},
get controllers() {
return Array.from(state.current.instances).map(function (_ref3) {
var c = _ref3[1];
return c;
});
}
};
}); // Update state
state.current = diffItems(state.current, props);
if (state.current.changed) {
// Update state
state.current.transitions.forEach(function (transition) {
var slot = transition.slot,
from = transition.from,
to = transition.to,
config = transition.config,
trail = transition.trail,
key = transition.key,
item = transition.item;
if (!state.current.instances.has(key)) state.current.instances.set(key, new Controller()); // update the map object
var ctrl = state.current.instances.get(key);
var newProps = _extends({}, extra, {
to: to,
from: from,
config: config,
ref: ref,
onRest: function onRest(values) {
if (state.current.mounted) {
if (transition.destroyed) {
// If no ref is given delete destroyed items immediately
if (!ref && !lazy) cleanUp(state, key);
if (onDestroyed) onDestroyed(item);
} // A transition comes to rest once all its springs conclude
var curInstances = Array.from(state.current.instances);
var active = curInstances.some(function (_ref4) {
var c = _ref4[1];
return !c.idle;
});
if (!active && (ref || lazy) && state.current.deleted.length > 0) cleanUp(state);
if (_onRest) _onRest(item, slot, values);
}
},
onStart: onStart && function () {
return onStart(item, slot);
},
onFrame: onFrame && function (values) {
return onFrame(item, slot, values);
},
delay: trail,
reset: reset && slot === ENTER // Update controller
});
ctrl.update(newProps);
if (!state.current.paused) ctrl.start();
});
}
React.useEffect(function () {
state.current.mounted = mounted.current = true;
return function () {
state.current.mounted = mounted.current = false;
Array.from(state.current.instances).map(function (_ref5) {
var c = _ref5[1];
return c.destroy();
});
state.current.instances.clear();
};
}, []);
return state.current.transitions.map(function (_ref6) {
var item = _ref6.item,
slot = _ref6.slot,
key = _ref6.key;
return {
item: item,
key: key,
state: slot,
props: state.current.instances.get(key).getValues()
};
});
}
function cleanUp(state, filterKey) {
var deleted = state.current.deleted;
var _loop = function _loop() {
if (_isArray) {
if (_i >= _iterator.length) return "break";
_ref8 = _iterator[_i++];
} else {
_i = _iterator.next();
if (_i.done) return "break";
_ref8 = _i.value;
}
var _ref7 = _ref8;
var key = _ref7.key;
var filter = function filter(t) {
return t.key !== key;
};
if (is.und(filterKey) || filterKey === key) {
state.current.instances.delete(key);
state.current.transitions = state.current.transitions.filter(filter);
state.current.deleted = state.current.deleted.filter(filter);
}
};
for (var _iterator = deleted, _isArray = Array.isArray(_iterator), _i = 0, _iterator = _isArray ? _iterator : _iterator[Symbol.iterator]();;) {
var _ref8;
var _ret = _loop();
if (_ret === "break") break;
}
state.current.forceUpdate();
}
function diffItems(_ref9, props) {
var first = _ref9.first,
prevProps = _ref9.prevProps,
state = _objectWithoutPropertiesLoose(_ref9, ["first", "prevProps"]);
var _get2 = get(props),
items = _get2.items,
keys = _get2.keys,
initial = _get2.initial,
from = _get2.from,
enter = _get2.enter,
leave = _get2.leave,
update = _get2.update,
_get2$trail = _get2.trail,
trail = _get2$trail === void 0 ? 0 : _get2$trail,
unique = _get2.unique,
config = _get2.config,
_get2$order = _get2.order,
order = _get2$order === void 0 ? [ENTER, LEAVE, UPDATE] : _get2$order;
var _get3 = get(prevProps),
_keys = _get3.keys,
_items = _get3.items;
var current = _extends({}, state.current);
var deleted = [].concat(state.deleted); // Compare next keys with current keys
var currentKeys = Object.keys(current);
var currentSet = new Set(currentKeys);
var nextSet = new Set(keys);
var added = keys.filter(function (item) {
return !currentSet.has(item);
});
var removed = state.transitions.filter(function (item) {
return !item.destroyed && !nextSet.has(item.originalKey);
}).map(function (i) {
return i.originalKey;
});
var updated = keys.filter(function (item) {
return currentSet.has(item);
});
var delay = -trail;
while (order.length) {
var changeType = order.shift();
switch (changeType) {
case ENTER:
{
added.forEach(function (key, index) {
// In unique mode, remove fading out transitions if their key comes in again
if (unique && deleted.find(function (d) {
return d.originalKey === key;
})) deleted = deleted.filter(function (t) {
return t.originalKey !== key;
});
var keyIndex = keys.indexOf(key);
var item = items[keyIndex];
var slot = first && initial !== void 0 ? 'initial' : ENTER;
current[key] = {
slot: slot,
originalKey: key,
key: unique ? String(key) : guid++,
item: item,
trail: delay = delay + trail,
config: callProp(config, item, slot),
from: callProp(first ? initial !== void 0 ? initial || {} : from : from, item),
to: callProp(enter, item)
};
});
break;
}
case LEAVE:
{
removed.forEach(function (key) {
var keyIndex = _keys.indexOf(key);
var item = _items[keyIndex];
var slot = LEAVE;
deleted.unshift(_extends({}, current[key], {
slot: slot,
destroyed: true,
left: _keys[Math.max(0, keyIndex - 1)],
right: _keys[Math.min(_keys.length, keyIndex + 1)],
trail: delay = delay + trail,
config: callProp(config, item, slot),
to: callProp(leave, item)
}));
delete current[key];
});
break;
}
case UPDATE:
{
updated.forEach(function (key) {
var keyIndex = keys.indexOf(key);
var item = items[keyIndex];
var slot = UPDATE;
current[key] = _extends({}, current[key], {
item: item,
slot: slot,
trail: delay = delay + trail,
config: callProp(config, item, slot),
to: callProp(update, item)
});
});
break;
}
}
}
var out = keys.map(function (key) {
return current[key];
}); // This tries to restore order for deleted items by finding their last known siblings
// only using the left sibling to keep order placement consistent for all deleted items
deleted.forEach(function (_ref10) {
var left = _ref10.left,
right = _ref10.right,
item = _objectWithoutPropertiesLoose(_ref10, ["left", "right"]);
var pos; // Was it the element on the left, if yes, move there ...
if ((pos = out.findIndex(function (t) {
return t.originalKey === left;
})) !== -1) pos += 1; // And if nothing else helps, move it to the start ¯\_(ツ)_/¯
pos = Math.max(0, pos);
out = [].concat(out.slice(0, pos), [item], out.slice(pos));
});
return _extends({}, state, {
changed: added.length || removed.length || updated.length,
first: first && added.length === 0,
transitions: out,
current: current,
deleted: deleted,
prevProps: props
});
}
var AnimatedStyle =
/*#__PURE__*/
function (_AnimatedObject) {
_inheritsLoose(AnimatedStyle, _AnimatedObject);
function AnimatedStyle(style) {
var _this;
if (style === void 0) {
style = {};
}
_this = _AnimatedObject.call(this) || this;
if (style.transform && !(style.transform instanceof Animated)) {
style = applyAnimatedValues.transform(style);
}
_this.payload = style;
return _this;
}
return AnimatedStyle;
}(AnimatedObject);
// http://www.w3.org/TR/css3-color/#svg-color
var colors = {
transparent: 0x00000000,
aliceblue: 0xf0f8ffff,
antiquewhite: 0xfaebd7ff,
aqua: 0x00ffffff,
aquamarine: 0x7fffd4ff,
azure: 0xf0ffffff,
beige: 0xf5f5dcff,
bisque: 0xffe4c4ff,
black: 0x000000ff,
blanchedalmond: 0xffebcdff,
blue: 0x0000ffff,
blueviolet: 0x8a2be2ff,
brown: 0xa52a2aff,
burlywood: 0xdeb887ff,
burntsienna: 0xea7e5dff,
cadetblue: 0x5f9ea0ff,
chartreuse: 0x7fff00ff,
chocolate: 0xd2691eff,
coral: 0xff7f50ff,
cornflowerblue: 0x6495edff,
cornsilk: 0xfff8dcff,
crimson: 0xdc143cff,
cyan: 0x00ffffff,
darkblue: 0x00008bff,
darkcyan: 0x008b8bff,
darkgoldenrod: 0xb8860bff,
darkgray: 0xa9a9a9ff,
darkgreen: 0x006400ff,
darkgrey: 0xa9a9a9ff,
darkkhaki: 0xbdb76bff,
darkmagenta: 0x8b008bff,
darkolivegreen: 0x556b2fff,
darkorange: 0xff8c00ff,
darkorchid: 0x9932ccff,
darkred: 0x8b0000ff,
darksalmon: 0xe9967aff,
darkseagreen: 0x8fbc8fff,
darkslateblue: 0x483d8bff,
darkslategray: 0x2f4f4fff,
darkslategrey: 0x2f4f4fff,
darkturquoise: 0x00ced1ff,
darkviolet: 0x9400d3ff,
deeppink: 0xff1493ff,
deepskyblue: 0x00bfffff,
dimgray: 0x696969ff,
dimgrey: 0x696969ff,
dodgerblue: 0x1e90ffff,
firebrick: 0xb22222ff,
floralwhite: 0xfffaf0ff,
forestgreen: 0x228b22ff,
fuchsia: 0xff00ffff,
gainsboro: 0xdcdcdcff,
ghostwhite: 0xf8f8ffff,
gold: 0xffd700ff,
goldenrod: 0xdaa520ff,
gray: 0x808080ff,
green: 0x008000ff,
greenyellow: 0xadff2fff,
grey: 0x808080ff,
honeydew: 0xf0fff0ff,
hotpink: 0xff69b4ff,
indianred: 0xcd5c5cff,
indigo: 0x4b0082ff,
ivory: 0xfffff0ff,
khaki: 0xf0e68cff,
lavender: 0xe6e6faff,
lavenderblush: 0xfff0f5ff,
lawngreen: 0x7cfc00ff,
lemonchiffon: 0xfffacdff,
lightblue: 0xadd8e6ff,
lightcoral: 0xf08080ff,
lightcyan: 0xe0ffffff,
lightgoldenrodyellow: 0xfafad2ff,
lightgray: 0xd3d3d3ff,
lightgreen: 0x90ee90ff,
lightgrey: 0xd3d3d3ff,
lightpink: 0xffb6c1ff,
lightsalmon: 0xffa07aff,
lightseagreen: 0x20b2aaff,
lightskyblue: 0x87cefaff,
lightslategray: 0x778899ff,
lightslategrey: 0x778899ff,
lightsteelblue: 0xb0c4deff,
lightyellow: 0xffffe0ff,
lime: 0x00ff00ff,
limegreen: 0x32cd32ff,
linen: 0xfaf0e6ff,
magenta: 0xff00ffff,
maroon: 0x800000ff,
mediumaquamarine: 0x66cdaaff,
mediumblue: 0x0000cdff,
mediumorchid: 0xba55d3ff,
mediumpurple: 0x9370dbff,
mediumseagreen: 0x3cb371ff,
mediumslateblue: 0x7b68eeff,
mediumspringgreen: 0x00fa9aff,
mediumturquoise: 0x48d1ccff,
mediumvioletred: 0xc71585ff,
midnightblue: 0x191970ff,
mintcream: 0xf5fffaff,
mistyrose: 0xffe4e1ff,
moccasin: 0xffe4b5ff,
navajowhite: 0xffdeadff,
navy: 0x000080ff,
oldlace: 0xfdf5e6ff,
olive: 0x808000ff,
olivedrab: 0x6b8e23ff,
orange: 0xffa500ff,
orangered: 0xff4500ff,
orchid: 0xda70d6ff,
palegoldenrod: 0xeee8aaff,
palegreen: 0x98fb98ff,
paleturquoise: 0xafeeeeff,
palevioletred: 0xdb7093ff,
papayawhip: 0xffefd5ff,
peachpuff: 0xffdab9ff,
peru: 0xcd853fff,
pink: 0xffc0cbff,
plum: 0xdda0ddff,
powderblue: 0xb0e0e6ff,
purple: 0x800080ff,
rebeccapurple: 0x663399ff,
red: 0xff0000ff,
rosybrown: 0xbc8f8fff,
royalblue: 0x4169e1ff,
saddlebrown: 0x8b4513ff,
salmon: 0xfa8072ff,
sandybrown: 0xf4a460ff,
seagreen: 0x2e8b57ff,
seashell: 0xfff5eeff,
sienna: 0xa0522dff,
silver: 0xc0c0c0ff,
skyblue: 0x87ceebff,
slateblue: 0x6a5acdff,
slategray: 0x708090ff,
slategrey: 0x708090ff,
snow: 0xfffafaff,
springgreen: 0x00ff7fff,
steelblue: 0x4682b4ff,
tan: 0xd2b48cff,
teal: 0x008080ff,
thistle: 0xd8bfd8ff,
tomato: 0xff6347ff,
turquoise: 0x40e0d0ff,
violet: 0xee82eeff,
wheat: 0xf5deb3ff,
white: 0xffffffff,
whitesmoke: 0xf5f5f5ff,
yellow: 0xffff00ff,
yellowgreen: 0x9acd32ff
};
// const INTEGER = '[-+]?\\d+';
var NUMBER = '[-+]?\\d*\\.?\\d+';
var PERCENTAGE = NUMBER + '%';
function call() {
for (var _len = arguments.length, parts = new Array(_len), _key = 0; _key < _len; _key++) {
parts[_key] = arguments[_key];
}
return '\\(\\s*(' + parts.join(')\\s*,\\s*(') + ')\\s*\\)';
}
var rgb = new RegExp('rgb' + call(NUMBER, NUMBER, NUMBER));
var rgba = new RegExp('rgba' + call(NUMBER, NUMBER, NUMBER, NUMBER));
var hsl = new RegExp('hsl' + call(NUMBER, PERCENTAGE, PERCENTAGE));
var hsla = new RegExp('hsla' + call(NUMBER, PERCENTAGE, PERCENTAGE, NUMBER));
var hex3 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
var hex4 = /^#([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/;
var hex6 = /^#([0-9a-fA-F]{6})$/;
var hex8 = /^#([0-9a-fA-F]{8})$/;
/*
https://github.com/react-community/normalize-css-color
BSD 3-Clause License
Copyright (c) 2016, React Community
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* Neither the name of the copyright holder nor the names of its
contributors may be used to endorse or promote products derived from
this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
function normalizeColor(color) {
var match;
if (typeof color === 'number') {
return color >>> 0 === color && color >= 0 && color <= 0xffffffff ? color : null;
} // Ordered based on occurrences on Facebook codebase
if (match = hex6.exec(color)) return parseInt(match[1] + 'ff', 16) >>> 0;
if (colors.hasOwnProperty(color)) return colors[color];
if (match = rgb.exec(color)) {
return (parse255(match[1]) << 24 | // r
parse255(match[2]) << 16 | // g
parse255(match[3]) << 8 | // b
0x000000ff) >>> // a
0;
}
if (match = rgba.exec(color)) {
return (parse255(match[1]) << 24 | // r
parse255(match[2]) << 16 | // g
parse255(match[3]) << 8 | // b
parse1(match[4])) >>> // a
0;
}
if (match = hex3.exec(color)) {
return parseInt(match[1] + match[1] + // r
match[2] + match[2] + // g
match[3] + match[3] + // b
'ff', // a
16) >>> 0;
} // https://drafts.csswg.org/css-color-4/#hex-notation
if (match = hex8.exec(color)) return parseInt(match[1], 16) >>> 0;
if (match = hex4.exec(color)) {
return parseInt(match[1] + match[1] + // r
match[2] + match[2] + // g
match[3] + match[3] + // b
match[4] + match[4], // a
16) >>> 0;
}
if (match = hsl.exec(color)) {
return (hslToRgb(parse360(match[1]), // h
parsePercentage(match[2]), // s
parsePercentage(match[3]) // l
) | 0x000000ff) >>> // a
0;
}
if (match = hsla.exec(color)) {
return (hslToRgb(parse360(match[1]), // h
parsePercentage(match[2]), // s
parsePercentage(match[3]) // l
) | parse1(match[4])) >>> // a
0;
}
return null;
}
function hue2rgb(p, q, t) {
if (t < 0) t += 1;
if (t > 1) t -= 1;
if (t < 1 / 6) return p + (q - p) * 6 * t;
if (t < 1 / 2) return q;
if (t < 2 / 3) return p + (q - p) * (2 / 3 - t) * 6;
return p;
}
function hslToRgb(h, s, l) {
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
var p = 2 * l - q;
var r = hue2rgb(p, q, h + 1 / 3);
var g = hue2rgb(p, q, h);
var b = hue2rgb(p, q, h - 1 / 3);
return Math.round(r * 255) << 24 | Math.round(g * 255) << 16 | Math.round(b * 255) << 8;
}
function parse255(str) {
var int = parseInt(str, 10);
if (int < 0) return 0;
if (int > 255) return 255;
return int;
}
function parse360(str) {
var int = parseFloat(str);
return (int % 360 + 360) % 360 / 360;
}
function parse1(str) {
var num = parseFloat(str);
if (num < 0) return 0;
if (num > 1) return 255;
return Math.round(num * 255);
}
function parsePercentage(str) {
// parseFloat conveniently ignores the final %
var int = parseFloat(str);
if (int < 0) return 0;
if (int > 100) return 1;
return int / 100;
}
function colorToRgba(input) {
var int32Color = normalizeColor(input);
if (int32Color === null) return input;
int32Color = int32Color || 0;
var r = (int32Color & 0xff000000) >>> 24;
var g = (int32Color & 0x00ff0000) >>> 16;
var b = (int32Color & 0x0000ff00) >>> 8;
var a = (int32Color & 0x000000ff) / 255;
return "rgba(" + r + ", " + g + ", " + b + ", " + a + ")";
} // Problem: https://github.com/animatedjs/animated/pull/102
// Solution: https://stackoverflow.com/questions/638565/parsing-scientific-notation-sensibly/658662
var stringShapeRegex = /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/g; // Covers rgb, rgba, hsl, hsla
// Taken from https://gist.github.com/olmokramer/82ccce673f86db7cda5e
var colorRegex = /(#(?:[0-9a-f]{2}){2,4}|(#[0-9a-f]{3})|(rgb|hsl)a?\((-?\d+%?[,\s]+){2,3}\s*[\d\.]+%?\))/gi; // Covers color names (transparent, blue, etc.)
var colorNamesRegex = new RegExp("(" + Object.keys(colors).join('|') + ")", 'g');
/**
* Supports string shapes by extracting numbers so new values can be computed,
* and recombines those values into new strings of the same shape. Supports
* things like:
*
* rgba(123, 42, 99, 0.36) // colors
* -45deg // values with units
* 0 2px 2px 0px rgba(0, 0, 0, 0.12) // box shadows
*/
var createStringInterpolator = function createStringInterpolator(config) {
// Replace colors with rgba
var outputRange = config.output.map(function (rangeValue) {
return rangeValue.replace(colorRegex, colorToRgba);
}).map(function (rangeValue) {
return rangeValue.replace(colorNamesRegex, colorToRgba);
});
var outputRanges = outputRange[0].match(stringShapeRegex).map(function () {
return [];
});
outputRange.forEach(function (value) {
value.match(stringShapeRegex).forEach(function (number, i) {
return outputRanges[i].push(+number);
});
});
var interpolations = outputRange[0].match(stringShapeRegex).map(function (_value, i) {
return createInterpolator(_extends({}, config, {
output: outputRanges[i]
}));
});
return function (input) {
var i = 0;
return outputRange[0] // 'rgba(0, 100, 200, 0)'
// ->
// 'rgba(${interpolations[0](input)}, ${interpolations[1](input)}, ...'
.replace(stringShapeRegex, function () {
return interpolations[i++](input);
}) // rgba requires that the r,g,b are integers.... so we want to round them, but we *dont* want to
// round the opacity (4th column).
.replace(/rgba\(([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+), ([0-9\.-]+)\)/gi, function (_, p1, p2, p3, p4) {
return "rgba(" + Math.round(p1) + ", " + Math.round(p2) + ", " + Math.round(p3) + ", " + p4 + ")";
});
};
};
var isUnitlessNumber = {
animationIterationCount: true,
borderImageOutset: true,
borderImageSlice: true,
borderImageWidth: true,
boxFlex: true,
boxFlexGroup: true,
boxOrdinalGroup: true,
columnCount: true,
columns: true,
flex: true,
flexGrow: true,
flexPositive: true,
flexShrink: true,
flexNegative: true,
flexOrder: true,
gridRow: true,
gridRowEnd: true,
gridRowSpan: true,
gridRowStart: true,
gridColumn: true,
gridColumnEnd: true,
gridColumnSpan: true,
gridColumnStart: true,
fontWeight: true,
lineClamp: true,
lineHeight: true,
opacity: true,
order: true,
orphans: true,
tabSize: true,
widows: true,
zIndex: true,
zoom: true,
// SVG-related properties
fillOpacity: true,
floodOpacity: true,
stopOpacity: true,
strokeDasharray: true,
strokeDashoffset: true,
strokeMiterlimit: true,
strokeOpacity: true,
strokeWidth: true
};
var prefixKey = function prefixKey(prefix, key) {
return prefix + key.charAt(0).toUpperCase() + key.substring(1);
};
var prefixes = ['Webkit', 'Ms', 'Moz', 'O'];
isUnitlessNumber = Object.keys(isUnitlessNumber).reduce(function (acc, prop) {
prefixes.forEach(function (prefix) {
return acc[prefixKey(prefix, prop)] = acc[prop];
});
return acc;
}, isUnitlessNumber);
function dangerousStyleValue(name, value, isCustomProperty) {
if (value == null || typeof value === 'boolean' || value === '') return '';
if (!isCustomProperty && typeof value === 'number' && value !== 0 && !(isUnitlessNumber.hasOwnProperty(name) && isUnitlessNumber[name])) return value + 'px'; // Presumes implicit 'px' suffix for unitless numbers
return ('' + value).trim();
}
var attributeCache = {};
injectCreateAnimatedStyle(function (style) {
return new AnimatedStyle(style);
});
injectDefaultElement('div');
injectStringInterpolator(createStringInterpolator);
injectColorNames(colors);
injectApplyAnimatedValues(function (instance, props) {
if (instance.nodeType && instance.setAttribute !== undefined) {
var style = props.style,
children = props.children,
scrollTop = props.scrollTop,
scrollLeft = props.scrollLeft,
attributes = _objectWithoutPropertiesLoose(props, ["style", "children", "scrollTop", "scrollLeft"]);
var filter = instance.nodeName === 'filter' || instance.parentNode && instance.parentNode.nodeName === 'filter';
if (scrollTop !== void 0) instance.scrollTop = scrollTop;
if (scrollLeft !== void 0) instance.scrollLeft = scrollLeft; // Set textContent, if children is an animatable value
if (children !== void 0) instance.textContent = children; // Set styles ...
for (var styleName in style) {
if (!style.hasOwnProperty(styleName)) continue;
var isCustomProperty = styleName.indexOf('--') === 0;
var styleValue = dangerousStyleValue(styleName, style[styleName], isCustomProperty);
if (styleName === 'float') styleName = 'cssFloat';
if (isCustomProperty) instance.style.setProperty(styleName, styleValue);else instance.style[styleName] = styleValue;
} // Set attributes ...
for (var name in attributes) {
// Attributes are written in dash case
var dashCase = filter ? name : attributeCache[name] || (attributeCache[name] = name.replace(/([A-Z])/g, function (n) {
return '-' + n.toLowerCase();
}));
if (typeof instance.getAttribute(dashCase) !== 'undefined') instance.setAttribute(dashCase, attributes[name]);
}
return;
} else return false;
}, function (style) {
return style;
});
var domElements = ['a', 'abbr', 'address', 'area', 'article', 'aside', 'audio', 'b', 'base', 'bdi', 'bdo', 'big', 'blockquote', 'body', 'br', 'button', 'canvas', 'caption', 'cite', 'code', 'col', 'colgroup', 'data', 'datalist', 'dd', 'del', 'details', 'dfn', 'dialog', 'div', 'dl', 'dt', 'em', 'embed', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'head', 'header', 'hgroup', 'hr', 'html', 'i', 'iframe', 'img', 'input', 'ins', 'kbd', 'keygen', 'label', 'legend', 'li', 'link', 'main', 'map', 'mark', 'menu', 'menuitem', 'meta', 'meter', 'nav', 'noscript', 'object', 'ol', 'optgroup', 'option', 'output', 'p', 'param', 'picture', 'pre', 'progress', 'q', 'rp', 'rt', 'ruby', 's', 'samp', 'script', 'section', 'select', 'small', 'source', 'span', 'strong', 'style', 'sub', 'summary', 'sup', 'table', 'tbody', 'td', 'textarea', 'tfoot', 'th', 'thead', 'time', 'title', 'tr', 'track', 'u', 'ul', 'var', 'video', 'wbr', // SVG
'circle', 'clipPath', 'defs', 'ellipse', 'foreignObject', 'g', 'image', 'line', 'linearGradient', 'mask', 'path', 'pattern', 'polygon', 'polyline', 'radialGradient', 'rect', 'stop', 'svg', 'text', 'tspan'];
// Extend animated with all the available THREE elements
var apply = merge(createAnimatedComponent, false);
var extendedAnimated = apply(domElements);
exports.apply = apply;
exports.config = config;
exports.update = update;
exports.animated = extendedAnimated;
exports.a = extendedAnimated;
exports.interpolate = interpolate$1;
exports.Globals = Globals;
exports.useSpring = useSpring;
exports.useTrail = useTrail;
exports.useTransition = useTransition;
exports.useChain = useChain;
exports.useSprings = useSprings;
/***/ }),
/***/ "ZbWB":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $test = GetIntrinsic('RegExp.prototype.test');
var callBind = __webpack_require__("hZ2/");
module.exports = function regexTester(regex) {
return callBind($test, regex);
};
/***/ }),
/***/ "Zss7":
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_RESULT__;// TinyColor v1.4.2
// https://github.com/bgrins/TinyColor
// Brian Grinstead, MIT License
(function(Math) {
var trimLeft = /^\s+/,
trimRight = /\s+$/,
tinyCounter = 0,
mathRound = Math.round,
mathMin = Math.min,
mathMax = Math.max,
mathRandom = Math.random;
function tinycolor (color, opts) {
color = (color) ? color : '';
opts = opts || { };
// If input is already a tinycolor, return itself
if (color instanceof tinycolor) {
return color;
}
// If we are called as a function, call using new instead
if (!(this instanceof tinycolor)) {
return new tinycolor(color, opts);
}
var rgb = inputToRGB(color);
this._originalInput = color,
this._r = rgb.r,
this._g = rgb.g,
this._b = rgb.b,
this._a = rgb.a,
this._roundA = mathRound(100*this._a) / 100,
this._format = opts.format || rgb.format;
this._gradientType = opts.gradientType;
// Don't let the range of [0,255] come back in [0,1].
// Potentially lose a little bit of precision here, but will fix issues where
// .5 gets interpreted as half of the total, instead of half of 1
// If it was supposed to be 128, this was already taken care of by `inputToRgb`
if (this._r < 1) { this._r = mathRound(this._r); }
if (this._g < 1) { this._g = mathRound(this._g); }
if (this._b < 1) { this._b = mathRound(this._b); }
this._ok = rgb.ok;
this._tc_id = tinyCounter++;
}
tinycolor.prototype = {
isDark: function() {
return this.getBrightness() < 128;
},
isLight: function() {
return !this.isDark();
},
isValid: function() {
return this._ok;
},
getOriginalInput: function() {
return this._originalInput;
},
getFormat: function() {
return this._format;
},
getAlpha: function() {
return this._a;
},
getBrightness: function() {
//http://www.w3.org/TR/AERT#color-contrast
var rgb = this.toRgb();
return (rgb.r * 299 + rgb.g * 587 + rgb.b * 114) / 1000;
},
getLuminance: function() {
//http://www.w3.org/TR/2008/REC-WCAG20-20081211/#relativeluminancedef
var rgb = this.toRgb();
var RsRGB, GsRGB, BsRGB, R, G, B;
RsRGB = rgb.r/255;
GsRGB = rgb.g/255;
BsRGB = rgb.b/255;
if (RsRGB <= 0.03928) {R = RsRGB / 12.92;} else {R = Math.pow(((RsRGB + 0.055) / 1.055), 2.4);}
if (GsRGB <= 0.03928) {G = GsRGB / 12.92;} else {G = Math.pow(((GsRGB + 0.055) / 1.055), 2.4);}
if (BsRGB <= 0.03928) {B = BsRGB / 12.92;} else {B = Math.pow(((BsRGB + 0.055) / 1.055), 2.4);}
return (0.2126 * R) + (0.7152 * G) + (0.0722 * B);
},
setAlpha: function(value) {
this._a = boundAlpha(value);
this._roundA = mathRound(100*this._a) / 100;
return this;
},
toHsv: function() {
var hsv = rgbToHsv(this._r, this._g, this._b);
return { h: hsv.h * 360, s: hsv.s, v: hsv.v, a: this._a };
},
toHsvString: function() {
var hsv = rgbToHsv(this._r, this._g, this._b);
var h = mathRound(hsv.h * 360), s = mathRound(hsv.s * 100), v = mathRound(hsv.v * 100);
return (this._a == 1) ?
"hsv(" + h + ", " + s + "%, " + v + "%)" :
"hsva(" + h + ", " + s + "%, " + v + "%, "+ this._roundA + ")";
},
toHsl: function() {
var hsl = rgbToHsl(this._r, this._g, this._b);
return { h: hsl.h * 360, s: hsl.s, l: hsl.l, a: this._a };
},
toHslString: function() {
var hsl = rgbToHsl(this._r, this._g, this._b);
var h = mathRound(hsl.h * 360), s = mathRound(hsl.s * 100), l = mathRound(hsl.l * 100);
return (this._a == 1) ?
"hsl(" + h + ", " + s + "%, " + l + "%)" :
"hsla(" + h + ", " + s + "%, " + l + "%, "+ this._roundA + ")";
},
toHex: function(allow3Char) {
return rgbToHex(this._r, this._g, this._b, allow3Char);
},
toHexString: function(allow3Char) {
return '#' + this.toHex(allow3Char);
},
toHex8: function(allow4Char) {
return rgbaToHex(this._r, this._g, this._b, this._a, allow4Char);
},
toHex8String: function(allow4Char) {
return '#' + this.toHex8(allow4Char);
},
toRgb: function() {
return { r: mathRound(this._r), g: mathRound(this._g), b: mathRound(this._b), a: this._a };
},
toRgbString: function() {
return (this._a == 1) ?
"rgb(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ")" :
"rgba(" + mathRound(this._r) + ", " + mathRound(this._g) + ", " + mathRound(this._b) + ", " + this._roundA + ")";
},
toPercentageRgb: function() {
return { r: mathRound(bound01(this._r, 255) * 100) + "%", g: mathRound(bound01(this._g, 255) * 100) + "%", b: mathRound(bound01(this._b, 255) * 100) + "%", a: this._a };
},
toPercentageRgbString: function() {
return (this._a == 1) ?
"rgb(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%)" :
"rgba(" + mathRound(bound01(this._r, 255) * 100) + "%, " + mathRound(bound01(this._g, 255) * 100) + "%, " + mathRound(bound01(this._b, 255) * 100) + "%, " + this._roundA + ")";
},
toName: function() {
if (this._a === 0) {
return "transparent";
}
if (this._a < 1) {
return false;
}
return hexNames[rgbToHex(this._r, this._g, this._b, true)] || false;
},
toFilter: function(secondColor) {
var hex8String = '#' + rgbaToArgbHex(this._r, this._g, this._b, this._a);
var secondHex8String = hex8String;
var gradientType = this._gradientType ? "GradientType = 1, " : "";
if (secondColor) {
var s = tinycolor(secondColor);
secondHex8String = '#' + rgbaToArgbHex(s._r, s._g, s._b, s._a);
}
return "progid:DXImageTransform.Microsoft.gradient("+gradientType+"startColorstr="+hex8String+",endColorstr="+secondHex8String+")";
},
toString: function(format) {
var formatSet = !!format;
format = format || this._format;
var formattedString = false;
var hasAlpha = this._a < 1 && this._a >= 0;
var needsAlphaFormat = !formatSet && hasAlpha && (format === "hex" || format === "hex6" || format === "hex3" || format === "hex4" || format === "hex8" || format === "name");
if (needsAlphaFormat) {
// Special case for "transparent", all other non-alpha formats
// will return rgba when there is transparency.
if (format === "name" && this._a === 0) {
return this.toName();
}
return this.toRgbString();
}
if (format === "rgb") {
formattedString = this.toRgbString();
}
if (format === "prgb") {
formattedString = this.toPercentageRgbString();
}
if (format === "hex" || format === "hex6") {
formattedString = this.toHexString();
}
if (format === "hex3") {
formattedString = this.toHexString(true);
}
if (format === "hex4") {
formattedString = this.toHex8String(true);
}
if (format === "hex8") {
formattedString = this.toHex8String();
}
if (format === "name") {
formattedString = this.toName();
}
if (format === "hsl") {
formattedString = this.toHslString();
}
if (format === "hsv") {
formattedString = this.toHsvString();
}
return formattedString || this.toHexString();
},
clone: function() {
return tinycolor(this.toString());
},
_applyModification: function(fn, args) {
var color = fn.apply(null, [this].concat([].slice.call(args)));
this._r = color._r;
this._g = color._g;
this._b = color._b;
this.setAlpha(color._a);
return this;
},
lighten: function() {
return this._applyModification(lighten, arguments);
},
brighten: function() {
return this._applyModification(brighten, arguments);
},
darken: function() {
return this._applyModification(darken, arguments);
},
desaturate: function() {
return this._applyModification(desaturate, arguments);
},
saturate: function() {
return this._applyModification(saturate, arguments);
},
greyscale: function() {
return this._applyModification(greyscale, arguments);
},
spin: function() {
return this._applyModification(spin, arguments);
},
_applyCombination: function(fn, args) {
return fn.apply(null, [this].concat([].slice.call(args)));
},
analogous: function() {
return this._applyCombination(analogous, arguments);
},
complement: function() {
return this._applyCombination(complement, arguments);
},
monochromatic: function() {
return this._applyCombination(monochromatic, arguments);
},
splitcomplement: function() {
return this._applyCombination(splitcomplement, arguments);
},
triad: function() {
return this._applyCombination(triad, arguments);
},
tetrad: function() {
return this._applyCombination(tetrad, arguments);
}
};
// If input is an object, force 1 into "1.0" to handle ratios properly
// String input requires "1.0" as input, so 1 will be treated as 1
tinycolor.fromRatio = function(color, opts) {
if (typeof color == "object") {
var newColor = {};
for (var i in color) {
if (color.hasOwnProperty(i)) {
if (i === "a") {
newColor[i] = color[i];
}
else {
newColor[i] = convertToPercentage(color[i]);
}
}
}
color = newColor;
}
return tinycolor(color, opts);
};
// Given a string or object, convert that input to RGB
// Possible string inputs:
//
// "red"
// "#f00" or "f00"
// "#ff0000" or "ff0000"
// "#ff000000" or "ff000000"
// "rgb 255 0 0" or "rgb (255, 0, 0)"
// "rgb 1.0 0 0" or "rgb (1, 0, 0)"
// "rgba (255, 0, 0, 1)" or "rgba 255, 0, 0, 1"
// "rgba (1.0, 0, 0, 1)" or "rgba 1.0, 0, 0, 1"
// "hsl(0, 100%, 50%)" or "hsl 0 100% 50%"
// "hsla(0, 100%, 50%, 1)" or "hsla 0 100% 50%, 1"
// "hsv(0, 100%, 100%)" or "hsv 0 100% 100%"
//
function inputToRGB(color) {
var rgb = { r: 0, g: 0, b: 0 };
var a = 1;
var s = null;
var v = null;
var l = null;
var ok = false;
var format = false;
if (typeof color == "string") {
color = stringInputToObject(color);
}
if (typeof color == "object") {
if (isValidCSSUnit(color.r) && isValidCSSUnit(color.g) && isValidCSSUnit(color.b)) {
rgb = rgbToRgb(color.r, color.g, color.b);
ok = true;
format = String(color.r).substr(-1) === "%" ? "prgb" : "rgb";
}
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.v)) {
s = convertToPercentage(color.s);
v = convertToPercentage(color.v);
rgb = hsvToRgb(color.h, s, v);
ok = true;
format = "hsv";
}
else if (isValidCSSUnit(color.h) && isValidCSSUnit(color.s) && isValidCSSUnit(color.l)) {
s = convertToPercentage(color.s);
l = convertToPercentage(color.l);
rgb = hslToRgb(color.h, s, l);
ok = true;
format = "hsl";
}
if (color.hasOwnProperty("a")) {
a = color.a;
}
}
a = boundAlpha(a);
return {
ok: ok,
format: color.format || format,
r: mathMin(255, mathMax(rgb.r, 0)),
g: mathMin(255, mathMax(rgb.g, 0)),
b: mathMin(255, mathMax(rgb.b, 0)),
a: a
};
}
// Conversion Functions
// --------------------
// `rgbToHsl`, `rgbToHsv`, `hslToRgb`, `hsvToRgb` modified from:
// <http://mjijackson.com/2008/02/rgb-to-hsl-and-rgb-to-hsv-color-model-conversion-algorithms-in-javascript>
// `rgbToRgb`
// Handle bounds / percentage checking to conform to CSS color spec
// <http://www.w3.org/TR/css3-color/>
// *Assumes:* r, g, b in [0, 255] or [0, 1]
// *Returns:* { r, g, b } in [0, 255]
function rgbToRgb(r, g, b){
return {
r: bound01(r, 255) * 255,
g: bound01(g, 255) * 255,
b: bound01(b, 255) * 255
};
}
// `rgbToHsl`
// Converts an RGB color value to HSL.
// *Assumes:* r, g, and b are contained in [0, 255] or [0, 1]
// *Returns:* { h, s, l } in [0,1]
function rgbToHsl(r, g, b) {
r = bound01(r, 255);
g = bound01(g, 255);
b = bound01(b, 255);
var max = mathMax(r, g, b), min = mathMin(r, g, b);
var h, s, l = (max + min) / 2;
if(max == min) {
h = s = 0; // achromatic
}
else {
var d = max - min;
s = l > 0.5 ? d / (2 - max - min) : d / (max + min);
switch(max) {
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
case g: h = (b - r) / d + 2; break;
case b: h = (r - g) / d + 4; break;
}
h /= 6;
}
return { h: h, s: s, l: l };
}
// `hslToRgb`
// Converts an HSL color value to RGB.
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and l are contained [0, 1] or [0, 100]
// *Returns:* { r, g, b } in the set [0, 255]
function hslToRgb(h, s, l) {
var r, g, b;
h = bound01(h, 360);
s = bound01(s, 100);
l = bound01(l, 100);
function hue2rgb(p, q, t) {
if(t < 0) t += 1;
if(t > 1) t -= 1;
if(t < 1/6) return p + (q - p) * 6 * t;
if(t < 1/2) return q;
if(t < 2/3) return p + (q - p) * (2/3 - t) * 6;
return p;
}
if(s === 0) {
r = g = b = l; // achromatic
}
else {
var q = l < 0.5 ? l * (1 + s) : l + s - l * s;
var p = 2 * l - q;
r = hue2rgb(p, q, h + 1/3);
g = hue2rgb(p, q, h);
b = hue2rgb(p, q, h - 1/3);
}
return { r: r * 255, g: g * 255, b: b * 255 };
}
// `rgbToHsv`
// Converts an RGB color value to HSV
// *Assumes:* r, g, and b are contained in the set [0, 255] or [0, 1]
// *Returns:* { h, s, v } in [0,1]
function rgbToHsv(r, g, b) {
r = bound01(r, 255);
g = bound01(g, 255);
b = bound01(b, 255);
var max = mathMax(r, g, b), min = mathMin(r, g, b);
var h, s, v = max;
var d = max - min;
s = max === 0 ? 0 : d / max;
if(max == min) {
h = 0; // achromatic
}
else {
switch(max) {
case r: h = (g - b) / d + (g < b ? 6 : 0); break;
case g: h = (b - r) / d + 2; break;
case b: h = (r - g) / d + 4; break;
}
h /= 6;
}
return { h: h, s: s, v: v };
}
// `hsvToRgb`
// Converts an HSV color value to RGB.
// *Assumes:* h is contained in [0, 1] or [0, 360] and s and v are contained in [0, 1] or [0, 100]
// *Returns:* { r, g, b } in the set [0, 255]
function hsvToRgb(h, s, v) {
h = bound01(h, 360) * 6;
s = bound01(s, 100);
v = bound01(v, 100);
var i = Math.floor(h),
f = h - i,
p = v * (1 - s),
q = v * (1 - f * s),
t = v * (1 - (1 - f) * s),
mod = i % 6,
r = [v, q, p, p, t, v][mod],
g = [t, v, v, q, p, p][mod],
b = [p, p, t, v, v, q][mod];
return { r: r * 255, g: g * 255, b: b * 255 };
}
// `rgbToHex`
// Converts an RGB color to hex
// Assumes r, g, and b are contained in the set [0, 255]
// Returns a 3 or 6 character hex
function rgbToHex(r, g, b, allow3Char) {
var hex = [
pad2(mathRound(r).toString(16)),
pad2(mathRound(g).toString(16)),
pad2(mathRound(b).toString(16))
];
// Return a 3 character hex if possible
if (allow3Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1)) {
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0);
}
return hex.join("");
}
// `rgbaToHex`
// Converts an RGBA color plus alpha transparency to hex
// Assumes r, g, b are contained in the set [0, 255] and
// a in [0, 1]. Returns a 4 or 8 character rgba hex
function rgbaToHex(r, g, b, a, allow4Char) {
var hex = [
pad2(mathRound(r).toString(16)),
pad2(mathRound(g).toString(16)),
pad2(mathRound(b).toString(16)),
pad2(convertDecimalToHex(a))
];
// Return a 4 character hex if possible
if (allow4Char && hex[0].charAt(0) == hex[0].charAt(1) && hex[1].charAt(0) == hex[1].charAt(1) && hex[2].charAt(0) == hex[2].charAt(1) && hex[3].charAt(0) == hex[3].charAt(1)) {
return hex[0].charAt(0) + hex[1].charAt(0) + hex[2].charAt(0) + hex[3].charAt(0);
}
return hex.join("");
}
// `rgbaToArgbHex`
// Converts an RGBA color to an ARGB Hex8 string
// Rarely used, but required for "toFilter()"
function rgbaToArgbHex(r, g, b, a) {
var hex = [
pad2(convertDecimalToHex(a)),
pad2(mathRound(r).toString(16)),
pad2(mathRound(g).toString(16)),
pad2(mathRound(b).toString(16))
];
return hex.join("");
}
// `equals`
// Can be called with any tinycolor input
tinycolor.equals = function (color1, color2) {
if (!color1 || !color2) { return false; }
return tinycolor(color1).toRgbString() == tinycolor(color2).toRgbString();
};
tinycolor.random = function() {
return tinycolor.fromRatio({
r: mathRandom(),
g: mathRandom(),
b: mathRandom()
});
};
// Modification Functions
// ----------------------
// Thanks to less.js for some of the basics here
// <https://github.com/cloudhead/less.js/blob/master/lib/less/functions.js>
function desaturate(color, amount) {
amount = (amount === 0) ? 0 : (amount || 10);
var hsl = tinycolor(color).toHsl();
hsl.s -= amount / 100;
hsl.s = clamp01(hsl.s);
return tinycolor(hsl);
}
function saturate(color, amount) {
amount = (amount === 0) ? 0 : (amount || 10);
var hsl = tinycolor(color).toHsl();
hsl.s += amount / 100;
hsl.s = clamp01(hsl.s);
return tinycolor(hsl);
}
function greyscale(color) {
return tinycolor(color).desaturate(100);
}
function lighten (color, amount) {
amount = (amount === 0) ? 0 : (amount || 10);
var hsl = tinycolor(color).toHsl();
hsl.l += amount / 100;
hsl.l = clamp01(hsl.l);
return tinycolor(hsl);
}
function brighten(color, amount) {
amount = (amount === 0) ? 0 : (amount || 10);
var rgb = tinycolor(color).toRgb();
rgb.r = mathMax(0, mathMin(255, rgb.r - mathRound(255 * - (amount / 100))));
rgb.g = mathMax(0, mathMin(255, rgb.g - mathRound(255 * - (amount / 100))));
rgb.b = mathMax(0, mathMin(255, rgb.b - mathRound(255 * - (amount / 100))));
return tinycolor(rgb);
}
function darken (color, amount) {
amount = (amount === 0) ? 0 : (amount || 10);
var hsl = tinycolor(color).toHsl();
hsl.l -= amount / 100;
hsl.l = clamp01(hsl.l);
return tinycolor(hsl);
}
// Spin takes a positive or negative amount within [-360, 360] indicating the change of hue.
// Values outside of this range will be wrapped into this range.
function spin(color, amount) {
var hsl = tinycolor(color).toHsl();
var hue = (hsl.h + amount) % 360;
hsl.h = hue < 0 ? 360 + hue : hue;
return tinycolor(hsl);
}
// Combination Functions
// ---------------------
// Thanks to jQuery xColor for some of the ideas behind these
// <https://github.com/infusion/jQuery-xcolor/blob/master/jquery.xcolor.js>
function complement(color) {
var hsl = tinycolor(color).toHsl();
hsl.h = (hsl.h + 180) % 360;
return tinycolor(hsl);
}
function triad(color) {
var hsl = tinycolor(color).toHsl();
var h = hsl.h;
return [
tinycolor(color),
tinycolor({ h: (h + 120) % 360, s: hsl.s, l: hsl.l }),
tinycolor({ h: (h + 240) % 360, s: hsl.s, l: hsl.l })
];
}
function tetrad(color) {
var hsl = tinycolor(color).toHsl();
var h = hsl.h;
return [
tinycolor(color),
tinycolor({ h: (h + 90) % 360, s: hsl.s, l: hsl.l }),
tinycolor({ h: (h + 180) % 360, s: hsl.s, l: hsl.l }),
tinycolor({ h: (h + 270) % 360, s: hsl.s, l: hsl.l })
];
}
function splitcomplement(color) {
var hsl = tinycolor(color).toHsl();
var h = hsl.h;
return [
tinycolor(color),
tinycolor({ h: (h + 72) % 360, s: hsl.s, l: hsl.l}),
tinycolor({ h: (h + 216) % 360, s: hsl.s, l: hsl.l})
];
}
function analogous(color, results, slices) {
results = results || 6;
slices = slices || 30;
var hsl = tinycolor(color).toHsl();
var part = 360 / slices;
var ret = [tinycolor(color)];
for (hsl.h = ((hsl.h - (part * results >> 1)) + 720) % 360; --results; ) {
hsl.h = (hsl.h + part) % 360;
ret.push(tinycolor(hsl));
}
return ret;
}
function monochromatic(color, results) {
results = results || 6;
var hsv = tinycolor(color).toHsv();
var h = hsv.h, s = hsv.s, v = hsv.v;
var ret = [];
var modification = 1 / results;
while (results--) {
ret.push(tinycolor({ h: h, s: s, v: v}));
v = (v + modification) % 1;
}
return ret;
}
// Utility Functions
// ---------------------
tinycolor.mix = function(color1, color2, amount) {
amount = (amount === 0) ? 0 : (amount || 50);
var rgb1 = tinycolor(color1).toRgb();
var rgb2 = tinycolor(color2).toRgb();
var p = amount / 100;
var rgba = {
r: ((rgb2.r - rgb1.r) * p) + rgb1.r,
g: ((rgb2.g - rgb1.g) * p) + rgb1.g,
b: ((rgb2.b - rgb1.b) * p) + rgb1.b,
a: ((rgb2.a - rgb1.a) * p) + rgb1.a
};
return tinycolor(rgba);
};
// Readability Functions
// ---------------------
// <http://www.w3.org/TR/2008/REC-WCAG20-20081211/#contrast-ratiodef (WCAG Version 2)
// `contrast`
// Analyze the 2 colors and returns the color contrast defined by (WCAG Version 2)
tinycolor.readability = function(color1, color2) {
var c1 = tinycolor(color1);
var c2 = tinycolor(color2);
return (Math.max(c1.getLuminance(),c2.getLuminance())+0.05) / (Math.min(c1.getLuminance(),c2.getLuminance())+0.05);
};
// `isReadable`
// Ensure that foreground and background color combinations meet WCAG2 guidelines.
// The third argument is an optional Object.
// the 'level' property states 'AA' or 'AAA' - if missing or invalid, it defaults to 'AA';
// the 'size' property states 'large' or 'small' - if missing or invalid, it defaults to 'small'.
// If the entire object is absent, isReadable defaults to {level:"AA",size:"small"}.
// *Example*
// tinycolor.isReadable("#000", "#111") => false
// tinycolor.isReadable("#000", "#111",{level:"AA",size:"large"}) => false
tinycolor.isReadable = function(color1, color2, wcag2) {
var readability = tinycolor.readability(color1, color2);
var wcag2Parms, out;
out = false;
wcag2Parms = validateWCAG2Parms(wcag2);
switch (wcag2Parms.level + wcag2Parms.size) {
case "AAsmall":
case "AAAlarge":
out = readability >= 4.5;
break;
case "AAlarge":
out = readability >= 3;
break;
case "AAAsmall":
out = readability >= 7;
break;
}
return out;
};
// `mostReadable`
// Given a base color and a list of possible foreground or background
// colors for that base, returns the most readable color.
// Optionally returns Black or White if the most readable color is unreadable.
// *Example*
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:false}).toHexString(); // "#112255"
// tinycolor.mostReadable(tinycolor.mostReadable("#123", ["#124", "#125"],{includeFallbackColors:true}).toHexString(); // "#ffffff"
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"large"}).toHexString(); // "#faf3f3"
// tinycolor.mostReadable("#a8015a", ["#faf3f3"],{includeFallbackColors:true,level:"AAA",size:"small"}).toHexString(); // "#ffffff"
tinycolor.mostReadable = function(baseColor, colorList, args) {
var bestColor = null;
var bestScore = 0;
var readability;
var includeFallbackColors, level, size ;
args = args || {};
includeFallbackColors = args.includeFallbackColors ;
level = args.level;
size = args.size;
for (var i= 0; i < colorList.length ; i++) {
readability = tinycolor.readability(baseColor, colorList[i]);
if (readability > bestScore) {
bestScore = readability;
bestColor = tinycolor(colorList[i]);
}
}
if (tinycolor.isReadable(baseColor, bestColor, {"level":level,"size":size}) || !includeFallbackColors) {
return bestColor;
}
else {
args.includeFallbackColors=false;
return tinycolor.mostReadable(baseColor,["#fff", "#000"],args);
}
};
// Big List of Colors
// ------------------
// <http://www.w3.org/TR/css3-color/#svg-color>
var names = tinycolor.names = {
aliceblue: "f0f8ff",
antiquewhite: "faebd7",
aqua: "0ff",
aquamarine: "7fffd4",
azure: "f0ffff",
beige: "f5f5dc",
bisque: "ffe4c4",
black: "000",
blanchedalmond: "ffebcd",
blue: "00f",
blueviolet: "8a2be2",
brown: "a52a2a",
burlywood: "deb887",
burntsienna: "ea7e5d",
cadetblue: "5f9ea0",
chartreuse: "7fff00",
chocolate: "d2691e",
coral: "ff7f50",
cornflowerblue: "6495ed",
cornsilk: "fff8dc",
crimson: "dc143c",
cyan: "0ff",
darkblue: "00008b",
darkcyan: "008b8b",
darkgoldenrod: "b8860b",
darkgray: "a9a9a9",
darkgreen: "006400",
darkgrey: "a9a9a9",
darkkhaki: "bdb76b",
darkmagenta: "8b008b",
darkolivegreen: "556b2f",
darkorange: "ff8c00",
darkorchid: "9932cc",
darkred: "8b0000",
darksalmon: "e9967a",
darkseagreen: "8fbc8f",
darkslateblue: "483d8b",
darkslategray: "2f4f4f",
darkslategrey: "2f4f4f",
darkturquoise: "00ced1",
darkviolet: "9400d3",
deeppink: "ff1493",
deepskyblue: "00bfff",
dimgray: "696969",
dimgrey: "696969",
dodgerblue: "1e90ff",
firebrick: "b22222",
floralwhite: "fffaf0",
forestgreen: "228b22",
fuchsia: "f0f",
gainsboro: "dcdcdc",
ghostwhite: "f8f8ff",
gold: "ffd700",
goldenrod: "daa520",
gray: "808080",
green: "008000",
greenyellow: "adff2f",
grey: "808080",
honeydew: "f0fff0",
hotpink: "ff69b4",
indianred: "cd5c5c",
indigo: "4b0082",
ivory: "fffff0",
khaki: "f0e68c",
lavender: "e6e6fa",
lavenderblush: "fff0f5",
lawngreen: "7cfc00",
lemonchiffon: "fffacd",
lightblue: "add8e6",
lightcoral: "f08080",
lightcyan: "e0ffff",
lightgoldenrodyellow: "fafad2",
lightgray: "d3d3d3",
lightgreen: "90ee90",
lightgrey: "d3d3d3",
lightpink: "ffb6c1",
lightsalmon: "ffa07a",
lightseagreen: "20b2aa",
lightskyblue: "87cefa",
lightslategray: "789",
lightslategrey: "789",
lightsteelblue: "b0c4de",
lightyellow: "ffffe0",
lime: "0f0",
limegreen: "32cd32",
linen: "faf0e6",
magenta: "f0f",
maroon: "800000",
mediumaquamarine: "66cdaa",
mediumblue: "0000cd",
mediumorchid: "ba55d3",
mediumpurple: "9370db",
mediumseagreen: "3cb371",
mediumslateblue: "7b68ee",
mediumspringgreen: "00fa9a",
mediumturquoise: "48d1cc",
mediumvioletred: "c71585",
midnightblue: "191970",
mintcream: "f5fffa",
mistyrose: "ffe4e1",
moccasin: "ffe4b5",
navajowhite: "ffdead",
navy: "000080",
oldlace: "fdf5e6",
olive: "808000",
olivedrab: "6b8e23",
orange: "ffa500",
orangered: "ff4500",
orchid: "da70d6",
palegoldenrod: "eee8aa",
palegreen: "98fb98",
paleturquoise: "afeeee",
palevioletred: "db7093",
papayawhip: "ffefd5",
peachpuff: "ffdab9",
peru: "cd853f",
pink: "ffc0cb",
plum: "dda0dd",
powderblue: "b0e0e6",
purple: "800080",
rebeccapurple: "663399",
red: "f00",
rosybrown: "bc8f8f",
royalblue: "4169e1",
saddlebrown: "8b4513",
salmon: "fa8072",
sandybrown: "f4a460",
seagreen: "2e8b57",
seashell: "fff5ee",
sienna: "a0522d",
silver: "c0c0c0",
skyblue: "87ceeb",
slateblue: "6a5acd",
slategray: "708090",
slategrey: "708090",
snow: "fffafa",
springgreen: "00ff7f",
steelblue: "4682b4",
tan: "d2b48c",
teal: "008080",
thistle: "d8bfd8",
tomato: "ff6347",
turquoise: "40e0d0",
violet: "ee82ee",
wheat: "f5deb3",
white: "fff",
whitesmoke: "f5f5f5",
yellow: "ff0",
yellowgreen: "9acd32"
};
// Make it easy to access colors via `hexNames[hex]`
var hexNames = tinycolor.hexNames = flip(names);
// Utilities
// ---------
// `{ 'name1': 'val1' }` becomes `{ 'val1': 'name1' }`
function flip(o) {
var flipped = { };
for (var i in o) {
if (o.hasOwnProperty(i)) {
flipped[o[i]] = i;
}
}
return flipped;
}
// Return a valid alpha value [0,1] with all invalid values being set to 1
function boundAlpha(a) {
a = parseFloat(a);
if (isNaN(a) || a < 0 || a > 1) {
a = 1;
}
return a;
}
// Take input from [0, n] and return it as [0, 1]
function bound01(n, max) {
if (isOnePointZero(n)) { n = "100%"; }
var processPercent = isPercentage(n);
n = mathMin(max, mathMax(0, parseFloat(n)));
// Automatically convert percentage into number
if (processPercent) {
n = parseInt(n * max, 10) / 100;
}
// Handle floating point rounding errors
if ((Math.abs(n - max) < 0.000001)) {
return 1;
}
// Convert into [0, 1] range if it isn't already
return (n % max) / parseFloat(max);
}
// Force a number between 0 and 1
function clamp01(val) {
return mathMin(1, mathMax(0, val));
}
// Parse a base-16 hex value into a base-10 integer
function parseIntFromHex(val) {
return parseInt(val, 16);
}
// Need to handle 1.0 as 100%, since once it is a number, there is no difference between it and 1
// <http://stackoverflow.com/questions/7422072/javascript-how-to-detect-number-as-a-decimal-including-1-0>
function isOnePointZero(n) {
return typeof n == "string" && n.indexOf('.') != -1 && parseFloat(n) === 1;
}
// Check to see if string passed in is a percentage
function isPercentage(n) {
return typeof n === "string" && n.indexOf('%') != -1;
}
// Force a hex value to have 2 characters
function pad2(c) {
return c.length == 1 ? '0' + c : '' + c;
}
// Replace a decimal with it's percentage value
function convertToPercentage(n) {
if (n <= 1) {
n = (n * 100) + "%";
}
return n;
}
// Converts a decimal to a hex value
function convertDecimalToHex(d) {
return Math.round(parseFloat(d) * 255).toString(16);
}
// Converts a hex value to a decimal
function convertHexToDecimal(h) {
return (parseIntFromHex(h) / 255);
}
var matchers = (function() {
// <http://www.w3.org/TR/css3-values/#integers>
var CSS_INTEGER = "[-\\+]?\\d+%?";
// <http://www.w3.org/TR/css3-values/#number-value>
var CSS_NUMBER = "[-\\+]?\\d*\\.\\d+%?";
// Allow positive/negative integer/number. Don't capture the either/or, just the entire outcome.
var CSS_UNIT = "(?:" + CSS_NUMBER + ")|(?:" + CSS_INTEGER + ")";
// Actual matching.
// Parentheses and commas are optional, but not required.
// Whitespace can take the place of commas or opening paren
var PERMISSIVE_MATCH3 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
var PERMISSIVE_MATCH4 = "[\\s|\\(]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")[,|\\s]+(" + CSS_UNIT + ")\\s*\\)?";
return {
CSS_UNIT: new RegExp(CSS_UNIT),
rgb: new RegExp("rgb" + PERMISSIVE_MATCH3),
rgba: new RegExp("rgba" + PERMISSIVE_MATCH4),
hsl: new RegExp("hsl" + PERMISSIVE_MATCH3),
hsla: new RegExp("hsla" + PERMISSIVE_MATCH4),
hsv: new RegExp("hsv" + PERMISSIVE_MATCH3),
hsva: new RegExp("hsva" + PERMISSIVE_MATCH4),
hex3: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
hex6: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/,
hex4: /^#?([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})([0-9a-fA-F]{1})$/,
hex8: /^#?([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})([0-9a-fA-F]{2})$/
};
})();
// `isValidCSSUnit`
// Take in a single string / number and check to see if it looks like a CSS unit
// (see `matchers` above for definition).
function isValidCSSUnit(color) {
return !!matchers.CSS_UNIT.exec(color);
}
// `stringInputToObject`
// Permissive string parsing. Take in a number of formats, and output an object
// based on detected format. Returns `{ r, g, b }` or `{ h, s, l }` or `{ h, s, v}`
function stringInputToObject(color) {
color = color.replace(trimLeft,'').replace(trimRight, '').toLowerCase();
var named = false;
if (names[color]) {
color = names[color];
named = true;
}
else if (color == 'transparent') {
return { r: 0, g: 0, b: 0, a: 0, format: "name" };
}
// Try to match string input using regular expressions.
// Keep most of the number bounding out of this function - don't worry about [0,1] or [0,100] or [0,360]
// Just return an object and let the conversion functions handle that.
// This way the result will be the same whether the tinycolor is initialized with string or object.
var match;
if ((match = matchers.rgb.exec(color))) {
return { r: match[1], g: match[2], b: match[3] };
}
if ((match = matchers.rgba.exec(color))) {
return { r: match[1], g: match[2], b: match[3], a: match[4] };
}
if ((match = matchers.hsl.exec(color))) {
return { h: match[1], s: match[2], l: match[3] };
}
if ((match = matchers.hsla.exec(color))) {
return { h: match[1], s: match[2], l: match[3], a: match[4] };
}
if ((match = matchers.hsv.exec(color))) {
return { h: match[1], s: match[2], v: match[3] };
}
if ((match = matchers.hsva.exec(color))) {
return { h: match[1], s: match[2], v: match[3], a: match[4] };
}
if ((match = matchers.hex8.exec(color))) {
return {
r: parseIntFromHex(match[1]),
g: parseIntFromHex(match[2]),
b: parseIntFromHex(match[3]),
a: convertHexToDecimal(match[4]),
format: named ? "name" : "hex8"
};
}
if ((match = matchers.hex6.exec(color))) {
return {
r: parseIntFromHex(match[1]),
g: parseIntFromHex(match[2]),
b: parseIntFromHex(match[3]),
format: named ? "name" : "hex"
};
}
if ((match = matchers.hex4.exec(color))) {
return {
r: parseIntFromHex(match[1] + '' + match[1]),
g: parseIntFromHex(match[2] + '' + match[2]),
b: parseIntFromHex(match[3] + '' + match[3]),
a: convertHexToDecimal(match[4] + '' + match[4]),
format: named ? "name" : "hex8"
};
}
if ((match = matchers.hex3.exec(color))) {
return {
r: parseIntFromHex(match[1] + '' + match[1]),
g: parseIntFromHex(match[2] + '' + match[2]),
b: parseIntFromHex(match[3] + '' + match[3]),
format: named ? "name" : "hex"
};
}
return false;
}
function validateWCAG2Parms(parms) {
// return valid WCAG2 parms for isReadable.
// If input parms are invalid, return {"level":"AA", "size":"small"}
var level, size;
parms = parms || {"level":"AA", "size":"small"};
level = (parms.level || "AA").toUpperCase();
size = (parms.size || "small").toLowerCase();
if (level !== "AA" && level !== "AAA") {
level = "AA";
}
if (size !== "small" && size !== "large") {
size = "small";
}
return {"level":level, "size":size};
}
// Node: Export function
if ( true && module.exports) {
module.exports = tinycolor;
}
// AMD/requirejs: Define the module
else if (true) {
!(__WEBPACK_AMD_DEFINE_RESULT__ = (function () {return tinycolor;}).call(exports, __webpack_require__, exports, module),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
}
// Browser: Expose to window
else {}
})(Math);
/***/ }),
/***/ "aA0e":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("wx14");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var reakit_Toolbar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("zTEx");
/* harmony import */ var _wordpress_warning__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("Z23Y");
/* harmony import */ var _wordpress_warning__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_warning__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _toolbar_context__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("GK4x");
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function ToolbarItem({
children,
as: Component,
...props
}, ref) {
const accessibleToolbarState = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["useContext"])(_toolbar_context__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"]);
if (typeof children !== 'function' && !Component) {
typeof process !== "undefined" && process.env && "production" !== "production" ? _wordpress_warning__WEBPACK_IMPORTED_MODULE_3___default()('`ToolbarItem` is a generic headless component. You must pass either a `children` prop as a function or an `as` prop as a component. ' + 'See https://developer.wordpress.org/block-editor/components/toolbar-item/') : void 0;
return null;
}
const allProps = { ...props,
ref,
'data-toolbar-item': true
};
if (!accessibleToolbarState) {
if (Component) {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(Component, allProps, children);
}
return children(allProps);
}
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(reakit_Toolbar__WEBPACK_IMPORTED_MODULE_2__[/* ToolbarItem */ "a"], Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])({}, accessibleToolbarState, allProps, {
as: Component
}), children);
}
/* harmony default export */ __webpack_exports__["a"] = (Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(ToolbarItem));
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("8oxB")))
/***/ }),
/***/ "aE6U":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _constants = __webpack_require__("Fv1B");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
exports['default'] = _propTypes2['default'].oneOf([_constants.HORIZONTAL_ORIENTATION, _constants.VERTICAL_ORIENTATION, _constants.VERTICAL_SCROLLABLE]);
/***/ }),
/***/ "aI7X":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* eslint no-invalid-this: 1 */
var ERROR_MESSAGE = 'Function.prototype.bind called on incompatible ';
var slice = Array.prototype.slice;
var toStr = Object.prototype.toString;
var funcType = '[object Function]';
module.exports = function bind(that) {
var target = this;
if (typeof target !== 'function' || toStr.call(target) !== funcType) {
throw new TypeError(ERROR_MESSAGE + target);
}
var args = slice.call(arguments, 1);
var bound;
var binder = function () {
if (this instanceof bound) {
var result = target.apply(
this,
args.concat(slice.call(arguments))
);
if (Object(result) === result) {
return result;
}
return this;
} else {
return target.apply(
that,
args.concat(slice.call(arguments))
);
}
};
var boundLength = Math.max(0, target.length - args.length);
var boundArgs = [];
for (var i = 0; i < boundLength; i++) {
boundArgs.push('$' + i);
}
bound = Function('binder', 'return function (' + boundArgs.join(',') + '){ return binder.apply(this,arguments); }')(binder);
if (target.prototype) {
var Empty = function Empty() {};
Empty.prototype = target.prototype;
bound.prototype = new Empty();
Empty.prototype = null;
}
return bound;
};
/***/ }),
/***/ "aU41":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useForkRef; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("cDcd");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
// https://github.com/mui-org/material-ui/blob/2bcc874cf07b81202968f769cb9c2398c7c11311/packages/material-ui/src/utils/useForkRef.js
function setRef(ref, value) {
if (value === void 0) {
value = null;
}
if (!ref) return;
if (typeof ref === "function") {
ref(value);
} else {
ref.current = value;
}
}
/**
* Merges up to two React Refs into a single memoized function React Ref so you
* can pass it to an element.
*
* @example
* import React from "react";
* import { useForkRef } from "reakit-utils";
*
* const Component = React.forwardRef((props, ref) => {
* const internalRef = React.useRef();
* return <div {...props} ref={useForkRef(internalRef, ref)} />;
* });
*/
function useForkRef(refA, refB) {
return Object(react__WEBPACK_IMPORTED_MODULE_0__["useMemo"])(function () {
if (refA == null && refB == null) {
return null;
}
return function (value) {
setRef(refA, value);
setRef(refB, value);
};
}, [refA, refB]);
}
/***/ }),
/***/ "aUaa":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("v7lB");
var $TypeError = GetIntrinsic('%TypeError%');
// http://www.ecma-international.org/ecma-262/5.1/#sec-9.10
module.exports = function CheckObjectCoercible(value, optMessage) {
if (value == null) {
throw new $TypeError(optMessage || ('Cannot call method on ' + value));
}
return value;
};
/***/ }),
/***/ "aenO":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $TypeError = GetIntrinsic('%TypeError%');
var IsPropertyKey = __webpack_require__("i10q");
var Type = __webpack_require__("V1cy");
// https://ecma-international.org/ecma-262/6.0/#sec-hasproperty
module.exports = function HasProperty(O, P) {
if (Type(O) !== 'Object') {
throw new $TypeError('Assertion failed: `O` must be an Object');
}
if (!IsPropertyKey(P)) {
throw new $TypeError('Assertion failed: `P` must be a Property Key');
}
return P in O;
};
/***/ }),
/***/ "agUq":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// http://262.ecma-international.org/5.1/#sec-9.11
module.exports = __webpack_require__("Asd8");
/***/ }),
/***/ "ald4":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var $isNaN = Number.isNaN || function (a) { return a !== a; };
module.exports = Number.isFinite || function (x) { return typeof x === 'number' && !$isNaN(x) && x !== Infinity && x !== -Infinity; };
/***/ }),
/***/ "bWcr":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const closeSmall = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M12 13.06l3.712 3.713 1.061-1.06L13.061 12l3.712-3.712-1.06-1.06L12 10.938 8.288 7.227l-1.061 1.06L10.939 12l-3.712 3.712 1.06 1.061L12 13.061z"
}));
/* harmony default export */ __webpack_exports__["a"] = (closeSmall);
/***/ }),
/***/ "c6aN":
/***/ (function(module, exports, __webpack_require__) {
var moment = __webpack_require__("wy2R");
function isValidMoment(testMoment) {
if (typeof moment.isMoment === 'function' && !moment.isMoment(testMoment)) {
return false;
}
/* istanbul ignore else */
if (typeof testMoment.isValid === 'function') {
// moment 1.7.0+
return testMoment.isValid();
}
/* istanbul ignore next */
return !isNaN(testMoment);
}
module.exports = {
isValidMoment : isValidMoment,
};
/***/ }),
/***/ "cD2C":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
if (true) {
module.exports = __webpack_require__("5aBA");
} else {}
/***/ }),
/***/ "cDcd":
/***/ (function(module, exports) {
(function() { module.exports = window["React"]; }());
/***/ }),
/***/ "cGtP":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const search = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M13.5 6C10.5 6 8 8.5 8 11.5c0 1.1.3 2.1.9 3l-3.4 3 1 1.1 3.4-2.9c1 .9 2.2 1.4 3.6 1.4 3 0 5.5-2.5 5.5-5.5C19 8.5 16.5 6 13.5 6zm0 9.5c-2.2 0-4-1.8-4-4s1.8-4 4-4 4 1.8 4 4-1.8 4-4 4z"
}));
/* harmony default export */ __webpack_exports__["a"] = (search);
/***/ }),
/***/ "dRQD":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = isTransitionEndSupported;
function isTransitionEndSupported() {
return !!(typeof window !== 'undefined' && 'TransitionEvent' in window);
}
/***/ }),
/***/ "dSD1":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ slot_fill_Fill; });
__webpack_require__.d(__webpack_exports__, "c", function() { return /* binding */ slot_fill_Slot; });
__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ Provider; });
__webpack_require__.d(__webpack_exports__, "d", function() { return /* binding */ createSlotFill; });
// UNUSED EXPORTS: useSlot
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
var esm_extends = __webpack_require__("wx14");
// EXTERNAL MODULE: external ["wp","element"]
var external_wp_element_ = __webpack_require__("GRId");
// EXTERNAL MODULE: external "lodash"
var external_lodash_ = __webpack_require__("YLtl");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/context.js
/**
* WordPress dependencies
*/
const SlotFillContext = Object(external_wp_element_["createContext"])({
registerSlot: () => {},
unregisterSlot: () => {},
registerFill: () => {},
unregisterFill: () => {},
getSlot: () => {},
getFills: () => {},
subscribe: () => {}
});
/* harmony default export */ var context = (SlotFillContext);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/use-slot.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* React hook returning the active slot given a name.
*
* @param {string} name Slot name.
* @return {Object} Slot object.
*/
const useSlot = name => {
const {
getSlot,
subscribe
} = Object(external_wp_element_["useContext"])(context);
const [slot, setSlot] = Object(external_wp_element_["useState"])(getSlot(name));
Object(external_wp_element_["useEffect"])(() => {
setSlot(getSlot(name));
const unsubscribe = subscribe(() => {
setSlot(getSlot(name));
});
return unsubscribe;
}, [name]);
return slot;
};
/* harmony default export */ var use_slot = (useSlot);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/fill.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function fill_FillComponent({
name,
children,
registerFill,
unregisterFill
}) {
const slot = use_slot(name);
const ref = Object(external_wp_element_["useRef"])({
name,
children
});
Object(external_wp_element_["useLayoutEffect"])(() => {
registerFill(name, ref.current);
return () => unregisterFill(name, ref.current);
}, []);
Object(external_wp_element_["useLayoutEffect"])(() => {
ref.current.children = children;
if (slot) {
slot.forceUpdate();
}
}, [children]);
Object(external_wp_element_["useLayoutEffect"])(() => {
if (name === ref.current.name) {
// ignore initial effect
return;
}
unregisterFill(ref.current.name, ref.current);
ref.current.name = name;
registerFill(name, ref.current);
}, [name]);
if (!slot || !slot.node) {
return null;
} // If a function is passed as a child, provide it with the fillProps.
if (Object(external_lodash_["isFunction"])(children)) {
children = children(slot.props.fillProps);
}
return Object(external_wp_element_["createPortal"])(children, slot.node);
}
const Fill = props => Object(external_wp_element_["createElement"])(context.Consumer, null, ({
registerFill,
unregisterFill
}) => Object(external_wp_element_["createElement"])(fill_FillComponent, Object(esm_extends["a" /* default */])({}, props, {
registerFill: registerFill,
unregisterFill: unregisterFill
})));
/* harmony default export */ var slot_fill_fill = (Fill);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/slot.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
class slot_SlotComponent extends external_wp_element_["Component"] {
constructor() {
super(...arguments);
this.isUnmounted = false;
this.bindNode = this.bindNode.bind(this);
}
componentDidMount() {
const {
registerSlot
} = this.props;
registerSlot(this.props.name, this);
}
componentWillUnmount() {
const {
unregisterSlot
} = this.props;
this.isUnmounted = true;
unregisterSlot(this.props.name, this);
}
componentDidUpdate(prevProps) {
const {
name,
unregisterSlot,
registerSlot
} = this.props;
if (prevProps.name !== name) {
unregisterSlot(prevProps.name);
registerSlot(name, this);
}
}
bindNode(node) {
this.node = node;
}
forceUpdate() {
if (this.isUnmounted) {
return;
}
super.forceUpdate();
}
render() {
const {
children,
name,
fillProps = {},
getFills
} = this.props;
const fills = Object(external_lodash_["map"])(getFills(name, this), fill => {
const fillChildren = Object(external_lodash_["isFunction"])(fill.children) ? fill.children(fillProps) : fill.children;
return external_wp_element_["Children"].map(fillChildren, (child, childIndex) => {
if (!child || Object(external_lodash_["isString"])(child)) {
return child;
}
const childKey = child.key || childIndex;
return Object(external_wp_element_["cloneElement"])(child, {
key: childKey
});
});
}).filter( // In some cases fills are rendered only when some conditions apply.
// This ensures that we only use non-empty fills when rendering, i.e.,
// it allows us to render wrappers only when the fills are actually present.
Object(external_lodash_["negate"])(external_wp_element_["isEmptyElement"]));
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_lodash_["isFunction"])(children) ? children(fills) : fills);
}
}
const Slot = props => Object(external_wp_element_["createElement"])(context.Consumer, null, ({
registerSlot,
unregisterSlot,
getFills
}) => Object(external_wp_element_["createElement"])(slot_SlotComponent, Object(esm_extends["a" /* default */])({}, props, {
registerSlot: registerSlot,
unregisterSlot: unregisterSlot,
getFills: getFills
})));
/* harmony default export */ var slot_fill_slot = (Slot);
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/use-slot.js
var bubbles_virtually_use_slot = __webpack_require__("+WFq");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/fill.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useForceUpdate() {
const [, setState] = Object(external_wp_element_["useState"])({});
const mounted = Object(external_wp_element_["useRef"])(true);
Object(external_wp_element_["useEffect"])(() => {
return () => {
mounted.current = false;
};
}, []);
return () => {
if (mounted.current) {
setState({});
}
};
}
function fill_Fill({
name,
children
}) {
const slot = Object(bubbles_virtually_use_slot["a" /* default */])(name);
const ref = Object(external_wp_element_["useRef"])({
rerender: useForceUpdate()
});
Object(external_wp_element_["useEffect"])(() => {
// We register fills so we can keep track of their existance.
// Some Slot implementations need to know if there're already fills
// registered so they can choose to render themselves or not.
slot.registerFill(ref);
return () => {
slot.unregisterFill(ref);
};
}, [slot.registerFill, slot.unregisterFill]);
if (!slot.ref || !slot.ref.current) {
return null;
}
if (typeof children === 'function') {
children = children(slot.fillProps);
}
return Object(external_wp_element_["createPortal"])(children, slot.ref.current);
}
// EXTERNAL MODULE: external ["wp","compose"]
var external_wp_compose_ = __webpack_require__("K9lf");
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot-fill-context.js
var slot_fill_context = __webpack_require__("JYkG");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function slot_Slot({
name,
fillProps = {},
as: Component = 'div',
...props
}, forwardedRef) {
const registry = Object(external_wp_element_["useContext"])(slot_fill_context["a" /* default */]);
const ref = Object(external_wp_element_["useRef"])();
Object(external_wp_element_["useLayoutEffect"])(() => {
registry.registerSlot(name, ref, fillProps);
return () => {
registry.unregisterSlot(name, ref);
}; // We are not including fillProps in the deps because we don't want to
// unregister and register the slot whenever fillProps change, which would
// cause the fill to be re-mounted. We are only considering the initial value
// of fillProps.
}, [registry.registerSlot, registry.unregisterSlot, name]); // fillProps may be an update that interacts with the layout, so we
// useLayoutEffect
Object(external_wp_element_["useLayoutEffect"])(() => {
registry.updateSlot(name, fillProps);
});
return Object(external_wp_element_["createElement"])(Component, Object(esm_extends["a" /* default */])({
ref: Object(external_wp_compose_["useMergeRefs"])([forwardedRef, ref])
}, props));
}
/* harmony default export */ var bubbles_virtually_slot = (Object(external_wp_element_["forwardRef"])(slot_Slot));
// EXTERNAL MODULE: external ["wp","isShallowEqual"]
var external_wp_isShallowEqual_ = __webpack_require__("rl8x");
var external_wp_isShallowEqual_default = /*#__PURE__*/__webpack_require__.n(external_wp_isShallowEqual_);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/slot-fill-provider.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function useSlotRegistry() {
const [slots, setSlots] = Object(external_wp_element_["useState"])({});
const [fills, setFills] = Object(external_wp_element_["useState"])({});
const registerSlot = Object(external_wp_element_["useCallback"])((name, ref, fillProps) => {
setSlots(prevSlots => {
const slot = prevSlots[name] || {};
return { ...prevSlots,
[name]: { ...slot,
ref: ref || slot.ref,
fillProps: fillProps || slot.fillProps || {}
}
};
});
}, []);
const unregisterSlot = Object(external_wp_element_["useCallback"])((name, ref) => {
setSlots(prevSlots => {
const {
[name]: slot,
...nextSlots
} = prevSlots; // Make sure we're not unregistering a slot registered by another element
// See https://github.com/WordPress/gutenberg/pull/19242#issuecomment-590295412
if ((slot === null || slot === void 0 ? void 0 : slot.ref) === ref) {
return nextSlots;
}
return prevSlots;
});
}, []);
const updateSlot = Object(external_wp_element_["useCallback"])((name, fillProps) => {
const slot = slots[name];
if (!slot) {
return;
}
if (!external_wp_isShallowEqual_default()(slot.fillProps, fillProps)) {
slot.fillProps = fillProps;
const slotFills = fills[name];
if (slotFills) {
// Force update fills
slotFills.map(fill => fill.current.rerender());
}
}
}, [slots, fills]);
const registerFill = Object(external_wp_element_["useCallback"])((name, ref) => {
setFills(prevFills => ({ ...prevFills,
[name]: [...(prevFills[name] || []), ref]
}));
}, []);
const unregisterFill = Object(external_wp_element_["useCallback"])((name, ref) => {
setFills(prevFills => {
if (prevFills[name]) {
return { ...prevFills,
[name]: prevFills[name].filter(fillRef => fillRef !== ref)
};
}
return prevFills;
});
}, []); // Memoizing the return value so it can be directly passed to Provider value
const registry = Object(external_wp_element_["useMemo"])(() => ({
slots,
fills,
registerSlot,
updateSlot,
unregisterSlot,
registerFill,
unregisterFill
}), [slots, fills, registerSlot, updateSlot, unregisterSlot, registerFill, unregisterFill]);
return registry;
}
function slot_fill_provider_SlotFillProvider({
children
}) {
const registry = useSlotRegistry();
return Object(external_wp_element_["createElement"])(slot_fill_context["a" /* default */].Provider, {
value: registry
}, children);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/provider.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
class provider_SlotFillProvider extends external_wp_element_["Component"] {
constructor() {
super(...arguments);
this.registerSlot = this.registerSlot.bind(this);
this.registerFill = this.registerFill.bind(this);
this.unregisterSlot = this.unregisterSlot.bind(this);
this.unregisterFill = this.unregisterFill.bind(this);
this.getSlot = this.getSlot.bind(this);
this.getFills = this.getFills.bind(this);
this.hasFills = this.hasFills.bind(this);
this.subscribe = this.subscribe.bind(this);
this.slots = {};
this.fills = {};
this.listeners = [];
this.contextValue = {
registerSlot: this.registerSlot,
unregisterSlot: this.unregisterSlot,
registerFill: this.registerFill,
unregisterFill: this.unregisterFill,
getSlot: this.getSlot,
getFills: this.getFills,
hasFills: this.hasFills,
subscribe: this.subscribe
};
}
registerSlot(name, slot) {
const previousSlot = this.slots[name];
this.slots[name] = slot;
this.triggerListeners(); // Sometimes the fills are registered after the initial render of slot
// But before the registerSlot call, we need to rerender the slot
this.forceUpdateSlot(name); // If a new instance of a slot is being mounted while another with the
// same name exists, force its update _after_ the new slot has been
// assigned into the instance, such that its own rendering of children
// will be empty (the new Slot will subsume all fills for this name).
if (previousSlot) {
previousSlot.forceUpdate();
}
}
registerFill(name, instance) {
this.fills[name] = [...(this.fills[name] || []), instance];
this.forceUpdateSlot(name);
}
unregisterSlot(name, instance) {
// If a previous instance of a Slot by this name unmounts, do nothing,
// as the slot and its fills should only be removed for the current
// known instance.
if (this.slots[name] !== instance) {
return;
}
delete this.slots[name];
this.triggerListeners();
}
unregisterFill(name, instance) {
this.fills[name] = Object(external_lodash_["without"])(this.fills[name], instance);
this.forceUpdateSlot(name);
}
getSlot(name) {
return this.slots[name];
}
getFills(name, slotInstance) {
// Fills should only be returned for the current instance of the slot
// in which they occupy.
if (this.slots[name] !== slotInstance) {
return [];
}
return this.fills[name];
}
hasFills(name) {
return this.fills[name] && !!this.fills[name].length;
}
forceUpdateSlot(name) {
const slot = this.getSlot(name);
if (slot) {
slot.forceUpdate();
}
}
triggerListeners() {
this.listeners.forEach(listener => listener());
}
subscribe(listener) {
this.listeners.push(listener);
return () => {
this.listeners = Object(external_lodash_["without"])(this.listeners, listener);
};
}
render() {
return Object(external_wp_element_["createElement"])(context.Provider, {
value: this.contextValue
}, this.props.children);
}
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/index.js
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
function slot_fill_Fill(props) {
// We're adding both Fills here so they can register themselves before
// their respective slot has been registered. Only the Fill that has a slot
// will render. The other one will return null.
return Object(external_wp_element_["createElement"])(external_wp_element_["Fragment"], null, Object(external_wp_element_["createElement"])(slot_fill_fill, props), Object(external_wp_element_["createElement"])(fill_Fill, props));
}
const slot_fill_Slot = Object(external_wp_element_["forwardRef"])(({
bubblesVirtually,
...props
}, ref) => {
if (bubblesVirtually) {
return Object(external_wp_element_["createElement"])(bubbles_virtually_slot, Object(esm_extends["a" /* default */])({}, props, {
ref: ref
}));
}
return Object(external_wp_element_["createElement"])(slot_fill_slot, props);
});
function Provider({
children,
...props
}) {
return Object(external_wp_element_["createElement"])(provider_SlotFillProvider, props, Object(external_wp_element_["createElement"])(slot_fill_provider_SlotFillProvider, null, children));
}
function createSlotFill(name) {
const FillComponent = props => Object(external_wp_element_["createElement"])(slot_fill_Fill, Object(esm_extends["a" /* default */])({
name: name
}, props));
FillComponent.displayName = name + 'Fill';
const SlotComponent = props => Object(external_wp_element_["createElement"])(slot_fill_Slot, Object(esm_extends["a" /* default */])({
name: name
}, props));
SlotComponent.displayName = name + 'Slot';
SlotComponent.__unstableName = name;
return {
Fill: FillComponent,
Slot: SlotComponent
};
}
/***/ }),
/***/ "ddK1":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var ES5ToInteger = __webpack_require__("Wfh+");
var ToNumber = __webpack_require__("xCFm");
// https://262.ecma-international.org/11.0/#sec-tointeger
module.exports = function ToInteger(value) {
var number = ToNumber(value);
if (number !== 0) {
number = ES5ToInteger(number);
}
return number === 0 ? 0 : number;
};
/***/ }),
/***/ "eBsn":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var has = __webpack_require__("oNNP");
var GetIntrinsic = __webpack_require__("rZ7t");
var $TypeError = GetIntrinsic('%TypeError%');
var Type = __webpack_require__("V1cy");
var ToBoolean = __webpack_require__("kvlw");
var IsCallable = __webpack_require__("agUq");
// https://262.ecma-international.org/5.1/#sec-8.10.5
module.exports = function ToPropertyDescriptor(Obj) {
if (Type(Obj) !== 'Object') {
throw new $TypeError('ToPropertyDescriptor requires an object');
}
var desc = {};
if (has(Obj, 'enumerable')) {
desc['[[Enumerable]]'] = ToBoolean(Obj.enumerable);
}
if (has(Obj, 'configurable')) {
desc['[[Configurable]]'] = ToBoolean(Obj.configurable);
}
if (has(Obj, 'value')) {
desc['[[Value]]'] = Obj.value;
}
if (has(Obj, 'writable')) {
desc['[[Writable]]'] = ToBoolean(Obj.writable);
}
if (has(Obj, 'get')) {
var getter = Obj.get;
if (typeof getter !== 'undefined' && !IsCallable(getter)) {
throw new $TypeError('getter must be a function');
}
desc['[[Get]]'] = getter;
}
if (has(Obj, 'set')) {
var setter = Obj.set;
if (typeof setter !== 'undefined' && !IsCallable(setter)) {
throw new $TypeError('setter must be a function');
}
desc['[[Set]]'] = setter;
}
if ((has(desc, '[[Get]]') || has(desc, '[[Set]]')) && (has(desc, '[[Value]]') || has(desc, '[[Writable]]'))) {
throw new $TypeError('Invalid property descriptor. Cannot both specify accessors and a value or writable attribute');
}
return desc;
};
/***/ }),
/***/ "eJkf":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* eslint complexity: [2, 18], max-statements: [2, 33] */
module.exports = function hasSymbols() {
if (typeof Symbol !== 'function' || typeof Object.getOwnPropertySymbols !== 'function') { return false; }
if (typeof Symbol.iterator === 'symbol') { return true; }
var obj = {};
var sym = Symbol('test');
var symObj = Object(sym);
if (typeof sym === 'string') { return false; }
if (Object.prototype.toString.call(sym) !== '[object Symbol]') { return false; }
if (Object.prototype.toString.call(symObj) !== '[object Symbol]') { return false; }
// temp disabled per https://github.com/ljharb/object.assign/issues/17
// if (sym instanceof Symbol) { return false; }
// temp disabled per https://github.com/WebReflection/get-own-property-symbols/issues/4
// if (!(symObj instanceof Symbol)) { return false; }
// if (typeof Symbol.prototype.toString !== 'function') { return false; }
// if (String(sym) !== Symbol.prototype.toString.call(sym)) { return false; }
var symVal = 42;
obj[sym] = symVal;
for (sym in obj) { return false; } // eslint-disable-line no-restricted-syntax, no-unreachable-loop
if (typeof Object.keys === 'function' && Object.keys(obj).length !== 0) { return false; }
if (typeof Object.getOwnPropertyNames === 'function' && Object.getOwnPropertyNames(obj).length !== 0) { return false; }
var syms = Object.getOwnPropertySymbols(obj);
if (syms.length !== 1 || syms[0] !== sym) { return false; }
if (!Object.prototype.propertyIsEnumerable.call(obj, sym)) { return false; }
if (typeof Object.getOwnPropertyDescriptor === 'function') {
var descriptor = Object.getOwnPropertyDescriptor(obj, sym);
if (descriptor.value !== symVal || descriptor.enumerable !== true) { return false; }
}
return true;
};
/***/ }),
/***/ "eNtd":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useLiveRef; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("cDcd");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _useIsomorphicEffect_js__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("AXvK");
/**
* A `React.Ref` that keeps track of the passed `value`.
*/
function useLiveRef(value) {
var ref = Object(react__WEBPACK_IMPORTED_MODULE_0__["useRef"])(value);
Object(_useIsomorphicEffect_js__WEBPACK_IMPORTED_MODULE_1__[/* useIsomorphicEffect */ "a"])(function () {
ref.current = value;
});
return ref;
}
/***/ }),
/***/ "eOFJ":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $TypeError = GetIntrinsic('%TypeError%');
var isPropertyDescriptor = __webpack_require__("Qmvf");
var DefineOwnProperty = __webpack_require__("wTIp");
var FromPropertyDescriptor = __webpack_require__("zYbv");
var IsAccessorDescriptor = __webpack_require__("z3X9");
var IsDataDescriptor = __webpack_require__("CGNl");
var IsPropertyKey = __webpack_require__("i10q");
var SameValue = __webpack_require__("HI8u");
var ToPropertyDescriptor = __webpack_require__("eBsn");
var Type = __webpack_require__("V1cy");
// https://ecma-international.org/ecma-262/6.0/#sec-definepropertyorthrow
module.exports = function DefinePropertyOrThrow(O, P, desc) {
if (Type(O) !== 'Object') {
throw new $TypeError('Assertion failed: Type(O) is not Object');
}
if (!IsPropertyKey(P)) {
throw new $TypeError('Assertion failed: IsPropertyKey(P) is not true');
}
var Desc = isPropertyDescriptor({
Type: Type,
IsDataDescriptor: IsDataDescriptor,
IsAccessorDescriptor: IsAccessorDescriptor
}, desc) ? desc : ToPropertyDescriptor(desc);
if (!isPropertyDescriptor({
Type: Type,
IsDataDescriptor: IsDataDescriptor,
IsAccessorDescriptor: IsAccessorDescriptor
}, Desc)) {
throw new $TypeError('Assertion failed: Desc is not a valid Property Descriptor');
}
return DefineOwnProperty(
IsDataDescriptor,
SameValue,
FromPropertyDescriptor,
O,
P,
Desc
);
};
/***/ }),
/***/ "eUCI":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SystemContext; });
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("cDcd");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
var SystemContext = /*#__PURE__*/Object(react__WEBPACK_IMPORTED_MODULE_0__["createContext"])({});
/***/ }),
/***/ "fW1L":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var callBound = __webpack_require__("EXo9");
var $TypeError = GetIntrinsic('%TypeError%');
var IsArray = __webpack_require__("9cOx");
var $apply = GetIntrinsic('%Reflect.apply%', true) || callBound('%Function.prototype.apply%');
// https://ecma-international.org/ecma-262/6.0/#sec-call
module.exports = function Call(F, V) {
var argumentsList = arguments.length > 2 ? arguments[2] : [];
if (!IsArray(argumentsList)) {
throw new $TypeError('Assertion failed: optional `argumentsList`, if provided, must be a List');
}
return $apply(F, V, argumentsList);
};
/***/ }),
/***/ "g56x":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["hooks"]; }());
/***/ }),
/***/ "gZI3":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var RightArrow = function () {
function RightArrow(props) {
return _react2['default'].createElement(
'svg',
props,
_react2['default'].createElement('path', {
d: 'M694.4 242.4l249.1 249.1c11 11 11 21 0 32L694.4 772.7c-5 5-10 7-16 7s-11-2-16-7c-11-11-11-21 0-32l210.1-210.1H67.1c-13 0-23-10-23-23s10-23 23-23h805.4L662.4 274.5c-21-21.1 11-53.1 32-32.1z'
})
);
}
return RightArrow;
}();
RightArrow.defaultProps = {
viewBox: '0 0 1000 1000'
};
exports['default'] = RightArrow;
/***/ }),
/***/ "gdqT":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["a11y"]; }());
/***/ }),
/***/ "h6xH":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = isBeforeDay;
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function isBeforeDay(a, b) {
if (!_moment2['default'].isMoment(a) || !_moment2['default'].isMoment(b)) return false;
var aYear = a.year();
var aMonth = a.month();
var bYear = b.year();
var bMonth = b.month();
var isSameYear = aYear === bYear;
var isSameMonth = aMonth === bMonth;
if (isSameYear && isSameMonth) return a.date() < b.date();
if (isSameYear) return aMonth < bMonth;
return aYear < bYear;
}
/***/ }),
/***/ "hE48":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ createComponent; });
// EXTERNAL MODULE: external "React"
var external_React_ = __webpack_require__("cDcd");
// EXTERNAL MODULE: ./node_modules/reakit-system/es/_rollupPluginBabelHelpers-0c84a174.js
var _rollupPluginBabelHelpers_0c84a174 = __webpack_require__("RDTF");
// EXTERNAL MODULE: ./node_modules/reakit-system/es/useCreateElement.js
var useCreateElement = __webpack_require__("IVEb");
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/_rollupPluginBabelHelpers-1f0bf8c2.js
var _rollupPluginBabelHelpers_1f0bf8c2 = __webpack_require__("I/A+");
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/isObject.js
var isObject = __webpack_require__("Ptb8");
// CONCATENATED MODULE: ./node_modules/reakit-utils/es/isPlainObject.js
/**
* Checks whether `arg` is a plain object or not.
*
* @returns {boolean}
*/
function isPlainObject(arg) {
var _proto$constructor;
if (!Object(isObject["a" /* isObject */])(arg)) return false;
var proto = Object.getPrototypeOf(arg);
if (proto == null) return true;
return ((_proto$constructor = proto.constructor) === null || _proto$constructor === void 0 ? void 0 : _proto$constructor.toString()) === Object.toString();
}
// CONCATENATED MODULE: ./node_modules/reakit-utils/es/splitProps.js
/**
* Splits an object (`props`) into a tuple where the first item is an object
* with the passed `keys`, and the second item is an object with these keys
* omitted.
*
* @deprecated will be removed in version 2
*
* @example
* import { splitProps } from "reakit-utils";
*
* splitProps({ a: "a", b: "b" }, ["a"]); // [{ a: "a" }, { b: "b" }]
*/
function __deprecatedSplitProps(props, keys) {
var propsKeys = Object.keys(props);
var picked = {};
var omitted = {};
for (var _i = 0, _propsKeys = propsKeys; _i < _propsKeys.length; _i++) {
var key = _propsKeys[_i];
if (keys.indexOf(key) >= 0) {
picked[key] = props[key];
} else {
omitted[key] = props[key];
}
}
return [picked, omitted];
}
/**
* Splits an object (`props`) into a tuple where the first item
* is the `state` property, and the second item is the rest of the properties.
*
* It is also backward compatible with version 1. If `keys` are passed then
* splits an object (`props`) into a tuple where the first item is an object
* with the passed `keys`, and the second item is an object with these keys
* omitted.
*
* @example
* import { splitProps } from "reakit-utils";
*
* splitProps({ a: "a", b: "b" }, ["a"]); // [{ a: "a" }, { b: "b" }]
*
* @example
* import { splitProps } from "reakit-utils";
*
* splitProps({ state: { a: "a" }, b: "b" }); // [{ a: "a" }, { b: "b" }]
*/
function splitProps(props, keys) {
if (keys === void 0) {
keys = [];
}
if (!isPlainObject(props.state)) {
return __deprecatedSplitProps(props, keys);
}
var _deprecatedSplitProp = __deprecatedSplitProps(props, [].concat(keys, ["state"])),
picked = _deprecatedSplitProp[0],
omitted = _deprecatedSplitProp[1];
var state = picked.state,
restPicked = Object(_rollupPluginBabelHelpers_1f0bf8c2["a" /* _ */])(picked, ["state"]);
return [Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, state), restPicked), omitted];
}
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/shallowEqual.js
var shallowEqual = __webpack_require__("uqqE");
// CONCATENATED MODULE: ./node_modules/reakit-utils/es/normalizePropsAreEqual.js
/**
* This higher order functions take `propsAreEqual` function and
* returns a new function which normalizes the props.
*
* Normalizing in our case is making sure the `propsAreEqual` works with
* both version 1 (object spreading) and version 2 (state object) state passing.
*
* To achieve this, the returned function in case of a state object
* will spread the state object in both `prev` and `next props.
*
* Other case it just returns the function as is which makes sure
* that we are still backward compatible
*/
function normalizePropsAreEqual(propsAreEqual) {
if (propsAreEqual.name === "normalizePropsAreEqualInner") {
return propsAreEqual;
}
return function normalizePropsAreEqualInner(prev, next) {
if (!isPlainObject(prev.state) || !isPlainObject(next.state)) {
return propsAreEqual(prev, next);
}
return propsAreEqual(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, prev.state), prev), Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])(Object(_rollupPluginBabelHelpers_1f0bf8c2["b" /* a */])({}, next.state), next));
};
}
// CONCATENATED MODULE: ./node_modules/reakit-system/es/createComponent.js
function forwardRef(component) {
return /*#__PURE__*/Object(external_React_["forwardRef"])(component);
}
function memo(component, propsAreEqual) {
return /*#__PURE__*/Object(external_React_["memo"])(component, propsAreEqual);
}
/**
* Creates a React component.
*
* @example
* import { createComponent } from "reakit-system";
*
* const A = createComponent({ as: "a" });
*
* @param options
*/
function createComponent(_ref) {
var type = _ref.as,
useHook = _ref.useHook,
shouldMemo = _ref.memo,
_ref$propsAreEqual = _ref.propsAreEqual,
propsAreEqual = _ref$propsAreEqual === void 0 ? useHook === null || useHook === void 0 ? void 0 : useHook.unstable_propsAreEqual : _ref$propsAreEqual,
_ref$keys = _ref.keys,
keys = _ref$keys === void 0 ? (useHook === null || useHook === void 0 ? void 0 : useHook.__keys) || [] : _ref$keys,
_ref$useCreateElement = _ref.useCreateElement,
useCreateElement$1 = _ref$useCreateElement === void 0 ? useCreateElement["a" /* useCreateElement */] : _ref$useCreateElement;
var Comp = function Comp(_ref2, ref) {
var _ref2$as = _ref2.as,
as = _ref2$as === void 0 ? type : _ref2$as,
props = Object(_rollupPluginBabelHelpers_0c84a174["b" /* a */])(_ref2, ["as"]);
if (useHook) {
var _as$render;
var _splitProps = splitProps(props, keys),
_options = _splitProps[0],
htmlProps = _splitProps[1];
var _useHook = useHook(_options, Object(_rollupPluginBabelHelpers_0c84a174["a" /* _ */])({
ref: ref
}, htmlProps)),
wrapElement = _useHook.wrapElement,
elementProps = Object(_rollupPluginBabelHelpers_0c84a174["b" /* a */])(_useHook, ["wrapElement"]); // @ts-ignore
var asKeys = ((_as$render = as.render) === null || _as$render === void 0 ? void 0 : _as$render.__keys) || as.__keys;
var asOptions = asKeys && splitProps(props, asKeys)[0];
var allProps = asOptions ? Object(_rollupPluginBabelHelpers_0c84a174["a" /* _ */])(Object(_rollupPluginBabelHelpers_0c84a174["a" /* _ */])({}, elementProps), asOptions) : elementProps;
var _element = useCreateElement$1(as, allProps);
if (wrapElement) {
return wrapElement(_element);
}
return _element;
}
return useCreateElement$1(as, Object(_rollupPluginBabelHelpers_0c84a174["a" /* _ */])({
ref: ref
}, props));
};
if (false) {}
Comp = forwardRef(Comp);
if (shouldMemo) {
Comp = memo(Comp, propsAreEqual && normalizePropsAreEqual(propsAreEqual));
}
Comp.__keys = keys;
Comp.unstable_propsAreEqual = normalizePropsAreEqual(propsAreEqual || shallowEqual["a" /* shallowEqual */]);
return Comp;
}
/***/ }),
/***/ "hZ2/":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var bind = __webpack_require__("D3zA");
var GetIntrinsic = __webpack_require__("rZ7t");
var $apply = GetIntrinsic('%Function.prototype.apply%');
var $call = GetIntrinsic('%Function.prototype.call%');
var $reflectApply = GetIntrinsic('%Reflect.apply%', true) || bind.call($call, $apply);
var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%', true);
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
var $max = GetIntrinsic('%Math.max%');
if ($defineProperty) {
try {
$defineProperty({}, 'a', { value: 1 });
} catch (e) {
// IE 8 has a broken defineProperty
$defineProperty = null;
}
}
module.exports = function callBind(originalFunction) {
var func = $reflectApply(bind, $call, arguments);
if ($gOPD && $defineProperty) {
var desc = $gOPD(func, 'length');
if (desc.configurable) {
// original length, plus the receiver, minus any additional arguments (after the receiver)
$defineProperty(
func,
'length',
{ value: 1 + $max(0, originalFunction.length - (arguments.length - 1)) }
);
}
}
return func;
};
var applyBind = function applyBind() {
return $reflectApply(bind, $apply, arguments);
};
if ($defineProperty) {
$defineProperty(module.exports, 'apply', { value: applyBind });
} else {
module.exports.apply = applyBind;
}
/***/ }),
/***/ "i10q":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// https://ecma-international.org/ecma-262/6.0/#sec-ispropertykey
module.exports = function IsPropertyKey(argument) {
return typeof argument === 'string' || typeof argument === 'symbol';
};
/***/ }),
/***/ "iB/h":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* WEBPACK VAR INJECTION */(function(process) {/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("YLtl");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("TSYQ");
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var _wordpress_a11y__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("gdqT");
/* harmony import */ var _wordpress_a11y__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(_wordpress_a11y__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("l3Sj");
/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _wordpress_warning__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("Z23Y");
/* harmony import */ var _wordpress_warning__WEBPACK_IMPORTED_MODULE_5___default = /*#__PURE__*/__webpack_require__.n(_wordpress_warning__WEBPACK_IMPORTED_MODULE_5__);
/* harmony import */ var ___WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("kA6J");
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const NOTICE_TIMEOUT = 10000;
/** @typedef {import('@wordpress/element').WPElement} WPElement */
/**
* Custom hook which announces the message with the given politeness, if a
* valid message is provided.
*
* @param {string|WPElement} [message] Message to announce.
* @param {'polite'|'assertive'} politeness Politeness to announce.
*/
function useSpokenMessage(message, politeness) {
const spokenMessage = typeof message === 'string' ? message : Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["renderToString"])(message);
Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(() => {
if (spokenMessage) {
Object(_wordpress_a11y__WEBPACK_IMPORTED_MODULE_3__["speak"])(spokenMessage, politeness);
}
}, [spokenMessage, politeness]);
}
function Snackbar({
className,
children,
spokenMessage = children,
politeness = 'polite',
actions = [],
onRemove = lodash__WEBPACK_IMPORTED_MODULE_1__["noop"],
icon = null,
explicitDismiss = false,
// onDismiss is a callback executed when the snackbar is dismissed.
// It is distinct from onRemove, which _looks_ like a callback but is
// actually the function to call to remove the snackbar from the UI.
onDismiss = lodash__WEBPACK_IMPORTED_MODULE_1__["noop"]
}, ref) {
onDismiss = onDismiss || lodash__WEBPACK_IMPORTED_MODULE_1__["noop"];
function dismissMe(event) {
if (event && event.preventDefault) {
event.preventDefault();
}
onDismiss();
onRemove();
}
function onActionClick(event, onClick) {
event.stopPropagation();
onRemove();
if (onClick) {
onClick(event);
}
}
useSpokenMessage(spokenMessage, politeness); // Only set up the timeout dismiss if we're not explicitly dismissing.
Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(() => {
const timeoutHandle = setTimeout(() => {
if (!explicitDismiss) {
onDismiss();
onRemove();
}
}, NOTICE_TIMEOUT);
return () => clearTimeout(timeoutHandle);
}, [onDismiss, onRemove]);
const classes = classnames__WEBPACK_IMPORTED_MODULE_2___default()(className, 'components-snackbar', {
'components-snackbar-explicit-dismiss': !!explicitDismiss
});
if (actions && actions.length > 1) {
// we need to inform developers that snackbar only accepts 1 action
typeof process !== "undefined" && process.env && "production" !== "production" ? _wordpress_warning__WEBPACK_IMPORTED_MODULE_5___default()('Snackbar can only have 1 action, use Notice if your message require many messages') : void 0; // return first element only while keeping it inside an array
actions = [actions[0]];
}
const snackbarContentClassnames = classnames__WEBPACK_IMPORTED_MODULE_2___default()('components-snackbar__content', {
'components-snackbar__content-with-icon': !!icon
});
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", {
ref: ref,
className: classes,
onClick: !explicitDismiss ? dismissMe : lodash__WEBPACK_IMPORTED_MODULE_1__["noop"],
tabIndex: "0",
role: !explicitDismiss ? 'button' : '',
onKeyPress: !explicitDismiss ? dismissMe : lodash__WEBPACK_IMPORTED_MODULE_1__["noop"],
"aria-label": !explicitDismiss ? Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_4__["__"])('Dismiss this notice') : ''
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", {
className: snackbarContentClassnames
}, icon && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("div", {
className: "components-snackbar__icon"
}, icon), children, actions.map(({
label,
onClick,
url
}, index) => {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(___WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"], {
key: index,
href: url,
isTertiary: true,
onClick: event => onActionClick(event, onClick),
className: "components-snackbar__action"
}, label);
}), explicitDismiss && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])("span", {
role: "button",
"aria-label": "Dismiss this notice",
tabIndex: "0",
className: "components-snackbar__dismiss-button",
onClick: dismissMe,
onKeyPress: dismissMe
}, "\u2715")));
}
/* harmony default export */ __webpack_exports__["a"] = (Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["forwardRef"])(Snackbar));
/* WEBPACK VAR INJECTION */}.call(this, __webpack_require__("8oxB")))
/***/ }),
/***/ "iClF":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/**
* WordPress dependencies
*/
/** @typedef {{icon: JSX.Element, size?: number} & import('@wordpress/primitives').SVGProps} IconProps */
/**
* Return an SVG icon.
*
* @param {IconProps} props icon is the SVG component to render
* size is a number specifiying the icon size in pixels
* Other props will be passed to wrapped SVG component
*
* @return {JSX.Element} Icon component
*/
function Icon({
icon,
size = 24,
...props
}) {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["cloneElement"])(icon, {
width: size,
height: size,
...props
});
}
/* harmony default export */ __webpack_exports__["a"] = (Icon);
/***/ }),
/***/ "iNdV":
/***/ (function(module, exports) {
var messages = {
invalidPredicate: '`predicate` must be a function',
invalidPropValidator: '`propValidator` must be a function',
requiredCore: 'is marked as required',
invalidTypeCore: 'Invalid input type',
predicateFailureCore: 'Failed to succeed with predicate',
anonymousMessage: '<<anonymous>>',
baseInvalidMessage: 'Invalid ',
};
function constructPropValidatorVariations(propValidator) {
if (typeof propValidator !== 'function') {
throw new Error(messages.invalidPropValidator);
}
var requiredPropValidator = propValidator.bind(null, false, null);
requiredPropValidator.isRequired = propValidator.bind(null, true, null);
requiredPropValidator.withPredicate = function predicateApplication(predicate) {
if (typeof predicate !== 'function') {
throw new Error(messages.invalidPredicate);
}
var basePropValidator = propValidator.bind(null, false, predicate);
basePropValidator.isRequired = propValidator.bind(null, true, predicate);
return basePropValidator;
};
return requiredPropValidator;
}
function createInvalidRequiredErrorMessage(propName, componentName, value) {
return new Error(
'The prop `' + propName + '` ' + messages.requiredCore +
' in `' + componentName + '`, but its value is `' + value + '`.'
);
}
var independentGuardianValue = -1;
function preValidationRequireCheck(isRequired, componentName, propFullName, propValue) {
var isPropValueUndefined = typeof propValue === 'undefined';
var isPropValueNull = propValue === null;
if (isRequired) {
if (isPropValueUndefined) {
return createInvalidRequiredErrorMessage(propFullName, componentName, 'undefined');
} else if (isPropValueNull) {
return createInvalidRequiredErrorMessage(propFullName, componentName, 'null');
}
}
if (isPropValueUndefined || isPropValueNull) {
return null;
}
return independentGuardianValue;
}
function createMomentChecker(type, typeValidator, validator, momentType) {
function propValidator(
isRequired, // Bound parameter to indicate with the propType is required
predicate, // Bound parameter to allow user to add dynamic validation
props,
propName,
componentName,
location,
propFullName
) {
var propValue = props[ propName ];
var propType = typeof propValue;
componentName = componentName || messages.anonymousMessage;
propFullName = propFullName || propName;
var preValidationRequireCheckValue = preValidationRequireCheck(
isRequired, componentName, propFullName, propValue
);
if (preValidationRequireCheckValue !== independentGuardianValue) {
return preValidationRequireCheckValue;
}
if (typeValidator && !typeValidator(propValue)) {
return new Error(
messages.invalidTypeCore + ': `' + propName + '` of type `' + propType + '` ' +
'supplied to `' + componentName + '`, expected `' + type + '`.'
);
}
if (!validator(propValue)) {
return new Error(
messages.baseInvalidMessage + location + ' `' + propName + '` of type `' + propType + '` ' +
'supplied to `' + componentName + '`, expected `' + momentType + '`.'
);
}
if (predicate && !predicate(propValue)) {
var predicateName = predicate.name || messages.anonymousMessage;
return new Error(
messages.baseInvalidMessage + location + ' `' + propName + '` of type `' + propType + '` ' +
'supplied to `' + componentName + '`. ' + messages.predicateFailureCore + ' `' +
predicateName + '`.'
);
}
return null;
}
return constructPropValidatorVariations(propValidator);
}
module.exports = {
constructPropValidatorVariations: constructPropValidatorVariations,
createMomentChecker: createMomentChecker,
messages: messages,
};
/***/ }),
/***/ "iYXd":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return findFirstEnabledItem; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getCurrentId; });
function findFirstEnabledItem(items, excludeId) {
if (excludeId) {
return items.find(function (item) {
return !item.disabled && item.id !== excludeId;
});
}
return items.find(function (item) {
return !item.disabled;
});
}
function getCurrentId(options, passedId) {
var _findFirstEnabledItem;
if (passedId || passedId === null) {
return passedId;
}
if (options.currentId || options.currentId === null) {
return options.currentId;
}
return (_findFirstEnabledItem = findFirstEnabledItem(options.items || [])) === null || _findFirstEnabledItem === void 0 ? void 0 : _findFirstEnabledItem.id;
}
/***/ }),
/***/ "ib7Q":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var getPolyfill = __webpack_require__("xoj2");
var define = __webpack_require__("82c2");
module.exports = function shimValues() {
var polyfill = getPolyfill();
define(Object, { values: polyfill }, {
values: function testValues() {
return Object.values !== polyfill;
}
});
return polyfill;
};
/***/ }),
/***/ "ixyq":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = calculateDimension;
function calculateDimension(el, axis) {
var borderBox = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
var withMargin = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
if (!el) {
return 0;
}
var axisStart = axis === 'width' ? 'Left' : 'Top';
var axisEnd = axis === 'width' ? 'Right' : 'Bottom';
// Only read styles if we need to
var style = !borderBox || withMargin ? window.getComputedStyle(el) : null;
// Offset includes border and padding
var offsetWidth = el.offsetWidth,
offsetHeight = el.offsetHeight;
var size = axis === 'width' ? offsetWidth : offsetHeight;
// Get the inner size
if (!borderBox) {
size -= parseFloat(style['padding' + axisStart]) + parseFloat(style['padding' + axisEnd]) + parseFloat(style['border' + axisStart + 'Width']) + parseFloat(style['border' + axisEnd + 'Width']);
}
// Apply margin
if (withMargin) {
size += parseFloat(style['margin' + axisStart]) + parseFloat(style['margin' + axisEnd]);
}
return size;
}
/***/ }),
/***/ "iz0l":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $TypeError = GetIntrinsic('%TypeError%');
var MAX_SAFE_INTEGER = __webpack_require__("yyeE");
var Call = __webpack_require__("fW1L");
var CreateDataPropertyOrThrow = __webpack_require__("WvKp");
var Get = __webpack_require__("3aeR");
var HasProperty = __webpack_require__("aenO");
var IsArray = __webpack_require__("9cOx");
var LengthOfArrayLike = __webpack_require__("y9oe");
var ToString = __webpack_require__("Hx/O");
// https://262.ecma-international.org/11.0/#sec-flattenintoarray
// eslint-disable-next-line max-params
module.exports = function FlattenIntoArray(target, source, sourceLen, start, depth) {
var mapperFunction;
if (arguments.length > 5) {
mapperFunction = arguments[5];
}
var targetIndex = start;
var sourceIndex = 0;
while (sourceIndex < sourceLen) {
var P = ToString(sourceIndex);
var exists = HasProperty(source, P);
if (exists === true) {
var element = Get(source, P);
if (typeof mapperFunction !== 'undefined') {
if (arguments.length <= 6) {
throw new $TypeError('Assertion failed: thisArg is required when mapperFunction is provided');
}
element = Call(mapperFunction, arguments[6], [element, sourceIndex, source]);
}
var shouldFlatten = false;
if (depth > 0) {
shouldFlatten = IsArray(element);
}
if (shouldFlatten) {
var elementLen = LengthOfArrayLike(element);
targetIndex = FlattenIntoArray(target, element, elementLen, targetIndex, depth - 1);
} else {
if (targetIndex >= MAX_SAFE_INTEGER) {
throw new $TypeError('index too large');
}
CreateDataPropertyOrThrow(target, ToString(targetIndex), element);
targetIndex += 1;
}
}
sourceIndex += 1;
}
return targetIndex;
};
/***/ }),
/***/ "jB5C":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; };
var RE_NUM = /[\-+]?(?:\d*\.|)\d+(?:[eE][\-+]?\d+|)/.source;
function getClientPosition(elem) {
var box = undefined;
var x = undefined;
var y = undefined;
var doc = elem.ownerDocument;
var body = doc.body;
var docElem = doc && doc.documentElement;
// 根据 GBS 最新数据A-Grade Browsers 都已支持 getBoundingClientRect 方法,不用再考虑传统的实现方式
box = elem.getBoundingClientRect();
// 注jQuery 还考虑减去 docElem.clientLeft/clientTop
// 但测试发现,这样反而会导致当 html 和 body 有边距/边框样式时,获取的值不正确
// 此外ie6 会忽略 html 的 margin 值,幸运地是没有谁会去设置 html 的 margin
x = box.left;
y = box.top;
// In IE, most of the time, 2 extra pixels are added to the top and left
// due to the implicit 2-pixel inset border. In IE6/7 quirks mode and
// IE6 standards mode, this border can be overridden by setting the
// document element's border to zero -- thus, we cannot rely on the
// offset always being 2 pixels.
// In quirks mode, the offset can be determined by querying the body's
// clientLeft/clientTop, but in standards mode, it is found by querying
// the document element's clientLeft/clientTop. Since we already called
// getClientBoundingRect we have already forced a reflow, so it is not
// too expensive just to query them all.
// ie 下应该减去窗口的边框吧,毕竟默认 absolute 都是相对窗口定位的
// 窗口边框标准是设 documentElement ,quirks 时设置 body
// 最好禁止在 body 和 html 上边框 ,但 ie < 9 html 默认有 2px ,减去
// 但是非 ie 不可能设置窗口边框body html 也不是窗口 ,ie 可以通过 html,body 设置
// 标准 ie 下 docElem.clientTop 就是 border-top
// ie7 html 即窗口边框改变不了。永远为 2
// 但标准 firefox/chrome/ie9 下 docElem.clientTop 是窗口边框,即使设了 border-top 也为 0
x -= docElem.clientLeft || body.clientLeft || 0;
y -= docElem.clientTop || body.clientTop || 0;
return {
left: x,
top: y
};
}
function getScroll(w, top) {
var ret = w['page' + (top ? 'Y' : 'X') + 'Offset'];
var method = 'scroll' + (top ? 'Top' : 'Left');
if (typeof ret !== 'number') {
var d = w.document;
// ie6,7,8 standard mode
ret = d.documentElement[method];
if (typeof ret !== 'number') {
// quirks mode
ret = d.body[method];
}
}
return ret;
}
function getScrollLeft(w) {
return getScroll(w);
}
function getScrollTop(w) {
return getScroll(w, true);
}
function getOffset(el) {
var pos = getClientPosition(el);
var doc = el.ownerDocument;
var w = doc.defaultView || doc.parentWindow;
pos.left += getScrollLeft(w);
pos.top += getScrollTop(w);
return pos;
}
function _getComputedStyle(elem, name, computedStyle_) {
var val = '';
var d = elem.ownerDocument;
var computedStyle = computedStyle_ || d.defaultView.getComputedStyle(elem, null);
// https://github.com/kissyteam/kissy/issues/61
if (computedStyle) {
val = computedStyle.getPropertyValue(name) || computedStyle[name];
}
return val;
}
var _RE_NUM_NO_PX = new RegExp('^(' + RE_NUM + ')(?!px)[a-z%]+$', 'i');
var RE_POS = /^(top|right|bottom|left)$/;
var CURRENT_STYLE = 'currentStyle';
var RUNTIME_STYLE = 'runtimeStyle';
var LEFT = 'left';
var PX = 'px';
function _getComputedStyleIE(elem, name) {
// currentStyle maybe null
// http://msdn.microsoft.com/en-us/library/ms535231.aspx
var ret = elem[CURRENT_STYLE] && elem[CURRENT_STYLE][name];
// 当 width/height 设置为百分比时,通过 pixelLeft 方式转换的 width/height 值
// 一开始就处理了! CUSTOM_STYLE.height,CUSTOM_STYLE.width ,cssHook 解决@2011-08-19
// 在 ie 下不对,需要直接用 offset 方式
// borderWidth 等值也有问题,但考虑到 borderWidth 设为百分比的概率很小,这里就不考虑了
// From the awesome hack by Dean Edwards
// http://erik.eae.net/archives/2007/07/27/18.54.15/#comment-102291
// If we're not dealing with a regular pixel number
// but a number that has a weird ending, we need to convert it to pixels
// exclude left right for relativity
if (_RE_NUM_NO_PX.test(ret) && !RE_POS.test(name)) {
// Remember the original values
var style = elem.style;
var left = style[LEFT];
var rsLeft = elem[RUNTIME_STYLE][LEFT];
// prevent flashing of content
elem[RUNTIME_STYLE][LEFT] = elem[CURRENT_STYLE][LEFT];
// Put in the new values to get a computed value out
style[LEFT] = name === 'fontSize' ? '1em' : ret || 0;
ret = style.pixelLeft + PX;
// Revert the changed values
style[LEFT] = left;
elem[RUNTIME_STYLE][LEFT] = rsLeft;
}
return ret === '' ? 'auto' : ret;
}
var getComputedStyleX = undefined;
if (typeof window !== 'undefined') {
getComputedStyleX = window.getComputedStyle ? _getComputedStyle : _getComputedStyleIE;
}
function each(arr, fn) {
for (var i = 0; i < arr.length; i++) {
fn(arr[i]);
}
}
function isBorderBoxFn(elem) {
return getComputedStyleX(elem, 'boxSizing') === 'border-box';
}
var BOX_MODELS = ['margin', 'border', 'padding'];
var CONTENT_INDEX = -1;
var PADDING_INDEX = 2;
var BORDER_INDEX = 1;
var MARGIN_INDEX = 0;
function swap(elem, options, callback) {
var old = {};
var style = elem.style;
var name = undefined;
// Remember the old values, and insert the new ones
for (name in options) {
if (options.hasOwnProperty(name)) {
old[name] = style[name];
style[name] = options[name];
}
}
callback.call(elem);
// Revert the old values
for (name in options) {
if (options.hasOwnProperty(name)) {
style[name] = old[name];
}
}
}
function getPBMWidth(elem, props, which) {
var value = 0;
var prop = undefined;
var j = undefined;
var i = undefined;
for (j = 0; j < props.length; j++) {
prop = props[j];
if (prop) {
for (i = 0; i < which.length; i++) {
var cssProp = undefined;
if (prop === 'border') {
cssProp = prop + which[i] + 'Width';
} else {
cssProp = prop + which[i];
}
value += parseFloat(getComputedStyleX(elem, cssProp)) || 0;
}
}
}
return value;
}
/**
* A crude way of determining if an object is a window
* @member util
*/
function isWindow(obj) {
// must use == for ie8
/* eslint eqeqeq:0 */
return obj != null && obj == obj.window;
}
var domUtils = {};
each(['Width', 'Height'], function (name) {
domUtils['doc' + name] = function (refWin) {
var d = refWin.document;
return Math.max(
// firefox chrome documentElement.scrollHeight< body.scrollHeight
// ie standard mode : documentElement.scrollHeight> body.scrollHeight
d.documentElement['scroll' + name],
// quirks : documentElement.scrollHeight 最大等于可视窗口多一点?
d.body['scroll' + name], domUtils['viewport' + name](d));
};
domUtils['viewport' + name] = function (win) {
// pc browser includes scrollbar in window.innerWidth
var prop = 'client' + name;
var doc = win.document;
var body = doc.body;
var documentElement = doc.documentElement;
var documentElementProp = documentElement[prop];
// 标准模式取 documentElement
// backcompat 取 body
return doc.compatMode === 'CSS1Compat' && documentElementProp || body && body[prop] || documentElementProp;
};
});
/*
得到元素的大小信息
@param elem
@param name
@param {String} [extra] 'padding' : (css width) + padding
'border' : (css width) + padding + border
'margin' : (css width) + padding + border + margin
*/
function getWH(elem, name, extra) {
if (isWindow(elem)) {
return name === 'width' ? domUtils.viewportWidth(elem) : domUtils.viewportHeight(elem);
} else if (elem.nodeType === 9) {
return name === 'width' ? domUtils.docWidth(elem) : domUtils.docHeight(elem);
}
var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
var borderBoxValue = name === 'width' ? elem.offsetWidth : elem.offsetHeight;
var computedStyle = getComputedStyleX(elem);
var isBorderBox = isBorderBoxFn(elem, computedStyle);
var cssBoxValue = 0;
if (borderBoxValue == null || borderBoxValue <= 0) {
borderBoxValue = undefined;
// Fall back to computed then un computed css if necessary
cssBoxValue = getComputedStyleX(elem, name);
if (cssBoxValue == null || Number(cssBoxValue) < 0) {
cssBoxValue = elem.style[name] || 0;
}
// Normalize '', auto, and prepare for extra
cssBoxValue = parseFloat(cssBoxValue) || 0;
}
if (extra === undefined) {
extra = isBorderBox ? BORDER_INDEX : CONTENT_INDEX;
}
var borderBoxValueOrIsBorderBox = borderBoxValue !== undefined || isBorderBox;
var val = borderBoxValue || cssBoxValue;
if (extra === CONTENT_INDEX) {
if (borderBoxValueOrIsBorderBox) {
return val - getPBMWidth(elem, ['border', 'padding'], which, computedStyle);
}
return cssBoxValue;
}
if (borderBoxValueOrIsBorderBox) {
var padding = extra === PADDING_INDEX ? -getPBMWidth(elem, ['border'], which, computedStyle) : getPBMWidth(elem, ['margin'], which, computedStyle);
return val + (extra === BORDER_INDEX ? 0 : padding);
}
return cssBoxValue + getPBMWidth(elem, BOX_MODELS.slice(extra), which, computedStyle);
}
var cssShow = {
position: 'absolute',
visibility: 'hidden',
display: 'block'
};
// fix #119 : https://github.com/kissyteam/kissy/issues/119
function getWHIgnoreDisplay(elem) {
var val = undefined;
var args = arguments;
// in case elem is window
// elem.offsetWidth === undefined
if (elem.offsetWidth !== 0) {
val = getWH.apply(undefined, args);
} else {
swap(elem, cssShow, function () {
val = getWH.apply(undefined, args);
});
}
return val;
}
function css(el, name, v) {
var value = v;
if ((typeof name === 'undefined' ? 'undefined' : _typeof(name)) === 'object') {
for (var i in name) {
if (name.hasOwnProperty(i)) {
css(el, i, name[i]);
}
}
return undefined;
}
if (typeof value !== 'undefined') {
if (typeof value === 'number') {
value += 'px';
}
el.style[name] = value;
return undefined;
}
return getComputedStyleX(el, name);
}
each(['width', 'height'], function (name) {
var first = name.charAt(0).toUpperCase() + name.slice(1);
domUtils['outer' + first] = function (el, includeMargin) {
return el && getWHIgnoreDisplay(el, name, includeMargin ? MARGIN_INDEX : BORDER_INDEX);
};
var which = name === 'width' ? ['Left', 'Right'] : ['Top', 'Bottom'];
domUtils[name] = function (elem, val) {
if (val !== undefined) {
if (elem) {
var computedStyle = getComputedStyleX(elem);
var isBorderBox = isBorderBoxFn(elem);
if (isBorderBox) {
val += getPBMWidth(elem, ['padding', 'border'], which, computedStyle);
}
return css(elem, name, val);
}
return undefined;
}
return elem && getWHIgnoreDisplay(elem, name, CONTENT_INDEX);
};
});
// 设置 elem 相对 elem.ownerDocument 的坐标
function setOffset(elem, offset) {
// set position first, in-case top/left are set even on static elem
if (css(elem, 'position') === 'static') {
elem.style.position = 'relative';
}
var old = getOffset(elem);
var ret = {};
var current = undefined;
var key = undefined;
for (key in offset) {
if (offset.hasOwnProperty(key)) {
current = parseFloat(css(elem, key)) || 0;
ret[key] = current + offset[key] - old[key];
}
}
css(elem, ret);
}
module.exports = _extends({
getWindow: function getWindow(node) {
var doc = node.ownerDocument || node;
return doc.defaultView || doc.parentWindow;
},
offset: function offset(el, value) {
if (typeof value !== 'undefined') {
setOffset(el, value);
} else {
return getOffset(el);
}
},
isWindow: isWindow,
each: each,
css: css,
clone: function clone(obj) {
var ret = {};
for (var i in obj) {
if (obj.hasOwnProperty(i)) {
ret[i] = obj[i];
}
}
var overflow = obj.overflow;
if (overflow) {
for (var i in obj) {
if (obj.hasOwnProperty(i)) {
ret.overflow[i] = obj.overflow[i];
}
}
}
return ret;
},
scrollLeft: function scrollLeft(w, v) {
if (isWindow(w)) {
if (v === undefined) {
return getScrollLeft(w);
}
window.scrollTo(v, getScrollTop(w));
} else {
if (v === undefined) {
return w.scrollLeft;
}
w.scrollLeft = v;
}
},
scrollTop: function scrollTop(w, v) {
if (isWindow(w)) {
if (v === undefined) {
return getScrollTop(w);
}
window.scrollTo(getScrollLeft(w), v);
} else {
if (v === undefined) {
return w.scrollTop;
}
w.scrollTop = v;
}
},
viewportWidth: 0,
viewportHeight: 0
}, domUtils);
/***/ }),
/***/ "jXQH":
/***/ (function(module, exports, __webpack_require__) {
var trimmedEndIndex = __webpack_require__("TO8r");
/** Used to match leading whitespace. */
var reTrimStart = /^\s+/;
/**
* The base implementation of `_.trim`.
*
* @private
* @param {string} string The string to trim.
* @returns {string} Returns the trimmed string.
*/
function baseTrim(string) {
return string
? string.slice(0, trimmedEndIndex(string) + 1).replace(reTrimStart, '')
: string;
}
module.exports = baseTrim;
/***/ }),
/***/ "jenk":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = toISOMonthString;
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _toMomentObject = __webpack_require__("WmS1");
var _toMomentObject2 = _interopRequireDefault(_toMomentObject);
var _constants = __webpack_require__("Fv1B");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function toISOMonthString(date, currentFormat) {
var dateObj = _moment2['default'].isMoment(date) ? date : (0, _toMomentObject2['default'])(date, currentFormat);
if (!dateObj) return null;
return dateObj.format(_constants.ISO_MONTH_FORMAT);
}
/***/ }),
/***/ "k2cL":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isSelfTarget; });
/**
* Returns `true` if `event.target` and `event.currentTarget` are the same.
*/
function isSelfTarget(event) {
return event.target === event.currentTarget;
}
/***/ }),
/***/ "k8OV":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ScrollLock; });
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/**
* WordPress dependencies
*/
/*
* Setting `overflow: hidden` on html and body elements resets body scroll in iOS.
* Save scroll top so we can restore it after locking scroll.
*
* NOTE: It would be cleaner and possibly safer to find a localized solution such
* as preventing default on certain touchmove events.
*/
let previousScrollTop = 0;
/**
* @param {boolean} locked
*/
function setLocked(locked) {
const scrollingElement = document.scrollingElement || document.body;
if (locked) {
previousScrollTop = scrollingElement.scrollTop;
}
const methodName = locked ? 'add' : 'remove';
scrollingElement.classList[methodName]('lockscroll'); // Adding the class to the document element seems to be necessary in iOS.
document.documentElement.classList[methodName]('lockscroll');
if (!locked) {
scrollingElement.scrollTop = previousScrollTop;
}
}
let lockCounter = 0;
/**
* A component that will lock scrolling when it is mounted and unlock scrolling when it is unmounted.
*
* @return {null} Render nothing.
*/
function ScrollLock() {
Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["useEffect"])(() => {
if (lockCounter === 0) {
setLocked(true);
}
++lockCounter;
return () => {
if (lockCounter === 1) {
setLocked(false);
}
--lockCounter;
};
}, []);
return null;
}
/***/ }),
/***/ "kA6J":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export Button */
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("wx14");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("TSYQ");
/* harmony import */ var classnames__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(classnames__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("YLtl");
/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("NMb1");
/* harmony import */ var _wordpress_deprecated__WEBPACK_IMPORTED_MODULE_4___default = /*#__PURE__*/__webpack_require__.n(_wordpress_deprecated__WEBPACK_IMPORTED_MODULE_4__);
/* harmony import */ var _tooltip__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("W/NR");
/* harmony import */ var _icon__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("9VDH");
/* harmony import */ var _visually_hidden__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("ldlY");
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
const disabledEventsOnDisabledButton = ['onMouseDown', 'onClick'];
function Button(props, ref) {
const {
href,
target,
isPrimary,
isSmall,
isTertiary,
isPressed,
isBusy,
isDefault,
isSecondary,
isLink,
isDestructive,
className,
disabled,
icon,
iconPosition = 'left',
iconSize,
showTooltip,
tooltipPosition,
shortcut,
label,
children,
text,
__experimentalIsFocusable: isFocusable,
describedBy,
...additionalProps
} = props;
if (isDefault) {
_wordpress_deprecated__WEBPACK_IMPORTED_MODULE_4___default()('Button isDefault prop', {
since: '5.4',
alternative: 'isSecondary'
});
}
const classes = classnames__WEBPACK_IMPORTED_MODULE_2___default()('components-button', className, {
'is-secondary': isDefault || isSecondary,
'is-primary': isPrimary,
'is-small': isSmall,
'is-tertiary': isTertiary,
'is-pressed': isPressed,
'is-busy': isBusy,
'is-link': isLink,
'is-destructive': isDestructive,
'has-text': !!icon && !!children,
'has-icon': !!icon
});
const trulyDisabled = disabled && !isFocusable;
const Tag = href !== undefined && !trulyDisabled ? 'a' : 'button';
const tagProps = Tag === 'a' ? {
href,
target
} : {
type: 'button',
disabled: trulyDisabled,
'aria-pressed': isPressed
};
if (disabled && isFocusable) {
// In this case, the button will be disabled, but still focusable and
// perceivable by screen reader users.
tagProps['aria-disabled'] = true;
for (const disabledEvent of disabledEventsOnDisabledButton) {
additionalProps[disabledEvent] = event => {
event.stopPropagation();
event.preventDefault();
};
}
} // Should show the tooltip if...
const shouldShowTooltip = !trulyDisabled && ( // an explicit tooltip is passed or...
showTooltip && label || // there's a shortcut or...
shortcut || // there's a label and...
!!label && ( // the children are empty and...
!children || Object(lodash__WEBPACK_IMPORTED_MODULE_3__["isArray"])(children) && !children.length) && // the tooltip is not explicitly disabled.
false !== showTooltip);
const descriptionId = describedBy ? Object(lodash__WEBPACK_IMPORTED_MODULE_3__["uniqueId"])() : null;
const describedById = additionalProps['aria-describedby'] || descriptionId;
const element = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(Tag, Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])({}, tagProps, additionalProps, {
className: classes,
"aria-label": additionalProps['aria-label'] || label,
"aria-describedby": describedById,
ref: ref
}), icon && iconPosition === 'left' && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_icon__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"], {
icon: icon,
size: iconSize
}), text && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["Fragment"], null, text), icon && iconPosition === 'right' && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_icon__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"], {
icon: icon,
size: iconSize
}), children);
if (!shouldShowTooltip) {
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["Fragment"], null, element, describedBy && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_visually_hidden__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])("span", {
id: descriptionId
}, describedBy)));
}
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["Fragment"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_tooltip__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"], {
text: describedBy ? describedBy : label,
shortcut: shortcut,
position: tooltipPosition
}, element), describedBy && Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])(_visually_hidden__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"], null, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])("span", {
id: descriptionId
}, describedBy)));
}
/* harmony default export */ __webpack_exports__["a"] = (Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(Button));
/***/ }),
/***/ "kDDq":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ emotion_esm_css; });
__webpack_require__.d(__webpack_exports__, "b", function() { return /* binding */ emotion_esm_cx; });
// UNUSED EXPORTS: cache, flush, getRegisteredStyles, hydrate, injectGlobal, keyframes, merge, sheet
// EXTERNAL MODULE: ./node_modules/@emotion/cache/dist/cache.browser.esm.js + 2 modules
var cache_browser_esm = __webpack_require__("TqVZ");
// EXTERNAL MODULE: ./node_modules/@emotion/serialize/dist/serialize.browser.esm.js + 2 modules
var serialize_browser_esm = __webpack_require__("MiSq");
// EXTERNAL MODULE: ./node_modules/@emotion/utils/dist/utils.browser.esm.js
var utils_browser_esm = __webpack_require__("SIPS");
// CONCATENATED MODULE: ./node_modules/create-emotion/dist/create-emotion.browser.esm.js
function insertWithoutScoping(cache, serialized) {
if (cache.inserted[serialized.name] === undefined) {
return cache.insert('', serialized, cache.sheet, true);
}
}
function merge(registered, css, className) {
var registeredStyles = [];
var rawClassName = Object(utils_browser_esm["a" /* getRegisteredStyles */])(registered, registeredStyles, className);
if (registeredStyles.length < 2) {
return className;
}
return rawClassName + css(registeredStyles);
}
var create_emotion_browser_esm_createEmotion = function createEmotion(options) {
var cache = Object(cache_browser_esm["a" /* default */])(options); // $FlowFixMe
cache.sheet.speedy = function (value) {
if (false) {}
this.isSpeedy = value;
};
cache.compat = true;
var css = function css() {
for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var serialized = Object(serialize_browser_esm["a" /* serializeStyles */])(args, cache.registered, undefined);
Object(utils_browser_esm["b" /* insertStyles */])(cache, serialized, false);
return cache.key + "-" + serialized.name;
};
var keyframes = function keyframes() {
for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
var serialized = Object(serialize_browser_esm["a" /* serializeStyles */])(args, cache.registered);
var animation = "animation-" + serialized.name;
insertWithoutScoping(cache, {
name: serialized.name,
styles: "@keyframes " + animation + "{" + serialized.styles + "}"
});
return animation;
};
var injectGlobal = function injectGlobal() {
for (var _len3 = arguments.length, args = new Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
args[_key3] = arguments[_key3];
}
var serialized = Object(serialize_browser_esm["a" /* serializeStyles */])(args, cache.registered);
insertWithoutScoping(cache, serialized);
};
var cx = function cx() {
for (var _len4 = arguments.length, args = new Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
args[_key4] = arguments[_key4];
}
return merge(cache.registered, css, classnames(args));
};
return {
css: css,
cx: cx,
injectGlobal: injectGlobal,
keyframes: keyframes,
hydrate: function hydrate(ids) {
ids.forEach(function (key) {
cache.inserted[key] = true;
});
},
flush: function flush() {
cache.registered = {};
cache.inserted = {};
cache.sheet.flush();
},
// $FlowFixMe
sheet: cache.sheet,
cache: cache,
getRegisteredStyles: utils_browser_esm["a" /* getRegisteredStyles */].bind(null, cache.registered),
merge: merge.bind(null, cache.registered, css)
};
};
var classnames = function classnames(args) {
var cls = '';
for (var i = 0; i < args.length; i++) {
var arg = args[i];
if (arg == null) continue;
var toAdd = void 0;
switch (typeof arg) {
case 'boolean':
break;
case 'object':
{
if (Array.isArray(arg)) {
toAdd = classnames(arg);
} else {
toAdd = '';
for (var k in arg) {
if (arg[k] && k) {
toAdd && (toAdd += ' ');
toAdd += k;
}
}
}
break;
}
default:
{
toAdd = arg;
}
}
if (toAdd) {
cls && (cls += ' ');
cls += toAdd;
}
}
return cls;
};
/* harmony default export */ var create_emotion_browser_esm = (create_emotion_browser_esm_createEmotion);
// CONCATENATED MODULE: ./node_modules/emotion/dist/emotion.esm.js
var _createEmotion = create_emotion_browser_esm(),
flush = _createEmotion.flush,
hydrate = _createEmotion.hydrate,
emotion_esm_cx = _createEmotion.cx,
emotion_esm_merge = _createEmotion.merge,
getRegisteredStyles = _createEmotion.getRegisteredStyles,
emotion_esm_injectGlobal = _createEmotion.injectGlobal,
emotion_esm_keyframes = _createEmotion.keyframes,
emotion_esm_css = _createEmotion.css,
sheet = _createEmotion.sheet,
emotion_esm_cache = _createEmotion.cache;
/***/ }),
/***/ "kFtd":
/***/ (function(module, exports) {
Object.defineProperty(exports, "__esModule", {
value: true
});
var GLOBAL_CACHE_KEY = 'reactWithStylesInterfaceCSS';
var MAX_SPECIFICITY = 20;
exports.GLOBAL_CACHE_KEY = GLOBAL_CACHE_KEY;
exports.MAX_SPECIFICITY = MAX_SPECIFICITY;
/***/ }),
/***/ "kTC8":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return CompositeItem; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return useCompositeItem; });
/* harmony import */ var _rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("BZp5");
/* harmony import */ var reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("hE48");
/* harmony import */ var reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("qdes");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("cDcd");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var reakit_utils_useForkRef__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("aU41");
/* harmony import */ var reakit_warning__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("KA1K");
/* harmony import */ var reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__("eNtd");
/* harmony import */ var reakit_utils_isSelfTarget__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__("k2cL");
/* harmony import */ var reakit_utils_hasFocusWithin__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__("PcHe");
/* harmony import */ var reakit_utils_isPortalEvent__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__("Vq1w");
/* harmony import */ var _Clickable_Clickable_js__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__("JLmN");
/* harmony import */ var reakit_utils_getDocument__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__("ouKs");
/* harmony import */ var _getCurrentId_5aa9849e_js__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__("iYXd");
/* harmony import */ var _keys_6742f591_js__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__("TFuP");
/* harmony import */ var _userFocus_e16425e3_js__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__("Mih7");
/* harmony import */ var reakit_utils_isTextField__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__("4po3");
/* harmony import */ var reakit_utils_ensureFocus__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__("AClM");
/* harmony import */ var _Id_Id_js__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__("ym77");
/* harmony import */ var _setTextFieldValue_0a221f4e_js__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__("0HL0");
function getWidget(itemElement) {
return itemElement.querySelector("[data-composite-item-widget]");
}
function useItem(options) {
return Object(react__WEBPACK_IMPORTED_MODULE_3__["useMemo"])(function () {
var _options$items;
return (_options$items = options.items) === null || _options$items === void 0 ? void 0 : _options$items.find(function (item) {
return options.id && item.id === options.id;
});
}, [options.items, options.id]);
}
function targetIsAnotherItem(event, items) {
if (Object(reakit_utils_isSelfTarget__WEBPACK_IMPORTED_MODULE_7__[/* isSelfTarget */ "a"])(event)) return false;
for (var _iterator = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* b */ "c"])(items), _step; !(_step = _iterator()).done;) {
var item = _step.value;
if (item.ref.current === event.target) {
return true;
}
}
return false;
}
var useCompositeItem = Object(reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__[/* createHook */ "a"])({
name: "CompositeItem",
compose: [_Clickable_Clickable_js__WEBPACK_IMPORTED_MODULE_10__[/* useClickable */ "a"], _Id_Id_js__WEBPACK_IMPORTED_MODULE_17__[/* unstable_useId */ "a"]],
keys: _keys_6742f591_js__WEBPACK_IMPORTED_MODULE_13__[/* b */ "c"],
propsAreEqual: function propsAreEqual(prev, next) {
if (!next.id || prev.id !== next.id) {
return _Clickable_Clickable_js__WEBPACK_IMPORTED_MODULE_10__[/* useClickable */ "a"].unstable_propsAreEqual(prev, next);
}
var prevCurrentId = prev.currentId,
prevMoves = prev.unstable_moves,
prevProps = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(prev, ["currentId", "unstable_moves"]);
var nextCurrentId = next.currentId,
nextMoves = next.unstable_moves,
nextProps = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(next, ["currentId", "unstable_moves"]);
if (nextCurrentId !== prevCurrentId) {
if (next.id === nextCurrentId || next.id === prevCurrentId) {
return false;
}
} else if (prevMoves !== nextMoves) {
return false;
}
return _Clickable_Clickable_js__WEBPACK_IMPORTED_MODULE_10__[/* useClickable */ "a"].unstable_propsAreEqual(prevProps, nextProps);
},
useOptions: function useOptions(options) {
return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, options), {}, {
id: options.id,
currentId: Object(_getCurrentId_5aa9849e_js__WEBPACK_IMPORTED_MODULE_12__[/* g */ "b"])(options),
unstable_clickOnSpace: options.unstable_hasActiveWidget ? false : options.unstable_clickOnSpace
});
},
useProps: function useProps(options, _ref) {
var _options$items2;
var htmlRef = _ref.ref,
_ref$tabIndex = _ref.tabIndex,
htmlTabIndex = _ref$tabIndex === void 0 ? 0 : _ref$tabIndex,
htmlOnMouseDown = _ref.onMouseDown,
htmlOnFocus = _ref.onFocus,
htmlOnBlurCapture = _ref.onBlurCapture,
htmlOnKeyDown = _ref.onKeyDown,
htmlOnClick = _ref.onClick,
htmlProps = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(_ref, ["ref", "tabIndex", "onMouseDown", "onFocus", "onBlurCapture", "onKeyDown", "onClick"]);
var ref = Object(react__WEBPACK_IMPORTED_MODULE_3__["useRef"])(null);
var id = options.id;
var trulyDisabled = options.disabled && !options.focusable;
var isCurrentItem = options.currentId === id;
var isCurrentItemRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_6__[/* useLiveRef */ "a"])(isCurrentItem);
var hasFocusedComposite = Object(react__WEBPACK_IMPORTED_MODULE_3__["useRef"])(false);
var item = useItem(options);
var onMouseDownRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_6__[/* useLiveRef */ "a"])(htmlOnMouseDown);
var onFocusRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_6__[/* useLiveRef */ "a"])(htmlOnFocus);
var onBlurCaptureRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_6__[/* useLiveRef */ "a"])(htmlOnBlurCapture);
var onKeyDownRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_6__[/* useLiveRef */ "a"])(htmlOnKeyDown);
var onClickRef = Object(reakit_utils_useLiveRef__WEBPACK_IMPORTED_MODULE_6__[/* useLiveRef */ "a"])(htmlOnClick);
var shouldTabIndex = !options.unstable_virtual && !options.unstable_hasActiveWidget && isCurrentItem || // We don't want to set tabIndex="-1" when using CompositeItem as a
// standalone component, without state props.
!((_options$items2 = options.items) !== null && _options$items2 !== void 0 && _options$items2.length);
Object(react__WEBPACK_IMPORTED_MODULE_3__["useEffect"])(function () {
var _options$registerItem;
if (!id) return undefined;
(_options$registerItem = options.registerItem) === null || _options$registerItem === void 0 ? void 0 : _options$registerItem.call(options, {
id: id,
ref: ref,
disabled: !!trulyDisabled
});
return function () {
var _options$unregisterIt;
(_options$unregisterIt = options.unregisterItem) === null || _options$unregisterIt === void 0 ? void 0 : _options$unregisterIt.call(options, id);
};
}, [id, trulyDisabled, options.registerItem, options.unregisterItem]);
Object(react__WEBPACK_IMPORTED_MODULE_3__["useEffect"])(function () {
var element = ref.current;
if (!element) {
false ? undefined : void 0;
return;
} // `moves` will be incremented whenever next, previous, up, down, first,
// last or move have been called. This means that the composite item will
// be focused whenever some of these functions are called. We're using
// isCurrentItemRef instead of isCurrentItem because we don't want to
// focus the item if isCurrentItem changes (and options.moves doesn't).
if (options.unstable_moves && isCurrentItemRef.current) {
Object(_userFocus_e16425e3_js__WEBPACK_IMPORTED_MODULE_14__[/* u */ "c"])(element);
}
}, [options.unstable_moves]);
var onMouseDown = Object(react__WEBPACK_IMPORTED_MODULE_3__["useCallback"])(function (event) {
var _onMouseDownRef$curre;
(_onMouseDownRef$curre = onMouseDownRef.current) === null || _onMouseDownRef$curre === void 0 ? void 0 : _onMouseDownRef$curre.call(onMouseDownRef, event);
Object(_userFocus_e16425e3_js__WEBPACK_IMPORTED_MODULE_14__[/* s */ "b"])(event.currentTarget, true);
}, []);
var onFocus = Object(react__WEBPACK_IMPORTED_MODULE_3__["useCallback"])(function (event) {
var _onFocusRef$current, _options$setCurrentId;
var shouldFocusComposite = Object(_userFocus_e16425e3_js__WEBPACK_IMPORTED_MODULE_14__[/* h */ "a"])(event.currentTarget);
Object(_userFocus_e16425e3_js__WEBPACK_IMPORTED_MODULE_14__[/* s */ "b"])(event.currentTarget, false);
(_onFocusRef$current = onFocusRef.current) === null || _onFocusRef$current === void 0 ? void 0 : _onFocusRef$current.call(onFocusRef, event);
if (event.defaultPrevented) return;
if (Object(reakit_utils_isPortalEvent__WEBPACK_IMPORTED_MODULE_9__[/* isPortalEvent */ "a"])(event)) return;
if (!id) return;
if (targetIsAnotherItem(event, options.items)) return;
(_options$setCurrentId = options.setCurrentId) === null || _options$setCurrentId === void 0 ? void 0 : _options$setCurrentId.call(options, id); // When using aria-activedescendant, we want to make sure that the
// composite container receives focus, not the composite item.
// But we don't want to do this if the target is another focusable
// element inside the composite item, such as CompositeItemWidget.
if (shouldFocusComposite && options.unstable_virtual && options.baseId && Object(reakit_utils_isSelfTarget__WEBPACK_IMPORTED_MODULE_7__[/* isSelfTarget */ "a"])(event)) {
var target = event.target;
var composite = Object(reakit_utils_getDocument__WEBPACK_IMPORTED_MODULE_11__[/* getDocument */ "a"])(target).getElementById(options.baseId);
if (composite) {
hasFocusedComposite.current = true;
Object(reakit_utils_ensureFocus__WEBPACK_IMPORTED_MODULE_16__[/* ensureFocus */ "a"])(composite);
}
}
}, [id, options.items, options.setCurrentId, options.unstable_virtual, options.baseId]);
var onBlurCapture = Object(react__WEBPACK_IMPORTED_MODULE_3__["useCallback"])(function (event) {
var _onBlurCaptureRef$cur;
(_onBlurCaptureRef$cur = onBlurCaptureRef.current) === null || _onBlurCaptureRef$cur === void 0 ? void 0 : _onBlurCaptureRef$cur.call(onBlurCaptureRef, event);
if (event.defaultPrevented) return;
if (options.unstable_virtual && hasFocusedComposite.current) {
// When hasFocusedComposite is true, composite has been focused right
// after focusing this item. This is an intermediate blur event, so
// we ignore it.
hasFocusedComposite.current = false;
event.preventDefault();
event.stopPropagation();
}
}, [options.unstable_virtual]);
var onKeyDown = Object(react__WEBPACK_IMPORTED_MODULE_3__["useCallback"])(function (event) {
var _onKeyDownRef$current;
if (!Object(reakit_utils_isSelfTarget__WEBPACK_IMPORTED_MODULE_7__[/* isSelfTarget */ "a"])(event)) return;
var isVertical = options.orientation !== "horizontal";
var isHorizontal = options.orientation !== "vertical";
var isGrid = !!(item !== null && item !== void 0 && item.groupId);
var keyMap = {
ArrowUp: (isGrid || isVertical) && options.up,
ArrowRight: (isGrid || isHorizontal) && options.next,
ArrowDown: (isGrid || isVertical) && options.down,
ArrowLeft: (isGrid || isHorizontal) && options.previous,
Home: function Home() {
if (!isGrid || event.ctrlKey) {
var _options$first;
(_options$first = options.first) === null || _options$first === void 0 ? void 0 : _options$first.call(options);
} else {
var _options$previous;
(_options$previous = options.previous) === null || _options$previous === void 0 ? void 0 : _options$previous.call(options, true);
}
},
End: function End() {
if (!isGrid || event.ctrlKey) {
var _options$last;
(_options$last = options.last) === null || _options$last === void 0 ? void 0 : _options$last.call(options);
} else {
var _options$next;
(_options$next = options.next) === null || _options$next === void 0 ? void 0 : _options$next.call(options, true);
}
},
PageUp: function PageUp() {
if (isGrid) {
var _options$up;
(_options$up = options.up) === null || _options$up === void 0 ? void 0 : _options$up.call(options, true);
} else {
var _options$first2;
(_options$first2 = options.first) === null || _options$first2 === void 0 ? void 0 : _options$first2.call(options);
}
},
PageDown: function PageDown() {
if (isGrid) {
var _options$down;
(_options$down = options.down) === null || _options$down === void 0 ? void 0 : _options$down.call(options, true);
} else {
var _options$last2;
(_options$last2 = options.last) === null || _options$last2 === void 0 ? void 0 : _options$last2.call(options);
}
}
};
var action = keyMap[event.key];
if (action) {
event.preventDefault();
action();
return;
}
(_onKeyDownRef$current = onKeyDownRef.current) === null || _onKeyDownRef$current === void 0 ? void 0 : _onKeyDownRef$current.call(onKeyDownRef, event);
if (event.defaultPrevented) return;
if (event.key.length === 1 && event.key !== " ") {
var widget = getWidget(event.currentTarget);
if (widget && Object(reakit_utils_isTextField__WEBPACK_IMPORTED_MODULE_15__[/* isTextField */ "a"])(widget)) {
widget.focus();
Object(_setTextFieldValue_0a221f4e_js__WEBPACK_IMPORTED_MODULE_18__[/* s */ "a"])(widget, "");
}
} else if (event.key === "Delete" || event.key === "Backspace") {
var _widget = getWidget(event.currentTarget);
if (_widget && Object(reakit_utils_isTextField__WEBPACK_IMPORTED_MODULE_15__[/* isTextField */ "a"])(_widget)) {
event.preventDefault();
Object(_setTextFieldValue_0a221f4e_js__WEBPACK_IMPORTED_MODULE_18__[/* s */ "a"])(_widget, "");
}
}
}, [options.orientation, item, options.up, options.next, options.down, options.previous, options.first, options.last]);
var onClick = Object(react__WEBPACK_IMPORTED_MODULE_3__["useCallback"])(function (event) {
var _onClickRef$current;
(_onClickRef$current = onClickRef.current) === null || _onClickRef$current === void 0 ? void 0 : _onClickRef$current.call(onClickRef, event);
if (event.defaultPrevented) return;
var element = event.currentTarget;
var widget = getWidget(element);
if (widget && !Object(reakit_utils_hasFocusWithin__WEBPACK_IMPORTED_MODULE_8__[/* hasFocusWithin */ "a"])(widget)) {
// If there's a widget inside the composite item, we make sure it's
// focused when pressing enter, space or clicking on the composite item.
widget.focus();
}
}, []);
return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({
ref: Object(reakit_utils_useForkRef__WEBPACK_IMPORTED_MODULE_4__[/* useForkRef */ "a"])(ref, htmlRef),
id: id,
tabIndex: shouldTabIndex ? htmlTabIndex : -1,
"aria-selected": options.unstable_virtual && isCurrentItem ? true : undefined,
onMouseDown: onMouseDown,
onFocus: onFocus,
onBlurCapture: onBlurCapture,
onKeyDown: onKeyDown,
onClick: onClick
}, htmlProps);
}
});
var CompositeItem = Object(reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__[/* createComponent */ "a"])({
as: "button",
memo: true,
useHook: useCompositeItem
});
/***/ }),
/***/ "kgBv":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $gOPD = __webpack_require__("knm9");
var $TypeError = GetIntrinsic('%TypeError%');
var callBound = __webpack_require__("EXo9");
var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable');
var has = __webpack_require__("oNNP");
var IsArray = __webpack_require__("9cOx");
var IsPropertyKey = __webpack_require__("i10q");
var IsRegExp = __webpack_require__("yy3d");
var ToPropertyDescriptor = __webpack_require__("eBsn");
var Type = __webpack_require__("V1cy");
// https://ecma-international.org/ecma-262/6.0/#sec-ordinarygetownproperty
module.exports = function OrdinaryGetOwnProperty(O, P) {
if (Type(O) !== 'Object') {
throw new $TypeError('Assertion failed: O must be an Object');
}
if (!IsPropertyKey(P)) {
throw new $TypeError('Assertion failed: P must be a Property Key');
}
if (!has(O, P)) {
return void 0;
}
if (!$gOPD) {
// ES3 / IE 8 fallback
var arrayLength = IsArray(O) && P === 'length';
var regexLastIndex = IsRegExp(O) && P === 'lastIndex';
return {
'[[Configurable]]': !(arrayLength || regexLastIndex),
'[[Enumerable]]': $isEnumerable(O, P),
'[[Value]]': O[P],
'[[Writable]]': true
};
}
return ToPropertyDescriptor($gOPD(O, P));
};
/***/ }),
/***/ "khzz":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return createEvent; });
/* harmony import */ var _getDocument_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("ouKs");
/**
* Creates an `Event` in a way that also works on IE 11.
*
* @example
* import { createEvent } from "reakit-utils";
*
* const el = document.getElementById("id");
* el.dispatchEvent(createEvent(el, "blur", { bubbles: false }));
*/
function createEvent(element, type, eventInit) {
if (typeof Event === "function") {
return new Event(type, eventInit);
} // IE 11 doesn't support Event constructors
var event = Object(_getDocument_js__WEBPACK_IMPORTED_MODULE_0__[/* getDocument */ "a"])(element).createEvent("Event");
event.initEvent(type, eventInit === null || eventInit === void 0 ? void 0 : eventInit.bubbles, eventInit === null || eventInit === void 0 ? void 0 : eventInit.cancelable);
return event;
}
/***/ }),
/***/ "knm9":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $gOPD = GetIntrinsic('%Object.getOwnPropertyDescriptor%');
if ($gOPD) {
try {
$gOPD([], 'length');
} catch (e) {
// IE 8 has a broken gOPD
$gOPD = null;
}
}
module.exports = $gOPD;
/***/ }),
/***/ "kqkJ":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ isFocusable; });
// UNUSED EXPORTS: getAllFocusableIn, getAllTabbableIn, getClosestFocusable, getFirstFocusableIn, getFirstTabbableIn, getLastTabbableIn, getNextTabbableIn, getPreviousTabbableIn, isTabbable
// CONCATENATED MODULE: ./node_modules/reakit-utils/es/matches.js
/**
* Ponyfill for `Element.prototype.matches`
*
* @see https://developer.mozilla.org/en-US/docs/Web/API/Element/matches
*/
function matches(element, selectors) {
if ("matches" in element) {
return element.matches(selectors);
}
if ("msMatchesSelector" in element) {
return element.msMatchesSelector(selectors);
}
return element.webkitMatchesSelector(selectors);
}
// CONCATENATED MODULE: ./node_modules/reakit-utils/es/closest.js
/**
* Ponyfill for `Element.prototype.closest`
*
* @example
* import { closest } from "reakit-utils";
*
* closest(document.getElementById("id"), "div");
* // same as
* document.getElementById("id").closest("div");
*/
function closest(element, selectors) {
if ("closest" in element) return element.closest(selectors);
do {
if (matches(element, selectors)) return element;
element = element.parentElement || element.parentNode;
} while (element !== null && element.nodeType === 1);
return null;
}
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/getActiveElement.js
var getActiveElement = __webpack_require__("Nym8");
// CONCATENATED MODULE: ./node_modules/reakit-utils/es/tabbable.js
/** @module tabbable */
var selector = "input:not([type='hidden']):not([disabled]), select:not([disabled]), " + "textarea:not([disabled]), a[href], button:not([disabled]), [tabindex], " + "iframe, object, embed, area[href], audio[controls], video[controls], " + "[contenteditable]:not([contenteditable='false'])";
function isVisible(element) {
var htmlElement = element;
return htmlElement.offsetWidth > 0 || htmlElement.offsetHeight > 0 || element.getClientRects().length > 0;
}
function hasNegativeTabIndex(element) {
var tabIndex = parseInt(element.getAttribute("tabindex") || "0", 10);
return tabIndex < 0;
}
/**
* Checks whether `element` is focusable or not.
*
* @memberof tabbable
*
* @example
* import { isFocusable } from "reakit-utils";
*
* isFocusable(document.querySelector("input")); // true
* isFocusable(document.querySelector("input[tabindex='-1']")); // true
* isFocusable(document.querySelector("input[hidden]")); // false
* isFocusable(document.querySelector("input:disabled")); // false
*/
function isFocusable(element) {
return matches(element, selector) && isVisible(element);
}
/**
* Checks whether `element` is tabbable or not.
*
* @memberof tabbable
*
* @example
* import { isTabbable } from "reakit-utils";
*
* isTabbable(document.querySelector("input")); // true
* isTabbable(document.querySelector("input[tabindex='-1']")); // false
* isTabbable(document.querySelector("input[hidden]")); // false
* isTabbable(document.querySelector("input:disabled")); // false
*/
function isTabbable(element) {
return isFocusable(element) && !hasNegativeTabIndex(element);
}
/**
* Returns all the focusable elements in `container`.
*
* @memberof tabbable
*
* @param {Element} container
*
* @returns {Element[]}
*/
function getAllFocusableIn(container) {
var allFocusable = Array.from(container.querySelectorAll(selector));
allFocusable.unshift(container);
return allFocusable.filter(isFocusable);
}
/**
* Returns the first focusable element in `container`.
*
* @memberof tabbable
*
* @param {Element} container
*
* @returns {Element|null}
*/
function getFirstFocusableIn(container) {
var _getAllFocusableIn = getAllFocusableIn(container),
first = _getAllFocusableIn[0];
return first || null;
}
/**
* Returns all the tabbable elements in `container`, including the container
* itself.
*
* @memberof tabbable
*
* @param {Element} container
* @param fallbackToFocusable If `true`, it'll return focusable elements if there are no tabbable ones.
*
* @returns {Element[]}
*/
function getAllTabbableIn(container, fallbackToFocusable) {
var allFocusable = Array.from(container.querySelectorAll(selector));
var allTabbable = allFocusable.filter(isTabbable);
if (isTabbable(container)) {
allTabbable.unshift(container);
}
if (!allTabbable.length && fallbackToFocusable) {
return allFocusable;
}
return allTabbable;
}
/**
* Returns the first tabbable element in `container`, including the container
* itself if it's tabbable.
*
* @memberof tabbable
*
* @param {Element} container
* @param fallbackToFocusable If `true`, it'll return the first focusable element if there are no tabbable ones.
*
* @returns {Element|null}
*/
function getFirstTabbableIn(container, fallbackToFocusable) {
var _getAllTabbableIn = getAllTabbableIn(container, fallbackToFocusable),
first = _getAllTabbableIn[0];
return first || null;
}
/**
* Returns the last tabbable element in `container`, including the container
* itself if it's tabbable.
*
* @memberof tabbable
*
* @param {Element} container
* @param fallbackToFocusable If `true`, it'll return the last focusable element if there are no tabbable ones.
*
* @returns {Element|null}
*/
function getLastTabbableIn(container, fallbackToFocusable) {
var allTabbable = getAllTabbableIn(container, fallbackToFocusable);
return allTabbable[allTabbable.length - 1] || null;
}
/**
* Returns the next tabbable element in `container`.
*
* @memberof tabbable
*
* @param {Element} container
* @param fallbackToFocusable If `true`, it'll return the next focusable element if there are no tabbable ones.
*
* @returns {Element|null}
*/
function getNextTabbableIn(container, fallbackToFocusable) {
var activeElement = Object(getActiveElement["a" /* getActiveElement */])(container);
var allFocusable = getAllFocusableIn(container);
var index = allFocusable.indexOf(activeElement);
var slice = allFocusable.slice(index + 1);
return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);
}
/**
* Returns the previous tabbable element in `container`.
*
* @memberof tabbable
*
* @param {Element} container
* @param fallbackToFocusable If `true`, it'll return the previous focusable element if there are no tabbable ones.
*
* @returns {Element|null}
*/
function getPreviousTabbableIn(container, fallbackToFocusable) {
var activeElement = Object(getActiveElement["a" /* getActiveElement */])(container);
var allFocusable = getAllFocusableIn(container).reverse();
var index = allFocusable.indexOf(activeElement);
var slice = allFocusable.slice(index + 1);
return slice.find(isTabbable) || allFocusable.find(isTabbable) || (fallbackToFocusable ? slice[0] : null);
}
/**
* Returns the closest focusable element.
*
* @memberof tabbable
*
* @param {Element} container
*
* @returns {Element|null}
*/
function getClosestFocusable(element) {
while (element && !isFocusable(element)) {
element = closest(element, selector);
}
return element;
}
/***/ }),
/***/ "kuGu":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("Jt44");
var $construct = GetIntrinsic('%Reflect.construct%', true);
var DefinePropertyOrThrow = __webpack_require__("eOFJ");
try {
DefinePropertyOrThrow({}, '', { '[[Get]]': function () {} });
} catch (e) {
// Accessor properties aren't supported
DefinePropertyOrThrow = null;
}
// https://ecma-international.org/ecma-262/6.0/#sec-isconstructor
if (DefinePropertyOrThrow && $construct) {
var isConstructorMarker = {};
var badArrayLike = {};
DefinePropertyOrThrow(badArrayLike, 'length', {
'[[Get]]': function () {
throw isConstructorMarker;
},
'[[Enumerable]]': true
});
module.exports = function IsConstructor(argument) {
try {
// `Reflect.construct` invokes `IsConstructor(target)` before `Get(args, 'length')`:
$construct(argument, badArrayLike);
} catch (err) {
return err === isConstructorMarker;
}
};
} else {
module.exports = function IsConstructor(argument) {
// unfortunately there's no way to truly check this without try/catch `new argument` in old environments
return typeof argument === 'function' && !!argument.prototype;
};
}
/***/ }),
/***/ "kvlw":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// http://262.ecma-international.org/5.1/#sec-9.2
module.exports = function ToBoolean(value) { return !!value; };
/***/ }),
/***/ "l3Sj":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["i18n"]; }());
/***/ }),
/***/ "lSNA":
/***/ (function(module, exports) {
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
module.exports = _defineProperty;
module.exports["default"] = module.exports, module.exports.__esModule = true;
/***/ }),
/***/ "laOf":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $TypeError = GetIntrinsic('%TypeError%');
// http://262.ecma-international.org/5.1/#sec-9.10
module.exports = function CheckObjectCoercible(value, optMessage) {
if (value == null) {
throw new $TypeError(optMessage || ('Cannot call method on ' + value));
}
return value;
};
/***/ }),
/***/ "ldlY":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXTERNAL MODULE: ./node_modules/classnames/index.js
var classnames = __webpack_require__("TSYQ");
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
// EXTERNAL MODULE: external ["wp","element"]
var external_wp_element_ = __webpack_require__("GRId");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/visually-hidden/utils.js
/**
* @template {keyof JSX.IntrinsicElements | import('react').JSXElementConstructor<any>} T
* @typedef OwnProps
* @property {T} [as='div'] Component to render
* @property {import('react').ReactNode | ((props: import('react').ComponentProps<T>) => JSX.Element) } [children] Children or render props function
*/
/**
* @template {keyof JSX.IntrinsicElements | import('react').JSXElementConstructor<any>} T
* @typedef {OwnProps<T> & import('react').ComponentProps<T>} Props
*/
/**
* renderAsRenderProps is used to wrap a component and convert
* the passed property "as" either a string or component, to the
* rendered tag if a string, or component.
*
* See VisuallyHidden hidden for example.
*
* @template {keyof JSX.IntrinsicElements | import('react').JSXElementConstructor<any>} T
* @param {Props<T>} props
* @return {JSX.Element} The rendered element.
*/
function renderAsRenderProps({
as: Component = 'div',
...props
}) {
if (typeof props.children === 'function') {
return props.children(props);
}
return Object(external_wp_element_["createElement"])(Component, props);
}
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/ui/context/with-next.js
var with_next = __webpack_require__("9NHk");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/visually-hidden/next.js
/**
* Internal dependencies
*/
const VisuallyHidden = false ? undefined : undefined;
/**
* There is nothing to adapt, the props are equal.
*
* @param {import('.').Props<any>} props
* @return {import('../ui/visually-hidden/hook').Props} Adapted props
*/
const adapter = props =>
/** @type {import('../ui/visually-hidden/hook').Props} */
props;
/**
* The generic type is too difficult to type here, default to any to circumvent that.
*
* @param {import('react').ForwardRefExoticComponent<import('.').Props<any>>} Current
*/
function withNextComponent(Current) {
return Object(with_next["a" /* withNext */])(Current, VisuallyHidden, 'WPComponentsVisuallyHidden', adapter);
}
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/visually-hidden/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* @template {keyof JSX.IntrinsicElements | import('react').JSXElementConstructor<any>} T
* @typedef OwnProps
* @property {T} [as='div'] Component to render, e.g. `"div"` or `MyComponent`.
*/
/**
* @template {keyof JSX.IntrinsicElements | import('react').JSXElementConstructor<any>} T
* @typedef {OwnProps<T> & import('react').ComponentPropsWithRef<T>} Props
*/
/**
* VisuallyHidden component to render text out non-visually
* for use in devices such as a screen reader.
*
* @template {keyof JSX.IntrinsicElements | import('react').JSXElementConstructor<any>} T T
* @param {Props<T>} props
* @param {import('react').Ref<any>} forwardedRef
* @return {JSX.Element} Element
*/
function visually_hidden_VisuallyHidden({
as = 'div',
className,
...props
}, forwardedRef) {
return renderAsRenderProps({
as,
className: classnames_default()('components-visually-hidden', className),
...props,
ref: forwardedRef
});
}
/* harmony default export */ var visually_hidden = __webpack_exports__["a"] = (withNextComponent(Object(external_wp_element_["forwardRef"])(visually_hidden_VisuallyHidden)));
/***/ }),
/***/ "lzPt":
/***/ (function(module, exports, __webpack_require__) {
// eslint-disable-next-line import/no-unresolved
module.exports = __webpack_require__("VDVV").default;
/***/ }),
/***/ "m2ax":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = getCalendarMonthWidth;
function getCalendarMonthWidth(daySize, calendarMonthPadding) {
return 7 * daySize + 2 * calendarMonthPadding + 1;
}
/***/ }),
/***/ "mMiH":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _createClass = function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; }();
var _object = __webpack_require__("Koq/");
var _object2 = _interopRequireDefault(_object);
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _reactAddonsShallowCompare = __webpack_require__("YZDV");
var _reactAddonsShallowCompare2 = _interopRequireDefault(_reactAddonsShallowCompare);
var _reactMomentProptypes = __webpack_require__("XGBb");
var _reactMomentProptypes2 = _interopRequireDefault(_reactMomentProptypes);
var _airbnbPropTypes = __webpack_require__("Hsqg");
var _reactWithStyles = __webpack_require__("TG4+");
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _defaultPhrases = __webpack_require__("vV+G");
var _getPhrasePropTypes = __webpack_require__("yc2e");
var _getPhrasePropTypes2 = _interopRequireDefault(_getPhrasePropTypes);
var _CalendarWeek = __webpack_require__("2Q00");
var _CalendarWeek2 = _interopRequireDefault(_CalendarWeek);
var _CalendarDay = __webpack_require__("N3k4");
var _CalendarDay2 = _interopRequireDefault(_CalendarDay);
var _calculateDimension = __webpack_require__("ixyq");
var _calculateDimension2 = _interopRequireDefault(_calculateDimension);
var _getCalendarMonthWeeks = __webpack_require__("F7ZS");
var _getCalendarMonthWeeks2 = _interopRequireDefault(_getCalendarMonthWeeks);
var _isSameDay = __webpack_require__("pRvc");
var _isSameDay2 = _interopRequireDefault(_isSameDay);
var _toISODateString = __webpack_require__("pYxT");
var _toISODateString2 = _interopRequireDefault(_toISODateString);
var _ModifiersShape = __webpack_require__("J7JS");
var _ModifiersShape2 = _interopRequireDefault(_ModifiersShape);
var _ScrollableOrientationShape = __webpack_require__("aE6U");
var _ScrollableOrientationShape2 = _interopRequireDefault(_ScrollableOrientationShape);
var _DayOfWeekShape = __webpack_require__("2S2E");
var _DayOfWeekShape2 = _interopRequireDefault(_DayOfWeekShape);
var _constants = __webpack_require__("Fv1B");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; }
function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } /* eslint react/no-array-index-key: 0 */
var propTypes = (0, _airbnbPropTypes.forbidExtraProps)((0, _object2['default'])({}, _reactWithStyles.withStylesPropTypes, {
month: _reactMomentProptypes2['default'].momentObj,
horizontalMonthPadding: _airbnbPropTypes.nonNegativeInteger,
isVisible: _propTypes2['default'].bool,
enableOutsideDays: _propTypes2['default'].bool,
modifiers: _propTypes2['default'].objectOf(_ModifiersShape2['default']),
orientation: _ScrollableOrientationShape2['default'],
daySize: _airbnbPropTypes.nonNegativeInteger,
onDayClick: _propTypes2['default'].func,
onDayMouseEnter: _propTypes2['default'].func,
onDayMouseLeave: _propTypes2['default'].func,
onMonthSelect: _propTypes2['default'].func,
onYearSelect: _propTypes2['default'].func,
renderMonthText: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes2['default'].func, 'renderMonthText', 'renderMonthElement'),
renderCalendarDay: _propTypes2['default'].func,
renderDayContents: _propTypes2['default'].func,
renderMonthElement: (0, _airbnbPropTypes.mutuallyExclusiveProps)(_propTypes2['default'].func, 'renderMonthText', 'renderMonthElement'),
firstDayOfWeek: _DayOfWeekShape2['default'],
setMonthTitleHeight: _propTypes2['default'].func,
verticalBorderSpacing: _airbnbPropTypes.nonNegativeInteger,
focusedDate: _reactMomentProptypes2['default'].momentObj, // indicates focusable day
isFocused: _propTypes2['default'].bool, // indicates whether or not to move focus to focusable day
// i18n
monthFormat: _propTypes2['default'].string,
phrases: _propTypes2['default'].shape((0, _getPhrasePropTypes2['default'])(_defaultPhrases.CalendarDayPhrases)),
dayAriaLabelFormat: _propTypes2['default'].string
}));
var defaultProps = {
month: (0, _moment2['default'])(),
horizontalMonthPadding: 13,
isVisible: true,
enableOutsideDays: false,
modifiers: {},
orientation: _constants.HORIZONTAL_ORIENTATION,
daySize: _constants.DAY_SIZE,
onDayClick: function () {
function onDayClick() {}
return onDayClick;
}(),
onDayMouseEnter: function () {
function onDayMouseEnter() {}
return onDayMouseEnter;
}(),
onDayMouseLeave: function () {
function onDayMouseLeave() {}
return onDayMouseLeave;
}(),
onMonthSelect: function () {
function onMonthSelect() {}
return onMonthSelect;
}(),
onYearSelect: function () {
function onYearSelect() {}
return onYearSelect;
}(),
renderMonthText: null,
renderCalendarDay: function () {
function renderCalendarDay(props) {
return _react2['default'].createElement(_CalendarDay2['default'], props);
}
return renderCalendarDay;
}(),
renderDayContents: null,
renderMonthElement: null,
firstDayOfWeek: null,
setMonthTitleHeight: null,
focusedDate: null,
isFocused: false,
// i18n
monthFormat: 'MMMM YYYY', // english locale
phrases: _defaultPhrases.CalendarDayPhrases,
dayAriaLabelFormat: undefined,
verticalBorderSpacing: undefined
};
var CalendarMonth = function (_React$Component) {
_inherits(CalendarMonth, _React$Component);
function CalendarMonth(props) {
_classCallCheck(this, CalendarMonth);
var _this = _possibleConstructorReturn(this, (CalendarMonth.__proto__ || Object.getPrototypeOf(CalendarMonth)).call(this, props));
_this.state = {
weeks: (0, _getCalendarMonthWeeks2['default'])(props.month, props.enableOutsideDays, props.firstDayOfWeek == null ? _moment2['default'].localeData().firstDayOfWeek() : props.firstDayOfWeek)
};
_this.setCaptionRef = _this.setCaptionRef.bind(_this);
_this.setMonthTitleHeight = _this.setMonthTitleHeight.bind(_this);
return _this;
}
_createClass(CalendarMonth, [{
key: 'componentDidMount',
value: function () {
function componentDidMount() {
this.setMonthTitleHeightTimeout = setTimeout(this.setMonthTitleHeight, 0);
}
return componentDidMount;
}()
}, {
key: 'componentWillReceiveProps',
value: function () {
function componentWillReceiveProps(nextProps) {
var month = nextProps.month,
enableOutsideDays = nextProps.enableOutsideDays,
firstDayOfWeek = nextProps.firstDayOfWeek;
var _props = this.props,
prevMonth = _props.month,
prevEnableOutsideDays = _props.enableOutsideDays,
prevFirstDayOfWeek = _props.firstDayOfWeek;
if (!month.isSame(prevMonth) || enableOutsideDays !== prevEnableOutsideDays || firstDayOfWeek !== prevFirstDayOfWeek) {
this.setState({
weeks: (0, _getCalendarMonthWeeks2['default'])(month, enableOutsideDays, firstDayOfWeek == null ? _moment2['default'].localeData().firstDayOfWeek() : firstDayOfWeek)
});
}
}
return componentWillReceiveProps;
}()
}, {
key: 'shouldComponentUpdate',
value: function () {
function shouldComponentUpdate(nextProps, nextState) {
return (0, _reactAddonsShallowCompare2['default'])(this, nextProps, nextState);
}
return shouldComponentUpdate;
}()
}, {
key: 'componentWillUnmount',
value: function () {
function componentWillUnmount() {
if (this.setMonthTitleHeightTimeout) {
clearTimeout(this.setMonthTitleHeightTimeout);
}
}
return componentWillUnmount;
}()
}, {
key: 'setMonthTitleHeight',
value: function () {
function setMonthTitleHeight() {
var setMonthTitleHeight = this.props.setMonthTitleHeight;
if (setMonthTitleHeight) {
var captionHeight = (0, _calculateDimension2['default'])(this.captionRef, 'height', true, true);
setMonthTitleHeight(captionHeight);
}
}
return setMonthTitleHeight;
}()
}, {
key: 'setCaptionRef',
value: function () {
function setCaptionRef(ref) {
this.captionRef = ref;
}
return setCaptionRef;
}()
}, {
key: 'render',
value: function () {
function render() {
var _props2 = this.props,
dayAriaLabelFormat = _props2.dayAriaLabelFormat,
daySize = _props2.daySize,
focusedDate = _props2.focusedDate,
horizontalMonthPadding = _props2.horizontalMonthPadding,
isFocused = _props2.isFocused,
isVisible = _props2.isVisible,
modifiers = _props2.modifiers,
month = _props2.month,
monthFormat = _props2.monthFormat,
onDayClick = _props2.onDayClick,
onDayMouseEnter = _props2.onDayMouseEnter,
onDayMouseLeave = _props2.onDayMouseLeave,
onMonthSelect = _props2.onMonthSelect,
onYearSelect = _props2.onYearSelect,
orientation = _props2.orientation,
phrases = _props2.phrases,
renderCalendarDay = _props2.renderCalendarDay,
renderDayContents = _props2.renderDayContents,
renderMonthElement = _props2.renderMonthElement,
renderMonthText = _props2.renderMonthText,
styles = _props2.styles,
verticalBorderSpacing = _props2.verticalBorderSpacing;
var weeks = this.state.weeks;
var monthTitle = renderMonthText ? renderMonthText(month) : month.format(monthFormat);
var verticalScrollable = orientation === _constants.VERTICAL_SCROLLABLE;
return _react2['default'].createElement(
'div',
_extends({}, (0, _reactWithStyles.css)(styles.CalendarMonth, { padding: '0 ' + String(horizontalMonthPadding) + 'px' }), {
'data-visible': isVisible
}),
_react2['default'].createElement(
'div',
_extends({
ref: this.setCaptionRef
}, (0, _reactWithStyles.css)(styles.CalendarMonth_caption, verticalScrollable && styles.CalendarMonth_caption__verticalScrollable)),
renderMonthElement ? renderMonthElement({ month: month, onMonthSelect: onMonthSelect, onYearSelect: onYearSelect }) : _react2['default'].createElement(
'strong',
null,
monthTitle
)
),
_react2['default'].createElement(
'table',
_extends({}, (0, _reactWithStyles.css)(!verticalBorderSpacing && styles.CalendarMonth_table, verticalBorderSpacing && styles.CalendarMonth_verticalSpacing, verticalBorderSpacing && { borderSpacing: '0px ' + String(verticalBorderSpacing) + 'px' }), {
role: 'presentation'
}),
_react2['default'].createElement(
'tbody',
null,
weeks.map(function (week, i) {
return _react2['default'].createElement(
_CalendarWeek2['default'],
{ key: i },
week.map(function (day, dayOfWeek) {
return renderCalendarDay({
key: dayOfWeek,
day: day,
daySize: daySize,
isOutsideDay: !day || day.month() !== month.month(),
tabIndex: isVisible && (0, _isSameDay2['default'])(day, focusedDate) ? 0 : -1,
isFocused: isFocused,
onDayMouseEnter: onDayMouseEnter,
onDayMouseLeave: onDayMouseLeave,
onDayClick: onDayClick,
renderDayContents: renderDayContents,
phrases: phrases,
modifiers: modifiers[(0, _toISODateString2['default'])(day)],
ariaLabelFormat: dayAriaLabelFormat
});
})
);
})
)
)
);
}
return render;
}()
}]);
return CalendarMonth;
}(_react2['default'].Component);
CalendarMonth.propTypes = propTypes;
CalendarMonth.defaultProps = defaultProps;
exports['default'] = (0, _reactWithStyles.withStyles)(function (_ref) {
var _ref$reactDates = _ref.reactDates,
color = _ref$reactDates.color,
font = _ref$reactDates.font,
spacing = _ref$reactDates.spacing;
return {
CalendarMonth: {
background: color.background,
textAlign: 'center',
verticalAlign: 'top',
userSelect: 'none'
},
CalendarMonth_table: {
borderCollapse: 'collapse',
borderSpacing: 0
},
CalendarMonth_verticalSpacing: {
borderCollapse: 'separate'
},
CalendarMonth_caption: {
color: color.text,
fontSize: font.captionSize,
textAlign: 'center',
paddingTop: spacing.captionPaddingTop,
paddingBottom: spacing.captionPaddingBottom,
captionSide: 'initial'
},
CalendarMonth_caption__verticalScrollable: {
paddingTop: 12,
paddingBottom: 7
}
};
})(CalendarMonth);
/***/ }),
/***/ "mjVI":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return TOOLBAR_KEYS; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return TOOLBAR_ITEM_KEYS; });
/* unused harmony export b */
// Automatically generated
var TOOLBAR_STATE_KEYS = ["baseId", "unstable_idCountRef", "unstable_virtual", "rtl", "orientation", "items", "groups", "currentId", "loop", "wrap", "shift", "unstable_moves", "unstable_hasActiveWidget", "unstable_includesBaseElement", "setBaseId", "registerItem", "unregisterItem", "registerGroup", "unregisterGroup", "move", "next", "previous", "up", "down", "first", "last", "sort", "unstable_setVirtual", "setRTL", "setOrientation", "setCurrentId", "setLoop", "setWrap", "setShift", "reset", "unstable_setIncludesBaseElement", "unstable_setHasActiveWidget"];
var TOOLBAR_KEYS = TOOLBAR_STATE_KEYS;
var TOOLBAR_ITEM_KEYS = TOOLBAR_KEYS;
var TOOLBAR_SEPARATOR_KEYS = TOOLBAR_ITEM_KEYS;
/***/ }),
/***/ "n1Y7":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var define = __webpack_require__("82c2");
var implementation = __webpack_require__("nRDI");
var getPolyfill = __webpack_require__("5yQQ");
var polyfill = getPolyfill();
var shim = __webpack_require__("Gn0q");
var boundContains = function contains(node, other) {
return polyfill.apply(node, [other]);
};
define(boundContains, {
getPolyfill: getPolyfill,
implementation: implementation,
shim: shim
});
module.exports = boundContains;
/***/ }),
/***/ "nKkb":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $abs = GetIntrinsic('%Math.abs%');
// http://262.ecma-international.org/5.1/#sec-5.2
module.exports = function abs(x) {
return $abs(x);
};
/***/ }),
/***/ "nLTY":
/***/ (function(module, exports) {
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = getClassName;
/**
* Construct a class name.
*
* namespace {String} Used to construct unique class names.
* styleName {String} Name identifying the specific style.
*
* Return the class name.
*/
function getClassName(namespace, styleName) {
var namespaceSegment = namespace.length > 0 ? String(namespace) + '__' : '';
return '' + namespaceSegment + String(styleName);
}
/***/ }),
/***/ "nRDI":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
module.exports = function contains(other) {
if (arguments.length < 1) {
throw new TypeError('1 argument is required');
}
if (typeof other !== 'object') {
throw new TypeError('Argument 1 (”other“) to Node.contains must be an instance of Node');
}
var node = other;
do {
if (this === node) {
return true;
}
if (node) {
node = node.parentNode;
}
} while (node);
return false;
};
/***/ }),
/***/ "nmnc":
/***/ (function(module, exports, __webpack_require__) {
var root = __webpack_require__("Kz5y");
/** Built-in value references. */
var Symbol = root.Symbol;
module.exports = Symbol;
/***/ }),
/***/ "oNNP":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var bind = __webpack_require__("D3zA");
module.exports = bind.call(Function.call, Object.prototype.hasOwnProperty);
/***/ }),
/***/ "oOcr":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = getPhrase;
function getPhrase(phrase, args) {
if (typeof phrase === 'string') return phrase;
if (typeof phrase === 'function') {
return phrase(args);
}
return '';
}
/***/ }),
/***/ "oR9Z":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _constants = __webpack_require__("Fv1B");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
exports['default'] = _propTypes2['default'].oneOf([_constants.INFO_POSITION_TOP, _constants.INFO_POSITION_BOTTOM, _constants.INFO_POSITION_BEFORE, _constants.INFO_POSITION_AFTER]);
/***/ }),
/***/ "oXO/":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/extends.js
var esm_extends = __webpack_require__("wx14");
// EXTERNAL MODULE: external ["wp","element"]
var external_wp_element_ = __webpack_require__("GRId");
// EXTERNAL MODULE: ./node_modules/classnames/index.js
var classnames = __webpack_require__("TSYQ");
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
// EXTERNAL MODULE: external ["wp","dom"]
var external_wp_dom_ = __webpack_require__("1CF3");
// EXTERNAL MODULE: external ["wp","keycodes"]
var external_wp_keycodes_ = __webpack_require__("RxS6");
// EXTERNAL MODULE: external ["wp","deprecated"]
var external_wp_deprecated_ = __webpack_require__("NMb1");
var external_wp_deprecated_default = /*#__PURE__*/__webpack_require__.n(external_wp_deprecated_);
// EXTERNAL MODULE: external ["wp","compose"]
var external_wp_compose_ = __webpack_require__("K9lf");
// EXTERNAL MODULE: ./node_modules/@wordpress/icons/build-module/library/close.js
var library_close = __webpack_require__("w95h");
// EXTERNAL MODULE: external ["wp","i18n"]
var external_wp_i18n_ = __webpack_require__("l3Sj");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/popover/utils.js
/**
* WordPress dependencies
*/
/**
* Module constants
*/
const HEIGHT_OFFSET = 10; // used by the arrow and a bit of empty space
/**
* Utility used to compute the popover position over the xAxis
*
* @param {Object} anchorRect Anchor Rect.
* @param {Object} contentSize Content Size.
* @param {string} xAxis Desired xAxis.
* @param {string} corner Desired corner.
* @param {boolean} stickyBoundaryElement The boundary element to use when
* switching between sticky and normal
* position.
* @param {string} chosenYAxis yAxis to be used.
* @param {Element} boundaryElement Boundary element.
* @param {boolean} forcePosition Don't adjust position based on anchor.
* @param {boolean} forceXAlignment Don't adjust alignment based on YAxis
*
* @return {Object} Popover xAxis position and constraints.
*/
function computePopoverXAxisPosition(anchorRect, contentSize, xAxis, corner, stickyBoundaryElement, chosenYAxis, boundaryElement, forcePosition, forceXAlignment) {
const {
width
} = contentSize; // Correct xAxis for RTL support
if (xAxis === 'left' && Object(external_wp_i18n_["isRTL"])()) {
xAxis = 'right';
} else if (xAxis === 'right' && Object(external_wp_i18n_["isRTL"])()) {
xAxis = 'left';
}
if (corner === 'left' && Object(external_wp_i18n_["isRTL"])()) {
corner = 'right';
} else if (corner === 'right' && Object(external_wp_i18n_["isRTL"])()) {
corner = 'left';
} // x axis alignment choices
const anchorMidPoint = Math.round(anchorRect.left + anchorRect.width / 2);
const centerAlignment = {
popoverLeft: anchorMidPoint,
contentWidth: (anchorMidPoint - width / 2 > 0 ? width / 2 : anchorMidPoint) + (anchorMidPoint + width / 2 > window.innerWidth ? window.innerWidth - anchorMidPoint : width / 2)
};
let leftAlignmentX = anchorRect.left;
if (corner === 'right') {
leftAlignmentX = anchorRect.right;
} else if (chosenYAxis !== 'middle' && !forceXAlignment) {
leftAlignmentX = anchorMidPoint;
}
let rightAlignmentX = anchorRect.right;
if (corner === 'left') {
rightAlignmentX = anchorRect.left;
} else if (chosenYAxis !== 'middle' && !forceXAlignment) {
rightAlignmentX = anchorMidPoint;
}
const leftAlignment = {
popoverLeft: leftAlignmentX,
contentWidth: leftAlignmentX - width > 0 ? width : leftAlignmentX
};
const rightAlignment = {
popoverLeft: rightAlignmentX,
contentWidth: rightAlignmentX + width > window.innerWidth ? window.innerWidth - rightAlignmentX : width
}; // Choosing the x axis
let chosenXAxis = xAxis;
let contentWidth = null;
if (!stickyBoundaryElement && !forcePosition) {
if (xAxis === 'center' && centerAlignment.contentWidth === width) {
chosenXAxis = 'center';
} else if (xAxis === 'left' && leftAlignment.contentWidth === width) {
chosenXAxis = 'left';
} else if (xAxis === 'right' && rightAlignment.contentWidth === width) {
chosenXAxis = 'right';
} else {
chosenXAxis = leftAlignment.contentWidth > rightAlignment.contentWidth ? 'left' : 'right';
const chosenWidth = chosenXAxis === 'left' ? leftAlignment.contentWidth : rightAlignment.contentWidth; // Limit width of the content to the viewport width
if (width > window.innerWidth) {
contentWidth = window.innerWidth;
} // If we can't find any alignment options that could fit
// our content, then let's fallback to the center of the viewport.
if (chosenWidth !== width) {
chosenXAxis = 'center';
centerAlignment.popoverLeft = window.innerWidth / 2;
}
}
}
let popoverLeft;
if (chosenXAxis === 'center') {
popoverLeft = centerAlignment.popoverLeft;
} else if (chosenXAxis === 'left') {
popoverLeft = leftAlignment.popoverLeft;
} else {
popoverLeft = rightAlignment.popoverLeft;
}
if (boundaryElement) {
const boundaryRect = boundaryElement.getBoundingClientRect();
popoverLeft = Math.min(popoverLeft, boundaryRect.right - width); // Avoid the popover being position beyond the left boundary if the
// direction is left to right.
if (!Object(external_wp_i18n_["isRTL"])()) {
popoverLeft = Math.max(popoverLeft, 0);
}
}
return {
xAxis: chosenXAxis,
popoverLeft,
contentWidth
};
}
/**
* Utility used to compute the popover position over the yAxis
*
* @param {Object} anchorRect Anchor Rect.
* @param {Object} contentSize Content Size.
* @param {string} yAxis Desired yAxis.
* @param {string} corner Desired corner.
* @param {boolean} stickyBoundaryElement The boundary element to use when
* switching between sticky and normal
* position.
* @param {Element} anchorRef The anchor element.
* @param {Element} relativeOffsetTop If applicable, top offset of the
* relative positioned parent container.
* @param {boolean} forcePosition Don't adjust position based on anchor.
*
* @return {Object} Popover xAxis position and constraints.
*/
function computePopoverYAxisPosition(anchorRect, contentSize, yAxis, corner, stickyBoundaryElement, anchorRef, relativeOffsetTop, forcePosition) {
const {
height
} = contentSize;
if (stickyBoundaryElement) {
const stickyRect = stickyBoundaryElement.getBoundingClientRect();
const stickyPosition = stickyRect.top + height - relativeOffsetTop;
if (anchorRect.top <= stickyPosition) {
return {
yAxis,
popoverTop: Math.min(anchorRect.bottom, stickyPosition)
};
}
} // y axis alignment choices
let anchorMidPoint = anchorRect.top + anchorRect.height / 2;
if (corner === 'bottom') {
anchorMidPoint = anchorRect.bottom;
} else if (corner === 'top') {
anchorMidPoint = anchorRect.top;
}
const middleAlignment = {
popoverTop: anchorMidPoint,
contentHeight: (anchorMidPoint - height / 2 > 0 ? height / 2 : anchorMidPoint) + (anchorMidPoint + height / 2 > window.innerHeight ? window.innerHeight - anchorMidPoint : height / 2)
};
const topAlignment = {
popoverTop: anchorRect.top,
contentHeight: anchorRect.top - HEIGHT_OFFSET - height > 0 ? height : anchorRect.top - HEIGHT_OFFSET
};
const bottomAlignment = {
popoverTop: anchorRect.bottom,
contentHeight: anchorRect.bottom + HEIGHT_OFFSET + height > window.innerHeight ? window.innerHeight - HEIGHT_OFFSET - anchorRect.bottom : height
}; // Choosing the y axis
let chosenYAxis = yAxis;
let contentHeight = null;
if (!stickyBoundaryElement && !forcePosition) {
if (yAxis === 'middle' && middleAlignment.contentHeight === height) {
chosenYAxis = 'middle';
} else if (yAxis === 'top' && topAlignment.contentHeight === height) {
chosenYAxis = 'top';
} else if (yAxis === 'bottom' && bottomAlignment.contentHeight === height) {
chosenYAxis = 'bottom';
} else {
chosenYAxis = topAlignment.contentHeight > bottomAlignment.contentHeight ? 'top' : 'bottom';
const chosenHeight = chosenYAxis === 'top' ? topAlignment.contentHeight : bottomAlignment.contentHeight;
contentHeight = chosenHeight !== height ? chosenHeight : null;
}
}
let popoverTop;
if (chosenYAxis === 'middle') {
popoverTop = middleAlignment.popoverTop;
} else if (chosenYAxis === 'top') {
popoverTop = topAlignment.popoverTop;
} else {
popoverTop = bottomAlignment.popoverTop;
}
return {
yAxis: chosenYAxis,
popoverTop,
contentHeight
};
}
/**
* Utility used to compute the popover position and the content max width/height
* for a popover given its anchor rect and its content size.
*
* @param {Object} anchorRect Anchor Rect.
* @param {Object} contentSize Content Size.
* @param {string} position Position.
* @param {boolean} stickyBoundaryElement The boundary element to use when
* switching between sticky and normal
* position.
* @param {Element} anchorRef The anchor element.
* @param {number} relativeOffsetTop If applicable, top offset of the
* relative positioned parent container.
* @param {Element} boundaryElement Boundary element.
* @param {boolean} forcePosition Don't adjust position based on anchor.
* @param {boolean} forceXAlignment Don't adjust alignment based on YAxis
*
* @return {Object} Popover position and constraints.
*/
function computePopoverPosition(anchorRect, contentSize, position = 'top', stickyBoundaryElement, anchorRef, relativeOffsetTop, boundaryElement, forcePosition, forceXAlignment) {
const [yAxis, xAxis = 'center', corner] = position.split(' ');
const yAxisPosition = computePopoverYAxisPosition(anchorRect, contentSize, yAxis, corner, stickyBoundaryElement, anchorRef, relativeOffsetTop, forcePosition);
const xAxisPosition = computePopoverXAxisPosition(anchorRect, contentSize, xAxis, corner, stickyBoundaryElement, yAxisPosition.yAxis, boundaryElement, forcePosition, forceXAlignment);
return { ...xAxisPosition,
...yAxisPosition
};
}
/**
* Offsets the given rect by the position of the iframe that contains the
* element. If the owner document is not in an iframe then it returns with the
* original rect. If the popover container document and the anchor document are
* the same, the original rect will also be returned.
*
* @param {DOMRect} rect bounds of the element
* @param {Document} ownerDocument document of the element
* @param {Element} container The popover container to position.
*
* @return {DOMRect} offsetted bounds
*/
function offsetIframe(rect, ownerDocument, container) {
const {
defaultView
} = ownerDocument;
const {
frameElement
} = defaultView;
if (!frameElement || ownerDocument === container.ownerDocument) {
return rect;
}
const iframeRect = frameElement.getBoundingClientRect();
return new defaultView.DOMRect(rect.left + iframeRect.left, rect.top + iframeRect.top, rect.width, rect.height);
}
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/button/index.js
var build_module_button = __webpack_require__("kA6J");
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/scroll-lock/index.js
var scroll_lock = __webpack_require__("k8OV");
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/bubbles-virtually/use-slot.js
var use_slot = __webpack_require__("+WFq");
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/slot-fill/index.js + 8 modules
var slot_fill = __webpack_require__("dSD1");
// EXTERNAL MODULE: ./node_modules/@wordpress/components/build-module/animate/index.js
var build_module_animate = __webpack_require__("L8Kx");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/popover/index.js
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
/**
* Internal dependencies
*/
/**
* Name of slot in which popover should fill.
*
* @type {string}
*/
const SLOT_NAME = 'Popover';
function computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect, anchorRef = false, shouldAnchorIncludePadding, container) {
if (anchorRect) {
return anchorRect;
}
if (getAnchorRect) {
if (!anchorRefFallback.current) {
return;
}
const rect = getAnchorRect(anchorRefFallback.current);
return offsetIframe(rect, rect.ownerDocument || anchorRefFallback.current.ownerDocument, container);
}
if (anchorRef !== false) {
if (!anchorRef || !window.Range || !window.Element || !window.DOMRect) {
return;
} // Duck-type to check if `anchorRef` is an instance of Range
// `anchorRef instanceof window.Range` checks will break across document boundaries
// such as in an iframe
if (typeof (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.cloneRange) === 'function') {
return offsetIframe(Object(external_wp_dom_["getRectangleFromRange"])(anchorRef), anchorRef.endContainer.ownerDocument, container);
} // Duck-type to check if `anchorRef` is an instance of Element
// `anchorRef instanceof window.Element` checks will break across document boundaries
// such as in an iframe
if (typeof (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.getBoundingClientRect) === 'function') {
const rect = offsetIframe(anchorRef.getBoundingClientRect(), anchorRef.ownerDocument, container);
if (shouldAnchorIncludePadding) {
return rect;
}
return withoutPadding(rect, anchorRef);
}
const {
top,
bottom
} = anchorRef;
const topRect = top.getBoundingClientRect();
const bottomRect = bottom.getBoundingClientRect();
const rect = offsetIframe(new window.DOMRect(topRect.left, topRect.top, topRect.width, bottomRect.bottom - topRect.top), top.ownerDocument, container);
if (shouldAnchorIncludePadding) {
return rect;
}
return withoutPadding(rect, anchorRef);
}
if (!anchorRefFallback.current) {
return;
}
const {
parentNode
} = anchorRefFallback.current;
const rect = parentNode.getBoundingClientRect();
if (shouldAnchorIncludePadding) {
return rect;
}
return withoutPadding(rect, parentNode);
}
function getComputedStyle(node) {
return node.ownerDocument.defaultView.getComputedStyle(node);
}
function withoutPadding(rect, element) {
const {
paddingTop,
paddingBottom,
paddingLeft,
paddingRight
} = getComputedStyle(element);
const top = paddingTop ? parseInt(paddingTop, 10) : 0;
const bottom = paddingBottom ? parseInt(paddingBottom, 10) : 0;
const left = paddingLeft ? parseInt(paddingLeft, 10) : 0;
const right = paddingRight ? parseInt(paddingRight, 10) : 0;
return {
x: rect.left + left,
y: rect.top + top,
width: rect.width - left - right,
height: rect.height - top - bottom,
left: rect.left + left,
right: rect.right - right,
top: rect.top + top,
bottom: rect.bottom - bottom
};
}
/**
* Sets or removes an element attribute.
*
* @param {Element} element The element to modify.
* @param {string} name The attribute name to set or remove.
* @param {?string} value The value to set. A falsy value will remove the
* attribute.
*/
function setAttribute(element, name, value) {
if (!value) {
if (element.hasAttribute(name)) {
element.removeAttribute(name);
}
} else if (element.getAttribute(name) !== value) {
element.setAttribute(name, value);
}
}
/**
* Sets or removes an element style property.
*
* @param {Element} element The element to modify.
* @param {string} property The property to set or remove.
* @param {?string} value The value to set. A falsy value will remove the
* property.
*/
function setStyle(element, property, value = '') {
if (element.style[property] !== value) {
element.style[property] = value;
}
}
/**
* Sets or removes an element class.
*
* @param {Element} element The element to modify.
* @param {string} name The class to set or remove.
* @param {boolean} toggle True to set the class, false to remove.
*/
function setClass(element, name, toggle) {
if (toggle) {
if (!element.classList.contains(name)) {
element.classList.add(name);
}
} else if (element.classList.contains(name)) {
element.classList.remove(name);
}
}
function getAnchorDocument(anchor) {
if (!anchor) {
return;
}
if (anchor.endContainer) {
return anchor.endContainer.ownerDocument;
}
if (anchor.top) {
return anchor.top.ownerDocument;
}
return anchor.ownerDocument;
}
const Popover = ({
headerTitle,
onClose,
children,
className,
noArrow = true,
isAlternate,
// Disable reason: We generate the `...contentProps` rest as remainder
// of props which aren't explicitly handled by this component.
/* eslint-disable no-unused-vars */
position = 'bottom right',
range,
focusOnMount = 'firstElement',
anchorRef,
shouldAnchorIncludePadding,
anchorRect,
getAnchorRect,
expandOnMobile,
animate = true,
onClickOutside,
onFocusOutside,
__unstableStickyBoundaryElement,
__unstableSlotName = SLOT_NAME,
__unstableObserveElement,
__unstableBoundaryParent,
__unstableForcePosition,
__unstableForceXAlignment,
/* eslint-enable no-unused-vars */
...contentProps
}, ref) => {
const anchorRefFallback = Object(external_wp_element_["useRef"])(null);
const contentRef = Object(external_wp_element_["useRef"])(null);
const containerRef = Object(external_wp_element_["useRef"])();
const isMobileViewport = Object(external_wp_compose_["useViewportMatch"])('medium', '<');
const [animateOrigin, setAnimateOrigin] = Object(external_wp_element_["useState"])();
const slot = Object(use_slot["a" /* default */])(__unstableSlotName);
const isExpanded = expandOnMobile && isMobileViewport;
const [containerResizeListener, contentSize] = Object(external_wp_compose_["useResizeObserver"])();
noArrow = isExpanded || noArrow;
Object(external_wp_element_["useLayoutEffect"])(() => {
if (isExpanded) {
setClass(containerRef.current, 'is-without-arrow', noArrow);
setClass(containerRef.current, 'is-alternate', isAlternate);
setAttribute(containerRef.current, 'data-x-axis');
setAttribute(containerRef.current, 'data-y-axis');
setStyle(containerRef.current, 'top');
setStyle(containerRef.current, 'left');
setStyle(contentRef.current, 'maxHeight');
setStyle(contentRef.current, 'maxWidth');
return;
}
const refresh = () => {
if (!containerRef.current || !contentRef.current) {
return;
}
let anchor = computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect, anchorRef, shouldAnchorIncludePadding, containerRef.current);
if (!anchor) {
return;
}
const {
offsetParent,
ownerDocument
} = containerRef.current;
let relativeOffsetTop = 0; // If there is a positioned ancestor element that is not the body,
// subtract the position from the anchor rect. If the position of
// the popover is fixed, the offset parent is null or the body
// element, in which case the position is relative to the viewport.
// See https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/offsetParent
if (offsetParent && offsetParent !== ownerDocument.body) {
const offsetParentRect = offsetParent.getBoundingClientRect();
relativeOffsetTop = offsetParentRect.top;
anchor = new window.DOMRect(anchor.left - offsetParentRect.left, anchor.top - offsetParentRect.top, anchor.width, anchor.height);
}
let boundaryElement;
if (__unstableBoundaryParent) {
var _containerRef$current;
boundaryElement = (_containerRef$current = containerRef.current.closest('.popover-slot')) === null || _containerRef$current === void 0 ? void 0 : _containerRef$current.parentNode;
}
const usedContentSize = !contentSize.height ? contentRef.current.getBoundingClientRect() : contentSize;
const {
popoverTop,
popoverLeft,
xAxis,
yAxis,
contentHeight,
contentWidth
} = computePopoverPosition(anchor, usedContentSize, position, __unstableStickyBoundaryElement, containerRef.current, relativeOffsetTop, boundaryElement, __unstableForcePosition, __unstableForceXAlignment);
if (typeof popoverTop === 'number' && typeof popoverLeft === 'number') {
setStyle(containerRef.current, 'top', popoverTop + 'px');
setStyle(containerRef.current, 'left', popoverLeft + 'px');
}
setClass(containerRef.current, 'is-without-arrow', noArrow || xAxis === 'center' && yAxis === 'middle');
setClass(containerRef.current, 'is-alternate', isAlternate);
setAttribute(containerRef.current, 'data-x-axis', xAxis);
setAttribute(containerRef.current, 'data-y-axis', yAxis);
setStyle(contentRef.current, 'maxHeight', typeof contentHeight === 'number' ? contentHeight + 'px' : '');
setStyle(contentRef.current, 'maxWidth', typeof contentWidth === 'number' ? contentWidth + 'px' : ''); // Compute the animation position
const yAxisMapping = {
top: 'bottom',
bottom: 'top'
};
const xAxisMapping = {
left: 'right',
right: 'left'
};
const animateYAxis = yAxisMapping[yAxis] || 'middle';
const animateXAxis = xAxisMapping[xAxis] || 'center';
setAnimateOrigin(animateXAxis + ' ' + animateYAxis);
};
refresh();
const {
ownerDocument
} = containerRef.current;
const {
defaultView
} = ownerDocument;
/*
* There are sometimes we need to reposition or resize the popover that
* are not handled by the resize/scroll window events (i.e. CSS changes
* in the layout that changes the position of the anchor).
*
* For these situations, we refresh the popover every 0.5s
*/
const intervalHandle = defaultView.setInterval(refresh, 500);
let rafId;
const refreshOnAnimationFrame = () => {
defaultView.cancelAnimationFrame(rafId);
rafId = defaultView.requestAnimationFrame(refresh);
}; // Sometimes a click trigger a layout change that affects the popover
// position. This is an opportunity to immediately refresh rather than
// at the interval.
defaultView.addEventListener('click', refreshOnAnimationFrame);
defaultView.addEventListener('resize', refresh);
defaultView.addEventListener('scroll', refresh, true);
const anchorDocument = getAnchorDocument(anchorRef); // If the anchor is within an iframe, the popover position also needs
// to refrest when the iframe content is scrolled or resized.
if (anchorDocument && anchorDocument !== ownerDocument) {
anchorDocument.defaultView.addEventListener('resize', refresh);
anchorDocument.defaultView.addEventListener('scroll', refresh, true);
}
let observer;
if (__unstableObserveElement) {
observer = new defaultView.MutationObserver(refresh);
observer.observe(__unstableObserveElement, {
attributes: true
});
}
return () => {
defaultView.clearInterval(intervalHandle);
defaultView.removeEventListener('resize', refresh);
defaultView.removeEventListener('scroll', refresh, true);
defaultView.removeEventListener('click', refreshOnAnimationFrame);
defaultView.cancelAnimationFrame(rafId);
if (anchorDocument && anchorDocument !== ownerDocument) {
anchorDocument.defaultView.removeEventListener('resize', refresh);
anchorDocument.defaultView.removeEventListener('scroll', refresh, true);
}
if (observer) {
observer.disconnect();
}
};
}, [isExpanded, anchorRect, getAnchorRect, anchorRef, shouldAnchorIncludePadding, position, contentSize, __unstableStickyBoundaryElement, __unstableObserveElement, __unstableBoundaryParent]); // Event handlers for closing the popover.
const closeEventRef = Object(external_wp_compose_["useRefEffect"])(node => {
function maybeClose(event) {
// Close on escape.
if (event.keyCode === external_wp_keycodes_["ESCAPE"] && onClose) {
event.stopPropagation();
onClose();
}
}
node.addEventListener('keydown', maybeClose);
return () => {
node.removeEventListener('keydown', maybeClose);
};
}, [onClose]);
const constrainedTabbingRef = Object(external_wp_compose_["useConstrainedTabbing"])();
const focusReturnRef = Object(external_wp_compose_["useFocusReturn"])();
const focusOnMountRef = Object(external_wp_compose_["useFocusOnMount"])(focusOnMount);
const focusOutsideProps = Object(external_wp_compose_["__experimentalUseFocusOutside"])(handleOnFocusOutside);
const mergedRefs = Object(external_wp_compose_["useMergeRefs"])([ref, containerRef, // Don't register the event at all if there's no onClose callback.
onClose ? closeEventRef : null, focusOnMount ? constrainedTabbingRef : null, focusOnMount ? focusReturnRef : null, focusOnMount ? focusOnMountRef : null]);
/**
* Shims an onFocusOutside callback to be compatible with a deprecated
* onClickOutside prop function, if provided.
*
* @param {FocusEvent} event Focus event from onFocusOutside.
*/
function handleOnFocusOutside(event) {
// Defer to given `onFocusOutside` if specified. Call `onClose` only if
// both `onFocusOutside` and `onClickOutside` are unspecified. Doing so
// assures backwards-compatibility for prior `onClickOutside` default.
if (onFocusOutside) {
onFocusOutside(event);
return;
} else if (!onClickOutside) {
if (onClose) {
onClose();
}
return;
} // Simulate MouseEvent using FocusEvent#relatedTarget as emulated click
// target. MouseEvent constructor is unsupported in Internet Explorer.
let clickEvent;
try {
clickEvent = new window.MouseEvent('click');
} catch (error) {
clickEvent = document.createEvent('MouseEvent');
clickEvent.initMouseEvent('click', true, true, window, 0, 0, 0, 0, 0, false, false, false, false, 0, null);
}
Object.defineProperty(clickEvent, 'target', {
get: () => event.relatedTarget
});
external_wp_deprecated_default()('Popover onClickOutside prop', {
since: '5.3',
alternative: 'onFocusOutside'
});
onClickOutside(clickEvent);
}
/** @type {false | string} */
const animateClassName = Boolean(animate && animateOrigin) && Object(build_module_animate["b" /* getAnimateClassName */])({
type: 'appear',
origin: animateOrigin
}); // Disable reason: We care to capture the _bubbled_ events from inputs
// within popover as inferring close intent.
let content = // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions
// eslint-disable-next-line jsx-a11y/no-static-element-interactions
Object(external_wp_element_["createElement"])("div", Object(esm_extends["a" /* default */])({
className: classnames_default()('components-popover', className, animateClassName, {
'is-expanded': isExpanded,
'is-without-arrow': noArrow,
'is-alternate': isAlternate
})
}, contentProps, focusOutsideProps, {
ref: mergedRefs,
tabIndex: "-1"
}), isExpanded && Object(external_wp_element_["createElement"])(scroll_lock["a" /* default */], null), isExpanded && Object(external_wp_element_["createElement"])("div", {
className: "components-popover__header"
}, Object(external_wp_element_["createElement"])("span", {
className: "components-popover__header-title"
}, headerTitle), Object(external_wp_element_["createElement"])(build_module_button["a" /* default */], {
className: "components-popover__close",
icon: library_close["a" /* default */],
onClick: onClose
})), Object(external_wp_element_["createElement"])("div", {
ref: contentRef,
className: "components-popover__content"
}, Object(external_wp_element_["createElement"])("div", {
style: {
position: 'relative'
}
}, containerResizeListener, children)));
if (slot.ref) {
content = Object(external_wp_element_["createElement"])(slot_fill["a" /* Fill */], {
name: __unstableSlotName
}, content);
}
if (anchorRef || anchorRect) {
return content;
}
return Object(external_wp_element_["createElement"])("span", {
ref: anchorRefFallback
}, content);
};
const PopoverContainer = Object(external_wp_element_["forwardRef"])(Popover);
function PopoverSlot({
name = SLOT_NAME
}, ref) {
return Object(external_wp_element_["createElement"])(slot_fill["c" /* Slot */], {
bubblesVirtually: true,
name: name,
className: "popover-slot",
ref: ref
});
}
PopoverContainer.Slot = Object(external_wp_element_["forwardRef"])(PopoverSlot);
/* harmony default export */ var popover = __webpack_exports__["a"] = (PopoverContainer);
/***/ }),
/***/ "ouKs":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return getDocument; });
/**
* Returns `element.ownerDocument || document`.
*/
function getDocument(element) {
return element ? element.ownerDocument || element : document;
}
/***/ }),
/***/ "pRvc":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = isSameDay;
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function isSameDay(a, b) {
if (!_moment2['default'].isMoment(a) || !_moment2['default'].isMoment(b)) return false;
// Compare least significant, most likely to change units first
// Moment's isSame clones moment inputs and is a tad slow
return a.date() === b.date() && a.month() === b.month() && a.year() === b.year();
}
/***/ }),
/***/ "pVnL":
/***/ (function(module, exports) {
function _extends() {
module.exports = _extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
module.exports["default"] = module.exports, module.exports.__esModule = true;
return _extends.apply(this, arguments);
}
module.exports = _extends;
module.exports["default"] = module.exports, module.exports.__esModule = true;
/***/ }),
/***/ "pYxT":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = toISODateString;
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _toMomentObject = __webpack_require__("WmS1");
var _toMomentObject2 = _interopRequireDefault(_toMomentObject);
var _constants = __webpack_require__("Fv1B");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function toISODateString(date, currentFormat) {
var dateObj = _moment2['default'].isMoment(date) ? date : (0, _toMomentObject2['default'])(date, currentFormat);
if (!dateObj) return null;
return dateObj.format(_constants.ISO_FORMAT);
}
/***/ }),
/***/ "q86A":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports["default"] = getTransformStyles;
function getTransformStyles(transformValue) {
return {
transform: transformValue,
msTransform: transformValue,
MozTransform: transformValue,
WebkitTransform: transformValue
};
}
/***/ }),
/***/ "qOxZ":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return fireEvent; });
/* harmony import */ var _createEvent_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("khzz");
/**
* Creates and dispatches `Event` in a way that also works on IE 11.
*
* @example
* import { fireEvent } from "reakit-utils";
*
* fireEvent(document.getElementById("id"), "blur", {
* bubbles: true,
* cancelable: true,
* });
*/
function fireEvent(element, type, eventInit) {
return element.dispatchEvent(Object(_createEvent_js__WEBPACK_IMPORTED_MODULE_0__[/* createEvent */ "a"])(element, type, eventInit));
}
/***/ }),
/***/ "qRz9":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["richText"]; }());
/***/ }),
/***/ "qT12":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/** @license React v16.13.1
* react-is.production.min.js
*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
var b="function"===typeof Symbol&&Symbol.for,c=b?Symbol.for("react.element"):60103,d=b?Symbol.for("react.portal"):60106,e=b?Symbol.for("react.fragment"):60107,f=b?Symbol.for("react.strict_mode"):60108,g=b?Symbol.for("react.profiler"):60114,h=b?Symbol.for("react.provider"):60109,k=b?Symbol.for("react.context"):60110,l=b?Symbol.for("react.async_mode"):60111,m=b?Symbol.for("react.concurrent_mode"):60111,n=b?Symbol.for("react.forward_ref"):60112,p=b?Symbol.for("react.suspense"):60113,q=b?
Symbol.for("react.suspense_list"):60120,r=b?Symbol.for("react.memo"):60115,t=b?Symbol.for("react.lazy"):60116,v=b?Symbol.for("react.block"):60121,w=b?Symbol.for("react.fundamental"):60117,x=b?Symbol.for("react.responder"):60118,y=b?Symbol.for("react.scope"):60119;
function z(a){if("object"===typeof a&&null!==a){var u=a.$$typeof;switch(u){case c:switch(a=a.type,a){case l:case m:case e:case g:case f:case p:return a;default:switch(a=a&&a.$$typeof,a){case k:case n:case t:case r:case h:return a;default:return u}}case d:return u}}}function A(a){return z(a)===m}exports.AsyncMode=l;exports.ConcurrentMode=m;exports.ContextConsumer=k;exports.ContextProvider=h;exports.Element=c;exports.ForwardRef=n;exports.Fragment=e;exports.Lazy=t;exports.Memo=r;exports.Portal=d;
exports.Profiler=g;exports.StrictMode=f;exports.Suspense=p;exports.isAsyncMode=function(a){return A(a)||z(a)===l};exports.isConcurrentMode=A;exports.isContextConsumer=function(a){return z(a)===k};exports.isContextProvider=function(a){return z(a)===h};exports.isElement=function(a){return"object"===typeof a&&null!==a&&a.$$typeof===c};exports.isForwardRef=function(a){return z(a)===n};exports.isFragment=function(a){return z(a)===e};exports.isLazy=function(a){return z(a)===t};
exports.isMemo=function(a){return z(a)===r};exports.isPortal=function(a){return z(a)===d};exports.isProfiler=function(a){return z(a)===g};exports.isStrictMode=function(a){return z(a)===f};exports.isSuspense=function(a){return z(a)===p};
exports.isValidElementType=function(a){return"string"===typeof a||"function"===typeof a||a===e||a===m||a===g||a===f||a===p||a===q||"object"===typeof a&&null!==a&&(a.$$typeof===t||a.$$typeof===r||a.$$typeof===h||a.$$typeof===k||a.$$typeof===n||a.$$typeof===w||a.$$typeof===x||a.$$typeof===y||a.$$typeof===v)};exports.typeOf=z;
/***/ }),
/***/ "qdes":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// EXPORTS
__webpack_require__.d(__webpack_exports__, "a", function() { return /* binding */ createHook; });
// EXTERNAL MODULE: external "React"
var external_React_ = __webpack_require__("cDcd");
// EXTERNAL MODULE: ./node_modules/reakit-system/es/SystemContext.js
var SystemContext = __webpack_require__("eUCI");
// CONCATENATED MODULE: ./node_modules/reakit-system/es/useToken.js
/**
* React custom hook that returns the value of any token defined in the
* SystemContext. It's mainly used internally in [`useOptions`](#useoptions)
* and [`useProps`](#useprops).
*
* @example
* import { SystemProvider, useToken } from "reakit-system";
*
* const system = {
* token: "value",
* };
*
* function Component(props) {
* const token = useToken("token", "default value");
* return <div {...props}>{token}</div>;
* }
*
* function App() {
* return (
* <SystemProvider unstable_system={system}>
* <Component />
* </SystemProvider>
* );
* }
*/
function useToken(token, defaultValue) {
Object(external_React_["useDebugValue"])(token);
var context = Object(external_React_["useContext"])(SystemContext["a" /* SystemContext */]);
return context[token] != null ? context[token] : defaultValue;
}
// CONCATENATED MODULE: ./node_modules/reakit-system/es/useProps.js
/**
* React custom hook that returns the props returned by a given
* `use${name}Props` in the SystemContext.
*
* @example
* import { SystemProvider, useProps } from "reakit-system";
*
* const system = {
* useAProps(options, htmlProps) {
* return {
* ...htmlProps,
* href: options.url,
* };
* },
* };
*
* function A({ url, ...htmlProps }) {
* const props = useProps("A", { url }, htmlProps);
* return <a {...props} />;
* }
*
* function App() {
* return (
* <SystemProvider unstable_system={system}>
* <A url="url">It will convert url into href in useAProps</A>
* </SystemProvider>
* );
* }
*/
function useProps(name, options, htmlProps) {
if (options === void 0) {
options = {};
}
if (htmlProps === void 0) {
htmlProps = {};
}
var hookName = "use" + name + "Props";
Object(external_React_["useDebugValue"])(hookName);
var useHook = useToken(hookName);
if (useHook) {
return useHook(options, htmlProps);
}
return htmlProps;
}
// EXTERNAL MODULE: ./node_modules/reakit-system/es/_rollupPluginBabelHelpers-0c84a174.js
var _rollupPluginBabelHelpers_0c84a174 = __webpack_require__("RDTF");
// CONCATENATED MODULE: ./node_modules/reakit-system/es/useOptions.js
/**
* React custom hook that returns the options returned by a given
* `use${name}Options` in the SystemContext.
*
* @example
* import React from "react";
* import { SystemProvider, useOptions } from "reakit-system";
*
* const system = {
* useAOptions(options, htmlProps) {
* return {
* ...options,
* url: htmlProps.href,
* };
* },
* };
*
* function A({ url, ...htmlProps }) {
* const options = useOptions("A", { url }, htmlProps);
* return <a href={options.url} {...htmlProps} />;
* }
*
* function App() {
* return (
* <SystemProvider unstable_system={system}>
* <A href="url">
* It will convert href into url in useAOptions and then url into href in A
* </A>
* </SystemProvider>
* );
* }
*/
function useOptions(name, options, htmlProps) {
if (options === void 0) {
options = {};
}
if (htmlProps === void 0) {
htmlProps = {};
}
var hookName = "use" + name + "Options";
Object(external_React_["useDebugValue"])(hookName);
var useHook = useToken(hookName);
if (useHook) {
return Object(_rollupPluginBabelHelpers_0c84a174["a" /* _ */])(Object(_rollupPluginBabelHelpers_0c84a174["a" /* _ */])({}, options), useHook(options, htmlProps));
}
return options;
}
// EXTERNAL MODULE: ./node_modules/reakit-utils/es/shallowEqual.js
var shallowEqual = __webpack_require__("uqqE");
// CONCATENATED MODULE: ./node_modules/reakit-utils/es/toArray.js
/**
* Transforms `arg` into an array if it's not already.
*
* @example
* import { toArray } from "reakit-utils";
*
* toArray("a"); // ["a"]
* toArray(["a"]); // ["a"]
*/
function toArray(arg) {
if (Array.isArray(arg)) {
return arg;
}
return typeof arg !== "undefined" ? [arg] : [];
}
// CONCATENATED MODULE: ./node_modules/reakit-system/es/createHook.js
/**
* Creates a React custom hook that will return component props.
*
* @example
* import { createHook } from "reakit-system";
*
* const useA = createHook({
* name: "A",
* keys: ["url"], // custom props/options keys
* useProps(options, htmlProps) {
* return {
* ...htmlProps,
* href: options.url,
* };
* },
* });
*
* function A({ url, ...htmlProps }) {
* const props = useA({ url }, htmlProps);
* return <a {...props} />;
* }
*
* @param options
*/
function createHook(options) {
var _options$useState, _composedHooks$;
var composedHooks = toArray(options.compose);
var __useOptions = function __useOptions(hookOptions, htmlProps) {
// Call the current hook's useOptions first
if (options.useOptions) {
hookOptions = options.useOptions(hookOptions, htmlProps);
} // If there's name, call useOptions from the system context
if (options.name) {
hookOptions = useOptions(options.name, hookOptions, htmlProps);
} // Run composed hooks useOptions
if (options.compose) {
for (var _iterator = Object(_rollupPluginBabelHelpers_0c84a174["c" /* b */])(composedHooks), _step; !(_step = _iterator()).done;) {
var hook = _step.value;
hookOptions = hook.__useOptions(hookOptions, htmlProps);
}
}
return hookOptions;
};
var useHook = function useHook(hookOptions, htmlProps, unstable_ignoreUseOptions) {
if (hookOptions === void 0) {
hookOptions = {};
}
if (htmlProps === void 0) {
htmlProps = {};
}
if (unstable_ignoreUseOptions === void 0) {
unstable_ignoreUseOptions = false;
}
// This won't execute when useHook was called from within another useHook
if (!unstable_ignoreUseOptions) {
hookOptions = __useOptions(hookOptions, htmlProps);
} // Call the current hook's useProps
if (options.useProps) {
htmlProps = options.useProps(hookOptions, htmlProps);
} // If there's name, call useProps from the system context
if (options.name) {
htmlProps = useProps(options.name, hookOptions, htmlProps);
}
if (options.compose) {
if (options.useComposeOptions) {
hookOptions = options.useComposeOptions(hookOptions, htmlProps);
}
if (options.useComposeProps) {
htmlProps = options.useComposeProps(hookOptions, htmlProps);
} else {
for (var _iterator2 = Object(_rollupPluginBabelHelpers_0c84a174["c" /* b */])(composedHooks), _step2; !(_step2 = _iterator2()).done;) {
var hook = _step2.value;
htmlProps = hook(hookOptions, htmlProps, true);
}
}
} // Remove undefined values from htmlProps
var finalHTMLProps = {};
var definedHTMLProps = htmlProps || {};
for (var prop in definedHTMLProps) {
if (definedHTMLProps[prop] !== undefined) {
finalHTMLProps[prop] = definedHTMLProps[prop];
}
}
return finalHTMLProps;
};
useHook.__useOptions = __useOptions;
var composedKeys = composedHooks.reduce(function (keys, hook) {
keys.push.apply(keys, hook.__keys || []);
return keys;
}, []); // It's used by createComponent to split option props (keys) and html props
useHook.__keys = [].concat(composedKeys, ((_options$useState = options.useState) === null || _options$useState === void 0 ? void 0 : _options$useState.__keys) || [], options.keys || []);
useHook.unstable_propsAreEqual = options.propsAreEqual || ((_composedHooks$ = composedHooks[0]) === null || _composedHooks$ === void 0 ? void 0 : _composedHooks$.unstable_propsAreEqual) || shallowEqual["a" /* shallowEqual */];
if (false) {}
return useHook;
}
/***/ }),
/***/ "rDFq":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $Object = GetIntrinsic('%Object%');
var isPrimitive = __webpack_require__("BeK9");
var $preventExtensions = $Object.preventExtensions;
var $isExtensible = $Object.isExtensible;
// https://ecma-international.org/ecma-262/6.0/#sec-isextensible-o
module.exports = $preventExtensions
? function IsExtensible(obj) {
return !isPrimitive(obj) && $isExtensible(obj);
}
: function IsExtensible(obj) {
return !isPrimitive(obj);
};
/***/ }),
/***/ "rQy3":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var has = __webpack_require__("oNNP");
var RequireObjectCoercible = __webpack_require__("25kQ");
var callBound = __webpack_require__("VF6F");
var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable');
module.exports = function values(O) {
var obj = RequireObjectCoercible(O);
var vals = [];
for (var key in obj) {
if (has(obj, key) && $isEnumerable(obj, key)) {
vals.push(obj[key]);
}
}
return vals;
};
/***/ }),
/***/ "rZ7t":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var undefined;
var $SyntaxError = SyntaxError;
var $Function = Function;
var $TypeError = TypeError;
// eslint-disable-next-line consistent-return
var getEvalledConstructor = function (expressionSyntax) {
try {
return $Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
} catch (e) {}
};
var $gOPD = Object.getOwnPropertyDescriptor;
if ($gOPD) {
try {
$gOPD({}, '');
} catch (e) {
$gOPD = null; // this is IE 8, which has a broken gOPD
}
}
var throwTypeError = function () {
throw new $TypeError();
};
var ThrowTypeError = $gOPD
? (function () {
try {
// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
arguments.callee; // IE 8 does not throw here
return throwTypeError;
} catch (calleeThrows) {
try {
// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
return $gOPD(arguments, 'callee').get;
} catch (gOPDthrows) {
return throwTypeError;
}
}
}())
: throwTypeError;
var hasSymbols = __webpack_require__("HyUg")();
var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
var needsEval = {};
var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
var INTRINSICS = {
'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
'%Array%': Array,
'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
'%AsyncFromSyncIteratorPrototype%': undefined,
'%AsyncFunction%': needsEval,
'%AsyncGenerator%': needsEval,
'%AsyncGeneratorFunction%': needsEval,
'%AsyncIteratorPrototype%': needsEval,
'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
'%Boolean%': Boolean,
'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
'%Date%': Date,
'%decodeURI%': decodeURI,
'%decodeURIComponent%': decodeURIComponent,
'%encodeURI%': encodeURI,
'%encodeURIComponent%': encodeURIComponent,
'%Error%': Error,
'%eval%': eval, // eslint-disable-line no-eval
'%EvalError%': EvalError,
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
'%Function%': $Function,
'%GeneratorFunction%': needsEval,
'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
'%isFinite%': isFinite,
'%isNaN%': isNaN,
'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
'%JSON%': typeof JSON === 'object' ? JSON : undefined,
'%Map%': typeof Map === 'undefined' ? undefined : Map,
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
'%Math%': Math,
'%Number%': Number,
'%Object%': Object,
'%parseFloat%': parseFloat,
'%parseInt%': parseInt,
'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
'%RangeError%': RangeError,
'%ReferenceError%': ReferenceError,
'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
'%RegExp%': RegExp,
'%Set%': typeof Set === 'undefined' ? undefined : Set,
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
'%String%': String,
'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
'%Symbol%': hasSymbols ? Symbol : undefined,
'%SyntaxError%': $SyntaxError,
'%ThrowTypeError%': ThrowTypeError,
'%TypedArray%': TypedArray,
'%TypeError%': $TypeError,
'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
'%URIError%': URIError,
'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
};
var doEval = function doEval(name) {
var value;
if (name === '%AsyncFunction%') {
value = getEvalledConstructor('async function () {}');
} else if (name === '%GeneratorFunction%') {
value = getEvalledConstructor('function* () {}');
} else if (name === '%AsyncGeneratorFunction%') {
value = getEvalledConstructor('async function* () {}');
} else if (name === '%AsyncGenerator%') {
var fn = doEval('%AsyncGeneratorFunction%');
if (fn) {
value = fn.prototype;
}
} else if (name === '%AsyncIteratorPrototype%') {
var gen = doEval('%AsyncGenerator%');
if (gen) {
value = getProto(gen.prototype);
}
}
INTRINSICS[name] = value;
return value;
};
var LEGACY_ALIASES = {
'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
'%ArrayPrototype%': ['Array', 'prototype'],
'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
'%ArrayProto_values%': ['Array', 'prototype', 'values'],
'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
'%BooleanPrototype%': ['Boolean', 'prototype'],
'%DataViewPrototype%': ['DataView', 'prototype'],
'%DatePrototype%': ['Date', 'prototype'],
'%ErrorPrototype%': ['Error', 'prototype'],
'%EvalErrorPrototype%': ['EvalError', 'prototype'],
'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
'%FunctionPrototype%': ['Function', 'prototype'],
'%Generator%': ['GeneratorFunction', 'prototype'],
'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
'%JSONParse%': ['JSON', 'parse'],
'%JSONStringify%': ['JSON', 'stringify'],
'%MapPrototype%': ['Map', 'prototype'],
'%NumberPrototype%': ['Number', 'prototype'],
'%ObjectPrototype%': ['Object', 'prototype'],
'%ObjProto_toString%': ['Object', 'prototype', 'toString'],
'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
'%PromisePrototype%': ['Promise', 'prototype'],
'%PromiseProto_then%': ['Promise', 'prototype', 'then'],
'%Promise_all%': ['Promise', 'all'],
'%Promise_reject%': ['Promise', 'reject'],
'%Promise_resolve%': ['Promise', 'resolve'],
'%RangeErrorPrototype%': ['RangeError', 'prototype'],
'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
'%RegExpPrototype%': ['RegExp', 'prototype'],
'%SetPrototype%': ['Set', 'prototype'],
'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
'%StringPrototype%': ['String', 'prototype'],
'%SymbolPrototype%': ['Symbol', 'prototype'],
'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
'%TypedArrayPrototype%': ['TypedArray', 'prototype'],
'%TypeErrorPrototype%': ['TypeError', 'prototype'],
'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
'%URIErrorPrototype%': ['URIError', 'prototype'],
'%WeakMapPrototype%': ['WeakMap', 'prototype'],
'%WeakSetPrototype%': ['WeakSet', 'prototype']
};
var bind = __webpack_require__("D3zA");
var hasOwn = __webpack_require__("oNNP");
var $concat = bind.call(Function.call, Array.prototype.concat);
var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
var $replace = bind.call(Function.call, String.prototype.replace);
var $strSlice = bind.call(Function.call, String.prototype.slice);
/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
var stringToPath = function stringToPath(string) {
var first = $strSlice(string, 0, 1);
var last = $strSlice(string, -1);
if (first === '%' && last !== '%') {
throw new $SyntaxError('invalid intrinsic syntax, expected closing `%`');
} else if (last === '%' && first !== '%') {
throw new $SyntaxError('invalid intrinsic syntax, expected opening `%`');
}
var result = [];
$replace(string, rePropName, function (match, number, quote, subString) {
result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
});
return result;
};
/* end adaptation */
var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
var intrinsicName = name;
var alias;
if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
alias = LEGACY_ALIASES[intrinsicName];
intrinsicName = '%' + alias[0] + '%';
}
if (hasOwn(INTRINSICS, intrinsicName)) {
var value = INTRINSICS[intrinsicName];
if (value === needsEval) {
value = doEval(intrinsicName);
}
if (typeof value === 'undefined' && !allowMissing) {
throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
}
return {
alias: alias,
name: intrinsicName,
value: value
};
}
throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
};
module.exports = function GetIntrinsic(name, allowMissing) {
if (typeof name !== 'string' || name.length === 0) {
throw new $TypeError('intrinsic name must be a non-empty string');
}
if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
throw new $TypeError('"allowMissing" argument must be a boolean');
}
var parts = stringToPath(name);
var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
var intrinsicRealName = intrinsic.name;
var value = intrinsic.value;
var skipFurtherCaching = false;
var alias = intrinsic.alias;
if (alias) {
intrinsicBaseName = alias[0];
$spliceApply(parts, $concat([0, 1], alias));
}
for (var i = 1, isOwn = true; i < parts.length; i += 1) {
var part = parts[i];
var first = $strSlice(part, 0, 1);
var last = $strSlice(part, -1);
if (
(
(first === '"' || first === "'" || first === '`')
|| (last === '"' || last === "'" || last === '`')
)
&& first !== last
) {
throw new $SyntaxError('property names with quotes must have matching quotes');
}
if (part === 'constructor' || !isOwn) {
skipFurtherCaching = true;
}
intrinsicBaseName += '.' + part;
intrinsicRealName = '%' + intrinsicBaseName + '%';
if (hasOwn(INTRINSICS, intrinsicRealName)) {
value = INTRINSICS[intrinsicRealName];
} else if (value != null) {
if (!(part in value)) {
if (!allowMissing) {
throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
}
return void undefined;
}
if ($gOPD && (i + 1) >= parts.length) {
var desc = $gOPD(value, part);
isOwn = !!desc;
// By convention, when a data property is converted to an accessor
// property to emulate a data property that does not suffer from
// the override mistake, that accessor's getter is marked with
// an `originalValue` property. Here, when we detect this, we
// uphold the illusion by pretending to see that original data
// property, i.e., returning the value rather than the getter
// itself.
if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
value = desc.get;
} else {
value = value[part];
}
} else {
isOwn = hasOwn(value, part);
value = value[part];
}
if (isOwn && !skipFurtherCaching) {
INTRINSICS[intrinsicRealName] = value;
}
}
}
return value;
};
/***/ }),
/***/ "reMF":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return isUA; });
/* harmony import */ var _canUseDOM_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("+ipW");
/**
* Checks if a given string exists in the user agent string.
*/
function isUA(string) {
if (!_canUseDOM_js__WEBPACK_IMPORTED_MODULE_0__[/* canUseDOM */ "a"]) return false;
return window.navigator.userAgent.indexOf(string) !== -1;
}
/***/ }),
/***/ "rl8x":
/***/ (function(module, exports) {
(function() { module.exports = window["wp"]["isShallowEqual"]; }());
/***/ }),
/***/ "sA9S":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $Object = GetIntrinsic('%Object%');
var RequireObjectCoercible = __webpack_require__("S0jC");
// https://ecma-international.org/ecma-262/6.0/#sec-toobject
module.exports = function ToObject(value) {
RequireObjectCoercible(value);
return $Object(value);
};
/***/ }),
/***/ "sDMB":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
exports['default'] = _propTypes2['default'].shape({
getState: _propTypes2['default'].func,
setState: _propTypes2['default'].func,
subscribe: _propTypes2['default'].func
});
/***/ }),
/***/ "sEfC":
/***/ (function(module, exports, __webpack_require__) {
var isObject = __webpack_require__("GoyQ"),
now = __webpack_require__("QIyF"),
toNumber = __webpack_require__("tLB3");
/** Error message constants. */
var FUNC_ERROR_TEXT = 'Expected a function';
/* Built-in method references for those with the same name as other `lodash` methods. */
var nativeMax = Math.max,
nativeMin = Math.min;
/**
* Creates a debounced function that delays invoking `func` until after `wait`
* milliseconds have elapsed since the last time the debounced function was
* invoked. The debounced function comes with a `cancel` method to cancel
* delayed `func` invocations and a `flush` method to immediately invoke them.
* Provide `options` to indicate whether `func` should be invoked on the
* leading and/or trailing edge of the `wait` timeout. The `func` is invoked
* with the last arguments provided to the debounced function. Subsequent
* calls to the debounced function return the result of the last `func`
* invocation.
*
* **Note:** If `leading` and `trailing` options are `true`, `func` is
* invoked on the trailing edge of the timeout only if the debounced function
* is invoked more than once during the `wait` timeout.
*
* If `wait` is `0` and `leading` is `false`, `func` invocation is deferred
* until to the next tick, similar to `setTimeout` with a timeout of `0`.
*
* See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)
* for details over the differences between `_.debounce` and `_.throttle`.
*
* @static
* @memberOf _
* @since 0.1.0
* @category Function
* @param {Function} func The function to debounce.
* @param {number} [wait=0] The number of milliseconds to delay.
* @param {Object} [options={}] The options object.
* @param {boolean} [options.leading=false]
* Specify invoking on the leading edge of the timeout.
* @param {number} [options.maxWait]
* The maximum time `func` is allowed to be delayed before it's invoked.
* @param {boolean} [options.trailing=true]
* Specify invoking on the trailing edge of the timeout.
* @returns {Function} Returns the new debounced function.
* @example
*
* // Avoid costly calculations while the window size is in flux.
* jQuery(window).on('resize', _.debounce(calculateLayout, 150));
*
* // Invoke `sendMail` when clicked, debouncing subsequent calls.
* jQuery(element).on('click', _.debounce(sendMail, 300, {
* 'leading': true,
* 'trailing': false
* }));
*
* // Ensure `batchLog` is invoked once after 1 second of debounced calls.
* var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });
* var source = new EventSource('/stream');
* jQuery(source).on('message', debounced);
*
* // Cancel the trailing debounced invocation.
* jQuery(window).on('popstate', debounced.cancel);
*/
function debounce(func, wait, options) {
var lastArgs,
lastThis,
maxWait,
result,
timerId,
lastCallTime,
lastInvokeTime = 0,
leading = false,
maxing = false,
trailing = true;
if (typeof func != 'function') {
throw new TypeError(FUNC_ERROR_TEXT);
}
wait = toNumber(wait) || 0;
if (isObject(options)) {
leading = !!options.leading;
maxing = 'maxWait' in options;
maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;
trailing = 'trailing' in options ? !!options.trailing : trailing;
}
function invokeFunc(time) {
var args = lastArgs,
thisArg = lastThis;
lastArgs = lastThis = undefined;
lastInvokeTime = time;
result = func.apply(thisArg, args);
return result;
}
function leadingEdge(time) {
// Reset any `maxWait` timer.
lastInvokeTime = time;
// Start the timer for the trailing edge.
timerId = setTimeout(timerExpired, wait);
// Invoke the leading edge.
return leading ? invokeFunc(time) : result;
}
function remainingWait(time) {
var timeSinceLastCall = time - lastCallTime,
timeSinceLastInvoke = time - lastInvokeTime,
timeWaiting = wait - timeSinceLastCall;
return maxing
? nativeMin(timeWaiting, maxWait - timeSinceLastInvoke)
: timeWaiting;
}
function shouldInvoke(time) {
var timeSinceLastCall = time - lastCallTime,
timeSinceLastInvoke = time - lastInvokeTime;
// Either this is the first call, activity has stopped and we're at the
// trailing edge, the system time has gone backwards and we're treating
// it as the trailing edge, or we've hit the `maxWait` limit.
return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||
(timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));
}
function timerExpired() {
var time = now();
if (shouldInvoke(time)) {
return trailingEdge(time);
}
// Restart the timer.
timerId = setTimeout(timerExpired, remainingWait(time));
}
function trailingEdge(time) {
timerId = undefined;
// Only invoke if we have `lastArgs` which means `func` has been
// debounced at least once.
if (trailing && lastArgs) {
return invokeFunc(time);
}
lastArgs = lastThis = undefined;
return result;
}
function cancel() {
if (timerId !== undefined) {
clearTimeout(timerId);
}
lastInvokeTime = 0;
lastArgs = lastCallTime = lastThis = timerId = undefined;
}
function flush() {
return timerId === undefined ? result : trailingEdge(now());
}
function debounced() {
var time = now(),
isInvoking = shouldInvoke(time);
lastArgs = arguments;
lastThis = this;
lastCallTime = time;
if (isInvoking) {
if (timerId === undefined) {
return leadingEdge(lastCallTime);
}
if (maxing) {
// Handle invocations in a tight loop.
clearTimeout(timerId);
timerId = setTimeout(timerExpired, wait);
return invokeFunc(lastCallTime);
}
}
if (timerId === undefined) {
timerId = setTimeout(timerExpired, wait);
}
return result;
}
debounced.cancel = cancel;
debounced.flush = flush;
return debounced;
}
module.exports = debounce;
/***/ }),
/***/ "sYn3":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var keysShim;
if (!Object.keys) {
// modified from https://github.com/es-shims/es5-shim
var has = Object.prototype.hasOwnProperty;
var toStr = Object.prototype.toString;
var isArgs = __webpack_require__("1KsK"); // eslint-disable-line global-require
var isEnumerable = Object.prototype.propertyIsEnumerable;
var hasDontEnumBug = !isEnumerable.call({ toString: null }, 'toString');
var hasProtoEnumBug = isEnumerable.call(function () {}, 'prototype');
var dontEnums = [
'toString',
'toLocaleString',
'valueOf',
'hasOwnProperty',
'isPrototypeOf',
'propertyIsEnumerable',
'constructor'
];
var equalsConstructorPrototype = function (o) {
var ctor = o.constructor;
return ctor && ctor.prototype === o;
};
var excludedKeys = {
$applicationCache: true,
$console: true,
$external: true,
$frame: true,
$frameElement: true,
$frames: true,
$innerHeight: true,
$innerWidth: true,
$onmozfullscreenchange: true,
$onmozfullscreenerror: true,
$outerHeight: true,
$outerWidth: true,
$pageXOffset: true,
$pageYOffset: true,
$parent: true,
$scrollLeft: true,
$scrollTop: true,
$scrollX: true,
$scrollY: true,
$self: true,
$webkitIndexedDB: true,
$webkitStorageInfo: true,
$window: true
};
var hasAutomationEqualityBug = (function () {
/* global window */
if (typeof window === 'undefined') { return false; }
for (var k in window) {
try {
if (!excludedKeys['$' + k] && has.call(window, k) && window[k] !== null && typeof window[k] === 'object') {
try {
equalsConstructorPrototype(window[k]);
} catch (e) {
return true;
}
}
} catch (e) {
return true;
}
}
return false;
}());
var equalsConstructorPrototypeIfNotBuggy = function (o) {
/* global window */
if (typeof window === 'undefined' || !hasAutomationEqualityBug) {
return equalsConstructorPrototype(o);
}
try {
return equalsConstructorPrototype(o);
} catch (e) {
return false;
}
};
keysShim = function keys(object) {
var isObject = object !== null && typeof object === 'object';
var isFunction = toStr.call(object) === '[object Function]';
var isArguments = isArgs(object);
var isString = isObject && toStr.call(object) === '[object String]';
var theKeys = [];
if (!isObject && !isFunction && !isArguments) {
throw new TypeError('Object.keys called on a non-object');
}
var skipProto = hasProtoEnumBug && isFunction;
if (isString && object.length > 0 && !has.call(object, 0)) {
for (var i = 0; i < object.length; ++i) {
theKeys.push(String(i));
}
}
if (isArguments && object.length > 0) {
for (var j = 0; j < object.length; ++j) {
theKeys.push(String(j));
}
} else {
for (var name in object) {
if (!(skipProto && name === 'prototype') && has.call(object, name)) {
theKeys.push(String(name));
}
}
}
if (hasDontEnumBug) {
var skipConstructor = equalsConstructorPrototypeIfNotBuggy(object);
for (var k = 0; k < dontEnums.length; ++k) {
if (!(skipConstructor && dontEnums[k] === 'constructor') && has.call(object, dontEnums[k])) {
theKeys.push(dontEnums[k]);
}
}
}
return theKeys;
};
}
module.exports = keysShim;
/***/ }),
/***/ "tLB3":
/***/ (function(module, exports, __webpack_require__) {
var baseTrim = __webpack_require__("jXQH"),
isObject = __webpack_require__("GoyQ"),
isSymbol = __webpack_require__("/9aa");
/** Used as references for various `Number` constants. */
var NAN = 0 / 0;
/** Used to detect bad signed hexadecimal string values. */
var reIsBadHex = /^[-+]0x[0-9a-f]+$/i;
/** Used to detect binary string values. */
var reIsBinary = /^0b[01]+$/i;
/** Used to detect octal string values. */
var reIsOctal = /^0o[0-7]+$/i;
/** Built-in method references without a dependency on `root`. */
var freeParseInt = parseInt;
/**
* Converts `value` to a number.
*
* @static
* @memberOf _
* @since 4.0.0
* @category Lang
* @param {*} value The value to process.
* @returns {number} Returns the number.
* @example
*
* _.toNumber(3.2);
* // => 3.2
*
* _.toNumber(Number.MIN_VALUE);
* // => 5e-324
*
* _.toNumber(Infinity);
* // => Infinity
*
* _.toNumber('3.2');
* // => 3.2
*/
function toNumber(value) {
if (typeof value == 'number') {
return value;
}
if (isSymbol(value)) {
return NAN;
}
if (isObject(value)) {
var other = typeof value.valueOf == 'function' ? value.valueOf() : value;
value = isObject(other) ? (other + '') : other;
}
if (typeof value != 'string') {
return value === 0 ? value : +value;
}
value = baseTrim(value);
var isBinary = reIsBinary.test(value);
return (isBinary || reIsOctal.test(value))
? freeParseInt(value.slice(2), isBinary ? 2 : 8)
: (reIsBadHex.test(value) ? NAN : +value);
}
module.exports = toNumber;
/***/ }),
/***/ "tQ+x":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export REACT_TYPEOF_KEY */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return COMPONENT_NAMESPACE; });
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return CONNECTED_NAMESPACE; });
/* unused harmony export CONTEXT_COMPONENT_NAMESPACE */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return CONNECT_STATIC_NAMESPACE; });
const REACT_TYPEOF_KEY = '$$typeof';
const COMPONENT_NAMESPACE = 'data-wp-component';
const CONNECTED_NAMESPACE = 'data-wp-c16t';
const CONTEXT_COMPONENT_NAMESPACE = 'data-wp-c5tc8t';
/**
* Special key where the connected namespaces are stored.
* This is attached to Context connected components as a static property.
*/
const CONNECT_STATIC_NAMESPACE = '__contextSystemKey__';
/***/ }),
/***/ "u5Fq":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = getVisibleDays;
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
var _toISOMonthString = __webpack_require__("jenk");
var _toISOMonthString2 = _interopRequireDefault(_toISOMonthString);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function getVisibleDays(month, numberOfMonths, enableOutsideDays, withoutTransitionMonths) {
if (!_moment2['default'].isMoment(month)) return {};
var visibleDaysByMonth = {};
var currentMonth = withoutTransitionMonths ? month.clone() : month.clone().subtract(1, 'month');
for (var i = 0; i < (withoutTransitionMonths ? numberOfMonths : numberOfMonths + 2); i += 1) {
var visibleDays = [];
// set utc offset to get correct dates in future (when timezone changes)
var baseDate = currentMonth.clone();
var firstOfMonth = baseDate.clone().startOf('month').hour(12);
var lastOfMonth = baseDate.clone().endOf('month').hour(12);
var currentDay = firstOfMonth.clone();
// days belonging to the previous month
if (enableOutsideDays) {
for (var j = 0; j < currentDay.weekday(); j += 1) {
var prevDay = currentDay.clone().subtract(j + 1, 'day');
visibleDays.unshift(prevDay);
}
}
while (currentDay < lastOfMonth) {
visibleDays.push(currentDay.clone());
currentDay.add(1, 'day');
}
if (enableOutsideDays) {
// weekday() returns the index of the day of the week according to the locale
// this means if the week starts on Monday, weekday() will return 0 for a Monday date, not 1
if (currentDay.weekday() !== 0) {
// days belonging to the next month
for (var k = currentDay.weekday(), count = 0; k < 7; k += 1, count += 1) {
var nextDay = currentDay.clone().add(count, 'day');
visibleDays.push(nextDay);
}
}
}
visibleDaysByMonth[(0, _toISOMonthString2['default'])(currentMonth)] = visibleDays;
currentMonth = currentMonth.clone().add(1, 'month');
}
return visibleDaysByMonth;
}
/***/ }),
/***/ "uGfJ":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const textColor = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M12.9 6h-2l-4 11h1.9l1.1-3h4.2l1.1 3h1.9L12.9 6zm-2.5 6.5l1.5-4.9 1.7 4.9h-3.2z"
}));
/* harmony default export */ __webpack_exports__["a"] = (textColor);
/***/ }),
/***/ "ulUS":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = isSameMonth;
var _moment = __webpack_require__("wy2R");
var _moment2 = _interopRequireDefault(_moment);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function isSameMonth(a, b) {
if (!_moment2['default'].isMoment(a) || !_moment2['default'].isMoment(b)) return false;
// Compare least significant, most likely to change units first
// Moment's isSame clones moment inputs and is a tad slow
return a.month() === b.month() && a.year() === b.year();
}
/***/ }),
/***/ "uqqE":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return shallowEqual; });
/**
* Compares two objects.
*
* @example
* import { shallowEqual } from "reakit-utils";
*
* shallowEqual({ a: "a" }, {}); // false
* shallowEqual({ a: "a" }, { b: "b" }); // false
* shallowEqual({ a: "a" }, { a: "a" }); // true
* shallowEqual({ a: "a" }, { a: "a", b: "b" }); // false
*/
function shallowEqual(objA, objB) {
if (objA === objB) return true;
if (!objA) return false;
if (!objB) return false;
if (typeof objA !== "object") return false;
if (typeof objB !== "object") return false;
var aKeys = Object.keys(objA);
var bKeys = Object.keys(objB);
var length = aKeys.length;
if (bKeys.length !== length) return false;
for (var _i = 0, _aKeys = aKeys; _i < _aKeys.length; _i++) {
var key = _aKeys[_i];
if (objA[key] !== objB[key]) {
return false;
}
}
return true;
}
/***/ }),
/***/ "utzN":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return contains; });
/**
* Similar to `Element.prototype.contains`, but a little bit faster when
* `element` is the same as `child`.
*
* @example
* import { contains } from "reakit-utils";
*
* contains(document.getElementById("parent"), document.getElementById("child"));
*/
function contains(parent, child) {
return parent === child || parent.contains(child);
}
/***/ }),
/***/ "v3P4":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var define = __webpack_require__("82c2");
var getPolyfill = __webpack_require__("22yB");
module.exports = function shimFlat() {
var polyfill = getPolyfill();
define(
Array.prototype,
{ flat: polyfill },
{ flat: function () { return Array.prototype.flat !== polyfill; } }
);
return polyfill;
};
/***/ }),
/***/ "v7lB":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
/* globals
AggregateError,
Atomics,
FinalizationRegistry,
SharedArrayBuffer,
WeakRef,
*/
var undefined;
var $SyntaxError = SyntaxError;
var $Function = Function;
var $TypeError = TypeError;
// eslint-disable-next-line consistent-return
var getEvalledConstructor = function (expressionSyntax) {
try {
// eslint-disable-next-line no-new-func
return Function('"use strict"; return (' + expressionSyntax + ').constructor;')();
} catch (e) {}
};
var $gOPD = Object.getOwnPropertyDescriptor;
if ($gOPD) {
try {
$gOPD({}, '');
} catch (e) {
$gOPD = null; // this is IE 8, which has a broken gOPD
}
}
var throwTypeError = function () { throw new $TypeError(); };
var ThrowTypeError = $gOPD
? (function () {
try {
// eslint-disable-next-line no-unused-expressions, no-caller, no-restricted-properties
arguments.callee; // IE 8 does not throw here
return throwTypeError;
} catch (calleeThrows) {
try {
// IE 8 throws on Object.getOwnPropertyDescriptor(arguments, '')
return $gOPD(arguments, 'callee').get;
} catch (gOPDthrows) {
return throwTypeError;
}
}
}())
: throwTypeError;
var hasSymbols = __webpack_require__("UVaH")();
var getProto = Object.getPrototypeOf || function (x) { return x.__proto__; }; // eslint-disable-line no-proto
var asyncGenFunction = getEvalledConstructor('async function* () {}');
var asyncGenFunctionPrototype = asyncGenFunction ? asyncGenFunction.prototype : undefined;
var asyncGenPrototype = asyncGenFunctionPrototype ? asyncGenFunctionPrototype.prototype : undefined;
var TypedArray = typeof Uint8Array === 'undefined' ? undefined : getProto(Uint8Array);
var INTRINSICS = {
'%AggregateError%': typeof AggregateError === 'undefined' ? undefined : AggregateError,
'%Array%': Array,
'%ArrayBuffer%': typeof ArrayBuffer === 'undefined' ? undefined : ArrayBuffer,
'%ArrayIteratorPrototype%': hasSymbols ? getProto([][Symbol.iterator]()) : undefined,
'%AsyncFromSyncIteratorPrototype%': undefined,
'%AsyncFunction%': getEvalledConstructor('async function () {}'),
'%AsyncGenerator%': asyncGenFunctionPrototype,
'%AsyncGeneratorFunction%': asyncGenFunction,
'%AsyncIteratorPrototype%': asyncGenPrototype ? getProto(asyncGenPrototype) : undefined,
'%Atomics%': typeof Atomics === 'undefined' ? undefined : Atomics,
'%BigInt%': typeof BigInt === 'undefined' ? undefined : BigInt,
'%Boolean%': Boolean,
'%DataView%': typeof DataView === 'undefined' ? undefined : DataView,
'%Date%': Date,
'%decodeURI%': decodeURI,
'%decodeURIComponent%': decodeURIComponent,
'%encodeURI%': encodeURI,
'%encodeURIComponent%': encodeURIComponent,
'%Error%': Error,
'%eval%': eval, // eslint-disable-line no-eval
'%EvalError%': EvalError,
'%Float32Array%': typeof Float32Array === 'undefined' ? undefined : Float32Array,
'%Float64Array%': typeof Float64Array === 'undefined' ? undefined : Float64Array,
'%FinalizationRegistry%': typeof FinalizationRegistry === 'undefined' ? undefined : FinalizationRegistry,
'%Function%': $Function,
'%GeneratorFunction%': getEvalledConstructor('function* () {}'),
'%Int8Array%': typeof Int8Array === 'undefined' ? undefined : Int8Array,
'%Int16Array%': typeof Int16Array === 'undefined' ? undefined : Int16Array,
'%Int32Array%': typeof Int32Array === 'undefined' ? undefined : Int32Array,
'%isFinite%': isFinite,
'%isNaN%': isNaN,
'%IteratorPrototype%': hasSymbols ? getProto(getProto([][Symbol.iterator]())) : undefined,
'%JSON%': typeof JSON === 'object' ? JSON : undefined,
'%Map%': typeof Map === 'undefined' ? undefined : Map,
'%MapIteratorPrototype%': typeof Map === 'undefined' || !hasSymbols ? undefined : getProto(new Map()[Symbol.iterator]()),
'%Math%': Math,
'%Number%': Number,
'%Object%': Object,
'%parseFloat%': parseFloat,
'%parseInt%': parseInt,
'%Promise%': typeof Promise === 'undefined' ? undefined : Promise,
'%Proxy%': typeof Proxy === 'undefined' ? undefined : Proxy,
'%RangeError%': RangeError,
'%ReferenceError%': ReferenceError,
'%Reflect%': typeof Reflect === 'undefined' ? undefined : Reflect,
'%RegExp%': RegExp,
'%Set%': typeof Set === 'undefined' ? undefined : Set,
'%SetIteratorPrototype%': typeof Set === 'undefined' || !hasSymbols ? undefined : getProto(new Set()[Symbol.iterator]()),
'%SharedArrayBuffer%': typeof SharedArrayBuffer === 'undefined' ? undefined : SharedArrayBuffer,
'%String%': String,
'%StringIteratorPrototype%': hasSymbols ? getProto(''[Symbol.iterator]()) : undefined,
'%Symbol%': hasSymbols ? Symbol : undefined,
'%SyntaxError%': $SyntaxError,
'%ThrowTypeError%': ThrowTypeError,
'%TypedArray%': TypedArray,
'%TypeError%': $TypeError,
'%Uint8Array%': typeof Uint8Array === 'undefined' ? undefined : Uint8Array,
'%Uint8ClampedArray%': typeof Uint8ClampedArray === 'undefined' ? undefined : Uint8ClampedArray,
'%Uint16Array%': typeof Uint16Array === 'undefined' ? undefined : Uint16Array,
'%Uint32Array%': typeof Uint32Array === 'undefined' ? undefined : Uint32Array,
'%URIError%': URIError,
'%WeakMap%': typeof WeakMap === 'undefined' ? undefined : WeakMap,
'%WeakRef%': typeof WeakRef === 'undefined' ? undefined : WeakRef,
'%WeakSet%': typeof WeakSet === 'undefined' ? undefined : WeakSet
};
var LEGACY_ALIASES = {
'%ArrayBufferPrototype%': ['ArrayBuffer', 'prototype'],
'%ArrayPrototype%': ['Array', 'prototype'],
'%ArrayProto_entries%': ['Array', 'prototype', 'entries'],
'%ArrayProto_forEach%': ['Array', 'prototype', 'forEach'],
'%ArrayProto_keys%': ['Array', 'prototype', 'keys'],
'%ArrayProto_values%': ['Array', 'prototype', 'values'],
'%AsyncFunctionPrototype%': ['AsyncFunction', 'prototype'],
'%AsyncGenerator%': ['AsyncGeneratorFunction', 'prototype'],
'%AsyncGeneratorPrototype%': ['AsyncGeneratorFunction', 'prototype', 'prototype'],
'%BooleanPrototype%': ['Boolean', 'prototype'],
'%DataViewPrototype%': ['DataView', 'prototype'],
'%DatePrototype%': ['Date', 'prototype'],
'%ErrorPrototype%': ['Error', 'prototype'],
'%EvalErrorPrototype%': ['EvalError', 'prototype'],
'%Float32ArrayPrototype%': ['Float32Array', 'prototype'],
'%Float64ArrayPrototype%': ['Float64Array', 'prototype'],
'%FunctionPrototype%': ['Function', 'prototype'],
'%Generator%': ['GeneratorFunction', 'prototype'],
'%GeneratorPrototype%': ['GeneratorFunction', 'prototype', 'prototype'],
'%Int8ArrayPrototype%': ['Int8Array', 'prototype'],
'%Int16ArrayPrototype%': ['Int16Array', 'prototype'],
'%Int32ArrayPrototype%': ['Int32Array', 'prototype'],
'%JSONParse%': ['JSON', 'parse'],
'%JSONStringify%': ['JSON', 'stringify'],
'%MapPrototype%': ['Map', 'prototype'],
'%NumberPrototype%': ['Number', 'prototype'],
'%ObjectPrototype%': ['Object', 'prototype'],
'%ObjProto_toString%': ['Object', 'prototype', 'toString'],
'%ObjProto_valueOf%': ['Object', 'prototype', 'valueOf'],
'%PromisePrototype%': ['Promise', 'prototype'],
'%PromiseProto_then%': ['Promise', 'prototype', 'then'],
'%Promise_all%': ['Promise', 'all'],
'%Promise_reject%': ['Promise', 'reject'],
'%Promise_resolve%': ['Promise', 'resolve'],
'%RangeErrorPrototype%': ['RangeError', 'prototype'],
'%ReferenceErrorPrototype%': ['ReferenceError', 'prototype'],
'%RegExpPrototype%': ['RegExp', 'prototype'],
'%SetPrototype%': ['Set', 'prototype'],
'%SharedArrayBufferPrototype%': ['SharedArrayBuffer', 'prototype'],
'%StringPrototype%': ['String', 'prototype'],
'%SymbolPrototype%': ['Symbol', 'prototype'],
'%SyntaxErrorPrototype%': ['SyntaxError', 'prototype'],
'%TypedArrayPrototype%': ['TypedArray', 'prototype'],
'%TypeErrorPrototype%': ['TypeError', 'prototype'],
'%Uint8ArrayPrototype%': ['Uint8Array', 'prototype'],
'%Uint8ClampedArrayPrototype%': ['Uint8ClampedArray', 'prototype'],
'%Uint16ArrayPrototype%': ['Uint16Array', 'prototype'],
'%Uint32ArrayPrototype%': ['Uint32Array', 'prototype'],
'%URIErrorPrototype%': ['URIError', 'prototype'],
'%WeakMapPrototype%': ['WeakMap', 'prototype'],
'%WeakSetPrototype%': ['WeakSet', 'prototype']
};
var bind = __webpack_require__("D3zA");
var hasOwn = __webpack_require__("oNNP");
var $concat = bind.call(Function.call, Array.prototype.concat);
var $spliceApply = bind.call(Function.apply, Array.prototype.splice);
var $replace = bind.call(Function.call, String.prototype.replace);
/* adapted from https://github.com/lodash/lodash/blob/4.17.15/dist/lodash.js#L6735-L6744 */
var rePropName = /[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g;
var reEscapeChar = /\\(\\)?/g; /** Used to match backslashes in property paths. */
var stringToPath = function stringToPath(string) {
var result = [];
$replace(string, rePropName, function (match, number, quote, subString) {
result[result.length] = quote ? $replace(subString, reEscapeChar, '$1') : number || match;
});
return result;
};
/* end adaptation */
var getBaseIntrinsic = function getBaseIntrinsic(name, allowMissing) {
var intrinsicName = name;
var alias;
if (hasOwn(LEGACY_ALIASES, intrinsicName)) {
alias = LEGACY_ALIASES[intrinsicName];
intrinsicName = '%' + alias[0] + '%';
}
if (hasOwn(INTRINSICS, intrinsicName)) {
var value = INTRINSICS[intrinsicName];
if (typeof value === 'undefined' && !allowMissing) {
throw new $TypeError('intrinsic ' + name + ' exists, but is not available. Please file an issue!');
}
return {
alias: alias,
name: intrinsicName,
value: value
};
}
throw new $SyntaxError('intrinsic ' + name + ' does not exist!');
};
module.exports = function GetIntrinsic(name, allowMissing) {
if (typeof name !== 'string' || name.length === 0) {
throw new $TypeError('intrinsic name must be a non-empty string');
}
if (arguments.length > 1 && typeof allowMissing !== 'boolean') {
throw new $TypeError('"allowMissing" argument must be a boolean');
}
var parts = stringToPath(name);
var intrinsicBaseName = parts.length > 0 ? parts[0] : '';
var intrinsic = getBaseIntrinsic('%' + intrinsicBaseName + '%', allowMissing);
var intrinsicRealName = intrinsic.name;
var value = intrinsic.value;
var skipFurtherCaching = false;
var alias = intrinsic.alias;
if (alias) {
intrinsicBaseName = alias[0];
$spliceApply(parts, $concat([0, 1], alias));
}
for (var i = 1, isOwn = true; i < parts.length; i += 1) {
var part = parts[i];
if (part === 'constructor' || !isOwn) {
skipFurtherCaching = true;
}
intrinsicBaseName += '.' + part;
intrinsicRealName = '%' + intrinsicBaseName + '%';
if (hasOwn(INTRINSICS, intrinsicRealName)) {
value = INTRINSICS[intrinsicRealName];
} else if (value != null) {
if ($gOPD && (i + 1) >= parts.length) {
var desc = $gOPD(value, part);
isOwn = !!desc;
if (!allowMissing && !(part in value)) {
throw new $TypeError('base intrinsic for ' + name + ' exists, but the property is not available.');
}
// By convention, when a data property is converted to an accessor
// property to emulate a data property that does not suffer from
// the override mistake, that accessor's getter is marked with
// an `originalValue` property. Here, when we detect this, we
// uphold the illusion by pretending to see that original data
// property, i.e., returning the value rather than the getter
// itself.
if (isOwn && 'get' in desc && !('originalValue' in desc.get)) {
value = desc.get;
} else {
value = value[part];
}
} else {
isOwn = hasOwn(value, part);
value = value[part];
}
if (isOwn && !skipFurtherCaching) {
INTRINSICS[intrinsicRealName] = value;
}
}
}
return value;
};
/***/ }),
/***/ "vLdR":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
// http://262.ecma-international.org/5.1/#sec-9.1
module.exports = __webpack_require__("Lxf3");
/***/ }),
/***/ "vUUf":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("wx14");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__);
/**
* @typedef OwnProps
*
* @property {string} icon Icon name
* @property {string} [className] Class name
*/
/** @typedef {import('react').ComponentPropsWithoutRef<'span'> & OwnProps} Props */
/**
* @param {Props} props
* @return {JSX.Element} Element
*/
function Dashicon({
icon,
className,
...extraProps
}) {
const iconClass = ['dashicon', 'dashicons', 'dashicons-' + icon, className].filter(Boolean).join(' ');
return Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_1__["createElement"])("span", Object(_babel_runtime_helpers_esm_extends__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])({
className: iconClass
}, extraProps));
}
/* harmony default export */ __webpack_exports__["a"] = (Dashicon);
/***/ }),
/***/ "vV+G":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var calendarLabel = 'Calendar';
var closeDatePicker = 'Close';
var focusStartDate = 'Interact with the calendar and add the check-in date for your trip.';
var clearDate = 'Clear Date';
var clearDates = 'Clear Dates';
var jumpToPrevMonth = 'Move backward to switch to the previous month.';
var jumpToNextMonth = 'Move forward to switch to the next month.';
var keyboardShortcuts = 'Keyboard Shortcuts';
var showKeyboardShortcutsPanel = 'Open the keyboard shortcuts panel.';
var hideKeyboardShortcutsPanel = 'Close the shortcuts panel.';
var openThisPanel = 'Open this panel.';
var enterKey = 'Enter key';
var leftArrowRightArrow = 'Right and left arrow keys';
var upArrowDownArrow = 'up and down arrow keys';
var pageUpPageDown = 'page up and page down keys';
var homeEnd = 'Home and end keys';
var escape = 'Escape key';
var questionMark = 'Question mark';
var selectFocusedDate = 'Select the date in focus.';
var moveFocusByOneDay = 'Move backward (left) and forward (right) by one day.';
var moveFocusByOneWeek = 'Move backward (up) and forward (down) by one week.';
var moveFocusByOneMonth = 'Switch months.';
var moveFocustoStartAndEndOfWeek = 'Go to the first or last day of a week.';
var returnFocusToInput = 'Return to the date input field.';
var keyboardNavigationInstructions = 'Press the down arrow key to interact with the calendar and\n select a date. Press the question mark key to get the keyboard shortcuts for changing dates.';
var chooseAvailableStartDate = function chooseAvailableStartDate(_ref) {
var date = _ref.date;
return 'Choose ' + String(date) + ' as your check-in date. It\u2019s available.';
};
var chooseAvailableEndDate = function chooseAvailableEndDate(_ref2) {
var date = _ref2.date;
return 'Choose ' + String(date) + ' as your check-out date. It\u2019s available.';
};
var chooseAvailableDate = function chooseAvailableDate(_ref3) {
var date = _ref3.date;
return date;
};
var dateIsUnavailable = function dateIsUnavailable(_ref4) {
var date = _ref4.date;
return 'Not available. ' + String(date);
};
var dateIsSelected = function dateIsSelected(_ref5) {
var date = _ref5.date;
return 'Selected. ' + String(date);
};
exports['default'] = {
calendarLabel: calendarLabel,
closeDatePicker: closeDatePicker,
focusStartDate: focusStartDate,
clearDate: clearDate,
clearDates: clearDates,
jumpToPrevMonth: jumpToPrevMonth,
jumpToNextMonth: jumpToNextMonth,
keyboardShortcuts: keyboardShortcuts,
showKeyboardShortcutsPanel: showKeyboardShortcutsPanel,
hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel,
openThisPanel: openThisPanel,
enterKey: enterKey,
leftArrowRightArrow: leftArrowRightArrow,
upArrowDownArrow: upArrowDownArrow,
pageUpPageDown: pageUpPageDown,
homeEnd: homeEnd,
escape: escape,
questionMark: questionMark,
selectFocusedDate: selectFocusedDate,
moveFocusByOneDay: moveFocusByOneDay,
moveFocusByOneWeek: moveFocusByOneWeek,
moveFocusByOneMonth: moveFocusByOneMonth,
moveFocustoStartAndEndOfWeek: moveFocustoStartAndEndOfWeek,
returnFocusToInput: returnFocusToInput,
keyboardNavigationInstructions: keyboardNavigationInstructions,
chooseAvailableStartDate: chooseAvailableStartDate,
chooseAvailableEndDate: chooseAvailableEndDate,
dateIsUnavailable: dateIsUnavailable,
dateIsSelected: dateIsSelected
};
var DateRangePickerPhrases = exports.DateRangePickerPhrases = {
calendarLabel: calendarLabel,
closeDatePicker: closeDatePicker,
clearDates: clearDates,
focusStartDate: focusStartDate,
jumpToPrevMonth: jumpToPrevMonth,
jumpToNextMonth: jumpToNextMonth,
keyboardShortcuts: keyboardShortcuts,
showKeyboardShortcutsPanel: showKeyboardShortcutsPanel,
hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel,
openThisPanel: openThisPanel,
enterKey: enterKey,
leftArrowRightArrow: leftArrowRightArrow,
upArrowDownArrow: upArrowDownArrow,
pageUpPageDown: pageUpPageDown,
homeEnd: homeEnd,
escape: escape,
questionMark: questionMark,
selectFocusedDate: selectFocusedDate,
moveFocusByOneDay: moveFocusByOneDay,
moveFocusByOneWeek: moveFocusByOneWeek,
moveFocusByOneMonth: moveFocusByOneMonth,
moveFocustoStartAndEndOfWeek: moveFocustoStartAndEndOfWeek,
returnFocusToInput: returnFocusToInput,
keyboardNavigationInstructions: keyboardNavigationInstructions,
chooseAvailableStartDate: chooseAvailableStartDate,
chooseAvailableEndDate: chooseAvailableEndDate,
dateIsUnavailable: dateIsUnavailable,
dateIsSelected: dateIsSelected
};
var DateRangePickerInputPhrases = exports.DateRangePickerInputPhrases = {
focusStartDate: focusStartDate,
clearDates: clearDates,
keyboardNavigationInstructions: keyboardNavigationInstructions
};
var SingleDatePickerPhrases = exports.SingleDatePickerPhrases = {
calendarLabel: calendarLabel,
closeDatePicker: closeDatePicker,
clearDate: clearDate,
jumpToPrevMonth: jumpToPrevMonth,
jumpToNextMonth: jumpToNextMonth,
keyboardShortcuts: keyboardShortcuts,
showKeyboardShortcutsPanel: showKeyboardShortcutsPanel,
hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel,
openThisPanel: openThisPanel,
enterKey: enterKey,
leftArrowRightArrow: leftArrowRightArrow,
upArrowDownArrow: upArrowDownArrow,
pageUpPageDown: pageUpPageDown,
homeEnd: homeEnd,
escape: escape,
questionMark: questionMark,
selectFocusedDate: selectFocusedDate,
moveFocusByOneDay: moveFocusByOneDay,
moveFocusByOneWeek: moveFocusByOneWeek,
moveFocusByOneMonth: moveFocusByOneMonth,
moveFocustoStartAndEndOfWeek: moveFocustoStartAndEndOfWeek,
returnFocusToInput: returnFocusToInput,
keyboardNavigationInstructions: keyboardNavigationInstructions,
chooseAvailableDate: chooseAvailableDate,
dateIsUnavailable: dateIsUnavailable,
dateIsSelected: dateIsSelected
};
var SingleDatePickerInputPhrases = exports.SingleDatePickerInputPhrases = {
clearDate: clearDate,
keyboardNavigationInstructions: keyboardNavigationInstructions
};
var DayPickerPhrases = exports.DayPickerPhrases = {
calendarLabel: calendarLabel,
jumpToPrevMonth: jumpToPrevMonth,
jumpToNextMonth: jumpToNextMonth,
keyboardShortcuts: keyboardShortcuts,
showKeyboardShortcutsPanel: showKeyboardShortcutsPanel,
hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel,
openThisPanel: openThisPanel,
enterKey: enterKey,
leftArrowRightArrow: leftArrowRightArrow,
upArrowDownArrow: upArrowDownArrow,
pageUpPageDown: pageUpPageDown,
homeEnd: homeEnd,
escape: escape,
questionMark: questionMark,
selectFocusedDate: selectFocusedDate,
moveFocusByOneDay: moveFocusByOneDay,
moveFocusByOneWeek: moveFocusByOneWeek,
moveFocusByOneMonth: moveFocusByOneMonth,
moveFocustoStartAndEndOfWeek: moveFocustoStartAndEndOfWeek,
returnFocusToInput: returnFocusToInput,
chooseAvailableStartDate: chooseAvailableStartDate,
chooseAvailableEndDate: chooseAvailableEndDate,
chooseAvailableDate: chooseAvailableDate,
dateIsUnavailable: dateIsUnavailable,
dateIsSelected: dateIsSelected
};
var DayPickerKeyboardShortcutsPhrases = exports.DayPickerKeyboardShortcutsPhrases = {
keyboardShortcuts: keyboardShortcuts,
showKeyboardShortcutsPanel: showKeyboardShortcutsPanel,
hideKeyboardShortcutsPanel: hideKeyboardShortcutsPanel,
openThisPanel: openThisPanel,
enterKey: enterKey,
leftArrowRightArrow: leftArrowRightArrow,
upArrowDownArrow: upArrowDownArrow,
pageUpPageDown: pageUpPageDown,
homeEnd: homeEnd,
escape: escape,
questionMark: questionMark,
selectFocusedDate: selectFocusedDate,
moveFocusByOneDay: moveFocusByOneDay,
moveFocusByOneWeek: moveFocusByOneWeek,
moveFocusByOneMonth: moveFocusByOneMonth,
moveFocustoStartAndEndOfWeek: moveFocustoStartAndEndOfWeek,
returnFocusToInput: returnFocusToInput
};
var DayPickerNavigationPhrases = exports.DayPickerNavigationPhrases = {
jumpToPrevMonth: jumpToPrevMonth,
jumpToNextMonth: jumpToNextMonth
};
var CalendarDayPhrases = exports.CalendarDayPhrases = {
chooseAvailableDate: chooseAvailableDate,
dateIsUnavailable: dateIsUnavailable,
dateIsSelected: dateIsSelected
};
/***/ }),
/***/ "w3Ut":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var MAX_SAFE_INTEGER = __webpack_require__("yyeE");
var ToInteger = __webpack_require__("ddK1");
module.exports = function ToLength(argument) {
var len = ToInteger(argument);
if (len <= 0) { return 0; } // includes converting -0 to +0
if (len > MAX_SAFE_INTEGER) { return MAX_SAFE_INTEGER; }
return len;
};
/***/ }),
/***/ "w95h":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("GRId");
/* harmony import */ var _wordpress_element__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__);
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("Tqx9");
/* harmony import */ var _wordpress_primitives__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__);
/**
* WordPress dependencies
*/
const close = Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["SVG"], {
xmlns: "http://www.w3.org/2000/svg",
viewBox: "0 0 24 24"
}, Object(_wordpress_element__WEBPACK_IMPORTED_MODULE_0__["createElement"])(_wordpress_primitives__WEBPACK_IMPORTED_MODULE_1__["Path"], {
d: "M13 11.8l6.1-6.3-1-1-6.1 6.2-6.1-6.2-1 1 6.1 6.3-6.5 6.7 1 1 6.5-6.6 6.5 6.6 1-1z"
}));
/* harmony default export */ __webpack_exports__["a"] = (close);
/***/ }),
/***/ "wTIp":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $defineProperty = GetIntrinsic('%Object.defineProperty%', true);
if ($defineProperty) {
try {
$defineProperty({}, 'a', { value: 1 });
} catch (e) {
// IE 8 has a broken defineProperty
$defineProperty = null;
}
}
var callBound = __webpack_require__("EXo9");
var $isEnumerable = callBound('Object.prototype.propertyIsEnumerable');
// eslint-disable-next-line max-params
module.exports = function DefineOwnProperty(IsDataDescriptor, SameValue, FromPropertyDescriptor, O, P, desc) {
if (!$defineProperty) {
if (!IsDataDescriptor(desc)) {
// ES3 does not support getters/setters
return false;
}
if (!desc['[[Configurable]]'] || !desc['[[Writable]]']) {
return false;
}
// fallback for ES3
if (P in O && $isEnumerable(O, P) !== !!desc['[[Enumerable]]']) {
// a non-enumerable existing property
return false;
}
// property does not exist at all, or exists but is enumerable
var V = desc['[[Value]]'];
// eslint-disable-next-line no-param-reassign
O[P] = V; // will use [[Define]]
return SameValue(O[P], V);
}
$defineProperty(O, P, FromPropertyDescriptor(desc));
return true;
};
/***/ }),
/***/ "wx14":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _extends; });
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
/***/ }),
/***/ "wy2R":
/***/ (function(module, exports) {
(function() { module.exports = window["moment"]; }());
/***/ }),
/***/ "xCFm":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $TypeError = GetIntrinsic('%TypeError%');
var $Number = GetIntrinsic('%Number%');
var $RegExp = GetIntrinsic('%RegExp%');
var $parseInteger = GetIntrinsic('%parseInt%');
var callBound = __webpack_require__("EXo9");
var regexTester = __webpack_require__("ZbWB");
var isPrimitive = __webpack_require__("BeK9");
var $strSlice = callBound('String.prototype.slice');
var isBinary = regexTester(/^0b[01]+$/i);
var isOctal = regexTester(/^0o[0-7]+$/i);
var isInvalidHexLiteral = regexTester(/^[-+]0x[0-9a-f]+$/i);
var nonWS = ['\u0085', '\u200b', '\ufffe'].join('');
var nonWSregex = new $RegExp('[' + nonWS + ']', 'g');
var hasNonWS = regexTester(nonWSregex);
// whitespace from: https://es5.github.io/#x15.5.4.20
// implementation from https://github.com/es-shims/es5-shim/blob/v3.4.0/es5-shim.js#L1304-L1324
var ws = [
'\x09\x0A\x0B\x0C\x0D\x20\xA0\u1680\u180E\u2000\u2001\u2002\u2003',
'\u2004\u2005\u2006\u2007\u2008\u2009\u200A\u202F\u205F\u3000\u2028',
'\u2029\uFEFF'
].join('');
var trimRegex = new RegExp('(^[' + ws + ']+)|([' + ws + ']+$)', 'g');
var $replace = callBound('String.prototype.replace');
var $trim = function (value) {
return $replace(value, trimRegex, '');
};
var ToPrimitive = __webpack_require__("L7Wv");
// https://ecma-international.org/ecma-262/6.0/#sec-tonumber
module.exports = function ToNumber(argument) {
var value = isPrimitive(argument) ? argument : ToPrimitive(argument, $Number);
if (typeof value === 'symbol') {
throw new $TypeError('Cannot convert a Symbol value to a number');
}
if (typeof value === 'bigint') {
throw new $TypeError('Conversion from \'BigInt\' to \'number\' is not allowed.');
}
if (typeof value === 'string') {
if (isBinary(value)) {
return ToNumber($parseInteger($strSlice(value, 2), 2));
} else if (isOctal(value)) {
return ToNumber($parseInteger($strSlice(value, 2), 8));
} else if (hasNonWS(value) || isInvalidHexLiteral(value)) {
return NaN;
} else {
var trimmed = $trim(value);
if (trimmed !== value) {
return ToNumber(trimmed);
}
}
}
return $Number(value);
};
/***/ }),
/***/ "xEte":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var CloseButton = function () {
function CloseButton(props) {
return _react2['default'].createElement(
'svg',
props,
_react2['default'].createElement('path', {
fillRule: 'evenodd',
d: 'M11.53.47a.75.75 0 0 0-1.061 0l-4.47 4.47L1.529.47A.75.75 0 1 0 .468 1.531l4.47 4.47-4.47 4.47a.75.75 0 1 0 1.061 1.061l4.47-4.47 4.47 4.47a.75.75 0 1 0 1.061-1.061l-4.47-4.47 4.47-4.47a.75.75 0 0 0 0-1.061z'
})
);
}
return CloseButton;
}();
CloseButton.defaultProps = {
viewBox: '0 0 12 12'
};
exports['default'] = CloseButton;
/***/ }),
/***/ "xOhs":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var core = {
white: '#fff',
gray: '#484848',
grayLight: '#82888a',
grayLighter: '#cacccd',
grayLightest: '#f2f2f2',
borderMedium: '#c4c4c4',
border: '#dbdbdb',
borderLight: '#e4e7e7',
borderLighter: '#eceeee',
borderBright: '#f4f5f5',
primary: '#00a699',
primaryShade_1: '#33dacd',
primaryShade_2: '#66e2da',
primaryShade_3: '#80e8e0',
primaryShade_4: '#b2f1ec',
primary_dark: '#008489',
secondary: '#007a87',
yellow: '#ffe8bc',
yellow_dark: '#ffce71'
};
exports['default'] = {
reactDates: {
zIndex: 0,
border: {
input: {
border: 0,
borderTop: 0,
borderRight: 0,
borderBottom: '2px solid transparent',
borderLeft: 0,
outlineFocused: 0,
borderFocused: 0,
borderTopFocused: 0,
borderLeftFocused: 0,
borderBottomFocused: '2px solid ' + String(core.primary_dark),
borderRightFocused: 0,
borderRadius: 0
},
pickerInput: {
borderWidth: 1,
borderStyle: 'solid',
borderRadius: 2
}
},
color: {
core: core,
disabled: core.grayLightest,
background: core.white,
backgroundDark: '#f2f2f2',
backgroundFocused: core.white,
border: 'rgb(219, 219, 219)',
text: core.gray,
textDisabled: core.border,
textFocused: '#007a87',
placeholderText: '#757575',
outside: {
backgroundColor: core.white,
backgroundColor_active: core.white,
backgroundColor_hover: core.white,
color: core.gray,
color_active: core.gray,
color_hover: core.gray
},
highlighted: {
backgroundColor: core.yellow,
backgroundColor_active: core.yellow_dark,
backgroundColor_hover: core.yellow_dark,
color: core.gray,
color_active: core.gray,
color_hover: core.gray
},
minimumNights: {
backgroundColor: core.white,
backgroundColor_active: core.white,
backgroundColor_hover: core.white,
borderColor: core.borderLighter,
color: core.grayLighter,
color_active: core.grayLighter,
color_hover: core.grayLighter
},
hoveredSpan: {
backgroundColor: core.primaryShade_4,
backgroundColor_active: core.primaryShade_3,
backgroundColor_hover: core.primaryShade_4,
borderColor: core.primaryShade_3,
borderColor_active: core.primaryShade_3,
borderColor_hover: core.primaryShade_3,
color: core.secondary,
color_active: core.secondary,
color_hover: core.secondary
},
selectedSpan: {
backgroundColor: core.primaryShade_2,
backgroundColor_active: core.primaryShade_1,
backgroundColor_hover: core.primaryShade_1,
borderColor: core.primaryShade_1,
borderColor_active: core.primary,
borderColor_hover: core.primary,
color: core.white,
color_active: core.white,
color_hover: core.white
},
selected: {
backgroundColor: core.primary,
backgroundColor_active: core.primary,
backgroundColor_hover: core.primary,
borderColor: core.primary,
borderColor_active: core.primary,
borderColor_hover: core.primary,
color: core.white,
color_active: core.white,
color_hover: core.white
},
blocked_calendar: {
backgroundColor: core.grayLighter,
backgroundColor_active: core.grayLighter,
backgroundColor_hover: core.grayLighter,
borderColor: core.grayLighter,
borderColor_active: core.grayLighter,
borderColor_hover: core.grayLighter,
color: core.grayLight,
color_active: core.grayLight,
color_hover: core.grayLight
},
blocked_out_of_range: {
backgroundColor: core.white,
backgroundColor_active: core.white,
backgroundColor_hover: core.white,
borderColor: core.borderLight,
borderColor_active: core.borderLight,
borderColor_hover: core.borderLight,
color: core.grayLighter,
color_active: core.grayLighter,
color_hover: core.grayLighter
}
},
spacing: {
dayPickerHorizontalPadding: 9,
captionPaddingTop: 22,
captionPaddingBottom: 37,
inputPadding: 0,
displayTextPaddingVertical: undefined,
displayTextPaddingTop: 11,
displayTextPaddingBottom: 9,
displayTextPaddingHorizontal: undefined,
displayTextPaddingLeft: 11,
displayTextPaddingRight: 11,
displayTextPaddingVertical_small: undefined,
displayTextPaddingTop_small: 7,
displayTextPaddingBottom_small: 5,
displayTextPaddingHorizontal_small: undefined,
displayTextPaddingLeft_small: 7,
displayTextPaddingRight_small: 7
},
sizing: {
inputWidth: 130,
inputWidth_small: 97,
arrowWidth: 24
},
noScrollBarOnVerticalScrollable: false,
font: {
size: 14,
captionSize: 18,
input: {
size: 19,
lineHeight: '24px',
size_small: 15,
lineHeight_small: '18px',
letterSpacing_small: '0.2px',
styleDisabled: 'italic'
}
}
}
};
/***/ }),
/***/ "xoj2":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var implementation = __webpack_require__("rQy3");
module.exports = function getPolyfill() {
return typeof Object.values === 'function' ? Object.values : implementation;
};
/***/ }),
/***/ "y9oe":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $TypeError = GetIntrinsic('%TypeError%');
var Get = __webpack_require__("3aeR");
var ToLength = __webpack_require__("w3Ut");
var Type = __webpack_require__("V1cy");
// https://262.ecma-international.org/11.0/#sec-lengthofarraylike
module.exports = function LengthOfArrayLike(obj) {
if (Type(obj) !== 'Object') {
throw new $TypeError('Assertion failed: `obj` must be an Object');
}
return ToLength(Get(obj, 'length'));
};
// TODO: use this all over
/***/ }),
/***/ "yLpj":
/***/ (function(module, exports) {
var g;
// This works in non-strict mode
g = (function() {
return this;
})();
try {
// This works if eval is allowed (see CSP)
g = g || new Function("return this")();
} catch (e) {
// This works if the window reference is available
if (typeof window === "object") g = window;
}
// g can still be undefined, but nothing to do about it...
// We return undefined, instead of nothing here, so it's
// easier to handle this case. if(!global) { ...}
module.exports = g;
/***/ }),
/***/ "yLpt":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var implementation = __webpack_require__("FufO");
var lacksProperEnumerationOrder = function () {
if (!Object.assign) {
return false;
}
/*
* v8, specifically in node 4.x, has a bug with incorrect property enumeration order
* note: this does not detect the bug unless there's 20 characters
*/
var str = 'abcdefghijklmnopqrst';
var letters = str.split('');
var map = {};
for (var i = 0; i < letters.length; ++i) {
map[letters[i]] = letters[i];
}
var obj = Object.assign({}, map);
var actual = '';
for (var k in obj) {
actual += k;
}
return str !== actual;
};
var assignHasPendingExceptions = function () {
if (!Object.assign || !Object.preventExtensions) {
return false;
}
/*
* Firefox 37 still has "pending exception" logic in its Object.assign implementation,
* which is 72% slower than our shim, and Firefox 40's native implementation.
*/
var thrower = Object.preventExtensions({ 1: 2 });
try {
Object.assign(thrower, 'xy');
} catch (e) {
return thrower[1] === 'y';
}
return false;
};
module.exports = function getPolyfill() {
if (!Object.assign) {
return implementation;
}
if (lacksProperEnumerationOrder()) {
return implementation;
}
if (assignHasPendingExceptions()) {
return implementation;
}
return Object.assign;
};
/***/ }),
/***/ "yN6O":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var ArraySpeciesCreate = __webpack_require__("7Ji+");
var FlattenIntoArray = __webpack_require__("iz0l");
var Get = __webpack_require__("3aeR");
var ToInteger = __webpack_require__("ddK1");
var ToLength = __webpack_require__("w3Ut");
var ToObject = __webpack_require__("sA9S");
module.exports = function flat() {
var O = ToObject(this);
var sourceLen = ToLength(Get(O, 'length'));
var depthNum = 1;
if (arguments.length > 0 && typeof arguments[0] !== 'undefined') {
depthNum = ToInteger(arguments[0]);
}
var A = ArraySpeciesCreate(O, 0);
FlattenIntoArray(A, O, sourceLen, 0, depthNum);
return A;
};
/***/ }),
/***/ "yc2e":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports['default'] = getPhrasePropTypes;
var _object = __webpack_require__("Koq/");
var _object2 = _interopRequireDefault(_object);
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
function getPhrasePropTypes(defaultPhrases) {
return Object.keys(defaultPhrases).reduce(function (phrases, key) {
return (0, _object2['default'])({}, phrases, _defineProperty({}, key, _propTypes2['default'].oneOfType([_propTypes2['default'].string, _propTypes2['default'].func, _propTypes2['default'].node])));
}, {});
}
/***/ }),
/***/ "ym77":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export unstable_Id */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return unstable_useId; });
/* harmony import */ var _rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("BZp5");
/* harmony import */ var reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("hE48");
/* harmony import */ var reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("qdes");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("cDcd");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_3__);
/* harmony import */ var _IdProvider_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("KCH1");
// Automatically generated
var ID_STATE_KEYS = ["baseId", "unstable_idCountRef", "setBaseId"];
var ID_KEYS = [].concat(ID_STATE_KEYS, ["id"]);
var unstable_useId = Object(reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__[/* createHook */ "a"])({
keys: ID_KEYS,
useOptions: function useOptions(options, htmlProps) {
var generateId = Object(react__WEBPACK_IMPORTED_MODULE_3__["useContext"])(_IdProvider_js__WEBPACK_IMPORTED_MODULE_4__[/* unstable_IdContext */ "a"]);
var _React$useState = Object(react__WEBPACK_IMPORTED_MODULE_3__["useState"])(function () {
// This comes from useIdState
if (options.unstable_idCountRef) {
options.unstable_idCountRef.current += 1;
return "-" + options.unstable_idCountRef.current;
} // If there's no useIdState, we check if `baseId` was passed (as a prop,
// not from useIdState).
if (options.baseId) {
return "-" + generateId("");
}
return "";
}),
suffix = _React$useState[0]; // `baseId` will be the prop passed directly as a prop or via useIdState.
// If there's neither, then it'll fallback to Context's generateId.
// This generateId can result in a sequential ID (if there's a Provider)
// or a random string (without Provider).
var baseId = Object(react__WEBPACK_IMPORTED_MODULE_3__["useMemo"])(function () {
return options.baseId || generateId();
}, [options.baseId, generateId]);
var id = htmlProps.id || options.id || "" + baseId + suffix;
return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])(Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({}, options), {}, {
id: id
});
},
useProps: function useProps(options, htmlProps) {
return Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* a */ "b"])({
id: options.id
}, htmlProps);
}
});
var unstable_Id = Object(reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__[/* createComponent */ "a"])({
as: "div",
useHook: unstable_useId
});
/***/ }),
/***/ "yy3d":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $match = GetIntrinsic('%Symbol.match%', true);
var hasRegExpMatcher = __webpack_require__("SegQ");
var ToBoolean = __webpack_require__("kvlw");
// https://ecma-international.org/ecma-262/6.0/#sec-isregexp
module.exports = function IsRegExp(argument) {
if (!argument || typeof argument !== 'object') {
return false;
}
if ($match) {
var isRegExp = argument[$match];
if (typeof isRegExp !== 'undefined') {
return ToBoolean(isRegExp);
}
}
return hasRegExpMatcher(argument);
};
/***/ }),
/***/ "yyeE":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var GetIntrinsic = __webpack_require__("rZ7t");
var $Math = GetIntrinsic('%Math%');
var $Number = GetIntrinsic('%Number%');
module.exports = $Number.MAX_SAFE_INTEGER || $Math.pow(2, 53) - 1;
/***/ }),
/***/ "z3X9":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var has = __webpack_require__("oNNP");
var assertRecord = __webpack_require__("10Kj");
var Type = __webpack_require__("V1cy");
// https://ecma-international.org/ecma-262/6.0/#sec-isaccessordescriptor
module.exports = function IsAccessorDescriptor(Desc) {
if (typeof Desc === 'undefined') {
return false;
}
assertRecord(Type, 'Property Descriptor', 'Desc', Desc);
if (!has(Desc, '[[Get]]') && !has(Desc, '[[Set]]')) {
return false;
}
return true;
};
/***/ }),
/***/ "z9I/":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return StyleSheet; });
/*
Based off glamor's StyleSheet, thanks Sunil ❤️
high performance StyleSheet for css-in-js systems
- uses multiple style tags behind the scenes for millions of rules
- uses `insertRule` for appending in production for *much* faster performance
// usage
import { StyleSheet } from '@emotion/sheet'
let styleSheet = new StyleSheet({ key: '', container: document.head })
styleSheet.insert('#box { border: 1px solid red; }')
- appends a css rule into the stylesheet
styleSheet.flush()
- empties the stylesheet of all its contents
*/
// $FlowFixMe
function sheetForTag(tag) {
if (tag.sheet) {
// $FlowFixMe
return tag.sheet;
} // this weirdness brought to you by firefox
/* istanbul ignore next */
for (var i = 0; i < document.styleSheets.length; i++) {
if (document.styleSheets[i].ownerNode === tag) {
// $FlowFixMe
return document.styleSheets[i];
}
}
}
function createStyleElement(options) {
var tag = document.createElement('style');
tag.setAttribute('data-emotion', options.key);
if (options.nonce !== undefined) {
tag.setAttribute('nonce', options.nonce);
}
tag.appendChild(document.createTextNode(''));
return tag;
}
var StyleSheet =
/*#__PURE__*/
function () {
function StyleSheet(options) {
this.isSpeedy = options.speedy === undefined ? "production" === 'production' : options.speedy;
this.tags = [];
this.ctr = 0;
this.nonce = options.nonce; // key is the value of the data-emotion attribute, it's used to identify different sheets
this.key = options.key;
this.container = options.container;
this.before = null;
}
var _proto = StyleSheet.prototype;
_proto.insert = function insert(rule) {
// the max length is how many rules we have per style tag, it's 65000 in speedy mode
// it's 1 in dev because we insert source maps that map a single rule to a location
// and you can only have one source map per style tag
if (this.ctr % (this.isSpeedy ? 65000 : 1) === 0) {
var _tag = createStyleElement(this);
var before;
if (this.tags.length === 0) {
before = this.before;
} else {
before = this.tags[this.tags.length - 1].nextSibling;
}
this.container.insertBefore(_tag, before);
this.tags.push(_tag);
}
var tag = this.tags[this.tags.length - 1];
if (this.isSpeedy) {
var sheet = sheetForTag(tag);
try {
// this is a really hot path
// we check the second character first because having "i"
// as the second character will happen less often than
// having "@" as the first character
var isImportRule = rule.charCodeAt(1) === 105 && rule.charCodeAt(0) === 64; // this is the ultrafast version, works across browsers
// the big drawback is that the css won't be editable in devtools
sheet.insertRule(rule, // we need to insert @import rules before anything else
// otherwise there will be an error
// technically this means that the @import rules will
// _usually_(not always since there could be multiple style tags)
// be the first ones in prod and generally later in dev
// this shouldn't really matter in the real world though
// @import is generally only used for font faces from google fonts and etc.
// so while this could be technically correct then it would be slower and larger
// for a tiny bit of correctness that won't matter in the real world
isImportRule ? 0 : sheet.cssRules.length);
} catch (e) {
if (false) {}
}
} else {
tag.appendChild(document.createTextNode(rule));
}
this.ctr++;
};
_proto.flush = function flush() {
// $FlowFixMe
this.tags.forEach(function (tag) {
return tag.parentNode.removeChild(tag);
});
this.tags = [];
this.ctr = 0;
};
return StyleSheet;
}();
/***/ }),
/***/ "zGFp":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* unused harmony export Role */
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return useRole; });
/* harmony import */ var _rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("BZp5");
/* harmony import */ var reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("hE48");
/* harmony import */ var reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("qdes");
/* harmony import */ var reakit_utils_shallowEqual__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("uqqE");
// Automatically generated
var ROLE_KEYS = ["unstable_system"];
var useRole = Object(reakit_system_createHook__WEBPACK_IMPORTED_MODULE_2__[/* createHook */ "a"])({
name: "Role",
keys: ROLE_KEYS,
propsAreEqual: function propsAreEqual(prev, next) {
var prevSystem = prev.unstable_system,
prevProps = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(prev, ["unstable_system"]);
var nextSystem = next.unstable_system,
nextProps = Object(_rollupPluginBabelHelpers_1f0bf8c2_js__WEBPACK_IMPORTED_MODULE_0__[/* _ */ "a"])(next, ["unstable_system"]);
if (prevSystem !== nextSystem && !Object(reakit_utils_shallowEqual__WEBPACK_IMPORTED_MODULE_3__[/* shallowEqual */ "a"])(prevSystem, nextSystem)) {
return false;
}
return Object(reakit_utils_shallowEqual__WEBPACK_IMPORTED_MODULE_3__[/* shallowEqual */ "a"])(prevProps, nextProps);
}
});
var Role = Object(reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_1__[/* createComponent */ "a"])({
as: "div",
useHook: useRole
});
/***/ }),
/***/ "zN8g":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _object = __webpack_require__("Koq/");
var _object2 = _interopRequireDefault(_object);
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _airbnbPropTypes = __webpack_require__("Hsqg");
var _reactWithStyles = __webpack_require__("TG4+");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
var propTypes = (0, _airbnbPropTypes.forbidExtraProps)((0, _object2['default'])({}, _reactWithStyles.withStylesPropTypes, {
unicode: _propTypes2['default'].string.isRequired,
label: _propTypes2['default'].string.isRequired,
action: _propTypes2['default'].string.isRequired,
block: _propTypes2['default'].bool
}));
var defaultProps = {
block: false
};
function KeyboardShortcutRow(_ref) {
var unicode = _ref.unicode,
label = _ref.label,
action = _ref.action,
block = _ref.block,
styles = _ref.styles;
return _react2['default'].createElement(
'li',
(0, _reactWithStyles.css)(styles.KeyboardShortcutRow, block && styles.KeyboardShortcutRow__block),
_react2['default'].createElement(
'div',
(0, _reactWithStyles.css)(styles.KeyboardShortcutRow_keyContainer, block && styles.KeyboardShortcutRow_keyContainer__block),
_react2['default'].createElement(
'span',
_extends({}, (0, _reactWithStyles.css)(styles.KeyboardShortcutRow_key), {
role: 'img',
'aria-label': String(label) + ',' // add comma so screen readers will pause before reading action
}),
unicode
)
),
_react2['default'].createElement(
'div',
(0, _reactWithStyles.css)(styles.KeyboardShortcutRow_action),
action
)
);
}
KeyboardShortcutRow.propTypes = propTypes;
KeyboardShortcutRow.defaultProps = defaultProps;
exports['default'] = (0, _reactWithStyles.withStyles)(function (_ref2) {
var color = _ref2.reactDates.color;
return {
KeyboardShortcutRow: {
listStyle: 'none',
margin: '6px 0'
},
KeyboardShortcutRow__block: {
marginBottom: 16
},
KeyboardShortcutRow_keyContainer: {
display: 'inline-block',
whiteSpace: 'nowrap',
textAlign: 'right',
marginRight: 6
},
KeyboardShortcutRow_keyContainer__block: {
textAlign: 'left',
display: 'inline'
},
KeyboardShortcutRow_key: {
fontFamily: 'monospace',
fontSize: 12,
textTransform: 'uppercase',
background: color.core.grayLightest,
padding: '2px 6px'
},
KeyboardShortcutRow_action: {
display: 'inline',
wordBreak: 'break-word',
marginLeft: 8
}
};
})(KeyboardShortcutRow);
/***/ }),
/***/ "zTEx":
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ToolbarItem; });
/* unused harmony export useToolbarItem */
/* harmony import */ var reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__("hE48");
/* harmony import */ var reakit_system_createHook__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__("qdes");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__("cDcd");
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_2__);
/* harmony import */ var reakit_warning__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__("KA1K");
/* harmony import */ var _Composite_CompositeItem_js__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__("kTC8");
/* harmony import */ var _keys_ae468c11_js__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__("mjVI");
var useToolbarItem = Object(reakit_system_createHook__WEBPACK_IMPORTED_MODULE_1__[/* createHook */ "a"])({
name: "ToolbarItem",
compose: _Composite_CompositeItem_js__WEBPACK_IMPORTED_MODULE_4__[/* useCompositeItem */ "b"],
keys: _keys_ae468c11_js__WEBPACK_IMPORTED_MODULE_5__[/* a */ "b"]
});
var ToolbarItem = Object(reakit_system_createComponent__WEBPACK_IMPORTED_MODULE_0__[/* createComponent */ "a"])({
as: "button",
memo: true,
useHook: useToolbarItem
});
/***/ }),
/***/ "zYbv":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var assertRecord = __webpack_require__("10Kj");
var Type = __webpack_require__("V1cy");
// https://ecma-international.org/ecma-262/6.0/#sec-frompropertydescriptor
module.exports = function FromPropertyDescriptor(Desc) {
if (typeof Desc === 'undefined') {
return Desc;
}
assertRecord(Type, 'Property Descriptor', 'Desc', Desc);
var obj = {};
if ('[[Value]]' in Desc) {
obj.value = Desc['[[Value]]'];
}
if ('[[Writable]]' in Desc) {
obj.writable = Desc['[[Writable]]'];
}
if ('[[Get]]' in Desc) {
obj.get = Desc['[[Get]]'];
}
if ('[[Set]]' in Desc) {
obj.set = Desc['[[Set]]'];
}
if ('[[Enumerable]]' in Desc) {
obj.enumerable = Desc['[[Enumerable]]'];
}
if ('[[Configurable]]' in Desc) {
obj.configurable = Desc['[[Configurable]]'];
}
return obj;
};
/***/ }),
/***/ "zfJ5":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; };
var _object = __webpack_require__("Koq/");
var _object2 = _interopRequireDefault(_object);
var _react = __webpack_require__("cDcd");
var _react2 = _interopRequireDefault(_react);
var _propTypes = __webpack_require__("17x9");
var _propTypes2 = _interopRequireDefault(_propTypes);
var _airbnbPropTypes = __webpack_require__("Hsqg");
var _reactWithStyles = __webpack_require__("TG4+");
var _defaultPhrases = __webpack_require__("vV+G");
var _getPhrasePropTypes = __webpack_require__("yc2e");
var _getPhrasePropTypes2 = _interopRequireDefault(_getPhrasePropTypes);
var _LeftArrow = __webpack_require__("0XP8");
var _LeftArrow2 = _interopRequireDefault(_LeftArrow);
var _RightArrow = __webpack_require__("gZI3");
var _RightArrow2 = _interopRequireDefault(_RightArrow);
var _ChevronUp = __webpack_require__("9gmn");
var _ChevronUp2 = _interopRequireDefault(_ChevronUp);
var _ChevronDown = __webpack_require__("DHWS");
var _ChevronDown2 = _interopRequireDefault(_ChevronDown);
var _ScrollableOrientationShape = __webpack_require__("aE6U");
var _ScrollableOrientationShape2 = _interopRequireDefault(_ScrollableOrientationShape);
var _constants = __webpack_require__("Fv1B");
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; }
function _toConsumableArray(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } else { return Array.from(arr); } }
var propTypes = (0, _airbnbPropTypes.forbidExtraProps)((0, _object2['default'])({}, _reactWithStyles.withStylesPropTypes, {
navPrev: _propTypes2['default'].node,
navNext: _propTypes2['default'].node,
orientation: _ScrollableOrientationShape2['default'],
onPrevMonthClick: _propTypes2['default'].func,
onNextMonthClick: _propTypes2['default'].func,
// internationalization
phrases: _propTypes2['default'].shape((0, _getPhrasePropTypes2['default'])(_defaultPhrases.DayPickerNavigationPhrases)),
isRTL: _propTypes2['default'].bool
}));
var defaultProps = {
navPrev: null,
navNext: null,
orientation: _constants.HORIZONTAL_ORIENTATION,
onPrevMonthClick: function () {
function onPrevMonthClick() {}
return onPrevMonthClick;
}(),
onNextMonthClick: function () {
function onNextMonthClick() {}
return onNextMonthClick;
}(),
// internationalization
phrases: _defaultPhrases.DayPickerNavigationPhrases,
isRTL: false
};
function DayPickerNavigation(_ref) {
var navPrev = _ref.navPrev,
navNext = _ref.navNext,
onPrevMonthClick = _ref.onPrevMonthClick,
onNextMonthClick = _ref.onNextMonthClick,
orientation = _ref.orientation,
phrases = _ref.phrases,
isRTL = _ref.isRTL,
styles = _ref.styles;
var isHorizontal = orientation === _constants.HORIZONTAL_ORIENTATION;
var isVertical = orientation !== _constants.HORIZONTAL_ORIENTATION;
var isVerticalScrollable = orientation === _constants.VERTICAL_SCROLLABLE;
var navPrevIcon = navPrev;
var navNextIcon = navNext;
var isDefaultNavPrev = false;
var isDefaultNavNext = false;
if (!navPrevIcon) {
isDefaultNavPrev = true;
var Icon = isVertical ? _ChevronUp2['default'] : _LeftArrow2['default'];
if (isRTL && !isVertical) {
Icon = _RightArrow2['default'];
}
navPrevIcon = _react2['default'].createElement(Icon, (0, _reactWithStyles.css)(isHorizontal && styles.DayPickerNavigation_svg__horizontal, isVertical && styles.DayPickerNavigation_svg__vertical));
}
if (!navNextIcon) {
isDefaultNavNext = true;
var _Icon = isVertical ? _ChevronDown2['default'] : _RightArrow2['default'];
if (isRTL && !isVertical) {
_Icon = _LeftArrow2['default'];
}
navNextIcon = _react2['default'].createElement(_Icon, (0, _reactWithStyles.css)(isHorizontal && styles.DayPickerNavigation_svg__horizontal, isVertical && styles.DayPickerNavigation_svg__vertical));
}
var isDefaultNav = isVerticalScrollable ? isDefaultNavNext : isDefaultNavNext || isDefaultNavPrev;
return _react2['default'].createElement(
'div',
_reactWithStyles.css.apply(undefined, [styles.DayPickerNavigation, isHorizontal && styles.DayPickerNavigation__horizontal].concat(_toConsumableArray(isVertical && [styles.DayPickerNavigation__vertical, isDefaultNav && styles.DayPickerNavigation__verticalDefault]), _toConsumableArray(isVerticalScrollable && [styles.DayPickerNavigation__verticalScrollable, isDefaultNav && styles.DayPickerNavigation__verticalScrollableDefault]))),
!isVerticalScrollable && _react2['default'].createElement(
'div',
_extends({
role: 'button',
tabIndex: '0'
}, _reactWithStyles.css.apply(undefined, [styles.DayPickerNavigation_button, isDefaultNavPrev && styles.DayPickerNavigation_button__default].concat(_toConsumableArray(isHorizontal && [styles.DayPickerNavigation_button__horizontal].concat(_toConsumableArray(isDefaultNavPrev && [styles.DayPickerNavigation_button__horizontalDefault, !isRTL && styles.DayPickerNavigation_leftButton__horizontalDefault, isRTL && styles.DayPickerNavigation_rightButton__horizontalDefault]))), _toConsumableArray(isVertical && [styles.DayPickerNavigation_button__vertical].concat(_toConsumableArray(isDefaultNavPrev && [styles.DayPickerNavigation_button__verticalDefault, styles.DayPickerNavigation_prevButton__verticalDefault]))))), {
'aria-label': phrases.jumpToPrevMonth,
onClick: onPrevMonthClick,
onKeyUp: function () {
function onKeyUp(e) {
var key = e.key;
if (key === 'Enter' || key === ' ') onPrevMonthClick(e);
}
return onKeyUp;
}(),
onMouseUp: function () {
function onMouseUp(e) {
e.currentTarget.blur();
}
return onMouseUp;
}()
}),
navPrevIcon
),
_react2['default'].createElement(
'div',
_extends({
role: 'button',
tabIndex: '0'
}, _reactWithStyles.css.apply(undefined, [styles.DayPickerNavigation_button, isDefaultNavNext && styles.DayPickerNavigation_button__default].concat(_toConsumableArray(isHorizontal && [styles.DayPickerNavigation_button__horizontal].concat(_toConsumableArray(isDefaultNavNext && [styles.DayPickerNavigation_button__horizontalDefault, isRTL && styles.DayPickerNavigation_leftButton__horizontalDefault, !isRTL && styles.DayPickerNavigation_rightButton__horizontalDefault]))), _toConsumableArray(isVertical && [styles.DayPickerNavigation_button__vertical, styles.DayPickerNavigation_nextButton__vertical].concat(_toConsumableArray(isDefaultNavNext && [styles.DayPickerNavigation_button__verticalDefault, styles.DayPickerNavigation_nextButton__verticalDefault, isVerticalScrollable && styles.DayPickerNavigation_nextButton__verticalScrollableDefault]))))), {
'aria-label': phrases.jumpToNextMonth,
onClick: onNextMonthClick,
onKeyUp: function () {
function onKeyUp(e) {
var key = e.key;
if (key === 'Enter' || key === ' ') onNextMonthClick(e);
}
return onKeyUp;
}(),
onMouseUp: function () {
function onMouseUp(e) {
e.currentTarget.blur();
}
return onMouseUp;
}()
}),
navNextIcon
)
);
}
DayPickerNavigation.propTypes = propTypes;
DayPickerNavigation.defaultProps = defaultProps;
exports['default'] = (0, _reactWithStyles.withStyles)(function (_ref2) {
var _ref2$reactDates = _ref2.reactDates,
color = _ref2$reactDates.color,
zIndex = _ref2$reactDates.zIndex;
return {
DayPickerNavigation: {
position: 'relative',
zIndex: zIndex + 2
},
DayPickerNavigation__horizontal: {
height: 0
},
DayPickerNavigation__vertical: {},
DayPickerNavigation__verticalScrollable: {},
DayPickerNavigation__verticalDefault: {
position: 'absolute',
width: '100%',
height: 52,
bottom: 0,
left: 0
},
DayPickerNavigation__verticalScrollableDefault: {
position: 'relative'
},
DayPickerNavigation_button: {
cursor: 'pointer',
userSelect: 'none',
border: 0,
padding: 0,
margin: 0
},
DayPickerNavigation_button__default: {
border: '1px solid ' + String(color.core.borderLight),
backgroundColor: color.background,
color: color.placeholderText,
':focus': {
border: '1px solid ' + String(color.core.borderMedium)
},
':hover': {
border: '1px solid ' + String(color.core.borderMedium)
},
':active': {
background: color.backgroundDark
}
},
DayPickerNavigation_button__horizontal: {},
DayPickerNavigation_button__horizontalDefault: {
position: 'absolute',
top: 18,
lineHeight: 0.78,
borderRadius: 3,
padding: '6px 9px'
},
DayPickerNavigation_leftButton__horizontalDefault: {
left: 22
},
DayPickerNavigation_rightButton__horizontalDefault: {
right: 22
},
DayPickerNavigation_button__vertical: {},
DayPickerNavigation_button__verticalDefault: {
padding: 5,
background: color.background,
boxShadow: '0 0 5px 2px rgba(0, 0, 0, 0.1)',
position: 'relative',
display: 'inline-block',
height: '100%',
width: '50%'
},
DayPickerNavigation_prevButton__verticalDefault: {},
DayPickerNavigation_nextButton__verticalDefault: {
borderLeft: 0
},
DayPickerNavigation_nextButton__verticalScrollableDefault: {
width: '100%'
},
DayPickerNavigation_svg__horizontal: {
height: 19,
width: 19,
fill: color.core.grayLight,
display: 'block'
},
DayPickerNavigation_svg__vertical: {
height: 42,
width: 42,
fill: color.text,
display: 'block'
}
};
})(DayPickerNavigation);
/***/ }),
/***/ "zt9T":
/***/ (function(module, exports, __webpack_require__) {
"use strict";
var util = __webpack_require__("jB5C");
function scrollIntoView(elem, container, config) {
config = config || {};
// document 归一化到 window
if (container.nodeType === 9) {
container = util.getWindow(container);
}
var allowHorizontalScroll = config.allowHorizontalScroll;
var onlyScrollIfNeeded = config.onlyScrollIfNeeded;
var alignWithTop = config.alignWithTop;
var alignWithLeft = config.alignWithLeft;
var offsetTop = config.offsetTop || 0;
var offsetLeft = config.offsetLeft || 0;
var offsetBottom = config.offsetBottom || 0;
var offsetRight = config.offsetRight || 0;
allowHorizontalScroll = allowHorizontalScroll === undefined ? true : allowHorizontalScroll;
var isWin = util.isWindow(container);
var elemOffset = util.offset(elem);
var eh = util.outerHeight(elem);
var ew = util.outerWidth(elem);
var containerOffset = undefined;
var ch = undefined;
var cw = undefined;
var containerScroll = undefined;
var diffTop = undefined;
var diffBottom = undefined;
var win = undefined;
var winScroll = undefined;
var ww = undefined;
var wh = undefined;
if (isWin) {
win = container;
wh = util.height(win);
ww = util.width(win);
winScroll = {
left: util.scrollLeft(win),
top: util.scrollTop(win)
};
// elem 相对 container 可视视窗的距离
diffTop = {
left: elemOffset.left - winScroll.left - offsetLeft,
top: elemOffset.top - winScroll.top - offsetTop
};
diffBottom = {
left: elemOffset.left + ew - (winScroll.left + ww) + offsetRight,
top: elemOffset.top + eh - (winScroll.top + wh) + offsetBottom
};
containerScroll = winScroll;
} else {
containerOffset = util.offset(container);
ch = container.clientHeight;
cw = container.clientWidth;
containerScroll = {
left: container.scrollLeft,
top: container.scrollTop
};
// elem 相对 container 可视视窗的距离
// 注意边框, offset 是边框到根节点
diffTop = {
left: elemOffset.left - (containerOffset.left + (parseFloat(util.css(container, 'borderLeftWidth')) || 0)) - offsetLeft,
top: elemOffset.top - (containerOffset.top + (parseFloat(util.css(container, 'borderTopWidth')) || 0)) - offsetTop
};
diffBottom = {
left: elemOffset.left + ew - (containerOffset.left + cw + (parseFloat(util.css(container, 'borderRightWidth')) || 0)) + offsetRight,
top: elemOffset.top + eh - (containerOffset.top + ch + (parseFloat(util.css(container, 'borderBottomWidth')) || 0)) + offsetBottom
};
}
if (diffTop.top < 0 || diffBottom.top > 0) {
// 强制向上
if (alignWithTop === true) {
util.scrollTop(container, containerScroll.top + diffTop.top);
} else if (alignWithTop === false) {
util.scrollTop(container, containerScroll.top + diffBottom.top);
} else {
// 自动调整
if (diffTop.top < 0) {
util.scrollTop(container, containerScroll.top + diffTop.top);
} else {
util.scrollTop(container, containerScroll.top + diffBottom.top);
}
}
} else {
if (!onlyScrollIfNeeded) {
alignWithTop = alignWithTop === undefined ? true : !!alignWithTop;
if (alignWithTop) {
util.scrollTop(container, containerScroll.top + diffTop.top);
} else {
util.scrollTop(container, containerScroll.top + diffBottom.top);
}
}
}
if (allowHorizontalScroll) {
if (diffTop.left < 0 || diffBottom.left > 0) {
// 强制向上
if (alignWithLeft === true) {
util.scrollLeft(container, containerScroll.left + diffTop.left);
} else if (alignWithLeft === false) {
util.scrollLeft(container, containerScroll.left + diffBottom.left);
} else {
// 自动调整
if (diffTop.left < 0) {
util.scrollLeft(container, containerScroll.left + diffTop.left);
} else {
util.scrollLeft(container, containerScroll.left + diffBottom.left);
}
}
} else {
if (!onlyScrollIfNeeded) {
alignWithLeft = alignWithLeft === undefined ? true : !!alignWithLeft;
if (alignWithLeft) {
util.scrollLeft(container, containerScroll.left + diffTop.left);
} else {
util.scrollLeft(container, containerScroll.left + diffBottom.left);
}
}
}
}
}
module.exports = scrollIntoView;
/***/ })
/******/ });