Liferay.Loader.define("@liferay/document-library-web@6.0.149/document_library/js/bulk/BulkStatus.es",["module","exports","require","@frontend-taglib-clay$clayui/loading-indicator","@liferay/frontend-js-react-web","frontend-js-web","liferay!frontend-js-react-web$prop-types","liferay!frontend-js-react-web$react","./reducer.es"],(function(e,t,r){window;{Object.defineProperty(t,"__esModule",{value:!0}),t.default=void 0;var a=_interopRequireDefault(r("@frontend-taglib-clay$clayui/loading-indicator")),n=r("@liferay/frontend-js-react-web"),i=r("frontend-js-web"),u=(_interopRequireDefault(r("liferay!frontend-js-react-web$prop-types")),_interopRequireWildcard(r("liferay!frontend-js-react-web$react"))),c=_interopRequireWildcard(r("./reducer.es"));function _getRequireWildcardCache(){if("function"!=typeof WeakMap)return null;var e=new WeakMap;return _getRequireWildcardCache=function _getRequireWildcardCache(){return e},e}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 i=a?Object.getOwnPropertyDescriptor(e,n):null;i&&(i.get||i.set)?Object.defineProperty(r,n,i):r[n]=e[n]}return r.default=e,t&&t.set(e,r),r}function _interopRequireDefault(e){return e&&e.__esModule?e:{default:e}}var l=function BulkStatus({bulkComponentId:e,bulkInProgress:t,bulkStatusUrl:r="/bulk/v1.0/status",intervalSpeed:l=1e3,pathModule:o,waitingTime:s=1e3}){const d=(0,n.useTimeout)(),[f,p]=(0,u.useReducer)(c.default,t?{current:c.STATES.LONG_POLLING}:{current:c.STATES.IDLE}),y=(0,u.useCallback)((()=>d((()=>{(0,i.fetch)("".concat(Liferay.ThemeDisplay.getPortalURL()).concat(o).concat(r)).then((e=>e.json())).then((e=>{e.actionInProgress?p({type:"check"}):p({type:"success"})})).catch((()=>p({type:"error"})))}),l)),[r,d,o,l]);return(0,u.useEffect)((()=>{let e;return f.current===c.STATES.SHORT_POLLING?(y(),e=d((()=>p({type:"initialDelayCompleted"})),s)):f.current===c.STATES.LONG_POLLING?y():f.current===c.STATES.NOTIFY&&((0,i.openToast)(f.toast),p({type:"notificationCompleted"})),e}),[d,f,y,s]),Liferay.component(e)||Liferay.component(e,{startWatch:()=>{p({type:"start"})}},{destroyOnNavigate:!0}),u.default.createElement("div",{className:"bulk-status-container"},u.default.createElement("div",{className:"bulk-status ".concat(!f.current.show&&"closed")},u.default.createElement("div",{className:"bulk-status-content"},u.default.createElement(a.default,{light:!0,small:!0}),u.default.createElement("span",null,Liferay.Language.get("processing-actions")))))};t.default=l}}));
//# sourceMappingURL=BulkStatus.es.js.map