import{pathToFileURL as e}from"node:url";async function t(e){let t=await Promise.all(Object.entries(e).map(async([e,t])=>[e,typeof t==`function`?await t():t]));return Object.fromEntries(t)}const n=`virtual:`;function r(e,t,r=c()){return{resolve:(i,a,o)=>{let c=s(i);if(Object.hasOwn(e,c)){let e=t?.get(c);return{url:n+encodeURIComponent(i)+(e?`?v=${e}`:``),shortCircuit:!0}}return a.parentURL?.startsWith(n)?o(i,{...a,parentURL:r}):o(i,a)},load:(t,r,a)=>{if(t.startsWith(n)){let n=s(decodeURIComponent(t.slice(8)));if(Object.hasOwn(e,n))return{format:i(n),source:e[n],shortCircuit:!0}}return a(t,r)}}}function i(e){return e.endsWith(`.json`)?`json`:e.endsWith(`.ts`)||e.endsWith(`.mts`)?`module-typescript`:`module`}function a(e,t,n,r){if(typeof n!=`function`)throw TypeError(`[env-runner] virtual TypeScript module "${e}" requires \`module.stripTypeScriptTypes\` ${r.requirement}; ${r.remedy} or provide a pre-transpiled JavaScript source instead.`);return n(t)}function o(e,t){let n=[t],r=new Set(n);for(let t of n){let i=[`"${t}"`,`'${t}'`,"`"+t+"`"];for(let[t,a]of Object.entries(e))!r.has(t)&&i.some(e=>a.includes(e))&&(r.add(t),n.push(t))}return n}function s(e){let t=e.indexOf(`?`);return t===-1?e:e.slice(0,t)}function c(){return e(process.cwd()+`/`).href}export{i as a,a as i,o as n,t as r,r as t};