"use strict";var j=require("path"),y=require("fs"),g=require("module"),r=require("@esbuild-kit/core-utils"),l=require("get-tsconfig");function f(s){return s&&typeof s=="object"&&"default"in s?s:{default:s}}var d=f(j),E=f(y),u=f(g);const x=/^\.{1,2}\//,O=/\.[cm]?tsx?$/,P=`${d.default.sep}node_modules${d.default.sep}`,i=process.env.ESBK_TSCONFIG_PATH?{path:d.default.resolve(process.env.ESBK_TSCONFIG_PATH),config:l.parseTsconfig(process.env.ESBK_TSCONFIG_PATH)}:l.getTsconfig(),h=i&&l.createFilesMatcher(i),T=i&&l.createPathsMatcher(i),F=r.installSourceMapSupport(),M=r.compareNodeVersion([13,2,0])>=0||r.compareNodeVersion([12,20,0])>=0&&r.compareNodeVersion([13,0,0])<0,m=u.default._extensions,A=m[".js"],b=[".js",".cjs",".cts",".mjs",".mts",".ts",".tsx",".jsx"];function N(s,e){if(!b.some(o=>e.endsWith(o)))return A(s,e);process.send&&process.send({type:"dependency",path:e});let t=E.default.readFileSync(e,"utf8");if(e.endsWith(".cjs")&&M){const o=r.transformDynamicImport(e,t);o&&(t=F(o,e))}else{const o=r.transformSync(t,e,{tsconfigRaw:h==null?void 0:h(e)});t=F(o,e)}s._compile(t,e)}[".js",".ts",".tsx",".jsx"].forEach(s=>{m[s]=N}),Object.defineProperty(m,".mjs",{value:N,enumerable:!1});const D=r.compareNodeVersion([16,0,0])>=0||r.compareNodeVersion([14,18,0])>=0,p=u.default._resolveFilename;u.default._resolveFilename=function(s,e,n,t){var o;if(!D&&s.startsWith("node:")&&(s=s.slice(5)),T&&!x.test(s)&&!((o=e==null?void 0:e.filename)!=null&&o.includes(P))){const a=T(s);for(const _ of a){const v=S.call(this,_,e,n,t);if(v)return v;try{return p.call(this,_,e,n,t)}catch{}}}const c=S.call(this,s,e,n,t);return c||p.call(this,s,e,n,t)};function S(s,e,n,t){const o=r.resolveTsPath(s);if(e!=null&&e.filename&&O.test(e.filename)&&o)try{return p.call(this,o,e,n,t)}catch(c){const{code:a}=c;if(a!=="MODULE_NOT_FOUND"&&a!=="ERR_PACKAGE_PATH_NOT_EXPORTED")throw c}}