Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.169/page_editor/app/components/fragment_configuration_fields/HideFragmentField",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../../common/hooks/useControlledState","../../../prop_types/index","../../config/constants/viewportSizes","../../contexts/ControlsContext","../../contexts/StoreContext","../../utils/getFormErrorDescription","../../utils/getResponsiveConfig","../../utils/useHasRequiredChild","../layout_data_items/hasDropZoneChild"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.HideFragmentField=function HideFragmentField({disabled:e,field:t,item:r,onValueSelect:f,title:m,value:y}){var _;const b=(0,u.useSelector)((e=>e.layoutData)),h=(0,u.useSelector)((e=>e.selectedViewportSize)),C=(0,p.default)(r.itemId),R=(0,s.useSelectItem)(),[v,w]=(0,l.default)(y||!1),k=null===(_=t.typeOptions)||void 0===_?void 0:_.customValues,q=getHiddenAncestorId(b,r,h);return i.default.createElement(i.default.Fragment,null,i.default.createElement(n.default.Group,{className:"mb-0 mt-1"},i.default.createElement("div",{className:"align-items-center d-flex justify-content-between page-editor__sidebar__fieldset__field-checkbox","data-tooltip-align":"bottom",title:m},i.default.createElement(n.ClayCheckbox,{"aria-label":t.label,checked:k?v===k.checked:v,containerProps:{className:"mb-0"},disabled:Boolean(q)||(0,g.default)(r,b)||e,label:t.label,onChange:e=>{let r=e.target.checked;if(k&&(r=r?k.checked:k.unchecked),w(r),f(t.name,r),e.target.checked&&C()){const{message:e}=(0,c.getFormErrorDescription)({type:c.FORM_ERROR_TYPES.hiddenFragment});(0,o.openToast)({message:e,type:"warning"})}}}),t.responsive&&h!==d.VIEWPORT_SIZES.desktop&&i.default.createElement(a.ClayButtonWithIcon,{"aria-label":Liferay.Language.get("restore-default"),"data-tooltip-align":"bottom",displayType:"secondary",onClick:()=>{f(t.name,null)},size:"sm",symbol:"restore",title:Liferay.Language.get("restore-default")}))),q&&i.default.createElement(i.default.Fragment,null,i.default.createElement("p",{className:"m-0 small text-secondary"},Liferay.Language.get("this-configuration-is-inherited")),i.default.createElement(a.default,{className:"p-0 page-editor__hide-feedback-button text-left",displayType:"link",onClick:()=>R(q)},Liferay.Language.get("go-to-parent-fragment-to-edit"))))};var a=_interopRequireWildcard(r("@frontend-taglib-clay$clayui/button")),n=_interopRequireWildcard(r("@frontend-taglib-clay$clayui/form")),o=r("frontend-js-web"),i=(_interopRequireDefault(r("liferay!frontend-js-react-web$prop-types")),_interopRequireDefault(r("liferay!frontend-js-react-web$react"))),l=_interopRequireDefault(r("../../../common/hooks/useControlledState")),d=(r("../../../prop_types/index"),r("../../config/constants/viewportSizes")),s=r("../../contexts/ControlsContext"),u=r("../../contexts/StoreContext"),c=r("../../utils/getFormErrorDescription"),f=r("../../utils/getResponsiveConfig"),p=_interopRequireDefault(r("../../utils/useHasRequiredChild")),g=_interopRequireDefault(r("../layout_data_items/hasDropZoneChild"));function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireWildcard(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=_getRequireWildcardCache();if(t&&t.has(e))return t.get(e);var r={},a=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var o=a?Object.getOwnPropertyDescriptor(e,n):null;o&&(o.get||o.set)?Object.defineProperty(r,n,o):r[n]=e[n]}return r.default=e,t&&t.set(e,r),r}function getHiddenAncestorId(e,t,r){const a=e.items[t.parentId];if(!a)return null;return"none"===(0,f.getResponsiveConfig)(a.config,r).styles.display?a.itemId:getHiddenAncestorId(e,a)}}}));
//# sourceMappingURL=HideFragmentField.js.map