"use strict";Object.defineProperty(exports,"__esModule",{value:!0}),exports.ProgressReporter=void 0,exports.createStagedProgress=createStagedProgress;class ProgressReporter{callback;lastPercent=0;constructor(t){this.callback=t}report(t,e){const r=void 0!==e?Math.max(0,Math.min(100,e)):void 0;void 0!==r&&(this.lastPercent=r),this.callback&&this.callback(t,r)}start(t){this.report(t,0)}update(t,e){this.report(t,e)}complete(){this.report("Complete",100)}getLastPercent(){return this.lastPercent}}function createStagedProgress(t,e){const r=new ProgressReporter(e);let s=0;const o=t.length>0?100/t.length:100;return{start:()=>{s=0,r.start(t[0]??"Starting...")},nextStage:()=>{s=Math.min(s+1,t.length-1);const e=Math.round(s*o);r.update(t[s]??"Processing...",e)},complete:()=>{s=t.length,r.complete()},getCurrentStage:()=>t[s]??"",getProgress:()=>Math.round(s*o)}}exports.ProgressReporter=ProgressReporter;