Liferay.Loader.define("change-tracking-web@2.0.102/publications/js/components/PublicationStatus",["module","exports","require","@frontend-taglib-clay$clayui/label","@frontend-taglib-clay$clayui/progress-bar","frontend-js-web","liferay!frontend-js-react-web$react"],(function(e,t,a){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=function PublicationStatus({dataURL:e,displayType:t,label:a,renderComplete:u,spritemap:c,updateStatus:p}){const[o,d]=(0,i.useState)(0);let f=null;a&&(f={displayType:t,label:a});const[s,y]=(0,i.useState)(f);if((0,i.useEffect)((()=>{a?y({displayType:t,label:a}):(y(null),(0,n.fetch)(e).then((e=>e.json())).then((t=>{if(t)if(t.label)y({displayType:t.displayType,label:t.label}),p&&p(t.displayType,t.label,t.published);else if(Object.hasOwnProperty.call(t,"percentage")){d(t.percentage);let a=null,r=null,l=!1;const i=setInterval((()=>{if(r)return y({displayType:a,label:r}),p&&p(a,r,l),void clearInterval(i);(0,n.fetch)(e).then((e=>e.json())).then((e=>{e&&(e.label?(d(100),a=e.displayType,r=e.label,l=e.published):Object.hasOwnProperty.call(e,"percentage")&&d(e.percentage))})).catch((()=>{}))}),1e3);return()=>clearInterval(i)}})))}),[e,t,a,p]),s)return u?u(s):i.default.createElement(r.default,{displayType:s.displayType,spritemap:c},s.label);return i.default.createElement(l.default,{spritemap:c,value:o})};var r=_interopRequireDefault(a("@frontend-taglib-clay$clayui/label")),l=_interopRequireDefault(a("@frontend-taglib-clay$clayui/progress-bar")),n=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 l in e)if(Object.prototype.hasOwnProperty.call(e,l)){var n=r?Object.getOwnPropertyDescriptor(e,l):null;n&&(n.get||n.set)?Object.defineProperty(a,l,n):a[l]=e[l]}a.default=e,t&&t.set(e,a);return a}(a("liferay!frontend-js-react-web$react"));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=PublicationStatus.js.map