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