var m=Object.defineProperty;var p=(t,e)=>{for(var r in e)m(t,r,{get:e[r],enumerable:!0})};var h={};p(h,{HOST_RUNTIME:()=>g});import*as o from"node:worker_threads";var i=class{postMessage(e,r){o.parentPort?.postMessage(e,r)}set onmessage(e){o.parentPort?.addEventListener("message",r=>{e(r)})}},a=class{#e;#r=!1;#s;constructor(e){this.#e=new Promise((r,s)=>{this.#s=s;let n=new o.Worker(new URL(e));n.once("message",d=>{d==="workerReady"&&r(n)}),n.on("error",s)})}postMessage(e,r){this.#e.then(s=>{this.#r||s.postMessage(e,r)})}dispose(){this.#r=!0,this.#e.then(e=>e.terminate())}terminate(e){e&&this.#s?.(new Error("Worker terminated")),this.dispose()}set onmessage(e){this.#e.then(r=>{r.on("message",s=>{this.#r||e({data:s,ports:[]})})})}set onerror(e){this.#e.then(r=>{r.on("error",s=>{this.#r||e({type:"error",...s})})})}},g={createWorker(t){return new a(t)},workerScope:new i,getOnLine(){return!0},getUserAgent(){return"Node.js"},getLocalStorage(){}};export{h as HostRuntime};
//# sourceMappingURL=node.js.map
