function e(e,t,n){throw new Error(n?`No known conditions for "${t}" specifier in "${e}" package`:`Missing "${t}" specifier in "${e}" package`)}function t(e){let t=new Set(["default"]);e.unsafe||t.add(e.require?"require":"import"),e.unsafe||t.add(e.browser?"browser":"node");for(const n of e.conditions||[])n.startsWith("!")?t.delete(n.slice(1)):t.add(n);return t}function n(n,f,o,l){let u,g,c=i(n,o),a=t(l||{}),p=f[c];if(void 0===p){let e,t,n,r;for(r in f)t&&r.length<t.length||("/"===r[r.length-1]&&c.startsWith(r)?(g=c.substring(r.length),t=r):r.length>1&&(n=r.indexOf("*",1),~n&&(e=RegExp("^"+r.substring(0,n)+"(.*)"+r.substring(1+n)+"$").exec(c),e&&e[1]&&(g=e[1],t=r))));p=f[t]}return p||e(n,c),u=s(p,a),u||e(n,c,1),g&&r(u,g),u}function r(e,t){let n,r=0,i=e.length,s=/[*]/g,f=/[/]$/;for(;r<i;r++)e[r]=s.test(n=e[r])?n.replace(s,t):f.test(n)?n+t:n}function i(e,t,n){if(e===t||"."===t)return".";let r=e+"/",i=r.length,s=t.slice(0,i)===r,f=s?t.slice(i):t;return"#"===f[0]?f:s||!n?"./"===f.slice(0,2)?f:"./"+f:f}function s(e,t,n){if(e){if("string"==typeof e)return n&&n.add(e),[e];let r,i;if(Array.isArray(e)){for(i=n||new Set,r=0;r<e.length;r++)s(e[r],t,i);if(!n&&i.size)return[...i]}else for(r in e)if(t.has(r))return s(e[r],t,n)}}function f(n,s,f,l){let u,g,c=i(n,f),a=t(l||{}),p=s[c];if(void 0===p){let e,t,n,r;for(r in s)t&&r.length<t.length||("/"===r[r.length-1]&&c.startsWith(r)?(g=c.substring(r.length),t=r):r.length>1&&(n=r.indexOf("*",1),~n&&(e=RegExp("^"+r.substring(0,n)+"(.*)"+r.substring(1+n)+"$").exec(c),e&&e[1]&&(g=e[1],t=r))));p=s[t]}if(p||e(n,c),u=o(p,a),u)return g&&r(u,g),u}function o(e,t,n,r){if(null==e)return;if("string"==typeof e)return r?(n&&n.add(e),[e]):void 0;let i,s;if(Array.isArray(e)){for(s=n||new Set,i=0;i<e.length;i++)o(e[i],t,s,r);return!n&&s.size?[...s]:void 0}if("types"in e){const r=o(e.types,t,n,!0);if(r&&r.length)return r}else if("typings"in e){const r=o(e.typings,t,n,!0);if(r&&r.length)return r}for(i in e)if("types"!==i&&"types"!==i&&t.has(i)){const s=o(e[i],t,n,r);if(s&&s.length)return s}}function l(e,t={}){let n,r=0,s=t.browser,f=t.fields||["module","main"],o="string"==typeof s;for(s&&!f.includes("browser")&&(f.unshift("browser"),o&&(s=i(e.name,s,!0)));r<f.length;r++)if(n=e[f[r]]){if("string"==typeof n);else{if("object"!=typeof n||"browser"!=f[r])continue;if(o&&(n=n[s],null==n))return s}return"string"==typeof n?"./"+n.replace(/^\.?\//,""):n}}function u(e,t,r){let i,s=e.exports;if(s){if("string"==typeof s)s={".":s};else for(i in s){"."!==i[0]&&(s={".":s});break}return n(e.name,s,t||".",r)}}function g(e,t,r){if(e.imports)return n(e.name,e.imports,t,r)}function c(e,t,n){return"#"===(t=i(e.name,t||"."))[0]?g(e,t,n):u(e,t,n)}function a(e,t,n){let r,i=e.exports;if(i){if("string"==typeof i)i={".":i};else for(r in i){"."!==r[0]&&(i={".":i});break}return f(e.name,i,t||".",n)}}exports.exports=u;exports.imports=g;exports.legacy=l;exports.resolve=c;exports.types=a;