const e=require(`../constants/vite.constants.cjs`),t=require(`../constants/chains.constants.cjs`),n=require(`./workerFactory.cjs`);var r=async r=>{let i=await n.WorkerFactory.getWebWorker(r.type);return new Promise((n,a)=>{let o={};if(typeof window<`u`&&window.location){let{origin:e,protocol:t,host:n,port:r,hostname:i,href:a}=window.location;o={origin:e,protocol:t,host:n,port:r,hostname:i,href:a}}i.onMessage(e=>{n(e),i.terminate()}),i.onError(e=>{a(e),i.terminate()});let s={payload:r.payload,metadata:{hostLocation:o,constants:{chains:{chainIds:t.chainIds},isDevelopment:e.isDevelopment}}};i.postMessage(s)})};exports.performTaskWithWorker=r;