From fe95143dc8db6b9b0f17b1a0c4d28aab98008470 Mon Sep 17 00:00:00 2001 From: HTMLBurger-NG Date: Fri, 10 Mar 2023 11:21:11 +0200 Subject: [PATCH] Bump v3.5.3 --- build/classic/metaboxes.js | 2 +- build/gutenberg/metaboxes.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/build/classic/metaboxes.js b/build/classic/metaboxes.js index e6bfa547..24a93b1e 100644 --- a/build/classic/metaboxes.js +++ b/build/classic/metaboxes.js @@ -1058,7 +1058,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _bab /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return handler; });\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ \"@wordpress/i18n\");\n/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _containers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../containers */ \"./packages/metaboxes/containers/index.js\");\n/* harmony import */ var _conditions_base__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../conditions/base */ \"./packages/metaboxes/monitors/conditional-display/conditions/base.js\");\n/* harmony import */ var _conditions_boolean__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../conditions/boolean */ \"./packages/metaboxes/monitors/conditional-display/conditions/boolean.js\");\n/* harmony import */ var _conditions_post_term__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../conditions/post-term */ \"./packages/metaboxes/monitors/conditional-display/conditions/post-term.js\");\n/* harmony import */ var _conditions_post_template__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../conditions/post-template */ \"./packages/metaboxes/monitors/conditional-display/conditions/post-template.js\");\n/* harmony import */ var _conditions_post_ancestor_id__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../conditions/post-ancestor-id */ \"./packages/metaboxes/monitors/conditional-display/conditions/post-ancestor-id.js\");\n/* harmony import */ var _conditions_term_parent_id__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../conditions/term-parent-id */ \"./packages/metaboxes/monitors/conditional-display/conditions/term-parent-id.js\");\n/* harmony import */ var _conditions_term_ancestor_id__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../conditions/term-ancestor-id */ \"./packages/metaboxes/monitors/conditional-display/conditions/term-ancestor-id.js\");\n\n/**\n * External dependencies.\n */\n\n\n\n/**\n * Internal dependencies.\n */\n\n\n\n\n\n\n\n\n\n/**\n * Keeps track of supported conditions.\n *\n * @type {Object}\n */\nvar conditions = {\n \"boolean\": _conditions_boolean__WEBPACK_IMPORTED_MODULE_5__[\"default\"],\n post_term: _conditions_post_term__WEBPACK_IMPORTED_MODULE_6__[\"default\"],\n post_ancestor_id: _conditions_post_ancestor_id__WEBPACK_IMPORTED_MODULE_8__[\"default\"],\n post_parent_id: _conditions_base__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n post_level: _conditions_base__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n post_format: _conditions_base__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n post_template: _conditions_post_template__WEBPACK_IMPORTED_MODULE_7__[\"default\"],\n term_level: _conditions_base__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n term_parent: _conditions_term_parent_id__WEBPACK_IMPORTED_MODULE_9__[\"default\"],\n term_ancestor: _conditions_term_ancestor_id__WEBPACK_IMPORTED_MODULE_10__[\"default\"],\n user_role: _conditions_base__WEBPACK_IMPORTED_MODULE_4__[\"default\"]\n};\n\n/**\n * Walks through the definitions and evaluates the conditions.\n *\n * @param {Object[]} definitions\n * @param {Object} values\n * @param {string} relation\n * @return {boolean}\n */\nfunction evaluate(definitions, values, relation) {\n var results = definitions.map(function (definition) {\n if (!definition.relation) {\n var condition = Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"get\"])(conditions, definition.type);\n if (condition) {\n return condition.isFulfiled(definition, values);\n } else {\n // eslint-disable-line no-else-return\n // eslint-disable-next-line no-console\n console.error(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__[\"sprintf\"])(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__[\"__\"])('Unsupported container condition - \"%1$s\".', 'carbon-fields-ui'), definition.type));\n return false;\n }\n } else {\n // eslint-disable-line no-else-return\n return evaluate(definition.conditions, values, definition.relation);\n }\n });\n switch (relation) {\n case 'AND':\n return results.every(Boolean);\n case 'OR':\n return results.some(Boolean);\n default:\n // eslint-disable-next-line no-console\n console.error(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__[\"sprintf\"])(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__[\"__\"])('Unsupported container condition relation used - \"%1$s\".', 'carbon-fields-ui'), relation));\n return false;\n }\n}\n\n/**\n * The function that causes the side effects.\n *\n * @param {Object} props\n * @param {Object} props.containers\n * @param {string} props.context\n * @return {Function}\n */\nfunction handler(_ref) {\n var containers = _ref.containers,\n context = _ref.context;\n return function (effect) {\n var results = Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"map\"])(containers, function (container, id) {\n return [id, evaluate(container.conditions.conditions, effect, container.conditions.relation)];\n });\n results.forEach(function (_ref2) {\n var _ref3 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_ref2, 2),\n id = _ref3[0],\n result = _ref3[1];\n var postboxNode = document.getElementById(id);\n var containerNode = document.querySelector(\".container-\".concat(id));\n var isMounted = !!containerNode.dataset.mounted;\n if (postboxNode) {\n postboxNode.hidden = !result;\n }\n if (containerNode) {\n if (result && !isMounted) {\n Object(_containers__WEBPACK_IMPORTED_MODULE_3__[\"renderContainer\"])(containers[id], context);\n }\n if (!result && isMounted) {\n delete containerNode.dataset.mounted;\n\n // Rely on React's internals instead of `unmountComponentAtNode`\n // due to https://github.com/facebook/react/issues/13690.\n // TODO: Conditionally render the fields in the container, this way\n // we can move away from mount/unmount cycles.\n containerNode._reactRootContainer.unmount();\n }\n }\n });\n };\n}\n\n//# sourceURL=webpack://cf.%5Bname%5D/./packages/metaboxes/monitors/conditional-display/handler/index.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return handler; });\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ \"@wordpress/i18n\");\n/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _containers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../containers */ \"./packages/metaboxes/containers/index.js\");\n/* harmony import */ var _conditions_base__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../conditions/base */ \"./packages/metaboxes/monitors/conditional-display/conditions/base.js\");\n/* harmony import */ var _conditions_boolean__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../conditions/boolean */ \"./packages/metaboxes/monitors/conditional-display/conditions/boolean.js\");\n/* harmony import */ var _conditions_post_term__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../conditions/post-term */ \"./packages/metaboxes/monitors/conditional-display/conditions/post-term.js\");\n/* harmony import */ var _conditions_post_template__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../conditions/post-template */ \"./packages/metaboxes/monitors/conditional-display/conditions/post-template.js\");\n/* harmony import */ var _conditions_post_ancestor_id__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../conditions/post-ancestor-id */ \"./packages/metaboxes/monitors/conditional-display/conditions/post-ancestor-id.js\");\n/* harmony import */ var _conditions_term_parent_id__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../conditions/term-parent-id */ \"./packages/metaboxes/monitors/conditional-display/conditions/term-parent-id.js\");\n/* harmony import */ var _conditions_term_ancestor_id__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../conditions/term-ancestor-id */ \"./packages/metaboxes/monitors/conditional-display/conditions/term-ancestor-id.js\");\n\n/**\r\n * External dependencies.\r\n */\n\n\n\n/**\r\n * Internal dependencies.\r\n */\n\n\n\n\n\n\n\n\n\n/**\r\n * Keeps track of supported conditions.\r\n *\r\n * @type {Object}\r\n */\nvar conditions = {\n \"boolean\": _conditions_boolean__WEBPACK_IMPORTED_MODULE_5__[\"default\"],\n post_term: _conditions_post_term__WEBPACK_IMPORTED_MODULE_6__[\"default\"],\n post_ancestor_id: _conditions_post_ancestor_id__WEBPACK_IMPORTED_MODULE_8__[\"default\"],\n post_parent_id: _conditions_base__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n post_level: _conditions_base__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n post_format: _conditions_base__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n post_template: _conditions_post_template__WEBPACK_IMPORTED_MODULE_7__[\"default\"],\n term_level: _conditions_base__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n term_parent: _conditions_term_parent_id__WEBPACK_IMPORTED_MODULE_9__[\"default\"],\n term_ancestor: _conditions_term_ancestor_id__WEBPACK_IMPORTED_MODULE_10__[\"default\"],\n user_role: _conditions_base__WEBPACK_IMPORTED_MODULE_4__[\"default\"]\n};\n\n/**\r\n * Walks through the definitions and evaluates the conditions.\r\n *\r\n * @param {Object[]} definitions\r\n * @param {Object} values\r\n * @param {string} relation\r\n * @return {boolean}\r\n */\nfunction evaluate(definitions, values, relation) {\n var results = definitions.map(function (definition) {\n if (!definition.relation) {\n var condition = Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"get\"])(conditions, definition.type);\n if (condition) {\n return condition.isFulfiled(definition, values);\n } else {\n // eslint-disable-line no-else-return\n // eslint-disable-next-line no-console\n console.error(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__[\"sprintf\"])(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__[\"__\"])('Unsupported container condition - \"%1$s\".', 'carbon-fields-ui'), definition.type));\n return false;\n }\n } else {\n // eslint-disable-line no-else-return\n return evaluate(definition.conditions, values, definition.relation);\n }\n });\n switch (relation) {\n case 'AND':\n return results.every(Boolean);\n case 'OR':\n return results.some(Boolean);\n default:\n // eslint-disable-next-line no-console\n console.error(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__[\"sprintf\"])(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__[\"__\"])('Unsupported container condition relation used - \"%1$s\".', 'carbon-fields-ui'), relation));\n return false;\n }\n}\n\n/**\r\n * The function that causes the side effects.\r\n *\r\n * @param {Object} props\r\n * @param {Object} props.containers\r\n * @param {string} props.context\r\n * @return {Function}\r\n */\nfunction handler(_ref) {\n var containers = _ref.containers,\n context = _ref.context;\n return function (effect) {\n var results = Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"map\"])(containers, function (container, id) {\n return [id, evaluate(container.conditions.conditions, effect, container.conditions.relation)];\n });\n results.forEach(function (_ref2) {\n var _ref3 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_ref2, 2),\n id = _ref3[0],\n result = _ref3[1];\n var postboxNode = document.getElementById(id);\n var containerNode = document.querySelector(\".container-\".concat(id));\n var isMounted = !!containerNode.dataset.mounted;\n if (postboxNode) {\n postboxNode.hidden = !result;\n }\n if (containerNode) {\n if (result && !isMounted) {\n Object(_containers__WEBPACK_IMPORTED_MODULE_3__[\"renderContainer\"])(containers[id], context);\n }\n if (!result && isMounted) {\n delete containerNode.dataset.mounted;\n\n // Rely on React's internals instead of `unmountComponentAtNode`\n // due to https://github.com/facebook/react/issues/13690.\n // TODO: Conditionally render the fields in the container, this way\n // we can move away from mount/unmount cycles.\n containerNode._reactRootContainer.unmount();\n }\n }\n });\n };\n}\n\n//# sourceURL=webpack://cf.%5Bname%5D/./packages/metaboxes/monitors/conditional-display/handler/index.js?"); /***/ }), diff --git a/build/gutenberg/metaboxes.js b/build/gutenberg/metaboxes.js index f0becd60..2aad78ca 100644 --- a/build/gutenberg/metaboxes.js +++ b/build/gutenberg/metaboxes.js @@ -1058,7 +1058,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _bab /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; -eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return handler; });\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ \"@wordpress/i18n\");\n/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _containers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../containers */ \"./packages/metaboxes/containers/index.js\");\n/* harmony import */ var _conditions_base__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../conditions/base */ \"./packages/metaboxes/monitors/conditional-display/conditions/base.js\");\n/* harmony import */ var _conditions_boolean__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../conditions/boolean */ \"./packages/metaboxes/monitors/conditional-display/conditions/boolean.js\");\n/* harmony import */ var _conditions_post_term__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../conditions/post-term */ \"./packages/metaboxes/monitors/conditional-display/conditions/post-term.js\");\n/* harmony import */ var _conditions_post_template__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../conditions/post-template */ \"./packages/metaboxes/monitors/conditional-display/conditions/post-template.js\");\n/* harmony import */ var _conditions_post_ancestor_id__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../conditions/post-ancestor-id */ \"./packages/metaboxes/monitors/conditional-display/conditions/post-ancestor-id.js\");\n/* harmony import */ var _conditions_term_parent_id__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../conditions/term-parent-id */ \"./packages/metaboxes/monitors/conditional-display/conditions/term-parent-id.js\");\n/* harmony import */ var _conditions_term_ancestor_id__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../conditions/term-ancestor-id */ \"./packages/metaboxes/monitors/conditional-display/conditions/term-ancestor-id.js\");\n\n/**\n * External dependencies.\n */\n\n\n\n/**\n * Internal dependencies.\n */\n\n\n\n\n\n\n\n\n\n/**\n * Keeps track of supported conditions.\n *\n * @type {Object}\n */\nvar conditions = {\n \"boolean\": _conditions_boolean__WEBPACK_IMPORTED_MODULE_5__[\"default\"],\n post_term: _conditions_post_term__WEBPACK_IMPORTED_MODULE_6__[\"default\"],\n post_ancestor_id: _conditions_post_ancestor_id__WEBPACK_IMPORTED_MODULE_8__[\"default\"],\n post_parent_id: _conditions_base__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n post_level: _conditions_base__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n post_format: _conditions_base__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n post_template: _conditions_post_template__WEBPACK_IMPORTED_MODULE_7__[\"default\"],\n term_level: _conditions_base__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n term_parent: _conditions_term_parent_id__WEBPACK_IMPORTED_MODULE_9__[\"default\"],\n term_ancestor: _conditions_term_ancestor_id__WEBPACK_IMPORTED_MODULE_10__[\"default\"],\n user_role: _conditions_base__WEBPACK_IMPORTED_MODULE_4__[\"default\"]\n};\n\n/**\n * Walks through the definitions and evaluates the conditions.\n *\n * @param {Object[]} definitions\n * @param {Object} values\n * @param {string} relation\n * @return {boolean}\n */\nfunction evaluate(definitions, values, relation) {\n var results = definitions.map(function (definition) {\n if (!definition.relation) {\n var condition = Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"get\"])(conditions, definition.type);\n if (condition) {\n return condition.isFulfiled(definition, values);\n } else {\n // eslint-disable-line no-else-return\n // eslint-disable-next-line no-console\n console.error(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__[\"sprintf\"])(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__[\"__\"])('Unsupported container condition - \"%1$s\".', 'carbon-fields-ui'), definition.type));\n return false;\n }\n } else {\n // eslint-disable-line no-else-return\n return evaluate(definition.conditions, values, definition.relation);\n }\n });\n switch (relation) {\n case 'AND':\n return results.every(Boolean);\n case 'OR':\n return results.some(Boolean);\n default:\n // eslint-disable-next-line no-console\n console.error(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__[\"sprintf\"])(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__[\"__\"])('Unsupported container condition relation used - \"%1$s\".', 'carbon-fields-ui'), relation));\n return false;\n }\n}\n\n/**\n * The function that causes the side effects.\n *\n * @param {Object} props\n * @param {Object} props.containers\n * @param {string} props.context\n * @return {Function}\n */\nfunction handler(_ref) {\n var containers = _ref.containers,\n context = _ref.context;\n return function (effect) {\n var results = Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"map\"])(containers, function (container, id) {\n return [id, evaluate(container.conditions.conditions, effect, container.conditions.relation)];\n });\n results.forEach(function (_ref2) {\n var _ref3 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_ref2, 2),\n id = _ref3[0],\n result = _ref3[1];\n var postboxNode = document.getElementById(id);\n var containerNode = document.querySelector(\".container-\".concat(id));\n var isMounted = !!containerNode.dataset.mounted;\n if (postboxNode) {\n postboxNode.hidden = !result;\n }\n if (containerNode) {\n if (result && !isMounted) {\n Object(_containers__WEBPACK_IMPORTED_MODULE_3__[\"renderContainer\"])(containers[id], context);\n }\n if (!result && isMounted) {\n delete containerNode.dataset.mounted;\n\n // Rely on React's internals instead of `unmountComponentAtNode`\n // due to https://github.com/facebook/react/issues/13690.\n // TODO: Conditionally render the fields in the container, this way\n // we can move away from mount/unmount cycles.\n containerNode._reactRootContainer.unmount();\n }\n }\n });\n };\n}\n\n//# sourceURL=webpack://cf.%5Bname%5D/./packages/metaboxes/monitors/conditional-display/handler/index.js?"); +eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return handler; });\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @babel/runtime/helpers/slicedToArray */ \"./node_modules/@babel/runtime/helpers/slicedToArray.js\");\n/* harmony import */ var _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(_babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @wordpress/i18n */ \"@wordpress/i18n\");\n/* harmony import */ var _wordpress_i18n__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__);\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! lodash */ \"lodash\");\n/* harmony import */ var lodash__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash__WEBPACK_IMPORTED_MODULE_2__);\n/* harmony import */ var _containers__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../../containers */ \"./packages/metaboxes/containers/index.js\");\n/* harmony import */ var _conditions_base__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../conditions/base */ \"./packages/metaboxes/monitors/conditional-display/conditions/base.js\");\n/* harmony import */ var _conditions_boolean__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../conditions/boolean */ \"./packages/metaboxes/monitors/conditional-display/conditions/boolean.js\");\n/* harmony import */ var _conditions_post_term__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../conditions/post-term */ \"./packages/metaboxes/monitors/conditional-display/conditions/post-term.js\");\n/* harmony import */ var _conditions_post_template__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../conditions/post-template */ \"./packages/metaboxes/monitors/conditional-display/conditions/post-template.js\");\n/* harmony import */ var _conditions_post_ancestor_id__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../conditions/post-ancestor-id */ \"./packages/metaboxes/monitors/conditional-display/conditions/post-ancestor-id.js\");\n/* harmony import */ var _conditions_term_parent_id__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../conditions/term-parent-id */ \"./packages/metaboxes/monitors/conditional-display/conditions/term-parent-id.js\");\n/* harmony import */ var _conditions_term_ancestor_id__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../conditions/term-ancestor-id */ \"./packages/metaboxes/monitors/conditional-display/conditions/term-ancestor-id.js\");\n\n/**\r\n * External dependencies.\r\n */\n\n\n\n/**\r\n * Internal dependencies.\r\n */\n\n\n\n\n\n\n\n\n\n/**\r\n * Keeps track of supported conditions.\r\n *\r\n * @type {Object}\r\n */\nvar conditions = {\n \"boolean\": _conditions_boolean__WEBPACK_IMPORTED_MODULE_5__[\"default\"],\n post_term: _conditions_post_term__WEBPACK_IMPORTED_MODULE_6__[\"default\"],\n post_ancestor_id: _conditions_post_ancestor_id__WEBPACK_IMPORTED_MODULE_8__[\"default\"],\n post_parent_id: _conditions_base__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n post_level: _conditions_base__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n post_format: _conditions_base__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n post_template: _conditions_post_template__WEBPACK_IMPORTED_MODULE_7__[\"default\"],\n term_level: _conditions_base__WEBPACK_IMPORTED_MODULE_4__[\"default\"],\n term_parent: _conditions_term_parent_id__WEBPACK_IMPORTED_MODULE_9__[\"default\"],\n term_ancestor: _conditions_term_ancestor_id__WEBPACK_IMPORTED_MODULE_10__[\"default\"],\n user_role: _conditions_base__WEBPACK_IMPORTED_MODULE_4__[\"default\"]\n};\n\n/**\r\n * Walks through the definitions and evaluates the conditions.\r\n *\r\n * @param {Object[]} definitions\r\n * @param {Object} values\r\n * @param {string} relation\r\n * @return {boolean}\r\n */\nfunction evaluate(definitions, values, relation) {\n var results = definitions.map(function (definition) {\n if (!definition.relation) {\n var condition = Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"get\"])(conditions, definition.type);\n if (condition) {\n return condition.isFulfiled(definition, values);\n } else {\n // eslint-disable-line no-else-return\n // eslint-disable-next-line no-console\n console.error(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__[\"sprintf\"])(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__[\"__\"])('Unsupported container condition - \"%1$s\".', 'carbon-fields-ui'), definition.type));\n return false;\n }\n } else {\n // eslint-disable-line no-else-return\n return evaluate(definition.conditions, values, definition.relation);\n }\n });\n switch (relation) {\n case 'AND':\n return results.every(Boolean);\n case 'OR':\n return results.some(Boolean);\n default:\n // eslint-disable-next-line no-console\n console.error(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__[\"sprintf\"])(Object(_wordpress_i18n__WEBPACK_IMPORTED_MODULE_1__[\"__\"])('Unsupported container condition relation used - \"%1$s\".', 'carbon-fields-ui'), relation));\n return false;\n }\n}\n\n/**\r\n * The function that causes the side effects.\r\n *\r\n * @param {Object} props\r\n * @param {Object} props.containers\r\n * @param {string} props.context\r\n * @return {Function}\r\n */\nfunction handler(_ref) {\n var containers = _ref.containers,\n context = _ref.context;\n return function (effect) {\n var results = Object(lodash__WEBPACK_IMPORTED_MODULE_2__[\"map\"])(containers, function (container, id) {\n return [id, evaluate(container.conditions.conditions, effect, container.conditions.relation)];\n });\n results.forEach(function (_ref2) {\n var _ref3 = _babel_runtime_helpers_slicedToArray__WEBPACK_IMPORTED_MODULE_0___default()(_ref2, 2),\n id = _ref3[0],\n result = _ref3[1];\n var postboxNode = document.getElementById(id);\n var containerNode = document.querySelector(\".container-\".concat(id));\n var isMounted = !!containerNode.dataset.mounted;\n if (postboxNode) {\n postboxNode.hidden = !result;\n }\n if (containerNode) {\n if (result && !isMounted) {\n Object(_containers__WEBPACK_IMPORTED_MODULE_3__[\"renderContainer\"])(containers[id], context);\n }\n if (!result && isMounted) {\n delete containerNode.dataset.mounted;\n\n // Rely on React's internals instead of `unmountComponentAtNode`\n // due to https://github.com/facebook/react/issues/13690.\n // TODO: Conditionally render the fields in the container, this way\n // we can move away from mount/unmount cycles.\n containerNode._reactRootContainer.unmount();\n }\n }\n });\n };\n}\n\n//# sourceURL=webpack://cf.%5Bname%5D/./packages/metaboxes/monitors/conditional-display/handler/index.js?"); /***/ }),