var termsByParent = Object(external_lodash_["groupBy"])(flatTermsWithParentAndChildren, 'parent');
if (termsByParent.null && termsByParent.null.length) {
return flatTermsWithParentAndChildren;
var fillWithChildren = function fillWithChildren(terms) {
return terms.map(function (term) {
var children = termsByParent[term.id];
return terms_objectSpread(terms_objectSpread({}, term), {}, {
children: children && children.length ? fillWithChildren(children) : []
return fillWithChildren(termsByParent['0'] || []);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/tree-select/index.js
function tree_select_getSelectOptions(tree) {
var level = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;
return Object(external_lodash_["flatMap"])(tree, function (treeNode) {
label: Object(external_lodash_["repeat"])("\xA0", level * 3) + Object(external_lodash_["unescape"])(treeNode.name)
}].concat(Object(toConsumableArray["a" /* default */])(tree_select_getSelectOptions(treeNode.children || [], level + 1)));
function TreeSelect(_ref) {
noOptionLabel = _ref.noOptionLabel,
onChange = _ref.onChange,
selectedId = _ref.selectedId,
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["label", "noOptionLabel", "onChange", "selectedId", "tree"]);
var options = Object(external_wp_element_["useMemo"])(function () {
return Object(external_lodash_["compact"])([noOptionLabel && {
}].concat(Object(toConsumableArray["a" /* default */])(tree_select_getSelectOptions(tree))));
}, [noOptionLabel, tree]);
return Object(external_wp_element_["createElement"])(select_control, Object(esm_extends["a" /* default */])({
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/query-controls/category-select.js
function CategorySelect(_ref) {
noOptionLabel = _ref.noOptionLabel,
categoriesList = _ref.categoriesList,
selectedCategoryId = _ref.selectedCategoryId,
onChange = _ref.onChange,
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["label", "noOptionLabel", "categoriesList", "selectedCategoryId", "onChange"]);
var termsTree = Object(external_wp_element_["useMemo"])(function () {
return buildTermsTree(categoriesList);
return Object(external_wp_element_["createElement"])(TreeSelect, Object(esm_extends["a" /* default */])({
noOptionLabel: noOptionLabel,
selectedId: selectedCategoryId
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/query-controls/author-select.js
function AuthorSelect(_ref) {
noOptionLabel = _ref.noOptionLabel,
authorList = _ref.authorList,
selectedAuthorId = _ref.selectedAuthorId,
onChange = _ref.onChange;
if (!authorList) return null;
var termsTree = buildTermsTree(authorList);
return Object(external_wp_element_["createElement"])(TreeSelect, Object(esm_extends["a" /* default */])({
noOptionLabel: noOptionLabel,
selectedId: selectedAuthorId
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/query-controls/index.js
var DEFAULT_MIN_ITEMS = 1;
var DEFAULT_MAX_ITEMS = 100;
var MAX_CATEGORIES_SUGGESTIONS = 20;
function QueryControls(_ref) {
var authorList = _ref.authorList,
selectedAuthorId = _ref.selectedAuthorId,
categoriesList = _ref.categoriesList,
selectedCategoryId = _ref.selectedCategoryId,
categorySuggestions = _ref.categorySuggestions,
selectedCategories = _ref.selectedCategories,
numberOfItems = _ref.numberOfItems,
_ref$maxItems = _ref.maxItems,
maxItems = _ref$maxItems === void 0 ? DEFAULT_MAX_ITEMS : _ref$maxItems,
_ref$minItems = _ref.minItems,
minItems = _ref$minItems === void 0 ? DEFAULT_MIN_ITEMS : _ref$minItems,
onCategoryChange = _ref.onCategoryChange,
onAuthorChange = _ref.onAuthorChange,
onNumberOfItemsChange = _ref.onNumberOfItemsChange,
onOrderChange = _ref.onOrderChange,
onOrderByChange = _ref.onOrderByChange;
return [onOrderChange && onOrderByChange && Object(external_wp_element_["createElement"])(select_control, {
key: "query-controls-order-select",
label: Object(external_wp_i18n_["__"])('Order by'),
value: "".concat(orderBy, "/").concat(order),
label: Object(external_wp_i18n_["__"])('Newest to oldest'),
label: Object(external_wp_i18n_["__"])('Oldest to newest'),
/* translators: label for ordering posts by title in ascending order */
label: Object(external_wp_i18n_["__"])('A → Z'),
/* translators: label for ordering posts by title in descending order */
label: Object(external_wp_i18n_["__"])('Z → A'),
onChange: function onChange(value) {
var _value$split = value.split('/'),
_value$split2 = Object(slicedToArray["a" /* default */])(_value$split, 2),
newOrderBy = _value$split2[0],
newOrder = _value$split2[1];
if (newOrder !== order) {
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(function (item) {
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",
label: Object(external_wp_i18n_["__"])('Author'),
noOptionLabel: Object(external_wp_i18n_["__"])('All'),
selectedAuthorId: selectedAuthorId,
}), onNumberOfItemsChange && Object(external_wp_element_["createElement"])(range_control, {
key: "query-controls-range-control",
label: Object(external_wp_i18n_["__"])('Number of items'),
onChange: onNumberOfItemsChange,
// EXTERNAL MODULE: ./node_modules/reakit/node_modules/reakit-warning/es/warning.js
var warning = __webpack_require__("JKGo");
// 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 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];
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, {
onChange === null || onChange === void 0 ? void 0 : onChange(event);
var useRadio = Object(createHook["a" /* createHook */])({
compose: CompositeItem["b" /* useCompositeItem */],
useOptions: function useOptions(_ref, _ref2) {
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 */])({
unstable_clickOnEnter: unstable_clickOnEnter,
unstable_checkOnFocus: unstable_checkOnFocus
value: (_options$value = options.value) != null ? _options$value : value
useProps: function useProps(options, _ref3) {
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;
false ? undefined : void 0;
if (element.tagName !== "INPUT" || element.type !== "radio") {
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) {
(_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 (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,
var Radio = Object(createComponent["a" /* createComponent */])({
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/radio-context/index.js
var RadioContext = Object(external_wp_element_["createContext"])({
setState: function setState() {}
/* harmony default export */ var radio_context = (RadioContext);
// CONCATENATED MODULE: ./node_modules/@wordpress/components/build-module/radio/index.js
function radio_Radio(_ref, ref) {
var children = _ref.children,
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["children", "value"]);
var radioContext = Object(external_wp_element_["useContext"])(radio_context);
var checked = radioContext.state === value;
return Object(external_wp_element_["createElement"])(Radio, Object(esm_extends["a" /* default */])({
as: build_module_button["a" /* default */],
}, 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) {
var _useSealedState = useSealedState(initialState),
initialValue = _useSealedState.state,
_useSealedState$loop = _useSealedState.loop,