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