Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.132/page_editor/app/components/PreviewModal",["module","exports","require","@frontend-taglib-clay$clayui/form","@frontend-taglib-clay$clayui/modal","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../../core/hooks/useId","../config/constants/layoutTypes","../config/constants/viewportSizes","../config/index","../contexts/DisplayPagePreviewItemContext","../contexts/StoreContext","../selectors/selectLanguageId","../selectors/selectSegmentsExperienceId","./DisplayPagePreviewItemSelector","./Translation","./ViewportSizeSelector"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var l=a("@frontend-taglib-clay$clayui/form"),n=S(a("@frontend-taglib-clay$clayui/modal")),r=a("frontend-js-web"),o=(S(a("liferay!frontend-js-react-web$prop-types")),function(e){if(e&&e.__esModule)return e;if(null===e||"object"!=typeof e&&"function"!=typeof e)return{default:e};var t=w();if(t&&t.has(e))return t.get(e);var a={},l=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var r=l?Object.getOwnPropertyDescriptor(e,n):null;r&&(r.get||r.set)?Object.defineProperty(a,n,r):a[n]=e[n]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react"))),s=a("../../core/hooks/useId"),c=a("../config/constants/layoutTypes"),i=a("../config/constants/viewportSizes"),d=a("../config/index"),u=a("../contexts/DisplayPagePreviewItemContext"),f=a("../contexts/StoreContext"),p=S(a("../selectors/selectLanguageId")),m=S(a("../selectors/selectSegmentsExperienceId")),g=a("./DisplayPagePreviewItemSelector"),y=S(a("./Translation")),v=S(a("./ViewportSizeSelector"));function w(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return w=function(){return e},e}function S(e){return e&&e.__esModule?e:{default:e}}var b=({observer:e})=>{const t=(0,f.useSelector)(m.default),[a,w]=(0,o.useState)((0,f.useSelector)(p.default)),S=(0,u.useDisplayPagePreviewItem)(),[b,P]=(0,o.useState)((0,f.useSelector)((e=>e.selectedViewportSize))),E=(0,f.useSelector)((e=>e.fragmentEntryLinks)),[_,x]=(0,o.useState)(t),I=(0,f.useSelector)((e=>e.availableSegmentsExperiences)),j=(0,s.useId)(),N=(0,o.useMemo)((()=>{let e=(0,r.addParams)({["".concat(d.config.portletNamespace,"languageId")]:a,["".concat(d.config.portletNamespace,"segmentsExperienceId")]:_},d.config.previewPageURL);return d.config.layoutType===c.LAYOUT_TYPES.display&&S&&(e=(0,r.addParams)({["".concat(d.config.portletNamespace,"className")]:S.data.className,["".concat(d.config.portletNamespace,"classPK")]:S.data.classPK},e)),e}),[a,_,S]),L=(0,o.useMemo)((()=>{const{maxWidth:e,minWidth:t}=d.config.availableViewportSizes[b];return b===i.VIEWPORT_SIZES.desktop?"100%":(e+t)/2}),[b]);return o.default.createElement(n.default,{className:"page-editor__preview-modal",containerProps:{className:"cadmin"},observer:e,size:"full-screen"},o.default.createElement(n.default.Header,null,o.default.createElement("div",{className:"d-flex flex-grow-1 justify-content-between page-editor__theme-adapter-buttons responsive-mode"},o.default.createElement("ul",{className:"justify-content-start navbar-nav page-editor__preview-modal__part"},I&&o.default.createElement("li",{className:"mr-2 nav-item"},o.default.createElement("div",{className:"align-middle d-inline-flex"},o.default.createElement("label",{className:"mr-2 mt-1 w-100",htmlFor:j},Liferay.Language.get("experience")),o.default.createElement(l.ClaySelect,{"aria-label":"Experience",className:"form-control-sm",id:j,onChange:e=>{x(e.target.options[e.target.selectedIndex].value)},value:_},I&&Object.keys(I).map((e=>o.default.createElement(l.ClaySelect.Option,{key:e,label:I[e].name,value:e})))))),o.default.createElement("li",{className:"nav-item"},o.default.createElement(y.default,{availableLanguages:d.config.availableLanguages,defaultLanguageId:d.config.defaultLanguageId,dispatch:({languageId:e})=>w(e),fragmentEntryLinks:E,languageId:a,segmentsExperienceId:_}))),o.default.createElement("div",{className:"page-editor__preview-modal__part"},o.default.createElement(v.default,{onSizeSelected:P,selectedSize:b})),o.default.createElement("div",{className:"justify-content-end page-editor__preview-modal__part pr-3"},d.config.layoutType===c.LAYOUT_TYPES.display?o.default.createElement(g.DisplayPagePreviewItemSelectorContent,null):null))),o.default.createElement(n.default.Body,{iFrameProps:{style:{maxWidth:L}},url:N}))};t.default=b}}));
//# sourceMappingURL=PreviewModal.js.map