nf3 0.1.7 → 0.1.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,13 @@
1
+ const m$1=Symbol.for(`__confbox_fmt__`),k$1=/^(\s+)/,v$1=/(\s+)$/;function x$3(e,i={}){return{sample:i.indent===void 0&&i.preserveIndentation!==!1&&e.slice(0,i?.sampleSize||1024),whiteSpace:i.preserveWhitespace===!1?void 0:{start:k$1.exec(e)?.[0]||``,end:v$1.exec(e)?.[0]||``}}}function N$2(t,n,a){!n||typeof n!=`object`||Object.defineProperty(n,m$1,{enumerable:!1,configurable:!0,writable:!0,value:x$3(t,a)})}function $$1(e,t=!1){let n=e.length,i=0,a=``,o=0,u=16,f=0,p=0,y=0,D=0,O=0;function A(t,n){let a=0,o=0;for(;a<t||!n;){let t=e.charCodeAt(i);if(t>=48&&t<=57)o=o*16+t-48;else if(t>=65&&t<=70)o=o*16+t-65+10;else if(t>=97&&t<=102)o=o*16+t-97+10;else break;i++,a++}return a<t&&(o=-1),o}function j(e){i=e,a=``,o=0,u=16,O=0}function M(){let t=i;if(e.charCodeAt(i)===48)i++;else for(i++;i<e.length&&L$1(e.charCodeAt(i));)i++;if(i<e.length&&e.charCodeAt(i)===46)if(i++,i<e.length&&L$1(e.charCodeAt(i)))for(i++;i<e.length&&L$1(e.charCodeAt(i));)i++;else return O=3,e.substring(t,i);let n=i;if(i<e.length&&(e.charCodeAt(i)===69||e.charCodeAt(i)===101))if(i++,(i<e.length&&e.charCodeAt(i)===43||e.charCodeAt(i)===45)&&i++,i<e.length&&L$1(e.charCodeAt(i))){for(i++;i<e.length&&L$1(e.charCodeAt(i));)i++;n=i}else O=3;return e.substring(t,n)}function F(){let t=``,a=i;for(;;){if(i>=n){t+=e.substring(a,i),O=2;break}let o=e.charCodeAt(i);if(o===34){t+=e.substring(a,i),i++;break}if(o===92){if(t+=e.substring(a,i),i++,i>=n){O=2;break}switch(e.charCodeAt(i++)){case 34:t+=`"`;break;case 92:t+=`\\`;break;case 47:t+=`/`;break;case 98:t+=`\b`;break;case 102:t+=`\f`;break;case 110:t+=`
2
+ `;break;case 114:t+=`\r`;break;case 116:t+=` `;break;case 117:let e=A(4,!0);e>=0?t+=String.fromCharCode(e):O=4;break;default:O=5}a=i;continue}if(o>=0&&o<=31)if(r$1(o)){t+=e.substring(a,i),O=2;break}else O=6;i++}return t}function I(){if(a=``,O=0,o=i,p=f,D=y,i>=n)return o=n,u=17;let t=e.charCodeAt(i);if(J$1(t)){do i++,a+=String.fromCharCode(t),t=e.charCodeAt(i);while(J$1(t));return u=15}if(r$1(t))return i++,a+=String.fromCharCode(t),t===13&&e.charCodeAt(i)===10&&(i++,a+=`
3
+ `),f++,y=i,u=14;switch(t){case 123:return i++,u=1;case 125:return i++,u=2;case 91:return i++,u=3;case 93:return i++,u=4;case 58:return i++,u=6;case 44:return i++,u=5;case 34:return i++,a=F(),u=10;case 47:let s=i-1;if(e.charCodeAt(i+1)===47){for(i+=2;i<n&&!r$1(e.charCodeAt(i));)i++;return a=e.substring(s,i),u=12}if(e.charCodeAt(i+1)===42){i+=2;let t=n-1,o=!1;for(;i<t;){let t=e.charCodeAt(i);if(t===42&&e.charCodeAt(i+1)===47){i+=2,o=!0;break}i++,r$1(t)&&(t===13&&e.charCodeAt(i)===10&&i++,f++,y=i)}return o||(i++,O=1),a=e.substring(s,i),u=13}return a+=String.fromCharCode(t),i++,u=16;case 45:if(a+=String.fromCharCode(t),i++,i===n||!L$1(e.charCodeAt(i)))return u=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return a+=M(),u=11;default:for(;i<n&&R(t);)i++,t=e.charCodeAt(i);if(o!==i){switch(a=e.substring(o,i),a){case`true`:return u=8;case`false`:return u=9;case`null`:return u=7}return u=16}return a+=String.fromCharCode(t),i++,u=16}}function R(e){if(J$1(e)||r$1(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function B(){let e;do e=I();while(e>=12&&e<=15);return e}return{setPosition:j,getPosition:()=>i,scan:t?B:I,getToken:()=>u,getTokenValue:()=>a,getTokenOffset:()=>o,getTokenLength:()=>i-o,getTokenStartLine:()=>p,getTokenStartCharacter:()=>o-D,getTokenError:()=>O}}function J$1(e){return e===32||e===9}function r$1(e){return e===10||e===13}function L$1(e){return e>=48&&e<=57}var Q$1;(function(e){e[e.lineFeed=10]=`lineFeed`,e[e.carriageReturn=13]=`carriageReturn`,e[e.space=32]=`space`,e[e._0=48]=`_0`,e[e._1=49]=`_1`,e[e._2=50]=`_2`,e[e._3=51]=`_3`,e[e._4=52]=`_4`,e[e._5=53]=`_5`,e[e._6=54]=`_6`,e[e._7=55]=`_7`,e[e._8=56]=`_8`,e[e._9=57]=`_9`,e[e.a=97]=`a`,e[e.b=98]=`b`,e[e.c=99]=`c`,e[e.d=100]=`d`,e[e.e=101]=`e`,e[e.f=102]=`f`,e[e.g=103]=`g`,e[e.h=104]=`h`,e[e.i=105]=`i`,e[e.j=106]=`j`,e[e.k=107]=`k`,e[e.l=108]=`l`,e[e.m=109]=`m`,e[e.n=110]=`n`,e[e.o=111]=`o`,e[e.p=112]=`p`,e[e.q=113]=`q`,e[e.r=114]=`r`,e[e.s=115]=`s`,e[e.t=116]=`t`,e[e.u=117]=`u`,e[e.v=118]=`v`,e[e.w=119]=`w`,e[e.x=120]=`x`,e[e.y=121]=`y`,e[e.z=122]=`z`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.asterisk=42]=`asterisk`,e[e.backslash=92]=`backslash`,e[e.closeBrace=125]=`closeBrace`,e[e.closeBracket=93]=`closeBracket`,e[e.colon=58]=`colon`,e[e.comma=44]=`comma`,e[e.dot=46]=`dot`,e[e.doubleQuote=34]=`doubleQuote`,e[e.minus=45]=`minus`,e[e.openBrace=123]=`openBrace`,e[e.openBracket=91]=`openBracket`,e[e.plus=43]=`plus`,e[e.slash=47]=`slash`,e[e.formFeed=12]=`formFeed`,e[e.tab=9]=`tab`})(Q$1||={}),Array(20).fill(0).map((e,t)=>` `.repeat(t)),Array(200).fill(0).map((e,t)=>`
4
+ `+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r
5
+ `+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`
6
+ `+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r
7
+ `+` `.repeat(t));var U$1;(function(e){e.DEFAULT={allowTrailingComma:!1}})(U$1||={});function S$2(e,t=[],n=U$1.DEFAULT){let i=null,a=[],o=[];function s(e){Array.isArray(a)?a.push(e):i!==null&&(a[i]=e)}return P$1(e,{onObjectBegin:()=>{let e={};s(e),o.push(a),a=e,i=null},onObjectProperty:e=>{i=e},onObjectEnd:()=>{a=o.pop()},onArrayBegin:()=>{let e=[];s(e),o.push(a),a=e,i=null},onArrayEnd:()=>{a=o.pop()},onLiteralValue:s,onError:(e,n,i)=>{t.push({error:e,offset:n,length:i})}},n),a[0]}function P$1(e,t,n=U$1.DEFAULT){let i=$$1(e,!1),a=[],s=0;function c(e){return e?()=>s===0&&e(i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter()):()=>!0}function l(e){return e?t=>s===0&&e(t,i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter()):()=>!0}function u(e){return e?t=>s===0&&e(t,i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter(),()=>a.slice()):()=>!0}function p(e){return e?()=>{s>0?s++:e(i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter(),()=>a.slice())===!1&&(s=1)}:()=>!0}function y(e){return e?()=>{s>0&&s--,s===0&&e(i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter())}:()=>!0}let D=p(t.onObjectBegin),O=u(t.onObjectProperty),A=y(t.onObjectEnd),j=p(t.onArrayBegin),M=y(t.onArrayEnd),F=u(t.onLiteralValue),I=l(t.onSeparator),R=c(t.onComment),B=l(t.onError),V=n&&n.disallowComments,G=n&&n.allowTrailingComma;function Y(){for(;;){let e=i.scan();switch(i.getTokenError()){case 4:X(14);break;case 5:X(15);break;case 3:X(13);break;case 1:V||X(11);break;case 2:X(12);break;case 6:X(16);break}switch(e){case 12:case 13:V?X(10):R();break;case 16:X(1);break;case 15:case 14:break;default:return e}}}function X(e,t=[],n=[]){if(B(e),t.length+n.length>0){let e=i.getToken();for(;e!==17;){if(t.indexOf(e)!==-1){Y();break}else if(n.indexOf(e)!==-1)break;e=Y()}}}function ge(e){let t=i.getTokenValue();return e?F(t):(O(t),a.push(t)),Y(),!0}function _e(){switch(i.getToken()){case 11:let e=i.getTokenValue(),t=Number(e);isNaN(t)&&(X(2),t=0),F(t);break;case 7:F(null);break;case 8:F(!0);break;case 9:F(!1);break;default:return!1}return Y(),!0}function ve(){return i.getToken()===10?(ge(!1),i.getToken()===6?(I(`:`),Y(),be()||X(4,[],[2,5])):X(5,[],[2,5]),a.pop(),!0):(X(3,[],[2,5]),!1)}function Z(){D(),Y();let e=!1;for(;i.getToken()!==2&&i.getToken()!==17;){if(i.getToken()===5){if(e||X(4,[],[]),I(`,`),Y(),i.getToken()===2&&G)break}else e&&X(6,[],[]);ve()||X(4,[],[2,5]),e=!0}return A(),i.getToken()===2?Y():X(7,[2],[]),!0}function ye(){j(),Y();let e=!0,t=!1;for(;i.getToken()!==4&&i.getToken()!==17;){if(i.getToken()===5){if(t||X(4,[],[]),I(`,`),Y(),i.getToken()===4&&G)break}else t&&X(6,[],[]);e?(a.push(0),e=!1):a[a.length-1]++,be()||X(4,[],[4,5]),t=!0}return M(),e||a.pop(),i.getToken()===4?Y():X(8,[4],[]),!0}function be(){switch(i.getToken()){case 3:return ye();case 1:return Z();case 10:return ge(!0);default:return _e()}}return Y(),i.getToken()===17?n.allowEmptyContent?!0:(X(4,[],[]),!1):be()?(i.getToken()!==17&&X(9,[],[]),!0):(X(4,[],[]),!1)}var W$1;(function(e){e[e.None=0]=`None`,e[e.UnexpectedEndOfComment=1]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=2]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=3]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=4]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=5]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=6]=`InvalidCharacter`})(W$1||={});var H$1;(function(e){e[e.OpenBraceToken=1]=`OpenBraceToken`,e[e.CloseBraceToken=2]=`CloseBraceToken`,e[e.OpenBracketToken=3]=`OpenBracketToken`,e[e.CloseBracketToken=4]=`CloseBracketToken`,e[e.CommaToken=5]=`CommaToken`,e[e.ColonToken=6]=`ColonToken`,e[e.NullKeyword=7]=`NullKeyword`,e[e.TrueKeyword=8]=`TrueKeyword`,e[e.FalseKeyword=9]=`FalseKeyword`,e[e.StringLiteral=10]=`StringLiteral`,e[e.NumericLiteral=11]=`NumericLiteral`,e[e.LineCommentTrivia=12]=`LineCommentTrivia`,e[e.BlockCommentTrivia=13]=`BlockCommentTrivia`,e[e.LineBreakTrivia=14]=`LineBreakTrivia`,e[e.Trivia=15]=`Trivia`,e[e.Unknown=16]=`Unknown`,e[e.EOF=17]=`EOF`})(H$1||={});const K$1=S$2;var q$1;(function(e){e[e.InvalidSymbol=1]=`InvalidSymbol`,e[e.InvalidNumberFormat=2]=`InvalidNumberFormat`,e[e.PropertyNameExpected=3]=`PropertyNameExpected`,e[e.ValueExpected=4]=`ValueExpected`,e[e.ColonExpected=5]=`ColonExpected`,e[e.CommaExpected=6]=`CommaExpected`,e[e.CloseBraceExpected=7]=`CloseBraceExpected`,e[e.CloseBracketExpected=8]=`CloseBracketExpected`,e[e.EndOfFileExpected=9]=`EndOfFileExpected`,e[e.InvalidCommentToken=10]=`InvalidCommentToken`,e[e.UnexpectedEndOfComment=11]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=12]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=13]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=14]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=15]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=16]=`InvalidCharacter`})(q$1||={});function x$2(e,t){let n=JSON.parse(e,t?.reviver);return N$2(e,n,t),n}function h$2(e,t){let n=K$1(e,t?.errors,t);return N$2(e,n,t),n}const b=/^(?:( )+|\t+)/,d=`space`;function g(e,t){let n=new Map,i=0,a,o;for(let s of e.split(/\n/g)){if(!s)continue;let e,c,l,u,f,p=s.match(b);if(p===null)i=0,a=``;else{if(e=p[0].length,c=p[1]?d:`tab`,t&&c===d&&e===1)continue;c!==a&&(i=0),a=c,l=1,u=0;let s=e-i;if(i=e,s===0)l=0,u=1;else{let e=s>0?s:-s;o=T(c,e)}f=n.get(o),f=f===void 0?[1,0]:[f[0]+l,f[1]+u],n.set(o,f)}}return n}function T(e,t){return(e===d?`s`:`t`)+String(t)}function w(e){return{type:e[0]===`s`?d:`tab`,amount:Number(e.slice(1))}}function E(e){let t,n=0,i=0;for(let[a,[o,s]]of e)(o>n||o===n&&s>i)&&(n=o,i=s,t=a);return t}function S$1(e,t){return(e===d?` `:` `).repeat(t)}function _(e){if(typeof e!=`string`)throw TypeError(`Expected a string`);let t=g(e,!0);t.size===0&&(t=g(e,!1));let n=E(t),i,a=0,o=``;return n!==void 0&&({type:i,amount:a}=w(n),o=S$1(i,a)),{amount:a,type:i,indent:o}}const m=Symbol.for(`__confbox_fmt__`),k=/^(\s+)/,v=/(\s+)$/;function x$1(e,t={}){return{sample:t.indent===void 0&&t.preserveIndentation!==!1&&e.slice(0,t?.sampleSize||1024),whiteSpace:t.preserveWhitespace===!1?void 0:{start:k.exec(e)?.[0]||``,end:v.exec(e)?.[0]||``}}}function N(e,t,n){!t||typeof t!=`object`||Object.defineProperty(t,m,{enumerable:!1,configurable:!0,writable:!0,value:x$1(e,n)})}function C(e,t){if(!e||typeof e!=`object`||!(m in e))return{indent:t?.indent??2,whitespace:{start:``,end:``}};let n=e[m];return{indent:t?.indent||_(n.sample||``).indent,whitespace:n.whiteSpace||{start:``,end:``}}}function $(e,t=!1){let n=e.length,i=0,a=``,o=0,s=16,c=0,l=0,u=0,f=0,p=0;function y(t,n){let a=0,o=0;for(;a<t;){let t=e.charCodeAt(i);if(t>=48&&t<=57)o=o*16+t-48;else if(t>=65&&t<=70)o=o*16+t-65+10;else if(t>=97&&t<=102)o=o*16+t-97+10;else break;i++,a++}return a<t&&(o=-1),o}function D(e){i=e,a=``,o=0,s=16,p=0}function O(){let t=i;if(e.charCodeAt(i)===48)i++;else for(i++;i<e.length&&L(e.charCodeAt(i));)i++;if(i<e.length&&e.charCodeAt(i)===46)if(i++,i<e.length&&L(e.charCodeAt(i)))for(i++;i<e.length&&L(e.charCodeAt(i));)i++;else return p=3,e.substring(t,i);let n=i;if(i<e.length&&(e.charCodeAt(i)===69||e.charCodeAt(i)===101))if(i++,(i<e.length&&e.charCodeAt(i)===43||e.charCodeAt(i)===45)&&i++,i<e.length&&L(e.charCodeAt(i))){for(i++;i<e.length&&L(e.charCodeAt(i));)i++;n=i}else p=3;return e.substring(t,n)}function A(){let t=``,a=i;for(;;){if(i>=n){t+=e.substring(a,i),p=2;break}let o=e.charCodeAt(i);if(o===34){t+=e.substring(a,i),i++;break}if(o===92){if(t+=e.substring(a,i),i++,i>=n){p=2;break}switch(e.charCodeAt(i++)){case 34:t+=`"`;break;case 92:t+=`\\`;break;case 47:t+=`/`;break;case 98:t+=`\b`;break;case 102:t+=`\f`;break;case 110:t+=`
8
+ `;break;case 114:t+=`\r`;break;case 116:t+=` `;break;case 117:let e=y(4);e>=0?t+=String.fromCharCode(e):p=4;break;default:p=5}a=i;continue}if(o>=0&&o<=31)if(r(o)){t+=e.substring(a,i),p=2;break}else p=6;i++}return t}function j(){if(a=``,p=0,o=i,l=c,f=u,i>=n)return o=n,s=17;let t=e.charCodeAt(i);if(J(t)){do i++,a+=String.fromCharCode(t),t=e.charCodeAt(i);while(J(t));return s=15}if(r(t))return i++,a+=String.fromCharCode(t),t===13&&e.charCodeAt(i)===10&&(i++,a+=`
9
+ `),c++,u=i,s=14;switch(t){case 123:return i++,s=1;case 125:return i++,s=2;case 91:return i++,s=3;case 93:return i++,s=4;case 58:return i++,s=6;case 44:return i++,s=5;case 34:return i++,a=A(),s=10;case 47:let l=i-1;if(e.charCodeAt(i+1)===47){for(i+=2;i<n&&!r(e.charCodeAt(i));)i++;return a=e.substring(l,i),s=12}if(e.charCodeAt(i+1)===42){i+=2;let t=n-1,o=!1;for(;i<t;){let t=e.charCodeAt(i);if(t===42&&e.charCodeAt(i+1)===47){i+=2,o=!0;break}i++,r(t)&&(t===13&&e.charCodeAt(i)===10&&i++,c++,u=i)}return o||(i++,p=1),a=e.substring(l,i),s=13}return a+=String.fromCharCode(t),i++,s=16;case 45:if(a+=String.fromCharCode(t),i++,i===n||!L(e.charCodeAt(i)))return s=16;case 48:case 49:case 50:case 51:case 52:case 53:case 54:case 55:case 56:case 57:return a+=O(),s=11;default:for(;i<n&&M(t);)i++,t=e.charCodeAt(i);if(o!==i){switch(a=e.substring(o,i),a){case`true`:return s=8;case`false`:return s=9;case`null`:return s=7}return s=16}return a+=String.fromCharCode(t),i++,s=16}}function M(e){if(J(e)||r(e))return!1;switch(e){case 125:case 93:case 123:case 91:case 34:case 58:case 44:case 47:return!1}return!0}function F(){let e;do e=j();while(e>=12&&e<=15);return e}return{setPosition:D,getPosition:()=>i,scan:t?F:j,getToken:()=>s,getTokenValue:()=>a,getTokenOffset:()=>o,getTokenLength:()=>i-o,getTokenStartLine:()=>l,getTokenStartCharacter:()=>o-f,getTokenError:()=>p}}function J(e){return e===32||e===9}function r(e){return e===10||e===13}function L(e){return e>=48&&e<=57}var Q;(function(e){e[e.lineFeed=10]=`lineFeed`,e[e.carriageReturn=13]=`carriageReturn`,e[e.space=32]=`space`,e[e._0=48]=`_0`,e[e._1=49]=`_1`,e[e._2=50]=`_2`,e[e._3=51]=`_3`,e[e._4=52]=`_4`,e[e._5=53]=`_5`,e[e._6=54]=`_6`,e[e._7=55]=`_7`,e[e._8=56]=`_8`,e[e._9=57]=`_9`,e[e.a=97]=`a`,e[e.b=98]=`b`,e[e.c=99]=`c`,e[e.d=100]=`d`,e[e.e=101]=`e`,e[e.f=102]=`f`,e[e.g=103]=`g`,e[e.h=104]=`h`,e[e.i=105]=`i`,e[e.j=106]=`j`,e[e.k=107]=`k`,e[e.l=108]=`l`,e[e.m=109]=`m`,e[e.n=110]=`n`,e[e.o=111]=`o`,e[e.p=112]=`p`,e[e.q=113]=`q`,e[e.r=114]=`r`,e[e.s=115]=`s`,e[e.t=116]=`t`,e[e.u=117]=`u`,e[e.v=118]=`v`,e[e.w=119]=`w`,e[e.x=120]=`x`,e[e.y=121]=`y`,e[e.z=122]=`z`,e[e.A=65]=`A`,e[e.B=66]=`B`,e[e.C=67]=`C`,e[e.D=68]=`D`,e[e.E=69]=`E`,e[e.F=70]=`F`,e[e.G=71]=`G`,e[e.H=72]=`H`,e[e.I=73]=`I`,e[e.J=74]=`J`,e[e.K=75]=`K`,e[e.L=76]=`L`,e[e.M=77]=`M`,e[e.N=78]=`N`,e[e.O=79]=`O`,e[e.P=80]=`P`,e[e.Q=81]=`Q`,e[e.R=82]=`R`,e[e.S=83]=`S`,e[e.T=84]=`T`,e[e.U=85]=`U`,e[e.V=86]=`V`,e[e.W=87]=`W`,e[e.X=88]=`X`,e[e.Y=89]=`Y`,e[e.Z=90]=`Z`,e[e.asterisk=42]=`asterisk`,e[e.backslash=92]=`backslash`,e[e.closeBrace=125]=`closeBrace`,e[e.closeBracket=93]=`closeBracket`,e[e.colon=58]=`colon`,e[e.comma=44]=`comma`,e[e.dot=46]=`dot`,e[e.doubleQuote=34]=`doubleQuote`,e[e.minus=45]=`minus`,e[e.openBrace=123]=`openBrace`,e[e.openBracket=91]=`openBracket`,e[e.plus=43]=`plus`,e[e.slash=47]=`slash`,e[e.formFeed=12]=`formFeed`,e[e.tab=9]=`tab`})(Q||={}),Array(20).fill(0).map((e,t)=>` `.repeat(t)),Array(200).fill(0).map((e,t)=>`
10
+ `+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r
11
+ `+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`
12
+ `+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r`+` `.repeat(t)),Array(200).fill(0).map((e,t)=>`\r
13
+ `+` `.repeat(t));var U;(function(e){e.DEFAULT={allowTrailingComma:!1}})(U||={});function S(e,t=[],n=U.DEFAULT){let i=null,a=[],o=[];function s(e){Array.isArray(a)?a.push(e):i!==null&&(a[i]=e)}return P(e,{onObjectBegin:()=>{let e={};s(e),o.push(a),a=e,i=null},onObjectProperty:e=>{i=e},onObjectEnd:()=>{a=o.pop()},onArrayBegin:()=>{let e=[];s(e),o.push(a),a=e,i=null},onArrayEnd:()=>{a=o.pop()},onLiteralValue:s,onError:(e,n,i)=>{t.push({error:e,offset:n,length:i})}},n),a[0]}function P(e,t,n=U.DEFAULT){let i=$(e,!1),a=[],o=0;function s(e){return e?()=>o===0&&e(i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter()):()=>!0}function c(e){return e?t=>o===0&&e(t,i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter()):()=>!0}function l(e){return e?t=>o===0&&e(t,i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter(),()=>a.slice()):()=>!0}function u(e){return e?()=>{o>0?o++:e(i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter(),()=>a.slice())===!1&&(o=1)}:()=>!0}function f(e){return e?()=>{o>0&&o--,o===0&&e(i.getTokenOffset(),i.getTokenLength(),i.getTokenStartLine(),i.getTokenStartCharacter())}:()=>!0}let p=u(t.onObjectBegin),y=l(t.onObjectProperty),D=f(t.onObjectEnd),O=u(t.onArrayBegin),A=f(t.onArrayEnd),j=l(t.onLiteralValue),M=c(t.onSeparator),F=s(t.onComment),I=c(t.onError),R=n&&n.disallowComments,B=n&&n.allowTrailingComma;function V(){for(;;){let e=i.scan();switch(i.getTokenError()){case 4:G(14);break;case 5:G(15);break;case 3:G(13);break;case 1:R||G(11);break;case 2:G(12);break;case 6:G(16);break}switch(e){case 12:case 13:R?G(10):F();break;case 16:G(1);break;case 15:case 14:break;default:return e}}}function G(e,t=[],n=[]){if(I(e),t.length+n.length>0){let e=i.getToken();for(;e!==17;){if(t.indexOf(e)!==-1){V();break}else if(n.indexOf(e)!==-1)break;e=V()}}}function Y(e){let t=i.getTokenValue();return e?j(t):(y(t),a.push(t)),V(),!0}function X(){switch(i.getToken()){case 11:let e=i.getTokenValue(),t=Number(e);isNaN(t)&&(G(2),t=0),j(t);break;case 7:j(null);break;case 8:j(!0);break;case 9:j(!1);break;default:return!1}return V(),!0}function ge(){return i.getToken()===10?(Y(!1),i.getToken()===6?(M(`:`),V(),Z()||G(4,[],[2,5])):G(5,[],[2,5]),a.pop(),!0):(G(3,[],[2,5]),!1)}function _e(){p(),V();let e=!1;for(;i.getToken()!==2&&i.getToken()!==17;){if(i.getToken()===5){if(e||G(4,[],[]),M(`,`),V(),i.getToken()===2&&B)break}else e&&G(6,[],[]);ge()||G(4,[],[2,5]),e=!0}return D(),i.getToken()===2?V():G(7,[2],[]),!0}function ve(){O(),V();let e=!0,t=!1;for(;i.getToken()!==4&&i.getToken()!==17;){if(i.getToken()===5){if(t||G(4,[],[]),M(`,`),V(),i.getToken()===4&&B)break}else t&&G(6,[],[]);e?(a.push(0),e=!1):a[a.length-1]++,Z()||G(4,[],[4,5]),t=!0}return A(),e||a.pop(),i.getToken()===4?V():G(8,[4],[]),!0}function Z(){switch(i.getToken()){case 3:return ve();case 1:return _e();case 10:return Y(!0);default:return X()}}return V(),i.getToken()===17?n.allowEmptyContent?!0:(G(4,[],[]),!1):Z()?(i.getToken()!==17&&G(9,[],[]),!0):(G(4,[],[]),!1)}var W;(function(e){e[e.None=0]=`None`,e[e.UnexpectedEndOfComment=1]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=2]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=3]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=4]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=5]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=6]=`InvalidCharacter`})(W||={});var H;(function(e){e[e.OpenBraceToken=1]=`OpenBraceToken`,e[e.CloseBraceToken=2]=`CloseBraceToken`,e[e.OpenBracketToken=3]=`OpenBracketToken`,e[e.CloseBracketToken=4]=`CloseBracketToken`,e[e.CommaToken=5]=`CommaToken`,e[e.ColonToken=6]=`ColonToken`,e[e.NullKeyword=7]=`NullKeyword`,e[e.TrueKeyword=8]=`TrueKeyword`,e[e.FalseKeyword=9]=`FalseKeyword`,e[e.StringLiteral=10]=`StringLiteral`,e[e.NumericLiteral=11]=`NumericLiteral`,e[e.LineCommentTrivia=12]=`LineCommentTrivia`,e[e.BlockCommentTrivia=13]=`BlockCommentTrivia`,e[e.LineBreakTrivia=14]=`LineBreakTrivia`,e[e.Trivia=15]=`Trivia`,e[e.Unknown=16]=`Unknown`,e[e.EOF=17]=`EOF`})(H||={});const K=S;var q;(function(e){e[e.InvalidSymbol=1]=`InvalidSymbol`,e[e.InvalidNumberFormat=2]=`InvalidNumberFormat`,e[e.PropertyNameExpected=3]=`PropertyNameExpected`,e[e.ValueExpected=4]=`ValueExpected`,e[e.ColonExpected=5]=`ColonExpected`,e[e.CommaExpected=6]=`CommaExpected`,e[e.CloseBraceExpected=7]=`CloseBraceExpected`,e[e.CloseBracketExpected=8]=`CloseBracketExpected`,e[e.EndOfFileExpected=9]=`EndOfFileExpected`,e[e.InvalidCommentToken=10]=`InvalidCommentToken`,e[e.UnexpectedEndOfComment=11]=`UnexpectedEndOfComment`,e[e.UnexpectedEndOfString=12]=`UnexpectedEndOfString`,e[e.UnexpectedEndOfNumber=13]=`UnexpectedEndOfNumber`,e[e.InvalidUnicode=14]=`InvalidUnicode`,e[e.InvalidEscapeCharacter=15]=`InvalidEscapeCharacter`,e[e.InvalidCharacter=16]=`InvalidCharacter`})(q||={});function x(e,t){let n=JSON.parse(e,t?.reviver);return N(e,n,t),n}function z(e,t){let n=C(e,t),i=JSON.stringify(e,t?.replacer,n.indent);return n.whitespace.start+i+n.whitespace.end}function h(e,t){let n=K(e,t?.errors,t);return N(e,n,t),n}export{x$2 as a,h$2 as i,x as n,z as r,h as t};
@@ -0,0 +1,3 @@
1
+ import fs,{lstatSync,realpathSync,statSync}from"node:fs";import{URL as URL$1,fileURLToPath,pathToFileURL}from"node:url";import path,{isAbsolute}from"node:path";import assert from"node:assert";import process$1 from"node:process";import v8 from"node:v8";import{format,inspect}from"node:util";const nodeBuiltins=`_http_agent._http_client._http_common._http_incoming._http_outgoing._http_server._stream_duplex._stream_passthrough._stream_readable._stream_transform._stream_wrap._stream_writable._tls_common._tls_wrap.assert.assert/strict.async_hooks.buffer.child_process.cluster.console.constants.crypto.dgram.diagnostics_channel.dns.dns/promises.domain.events.fs.fs/promises.http.http2.https.inspector.inspector/promises.module.net.os.path.path/posix.path/win32.perf_hooks.process.punycode.querystring.readline.readline/promises.repl.stream.stream/consumers.stream/promises.stream/web.string_decoder.sys.timers.timers/promises.tls.trace_events.tty.url.util.util/types.v8.vm.wasi.worker_threads.zlib`.split(`.`),own$1={}.hasOwnProperty,classRegExp=/^([A-Z][a-z\d]*)+$/,kTypes=new Set([`string`,`function`,`number`,`object`,`Function`,`Object`,`boolean`,`bigint`,`symbol`]),messages=new Map;let userStackTraceLimit;function formatList(l,R=`and`){return l.length<3?l.join(` ${R} `):`${l.slice(0,-1).join(`, `)}, ${R} ${l.at(-1)}`}function createError(l,R,z){return messages.set(l,R),makeNodeErrorWithCode(z,l)}function makeNodeErrorWithCode(l,R){return function(...z){let B=Error.stackTraceLimit;isErrorStackTraceLimitWritable()&&(Error.stackTraceLimit=0);let V=new l;isErrorStackTraceLimitWritable()&&(Error.stackTraceLimit=B);let H=getMessage(R,z,V);return Object.defineProperties(V,{message:{value:H,enumerable:!1,writable:!0,configurable:!0},toString:{value(){return`${this.name} [${R}]: ${this.message}`},enumerable:!1,writable:!0,configurable:!0}}),captureLargerStackTrace(V),V.code=R,V}}function isErrorStackTraceLimitWritable(){try{if(v8.startupSnapshot.isBuildingSnapshot())return!1}catch{}let l=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return l===void 0?Object.isExtensible(Error):own$1.call(l,`writable`)&&l.writable!==void 0?l.writable:l.set!==void 0}function hideStackFrames(l){let R=`__node_internal_`+l.name;return Object.defineProperty(l,`name`,{value:R}),l}const captureLargerStackTrace=hideStackFrames(function(l){let R=isErrorStackTraceLimitWritable();return R&&(userStackTraceLimit=Error.stackTraceLimit,Error.stackTraceLimit=1/0),Error.captureStackTrace(l),R&&(Error.stackTraceLimit=userStackTraceLimit),l});function getMessage(l,R,z){let B=messages.get(l);if(assert(B!==void 0,"expected `message` to be found"),typeof B==`function`)return assert(B.length<=R.length,`Code: ${l}; The provided arguments length (${R.length}) does not match the required ones (${B.length}).`),Reflect.apply(B,z,R);let V=/%[dfijoOs]/g,H=0;for(;V.exec(B)!==null;)H++;return assert(H===R.length,`Code: ${l}; The provided arguments length (${R.length}) does not match the required ones (${H}).`),R.length===0?B:(R.unshift(B),Reflect.apply(format,null,R))}function determineSpecificType(l){if(l==null)return String(l);if(typeof l==`function`&&l.name)return`function ${l.name}`;if(typeof l==`object`)return l.constructor&&l.constructor.name?`an instance of ${l.constructor.name}`:`${inspect(l,{depth:-1})}`;let R=inspect(l,{colors:!1});return R.length>28&&(R=`${R.slice(0,25)}...`),`type ${typeof l} (${R})`}createError(`ERR_INVALID_ARG_TYPE`,(l,R,z)=>{assert(typeof l==`string`,`'name' must be a string`),Array.isArray(R)||(R=[R]);let B=`The `;if(l.endsWith(` argument`))B+=`${l} `;else{let R=l.includes(`.`)?`property`:`argument`;B+=`"${l}" ${R} `}B+=`must be `;let V=[],H=[],U=[];for(let l of R)assert(typeof l==`string`,`All expected entries have to be of type string`),kTypes.has(l)?V.push(l.toLowerCase()):classRegExp.exec(l)===null?(assert(l!==`object`,`The value "object" should be written as "Object"`),U.push(l)):H.push(l);if(H.length>0){let l=V.indexOf(`object`);l!==-1&&(V.slice(l,1),H.push(`Object`))}return V.length>0&&(B+=`${V.length>1?`one of type`:`of type`} ${formatList(V,`or`)}`,(H.length>0||U.length>0)&&(B+=` or `)),H.length>0&&(B+=`an instance of ${formatList(H,`or`)}`,U.length>0&&(B+=` or `)),U.length>0&&(U.length>1?B+=`one of ${formatList(U,`or`)}`:(U[0]?.toLowerCase()!==U[0]&&(B+=`an `),B+=`${U[0]}`)),B+=`. Received ${determineSpecificType(z)}`,B},TypeError);const ERR_INVALID_MODULE_SPECIFIER=createError(`ERR_INVALID_MODULE_SPECIFIER`,(l,R,z)=>`Invalid module "${l}" ${R}${z?` imported from ${z}`:``}`,TypeError),ERR_INVALID_PACKAGE_CONFIG=createError(`ERR_INVALID_PACKAGE_CONFIG`,(l,R,z)=>`Invalid package config ${l}${R?` while importing ${R}`:``}${z?`. ${z}`:``}`,Error),ERR_INVALID_PACKAGE_TARGET=createError(`ERR_INVALID_PACKAGE_TARGET`,(l,R,z,B=!1,V)=>{let H=typeof z==`string`&&!B&&z.length>0&&!z.startsWith(`./`);return R===`.`?(assert(B===!1),`Invalid "exports" main target ${JSON.stringify(z)} defined in the package config ${l}package.json${V?` imported from ${V}`:``}${H?`; targets must start with "./"`:``}`):`Invalid "${B?`imports`:`exports`}" target ${JSON.stringify(z)} defined for '${R}' in the package config ${l}package.json${V?` imported from ${V}`:``}${H?`; targets must start with "./"`:``}`},Error),ERR_MODULE_NOT_FOUND=createError(`ERR_MODULE_NOT_FOUND`,(l,R,z=!1)=>`Cannot find ${z?`module`:`package`} '${l}' imported from ${R}`,Error);createError(`ERR_NETWORK_IMPORT_DISALLOWED`,`import of '%s' by %s is not supported: %s`,Error);const ERR_PACKAGE_IMPORT_NOT_DEFINED=createError(`ERR_PACKAGE_IMPORT_NOT_DEFINED`,(l,R,z)=>`Package import specifier "${l}" is not defined${R?` in package ${R||``}package.json`:``} imported from ${z}`,TypeError),ERR_PACKAGE_PATH_NOT_EXPORTED=createError(`ERR_PACKAGE_PATH_NOT_EXPORTED`,(l,R,z)=>R===`.`?`No "exports" main defined in ${l}package.json${z?` imported from ${z}`:``}`:`Package subpath '${R}' is not defined by "exports" in ${l}package.json${z?` imported from ${z}`:``}`,Error),ERR_UNSUPPORTED_DIR_IMPORT=createError(`ERR_UNSUPPORTED_DIR_IMPORT`,`Directory import '%s' is not supported resolving ES modules imported from %s`,Error),ERR_UNSUPPORTED_RESOLVE_REQUEST=createError(`ERR_UNSUPPORTED_RESOLVE_REQUEST`,`Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.`,TypeError),ERR_UNKNOWN_FILE_EXTENSION=createError(`ERR_UNKNOWN_FILE_EXTENSION`,(l,R)=>`Unknown file extension "${l}" for ${R}`,TypeError);createError(`ERR_INVALID_ARG_VALUE`,(l,R,z=`is invalid`)=>{let B=inspect(R);return B.length>128&&(B=`${B.slice(0,128)}...`),`The ${l.includes(`.`)?`property`:`argument`} '${l}' ${z}. Received ${B}`},TypeError);const hasOwnProperty$1={}.hasOwnProperty,cache=new Map;function read(R,{base:z,specifier:B}){let V=cache.get(R);if(V)return V;let U;try{U=fs.readFileSync(path.toNamespacedPath(R),`utf8`)}catch(l){let R=l;if(R.code!==`ENOENT`)throw R}let G={exists:!1,pjsonPath:R,main:void 0,name:void 0,type:`none`,exports:void 0,imports:void 0};if(U!==void 0){let l;try{l=JSON.parse(U)}catch(l){let V=new ERR_INVALID_PACKAGE_CONFIG(R,(z?`"${B}" from `:``)+fileURLToPath(z||B),l.message);throw V.cause=l,V}G.exists=!0,hasOwnProperty$1.call(l,`name`)&&typeof l.name==`string`&&(G.name=l.name),hasOwnProperty$1.call(l,`main`)&&typeof l.main==`string`&&(G.main=l.main),hasOwnProperty$1.call(l,`exports`)&&(G.exports=l.exports),hasOwnProperty$1.call(l,`imports`)&&(G.imports=l.imports),hasOwnProperty$1.call(l,`type`)&&(l.type===`commonjs`||l.type===`module`)&&(G.type=l.type)}return cache.set(R,G),G}function getPackageScopeConfig(l){let R=new URL(`package.json`,l);for(;!R.pathname.endsWith(`node_modules/package.json`);){let z=read(fileURLToPath(R),{specifier:l});if(z.exists)return z;let B=R;if(R=new URL(`../package.json`,R),R.pathname===B.pathname)break}return{pjsonPath:fileURLToPath(R),exists:!1,type:`none`}}const hasOwnProperty={}.hasOwnProperty,extensionFormatMap={__proto__:null,".json":`json`,".cjs":`commonjs`,".cts":`commonjs`,".js":`module`,".ts":`module`,".mts":`module`,".mjs":`module`},protocolHandlers={__proto__:null,"data:":getDataProtocolModuleFormat,"file:":getFileProtocolModuleFormat,"node:":()=>`builtin`};function mimeToFormat(l){return l&&/\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i.test(l)?`module`:l===`application/json`?`json`:null}function getDataProtocolModuleFormat(l){let{1:R}=/^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(l.pathname)||[null,null,null];return mimeToFormat(R)}function extname(l){let R=l.pathname,z=R.length;for(;z--;){let l=R.codePointAt(z);if(l===47)return``;if(l===46)return R.codePointAt(z-1)===47?``:R.slice(z)}return``}function getFileProtocolModuleFormat(l,R,z){let B=extname(l);if(B===`.js`){let{type:R}=getPackageScopeConfig(l);return R===`none`?`commonjs`:R}if(B===``){let{type:R}=getPackageScopeConfig(l);return R===`none`||R===`commonjs`?`commonjs`:`module`}let V=extensionFormatMap[B];if(V)return V;if(!z)throw new ERR_UNKNOWN_FILE_EXTENSION(B,fileURLToPath(l))}function defaultGetFormatWithoutErrors(l,R){let z=l.protocol;return hasOwnProperty.call(protocolHandlers,z)&&protocolHandlers[z](l,R,!0)||null}const RegExpPrototypeSymbolReplace=RegExp.prototype[Symbol.replace],own={}.hasOwnProperty,invalidSegmentRegEx=/(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i,deprecatedInvalidSegmentRegEx=/(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i,invalidPackageNameRegEx=/^\.|%|\\/,patternRegEx=/\*/g,encodedSeparatorRegEx=/%2f|%5c/i,emittedPackageWarnings=new Set,doubleSlashRegEx=/[/\\]{2}/;function emitInvalidSegmentDeprecation(l,R,z,B,V,U,W){if(process$1.noDeprecation)return;let G=fileURLToPath(B),K=doubleSlashRegEx.exec(W?l:R)!==null;process$1.emitWarning(`Use of deprecated ${K?`double slash`:`leading or trailing slash matching`} resolving "${l}" for module request "${R}" ${R===z?``:`matched to "${z}" `}in the "${V?`imports`:`exports`}" field module resolution of the package at ${G}${U?` imported from ${fileURLToPath(U)}`:``}.`,`DeprecationWarning`,`DEP0166`)}function emitLegacyIndexDeprecation(l,R,z,B){if(process$1.noDeprecation||defaultGetFormatWithoutErrors(l,{parentURL:z.href})!==`module`)return;let U=fileURLToPath(l.href),G=fileURLToPath(new URL$1(`.`,R)),K=fileURLToPath(z);B?path.resolve(G,B)!==U&&process$1.emitWarning(`Package ${G} has a "main" field set to "${B}", excluding the full filename and extension to the resolved file at "${U.slice(G.length)}", imported from ${K}.
2
+ Automatic extension resolution of the "main" field is deprecated for ES modules.`,`DeprecationWarning`,`DEP0151`):process$1.emitWarning(`No "main" or "exports" field defined in the package.json for ${G} resolving the main entry point "${U.slice(G.length)}", imported from ${K}.
3
+ Default "index" lookups for the main are deprecated for ES modules.`,`DeprecationWarning`,`DEP0151`)}function tryStatSync(l){try{return statSync(l)}catch{}}function fileExists(l){let R=statSync(l,{throwIfNoEntry:!1});return(R?R.isFile():void 0)??!1}function legacyMainResolve(l,R,z){let B;if(R.main!==void 0){if(B=new URL$1(R.main,l),fileExists(B))return B;let H=[`./${R.main}.js`,`./${R.main}.json`,`./${R.main}.node`,`./${R.main}/index.js`,`./${R.main}/index.json`,`./${R.main}/index.node`],U=-1;for(;++U<H.length&&(B=new URL$1(H[U],l),!fileExists(B));)B=void 0;if(B)return emitLegacyIndexDeprecation(B,l,z,R.main),B}let U=[`./index.js`,`./index.json`,`./index.node`],W=-1;for(;++W<U.length&&(B=new URL$1(U[W],l),!fileExists(B));)B=void 0;if(B)return emitLegacyIndexDeprecation(B,l,z,R.main),B;throw new ERR_MODULE_NOT_FOUND(fileURLToPath(new URL$1(`.`,l)),fileURLToPath(z))}function finalizeResolution(l,R,B){if(encodedSeparatorRegEx.exec(l.pathname)!==null)throw new ERR_INVALID_MODULE_SPECIFIER(l.pathname,String.raw`must not include encoded "/" or "\" characters`,fileURLToPath(R));let V;try{V=fileURLToPath(l)}catch(z){throw Object.defineProperty(z,`input`,{value:String(l)}),Object.defineProperty(z,`module`,{value:String(R)}),z}let G=tryStatSync(V.endsWith(`/`)?V.slice(-1):V);if(G&&G.isDirectory()){let z=new ERR_UNSUPPORTED_DIR_IMPORT(V,fileURLToPath(R));throw z.url=String(l),z}if(!G||!G.isFile()){let z=new ERR_MODULE_NOT_FOUND(V||l.pathname,R&&fileURLToPath(R),!0);throw z.url=String(l),z}{let R=realpathSync(V),{search:B,hash:H}=l;l=pathToFileURL(R+(V.endsWith(path.sep)?`/`:``)),l.search=B,l.hash=H}return l}function importNotDefined(l,R,z){return new ERR_PACKAGE_IMPORT_NOT_DEFINED(l,R&&fileURLToPath(new URL$1(`.`,R)),fileURLToPath(z))}function exportsNotFound(l,R,z){return new ERR_PACKAGE_PATH_NOT_EXPORTED(fileURLToPath(new URL$1(`.`,R)),l,z&&fileURLToPath(z))}function throwInvalidSubpath(l,R,z,B,V){throw new ERR_INVALID_MODULE_SPECIFIER(l,`request is not a valid match in pattern "${R}" for the "${B?`imports`:`exports`}" resolution of ${fileURLToPath(z)}`,V&&fileURLToPath(V))}function invalidPackageTarget(l,R,z,B,U){return R=typeof R==`object`&&R?JSON.stringify(R,null,``):`${R}`,new ERR_INVALID_PACKAGE_TARGET(fileURLToPath(new URL$1(`.`,z)),l,R,B,U&&fileURLToPath(U))}function resolvePackageTargetString(l,R,z,B,H,U,W,G,K){if(R!==``&&!U&&l.at(-1)!==`/`)throw invalidPackageTarget(z,l,B,W,H);if(!l.startsWith(`./`)){if(W&&!l.startsWith(`../`)&&!l.startsWith(`/`)){let z=!1;try{new URL$1(l),z=!0}catch{}if(!z)return packageResolve(U?RegExpPrototypeSymbolReplace.call(patternRegEx,l,()=>R):l+R,B,K)}throw invalidPackageTarget(z,l,B,W,H)}if(invalidSegmentRegEx.exec(l.slice(2))!==null)if(deprecatedInvalidSegmentRegEx.exec(l.slice(2))===null){if(!G){let V=U?z.replace(`*`,()=>R):z+R;emitInvalidSegmentDeprecation(U?RegExpPrototypeSymbolReplace.call(patternRegEx,l,()=>R):l,V,z,B,W,H,!0)}}else throw invalidPackageTarget(z,l,B,W,H);let q=new URL$1(l,B),J=q.pathname,Y=new URL$1(`.`,B).pathname;if(!J.startsWith(Y))throw invalidPackageTarget(z,l,B,W,H);if(R===``)return q;if(invalidSegmentRegEx.exec(R)!==null){let V=U?z.replace(`*`,()=>R):z+R;deprecatedInvalidSegmentRegEx.exec(R)===null?G||emitInvalidSegmentDeprecation(U?RegExpPrototypeSymbolReplace.call(patternRegEx,l,()=>R):l,V,z,B,W,H,!1):throwInvalidSubpath(V,z,B,W,H)}return U?new URL$1(RegExpPrototypeSymbolReplace.call(patternRegEx,q.href,()=>R)):new URL$1(R,q)}function isArrayIndex(l){let R=Number(l);return`${R}`===l?R>=0&&R<4294967295:!1}function resolvePackageTarget(l,R,z,B,V,U,W,G,K){if(typeof R==`string`)return resolvePackageTargetString(R,z,B,l,V,U,W,G,K);if(Array.isArray(R)){let H=R;if(H.length===0)return null;let q,J=-1;for(;++J<H.length;){let R=H[J],Y;try{Y=resolvePackageTarget(l,R,z,B,V,U,W,G,K)}catch(l){let R=l;if(q=R,R.code===`ERR_INVALID_PACKAGE_TARGET`)continue;throw l}if(Y!==void 0){if(Y===null){q=null;continue}return Y}}if(q==null)return null;throw q}if(typeof R==`object`&&R){let q=Object.getOwnPropertyNames(R),J=-1;for(;++J<q.length;){let R=q[J];if(isArrayIndex(R))throw new ERR_INVALID_PACKAGE_CONFIG(fileURLToPath(l),fileURLToPath(V),`"exports" cannot contain numeric property keys.`)}for(J=-1;++J<q.length;){let H=q[J];if(H===`default`||K&&K.has(H)){let q=R[H],J=resolvePackageTarget(l,q,z,B,V,U,W,G,K);if(J===void 0)continue;return J}}return null}if(R===null)return null;throw invalidPackageTarget(B,R,l,W,V)}function isConditionalExportsMainSugar(l,R,z){if(typeof l==`string`||Array.isArray(l))return!0;if(typeof l!=`object`||!l)return!1;let B=Object.getOwnPropertyNames(l),V=!1,U=0,W=-1;for(;++W<B.length;){let l=B[W],G=l===``||l[0]!==`.`;if(U++===0)V=G;else if(V!==G)throw new ERR_INVALID_PACKAGE_CONFIG(fileURLToPath(R),fileURLToPath(z),`"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`)}return V}function emitTrailingSlashPatternDeprecation(l,R,z){if(process$1.noDeprecation)return;let B=fileURLToPath(R);emittedPackageWarnings.has(B+`|`+l)||(emittedPackageWarnings.add(B+`|`+l),process$1.emitWarning(`Use of deprecated trailing slash pattern mapping "${l}" in the "exports" field module resolution of the package at ${B}${z?` imported from ${fileURLToPath(z)}`:``}. Mapping specifiers ending in "/" is no longer supported.`,`DeprecationWarning`,`DEP0155`))}function packageExportsResolve(l,R,z,B,V){let H=z.exports;if(isConditionalExportsMainSugar(H,l,B)&&(H={".":H}),own.call(H,R)&&!R.includes(`*`)&&!R.endsWith(`/`)){let z=H[R],U=resolvePackageTarget(l,z,``,R,B,!1,!1,!1,V);if(U==null)throw exportsNotFound(R,l,B);return U}let U=``,W=``,G=Object.getOwnPropertyNames(H),K=-1;for(;++K<G.length;){let z=G[K],V=z.indexOf(`*`);if(V!==-1&&R.startsWith(z.slice(0,V))){R.endsWith(`/`)&&emitTrailingSlashPatternDeprecation(R,l,B);let H=z.slice(V+1);R.length>=z.length&&R.endsWith(H)&&patternKeyCompare(U,z)===1&&z.lastIndexOf(`*`)===V&&(U=z,W=R.slice(V,R.length-H.length))}}if(U){let z=H[U],G=resolvePackageTarget(l,z,W,U,B,!0,!1,R.endsWith(`/`),V);if(G==null)throw exportsNotFound(R,l,B);return G}throw exportsNotFound(R,l,B)}function patternKeyCompare(l,R){let z=l.indexOf(`*`),B=R.indexOf(`*`),V=z===-1?l.length:z+1,H=B===-1?R.length:B+1;return V>H?-1:H>V||z===-1?1:B===-1||l.length>R.length?-1:R.length>l.length?1:0}function packageImportsResolve(l,R,z){if(l===`#`||l.startsWith(`#/`)||l.endsWith(`/`))throw new ERR_INVALID_MODULE_SPECIFIER(l,`is not a valid internal imports specifier name`,fileURLToPath(R));let B,V=getPackageScopeConfig(R);if(V.exists){B=pathToFileURL(V.pjsonPath);let H=V.imports;if(H)if(own.call(H,l)&&!l.includes(`*`)){let V=resolvePackageTarget(B,H[l],``,l,R,!1,!0,!1,z);if(V!=null)return V}else{let V=``,U=``,W=Object.getOwnPropertyNames(H),G=-1;for(;++G<W.length;){let R=W[G],z=R.indexOf(`*`);if(z!==-1&&l.startsWith(R.slice(0,-1))){let B=R.slice(z+1);l.length>=R.length&&l.endsWith(B)&&patternKeyCompare(V,R)===1&&R.lastIndexOf(`*`)===z&&(V=R,U=l.slice(z,l.length-B.length))}}if(V){let l=H[V],W=resolvePackageTarget(B,l,U,V,R,!0,!0,!1,z);if(W!=null)return W}}}throw importNotDefined(l,B,R)}function parsePackageName(l,R){let z=l.indexOf(`/`),B=!0,V=!1;l[0]===`@`&&(V=!0,z===-1||l.length===0?B=!1:z=l.indexOf(`/`,z+1));let U=z===-1?l:l.slice(0,z);if(invalidPackageNameRegEx.exec(U)!==null&&(B=!1),!B)throw new ERR_INVALID_MODULE_SPECIFIER(l,`is not a valid package name`,fileURLToPath(R));return{packageName:U,packageSubpath:`.`+(z===-1?``:l.slice(z)),isScoped:V}}function packageResolve(l,R,z){if(nodeBuiltins.includes(l))return new URL$1(`node:`+l);let{packageName:B,packageSubpath:W,isScoped:G}=parsePackageName(l,R),K=getPackageScopeConfig(R);if(K.exists&&K.name===B&&K.exports!==void 0&&K.exports!==null)return packageExportsResolve(pathToFileURL(K.pjsonPath),W,K,R,z);let q=new URL$1(`./node_modules/`+B+`/package.json`,R),J=fileURLToPath(q),Y;do{let U=tryStatSync(J.slice(0,-13));if(!U||!U.isDirectory()){Y=J,q=new URL$1((G?`../../../../node_modules/`:`../../../node_modules/`)+B+`/package.json`,q),J=fileURLToPath(q);continue}let K=read(J,{base:R,specifier:l});return K.exports!==void 0&&K.exports!==null?packageExportsResolve(q,W,K,R,z):W===`.`?legacyMainResolve(q,K,R):new URL$1(W,q)}while(J.length!==Y.length);throw new ERR_MODULE_NOT_FOUND(B,fileURLToPath(R),!1)}function isRelativeSpecifier(l){return l[0]===`.`&&(l.length===1||l[1]===`/`||l[1]===`.`&&(l.length===2||l[2]===`/`))}function shouldBeTreatedAsRelativeOrAbsolutePath(l){return l===``?!1:l[0]===`/`?!0:isRelativeSpecifier(l)}function moduleResolve(l,R,z,B){let H=R.protocol,U=H===`data:`,W;if(shouldBeTreatedAsRelativeOrAbsolutePath(l))try{W=new URL$1(l,R)}catch(z){let B=new ERR_UNSUPPORTED_RESOLVE_REQUEST(l,R);throw B.cause=z,B}else if(H===`file:`&&l[0]===`#`)W=packageImportsResolve(l,R,z);else try{W=new URL$1(l)}catch(B){if(U&&!nodeBuiltins.includes(l)){let z=new ERR_UNSUPPORTED_RESOLVE_REQUEST(l,R);throw z.cause=B,z}W=packageResolve(l,R,z)}return assert(W!==void 0,`expected to be defined`),W.protocol===`file:`?finalizeResolution(W,R):W}const DEFAULT_CONDITIONS_SET=new Set([`node`,`import`]),isWindows=(()=>process.platform===`win32`)(),NOT_FOUND_ERRORS=new Set([`ERR_MODULE_NOT_FOUND`,`ERR_UNSUPPORTED_DIR_IMPORT`,`MODULE_NOT_FOUND`,`ERR_PACKAGE_PATH_NOT_EXPORTED`,`ERR_PACKAGE_IMPORT_NOT_DEFINED`]),globalCache=(()=>globalThis.__EXSOLVE_CACHE__||=new Map)();function resolveModuleURL(l,B){let V=_parseInput(l);if(`external`in V)return V.external;let H=V.specifier,W=V.url,G=V.absolutePath,K,q;if(B?.cache!==!1&&(K=_cacheKey(G||H,B),q=B?.cache&&typeof B?.cache==`object`?B.cache:globalCache),q){let l=q.get(K);if(typeof l==`string`)return l;if(l instanceof Error){if(B?.try)return;throw l}}if(G)try{let l=lstatSync(G);if(l.isSymbolicLink()&&(G=realpathSync(G),W=pathToFileURL(G)),l.isFile())return q&&q.set(K,W.href),W.href}catch(l){if(l?.code!==`ENOENT`)throw q&&q.set(K,l),l}let J=B?.conditions?new Set(B.conditions):DEFAULT_CONDITIONS_SET,Y=H||W.href,X=_normalizeBases(B?.from),Z=B?.suffixes||[``],Q=B?.extensions?[``,...B.extensions]:[``],$;for(let l of X){for(let R of Z){let z=_join(Y,R);z===`.`&&(z+=`/.`);for(let R of Q)if($=_tryModuleResolve(z+R,l,J),$)break;if($)break}if($)break}if(!$){let R=Error(`Cannot resolve module "${l}" (from: ${X.map(l=>_fmtPath(l)).join(`, `)})`);if(R.code=`ERR_MODULE_NOT_FOUND`,q&&q.set(K,R),B?.try)return;throw R}return q&&q.set(K,$.href),$.href}function resolveModulePath(l,R){let z=resolveModuleURL(l,R);if(!z||!z.startsWith(`file://`)&&R?.try)return;let B=fileURLToPath(z);return isWindows?_normalizeWinPath(B):B}function _tryModuleResolve(l,R,z){try{return moduleResolve(l,R,z)}catch(l){if(!NOT_FOUND_ERRORS.has(l?.code))throw l}}function _normalizeBases(l){let R=(Array.isArray(l)?l:[l]).flatMap(l=>_normalizeBase(l));return R.length===0?[pathToFileURL(`./`)]:R}function _normalizeBase(l){if(!l)return[];if(_isURL(l))return[l];if(typeof l!=`string`)return[];if(/^(?:node|data|http|https|file):/.test(l))return new URL(l);try{return l.endsWith(`/`)||statSync(l).isDirectory()?pathToFileURL(l+`/`):pathToFileURL(l)}catch{return[pathToFileURL(l+`/`),pathToFileURL(l)]}}function _fmtPath(l){try{return fileURLToPath(l)}catch{return l}}function _cacheKey(l,R){return JSON.stringify([l,(R?.conditions||[`node`,`import`]).sort(),R?.extensions,R?.from,R?.suffixes])}function _join(l,R){return!l||!R||R===`/`?l:(l.endsWith(`/`)?l:l+`/`)+(R.startsWith(`/`)?R.slice(1):R)}function _normalizeWinPath(l){return l.replace(/\\/g,`/`).replace(/^[a-z]:\//,l=>l.toUpperCase())}function _isURL(l){return l instanceof URL||l?.constructor?.name===`URL`}function _parseInput(l){if(typeof l==`string`){if(l.startsWith(`file:`)){let R=new URL(l);return{url:R,absolutePath:fileURLToPath(R)}}return isAbsolute(l)?{url:pathToFileURL(l),absolutePath:l}:/^(?:node|data|http|https):/.test(l)?{external:l}:nodeBuiltins.includes(l)&&!l.includes(`:`)?{external:`node:${l}`}:{specifier:l}}if(_isURL(l))return l.protocol===`file:`?{url:l,absolutePath:fileURLToPath(l)}:{external:l.href};throw TypeError("id must be a `string` or `URL`")}export{resolveModuleURL as n,resolveModulePath as t};
@@ -0,0 +1 @@
1
+ import{a as x,i as h}from"./confbox.mjs";import fs,{promises,realpathSync,statSync}from"node:fs";import{URL as URL$1,fileURLToPath,pathToFileURL}from"node:url";import path from"node:path";import assert from"node:assert";import process$1 from"node:process";import v8 from"node:v8";import{format,inspect}from"node:util";import"acorn";import{builtinModules}from"node:module";const _DRIVE_LETTER_START_RE=/^[A-Za-z]:\//;function normalizeWindowsPath(p=``){return p&&p.replace(/\\/g,`/`).replace(_DRIVE_LETTER_START_RE,p=>p.toUpperCase())}const _UNC_REGEX=/^[/\\]{2}/,_IS_ABSOLUTE_RE=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Za-z]:[/\\]/,_DRIVE_LETTER_RE=/^[A-Za-z]:$/,_ROOT_FOLDER_RE=/^\/([A-Za-z]:)?$/,_EXTNAME_RE=/.(\.[^./]+|\.)$/,normalize=function(p){if(p.length===0)return`.`;p=normalizeWindowsPath(p);let H=p.match(_UNC_REGEX),U=isAbsolute$1(p),W=p[p.length-1]===`/`;return p=normalizeString(p,!U),p.length===0?U?`/`:W?`./`:`.`:(W&&(p+=`/`),_DRIVE_LETTER_RE.test(p)&&(p+=`/`),H?U?`//${p}`:`//./${p}`:U&&!isAbsolute$1(p)?`/${p}`:p)},join=function(...p){let H=``;for(let U of p)if(U)if(H.length>0){let p=H[H.length-1]===`/`,W=U[0]===`/`;p&&W?H+=U.slice(1):H+=p||W?U:`/${U}`}else H+=U;return normalize(H)};function cwd(){return typeof process<`u`&&typeof process.cwd==`function`?process.cwd().replace(/\\/g,`/`):`/`}const resolve=function(...p){p=p.map(p=>normalizeWindowsPath(p));let H=``,U=!1;for(let W=p.length-1;W>=-1&&!U;W--){let G=W>=0?p[W]:cwd();!G||G.length===0||(H=`${G}/${H}`,U=isAbsolute$1(G))}return H=normalizeString(H,!U),U&&!isAbsolute$1(H)?`/${H}`:H.length>0?H:`.`};function normalizeString(p,H){let U=``,W=0,G=-1,K=0,q=null;for(let J=0;J<=p.length;++J){if(J<p.length)q=p[J];else if(q===`/`)break;else q=`/`;if(q===`/`){if(!(G===J-1||K===1))if(K===2){if(U.length<2||W!==2||U[U.length-1]!==`.`||U[U.length-2]!==`.`){if(U.length>2){let p=U.lastIndexOf(`/`);p===-1?(U=``,W=0):(U=U.slice(0,p),W=U.length-1-U.lastIndexOf(`/`)),G=J,K=0;continue}else if(U.length>0){U=``,W=0,G=J,K=0;continue}}H&&(U+=U.length>0?`/..`:`..`,W=2)}else U.length>0?U+=`/${p.slice(G+1,J)}`:U=p.slice(G+1,J),W=J-G-1;G=J,K=0}else q===`.`&&K!==-1?++K:K=-1}return U}const isAbsolute$1=function(p){return _IS_ABSOLUTE_RE.test(p)},extname=function(p){if(p===`..`)return``;let H=_EXTNAME_RE.exec(normalizeWindowsPath(p));return H&&H[1]||``},relative=function(p,H){let U=resolve(p).replace(_ROOT_FOLDER_RE,`$1`).split(`/`),W=resolve(H).replace(_ROOT_FOLDER_RE,`$1`).split(`/`);if(W[0][1]===`:`&&U[0][1]===`:`&&U[0]!==W[0])return W.join(`/`);let G=[...U];for(let p of G){if(W[0]!==p)break;U.shift(),W.shift()}return[...U.map(()=>`..`),...W].join(`/`)},dirname$1=function(p){let H=normalizeWindowsPath(p).replace(/\/$/,``).split(`/`).slice(0,-1);return H.length===1&&_DRIVE_LETTER_RE.test(H[0])&&(H[0]+=`/`),H.join(`/`)||(isAbsolute$1(p)?`/`:`.`)},basename=function(p,H){let U=normalizeWindowsPath(p).split(`/`),W=``;for(let p=U.length-1;p>=0;p--){let H=U[p];if(H){W=H;break}}return H&&W.endsWith(H)?W.slice(0,-H.length):W};String.fromCharCode;const TRAILING_SLASH_RE=/\/$|\/\?|\/#/,JOIN_LEADING_SLASH_RE=/^\.?\//;function hasTrailingSlash(p=``,H){return H?TRAILING_SLASH_RE.test(p):p.endsWith(`/`)}function withTrailingSlash(p=``,H){if(!H)return p.endsWith(`/`)?p:p+`/`;if(hasTrailingSlash(p,!0))return p||`/`;let U=p,W=``,G=p.indexOf(`#`);if(G!==-1&&(U=p.slice(0,G),W=p.slice(G),!U))return W;let[K,...q]=U.split(`?`);return K+`/`+(q.length>0?`?${q.join(`?`)}`:``)+W}function isNonEmptyURL(p){return p&&p!==`/`}function joinURL(p,...H){let U=p||``;for(let p of H.filter(p=>isNonEmptyURL(p)))if(U){let H=p.replace(JOIN_LEADING_SLASH_RE,``);U=withTrailingSlash(U)+H}else U=p;return U}const defaultFindOptions={startingFrom:`.`,rootPattern:/^node_modules$/,reverse:!1,test:p=>{try{if(statSync(p).isFile())return!0}catch{}}};async function findFile(p,H={}){let U=Array.isArray(p)?p:[p],W={...defaultFindOptions,...H},G=resolve(W.startingFrom),K=G[0]===`/`,q=G.split(`/`).filter(Boolean);K&&(q[0]=`/`+q[0]);let J=q.findIndex(p=>p.match(W.rootPattern));if(J===-1&&(J=0),W.reverse)for(let p=J+1;p<=q.length;p++)for(let H of U){let U=join(...q.slice(0,p),H);if(await W.test(U))return U}else for(let p=q.length;p>J;p--)for(let H of U){let U=join(...q.slice(0,p),H);if(await W.test(U))return U}throw Error(`Cannot find matching ${p} in ${W.startingFrom} or parent directories`)}function findNearestFile(p,H={}){return findFile(p,H)}const FileCache=new Map;async function readPackageJSON(U,G={}){let K=await resolvePackageJSON(U,G),q=G.cache&&typeof G.cache!=`boolean`?G.cache:FileCache;if(G.cache&&q.has(K))return q.get(K);let J=await promises.readFile(K,`utf8`),Y;try{Y=x(J)}catch{Y=h(J)}return q.set(K,Y),Y}async function resolvePackageJSON(p=process.cwd(),H={}){return findNearestFile(`package.json`,{startingFrom:isAbsolute$1(p)?p:await resolvePath(p,H),...H})}const BUILTIN_MODULES=new Set(builtinModules);function normalizeSlash(p){return p.replace(/\\/g,`/`)}const own$1={}.hasOwnProperty,classRegExp=/^([A-Z][a-z\d]*)+$/,kTypes=new Set([`string`,`function`,`number`,`object`,`Function`,`Object`,`boolean`,`bigint`,`symbol`]),codes={};function formatList(p,H=`and`){return p.length<3?p.join(` ${H} `):`${p.slice(0,-1).join(`, `)}, ${H} ${p[p.length-1]}`}const messages=new Map;let userStackTraceLimit;codes.ERR_INVALID_ARG_TYPE=createError(`ERR_INVALID_ARG_TYPE`,(p,H,U)=>{assert(typeof p==`string`,`'name' must be a string`),Array.isArray(H)||(H=[H]);let W=`The `;if(p.endsWith(` argument`))W+=`${p} `;else{let H=p.includes(`.`)?`property`:`argument`;W+=`"${p}" ${H} `}W+=`must be `;let G=[],K=[],q=[];for(let p of H)assert(typeof p==`string`,`All expected entries have to be of type string`),kTypes.has(p)?G.push(p.toLowerCase()):classRegExp.exec(p)===null?(assert(p!==`object`,`The value "object" should be written as "Object"`),q.push(p)):K.push(p);if(K.length>0){let p=G.indexOf(`object`);p!==-1&&(G.slice(p,1),K.push(`Object`))}return G.length>0&&(W+=`${G.length>1?`one of type`:`of type`} ${formatList(G,`or`)}`,(K.length>0||q.length>0)&&(W+=` or `)),K.length>0&&(W+=`an instance of ${formatList(K,`or`)}`,q.length>0&&(W+=` or `)),q.length>0&&(q.length>1?W+=`one of ${formatList(q,`or`)}`:(q[0].toLowerCase()!==q[0]&&(W+=`an `),W+=`${q[0]}`)),W+=`. Received ${determineSpecificType(U)}`,W},TypeError),codes.ERR_INVALID_MODULE_SPECIFIER=createError(`ERR_INVALID_MODULE_SPECIFIER`,(p,H,U=void 0)=>`Invalid module "${p}" ${H}${U?` imported from ${U}`:``}`,TypeError),codes.ERR_INVALID_PACKAGE_CONFIG=createError(`ERR_INVALID_PACKAGE_CONFIG`,(p,H,U)=>`Invalid package config ${p}${H?` while importing ${H}`:``}${U?`. ${U}`:``}`,Error),codes.ERR_INVALID_PACKAGE_TARGET=createError(`ERR_INVALID_PACKAGE_TARGET`,(p,H,U,W=!1,G=void 0)=>{let K=typeof U==`string`&&!W&&U.length>0&&!U.startsWith(`./`);return H===`.`?(assert(W===!1),`Invalid "exports" main target ${JSON.stringify(U)} defined in the package config ${p}package.json${G?` imported from ${G}`:``}${K?`; targets must start with "./"`:``}`):`Invalid "${W?`imports`:`exports`}" target ${JSON.stringify(U)} defined for '${H}' in the package config ${p}package.json${G?` imported from ${G}`:``}${K?`; targets must start with "./"`:``}`},Error),codes.ERR_MODULE_NOT_FOUND=createError(`ERR_MODULE_NOT_FOUND`,(p,H,U=!1)=>`Cannot find ${U?`module`:`package`} '${p}' imported from ${H}`,Error),codes.ERR_NETWORK_IMPORT_DISALLOWED=createError(`ERR_NETWORK_IMPORT_DISALLOWED`,`import of '%s' by %s is not supported: %s`,Error),codes.ERR_PACKAGE_IMPORT_NOT_DEFINED=createError(`ERR_PACKAGE_IMPORT_NOT_DEFINED`,(p,H,U)=>`Package import specifier "${p}" is not defined${H?` in package ${H}package.json`:``} imported from ${U}`,TypeError),codes.ERR_PACKAGE_PATH_NOT_EXPORTED=createError(`ERR_PACKAGE_PATH_NOT_EXPORTED`,(p,H,U=void 0)=>H===`.`?`No "exports" main defined in ${p}package.json${U?` imported from ${U}`:``}`:`Package subpath '${H}' is not defined by "exports" in ${p}package.json${U?` imported from ${U}`:``}`,Error),codes.ERR_UNSUPPORTED_DIR_IMPORT=createError(`ERR_UNSUPPORTED_DIR_IMPORT`,`Directory import '%s' is not supported resolving ES modules imported from %s`,Error),codes.ERR_UNSUPPORTED_RESOLVE_REQUEST=createError(`ERR_UNSUPPORTED_RESOLVE_REQUEST`,`Failed to resolve module specifier "%s" from "%s": Invalid relative URL or base scheme is not hierarchical.`,TypeError),codes.ERR_UNKNOWN_FILE_EXTENSION=createError(`ERR_UNKNOWN_FILE_EXTENSION`,(p,H)=>`Unknown file extension "${p}" for ${H}`,TypeError),codes.ERR_INVALID_ARG_VALUE=createError(`ERR_INVALID_ARG_VALUE`,(p,H,U=`is invalid`)=>{let W=inspect(H);return W.length>128&&(W=`${W.slice(0,128)}...`),`The ${p.includes(`.`)?`property`:`argument`} '${p}' ${U}. Received ${W}`},TypeError);function createError(p,H,U){return messages.set(p,H),makeNodeErrorWithCode(U,p)}function makeNodeErrorWithCode(p,H){return U;function U(...U){let W=Error.stackTraceLimit;isErrorStackTraceLimitWritable()&&(Error.stackTraceLimit=0);let G=new p;isErrorStackTraceLimitWritable()&&(Error.stackTraceLimit=W);let K=getMessage(H,U,G);return Object.defineProperties(G,{message:{value:K,enumerable:!1,writable:!0,configurable:!0},toString:{value(){return`${this.name} [${H}]: ${this.message}`},enumerable:!1,writable:!0,configurable:!0}}),captureLargerStackTrace(G),G.code=H,G}}function isErrorStackTraceLimitWritable(){try{if(v8.startupSnapshot.isBuildingSnapshot())return!1}catch{}let p=Object.getOwnPropertyDescriptor(Error,`stackTraceLimit`);return p===void 0?Object.isExtensible(Error):own$1.call(p,`writable`)&&p.writable!==void 0?p.writable:p.set!==void 0}function hideStackFrames(p){let H=`__node_internal_`+p.name;return Object.defineProperty(p,`name`,{value:H}),p}const captureLargerStackTrace=hideStackFrames(function(p){let H=isErrorStackTraceLimitWritable();return H&&(userStackTraceLimit=Error.stackTraceLimit,Error.stackTraceLimit=1/0),Error.captureStackTrace(p),H&&(Error.stackTraceLimit=userStackTraceLimit),p});function getMessage(p,H,U){let W=messages.get(p);if(assert(W!==void 0,"expected `message` to be found"),typeof W==`function`)return assert(W.length<=H.length,`Code: ${p}; The provided arguments length (${H.length}) does not match the required ones (${W.length}).`),Reflect.apply(W,U,H);let G=/%[dfijoOs]/g,K=0;for(;G.exec(W)!==null;)K++;return assert(K===H.length,`Code: ${p}; The provided arguments length (${H.length}) does not match the required ones (${K}).`),H.length===0?W:(H.unshift(W),Reflect.apply(format,null,H))}function determineSpecificType(p){if(p==null)return String(p);if(typeof p==`function`&&p.name)return`function ${p.name}`;if(typeof p==`object`)return p.constructor&&p.constructor.name?`an instance of ${p.constructor.name}`:`${inspect(p,{depth:-1})}`;let H=inspect(p,{colors:!1});return H.length>28&&(H=`${H.slice(0,25)}...`),`type ${typeof p} (${H})`}const hasOwnProperty$1={}.hasOwnProperty,{ERR_INVALID_PACKAGE_CONFIG:ERR_INVALID_PACKAGE_CONFIG$1}=codes,cache=new Map;function read(p,{base:H,specifier:W}){let G=cache.get(p);if(G)return G;let K;try{K=fs.readFileSync(path.toNamespacedPath(p),`utf8`)}catch(p){let H=p;if(H.code!==`ENOENT`)throw H}let q={exists:!1,pjsonPath:p,main:void 0,name:void 0,type:`none`,exports:void 0,imports:void 0};if(K!==void 0){let U;try{U=JSON.parse(K)}catch(U){let G=U,K=new ERR_INVALID_PACKAGE_CONFIG$1(p,(H?`"${W}" from `:``)+fileURLToPath(H||W),G.message);throw K.cause=G,K}q.exists=!0,hasOwnProperty$1.call(U,`name`)&&typeof U.name==`string`&&(q.name=U.name),hasOwnProperty$1.call(U,`main`)&&typeof U.main==`string`&&(q.main=U.main),hasOwnProperty$1.call(U,`exports`)&&(q.exports=U.exports),hasOwnProperty$1.call(U,`imports`)&&(q.imports=U.imports),hasOwnProperty$1.call(U,`type`)&&(U.type===`commonjs`||U.type===`module`)&&(q.type=U.type)}return cache.set(p,q),q}function getPackageScopeConfig(p){let H=new URL(`package.json`,p);for(;!H.pathname.endsWith(`node_modules/package.json`);){let U=read(fileURLToPath(H),{specifier:p});if(U.exists)return U;let W=H;if(H=new URL(`../package.json`,H),H.pathname===W.pathname)break}return{pjsonPath:fileURLToPath(H),exists:!1,type:`none`}}function getPackageType(p){return getPackageScopeConfig(p).type}const{ERR_UNKNOWN_FILE_EXTENSION}=codes,hasOwnProperty={}.hasOwnProperty,extensionFormatMap={__proto__:null,".cjs":`commonjs`,".js":`module`,".json":`json`,".mjs":`module`};function mimeToFormat(p){return p&&/\s*(text|application)\/javascript\s*(;\s*charset=utf-?8\s*)?/i.test(p)?`module`:p===`application/json`?`json`:null}const protocolHandlers={__proto__:null,"data:":getDataProtocolModuleFormat,"file:":getFileProtocolModuleFormat,"http:":getHttpProtocolModuleFormat,"https:":getHttpProtocolModuleFormat,"node:"(){return`builtin`}};function getDataProtocolModuleFormat(p){let{1:H}=/^([^/]+\/[^;,]+)[^,]*?(;base64)?,/.exec(p.pathname)||[null,null,null];return mimeToFormat(H)}function extname$1(p){let H=p.pathname,U=H.length;for(;U--;){let p=H.codePointAt(U);if(p===47)return``;if(p===46)return H.codePointAt(U-1)===47?``:H.slice(U)}return``}function getFileProtocolModuleFormat(p,H,U){let W=extname$1(p);if(W===`.js`){let H=getPackageType(p);return H===`none`?`commonjs`:H}if(W===``){let H=getPackageType(p);return H===`none`||H===`commonjs`?`commonjs`:`module`}let G=extensionFormatMap[W];if(G)return G;if(!U)throw new ERR_UNKNOWN_FILE_EXTENSION(W,fileURLToPath(p))}function getHttpProtocolModuleFormat(){}function defaultGetFormatWithoutErrors(p,H){let U=p.protocol;return hasOwnProperty.call(protocolHandlers,U)&&protocolHandlers[U](p,H,!0)||null}const RegExpPrototypeSymbolReplace=RegExp.prototype[Symbol.replace],{ERR_INVALID_MODULE_SPECIFIER,ERR_INVALID_PACKAGE_CONFIG,ERR_INVALID_PACKAGE_TARGET,ERR_MODULE_NOT_FOUND,ERR_PACKAGE_IMPORT_NOT_DEFINED,ERR_PACKAGE_PATH_NOT_EXPORTED,ERR_UNSUPPORTED_DIR_IMPORT,ERR_UNSUPPORTED_RESOLVE_REQUEST}=codes,own={}.hasOwnProperty,invalidSegmentRegEx=/(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))?(\\|\/|$)/i,deprecatedInvalidSegmentRegEx=/(^|\\|\/)((\.|%2e)(\.|%2e)?|(n|%6e|%4e)(o|%6f|%4f)(d|%64|%44)(e|%65|%45)(_|%5f)(m|%6d|%4d)(o|%6f|%4f)(d|%64|%44)(u|%75|%55)(l|%6c|%4c)(e|%65|%45)(s|%73|%53))(\\|\/|$)/i,invalidPackageNameRegEx=/^\.|%|\\/,patternRegEx=/\*/g,encodedSeparatorRegEx=/%2f|%5c/i,emittedPackageWarnings=new Set,doubleSlashRegEx=/[/\\]{2}/;function emitInvalidSegmentDeprecation(p,H,U,W,G,K,q){if(process$1.noDeprecation)return;let Y=fileURLToPath(W),X=doubleSlashRegEx.exec(q?p:H)!==null;process$1.emitWarning(`Use of deprecated ${X?`double slash`:`leading or trailing slash matching`} resolving "${p}" for module request "${H}" ${H===U?``:`matched to "${U}" `}in the "${G?`imports`:`exports`}" field module resolution of the package at ${Y}${K?` imported from ${fileURLToPath(K)}`:``}.`,`DeprecationWarning`,`DEP0166`)}function emitLegacyIndexDeprecation(p,H,U,W){if(process$1.noDeprecation||defaultGetFormatWithoutErrors(p,{parentURL:U.href})!==`module`)return;let G=fileURLToPath(p.href),K=fileURLToPath(new URL$1(`.`,H)),Y=fileURLToPath(U);W?path.resolve(K,W)!==G&&process$1.emitWarning(`Package ${K} has a "main" field set to "${W}", excluding the full filename and extension to the resolved file at "${G.slice(K.length)}", imported from ${Y}.\n Automatic extension resolution of the "main" field is deprecated for ES modules.`,`DeprecationWarning`,`DEP0151`):process$1.emitWarning(`No "main" or "exports" field defined in the package.json for ${K} resolving the main entry point "${G.slice(K.length)}", imported from ${Y}.\nDefault "index" lookups for the main are deprecated for ES modules.`,`DeprecationWarning`,`DEP0151`)}function tryStatSync(p){try{return statSync(p)}catch{}}function fileExists(p){let H=statSync(p,{throwIfNoEntry:!1});return(H?H.isFile():void 0)??!1}function legacyMainResolve(p,H,U){let W;if(H.main!==void 0){if(W=new URL$1(H.main,p),fileExists(W))return W;let G=[`./${H.main}.js`,`./${H.main}.json`,`./${H.main}.node`,`./${H.main}/index.js`,`./${H.main}/index.json`,`./${H.main}/index.node`],K=-1;for(;++K<G.length&&(W=new URL$1(G[K],p),!fileExists(W));)W=void 0;if(W)return emitLegacyIndexDeprecation(W,p,U,H.main),W}let G=[`./index.js`,`./index.json`,`./index.node`],K=-1;for(;++K<G.length&&(W=new URL$1(G[K],p),!fileExists(W));)W=void 0;if(W)return emitLegacyIndexDeprecation(W,p,U,H.main),W;throw new ERR_MODULE_NOT_FOUND(fileURLToPath(new URL$1(`.`,p)),fileURLToPath(U))}function finalizeResolution(p,H,U){if(encodedSeparatorRegEx.exec(p.pathname)!==null)throw new ERR_INVALID_MODULE_SPECIFIER(p.pathname,`must not include encoded "/" or "\\" characters`,fileURLToPath(H));let W;try{W=fileURLToPath(p)}catch(U){let W=U;throw Object.defineProperty(W,`input`,{value:String(p)}),Object.defineProperty(W,`module`,{value:String(H)}),W}let K=tryStatSync(W.endsWith(`/`)?W.slice(-1):W);if(K&&K.isDirectory()){let U=new ERR_UNSUPPORTED_DIR_IMPORT(W,fileURLToPath(H));throw U.url=String(p),U}if(!K||!K.isFile()){let U=new ERR_MODULE_NOT_FOUND(W||p.pathname,H&&fileURLToPath(H),!0);throw U.url=String(p),U}{let H=realpathSync(W),{search:U,hash:K}=p;p=pathToFileURL(H+(W.endsWith(path.sep)?`/`:``)),p.search=U,p.hash=K}return p}function importNotDefined(p,H,U){return new ERR_PACKAGE_IMPORT_NOT_DEFINED(p,H&&fileURLToPath(new URL$1(`.`,H)),fileURLToPath(U))}function exportsNotFound(p,H,U){return new ERR_PACKAGE_PATH_NOT_EXPORTED(fileURLToPath(new URL$1(`.`,H)),p,U&&fileURLToPath(U))}function throwInvalidSubpath(p,H,U,W,G){throw new ERR_INVALID_MODULE_SPECIFIER(p,`request is not a valid match in pattern "${H}" for the "${W?`imports`:`exports`}" resolution of ${fileURLToPath(U)}`,G&&fileURLToPath(G))}function invalidPackageTarget(p,H,U,W,G){return H=typeof H==`object`&&H?JSON.stringify(H,null,``):`${H}`,new ERR_INVALID_PACKAGE_TARGET(fileURLToPath(new URL$1(`.`,U)),p,H,W,G&&fileURLToPath(G))}function resolvePackageTargetString(p,H,U,W,G,K,J,Y,X){if(H!==``&&!K&&p[p.length-1]!==`/`)throw invalidPackageTarget(U,p,W,J,G);if(!p.startsWith(`./`)){if(J&&!p.startsWith(`../`)&&!p.startsWith(`/`)){let U=!1;try{new URL$1(p),U=!0}catch{}if(!U)return packageResolve(K?RegExpPrototypeSymbolReplace.call(patternRegEx,p,()=>H):p+H,W,X)}throw invalidPackageTarget(U,p,W,J,G)}if(invalidSegmentRegEx.exec(p.slice(2))!==null)if(deprecatedInvalidSegmentRegEx.exec(p.slice(2))===null){if(!Y){let q=K?U.replace(`*`,()=>H):U+H;emitInvalidSegmentDeprecation(K?RegExpPrototypeSymbolReplace.call(patternRegEx,p,()=>H):p,q,U,W,J,G,!0)}}else throw invalidPackageTarget(U,p,W,J,G);let Z=new URL$1(p,W),Q=Z.pathname,$=new URL$1(`.`,W).pathname;if(!Q.startsWith($))throw invalidPackageTarget(U,p,W,J,G);if(H===``)return Z;if(invalidSegmentRegEx.exec(H)!==null){let q=K?U.replace(`*`,()=>H):U+H;deprecatedInvalidSegmentRegEx.exec(H)===null?Y||emitInvalidSegmentDeprecation(K?RegExpPrototypeSymbolReplace.call(patternRegEx,p,()=>H):p,q,U,W,J,G,!1):throwInvalidSubpath(q,U,W,J,G)}return K?new URL$1(RegExpPrototypeSymbolReplace.call(patternRegEx,Z.href,()=>H)):new URL$1(H,Z)}function isArrayIndex(p){let H=Number(p);return`${H}`===p?H>=0&&H<4294967295:!1}function resolvePackageTarget(p,H,U,W,G,K,q,Y,X){if(typeof H==`string`)return resolvePackageTargetString(H,U,W,p,G,K,q,Y,X);if(Array.isArray(H)){let J=H;if(J.length===0)return null;let Z,Q=-1;for(;++Q<J.length;){let H=J[Q],$;try{$=resolvePackageTarget(p,H,U,W,G,K,q,Y,X)}catch(p){let H=p;if(Z=H,H.code===`ERR_INVALID_PACKAGE_TARGET`)continue;throw p}if($!==void 0){if($===null){Z=null;continue}return $}}if(Z==null)return null;throw Z}if(typeof H==`object`&&H){let Z=Object.getOwnPropertyNames(H),Q=-1;for(;++Q<Z.length;){let H=Z[Q];if(isArrayIndex(H))throw new ERR_INVALID_PACKAGE_CONFIG(fileURLToPath(p),G,`"exports" cannot contain numeric property keys.`)}for(Q=-1;++Q<Z.length;){let J=Z[Q];if(J===`default`||X&&X.has(J)){let Z=H[J],Q=resolvePackageTarget(p,Z,U,W,G,K,q,Y,X);if(Q===void 0)continue;return Q}}return null}if(H===null)return null;throw invalidPackageTarget(W,H,p,q,G)}function isConditionalExportsMainSugar(p,H,U){if(typeof p==`string`||Array.isArray(p))return!0;if(typeof p!=`object`||!p)return!1;let W=Object.getOwnPropertyNames(p),G=!1,K=0,q=-1;for(;++q<W.length;){let p=W[q],Y=p===``||p[0]!==`.`;if(K++===0)G=Y;else if(G!==Y)throw new ERR_INVALID_PACKAGE_CONFIG(fileURLToPath(H),U,`"exports" cannot contain some keys starting with '.' and some not. The exports object must either be an object of package subpath keys or an object of main entry condition name keys only.`)}return G}function emitTrailingSlashPatternDeprecation(p,H,U){if(process$1.noDeprecation)return;let W=fileURLToPath(H);emittedPackageWarnings.has(W+`|`+p)||(emittedPackageWarnings.add(W+`|`+p),process$1.emitWarning(`Use of deprecated trailing slash pattern mapping "${p}" in the "exports" field module resolution of the package at ${W}${U?` imported from ${fileURLToPath(U)}`:``}. Mapping specifiers ending in "/" is no longer supported.`,`DeprecationWarning`,`DEP0155`))}function packageExportsResolve(p,H,U,W,G){let K=U.exports;if(isConditionalExportsMainSugar(K,p,W)&&(K={".":K}),own.call(K,H)&&!H.includes(`*`)&&!H.endsWith(`/`)){let U=K[H],q=resolvePackageTarget(p,U,``,H,W,!1,!1,!1,G);if(q==null)throw exportsNotFound(H,p,W);return q}let q=``,J=``,Y=Object.getOwnPropertyNames(K),X=-1;for(;++X<Y.length;){let U=Y[X],G=U.indexOf(`*`);if(G!==-1&&H.startsWith(U.slice(0,G))){H.endsWith(`/`)&&emitTrailingSlashPatternDeprecation(H,p,W);let K=U.slice(G+1);H.length>=U.length&&H.endsWith(K)&&patternKeyCompare(q,U)===1&&U.lastIndexOf(`*`)===G&&(q=U,J=H.slice(G,H.length-K.length))}}if(q){let U=K[q],Y=resolvePackageTarget(p,U,J,q,W,!0,!1,H.endsWith(`/`),G);if(Y==null)throw exportsNotFound(H,p,W);return Y}throw exportsNotFound(H,p,W)}function patternKeyCompare(p,H){let U=p.indexOf(`*`),W=H.indexOf(`*`),G=U===-1?p.length:U+1,K=W===-1?H.length:W+1;return G>K?-1:K>G||U===-1?1:W===-1||p.length>H.length?-1:H.length>p.length?1:0}function packageImportsResolve(p,H,U){if(p===`#`||p.startsWith(`#/`)||p.endsWith(`/`))throw new ERR_INVALID_MODULE_SPECIFIER(p,`is not a valid internal imports specifier name`,fileURLToPath(H));let W,G=getPackageScopeConfig(H);if(G.exists){W=pathToFileURL(G.pjsonPath);let K=G.imports;if(K)if(own.call(K,p)&&!p.includes(`*`)){let G=resolvePackageTarget(W,K[p],``,p,H,!1,!0,!1,U);if(G!=null)return G}else{let G=``,q=``,J=Object.getOwnPropertyNames(K),Y=-1;for(;++Y<J.length;){let H=J[Y],U=H.indexOf(`*`);if(U!==-1&&p.startsWith(H.slice(0,-1))){let W=H.slice(U+1);p.length>=H.length&&p.endsWith(W)&&patternKeyCompare(G,H)===1&&H.lastIndexOf(`*`)===U&&(G=H,q=p.slice(U,p.length-W.length))}}if(G){let p=K[G],J=resolvePackageTarget(W,p,q,G,H,!0,!0,!1,U);if(J!=null)return J}}}throw importNotDefined(p,W,H)}function parsePackageName(p,H){let U=p.indexOf(`/`),W=!0,G=!1;p[0]===`@`&&(G=!0,U===-1||p.length===0?W=!1:U=p.indexOf(`/`,U+1));let K=U===-1?p:p.slice(0,U);if(invalidPackageNameRegEx.exec(K)!==null&&(W=!1),!W)throw new ERR_INVALID_MODULE_SPECIFIER(p,`is not a valid package name`,fileURLToPath(H));return{packageName:K,packageSubpath:`.`+(U===-1?``:p.slice(U)),isScoped:G}}function packageResolve(p,H,U){if(builtinModules.includes(p))return new URL$1(`node:`+p);let{packageName:W,packageSubpath:G,isScoped:K}=parsePackageName(p,H),X=getPackageScopeConfig(H);if(X.exists){let p=pathToFileURL(X.pjsonPath);if(X.name===W&&X.exports!==void 0&&X.exports!==null)return packageExportsResolve(p,G,X,H,U)}let Z=new URL$1(`./node_modules/`+W+`/package.json`,H),Q=fileURLToPath(Z),$;do{let Y=tryStatSync(Q.slice(0,-13));if(!Y||!Y.isDirectory()){$=Q,Z=new URL$1((K?`../../../../node_modules/`:`../../../node_modules/`)+W+`/package.json`,Z),Q=fileURLToPath(Z);continue}let X=read(Q,{base:H,specifier:p});return X.exports!==void 0&&X.exports!==null?packageExportsResolve(Z,G,X,H,U):G===`.`?legacyMainResolve(Z,X,H):new URL$1(G,Z)}while(Q.length!==$.length);throw new ERR_MODULE_NOT_FOUND(W,fileURLToPath(H),!1)}function isRelativeSpecifier(p){return p[0]===`.`&&(p.length===1||p[1]===`/`||p[1]===`.`&&(p.length===2||p[2]===`/`))}function shouldBeTreatedAsRelativeOrAbsolutePath(p){return p===``?!1:p[0]===`/`?!0:isRelativeSpecifier(p)}function moduleResolve(p,H,U,W){let G=H.protocol,K=G===`data:`||G===`http:`||G===`https:`,J;if(shouldBeTreatedAsRelativeOrAbsolutePath(p))try{J=new URL$1(p,H)}catch(U){let W=new ERR_UNSUPPORTED_RESOLVE_REQUEST(p,H);throw W.cause=U,W}else if(G===`file:`&&p[0]===`#`)J=packageImportsResolve(p,H,U);else try{J=new URL$1(p)}catch(W){if(K&&!builtinModules.includes(p)){let U=new ERR_UNSUPPORTED_RESOLVE_REQUEST(p,H);throw U.cause=W,U}J=packageResolve(p,H,U)}return assert(J!==void 0,`expected to be defined`),J.protocol===`file:`?finalizeResolution(J,H):J}function fileURLToPath$1(p){return typeof p==`string`&&!p.startsWith(`file://`)?normalizeSlash(p):normalizeSlash(fileURLToPath(p))}function pathToFileURL$1(p){return pathToFileURL(fileURLToPath$1(p)).toString()}function normalizeid(p){return typeof p!=`string`&&(p=p.toString()),/(?:node|data|http|https|file):/.test(p)?p:BUILTIN_MODULES.has(p)?`node:`+p:`file://`+encodeURI(normalizeSlash(p))}function isNodeBuiltin(p=``){return p=p.replace(/^node:/,``).split(`/`,1)[0],BUILTIN_MODULES.has(p)}const ProtocolRegex=/^(?<proto>.{2,}?):.+$/;function getProtocol(p){let H=p.match(ProtocolRegex);return H?H.groups?.proto:void 0}const DEFAULT_CONDITIONS_SET=new Set([`node`,`import`]),DEFAULT_EXTENSIONS=[`.mjs`,`.cjs`,`.js`,`.json`],NOT_FOUND_ERRORS=new Set([`ERR_MODULE_NOT_FOUND`,`ERR_UNSUPPORTED_DIR_IMPORT`,`MODULE_NOT_FOUND`,`ERR_PACKAGE_PATH_NOT_EXPORTED`]);function _tryModuleResolve(p,H,U){try{return moduleResolve(p,H,U)}catch(p){if(!NOT_FOUND_ERRORS.has(p?.code))throw p}}function _resolve(p,H={}){if(typeof p!=`string`)if(p instanceof URL)p=fileURLToPath$1(p);else throw TypeError("input must be a `string` or `URL`");if(/(?:node|data|http|https):/.test(p))return p;if(BUILTIN_MODULES.has(p))return`node:`+p;if(p.startsWith(`file://`)&&(p=fileURLToPath$1(p)),isAbsolute$1(p))try{if(statSync(p).isFile())return pathToFileURL$1(p)}catch(p){if(p?.code!==`ENOENT`)throw p}let U=H.conditions?new Set(H.conditions):DEFAULT_CONDITIONS_SET,W=(Array.isArray(H.url)?H.url:[H.url]).filter(Boolean).map(p=>new URL(normalizeid(p.toString())));W.length===0&&W.push(new URL(pathToFileURL$1(process.cwd())));let G=[...W];for(let p of W)p.protocol===`file:`&&G.push(new URL(`./`,p),new URL(joinURL(p.pathname,`_index.js`),p),new URL(`node_modules`,p));let q;for(let W of G){if(q=_tryModuleResolve(p,W,U),q)break;for(let G of[``,`/index`]){for(let K of H.extensions||DEFAULT_EXTENSIONS)if(q=_tryModuleResolve(joinURL(p,G)+K,W,U),q)break;if(q)break}if(q)break}if(!q){let H=Error(`Cannot find module ${p} imported from ${G.join(`, `)}`);throw H.code=`ERR_MODULE_NOT_FOUND`,H}return pathToFileURL$1(q)}function resolveSync(p,H){return _resolve(p,H)}function resolvePathSync(p,H){return fileURLToPath$1(resolveSync(p,H))}function resolvePath(p,H){try{return Promise.resolve(resolvePathSync(p,H))}catch(p){return Promise.reject(p)}}const NODE_MODULES_RE=/^(.+\/node_modules\/)([^/@]+|@[^/]+\/[^/]+)(\/?.*?)?$/;function parseNodeModulePath(p){if(!p)return{};p=normalize(fileURLToPath$1(p));let H=NODE_MODULES_RE.exec(p);if(!H)return{};let[,U,W,G]=H;return{dir:U,name:W,subpath:G?`.${G}`:void 0}}async function lookupNodeModuleSubpath(p){p=normalize(fileURLToPath$1(p));let{name:H,subpath:U}=parseNodeModulePath(p);if(!H||!U)return U;let{exports:W}=await readPackageJSON(p).catch(()=>{})||{};if(W){let p=_findSubpath(U,W);if(p)return p}return U}function _findSubpath(p,H){return typeof H==`string`&&(H={".":H}),p.startsWith(`.`)||(p=p.startsWith(`/`)?`.${p}`:`./${p}`),p in(H||{})?p:_flattenExports(H).find(H=>H.fsPath===p)?.subpath}function _flattenExports(p={},H=`./`){return Object.entries(p).flatMap(([p,U])=>{let[W,G]=p.startsWith(`.`)?[p.slice(1),void 0]:[``,p],K=joinURL(H,W);return typeof U==`string`?[{subpath:K,fsPath:U,condition:G}]:_flattenExports(U,K)})}const ESM_RE=/(?:[\s;]|^)(?:import[\s\w*,{}]*from|import\s*["'*{]|export\b\s*(?:[*{]|default|class|type|function|const|var|let|async function)|import\.meta\b)/m,COMMENT_RE=/\/\*.+?\*\/|\/\/.*(?=[nr])/g,BUILTIN_EXTENSIONS=new Set([`.mjs`,`.cjs`,`.node`,`.wasm`]);function hasESMSyntax(p,H={}){return H.stripComments&&(p=p.replace(COMMENT_RE,``)),ESM_RE.test(p)}const validNodeImportDefaults={allowedProtocols:[`node`,`file`,`data`]};async function isValidNodeImport(p,H={}){if(isNodeBuiltin(p))return!0;let U={...validNodeImportDefaults,...H},G=getProtocol(p);if(G&&!U.allowedProtocols?.includes(G))return!1;if(G===`data`)return!0;let K=await resolvePath(p,U),q=extname(K);return BUILTIN_EXTENSIONS.has(q)?!0:q===`.js`?(await readPackageJSON(K).catch(()=>{}))?.type===`module`?!0:/\.(?:\w+-)?esm?(?:-\w+)?\.js$|\/esm?\//.test(K)?!1:!hasESMSyntax(U.code||await promises.readFile(K,`utf8`).catch(()=>{})||``,{stripComments:U.stripComments}):!1}export{basename as a,join as c,resolve as d,parseNodeModulePath as i,normalize as l,lookupNodeModuleSubpath as n,dirname$1 as o,normalizeid as r,isAbsolute$1 as s,isValidNodeImport as t,relative as u};
@@ -0,0 +1 @@
1
+ import{t as resolveModulePath}from"./exsolve.mjs";import{c as join,d as resolve,l as normalize,s as isAbsolute}from"./mlly.mjs";import{n as x,r as z,t as h}from"./confbox.mjs";import{promises,statSync}from"node:fs";import{fileURLToPath}from"node:url";import"node:fs/promises";const defaultFindOptions={startingFrom:`.`,rootPattern:/^node_modules$/,reverse:!1,test:e=>{try{if(statSync(e).isFile())return!0}catch{}}};async function findFile(e,f={}){let p=Array.isArray(e)?e:[e],m={...defaultFindOptions,...f},g=resolve(m.startingFrom),_=g[0]===`/`,v=g.split(`/`).filter(Boolean);if(p.includes(v.at(-1))&&await m.test(g))return g;_&&(v[0]=`/`+v[0]);let y=v.findIndex(e=>e.match(m.rootPattern));if(y===-1&&(y=0),m.reverse)for(let e=y+1;e<=v.length;e++)for(let d of p){let f=join(...v.slice(0,e),d);if(await m.test(f))return f}else for(let e=v.length;e>y;e--)for(let d of p){let f=join(...v.slice(0,e),d);if(await m.test(f))return f}throw Error(`Cannot find matching ${e} in ${m.startingFrom} or parent directories`)}function findNearestFile(e,u={}){return findFile(e,u)}function _resolvePath(u,d={}){return u instanceof URL||u.startsWith(`file://`)?normalize(fileURLToPath(u)):isAbsolute(u)?normalize(u):resolveModulePath(u,{...d,from:d.from||d.parent||d.url})}const FileCache=new Map;async function readPackageJSON(e,u={}){let d=await resolvePackageJSON(e,u),f=u.cache&&typeof u.cache!=`boolean`?u.cache:FileCache;if(u.cache&&f.has(d))return f.get(d);let p=await promises.readFile(d,`utf8`),g;try{g=x(p)}catch{g=h(p)}return f.set(d,g),g}async function writePackageJSON(e,u){await promises.writeFile(e,z(u))}async function resolvePackageJSON(e=process.cwd(),u={}){return findNearestFile(`package.json`,{...u,startingFrom:_resolvePath(e,u)})}export{writePackageJSON as n,readPackageJSON as t};