Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.179/page_editor/app/components/fragment_configuration_fields/HideFragmentField",["module","exports","require","@frontend-taglib-clay$clayui/button","@frontend-taglib-clay$clayui/form","@liferay/layout-js-components-web","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../../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:y,value:m}){var b;const _=(0,c.useSelector)((e=>e.layoutData)),h=(0,c.useSelector)((e=>e.selectedViewportSize)),C=(0,p.default)(r.itemId),R=(0,s.useSelectItem)(),[w,v]=(0,i.useControlledState)(m||!1),j=null===(b=t.typeOptions)||void 0===b?void 0:b.customValues,x=getHiddenAncestorId(_,r,h);return l.default.createElement(l.default.Fragment,null,l.default.createElement(n.default.Group,{className:"mb-0 mt-1"},l.default.createElement("div",{className:"align-items-center d-flex justify-content-between page-editor__sidebar__fieldset__field-checkbox","data-tooltip-align":"bottom",title:y},l.default.createElement(n.ClayCheckbox,{"aria-label":t.label,checked:j?w===j.checked:w,containerProps:{className:"mb-0"},disabled:Boolean(x)||(0,g.default)(r,_)||e,label:t.label,onChange:e=>{let r=e.target.checked;if(j&&(r=r?j.checked:j.unchecked),v(r),f(t.name,r),e.target.checked&&C()){const{message:e}=(0,u.getFormErrorDescription)({type:u.FORM_ERROR_TYPES.hiddenFragment});(0,o.openToast)({message:e,type:"warning"})}}}),t.responsive&&h!==d.VIEWPORT_SIZES.desktop&&l.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")}))),x&&l.default.createElement(l.default.Fragment,null,l.default.createElement("p",{className:"m-0 small text-secondary"},Liferay.Language.get("this-configuration-is-inherited")),l.default.createElement(a.default,{className:"p-0 page-editor__hide-feedback-button text-left",displayType:"link",onClick:()=>R(x)},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")),i=r("@liferay/layout-js-components-web"),o=r("frontend-js-web"),l=(_interopRequireDefault(r("liferay!frontend-js-react-web$prop-types")),_interopRequireDefault(r("liferay!frontend-js-react-web$react"))),d=(r("../../../prop_types/index"),r("../../config/constants/viewportSizes")),s=r("../../contexts/ControlsContext"),c=r("../../contexts/StoreContext"),u=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 i=a?Object.getOwnPropertyDescriptor(e,n):null;i&&(i.get||i.set)?Object.defineProperty(r,n,i):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