// EXTERNAL MODULE: external ["wp","i18n"]
var external_wp_i18n_ = __webpack_require__("l3Sj");
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/popover/utils.js
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(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(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; }
var 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
* @param {string} chosenYAxis yAxis to be used.
* @param {Element} boundaryElement Boundary element.
* @param {boolean} forcePosition Don't adjust position based on anchor.
* @return {Object} Popover xAxis position and constraints.
function computePopoverXAxisPosition(anchorRect, contentSize, xAxis, corner, stickyBoundaryElement, chosenYAxis, boundaryElement, forcePosition) {
var width = contentSize.width; // Correct xAxis for RTL support
if (xAxis === 'left' && Object(external_wp_i18n_["isRTL"])()) {
} else if (xAxis === 'right' && Object(external_wp_i18n_["isRTL"])()) {
if (corner === 'left' && Object(external_wp_i18n_["isRTL"])()) {
} else if (corner === 'right' && Object(external_wp_i18n_["isRTL"])()) {
} // x axis alignment choices
var anchorMidPoint = Math.round(anchorRect.left + anchorRect.width / 2);
popoverLeft: anchorMidPoint,
contentWidth: (anchorMidPoint - width / 2 > 0 ? width / 2 : anchorMidPoint) + (anchorMidPoint + width / 2 > window.innerWidth ? window.innerWidth - anchorMidPoint : width / 2)
var leftAlignmentX = anchorRect.left;
if (corner === 'right') {
leftAlignmentX = anchorRect.right;
} else if (chosenYAxis !== 'middle') {
leftAlignmentX = anchorMidPoint;
var rightAlignmentX = anchorRect.right;
rightAlignmentX = anchorRect.left;
} else if (chosenYAxis !== 'middle') {
rightAlignmentX = anchorMidPoint;
popoverLeft: leftAlignmentX,
contentWidth: leftAlignmentX - width > 0 ? width : leftAlignmentX
popoverLeft: rightAlignmentX,
contentWidth: rightAlignmentX + width > window.innerWidth ? window.innerWidth - rightAlignmentX : width
}; // Choosing the x axis
if (!stickyBoundaryElement && !forcePosition) {
if (xAxis === 'center' && centerAlignment.contentWidth === width) {
} else if (xAxis === 'left' && leftAlignment.contentWidth === width) {
} else if (xAxis === 'right' && rightAlignment.contentWidth === width) {
chosenXAxis = leftAlignment.contentWidth > rightAlignment.contentWidth ? 'left' : 'right';
var 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) {
centerAlignment.popoverLeft = window.innerWidth / 2;
if (chosenXAxis === 'center') {
popoverLeft = centerAlignment.popoverLeft;
} else if (chosenXAxis === 'left') {
popoverLeft = leftAlignment.popoverLeft;
popoverLeft = rightAlignment.popoverLeft;
var boundaryRect = boundaryElement.getBoundingClientRect();
popoverLeft = Math.min(popoverLeft, boundaryRect.right - width);
popoverLeft: popoverLeft,
contentWidth: 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
* @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) {
var height = contentSize.height;
if (stickyBoundaryElement) {
var stickyRect = stickyBoundaryElement.getBoundingClientRect();
var stickyPosition = stickyRect.top + height - relativeOffsetTop;
if (anchorRect.top <= stickyPosition) {
popoverTop: Math.min(anchorRect.bottom, stickyPosition)
} // y axis alignment choices
var anchorMidPoint = anchorRect.top + anchorRect.height / 2;
if (corner === 'bottom') {
anchorMidPoint = anchorRect.bottom;
} else if (corner === 'top') {
anchorMidPoint = anchorRect.top;
popoverTop: anchorMidPoint,
contentHeight: (anchorMidPoint - height / 2 > 0 ? height / 2 : anchorMidPoint) + (anchorMidPoint + height / 2 > window.innerHeight ? window.innerHeight - anchorMidPoint : height / 2)
popoverTop: anchorRect.top,
contentHeight: anchorRect.top - HEIGHT_OFFSET - height > 0 ? height : anchorRect.top - HEIGHT_OFFSET
popoverTop: anchorRect.bottom,
contentHeight: anchorRect.bottom + HEIGHT_OFFSET + height > window.innerHeight ? window.innerHeight - HEIGHT_OFFSET - anchorRect.bottom : height
}; // Choosing the y axis
var contentHeight = null;
if (!stickyBoundaryElement && !forcePosition) {
if (yAxis === 'middle' && middleAlignment.contentHeight === height) {
} else if (yAxis === 'top' && topAlignment.contentHeight === height) {
} else if (yAxis === 'bottom' && bottomAlignment.contentHeight === height) {
chosenYAxis = topAlignment.contentHeight > bottomAlignment.contentHeight ? 'top' : 'bottom';
var chosenHeight = chosenYAxis === 'top' ? topAlignment.contentHeight : bottomAlignment.contentHeight;
contentHeight = chosenHeight !== height ? chosenHeight : null;
if (chosenYAxis === 'middle') {
popoverTop = middleAlignment.popoverTop;
} else if (chosenYAxis === 'top') {
popoverTop = topAlignment.popoverTop;
popoverTop = bottomAlignment.popoverTop;
contentHeight: 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
* @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.
* @return {Object} Popover position and constraints.
function computePopoverPosition(anchorRect, contentSize) {
var position = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : 'top';
var stickyBoundaryElement = arguments.length > 3 ? arguments[3] : undefined;
var anchorRef = arguments.length > 4 ? arguments[4] : undefined;
var relativeOffsetTop = arguments.length > 5 ? arguments[5] : undefined;
var boundaryElement = arguments.length > 6 ? arguments[6] : undefined;
var forcePosition = arguments.length > 7 ? arguments[7] : undefined;
var _position$split = position.split(' '),
_position$split2 = Object(slicedToArray["a" /* default */])(_position$split, 3),
yAxis = _position$split2[0],
_position$split2$ = _position$split2[1],
xAxis = _position$split2$ === void 0 ? 'center' : _position$split2$,
corner = _position$split2[2];
var yAxisPosition = computePopoverYAxisPosition(anchorRect, contentSize, yAxis, corner, stickyBoundaryElement, anchorRef, relativeOffsetTop, forcePosition);
var xAxisPosition = computePopoverXAxisPosition(anchorRect, contentSize, xAxis, corner, stickyBoundaryElement, yAxisPosition.yAxis, boundaryElement, forcePosition);
return _objectSpread(_objectSpread({}, xAxisPosition), yAxisPosition);
// 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 + 6 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
* Name of slot in which popover should fill.
var SLOT_NAME = 'Popover';
function offsetIframe(rect, ownerDocument) {
var defaultView = ownerDocument.defaultView;
var frameElement = defaultView.frameElement;
var iframeRect = frameElement.getBoundingClientRect();
return new defaultView.DOMRect(rect.left + iframeRect.left, rect.top + iframeRect.top, rect.width, rect.height);
function computeAnchorRect(anchorRefFallback, anchorRect, getAnchorRect) {
var anchorRef = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
var shouldAnchorIncludePadding = arguments.length > 4 ? arguments[4] : undefined;
if (!anchorRefFallback.current) {
return getAnchorRect(anchorRefFallback.current);
if (anchorRef !== false) {
if (!anchorRef || !window.Range || !window.Element || !window.DOMRect) {
} // Duck-type to check if `anchorRef` is an instance of Range
// `anchorRef instanceof window.Range` checks will break across document boundaries
if (typeof (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.cloneRange) === 'function') {
return offsetIframe(Object(external_wp_dom_["getRectangleFromRange"])(anchorRef), anchorRef.endContainer.ownerDocument);
} // Duck-type to check if `anchorRef` is an instance of Element
// `anchorRef instanceof window.Element` checks will break across document boundaries
if (typeof (anchorRef === null || anchorRef === void 0 ? void 0 : anchorRef.getBoundingClientRect) === 'function') {
var _rect2 = offsetIframe(anchorRef.getBoundingClientRect(), anchorRef.ownerDocument);
if (shouldAnchorIncludePadding) {
return withoutPadding(_rect2, anchorRef);
bottom = anchorRef.bottom;
var topRect = top.getBoundingClientRect();
var bottomRect = bottom.getBoundingClientRect();
var _rect = offsetIframe(new window.DOMRect(topRect.left, topRect.top, topRect.width, bottomRect.bottom - topRect.top), top.ownerDocument);
if (shouldAnchorIncludePadding) {
return withoutPadding(_rect, anchorRef);
if (!anchorRefFallback.current) {
var parentNode = anchorRefFallback.current.parentNode;
var rect = parentNode.getBoundingClientRect();
if (shouldAnchorIncludePadding) {
return withoutPadding(rect, parentNode);
function getComputedStyle(node) {
return node.ownerDocument.defaultView.getComputedStyle(node);
function withoutPadding(rect, element) {
var _getComputedStyle = getComputedStyle(element),
paddingTop = _getComputedStyle.paddingTop,
paddingBottom = _getComputedStyle.paddingBottom,
paddingLeft = _getComputedStyle.paddingLeft,
paddingRight = _getComputedStyle.paddingRight;
var top = paddingTop ? parseInt(paddingTop, 10) : 0;
var bottom = paddingBottom ? parseInt(paddingBottom, 10) : 0;
var left = paddingLeft ? parseInt(paddingLeft, 10) : 0;
var right = paddingRight ? parseInt(paddingRight, 10) : 0;
width: rect.width - left - right,
height: rect.height - top - bottom,
right: rect.right - right,
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
function setAttribute(element, name, 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
function setStyle(element, property) {
var value = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : '';
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 (!element.classList.contains(name)) {
element.classList.add(name);
} else if (element.classList.contains(name)) {
element.classList.remove(name);
function getAnchorDocument(anchor) {
if (anchor.endContainer) {
return anchor.endContainer.ownerDocument;
return anchor.top.ownerDocument;
return anchor.ownerDocument;
var popover_Popover = function Popover(_ref) {
var headerTitle = _ref.headerTitle,
onKeyDown = _ref.onKeyDown,
children = _ref.children,
className = _ref.className,
_ref$noArrow = _ref.noArrow,
noArrow = _ref$noArrow === void 0 ? true : _ref$noArrow,
isAlternate = _ref.isAlternate,
_ref$position = _ref.position,