Liferay.Loader.define("@liferay/layout-content-page-editor-web@3.0.141/page_editor/app/components/NetworkStatusBar",["module","exports","require","@frontend-taglib-clay$clayui/icon","@frontend-taglib-clay$clayui/loading-indicator","@liferay/frontend-js-react-web","frontend-js-web","liferay!frontend-js-react-web$react","../config/constants/serviceNetworkStatusTypes"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/icon")),n=_interopRequireDefault(a("@frontend-taglib-clay$clayui/loading-indicator")),l=a("@liferay/frontend-js-react-web"),c=a("frontend-js-web"),i=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 a={},r=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var n in e)if(Object.prototype.hasOwnProperty.call(e,n)){var l=r?Object.getOwnPropertyDescriptor(e,n):null;l&&(l.get||l.set)?Object.defineProperty(a,n,l):a[n]=e[n]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react")),o=a("../config/constants/serviceNetworkStatusTypes");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}}const LoadingText=({children:e})=>i.default.createElement(i.default.Fragment,null,i.default.createElement("span",{className:"d-none d-sm-block m-0 navbar-text page-editor__status-bar text-info"},e),i.default.createElement(n.default,{className:"my-0",small:!0})),SuccessText=({children:e})=>i.default.createElement(i.default.Fragment,null,i.default.createElement("span",{className:"d-none d-sm-block m-0 navbar-text page-editor__status-bar text-success"},e),i.default.createElement(r.default,{className:"text-success",symbol:"check-circle"})),getContent=(e,t)=>e?t===o.SERVICE_NETWORK_STATUS_TYPES.draftSaved?i.default.createElement(SuccessText,null,Liferay.Language.get("saved")):t===o.SERVICE_NETWORK_STATUS_TYPES.savingDraft?i.default.createElement(LoadingText,null,Liferay.Language.get("saving")):null:i.default.createElement(LoadingText,null,Liferay.Language.get("trying-to-reconnect"));var _default=({error:e,status:t})=>{const[a,r]=(0,i.useState)(!0);(0,i.useEffect)((()=>{t===o.SERVICE_NETWORK_STATUS_TYPES.error&&(0,c.openToast)({message:e,type:"danger"})}),[e,t]),(0,l.useEventListener)("online",(()=>r(!0)),!0,window),(0,l.useEventListener)("offline",(()=>r(!1)),!0,window);const n=getContent(a,t);return i.default.createElement("span",{className:"align-items-center d-flex h-100 text-truncate"},n)};t.default=_default}}));
//# sourceMappingURL=NetworkStatusBar.js.map