@visulima/email 4.0.0 → 4.2.0
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.
- package/CHANGELOG.md +15 -0
- package/README.md +74 -1
- package/dist/crypto/index.d.ts +2 -2
- package/dist/deliverability/dmarc-report.js +1 -1
- package/dist/deliverability/index.d.ts +1 -1
- package/dist/inbound/index.d.ts +1 -1
- package/dist/index.d.ts +11 -5
- package/dist/index.js +1 -1
- package/dist/middleware/index.d.ts +3 -3
- package/dist/middleware/index.js +1 -1
- package/dist/packem_chunks/index.js +5 -5
- package/dist/packem_shared/{DraftMailMessage-B0gwf8n_.js → DraftMailMessage-zkKTOxQ8.js} +1 -1
- package/dist/packem_shared/EmailError-SXEFQEyA.js +1 -0
- package/dist/packem_shared/Mail-DtpXUSIl.js +1 -0
- package/dist/packem_shared/MailMessage-Aw0vVAh-.js +1 -0
- package/dist/packem_shared/{RequiredOptionError-ctDEEB1s.js → RequiredOptionError-C2wWqmiE.js} +1 -1
- package/dist/packem_shared/{ahaSendProvider-D95-pwFh.js → ahaSendProvider-Ci_a_O8d.js} +1 -1
- package/dist/packem_shared/{attachment-processor-BJFDS343.js → attachment-processor-AB1m-n9T.js} +1 -1
- package/dist/packem_shared/{autoSendProvider-yxUx3sEj.js → autoSendProvider-DG3pNJML.js} +1 -1
- package/dist/packem_shared/{awsSesProvider-DnZo9X_g.js → awsSesProvider-C4b5kuL4.js} +1 -1
- package/dist/packem_shared/{azureProvider-D6Z4c1yT.js → azureProvider-CEnz3uy_.js} +1 -1
- package/dist/packem_shared/{brevoProvider-D1yTSs0l.js → brevoProvider-BsbInXjw.js} +1 -1
- package/dist/packem_shared/{build-mime-message-BCFKPqaW.js → build-mime-message-D45WdgfP.js} +1 -1
- package/dist/packem_shared/{circuitBreakerMiddleware-DcBN7K6H.js → circuitBreakerMiddleware-Cm0m75qi.js} +1 -1
- package/dist/packem_shared/{cloudflareEmailProvider-DZbs35NL.js → cloudflareEmailProvider-CnpH5R5p.js} +1 -1
- package/dist/packem_shared/{createTestEmail-gr512snl.js → createTestEmail-B2Fz-Ifb.js} +1 -1
- package/dist/packem_shared/createWorker-ChrQvLUF.js +1 -0
- package/dist/packem_shared/extractLinks-BwE1SjNF.js +1 -0
- package/dist/packem_shared/{failoverProvider-IED1M0M5.js → failoverProvider-DsBqMOfK.js} +1 -1
- package/dist/packem_shared/fileProvider-BnDeaSqA.js +1 -0
- package/dist/packem_shared/{httpProvider-CpdWJoRq.js → httpProvider-BuA00407.js} +1 -1
- package/dist/packem_shared/{infobipProvider-DTqFu5pM.js → infobipProvider-DVUg9jKC.js} +1 -1
- package/dist/packem_shared/{isValidSigningCertUrl-CK1t2a7x.js → isValidSigningCertUrl-gnYr3oyD.js} +1 -1
- package/dist/packem_shared/{loopsProvider-PiE2HxoW.js → loopsProvider-BJUNQ2rR.js} +1 -1
- package/dist/packem_shared/{mail.d-BdyyyQO5.d.ts → mail.d-2u-30lWz.d.ts} +12 -4
- package/dist/packem_shared/{mailCrabProvider-BSapw_mS.js → mailCrabProvider-CFKRofS5.js} +1 -1
- package/dist/packem_shared/{mailPaceProvider-BugIutTw.js → mailPaceProvider-DBQd6NYt.js} +1 -1
- package/dist/packem_shared/{mailchannelsProvider-Dn24mI8D.js → mailchannelsProvider-CPVW3wlH.js} +1 -1
- package/dist/packem_shared/{mailerSendProvider-B6X4Lhsf.js → mailerSendProvider-B2H6BtoV.js} +1 -1
- package/dist/packem_shared/{mailgunProvider-4sMtcQcW.js → mailgunProvider-JRVH70PB.js} +1 -1
- package/dist/packem_shared/{mailjetProvider-DvrHwipw.js → mailjetProvider-BzBovF5M.js} +1 -1
- package/dist/packem_shared/{mailomatProvider-CrkNQGfL.js → mailomatProvider-x6IHKuWU.js} +1 -1
- package/dist/packem_shared/{mailtrapProvider-DTgvCUrs.js → mailtrapProvider-CJTJoDcV.js} +1 -1
- package/dist/packem_shared/make-request-mszP240P.js +1 -0
- package/dist/packem_shared/{mandrillProvider-BaK0GEj7.js → mandrillProvider-BcztgKkr.js} +1 -1
- package/dist/packem_shared/{mockProvider-CTxxbT0d.js → mockProvider-DVtl5Jjy.js} +1 -1
- package/dist/packem_shared/{netcoreProvider-BZJ0noQ2.js → netcoreProvider-YWEpa-wi.js} +1 -1
- package/dist/packem_shared/{nodemailerProvider-DqJh8ghN.js → nodemailerProvider-WNNtLE2s.js} +1 -1
- package/dist/packem_shared/{opentelemetryProvider-s0gvh05u.js → opentelemetryProvider-ddbILMeS.js} +1 -1
- package/dist/packem_shared/{outlook365Provider-DQUSFy2d.js → outlook365Provider-D5eETMZq.js} +1 -1
- package/dist/packem_shared/{plunkProvider-WMi1yPya.js → plunkProvider-TrBBoX7_.js} +1 -1
- package/dist/packem_shared/{postalProvider-DpBFGpoX.js → postalProvider-CU53hX0R.js} +1 -1
- package/dist/packem_shared/{postmarkProvider-ClUaHPvw.js → postmarkProvider-DEYQp8Gv.js} +1 -1
- package/dist/packem_shared/{provider-base-BEz00m9R.js → provider-base-G22b4a87.js} +1 -1
- package/dist/packem_shared/{provider.d-Cx5YQJdP.d.ts → provider.d-BLLbEuQ8.d.ts} +1 -1
- package/dist/packem_shared/resendProvider-BaIZCvph.js +1 -0
- package/dist/packem_shared/{retry-aghj7y8m.js → retry-ByPJFAtq.js} +1 -1
- package/dist/packem_shared/{roundRobinProvider-Dr1DdT2L.js → roundRobinProvider-CfuNY7We.js} +1 -1
- package/dist/packem_shared/{scalewayProvider-BhbDUEah.js → scalewayProvider-x6S2ZSPd.js} +1 -1
- package/dist/packem_shared/{sendGridProvider-DBZHhxd6.js → sendGridProvider-8Po3P-ia.js} +1 -1
- package/dist/packem_shared/{smtpProvider-CjcOEiAh.js → smtpProvider-BPamDNuv.js} +1 -1
- package/dist/packem_shared/{sparkpostProvider-B19lU9D5.js → sparkpostProvider-BVu1KeNz.js} +1 -1
- package/dist/packem_shared/{sweegoProvider-H8KWGDff.js → sweegoProvider-DHISjS9s.js} +1 -1
- package/dist/packem_shared/{types.d-Cb5fls_X.d.ts → types.d-A1Eea-p_.d.ts} +1 -1
- package/dist/packem_shared/{types.d-kHO4kX9q.d.ts → types.d-B5iH_mgb.d.ts} +1 -1
- package/dist/packem_shared/{types.d-GKqPNk0I.d.ts → types.d-Chhzb-48.d.ts} +1 -1
- package/dist/packem_shared/{types.d-B9295M4_.d.ts → types.d-CyiC9uRC.d.ts} +10 -0
- package/dist/packem_shared/{types.d-C5geVKes.d.ts → types.d-V_yuAOrx.d.ts} +1 -1
- package/dist/packem_shared/{verifySendGridWebhook-csuRasH3.js → verifySendGridWebhook-0_3qKQA1.js} +1 -1
- package/dist/packem_shared/{withSuppression-B0eZ2xNQ.js → withSuppression-COCHL9Zx.js} +1 -1
- package/dist/packem_shared/{zeptomailProvider-L7nkdn0L.js → zeptomailProvider-IhCIl_2a.js} +1 -1
- package/dist/providers/ahasend/index.d.ts +3 -3
- package/dist/providers/ahasend/index.js +1 -1
- package/dist/providers/autosend/index.d.ts +3 -3
- package/dist/providers/autosend/index.js +1 -1
- package/dist/providers/aws-ses/index.d.ts +3 -3
- package/dist/providers/aws-ses/index.js +1 -1
- package/dist/providers/azure/index.d.ts +3 -3
- package/dist/providers/azure/index.js +1 -1
- package/dist/providers/brevo/index.d.ts +3 -3
- package/dist/providers/brevo/index.js +1 -1
- package/dist/providers/cloudflare-email/index.d.ts +4 -4
- package/dist/providers/cloudflare-email/index.js +1 -1
- package/dist/providers/failover/index.d.ts +3 -3
- package/dist/providers/failover/index.js +1 -1
- package/dist/providers/file/index.d.ts +23 -0
- package/dist/providers/file/index.js +1 -0
- package/dist/providers/http/index.d.ts +3 -3
- package/dist/providers/http/index.js +1 -1
- package/dist/providers/infobip/index.d.ts +3 -3
- package/dist/providers/infobip/index.js +1 -1
- package/dist/providers/loops/index.d.ts +3 -3
- package/dist/providers/loops/index.js +1 -1
- package/dist/providers/mailchannels/index.d.ts +3 -3
- package/dist/providers/mailchannels/index.js +1 -1
- package/dist/providers/mailcrab/index.d.ts +3 -3
- package/dist/providers/mailcrab/index.js +1 -1
- package/dist/providers/mailersend/index.d.ts +3 -3
- package/dist/providers/mailersend/index.js +1 -1
- package/dist/providers/mailgun/index.d.ts +3 -3
- package/dist/providers/mailgun/index.js +1 -1
- package/dist/providers/mailjet/index.d.ts +3 -3
- package/dist/providers/mailjet/index.js +1 -1
- package/dist/providers/mailomat/index.d.ts +3 -3
- package/dist/providers/mailomat/index.js +1 -1
- package/dist/providers/mailpace/index.d.ts +3 -3
- package/dist/providers/mailpace/index.js +1 -1
- package/dist/providers/mailtrap/index.d.ts +3 -3
- package/dist/providers/mailtrap/index.js +1 -1
- package/dist/providers/mandrill/index.d.ts +3 -3
- package/dist/providers/mandrill/index.js +1 -1
- package/dist/providers/mock/index.d.ts +5 -5
- package/dist/providers/mock/index.js +1 -1
- package/dist/providers/netcore/index.d.ts +3 -3
- package/dist/providers/netcore/index.js +1 -1
- package/dist/providers/nodemailer/index.d.ts +3 -3
- package/dist/providers/nodemailer/index.js +1 -1
- package/dist/providers/opentelemetry/index.d.ts +2 -2
- package/dist/providers/opentelemetry/index.js +1 -1
- package/dist/providers/outlook365/index.d.ts +3 -3
- package/dist/providers/outlook365/index.js +1 -1
- package/dist/providers/plunk/index.d.ts +3 -3
- package/dist/providers/plunk/index.js +1 -1
- package/dist/providers/postal/index.d.ts +3 -3
- package/dist/providers/postal/index.js +1 -1
- package/dist/providers/postmark/index.d.ts +3 -3
- package/dist/providers/postmark/index.js +1 -1
- package/dist/providers/resend/index.d.ts +3 -3
- package/dist/providers/resend/index.js +1 -1
- package/dist/providers/roundrobin/index.d.ts +3 -3
- package/dist/providers/roundrobin/index.js +1 -1
- package/dist/providers/scaleway/index.d.ts +3 -3
- package/dist/providers/scaleway/index.js +1 -1
- package/dist/providers/sendgrid/index.d.ts +3 -3
- package/dist/providers/sendgrid/index.js +1 -1
- package/dist/providers/smtp/index.d.ts +4 -4
- package/dist/providers/smtp/index.js +1 -1
- package/dist/providers/sparkpost/index.d.ts +3 -3
- package/dist/providers/sparkpost/index.js +1 -1
- package/dist/providers/sweego/index.d.ts +3 -3
- package/dist/providers/sweego/index.js +1 -1
- package/dist/providers/zeptomail/index.d.ts +3 -3
- package/dist/providers/zeptomail/index.js +1 -1
- package/dist/queue/bullmq-queue.d.ts +2 -2
- package/dist/queue/index.d.ts +4 -3
- package/dist/queue/index.js +1 -1
- package/dist/queue/pg-boss-queue.d.ts +2 -2
- package/dist/queue/sqs-queue.d.ts +2 -2
- package/dist/queue/unstorage-queue.d.ts +2 -2
- package/dist/render/css-inline.js +1 -1
- package/dist/template-engines/handlebars.js +1 -1
- package/dist/template-engines/html-to-text.js +1 -1
- package/dist/template-engines/i18n.js +1 -1
- package/dist/template-engines/jsx-email.js +1 -1
- package/dist/template-engines/liquid.js +1 -1
- package/dist/template-engines/locale-files.d.ts +66 -0
- package/dist/template-engines/locale-files.js +1 -0
- package/dist/template-engines/mjml.js +1 -1
- package/dist/template-engines/react-email.js +1 -1
- package/dist/template-engines/vue-email.js +1 -1
- package/dist/test/index.d.ts +24 -7
- package/dist/test/index.js +1 -1
- package/dist/utils/format-email-address.d.ts +1 -1
- package/dist/utils/format-email-address.js +1 -1
- package/dist/utils/parse-address.d.ts +1 -1
- package/dist/utils/parse-eml.d.ts +1 -1
- package/dist/utils/result.d.ts +1 -1
- package/dist/utils/result.js +1 -1
- package/dist/utils/validation/check-feature-support.d.ts +1 -1
- package/dist/utils/validation/check-feature-support.js +1 -1
- package/dist/webhooks/index.js +1 -1
- package/package.json +9 -1
- package/dist/packem_shared/EmailError-BIaHK1Uw.js +0 -1
- package/dist/packem_shared/Mail-DmYNQ0KK.js +0 -1
- package/dist/packem_shared/MailMessage-DmmaNHHc.js +0 -1
- package/dist/packem_shared/createWorker-ChuTgETP.js +0 -1
- package/dist/packem_shared/make-request-Cyz5_yu8.js +0 -1
- package/dist/packem_shared/resendProvider-DtaB7sk0.js +0 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import{createRequire as wn}from"node:module";let Sn;const xn=t=>(Sn??=wn(import.meta.url))(t),Ct=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,En=t=>{if(typeof Ct<"u"&&Ct.versions&&Ct.versions.node){const[e,s]=Ct.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Ct.getBuiltinModule(t)}return xn(t)},{createRequire:H}=En("node:module"),we=0,Os=4,ba=2,va=1,Ns=Symbol("findUpStop"),An=/^[A-Z]:\//i,Et=(t="")=>t&&t.replaceAll("\\","/").replace(An,e=>e.toUpperCase()),_n=/^[/\\]{2}/,Tn=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,qe=/^[A-Z]:$/i,Rn=/[^/](\.[^./]+)$/,kn=/^[/\\]|^[a-z]:[/\\]/i,Cn=/\/$/,On=()=>{if(typeof process.cwd=="function")try{const t=process.cwd();if(typeof t=="string")return Et(t)}catch{}return"/"},Ls=(t,e)=>{let s="",n=0,o=-1,r=0,i;for(let c=0;c<=t.length;++c){if(c<t.length)i=t[c];else{if(i==="/")break;i="/"}if(i==="/"){if(!(o===c-1||r===1))if(r===2){if(s.length<2||n!==2||!s.endsWith(".")||s.at(-2)!=="."){if(s.length>2){const u=s.lastIndexOf("/");u===-1?(s="",n=0):(s=s.slice(0,u),n=s.length-1-s.lastIndexOf("/")),o=c,r=0;continue}else if(s.length>0){s="",n=0,o=c,r=0;continue}}e&&(s+=s.length>0?"/..":"..",n=2)}else s.length>0?s+=`/${t.slice(o+1,c)}`:s=t.slice(o+1,c),n=c-o-1;o=c,r=0}else i==="."&&r!==-1?++r:r=-1}return s},St=t=>Tn.test(t),Tt=function(t){if(t.length===0)return".";t=Et(t);const e=_n.exec(t),s=St(t),n=t.at(-1)==="/";return t=Ls(t,!s),t.length===0?s?"/":n?"./":".":(n&&(t+="/"),qe.test(t)&&(t+="/"),e?s?`//${t}`:`//./${t}`:s&&!St(t)?`/${t}`:t)},Se=(...t)=>{let e="";for(const s of t)if(s)if(e.length>0){const n=e.at(-1)==="/",o=s[0]==="/";n&&o?e+=s.slice(1):e+=n||o?s:`/${s}`}else e+=s;return Tt(e)},tt=function(...t){t=t.map(n=>Et(n));let e="",s=!1;for(let n=t.length-1;n>=-1&&!s;n--){const o=n>=0?t[n]:On();!o||o.length===0||(e=`${o}/${e}`,s=St(o))}return e=Ls(e,!s),qe.test(e)?`${e}/`:s&&!St(e)?`/${e}`:e.length>0?e:"."},ht=function(t){return Et(t)},Nn=function(t){return Rn.exec(Et(t))?.[1]??""},V=t=>{const e=Et(t).replace(Cn,""),s=e.lastIndexOf("/");if(s===-1)return St(t)?"/":".";const n=e.slice(0,s);return qe.test(n)?`${n}/`:n||(St(t)?"/":".")},le=(t,e)=>{const s=Et(t),n=s.slice(s.lastIndexOf("/")+1);if(e&&n.endsWith(e)){if(e===s)return"";const o=n.slice(0,-e.length);if(o.length>0)return o}return n},Ds=function(t){const e=kn.exec(t)?.[0]?.replaceAll("\\","/")??"",s=le(t),n=Nn(s);return{base:s,dir:V(t),ext:n,name:s.slice(0,s.length-n.length),root:e}};let Ln;const Dn=t=>(Ln??=H(import.meta.url))(t),Ot=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Fn=t=>{if(typeof Ot<"u"&&Ot.versions&&Ot.versions.node){const[e,s]=Ot.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Ot.getBuiltinModule(t)}return Dn(t)},{fileURLToPath:Hn}=Fn("node:url");function In(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ve,Ye;function Bn(){return Ye||(Ye=1,Ve=["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"]),Ve}var Mn=Bn();const Pn=In(Mn);new Set(Pn);const F=t=>Et(t instanceof URL?Hn(t):t);let xt=class extends Error{constructor(e){super(`EEXIST: ${e}`)}get code(){return"EEXIST"}set code(e){throw new Error("Cannot overwrite code EEXIST")}get name(){return"AlreadyExistsError"}set name(e){throw new Error("Cannot overwrite name of AlreadyExistsError")}};const P=t=>{if(!t||!(t instanceof URL)&&typeof t!="string")throw new TypeError("Path must be a non-empty string or URL.")};let jn;const Gn=t=>(jn??=H(import.meta.url))(t),Nt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Un=t=>{if(typeof Nt<"u"&&Nt.versions&&Nt.versions.node){const[e,s]=Nt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Nt.getBuiltinModule(t)}return Gn(t)},{cp:zn}=Un("node:fs/promises"),Sa=async(t,e,s={})=>{P(t),P(e);const{dereference:n=!1,errorOnExist:o=!0,filter:r,overwrite:i=!0,preserveTimestamps:c=!1,recursive:u=!0,verbatimSymlinks:y=!1}=s,l=F(t),h=F(e);try{await zn(l,h,{dereference:n,errorOnExist:o,filter:r,force:i,preserveTimestamps:c,recursive:u,verbatimSymlinks:y})}catch($){throw $?.code==="ERR_FS_CP_EEXIST"?new xt(`destination already exists, copy '${h}'`):$}};let qn;const Wn=t=>(qn??=H(import.meta.url))(t),Lt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Xn=t=>{if(typeof Lt<"u"&&Lt.versions&&Lt.versions.node){const[e,s]=Lt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Lt.getBuiltinModule(t)}return Wn(t)},{cpSync:Kn}=Xn("node:fs"),xa=(t,e,s={})=>{P(t),P(e);const{dereference:n=!1,errorOnExist:o=!0,filter:r,overwrite:i=!0,preserveTimestamps:c=!1,recursive:u=!0,verbatimSymlinks:y=!1}=s,l=F(t),h=F(e);try{Kn(l,h,{dereference:n,errorOnExist:o,filter:r,force:i,preserveTimestamps:c,recursive:u,verbatimSymlinks:y})}catch($){throw $?.code==="ERR_FS_CP_EEXIST"?new xt(`destination already exists, copy '${h}'`):$}},dt=t=>{if(t.isFile())return"file";if(t.isDirectory())return"dir";if(t.isSymbolicLink())return"symlink"};let Qn;const Vn=t=>(Qn??=H(import.meta.url))(t),Dt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Yn=t=>{if(typeof Dt<"u"&&Dt.versions&&Dt.versions.node){const[e,s]=Dt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Dt.getBuiltinModule(t)}return Vn(t)},{lstat:Ze,mkdir:Zn}=Yn("node:fs/promises"),We=async t=>{P(t);try{const e=await Ze(t);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(dt(e))}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{await Zn(t,{recursive:!0})}catch(e){if(e.code!=="EEXIST")throw e;const s=await Ze(t);if(!s.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(dt(s))}'`,{cause:e})}};let Jn;const tr=t=>(Jn??=H(import.meta.url))(t),Ft=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,er=t=>{if(typeof Ft<"u"&&Ft.versions&&Ft.versions.node){const[e,s]=Ft.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Ft.getBuiltinModule(t)}return tr(t)},{lstatSync:Je,mkdirSync:sr}=er("node:fs"),Xe=t=>{P(t);try{const e=Je(t);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(dt(e))}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{sr(t,{recursive:!0})}catch(e){if(e.code!=="EEXIST")throw e;const s=Je(t);if(!s.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(dt(s))}'`,{cause:e})}};let nr;const rr=t=>(nr??=H(import.meta.url))(t),Ht=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,or=t=>{if(typeof Ht<"u"&&Ht.versions&&Ht.versions.node){const[e,s]=Ht.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Ht.getBuiltinModule(t)}return rr(t)},{lstat:ir,writeFile:cr}=or("node:fs/promises"),Ea=async t=>{P(t);try{const e=await ir(t);if(!e.isFile())throw new Error(`Ensure path exists, expected 'file', got '${String(dt(e))}'`)}catch(e){if(e.code==="ENOENT"){await We(V(F(t))),await cr(t,new Uint8Array);return}throw e}};let ur;const ar=t=>(ur??=H(import.meta.url))(t),It=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,lr=t=>{if(typeof It<"u"&&It.versions&&It.versions.node){const[e,s]=It.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return It.getBuiltinModule(t)}return ar(t)},{lstatSync:pr,writeFileSync:fr}=lr("node:fs"),Aa=t=>{P(t);try{const e=pr(t);if(!e.isFile())throw new Error(`Ensure path exists, expected 'file', got '${String(dt(e))}'`)}catch(e){if(e.code==="ENOENT"){Xe(V(F(t))),fr(t,new Uint8Array);return}throw e}},xe=(t,e)=>e.ino!==0n&&e.dev!==0n&&e.ino===t.ino&&e.dev===t.dev;let hr;const dr=t=>(hr??=H(import.meta.url))(t),Bt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,gr=t=>{if(typeof Bt<"u"&&Bt.versions&&Bt.versions.node){const[e,s]=Bt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Bt.getBuiltinModule(t)}return dr(t)},{lstat:ts,link:yr}=gr("node:fs/promises"),_a=async(t,e)=>{P(t),P(e),t=ht(F(t)),e=ht(F(e));let s;try{s=await ts(e,{bigint:!0})}catch{}let n;try{n=await ts(t,{bigint:!0})}catch(o){const r=o;throw r.message=r.message.replace("lstat","ensureLink"),r}s&&xe(n,s)||(await We(V(e)),await yr(t,e))};let mr;const $r=t=>(mr??=H(import.meta.url))(t),Mt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,br=t=>{if(typeof Mt<"u"&&Mt.versions&&Mt.versions.node){const[e,s]=Mt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Mt.getBuiltinModule(t)}return $r(t)},{lstatSync:es,linkSync:vr}=br("node:fs"),Ta=(t,e)=>{P(t),P(e),t=ht(F(t)),e=ht(F(e));let s;try{s=es(e,{bigint:!0})}catch{}let n;try{n=es(t,{bigint:!0})}catch(o){const r=o;throw r.message=r.message.replace("lstat","ensureLink"),r}s&&xe(n,s)||(Xe(V(e)),vr(t,e))},Fs=(t,e)=>typeof t!="string"?t:t.startsWith("./")?tt(t):typeof e=="string"?tt(V(e),t):new URL(t,e);let wr;const Sr=t=>(wr??=H(import.meta.url))(t),Pt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,xr=t=>{if(typeof Pt<"u"&&Pt.versions&&Pt.versions.node){const[e,s]=Pt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Pt.getBuiltinModule(t)}return Sr(t)},{lstat:ke,stat:ss,symlink:Er,readlink:Ar}=xr("node:fs/promises"),_r=process.platform==="win32"||/^(?:msys|cygwin)$/.test(process.env.OSTYPE),Ra=async(t,e,s)=>{P(t),P(e);const n=Fs(t,e);e=ht(F(e));try{if((await ke(e)).isSymbolicLink()){const[c,u]=await Promise.all([ss(n,{bigint:!0}),ss(e,{bigint:!0})]);if(xe(c,u))return}}catch{}const o=await ke(n),r=dt(o);await We(V(e));let i=s??"file";s||(_r?i="junction":i=r==="dir"?"dir":"file");try{await Er(ht(F(n)),e,i)}catch(c){if(c.code!=="EEXIST")throw c;const u=await ke(e);if(!u.isSymbolicLink())throw new xt(`A ${String(dt(u))} already exists at the path: ${e}`);const y=await Ar(e),l=ht(tt(y));if(l!==n)throw new xt(`A symlink targeting to an undesired path already exists: ${e} -> ${l}`)}};let Tr;const Rr=t=>(Tr??=H(import.meta.url))(t),jt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,kr=t=>{if(typeof jt<"u"&&jt.versions&&jt.versions.node){const[e,s]=jt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return jt.getBuiltinModule(t)}return Rr(t)},{lstatSync:Ce,statSync:ns,symlinkSync:Cr,readlinkSync:Or}=kr("node:fs"),Nr=process.platform==="win32"||/^(?:msys|cygwin)$/.test(process.env.OSTYPE),ka=(t,e,s)=>{P(t),P(e);const n=Fs(t,e);e=ht(F(e));try{if(Ce(e).isSymbolicLink()&&xe(ns(n,{bigint:!0}),ns(e,{bigint:!0})))return}catch{}const o=Ce(n),r=dt(o);Xe(V(e));let i=s??"file";s||(Nr?i="junction":i=r==="dir"?"dir":"file");try{Cr(ht(F(n)),e,i)}catch(c){if(c.code!=="EEXIST")throw c;const u=Ce(e);if(!u.isSymbolicLink())throw new xt(`A ${String(dt(u))} already exists at the path: ${e}`);const y=Or(e),l=ht(tt(y));if(l!==n)throw new xt(`A symlink targeting to an undesired path already exists: ${e} -> ${l}`)}},Lr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{platform:Dr}=Lr,Hs=/\r?\n/g,Is=`
|
|
1
|
+
import{createRequire as wn}from"node:module";let Sn;const xn=t=>(Sn??=wn(import.meta.url))(t),Ct=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,En=t=>{if(typeof Ct<"u"&&Ct.versions&&Ct.versions.node){const[e,s]=Ct.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Ct.getBuiltinModule(t)}return xn(t)},{createRequire:H}=En("node:module"),we=0,Os=4,ba=2,va=1,Ns=Symbol("findUpStop"),An=/^[A-Z]:\//i,Et=(t="")=>t&&t.replaceAll("\\","/").replace(An,e=>e.toUpperCase()),_n=/^[/\\]{2}/,Tn=/^[/\\](?![/\\])|^[/\\]{2}(?!\.)|^[A-Z]:[/\\]/i,ze=/^[A-Z]:$/i,Rn=/[^/](\.[^./]+)$/,kn=/^[/\\]|^[a-z]:[/\\]/i,Cn=/\/$/,On=()=>{if(typeof process.cwd=="function")try{const t=process.cwd();if(typeof t=="string")return Et(t)}catch{}return"/"},Ls=(t,e)=>{let s="",n=0,o=-1,r=0,i;for(let c=0;c<=t.length;++c){if(c<t.length)i=t[c];else{if(i==="/")break;i="/"}if(i==="/"){if(!(o===c-1||r===1))if(r===2){if(s.length<2||n!==2||!s.endsWith(".")||s.at(-2)!=="."){if(s.length>2){const u=s.lastIndexOf("/");u===-1?(s="",n=0):(s=s.slice(0,u),n=s.length-1-s.lastIndexOf("/")),o=c,r=0;continue}else if(s.length>0){s="",n=0,o=c,r=0;continue}}e&&(s+=s.length>0?"/..":"..",n=2)}else s.length>0?s+=`/${t.slice(o+1,c)}`:s=t.slice(o+1,c),n=c-o-1;o=c,r=0}else i==="."&&r!==-1?++r:r=-1}return s},St=t=>Tn.test(t),Tt=function(t){if(t.length===0)return".";t=Et(t);const e=_n.exec(t),s=St(t),n=t.at(-1)==="/";return t=Ls(t,!s),t.length===0?s?"/":n?"./":".":(n&&(t+="/"),ze.test(t)&&(t+="/"),e?s?`//${t}`:`//./${t}`:s&&!St(t)?`/${t}`:t)},Se=(...t)=>{let e="";for(const s of t)if(s)if(e.length>0){const n=e.at(-1)==="/",o=s[0]==="/";n&&o?e+=s.slice(1):e+=n||o?s:`/${s}`}else e+=s;return Tt(e)},tt=function(...t){t=t.map(n=>Et(n));let e="",s=!1;for(let n=t.length-1;n>=-1&&!s;n--){const o=n>=0?t[n]:On();!o||o.length===0||(e=`${o}/${e}`,s=St(o))}return e=Ls(e,!s),ze.test(e)?`${e}/`:s&&!St(e)?`/${e}`:e.length>0?e:"."},ht=function(t){return Et(t)},Nn=function(t){return Rn.exec(Et(t))?.[1]??""},V=t=>{const e=Et(t).replace(Cn,""),s=e.lastIndexOf("/");if(s===-1)return St(t)?"/":".";const n=e.slice(0,s);return ze.test(n)?`${n}/`:n||(St(t)?"/":".")},le=(t,e)=>{const s=Et(t),n=s.slice(s.lastIndexOf("/")+1);if(e&&n.endsWith(e)){if(e===s)return"";const o=n.slice(0,-e.length);if(o.length>0)return o}return n},Ds=function(t){const e=kn.exec(t)?.[0]?.replaceAll("\\","/")??"",s=le(t),n=Nn(s);return{base:s,dir:V(t),ext:n,name:s.slice(0,s.length-n.length),root:e}};let Ln;const Dn=t=>(Ln??=H(import.meta.url))(t),Ot=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Fn=t=>{if(typeof Ot<"u"&&Ot.versions&&Ot.versions.node){const[e,s]=Ot.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Ot.getBuiltinModule(t)}return Dn(t)},{fileURLToPath:Hn}=Fn("node:url");function In(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var Ve,Ye;function Bn(){return Ye||(Ye=1,Ve=["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"]),Ve}var Mn=Bn();const Pn=In(Mn);new Set(Pn);const F=t=>Et(t instanceof URL?Hn(t):t);let xt=class extends Error{constructor(e){super(`EEXIST: ${e}`)}get code(){return"EEXIST"}set code(e){throw new Error("Cannot overwrite code EEXIST")}get name(){return"AlreadyExistsError"}set name(e){throw new Error("Cannot overwrite name of AlreadyExistsError")}};const P=t=>{if(!t||!(t instanceof URL)&&typeof t!="string")throw new TypeError("Path must be a non-empty string or URL.")};let jn;const Gn=t=>(jn??=H(import.meta.url))(t),Nt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Un=t=>{if(typeof Nt<"u"&&Nt.versions&&Nt.versions.node){const[e,s]=Nt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Nt.getBuiltinModule(t)}return Gn(t)},{cp:qn}=Un("node:fs/promises"),Sa=async(t,e,s={})=>{P(t),P(e);const{dereference:n=!1,errorOnExist:o=!0,filter:r,overwrite:i=!0,preserveTimestamps:c=!1,recursive:u=!0,verbatimSymlinks:y=!1}=s,l=F(t),h=F(e);try{await qn(l,h,{dereference:n,errorOnExist:o,filter:r,force:i,preserveTimestamps:c,recursive:u,verbatimSymlinks:y})}catch($){throw $?.code==="ERR_FS_CP_EEXIST"?new xt(`destination already exists, copy '${h}'`):$}};let zn;const Wn=t=>(zn??=H(import.meta.url))(t),Lt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Xn=t=>{if(typeof Lt<"u"&&Lt.versions&&Lt.versions.node){const[e,s]=Lt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Lt.getBuiltinModule(t)}return Wn(t)},{cpSync:Kn}=Xn("node:fs"),xa=(t,e,s={})=>{P(t),P(e);const{dereference:n=!1,errorOnExist:o=!0,filter:r,overwrite:i=!0,preserveTimestamps:c=!1,recursive:u=!0,verbatimSymlinks:y=!1}=s,l=F(t),h=F(e);try{Kn(l,h,{dereference:n,errorOnExist:o,filter:r,force:i,preserveTimestamps:c,recursive:u,verbatimSymlinks:y})}catch($){throw $?.code==="ERR_FS_CP_EEXIST"?new xt(`destination already exists, copy '${h}'`):$}},dt=t=>{if(t.isFile())return"file";if(t.isDirectory())return"dir";if(t.isSymbolicLink())return"symlink"};let Qn;const Vn=t=>(Qn??=H(import.meta.url))(t),Dt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Yn=t=>{if(typeof Dt<"u"&&Dt.versions&&Dt.versions.node){const[e,s]=Dt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Dt.getBuiltinModule(t)}return Vn(t)},{lstat:Ze,mkdir:Zn}=Yn("node:fs/promises"),We=async t=>{P(t);try{const e=await Ze(t);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(dt(e))}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{await Zn(t,{recursive:!0})}catch(e){if(e.code!=="EEXIST")throw e;const s=await Ze(t);if(!s.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(dt(s))}'`,{cause:e})}};let Jn;const tr=t=>(Jn??=H(import.meta.url))(t),Ft=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,er=t=>{if(typeof Ft<"u"&&Ft.versions&&Ft.versions.node){const[e,s]=Ft.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Ft.getBuiltinModule(t)}return tr(t)},{lstatSync:Je,mkdirSync:sr}=er("node:fs"),Xe=t=>{P(t);try{const e=Je(t);if(!e.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(dt(e))}'`);return}catch(e){if(e.code!=="ENOENT")throw e}try{sr(t,{recursive:!0})}catch(e){if(e.code!=="EEXIST")throw e;const s=Je(t);if(!s.isDirectory())throw new Error(`Ensure path exists, expected 'dir', got '${String(dt(s))}'`,{cause:e})}};let nr;const rr=t=>(nr??=H(import.meta.url))(t),Ht=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,or=t=>{if(typeof Ht<"u"&&Ht.versions&&Ht.versions.node){const[e,s]=Ht.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Ht.getBuiltinModule(t)}return rr(t)},{lstat:ir,writeFile:cr}=or("node:fs/promises"),Ea=async t=>{P(t);try{const e=await ir(t);if(!e.isFile())throw new Error(`Ensure path exists, expected 'file', got '${String(dt(e))}'`)}catch(e){if(e.code==="ENOENT"){await We(V(F(t))),await cr(t,new Uint8Array);return}throw e}};let ur;const ar=t=>(ur??=H(import.meta.url))(t),It=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,lr=t=>{if(typeof It<"u"&&It.versions&&It.versions.node){const[e,s]=It.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return It.getBuiltinModule(t)}return ar(t)},{lstatSync:pr,writeFileSync:fr}=lr("node:fs"),Aa=t=>{P(t);try{const e=pr(t);if(!e.isFile())throw new Error(`Ensure path exists, expected 'file', got '${String(dt(e))}'`)}catch(e){if(e.code==="ENOENT"){Xe(V(F(t))),fr(t,new Uint8Array);return}throw e}},xe=(t,e)=>e.ino!==0n&&e.dev!==0n&&e.ino===t.ino&&e.dev===t.dev;let hr;const dr=t=>(hr??=H(import.meta.url))(t),Bt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,gr=t=>{if(typeof Bt<"u"&&Bt.versions&&Bt.versions.node){const[e,s]=Bt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Bt.getBuiltinModule(t)}return dr(t)},{lstat:ts,link:yr}=gr("node:fs/promises"),_a=async(t,e)=>{P(t),P(e),t=ht(F(t)),e=ht(F(e));let s;try{s=await ts(e,{bigint:!0})}catch{}let n;try{n=await ts(t,{bigint:!0})}catch(o){const r=o;throw r.message=r.message.replace("lstat","ensureLink"),r}s&&xe(n,s)||(await We(V(e)),await yr(t,e))};let mr;const $r=t=>(mr??=H(import.meta.url))(t),Mt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,br=t=>{if(typeof Mt<"u"&&Mt.versions&&Mt.versions.node){const[e,s]=Mt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Mt.getBuiltinModule(t)}return $r(t)},{lstatSync:es,linkSync:vr}=br("node:fs"),Ta=(t,e)=>{P(t),P(e),t=ht(F(t)),e=ht(F(e));let s;try{s=es(e,{bigint:!0})}catch{}let n;try{n=es(t,{bigint:!0})}catch(o){const r=o;throw r.message=r.message.replace("lstat","ensureLink"),r}s&&xe(n,s)||(Xe(V(e)),vr(t,e))},Fs=(t,e)=>typeof t!="string"?t:t.startsWith("./")?tt(t):typeof e=="string"?tt(V(e),t):new URL(t,e);let wr;const Sr=t=>(wr??=H(import.meta.url))(t),Pt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,xr=t=>{if(typeof Pt<"u"&&Pt.versions&&Pt.versions.node){const[e,s]=Pt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Pt.getBuiltinModule(t)}return Sr(t)},{lstat:ke,stat:ss,symlink:Er,readlink:Ar}=xr("node:fs/promises"),_r=process.platform==="win32"||/^(?:msys|cygwin)$/.test(process.env.OSTYPE),Ra=async(t,e,s)=>{P(t),P(e);const n=Fs(t,e);e=ht(F(e));try{if((await ke(e)).isSymbolicLink()){const[c,u]=await Promise.all([ss(n,{bigint:!0}),ss(e,{bigint:!0})]);if(xe(c,u))return}}catch{}const o=await ke(n),r=dt(o);await We(V(e));let i=s??"file";s||(_r?i="junction":i=r==="dir"?"dir":"file");try{await Er(ht(F(n)),e,i)}catch(c){if(c.code!=="EEXIST")throw c;const u=await ke(e);if(!u.isSymbolicLink())throw new xt(`A ${String(dt(u))} already exists at the path: ${e}`);const y=await Ar(e),l=ht(tt(y));if(l!==n)throw new xt(`A symlink targeting to an undesired path already exists: ${e} -> ${l}`)}};let Tr;const Rr=t=>(Tr??=H(import.meta.url))(t),jt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,kr=t=>{if(typeof jt<"u"&&jt.versions&&jt.versions.node){const[e,s]=jt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return jt.getBuiltinModule(t)}return Rr(t)},{lstatSync:Ce,statSync:ns,symlinkSync:Cr,readlinkSync:Or}=kr("node:fs"),Nr=process.platform==="win32"||/^(?:msys|cygwin)$/.test(process.env.OSTYPE),ka=(t,e,s)=>{P(t),P(e);const n=Fs(t,e);e=ht(F(e));try{if(Ce(e).isSymbolicLink()&&xe(ns(n,{bigint:!0}),ns(e,{bigint:!0})))return}catch{}const o=Ce(n),r=dt(o);Xe(V(e));let i=s??"file";s||(Nr?i="junction":i=r==="dir"?"dir":"file");try{Cr(ht(F(n)),e,i)}catch(c){if(c.code!=="EEXIST")throw c;const u=Ce(e);if(!u.isSymbolicLink())throw new xt(`A ${String(dt(u))} already exists at the path: ${e}`);const y=Or(e),l=ht(tt(y));if(l!==n)throw new xt(`A symlink targeting to an undesired path already exists: ${e} -> ${l}`)}},Lr=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{platform:Dr}=Lr,Hs=/\r?\n/g,Is=`
|
|
2
2
|
`,Ge=`\r
|
|
3
|
-
`,Ca=Dr==="win32"?Ge:Is,Oa=t=>{const e=t.match(Hs);if(!e||e.length===0)return null;const s=e.filter(o=>o===Ge).length,n=e.length-s;return s>n?Ge:Is},Na=(t,e)=>t.replaceAll(Hs,e);let me=class extends Error{root;constructor(e,s){super(`${e instanceof Error?e.message:String(e)} for path "${s}"`),this.cause=e,this.root=s}get name(){return"WalkError"}set name(e){throw new Error("Cannot overwrite name of WalkError")}};const Fr=t=>{const e=[],s=new Set;let n=0;for(const c of t){if(c==="{")e.push(n);else if(c==="}"){const u=e.pop();u!==void 0&&(s.add(u),s.add(n))}n+=1}let o=0,r=0,i="";for(const c of t)c==="{"?s.has(r)?(i+="(",o+=1):i+=String.raw`\{`:c==="}"?s.has(r)?(i+=")",o-=1):i+=String.raw`\}`:c===","&&o>0?i+="|":i+=c,r+=1;return i},$e=t=>{const e=t.replace(/[$()+\\^]/g,String.raw`\$&`).replace(/\.\*/g,".([^/]*)").replace(/\*\*/g,"(.*)").replace(/(?<!\.)\*(?!\*)/g,"([^/]*)").replace(/\?/g,"[^/]").replace(/\.(?!\*)/g,String.raw`\.`),s=Fr(e).replace(/\[!(.*?)\]/g,"[^$1]");try{return new RegExp(`^${s}$`)}catch(n){throw new Error(`Invalid glob pattern: ${t}`,{cause:n})}};let Hr=class{name;path;#t;constructor(e,s,n){this.#t=e,this.name=s,this.path=n}isDirectory(){return this.#t.isDirectory()}isFile(){return this.#t.isFile()}isSymbolicLink(){return this.#t.isSymbolicLink()}};const kt=(t,e,s)=>new Hr(t,e,s),wt=(t,e,s,n)=>{if(Array.isArray(e)&&e.length>0&&!e.some(r=>t.endsWith(r)))return!1;const o=t.includes("\\")?t.replaceAll("\\","/"):t;return s&&!s.some(r=>r.test(o))?!1:!n?.some(r=>r.test(o))};let Ir;const Br=t=>(Ir??=H(import.meta.url))(t),Gt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Mr=t=>{if(typeof Gt<"u"&&Gt.versions&&Gt.versions.node){const[e,s]=Gt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Gt.getBuiltinModule(t)}return Br(t)},{readdir:Pr,realpath:jr,stat:Bs}=Mr("node:fs/promises"),Gr=async t=>{const e=Tt(t),s=le(e),n=await Bs(e);return kt(n,s,e)};async function*Ms(t,e={}){const{extensions:s,followSymlinks:n=!1,includeDirs:o=!0,includeFiles:r=!0,includeSymlinks:i=!0,match:c,maxDepth:u=Number.POSITIVE_INFINITY,skip:y}=e;if(P(t),u<0)return;const l=e.visited??new Set,h=c?c.map(g=>typeof g=="string"?$e(g):g):void 0,$=y?y.map(g=>typeof g=="string"?$e(g):g):void 0;if(t=tt(F(t)),o&&wt(t,s,h,$)&&(yield await Gr(t)),!(u<1||!wt(t,void 0,void 0,$)))try{const g=await Pr(t,{withFileTypes:!0});for(const b of g){let E=Se(t,b.name),R=b,{name:C}=b,D=b.isDirectory(),m=b.isFile();if(b.isSymbolicLink())if(n){const v=Tt(await jr(E));if(l.has(v))continue;E=v;const a=await Bs(v);D=a.isDirectory(),m=a.isFile(),R=a,C=le(v)}else if(i&&wt(E,s,h,$)){yield kt(b,b.name,E);continue}else continue;D?(n&&l.add(E),yield*Ms(E,{extensions:s,followSymlinks:n,includeDirs:o,includeFiles:r,includeSymlinks:i,match:h,maxDepth:u-1,skip:$,visited:l})):m&&r&&wt(E,s,h,$)&&(yield kt(R,C,E))}}catch(g){throw g instanceof me?g:new me(g,t)}}const Fa=async(t,e={})=>{Array.isArray(e.extensions)||(e.extensions=["js","mjs","cjs","ts"]);const s=[];for await(const n of Ms(t,e))s.push(n.path);return s};let Ur;const zr=t=>(Ur??=H(import.meta.url))(t),Ut=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,qr=t=>{if(typeof Ut<"u"&&Ut.versions&&Ut.versions.node){const[e,s]=Ut.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Ut.getBuiltinModule(t)}return zr(t)},{readdirSync:Wr,realpathSync:Xr,statSync:Ps}=qr("node:fs"),Kr=t=>{const e=Tt(t),s=Ps(e);return kt(s,le(e),e)};function*js(t,e={}){const{extensions:s,followSymlinks:n=!1,includeDirs:o=!0,includeFiles:r=!0,includeSymlinks:i=!0,match:c,maxDepth:u=Number.POSITIVE_INFINITY,skip:y}=e;if(P(t),u<0)return;const l=e.visited??new Set,h=c?c.map(g=>typeof g=="string"?$e(g):g):void 0,$=y?y.map(g=>typeof g=="string"?$e(g):g):void 0;if(t=tt(F(t)),o&&wt(t,s,h,$)&&(yield Kr(t)),!(u<1||!wt(t,void 0,void 0,$)))try{const g=Wr(t,{withFileTypes:!0});for(const b of g){let E=Se(t,b.name),R=b,{name:C}=b,D=b.isDirectory(),m=b.isFile();if(b.isSymbolicLink())if(n){const v=Tt(Xr(E));if(l.has(v))continue;E=v;const a=Ps(v);D=a.isDirectory(),m=a.isFile(),R=a,C=le(v)}else if(i&&wt(E,s,h,$)){yield kt(b,b.name,Tt(E));continue}else continue;D?(n&&l.add(E),yield*js(E,{extensions:s,followSymlinks:n,includeDirs:o,includeFiles:r,includeSymlinks:i,match:h,maxDepth:u-1,skip:$,visited:l})):m&&r&&wt(E,s,h,$)&&(yield kt(R,C,Tt(E)))}}catch(g){throw g instanceof me?g:new me(g,t)}}const Ha=(t,e={})=>{Array.isArray(e.extensions)||(e.extensions=["js","mjs","cjs","ts"]);const s=[];for(const n of js(t,e))s.push(n.path);return s};let Qr;const Vr=t=>(Qr??=H(import.meta.url))(t),zt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Yr=t=>{if(typeof zt<"u"&&zt.versions&&zt.versions.node){const[e,s]=zt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return zt.getBuiltinModule(t)}return Vr(t)},{stat:Zr,lstat:Jr}=Yr("node:fs/promises"),Ia=async(t,e={})=>{if(typeof t!="string"&&!Array.isArray(t)&&typeof t!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");const s=e.cwd?F(e.cwd):process.cwd();let n=tt(s);const{root:o}=Ds(n),r=F(e.stopAt??o),i=tt(n,r),c=e.type??"file",u=async function(l){return typeof t=="function"?[await t(l)]:typeof t=="string"?[t]:Array.isArray(t)?t:[t]};e.allowSymlinks??=!0;const y=e.allowSymlinks?Zr:Jr;for(;n;){const l=await u(n);for(let h of l){if(h===Ns)return;if(h===void 0)continue;Buffer.isBuffer(h)?h=h.toString():h instanceof URL&&(h=F(h));const $=St(h)?h:tt(n,h);try{const g=await y($);if(c==="file"&&g.isFile()||c==="directory"&&g.isDirectory())return $}catch{}}if(n===i||n===o)break;n=V(n)}};let to;const eo=t=>(to??=H(import.meta.url))(t),qt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,so=t=>{if(typeof qt<"u"&&qt.versions&&qt.versions.node){const[e,s]=qt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return qt.getBuiltinModule(t)}return eo(t)},{statSync:no,lstatSync:ro}=so("node:fs"),Ba=(t,e={})=>{if(typeof t!="string"&&!Array.isArray(t)&&typeof t!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");const s=e.cwd?F(e.cwd):process.cwd();let n=tt(s);const{root:o}=Ds(n),r=F(e.stopAt??o),i=tt(n,r),c=e.type??"file",u=function(l){return typeof t=="function"?[t(l)]:typeof t=="string"?[t]:Array.isArray(t)?t:[t]};e.allowSymlinks??=!0;const y=e.allowSymlinks?no:ro;for(;n;){for(let l of u(n)){if(l===Ns)return;if(l===void 0)continue;Buffer.isBuffer(l)?l=l.toString():l instanceof URL&&(l=F(l));const h=St(l)?l:tt(n,l);try{const $=y(h);if(c==="file"&&$.isFile()||c==="directory"&&$.isDirectory())return h}catch{}}if(n===i||n===o)break;n=V(n)}};function Ke(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var rs={},Oe,os;function Ee(){if(os)return Oe;os=1;const t="\\\\/",e=`[^${t}]`,s=0,n=Symbol("unignore"),o="\\.",r="\\+",i="\\?",c="\\/",u="(?=.)",y="[^/]",l=`(?:${c}|$)`,h=`(?:^|${c})`,$=`${o}{1,2}${l}`,g=`(?!${o})`,b=`(?!${h}${$})`,E=`(?!${o}{0,1}${l})`,R=`(?!${$})`,C=`[^.${c}]`,D=`${y}*?`,m={DOT_LITERAL:o,PLUS_LITERAL:r,QMARK_LITERAL:i,SLASH_LITERAL:c,ONE_CHAR:u,QMARK:y,END_ANCHOR:l,DOTS_SLASH:$,NO_DOT:g,NO_DOTS:b,NO_DOT_SLASH:E,NO_DOTS_SLASH:R,QMARK_NO_DOT:C,STAR:D,START_ANCHOR:h,SEP:"/"},v={...m,SLASH_LITERAL:`[${t}]`,QMARK:e,STAR:`${e}*?`,DOTS_SLASH:`${o}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${o})`,NO_DOTS:`(?!(?:^|[${t}])${o}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${o}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${o}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`,SEP:"\\"},a={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return Oe={DEFAULT_MAX_EXTGLOB_RECURSION:s,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:a,UNIGNORE:n,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(A){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${A.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(A){return A===!0?v:m}},Oe}var is;function Ae(){return is||(is=1,(function(t){const{REGEX_BACKSLASH:e,REGEX_REMOVE_BACKSLASH:s,REGEX_SPECIAL_CHARS:n,REGEX_SPECIAL_CHARS_GLOBAL:o}=Ee();t.isObject=r=>r!==null&&typeof r=="object"&&!Array.isArray(r),t.hasRegexChars=r=>n.test(r),t.isRegexChar=r=>r.length===1&&t.hasRegexChars(r),t.escapeRegex=r=>r.replace(o,"\\$1"),t.toPosixSlashes=r=>r.replace(e,"/"),t.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const r=navigator.platform.toLowerCase();return r==="win32"||r==="windows"}return process.platform?process.platform==="win32":!1},t.removeBackslashes=r=>r.replace(s,i=>i==="\\"?"":i),t.escapeLast=(r,i,c)=>{const u=r.lastIndexOf(i,c);return u===-1?r:r[u-1]==="\\"?t.escapeLast(r,i,u-1):`${r.slice(0,u)}\\${r.slice(u)}`},t.removePrefix=(r,i={})=>{let c=r;return c.startsWith("./")&&(c=c.slice(2),i.prefix="./"),c},t.wrapOutput=(r,i={},c={})=>{const u=c.contains?"":"^",y=c.contains?"":"$";let l=`${u}(?:${r})${y}`;return i.negated===!0&&(l=`(?:^(?!${l}).*$)`),l},t.basename=(r,{windows:i}={})=>{const c=r.split(i?/[\\/]/:"/"),u=c[c.length-1];return u===""?c[c.length-2]:u}})(rs)),rs}var Ne,cs;function oo(){if(cs)return Ne;cs=1;const t=Ae(),{CHAR_ASTERISK:e,CHAR_AT:s,CHAR_BACKWARD_SLASH:n,CHAR_COMMA:o,CHAR_DOT:r,CHAR_EXCLAMATION_MARK:i,CHAR_FORWARD_SLASH:c,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:y,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_PLUS:h,CHAR_QUESTION_MARK:$,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:b,CHAR_RIGHT_SQUARE_BRACKET:E}=Ee(),R=D=>D===c||D===n,C=D=>{D.isPrefix!==!0&&(D.depth=D.isGlobstar?1/0:1)};return Ne=(D,m)=>{const v=m||{},a=D.length-1,A=v.parts===!0||v.scanToEnd===!0,O=[],_=[],T=[];let x=D,B=-1,U=0,nt=0,gt=!1,rt=!1,K=!1,ot=!1,mt=!1,ut=!1,it=!1,W=!1,at=!1,Z=!1,$t=0,J,k,M={value:"",depth:0,isGlob:!1};const Y=()=>B>=a,d=()=>x.charCodeAt(B+1),z=()=>(J=k,x.charCodeAt(++B));for(;B<a;){k=z();let et;if(k===n){it=M.backslashes=!0,k=z(),k===u&&(ut=!0);continue}if(ut===!0||k===u){for($t++;Y()!==!0&&(k=z());){if(k===n){it=M.backslashes=!0,z();continue}if(k===u){$t++;continue}if(ut!==!0&&k===r&&(k=z())===r){if(gt=M.isBrace=!0,K=M.isGlob=!0,Z=!0,A===!0)continue;break}if(ut!==!0&&k===o){if(gt=M.isBrace=!0,K=M.isGlob=!0,Z=!0,A===!0)continue;break}if(k===g&&($t--,$t===0)){ut=!1,gt=M.isBrace=!0,Z=!0;break}}if(A===!0)continue;break}if(k===c){if(O.push(B),_.push(M),M={value:"",depth:0,isGlob:!1},Z===!0)continue;if(J===r&&B===U+1){U+=2;continue}nt=B+1;continue}if(v.noext!==!0&&(k===h||k===s||k===e||k===$||k===i)&&d()===y){if(K=M.isGlob=!0,ot=M.isExtglob=!0,Z=!0,k===i&&B===U&&(at=!0),A===!0){for(;Y()!==!0&&(k=z());){if(k===n){it=M.backslashes=!0,k=z();continue}if(k===b){K=M.isGlob=!0,Z=!0;break}}continue}break}if(k===e){if(J===e&&(mt=M.isGlobstar=!0),K=M.isGlob=!0,Z=!0,A===!0)continue;break}if(k===$){if(K=M.isGlob=!0,Z=!0,A===!0)continue;break}if(k===l){for(;Y()!==!0&&(et=z());){if(et===n){it=M.backslashes=!0,z();continue}if(et===E){rt=M.isBracket=!0,K=M.isGlob=!0,Z=!0;break}}if(A===!0)continue;break}if(v.nonegate!==!0&&k===i&&B===U){W=M.negated=!0,U++;continue}if(v.noparen!==!0&&k===y){if(K=M.isGlob=!0,A===!0){for(;Y()!==!0&&(k=z());){if(k===y){it=M.backslashes=!0,k=z();continue}if(k===b){Z=!0;break}}continue}break}if(K===!0){if(Z=!0,A===!0)continue;break}}v.noext===!0&&(ot=!1,K=!1);let G=x,bt="",p="";U>0&&(bt=x.slice(0,U),x=x.slice(U),nt-=U),G&&K===!0&&nt>0?(G=x.slice(0,nt),p=x.slice(nt)):K===!0?(G="",p=x):G=x,G&&G!==""&&G!=="/"&&G!==x&&R(G.charCodeAt(G.length-1))&&(G=G.slice(0,-1)),v.unescape===!0&&(p&&(p=t.removeBackslashes(p)),G&&it===!0&&(G=t.removeBackslashes(G)));const f={prefix:bt,input:D,start:U,base:G,glob:p,isBrace:gt,isBracket:rt,isGlob:K,isExtglob:ot,isGlobstar:mt,negated:W,negatedExtglob:at};if(v.tokens===!0&&(f.maxDepth=0,R(k)||_.push(M),f.tokens=_),v.parts===!0||v.tokens===!0){let et;for(let I=0;I<O.length;I++){const ct=et?et+1:U,lt=O[I],st=D.slice(ct,lt);v.tokens&&(I===0&&U!==0?(_[I].isPrefix=!0,_[I].value=bt):_[I].value=st,C(_[I]),f.maxDepth+=_[I].depth),(I!==0||st!=="")&&T.push(st),et=lt}if(et&&et+1<D.length){const I=D.slice(et+1);T.push(I),v.tokens&&(_[_.length-1].value=I,C(_[_.length-1]),f.maxDepth+=_[_.length-1].depth)}f.slashes=O,f.parts=T}return f},Ne}var Le,us;function io(){if(us)return Le;us=1;const t=Ee(),e=Ae(),{MAX_LENGTH:s,POSIX_REGEX_SOURCE:n,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:r,REPLACEMENTS:i}=t,c=(m,v)=>{if(typeof v.expandRange=="function")return v.expandRange(...m,v);m.sort();const a=`[${m.join("-")}]`;try{new RegExp(a)}catch{return m.map(A=>e.escapeRegex(A)).join("..")}return a},u=(m,v)=>`Missing ${m}: "${v}" - use "\\\\${v}" to match literal characters`,y=m=>{const v=[];let a=0,A=0,O=0,_="",T=!1;for(const x of m){if(T===!0){_+=x,T=!1;continue}if(x==="\\"){_+=x,T=!0;continue}if(x==='"'){O=O===1?0:1,_+=x;continue}if(O===0){if(x==="[")a++;else if(x==="]"&&a>0)a--;else if(a===0){if(x==="(")A++;else if(x===")"&&A>0)A--;else if(x==="|"&&A===0){v.push(_),_="";continue}}}_+=x}return v.push(_),v},l=m=>{let v=!1;for(const a of m){if(v===!0){v=!1;continue}if(a==="\\"){v=!0;continue}if(/[?*+@!()[\]{}]/.test(a))return!1}return!0},h=m=>{let v=m.trim(),a=!0;for(;a===!0;)a=!1,/^@\([^\\()[\]{}|]+\)$/.test(v)&&(v=v.slice(2,-1),a=!0);if(l(v))return v.replace(/\\(.)/g,"$1")},$=m=>{const v=m.map(h).filter(Boolean);for(let a=0;a<v.length;a++)for(let A=a+1;A<v.length;A++){const O=v[a],_=v[A],T=O[0];if(!(!T||O!==T.repeat(O.length)||_!==T.repeat(_.length))&&(O===_||O.startsWith(_)||_.startsWith(O)))return!0}return!1},g=(m,v=!0)=>{if(m[0]!=="+"&&m[0]!=="*"||m[1]!=="(")return;let a=0,A=0,O=0,_=!1;for(let T=1;T<m.length;T++){const x=m[T];if(_===!0){_=!1;continue}if(x==="\\"){_=!0;continue}if(x==='"'){O=O===1?0:1;continue}if(O!==1){if(x==="["){a++;continue}if(x==="]"&&a>0){a--;continue}if(!(a>0)){if(x==="("){A++;continue}if(x===")"&&(A--,A===0))return v===!0&&T!==m.length-1?void 0:{type:m[0],body:m.slice(2,T),end:T}}}}},b=m=>`${m.length===1?e.escapeRegex(m[0]):`[${m.map(v=>e.escapeRegex(v)).join("")}]`}*`,E=m=>{let v=0;const a=[];for(;v<m.length;){const A=g(m.slice(v),!1);if(!A||A.type!=="*")return;const O=y(A.body).map(T=>T.trim());if(O.length!==1)return;const _=h(O[0]);if(!_||_.length!==1)return;a.push(_),v+=A.end+1}if(!(a.length<1))return a},R=m=>{let v=0,a=m.trim(),A=g(a);for(;A;)v++,a=A.body.trim(),A=g(a);return v},C=(m,v)=>{if(v.maxExtglobRecursion===!1)return{risky:!1};const a=typeof v.maxExtglobRecursion=="number"?v.maxExtglobRecursion:t.DEFAULT_MAX_EXTGLOB_RECURSION,A=y(m).map(x=>x.trim());if(A.length>1&&(A.some(x=>x==="")||A.some(x=>/^[*?]+$/.test(x))||$(A)))return{risky:!0};const O=[];let _=!1,T=!0;for(const x of A){const B=E(x);if(B){_=!0,O.push(...B);continue}const U=h(x);if(U&&U.length===1){O.push(U);continue}if(T=!1,R(x)>a)return{risky:!0}}return _?T?{risky:!0,safeOutput:b([...new Set(O)])}:{risky:!0}:{risky:!1}},D=(m,v)=>{if(typeof m!="string")throw new TypeError("Expected a string");m=i[m]||m;const a={...v},A=typeof a.maxLength=="number"?Math.min(s,a.maxLength):s;let O=m.length;if(O>A)throw new SyntaxError(`Input length: ${O}, exceeds maximum allowed length: ${A}`);const _={type:"bos",value:"",output:a.prepend||""},T=[_],x=a.capture?"":"?:",B=t.globChars(a.windows),U=t.extglobChars(B),{DOT_LITERAL:nt,PLUS_LITERAL:gt,SLASH_LITERAL:rt,ONE_CHAR:K,DOTS_SLASH:ot,NO_DOT:mt,NO_DOT_SLASH:ut,NO_DOTS_SLASH:it,QMARK:W,QMARK_NO_DOT:at,STAR:Z,START_ANCHOR:$t}=B,J=S=>`(${x}(?:(?!${$t}${S.dot?ot:nt}).)*?)`,k=a.dot?"":mt,M=a.dot?W:at;let Y=a.bash===!0?J(a):Z;a.capture&&(Y=`(${Y})`),typeof a.noext=="boolean"&&(a.noextglob=a.noext);const d={input:m,index:-1,start:0,dot:a.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:T};m=e.removePrefix(m,d),O=m.length;const z=[],G=[],bt=[];let p=_,f;const et=()=>d.index===O-1,I=d.peek=(S=1)=>m[d.index+S],ct=d.advance=()=>m[++d.index]||"",lt=()=>m.slice(d.index+1),st=(S="",q=0)=>{d.consumed+=S,d.index+=q},de=S=>{d.output+=S.output!=null?S.output:S.value,st(S.value)},bn=()=>{let S=1;for(;I()==="!"&&(I(2)!=="("||I(3)==="?");)ct(),d.start++,S++;return S%2===0?!1:(d.negated=!0,d.start++,!0)},ge=S=>{d[S]++,bt.push(S)},vt=S=>{d[S]--,bt.pop()},N=S=>{if(p.type==="globstar"){const q=d.braces>0&&(S.type==="comma"||S.type==="brace"),w=S.extglob===!0||z.length&&(S.type==="pipe"||S.type==="paren");S.type!=="slash"&&S.type!=="paren"&&!q&&!w&&(d.output=d.output.slice(0,-p.output.length),p.type="star",p.value="*",p.output=Y,d.output+=p.output)}if(z.length&&S.type!=="paren"&&(z[z.length-1].inner+=S.value),(S.value||S.output)&&de(S),p&&p.type==="text"&&S.type==="text"){p.output=(p.output||p.value)+S.value,p.value+=S.value;return}S.prev=p,T.push(S),p=S},ye=(S,q)=>{const w={...U[q],conditions:1,inner:""};w.prev=p,w.parens=d.parens,w.output=d.output,w.startIndex=d.index,w.tokensIndex=T.length;const L=(a.capture?"(":"")+w.open;ge("parens"),N({type:S,value:q,output:d.output?"":K}),N({type:"paren",extglob:!0,value:ct(),output:L}),z.push(w)},vn=S=>{const q=m.slice(S.startIndex,d.index+1),w=m.slice(S.startIndex+2,d.index),L=C(w,a);if((S.type==="plus"||S.type==="star")&&L.risky){const j=L.safeOutput?(S.output?"":K)+(a.capture?`(${L.safeOutput})`:L.safeOutput):void 0,pt=T[S.tokensIndex];pt.type="text",pt.value=q,pt.output=j||e.escapeRegex(q);for(let ft=S.tokensIndex+1;ft<T.length;ft++)T[ft].value="",T[ft].output="",delete T[ft].suffix;d.output=S.output+pt.output,d.backtrack=!0,N({type:"paren",extglob:!0,value:f,output:""}),vt("parens");return}let X=S.close+(a.capture?")":""),Q;if(S.type==="negate"){let j=Y;if(S.inner&&S.inner.length>1&&S.inner.includes("/")&&(j=J(a)),(j!==Y||et()||/^\)+$/.test(lt()))&&(X=S.close=`)$))${j}`),S.inner.includes("*")&&(Q=lt())&&/^\.[^\\/.]+$/.test(Q)){const pt=D(Q,{...v,fastpaths:!1}).output;X=S.close=`)${pt})${j})`}S.prev.type==="bos"&&(d.negatedExtglob=!0)}N({type:"paren",extglob:!0,value:f,output:X}),vt("parens")};if(a.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(m)){let S=!1,q=m.replace(r,(w,L,X,Q,j,pt)=>Q==="\\"?(S=!0,w):Q==="?"?L?L+Q+(j?W.repeat(j.length):""):pt===0?M+(j?W.repeat(j.length):""):W.repeat(X.length):Q==="."?nt.repeat(X.length):Q==="*"?L?L+Q+(j?Y:""):Y:L?w:`\\${w}`);return S===!0&&(a.unescape===!0?q=q.replace(/\\/g,""):q=q.replace(/\\+/g,w=>w.length%2===0?"\\\\":w?"\\":"")),q===m&&a.contains===!0?(d.output=m,d):(d.output=e.wrapOutput(q,d,v),d)}for(;!et();){if(f=ct(),f==="\0")continue;if(f==="\\"){const w=I();if(w==="/"&&a.bash!==!0||w==="."||w===";")continue;if(!w){f+="\\",N({type:"text",value:f});continue}const L=/^\\+/.exec(lt());let X=0;if(L&&L[0].length>2&&(X=L[0].length,d.index+=X,X%2!==0&&(f+="\\")),a.unescape===!0?f=ct():f+=ct(),d.brackets===0){N({type:"text",value:f});continue}}if(d.brackets>0&&(f!=="]"||p.value==="["||p.value==="[^")){if(a.posix!==!1&&f===":"){const w=p.value.slice(1);if(w.includes("[")&&(p.posix=!0,w.includes(":"))){const L=p.value.lastIndexOf("["),X=p.value.slice(0,L),Q=p.value.slice(L+2),j=n[Q];if(j){p.value=X+j,d.backtrack=!0,ct(),!_.output&&T.indexOf(p)===1&&(_.output=K);continue}}}(f==="["&&I()!==":"||f==="-"&&I()==="]")&&(f=`\\${f}`),f==="]"&&(p.value==="["||p.value==="[^")&&(f=`\\${f}`),a.posix===!0&&f==="!"&&p.value==="["&&(f="^"),p.value+=f,de({value:f});continue}if(d.quotes===1&&f!=='"'){f=e.escapeRegex(f),p.value+=f,de({value:f});continue}if(f==='"'){d.quotes=d.quotes===1?0:1,a.keepQuotes===!0&&N({type:"text",value:f});continue}if(f==="("){ge("parens"),N({type:"paren",value:f});continue}if(f===")"){if(d.parens===0&&a.strictBrackets===!0)throw new SyntaxError(u("opening","("));const w=z[z.length-1];if(w&&d.parens===w.parens+1){vn(z.pop());continue}N({type:"paren",value:f,output:d.parens?")":"\\)"}),vt("parens");continue}if(f==="["){if(a.nobracket===!0||!lt().includes("]")){if(a.nobracket!==!0&&a.strictBrackets===!0)throw new SyntaxError(u("closing","]"));f=`\\${f}`}else ge("brackets");N({type:"bracket",value:f});continue}if(f==="]"){if(a.nobracket===!0||p&&p.type==="bracket"&&p.value.length===1){N({type:"text",value:f,output:`\\${f}`});continue}if(d.brackets===0){if(a.strictBrackets===!0)throw new SyntaxError(u("opening","["));N({type:"text",value:f,output:`\\${f}`});continue}vt("brackets");const w=p.value.slice(1);if(p.posix!==!0&&w[0]==="^"&&!w.includes("/")&&(f=`/${f}`),p.value+=f,de({value:f}),a.literalBrackets===!1||e.hasRegexChars(w))continue;const L=e.escapeRegex(p.value);if(d.output=d.output.slice(0,-p.value.length),a.literalBrackets===!0){d.output+=L,p.value=L;continue}p.value=`(${x}${L}|${p.value})`,d.output+=p.value;continue}if(f==="{"&&a.nobrace!==!0){ge("braces");const w={type:"brace",value:f,output:"(",outputIndex:d.output.length,tokensIndex:d.tokens.length};G.push(w),N(w);continue}if(f==="}"){const w=G[G.length-1];if(a.nobrace===!0||!w){N({type:"text",value:f,output:f});continue}let L=")";if(w.dots===!0){const X=T.slice(),Q=[];for(let j=X.length-1;j>=0&&(T.pop(),X[j].type!=="brace");j--)X[j].type!=="dots"&&Q.unshift(X[j].value);L=c(Q,a),d.backtrack=!0}if(w.comma!==!0&&w.dots!==!0){const X=d.output.slice(0,w.outputIndex),Q=d.tokens.slice(w.tokensIndex);w.value=w.output="\\{",f=L="\\}",d.output=X;for(const j of Q)d.output+=j.output||j.value}N({type:"brace",value:f,output:L}),vt("braces"),G.pop();continue}if(f==="|"){z.length>0&&z[z.length-1].conditions++,N({type:"text",value:f});continue}if(f===","){let w=f;const L=G[G.length-1];L&&bt[bt.length-1]==="braces"&&(L.comma=!0,w="|"),N({type:"comma",value:f,output:w});continue}if(f==="/"){if(p.type==="dot"&&d.index===d.start+1){d.start=d.index+1,d.consumed="",d.output="",T.pop(),p=_;continue}N({type:"slash",value:f,output:rt});continue}if(f==="."){if(d.braces>0&&p.type==="dot"){p.value==="."&&(p.output=nt);const w=G[G.length-1];p.type="dots",p.output+=f,p.value+=f,w.dots=!0;continue}if(d.braces+d.parens===0&&p.type!=="bos"&&p.type!=="slash"){N({type:"text",value:f,output:nt});continue}N({type:"dot",value:f,output:nt});continue}if(f==="?"){if(!(p&&p.value==="(")&&a.noextglob!==!0&&I()==="("&&I(2)!=="?"){ye("qmark",f);continue}if(p&&p.type==="paren"){const w=I();let L=f;(p.value==="("&&!/[!=<:]/.test(w)||w==="<"&&!/<([!=]|\w+>)/.test(lt()))&&(L=`\\${f}`),N({type:"text",value:f,output:L});continue}if(a.dot!==!0&&(p.type==="slash"||p.type==="bos")){N({type:"qmark",value:f,output:at});continue}N({type:"qmark",value:f,output:W});continue}if(f==="!"){if(a.noextglob!==!0&&I()==="("&&(I(2)!=="?"||!/[!=<:]/.test(I(3)))){ye("negate",f);continue}if(a.nonegate!==!0&&d.index===0){bn();continue}}if(f==="+"){if(a.noextglob!==!0&&I()==="("&&I(2)!=="?"){ye("plus",f);continue}if(p&&p.value==="("||a.regex===!1){N({type:"plus",value:f,output:gt});continue}if(p&&(p.type==="bracket"||p.type==="paren"||p.type==="brace")||d.parens>0){N({type:"plus",value:f});continue}N({type:"plus",value:gt});continue}if(f==="@"){if(a.noextglob!==!0&&I()==="("&&I(2)!=="?"){N({type:"at",extglob:!0,value:f,output:""});continue}N({type:"text",value:f});continue}if(f!=="*"){(f==="$"||f==="^")&&(f=`\\${f}`);const w=o.exec(lt());w&&(f+=w[0],d.index+=w[0].length),N({type:"text",value:f});continue}if(p&&(p.type==="globstar"||p.star===!0)){p.type="star",p.star=!0,p.value+=f,p.output=Y,d.backtrack=!0,d.globstar=!0,st(f);continue}let S=lt();if(a.noextglob!==!0&&/^\([^?]/.test(S)){ye("star",f);continue}if(p.type==="star"){if(a.noglobstar===!0){st(f);continue}const w=p.prev,L=w.prev,X=w.type==="slash"||w.type==="bos",Q=L&&(L.type==="star"||L.type==="globstar");if(a.bash===!0&&(!X||S[0]&&S[0]!=="/")){N({type:"star",value:f,output:""});continue}const j=d.braces>0&&(w.type==="comma"||w.type==="brace"),pt=z.length&&(w.type==="pipe"||w.type==="paren");if(!X&&w.type!=="paren"&&!j&&!pt){N({type:"star",value:f,output:""});continue}for(;S.slice(0,3)==="/**";){const ft=m[d.index+4];if(ft&&ft!=="/")break;S=S.slice(3),st("/**",3)}if(w.type==="bos"&&et()){p.type="globstar",p.value+=f,p.output=J(a),d.output=p.output,d.globstar=!0,st(f);continue}if(w.type==="slash"&&w.prev.type!=="bos"&&!Q&&et()){d.output=d.output.slice(0,-(w.output+p.output).length),w.output=`(?:${w.output}`,p.type="globstar",p.output=J(a)+(a.strictSlashes?")":"|$)"),p.value+=f,d.globstar=!0,d.output+=w.output+p.output,st(f);continue}if(w.type==="slash"&&w.prev.type!=="bos"&&S[0]==="/"){const ft=S[1]!==void 0?"|$":"";d.output=d.output.slice(0,-(w.output+p.output).length),w.output=`(?:${w.output}`,p.type="globstar",p.output=`${J(a)}${rt}|${rt}${ft})`,p.value+=f,d.output+=w.output+p.output,d.globstar=!0,st(f+ct()),N({type:"slash",value:"/",output:""});continue}if(w.type==="bos"&&S[0]==="/"){p.type="globstar",p.value+=f,p.output=`(?:^|${rt}|${J(a)}${rt})`,d.output=p.output,d.globstar=!0,st(f+ct()),N({type:"slash",value:"/",output:""});continue}if(j&&S[0]==="/"){p.type="globstar",p.value+=f,p.output=`(?:^|${rt}|${J(a)}${rt})`,d.output+=p.output,d.globstar=!0,st(f+ct()),N({type:"slash",value:"/",output:""});continue}d.output=d.output.slice(0,-p.output.length),p.type="globstar",p.output=J(a),p.value+=f,d.output+=p.output,d.globstar=!0,st(f);continue}const q={type:"star",value:f,output:Y};if(a.bash===!0){q.output=".*?",(p.type==="bos"||p.type==="slash")&&(q.output=k+q.output),N(q);continue}if(p&&(p.type==="bracket"||p.type==="paren")&&a.regex===!0){q.output=f,N(q);continue}(d.index===d.start||p.type==="slash"||p.type==="dot")&&(p.type==="dot"?(d.output+=ut,p.output+=ut):a.dot===!0?(d.output+=it,p.output+=it):(d.output+=k,p.output+=k),I()!=="*"&&(d.output+=K,p.output+=K)),N(q)}for(;d.brackets>0;){if(a.strictBrackets===!0)throw new SyntaxError(u("closing","]"));d.output=e.escapeLast(d.output,"["),vt("brackets")}for(;d.parens>0;){if(a.strictBrackets===!0)throw new SyntaxError(u("closing",")"));d.output=e.escapeLast(d.output,"("),vt("parens")}for(;d.braces>0;){if(a.strictBrackets===!0)throw new SyntaxError(u("closing","}"));d.output=e.escapeLast(d.output,"{"),vt("braces")}if(a.strictSlashes!==!0&&(p.type==="star"||p.type==="bracket")&&N({type:"maybe_slash",value:"",output:`${rt}?`}),d.backtrack===!0){d.output="";for(const S of d.tokens)d.output+=S.output!=null?S.output:S.value,S.suffix&&(d.output+=S.suffix)}return d};return D.fastpaths=(m,v)=>{const a={...v},A=typeof a.maxLength=="number"?Math.min(s,a.maxLength):s,O=m.length;if(O>A)throw new SyntaxError(`Input length: ${O}, exceeds maximum allowed length: ${A}`);m=i[m]||m;const{DOT_LITERAL:_,SLASH_LITERAL:T,ONE_CHAR:x,DOTS_SLASH:B,NO_DOT:U,NO_DOTS:nt,NO_DOTS_SLASH:gt,STAR:rt,START_ANCHOR:K}=t.globChars(a.windows),ot=a.dot?nt:U,mt=a.dot?gt:U,ut=a.capture?"":"?:",it={negated:!1,prefix:""};let W=a.bash===!0?".*?":rt;a.capture&&(W=`(${W})`);const at=k=>k.noglobstar===!0?W:`(${ut}(?:(?!${K}${k.dot?B:_}).)*?)`,Z=k=>{switch(k){case"*":return`${ot}${x}${W}`;case".*":return`${_}${x}${W}`;case"*.*":return`${ot}${W}${_}${x}${W}`;case"*/*":return`${ot}${W}${T}${x}${mt}${W}`;case"**":return ot+at(a);case"**/*":return`(?:${ot}${at(a)}${T})?${mt}${x}${W}`;case"**/*.*":return`(?:${ot}${at(a)}${T})?${mt}${W}${_}${x}${W}`;case"**/.*":return`(?:${ot}${at(a)}${T})?${_}${x}${W}`;default:{const M=/^(.*?)\.(\w+)$/.exec(k);if(!M)return;const Y=Z(M[1]);return Y?Y+_+M[2]:void 0}}},$t=e.removePrefix(m,it);let J=Z($t);return J&&a.strictSlashes!==!0&&(J+=`${T}?`),J},Le=D,Le}var De,as;function co(){if(as)return De;as=1;const t=oo(),e=io(),s=Ae(),n=Ee(),o=i=>i&&typeof i=="object"&&!Array.isArray(i),r=(i,c,u=!1)=>{if(Array.isArray(i)){const R=i.map(C=>r(C,c,u));return C=>{for(const D of R){const m=D(C);if(m)return m}return!1}}const y=o(i)&&i.tokens&&i.input;if(i===""||typeof i!="string"&&!y)throw new TypeError("Expected pattern to be a non-empty string");const l=c||{},h=l.windows,$=y?r.compileRe(i,c):r.makeRe(i,c,!1,!0),g=$.state;delete $.state;let b=()=>!1;if(l.ignore){const R={...c,ignore:null,onMatch:null,onResult:null};b=r(l.ignore,R,u)}const E=(R,C=!1)=>{const{isMatch:D,match:m,output:v}=r.test(R,$,c,{glob:i,posix:h}),a={glob:i,state:g,regex:$,posix:h,input:R,output:v,match:m,isMatch:D};if(typeof l.onResult=="function"&&l.onResult(a),D===!1)return a.isMatch=!1,C?a:!1;t:if(b(R)){if(typeof l.onIgnore=="function"&&l.onIgnore(a)===n.UNIGNORE){a.isMatch=!0;break t}return a.isMatch=!1,C?a:!1}return typeof l.onMatch=="function"&&l.onMatch(a),C?a:!0};return u&&(E.state=g),E};return r.test=(i,c,u,{glob:y,posix:l}={})=>{if(typeof i!="string")throw new TypeError("Expected input to be a string");if(i==="")return{isMatch:!1,output:""};const h=u||{},$=h.format||(l?s.toPosixSlashes:null);let g=i===y,b=g&&$?$(i):i;return g===!1&&(b=$?$(i):i,g=b===y),(g===!1||h.capture===!0)&&(h.matchBase===!0||h.basename===!0?g=r.matchBase(i,c,u,l):g=c.exec(b)),{isMatch:!!g,match:g,output:b}},r.matchBase=(i,c,u,y=u&&u.windows)=>(c instanceof RegExp?c:r.makeRe(c,u)).test(s.basename(i,{windows:y})),r.isMatch=(i,c,u)=>r(c,u)(i),r.parse=(i,c)=>Array.isArray(i)?i.map(u=>r.parse(u,c)):e(i,{...c,fastpaths:!1}),r.scan=(i,c)=>t(i,c),r.compileRe=(i,c,u=!1,y=!1)=>{if(u===!0)return i.output;const l=c||{},h=l.contains?"":"^",$=l.contains?"":"$";let g=`${h}(?:${i.output})${$}`;i&&i.negated===!0&&(g=`^(?!${g}).*$`);const b=r.toRegex(g,c);return y===!0&&(b.state=i),b},r.makeRe=(i,c={},u=!1,y=!1)=>{if(!i||typeof i!="string")throw new TypeError("Expected a non-empty string");let l={negated:!1,fastpaths:!0};return c.fastpaths!==!1&&(i[0]==="."||i[0]==="*")&&(l.output=e.fastpaths(i,c)),l.output||(l=e(i,c)),r.compileRe(l,c,u,y)},r.toRegex=(i,c)=>{try{const u=c||{};return new RegExp(i,u.flags||(u.nocase?"i":""))}catch(u){if(c&&c.debug===!0)throw u;return/$^/}},r.constants=n,De=r,De}var Fe,ls;function uo(){if(ls)return Fe;ls=1;const t=co(),e=Ae();function s(n,o,r=!1){return o&&(o.windows===null||o.windows===void 0)&&(o={...o,windows:e.isWindows()}),t(n,o,r)}return Object.assign(s,t),Fe=s,Fe}var ao=uo();const yt=Ke(ao);let lo;const po=t=>(lo??=H(import.meta.url))(t),Wt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,pe=t=>{if(typeof Wt<"u"&&Wt.versions&&Wt.versions.node){const[e,s]=Wt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Wt.getBuiltinModule(t)}return po(t)},ps=pe("fs"),fo={...ps,default:ps},{statSync:ho,stat:go,realpathSync:yo,realpath:mo,readdirSync:$o,readdir:bo}=pe("fs"),{sep:Gs,basename:vo,dirname:Ue,resolve:Us,normalize:wo,relative:So,posix:_t,isAbsolute:xo}=pe("path"),{fileURLToPath:Eo}=pe("url"),{createRequire:Ao}=pe("module");var fs=Ao(import.meta.url);function _o(t){let e=wo(t);return e.length>1&&e[e.length-1]===Gs&&(e=e.substring(0,e.length-1)),e}const To=/[\\/]/g;function zs(t,e){return t.replace(To,e)}const Ro=/^[a-z]:[\\/]$/i;function ko(t){return t==="/"||Ro.test(t)}function He(t,e){const{resolvePaths:s,normalizePath:n,pathSeparator:o}=e,r=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(s&&(t=Us(t)),(n||r)&&(t=_o(t)),t===".")return"";const i=t[t.length-1]!==o;return zs(i?t+o:t,o)}function qs(t,e){return e+t}function Co(t,e){return function(s,n){return n.startsWith(t)?n.slice(t.length)+s:zs(So(t,n),e.pathSeparator)+e.pathSeparator+s}}function Oo(t){return t}function No(t,e,s){return e+t+s}function Lo(t,e){const{relativePaths:s,includeBasePath:n}=e;return s&&t?Co(t,e):n?qs:Oo}function Do(t){return function(e,s){s.push(e.substring(t.length)||".")}}function Fo(t){return function(e,s,n){const o=e.substring(t.length)||".";n.every(r=>r(o,!0))&&s.push(o)}}const Ho=(t,e)=>{e.push(t||".")},Io=(t,e,s)=>{const n=t||".";s.every(o=>o(n,!0))&&e.push(n)},Bo=()=>{};function Mo(t,e){const{includeDirs:s,filters:n,relativePaths:o}=e;return s?o?n&&n.length?Fo(t):Do(t):n&&n.length?Io:Ho:Bo}const Po=(t,e,s,n)=>{n.every(o=>o(t,!1))&&s.files++},jo=(t,e,s,n)=>{n.every(o=>o(t,!1))&&e.push(t)},Go=(t,e,s,n)=>{s.files++},Uo=(t,e)=>{e.push(t)},zo=()=>{};function qo(t){const{excludeFiles:e,filters:s,onlyCounts:n}=t;return e?zo:s&&s.length?n?Po:jo:n?Go:Uo}const Wo=t=>t,Xo=()=>[""].slice(0,0);function Ko(t){return t.group?Xo:Wo}const Qo=(t,e,s)=>{t.push({directory:e,files:s,dir:e})},Vo=()=>{};function Yo(t){return t.group?Qo:Vo}const Zo=function(t,e,s){const{queue:n,fs:o,options:{suppressErrors:r}}=e;n.enqueue(),o.realpath(t,(i,c)=>{if(i)return n.dequeue(r?null:i,e);o.stat(c,(u,y)=>{if(u)return n.dequeue(r?null:u,e);if(y.isDirectory()&&Ws(t,c,e))return n.dequeue(null,e);s(y,c),n.dequeue(null,e)})})},Jo=function(t,e,s){const{queue:n,fs:o,options:{suppressErrors:r}}=e;n.enqueue();try{const i=o.realpathSync(t),c=o.statSync(i);if(c.isDirectory()&&Ws(t,i,e))return;s(c,i)}catch(i){if(!r)throw i}};function ti(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?Jo:Zo}function Ws(t,e,s){if(s.options.useRealPaths)return ei(e,s);let n=Ue(t),o=1;for(;n!==s.root&&o<2;){const r=s.symlinks.get(n);r&&(r===e||r.startsWith(e)||e.startsWith(r))?o++:n=Ue(n)}return s.symlinks.set(t,e),o>1}function ei(t,e){return e.visited.includes(t+e.options.pathSeparator)}const si=t=>t.counts,ni=t=>t.groups,ri=t=>t.paths,oi=t=>t.paths.slice(0,t.options.maxFiles),ii=(t,e,s)=>(_e(e,s,t.counts,t.options.suppressErrors),null),ci=(t,e,s)=>(_e(e,s,t.paths,t.options.suppressErrors),null),ui=(t,e,s)=>(_e(e,s,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),ai=(t,e,s)=>(_e(e,s,t.groups,t.options.suppressErrors),null);function _e(t,e,s,n){e(t&&!n?t:null,s)}function li(t,e){const{onlyCounts:s,group:n,maxFiles:o}=t;return s?e?si:ii:n?e?ni:ai:o?e?oi:ui:e?ri:ci}const Xs={withFileTypes:!0},pi=(t,e,s,n,o)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);const{fs:r}=t;t.visited.push(e),t.counts.directories++,r.readdir(e||".",Xs,(i,c=[])=>{o(c,s,n),t.queue.dequeue(t.options.suppressErrors?null:i,t)})},fi=(t,e,s,n,o)=>{const{fs:r}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let i=[];try{i=r.readdirSync(e||".",Xs)}catch(c){if(!t.options.suppressErrors)throw c}o(i,s,n)};function hi(t){return t?fi:pi}var di=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},gi=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},yi=class{aborted=!1;abort(){this.aborted=!0}},Ks=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(e,s,n){this.isSynchronous=!n,this.callbackInvoker=li(s,this.isSynchronous),this.root=He(e,s),this.state={root:ko(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new gi,options:s,queue:new di((o,r)=>this.callbackInvoker(r,o,n)),symlinks:new Map,visited:[""].slice(0,0),controller:new yi,fs:s.fs||fo},this.joinPath=Lo(this.root,s),this.pushDirectory=Mo(this.root,s),this.pushFile=qo(s),this.getArray=Ko(s),this.groupFiles=Yo(s),this.resolveSymlink=ti(s,this.isSynchronous),this.walkDirectory=hi(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(e,s,n)=>{const{paths:o,options:{filters:r,resolveSymlinks:i,excludeSymlinks:c,exclude:u,maxFiles:y,signal:l,useRealPaths:h,pathSeparator:$},controller:g}=this.state;if(g.aborted||l&&l.aborted||y&&o.length>y)return;const b=this.getArray(this.state.paths);for(let E=0;E<e.length;++E){const R=e[E];if(R.isFile()||R.isSymbolicLink()&&!i&&!c){const C=this.joinPath(R.name,s);this.pushFile(C,b,this.state.counts,r)}else if(R.isDirectory()){let C=No(R.name,s,this.state.options.pathSeparator);if(u&&u(R.name,C))continue;this.pushDirectory(C,o,r),this.walkDirectory(this.state,C,C,n-1,this.walk)}else if(this.resolveSymlink&&R.isSymbolicLink()){let C=qs(R.name,s);this.resolveSymlink(C,this.state,(D,m)=>{if(D.isDirectory()){if(m=He(m,this.state.options),u&&u(R.name,h?m:C+$))return;this.walkDirectory(this.state,m,h?m:C+$,n-1,this.walk)}else{m=h?m:C;const v=vo(m),a=He(Ue(m),this.state.options);m=this.joinPath(v,a),this.pushFile(m,b,this.state.counts,r)}})}}this.groupFiles(this.state.groups,s,b)}};function mi(t,e){return new Promise((s,n)=>{Qs(t,e,(o,r)=>{if(o)return n(o);s(r)})})}function Qs(t,e,s){new Ks(t,e,s).start()}function $i(t,e){return new Ks(t,e).start()}var hs=class{constructor(e,s){this.root=e,this.options=s}withPromise(){return mi(this.root,this.options)}withCallback(e){Qs(this.root,this.options,e)}sync(){return $i(this.root,this.options)}};let Vs=null;try{fs.resolve("picomatch"),Vs=fs("picomatch")}catch{}var bi=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:Gs,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new hs(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new hs(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){const s=this.globFunction||Vs;if(!s)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=s(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(o=>n(o)),this}};const vi=Array.isArray,Ys=/\\/g,wi=/^[A-Za-z]:$/,Zs=process.platform==="win32",Si=/^(\/?\.\.)+$/;function ds(t,e={}){const s=t.length,n=Array(s),o=Array(s);let r,i;for(r=0;r<s;r++){const c=Js(t[r]);n[r]=c;const u=c.length,y=Array(u);for(i=0;i<u;i++)y[i]=yt(c[i],e);o[r]=y}return c=>{const u=c.split("/");if(u[0]===".."&&Si.test(c))return!0;for(r=0;r<s;r++){const y=n[r],l=o[r],h=u.length,$=Math.min(h,y.length);for(i=0;i<$;){const g=y[i];if(g.includes("/"))return!0;if(!l[i](u[i]))break;if(!e.noglobstar&&g==="**")return!0;i++}if(i===h)return!0}return!1}}const xi=/^[A-Z]:\/$/i,Ei=Zs?t=>xi.test(t):t=>t==="/";function gs(t,e,s){if(t===e||e.startsWith(`${t}/`)){if(s){const o=t.length+ +!Ei(t);return(r,i)=>r.slice(o,i?-1:void 0)||"."}const n=e.slice(t.length+1);return n?(o,r)=>{if(o===".")return n;const i=`${n}/${o}`;return r?i.slice(0,-1):i}:(o,r)=>r&&o!=="."?o.slice(0,-1):o}return s?n=>_t.relative(t,n)||".":n=>_t.relative(t,`${e}/${n}`)||"."}function Ai(t,e){if(e.startsWith(`${t}/`)){const s=e.slice(t.length+1);return n=>`${s}/${n}`}return s=>{const n=_t.relative(t,`${e}/${s}`);return s[s.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function ys(t){return t.replace(wi,e=>`${e}/`)}const _i={parts:!0};function Js(t){var e;const s=yt.scan(t,_i);return!((e=s.parts)===null||e===void 0)&&e.length?s.parts:[t]}const Ti=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,Ri=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,ki=t=>t.replace(Ti,"\\$&"),Ci=t=>t.replace(Ri,"\\$&"),Oi=Zs?Ci:ki;function Ni(t,e){const s=yt.scan(t);return s.isGlob||s.negated}function ue(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function tn(t){return typeof t=="string"?[t]:t??[]}const Li=/^(\/?\.\.)+/,Di=/\\(?=[()[\]{}!*+?@|])/g;function Ie(t,e,s,n){var o;const r=e.cwd;let i=t;t[t.length-1]==="/"&&(i=t.slice(0,-1));const c=i.lastIndexOf("/"),u=(c===-1?i:i.slice(c+1)).startsWith("!(");i[i.length-1]!=="*"&&!u&&e.expandDirectories&&(i+="/**");const y=Oi(r);i=xo(i.replace(Di,""))?_t.relative(y,i):_t.normalize(i);const l=(o=Li.exec(i))===null||o===void 0?void 0:o[0],h=Js(i);if(l){const g=(l.length+1)/3;let b=0;const E=y.split("/");for(;b<g&&h[b+g]===E[E.length+b-g];)i=i.slice(0,(g-b-1)*3)+i.slice((g-b)*3+h[b+g].length+1)||".",b++;const R=_t.join(r,l.slice(b*3));R[0]!=="."&&s.root.length>R.length&&(s.root=ys(R),s.depthOffset=-g+b)}if(!n&&s.depthOffset>=0){var $;($=s.commonPath)!==null&&$!==void 0||(s.commonPath=h);const g=[],b=Math.min(s.commonPath.length,h.length);for(let E=0;E<b;E++){const R=h[E];if(R==="**"&&!h[E+1]){g.pop();break}if(E===h.length-1||R!==s.commonPath[E]||Ni(R))break;g.push(R)}s.depthOffset=g.length,s.commonPath=g,s.root=ys(g.length>0?_t.join(r,...g):r)}return i}function Fi(t,e,s){const n=[],o=[],r=[];for(const i of t.ignore)i&&(i[0]!=="!"||i[1]==="("?o.push(Ie(i,t,s,!0)):r.push(i.slice(1)));for(const i of e)i&&(i[0]!=="!"||i[1]==="("?n.push(Ie(i,t,s,!1)):(i[1]!=="!"||i[2]==="(")&&o.push(Ie(i.slice(1),t,s,!0)));return{match:n,ignore:o,unignore:r}}function Hi(t,e){const s=t.cwd,n={root:s,depthOffset:0},o=Fi(t,e,n);t.debug&&ue("internal processing patterns:",o);const{absolute:r,caseSensitiveMatch:i,debug:c,dot:u,followSymbolicLinks:y,onlyDirectories:l}=t,h=n.root.replace(Ys,""),$={dot:u,nobrace:t.braceExpansion===!1,nocase:!i,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},g=o.unignore.length>0,b=g?yt(o.unignore,$):void 0,E=g?ds(o.unignore,$):void 0,R=yt(o.match,{...$,ignore:o.ignore,onIgnore:b?T=>b(T.output)&&yt.constants.UNIGNORE:void 0}),C=yt(o.ignore,$),D=ds(o.match,$),m=gs(s,h,r),v=r?m:gs(s,h,!0),a=o.match.length>0&&o.match.every(T=>T==="**"||T==="**/*"),A=o.ignore.length>0||g||!a?(T,x)=>{const B=v(x,!0);return B==="."||E&&E(B)?!1:!D(B)||C(B)}:void 0;let O;t.deep!==void 0&&(O=Math.round(t.deep-n.depthOffset));const _=new bi({filters:[c?(T,x)=>{const B=m(T,x),U=R(B);return U&&ue(`matched ${B}`),U}:(T,x)=>{const B=m(T,x);return R(B)}],exclude:c&&A?(T,x)=>{const B=A(T,x);return ue(`${B?"skipped":"crawling"} ${x}`),B}:A,fs:t.fs,pathSeparator:"/",relativePaths:!r,resolvePaths:r,includeBasePath:r,resolveSymlinks:y,excludeSymlinks:!y,excludeFiles:l,includeDirs:l||!t.onlyFiles,maxDepth:O,signal:t.signal}).crawl(h);return t.debug&&ue("internal properties:",{...n,root:h}),[_,s!==h&&!r&&Ai(s,h)]}function en(t,e){if(e)for(let s=t.length-1;s>=0;s--)t[s]=e(t[s]);return t}const ms={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function Ii(t){const e=Object.assign({},t);for(const s in ms)e[s]===void 0&&Object.assign(e,{[s]:ms[s]});return e.cwd=(e.cwd instanceof URL?Eo(e.cwd):Us(e.cwd||process.cwd())).replace(Ys,"/"),e.ignore=tn(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||bo,readdirSync:e.fs.readdirSync||$o,realpath:e.fs.realpath||mo,realpathSync:e.fs.realpathSync||yo,stat:e.fs.stat||go,statSync:e.fs.statSync||ho}),e.debug&&ue("globbing with options:",e),e}function sn(t,e={}){var s;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");const n=vi(t)||typeof t=="string",o=tn((s=n?t:t.patterns)!==null&&s!==void 0?s:"**/*"),r=Ii(n?e:t);return o.length>0?Hi(r,o):[]}async function Bi(t,e){const[s,n]=sn(t,e);return s?en(await s.withPromise(),n):[]}function Mi(t,e){const[s,n]=sn(t,e);return s?en(s.sync(),n):[]}const ja=async(t,e)=>await Bi(t,e),Ga=(t,e)=>Mi(t,e);var Be,$s;function Pi(){if($s)return Be;$s=1;/*!
|
|
3
|
+
`,Ca=Dr==="win32"?Ge:Is,Oa=t=>{const e=t.match(Hs);if(!e||e.length===0)return null;const s=e.filter(o=>o===Ge).length,n=e.length-s;return s>n?Ge:Is},Na=(t,e)=>t.replaceAll(Hs,e);let me=class extends Error{root;constructor(e,s){super(`${e instanceof Error?e.message:String(e)} for path "${s}"`),this.cause=e,this.root=s}get name(){return"WalkError"}set name(e){throw new Error("Cannot overwrite name of WalkError")}};const Fr=t=>{const e=[],s=new Set;let n=0;for(const c of t){if(c==="{")e.push(n);else if(c==="}"){const u=e.pop();u!==void 0&&(s.add(u),s.add(n))}n+=1}let o=0,r=0,i="";for(const c of t)c==="{"?s.has(r)?(i+="(",o+=1):i+=String.raw`\{`:c==="}"?s.has(r)?(i+=")",o-=1):i+=String.raw`\}`:c===","&&o>0?i+="|":i+=c,r+=1;return i},$e=t=>{const e=t.replace(/[$()+\\^]/g,String.raw`\$&`).replace(/\.\*/g,".([^/]*)").replace(/\*\*/g,"(.*)").replace(/(?<!\.)\*(?!\*)/g,"([^/]*)").replace(/\?/g,"[^/]").replace(/\.(?!\*)/g,String.raw`\.`),s=Fr(e).replace(/\[!(.*?)\]/g,"[^$1]");try{return new RegExp(`^${s}$`)}catch(n){throw new Error(`Invalid glob pattern: ${t}`,{cause:n})}};let Hr=class{name;path;#t;constructor(e,s,n){this.#t=e,this.name=s,this.path=n}isDirectory(){return this.#t.isDirectory()}isFile(){return this.#t.isFile()}isSymbolicLink(){return this.#t.isSymbolicLink()}};const kt=(t,e,s)=>new Hr(t,e,s),wt=(t,e,s,n)=>{if(Array.isArray(e)&&e.length>0&&!e.some(r=>t.endsWith(r)))return!1;const o=t.includes("\\")?t.replaceAll("\\","/"):t;return s&&!s.some(r=>r.test(o))?!1:!n?.some(r=>r.test(o))};let Ir;const Br=t=>(Ir??=H(import.meta.url))(t),Gt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Mr=t=>{if(typeof Gt<"u"&&Gt.versions&&Gt.versions.node){const[e,s]=Gt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Gt.getBuiltinModule(t)}return Br(t)},{readdir:Pr,realpath:jr,stat:Bs}=Mr("node:fs/promises"),Gr=async t=>{const e=Tt(t),s=le(e),n=await Bs(e);return kt(n,s,e)};async function*Ms(t,e={}){const{extensions:s,followSymlinks:n=!1,includeDirs:o=!0,includeFiles:r=!0,includeSymlinks:i=!0,match:c,maxDepth:u=Number.POSITIVE_INFINITY,skip:y}=e;if(P(t),u<0)return;const l=e.visited??new Set,h=c?c.map(g=>typeof g=="string"?$e(g):g):void 0,$=y?y.map(g=>typeof g=="string"?$e(g):g):void 0;if(t=tt(F(t)),o&&wt(t,s,h,$)&&(yield await Gr(t)),!(u<1||!wt(t,void 0,void 0,$)))try{const g=await Pr(t,{withFileTypes:!0});for(const b of g){let E=Se(t,b.name),R=b,{name:C}=b,D=b.isDirectory(),m=b.isFile();if(b.isSymbolicLink())if(n){const v=Tt(await jr(E));if(l.has(v))continue;E=v;const a=await Bs(v);D=a.isDirectory(),m=a.isFile(),R=a,C=le(v)}else if(i&&wt(E,s,h,$)){yield kt(b,b.name,E);continue}else continue;D?(n&&l.add(E),yield*Ms(E,{extensions:s,followSymlinks:n,includeDirs:o,includeFiles:r,includeSymlinks:i,match:h,maxDepth:u-1,skip:$,visited:l})):m&&r&&wt(E,s,h,$)&&(yield kt(R,C,E))}}catch(g){throw g instanceof me?g:new me(g,t)}}const Fa=async(t,e={})=>{Array.isArray(e.extensions)||(e.extensions=["js","mjs","cjs","ts"]);const s=[];for await(const n of Ms(t,e))s.push(n.path);return s};let Ur;const qr=t=>(Ur??=H(import.meta.url))(t),Ut=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,zr=t=>{if(typeof Ut<"u"&&Ut.versions&&Ut.versions.node){const[e,s]=Ut.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Ut.getBuiltinModule(t)}return qr(t)},{readdirSync:Wr,realpathSync:Xr,statSync:Ps}=zr("node:fs"),Kr=t=>{const e=Tt(t),s=Ps(e);return kt(s,le(e),e)};function*js(t,e={}){const{extensions:s,followSymlinks:n=!1,includeDirs:o=!0,includeFiles:r=!0,includeSymlinks:i=!0,match:c,maxDepth:u=Number.POSITIVE_INFINITY,skip:y}=e;if(P(t),u<0)return;const l=e.visited??new Set,h=c?c.map(g=>typeof g=="string"?$e(g):g):void 0,$=y?y.map(g=>typeof g=="string"?$e(g):g):void 0;if(t=tt(F(t)),o&&wt(t,s,h,$)&&(yield Kr(t)),!(u<1||!wt(t,void 0,void 0,$)))try{const g=Wr(t,{withFileTypes:!0});for(const b of g){let E=Se(t,b.name),R=b,{name:C}=b,D=b.isDirectory(),m=b.isFile();if(b.isSymbolicLink())if(n){const v=Tt(Xr(E));if(l.has(v))continue;E=v;const a=Ps(v);D=a.isDirectory(),m=a.isFile(),R=a,C=le(v)}else if(i&&wt(E,s,h,$)){yield kt(b,b.name,Tt(E));continue}else continue;D?(n&&l.add(E),yield*js(E,{extensions:s,followSymlinks:n,includeDirs:o,includeFiles:r,includeSymlinks:i,match:h,maxDepth:u-1,skip:$,visited:l})):m&&r&&wt(E,s,h,$)&&(yield kt(R,C,Tt(E)))}}catch(g){throw g instanceof me?g:new me(g,t)}}const Ha=(t,e={})=>{Array.isArray(e.extensions)||(e.extensions=["js","mjs","cjs","ts"]);const s=[];for(const n of js(t,e))s.push(n.path);return s};let Qr;const Vr=t=>(Qr??=H(import.meta.url))(t),qt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Yr=t=>{if(typeof qt<"u"&&qt.versions&&qt.versions.node){const[e,s]=qt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return qt.getBuiltinModule(t)}return Vr(t)},{stat:Zr,lstat:Jr}=Yr("node:fs/promises"),Ia=async(t,e={})=>{if(typeof t!="string"&&!Array.isArray(t)&&typeof t!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");const s=e.cwd?F(e.cwd):process.cwd();let n=tt(s);const{root:o}=Ds(n),r=F(e.stopAt??o),i=tt(n,r),c=e.type??"file",u=async function(l){return typeof t=="function"?[await t(l)]:typeof t=="string"?[t]:Array.isArray(t)?t:[t]};e.allowSymlinks??=!0;const y=e.allowSymlinks?Zr:Jr;for(;n;){const l=await u(n);for(let h of l){if(h===Ns)return;if(h===void 0)continue;Buffer.isBuffer(h)?h=h.toString():h instanceof URL&&(h=F(h));const $=St(h)?h:tt(n,h);try{const g=await y($);if(c==="file"&&g.isFile()||c==="directory"&&g.isDirectory())return $}catch{}}if(n===i||n===o)break;n=V(n)}};let to;const eo=t=>(to??=H(import.meta.url))(t),zt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,so=t=>{if(typeof zt<"u"&&zt.versions&&zt.versions.node){const[e,s]=zt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return zt.getBuiltinModule(t)}return eo(t)},{statSync:no,lstatSync:ro}=so("node:fs"),Ba=(t,e={})=>{if(typeof t!="string"&&!Array.isArray(t)&&typeof t!="function")throw new TypeError("The `name` argument must be of type `string` or `string[]`");const s=e.cwd?F(e.cwd):process.cwd();let n=tt(s);const{root:o}=Ds(n),r=F(e.stopAt??o),i=tt(n,r),c=e.type??"file",u=function(l){return typeof t=="function"?[t(l)]:typeof t=="string"?[t]:Array.isArray(t)?t:[t]};e.allowSymlinks??=!0;const y=e.allowSymlinks?no:ro;for(;n;){for(let l of u(n)){if(l===Ns)return;if(l===void 0)continue;Buffer.isBuffer(l)?l=l.toString():l instanceof URL&&(l=F(l));const h=St(l)?l:tt(n,l);try{const $=y(h);if(c==="file"&&$.isFile()||c==="directory"&&$.isDirectory())return h}catch{}}if(n===i||n===o)break;n=V(n)}};function Ke(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var rs={},Oe,os;function Ee(){if(os)return Oe;os=1;const t="\\\\/",e=`[^${t}]`,s=0,n=Symbol("unignore"),o="\\.",r="\\+",i="\\?",c="\\/",u="(?=.)",y="[^/]",l=`(?:${c}|$)`,h=`(?:^|${c})`,$=`${o}{1,2}${l}`,g=`(?!${o})`,b=`(?!${h}${$})`,E=`(?!${o}{0,1}${l})`,R=`(?!${$})`,C=`[^.${c}]`,D=`${y}*?`,m={DOT_LITERAL:o,PLUS_LITERAL:r,QMARK_LITERAL:i,SLASH_LITERAL:c,ONE_CHAR:u,QMARK:y,END_ANCHOR:l,DOTS_SLASH:$,NO_DOT:g,NO_DOTS:b,NO_DOT_SLASH:E,NO_DOTS_SLASH:R,QMARK_NO_DOT:C,STAR:D,START_ANCHOR:h,SEP:"/"},v={...m,SLASH_LITERAL:`[${t}]`,QMARK:e,STAR:`${e}*?`,DOTS_SLASH:`${o}{1,2}(?:[${t}]|$)`,NO_DOT:`(?!${o})`,NO_DOTS:`(?!(?:^|[${t}])${o}{1,2}(?:[${t}]|$))`,NO_DOT_SLASH:`(?!${o}{0,1}(?:[${t}]|$))`,NO_DOTS_SLASH:`(?!${o}{1,2}(?:[${t}]|$))`,QMARK_NO_DOT:`[^.${t}]`,START_ANCHOR:`(?:^|[${t}])`,END_ANCHOR:`(?:[${t}]|$)`,SEP:"\\"},a={__proto__:null,alnum:"a-zA-Z0-9",alpha:"a-zA-Z",ascii:"\\x00-\\x7F",blank:" \\t",cntrl:"\\x00-\\x1F\\x7F",digit:"0-9",graph:"\\x21-\\x7E",lower:"a-z",print:"\\x20-\\x7E ",punct:"\\-!\"#$%&'()\\*+,./:;<=>?@[\\]^_`{|}~",space:" \\t\\r\\n\\v\\f",upper:"A-Z",word:"A-Za-z0-9_",xdigit:"A-Fa-f0-9"};return Oe={DEFAULT_MAX_EXTGLOB_RECURSION:s,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:a,UNIGNORE:n,REGEX_BACKSLASH:/\\(?![*+?^${}(|)[\]])/g,REGEX_NON_SPECIAL_CHARS:/^[^@![\].,$*+?^{}()|\\/]+/,REGEX_SPECIAL_CHARS:/[-*+?.^${}(|)[\]]/,REGEX_SPECIAL_CHARS_BACKREF:/(\\?)((\W)(\3*))/g,REGEX_SPECIAL_CHARS_GLOBAL:/([-*+?.^${}(|)[\]])/g,REGEX_REMOVE_BACKSLASH:/(?:\[.*?[^\\]\]|\\(?=.))/g,REPLACEMENTS:{__proto__:null,"***":"*","**/**":"**","**/**/**":"**"},CHAR_0:48,CHAR_9:57,CHAR_UPPERCASE_A:65,CHAR_LOWERCASE_A:97,CHAR_UPPERCASE_Z:90,CHAR_LOWERCASE_Z:122,CHAR_LEFT_PARENTHESES:40,CHAR_RIGHT_PARENTHESES:41,CHAR_ASTERISK:42,CHAR_AMPERSAND:38,CHAR_AT:64,CHAR_BACKWARD_SLASH:92,CHAR_CARRIAGE_RETURN:13,CHAR_CIRCUMFLEX_ACCENT:94,CHAR_COLON:58,CHAR_COMMA:44,CHAR_DOT:46,CHAR_DOUBLE_QUOTE:34,CHAR_EQUAL:61,CHAR_EXCLAMATION_MARK:33,CHAR_FORM_FEED:12,CHAR_FORWARD_SLASH:47,CHAR_GRAVE_ACCENT:96,CHAR_HASH:35,CHAR_HYPHEN_MINUS:45,CHAR_LEFT_ANGLE_BRACKET:60,CHAR_LEFT_CURLY_BRACE:123,CHAR_LEFT_SQUARE_BRACKET:91,CHAR_LINE_FEED:10,CHAR_NO_BREAK_SPACE:160,CHAR_PERCENT:37,CHAR_PLUS:43,CHAR_QUESTION_MARK:63,CHAR_RIGHT_ANGLE_BRACKET:62,CHAR_RIGHT_CURLY_BRACE:125,CHAR_RIGHT_SQUARE_BRACKET:93,CHAR_SEMICOLON:59,CHAR_SINGLE_QUOTE:39,CHAR_SPACE:32,CHAR_TAB:9,CHAR_UNDERSCORE:95,CHAR_VERTICAL_LINE:124,CHAR_ZERO_WIDTH_NOBREAK_SPACE:65279,extglobChars(A){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${A.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(A){return A===!0?v:m}},Oe}var is;function Ae(){return is||(is=1,(function(t){const{REGEX_BACKSLASH:e,REGEX_REMOVE_BACKSLASH:s,REGEX_SPECIAL_CHARS:n,REGEX_SPECIAL_CHARS_GLOBAL:o}=Ee();t.isObject=r=>r!==null&&typeof r=="object"&&!Array.isArray(r),t.hasRegexChars=r=>n.test(r),t.isRegexChar=r=>r.length===1&&t.hasRegexChars(r),t.escapeRegex=r=>r.replace(o,"\\$1"),t.toPosixSlashes=r=>r.replace(e,"/"),t.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const r=navigator.platform.toLowerCase();return r==="win32"||r==="windows"}return process.platform?process.platform==="win32":!1},t.removeBackslashes=r=>r.replace(s,i=>i==="\\"?"":i),t.escapeLast=(r,i,c)=>{const u=r.lastIndexOf(i,c);return u===-1?r:r[u-1]==="\\"?t.escapeLast(r,i,u-1):`${r.slice(0,u)}\\${r.slice(u)}`},t.removePrefix=(r,i={})=>{let c=r;return c.startsWith("./")&&(c=c.slice(2),i.prefix="./"),c},t.wrapOutput=(r,i={},c={})=>{const u=c.contains?"":"^",y=c.contains?"":"$";let l=`${u}(?:${r})${y}`;return i.negated===!0&&(l=`(?:^(?!${l}).*$)`),l},t.basename=(r,{windows:i}={})=>{const c=r.split(i?/[\\/]/:"/"),u=c[c.length-1];return u===""?c[c.length-2]:u}})(rs)),rs}var Ne,cs;function oo(){if(cs)return Ne;cs=1;const t=Ae(),{CHAR_ASTERISK:e,CHAR_AT:s,CHAR_BACKWARD_SLASH:n,CHAR_COMMA:o,CHAR_DOT:r,CHAR_EXCLAMATION_MARK:i,CHAR_FORWARD_SLASH:c,CHAR_LEFT_CURLY_BRACE:u,CHAR_LEFT_PARENTHESES:y,CHAR_LEFT_SQUARE_BRACKET:l,CHAR_PLUS:h,CHAR_QUESTION_MARK:$,CHAR_RIGHT_CURLY_BRACE:g,CHAR_RIGHT_PARENTHESES:b,CHAR_RIGHT_SQUARE_BRACKET:E}=Ee(),R=D=>D===c||D===n,C=D=>{D.isPrefix!==!0&&(D.depth=D.isGlobstar?1/0:1)};return Ne=(D,m)=>{const v=m||{},a=D.length-1,A=v.parts===!0||v.scanToEnd===!0,O=[],_=[],T=[];let x=D,B=-1,U=0,nt=0,gt=!1,rt=!1,K=!1,ot=!1,mt=!1,ut=!1,it=!1,W=!1,at=!1,Z=!1,$t=0,J,k,M={value:"",depth:0,isGlob:!1};const Y=()=>B>=a,d=()=>x.charCodeAt(B+1),q=()=>(J=k,x.charCodeAt(++B));for(;B<a;){k=q();let et;if(k===n){it=M.backslashes=!0,k=q(),k===u&&(ut=!0);continue}if(ut===!0||k===u){for($t++;Y()!==!0&&(k=q());){if(k===n){it=M.backslashes=!0,q();continue}if(k===u){$t++;continue}if(ut!==!0&&k===r&&(k=q())===r){if(gt=M.isBrace=!0,K=M.isGlob=!0,Z=!0,A===!0)continue;break}if(ut!==!0&&k===o){if(gt=M.isBrace=!0,K=M.isGlob=!0,Z=!0,A===!0)continue;break}if(k===g&&($t--,$t===0)){ut=!1,gt=M.isBrace=!0,Z=!0;break}}if(A===!0)continue;break}if(k===c){if(O.push(B),_.push(M),M={value:"",depth:0,isGlob:!1},Z===!0)continue;if(J===r&&B===U+1){U+=2;continue}nt=B+1;continue}if(v.noext!==!0&&(k===h||k===s||k===e||k===$||k===i)&&d()===y){if(K=M.isGlob=!0,ot=M.isExtglob=!0,Z=!0,k===i&&B===U&&(at=!0),A===!0){for(;Y()!==!0&&(k=q());){if(k===n){it=M.backslashes=!0,k=q();continue}if(k===b){K=M.isGlob=!0,Z=!0;break}}continue}break}if(k===e){if(J===e&&(mt=M.isGlobstar=!0),K=M.isGlob=!0,Z=!0,A===!0)continue;break}if(k===$){if(K=M.isGlob=!0,Z=!0,A===!0)continue;break}if(k===l){for(;Y()!==!0&&(et=q());){if(et===n){it=M.backslashes=!0,q();continue}if(et===E){rt=M.isBracket=!0,K=M.isGlob=!0,Z=!0;break}}if(A===!0)continue;break}if(v.nonegate!==!0&&k===i&&B===U){W=M.negated=!0,U++;continue}if(v.noparen!==!0&&k===y){if(K=M.isGlob=!0,A===!0){for(;Y()!==!0&&(k=q());){if(k===y){it=M.backslashes=!0,k=q();continue}if(k===b){Z=!0;break}}continue}break}if(K===!0){if(Z=!0,A===!0)continue;break}}v.noext===!0&&(ot=!1,K=!1);let G=x,bt="",p="";U>0&&(bt=x.slice(0,U),x=x.slice(U),nt-=U),G&&K===!0&&nt>0?(G=x.slice(0,nt),p=x.slice(nt)):K===!0?(G="",p=x):G=x,G&&G!==""&&G!=="/"&&G!==x&&R(G.charCodeAt(G.length-1))&&(G=G.slice(0,-1)),v.unescape===!0&&(p&&(p=t.removeBackslashes(p)),G&&it===!0&&(G=t.removeBackslashes(G)));const f={prefix:bt,input:D,start:U,base:G,glob:p,isBrace:gt,isBracket:rt,isGlob:K,isExtglob:ot,isGlobstar:mt,negated:W,negatedExtglob:at};if(v.tokens===!0&&(f.maxDepth=0,R(k)||_.push(M),f.tokens=_),v.parts===!0||v.tokens===!0){let et;for(let I=0;I<O.length;I++){const ct=et?et+1:U,lt=O[I],st=D.slice(ct,lt);v.tokens&&(I===0&&U!==0?(_[I].isPrefix=!0,_[I].value=bt):_[I].value=st,C(_[I]),f.maxDepth+=_[I].depth),(I!==0||st!=="")&&T.push(st),et=lt}if(et&&et+1<D.length){const I=D.slice(et+1);T.push(I),v.tokens&&(_[_.length-1].value=I,C(_[_.length-1]),f.maxDepth+=_[_.length-1].depth)}f.slashes=O,f.parts=T}return f},Ne}var Le,us;function io(){if(us)return Le;us=1;const t=Ee(),e=Ae(),{MAX_LENGTH:s,POSIX_REGEX_SOURCE:n,REGEX_NON_SPECIAL_CHARS:o,REGEX_SPECIAL_CHARS_BACKREF:r,REPLACEMENTS:i}=t,c=(m,v)=>{if(typeof v.expandRange=="function")return v.expandRange(...m,v);m.sort();const a=`[${m.join("-")}]`;try{new RegExp(a)}catch{return m.map(A=>e.escapeRegex(A)).join("..")}return a},u=(m,v)=>`Missing ${m}: "${v}" - use "\\\\${v}" to match literal characters`,y=m=>{const v=[];let a=0,A=0,O=0,_="",T=!1;for(const x of m){if(T===!0){_+=x,T=!1;continue}if(x==="\\"){_+=x,T=!0;continue}if(x==='"'){O=O===1?0:1,_+=x;continue}if(O===0){if(x==="[")a++;else if(x==="]"&&a>0)a--;else if(a===0){if(x==="(")A++;else if(x===")"&&A>0)A--;else if(x==="|"&&A===0){v.push(_),_="";continue}}}_+=x}return v.push(_),v},l=m=>{let v=!1;for(const a of m){if(v===!0){v=!1;continue}if(a==="\\"){v=!0;continue}if(/[?*+@!()[\]{}]/.test(a))return!1}return!0},h=m=>{let v=m.trim(),a=!0;for(;a===!0;)a=!1,/^@\([^\\()[\]{}|]+\)$/.test(v)&&(v=v.slice(2,-1),a=!0);if(l(v))return v.replace(/\\(.)/g,"$1")},$=m=>{const v=m.map(h).filter(Boolean);for(let a=0;a<v.length;a++)for(let A=a+1;A<v.length;A++){const O=v[a],_=v[A],T=O[0];if(!(!T||O!==T.repeat(O.length)||_!==T.repeat(_.length))&&(O===_||O.startsWith(_)||_.startsWith(O)))return!0}return!1},g=(m,v=!0)=>{if(m[0]!=="+"&&m[0]!=="*"||m[1]!=="(")return;let a=0,A=0,O=0,_=!1;for(let T=1;T<m.length;T++){const x=m[T];if(_===!0){_=!1;continue}if(x==="\\"){_=!0;continue}if(x==='"'){O=O===1?0:1;continue}if(O!==1){if(x==="["){a++;continue}if(x==="]"&&a>0){a--;continue}if(!(a>0)){if(x==="("){A++;continue}if(x===")"&&(A--,A===0))return v===!0&&T!==m.length-1?void 0:{type:m[0],body:m.slice(2,T),end:T}}}}},b=m=>`${m.length===1?e.escapeRegex(m[0]):`[${m.map(v=>e.escapeRegex(v)).join("")}]`}*`,E=m=>{let v=0;const a=[];for(;v<m.length;){const A=g(m.slice(v),!1);if(!A||A.type!=="*")return;const O=y(A.body).map(T=>T.trim());if(O.length!==1)return;const _=h(O[0]);if(!_||_.length!==1)return;a.push(_),v+=A.end+1}if(!(a.length<1))return a},R=m=>{let v=0,a=m.trim(),A=g(a);for(;A;)v++,a=A.body.trim(),A=g(a);return v},C=(m,v)=>{if(v.maxExtglobRecursion===!1)return{risky:!1};const a=typeof v.maxExtglobRecursion=="number"?v.maxExtglobRecursion:t.DEFAULT_MAX_EXTGLOB_RECURSION,A=y(m).map(x=>x.trim());if(A.length>1&&(A.some(x=>x==="")||A.some(x=>/^[*?]+$/.test(x))||$(A)))return{risky:!0};const O=[];let _=!1,T=!0;for(const x of A){const B=E(x);if(B){_=!0,O.push(...B);continue}const U=h(x);if(U&&U.length===1){O.push(U);continue}if(T=!1,R(x)>a)return{risky:!0}}return _?T?{risky:!0,safeOutput:b([...new Set(O)])}:{risky:!0}:{risky:!1}},D=(m,v)=>{if(typeof m!="string")throw new TypeError("Expected a string");m=i[m]||m;const a={...v},A=typeof a.maxLength=="number"?Math.min(s,a.maxLength):s;let O=m.length;if(O>A)throw new SyntaxError(`Input length: ${O}, exceeds maximum allowed length: ${A}`);const _={type:"bos",value:"",output:a.prepend||""},T=[_],x=a.capture?"":"?:",B=t.globChars(a.windows),U=t.extglobChars(B),{DOT_LITERAL:nt,PLUS_LITERAL:gt,SLASH_LITERAL:rt,ONE_CHAR:K,DOTS_SLASH:ot,NO_DOT:mt,NO_DOT_SLASH:ut,NO_DOTS_SLASH:it,QMARK:W,QMARK_NO_DOT:at,STAR:Z,START_ANCHOR:$t}=B,J=S=>`(${x}(?:(?!${$t}${S.dot?ot:nt}).)*?)`,k=a.dot?"":mt,M=a.dot?W:at;let Y=a.bash===!0?J(a):Z;a.capture&&(Y=`(${Y})`),typeof a.noext=="boolean"&&(a.noextglob=a.noext);const d={input:m,index:-1,start:0,dot:a.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:T};m=e.removePrefix(m,d),O=m.length;const q=[],G=[],bt=[];let p=_,f;const et=()=>d.index===O-1,I=d.peek=(S=1)=>m[d.index+S],ct=d.advance=()=>m[++d.index]||"",lt=()=>m.slice(d.index+1),st=(S="",z=0)=>{d.consumed+=S,d.index+=z},de=S=>{d.output+=S.output!=null?S.output:S.value,st(S.value)},bn=()=>{let S=1;for(;I()==="!"&&(I(2)!=="("||I(3)==="?");)ct(),d.start++,S++;return S%2===0?!1:(d.negated=!0,d.start++,!0)},ge=S=>{d[S]++,bt.push(S)},vt=S=>{d[S]--,bt.pop()},N=S=>{if(p.type==="globstar"){const z=d.braces>0&&(S.type==="comma"||S.type==="brace"),w=S.extglob===!0||q.length&&(S.type==="pipe"||S.type==="paren");S.type!=="slash"&&S.type!=="paren"&&!z&&!w&&(d.output=d.output.slice(0,-p.output.length),p.type="star",p.value="*",p.output=Y,d.output+=p.output)}if(q.length&&S.type!=="paren"&&(q[q.length-1].inner+=S.value),(S.value||S.output)&&de(S),p&&p.type==="text"&&S.type==="text"){p.output=(p.output||p.value)+S.value,p.value+=S.value;return}S.prev=p,T.push(S),p=S},ye=(S,z)=>{const w={...U[z],conditions:1,inner:""};w.prev=p,w.parens=d.parens,w.output=d.output,w.startIndex=d.index,w.tokensIndex=T.length;const L=(a.capture?"(":"")+w.open;ge("parens"),N({type:S,value:z,output:d.output?"":K}),N({type:"paren",extglob:!0,value:ct(),output:L}),q.push(w)},vn=S=>{const z=m.slice(S.startIndex,d.index+1),w=m.slice(S.startIndex+2,d.index),L=C(w,a);if((S.type==="plus"||S.type==="star")&&L.risky){const j=L.safeOutput?(S.output?"":K)+(a.capture?`(${L.safeOutput})`:L.safeOutput):void 0,pt=T[S.tokensIndex];pt.type="text",pt.value=z,pt.output=j||e.escapeRegex(z);for(let ft=S.tokensIndex+1;ft<T.length;ft++)T[ft].value="",T[ft].output="",delete T[ft].suffix;d.output=S.output+pt.output,d.backtrack=!0,N({type:"paren",extglob:!0,value:f,output:""}),vt("parens");return}let X=S.close+(a.capture?")":""),Q;if(S.type==="negate"){let j=Y;if(S.inner&&S.inner.length>1&&S.inner.includes("/")&&(j=J(a)),(j!==Y||et()||/^\)+$/.test(lt()))&&(X=S.close=`)$))${j}`),S.inner.includes("*")&&(Q=lt())&&/^\.[^\\/.]+$/.test(Q)){const pt=D(Q,{...v,fastpaths:!1}).output;X=S.close=`)${pt})${j})`}S.prev.type==="bos"&&(d.negatedExtglob=!0)}N({type:"paren",extglob:!0,value:f,output:X}),vt("parens")};if(a.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(m)){let S=!1,z=m.replace(r,(w,L,X,Q,j,pt)=>Q==="\\"?(S=!0,w):Q==="?"?L?L+Q+(j?W.repeat(j.length):""):pt===0?M+(j?W.repeat(j.length):""):W.repeat(X.length):Q==="."?nt.repeat(X.length):Q==="*"?L?L+Q+(j?Y:""):Y:L?w:`\\${w}`);return S===!0&&(a.unescape===!0?z=z.replace(/\\/g,""):z=z.replace(/\\+/g,w=>w.length%2===0?"\\\\":w?"\\":"")),z===m&&a.contains===!0?(d.output=m,d):(d.output=e.wrapOutput(z,d,v),d)}for(;!et();){if(f=ct(),f==="\0")continue;if(f==="\\"){const w=I();if(w==="/"&&a.bash!==!0||w==="."||w===";")continue;if(!w){f+="\\",N({type:"text",value:f});continue}const L=/^\\+/.exec(lt());let X=0;if(L&&L[0].length>2&&(X=L[0].length,d.index+=X,X%2!==0&&(f+="\\")),a.unescape===!0?f=ct():f+=ct(),d.brackets===0){N({type:"text",value:f});continue}}if(d.brackets>0&&(f!=="]"||p.value==="["||p.value==="[^")){if(a.posix!==!1&&f===":"){const w=p.value.slice(1);if(w.includes("[")&&(p.posix=!0,w.includes(":"))){const L=p.value.lastIndexOf("["),X=p.value.slice(0,L),Q=p.value.slice(L+2),j=n[Q];if(j){p.value=X+j,d.backtrack=!0,ct(),!_.output&&T.indexOf(p)===1&&(_.output=K);continue}}}(f==="["&&I()!==":"||f==="-"&&I()==="]")&&(f=`\\${f}`),f==="]"&&(p.value==="["||p.value==="[^")&&(f=`\\${f}`),a.posix===!0&&f==="!"&&p.value==="["&&(f="^"),p.value+=f,de({value:f});continue}if(d.quotes===1&&f!=='"'){f=e.escapeRegex(f),p.value+=f,de({value:f});continue}if(f==='"'){d.quotes=d.quotes===1?0:1,a.keepQuotes===!0&&N({type:"text",value:f});continue}if(f==="("){ge("parens"),N({type:"paren",value:f});continue}if(f===")"){if(d.parens===0&&a.strictBrackets===!0)throw new SyntaxError(u("opening","("));const w=q[q.length-1];if(w&&d.parens===w.parens+1){vn(q.pop());continue}N({type:"paren",value:f,output:d.parens?")":"\\)"}),vt("parens");continue}if(f==="["){if(a.nobracket===!0||!lt().includes("]")){if(a.nobracket!==!0&&a.strictBrackets===!0)throw new SyntaxError(u("closing","]"));f=`\\${f}`}else ge("brackets");N({type:"bracket",value:f});continue}if(f==="]"){if(a.nobracket===!0||p&&p.type==="bracket"&&p.value.length===1){N({type:"text",value:f,output:`\\${f}`});continue}if(d.brackets===0){if(a.strictBrackets===!0)throw new SyntaxError(u("opening","["));N({type:"text",value:f,output:`\\${f}`});continue}vt("brackets");const w=p.value.slice(1);if(p.posix!==!0&&w[0]==="^"&&!w.includes("/")&&(f=`/${f}`),p.value+=f,de({value:f}),a.literalBrackets===!1||e.hasRegexChars(w))continue;const L=e.escapeRegex(p.value);if(d.output=d.output.slice(0,-p.value.length),a.literalBrackets===!0){d.output+=L,p.value=L;continue}p.value=`(${x}${L}|${p.value})`,d.output+=p.value;continue}if(f==="{"&&a.nobrace!==!0){ge("braces");const w={type:"brace",value:f,output:"(",outputIndex:d.output.length,tokensIndex:d.tokens.length};G.push(w),N(w);continue}if(f==="}"){const w=G[G.length-1];if(a.nobrace===!0||!w){N({type:"text",value:f,output:f});continue}let L=")";if(w.dots===!0){const X=T.slice(),Q=[];for(let j=X.length-1;j>=0&&(T.pop(),X[j].type!=="brace");j--)X[j].type!=="dots"&&Q.unshift(X[j].value);L=c(Q,a),d.backtrack=!0}if(w.comma!==!0&&w.dots!==!0){const X=d.output.slice(0,w.outputIndex),Q=d.tokens.slice(w.tokensIndex);w.value=w.output="\\{",f=L="\\}",d.output=X;for(const j of Q)d.output+=j.output||j.value}N({type:"brace",value:f,output:L}),vt("braces"),G.pop();continue}if(f==="|"){q.length>0&&q[q.length-1].conditions++,N({type:"text",value:f});continue}if(f===","){let w=f;const L=G[G.length-1];L&&bt[bt.length-1]==="braces"&&(L.comma=!0,w="|"),N({type:"comma",value:f,output:w});continue}if(f==="/"){if(p.type==="dot"&&d.index===d.start+1){d.start=d.index+1,d.consumed="",d.output="",T.pop(),p=_;continue}N({type:"slash",value:f,output:rt});continue}if(f==="."){if(d.braces>0&&p.type==="dot"){p.value==="."&&(p.output=nt);const w=G[G.length-1];p.type="dots",p.output+=f,p.value+=f,w.dots=!0;continue}if(d.braces+d.parens===0&&p.type!=="bos"&&p.type!=="slash"){N({type:"text",value:f,output:nt});continue}N({type:"dot",value:f,output:nt});continue}if(f==="?"){if(!(p&&p.value==="(")&&a.noextglob!==!0&&I()==="("&&I(2)!=="?"){ye("qmark",f);continue}if(p&&p.type==="paren"){const w=I();let L=f;(p.value==="("&&!/[!=<:]/.test(w)||w==="<"&&!/<([!=]|\w+>)/.test(lt()))&&(L=`\\${f}`),N({type:"text",value:f,output:L});continue}if(a.dot!==!0&&(p.type==="slash"||p.type==="bos")){N({type:"qmark",value:f,output:at});continue}N({type:"qmark",value:f,output:W});continue}if(f==="!"){if(a.noextglob!==!0&&I()==="("&&(I(2)!=="?"||!/[!=<:]/.test(I(3)))){ye("negate",f);continue}if(a.nonegate!==!0&&d.index===0){bn();continue}}if(f==="+"){if(a.noextglob!==!0&&I()==="("&&I(2)!=="?"){ye("plus",f);continue}if(p&&p.value==="("||a.regex===!1){N({type:"plus",value:f,output:gt});continue}if(p&&(p.type==="bracket"||p.type==="paren"||p.type==="brace")||d.parens>0){N({type:"plus",value:f});continue}N({type:"plus",value:gt});continue}if(f==="@"){if(a.noextglob!==!0&&I()==="("&&I(2)!=="?"){N({type:"at",extglob:!0,value:f,output:""});continue}N({type:"text",value:f});continue}if(f!=="*"){(f==="$"||f==="^")&&(f=`\\${f}`);const w=o.exec(lt());w&&(f+=w[0],d.index+=w[0].length),N({type:"text",value:f});continue}if(p&&(p.type==="globstar"||p.star===!0)){p.type="star",p.star=!0,p.value+=f,p.output=Y,d.backtrack=!0,d.globstar=!0,st(f);continue}let S=lt();if(a.noextglob!==!0&&/^\([^?]/.test(S)){ye("star",f);continue}if(p.type==="star"){if(a.noglobstar===!0){st(f);continue}const w=p.prev,L=w.prev,X=w.type==="slash"||w.type==="bos",Q=L&&(L.type==="star"||L.type==="globstar");if(a.bash===!0&&(!X||S[0]&&S[0]!=="/")){N({type:"star",value:f,output:""});continue}const j=d.braces>0&&(w.type==="comma"||w.type==="brace"),pt=q.length&&(w.type==="pipe"||w.type==="paren");if(!X&&w.type!=="paren"&&!j&&!pt){N({type:"star",value:f,output:""});continue}for(;S.slice(0,3)==="/**";){const ft=m[d.index+4];if(ft&&ft!=="/")break;S=S.slice(3),st("/**",3)}if(w.type==="bos"&&et()){p.type="globstar",p.value+=f,p.output=J(a),d.output=p.output,d.globstar=!0,st(f);continue}if(w.type==="slash"&&w.prev.type!=="bos"&&!Q&&et()){d.output=d.output.slice(0,-(w.output+p.output).length),w.output=`(?:${w.output}`,p.type="globstar",p.output=J(a)+(a.strictSlashes?")":"|$)"),p.value+=f,d.globstar=!0,d.output+=w.output+p.output,st(f);continue}if(w.type==="slash"&&w.prev.type!=="bos"&&S[0]==="/"){const ft=S[1]!==void 0?"|$":"";d.output=d.output.slice(0,-(w.output+p.output).length),w.output=`(?:${w.output}`,p.type="globstar",p.output=`${J(a)}${rt}|${rt}${ft})`,p.value+=f,d.output+=w.output+p.output,d.globstar=!0,st(f+ct()),N({type:"slash",value:"/",output:""});continue}if(w.type==="bos"&&S[0]==="/"){p.type="globstar",p.value+=f,p.output=`(?:^|${rt}|${J(a)}${rt})`,d.output=p.output,d.globstar=!0,st(f+ct()),N({type:"slash",value:"/",output:""});continue}if(j&&S[0]==="/"){p.type="globstar",p.value+=f,p.output=`(?:^|${rt}|${J(a)}${rt})`,d.output+=p.output,d.globstar=!0,st(f+ct()),N({type:"slash",value:"/",output:""});continue}d.output=d.output.slice(0,-p.output.length),p.type="globstar",p.output=J(a),p.value+=f,d.output+=p.output,d.globstar=!0,st(f);continue}const z={type:"star",value:f,output:Y};if(a.bash===!0){z.output=".*?",(p.type==="bos"||p.type==="slash")&&(z.output=k+z.output),N(z);continue}if(p&&(p.type==="bracket"||p.type==="paren")&&a.regex===!0){z.output=f,N(z);continue}(d.index===d.start||p.type==="slash"||p.type==="dot")&&(p.type==="dot"?(d.output+=ut,p.output+=ut):a.dot===!0?(d.output+=it,p.output+=it):(d.output+=k,p.output+=k),I()!=="*"&&(d.output+=K,p.output+=K)),N(z)}for(;d.brackets>0;){if(a.strictBrackets===!0)throw new SyntaxError(u("closing","]"));d.output=e.escapeLast(d.output,"["),vt("brackets")}for(;d.parens>0;){if(a.strictBrackets===!0)throw new SyntaxError(u("closing",")"));d.output=e.escapeLast(d.output,"("),vt("parens")}for(;d.braces>0;){if(a.strictBrackets===!0)throw new SyntaxError(u("closing","}"));d.output=e.escapeLast(d.output,"{"),vt("braces")}if(a.strictSlashes!==!0&&(p.type==="star"||p.type==="bracket")&&N({type:"maybe_slash",value:"",output:`${rt}?`}),d.backtrack===!0){d.output="";for(const S of d.tokens)d.output+=S.output!=null?S.output:S.value,S.suffix&&(d.output+=S.suffix)}return d};return D.fastpaths=(m,v)=>{const a={...v},A=typeof a.maxLength=="number"?Math.min(s,a.maxLength):s,O=m.length;if(O>A)throw new SyntaxError(`Input length: ${O}, exceeds maximum allowed length: ${A}`);m=i[m]||m;const{DOT_LITERAL:_,SLASH_LITERAL:T,ONE_CHAR:x,DOTS_SLASH:B,NO_DOT:U,NO_DOTS:nt,NO_DOTS_SLASH:gt,STAR:rt,START_ANCHOR:K}=t.globChars(a.windows),ot=a.dot?nt:U,mt=a.dot?gt:U,ut=a.capture?"":"?:",it={negated:!1,prefix:""};let W=a.bash===!0?".*?":rt;a.capture&&(W=`(${W})`);const at=k=>k.noglobstar===!0?W:`(${ut}(?:(?!${K}${k.dot?B:_}).)*?)`,Z=k=>{switch(k){case"*":return`${ot}${x}${W}`;case".*":return`${_}${x}${W}`;case"*.*":return`${ot}${W}${_}${x}${W}`;case"*/*":return`${ot}${W}${T}${x}${mt}${W}`;case"**":return ot+at(a);case"**/*":return`(?:${ot}${at(a)}${T})?${mt}${x}${W}`;case"**/*.*":return`(?:${ot}${at(a)}${T})?${mt}${W}${_}${x}${W}`;case"**/.*":return`(?:${ot}${at(a)}${T})?${_}${x}${W}`;default:{const M=/^(.*?)\.(\w+)$/.exec(k);if(!M)return;const Y=Z(M[1]);return Y?Y+_+M[2]:void 0}}},$t=e.removePrefix(m,it);let J=Z($t);return J&&a.strictSlashes!==!0&&(J+=`${T}?`),J},Le=D,Le}var De,as;function co(){if(as)return De;as=1;const t=oo(),e=io(),s=Ae(),n=Ee(),o=i=>i&&typeof i=="object"&&!Array.isArray(i),r=(i,c,u=!1)=>{if(Array.isArray(i)){const R=i.map(C=>r(C,c,u));return C=>{for(const D of R){const m=D(C);if(m)return m}return!1}}const y=o(i)&&i.tokens&&i.input;if(i===""||typeof i!="string"&&!y)throw new TypeError("Expected pattern to be a non-empty string");const l=c||{},h=l.windows,$=y?r.compileRe(i,c):r.makeRe(i,c,!1,!0),g=$.state;delete $.state;let b=()=>!1;if(l.ignore){const R={...c,ignore:null,onMatch:null,onResult:null};b=r(l.ignore,R,u)}const E=(R,C=!1)=>{const{isMatch:D,match:m,output:v}=r.test(R,$,c,{glob:i,posix:h}),a={glob:i,state:g,regex:$,posix:h,input:R,output:v,match:m,isMatch:D};if(typeof l.onResult=="function"&&l.onResult(a),D===!1)return a.isMatch=!1,C?a:!1;t:if(b(R)){if(typeof l.onIgnore=="function"&&l.onIgnore(a)===n.UNIGNORE){a.isMatch=!0;break t}return a.isMatch=!1,C?a:!1}return typeof l.onMatch=="function"&&l.onMatch(a),C?a:!0};return u&&(E.state=g),E};return r.test=(i,c,u,{glob:y,posix:l}={})=>{if(typeof i!="string")throw new TypeError("Expected input to be a string");if(i==="")return{isMatch:!1,output:""};const h=u||{},$=h.format||(l?s.toPosixSlashes:null);let g=i===y,b=g&&$?$(i):i;return g===!1&&(b=$?$(i):i,g=b===y),(g===!1||h.capture===!0)&&(h.matchBase===!0||h.basename===!0?g=r.matchBase(i,c,u,l):g=c.exec(b)),{isMatch:!!g,match:g,output:b}},r.matchBase=(i,c,u,y=u&&u.windows)=>(c instanceof RegExp?c:r.makeRe(c,u)).test(s.basename(i,{windows:y})),r.isMatch=(i,c,u)=>r(c,u)(i),r.parse=(i,c)=>Array.isArray(i)?i.map(u=>r.parse(u,c)):e(i,{...c,fastpaths:!1}),r.scan=(i,c)=>t(i,c),r.compileRe=(i,c,u=!1,y=!1)=>{if(u===!0)return i.output;const l=c||{},h=l.contains?"":"^",$=l.contains?"":"$";let g=`${h}(?:${i.output})${$}`;i&&i.negated===!0&&(g=`^(?!${g}).*$`);const b=r.toRegex(g,c);return y===!0&&(b.state=i),b},r.makeRe=(i,c={},u=!1,y=!1)=>{if(!i||typeof i!="string")throw new TypeError("Expected a non-empty string");let l={negated:!1,fastpaths:!0};return c.fastpaths!==!1&&(i[0]==="."||i[0]==="*")&&(l.output=e.fastpaths(i,c)),l.output||(l=e(i,c)),r.compileRe(l,c,u,y)},r.toRegex=(i,c)=>{try{const u=c||{};return new RegExp(i,u.flags||(u.nocase?"i":""))}catch(u){if(c&&c.debug===!0)throw u;return/$^/}},r.constants=n,De=r,De}var Fe,ls;function uo(){if(ls)return Fe;ls=1;const t=co(),e=Ae();function s(n,o,r=!1){return o&&(o.windows===null||o.windows===void 0)&&(o={...o,windows:e.isWindows()}),t(n,o,r)}return Object.assign(s,t),Fe=s,Fe}var ao=uo();const yt=Ke(ao);let lo;const po=t=>(lo??=H(import.meta.url))(t),Wt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,pe=t=>{if(typeof Wt<"u"&&Wt.versions&&Wt.versions.node){const[e,s]=Wt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Wt.getBuiltinModule(t)}return po(t)},ps=pe("fs"),fo={...ps,default:ps},{statSync:ho,stat:go,realpathSync:yo,realpath:mo,readdirSync:$o,readdir:bo}=pe("fs"),{sep:Gs,basename:vo,dirname:Ue,resolve:Us,normalize:wo,relative:So,posix:_t,isAbsolute:xo}=pe("path"),{fileURLToPath:Eo}=pe("url"),{createRequire:Ao}=pe("module");var fs=Ao(import.meta.url);function _o(t){let e=wo(t);return e.length>1&&e[e.length-1]===Gs&&(e=e.substring(0,e.length-1)),e}const To=/[\\/]/g;function qs(t,e){return t.replace(To,e)}const Ro=/^[a-z]:[\\/]$/i;function ko(t){return t==="/"||Ro.test(t)}function He(t,e){const{resolvePaths:s,normalizePath:n,pathSeparator:o}=e,r=process.platform==="win32"&&t.includes("/")||t.startsWith(".");if(s&&(t=Us(t)),(n||r)&&(t=_o(t)),t===".")return"";const i=t[t.length-1]!==o;return qs(i?t+o:t,o)}function zs(t,e){return e+t}function Co(t,e){return function(s,n){return n.startsWith(t)?n.slice(t.length)+s:qs(So(t,n),e.pathSeparator)+e.pathSeparator+s}}function Oo(t){return t}function No(t,e,s){return e+t+s}function Lo(t,e){const{relativePaths:s,includeBasePath:n}=e;return s&&t?Co(t,e):n?zs:Oo}function Do(t){return function(e,s){s.push(e.substring(t.length)||".")}}function Fo(t){return function(e,s,n){const o=e.substring(t.length)||".";n.every(r=>r(o,!0))&&s.push(o)}}const Ho=(t,e)=>{e.push(t||".")},Io=(t,e,s)=>{const n=t||".";s.every(o=>o(n,!0))&&e.push(n)},Bo=()=>{};function Mo(t,e){const{includeDirs:s,filters:n,relativePaths:o}=e;return s?o?n&&n.length?Fo(t):Do(t):n&&n.length?Io:Ho:Bo}const Po=(t,e,s,n)=>{n.every(o=>o(t,!1))&&s.files++},jo=(t,e,s,n)=>{n.every(o=>o(t,!1))&&e.push(t)},Go=(t,e,s,n)=>{s.files++},Uo=(t,e)=>{e.push(t)},qo=()=>{};function zo(t){const{excludeFiles:e,filters:s,onlyCounts:n}=t;return e?qo:s&&s.length?n?Po:jo:n?Go:Uo}const Wo=t=>t,Xo=()=>[""].slice(0,0);function Ko(t){return t.group?Xo:Wo}const Qo=(t,e,s)=>{t.push({directory:e,files:s,dir:e})},Vo=()=>{};function Yo(t){return t.group?Qo:Vo}const Zo=function(t,e,s){const{queue:n,fs:o,options:{suppressErrors:r}}=e;n.enqueue(),o.realpath(t,(i,c)=>{if(i)return n.dequeue(r?null:i,e);o.stat(c,(u,y)=>{if(u)return n.dequeue(r?null:u,e);if(y.isDirectory()&&Ws(t,c,e))return n.dequeue(null,e);s(y,c),n.dequeue(null,e)})})},Jo=function(t,e,s){const{queue:n,fs:o,options:{suppressErrors:r}}=e;n.enqueue();try{const i=o.realpathSync(t),c=o.statSync(i);if(c.isDirectory()&&Ws(t,i,e))return;s(c,i)}catch(i){if(!r)throw i}};function ti(t,e){return!t.resolveSymlinks||t.excludeSymlinks?null:e?Jo:Zo}function Ws(t,e,s){if(s.options.useRealPaths)return ei(e,s);let n=Ue(t),o=1;for(;n!==s.root&&o<2;){const r=s.symlinks.get(n);r&&(r===e||r.startsWith(e)||e.startsWith(r))?o++:n=Ue(n)}return s.symlinks.set(t,e),o>1}function ei(t,e){return e.visited.includes(t+e.options.pathSeparator)}const si=t=>t.counts,ni=t=>t.groups,ri=t=>t.paths,oi=t=>t.paths.slice(0,t.options.maxFiles),ii=(t,e,s)=>(_e(e,s,t.counts,t.options.suppressErrors),null),ci=(t,e,s)=>(_e(e,s,t.paths,t.options.suppressErrors),null),ui=(t,e,s)=>(_e(e,s,t.paths.slice(0,t.options.maxFiles),t.options.suppressErrors),null),ai=(t,e,s)=>(_e(e,s,t.groups,t.options.suppressErrors),null);function _e(t,e,s,n){e(t&&!n?t:null,s)}function li(t,e){const{onlyCounts:s,group:n,maxFiles:o}=t;return s?e?si:ii:n?e?ni:ai:o?e?oi:ui:e?ri:ci}const Xs={withFileTypes:!0},pi=(t,e,s,n,o)=>{if(t.queue.enqueue(),n<0)return t.queue.dequeue(null,t);const{fs:r}=t;t.visited.push(e),t.counts.directories++,r.readdir(e||".",Xs,(i,c=[])=>{o(c,s,n),t.queue.dequeue(t.options.suppressErrors?null:i,t)})},fi=(t,e,s,n,o)=>{const{fs:r}=t;if(n<0)return;t.visited.push(e),t.counts.directories++;let i=[];try{i=r.readdirSync(e||".",Xs)}catch(c){if(!t.options.suppressErrors)throw c}o(i,s,n)};function hi(t){return t?fi:pi}var di=class{count=0;constructor(t){this.onQueueEmpty=t}enqueue(){return this.count++,this.count}dequeue(t,e){this.onQueueEmpty&&(--this.count<=0||t)&&(this.onQueueEmpty(t,e),t&&(e.controller.abort(),this.onQueueEmpty=void 0))}},gi=class{_files=0;_directories=0;set files(t){this._files=t}get files(){return this._files}set directories(t){this._directories=t}get directories(){return this._directories}get dirs(){return this._directories}},yi=class{aborted=!1;abort(){this.aborted=!0}},Ks=class{root;isSynchronous;state;joinPath;pushDirectory;pushFile;getArray;groupFiles;resolveSymlink;walkDirectory;callbackInvoker;constructor(e,s,n){this.isSynchronous=!n,this.callbackInvoker=li(s,this.isSynchronous),this.root=He(e,s),this.state={root:ko(this.root)?this.root:this.root.slice(0,-1),paths:[""].slice(0,0),groups:[],counts:new gi,options:s,queue:new di((o,r)=>this.callbackInvoker(r,o,n)),symlinks:new Map,visited:[""].slice(0,0),controller:new yi,fs:s.fs||fo},this.joinPath=Lo(this.root,s),this.pushDirectory=Mo(this.root,s),this.pushFile=zo(s),this.getArray=Ko(s),this.groupFiles=Yo(s),this.resolveSymlink=ti(s,this.isSynchronous),this.walkDirectory=hi(this.isSynchronous)}start(){return this.pushDirectory(this.root,this.state.paths,this.state.options.filters),this.walkDirectory(this.state,this.root,this.root,this.state.options.maxDepth,this.walk),this.isSynchronous?this.callbackInvoker(this.state,null):null}walk=(e,s,n)=>{const{paths:o,options:{filters:r,resolveSymlinks:i,excludeSymlinks:c,exclude:u,maxFiles:y,signal:l,useRealPaths:h,pathSeparator:$},controller:g}=this.state;if(g.aborted||l&&l.aborted||y&&o.length>y)return;const b=this.getArray(this.state.paths);for(let E=0;E<e.length;++E){const R=e[E];if(R.isFile()||R.isSymbolicLink()&&!i&&!c){const C=this.joinPath(R.name,s);this.pushFile(C,b,this.state.counts,r)}else if(R.isDirectory()){let C=No(R.name,s,this.state.options.pathSeparator);if(u&&u(R.name,C))continue;this.pushDirectory(C,o,r),this.walkDirectory(this.state,C,C,n-1,this.walk)}else if(this.resolveSymlink&&R.isSymbolicLink()){let C=zs(R.name,s);this.resolveSymlink(C,this.state,(D,m)=>{if(D.isDirectory()){if(m=He(m,this.state.options),u&&u(R.name,h?m:C+$))return;this.walkDirectory(this.state,m,h?m:C+$,n-1,this.walk)}else{m=h?m:C;const v=vo(m),a=He(Ue(m),this.state.options);m=this.joinPath(v,a),this.pushFile(m,b,this.state.counts,r)}})}}this.groupFiles(this.state.groups,s,b)}};function mi(t,e){return new Promise((s,n)=>{Qs(t,e,(o,r)=>{if(o)return n(o);s(r)})})}function Qs(t,e,s){new Ks(t,e,s).start()}function $i(t,e){return new Ks(t,e).start()}var hs=class{constructor(e,s){this.root=e,this.options=s}withPromise(){return mi(this.root,this.options)}withCallback(e){Qs(this.root,this.options,e)}sync(){return $i(this.root,this.options)}};let Vs=null;try{fs.resolve("picomatch"),Vs=fs("picomatch")}catch{}var bi=class{globCache={};options={maxDepth:1/0,suppressErrors:!0,pathSeparator:Gs,filters:[]};globFunction;constructor(t){this.options={...this.options,...t},this.globFunction=this.options.globFunction}group(){return this.options.group=!0,this}withPathSeparator(t){return this.options.pathSeparator=t,this}withBasePath(){return this.options.includeBasePath=!0,this}withRelativePaths(){return this.options.relativePaths=!0,this}withDirs(){return this.options.includeDirs=!0,this}withMaxDepth(t){return this.options.maxDepth=t,this}withMaxFiles(t){return this.options.maxFiles=t,this}withFullPaths(){return this.options.resolvePaths=!0,this.options.includeBasePath=!0,this}withErrors(){return this.options.suppressErrors=!1,this}withSymlinks({resolvePaths:t=!0}={}){return this.options.resolveSymlinks=!0,this.options.useRealPaths=t,this.withFullPaths()}withAbortSignal(t){return this.options.signal=t,this}normalize(){return this.options.normalizePath=!0,this}filter(t){return this.options.filters.push(t),this}onlyDirs(){return this.options.excludeFiles=!0,this.options.includeDirs=!0,this}exclude(t){return this.options.exclude=t,this}onlyCounts(){return this.options.onlyCounts=!0,this}crawl(t){return new hs(t||".",this.options)}withGlobFunction(t){return this.globFunction=t,this}crawlWithOptions(t,e){return this.options={...this.options,...e},new hs(t||".",this.options)}glob(...t){return this.globFunction?this.globWithOptions(t):this.globWithOptions(t,{dot:!0})}globWithOptions(t,...e){const s=this.globFunction||Vs;if(!s)throw new Error("Please specify a glob function to use glob matching.");var n=this.globCache[t.join("\0")];return n||(n=s(t,...e),this.globCache[t.join("\0")]=n),this.options.filters.push(o=>n(o)),this}};const vi=Array.isArray,Ys=/\\/g,wi=/^[A-Za-z]:$/,Zs=process.platform==="win32",Si=/^(\/?\.\.)+$/;function ds(t,e={}){const s=t.length,n=Array(s),o=Array(s);let r,i;for(r=0;r<s;r++){const c=Js(t[r]);n[r]=c;const u=c.length,y=Array(u);for(i=0;i<u;i++)y[i]=yt(c[i],e);o[r]=y}return c=>{const u=c.split("/");if(u[0]===".."&&Si.test(c))return!0;for(r=0;r<s;r++){const y=n[r],l=o[r],h=u.length,$=Math.min(h,y.length);for(i=0;i<$;){const g=y[i];if(g.includes("/"))return!0;if(!l[i](u[i]))break;if(!e.noglobstar&&g==="**")return!0;i++}if(i===h)return!0}return!1}}const xi=/^[A-Z]:\/$/i,Ei=Zs?t=>xi.test(t):t=>t==="/";function gs(t,e,s){if(t===e||e.startsWith(`${t}/`)){if(s){const o=t.length+ +!Ei(t);return(r,i)=>r.slice(o,i?-1:void 0)||"."}const n=e.slice(t.length+1);return n?(o,r)=>{if(o===".")return n;const i=`${n}/${o}`;return r?i.slice(0,-1):i}:(o,r)=>r&&o!=="."?o.slice(0,-1):o}return s?n=>_t.relative(t,n)||".":n=>_t.relative(t,`${e}/${n}`)||"."}function Ai(t,e){if(e.startsWith(`${t}/`)){const s=e.slice(t.length+1);return n=>`${s}/${n}`}return s=>{const n=_t.relative(t,`${e}/${s}`);return s[s.length-1]==="/"&&n!==""?`${n}/`:n||"."}}function ys(t){return t.replace(wi,e=>`${e}/`)}const _i={parts:!0};function Js(t){var e;const s=yt.scan(t,_i);return!((e=s.parts)===null||e===void 0)&&e.length?s.parts:[t]}const Ti=/(?<!\\)([()[\]{}*?|]|^!|[!+@](?=\()|\\(?![()[\]{}!*+?@|]))/g,Ri=/(?<!\\)([()[\]{}]|^!|[!+@](?=\())/g,ki=t=>t.replace(Ti,"\\$&"),Ci=t=>t.replace(Ri,"\\$&"),Oi=Zs?Ci:ki;function Ni(t,e){const s=yt.scan(t);return s.isGlob||s.negated}function ue(...t){console.log(`[tinyglobby ${new Date().toLocaleTimeString("es")}]`,...t)}function tn(t){return typeof t=="string"?[t]:t??[]}const Li=/^(\/?\.\.)+/,Di=/\\(?=[()[\]{}!*+?@|])/g;function Ie(t,e,s,n){var o;const r=e.cwd;let i=t;t[t.length-1]==="/"&&(i=t.slice(0,-1));const c=i.lastIndexOf("/"),u=(c===-1?i:i.slice(c+1)).startsWith("!(");i[i.length-1]!=="*"&&!u&&e.expandDirectories&&(i+="/**");const y=Oi(r);i=xo(i.replace(Di,""))?_t.relative(y,i):_t.normalize(i);const l=(o=Li.exec(i))===null||o===void 0?void 0:o[0],h=Js(i);if(l){const g=(l.length+1)/3;let b=0;const E=y.split("/");for(;b<g&&h[b+g]===E[E.length+b-g];)i=i.slice(0,(g-b-1)*3)+i.slice((g-b)*3+h[b+g].length+1)||".",b++;const R=_t.join(r,l.slice(b*3));R[0]!=="."&&s.root.length>R.length&&(s.root=ys(R),s.depthOffset=-g+b)}if(!n&&s.depthOffset>=0){var $;($=s.commonPath)!==null&&$!==void 0||(s.commonPath=h);const g=[],b=Math.min(s.commonPath.length,h.length);for(let E=0;E<b;E++){const R=h[E];if(R==="**"&&!h[E+1]){g.pop();break}if(E===h.length-1||R!==s.commonPath[E]||Ni(R))break;g.push(R)}s.depthOffset=g.length,s.commonPath=g,s.root=ys(g.length>0?_t.join(r,...g):r)}return i}function Fi(t,e,s){const n=[],o=[],r=[];for(const i of t.ignore)i&&(i[0]!=="!"||i[1]==="("?o.push(Ie(i,t,s,!0)):r.push(i.slice(1)));for(const i of e)i&&(i[0]!=="!"||i[1]==="("?n.push(Ie(i,t,s,!1)):(i[1]!=="!"||i[2]==="(")&&o.push(Ie(i.slice(1),t,s,!0)));return{match:n,ignore:o,unignore:r}}function Hi(t,e){const s=t.cwd,n={root:s,depthOffset:0},o=Fi(t,e,n);t.debug&&ue("internal processing patterns:",o);const{absolute:r,caseSensitiveMatch:i,debug:c,dot:u,followSymbolicLinks:y,onlyDirectories:l}=t,h=n.root.replace(Ys,""),$={dot:u,nobrace:t.braceExpansion===!1,nocase:!i,noextglob:t.extglob===!1,noglobstar:t.globstar===!1,posix:!0},g=o.unignore.length>0,b=g?yt(o.unignore,$):void 0,E=g?ds(o.unignore,$):void 0,R=yt(o.match,{...$,ignore:o.ignore,onIgnore:b?T=>b(T.output)&&yt.constants.UNIGNORE:void 0}),C=yt(o.ignore,$),D=ds(o.match,$),m=gs(s,h,r),v=r?m:gs(s,h,!0),a=o.match.length>0&&o.match.every(T=>T==="**"||T==="**/*"),A=o.ignore.length>0||g||!a?(T,x)=>{const B=v(x,!0);return B==="."||E&&E(B)?!1:!D(B)||C(B)}:void 0;let O;t.deep!==void 0&&(O=Math.round(t.deep-n.depthOffset));const _=new bi({filters:[c?(T,x)=>{const B=m(T,x),U=R(B);return U&&ue(`matched ${B}`),U}:(T,x)=>{const B=m(T,x);return R(B)}],exclude:c&&A?(T,x)=>{const B=A(T,x);return ue(`${B?"skipped":"crawling"} ${x}`),B}:A,fs:t.fs,pathSeparator:"/",relativePaths:!r,resolvePaths:r,includeBasePath:r,resolveSymlinks:y,excludeSymlinks:!y,excludeFiles:l,includeDirs:l||!t.onlyFiles,maxDepth:O,signal:t.signal}).crawl(h);return t.debug&&ue("internal properties:",{...n,root:h}),[_,s!==h&&!r&&Ai(s,h)]}function en(t,e){if(e)for(let s=t.length-1;s>=0;s--)t[s]=e(t[s]);return t}const ms={caseSensitiveMatch:!0,debug:!!process.env.TINYGLOBBY_DEBUG,expandDirectories:!0,followSymbolicLinks:!0,onlyFiles:!0};function Ii(t){const e=Object.assign({},t);for(const s in ms)e[s]===void 0&&Object.assign(e,{[s]:ms[s]});return e.cwd=(e.cwd instanceof URL?Eo(e.cwd):Us(e.cwd||process.cwd())).replace(Ys,"/"),e.ignore=tn(e.ignore),e.fs&&(e.fs={readdir:e.fs.readdir||bo,readdirSync:e.fs.readdirSync||$o,realpath:e.fs.realpath||mo,realpathSync:e.fs.realpathSync||yo,stat:e.fs.stat||go,statSync:e.fs.statSync||ho}),e.debug&&ue("globbing with options:",e),e}function sn(t,e={}){var s;if(t&&e?.patterns)throw new Error("Cannot pass patterns as both an argument and an option");const n=vi(t)||typeof t=="string",o=tn((s=n?t:t.patterns)!==null&&s!==void 0?s:"**/*"),r=Ii(n?e:t);return o.length>0?Hi(r,o):[]}async function Bi(t,e){const[s,n]=sn(t,e);return s?en(await s.withPromise(),n):[]}function Mi(t,e){const[s,n]=sn(t,e);return s?en(s.sync(),n):[]}const ja=async(t,e)=>await Bi(t,e),Ga=(t,e)=>Mi(t,e);var Be,$s;function Pi(){if($s)return Be;$s=1;/*!
|
|
4
4
|
* is-extglob <https://github.com/jonschlinkert/is-extglob>
|
|
5
5
|
*
|
|
6
6
|
* Copyright (c) 2014-2016, Jon Schlinkert.
|
|
@@ -10,7 +10,7 @@ import{createRequire as wn}from"node:module";let Sn;const xn=t=>(Sn??=wn(import.
|
|
|
10
10
|
*
|
|
11
11
|
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
12
12
|
* Released under the MIT License.
|
|
13
|
-
*/var t=Pi(),e={"{":"}","(":")","[":"]"},s=function(o){if(o[0]==="!")return!0;for(var r=0,i=-2,c=-2,u=-2,y=-2,l=-2;r<o.length;){if(o[r]==="*"||o[r+1]==="?"&&/[\].+)]/.test(o[r])||c!==-1&&o[r]==="["&&o[r+1]!=="]"&&(c<r&&(c=o.indexOf("]",r)),c>r&&(l===-1||l>c||(l=o.indexOf("\\",r),l===-1||l>c)))||u!==-1&&o[r]==="{"&&o[r+1]!=="}"&&(u=o.indexOf("}",r),u>r&&(l=o.indexOf("\\",r),l===-1||l>u))||y!==-1&&o[r]==="("&&o[r+1]==="?"&&/[:!=]/.test(o[r+2])&&o[r+3]!==")"&&(y=o.indexOf(")",r),y>r&&(l=o.indexOf("\\",r),l===-1||l>y))||i!==-1&&o[r]==="("&&o[r+1]!=="|"&&(i<r&&(i=o.indexOf("|",r)),i!==-1&&o[i+1]!==")"&&(y=o.indexOf(")",i),y>i&&(l=o.indexOf("\\",i),l===-1||l>y))))return!0;if(o[r]==="\\"){var h=o[r+1];r+=2;var $=e[h];if($){var g=o.indexOf($,r);g!==-1&&(r=g+1)}if(o[r]==="!")return!0}else r++}return!1},n=function(o){if(o[0]==="!")return!0;for(var r=0;r<o.length;){if(/[*?{}()[\]]/.test(o[r]))return!0;if(o[r]==="\\"){var i=o[r+1];r+=2;var c=e[i];if(c){var u=o.indexOf(c,r);u!==-1&&(r=u+1)}if(o[r]==="!")return!0}else r++}return!1};return Me=function(o,r){if(typeof o!="string"||o==="")return!1;if(t(o))return!0;var i=s;return r&&r.strict===!1&&(i=n),i(o)},Me}let ji;const Gi=t=>(ji??=H(import.meta.url))(t),Xt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,rn=t=>{if(typeof Xt<"u"&&Xt.versions&&Xt.versions.node){const[e,s]=Xt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Xt.getBuiltinModule(t)}return Gi(t)},Ui=rn("path"),
|
|
13
|
+
*/var t=Pi(),e={"{":"}","(":")","[":"]"},s=function(o){if(o[0]==="!")return!0;for(var r=0,i=-2,c=-2,u=-2,y=-2,l=-2;r<o.length;){if(o[r]==="*"||o[r+1]==="?"&&/[\].+)]/.test(o[r])||c!==-1&&o[r]==="["&&o[r+1]!=="]"&&(c<r&&(c=o.indexOf("]",r)),c>r&&(l===-1||l>c||(l=o.indexOf("\\",r),l===-1||l>c)))||u!==-1&&o[r]==="{"&&o[r+1]!=="}"&&(u=o.indexOf("}",r),u>r&&(l=o.indexOf("\\",r),l===-1||l>u))||y!==-1&&o[r]==="("&&o[r+1]==="?"&&/[:!=]/.test(o[r+2])&&o[r+3]!==")"&&(y=o.indexOf(")",r),y>r&&(l=o.indexOf("\\",r),l===-1||l>y))||i!==-1&&o[r]==="("&&o[r+1]!=="|"&&(i<r&&(i=o.indexOf("|",r)),i!==-1&&o[i+1]!==")"&&(y=o.indexOf(")",i),y>i&&(l=o.indexOf("\\",i),l===-1||l>y))))return!0;if(o[r]==="\\"){var h=o[r+1];r+=2;var $=e[h];if($){var g=o.indexOf($,r);g!==-1&&(r=g+1)}if(o[r]==="!")return!0}else r++}return!1},n=function(o){if(o[0]==="!")return!0;for(var r=0;r<o.length;){if(/[*?{}()[\]]/.test(o[r]))return!0;if(o[r]==="\\"){var i=o[r+1];r+=2;var c=e[i];if(c){var u=o.indexOf(c,r);u!==-1&&(r=u+1)}if(o[r]==="!")return!0}else r++}return!1};return Me=function(o,r){if(typeof o!="string"||o==="")return!1;if(t(o))return!0;var i=s;return r&&r.strict===!1&&(i=n),i(o)},Me}let ji;const Gi=t=>(ji??=H(import.meta.url))(t),Xt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,rn=t=>{if(typeof Xt<"u"&&Xt.versions&&Xt.versions.node){const[e,s]=Xt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Xt.getBuiltinModule(t)}return Gi(t)},Ui=rn("path"),qi=rn("os");var Pe,vs;function zi(){if(vs)return Pe;vs=1;var t=nn(),e=Ui.posix.dirname,s=qi.platform()==="win32",n="/",o=/\\/g,r=/\\([!*?|[\](){}])/g;Pe=function(u,y){var l=Object.assign({flipBackslashes:!0},y);l.flipBackslashes&&s&&u.indexOf(n)<0&&(u=u.replace(o,n)),i(u)&&(u+=n),u+="a";do u=e(u);while(c(u));return u.replace(r,"$1")};function i(u){var y=u.slice(-1),l;switch(y){case"}":l="{";break;case"]":l="[";break;default:return!1}var h=u.indexOf(l);return h<0?!1:u.slice(h+1,-1).includes(n)}function c(u){return/\([^()]+$/.test(u)||u[0]==="{"||u[0]==="["||/[^\\][{[]/.test(u)?!0:t(u)}return Pe}var Wi=zi();const Xi=Ke(Wi),Ua=(t,e)=>Xi(t,e);let Ki;const Qi=t=>(Ki??=H(import.meta.url))(t),Kt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Vi=t=>{if(typeof Kt<"u"&&Kt.versions&&Kt.versions.node){const[e,s]=Kt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Kt.getBuiltinModule(t)}return Qi(t)},{access:Yi}=Vi("node:fs/promises");async function be(t,e=we){P(t),t=F(t);try{return await Yi(t,e),!0}catch{return!1}}let Zi;const Ji=t=>(Zi??=H(import.meta.url))(t),Qt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,tc=t=>{if(typeof Qt<"u"&&Qt.versions&&Qt.versions.node){const[e,s]=Qt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Qt.getBuiltinModule(t)}return Ji(t)},{accessSync:ec}=tc("node:fs");function ve(t,e=we){P(t),t=F(t);try{return ec(t,e),!0}catch{return!1}}var sc=nn();const nc=Ke(sc),qa=(t,e)=>nc(t,e),za=(t,e,s)=>{const n=yt(e,s);return Array.isArray(t)?t.some(o=>n(o)):n(t)},Wa=(t,e)=>{const s=yt(t,e);return n=>s(n)};let rc;const oc=t=>(rc??=H(import.meta.url))(t),Rt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,on=t=>{if(typeof Rt<"u"&&Rt.versions&&Rt.versions.node){const[e,s]=Rt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Rt.getBuiltinModule(t)}return oc(t)},{cwd:Te}=Rt,{mkdir:ic,rename:cc,copyFile:uc,unlink:ac}=on("node:fs/promises"),{mkdirSync:lc,renameSync:pc,copyFileSync:fc,unlinkSync:hc}=on("node:fs");let dc=class extends Error{constructor(e,s){super(`Source directory "${V(e)}" does not match destination directory "${V(s)}"`),this.name="SameDirectoryError"}};const cn=(t,e)=>{if(!t||!e)throw new Error("Source and destination paths must not be empty");if(V(t)!==V(e))throw new dc(t,e)},un=async(t,e,{cwd:s,directoryMode:n,overwrite:o,validateDirectory:r})=>{if(s&&(t=tt(s,t),e=tt(s,e)),r&&cn(t,e),!o&&await be(e))throw new Error(`The destination file exists: ${e}`);await ic(V(e),{mode:n,recursive:!0});try{await cc(t,e)}catch(i){if(i.code==="EXDEV")await uc(t,e),await ac(t);else throw i}},an=(t,e,{cwd:s,directoryMode:n,overwrite:o,validateDirectory:r})=>{if(s&&(t=tt(s,t),e=tt(s,e)),r&&cn(t,e),!o&&ve(e))throw new Error(`The destination file exists: ${e}`);lc(V(e),{mode:n,recursive:!0});try{pc(t,e)}catch(i){if(i.code==="EXDEV")fc(t,e),hc(t);else throw i}},Ka=async(t,e,s={})=>{const n={overwrite:!0,validateDirectory:!1,...s,cwd:s.cwd?F(s.cwd):Te()};await un(t,e,n)},Qa=(t,e,s)=>{const n={overwrite:!0,validateDirectory:!1,...s};n.cwd=n.cwd?F(n.cwd):Te(),an(t,e,n)},Va=async(t,e,s)=>{const n={overwrite:!0,...s,validateDirectory:!0};n.cwd=n.cwd?F(n.cwd):Te(),await un(t,e,n)},Ya=(t,e,s)=>{const n={overwrite:!0,...s,validateDirectory:!0};n.cwd=n.cwd?F(n.cwd):Te(),an(t,e,n)};let gc=class extends Error{constructor(e){super(`ENOENT: ${e}`)}get code(){return"ENOENT"}set code(e){throw new Error("Cannot overwrite code ENOENT")}get name(){return"NotFoundError"}set name(e){throw new Error("Cannot overwrite name of NotFoundError")}},yc=class extends Error{constructor(e){super(`EPERM: Operation not permitted, ${e}`)}get code(){return"EPERM"}set code(e){throw new Error("Cannot overwrite code EPERM")}get name(){return"PermissionError"}set name(e){throw new Error("Cannot overwrite name of PermissionError")}};const ln=(t,e)=>{const s=t?.code;return s==="ENOENT"?new gc(`no such file or directory, open '${e}'`):s==="EACCES"||s==="EPERM"?new yc(`unable to read the non-readable file: ${e}`):t};let mc;const $c=t=>(mc??=H(import.meta.url))(t),Vt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,pn=t=>{if(typeof Vt<"u"&&Vt.versions&&Vt.versions.node){const[e,s]=Vt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Vt.getBuiltinModule(t)}return $c(t)},{readFile:bc}=pn("node:fs/promises"),{unzip:vc,brotliDecompress:wc}=pn("node:zlib"),Sc={brotli:wc,gzip:vc,none:(t,e)=>{e(null,t)}},xc=async(t,e)=>{P(t),t=F(t);const{buffer:s,compression:n,encoding:o,flag:r}=e??{};let i;try{i=await bc(t,r?{flag:r}:{})}catch(c){throw ln(c,t)}return await new Promise((c,u)=>{Sc[n??"none"](i,(y,l)=>{y?u(y):c(s?l:l.toString(o??"utf8"))})})};let Ec;const Ac=t=>(Ec??=H(import.meta.url))(t),Yt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,fn=t=>{if(typeof Yt<"u"&&Yt.versions&&Yt.versions.node){const[e,s]=Yt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Yt.getBuiltinModule(t)}return Ac(t)},{readFileSync:_c}=fn("node:fs"),{unzipSync:Tc,brotliDecompressSync:Rc}=fn("node:zlib"),kc={brotli:Rc,gzip:Tc,none:t=>t},Cc=(t,e)=>{P(t),t=F(t);const{buffer:s,compression:n,encoding:o,flag:r}=e??{};let i;try{i=_c(t,r?{flag:r}:{})}catch(y){throw ln(y,t)}const c=kc[n??"none"],u=c(i);return s?u:u.toString(o??"utf8")},Oc=globalThis.process??Object.create(null),ws={versions:{}},Ss=new Proxy(Oc,{get(t,e){if(e in t)return t[e];if(e in ws)return ws[e]}}),Nc=t=>t.replaceAll(/\r\n|\r(?!\n)|\n/gu,`
|
|
14
14
|
`),Lc=(t,e,s,n)=>{const o={column:0,line:-1,...t.start},r={...o,...t.end},i=o.line,c=o.column,u=r.line,y=r.column;let l=Math.max(i-(s+1),0),h=Math.min(e.length,u+n);i===-1&&(l=0),u===-1&&(h=e.length);const $=u-i,g={};if($)for(let b=0;b<=$;b++){const E=b+i;if(!c)g[E]=!0;else if(b===0){const R=e[E-1]?.length;g[E]=[c,(R??0)-c+1]}else if(b===$)g[E]=[0,y];else{const R=e[E-b]?.length;g[E]=[0,R]}}else c===y?g[i]=c?[c,0]:!0:g[i]=[c,(y??0)-(c??0)];return{end:h,markerLines:g,start:l}},Dc=Ss.platform==="win32"&&!Ss.env?.WT_SESSION?">":"❯",Fc=(t,e,s)=>{const n={linesAbove:2,linesBelow:3,prefix:"",showGutter:!0,tabWidth:4,...s,color:{gutter:b=>b,marker:b=>b,message:b=>b,...s?.color}},o=typeof e.start.column=="number";let r=(t.includes("\r")?Nc(t):t).split(`
|
|
15
15
|
`);typeof n.tabWidth=="number"&&t.includes(" ")&&(r=r.map(b=>b.replaceAll(" "," ".repeat(n.tabWidth))));const{end:i,markerLines:c,start:u}=Lc(e,r,n.linesAbove,n.linesBelow),y=String(i).length,{gutter:l,marker:h,message:$}=n.color;let g=r.slice(u,i).map((b,E)=>{const R=u+1+E,C=c[R],D=String(R).padStart(y),m=!c[R+1],v=` ${D}${n.showGutter?" |":""}`;if(C){let a="";if(Array.isArray(C)){const A=b.replaceAll(/[^\t]/g," ").slice(0,Math.max(C[0]-1,0)),O=C[1]||1;a=[`
|
|
16
16
|
`,n.prefix+l(v.replaceAll(/\d/g," "))," ",A,h("^").repeat(O)].join(""),m&&n.message&&(a+=` ${$(n.message)}`)}return[n.prefix+h(Dc),l(v),b.length>0?` ${b}`:"",a].join("")}return`${n.prefix} ${l(v)}${b.length>0?` ${b}`:""}`}).join(`
|
|
@@ -18,10 +18,10 @@ import{createRequire as wn}from"node:module";let Sn;const xn=t=>(Sn??=wn(import.
|
|
|
18
18
|
${g}`),g},xs=(t,e)=>{let s=0,n=e.length-2;for(;s<n;){const o=s+(n-s>>1);if(t<e[o])n=o-1;else if(t>=e[o+1])s=o+1;else{s=o;break}}return s},Hc=/\n|\r(?!\n)/,Ic=t=>t.split(Hc).reduce((e,s)=>(e.push(e.at(-1)+s.length+1),e),[0]),Bc=(t,e,s)=>{if(!Array.isArray(t)&&typeof t!="string"||(typeof t=="string"||Array.isArray(t))&&t.length===0)return{column:0,line:0};if(typeof e!="number"||typeof t=="string"&&e>=t.length||Array.isArray(t)&&e+1>=t.at(-1))return{column:0,line:0};if(typeof t=="string"){const o=Ic(t),r=xs(e,o);return{column:e-o[r]+1,line:r+1}}const n=xs(e,t);return{column:e-t[n]+1,line:n+1}};class Mc extends Error{fileName;codeFrame;name="JSONError";#t;constructor(e){super(),this.#t=e}get message(){return`${this.#t}${this.fileName?` in ${this.fileName}`:""}${this.codeFrame?`
|
|
19
19
|
|
|
20
20
|
${this.codeFrame}
|
|
21
|
-
`:""}`}set message(e){this.#t=e}}const Pc=t=>String.raw`\u{${t.codePointAt(0).toString(16)}}`,jc=(t,e,s)=>Fc(t,{start:e},{tabWidth:!1,...s}),Gc=/in JSON at position (\d+)(?: \(line (\d+) column (\d+)\))?$/,Uc=(t,e)=>{const s=Gc.exec(e);if(!s)return;const[,n,o,r]=s;if(o&&r)return{column:Number(r),line:Number(o)};let i=Number(n);return i===t.length&&(i=t.length-1),Bc(t,i)},zc=/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,qc=t=>t.replace(zc,(e,s,n)=>`"${n}"(${Pc(n)})`);function hn(t,e,s,n){typeof e=="string"&&(typeof s=="object"&&(n=s),s=e,e=void 0);let o;try{return JSON.parse(t,e)}catch(c){o=c.message}let r;t?(r=Uc(t,o),o=qc(o)):o+=" while parsing empty string";const i=new Mc(o);throw i.fileName=s,r&&(i.codeFrame=jc(t,r,n)),i}async function tl(t,e,s){typeof e=="object"&&(s=e,e=void 0);const n=await xc(t,{buffer:!0,encoding:void 0});let o=new TextDecoder().decode(n);const{beforeParse:r,color:i}=s??{};return typeof r=="function"&&(o=r(o)),hn(o,e,F(t),{color:i})}function el(t,e,s){typeof e=="object"&&(s=e,e=void 0);const n=Cc(t,{buffer:!0,encoding:void 0});let o=new TextDecoder().decode(n);const{beforeParse:r,color:i}=s??{};return typeof r=="function"&&(o=r(o)),hn(o,e,F(t),{color:i})}const Re=t=>{const e={force:!0,recursive:!0};return t?.maxRetries!==void 0&&(e.maxRetries=t.maxRetries),t?.retryDelay!==void 0&&(e.retryDelay=t.retryDelay),e};let Wc;const Xc=t=>(Wc??=H(import.meta.url))(t),Zt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,dn=t=>{if(typeof Zt<"u"&&Zt.versions&&Zt.versions.node){const[e,s]=Zt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Zt.getBuiltinModule(t)}return Xc(t)},{existsSync:Kc}=dn("node:fs"),{mkdir:Qc,readdir:Vc,rm:Yc}=dn("node:fs/promises"),sl=async(t,e)=>{if(P(t),!Kc(t)){await Qc(t,{recursive:!0});return}const s=await Vc(t),n=Re(e);for(const o of s)await Yc(Se(F(t),o),n)};let Zc;const Jc=t=>(Zc??=H(import.meta.url))(t),Jt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,tu=t=>{if(typeof Jt<"u"&&Jt.versions&&Jt.versions.node){const[e,s]=Jt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Jt.getBuiltinModule(t)}return Jc(t)},{existsSync:eu,mkdirSync:su,readdirSync:nu,rmSync:ru}=tu("node:fs"),nl=(t,e)=>{if(P(t),!eu(t)){su(t,{recursive:!0});return}const s=Re(e);for(const n of nu(t))ru(Se(F(t),n),s)};let ou;const iu=t=>(ou??=H(import.meta.url))(t),te=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,cu=t=>{if(typeof te<"u"&&te.versions&&te.versions.node){const[e,s]=te.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return te.getBuiltinModule(t)}return iu(t)},{rm:uu}=cu("node:fs/promises"),rl=async(t,e={})=>{P(t),await uu(t,Re(e))};let au;const lu=t=>(au??=H(import.meta.url))(t),ee=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,pu=t=>{if(typeof ee<"u"&&ee.versions&&ee.versions.node){const[e,s]=ee.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return ee.getBuiltinModule(t)}return lu(t)},{rmSync:fu}=pu("node:fs"),ol=(t,e={})=>{P(t),fu(t,Re(e))},hu=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{platform:du}=hu,At="unnamed",gu=128,Es={'"':"ˮ","*":"⁎","/":"⁄",":":"꞉","<":"‹",">":"›","?":"ʔ","\\":"∖","|":"ǀ"},yu=/[\u0000-\u001F\u0080-\u009F]/g,mu=/^(?:\.+[/\\]+)+|^\.+$/g,ze=/^(?:con|prn|aux|nul|com\d|lpt\d)$/i,$u=/[<>:"/\\|?*]/g,bu=/\//g,ae=new Set([" "," ","."]),fe=(t,e)=>e>0&&e<t.length-1,vu=(t,e)=>{const s=t.lastIndexOf(".");if(!fe(t,s))return t.slice(0,e);const n=t.slice(0,s),o=t.slice(s),r=e-o.length;return r>0?`${n.slice(0,r)}${o}`:t.slice(0,e)},As=t=>{let e=0,s=t.length;for(;e<s;){const n=t[e];if(n===void 0||!ae.has(n))break;e+=1}for(;s>e;){const n=t[s-1];if(n===void 0||!ae.has(n))break;s-=1}return t.slice(e,s)},wu=t=>{const e=t.lastIndexOf(".");if(fe(t,e)){const n=t.slice(0,e),o=t.slice(e);let r=n;for(;r.length>0;){const i=r.at(-1);if(i===void 0||!ae.has(i))break;r=r.slice(0,-1)}return r.length===0?o.slice(1):`${r}${o}`}let s=t;for(;s.length>0;){const n=s.at(-1);if(n===void 0||!ae.has(n))break;s=s.slice(0,-1)}return s},Su=t=>{const e=t.lastIndexOf(".");if(fe(t,e))return!1;if(ze.test(t))return!0;let s=t;for(;s.length>0;){const n=s.at(-1);if(n===void 0||!ae.has(n))break;s=s.slice(0,-1)}return!!(s.length>0&&ze.test(s))},xu=t=>{const e=t.lastIndexOf(".");if(fe(t,e)){const o=t.slice(0,e),r=t.slice(e),i=As(o);return i.length===0?void 0:`${i}${r}`}const s=t.trim();if(s.length>0&&s[0]==="."&&s.length<=5&&s.indexOf(".",1)===-1)return;const n=As(t);if(n.length!==0)return n},Eu=t=>{const e=t?.filesystem??"auto";return e==="auto"?du==="win32"?"win32":"unix":e==="darwin"?"unix":e},il=(t,e)=>{if(typeof t!="string"||t.length===0)return At;const s=Eu(e);let n=t;if(n=n.replace(yu,""),n.length===0||(n=n.replace(mu,""),n.length===0))return At;if(s==="win32"||s==="fat32"){const r=n.lastIndexOf(".");if(!fe(n,r)&&ze.test(n))return At}if(n=s==="win32"||s==="fat32"?n.replaceAll($u,r=>Es[r]??""):n.replaceAll(bu,Es["/"]),n=n.trim(),(s==="win32"||s==="fat32")&&(Su(n)||s==="win32"&&(n=wu(n),n.length===0)))return At;if(s==="fat32"){const r=xu(n);if(r===void 0)return At;n=r}if(n.length===0)return At;const o=e?.maxLength??gu;return n.length>o&&(n=vu(n,o),n.length===0)?At:n},gn=t=>{if(typeof t!="string"&&!(t instanceof ArrayBuffer)&&!ArrayBuffer.isView(t))throw new TypeError("File contents must be a string, ArrayBuffer, or ArrayBuffer view.")};let Au;const _u=t=>(Au??=H(import.meta.url))(t),se=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Tu=t=>{if(typeof se<"u"&&se.versions&&se.versions.node){const[e,s]=se.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return se.getBuiltinModule(t)}return _u(t)},{randomBytes:Ru}=Tu("node:crypto"),yn=t=>`${t}.${process.pid.toString(36)}.${Ru(6).toString("hex")}.tmp`,ku=new TextEncoder,mn=t=>{if(t instanceof Uint8Array)return t;if(typeof t=="string")return ku.encode(t);if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t)){const e=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);return new Uint8Array(e)}throw new TypeError("Invalid contents type. Expected string or ArrayBuffer.")};let Cu;const Ou=t=>(Cu??=H(import.meta.url))(t),ne=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Nu=t=>{if(typeof ne<"u"&&ne.versions&&ne.versions.node){const[e,s]=ne.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return ne.getBuiltinModule(t)}return Ou(t)},{mkdir:Lu,readFile:Du,writeFile:Fu,stat:Hu,rename:_s,chown:Iu,chmod:Bu,unlink:Mu}=Nu("node:fs/promises"),Pu=async(t,e,s)=>{s={backup:!1,encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...s},P(t),gn(e),t=F(t);const n=await be(t,we),o=s.flag??"w",r=o.includes("a"),i=o.includes("x");if(n&&(!s.overwrite||i))throw new xt(`file already exists, open '${t}'`);const c=yn(t);try{!n&&s.recursive&&await Lu(V(t),{recursive:!0});let u,y=typeof e=="string"?Buffer.from(e,s.encoding??"utf8"):mn(e);if(r&&n&&(y=Buffer.concat([await Du(t),y])),await Fu(c,y,{flag:"wx"}),n&&s.backup&&(u=await Hu(t),s.chown??={gid:u.gid,uid:u.uid},await _s(t,`${t}.bak`)),s.chown)try{await Iu(c,s.chown.uid,s.chown.gid)}catch{}const l=u&&s.mode===void 0?u.mode:s.mode;l!==void 0&&await Bu(c,l),await _s(c,t)}catch(u){throw new Error(`Failed to write file at: ${t} - ${u.message}`,{cause:u})}finally{await be(c)&&await Mu(c)}};let ju;const Gu=t=>(ju??=H(import.meta.url))(t),re=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Uu=t=>{if(typeof re<"u"&&re.versions&&re.versions.node){const[e,s]=re.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return re.getBuiltinModule(t)}return Gu(t)},{mkdirSync:zu,readFileSync:qu,writeFileSync:Wu,statSync:Xu,renameSync:Ts,chownSync:Ku,chmodSync:Qu,unlinkSync:Vu}=Uu("node:fs"),Yu=(t,e,s)=>{s={backup:!1,encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...s},P(t),gn(e),t=F(t);const n=ve(t,we),o=s.flag??"w",r=o.includes("a"),i=o.includes("x");if(n&&(!s.overwrite||i))throw new xt(`file already exists, open '${t}'`);const c=yn(t);try{!n&&s.recursive&&zu(V(t),{recursive:!0});let u,y=typeof e=="string"?Buffer.from(e,s.encoding??"utf8"):mn(e);if(r&&n&&(y=Buffer.concat([qu(t),y])),Wu(c,y,{flag:"wx"}),n&&s.backup&&(u=Xu(t),s.chown??={gid:u.gid,uid:u.uid},Ts(t,`${t}.bak`)),s.chown)try{Ku(c,s.chown.uid,s.chown.gid)}catch{}const l=u&&s.mode===void 0?u.mode:s.mode;l!==void 0&&Qu(c,l),Ts(c,t)}catch(u){throw new Error(`Failed to write file at: ${t} - ${u.message}`,{cause:u})}finally{ve(c)&&Vu(c)}},Zu=/^(?:( )+|\t+)/,he="space";function Rs(t,e,s){return t&&e===he&&s===1}function ks(t,e){const s=new Map;let n=0,o,r;for(const i of t.split(/\n/g)){if(!i)continue;const c=i.match(Zu);if(c===null)n=0,o="";else{const u=c[0].length,y=c[1]?he:"tab";if(Rs(e,y,u))continue;y!==o&&(n=0),o=y;let l=1,h=0;const $=u-n;if(n=u,$===0)l=0,h=1;else{const b=Math.abs($);if(Rs(e,y,b))continue;r=Ju(y,b)}const g=s.get(r);s.set(r,g===void 0?[1,0]:[g[0]+l,g[1]+h])}}return s}function Ju(t,e){return(t===he?"s":"t")+String(e)}function ta(t){const e=t[0]==="s"?he:"tab",s=Number(t.slice(1));return{type:e,amount:s}}function ea(t){let e,s=0,n=0;for(const[o,[r,i]]of t)(r>s||r===s&&i>n)&&(s=r,n=i,e=o);return e}function sa(t,e){return(t===he?" ":" ").repeat(e)}function $n(t){if(typeof t!="string")throw new TypeError("Expected a string");let e=ks(t,!0);e.size===0&&(e=ks(t,!1));const s=ea(e);let n,o=0,r="";return s!==void 0&&({type:n,amount:o}=ta(s),r=sa(n,o)),{amount:o,type:n,indent:r}}let na;const ra=t=>(na??=H(import.meta.url))(t),oe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,oa=t=>{if(typeof oe<"u"&&oe.versions&&oe.versions.node){const[e,s]=oe.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return oe.getBuiltinModule(t)}return ra(t)},{readFile:ia}=oa("node:fs/promises"),cl=async(t,e,s={})=>{const{detectIndent:n,indent:o,replacer:r,stringify:i=JSON.stringify,...c}={indent:" ",...s};let u=o,y=`
|
|
21
|
+
`:""}`}set message(e){this.#t=e}}const Pc=t=>String.raw`\u{${t.codePointAt(0).toString(16)}}`,jc=(t,e,s)=>Fc(t,{start:e},{tabWidth:!1,...s}),Gc=/in JSON at position (\d+)(?: \(line (\d+) column (\d+)\))?$/,Uc=(t,e)=>{const s=Gc.exec(e);if(!s)return;const[,n,o,r]=s;if(o&&r)return{column:Number(r),line:Number(o)};let i=Number(n);return i===t.length&&(i=t.length-1),Bc(t,i)},qc=/(?<=^Unexpected token )(?<quote>')?(.)\k<quote>/,zc=t=>t.replace(qc,(e,s,n)=>`"${n}"(${Pc(n)})`);function hn(t,e,s,n){typeof e=="string"&&(typeof s=="object"&&(n=s),s=e,e=void 0);let o;try{return JSON.parse(t,e)}catch(c){o=c.message}let r;t?(r=Uc(t,o),o=zc(o)):o+=" while parsing empty string";const i=new Mc(o);throw i.fileName=s,r&&(i.codeFrame=jc(t,r,n)),i}async function tl(t,e,s){typeof e=="object"&&(s=e,e=void 0);const n=await xc(t,{buffer:!0,encoding:void 0});let o=new TextDecoder().decode(n);const{beforeParse:r,color:i}=s??{};return typeof r=="function"&&(o=r(o)),hn(o,e,F(t),{color:i})}function el(t,e,s){typeof e=="object"&&(s=e,e=void 0);const n=Cc(t,{buffer:!0,encoding:void 0});let o=new TextDecoder().decode(n);const{beforeParse:r,color:i}=s??{};return typeof r=="function"&&(o=r(o)),hn(o,e,F(t),{color:i})}const Re=t=>{const e={force:!0,recursive:!0};return t?.maxRetries!==void 0&&(e.maxRetries=t.maxRetries),t?.retryDelay!==void 0&&(e.retryDelay=t.retryDelay),e};let Wc;const Xc=t=>(Wc??=H(import.meta.url))(t),Zt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,dn=t=>{if(typeof Zt<"u"&&Zt.versions&&Zt.versions.node){const[e,s]=Zt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Zt.getBuiltinModule(t)}return Xc(t)},{existsSync:Kc}=dn("node:fs"),{mkdir:Qc,readdir:Vc,rm:Yc}=dn("node:fs/promises"),sl=async(t,e)=>{if(P(t),!Kc(t)){await Qc(t,{recursive:!0});return}const s=await Vc(t),n=Re(e);for(const o of s)await Yc(Se(F(t),o),n)};let Zc;const Jc=t=>(Zc??=H(import.meta.url))(t),Jt=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,tu=t=>{if(typeof Jt<"u"&&Jt.versions&&Jt.versions.node){const[e,s]=Jt.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return Jt.getBuiltinModule(t)}return Jc(t)},{existsSync:eu,mkdirSync:su,readdirSync:nu,rmSync:ru}=tu("node:fs"),nl=(t,e)=>{if(P(t),!eu(t)){su(t,{recursive:!0});return}const s=Re(e);for(const n of nu(t))ru(Se(F(t),n),s)};let ou;const iu=t=>(ou??=H(import.meta.url))(t),te=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,cu=t=>{if(typeof te<"u"&&te.versions&&te.versions.node){const[e,s]=te.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return te.getBuiltinModule(t)}return iu(t)},{rm:uu}=cu("node:fs/promises"),rl=async(t,e={})=>{P(t),await uu(t,Re(e))};let au;const lu=t=>(au??=H(import.meta.url))(t),ee=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,pu=t=>{if(typeof ee<"u"&&ee.versions&&ee.versions.node){const[e,s]=ee.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return ee.getBuiltinModule(t)}return lu(t)},{rmSync:fu}=pu("node:fs"),ol=(t,e={})=>{P(t),fu(t,Re(e))},hu=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,{platform:du}=hu,At="unnamed",gu=128,Es={'"':"ˮ","*":"⁎","/":"⁄",":":"꞉","<":"‹",">":"›","?":"ʔ","\\":"∖","|":"ǀ"},yu=/[\u0000-\u001F\u0080-\u009F]/g,mu=/^(?:\.+[/\\]+)+|^\.+$/g,qe=/^(?:con|prn|aux|nul|com\d|lpt\d)$/i,$u=/[<>:"/\\|?*]/g,bu=/\//g,ae=new Set([" "," ","."]),fe=(t,e)=>e>0&&e<t.length-1,vu=(t,e)=>{const s=t.lastIndexOf(".");if(!fe(t,s))return t.slice(0,e);const n=t.slice(0,s),o=t.slice(s),r=e-o.length;return r>0?`${n.slice(0,r)}${o}`:t.slice(0,e)},As=t=>{let e=0,s=t.length;for(;e<s;){const n=t[e];if(n===void 0||!ae.has(n))break;e+=1}for(;s>e;){const n=t[s-1];if(n===void 0||!ae.has(n))break;s-=1}return t.slice(e,s)},wu=t=>{const e=t.lastIndexOf(".");if(fe(t,e)){const n=t.slice(0,e),o=t.slice(e);let r=n;for(;r.length>0;){const i=r.at(-1);if(i===void 0||!ae.has(i))break;r=r.slice(0,-1)}return r.length===0?o.slice(1):`${r}${o}`}let s=t;for(;s.length>0;){const n=s.at(-1);if(n===void 0||!ae.has(n))break;s=s.slice(0,-1)}return s},Su=t=>{const e=t.lastIndexOf(".");if(fe(t,e))return!1;if(qe.test(t))return!0;let s=t;for(;s.length>0;){const n=s.at(-1);if(n===void 0||!ae.has(n))break;s=s.slice(0,-1)}return!!(s.length>0&&qe.test(s))},xu=t=>{const e=t.lastIndexOf(".");if(fe(t,e)){const o=t.slice(0,e),r=t.slice(e),i=As(o);return i.length===0?void 0:`${i}${r}`}const s=t.trim();if(s.length>0&&s[0]==="."&&s.length<=5&&s.indexOf(".",1)===-1)return;const n=As(t);if(n.length!==0)return n},Eu=t=>{const e=t?.filesystem??"auto";return e==="auto"?du==="win32"?"win32":"unix":e==="darwin"?"unix":e},il=(t,e)=>{if(typeof t!="string"||t.length===0)return At;const s=Eu(e);let n=t;if(n=n.replace(yu,""),n.length===0||(n=n.replace(mu,""),n.length===0))return At;if(s==="win32"||s==="fat32"){const r=n.lastIndexOf(".");if(!fe(n,r)&&qe.test(n))return At}if(n=s==="win32"||s==="fat32"?n.replaceAll($u,r=>Es[r]??""):n.replaceAll(bu,Es["/"]),n=n.trim(),(s==="win32"||s==="fat32")&&(Su(n)||s==="win32"&&(n=wu(n),n.length===0)))return At;if(s==="fat32"){const r=xu(n);if(r===void 0)return At;n=r}if(n.length===0)return At;const o=e?.maxLength??gu;return n.length>o&&(n=vu(n,o),n.length===0)?At:n},gn=t=>{if(typeof t!="string"&&!(t instanceof ArrayBuffer)&&!ArrayBuffer.isView(t))throw new TypeError("File contents must be a string, ArrayBuffer, or ArrayBuffer view.")};let Au;const _u=t=>(Au??=H(import.meta.url))(t),se=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Tu=t=>{if(typeof se<"u"&&se.versions&&se.versions.node){const[e,s]=se.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return se.getBuiltinModule(t)}return _u(t)},{randomBytes:Ru}=Tu("node:crypto"),yn=t=>`${t}.${process.pid.toString(36)}.${Ru(6).toString("hex")}.tmp`,ku=new TextEncoder,mn=t=>{if(t instanceof Uint8Array)return t;if(typeof t=="string")return ku.encode(t);if(t instanceof ArrayBuffer)return new Uint8Array(t);if(ArrayBuffer.isView(t)){const e=t.buffer.slice(t.byteOffset,t.byteOffset+t.byteLength);return new Uint8Array(e)}throw new TypeError("Invalid contents type. Expected string or ArrayBuffer.")};let Cu;const Ou=t=>(Cu??=H(import.meta.url))(t),ne=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Nu=t=>{if(typeof ne<"u"&&ne.versions&&ne.versions.node){const[e,s]=ne.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return ne.getBuiltinModule(t)}return Ou(t)},{mkdir:Lu,readFile:Du,writeFile:Fu,stat:Hu,rename:_s,chown:Iu,chmod:Bu,unlink:Mu}=Nu("node:fs/promises"),Pu=async(t,e,s)=>{s={backup:!1,encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...s},P(t),gn(e),t=F(t);const n=await be(t,we),o=s.flag??"w",r=o.includes("a"),i=o.includes("x");if(n&&(!s.overwrite||i))throw new xt(`file already exists, open '${t}'`);const c=yn(t);try{!n&&s.recursive&&await Lu(V(t),{recursive:!0});let u,y=typeof e=="string"?Buffer.from(e,s.encoding??"utf8"):mn(e);if(r&&n&&(y=Buffer.concat([await Du(t),y])),await Fu(c,y,{flag:"wx"}),n&&s.backup&&(u=await Hu(t),s.chown??={gid:u.gid,uid:u.uid},await _s(t,`${t}.bak`)),s.chown)try{await Iu(c,s.chown.uid,s.chown.gid)}catch{}const l=u&&s.mode===void 0?u.mode:s.mode;l!==void 0&&await Bu(c,l),await _s(c,t)}catch(u){throw new Error(`Failed to write file at: ${t} - ${u.message}`,{cause:u})}finally{await be(c)&&await Mu(c)}};let ju;const Gu=t=>(ju??=H(import.meta.url))(t),re=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Uu=t=>{if(typeof re<"u"&&re.versions&&re.versions.node){const[e,s]=re.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return re.getBuiltinModule(t)}return Gu(t)},{mkdirSync:qu,readFileSync:zu,writeFileSync:Wu,statSync:Xu,renameSync:Ts,chownSync:Ku,chmodSync:Qu,unlinkSync:Vu}=Uu("node:fs"),Yu=(t,e,s)=>{s={backup:!1,encoding:"utf8",flag:"w",overwrite:!0,recursive:!0,...s},P(t),gn(e),t=F(t);const n=ve(t,we),o=s.flag??"w",r=o.includes("a"),i=o.includes("x");if(n&&(!s.overwrite||i))throw new xt(`file already exists, open '${t}'`);const c=yn(t);try{!n&&s.recursive&&qu(V(t),{recursive:!0});let u,y=typeof e=="string"?Buffer.from(e,s.encoding??"utf8"):mn(e);if(r&&n&&(y=Buffer.concat([zu(t),y])),Wu(c,y,{flag:"wx"}),n&&s.backup&&(u=Xu(t),s.chown??={gid:u.gid,uid:u.uid},Ts(t,`${t}.bak`)),s.chown)try{Ku(c,s.chown.uid,s.chown.gid)}catch{}const l=u&&s.mode===void 0?u.mode:s.mode;l!==void 0&&Qu(c,l),Ts(c,t)}catch(u){throw new Error(`Failed to write file at: ${t} - ${u.message}`,{cause:u})}finally{ve(c)&&Vu(c)}},Zu=/^(?:( )+|\t+)/,he="space";function Rs(t,e,s){return t&&e===he&&s===1}function ks(t,e){const s=new Map;let n=0,o,r;for(const i of t.split(/\n/g)){if(!i)continue;const c=i.match(Zu);if(c===null)n=0,o="";else{const u=c[0].length,y=c[1]?he:"tab";if(Rs(e,y,u))continue;y!==o&&(n=0),o=y;let l=1,h=0;const $=u-n;if(n=u,$===0)l=0,h=1;else{const b=Math.abs($);if(Rs(e,y,b))continue;r=Ju(y,b)}const g=s.get(r);s.set(r,g===void 0?[1,0]:[g[0]+l,g[1]+h])}}return s}function Ju(t,e){return(t===he?"s":"t")+String(e)}function ta(t){const e=t[0]==="s"?he:"tab",s=Number(t.slice(1));return{type:e,amount:s}}function ea(t){let e,s=0,n=0;for(const[o,[r,i]]of t)(r>s||r===s&&i>n)&&(s=r,n=i,e=o);return e}function sa(t,e){return(t===he?" ":" ").repeat(e)}function $n(t){if(typeof t!="string")throw new TypeError("Expected a string");let e=ks(t,!0);e.size===0&&(e=ks(t,!1));const s=ea(e);let n,o=0,r="";return s!==void 0&&({type:n,amount:o}=ta(s),r=sa(n,o)),{amount:o,type:n,indent:r}}let na;const ra=t=>(na??=H(import.meta.url))(t),oe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,oa=t=>{if(typeof oe<"u"&&oe.versions&&oe.versions.node){const[e,s]=oe.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return oe.getBuiltinModule(t)}return ra(t)},{readFile:ia}=oa("node:fs/promises"),cl=async(t,e,s={})=>{const{detectIndent:n,indent:o,replacer:r,stringify:i=JSON.stringify,...c}={indent:" ",...s};let u=o,y=`
|
|
22
22
|
`;if(await be(t,Os))try{const h=await ia(t,"utf8");if(n){const{indent:$}=$n(h);u=$}y=h.endsWith(`
|
|
23
23
|
`)?`
|
|
24
24
|
`:""}catch(h){if(h.code!=="ENOENT")throw h}const l=i(e,r,u);await Pu(t,`${l}${y}`,c)};let ca;const ua=t=>(ca??=H(import.meta.url))(t),ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,aa=t=>{if(typeof ie<"u"&&ie.versions&&ie.versions.node){const[e,s]=ie.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return ie.getBuiltinModule(t)}return ua(t)},{readFileSync:la}=aa("node:fs"),ul=(t,e,s={})=>{const{detectIndent:n,indent:o,replacer:r,stringify:i=JSON.stringify,...c}={indent:" ",...s};let u=o,y=`
|
|
25
25
|
`;if(ve(t,Os))try{const h=la(t,"utf8");if(n){const{indent:$}=$n(h);u=$}y=h.endsWith(`
|
|
26
26
|
`)?`
|
|
27
|
-
`:""}catch(h){if(h.code!=="ENOENT")throw h}const l=i(e,r,u);Yu(t,`${l}${y}`,c)};let pa;const fa=t=>(pa??=H(import.meta.url))(t),ce=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Qe=t=>{if(typeof ce<"u"&&ce.versions&&ce.versions.node){const[e,s]=ce.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return ce.getBuiltinModule(t)}return fa(t)},ha=Qe("fs"),da=Qe("os"),ga=Qe("path");var je={},Cs;function ya(){if(Cs)return je;Cs=1;var t=Object.defineProperty,e=(l,h)=>t(l,"name",{value:h,configurable:!0}),s=ha,n=da,o=ga;const r=e(l=>{let h="";for(let $=0;$<l.length;$+=1){const g=l[$],b=g.toUpperCase();h+=g===b?g.toLowerCase():b}return h},"invertCase"),i=new Map,c=e((l,h)=>{const $=o.join(l,`.is-fs-case-sensitive-test-${process.pid}`);try{return h.writeFileSync($,""),!h.existsSync(r($))}finally{try{h.unlinkSync($)}catch{}}},"checkDirectoryCaseWithWrite"),u=e((l,h,$)=>{try{return c(l,$)}catch(g){if(h===void 0)return c(n.tmpdir(),$);throw g}},"checkDirectoryCaseWithFallback"),y=e((l,h=s,$=!0)=>{const g=l??process.cwd();if($&&i.has(g))return i.get(g);let b;const E=r(g);return E!==g&&h.existsSync(g)?b=!h.existsSync(E):b=u(g,l,h),$&&i.set(g,b),b},"isFsCaseSensitive");return je.isFsCaseSensitive=y,je}var ma=ya();const al=ma.isFsCaseSensitive;export{Ge as CRLF,Ca as EOL,Ns as FIND_UP_STOP,we as F_OK,Is as LF,Os as R_OK,ba as W_OK,va as X_OK,Fa as collect,Ha as collectSync,Sa as copy,xa as copySync,Oa as detect,sl as emptyDir,nl as emptyDirSync,We as ensureDir,Xe as ensureDirSync,Ea as ensureFile,Aa as ensureFileSync,_a as ensureLink,Ta as ensureLinkSync,Ra as ensureSymlink,ka as ensureSymlinkSync,Ia as findUp,Ba as findUpSync,Na as format,ja as glob,Ua as globParent,Ga as globSync,be as isAccessible,ve as isAccessibleSync,al as isFsCaseSensitive,
|
|
27
|
+
`:""}catch(h){if(h.code!=="ENOENT")throw h}const l=i(e,r,u);Yu(t,`${l}${y}`,c)};let pa;const fa=t=>(pa??=H(import.meta.url))(t),ce=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Qe=t=>{if(typeof ce<"u"&&ce.versions&&ce.versions.node){const[e,s]=ce.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return ce.getBuiltinModule(t)}return fa(t)},ha=Qe("fs"),da=Qe("os"),ga=Qe("path");var je={},Cs;function ya(){if(Cs)return je;Cs=1;var t=Object.defineProperty,e=(l,h)=>t(l,"name",{value:h,configurable:!0}),s=ha,n=da,o=ga;const r=e(l=>{let h="";for(let $=0;$<l.length;$+=1){const g=l[$],b=g.toUpperCase();h+=g===b?g.toLowerCase():b}return h},"invertCase"),i=new Map,c=e((l,h)=>{const $=o.join(l,`.is-fs-case-sensitive-test-${process.pid}`);try{return h.writeFileSync($,""),!h.existsSync(r($))}finally{try{h.unlinkSync($)}catch{}}},"checkDirectoryCaseWithWrite"),u=e((l,h,$)=>{try{return c(l,$)}catch(g){if(h===void 0)return c(n.tmpdir(),$);throw g}},"checkDirectoryCaseWithFallback"),y=e((l,h=s,$=!0)=>{const g=l??process.cwd();if($&&i.has(g))return i.get(g);let b;const E=r(g);return E!==g&&h.existsSync(g)?b=!h.existsSync(E):b=u(g,l,h),$&&i.set(g,b),b},"isFsCaseSensitive");return je.isFsCaseSensitive=y,je}var ma=ya();const al=ma.isFsCaseSensitive;export{Ge as CRLF,Ca as EOL,Ns as FIND_UP_STOP,we as F_OK,Is as LF,Os as R_OK,ba as W_OK,va as X_OK,Fa as collect,Ha as collectSync,Sa as copy,xa as copySync,Oa as detect,sl as emptyDir,nl as emptyDirSync,We as ensureDir,Xe as ensureDirSync,Ea as ensureFile,Aa as ensureFileSync,_a as ensureLink,Ta as ensureLinkSync,Ra as ensureSymlink,ka as ensureSymlinkSync,Ia as findUp,Ba as findUpSync,Na as format,ja as glob,Ua as globParent,Ga as globSync,be as isAccessible,ve as isAccessibleSync,al as isFsCaseSensitive,qa as isGlob,za as match,Wa as matcher,Ka as move,Qa as moveSync,xc as readFile,Cc as readFileSync,tl as readJson,el as readJsonSync,rl as remove,ol as removeSync,Va as rename,Ya as renameSync,il as sanitize,Ms as walk,js as walkSync,Pu as writeFile,Yu as writeFileSync,cl as writeJson,ul as writeJsonSync};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"./MailMessage-
|
|
1
|
+
import e from"./MailMessage-Aw0vVAh-.js";class t extends e{constructor(){super(),this.header("X-Unsent","1")}}export{t as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
class h extends Error{loc;title;hint;type="VisulimaError";constructor({cause:t,hint:s,location:e,message:i,name:r,stack:c,title:n}){super(i,{cause:t}),this.title=n,this.name=r,this.stack=c??this.stack,this.loc=e,this.hint=s}setLocation(t){this.loc=t}setName(t){this.name=t}setMessage(t){this.message=t}setHint(t){this.hint=t}}class l extends h{component;code;permanent;constructor(t,s,e){super({cause:e?.cause,hint:e?.hint,message:`[@visulima/email] [${t}] ${s}`,name:"EmailError",title:`Email ${t} Error`}),this.component=t,this.code=e?.code,this.permanent=e?.permanent??!1}}export{l as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import f from"./DraftMailMessage-zkKTOxQ8.js";import v from"./EmailError-SXEFQEyA.js";import u from"./MailMessage-Aw0vVAh-.js";import{composeMiddleware as w}from"./composeMiddleware-B3RCDFsy.js";import{b as C}from"./build-mime-message-D45WdgfP.js";import{c as M}from"./create-logger-CazqtXcL.js";import{h as d}from"./headers-to-record-ZOZ7Dubo.js";import T from"../utils/validation/check-feature-support.js";const S=(a,e,r)=>{e.success&&e.data?a&&a.info("Email sent successfully",{messageId:e.data.messageId,provider:e.data.provider}):a&&a.error("Email send failed",{error:e.error,provider:r})},E=async(a,e,r)=>{const t={...a,to:e.to};return delete t.idempotencyKey,e.cc&&(t.cc=e.cc),e.bcc&&(t.bcc=e.bcc),e.replyTo&&(t.replyTo=e.replyTo),e.headers&&(t.headers={...d(a.headers??{}),...d(e.headers)}),t.subject=e.subject??a.subject,r&&e.data&&(t.subject=await r(t.subject,e.data),a.html!==void 0&&(t.html=await r(a.html,e.data)),a.text!==void 0&&(t.text=await r(a.text,e.data))),t};class h{static extractErrorMessages(e){return e instanceof Error?[e.message]:[String(e??"Unknown error")]}provider;logger;loggerInstance;globalConfig;featureCheck;middlewares=[];composedSend;mountedProviders=new Map;constructor(e,r){this.provider=e,this.featureCheck=r?.featureCheck??"error"}setLogger(e){return this.loggerInstance=e,this.logger=M("Mail",e),this}use(e){return this.middlewares.push(e),this.composedSend=void 0,this}mount(e,r){return this.mountedProviders.set(e,r),this}setFrom(e){return this.globalConfig??={},this.globalConfig.from=e,this.logger&&this.logger.debug("Default from address updated",{from:e.email}),this}setReplyTo(e){return this.globalConfig??={},this.globalConfig.replyTo=e,this.logger&&this.logger.debug("Default reply-to address updated",{replyTo:e.email}),this}setHeaders(e){if(this.globalConfig??={},this.globalConfig.headers=e,this.logger){const r=d(e);this.logger.debug("Default headers updated",{count:Object.keys(r).length,headers:Object.keys(r)})}return this}async draft(e){let r=e instanceof u||e instanceof f?await this.buildDraftFromMessage(e):await this.buildDraftFromOptions(e);r=this.applyGlobalConfig(r);const t=r.headers?d(r.headers):{};r.headers={...t,"X-Unsent":"1"};const s=await C(r,{includeBcc:!0});return this.logger&&this.logger.debug("Draft created successfully in EML format",{from:r.from.email,size:s.length,subject:r.subject,to:Array.isArray(r.to)?r.to.length:1}),s}async send(e){if(e instanceof f)throw new TypeError("Cannot send draft messages. Convert to MailMessage first or remove X-Unsent header.");let r;if(e instanceof u)this.logger&&this.logger.debug("Sending MailMessage instance"),this.loggerInstance&&e.setLogger(this.loggerInstance),r=await e.build();else{const o=e;this.logger&&this.logger.debug("Sending email with options",{subject:o.subject,to:Array.isArray(o.to)?o.to.length:1}),r=o}r=this.applyGlobalConfig(r);const t=this.assertFeatureSupport(r,this.resolveProvider(r));if(t)return{error:t,success:!1};const s=await this.dispatch(r);return S(this.logger,s,this.provider.name??"unknown"),s}sendMany(e,r){const t=Math.max(1,Math.floor(r?.concurrency??1));return t===1?this.sendManySerial(e,r?.signal):this.sendManyConcurrent(e,t,r?.signal)}sendBatch(e,r,t){const s=async function*(){const o=e instanceof u?await e.build():e;for(const i of r)yield await E(o,i,t?.render)};return this.sendMany(s(),{concurrency:t?.concurrency,signal:t?.signal})}async sendOneToReceipt(e){const r=this.provider.name;try{const t=await this.send(e);return t.success&&t.data?{messageId:t.data.messageId,provider:t.data.provider??r,response:t.data.response,successful:!0,timestamp:t.data.timestamp}:{errorMessages:h.extractErrorMessages(t.error),provider:r,successful:!1}}catch(t){return{errorMessages:h.extractErrorMessages(t),provider:r,successful:!1}}}async*sendManySerial(e,r){const t=this.provider.name;let s=0,o=0,i=0;this.logger&&this.logger.debug("Starting batch email send",{provider:t});for await(const l of e){if(l instanceof f)throw new TypeError("Cannot send draft messages. Convert to MailMessage first or remove X-Unsent header.");if(r?.aborted){this.logger&&this.logger.warn("Batch send operation was aborted",{failed:i,processed:s,successful:o}),yield{errorMessages:["Send operation was aborted"],provider:t,successful:!1};return}s+=1;const n=await this.sendOneToReceipt(l);n.successful?o+=1:i+=1,yield n}this.logger&&this.logger.debug("Batch email send completed",{failureCount:i,processedCount:s,provider:t,successCount:o})}async*sendManyConcurrent(e,r,t){const s=this.provider.name;this.logger&&this.logger.debug("Starting concurrent batch email send",{concurrency:r,provider:s});const o=Symbol.asyncIterator in e?e[Symbol.asyncIterator]():e[Symbol.iterator](),i=new Map;let l=0,n=!1,p=!1;const m=async()=>{for(;!n&&!p&&i.size<r;){const g=await o.next();if(g.done){n=!0;break}const c=g.value;if(c instanceof f)throw new TypeError("Cannot send draft messages. Convert to MailMessage first or remove X-Unsent header.");const b=l;l+=1,i.set(b,this.sendOneToReceipt(c).then(y=>({id:b,receipt:y})))}};for(await m();i.size>0;){if(t?.aborted){p=!0,yield{errorMessages:["Send operation was aborted"],provider:s,successful:!1};return}const{id:g,receipt:c}=await Promise.race(i.values());i.delete(g),yield c,await m()}this.logger&&this.logger.debug("Concurrent batch email send completed",{processedCount:l,provider:s})}async dispatch(e){return this.middlewares.length===0?await this.resolveProvider(e).sendEmail(e):(this.composedSend??=w(this.middlewares,r=>Promise.resolve(this.resolveProvider(r).sendEmail(r))),await this.composedSend(e))}resolveProvider(e){return e.stream!==void 0?this.mountedProviders.get(e.stream)??this.provider:this.provider}assertFeatureSupport(e,r){if(this.featureCheck==="off")return;const{supported:t,violations:s}=T(e,r.features);if(t)return;const o=r.name??"unknown",i=s.map(n=>n.field),l=s.map(n=>n.message);if(this.featureCheck==="warn"){this.logger&&this.logger.warn("Message uses capabilities the provider does not support",{fields:i,provider:o});return}return this.logger&&this.logger.error("Message rejected by capability guard",{fields:i,provider:o}),new v(o,`Provider does not support the following message fields: ${i.join(", ")}`,{code:"UNSUPPORTED_FEATURES",hint:l})}async buildDraftFromMessage(e){return this.logger&&this.logger.debug("Creating draft from MailMessage instance"),this.loggerInstance&&e.setLogger(this.loggerInstance),this.applyGlobalConfigToMessage(e),await e.build()}async buildDraftFromOptions(e){return this.logger&&this.logger.debug("Creating draft from email options",{subject:e.subject,to:Array.isArray(e.to)?e.to.length:1}),e}applyGlobalConfigToMessage(e){const r=this.globalConfig?.from;r&&!e.getFrom()&&e.from(r);const t=this.globalConfig?.replyTo;if(t&&!e.getReplyTo()&&e.replyTo(t),this.globalConfig?.headers){const s=d(this.globalConfig.headers);Object.entries(s).forEach(([o,i])=>{e.header(o,i)})}}applyGlobalConfig(e){if(!this.globalConfig)return e;const r={...e};if(!r.from&&this.globalConfig.from&&(r.from=this.globalConfig.from,this.logger&&this.logger.debug("Applied global from address",{from:this.globalConfig.from.email})),!r.replyTo&&this.globalConfig.replyTo&&(r.replyTo=this.globalConfig.replyTo,this.logger&&this.logger.debug("Applied global reply-to address",{replyTo:this.globalConfig.replyTo.email})),this.globalConfig.headers){const t=d(this.globalConfig.headers),s=r.headers?d(r.headers):{};r.headers={...t,...s},this.logger&&this.logger.debug("Merged global headers",{globalCount:Object.keys(t).length,messageCount:Object.keys(s).length})}return r}}const O=(a,e)=>new h(a,e);export{h as Mail,O as createMail};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as y}from"node:module";import{readFileAsBuffer as c,detectMimeType as d,generateContentId as u}from"./detectMimeType-BRz3Qjyz.js";import{c as T}from"./create-logger-CazqtXcL.js";import{h as l}from"./headers-to-record-ZOZ7Dubo.js";let p;const A=n=>(p??=y(import.meta.url))(n),o=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,f=n=>{if(typeof o<"u"&&o.versions&&o.versions.node){const[t,e]=o.versions.node.split(".").map(Number);if(t>22||t===22&&e>=3||t===20&&e>=16)return o.getBuiltinModule(n)}return A(n)},{basename:g}=f("node:path"),{fileURLToPath:b}=f("node:url"),m=async()=>(await import("../template-engines/html-to-text.js")).default,x=async()=>(await import("ical-generator")).default,a=n=>Array.isArray(n)?n.map(t=>typeof t=="string"?{email:t}:t):typeof n=="string"?[{email:n}]:[n];class D{fromAddress;toAddresses=[];ccAddresses=[];bccAddresses=[];subjectText="";textContent;textCharset="utf8";autoTextEnabled=!0;htmlContent;htmlCharset="utf8";dateValue;returnPathAddress;senderAddress;headers={};attachments=[];replyToAddress;priorityValue;tagsValue=[];idempotencyKeyValue;signer;encrypter;logger;icalEventData;icalEventBuilder;from(t){return this.fromAddress=typeof t=="string"?{email:t}:t,this}to(t){return this.toAddresses.length=0,this.toAddresses.push(...a(t)),this}cc(t){return this.ccAddresses.length=0,this.ccAddresses.push(...a(t)),this}bcc(t){return this.bccAddresses.length=0,this.bccAddresses.push(...a(t)),this}subject(t){return this.subjectText=t,this}text(t,e="utf8"){return this.textContent=t,this.textCharset=e,this}html(t,e="utf8"){return this.htmlContent=t,this.htmlCharset=e,this}header(t,e){return this.headers[t]=e,this}setHeaders(t){const e=l(t);return Object.assign(this.headers,e),this}async attachFromPath(t,e){try{const s=await c(t),i=e?.filename??(g(t)||"attachment"),r=e?.contentType??d(i);this.attachments.push({cid:e?.cid,content:s,contentDisposition:e?.contentDisposition??"attachment",contentType:r,encoding:e?.encoding,filename:i,headers:e?.headers}),this.logger&&this.logger.debug(`Attachment added from path: ${t}`,{contentType:r,filename:i})}catch(s){throw this.logger&&this.logger.error(`Failed to attach file from path: ${t}`,s),s}return this}attachData(t,e){const s=e.contentType??d(e.filename);return this.attachments.push({cid:e.cid,content:t,contentDisposition:e.contentDisposition??"attachment",contentType:s,encoding:e.encoding,filename:e.filename,headers:e.headers}),this.logger&&this.logger.debug("Attachment added from data",{contentType:s,filename:e.filename}),this}async embedFromPath(t,e){try{const s=await c(t),i=e?.filename??(g(t)||"inline"),r=e?.contentType??d(i),h=u(i);return this.attachments.push({cid:h,content:s,contentDisposition:"inline",contentType:r,filename:i}),this.logger&&this.logger.debug(`Inline attachment embedded from path: ${t}`,{cid:h,contentType:r,filename:i}),h}catch(s){throw this.logger&&this.logger.error(`Failed to embed file from path: ${t}`,s),s}}embedData(t,e,s){const i=s?.contentType??d(e),r=u(e);return this.attachments.push({cid:r,content:t,contentDisposition:"inline",contentType:i,filename:e}),this.logger&&this.logger.debug("Inline attachment embedded from data",{cid:r,contentType:i,filename:e}),r}replyTo(t){return this.replyToAddress=typeof t=="string"?{email:t}:t,this}date(t){return this.dateValue=typeof t=="string"?new Date(t):t,this.logger&&this.logger.debug("Date header set",{date:this.dateValue.toISOString()}),this}returnPath(t){return this.returnPathAddress=typeof t=="string"?{email:t}:t,this.logger&&this.logger.debug("Return-path address set",{returnPath:this.returnPathAddress.email}),this}sender(t){return this.senderAddress=typeof t=="string"?{email:t}:t,this.logger&&this.logger.debug("Sender address set",{sender:this.senderAddress.email}),this}addTo(t){return this.toAddresses.push(...a(t)),this}addCc(t){return this.ccAddresses.push(...a(t)),this}addBcc(t){return this.bccAddresses.push(...a(t)),this}addReplyTo(t){const e=Array.isArray(t)?t:[t];if(e.length>0){const s=e[0];this.replyToAddress=typeof s=="string"?{email:s}:s}return this}addFrom(t){const e=Array.isArray(t)?t:[t];if(e.length>0){const s=e[0];this.fromAddress=typeof s=="string"?{email:s}:s}return this}priority(t){return this.priorityValue=t,this}tags(t){return this.tagsValue=Array.isArray(t)?t:[t],this}idempotencyKey(t){return this.idempotencyKeyValue=t,this}sign(t){return this.signer=t,this.logger&&this.logger.debug("Email signer configured"),this}encrypt(t){return this.encrypter=t,this.logger&&this.logger.debug("Email encrypter configured"),this}setLogger(t){return this.logger=T("MailMessage",t),this}icalEvent(t,e){return typeof t=="function"?(this.icalEventBuilder={build:t,options:e},this.icalEventData=void 0):(this.icalEventBuilder=void 0,this.icalEventData={content:t,...e}),this.logger&&this.logger.debug("Calendar event attached",{method:e?.method}),this}icalEventFromFile(t,e){const s=typeof t=="string"?t:b(t);return this.icalEventData={path:s,...e},this.logger&&this.logger.debug(`Calendar event attached from file: ${s}`,{method:e?.method}),this}icalEventFromUrl(t,e){return this.icalEventData={href:t,...e},this.logger&&this.logger.debug(`Calendar event attached from URL: ${t}`,{method:e?.method}),this}async view(t,e,s,i){try{const r=i?.autoText!==!1;this.autoTextEnabled=r,this.logger&&this.logger.debug("Rendering template",{autoText:r});const h=await t(e,s,i);this.html(h),r&&h&&await this.tryAutoGenerateText(h),this.logger&&this.logger.debug("Template rendered successfully")}catch(r){throw this.logger&&this.logger.error("Failed to render template",r),new Error(`Failed to render template: ${r.message}`)}return this}async viewText(t,e,s,i){try{this.logger&&this.logger.debug("Rendering text template");const r=await t(e,s,i);if(typeof r=="string")this.text(r),this.logger&&this.logger.debug("Text template rendered successfully");else throw new TypeError("Text renderer must return a string")}catch(r){throw this.logger&&this.logger.error("Failed to render text template",r),new Error(`Failed to render text template: ${r.message}`)}return this}async build(){if(this.logger&&this.logger.debug("Building email message"),this.fromAddress||this.throwAndLogError("From address is required","Build failed: from address is required"),this.toAddresses.length===0&&this.throwAndLogError("At least one recipient is required","Build failed: at least one recipient is required"),this.subjectText||this.throwAndLogError("Subject is required","Build failed: subject is required"),this.htmlContent&&!this.textContent&&this.autoTextEnabled)try{const e=await m();this.textContent=e(this.htmlContent),this.logger&&this.logger.debug("Auto-generated text content from HTML")}catch{this.logger&&this.logger.debug("Failed to convert HTML to text; proceeding without text content.")}!this.textContent&&!this.htmlContent&&this.throwAndLogError("Either text or html content is required","Build failed: either text or html content is required");let t={from:this.fromAddress,html:this.htmlContent,subject:this.subjectText,text:this.textContent,to:this.toAddresses.length===1?this.toAddresses[0]:this.toAddresses};if(this.ccAddresses.length>0&&(t.cc=this.ccAddresses.length===1?this.ccAddresses[0]:this.ccAddresses),this.bccAddresses.length>0&&(t.bcc=this.bccAddresses.length===1?this.bccAddresses[0]:this.bccAddresses),Object.keys(this.headers).length>0&&(t.headers=this.headers),this.attachments.length>0&&(t.attachments=this.attachments,this.logger&&this.logger.debug(`Email includes ${this.attachments.length} attachment(s)`)),this.replyToAddress&&(t.replyTo=this.replyToAddress),this.priorityValue&&(t.priority=this.priorityValue),this.tagsValue.length>0&&(t.tags=this.tagsValue),this.idempotencyKeyValue!==void 0&&(t.idempotencyKey=this.idempotencyKeyValue),this.icalEventBuilder){const s=(await x())();this.icalEventBuilder.build(s),this.icalEventData={content:s.toString(),...this.icalEventBuilder.options}}return this.icalEventData&&(t.icalEvent=this.icalEventData,this.logger&&this.logger.debug("Email includes calendar event")),this.dateValue&&(t.headers={...l(t.headers??{}),Date:this.dateValue.toUTCString()}),this.returnPathAddress&&(t.headers={...l(t.headers??{}),"Return-Path":this.returnPathAddress.email}),this.senderAddress&&(t.headers={...l(t.headers??{}),Sender:this.senderAddress.email}),this.signer&&(this.logger&&this.logger.debug("Signing email message"),t=await this.signer.sign(t),this.logger&&this.logger.debug("Email message signed successfully")),this.encrypter&&(this.logger&&this.logger.debug("Encrypting email message"),t=await this.encrypter.encrypt(t),this.logger&&this.logger.debug("Email message encrypted successfully")),this.logger&&this.logger.debug("Email message built successfully",{bcc:this.bccAddresses.length,cc:this.ccAddresses.length,hasHtml:!!this.htmlContent,hasText:!!this.textContent,to:this.toAddresses.length}),t}getSubject(){return this.subjectText}getFrom(){return this.fromAddress}getTo(){return[...this.toAddresses]}getCc(){return[...this.ccAddresses]}getBcc(){return[...this.bccAddresses]}getReplyTo(){return this.replyToAddress}getSender(){return this.senderAddress}getReturnPath(){return this.returnPathAddress}getDate(){return this.dateValue}getPriority(){return this.priorityValue}getTextBody(){return this.textContent}getTextCharset(){return this.textCharset}getHtmlBody(){return this.htmlContent}getHtmlCharset(){return this.htmlCharset}getAttachments(){return[...this.attachments]}async tryAutoGenerateText(t){try{const s=(await m())(t);s&&!this.textContent&&this.text(s),this.logger&&this.logger.debug("Auto-generated text content from HTML template")}catch(e){this.logger&&this.logger.warn("Failed to auto-generate text from HTML template",e)}}throwAndLogError(t,e){const s=new Error(t);throw this.logger&&this.logger.error(e??t),s}}export{D as default};
|
package/dist/packem_shared/{RequiredOptionError-ctDEEB1s.js → RequiredOptionError-C2wWqmiE.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import s from"./EmailError-
|
|
1
|
+
import s from"./EmailError-SXEFQEyA.js";class n extends s{constructor(o,r){const e=Array.isArray(r)?`Missing required options: ${r.map(i=>`'${i}'`).join(", ")}`:`Missing required option: '${r}'`;super(o,e,{hint:Array.isArray(r)?`Please provide the following required options: ${r.map(i=>`'${i}'`).join(", ")}`:`Please provide the required option: '${r}'`}),this.name="RequiredOptionError"}}export{n as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import c from"./EmailError-
|
|
1
|
+
import c from"./EmailError-SXEFQEyA.js";import b from"./RequiredOptionError-C2wWqmiE.js";import{g as v}from"./generate-message-id-C5AM6DFE.js";import{h as E}from"./headers-to-record-ZOZ7Dubo.js";import{m as u}from"./make-request-mszP240P.js";import{r as h}from"./retry-ByPJFAtq.js";import{v as w}from"./validate-email-options-DxdAVLlu.js";import{defineProvider as A}from"./defineProvider-C9q-7iwt.js";import{c as T,h as g,P as I}from"./provider-base-G22b4a87.js";import{f as l,a as P}from"./address-formatter-w36S9ZYj.js";import{p as S}from"./attachment-processor-AB1m-n9T.js";const t="ahasend",C="https://api.ahasend.com",R=3e4,$=3,N=A((o={})=>{if(!o.apiKey)throw new b(t,"apiKey");const a={apiKey:o.apiKey,debug:o.debug??!1,endpoint:o.endpoint??C,retries:o.retries??$,timeout:o.timeout??R,...o.logger&&{logger:o.logger}},y=new I,s=T(t,o.logger);return{features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new c(t,"Email ID is required to retrieve email details"),success:!1};await this.initialize();const i={Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"};s.debug("Retrieving email details",{id:e});const r=await h(async()=>u(`${a.endpoint}/emails/${e}`,{headers:i,method:"GET",timeout:a.timeout}),a.retries);return r.success?(s.debug("Email details retrieved successfully"),{data:r.data?.body,success:!0}):(s.debug("API request failed when retrieving email",r.error),{error:new c(t,`Failed to retrieve email: ${r.error instanceof Error?r.error.message:"Unknown error"}`,{cause:r.error}),success:!1})}catch(i){return{error:g(t,"retrieve email",i,s),success:!1}}},async initialize(){await y.ensureInitialized(async()=>{if(!await this.isAvailable())throw new c(t,"AhaSend API not available or invalid API key");s.debug("Provider initialized successfully")},t)},async isAvailable(){try{s.debug("Checking AhaSend API availability");const e=await u(`${a.endpoint}/v2/ping`,{headers:{Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"},method:"GET",timeout:a.timeout});if(e.success)return!0;const i=e.data?.statusCode??e.error?.statusCode;return!1}catch(e){return s.debug("Error checking availability:",e),!1}},name:t,options:a,async sendEmail(e){try{const i=w(e);if(i.length>0)return{error:new c(t,`Invalid email options: ${i.join(", ")}`),success:!1};await this.initialize();const r={from:{email:e.from.email,name:e.from.name},subject:e.subject,to:l(e.to)};if(e.html&&(r.html=e.html),e.text&&(r.text=e.text),e.cc&&(r.cc=l(e.cc)),e.bcc&&(r.bcc=l(e.bcc)),e.replyTo&&(r.replyTo=P(e.replyTo)),e.templateId&&(r.templateId=e.templateId,e.templateVariables&&(r.templateVariables=e.templateVariables)),e.tags&&e.tags.length>0&&(r.tags=e.tags),e.headers){const n=E(e.headers);r.headers=n}e.attachments&&e.attachments.length>0&&(r.attachments=await Promise.all(e.attachments.map(async n=>({content:await S(n,t),contentType:n.contentType??"application/octet-stream",filename:n.filename,...n.cid&&{cid:n.cid}})))),s.debug("Sending email via AhaSend API",{subject:r.subject,to:r.to});const p={Authorization:`Bearer ${a.apiKey}`,"Content-Type":"application/json"},d=await h(async()=>u(`${a.endpoint}/send`,{headers:p,method:"POST",timeout:a.timeout},JSON.stringify(r)),a.retries);if(!d.success)return s.debug("API request failed when sending email",d.error),{error:d.error??new c(t,"Failed to send email"),success:!1};const m=d.data?.body,f=m?.messageId??m?.id??v();return s.debug("Email sent successfully",{messageId:f}),{data:{messageId:f,provider:t,response:d.data,sent:!0,timestamp:new Date},success:!0}}catch(i){return{error:g(t,"send email",i,s),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{N as default};
|
package/dist/packem_shared/{attachment-processor-BJFDS343.js → attachment-processor-AB1m-n9T.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{createRequire as r}from"node:module";import l from"./EmailError-
|
|
1
|
+
import{createRequire as r}from"node:module";import l from"./EmailError-SXEFQEyA.js";let c;const p=e=>(c??=r(import.meta.url))(e),t=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,f=e=>{if(typeof t<"u"&&t.versions&&t.versions.node){const[n,o]=t.versions.node.split(".").map(Number);if(n>22||n===22&&o>=3||n===20&&o>=16)return t.getBuiltinModule(e)}return p(e)},{Buffer:a}=f("node:buffer"),s=async(e,n)=>{let o;if(e.content)if(typeof e.content=="string")o=e.content;else if(e.content instanceof Promise){const i=await e.content;o=a.from(i).toString("base64")}else o=e.content.toString("base64");else if(e.raw)o=typeof e.raw=="string"?e.raw:e.raw.toString("base64");else throw new l(n,`Attachment ${e.filename} has no content`);return o},y=async(e,n)=>({content:await s(e,n),contentType:e.contentType??"application/octet-stream",disposition:e.contentDisposition??"attachment",filename:e.filename,...e.cid&&{contentId:e.cid}}),_=async(e,n)=>({content:await s(e,n),disposition:e.contentDisposition??"attachment",filename:e.filename,type:e.contentType??"application/octet-stream",...e.cid&&{content_id:e.cid}}),g=async(e,n)=>({Content:await s(e,n),ContentType:e.contentType??"application/octet-stream",Name:e.filename,...e.cid&&{ContentID:e.cid}}),w=async(e,n,o)=>({content:await s(e,n),key:`attachment[${o}]`});export{w as a,g as b,y as c,_ as d,s as p};
|