Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.132/page_editor/app/components/LayoutViewport",["module","exports","require","liferay!frontend-js-react-web$classnames","liferay!frontend-js-react-web$react","liferay!frontend-js-react-web$react-dnd","../../core/debounceRAF","../config/constants/viewportSizes","../config/index","../contexts/ControlsContext","../contexts/GlobalContext","../contexts/StoreContext","../selectors/selectItemConfigurationOpen","../selectors/selectSidebarIsOpened","./DisabledArea","./Layout","./MasterLayout"],(function(e,t,o){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function(){const e=(0,n.useRef)(),[t,o]=(0,n.useState)(null),[y,_]=(0,n.useState)(),[w,b]=(0,n.useState)(!1),S=(0,u.useSelectItem)(),E=(0,c.useSelector)((e=>e.layoutData.rootItems.main)),x=(0,c.useSelector)((e=>{var t;return null===(t=e.masterLayout)||void 0===t?void 0:t.masterLayoutData})),I=(0,c.useSelector)((e=>e.selectedViewportSize)),L=(0,c.useSelector)(p.default),O=(0,c.useSelector)(f.default),{isDragging:h}=(0,a.useDragLayer)((e=>({isDragging:e.isDragging()})));return(0,n.useEffect)((()=>{const o=e.current;let r=0,n=0;_(void 0);const a=(0,i.default)((e=>{const{maxWidth:t,minWidth:o}=s.config.availableViewportSizes[I];_(Math.min(Math.max(r+2*(e.clientX-n),o),t+1))})),l=()=>{b(!1),document.removeEventListener("mousemove",a,!0),document.removeEventListener("mouseup",l)},u=e=>{t&&(b(!0),S(null),e.preventDefault(),n=e.clientX,r=t.getBoundingClientRect().width-(parseInt(getComputedStyle(t).paddingRight,10)||0),_(r),document.addEventListener("mousemove",a,!0),document.addEventListener("mouseup",l))};return o&&o.addEventListener("mousedown",u,!0),()=>{o&&o.removeEventListener("mousedown",u,!0)}}),[t,S,I]),n.default.createElement("div",{className:(0,r.default)("page-editor__layout-viewport","page-editor__layout-viewport--size-".concat(I),{cadmin:I!==l.VIEWPORT_SIZES.desktop,"page-editor__layout-viewport__resizing":w,"page-editor__layout-viewport--with-item-configuration-open":O,"page-editor__layout-viewport--with-sidebar-open":L})},w&&n.default.createElement("div",{className:"page-editor__layout-viewport__label-width"},n.default.createElement("span",null,y,"px")),n.default.createElement("div",{className:"page-editor__layout-viewport__resizer",ref:o,style:{width:y}},n.default.createElement(d.GlobalContextFrame,{useIframe:I!==l.VIEWPORT_SIZES.desktop},!h&&n.default.createElement(m.default,null),x?n.default.createElement(v.default,null):n.default.createElement(g.default,{mainItemId:E}))),I!==l.VIEWPORT_SIZES.desktop&&n.default.createElement("div",{className:"page-editor__layout-viewport__handle",ref:e}))};var r=_(o("liferay!frontend-js-react-web$classnames")),n=function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=y();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=o("liferay!frontend-js-react-web$react-dnd"),i=_(o("../../core/debounceRAF")),l=o("../config/constants/viewportSizes"),s=o("../config/index"),u=o("../contexts/ControlsContext"),d=o("../contexts/GlobalContext"),c=o("../contexts/StoreContext"),f=_(o("../selectors/selectItemConfigurationOpen")),p=_(o("../selectors/selectSidebarIsOpened")),m=_(o("./DisabledArea")),g=_(o("./Layout")),v=_(o("./MasterLayout"));function y(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return y=function(){return e},e}function _(e){return e&&e.__esModule?e:{default:e}}}}));
//# sourceMappingURL=LayoutViewport.js.map