Liferay.Loader.define("layout-reports-web@1.0.55/js/components/LayoutReports",["module","exports","require","@liferay/frontend-js-react-web","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","../constants/actionTypes","../context/ConstantsContext","../context/StoreContext","../utils/loadIssues","./BasicInformation","./IssueDetail","./IssuesList","./NotConfigured","./error-alert/ErrorAlert"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function LayoutReports({eventTriggered:e}){const t=(0,a.useIsMounted)(),{data:r,error:y,languageId:C,loading:R,selectedIssue:_}=(0,o.useContext)(i.StoreStateContext),{isPanelStateOpen:b,layoutReportsDataURL:L}=(0,o.useContext)(l.ConstantsContext),I=(0,o.useContext)(i.StoreDispatchContext),j=(0,o.useCallback)((e=>{t()&&I(e)}),[I,t]),x=(0,o.useCallback)((e=>{j({type:u.LOAD_DATA}),(0,n.fetch)(e,{method:"GET"}).then((e=>e.json().then((e=>{if(j({data:e,loading:e.validConnection,type:u.SET_DATA}),e.validConnection){const t=e.pageURLs.find((t=>t.languageId===(C||e.defaultLanguageId)));(0,s.default)({dispatch:j,languageId:C||e.defaultLanguageId,refreshCache:!1,url:t})}})))).catch((()=>{j({error:Liferay.Language.get("an-unexpected-error-occurred"),type:u.SET_ERROR})}))}),[C,j]);if((0,o.useEffect)((()=>{!b||r||R||x(L)}),[r,b,L,R,x]),(0,o.useEffect)((()=>{e&&!r&&x(L)}),[e,r,L,x]),!r)return null;const D=r.validConnection&&y||r.privateLayout,h=!R&&!r.validConnection;return o.default.createElement(o.default.Fragment,null,!h&&o.default.createElement("div",{className:"pb-3 px-3"},o.default.createElement(d.default,{defaultLanguageId:r.defaultLanguageId,pageURLs:r.pageURLs,selectedLanguageId:C})),D?o.default.createElement(g.default,null):h?o.default.createElement(p.default,null):_?o.default.createElement(f.default,null):o.default.createElement(c.default,null))};var a=r("@liferay/frontend-js-react-web"),n=r("frontend-js-web"),o=(_interopRequireDefault(r("liferay!frontend-js-react-web$prop-types")),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 o=a?Object.getOwnPropertyDescriptor(e,n):null;o&&(o.get||o.set)?Object.defineProperty(r,n,o):r[n]=e[n]}r.default=e,t&&t.set(e,r);return r}(r("liferay!frontend-js-react-web$react"))),u=r("../constants/actionTypes"),l=r("../context/ConstantsContext"),i=r("../context/StoreContext"),s=_interopRequireDefault(r("../utils/loadIssues")),d=_interopRequireDefault(r("./BasicInformation")),f=_interopRequireDefault(r("./IssueDetail")),c=_interopRequireDefault(r("./IssuesList")),p=_interopRequireDefault(r("./NotConfigured")),g=_interopRequireDefault(r("./error-alert/ErrorAlert"));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=LayoutReports.js.map