"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const W=require("../../../../is-core-module@2.9.0/node_modules/is-core-module/index.js"),D=require("../../../../../../_virtual/___vite-browser-external.js"),X=require("./homedir.js"),Y=require("./caller.js"),x=require("./node-modules-paths.js"),ee=require("./normalize-options.js");var g,T;function re(){if(T)return g;T=1;var M=W.__require(),v=D,i=D,R=X.__require(),A=Y.__require(),C=x.__require(),$=ee.__require(),z=process.platform!=="win32"&&v.realpathSync&&typeof v.realpathSync.native=="function"?v.realpathSync.native:v.realpathSync,F=R(),L=function(){return[i.join(F,".node_modules"),i.join(F,".node_libraries")]},U=function(r){try{var t=v.statSync(r,{throwIfNoEntry:!1})}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return!1;throw e}return!!t&&(t.isFile()||t.isFIFO())},B=function(r){try{var t=v.statSync(r,{throwIfNoEntry:!1})}catch(e){if(e&&(e.code==="ENOENT"||e.code==="ENOTDIR"))return!1;throw e}return!!t&&t.isDirectory()},G=function(r){try{return z(r)}catch(t){if(t.code!=="ENOENT")throw t}return r},y=function(r,t,e){return e&&e.preserveSymlinks===!1?r(t):t},H=function(r,t){var e=r(t);try{var c=JSON.parse(e);return c}catch{}},J=function(r,t,e){for(var c=C(t,e,r),u=0;u<c.length;u++)c[u]=i.join(c[u],r);return c};return g=function(r,t){if(typeof r!="string")throw new TypeError("Path must be a string.");var e=$(r,t),c=e.isFile||U,u=e.readFileSync||v.readFileSync,K=e.isDirectory||B,h=e.realpathSync||G,j=e.readPackageSync||H;if(e.readFileSync&&e.readPackageSync)throw new TypeError("`readFileSync` and `readPackageSync` are mutually exclusive.");var w=e.packageIterator,E=e.extensions||[".js"],V=e.includeCoreModules!==!1,k=e.basedir||i.dirname(A()),Z=e.filename||k;e.paths=e.paths||L();var N=y(h,i.resolve(k),e);if(/^(?:\.\.?(?:\/|$)|\/|([A-Za-z]:)?[/\\])/.test(r)){var S=i.resolve(N,r);(r==="."||r===".."||r.slice(-1)==="/")&&(S+="/");var P=p(S)||_(S);if(P)return y(h,P,e)}else{if(V&&M(r))return r;var q=Q(r,N);if(q)return y(h,q,e)}var O=new Error("Cannot find module '"+r+"' from '"+Z+"'");throw O.code="MODULE_NOT_FOUND",O;function p(a){var o=b(i.dirname(a));if(o&&o.dir&&o.pkg&&e.pathFilter){var n=i.relative(o.dir,a),f=e.pathFilter(o.pkg,a,n);f&&(a=i.resolve(o.dir,f))}if(c(a))return a;for(var s=0;s<E.length;s++){var l=a+E[s];if(c(l))return l}}function b(a){if(!(a===""||a==="/")&&!(process.platform==="win32"&&/^\w:[/\\]*$/.test(a))&&!/[/\\]node_modules[/\\]*$/.test(a)){var o=i.join(y(h,a,e),"package.json");if(!c(o))return b(i.dirname(a));var n=j(u,o);return n&&e.packageFilter&&(n=e.packageFilter(n,a)),{pkg:n,dir:a}}}function _(a){var o=i.join(y(h,a,e),"/package.json");if(c(o)){try{var n=j(u,o)}catch{}if(n&&e.packageFilter&&(n=e.packageFilter(n,a)),n&&n.main){if(typeof n.main!="string"){var f=new TypeError("package \u201C"+n.name+"\u201D `main` must be a string");throw f.code="INVALID_PACKAGE_MAIN",f}(n.main==="."||n.main==="./")&&(n.main="index");try{var s=p(i.resolve(a,n.main));if(s)return s;var l=_(i.resolve(a,n.main));if(l)return l}catch{}}}return p(i.join(a,"/index"))}function Q(a,o){for(var n=function(){return J(a,o,e)},f=w?w(a,o,n,e):n(),s=0;s<f.length;s++){var l=f[s];if(K(i.dirname(l))){var m=p(l);if(m)return m;var I=_(l);if(I)return I}}}},g}exports.__require=re;
//# sourceMappingURL=sync.js.map
