Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.151/page_editor/app/components/layout_data_items/CollectionWithControls",["module","exports","require","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$react","../../../common/hooks/useSetRef","../../../prop_types/index","../../config/constants/layoutDataItemTypes","../../contexts/ControlsContext","../../contexts/StoreContext","../../utils/getLayoutDataItemTopperUniqueClassName","../../utils/getResponsiveConfig","../topper/Topper","./Collection","./isHovered"],(function(e,t,o){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=_interopRequireDefault(o("liferay!frontend-js-react-web$classnames")),n=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 o={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var a=r?Object.getOwnPropertyDescriptor(e,n):null;a&&(a.get||a.set)?Object.defineProperty(o,n,a):o[n]=e[n]}o.default=e,t&&t.set(e,o);return o}(o("liferay!frontend-js-react-web$react")),a=_interopRequireDefault(o("../../../common/hooks/useSetRef")),i=(o("../../../prop_types/index"),o("../../config/constants/layoutDataItemTypes")),l=o("../../contexts/ControlsContext"),u=o("../../contexts/StoreContext"),s=_interopRequireDefault(o("../../utils/getLayoutDataItemTopperUniqueClassName")),c=o("../../utils/getResponsiveConfig"),f=_interopRequireDefault(o("../topper/Topper")),d=_interopRequireDefault(o("./Collection")),p=_interopRequireDefault(o("./isHovered"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var m=n.default.forwardRef((({children:e,item:t},o)=>{const[i,l]=(0,n.useState)(!1),[p,m]=(0,a.default)(o),y=(0,u.useSelector)((e=>e.selectedViewportSize)),_=(0,c.getResponsiveConfig)(t.config,y),{display:g}=_.styles;return n.default.createElement(n.default.Fragment,null,n.default.createElement(HoverHandler,{hovered:i,item:t,setHovered:l}),n.default.createElement(f.default,{className:(0,r.default)((0,s.default)(t.itemId),{"page-editor__topper--hovered":i}),item:t,itemElement:m,style:{display:g}},n.default.createElement(d.default,{item:t,ref:p},e)))}));t.default=m;const HoverHandler=({hovered:e,item:t,setHovered:o})=>{const r=(0,l.useHoveredItemType)(),a=(0,l.useHoveredItemId)();return(0,n.useEffect)((()=>{if(t.type===i.LAYOUT_DATA_ITEM_TYPES.collection&&"collection"in t.config){const n=(0,p.default)({editableValue:t.config.collection,hoveredItemId:a,hoveredItemType:r});e!==n&&o(n)}}),[t,a,r,o,e]),null}}}));
//# sourceMappingURL=CollectionWithControls.js.map