Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(e){e.hooks?.onEnqueue?.();let t=(e.tails.get(e.key)??Promise.resolve()).catch(()=>void 0).then(e.task).finally(()=>{e.hooks?.onSettle?.()}),n=t.then(()=>void 0,()=>void 0);return e.tails.set(e.key,n),n.finally(()=>{e.tails.get(e.key)===n&&e.tails.delete(e.key)}),t}var t=class{constructor(){this.tails=new Map}getTailMapForTesting(){return this.tails}enqueue(t,n,r){return e({tails:this.tails,key:t,task:n,...r?{hooks:r}:{}})}};exports.KeyedAsyncQueue=t,exports.enqueueKeyedTask=e;
