@visulima/email 1.0.0-alpha.9 → 1.0.1
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 +782 -0
- package/LICENSE.md +541 -847
- package/README.md +212 -191
- package/dist/crypto/index.d.ts +304 -4
- package/dist/crypto/index.js +1 -1
- package/dist/deliverability/dmarc-report.d.ts +95 -0
- package/dist/deliverability/dmarc-report.js +1 -0
- package/dist/deliverability/index.d.ts +360 -0
- package/dist/deliverability/index.js +1 -0
- package/dist/events/index.d.ts +31 -0
- package/dist/events/index.js +1 -0
- package/dist/inbound/index.d.ts +375 -0
- package/dist/inbound/index.js +1 -0
- package/dist/index.d.ts +94 -9
- package/dist/index.js +1 -1
- package/dist/middleware/index.d.ts +346 -0
- package/dist/middleware/index.js +1 -0
- package/dist/packem_shared/ALL_EVENTS-3kwh5CBE.js +1 -0
- package/dist/packem_shared/DkimSigner-CiLBaXrg.js +18 -0
- package/dist/packem_shared/DraftMailMessage-CGTVuy2z.js +1 -0
- package/dist/packem_shared/EmailError-B-sEf3bp.js +1 -0
- package/dist/packem_shared/Mail-C1zp-fqt.js +1 -0
- package/dist/packem_shared/MailMessage-DQRgs5Dz.js +1 -0
- package/dist/packem_shared/MemoryEventStore-CuhfO9aj.js +1 -0
- package/dist/packem_shared/MemoryQueue-Dl1Fa6OJ.js +1 -0
- package/dist/packem_shared/MemorySuppressionStore-DZnbz-_B.js +1 -0
- package/dist/packem_shared/RATE_LIMIT_PRESETS-BPADLgcA.js +1 -0
- package/dist/packem_shared/RequiredOptionError-DuNNY_a5.js +1 -0
- package/dist/packem_shared/SmimeEncrypter-DavopRlE.js +6 -0
- package/dist/packem_shared/SmimeSigner-0onWksAv.js +8 -0
- package/dist/packem_shared/addDarkModeSupport-DZYxULjl.js +1 -0
- package/dist/packem_shared/address-formatter-BWR2Dddx.js +1 -0
- package/dist/packem_shared/aggregate-features-BqEjPd42.js +1 -0
- package/dist/packem_shared/ahaSendProvider-D81_wUA1.js +1 -0
- package/dist/packem_shared/arcMessageSignatureBase-DDLEHW2E.js +17 -0
- package/dist/packem_shared/attachment-processor-CMp7qqMI.js +1 -0
- package/dist/packem_shared/awsSesProvider-BGZJUIep.js +32 -0
- package/dist/packem_shared/azureProvider-CmcK4bsf.js +1 -0
- package/dist/packem_shared/brevoProvider-C1BDXr41.js +1 -0
- package/dist/packem_shared/build-mime-message-B6927SQy.js +3 -0
- package/dist/packem_shared/buildListUnsubscribe-Cdr8MvR_.js +1 -0
- package/dist/packem_shared/buildMtaStsPolicy-oEQg8y_C.js +6 -0
- package/dist/packem_shared/circuitBreakerMiddleware-D2SA_07f.js +1 -0
- package/dist/packem_shared/cloudflareEmailProvider-Bv-ty-74.js +1 -0
- package/dist/packem_shared/composeMiddleware-BHwLLEzK.js +1 -0
- package/dist/packem_shared/create-logger-BQTS3f-I.js +1 -0
- package/dist/packem_shared/createSuppressionStore-CeAZKCbY.js +1 -0
- package/dist/packem_shared/createTestEmail-D3XPGiHY.js +1 -0
- package/dist/packem_shared/createWorker-_-yMWcNQ.js +1 -0
- package/dist/packem_shared/dedupeMiddleware-B6ajWOTi.js +1 -0
- package/dist/packem_shared/defineInboundHandler-CnL2BzlL.js +1 -0
- package/dist/packem_shared/defineProvider-C9q-7iwt.js +1 -0
- package/dist/packem_shared/detectMimeType-DFH3kp6K.js +1 -0
- package/dist/packem_shared/emailMatchers-DZDkrZ_3.js +1 -0
- package/dist/packem_shared/event-bus.d-DEl3w_EW.d.ts +104 -0
- package/dist/packem_shared/extractCidReferences-BuoTREMp.js +1 -0
- package/dist/packem_shared/extractReply-BUjIBt9A.js +5 -0
- package/dist/packem_shared/failoverProvider-BgX6zfnY.js +1 -0
- package/dist/packem_shared/format-address-DTl-9O70.js +1 -0
- package/dist/packem_shared/generate-boundary-DQbzDiOI.js +1 -0
- package/dist/packem_shared/generate-message-id-gXAuMz4g.js +1 -0
- package/dist/packem_shared/headers-to-record-De1Eg951.js +1 -0
- package/dist/packem_shared/httpProvider-DJAsYSun.js +1 -0
- package/dist/packem_shared/index-BoZvzveg.js +11 -0
- package/dist/packem_shared/infobipProvider-lHyGrXgZ.js +1 -0
- package/dist/packem_shared/injectPreheader-CF9WHZ7J.js +1 -0
- package/dist/packem_shared/inlineCss-BQ7d2Cyz.js +1 -0
- package/dist/packem_shared/isValidSigningCertUrl-Bii1AMGC.js +3 -0
- package/dist/packem_shared/loggingMiddleware-CZIiVMVp.js +1 -0
- package/dist/packem_shared/loopsProvider-DyloxzNC.js +1 -0
- package/dist/packem_shared/mail.d-B9SSqyy0.d.ts +909 -0
- package/dist/packem_shared/{mailCrabProvider-CM_CFDca.js → mailCrabProvider-CPtBT6Th.js} +1 -1
- package/dist/packem_shared/mailPaceProvider-CJEvOFBh.js +1 -0
- package/dist/packem_shared/mailchannelsProvider-osRkW_tz.js +1 -0
- package/dist/packem_shared/mailerSendProvider-C_6LzARK.js +1 -0
- package/dist/packem_shared/mailgunProvider-DkISvMPe.js +1 -0
- package/dist/packem_shared/mailjetProvider-CV0i4Xzh.js +1 -0
- package/dist/packem_shared/mailomatProvider-B5YFonEO.js +1 -0
- package/dist/packem_shared/mailtrapProvider-C4ZquIPz.js +1 -0
- package/dist/packem_shared/make-request-BlK_B72c.js +1 -0
- package/dist/packem_shared/mandrillProvider-DWPFh_Sj.js +1 -0
- package/dist/packem_shared/mockProvider-Behywbl1.js +1 -0
- package/dist/packem_shared/netcoreProvider-C5TEciaN.js +1 -0
- package/dist/packem_shared/nodemailerProvider-BFHobXxt.js +1 -0
- package/dist/packem_shared/normalizeMessageId-DAx2pGe2.js +1 -0
- package/dist/packem_shared/oauth2Middleware-CodqXkyj.js +1 -0
- package/dist/packem_shared/opentelemetryProvider-ByHC01ub.js +1 -0
- package/dist/packem_shared/outlook365Provider-63ggDpqV.js +1 -0
- package/dist/packem_shared/parseAddress-DdbViBAJ.js +1 -0
- package/dist/packem_shared/parseArfReport-Ds6S3c4J.js +6 -0
- package/dist/packem_shared/parseCloudflareInbound-C__j-oNa.js +1 -0
- package/dist/packem_shared/parseDmarcRecord-DXZ-_rF0.js +1 -0
- package/dist/packem_shared/parseMailgunInbound-BpC6uPNe.js +1 -0
- package/dist/packem_shared/parsePostmarkInbound-Co3_c6-9.js +1 -0
- package/dist/packem_shared/parseSendGridInbound-DsALoijO.js +4 -0
- package/dist/packem_shared/parseSesInbound-CH5tHIjp.js +1 -0
- package/dist/packem_shared/parseTlsReport-wPe1lIDs.js +1 -0
- package/dist/packem_shared/plunkProvider-yTlrJVEp.js +1 -0
- package/dist/packem_shared/postProcessHtml-DqKi2Ucg.js +1 -0
- package/dist/packem_shared/postalProvider-CRX_bMYD.js +1 -0
- package/dist/packem_shared/postmarkProvider-CDx85Yge.js +1 -0
- package/dist/packem_shared/provider-base-C7PuopYK.js +1 -0
- package/dist/packem_shared/provider.d-J-y6iogK.d.ts +28 -0
- package/dist/packem_shared/quoted-printable-nSGDA1tA.js +7 -0
- package/dist/packem_shared/resendProvider-CiclWxzr.js +1 -0
- package/dist/packem_shared/retry-3pnxTuNs.js +1 -0
- package/dist/packem_shared/retryMiddleware-DbViDX4r.js +1 -0
- package/dist/packem_shared/roundRobinProvider-D1by5KGW.js +1 -0
- package/dist/packem_shared/sanitize-header-DJhgZl3y.js +1 -0
- package/dist/packem_shared/scalewayProvider-BcND48qO.js +1 -0
- package/dist/packem_shared/sendGridProvider-D8ZLgY62.js +1 -0
- package/dist/packem_shared/smtpProvider-Bm0yP97W.js +25 -0
- package/dist/packem_shared/sparkpostProvider-CTYfSRaV.js +1 -0
- package/dist/packem_shared/sweegoProvider-DOoin_vi.js +1 -0
- package/dist/packem_shared/toEmailSnapshot-DeRqM5SJ.js +1 -0
- package/dist/packem_shared/tracer.d-MU42G1jG.d.ts +494 -0
- package/dist/packem_shared/types.d-BId55FW2.d.ts +107 -0
- package/dist/packem_shared/types.d-CmoWvdZi.d.ts +61 -0
- package/dist/packem_shared/types.d-DCkecJse.d.ts +51 -0
- package/dist/packem_shared/types.d-Mpu0HZoG.d.ts +24 -0
- package/dist/packem_shared/types.d-ejzh-xBP.d.ts +209 -0
- package/dist/packem_shared/types.d-lcJZmwRK.d.ts +69 -0
- package/dist/packem_shared/types.d-nyR1ty1Q.d.ts +9 -0
- package/dist/packem_shared/utils-BfYfPB_I.js +1 -0
- package/dist/packem_shared/validate-email-options-mCM9dVug.js +1 -0
- package/dist/packem_shared/verifyMailgunWebhook-Cwl0OD3P.js +1 -0
- package/dist/packem_shared/verifyPostmarkWebhook-C72ZvbrG.js +1 -0
- package/dist/packem_shared/verifyResendWebhook-YK2zNDXR.js +1 -0
- package/dist/packem_shared/verifySendGridWebhook-Dbwc1tfG.js +1 -0
- package/dist/packem_shared/withEvents-CCVblSqj.js +1 -0
- package/dist/packem_shared/withMetrics-DWywX_6M.js +1 -0
- package/dist/packem_shared/withRender-VP9wE5Yr.js +1 -0
- package/dist/packem_shared/withSuppression-DBaZDMAr.js +1 -0
- package/dist/packem_shared/withTelemetry-DL2qo0Hp.js +1 -0
- package/dist/packem_shared/zeptomailProvider-DKBPSHPj.js +1 -0
- package/dist/providers/ahasend/index.d.ts +36 -3
- package/dist/providers/ahasend/index.js +1 -1
- package/dist/providers/aws-ses/index.d.ts +47 -3
- package/dist/providers/aws-ses/index.js +1 -1
- package/dist/providers/azure/index.d.ts +52 -3
- package/dist/providers/azure/index.js +1 -1
- package/dist/providers/brevo/index.d.ts +65 -3
- package/dist/providers/brevo/index.js +1 -1
- package/dist/providers/cloudflare-email/index.d.ts +36 -0
- package/dist/providers/cloudflare-email/index.js +1 -0
- package/dist/providers/failover/index.d.ts +27 -3
- package/dist/providers/failover/index.js +1 -1
- package/dist/providers/http/index.d.ts +35 -3
- package/dist/providers/http/index.js +1 -1
- package/dist/providers/infobip/index.d.ts +56 -3
- package/dist/providers/infobip/index.js +1 -1
- package/dist/providers/loops/index.d.ts +47 -0
- package/dist/providers/loops/index.js +1 -0
- package/dist/providers/mailchannels/index.d.ts +26 -0
- package/dist/providers/mailchannels/index.js +1 -0
- package/dist/providers/mailcrab/index.d.ts +32 -3
- package/dist/providers/mailcrab/index.js +1 -1
- package/dist/providers/mailersend/index.d.ts +51 -3
- package/dist/providers/mailersend/index.js +1 -1
- package/dist/providers/mailgun/index.d.ts +73 -3
- package/dist/providers/mailgun/index.js +1 -1
- package/dist/providers/mailjet/index.d.ts +72 -3
- package/dist/providers/mailjet/index.js +1 -1
- package/dist/providers/mailomat/index.d.ts +40 -3
- package/dist/providers/mailomat/index.js +1 -1
- package/dist/providers/mailpace/index.d.ts +52 -3
- package/dist/providers/mailpace/index.js +1 -1
- package/dist/providers/mailtrap/index.d.ts +44 -3
- package/dist/providers/mailtrap/index.js +1 -1
- package/dist/providers/mandrill/index.d.ts +87 -3
- package/dist/providers/mandrill/index.js +1 -1
- package/dist/providers/mock/index.d.ts +12 -3
- package/dist/providers/mock/index.js +1 -1
- package/dist/providers/netcore/index.d.ts +35 -0
- package/dist/providers/netcore/index.js +1 -0
- package/dist/providers/nodemailer/index.d.ts +38 -3
- package/dist/providers/nodemailer/index.js +1 -1
- package/dist/providers/opentelemetry/index.d.ts +37 -3
- package/dist/providers/opentelemetry/index.js +1 -1
- package/dist/providers/outlook365/index.d.ts +48 -0
- package/dist/providers/outlook365/index.js +1 -0
- package/dist/providers/plunk/index.d.ts +38 -3
- package/dist/providers/plunk/index.js +1 -1
- package/dist/providers/postal/index.d.ts +48 -3
- package/dist/providers/postal/index.js +1 -1
- package/dist/providers/postmark/index.d.ts +60 -3
- package/dist/providers/postmark/index.js +1 -1
- package/dist/providers/resend/index.d.ts +51 -3
- package/dist/providers/resend/index.js +1 -1
- package/dist/providers/roundrobin/index.d.ts +27 -3
- package/dist/providers/roundrobin/index.js +1 -1
- package/dist/providers/scaleway/index.d.ts +44 -3
- package/dist/providers/scaleway/index.js +1 -1
- package/dist/providers/sendgrid/index.d.ts +84 -3
- package/dist/providers/sendgrid/index.js +1 -1
- package/dist/providers/smtp/index.d.ts +71 -3
- package/dist/providers/smtp/index.js +1 -1
- package/dist/providers/sparkpost/index.d.ts +43 -0
- package/dist/providers/sparkpost/index.js +1 -0
- package/dist/providers/sweego/index.d.ts +40 -3
- package/dist/providers/sweego/index.js +1 -1
- package/dist/providers/zeptomail/index.d.ts +37 -3
- package/dist/providers/zeptomail/index.js +1 -1
- package/dist/queue/bullmq-queue.d.ts +46 -0
- package/dist/queue/bullmq-queue.js +1 -0
- package/dist/queue/index.d.ts +147 -0
- package/dist/queue/index.js +1 -0
- package/dist/queue/pg-boss-queue.d.ts +41 -0
- package/dist/queue/pg-boss-queue.js +1 -0
- package/dist/queue/sqs-queue.d.ts +72 -0
- package/dist/queue/sqs-queue.js +1 -0
- package/dist/queue/unstorage-queue.d.ts +199 -0
- package/dist/queue/unstorage-queue.js +1 -0
- package/dist/render/index.d.ts +107 -0
- package/dist/render/index.js +1 -0
- package/dist/template-engines/handlebars.d.ts +23 -22
- package/dist/template-engines/handlebars.js +1 -1
- package/dist/template-engines/html-to-text.d.ts +24 -24
- package/dist/template-engines/html-to-text.js +1 -1
- package/dist/template-engines/i18n.d.ts +61 -0
- package/dist/template-engines/i18n.js +1 -0
- package/dist/template-engines/jsx-email.d.ts +11 -0
- package/dist/template-engines/jsx-email.js +1 -0
- package/dist/template-engines/liquid.d.ts +12 -0
- package/dist/template-engines/liquid.js +1 -0
- package/dist/template-engines/mjml.d.ts +10 -10
- package/dist/template-engines/mjml.js +1 -1
- package/dist/template-engines/react-email.d.ts +9 -9
- package/dist/template-engines/react-email.js +1 -1
- package/dist/template-engines/vue-email.d.ts +9 -9
- package/dist/template-engines/vue-email.js +1 -1
- package/dist/test/index.d.ts +155 -0
- package/dist/test/index.js +1 -0
- package/dist/utils/cache.d.ts +49 -48
- package/dist/utils/cache.js +1 -1
- package/dist/utils/format-email-address.d.ts +8 -7
- package/dist/utils/format-email-address.js +1 -1
- package/dist/utils/normalize-email-aliases.d.ts +20 -20
- package/dist/utils/normalize-email-aliases.js +1 -1
- package/dist/utils/parse-address.d.ts +18 -17
- package/dist/utils/parse-address.js +1 -1
- package/dist/utils/parse-eml.d.ts +22 -0
- package/dist/utils/parse-eml.js +6 -0
- package/dist/utils/result.d.ts +49 -0
- package/dist/utils/result.js +1 -0
- package/dist/utils/validation/check-feature-support.d.ts +53 -0
- package/dist/utils/validation/check-feature-support.js +1 -0
- package/dist/utils/validation/validate-email.d.ts +5 -5
- package/dist/utils/validation/validate-email.js +1 -1
- package/dist/webhooks/index.d.ts +231 -0
- package/dist/webhooks/index.js +1 -0
- package/package.json +191 -81
- package/dist/attachment-helpers.d.ts +0 -64
- package/dist/crypto/dkim-signer.d.ts +0 -48
- package/dist/crypto/smime-encrypter.d.ts +0 -53
- package/dist/crypto/smime-signer.d.ts +0 -48
- package/dist/crypto/types.d.ts +0 -101
- package/dist/draft-mail-message.d.ts +0 -13
- package/dist/errors/email-error.d.ts +0 -17
- package/dist/errors/required-option-error.d.ts +0 -10
- package/dist/mail-message.d.ts +0 -425
- package/dist/mail.d.ts +0 -206
- package/dist/packem_shared/DkimSigner-pFd4c3fZ.js +0 -18
- package/dist/packem_shared/EmailError-zm2ffVav.js +0 -1
- package/dist/packem_shared/Mail-6Bltpy_p.js +0 -1
- package/dist/packem_shared/MailMessage-B76GPBBA.js +0 -1
- package/dist/packem_shared/RequiredOptionError-CevW3u2K.js +0 -1
- package/dist/packem_shared/SmimeEncrypter-CBevU534.js +0 -6
- package/dist/packem_shared/SmimeSigner-CObA4jzT.js +0 -8
- package/dist/packem_shared/address-formatter-Cm_E_ZMa.js +0 -1
- package/dist/packem_shared/ahaSendProvider-DlFKEQ6D.js +0 -1
- package/dist/packem_shared/attachment-processor-2rHmfa7j.js +0 -1
- package/dist/packem_shared/awsSesProvider-Ba-eVJxZ.js +0 -32
- package/dist/packem_shared/azureProvider-CQYAkgVF.js +0 -1
- package/dist/packem_shared/brevoProvider-5p6jjiK9.js +0 -1
- package/dist/packem_shared/build-mime-message-IYaUqqPJ.js +0 -2
- package/dist/packem_shared/create-logger-BiWdqFNg.js +0 -1
- package/dist/packem_shared/defineProvider-B9rSklAJ.js +0 -1
- package/dist/packem_shared/detectMimeType-S8WRsNtY.js +0 -1
- package/dist/packem_shared/failoverProvider-CAHQQueo.js +0 -1
- package/dist/packem_shared/generate-boundary-Cx8nXYS0.js +0 -1
- package/dist/packem_shared/generate-message-id-D4uA8gkj.js +0 -1
- package/dist/packem_shared/headers-to-record-Qo124ImV.js +0 -1
- package/dist/packem_shared/httpProvider-CZD6LZX3.js +0 -1
- package/dist/packem_shared/infobipProvider-CtLwrUaP.js +0 -1
- package/dist/packem_shared/mailPaceProvider-B6yKvh6z.js +0 -1
- package/dist/packem_shared/mailerSendProvider-CeeIXFnW.js +0 -1
- package/dist/packem_shared/mailgunProvider-mmjKzouh.js +0 -1
- package/dist/packem_shared/mailjetProvider-DwN6i0VA.js +0 -1
- package/dist/packem_shared/mailomatProvider-DMQmjKHT.js +0 -1
- package/dist/packem_shared/mailtrapProvider-BN3UBEQw.js +0 -1
- package/dist/packem_shared/make-request-BDzF9W9D.js +0 -1
- package/dist/packem_shared/mandrillProvider-370y7CLu.js +0 -1
- package/dist/packem_shared/mockProvider-DN5ZwutD.js +0 -1
- package/dist/packem_shared/nodemailerProvider-_w8QXMU-.js +0 -1
- package/dist/packem_shared/opentelemetryProvider-C_ZXOLSd.js +0 -1
- package/dist/packem_shared/plunkProvider-DfJumQ4U.js +0 -1
- package/dist/packem_shared/postalProvider-Bavx2FcH.js +0 -1
- package/dist/packem_shared/postmarkProvider-DFC0uvjO.js +0 -1
- package/dist/packem_shared/provider-base-Cmzx6BTO.js +0 -1
- package/dist/packem_shared/readFile-BlZxbhCU-C8bCdiA2.js +0 -1
- package/dist/packem_shared/resendProvider-CfqU7UdE.js +0 -1
- package/dist/packem_shared/roundRobinProvider-1WQnuKR8.js +0 -1
- package/dist/packem_shared/sanitize-header-wWav-Scu.js +0 -1
- package/dist/packem_shared/scalewayProvider-be1HPimL.js +0 -1
- package/dist/packem_shared/sendGridProvider-BVI1sq3n.js +0 -1
- package/dist/packem_shared/smtpProvider-BV-ufR53.js +0 -23
- package/dist/packem_shared/sweegoProvider-7419CSAq.js +0 -1
- package/dist/packem_shared/validate-email-options-DfJ7llf8.js +0 -1
- package/dist/packem_shared/zeptomailProvider-C2lh0Xmo.js +0 -1
- package/dist/providers/ahasend/provider.d.ts +0 -7
- package/dist/providers/ahasend/types.d.ts +0 -28
- package/dist/providers/aws-ses/provider.d.ts +0 -8
- package/dist/providers/aws-ses/types.d.ts +0 -38
- package/dist/providers/azure/provider.d.ts +0 -7
- package/dist/providers/azure/types.d.ts +0 -44
- package/dist/providers/brevo/provider.d.ts +0 -7
- package/dist/providers/brevo/types.d.ts +0 -57
- package/dist/providers/failover/provider.d.ts +0 -7
- package/dist/providers/failover/types.d.ts +0 -19
- package/dist/providers/http/provider.d.ts +0 -7
- package/dist/providers/http/types.d.ts +0 -27
- package/dist/providers/infobip/provider.d.ts +0 -7
- package/dist/providers/infobip/types.d.ts +0 -48
- package/dist/providers/mailcrab/provider.d.ts +0 -9
- package/dist/providers/mailcrab/types.d.ts +0 -22
- package/dist/providers/mailersend/provider.d.ts +0 -7
- package/dist/providers/mailersend/types.d.ts +0 -43
- package/dist/providers/mailgun/provider.d.ts +0 -7
- package/dist/providers/mailgun/types.d.ts +0 -65
- package/dist/providers/mailjet/provider.d.ts +0 -7
- package/dist/providers/mailjet/types.d.ts +0 -64
- package/dist/providers/mailomat/provider.d.ts +0 -7
- package/dist/providers/mailomat/types.d.ts +0 -32
- package/dist/providers/mailpace/provider.d.ts +0 -7
- package/dist/providers/mailpace/types.d.ts +0 -44
- package/dist/providers/mailtrap/provider.d.ts +0 -7
- package/dist/providers/mailtrap/types.d.ts +0 -36
- package/dist/providers/mandrill/provider.d.ts +0 -7
- package/dist/providers/mandrill/types.d.ts +0 -79
- package/dist/providers/mock/provider.d.ts +0 -8
- package/dist/providers/mock/types.d.ts +0 -50
- package/dist/providers/nodemailer/provider.d.ts +0 -7
- package/dist/providers/nodemailer/types.d.ts +0 -30
- package/dist/providers/opentelemetry/provider.d.ts +0 -8
- package/dist/providers/opentelemetry/types.d.ts +0 -31
- package/dist/providers/plunk/provider.d.ts +0 -7
- package/dist/providers/plunk/types.d.ts +0 -30
- package/dist/providers/postal/provider.d.ts +0 -7
- package/dist/providers/postal/types.d.ts +0 -40
- package/dist/providers/postmark/provider.d.ts +0 -7
- package/dist/providers/postmark/types.d.ts +0 -52
- package/dist/providers/provider.d.ts +0 -27
- package/dist/providers/resend/provider.d.ts +0 -7
- package/dist/providers/resend/types.d.ts +0 -43
- package/dist/providers/roundrobin/provider.d.ts +0 -7
- package/dist/providers/roundrobin/types.d.ts +0 -19
- package/dist/providers/scaleway/provider.d.ts +0 -7
- package/dist/providers/scaleway/types.d.ts +0 -36
- package/dist/providers/sendgrid/provider.d.ts +0 -7
- package/dist/providers/sendgrid/types.d.ts +0 -76
- package/dist/providers/smtp/provider.d.ts +0 -7
- package/dist/providers/smtp/types.d.ts +0 -63
- package/dist/providers/sweego/provider.d.ts +0 -7
- package/dist/providers/sweego/types.d.ts +0 -32
- package/dist/providers/utils/address-formatter.d.ts +0 -139
- package/dist/providers/utils/attachment-processor.d.ts +0 -58
- package/dist/providers/utils/index.d.ts +0 -4
- package/dist/providers/utils/payload-builder.d.ts +0 -78
- package/dist/providers/utils/provider-base.d.ts +0 -69
- package/dist/providers/zeptomail/provider.d.ts +0 -7
- package/dist/providers/zeptomail/types.d.ts +0 -29
- package/dist/template-engines/types.d.ts +0 -8
- package/dist/types.d.ts +0 -203
- package/dist/utils/build-mime-message.d.ts +0 -8
- package/dist/utils/create-logger.d.ts +0 -16
- package/dist/utils/format-email-addresses.d.ts +0 -8
- package/dist/utils/generate-boundary.d.ts +0 -7
- package/dist/utils/generate-message-id.d.ts +0 -6
- package/dist/utils/headers-to-record.d.ts +0 -9
- package/dist/utils/is-port-available.d.ts +0 -9
- package/dist/utils/make-request.d.ts +0 -18
- package/dist/utils/retry.d.ts +0 -10
- package/dist/utils/sanitize-header.d.ts +0 -14
- package/dist/utils/to-base64.d.ts +0 -8
- package/dist/utils/validation/check-mx-records.d.ts +0 -42
- package/dist/utils/validation/check-mx-records.js +0 -1
- package/dist/utils/validation/disposable-email-domains.d.ts +0 -13
- package/dist/utils/validation/disposable-email-domains.js +0 -1
- package/dist/utils/validation/role-accounts.d.ts +0 -21
- package/dist/utils/validation/role-accounts.js +0 -1
- package/dist/utils/validation/validate-email-options.d.ts +0 -8
- package/dist/utils/validation/verify-email.d.ts +0 -47
- package/dist/utils/validation/verify-email.js +0 -1
- package/dist/utils/validation/verify-smtp.d.ts +0 -39
- package/dist/utils/validation/verify-smtp.js +0 -4
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import d from"./EmailError-B-sEf3bp.js";import T from"./RequiredOptionError-DuNNY_a5.js";import{e as A}from"./generate-message-id-gXAuMz4g.js";import{s as I}from"./headers-to-record-De1Eg951.js";import{m}from"./make-request-BlK_B72c.js";import{u as g}from"./retry-3pnxTuNs.js";import{f as P}from"./validate-email-options-mCM9dVug.js";import{defineProvider as C}from"./defineProvider-C9q-7iwt.js";import{P as k,h as b,c as E}from"./provider-base-C7PuopYK.js";import{f as p,a as y}from"./address-formatter-BWR2Dddx.js";import{p as j}from"./attachment-processor-CMp7qqMI.js";const r="brevo",S="https://api.brevo.com/v3",z=3e4,K=3,L=C((n={})=>{if(!n.apiKey)throw new T(r,"apiKey");const v=n.endpoint??S,s={apiKey:n.apiKey,debug:n.debug??!1,endpoint:v,hardValidation:n.hardValidation??!1,retries:n.retries??K,timeout:n.timeout??z,...n.logger&&{logger:n.logger}},u=new k,i=E(r,n.logger);return{endpoint:s.endpoint,features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!0,tagging:!0,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new d(r,"Email ID is required to retrieve email details"),success:!1};await u.ensureInitialized(()=>this.initialize(),r);const t={"api-key":s.apiKey,"Content-Type":"application/json"};i.debug("Retrieving email details",{id:e});const l=await g(async()=>m(`${s.endpoint}/smtp/emails/${e}`,{headers:t,method:"GET",timeout:s.timeout}),s.retries);return l.success?(i.debug("Email details retrieved successfully"),{data:l.data?.body,success:!0}):(i.debug("API request failed when retrieving email",l.error),{error:new d(r,`Failed to retrieve email: ${l.error instanceof Error?l.error.message:"Unknown error"}`,{cause:l.error}),success:!1})}catch(t){return{error:b(r,"retrieve email",t,i),success:!1}}},async initialize(){await u.ensureInitialized(async()=>{if(!await this.isAvailable())throw new d(r,"Brevo API not available or invalid API key");i.debug("Provider initialized successfully")},r)},async isAvailable(){try{const e={"api-key":s.apiKey,"Content-Type":"application/json"};i.debug("Checking Brevo API availability");const t=await m(`${s.endpoint}/account`,{headers:e,method:"GET",timeout:s.timeout});return i.debug("Brevo API availability check response:",{error:t.error instanceof Error?t.error.message:void 0,statusCode:t.data?.statusCode,success:t.success}),!!(t.success&&t.data&&typeof t.data=="object"&&"statusCode"in t.data&&typeof t.data.statusCode=="number"&&t.data.statusCode>=200&&t.data.statusCode<300)}catch(e){return i.debug("Error checking availability:",e),!1}},name:r,options:s,async sendEmail(e){try{let t;Array.isArray(e.replyTo)?t=e.replyTo.length>0?e.replyTo[0]:void 0:t=e.replyTo;const l={...e,replyTo:t},f=P(l);if(f.length>0)return{error:new d(r,`Invalid email options: ${f.join(", ")}`),success:!1};await u.ensureInitialized(()=>this.initialize(),r);const a={sender:y(e.from),subject:e.subject,to:p(e.to)};if(e.html&&(a.htmlContent=e.html),e.text&&(a.textContent=e.text),e.cc&&(a.cc=p(e.cc)),e.bcc&&(a.bcc=p(e.bcc)),e.replyTo)if(Array.isArray(e.replyTo)){if(s.hardValidation)return{error:new d(r,"Only one replyTo address is allowed"),success:!1};if(e.replyTo.length===0)return{error:new d(r,"replyTo array cannot be empty"),success:!1};const o=e.replyTo[0];if(!o)return{error:new d(r,"replyTo array cannot be empty"),success:!1};a.replyTo=y(o)}else a.replyTo=y(e.replyTo);if(e.templateId&&(a.templateId=e.templateId,e.templateParams&&(a.params=e.templateParams)),e.tags&&e.tags.length>0&&(a.tags=e.tags),e.scheduledAt){const o=typeof e.scheduledAt=="number"?new Date(e.scheduledAt*1e3).toISOString():e.scheduledAt;a.scheduledAt=o}if(e.batchId&&(a.batchId=e.batchId),e.headers){const o=I(e.headers);a.headers=o}e.attachments&&e.attachments.length>0&&(a.attachment=await Promise.all(e.attachments.map(async o=>({content:await j(o,r),name:o.filename,...o.contentType&&{type:o.contentType}})))),i.debug("Sending email via Brevo API",{subject:a.subject,to:a.to});const w={"api-key":s.apiKey,"Content-Type":"application/json"},c=await g(async()=>m(`${s.endpoint}/smtp/email`,{headers:w,method:"POST",timeout:s.timeout},JSON.stringify(a)),s.retries);if(!c.success)return i.debug("API request failed when sending email",c.error),{error:c.error??new d(r,"Failed to send email"),success:!1};const h=c.data?.body?.messageId??A();return i.debug("Email sent successfully",{messageId:h}),{data:{messageId:h,provider:r,response:c.data,sent:!0,timestamp:new Date},success:!0}}catch(t){return{error:b(r,"send email",t,i),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{L as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import v from"./EmailError-B-sEf3bp.js";import l from"../utils/format-email-address.js";import{r as F}from"./generate-boundary-DQbzDiOI.js";import{s as M}from"./headers-to-record-De1Eg951.js";import{f as g}from"./quoted-printable-nSGDA1tA.js";import{a as T,s as f}from"./sanitize-header-DJhgZl3y.js";const d=globalThis.Buffer!==void 0,$=t=>{if(typeof t=="string"){if(d)return Buffer.from(t,"utf8").toString("base64");const e=new TextEncoder().encode(t);let r="";const n=8192;for(let s=0;s<e.length;s+=n){const i=e.subarray(s,Math.min(s+n,e.length));r+=String.fromCharCode(...i)}return btoa(r)}if(d&&t instanceof Buffer)return t.toString("base64");const a=t instanceof Uint8Array?t:new Uint8Array(t);if(d)return Buffer.from(a).toString("base64");let h="";const o=8192;for(let e=0;e<a.length;e+=o){const r=a.subarray(e,Math.min(e+o,a.length));h+=String.fromCharCode(...r)}return btoa(h)},j=globalThis.Buffer!==void 0,A=/[^\u0000-\u007F]/,S=t=>!A.test(t),U=t=>{if(S(t))return t;const a=45,h=new TextDecoder,o=j?Buffer.from(t,"utf8"):new TextEncoder().encode(t),e=[];let r=0;for(;r<o.length;){let n=Math.min(r+a,o.length);if(n<o.length)for(;n>r&&(o[n]&192)===128;)n-=1;const s=o.subarray(r,n),i=h.decode(s);e.push(`=?UTF-8?B?${$(i)}?=`),r=n}return e.join(" ")},b=t=>Array.isArray(t)?t.map(a=>l(a)).join(", "):l(t),y=/[^ -]/,C=t=>U(f(t)),D=globalThis.Buffer!==void 0,x=t=>t.replaceAll(/.{1,76}/g,`$&\r
|
|
2
|
+
`).trimEnd(),P=async(t,a={})=>{const{includeBcc:h=!1}=a,o=F(),e=[`From: ${l(t.from)}`,`To: ${b(t.to)}`];if(t.cc&&e.push(`Cc: ${b(t.cc)}`),h&&t.bcc&&e.push(`Bcc: ${b(t.bcc)}`),t.replyTo&&e.push(`Reply-To: ${l(t.replyTo)}`),e.push(`Subject: ${C(t.subject)}`,"MIME-Version: 1.0"),t.headers){const r=M(t.headers);Object.entries(r).forEach(([n,s])=>{const i=T(n),p=f(s);e.push(`${i}: ${p}`)})}if(e.push(`Content-Type: multipart/mixed; boundary="${o}"`,""),t.text&&(y.test(t.text)?e.push(`--${o}`,"Content-Type: text/plain; charset=UTF-8","Content-Transfer-Encoding: quoted-printable","",g(t.text),""):e.push(`--${o}`,"Content-Type: text/plain; charset=UTF-8","Content-Transfer-Encoding: 7bit","",t.text,"")),t.html&&(y.test(t.html)?e.push(`--${o}`,"Content-Type: text/html; charset=UTF-8","Content-Transfer-Encoding: quoted-printable","",g(t.html),""):e.push(`--${o}`,"Content-Type: text/html; charset=UTF-8","Content-Transfer-Encoding: 7bit","",t.html,"")),t.attachments&&t.attachments.length>0){const r=await Promise.all(t.attachments.map(async n=>{let s;if(n.raw!==void 0)s=n.raw;else{if(n.content===void 0)throw new v("attachment",`Attachment '${n.filename}' must have content, raw, or be resolved from path/href before building MIME message`);s=n.content instanceof Promise?await n.content:n.content}return{...n,resolvedContent:s}}));for(const n of r){e.push(`--${o}`);const s=f(n.contentType??"application/octet-stream"),i=C(n.filename);e.push(`Content-Type: ${s}; name="${i}"`);const p=f(n.contentDisposition??"attachment");e.push(`Content-Disposition: ${p}; filename="${i}"`),n.cid&&e.push(`Content-ID: <${f(n.cid)}>`),n.headers&&Object.entries(n.headers).forEach(([m,w])=>{const B=T(m),E=f(w);e.push(`${B}: ${E}`)});const u=f(n.encoding??"base64");e.push(`Content-Transfer-Encoding: ${u}`,"");const c=n.resolvedContent;if(u==="base64")e.push(x($(c)));else if(u==="7bit"||u==="8bit")if(typeof c=="string")e.push(c);else if(D&&c instanceof Buffer)e.push(c.toString("utf8"));else{const m=new TextDecoder;e.push(m.decode(c))}else e.push(x($(c)));e.push("")}}return e.push(`--${o}--`),e.join(`\r
|
|
3
|
+
`)};export{P as F};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const u=r=>{const{mailto:s,mailtoSubject:e="unsubscribe",oneClick:o=!1,url:t}=r;if(!t&&!s)throw new TypeError("buildListUnsubscribe requires at least one of `url` or `mailto`");const i=[];t&&i.push(`<${t}>`),s&&(s.startsWith("mailto:")?i.push(`<${s}>`):i.push(`<mailto:${s}?subject=${encodeURIComponent(e)}>`));const n={"List-Unsubscribe":i.join(", ")};if(o){if(!t?.startsWith("https:"))throw new TypeError("One-click unsubscribe (RFC 8058) requires an https `url`");n["List-Unsubscribe-Post"]="List-Unsubscribe=One-Click"}return n},c=r=>{const s=r.match(/<[^<>]+>/g);return s?s.map(e=>e.slice(1,-1).trim()):[]};export{u as buildListUnsubscribe,c as parseListUnsubscribe};
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const c=new Set(["enforce","none","testing"]),g=o=>{const n=[];let e,r,s;for(const m of o.replaceAll(`\r
|
|
2
|
+
`,`
|
|
3
|
+
`).split(`
|
|
4
|
+
`)){const a=m.indexOf(":");if(a===-1)continue;const i=m.slice(0,a).trim().toLowerCase(),t=m.slice(a+1).trim();if(i==="version")e=t;else if(i==="mode"&&(t==="enforce"||t==="testing"||t==="none"))r=t;else if(i==="max_age"){const l=Number.parseInt(t,10);s=Number.isNaN(l)?void 0:l}else i==="mx"&&t.length>0&&n.push(t)}return{maxAge:s,mode:r,mx:n,valid:e==="STSv1"&&r!==void 0&&s!==void 0,version:e}},d=o=>{if(!c.has(o.mode))throw new TypeError('buildMtaStsPolicy: `mode` must be one of "enforce", "testing", or "none"');if(!Number.isInteger(o.maxAge)||o.maxAge<0)throw new TypeError("buildMtaStsPolicy: `maxAge` must be a non-negative integer");const n=o.mx.map(e=>e.trim());if(n.length===0||n.some(e=>e.length===0))throw new TypeError("buildMtaStsPolicy: `mx` must contain at least one non-empty host");return`${["version: STSv1",`mode: ${o.mode}`,...n.map(e=>`mx: ${e}`),`max_age: ${String(o.maxAge)}`].join(`\r
|
|
5
|
+
`)}\r
|
|
6
|
+
`};export{d as buildMtaStsPolicy,g as parseMtaStsPolicy};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import w from"./EmailError-B-sEf3bp.js";const C=(c={})=>{const{failureThreshold:u=5,now:s=Date.now,onStateChange:p,resetTimeout:d=3e4}=c;let e="closed",n=0,l=0,t=!1;const a=r=>{e!==r&&(e=r,p?.(r))},i=()=>({error:new w("middleware","Circuit breaker is open",{code:"CIRCUIT_OPEN"}),success:!1});return async(r,h)=>{if(e==="open"&&s()-l>=d&&(a("half-open"),t=!1),e==="open")return i();let f=!1;if(e==="half-open"){if(t)return i();t=!0,f=!0}let o;try{o=await h(r)}finally{f&&(t=!1)}return o.success?(n=0,a("closed"),o):(n+=1,(e==="half-open"||n>=u)&&(l=s(),a("open")),o)}};export{C as circuitBreakerMiddleware};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import a from"./EmailError-B-sEf3bp.js";import m from"./RequiredOptionError-DuNNY_a5.js";import{F as d}from"./build-mime-message-B6927SQy.js";import{e as f}from"./generate-message-id-gXAuMz4g.js";import{s as u}from"./headers-to-record-De1Eg951.js";import{f as p}from"./validate-email-options-mCM9dVug.js";import{defineProvider as g}from"./defineProvider-C9q-7iwt.js";import{h,c as v}from"./provider-base-C7PuopYK.js";const r="cloudflare-email",C=g((t={})=>{if(typeof t.send!="function")throw new m(r,"send");const c=v(r,t.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!0,html:!0,replyTo:!0,scheduling:!1,tagging:!1,templates:!1,tracking:!1},async initialize(){await Promise.resolve()},async isAvailable(){return typeof t.send=="function"},name:r,async sendEmail(e){try{const s=p(e);if(s.length>0)return{error:new a(r,`Invalid email options: ${s.join(", ")}`),success:!1};const i=Array.isArray(e.to)?e.to:[e.to];if(i.length!==1||e.cc!==void 0||e.bcc!==void 0)return{error:new a(r,"Cloudflare Email supports exactly one `to` recipient and does not support cc/bcc"),success:!1};const[o]=i;if(!o)return{error:new a(r,"A single `to` recipient is required"),success:!1};const n=f(),l=await d({...e,headers:{...e.headers?u(e.headers):{},"Message-ID":n}});return await t.send(e.from.email,o.email,l),{data:{messageId:n,provider:r,sent:!0,timestamp:new Date},success:!0}}catch(s){return{error:h(r,"send email",s,c),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{C as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const c=(o,t)=>{let e=t;for(const r of o.toReversed()){const n=e;e=s=>r(s,n)}return e};export{c as composeMiddleware};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a=(n,e)=>{const $=()=>{};return e?{debug:(r,...o)=>{e.log(`[${n}] ${r}`,...o)},error:(r,...o)=>{e.error(`[${n}] ${r}`,...o)},info:(r,...o)=>{e.info(`[${n}] ${r}`,...o)},warn:(r,...o)=>{e.warn(`[${n}] ${r}`,...o)}}:{debug:$,error:$,info:$,warn:$}};export{a as c};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import a from"./MemorySuppressionStore-DZnbz-_B.js";const i=async(r,p)=>{const t=Array.isArray(r)?r:[r],o=[],e=[];for(const s of t)await p.has(s.email)?e.push(s):o.push(s);return{allowed:o,suppressed:e}},u=r=>new a(r);export{a as MemorySuppressionStore,u as createSuppressionStore,i as filterSuppressed};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createMail as w}from"./Mail-C1zp-fqt.js";import u from"./mockProvider-Behywbl1.js";const d=(t,o,e,n)=>{const r=Date.now()+e;return new Promise((s,c)=>{const a=()=>{const i=t.find(m=>o(m));if(i){s(i);return}if(Date.now()>=r){c(new Error("waitFor timed out before a matching message was captured"));return}setTimeout(a,n)};a()})},l=()=>{const t=u(),o=w(t),e=t.getInstance?.();if(!e)throw new Error("mockProvider() did not expose getInstance(); cannot create a test harness");return{mail:o,reset:()=>{e.length=0},sent:()=>e,waitFor:(n,r={})=>d(e,n,r.timeout??1e3,r.interval??10)}};export{l as createTestEmail};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const p=n=>1e3*2**(n-1),g=n=>{const{backoff:y=p,concurrency:E=1,maxAttempts:d=3,onDeadLetter:m,onError:l,onReserveError:v,pollInterval:h=1e3,queue:e,send:k}=n;let c=!1,o=0,s;const i=async(r,t)=>{try{await t()}catch(a){l?.(r,{error:a instanceof Error?a:new Error(String(a)),success:!1})}},u=async r=>{let t;try{t=await k(r.message)}catch(f){t={error:f instanceof Error?f:new Error(String(f)),success:!1}}if(t.success){await i(r,()=>e.ack(r.id));return}l?.(r,t);const a=r.attempts+1;if(a>=d){await i(r,()=>e.ack(r.id)),m?.(r,t);return}await i(r,()=>e.retry(r.id,y(a)))},w=async()=>{if(c){try{for(;o<E;){const r=await e.reserve();if(!r)break;o+=1,u(r).finally(()=>{o-=1}).catch(()=>{})}}catch(r){v?.(r instanceof Error?r:new Error(String(r)))}c&&(s=setTimeout(()=>{w().catch(()=>{})},h))}};return{drain:async()=>{let r=await e.reserve();for(;r;)await u(r),r=await e.reserve()},start:()=>{c||(c=!0,w().catch(()=>{}))},stop:()=>{c=!1,s&&(clearTimeout(s),s=void 0)}}};export{g as createWorker};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as m}from"node:module";const _=m(import.meta.url),r=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,f=t=>{if(typeof r<"u"&&r.versions&&r.versions.node){const[e,s]=r.versions.node.split(".").map(Number);if(e>22||e===22&&s>=3||e===20&&s>=16)return r.getBuiltinModule(t)}return _(t)},{createHash:g}=f("node:crypto"),p=t=>t?(Array.isArray(t)?t:[t]).map(e=>e.email.toLowerCase()).toSorted((e,s)=>e.localeCompare(s)).join(","):"",y=t=>{const e=g("sha256");return e.update(p(t.to)),e.update("\0"),e.update(p(t.cc)),e.update("\0"),e.update(t.subject),e.update("\0"),e.update(t.text??t.html??""),e.digest("hex")},j=(t={})=>{const{keyFn:e=y,now:s=Date.now,ttl:d=6e4}=t,a=new Map;return async(c,l)=>{const i=e(c),u=s(),o=a.get(i);if(o&&o.expires>u)return o.result;const n=await l(c);return n.success&&a.set(i,{expires:u+d,result:n}),n}};export{j as dedupeMiddleware};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import n from"./parseCloudflareInbound-C__j-oNa.js";import a from"./parseMailgunInbound-BpC6uPNe.js";import i from"./parsePostmarkInbound-Co3_c6-9.js";import s from"./parseSendGridInbound-DsALoijO.js";import m from"./parseSesInbound-CH5tHIjp.js";import{extractReply as c}from"./extractReply-BUjIBt9A.js";const u=(e,r)=>{switch(e){case"cloudflare":return n(r);case"mailgun":return a(r);case"sendgrid":return s(r);case"ses":return m(r);default:return i(r)}},w=e=>({handle:async(r,o)=>{try{const t=u(r,o);return e.stripReply&&t.text!==void 0&&(t.text=c(t.text)),await e.onMessage(t),t}catch(t){if(e.onError){await e.onError(t,r,o);return}throw t}}});export{w as defineInboundHandler,u as parseInbound};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=e=>e;export{o as defineProvider};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{z as o}from"./index-BoZvzveg.js";import a from"mime";const n=e=>a.getType(e)??"application/octet-stream",p=e=>{const t=e.replaceAll(/[^a-z0-9]/gi,"-").replaceAll(/-+/g,"-").replaceAll(/^-|-$/g,"").toLowerCase(),r=Math.random().toString(36).slice(2,9);return`${t}-${r}@email`},c=e=>o(e,{buffer:!0});export{n as detectMimeType,p as generateContentId,c as readFileAsBuffer};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=e=>Array.isArray(e)?e:e.sent(),c=e=>e?(Array.isArray(e)?e:[e]).map(t=>t.email.toLowerCase()):[],m=e=>[...c(e.to),...c(e.cc),...c(e.bcc)],h=(e,t)=>{const n=t.toLowerCase(),s=o(e).some(a=>m(a.options).includes(n));return{message:()=>`expected ${s?"no ":""}email to have been sent to ${t}`,pass:s}},p=(e,t)=>{const n=o(e).some(s=>typeof t=="string"?s.options.subject===t:t.test(s.options.subject));return{message:()=>`expected ${n?"no ":""}email to have been sent with subject ${String(t)}`,pass:n}},v=(e,t)=>{const n=o(e).some(s=>{const a=s.options.attachments??[];return t===void 0?a.length>0:a.some(i=>i.filename===t)});return{message:()=>`expected ${n?"no ":""}email to have been sent with attachment${t?` "${t}"`:""}`,pass:n}},u=(e,t)=>{const n=typeof t=="function"?t:a=>Object.entries(t).every(([i,r])=>a[i]===r),s=o(e).some(a=>n(a.options));return{message:()=>`expected ${s?"no ":""}email to have been sent matching the given condition`,pass:s}},g={toHaveSentMatching:u,toHaveSentTo:h,toHaveSentWithAttachment:v,toHaveSentWithSubject:p},b=e=>{e.extend(g)};export{g as emailMatchers,b as registerEmailMatchers,u as toHaveSentMatching,h as toHaveSentTo,v as toHaveSentWithAttachment,p as toHaveSentWithSubject};
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The lifecycle/engagement event types that converge onto a single {@link EmailEvent} shape.
|
|
3
|
+
*
|
|
4
|
+
* The first group (`queued` → `failed`) is emitted by the send pipeline; the rest typically originate
|
|
5
|
+
* from provider webhooks (delivery/engagement signals).
|
|
6
|
+
*/
|
|
7
|
+
type EmailEventType = "attempt" | "bounced" | "clicked" | "complained" | "deferred" | "delivered" | "failed" | "opened" | "queued" | "sent" | "unsubscribed";
|
|
8
|
+
/**
|
|
9
|
+
* A single, provider-agnostic email event. Both internal send-lifecycle signals and normalized
|
|
10
|
+
* webhook events use this shape so a timeline can be reconstructed from one stream.
|
|
11
|
+
*/
|
|
12
|
+
interface EmailEvent {
|
|
13
|
+
/**
|
|
14
|
+
* Arbitrary structured payload (provider response, bounce sub-type, click URL, …).
|
|
15
|
+
*/
|
|
16
|
+
data?: Record<string, unknown>;
|
|
17
|
+
/**
|
|
18
|
+
* A unique id for this event.
|
|
19
|
+
*/
|
|
20
|
+
id: string;
|
|
21
|
+
/**
|
|
22
|
+
* The message this event concerns.
|
|
23
|
+
*/
|
|
24
|
+
messageId?: string;
|
|
25
|
+
/**
|
|
26
|
+
* The provider that produced (or will produce) the message.
|
|
27
|
+
*/
|
|
28
|
+
provider?: string;
|
|
29
|
+
/**
|
|
30
|
+
* The recipient address this event concerns, when applicable.
|
|
31
|
+
*/
|
|
32
|
+
recipient?: string;
|
|
33
|
+
/**
|
|
34
|
+
* When the event occurred.
|
|
35
|
+
*/
|
|
36
|
+
timestamp: Date;
|
|
37
|
+
/**
|
|
38
|
+
* The kind of event.
|
|
39
|
+
*/
|
|
40
|
+
type: EmailEventType;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* A listener invoked for matching {@link EmailEvent}s.
|
|
44
|
+
*/
|
|
45
|
+
type EmailEventListener = (event: EmailEvent) => void;
|
|
46
|
+
/**
|
|
47
|
+
* A persistence backend for {@link EmailEvent}s.
|
|
48
|
+
*/
|
|
49
|
+
interface EventStore {
|
|
50
|
+
/**
|
|
51
|
+
* Appends an event.
|
|
52
|
+
* @param event The event to store.
|
|
53
|
+
*/
|
|
54
|
+
append: (event: EmailEvent) => Promise<void> | void;
|
|
55
|
+
/**
|
|
56
|
+
* Returns the full, time-ordered timeline for a message.
|
|
57
|
+
* @param messageId The message to reconstruct.
|
|
58
|
+
*/
|
|
59
|
+
timeline: (messageId: string) => EmailEvent[] | Promise<EmailEvent[]>;
|
|
60
|
+
}
|
|
61
|
+
type Selector = "*" | EmailEventType;
|
|
62
|
+
/**
|
|
63
|
+
* The wildcard selector that subscribes to every event type.
|
|
64
|
+
*/
|
|
65
|
+
declare const ALL_EVENTS: "*";
|
|
66
|
+
/**
|
|
67
|
+
* A tiny synchronous pub/sub bus for {@link EmailEvent}s.
|
|
68
|
+
*
|
|
69
|
+
* Subscribe to a specific {@link EmailEventType} or to {@link ALL_EVENTS} (`"*"`) for every event.
|
|
70
|
+
*/
|
|
71
|
+
declare class EventBus {
|
|
72
|
+
private readonly listeners;
|
|
73
|
+
/**
|
|
74
|
+
* Subscribes a listener to an event type (or all events).
|
|
75
|
+
* @param type The event type, or `"*"` for all events.
|
|
76
|
+
* @param listener The listener to invoke.
|
|
77
|
+
* @returns An unsubscribe function.
|
|
78
|
+
*/
|
|
79
|
+
on(type: Selector, listener: EmailEventListener): () => void;
|
|
80
|
+
/**
|
|
81
|
+
* Subscribes a listener that is removed after its first invocation.
|
|
82
|
+
* @param type The event type, or `"*"` for all events.
|
|
83
|
+
* @param listener The listener to invoke once.
|
|
84
|
+
* @returns An unsubscribe function.
|
|
85
|
+
*/
|
|
86
|
+
once(type: Selector, listener: EmailEventListener): () => void;
|
|
87
|
+
/**
|
|
88
|
+
* Removes a previously-added listener.
|
|
89
|
+
* @param type The event type the listener was registered under.
|
|
90
|
+
* @param listener The listener to remove.
|
|
91
|
+
*/
|
|
92
|
+
off(type: Selector, listener: EmailEventListener): void;
|
|
93
|
+
/**
|
|
94
|
+
* Emits an event to all matching listeners (type-specific first, then wildcard).
|
|
95
|
+
* @param event The event to dispatch.
|
|
96
|
+
*/
|
|
97
|
+
emit(event: EmailEvent): void;
|
|
98
|
+
/**
|
|
99
|
+
* Removes all listeners (optionally for a single type).
|
|
100
|
+
* @param type When provided, only listeners for this type are removed.
|
|
101
|
+
*/
|
|
102
|
+
clear(type?: Selector): void;
|
|
103
|
+
}
|
|
104
|
+
export { ALL_EVENTS as A, EmailEvent as E, EventStore as a, EmailEventListener as b, EmailEventType as c, EventBus as d };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const o=/\b(src|href)\s*=\s*(["'])cid:([^"']+)\2/gi,d=(t,e)=>t.replaceAll(o,(r,s,c,i)=>{const n=e(i);return n===void 0?r:`${s}=${c}${n}${c}`}),l=t=>{const e=new Set;for(const r of t.matchAll(o))r[3]&&e.add(r[3]);return[...e]};export{l as extractCidReferences,d as rewriteCidLinks};
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
const a=[/^On .*wrote:$/i,/^Am .*schrieb.*:$/i,/^Le .*a écrit ?:$/i,/^El .*escribió:$/i,/^.+\btarihinde\b.+yazdı:$/i],l=[/^-{2,}\s*Original Message\s*-{2,}/i,/^-{2,}\s*Forwarded message\s*-{2,}/i,/^_{5,}$/],c=/^--\s?$/,f=/^(?:from|von):\s/i,u=/^(?:to|an|cc|sent|gesendet|date|datum|subject|betreff|reply-to):\s/i,m=e=>e.startsWith(">")||l.some(r=>r.test(e))?!0:a.some(r=>r.test(e)),g=(e,r)=>{if(!f.test((e[r]??"").trim()))return!1;let i=0;for(let s=r+1;s<e.length&&i<3;s+=1){const t=e[s].trim();if(t!==""&&(i+=1,u.test(t)))return!0}return!1},p=(e,r={})=>{const{stripSignature:i=!0}=r,s=e.replaceAll(`\r
|
|
2
|
+
`,`
|
|
3
|
+
`).split(`
|
|
4
|
+
`),t=[];for(let n=0;n<s.length;n+=1){const o=s[n];if(m(o.trim())||g(s,n)||i&&c.test(o))break;t.push(o)}for(;t.length>0&&t[t.length-1].trim()==="";)t.pop();return t.join(`
|
|
5
|
+
`).trim()};export{p as extractReply};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import u from"./EmailError-B-sEf3bp.js";import b from"./RequiredOptionError-DuNNY_a5.js";import{c as w}from"./create-logger-BQTS3f-I.js";import{e as y}from"./generate-message-id-gXAuMz4g.js";import{defineProvider as $}from"./defineProvider-C9q-7iwt.js";import{d as A}from"./aggregate-features-BqEjPd42.js";const E=i=>typeof i=="function",z=i=>i!==null&&typeof i=="object"&&"sendEmail"in i&&"initialize"in i&&"isAvailable"in i,o="failover",j=$((i={})=>{if(!i.mailers||i.mailers.length===0)throw new b(o,"mailers");const d={debug:i.debug??!1,mailers:i.mailers,retryAfter:i.retryAfter??60};let v=!1;const t=[],n=w(o,i.logger);let g;const m=async()=>g||(g=(async()=>{t.length=0;for(const a of d.mailers)try{let e;if(E(a))e=a({});else if(z(a))e=a;else{n.debug(`Skipping invalid mailer: ${a}`);continue}try{await e.initialize(),t.push(e),n.debug(`Initialized provider: ${e.name??"unknown"}`)}catch(l){n.debug(`Failed to initialize provider ${e.name??"unknown"}:`,l)}}catch(e){n.debug("Error processing mailer:",e)}if(t.length===0)throw new u(o,"No providers could be initialized")})(),g);return{features:A(d.mailers),async initialize(){if(!v)try{await m(),v=!0,n.debug(`Failover provider initialized with ${t.length} provider(s)`)}catch(a){throw new u(o,`Failed to initialize: ${a.message}`,{cause:a})}},async isAvailable(){try{t.length===0&&await m();for(const a of t)try{if(await a.isAvailable())return!0}catch{}return!1}catch{return!1}},name:o,options:d,async sendEmail(a){try{if(t.length===0&&await m(),t.length===0)return{error:new u(o,"No providers available"),success:!1};const e=[];let l;for(let s=0;s<t.length;s+=1){const f=t[s];if(!f)continue;const c=f.name??`provider-${s+1}`;n.debug(`Attempting to send email via ${c} (${s+1}/${t.length})`);try{if(!await f.isAvailable()){n.debug(`Provider ${c} is not available, skipping`),e.push(new u(o,`Provider ${c} is not available`));continue}const r=await f.sendEmail(a);if(r.success&&r.data)return n.debug(`Email sent successfully via ${c}`),{data:{...r.data,messageId:r.data.messageId||y(),provider:`${o}(${c})`},success:!0};if(r.error){l=r.error,e.push(r.error);const p=r.error instanceof Error?r.error.message:String(r.error);n.debug(`Failed to send via ${c}:`,p)}}catch(r){l=r instanceof Error?r:new Error(String(r)),e.push(l);const p=l instanceof Error?l.message:String(l);n.debug(`Exception sending via ${c}:`,p)}s<t.length-1&&d.retryAfter>0&&(n.debug(`Waiting ${d.retryAfter}ms before trying next provider`),await new Promise(r=>{setTimeout(()=>{r()},d.retryAfter)}))}const h=e.map(s=>s instanceof Error?s.message:String(s)).join("; ");return{error:new u(o,`All providers failed. Errors: ${h}`,{cause:l}),success:!1}}catch(e){return{error:new u(o,`Failed to send email: ${e.message}`,{cause:e}),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{j as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const n=/[\r\n<>]/,i=e=>{let a=e.replaceAll(/[\r\n\t]+/g," ");a=[...a].filter(s=>{const t=s.codePointAt(0);return t===void 0?!1:t>=32&&t<=126||t>159}).join("");const r="\\",l='"';return a=a.replaceAll(r,r+r).replaceAll(l,r+l),a.trim().replaceAll(/\s+/g," ")},o=e=>{if(n.test(e.email))throw new Error("Invalid email address for header formatting");if(e.name){const a=i(e.name);if(a)return`"${a}" <${e.email}>`}return e.email},m=e=>(Array.isArray(e)?e:[e]).map(a=>o(a)).join(", ");export{o as a,m as f,i as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as t}from"node:module";const n=t(import.meta.url),e=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,i=r=>{if(typeof e<"u"&&e.versions&&e.versions.node){const[o,s]=e.versions.node.split(".").map(Number);if(o>22||o===22&&s>=3||o===20&&s>=16)return e.getBuiltinModule(r)}return n(r)},{randomBytes:c}=i("node:crypto"),u=()=>`----_=_NextPart_${c(16).toString("hex")}`;export{u as r};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const a=()=>{const t="visulima.local",n=Date.now(),o=Math.random().toString(36).slice(2,10);return`<${n}.${o}@${t}>`};export{a as e};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const r=e=>{if(!(e instanceof Headers))return e;const n={};return e.forEach((t,o)=>{n[o]=t}),n};export{r as s};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import c from"./EmailError-B-sEf3bp.js";import g from"./RequiredOptionError-DuNNY_a5.js";import{e as w}from"./generate-message-id-gXAuMz4g.js";import{m as u}from"./make-request-BlK_B72c.js";import{f as A}from"./validate-email-options-mCM9dVug.js";import{defineProvider as j}from"./defineProvider-C9q-7iwt.js";const i="http",v="POST",f=3e4,S=j((o={})=>{if(!o.endpoint)throw new g(i,"endpoint");const a={apiKey:o.apiKey??"",endpoint:o.endpoint,headers:o.headers??{},method:o.method??v},d=()=>{const e={"Content-Type":"application/json",...a.headers};return a.apiKey&&(e.Authorization=`Bearer ${a.apiKey}`),e},p=e=>{const t={from:e.from.email,from_name:e.from.name,html:e.html,subject:e.subject,text:e.text,to:Array.isArray(e.to)?e.to.map(s=>s.email):e.to.email};return e.cc&&(t.cc=Array.isArray(e.cc)?e.cc.map(s=>s.email):e.cc.email),e.bcc&&(t.bcc=Array.isArray(e.bcc)?e.bcc.map(s=>s.email):e.bcc.email),e.customParams&&Object.assign(t,e.customParams),t};let m=!1;return{features:{attachments:!1,batchSending:!1,customHeaders:!0,html:!0,replyTo:!1,scheduling:!1,tagging:!1,templates:!1,tracking:!1},async initialize(){if(!m){if(!await this.isAvailable())throw new c(i,"API endpoint not available");m=!0}},async isAvailable(){try{return!!(await u(a.endpoint,{headers:d(),method:"OPTIONS",timeout:f})).success}catch(e){if(e instanceof Error){const t=e.message;if(t.includes("401")||t.includes("403"))return!1}return!1}},name:i,options:a,async sendEmail(e){try{const t=A(e);if(t.length>0)return{error:new c(i,`Invalid email options: ${t.join(", ")}`),success:!1};m||await this.initialize();const s=d();e.headers&&Object.assign(s,e.headers);const h=p(e),y=e.endpointOverride??a.endpoint,b=e.methodOverride??a.method,n=await u(y,{headers:s,method:b,timeout:f},JSON.stringify(h));if(!n.success)return{error:new c(i,`Failed to send email: ${n.error?.message||"Unknown error"}`,{cause:n.error}),success:!1};let l;const r=n.data?.body;return r&&typeof r=="object"&&(l=r.id??r.messageId??(r.data&&typeof r.data=="object"&&(r.data.id??r.data.messageId))),l??=w(),{data:{messageId:l,provider:i,response:n.data?.body,sent:!0,timestamp:new Date},success:!0}}catch(t){return{error:new c(i,`Failed to send email: ${t.message}`,{cause:t}),success:!1}}},async validateCredentials(){try{const e=await u(a.endpoint,{headers:d(),method:"GET",timeout:f});return!!(e.data&&typeof e.data=="object"&&"statusCode"in e.data&&typeof e.data.statusCode=="number"&&e.data.statusCode>=200&&e.data.statusCode<300)}catch{return!1}}}});export{S as default};
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import{createRequire as It}from"node:module";const Pt=It(import.meta.url),de=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Dt=t=>{if(typeof de<"u"&&de.versions&&de.versions.node){const[e,o]=de.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return de.getBuiltinModule(t)}return Pt(t)},{createRequire:S}=Dt("node:module"),Gt=/^[A-Z]:\//i,Ut=(t="")=>t&&t.replaceAll("\\","/").replace(Gt,e=>e.toUpperCase()),zt=S(import.meta.url),be=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Kt=t=>{if(typeof be<"u"&&be.versions&&be.versions.node){const[e,o]=be.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return be.getBuiltinModule(t)}return zt(t)},{fileURLToPath:Ft}=Kt("node:url");function Xt(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var dt,bt;function jt(){return bt||(bt=1,dt=["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"]),dt}var Qt=jt();const Wt=Xt(Qt);new Set(Wt);const qt=t=>Ut(t instanceof URL?Ft(t):t),Zt=t=>{if(!t||!(t instanceof URL)&&typeof t!="string")throw new TypeError("Path must be a non-empty string or URL.")},Vt=S(import.meta.url),he=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Yt=t=>{if(typeof he<"u"&&he.versions&&he.versions.node){const[e,o]=he.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return he.getBuiltinModule(t)}return Vt(t)};Yt("node:fs/promises");const Jt=S(import.meta.url),me=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,eo=t=>{if(typeof me<"u"&&me.versions&&me.versions.node){const[e,o]=me.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return me.getBuiltinModule(t)}return Jt(t)};eo("node:fs");const to=S(import.meta.url),ye=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,oo=t=>{if(typeof ye<"u"&&ye.versions&&ye.versions.node){const[e,o]=ye.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return ye.getBuiltinModule(t)}return to(t)};oo("node:fs/promises");const so=S(import.meta.url),ve=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ro=t=>{if(typeof ve<"u"&&ve.versions&&ve.versions.node){const[e,o]=ve.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return ve.getBuiltinModule(t)}return so(t)};ro("node:fs");const no=S(import.meta.url),$e=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,uo=t=>{if(typeof $e<"u"&&$e.versions&&$e.versions.node){const[e,o]=$e.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return $e.getBuiltinModule(t)}return no(t)};uo("node:fs/promises");const io=S(import.meta.url),Ee=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,lo=t=>{if(typeof Ee<"u"&&Ee.versions&&Ee.versions.node){const[e,o]=Ee.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ee.getBuiltinModule(t)}return io(t)};lo("node:fs");const ao=S(import.meta.url),Re=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,po=t=>{if(typeof Re<"u"&&Re.versions&&Re.versions.node){const[e,o]=Re.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Re.getBuiltinModule(t)}return ao(t)};po("node:fs/promises");const co=S(import.meta.url),_e=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,fo=t=>{if(typeof _e<"u"&&_e.versions&&_e.versions.node){const[e,o]=_e.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return _e.getBuiltinModule(t)}return co(t)};fo("node:fs");const go=S(import.meta.url),Ae=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,bo=t=>{if(typeof Ae<"u"&&Ae.versions&&Ae.versions.node){const[e,o]=Ae.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ae.getBuiltinModule(t)}return go(t)};bo("node:fs/promises");const ho=S(import.meta.url),Te=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,mo=t=>{if(typeof Te<"u"&&Te.versions&&Te.versions.node){const[e,o]=Te.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Te.getBuiltinModule(t)}return ho(t)};mo("node:fs");S(import.meta.url);const yo=S(import.meta.url),xe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,vo=t=>{if(typeof xe<"u"&&xe.versions&&xe.versions.node){const[e,o]=xe.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return xe.getBuiltinModule(t)}return yo(t)};vo("node:fs/promises");const $o=S(import.meta.url),Ce=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Eo=t=>{if(typeof Ce<"u"&&Ce.versions&&Ce.versions.node){const[e,o]=Ce.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ce.getBuiltinModule(t)}return $o(t)};Eo("node:fs");const Ro=S(import.meta.url),Se=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,_o=t=>{if(typeof Se<"u"&&Se.versions&&Se.versions.node){const[e,o]=Se.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Se.getBuiltinModule(t)}return Ro(t)};_o("node:fs/promises");const Ao=S(import.meta.url),Oe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,To=t=>{if(typeof Oe<"u"&&Oe.versions&&Oe.versions.node){const[e,o]=Oe.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Oe.getBuiltinModule(t)}return Ao(t)};To("node:fs");function ct(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var ht={},ot,mt;function et(){if(mt)return ot;mt=1;const t="[^\\\\/]",e=Symbol("unignore"),o="\\.",H="\\+",b="\\?",n="\\/",l="(?=.)",f="[^/]",a=`(?:${n}|$)`,R=`(?:^|${n})`,g=`${o}{1,2}${a}`,T=`(?!${o})`,C=`(?!${R}${g})`,_=`(?!${o}{0,1}${a})`,L=`(?!${g})`,te=`[^.${n}]`,q=`${f}*?`,Z="/",M={DOT_LITERAL:o,PLUS_LITERAL:H,QMARK_LITERAL:b,SLASH_LITERAL:n,ONE_CHAR:l,QMARK:f,END_ANCHOR:a,DOTS_SLASH:g,NO_DOT:T,NO_DOTS:C,NO_DOT_SLASH:_,NO_DOTS_SLASH:L,QMARK_NO_DOT:te,STAR:q,START_ANCHOR:R,SEP:Z},d={...M,SLASH_LITERAL:"[\\\\/]",QMARK:t,STAR:`${t}*?`,DOTS_SLASH:`${o}{1,2}(?:[\\\\/]|$)`,NO_DOT:`(?!${o})`,NO_DOTS:`(?!(?:^|[\\\\/])${o}{1,2}(?:[\\\\/]|$))`,NO_DOT_SLASH:`(?!${o}{0,1}(?:[\\\\/]|$))`,NO_DOTS_SLASH:`(?!${o}{1,2}(?:[\\\\/]|$))`,QMARK_NO_DOT:"[^.\\\\/]",START_ANCHOR:"(?:^|[\\\\/])",END_ANCHOR:"(?:[\\\\/]|$)",SEP:"\\"},h={__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 ot={DEFAULT_MAX_EXTGLOB_RECURSION:0,MAX_LENGTH:1024*64,POSIX_REGEX_SOURCE:h,UNIGNORE:e,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(s){return{"!":{type:"negate",open:"(?:(?!(?:",close:`))${s.STAR})`},"?":{type:"qmark",open:"(?:",close:")?"},"+":{type:"plus",open:"(?:",close:")+"},"*":{type:"star",open:"(?:",close:")*"},"@":{type:"at",open:"(?:",close:")"}}},globChars(s){return s===!0?d:M}},ot}var yt;function tt(){return yt||(yt=1,(function(t){const{REGEX_BACKSLASH:e,REGEX_REMOVE_BACKSLASH:o,REGEX_SPECIAL_CHARS:H,REGEX_SPECIAL_CHARS_GLOBAL:b}=et();t.isObject=n=>n!==null&&typeof n=="object"&&!Array.isArray(n),t.hasRegexChars=n=>H.test(n),t.isRegexChar=n=>n.length===1&&t.hasRegexChars(n),t.escapeRegex=n=>n.replace(b,"\\$1"),t.toPosixSlashes=n=>n.replace(e,"/"),t.isWindows=()=>{if(typeof navigator<"u"&&navigator.platform){const n=navigator.platform.toLowerCase();return n==="win32"||n==="windows"}return process.platform?process.platform==="win32":!1},t.removeBackslashes=n=>n.replace(o,l=>l==="\\"?"":l),t.escapeLast=(n,l,f)=>{const a=n.lastIndexOf(l,f);return a===-1?n:n[a-1]==="\\"?t.escapeLast(n,l,a-1):`${n.slice(0,a)}\\${n.slice(a)}`},t.removePrefix=(n,l={})=>{let f=n;return f.startsWith("./")&&(f=f.slice(2),l.prefix="./"),f},t.wrapOutput=(n,l={},f={})=>{const a=f.contains?"":"^",R=f.contains?"":"$";let g=`${a}(?:${n})${R}`;return l.negated===!0&&(g=`(?:^(?!${g}).*$)`),g},t.basename=(n,{windows:l}={})=>{const f=n.split(l?/[\\/]/:"/"),a=f[f.length-1];return a===""?f[f.length-2]:a}})(ht)),ht}var st,vt;function xo(){if(vt)return st;vt=1;const t=tt(),{CHAR_ASTERISK:e,CHAR_AT:o,CHAR_BACKWARD_SLASH:H,CHAR_COMMA:b,CHAR_DOT:n,CHAR_EXCLAMATION_MARK:l,CHAR_FORWARD_SLASH:f,CHAR_LEFT_CURLY_BRACE:a,CHAR_LEFT_PARENTHESES:R,CHAR_LEFT_SQUARE_BRACKET:g,CHAR_PLUS:T,CHAR_QUESTION_MARK:C,CHAR_RIGHT_CURLY_BRACE:_,CHAR_RIGHT_PARENTHESES:L,CHAR_RIGHT_SQUARE_BRACKET:te}=et(),q=M=>M===f||M===H,Z=M=>{M.isPrefix!==!0&&(M.depth=M.isGlobstar?1/0:1)};return st=(M,d)=>{const h=d||{},s=M.length-1,$=h.parts===!0||h.scanToEnd===!0,O=[],m=[],E=[];let y=M,F=-1,U=0,Y=0,ae=!1,J=!1,z=!1,ee=!1,pe=!1,re=!1,oe=!1,D=!1,ne=!1,j=!1,ce=0,Q,v,k={value:"",depth:0,isGlob:!1};const X=()=>F>=s,i=()=>y.charCodeAt(F+1),I=()=>(Q=v,y.charCodeAt(++F));for(;F<s;){v=I();let W;if(v===H){oe=k.backslashes=!0,v=I(),v===a&&(re=!0);continue}if(re===!0||v===a){for(ce++;X()!==!0&&(v=I());){if(v===H){oe=k.backslashes=!0,I();continue}if(v===a){ce++;continue}if(re!==!0&&v===n&&(v=I())===n){if(ae=k.isBrace=!0,z=k.isGlob=!0,j=!0,$===!0)continue;break}if(re!==!0&&v===b){if(ae=k.isBrace=!0,z=k.isGlob=!0,j=!0,$===!0)continue;break}if(v===_&&(ce--,ce===0)){re=!1,ae=k.isBrace=!0,j=!0;break}}if($===!0)continue;break}if(v===f){if(O.push(F),m.push(k),k={value:"",depth:0,isGlob:!1},j===!0)continue;if(Q===n&&F===U+1){U+=2;continue}Y=F+1;continue}if(h.noext!==!0&&(v===T||v===o||v===e||v===C||v===l)&&i()===R){if(z=k.isGlob=!0,ee=k.isExtglob=!0,j=!0,v===l&&F===U&&(ne=!0),$===!0){for(;X()!==!0&&(v=I());){if(v===H){oe=k.backslashes=!0,v=I();continue}if(v===L){z=k.isGlob=!0,j=!0;break}}continue}break}if(v===e){if(Q===e&&(pe=k.isGlobstar=!0),z=k.isGlob=!0,j=!0,$===!0)continue;break}if(v===C){if(z=k.isGlob=!0,j=!0,$===!0)continue;break}if(v===g){for(;X()!==!0&&(W=I());){if(W===H){oe=k.backslashes=!0,I();continue}if(W===te){J=k.isBracket=!0,z=k.isGlob=!0,j=!0;break}}if($===!0)continue;break}if(h.nonegate!==!0&&v===l&&F===U){D=k.negated=!0,U++;continue}if(h.noparen!==!0&&v===R){if(z=k.isGlob=!0,$===!0){for(;X()!==!0&&(v=I());){if(v===R){oe=k.backslashes=!0,v=I();continue}if(v===L){j=!0;break}}continue}break}if(z===!0){if(j=!0,$===!0)continue;break}}h.noext===!0&&(ee=!1,z=!1);let B=y,fe="",r="";U>0&&(fe=y.slice(0,U),y=y.slice(U),Y-=U),B&&z===!0&&Y>0?(B=y.slice(0,Y),r=y.slice(Y)):z===!0?(B="",r=y):B=y,B&&B!==""&&B!=="/"&&B!==y&&q(B.charCodeAt(B.length-1))&&(B=B.slice(0,-1)),h.unescape===!0&&(r&&(r=t.removeBackslashes(r)),B&&oe===!0&&(B=t.removeBackslashes(B)));const u={prefix:fe,input:M,start:U,base:B,glob:r,isBrace:ae,isBracket:J,isGlob:z,isExtglob:ee,isGlobstar:pe,negated:D,negatedExtglob:ne};if(h.tokens===!0&&(u.maxDepth=0,q(v)||m.push(k),u.tokens=m),h.parts===!0||h.tokens===!0){let W;for(let w=0;w<O.length;w++){const se=W?W+1:U,ue=O[w],V=M.slice(se,ue);h.tokens&&(w===0&&U!==0?(m[w].isPrefix=!0,m[w].value=fe):m[w].value=V,Z(m[w]),u.maxDepth+=m[w].depth),(w!==0||V!=="")&&E.push(V),W=ue}if(W&&W+1<M.length){const w=M.slice(W+1);E.push(w),h.tokens&&(m[m.length-1].value=w,Z(m[m.length-1]),u.maxDepth+=m[m.length-1].depth)}u.slashes=O,u.parts=E}return u},st}var rt,$t;function Co(){if($t)return rt;$t=1;const t=et(),e=tt(),{MAX_LENGTH:o,POSIX_REGEX_SOURCE:H,REGEX_NON_SPECIAL_CHARS:b,REGEX_SPECIAL_CHARS_BACKREF:n,REPLACEMENTS:l}=t,f=(d,h)=>typeof h.expandRange=="function"?h.expandRange(...d,h):(d.sort(),`[${d.join("-")}]`),a=(d,h)=>`Missing ${d}: "${h}" - use "\\\\${h}" to match literal characters`,R=d=>{const h=[];let s=0,$=0,O=0,m="",E=!1;for(const y of d){if(E===!0){m+=y,E=!1;continue}if(y==="\\"){m+=y,E=!0;continue}if(y==='"'){O=O===1?0:1,m+=y;continue}if(O===0){if(y==="[")s++;else if(y==="]"&&s>0)s--;else if(s===0){if(y==="(")$++;else if(y===")"&&$>0)$--;else if(y==="|"&&$===0){h.push(m),m="";continue}}}m+=y}return h.push(m),h},g=d=>{let h=!1;for(const s of d){if(h===!0){h=!1;continue}if(s==="\\"){h=!0;continue}if(/[?*+@!()[\]{}]/.test(s))return!1}return!0},T=d=>{let h=d.trim(),s=!0;for(;s===!0;)s=!1,/^@\([^\\()[\]{}|]+\)$/.test(h)&&(h=h.slice(2,-1),s=!0);if(g(h))return h.replace(/\\(.)/g,"$1")},C=d=>{const h=d.map(T).filter(Boolean);for(let s=0;s<h.length;s++)for(let $=s+1;$<h.length;$++){const O=h[s],m=h[$],E=O[0];if(!(!E||O!==E.repeat(O.length)||m!==E.repeat(m.length))&&(O===m||O.startsWith(m)||m.startsWith(O)))return!0}return!1},_=(d,h=!0)=>{if(d[0]!=="+"&&d[0]!=="*"||d[1]!=="(")return;let s=0,$=0,O=0,m=!1;for(let E=1;E<d.length;E++){const y=d[E];if(m===!0){m=!1;continue}if(y==="\\"){m=!0;continue}if(y==='"'){O=O===1?0:1;continue}if(O!==1){if(y==="["){s++;continue}if(y==="]"&&s>0){s--;continue}if(!(s>0)){if(y==="("){$++;continue}if(y===")"&&($--,$===0))return h===!0&&E!==d.length-1?void 0:{type:d[0],body:d.slice(2,E),end:E}}}}},L=d=>`${d.length===1?e.escapeRegex(d[0]):`[${d.map(h=>e.escapeRegex(h)).join("")}]`}*`,te=d=>{let h=0;const s=[];for(;h<d.length;){const $=_(d.slice(h),!1);if(!$||$.type!=="*")return;const O=R($.body).map(E=>E.trim());if(O.length!==1)return;const m=T(O[0]);if(!m||m.length!==1)return;s.push(m),h+=$.end+1}if(!(s.length<1))return s},q=d=>{let h=0,s=d.trim(),$=_(s);for(;$;)h++,s=$.body.trim(),$=_(s);return h},Z=(d,h)=>{if(h.maxExtglobRecursion===!1)return{risky:!1};const s=typeof h.maxExtglobRecursion=="number"?h.maxExtglobRecursion:t.DEFAULT_MAX_EXTGLOB_RECURSION,$=R(d).map(y=>y.trim());if($.length>1&&($.some(y=>y==="")||$.some(y=>/^[*?]+$/.test(y))||C($)))return{risky:!0};const O=[];let m=!1,E=!0;for(const y of $){const F=te(y);if(F){m=!0,O.push(...F);continue}const U=T(y);if(U&&U.length===1){O.push(U);continue}if(E=!1,q(y)>s)return{risky:!0}}return m?E?{risky:!0,safeOutput:L([...new Set(O)])}:{risky:!0}:{risky:!1}},M=(d,h)=>{if(typeof d!="string")throw new TypeError("Expected a string");d=l[d]||d;const s={...h},$=typeof s.maxLength=="number"?Math.min(o,s.maxLength):o;let O=d.length;if(O>$)throw new SyntaxError(`Input length: ${O}, exceeds maximum allowed length: ${$}`);const m={type:"bos",value:"",output:s.prepend||""},E=[m],y=s.capture?"":"?:",F=t.globChars(s.windows),U=t.extglobChars(F),{DOT_LITERAL:Y,PLUS_LITERAL:ae,SLASH_LITERAL:J,ONE_CHAR:z,DOTS_SLASH:ee,NO_DOT:pe,NO_DOT_SLASH:re,NO_DOTS_SLASH:oe,QMARK:D,QMARK_NO_DOT:ne,STAR:j,START_ANCHOR:ce}=F,Q=c=>`(${y}(?:(?!${ce}${c.dot?ee:Y}).)*?)`,v=s.dot?"":pe,k=s.dot?D:ne;let X=s.bash===!0?Q(s):j;s.capture&&(X=`(${X})`),typeof s.noext=="boolean"&&(s.noextglob=s.noext);const i={input:d,index:-1,start:0,dot:s.dot===!0,consumed:"",output:"",prefix:"",backtrack:!1,negated:!1,brackets:0,braces:0,parens:0,quotes:0,globstar:!1,tokens:E};d=e.removePrefix(d,i),O=d.length;const I=[],B=[],fe=[];let r=m,u;const W=()=>i.index===O-1,w=i.peek=(c=1)=>d[i.index+c],se=i.advance=()=>d[++i.index]||"",ue=()=>d.slice(i.index+1),V=(c="",P=0)=>{i.consumed+=c,i.index+=P},Ve=c=>{i.output+=c.output!=null?c.output:c.value,V(c.value)},Mt=()=>{let c=1;for(;w()==="!"&&(w(2)!=="("||w(3)==="?");)se(),i.start++,c++;return c%2===0?!1:(i.negated=!0,i.start++,!0)},Ye=c=>{i[c]++,fe.push(c)},ge=c=>{i[c]--,fe.pop()},A=c=>{if(r.type==="globstar"){const P=i.braces>0&&(c.type==="comma"||c.type==="brace"),p=c.extglob===!0||I.length&&(c.type==="pipe"||c.type==="paren");c.type!=="slash"&&c.type!=="paren"&&!P&&!p&&(i.output=i.output.slice(0,-r.output.length),r.type="star",r.value="*",r.output=X,i.output+=r.output)}if(I.length&&c.type!=="paren"&&(I[I.length-1].inner+=c.value),(c.value||c.output)&&Ve(c),r&&r.type==="text"&&c.type==="text"){r.output=(r.output||r.value)+c.value,r.value+=c.value;return}c.prev=r,E.push(c),r=c},Je=(c,P)=>{const p={...U[P],conditions:1,inner:""};p.prev=r,p.parens=i.parens,p.output=i.output,p.startIndex=i.index,p.tokensIndex=E.length;const x=(s.capture?"(":"")+p.open;Ye("parens"),A({type:c,value:P,output:i.output?"":z}),A({type:"paren",extglob:!0,value:se(),output:x}),I.push(p)},Bt=c=>{const P=d.slice(c.startIndex,i.index+1),p=d.slice(c.startIndex+2,i.index),x=Z(p,s);if((c.type==="plus"||c.type==="star")&&x.risky){const N=x.safeOutput?(c.output?"":z)+(s.capture?`(${x.safeOutput})`:x.safeOutput):void 0,ie=E[c.tokensIndex];ie.type="text",ie.value=P,ie.output=N||e.escapeRegex(P);for(let le=c.tokensIndex+1;le<E.length;le++)E[le].value="",E[le].output="",delete E[le].suffix;i.output=c.output+ie.output,i.backtrack=!0,A({type:"paren",extglob:!0,value:u,output:""}),ge("parens");return}let G=c.close+(s.capture?")":""),K;if(c.type==="negate"){let N=X;if(c.inner&&c.inner.length>1&&c.inner.includes("/")&&(N=Q(s)),(N!==X||W()||/^\)+$/.test(ue()))&&(G=c.close=`)$))${N}`),c.inner.includes("*")&&(K=ue())&&/^\.[^\\/.]+$/.test(K)){const ie=M(K,{...h,fastpaths:!1}).output;G=c.close=`)${ie})${N})`}c.prev.type==="bos"&&(i.negatedExtglob=!0)}A({type:"paren",extglob:!0,value:u,output:G}),ge("parens")};if(s.fastpaths!==!1&&!/(^[*!]|[/()[\]{}"])/.test(d)){let c=!1,P=d.replace(n,(p,x,G,K,N,ie)=>K==="\\"?(c=!0,p):K==="?"?x?x+K+(N?D.repeat(N.length):""):ie===0?k+(N?D.repeat(N.length):""):D.repeat(G.length):K==="."?Y.repeat(G.length):K==="*"?x?x+K+(N?X:""):X:x?p:`\\${p}`);return c===!0&&(s.unescape===!0?P=P.replace(/\\/g,""):P=P.replace(/\\+/g,p=>p.length%2===0?"\\\\":p?"\\":"")),P===d&&s.contains===!0?(i.output=d,i):(i.output=e.wrapOutput(P,i,h),i)}for(;!W();){if(u=se(),u==="\0")continue;if(u==="\\"){const p=w();if(p==="/"&&s.bash!==!0||p==="."||p===";")continue;if(!p){u+="\\",A({type:"text",value:u});continue}const x=/^\\+/.exec(ue());let G=0;if(x&&x[0].length>2&&(G=x[0].length,i.index+=G,G%2!==0&&(u+="\\")),s.unescape===!0?u=se():u+=se(),i.brackets===0){A({type:"text",value:u});continue}}if(i.brackets>0&&(u!=="]"||r.value==="["||r.value==="[^")){if(s.posix!==!1&&u===":"){const p=r.value.slice(1);if(p.includes("[")&&(r.posix=!0,p.includes(":"))){const x=r.value.lastIndexOf("["),G=r.value.slice(0,x),K=r.value.slice(x+2),N=H[K];if(N){r.value=G+N,i.backtrack=!0,se(),!m.output&&E.indexOf(r)===1&&(m.output=z);continue}}}(u==="["&&w()!==":"||u==="-"&&w()==="]")&&(u=`\\${u}`),u==="]"&&(r.value==="["||r.value==="[^")&&(u=`\\${u}`),s.posix===!0&&u==="!"&&r.value==="["&&(u="^"),r.value+=u,Ve({value:u});continue}if(i.quotes===1&&u!=='"'){u=e.escapeRegex(u),r.value+=u,Ve({value:u});continue}if(u==='"'){i.quotes=i.quotes===1?0:1,s.keepQuotes===!0&&A({type:"text",value:u});continue}if(u==="("){Ye("parens"),A({type:"paren",value:u});continue}if(u===")"){if(i.parens===0&&s.strictBrackets===!0)throw new SyntaxError(a("opening","("));const p=I[I.length-1];if(p&&i.parens===p.parens+1){Bt(I.pop());continue}A({type:"paren",value:u,output:i.parens?")":"\\)"}),ge("parens");continue}if(u==="["){if(s.nobracket===!0||!ue().includes("]")){if(s.nobracket!==!0&&s.strictBrackets===!0)throw new SyntaxError(a("closing","]"));u=`\\${u}`}else Ye("brackets");A({type:"bracket",value:u});continue}if(u==="]"){if(s.nobracket===!0||r&&r.type==="bracket"&&r.value.length===1){A({type:"text",value:u,output:`\\${u}`});continue}if(i.brackets===0){if(s.strictBrackets===!0)throw new SyntaxError(a("opening","["));A({type:"text",value:u,output:`\\${u}`});continue}ge("brackets");const p=r.value.slice(1);if(r.posix!==!0&&p[0]==="^"&&!p.includes("/")&&(u=`/${u}`),r.value+=u,Ve({value:u}),s.literalBrackets===!1||e.hasRegexChars(p))continue;const x=e.escapeRegex(r.value);if(i.output=i.output.slice(0,-r.value.length),s.literalBrackets===!0){i.output+=x,r.value=x;continue}r.value=`(${y}${x}|${r.value})`,i.output+=r.value;continue}if(u==="{"&&s.nobrace!==!0){Ye("braces");const p={type:"brace",value:u,output:"(",outputIndex:i.output.length,tokensIndex:i.tokens.length};B.push(p),A(p);continue}if(u==="}"){const p=B[B.length-1];if(s.nobrace===!0||!p){A({type:"text",value:u,output:u});continue}let x=")";if(p.dots===!0){const G=E.slice(),K=[];for(let N=G.length-1;N>=0&&(E.pop(),G[N].type!=="brace");N--)G[N].type!=="dots"&&K.unshift(G[N].value);x=f(K,s),i.backtrack=!0}if(p.comma!==!0&&p.dots!==!0){const G=i.output.slice(0,p.outputIndex),K=i.tokens.slice(p.tokensIndex);p.value=p.output="\\{",u=x="\\}",i.output=G;for(const N of K)i.output+=N.output||N.value}A({type:"brace",value:u,output:x}),ge("braces"),B.pop();continue}if(u==="|"){I.length>0&&I[I.length-1].conditions++,A({type:"text",value:u});continue}if(u===","){let p=u;const x=B[B.length-1];x&&fe[fe.length-1]==="braces"&&(x.comma=!0,p="|"),A({type:"comma",value:u,output:p});continue}if(u==="/"){if(r.type==="dot"&&i.index===i.start+1){i.start=i.index+1,i.consumed="",i.output="",E.pop(),r=m;continue}A({type:"slash",value:u,output:J});continue}if(u==="."){if(i.braces>0&&r.type==="dot"){r.value==="."&&(r.output=Y);const p=B[B.length-1];r.type="dots",r.output+=u,r.value+=u,p.dots=!0;continue}if(i.braces+i.parens===0&&r.type!=="bos"&&r.type!=="slash"){A({type:"text",value:u,output:Y});continue}A({type:"dot",value:u,output:Y});continue}if(u==="?"){if(!(r&&r.value==="(")&&s.noextglob!==!0&&w()==="("&&w(2)!=="?"){Je("qmark",u);continue}if(r&&r.type==="paren"){const p=w();let x=u;(r.value==="("&&!/[!=<:]/.test(p)||p==="<"&&!/<([!=]|\w+>)/.test(ue()))&&(x=`\\${u}`),A({type:"text",value:u,output:x});continue}if(s.dot!==!0&&(r.type==="slash"||r.type==="bos")){A({type:"qmark",value:u,output:ne});continue}A({type:"qmark",value:u,output:D});continue}if(u==="!"){if(s.noextglob!==!0&&w()==="("&&(w(2)!=="?"||!/[!=<:]/.test(w(3)))){Je("negate",u);continue}if(s.nonegate!==!0&&i.index===0){Mt();continue}}if(u==="+"){if(s.noextglob!==!0&&w()==="("&&w(2)!=="?"){Je("plus",u);continue}if(r&&r.value==="("||s.regex===!1){A({type:"plus",value:u,output:ae});continue}if(r&&(r.type==="bracket"||r.type==="paren"||r.type==="brace")||i.parens>0){A({type:"plus",value:u});continue}A({type:"plus",value:ae});continue}if(u==="@"){if(s.noextglob!==!0&&w()==="("&&w(2)!=="?"){A({type:"at",extglob:!0,value:u,output:""});continue}A({type:"text",value:u});continue}if(u!=="*"){(u==="$"||u==="^")&&(u=`\\${u}`);const p=b.exec(ue());p&&(u+=p[0],i.index+=p[0].length),A({type:"text",value:u});continue}if(r&&(r.type==="globstar"||r.star===!0)){r.type="star",r.star=!0,r.value+=u,r.output=X,i.backtrack=!0,i.globstar=!0,V(u);continue}let c=ue();if(s.noextglob!==!0&&/^\([^?]/.test(c)){Je("star",u);continue}if(r.type==="star"){if(s.noglobstar===!0){V(u);continue}const p=r.prev,x=p.prev,G=p.type==="slash"||p.type==="bos",K=x&&(x.type==="star"||x.type==="globstar");if(s.bash===!0&&(!G||c[0]&&c[0]!=="/")){A({type:"star",value:u,output:""});continue}const N=i.braces>0&&(p.type==="comma"||p.type==="brace"),ie=I.length&&(p.type==="pipe"||p.type==="paren");if(!G&&p.type!=="paren"&&!N&&!ie){A({type:"star",value:u,output:""});continue}for(;c.slice(0,3)==="/**";){const le=d[i.index+4];if(le&&le!=="/")break;c=c.slice(3),V("/**",3)}if(p.type==="bos"&&W()){r.type="globstar",r.value+=u,r.output=Q(s),i.output=r.output,i.globstar=!0,V(u);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&!K&&W()){i.output=i.output.slice(0,-(p.output+r.output).length),p.output=`(?:${p.output}`,r.type="globstar",r.output=Q(s)+(s.strictSlashes?")":"|$)"),r.value+=u,i.globstar=!0,i.output+=p.output+r.output,V(u);continue}if(p.type==="slash"&&p.prev.type!=="bos"&&c[0]==="/"){const le=c[1]!==void 0?"|$":"";i.output=i.output.slice(0,-(p.output+r.output).length),p.output=`(?:${p.output}`,r.type="globstar",r.output=`${Q(s)}${J}|${J}${le})`,r.value+=u,i.output+=p.output+r.output,i.globstar=!0,V(u+se()),A({type:"slash",value:"/",output:""});continue}if(p.type==="bos"&&c[0]==="/"){r.type="globstar",r.value+=u,r.output=`(?:^|${J}|${Q(s)}${J})`,i.output=r.output,i.globstar=!0,V(u+se()),A({type:"slash",value:"/",output:""});continue}if(N&&c[0]==="/"){r.type="globstar",r.value+=u,r.output=`(?:^|${J}|${Q(s)}${J})`,i.output+=r.output,i.globstar=!0,V(u+se()),A({type:"slash",value:"/",output:""});continue}i.output=i.output.slice(0,-r.output.length),r.type="globstar",r.output=Q(s),r.value+=u,i.output+=r.output,i.globstar=!0,V(u);continue}const P={type:"star",value:u,output:X};if(s.bash===!0){P.output=".*?",(r.type==="bos"||r.type==="slash")&&(P.output=v+P.output),A(P);continue}if(r&&(r.type==="bracket"||r.type==="paren")&&s.regex===!0){P.output=u,A(P);continue}(i.index===i.start||r.type==="slash"||r.type==="dot")&&(r.type==="dot"?(i.output+=re,r.output+=re):s.dot===!0?(i.output+=oe,r.output+=oe):(i.output+=v,r.output+=v),w()!=="*"&&(i.output+=z,r.output+=z)),A(P)}for(;i.brackets>0;){if(s.strictBrackets===!0)throw new SyntaxError(a("closing","]"));i.output=e.escapeLast(i.output,"["),ge("brackets")}for(;i.parens>0;){if(s.strictBrackets===!0)throw new SyntaxError(a("closing",")"));i.output=e.escapeLast(i.output,"("),ge("parens")}for(;i.braces>0;){if(s.strictBrackets===!0)throw new SyntaxError(a("closing","}"));i.output=e.escapeLast(i.output,"{"),ge("braces")}if(s.strictSlashes!==!0&&(r.type==="star"||r.type==="bracket")&&A({type:"maybe_slash",value:"",output:`${J}?`}),i.backtrack===!0){i.output="";for(const c of i.tokens)i.output+=c.output!=null?c.output:c.value,c.suffix&&(i.output+=c.suffix)}return i};return M.fastpaths=(d,h)=>{const s={...h},$=typeof s.maxLength=="number"?Math.min(o,s.maxLength):o,O=d.length;if(O>$)throw new SyntaxError(`Input length: ${O}, exceeds maximum allowed length: ${$}`);d=l[d]||d;const{DOT_LITERAL:m,SLASH_LITERAL:E,ONE_CHAR:y,DOTS_SLASH:F,NO_DOT:U,NO_DOTS:Y,NO_DOTS_SLASH:ae,STAR:J,START_ANCHOR:z}=t.globChars(s.windows),ee=s.dot?Y:U,pe=s.dot?ae:U,re=s.capture?"":"?:",oe={negated:!1,prefix:""};let D=s.bash===!0?".*?":J;s.capture&&(D=`(${D})`);const ne=v=>v.noglobstar===!0?D:`(${re}(?:(?!${z}${v.dot?F:m}).)*?)`,j=v=>{switch(v){case"*":return`${ee}${y}${D}`;case".*":return`${m}${y}${D}`;case"*.*":return`${ee}${D}${m}${y}${D}`;case"*/*":return`${ee}${D}${E}${y}${pe}${D}`;case"**":return ee+ne(s);case"**/*":return`(?:${ee}${ne(s)}${E})?${pe}${y}${D}`;case"**/*.*":return`(?:${ee}${ne(s)}${E})?${pe}${D}${m}${y}${D}`;case"**/.*":return`(?:${ee}${ne(s)}${E})?${m}${y}${D}`;default:{const k=/^(.*?)\.(\w+)$/.exec(v);if(!k)return;const X=j(k[1]);return X?X+m+k[2]:void 0}}},ce=e.removePrefix(d,oe);let Q=j(ce);return Q&&s.strictSlashes!==!0&&(Q+=`${E}?`),Q},rt=M,rt}var nt,Et;function So(){if(Et)return nt;Et=1;const t=xo(),e=Co(),o=tt(),H=et(),b=l=>l&&typeof l=="object"&&!Array.isArray(l),n=(l,f,a=!1)=>{if(Array.isArray(l)){const q=l.map(Z=>n(Z,f,a));return Z=>{for(const M of q){const d=M(Z);if(d)return d}return!1}}const R=b(l)&&l.tokens&&l.input;if(l===""||typeof l!="string"&&!R)throw new TypeError("Expected pattern to be a non-empty string");const g=f||{},T=g.windows,C=R?n.compileRe(l,f):n.makeRe(l,f,!1,!0),_=C.state;delete C.state;let L=()=>!1;if(g.ignore){const q={...f,ignore:null,onMatch:null,onResult:null};L=n(g.ignore,q,a)}const te=(q,Z=!1)=>{const{isMatch:M,match:d,output:h}=n.test(q,C,f,{glob:l,posix:T}),s={glob:l,state:_,regex:C,posix:T,input:q,output:h,match:d,isMatch:M};if(typeof g.onResult=="function"&&g.onResult(s),M===!1)return s.isMatch=!1,Z?s:!1;e:if(L(q)){if(typeof g.onIgnore=="function"&&g.onIgnore(s)===H.UNIGNORE){s.isMatch=!0;break e}return s.isMatch=!1,Z?s:!1}return typeof g.onMatch=="function"&&g.onMatch(s),Z?s:!0};return a&&(te.state=_),te};return n.test=(l,f,a,{glob:R,posix:g}={})=>{if(typeof l!="string")throw new TypeError("Expected input to be a string");if(l==="")return{isMatch:!1,output:""};const T=a||{},C=T.format||(g?o.toPosixSlashes:null);let _=l===R,L=_&&C?C(l):l;return _===!1&&(L=C?C(l):l,_=L===R),(_===!1||T.capture===!0)&&(T.matchBase===!0||T.basename===!0?_=n.matchBase(l,f,a,g):_=f.exec(L)),{isMatch:!!_,match:_,output:L}},n.matchBase=(l,f,a,R=a&&a.windows)=>(f instanceof RegExp?f:n.makeRe(f,a)).test(o.basename(l,{windows:R})),n.isMatch=(l,f,a)=>n(f,a)(l),n.parse=(l,f)=>Array.isArray(l)?l.map(a=>n.parse(a,f)):e(l,{...f,fastpaths:!1}),n.scan=(l,f)=>t(l,f),n.compileRe=(l,f,a=!1,R=!1)=>{if(a===!0)return l.output;const g=f||{},T=g.contains?"":"^",C=g.contains?"":"$";let _=`${T}(?:${l.output})${C}`;l&&l.negated===!0&&(_=`^(?!${_}).*$`);const L=n.toRegex(_,f);return R===!0&&(L.state=l),L},n.makeRe=(l,f={},a=!1,R=!1)=>{if(!l||typeof l!="string")throw new TypeError("Expected a non-empty string");let g={negated:!1,fastpaths:!0};return f.fastpaths!==!1&&(l[0]==="."||l[0]==="*")&&(g.output=e.fastpaths(l,f)),g.output||(g=e(l,f)),n.compileRe(g,f,a,R)},n.toRegex=(l,f)=>{try{const a=f||{};return new RegExp(l,a.flags||(a.nocase?"i":""))}catch(a){if(f&&f.debug===!0)throw a;return/$^/}},n.constants=H,nt=n,nt}var ut,Rt;function Oo(){if(Rt)return ut;Rt=1;const t=So(),e=tt();function o(H,b,n=!1){return b&&(b.windows===null||b.windows===void 0)&&(b={...b,windows:e.isWindows()}),t(H,b,n)}return Object.assign(o,t),ut=o,ut}var wo=Oo();ct(wo);const ko=S(import.meta.url),we=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ze=t=>{if(typeof we<"u"&&we.versions&&we.versions.node){const[e,o]=we.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return we.getBuiltinModule(t)}return ko(t)};Ze("fs");Ze("fs");Ze("path");Ze("url");const{createRequire:Ho}=Ze("module");var _t=Ho(import.meta.url);try{_t.resolve("picomatch"),_t("picomatch")}catch{}var it,At;function No(){if(At)return it;At=1;/*!
|
|
2
|
+
* is-extglob <https://github.com/jonschlinkert/is-extglob>
|
|
3
|
+
*
|
|
4
|
+
* Copyright (c) 2014-2016, Jon Schlinkert.
|
|
5
|
+
* Licensed under the MIT License.
|
|
6
|
+
*/return it=function(t){if(typeof t!="string"||t==="")return!1;for(var e;e=/(\\).|([@?!+*]\(.*\))/g.exec(t);){if(e[2])return!0;t=t.slice(e.index+e[0].length)}return!1},it}var lt,Tt;function St(){if(Tt)return lt;Tt=1;/*!
|
|
7
|
+
* is-glob <https://github.com/jonschlinkert/is-glob>
|
|
8
|
+
*
|
|
9
|
+
* Copyright (c) 2014-2017, Jon Schlinkert.
|
|
10
|
+
* Released under the MIT License.
|
|
11
|
+
*/var t=No(),e={"{":"}","(":")","[":"]"},o=function(b){if(b[0]==="!")return!0;for(var n=0,l=-2,f=-2,a=-2,R=-2,g=-2;n<b.length;){if(b[n]==="*"||b[n+1]==="?"&&/[\].+)]/.test(b[n])||f!==-1&&b[n]==="["&&b[n+1]!=="]"&&(f<n&&(f=b.indexOf("]",n)),f>n&&(g===-1||g>f||(g=b.indexOf("\\",n),g===-1||g>f)))||a!==-1&&b[n]==="{"&&b[n+1]!=="}"&&(a=b.indexOf("}",n),a>n&&(g=b.indexOf("\\",n),g===-1||g>a))||R!==-1&&b[n]==="("&&b[n+1]==="?"&&/[:!=]/.test(b[n+2])&&b[n+3]!==")"&&(R=b.indexOf(")",n),R>n&&(g=b.indexOf("\\",n),g===-1||g>R))||l!==-1&&b[n]==="("&&b[n+1]!=="|"&&(l<n&&(l=b.indexOf("|",n)),l!==-1&&b[l+1]!==")"&&(R=b.indexOf(")",l),R>l&&(g=b.indexOf("\\",l),g===-1||g>R))))return!0;if(b[n]==="\\"){var T=b[n+1];n+=2;var C=e[T];if(C){var _=b.indexOf(C,n);_!==-1&&(n=_+1)}if(b[n]==="!")return!0}else n++}return!1},H=function(b){if(b[0]==="!")return!0;for(var n=0;n<b.length;){if(/[*?{}()[\]]/.test(b[n]))return!0;if(b[n]==="\\"){var l=b[n+1];n+=2;var f=e[l];if(f){var a=b.indexOf(f,n);a!==-1&&(n=a+1)}if(b[n]==="!")return!0}else n++}return!1};return lt=function(b,n){if(typeof b!="string"||b==="")return!1;if(t(b))return!0;var l=o;return n&&n.strict===!1&&(l=H),l(b)},lt}const Lo=S(import.meta.url),ke=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ot=t=>{if(typeof ke<"u"&&ke.versions&&ke.versions.node){const[e,o]=ke.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return ke.getBuiltinModule(t)}return Lo(t)},Mo=Ot("path"),Bo=Ot("os");var at,xt;function Io(){if(xt)return at;xt=1;var t=St(),e=Mo.posix.dirname,o=Bo.platform()==="win32",H="/",b=/\\/g,n=/\\([!*?|[\](){}])/g;at=function(a,R){var g=Object.assign({flipBackslashes:!0},R);g.flipBackslashes&&o&&a.indexOf(H)<0&&(a=a.replace(b,H)),l(a)&&(a+=H),a+="a";do a=e(a);while(f(a));return a.replace(n,"$1")};function l(a){var R=a.slice(-1),g;switch(R){case"}":g="{";break;case"]":g="[";break;default:return!1}var T=a.indexOf(g);return T<0?!1:a.slice(T+1,-1).includes(H)}function f(a){return/\([^()]+$/.test(a)||a[0]==="{"||a[0]==="["||/[^\\][{[]/.test(a)?!0:t(a)}return at}var Po=Io();ct(Po);const Do=S(import.meta.url),He=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Go=t=>{if(typeof He<"u"&&He.versions&&He.versions.node){const[e,o]=He.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return He.getBuiltinModule(t)}return Do(t)};Go("node:fs/promises");const Uo=S(import.meta.url),Ne=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,zo=t=>{if(typeof Ne<"u"&&Ne.versions&&Ne.versions.node){const[e,o]=Ne.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ne.getBuiltinModule(t)}return Uo(t)};zo("node:fs");var Ko=St();ct(Ko);const Fo=S(import.meta.url),Le=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,wt=t=>{if(typeof Le<"u"&&Le.versions&&Le.versions.node){const[e,o]=Le.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Le.getBuiltinModule(t)}return Fo(t)};wt("node:fs/promises");wt("node:fs");let Xo=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")}},jo=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 Qo=(t,e)=>{const o=t?.code;return o==="ENOENT"?new Xo(`no such file or directory, open '${e}'`):o==="EACCES"||o==="EPERM"?new jo(`unable to read the non-readable file: ${e}`):t},Wo=S(import.meta.url),Me=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,kt=t=>{if(typeof Me<"u"&&Me.versions&&Me.versions.node){const[e,o]=Me.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Me.getBuiltinModule(t)}return Wo(t)},{readFile:qo}=kt("node:fs/promises"),{unzip:Zo,brotliDecompress:Vo}=kt("node:zlib"),Yo={brotli:Vo,gzip:Zo,none:(t,e)=>{e(null,t)}},ks=async(t,e)=>{Zt(t),t=qt(t);const{buffer:o,compression:H,encoding:b,flag:n}=e??{};let l;try{l=await qo(t,n?{flag:n}:{})}catch(f){throw Qo(f,t)}return await new Promise((f,a)=>{Yo[H??"none"](l,(R,g)=>{R?a(R):f(o?g:g.toString(b??"utf8"))})})},Jo=S(import.meta.url),Be=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Ht=t=>{if(typeof Be<"u"&&Be.versions&&Be.versions.node){const[e,o]=Be.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Be.getBuiltinModule(t)}return Jo(t)};Ht("node:fs");Ht("node:zlib");const es=S(import.meta.url),Ie=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ts=t=>{if(typeof Ie<"u"&&Ie.versions&&Ie.versions.node){const[e,o]=Ie.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ie.getBuiltinModule(t)}return es(t)},{createRequire:Nt}=ts("node:module"),os=new Map([["Error",Error],["EvalError",EvalError],["RangeError",RangeError],["ReferenceError",ReferenceError],["SyntaxError",SyntaxError],["TypeError",TypeError],["URIError",URIError]]);typeof AggregateError<"u"&&os.set("AggregateError",AggregateError);const ss=Nt(import.meta.url),Pe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,rs=t=>{if(typeof Pe<"u"&&Pe.versions&&Pe.versions.node){const[e,o]=Pe.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Pe.getBuiltinModule(t)}return ss(t)};rs("node:util");const ns=Nt(import.meta.url),De=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ft=t=>{if(typeof De<"u"&&De.versions&&De.versions.node){const[e,o]=De.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return De.getBuiltinModule(t)}return ns(t)};ft("node:fs");ft("node:path");ft("node:url");const us=S(import.meta.url),Ge=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Lt=t=>{if(typeof Ge<"u"&&Ge.versions&&Ge.versions.node){const[e,o]=Ge.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ge.getBuiltinModule(t)}return us(t)};Lt("node:fs");Lt("node:fs/promises");const is=S(import.meta.url),Ue=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ls=t=>{if(typeof Ue<"u"&&Ue.versions&&Ue.versions.node){const[e,o]=Ue.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ue.getBuiltinModule(t)}return is(t)};ls("node:fs");const as=S(import.meta.url),ze=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ps=t=>{if(typeof ze<"u"&&ze.versions&&ze.versions.node){const[e,o]=ze.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return ze.getBuiltinModule(t)}return as(t)};ps("node:fs/promises");const cs=S(import.meta.url),Ke=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,fs=t=>{if(typeof Ke<"u"&&Ke.versions&&Ke.versions.node){const[e,o]=Ke.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Ke.getBuiltinModule(t)}return cs(t)};fs("node:fs");S(import.meta.url);const gs=S(import.meta.url),Fe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ds=t=>{if(typeof Fe<"u"&&Fe.versions&&Fe.versions.node){const[e,o]=Fe.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Fe.getBuiltinModule(t)}return gs(t)};ds("node:crypto");new TextEncoder;const bs=S(import.meta.url),Xe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,hs=t=>{if(typeof Xe<"u"&&Xe.versions&&Xe.versions.node){const[e,o]=Xe.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Xe.getBuiltinModule(t)}return bs(t)};hs("node:fs/promises");const ms=S(import.meta.url),je=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,ys=t=>{if(typeof je<"u"&&je.versions&&je.versions.node){const[e,o]=je.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return je.getBuiltinModule(t)}return ms(t)};ys("node:fs");const vs=S(import.meta.url),Qe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,$s=t=>{if(typeof Qe<"u"&&Qe.versions&&Qe.versions.node){const[e,o]=Qe.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return Qe.getBuiltinModule(t)}return vs(t)};$s("node:fs/promises");const Es=S(import.meta.url),We=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,Rs=t=>{if(typeof We<"u"&&We.versions&&We.versions.node){const[e,o]=We.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return We.getBuiltinModule(t)}return Es(t)};Rs("node:fs");const _s=S(import.meta.url),qe=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,gt=t=>{if(typeof qe<"u"&&qe.versions&&qe.versions.node){const[e,o]=qe.versions.node.split(".").map(Number);if(e>22||e===22&&o>=3||e===20&&o>=16)return qe.getBuiltinModule(t)}return _s(t)},As=gt("fs"),Ts=gt("os"),xs=gt("path");var pt={},Ct;function Cs(){if(Ct)return pt;Ct=1;var t=Object.defineProperty,e=(g,T)=>t(g,"name",{value:T,configurable:!0}),o=As,H=Ts,b=xs;const n=e(g=>{let T="";for(let C=0;C<g.length;C+=1){const _=g[C],L=_.toUpperCase();T+=_===L?_.toLowerCase():L}return T},"invertCase"),l=new Map,f=e((g,T)=>{const C=b.join(g,`.is-fs-case-sensitive-test-${process.pid}`);try{return T.writeFileSync(C,""),!T.existsSync(n(C))}finally{try{T.unlinkSync(C)}catch{}}},"checkDirectoryCaseWithWrite"),a=e((g,T,C)=>{try{return f(g,C)}catch(_){if(T===void 0)return f(H.tmpdir(),C);throw _}},"checkDirectoryCaseWithFallback"),R=e((g,T=o,C=!0)=>{const _=g??process.cwd();if(C&&l.has(_))return l.get(_);let L;const te=n(_);return te!==_&&T.existsSync(_)?L=!T.existsSync(te):L=a(_,g,T),C&&l.set(_,L),L},"isFsCaseSensitive");return pt.isFsCaseSensitive=R,pt}Cs();export{ks as z};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import c from"./EmailError-B-sEf3bp.js";import v from"./RequiredOptionError-DuNNY_a5.js";import{e as w}from"./generate-message-id-gXAuMz4g.js";import{s as A}from"./headers-to-record-De1Eg951.js";import{m as d}from"./make-request-BlK_B72c.js";import{u as g}from"./retry-3pnxTuNs.js";import{f as I}from"./validate-email-options-mCM9dVug.js";import{defineProvider as P}from"./defineProvider-C9q-7iwt.js";import{P as T,h as y,c as U}from"./provider-base-C7PuopYK.js";import{d as u}from"./address-formatter-BWR2Dddx.js";import{p as z}from"./attachment-processor-CMp7qqMI.js";const r="infobip",E="https://api.infobip.com",k=3e4,j=3,H=P((s={})=>{if(!s.apiKey)throw new v(r,"apiKey");const p=s.baseUrl??E,h=s.endpoint??`${p}/email/3/send`,a={apiKey:s.apiKey,baseUrl:p,debug:s.debug??!1,endpoint:h,retries:s.retries??j,timeout:s.timeout??k,...s.logger&&{logger:s.logger}},m=new T,i=U(r,s.logger);return{features:{attachments:!0,batchSending:!0,customHeaders:!0,html:!0,replyTo:!0,scheduling:!0,tagging:!1,templates:!0,tracking:!0},async getEmail(e){try{if(!e)return{error:new c(r,"Email ID is required to retrieve email details"),success:!1};await m.ensureInitialized(()=>this.initialize(),r);const n={Authorization:`App ${a.apiKey}`,"Content-Type":"application/json"};i.debug("Retrieving email details",{id:e});const t=await g(async()=>d(`${a.baseUrl}/email/3/reports/${e}`,{headers:n,method:"GET",timeout:a.timeout}),a.retries);return t.success?(i.debug("Email details retrieved successfully"),{data:t.data?.body,success:!0}):(i.debug("API request failed when retrieving email",t.error),{error:new c(r,`Failed to retrieve email: ${t.error instanceof Error?t.error.message:"Unknown error"}`,{cause:t.error}),success:!1})}catch(n){return{error:y(r,"retrieve email",n,i),success:!1}}},async initialize(){await m.ensureInitialized(async()=>{if(!await this.isAvailable())throw new c(r,"Infobip API not available or invalid API key");i.debug("Provider initialized successfully")},r)},async isAvailable(){try{i.debug("Checking Infobip API availability");const e={Authorization:`App ${a.apiKey}`,"Content-Type":"application/json"};return(await d(`${a.baseUrl}/account/1/me`,{headers:e,method:"GET",timeout:a.timeout})).success}catch(e){return i.debug("Error checking availability:",e),!1}},name:r,options:a,async sendEmail(e){try{const n=I(e);if(n.length>0)return{error:new c(r,`Invalid email options: ${n.join(", ")}`),success:!1};await m.ensureInitialized(()=>this.initialize(),r);const t={from:typeof e.from=="string"?e.from:e.from.email,subject:e.subject,to:u(e.to)};if(e.html&&(t.html=e.html),e.text&&(t.text=e.text),e.cc&&(t.cc=u(e.cc)),e.bcc&&(t.bcc=u(e.bcc)),e.replyTo&&(t.replyTo=typeof e.replyTo=="string"?e.replyTo:e.replyTo.email),e.templateId&&(t.templateId=e.templateId,e.templateVariables&&(t.templateData=e.templateVariables)),e.trackingUrl&&(t.trackingUrl=e.trackingUrl),e.notifyUrl&&(t.notifyUrl=e.notifyUrl),e.intermediateReport!==void 0&&(t.intermediateReport=e.intermediateReport),e.sendAt&&(t.sendAt=e.sendAt),e.headers){const l=A(e.headers);t.headers=l}e.attachments&&e.attachments.length>0&&(t.attachments=await Promise.all(e.attachments.map(async l=>({content:await z(l,r),contentType:l.contentType??"application/octet-stream",name:l.filename})))),i.debug("Sending email via Infobip API",{subject:t.subject,to:t.to});const b={Authorization:`App ${a.apiKey}`,"Content-Type":"application/json"},o=await g(async()=>d(a.endpoint,{headers:b,method:"POST",timeout:a.timeout},JSON.stringify(t)),a.retries);if(!o.success)return i.debug("API request failed when sending email",o.error),{error:o.error??new c(r,"Failed to send email"),success:!1};const f=o.data?.body?.messages?.[0]?.messageId??w();return i.debug("Email sent successfully",{messageId:f}),{data:{messageId:f,provider:r,response:o.data,sent:!0,timestamp:new Date},success:!0}}catch(n){return{error:y(r,"send email",n,i),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{H as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const i=/<body[^<>]*>/i,o=e=>e.replaceAll("&","&").replaceAll("<","<").replaceAll(">",">").replaceAll('"',"""),s=(e,c,a={})=>{const n=a.spacer===!1?"":" ".repeat(120),t=`<div style="display:none;max-height:0;overflow:hidden;mso-hide:all;">${o(c)}${n}</div>`,l=i.exec(e);if(l){const r=l.index+l[0].length;return`${e.slice(0,r)}${t}${e.slice(r)}`}return`${t}${e}`};export{s as injectPreheader};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{createRequire as i}from"node:module";import r from"./EmailError-B-sEf3bp.js";const a=i(import.meta.url),n=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,c=o=>{if(typeof n<"u"&&n.versions&&n.versions.node){const[s,t]=n.versions.node.split(".").map(Number);if(s>22||s===22&&t>=3||s===20&&t>=16)return n.getBuiltinModule(o)}return a(o)},{createRequire:u}=c("node:module"),d=u(import.meta.url),p=(o,s)=>{let t;try{const e=d("juice");t=e.default??e}catch(e){throw e instanceof Error&&(e.code==="MODULE_NOT_FOUND"||e.message.includes("Cannot find module")||e.message.includes("Cannot find package"))?new r("render","juice is not installed. Please install it: pnpm add juice",{cause:e}):new r("render",`Failed to load juice: ${e.message}`,{cause:e})}try{return t(o,s)}catch(e){throw new r("render",`Failed to inline CSS: ${e.message}`,{cause:e})}};export{p as default};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{createRequire as g}from"node:module";import o from"./EmailError-B-sEf3bp.js";const p=g(import.meta.url),n=typeof globalThis<"u"&&typeof globalThis.process<"u"?globalThis.process:process,u=e=>{if(typeof n<"u"&&n.versions&&n.versions.node){const[t,s]=n.versions.node.split(".").map(Number);if(t>22||t===22&&s>=3||t===20&&s>=16)return n.getBuiltinModule(e)}return p(e)},{Buffer:m}=u("node:buffer"),{X509Certificate:d,createVerify:S}=u("node:crypto"),y={Notification:["Message","MessageId","Subject","Timestamp","TopicArn","Type"],SubscriptionConfirmation:["Message","MessageId","SubscribeURL","Timestamp","Token","TopicArn","Type"],UnsubscribeConfirmation:["Message","MessageId","SubscribeURL","Timestamp","Token","TopicArn","Type"]},b=/^sns\.[a-z0-9-]+\.amazonaws\.com(?:\.cn)?$/,w=/\.$/,h=e=>{let t;try{t=new URL(e)}catch{return!1}if(t.protocol!=="https:"||t.username!==""||t.password!==""||t.port!=="")return!1;const s=t.hostname.toLowerCase().replace(w,"");return b.test(s)},T=async e=>{if(!h(e))throw new o("webhooks",`Refusing to fetch SNS signing certificate from untrusted URL: ${e}`);const t=await fetch(e,{signal:AbortSignal.timeout(5e3)});if(!t.ok)throw new o("webhooks",`Failed to fetch SNS signing certificate (status ${String(t.status)})`);return await t.text()},v=e=>{const t=y[e.Type??""];if(!t)return;let s="";for(const i of t){const r=e[i];typeof r=="string"&&(s+=`${i}
|
|
2
|
+
${r}
|
|
3
|
+
`)}return s},M=async(e,t={})=>{const{certificateResolver:s=T}=t;if(!e.Signature||!e.SigningCertURL)return{reason:"missing-signature",valid:!1};const i=v(e);if(i===void 0)return{reason:"unknown-message-type",valid:!1};let r;if(e.SignatureVersion==="1")r="RSA-SHA1";else if(e.SignatureVersion==="2")r="RSA-SHA256";else return{reason:"unknown-signature-version",valid:!1};const f=await s(e.SigningCertURL);let a;try{a=new d(f).publicKey}catch(l){throw new o("webhooks","Failed to parse SNS signing certificate",{cause:l})}let c;try{c=S(r).update(i,"utf8").verify(a,m.from(e.Signature,"base64"))}catch{return{reason:"signature-malformed",valid:!1}}return c?{valid:!0}:{reason:"signature-mismatch",valid:!1}};export{h as isValidSigningCertUrl,M as verifySnsMessage};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
const n=e=>{const r=e.indexOf("@");if(r<=0)return"•••";const s=e.slice(0,r),a=e.slice(r+1);return`${s.slice(0,1)}${"•".repeat(Math.max(1,s.length-1))}@${a}`},c=(e,r)=>(Array.isArray(e)?e:[e]).map(s=>r?n(s.email):s.email),l=(e={})=>{const{logger:r=console,redact:s=!0}=e;return async(a,t)=>{const o=c(a.to,s);r.info("[@visulima/email] sending",{subject:s?void 0:a.subject,to:o});const i=await t(a);return i.success?r.info("[@visulima/email] sent",{messageId:i.data?.messageId,to:o}):r.error("[@visulima/email] send failed",{error:i.error instanceof Error?i.error.message:i.error,to:o}),i}};export{l as loggingMiddleware};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import o from"./EmailError-B-sEf3bp.js";import f from"./RequiredOptionError-DuNNY_a5.js";import{e as g}from"./generate-message-id-gXAuMz4g.js";import{m as h}from"./make-request-BlK_B72c.js";import{u as y}from"./retry-3pnxTuNs.js";import{defineProvider as b}from"./defineProvider-C9q-7iwt.js";import{c as v}from"./attachment-processor-CMp7qqMI.js";import{h as w,P as T,c as A}from"./provider-base-C7PuopYK.js";const t="loops",I="https://app.loops.so/api/v1/transactional",P=3e4,K=3,E=b((a={})=>{if(!a.apiKey)throw new f(t,"apiKey");const r={apiKey:a.apiKey,debug:a.debug??!1,defaultTransactionalId:a.defaultTransactionalId,endpoint:a.endpoint??I,logger:a.logger,retries:a.retries??K,timeout:a.timeout??P},m=new T,u=A(t,a.logger);return{features:{attachments:!0,batchSending:!1,customHeaders:!1,html:!1,replyTo:!1,scheduling:!1,tagging:!1,templates:!0,tracking:!0},async initialize(){m.setInitialized()},async isAvailable(){return r.apiKey.length>0},name:t,options:r,async sendEmail(e){try{const s=e.transactionalId??r.defaultTransactionalId;if(!s)return{error:new o(t,"Loops requires a `transactionalId` (on the message or as `defaultTransactionalId`)"),success:!1};const l=Array.isArray(e.to)?e.to:[e.to];if(l.length!==1||e.cc!==void 0||e.bcc!==void 0)return{error:new o(t,"Loops supports exactly one `to` recipient and does not support cc/bcc"),success:!1};const[d]=l;if(!d)return{error:new o(t,"A `to` recipient is required"),success:!1};const n={email:d.email,transactionalId:s};e.dataVariables&&(n.dataVariables=e.dataVariables),e.addToAudience&&(n.addToAudience=!0),e.attachments&&e.attachments.length>0&&(n.attachments=await Promise.all(e.attachments.map(async p=>{const c=await v(p,t);return{contentType:c.contentType,data:c.content,filename:c.filename}})));const i=await y(async()=>h(r.endpoint,{headers:{Authorization:`Bearer ${r.apiKey}`,"Content-Type":"application/json"},method:"POST",timeout:r.timeout},JSON.stringify(n)),r.retries);return i.success?{data:{messageId:g(),provider:t,response:i.data,sent:!0,timestamp:new Date},success:!0}:{error:i.error??new o(t,"Failed to send email"),success:!1}}catch(s){return{error:w(t,"send email",s,u),success:!1}}},async validateCredentials(){return this.isAvailable()}}});export{E as default};
|