import{ao as t,aq as s,a_ as x,ep as b,M as f,cb as w,aI as m,f1 as S,iw as L,v as k}from"./app-k0jcl5PQ.js";import{P as g}from"./Bd15j6xA.chunk.js";import{B as o}from"./DkDkjje4.chunk.js";import{h as y}from"./DIAJ896Y.chunk.js";const r="userManager.wizardInProgress";function P(e){const a=Math.floor(e.totalItemsComplete/e.totalItems*100)||0;function u(){return e.objectType===f.User&&e.userType?t.jsx(s,{namespace:r,phrase:e.userType===w.Learner?"progressStudents":"progressStaff",options:{totalComplete:e.totalItemsComplete,total:e.totalItems,smartCount:e.totalItems}}):e.objectType===f.Video?t.jsx(s,{namespace:r,phrase:"progressVideos",options:{totalComplete:e.totalItemsComplete,total:e.totalItems,smartCount:e.totalItems}}):t.jsx(s,{namespace:r,phrase:"progressItems",options:{totalComplete:e.totalItemsComplete,total:e.totalItems,smartCount:e.totalItems}})}return t.jsxs("div",{children:[t.jsxs("div",{className:"d-flex align-items-center mb-2",children:[t.jsx("h2",{className:"h5 mb-0",children:t.jsx(s,{namespace:r,phrase:"heading",options:{percentage:a,actionName:e.actionName}})}),t.jsx(x,{svg:b})]}),t.jsx("p",{children:t.jsx(s,{namespace:r,phrase:`info${e.actionVerb}`})}),t.jsxs("p",{className:"mb-1",children:[t.jsx("span",{className:"text-info",children:e.progressVerbPhrase?t.jsx("span",{children:e.progressVerbPhrase}):t.jsx(s,{namespace:r,phrase:`progressVerb${e.actionVerb}`})})," ",u()]}),t.jsx(g,{variant:"info",now:a})]})}const l="userManager.wizardSubmitted";function E(e){return t.jsxs("div",{children:[t.jsxs("div",{className:"d-flex align-items-center mb-2",children:[t.jsx("h2",{className:"h5 mb-0",children:e.actionName?t.jsx(s,{namespace:l,phrase:"heading",options:{actionName:e.actionName}}):t.jsx(s,{namespace:l,phrase:"headingGeneric"})}),t.jsx(x,{svg:b})]}),t.jsx("p",{children:t.jsx(s,{namespace:l,phrase:`info${e.actionVerb}`})}),t.jsx("p",{className:"mb-1 text-info",children:t.jsx(s,{namespace:l,phrase:"preparing"})}),t.jsx(g,{variant:"info",now:0})]})}const j=2e3,R=3;function p(e){const[a,u]=m.useState(null),[I,C]=m.useState(0),i=m.useRef(null),h=S(),N=L();m.useEffect(()=>(d(),()=>{i.current&&window.clearTimeout(i.current)}),[e.jobId]);function d(){e.pollJob(T,v)}function T(n){if(u(n),!(n.status===o.Completed||n.status===o.CompletedWithError||n.status===o.Failed)){i.current=window.setTimeout(d,j);return}window.setTimeout(()=>{V()},2e3)}function v(n){I===R&&(window.clearTimeout(i.current),e.navLockId&&h.unlock(e.navLockId),y(n)),C(c=>c+1),i.current=window.setTimeout(d,j)}function V(){var c;e.navLockId&&h.unlock(e.navLockId);const n={jobId:e.jobId};if(e.userType&&(n.userType=e.userType,N(["school:users","user:count","search:aggregation","search:users"])),e.statusCompleteAppLink){k.trigger({...e.statusCompleteAppLink,params:n});return}(c=e.onStatusCompleted)==null||c.call(e)}return!a||a.status===o.Submitted||a.status===o.Queued||a.status===o.Pending||a.totalItems===0?t.jsx(E,{actionName:e.actionName,actionVerb:e.actionVerb}):t.jsx(P,{totalItems:a.totalItems,totalItemsComplete:a.processedItems,userType:e.userType,objectType:e.objectType,actionName:e.actionName,actionVerb:e.actionVerb,progressVerbPhrase:e.progressVerbPhrase})}export{p as W};
//# sourceMappingURL=BkcyZdze.chunk.js.map
