@visulima/email
Version:
A comprehensive email library with multi-provider support, crypto utilities, and template engines
2 lines (1 loc) • 19.4 kB
JavaScript
var vr=Object.defineProperty;var $=(e,n)=>vr(e,"name",{value:n,configurable:!0});import{createRequire as $r}from"node:module";const wr=$r(import.meta.url),C=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,yr=$(e=>{if(typeof C<"u"&&C.versions&&C.versions.node){const[n,i]=C.versions.node.split(".").map(Number);if(n>22||n===22&&i>=3||n===20&&i>=16)return C.getBuiltinModule(e)}return wr(e)},"__cjs_getBuiltinModule"),{createRequire:ne}=yr("node:module"),jr=0,zr=4;var Or=Object.defineProperty,Pr=$((e,n)=>Or(e,"name",{value:n,configurable:!0}),"t$2"),Mr=Object.defineProperty,_r=Pr((e,n)=>Mr(e,"name",{value:n,configurable:!0}),"t"),Er=Object.defineProperty,kr=_r((e,n)=>Er(e,"name",{value:n,configurable:!0}),"n");const Be=kr(e=>{if(!e||!(e instanceof URL)&&typeof e!="string")throw new TypeError("Path must be a non-empty string or URL.")},"assertValidFileOrDirectoryPath");var Ar=Object.defineProperty,Rr=$((e,n)=>Ar(e,"name",{value:n,configurable:!0}),"$e"),Br=Object.defineProperty,oe=Rr((e,n)=>Br(e,"name",{value:n,configurable:!0}),"W"),Tr=Object.defineProperty,u=oe((e,n)=>Tr(e,"name",{value:n,configurable:!0}),"u$1");let _e=u(()=>{var e=(()=>{var n=Object.defineProperty,i=Object.getOwnPropertyDescriptor,c=Object.getOwnPropertyNames,d=Object.prototype.hasOwnProperty,b=u((t,r)=>{for(var o in r)n(t,o,{get:r[o],enumerable:!0})},"ne"),w=u((t,r,o,a)=>{if(r&&typeof r=="object"||typeof r=="function")for(let s of c(r))!d.call(t,s)&&s!==o&&n(t,s,{get:u(()=>r[s],"get"),enumerable:!(a=i(r,s))||a.enumerable});return t},"ae"),x=u(t=>w(n({},"__esModule",{value:!0}),t),"oe"),E={};b(E,{zeptomatch:u(()=>Me,"zeptomatch")});var T=u(t=>{const r=new Set,o=[t];for(let a=0;a<o.length;a++){const s=o[a];if(r.has(s))continue;r.add(s);const{children:l}=s;if(l?.length)for(let f=0,g=l.length;f<g;f++)o.push(l[f])}return Array.from(r)},"M"),D=u(t=>{let r="";const o=T(t);for(let a=0,s=o.length;a<s;a++){const l=o[a];if(!l.regex)continue;const f=l.regex.flags;if(r||(r=f),r!==f)throw new Error(`Inconsistent RegExp flags used: "${r}" and "${f}"`)}return r},"se"),ue=u((t,r,o)=>{const a=o.get(t);if(a!==void 0)return a;const s=t.partial??r;let l="";if(t.regex&&(l+=s?"(?:$|":"",l+=t.regex.source),t.children?.length){const f=Ye(t.children.map(g=>ue(g,r,o)).filter(Boolean));if(f?.length){const g=t.children.some(q=>!q.regex||!(q.partial??r)),h=f.length>1||s&&(!l.length||g);l+=h?s?"(?:$|":"(?:":"",l+=f.join("|"),l+=h?")":""}}return t.regex&&(l+=s?")":""),o.set(t,l),l},"O"),Ve=u((t,r)=>{const o=new Map,a=T(t);for(let s=a.length-1;s>=0;s--){const l=ue(a[s],r,o);if(!(s>0))return l}return""},"ie"),Ye=u(t=>Array.from(new Set(t)),"ue"),H=u((t,r,o)=>H.compile(t,o).test(r),"R");H.compile=(t,r)=>{const o=r?.partial??!1,a=Ve(t,o),s=D(t);return new RegExp(`^(?:${a})$`,s)};var He=H,Je=u((t,r)=>{const o=He.compile(t,r),a=`${o.source.slice(0,-1)}[\\\\/]?$`,s=o.flags;return new RegExp(a,s)},"le"),Ke=Je,Qe=u(t=>{const r=t.map(a=>a.source).join("|")||"$^",o=t[0]?.flags;return new RegExp(r,o)},"ve"),Xe=Qe,ce=u(t=>Array.isArray(t),"j"),S=u(t=>typeof t=="function","_"),et=u(t=>t.length===0,"he"),tt=(()=>{const{toString:t}=Function.prototype,r=/(?:^\(\s*(?:[^,.()]|\.(?!\.\.))*\s*\)\s*=>|^\s*[a-zA-Z$_][a-zA-Z0-9$_]*\s*=>)/;return o=>(o.length===0||o.length===1)&&r.test(t.call(o))})(),rt=u(t=>typeof t=="number","de"),nt=u(t=>typeof t=="object"&&t!==null,"xe"),ot=u(t=>t instanceof RegExp,"me"),st=(()=>{const t=/\\\(|\((?!\?(?::|=|!|<=|<!))/;return r=>t.test(r.source)})(),at=(()=>{const t=/^[a-zA-Z0-9_-]+$/;return r=>t.test(r.source)&&!r.flags.includes("i")})(),fe=u(t=>typeof t=="string","A"),P=u(t=>t===void 0,"f"),it=u(t=>{const r=new Map;return o=>{const a=r.get(o);if(a!==void 0)return a;const s=t(o);return r.set(o,s),s}},"ye"),pe=u((t,r,o={})=>{const a={cache:{},input:t,index:0,indexBacktrackMax:0,options:o,output:[]},s=M(r)(a),l=Math.max(a.index,a.indexBacktrackMax);if(s&&a.index===t.length)return a.output;throw new Error(`Failed to parse at index ${l}`)},"I"),p=u((t,r)=>ce(t)?lt(t,r):fe(t)?ge(t,r):ut(t,r),"i"),lt=u((t,r)=>{const o={};for(const a of t){if(a.length!==1)throw new Error(`Invalid character: "${a}"`);const s=a.charCodeAt(0);o[s]=!0}return a=>{const s=a.input;let l=a.index,f=l;for(;f<s.length&&s.charCodeAt(f)in o;)f+=1;if(f>l){if(!P(r)&&!a.options.silent){const g=s.slice(l,f),h=S(r)?r(g,s,`${l}`):r;P(h)||a.output.push(h)}a.index=f}return!0}},"we"),ut=u((t,r)=>{if(at(t))return ge(t.source,r);{const o=t.source,a=t.flags.replace(/y|$/,"y"),s=new RegExp(o,a);return st(t)&&S(r)&&!tt(r)?ct(s,r):ft(s,r)}},"$e"),ct=u((t,r)=>o=>{const a=o.index,s=o.input;t.lastIndex=a;const l=t.exec(s);if(l){const f=t.lastIndex;if(!o.options.silent){const g=r(...l,s,`${a}`);P(g)||o.output.push(g)}return o.index=f,!0}else return!1},"Ee"),ft=u((t,r)=>o=>{const a=o.index,s=o.input;if(t.lastIndex=a,t.test(s)){const l=t.lastIndex;if(!P(r)&&!o.options.silent){const f=S(r)?r(s.slice(a,l),s,`${a}`):r;P(f)||o.output.push(f)}return o.index=l,!0}else return!1},"Ce"),ge=u((t,r)=>o=>{const a=o.index,s=o.input;if(s.startsWith(t,a)){if(!P(r)&&!o.options.silent){const l=S(r)?r(t,s,`${a}`):r;P(l)||o.output.push(l)}return o.index+=t.length,!0}else return!1},"F"),J=u((t,r,o,a)=>{const s=M(t),l=r>1;return Q(K(me(f=>{let g=0;for(;g<o;){const h=f.index;if(!s(f)||(g+=1,f.index===h))break}return g>=r},l),a))},"k"),de=u((t,r)=>J(t,0,1,r),"L"),G=u((t,r)=>J(t,0,1/0,r),"$"),pt=u((t,r)=>J(t,1,1/0,r),"Re"),A=u((t,r)=>{const o=t.map(M);return Q(K(me(a=>{for(let s=0,l=o.length;s<l;s++)if(!o[s](a))return!1;return!0}),r))},"x"),y=u((t,r)=>{const o=t.map(M);return Q(K(a=>{for(let s=0,l=o.length;s<l;s++)if(o[s](a))return!0;return!1},r))},"p"),me=u((t,r=!0,o=!1)=>{const a=M(t);return r?s=>{const l=s.index,f=s.output.length,g=a(s);return!g&&!o&&(s.indexBacktrackMax=Math.max(s.indexBacktrackMax,s.index)),(!g||o)&&(s.index=l,s.output.length!==f&&(s.output.length=f)),g}:a},"q"),K=u((t,r)=>{const o=M(t);return r?a=>{if(a.options.silent)return o(a);const s=a.output.length;if(o(a)){const l=a.output.splice(s,1/0),f=r(l);return P(f)||a.output.push(f),!0}else return!1}:o},"B"),Q=(()=>{let t=0;return r=>{const o=M(r),a=t+=1;return s=>{var l;if(s.options.memoization===!1)return o(s);const f=s.index,g=(l=s.cache)[a]||(l[a]={indexMax:-1,queue:[]}),h=g.queue;if(f<=g.indexMax){const I=g.store||(g.store=new Map);if(h.length){for(let B=0,hr=h.length;B<hr;B+=2){const br=h[B*2],xr=h[B*2+1];I.set(br,xr)}h.length=0}const j=I.get(f);if(j===!1)return!1;if(rt(j))return s.index=j,!0;if(j)return s.index=j.index,j.output?.length&&s.output.push(...j.output),!0}const q=s.output.length,mr=o(s);if(g.indexMax=Math.max(g.indexMax,f),mr){const I=s.index,j=s.output.length;if(j>q){const B=s.output.slice(q,j);h.push(f,{index:I,output:B})}else h.push(f,I);return!0}else return h.push(f,!1),!1}}})(),he=u(t=>{let r;return o=>(r||(r=M(t())),r(o))},"G"),M=it(t=>{if(S(t))return et(t)?he(t):t;if(fe(t)||ot(t))return p(t);if(ce(t))return A(t);if(nt(t))return y(Object.values(t));throw new Error("Invalid rule")}),k=u(t=>t,"d"),gt=u(t=>typeof t=="string","ke"),dt=u(t=>{const r=new WeakMap,o=new WeakMap;return(a,s)=>{const l=s?.partial?o:r,f=l.get(a);if(f!==void 0)return f;const g=t(a,s);return l.set(a,g),g}},"Be"),mt=u(t=>{const r={},o={};return(a,s)=>{const l=s?.partial?o:r;return l[a]??(l[a]=t(a,s))}},"Pe"),ht=p(/\\./,k),bt=p(/./,k),xt=p(/\*\*\*+/,"*"),vt=p(/([^/{[(!])\*\*/,(t,r)=>`${r}*`),$t=p(/(^|.)\*\*(?=[^*/)\]}])/,(t,r)=>`${r}*`),wt=G(y([ht,xt,vt,$t,bt])),yt=wt,jt=u(t=>pe(t,yt,{memoization:!1}).join(""),"Ie"),zt=jt,be="abcdefghijklmnopqrstuvwxyz",Ot=u(t=>{let r="";for(;t>0;){const o=(t-1)%26;r=be[o]+r,t=Math.floor((t-1)/26)}return r},"Le"),xe=u(t=>{let r=0;for(let o=0,a=t.length;o<a;o++)r=r*26+be.indexOf(t[o])+1;return r},"V"),X=u((t,r)=>{if(r<t)return X(r,t);const o=[];for(;t<=r;)o.push(t++);return o},"b"),Pt=u((t,r,o)=>X(t,r).map(a=>String(a).padStart(o,"0")),"qe"),ve=u((t,r)=>X(xe(t),xe(r)).map(Ot),"W"),m=u(t=>({partial:!1,regex:new RegExp(t,"s"),children:[]}),"c"),W=u(t=>({children:t}),"y"),R=(()=>{const t=u((r,o,a)=>{if(a.has(r))return;a.add(r);const{children:s}=r;if(!s.length)s.push(o);else for(let l=0,f=s.length;l<f;l++)t(s[l],o,a)},"e");return r=>{if(!r.length)return W([]);for(let o=r.length-1;o>=1;o--){const a=new Set,s=r[o-1],l=r[o];t(s,l,a)}return r[0]}})(),_=u(()=>({regex:new RegExp("[\\\\/]","s"),children:[]}),"g"),Mt=p(/\\./,m),_t=p(/[$.*+?^(){}[\]\|]/,t=>m(`\\${t}`)),Et=p(/[\\\/]/,_),kt=p(/[^$.*+?^(){}[\]\|\\\/]+/,m),At=p(/^(?:!!)*!(.*)$/,(t,r)=>m(`(?!^${Me.compile(r).source}$).*?`)),Rt=p(/^(!!)+/),Bt=y([At,Rt]),Tt=p(/\/(\*\*\/)+/,()=>W([R([_(),m(".+?"),_()]),_()])),St=p(/^(\*\*\/)+/,()=>W([m("^"),R([m(".*?"),_()])])),Wt=p(/\/(\*\*)$/,()=>W([R([_(),m(".*?")]),m("$")])),qt=p(/\*\*/,()=>m(".*?")),$e=y([Tt,St,Wt,qt]),It=p(/\*\/(?!\*\*\/|\*$)/,()=>R([m("[^\\\\/]*?"),_()])),Ct=p(/\*/,()=>m("[^\\\\/]*")),we=y([It,Ct]),ye=p("?",()=>m("[^\\\\/]")),Lt=p("[",k),Ft=p("]",k),Zt=p(/[!^]/,"^\\\\/"),Nt=p(/[a-z]-[a-z]|[0-9]-[0-9]/i,k),Ut=p(/\\./,k),Dt=p(/[$.*+?^(){}[\|]/,t=>`\\${t}`),Gt=p(/[\\\/]/,"\\\\/"),Vt=p(/[^$.*+?^(){}[\]\|\\\/]+/,k),Yt=y([Ut,Dt,Gt,Nt,Vt]),je=A([Lt,de(Zt),G(Yt),Ft],t=>m(t.join(""))),Ht=p("{","(?:"),Jt=p("}",")"),Kt=p(/(\d+)\.\.(\d+)/,(t,r,o)=>Pt(+r,+o,Math.min(r.length,o.length)).join("|")),Qt=p(/([a-z]+)\.\.([a-z]+)/,(t,r,o)=>ve(r,o).join("|")),Xt=p(/([A-Z]+)\.\.([A-Z]+)/,(t,r,o)=>ve(r.toLowerCase(),o.toLowerCase()).join("|").toUpperCase()),er=y([Kt,Qt,Xt]),ze=A([Ht,er,Jt],t=>m(t.join(""))),tr=p("{"),rr=p("}"),nr=p(","),or=p(/\\./,m),sr=p(/[$.*+?^(){[\]\|]/,t=>m(`\\${t}`)),ar=p(/[\\\/]/,_),ir=p(/[^$.*+?^(){}[\]\|\\\/,]+/,m),lr=he(()=>Pe),ur=p("",()=>m("(?:)")),cr=pt(y([$e,we,ye,je,ze,lr,or,sr,ar,ir]),R),Oe=y([cr,ur]),Pe=A([tr,de(A([Oe,G(A([nr,Oe]))])),rr],W),fr=G(y([Bt,$e,we,ye,je,ze,Pe,Mt,_t,Et,kt]),R),pr=fr,gr=u(t=>pe(t,pr,{memoization:!1})[0],"kr"),dr=gr,ee=u((t,r,o)=>ee.compile(t,o).test(r),"N");ee.compile=(()=>{const t=mt((o,a)=>Ke(dr(zt(o)),a)),r=dt((o,a)=>Xe(o.map(s=>t(s,a))));return(o,a)=>gt(o)?t(o,a):r(o,a)})();var Me=ee;return x(E)})();return e.default||e},"_lazyMatch"),te;const Sr=u((e,n)=>(te||(te=_e(),_e=null),te(e,n)),"default");var Wr=Object.defineProperty,qr=oe((e,n)=>Wr(e,"name",{value:n,configurable:!0}),"t$1");const Ir=/^[A-Z]:\//i,z=qr((e="")=>e&&e.replaceAll("\\","/").replace(Ir,n=>n.toUpperCase()),"normalizeWindowsPath");var Cr=Object.defineProperty,v=oe((e,n)=>Cr(e,"name",{value:n,configurable:!0}),"r");const Lr=/^[/\\]{2}/,Fr=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,Te=/^[A-Z]:$/i,Ee=/^\/([A-Z]:)?$/i,Zr=/.(\.[^./]+)$/,Nr=/^[/\\]|^[a-z]:[/\\]/i,Ur=v(()=>typeof process.cwd=="function"?process.cwd().replaceAll("\\","/"):"/","cwd"),Se=v((e,n)=>{let i="",c=0,d=-1,b=0,w;for(let x=0;x<=e.length;++x){if(x<e.length)w=e[x];else{if(w==="/")break;w="/"}if(w==="/"){if(!(d===x-1||b===1))if(b===2){if(i.length<2||c!==2||!i.endsWith(".")||i.at(-2)!=="."){if(i.length>2){const E=i.lastIndexOf("/");E===-1?(i="",c=0):(i=i.slice(0,E),c=i.length-1-i.lastIndexOf("/")),d=x,b=0;continue}else if(i.length>0){i="",c=0,d=x,b=0;continue}}n&&(i+=i.length>0?"/..":"..",c=2)}else i.length>0?i+=`/${e.slice(d+1,x)}`:i=e.slice(d+1,x),c=x-d-1;d=x,b=0}else w==="."&&b!==-1?++b:b=-1}return i},"normalizeString"),N=v(e=>Fr.test(e),"isAbsolute"),We=v(function(e){if(e.length===0)return".";e=z(e);const n=Lr.exec(e),i=N(e),c=e.at(-1)==="/";return e=Se(e,!i),e.length===0?i?"/":c?"./":".":(c&&(e+="/"),Te.test(e)&&(e+="/"),n?i?`//${e}`:`//./${e}`:i&&!N(e)?`/${e}`:e)},"normalize"),qe=v((...e)=>{let n="";for(const i of e)if(i)if(n.length>0){const c=n[n.length-1]==="/",d=i[0]==="/";c&&d?n+=i.slice(1):n+=c||d?i:`/${i}`}else n+=i;return We(n)},"join"),re=v(function(...e){e=e.map(c=>z(c));let n="",i=!1;for(let c=e.length-1;c>=-1&&!i;c--){const d=c>=0?e[c]:Ur();!d||d.length===0||(n=`${d}/${n}`,i=N(d))}return n=Se(n,!i),i&&!N(n)?`/${n}`:n.length>0?n:"."},"resolve");v(function(e){return z(e)},"toNamespacedPath");const Ie=v(function(e){return Zr.exec(z(e))?.[1]??""},"extname");v(function(e,n){const i=re(e).replace(Ee,"$1").split("/"),c=re(n).replace(Ee,"$1").split("/");if(c[0][1]===":"&&i[0][1]===":"&&i[0]!==c[0])return c.join("/");const d=[...i];for(const b of d){if(c[0]!==b)break;i.shift(),c.shift()}return[...i.map(()=>".."),...c].join("/")},"relative");const Dr=v(e=>{const n=z(e).replace(/\/$/,"").split("/").slice(0,-1);return n.length===1&&Te.test(n[0])&&(n[0]+="/"),n.join("/")||(N(e)?"/":".")},"dirname");v(function(e){const n=[e.root,e.dir,e.base??e.name+e.ext].filter(Boolean);return z(e.root?re(...n):n.join("/"))},"format");const Gr=v((e,n)=>{const i=z(e).split("/").pop();return n&&i.endsWith(n)?i.slice(0,-n.length):i},"basename");v(function(e){const n=Nr.exec(e)?.[0]?.replaceAll("\\","/")??"",i=Gr(e),c=Ie(i);return{base:i,dir:Dr(e),ext:c,name:i.slice(0,i.length-c.length),root:n}},"parse");v((e,n)=>Sr(n,We(e)),"matchesGlob");var Vr=Object.defineProperty,se=$((e,n)=>Vr(e,"name",{value:n,configurable:!0}),"o$2"),Yr=Object.defineProperty,Y=se((e,n)=>Yr(e,"name",{value:n,configurable:!0}),"o");const Hr=ne(import.meta.url),L=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Jr=Y(e=>{if(typeof L<"u"&&L.versions&&L.versions.node){const[n,i]=L.versions.node.split(".").map(Number);if(n>22||n===22&&i>=3||n===20&&i>=16)return L.getBuiltinModule(e)}return Hr(e)},"__cjs_getBuiltinModule"),{fileURLToPath:Kr}=Jr("node:url");function ae(e){return e&&e.__esModule&&Object.prototype.hasOwnProperty.call(e,"default")?e.default:e}$(ae,"b$1");se(ae,"j");Y(ae,"getDefaultExportFromCjs");var ke,Ae;function ie(){return Ae||(Ae=1,ke=["3dm","3ds","3g2","3gp","7z","a","aac","adp","afdesign","afphoto","afpub","ai","aif","aiff","alz","ape","apk","appimage","ar","arj","asf","au","avi","bak","baml","bh","bin","bk","bmp","btif","bz2","bzip2","cab","caf","cgm","class","cmx","cpio","cr2","cr3","cur","dat","dcm","deb","dex","djvu","dll","dmg","dng","doc","docm","docx","dot","dotm","dra","DS_Store","dsk","dts","dtshd","dvb","dwg","dxf","ecelp4800","ecelp7470","ecelp9600","egg","eol","eot","epub","exe","f4v","fbs","fh","fla","flac","flatpak","fli","flv","fpx","fst","fvt","g3","gh","gif","graffle","gz","gzip","h261","h263","h264","icns","ico","ief","img","ipa","iso","jar","jpeg","jpg","jpgv","jpm","jxr","key","ktx","lha","lib","lvp","lz","lzh","lzma","lzo","m3u","m4a","m4v","mar","mdi","mht","mid","midi","mj2","mka","mkv","mmr","mng","mobi","mov","movie","mp3","mp4","mp4a","mpeg","mpg","mpga","mxu","nef","npx","numbers","nupkg","o","odp","ods","odt","oga","ogg","ogv","otf","ott","pages","pbm","pcx","pdb","pdf","pea","pgm","pic","png","pnm","pot","potm","potx","ppa","ppam","ppm","pps","ppsm","ppsx","ppt","pptm","pptx","psd","pya","pyc","pyo","pyv","qt","rar","ras","raw","resources","rgb","rip","rlc","rmf","rmvb","rpm","rtf","rz","s3m","s7z","scpt","sgi","shar","snap","sil","sketch","slk","smv","snk","so","stl","suo","sub","swf","tar","tbz","tbz2","tga","tgz","thmx","tif","tiff","tlz","ttc","ttf","txz","udf","uvh","uvi","uvm","uvp","uvs","uvu","viv","vob","war","wav","wax","wbmp","wdp","weba","webm","webp","whl","wim","wm","wma","wmv","wmx","woff","woff2","wrm","wvx","xbm","xif","xla","xlam","xls","xlsb","xlsm","xlsx","xlt","xltm","xltx","xm","xmind","xpi","xpm","xwd","xz","z","zip","zipx"]),ke}$(ie,"v$1");se(ie,"z");Y(ie,"requireBinaryExtensions");var Qr=ie();const Xr=ae(Qr);var en=Object.defineProperty,O=Y((e,n)=>en(e,"name",{value:n,configurable:!0}),"r");const tn=new Set(Xr),rn=new Set(["/","\\",void 0]),Re=Symbol.for("pathe:normalizedAlias"),nn=/(^|[/\\])([^/\\]+?)(?=(?:\.[^.]+)?$)/,on=O((e,n)=>n.split("/").length-e.split("/").length,"compareAliases"),V=O((e="/")=>{const n=e.at(-1);return n==="/"||n==="\\"},"hasTrailingSlash"),Ce=O(e=>{if(e[Re])return e;const n=Object.fromEntries(Object.entries(e).toSorted(([i],[c])=>on(i,c)));for(const i in n)for(const c in n)c===i||i.startsWith(c)||n[i].startsWith(c)&&rn.has(n[i][c.length])&&(n[i]=n[c]+n[i].slice(c.length));return Object.defineProperty(n,Re,{enumerable:!1,value:!0}),n},"normalizeAliases");O((e,n)=>{e=z(e),n=Ce(n);for(const[i,c]of Object.entries(n)){if(!e.startsWith(i))continue;const d=V(i)?i.slice(0,-1):i;if(V(e[d.length]))return qe(c,e.slice(i.length))}return e},"resolveAlias");O(e=>nn.exec(e)?.[2],"filename");O((e,n)=>{e=z(e),n=Ce(n);for(const[i,c]of Object.entries(n).toReversed()){if(!e.startsWith(c))continue;const d=V(c)?c.slice(0,-1):c;if(V(e[d.length]))return qe(i,e.slice(c.length))}return e},"reverseResolveAlias");O(e=>/^(?:\.?\.[/\\]|\.\.\B)/.test(e)||e==="..","isRelative");O(e=>tn.has(Ie(e).slice(1).toLowerCase()),"isBinaryPath");const Le=O(e=>z(e instanceof URL?Kr(e):e),"toPath");O(()=>{if(!globalThis?.process)return!1;if(globalThis?.process?.platform==="win32"||globalThis?.process?.platform==="cygwin")return!0;const e=globalThis?.process?.env.OSTYPE;return typeof e!="string"?!1:/^(?:msys|cygwin)$/.test(e)},"isWindows");var sn=Object.defineProperty,Fe=$((e,n)=>sn(e,"name",{value:n,configurable:!0}),"t$1"),an=Object.defineProperty,le=Fe((e,n)=>an(e,"name",{value:n,configurable:!0}),"s");const ln=ne(import.meta.url),F=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,un=le(e=>{if(typeof F<"u"&&F.versions&&F.versions.node){const[n,i]=F.versions.node.split(".").map(Number);if(n>22||n===22&&i>=3||n===20&&i>=16)return F.getBuiltinModule(e)}return ln(e)},"__cjs_getBuiltinModule"),{access:cn}=un("node:fs/promises");var fn=Object.defineProperty,pn=le((e,n)=>fn(e,"name",{value:n,configurable:!0}),"o");async function U(e,n=jr){Be(e),e=Le(e);try{return await cn(e,n),!0}catch{return!1}}$(U,"i$1");Fe(U,"d");le(U,"m");pn(U,"isAccessible");var gn=Object.defineProperty,Ze=$((e,n)=>gn(e,"name",{value:n,configurable:!0}),"t"),dn=Object.defineProperty,Ne=Ze((e,n)=>dn(e,"name",{value:n,configurable:!0}),"t"),mn=Object.defineProperty,hn=Ne((e,n)=>mn(e,"name",{value:n,configurable:!0}),"o");let bn=class extends Error{static{$(this,"c")}static{Ze(this,"i")}static{Ne(this,"n")}static{hn(this,"PermissionError")}constructor(n){super(`EPERM: Operation not permitted, ${n}`)}get code(){return"EPERM"}set code(n){throw new Error("Cannot overwrite code EPERM")}get name(){return"PermissionError"}set name(n){throw new Error("Cannot overwrite name of PermissionError")}};var xn=Object.defineProperty,vn=$((e,n)=>xn(e,"name",{value:n,configurable:!0}),"f"),$n=Object.defineProperty,Ue=vn((e,n)=>$n(e,"name",{value:n,configurable:!0}),"i");const wn=ne(import.meta.url),Z=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,De=Ue(e=>{if(typeof Z<"u"&&Z.versions&&Z.versions.node){const[n,i]=Z.versions.node.split(".").map(Number);if(n>22||n===22&&i>=3||n===20&&i>=16)return Z.getBuiltinModule(e)}return wn(e)},"__cjs_getBuiltinModule"),{readFile:yn}=De("node:fs/promises"),{unzip:jn,brotliDecompress:zn}=De("node:zlib");var On=Object.defineProperty,Ge=Ue((e,n)=>On(e,"name",{value:n,configurable:!0}),"n");const Pn={brotli:zn,gzip:jn,none:Ge((e,n)=>{n(null,e)},"none")},kn=Ge(async(e,n)=>{if(Be(e),e=Le(e),!await U(e))throw new bn(`unable to read the non-accessible file: ${e}`);if(!await U(e,zr))throw new Error(`Unable to read the non-readable file: ${e}`);const{buffer:i,compression:c,encoding:d,flag:b}=n??{};return await yn(e,b?{encoding:d,flag:b}:{encoding:d}).then(async w=>await new Promise((x,E)=>{Pn[c??"none"](w,(T,D)=>{T?E(T):x(i?D:D.toString())})})).catch(w=>{throw w})},"readFile");export{kn as B};