import{B as g}from"./chunk-OKJYL2E7.js";import{G as d,c as m,j as c,l as f,oc as k,s as u}from"./chunk-OXQYUXXW.js";var a={init:"worker-init",terminate:"worker-terminate"};var y=class o{create(e,t={}){if(typeof Worker>"u")throw new Error(k("worker_not_supported"));let r=new m;e.onmessage=s=>{r.next(s.data)},e.onerror=s=>{r.error(s.message)},t.sendEvents&&e.postMessage(a.init);let n=()=>{t.sendEvents&&e.postMessage(a.terminate),e.terminate()};return{postMessage:s=>{let p=g();return e.postMessage({message:s,key:p}),c(r.pipe(u(i=>i.key===p),f(i=>i.message)))},terminate:()=>{n(),r.complete()}}}async run(e,t,r={}){let n=this.create(e,r);try{return await n.postMessage(t)}finally{n.terminate()}}static \u0275fac=function(t){return new(t||o)};static \u0275prov=d({token:o,factory:o.\u0275fac,providedIn:"root"})};export{y as a};
