@emailens/cli 0.13.16 → 0.13.19

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.
@@ -7228,9 +7228,9 @@ var require_dispatcher_base = __commonJS({
7228
7228
  }
7229
7229
  close(callback) {
7230
7230
  if (callback === void 0) {
7231
- return new Promise((resolve2, reject) => {
7231
+ return new Promise((resolve3, reject) => {
7232
7232
  this.close((err, data2) => {
7233
- return err ? reject(err) : resolve2(data2);
7233
+ return err ? reject(err) : resolve3(data2);
7234
7234
  });
7235
7235
  });
7236
7236
  }
@@ -7268,9 +7268,9 @@ var require_dispatcher_base = __commonJS({
7268
7268
  err = null;
7269
7269
  }
7270
7270
  if (callback === void 0) {
7271
- return new Promise((resolve2, reject) => {
7271
+ return new Promise((resolve3, reject) => {
7272
7272
  this.destroy(err, (err2, data2) => {
7273
- return err2 ? reject(err2) : resolve2(data2);
7273
+ return err2 ? reject(err2) : resolve3(data2);
7274
7274
  });
7275
7275
  });
7276
7276
  }
@@ -10776,8 +10776,8 @@ var require_promise = __commonJS({
10776
10776
  function createDeferredPromise() {
10777
10777
  let res;
10778
10778
  let rej;
10779
- const promise = new Promise((resolve2, reject) => {
10780
- res = resolve2;
10779
+ const promise = new Promise((resolve3, reject) => {
10780
+ res = resolve3;
10781
10781
  rej = reject;
10782
10782
  });
10783
10783
  return { promise, resolve: res, reject: rej };
@@ -12186,12 +12186,12 @@ upgrade: ${upgrade}\r
12186
12186
  cb();
12187
12187
  }
12188
12188
  }
12189
- const waitForDrain = () => new Promise((resolve2, reject) => {
12189
+ const waitForDrain = () => new Promise((resolve3, reject) => {
12190
12190
  assert(callback === null);
12191
12191
  if (socket[kError]) {
12192
12192
  reject(socket[kError]);
12193
12193
  } else {
12194
- callback = resolve2;
12194
+ callback = resolve3;
12195
12195
  }
12196
12196
  });
12197
12197
  socket.on("close", onDrain).on("drain", onDrain);
@@ -13075,12 +13075,12 @@ var require_client_h2 = __commonJS({
13075
13075
  cb();
13076
13076
  }
13077
13077
  }
13078
- const waitForDrain = () => new Promise((resolve2, reject) => {
13078
+ const waitForDrain = () => new Promise((resolve3, reject) => {
13079
13079
  assert(callback === null);
13080
13080
  if (socket[kError]) {
13081
13081
  reject(socket[kError]);
13082
13082
  } else {
13083
- callback = resolve2;
13083
+ callback = resolve3;
13084
13084
  }
13085
13085
  });
13086
13086
  h2stream.on("close", onDrain).on("drain", onDrain);
@@ -13397,16 +13397,16 @@ var require_client = __commonJS({
13397
13397
  return this[kNeedDrain] < 2;
13398
13398
  }
13399
13399
  [kClose]() {
13400
- return new Promise((resolve2) => {
13400
+ return new Promise((resolve3) => {
13401
13401
  if (this[kSize]) {
13402
- this[kClosedResolve] = resolve2;
13402
+ this[kClosedResolve] = resolve3;
13403
13403
  } else {
13404
- resolve2(null);
13404
+ resolve3(null);
13405
13405
  }
13406
13406
  });
13407
13407
  }
13408
13408
  [kDestroy](err) {
13409
- return new Promise((resolve2) => {
13409
+ return new Promise((resolve3) => {
13410
13410
  const requests = this[kQueue].splice(this[kPendingIdx]);
13411
13411
  for (let i2 = 0; i2 < requests.length; i2++) {
13412
13412
  const request = requests[i2];
@@ -13419,7 +13419,7 @@ var require_client = __commonJS({
13419
13419
  this[kClosedResolve]();
13420
13420
  this[kClosedResolve] = null;
13421
13421
  }
13422
- resolve2(null);
13422
+ resolve3(null);
13423
13423
  };
13424
13424
  if (this[kHTTPContext]) {
13425
13425
  this[kHTTPContext].destroy(err, callback);
@@ -13826,8 +13826,8 @@ var require_pool_base = __commonJS({
13826
13826
  }
13827
13827
  return Promise.all(closeAll);
13828
13828
  } else {
13829
- return new Promise((resolve2) => {
13830
- this[kClosedResolve] = resolve2;
13829
+ return new Promise((resolve3) => {
13830
+ this[kClosedResolve] = resolve3;
13831
13831
  });
13832
13832
  }
13833
13833
  }
@@ -14949,7 +14949,7 @@ var require_socks5_proxy_agent = __commonJS({
14949
14949
  const proxyHost = this[kProxyUrl].hostname;
14950
14950
  const proxyPort = parseInt(this[kProxyUrl].port) || 1080;
14951
14951
  debug("creating SOCKS5 connection to", proxyHost, proxyPort);
14952
- const socket = await new Promise((resolve2, reject) => {
14952
+ const socket = await new Promise((resolve3, reject) => {
14953
14953
  this[kConnector]({
14954
14954
  hostname: proxyHost,
14955
14955
  host: proxyHost,
@@ -14959,7 +14959,7 @@ var require_socks5_proxy_agent = __commonJS({
14959
14959
  if (err) {
14960
14960
  reject(err);
14961
14961
  } else {
14962
- resolve2(socket2);
14962
+ resolve3(socket2);
14963
14963
  }
14964
14964
  });
14965
14965
  });
@@ -14969,14 +14969,14 @@ var require_socks5_proxy_agent = __commonJS({
14969
14969
  socket.destroy();
14970
14970
  });
14971
14971
  await socks5Client.handshake();
14972
- await new Promise((resolve2, reject) => {
14972
+ await new Promise((resolve3, reject) => {
14973
14973
  const timeout = setTimeout(() => {
14974
14974
  reject(new Error("SOCKS5 authentication timeout"));
14975
14975
  }, 5e3);
14976
14976
  const onAuthenticated = () => {
14977
14977
  clearTimeout(timeout);
14978
14978
  socks5Client.removeListener("error", onError);
14979
- resolve2();
14979
+ resolve3();
14980
14980
  };
14981
14981
  const onError = (err) => {
14982
14982
  clearTimeout(timeout);
@@ -14985,14 +14985,14 @@ var require_socks5_proxy_agent = __commonJS({
14985
14985
  };
14986
14986
  if (socks5Client.state === STATES.AUTHENTICATED) {
14987
14987
  clearTimeout(timeout);
14988
- resolve2();
14988
+ resolve3();
14989
14989
  } else {
14990
14990
  socks5Client.once("authenticated", onAuthenticated);
14991
14991
  socks5Client.once("error", onError);
14992
14992
  }
14993
14993
  });
14994
14994
  await socks5Client.connect(targetHost, targetPort);
14995
- await new Promise((resolve2, reject) => {
14995
+ await new Promise((resolve3, reject) => {
14996
14996
  const timeout = setTimeout(() => {
14997
14997
  reject(new Error("SOCKS5 connection timeout"));
14998
14998
  }, 5e3);
@@ -15000,7 +15000,7 @@ var require_socks5_proxy_agent = __commonJS({
15000
15000
  debug("SOCKS5 tunnel established to", targetHost, targetPort, "via", info);
15001
15001
  clearTimeout(timeout);
15002
15002
  socks5Client.removeListener("error", onError);
15003
- resolve2();
15003
+ resolve3();
15004
15004
  };
15005
15005
  const onError = (err) => {
15006
15006
  clearTimeout(timeout);
@@ -15043,8 +15043,8 @@ var require_socks5_proxy_agent = __commonJS({
15043
15043
  socket,
15044
15044
  servername: this[kRequestTls]?.servername || targetHost
15045
15045
  });
15046
- await new Promise((resolve2, reject) => {
15047
- finalSocket.once("secureConnect", resolve2);
15046
+ await new Promise((resolve3, reject) => {
15047
+ finalSocket.once("secureConnect", resolve3);
15048
15048
  finalSocket.once("error", reject);
15049
15049
  });
15050
15050
  }
@@ -16177,7 +16177,7 @@ var require_readable = __commonJS({
16177
16177
  if (this._readableState.closeEmitted) {
16178
16178
  return Promise.resolve(null);
16179
16179
  }
16180
- return new Promise((resolve2, reject) => {
16180
+ return new Promise((resolve3, reject) => {
16181
16181
  if (this[kContentLength] && this[kContentLength] > limit || this[kBytesRead] > limit) {
16182
16182
  this.destroy(new AbortError());
16183
16183
  }
@@ -16191,11 +16191,11 @@ var require_readable = __commonJS({
16191
16191
  if (signal.aborted) {
16192
16192
  reject(signal.reason ?? new AbortError());
16193
16193
  } else {
16194
- resolve2(null);
16194
+ resolve3(null);
16195
16195
  }
16196
16196
  });
16197
16197
  } else {
16198
- this.on("close", resolve2);
16198
+ this.on("close", resolve3);
16199
16199
  }
16200
16200
  this.on("error", noop).on("data", () => {
16201
16201
  if (this[kBytesRead] > limit) {
@@ -16223,7 +16223,7 @@ var require_readable = __commonJS({
16223
16223
  }
16224
16224
  function consume(stream, type) {
16225
16225
  assert(!stream[kConsume]);
16226
- return new Promise((resolve2, reject) => {
16226
+ return new Promise((resolve3, reject) => {
16227
16227
  if (isUnusable(stream)) {
16228
16228
  const rState = stream._readableState;
16229
16229
  if (rState.destroyed && rState.closeEmitted === false) {
@@ -16238,7 +16238,7 @@ var require_readable = __commonJS({
16238
16238
  stream[kConsume] = {
16239
16239
  type,
16240
16240
  stream,
16241
- resolve: resolve2,
16241
+ resolve: resolve3,
16242
16242
  reject,
16243
16243
  length: 0,
16244
16244
  body: []
@@ -16312,18 +16312,18 @@ var require_readable = __commonJS({
16312
16312
  return buffer;
16313
16313
  }
16314
16314
  function consumeEnd(consume2, encoding) {
16315
- const { type, body, resolve: resolve2, stream, length } = consume2;
16315
+ const { type, body, resolve: resolve3, stream, length } = consume2;
16316
16316
  try {
16317
16317
  if (type === "text") {
16318
- resolve2(chunksDecode(body, length, encoding));
16318
+ resolve3(chunksDecode(body, length, encoding));
16319
16319
  } else if (type === "json") {
16320
- resolve2(JSON.parse(chunksDecode(body, length, encoding)));
16320
+ resolve3(JSON.parse(chunksDecode(body, length, encoding)));
16321
16321
  } else if (type === "arrayBuffer") {
16322
- resolve2(chunksConcat(body, length).buffer);
16322
+ resolve3(chunksConcat(body, length).buffer);
16323
16323
  } else if (type === "blob") {
16324
- resolve2(new Blob(body, { type: stream[kContentType] }));
16324
+ resolve3(new Blob(body, { type: stream[kContentType] }));
16325
16325
  } else if (type === "bytes") {
16326
- resolve2(chunksConcat(body, length));
16326
+ resolve3(chunksConcat(body, length));
16327
16327
  }
16328
16328
  consumeFinish(consume2);
16329
16329
  } catch (err) {
@@ -16513,9 +16513,9 @@ var require_api_request = __commonJS({
16513
16513
  };
16514
16514
  function request(opts, callback) {
16515
16515
  if (callback === void 0) {
16516
- return new Promise((resolve2, reject) => {
16516
+ return new Promise((resolve3, reject) => {
16517
16517
  request.call(this, opts, (err, data2) => {
16518
- return err ? reject(err) : resolve2(data2);
16518
+ return err ? reject(err) : resolve3(data2);
16519
16519
  });
16520
16520
  });
16521
16521
  }
@@ -16727,9 +16727,9 @@ var require_api_stream = __commonJS({
16727
16727
  };
16728
16728
  function stream(opts, factory, callback) {
16729
16729
  if (callback === void 0) {
16730
- return new Promise((resolve2, reject) => {
16730
+ return new Promise((resolve3, reject) => {
16731
16731
  stream.call(this, opts, factory, (err, data2) => {
16732
- return err ? reject(err) : resolve2(data2);
16732
+ return err ? reject(err) : resolve3(data2);
16733
16733
  });
16734
16734
  });
16735
16735
  }
@@ -17017,9 +17017,9 @@ var require_api_upgrade = __commonJS({
17017
17017
  };
17018
17018
  function upgrade(opts, callback) {
17019
17019
  if (callback === void 0) {
17020
- return new Promise((resolve2, reject) => {
17020
+ return new Promise((resolve3, reject) => {
17021
17021
  upgrade.call(this, opts, (err, data2) => {
17022
- return err ? reject(err) : resolve2(data2);
17022
+ return err ? reject(err) : resolve3(data2);
17023
17023
  });
17024
17024
  });
17025
17025
  }
@@ -17112,9 +17112,9 @@ var require_api_connect = __commonJS({
17112
17112
  };
17113
17113
  function connect(opts, callback) {
17114
17114
  if (callback === void 0) {
17115
- return new Promise((resolve2, reject) => {
17115
+ return new Promise((resolve3, reject) => {
17116
17116
  connect.call(this, opts, (err, data2) => {
17117
- return err ? reject(err) : resolve2(data2);
17117
+ return err ? reject(err) : resolve3(data2);
17118
17118
  });
17119
17119
  });
17120
17120
  }
@@ -18388,7 +18388,7 @@ var require_snapshot_recorder = __commonJS({
18388
18388
  "node_modules/undici/lib/mock/snapshot-recorder.js"(exports, module) {
18389
18389
  "use strict";
18390
18390
  var { writeFile, readFile, mkdir } = __require("fs/promises");
18391
- var { dirname: dirname2, resolve: resolve2 } = __require("path");
18391
+ var { dirname: dirname3, resolve: resolve3 } = __require("path");
18392
18392
  var { setTimeout: setTimeout2, clearTimeout: clearTimeout2 } = __require("timers");
18393
18393
  var { InvalidArgumentError, UndiciError } = require_errors();
18394
18394
  var { hashId, isUrlExcludedFactory, normalizeHeaders, createHeaderFilters } = require_snapshot_utils();
@@ -18589,7 +18589,7 @@ var require_snapshot_recorder = __commonJS({
18589
18589
  throw new InvalidArgumentError("Snapshot path is required");
18590
18590
  }
18591
18591
  try {
18592
- const data2 = await readFile(resolve2(path), "utf8");
18592
+ const data2 = await readFile(resolve3(path), "utf8");
18593
18593
  const parsed = JSON.parse(data2);
18594
18594
  if (Array.isArray(parsed)) {
18595
18595
  this.#snapshots.clear();
@@ -18618,8 +18618,8 @@ var require_snapshot_recorder = __commonJS({
18618
18618
  if (!path) {
18619
18619
  throw new InvalidArgumentError("Snapshot path is required");
18620
18620
  }
18621
- const resolvedPath = resolve2(path);
18622
- await mkdir(dirname2(resolvedPath), { recursive: true });
18621
+ const resolvedPath = resolve3(path);
18622
+ await mkdir(dirname3(resolvedPath), { recursive: true });
18623
18623
  const data2 = Array.from(this.#snapshots.entries()).map(([hash, snapshot]) => ({
18624
18624
  hash,
18625
18625
  snapshot
@@ -25416,7 +25416,7 @@ var require_fetch = __commonJS({
25416
25416
  function handleFetchDone(response) {
25417
25417
  finalizeAndReportTiming(response, "fetch");
25418
25418
  }
25419
- function fetch2(input, init2 = void 0) {
25419
+ function fetch3(input, init2 = void 0) {
25420
25420
  webidl.argumentLengthCheck(arguments, 1, "globalThis.fetch");
25421
25421
  let p = createDeferredPromise();
25422
25422
  let requestObject;
@@ -26268,7 +26268,7 @@ var require_fetch = __commonJS({
26268
26268
  const agent = fetchParams.controller.dispatcher;
26269
26269
  const path = url.pathname + url.search;
26270
26270
  const hasTrailingQuestionMark = url.search.length === 0 && url.href[url.href.length - url.hash.length - 1] === "?";
26271
- return new Promise((resolve2, reject) => agent.dispatch(
26271
+ return new Promise((resolve3, reject) => agent.dispatch(
26272
26272
  {
26273
26273
  path: hasTrailingQuestionMark ? `${path}?` : path,
26274
26274
  origin: url.origin,
@@ -26356,7 +26356,7 @@ var require_fetch = __commonJS({
26356
26356
  }
26357
26357
  this.body = new Readable({ read: resume });
26358
26358
  const onError = this.onError.bind(this);
26359
- resolve2({
26359
+ resolve3({
26360
26360
  status,
26361
26361
  statusText,
26362
26362
  headersList,
@@ -26409,7 +26409,7 @@ var require_fetch = __commonJS({
26409
26409
  headersList.append(headerName, String(value), true);
26410
26410
  }
26411
26411
  }
26412
- resolve2({
26412
+ resolve3({
26413
26413
  status,
26414
26414
  statusText: STATUS_CODES[status],
26415
26415
  headersList,
@@ -26433,7 +26433,7 @@ var require_fetch = __commonJS({
26433
26433
  headersList.append(nameStr, value.toString("latin1"), true);
26434
26434
  }
26435
26435
  }
26436
- resolve2({
26436
+ resolve3({
26437
26437
  status,
26438
26438
  statusText: STATUS_CODES[status],
26439
26439
  headersList,
@@ -26446,7 +26446,7 @@ var require_fetch = __commonJS({
26446
26446
  }
26447
26447
  }
26448
26448
  module.exports = {
26449
- fetch: fetch2,
26449
+ fetch: fetch3,
26450
26450
  Fetch,
26451
26451
  fetching,
26452
26452
  finalizeAndReportTiming
@@ -30700,7 +30700,7 @@ var require_undici = __commonJS({
30700
30700
  err.stack = stack ? `${stack}
30701
30701
  ${captureLines}` : capture.stack;
30702
30702
  }
30703
- module.exports.fetch = function fetch2(init2, options = void 0) {
30703
+ module.exports.fetch = function fetch3(init2, options = void 0) {
30704
30704
  return fetchImpl(init2, options).catch((err) => {
30705
30705
  if (currentFilename) {
30706
30706
  appendFetchStackTrace(err, currentFilename);
@@ -38682,11 +38682,11 @@ function getAtomFeed(feedRoot) {
38682
38682
  if (href2) {
38683
38683
  entry.link = href2;
38684
38684
  }
38685
- const description = fetch("summary", children2) || fetch("content", children2);
38685
+ const description = fetch2("summary", children2) || fetch2("content", children2);
38686
38686
  if (description) {
38687
38687
  entry.description = description;
38688
38688
  }
38689
- const pubDate = fetch("updated", children2);
38689
+ const pubDate = fetch2("updated", children2);
38690
38690
  if (pubDate) {
38691
38691
  entry.pubDate = new Date(pubDate);
38692
38692
  }
@@ -38700,7 +38700,7 @@ function getAtomFeed(feedRoot) {
38700
38700
  feed.link = href;
38701
38701
  }
38702
38702
  addConditionally(feed, "description", "subtitle", childs);
38703
- const updated = fetch("updated", childs);
38703
+ const updated = fetch2("updated", childs);
38704
38704
  if (updated) {
38705
38705
  feed.updated = new Date(updated);
38706
38706
  }
@@ -38720,7 +38720,7 @@ function getRssFeed(feedRoot) {
38720
38720
  addConditionally(entry, "title", "title", children2);
38721
38721
  addConditionally(entry, "link", "link", children2);
38722
38722
  addConditionally(entry, "description", "description", children2);
38723
- const pubDate = fetch("pubDate", children2) || fetch("dc:date", children2);
38723
+ const pubDate = fetch2("pubDate", children2) || fetch2("dc:date", children2);
38724
38724
  if (pubDate)
38725
38725
  entry.pubDate = new Date(pubDate);
38726
38726
  return entry;
@@ -38729,7 +38729,7 @@ function getRssFeed(feedRoot) {
38729
38729
  addConditionally(feed, "title", "title", childs);
38730
38730
  addConditionally(feed, "link", "link", childs);
38731
38731
  addConditionally(feed, "description", "description", childs);
38732
- const updated = fetch("lastBuildDate", childs);
38732
+ const updated = fetch2("lastBuildDate", childs);
38733
38733
  if (updated) {
38734
38734
  feed.updated = new Date(updated);
38735
38735
  }
@@ -38773,11 +38773,11 @@ function getMediaElements(where) {
38773
38773
  function getOneElement(tagName2, node) {
38774
38774
  return getElementsByTagName(tagName2, node, true, 1)[0];
38775
38775
  }
38776
- function fetch(tagName2, where, recurse = false) {
38776
+ function fetch2(tagName2, where, recurse = false) {
38777
38777
  return textContent(getElementsByTagName(tagName2, where, recurse, 1)).trim();
38778
38778
  }
38779
38779
  function addConditionally(obj, prop2, tagName2, where, recurse = false) {
38780
- const val2 = fetch(tagName2, where, recurse);
38780
+ const val2 = fetch2(tagName2, where, recurse);
38781
38781
  if (val2)
38782
38782
  obj[prop2] = val2;
38783
38783
  }
@@ -53845,7 +53845,7 @@ var CSS_SUPPORT_TABLE = {
53845
53845
  "outlook-macos": "supported",
53846
53846
  "apple-mail-macos": "supported",
53847
53847
  "apple-mail-ios": "supported",
53848
- "yahoo-mail": "supported",
53848
+ "yahoo-mail": "partial",
53849
53849
  "yahoo-mail-android": "supported",
53850
53850
  "yahoo-mail-ios": "supported",
53851
53851
  "samsung-mail": "supported",
@@ -56808,12 +56808,12 @@ var CSS_SUPPORT_TABLE = {
56808
56808
  "outlook-windows": "unsupported",
56809
56809
  "outlook-windows-legacy": "unsupported",
56810
56810
  "outlook-ios": "unsupported",
56811
- "outlook-android": "unsupported",
56811
+ "outlook-android": "supported",
56812
56812
  "outlook-macos": "unsupported",
56813
56813
  "apple-mail-macos": "supported",
56814
56814
  "apple-mail-ios": "supported",
56815
- "yahoo-mail": "supported",
56816
- "yahoo-mail-android": "supported",
56815
+ "yahoo-mail": "unsupported",
56816
+ "yahoo-mail-android": "unsupported",
56817
56817
  "yahoo-mail-ios": "supported",
56818
56818
  "samsung-mail": "supported",
56819
56819
  "thunderbird": "supported",
@@ -57406,12 +57406,12 @@ var CSS_SUPPORT_TABLE = {
57406
57406
  "outlook-windows": "supported",
57407
57407
  "outlook-windows-legacy": "unsupported",
57408
57408
  "outlook-ios": "supported",
57409
- "outlook-android": "supported",
57409
+ "outlook-android": "unsupported",
57410
57410
  "outlook-macos": "supported",
57411
57411
  "apple-mail-macos": "supported",
57412
57412
  "apple-mail-ios": "supported",
57413
- "yahoo-mail": "supported",
57414
- "yahoo-mail-android": "supported",
57413
+ "yahoo-mail": "unsupported",
57414
+ "yahoo-mail-android": "unsupported",
57415
57415
  "yahoo-mail-ios": "supported",
57416
57416
  "samsung-mail": "supported",
57417
57417
  "thunderbird": "supported",
@@ -58929,7 +58929,7 @@ var CSS_SUPPORT_NOTES = {
58929
58929
  "gmail-android": ["Partial. Not supported with non Google accounts. But it can be used in the `background` shorthand property instead."],
58930
58930
  "gmail-ios": ["Partial. Not supported with non Google accounts. But it can be used in the `background` shorthand property instead."],
58931
58931
  "outlook-windows-legacy": ["Background images size can be used in VML with the `size` attribute. See [VML documentation](https://docs.microsoft.com/en-us/windows/win32/vml/size-attribute--fill--vml)."],
58932
- "yahoo-mail": ["Partial. Does not support multiple values. The comma between two values is removed."],
58932
+ "yahoo-mail": ["Observed 2026-11-09 (Emailens real-device checks, Yahoo Mail web (Chrome): foodpanda campaign (2026-10-28), AliExpress (2026-11-09)): Partial. Ignored inside the background shorthand (`background: url() 0 0 / cover`): the image draws at its natural size. The background-size property written on its own works."],
58933
58933
  "yahoo-mail-android": ["Partial. Does not support multiple values. The comma between two values is removed."],
58934
58934
  "yahoo-mail-ios": ["Partial. Does not support multiple values. The comma between two values is removed."],
58935
58935
  "aol": ["Partial. Does not support multiple values. The comma between two values is removed."]
@@ -59411,7 +59411,10 @@ var CSS_SUPPORT_NOTES = {
59411
59411
  "gmail-ios": ["Partial. Not supported with non Google accounts."]
59412
59412
  },
59413
59413
  "text-shadow": {
59414
- "outlook-web": ["Observed 2026-10-14 (Emailens real-device probe, Outlook.com (Chrome)): A red text-shadow rendered behind bold text."]
59414
+ "outlook-web": ["Observed 2026-10-14 (Emailens real-device probe, Outlook.com (Chrome)): A red text-shadow rendered behind bold text."],
59415
+ "outlook-android": ["Observed 2026-11-08 (Emailens probe sheets 20-22, the Outlook Android app, our own seed inbox): A green text-shadow drew behind the text."],
59416
+ "yahoo-mail": ["Observed 2026-11-08 (Emailens probe sheets 20-22, Yahoo Mail web (Chrome), our own seed inbox): A green text-shadow did not draw; the text rendered plain."],
59417
+ "yahoo-mail-android": ["Observed 2026-11-08 (Emailens probe sheets 20-22, the Yahoo Mail Android app, our own seed inbox): A green text-shadow did not draw; the text rendered plain."]
59415
59418
  },
59416
59419
  "text-transform": {
59417
59420
  "outlook-windows-legacy": ["Partial. `lowercase` value is not supported."]
@@ -59465,9 +59468,12 @@ var CSS_SUPPORT_NOTES = {
59465
59468
  },
59466
59469
  "visibility": {
59467
59470
  "outlook-ios": ['Buggy. `visibility:collapse` applied to a `<tr>` only hides content and does not "remove" it from layout.'],
59471
+ "outlook-android": ["Observed 2026-11-08 (Emailens probe sheets 20-22, the Outlook Android app, our own seed inbox): An element at `visibility:hidden` stayed visible. Use `display:none` (or remove the element) to hide it."],
59468
59472
  "outlook-macos": ['Buggy. `visibility:collapse` applied to a `<tr>` only hides content and does not "remove" it from layout.'],
59469
59473
  "apple-mail-macos": ['Buggy. `visibility:collapse` applied to a `<tr>` only hides content and does not "remove" it from layout.'],
59470
59474
  "apple-mail-ios": ['Buggy. `visibility:collapse` applied to a `<tr>` only hides content and does not "remove" it from layout.'],
59475
+ "yahoo-mail": ["Observed 2026-11-08 (Emailens probe sheets 20-22, Yahoo Mail web (Chrome), our own seed inbox): An element at `visibility:hidden` stayed visible. Use `display:none` (or remove the element) to hide it."],
59476
+ "yahoo-mail-android": ["Observed 2026-11-08 (Emailens probe sheets 20-22, the Yahoo Mail Android app, our own seed inbox): An element at `visibility:hidden` stayed visible. Use `display:none` (or remove the element) to hide it."],
59471
59477
  "yahoo-mail-ios": ['Buggy. `visibility:collapse` applied to a `<tr>` only hides content and does not "remove" it from layout.'],
59472
59478
  "protonmail": ['Buggy. `visibility:collapse` applied to a `<tr>` only hides content and does not "remove" it from layout.']
59473
59479
  },
@@ -63661,6 +63667,13 @@ var capBorder = (value) => value.replace(
63661
63667
  (whole, n2) => Number(n2) > MAX_BORDER_PX ? `${MAX_BORDER_PX}px` : whole
63662
63668
  );
63663
63669
  var flattenMargin = (value) => value.split(/\s+/).map((part) => part === "auto" || /^-/.test(part) ? "0" : part).join(" ");
63670
+ var flattenDivMargin = (prop2, value) => {
63671
+ if (prop2 === "margin-left" || prop2 === "margin-right") return value.trim() === "auto" ? "0" : value;
63672
+ if (prop2 !== "margin") return flattenMargin(value);
63673
+ const parts = value.trim().split(/\s+/);
63674
+ const vertical = (i2) => i2 === 0 || i2 === 2 && parts.length >= 3;
63675
+ return parts.map((part, i2) => part === "auto" || /^-/.test(part) && vertical(i2) ? "0" : part).join(" ");
63676
+ };
63664
63677
  function holdsNoText($3, el2) {
63665
63678
  const own = $3(el2).clone();
63666
63679
  own.find("table").remove();
@@ -63943,7 +63956,7 @@ function applyWordBoxModel($3) {
63943
63956
  if (tag === "div" || tag === "table") {
63944
63957
  for (const prop2 of MARGIN) {
63945
63958
  const value = props.get(prop2);
63946
- if (value !== void 0) props.set(prop2, flattenMargin(value));
63959
+ if (value !== void 0) props.set(prop2, tag === "div" ? flattenDivMargin(prop2, value) : flattenMargin(value));
63947
63960
  }
63948
63961
  if (tag === "table" && /center/i.test((_f = $3(el2).attr("align")) != null ? _f : "")) {
63949
63962
  props.delete("margin-top");
@@ -65045,7 +65058,7 @@ var TARGETING_HACKS = [
65045
65058
  "notes": ""
65046
65059
  }
65047
65060
  ];
65048
- var GMAIL_WRAPPER_SELECTOR = /(?:^|[\s>~+(])u\s*\+\s*([.#][\w-]+)/i;
65061
+ var GMAIL_WRAPPER_SELECTOR = /(?:^|[\s>~+(,{}])u\s*\+\s*([.#][\w-]+)/i;
65049
65062
  var TARGETING_MATCHERS = [
65050
65063
  {
65051
65064
  id: "gmail-android-div-u-body",
@@ -65483,6 +65496,160 @@ function applyTargetingSimulation($3, clientId) {
65483
65496
  body.append($3("<div></div>").append("<u></u>").append(inner));
65484
65497
  }
65485
65498
  }
65499
+ var RUN = "2026-10-14";
65500
+ var seen = (level, source, note) => ({
65501
+ level,
65502
+ observed: RUN,
65503
+ source,
65504
+ note
65505
+ });
65506
+ var newOutlookMac = (level, note) => ({
65507
+ level,
65508
+ observed: "2026-10-27",
65509
+ source: "Emailens probe sheets 20-22, the new Outlook for Mac",
65510
+ note
65511
+ });
65512
+ var yahooWeb = (level, note) => ({
65513
+ level,
65514
+ observed: "2026-10-27",
65515
+ source: "Emailens probe, Yahoo Mail web (Chrome), real-device run E8fVpFwwLtL8",
65516
+ note
65517
+ });
65518
+ var gmailWeb = (level, note) => ({
65519
+ level,
65520
+ observed: "2026-10-28",
65521
+ source: "Emailens probe, Gmail web (Chrome), real-device run 1isFNBBaOyEo",
65522
+ note
65523
+ });
65524
+ var worker = (level, source, note) => ({
65525
+ level,
65526
+ observed: "2026-11-08",
65527
+ source: `Emailens probe sheets 20-22, ${source}, our own seed inbox`,
65528
+ note
65529
+ });
65530
+ var OBSERVED_OVERRIDES = {
65531
+ // Email Geeks #email-code, 2026-10-29: "Yahoo strips action and formaction".
65532
+ // Six forms sent to our Yahoo seed; the delivered HTML had neither.
65533
+ "<form>": {
65534
+ "yahoo-mail": {
65535
+ level: "unsupported",
65536
+ observed: "2026-10-29",
65537
+ source: "Emailens probe, Yahoo Mail web (Chrome), our own seed inbox",
65538
+ note: 'The form is kept but its `action` is removed (absolute, relative and empty alike), and so is `formaction` on a button; Yahoo adds `target="_blank"`. The form cannot reach your server: link to a landing page instead. `type="email"` is also dropped from inputs; `method`, text, radio and submit inputs are kept.'
65539
+ }
65540
+ },
65541
+ // display:flex holds and so does width; the item sizing does not. A label
65542
+ // column at `flex:0 0 34%` beside a paragraph collapsed to a letter wide.
65543
+ flex: {
65544
+ "yahoo-mail": yahooWeb(
65545
+ "unsupported",
65546
+ "The `flex` shorthand is dropped: an item at `flex:0 0 34%` shrank to its narrowest, breaking words letter by letter. Size flex items with `width` (and `flex-shrink:0`), or use a table."
65547
+ ),
65548
+ "gmail-web": gmailWeb(
65549
+ "unsupported",
65550
+ "The `flex` shorthand is dropped: an item at `flex:0 0 34%` lost its 34% and sized to its content. `width:34%` on the same item held, and so did a table."
65551
+ )
65552
+ },
65553
+ "flex-basis": {
65554
+ "yahoo-mail": yahooWeb(
65555
+ "unsupported",
65556
+ "Dropped, with flex-grow and flex-shrink beside it: the item sized to its content instead of 34%. `width:34%` on the same item held."
65557
+ ),
65558
+ "gmail-web": gmailWeb(
65559
+ "unsupported",
65560
+ "Dropped, with flex-grow and flex-shrink beside it: the item sized to its content instead of 34%. `width:34%` on the same item held."
65561
+ )
65562
+ },
65563
+ // caniemail 16.80 says not supported; plain track lists are kept and the
65564
+ // functions dropped, twice over two runs.
65565
+ "grid-template-columns": {
65566
+ "outlook-macos": newOutlookMac(
65567
+ "partial",
65568
+ "Plain track sizes work (`300px 300px`, `1fr 1fr`); a value with `repeat()` or `minmax()` is dropped, so the grid falls back to one column."
65569
+ )
65570
+ },
65571
+ // Sheet 20 case 30: an orange block at visibility:hidden over a green cell
65572
+ // stayed orange. Gmail web, on the same sheet, hid it.
65573
+ visibility: {
65574
+ "yahoo-mail": worker(
65575
+ "unsupported",
65576
+ "Yahoo Mail web (Chrome)",
65577
+ "An element at `visibility:hidden` stayed visible. Use `display:none` (or remove the element) to hide it."
65578
+ ),
65579
+ "yahoo-mail-android": worker(
65580
+ "unsupported",
65581
+ "the Yahoo Mail Android app",
65582
+ "An element at `visibility:hidden` stayed visible. Use `display:none` (or remove the element) to hide it."
65583
+ ),
65584
+ "outlook-android": worker(
65585
+ "unsupported",
65586
+ "the Outlook Android app",
65587
+ "An element at `visibility:hidden` stayed visible. Use `display:none` (or remove the element) to hide it."
65588
+ )
65589
+ },
65590
+ "box-shadow": {
65591
+ "yahoo-mail": seen(
65592
+ "supported",
65593
+ "Emailens real-device probe, Yahoo Mail (Chrome)",
65594
+ "A box-shadow on a table cell rendered with its offset and colour."
65595
+ )
65596
+ },
65597
+ // Sheet 22 case 13: a green text-shadow drew in Gmail and Outlook Android,
65598
+ // not in either Yahoo.
65599
+ "text-shadow": {
65600
+ "yahoo-mail": worker(
65601
+ "unsupported",
65602
+ "Yahoo Mail web (Chrome)",
65603
+ "A green text-shadow did not draw; the text rendered plain."
65604
+ ),
65605
+ "yahoo-mail-android": worker(
65606
+ "unsupported",
65607
+ "the Yahoo Mail Android app",
65608
+ "A green text-shadow did not draw; the text rendered plain."
65609
+ ),
65610
+ "outlook-web": seen(
65611
+ "supported",
65612
+ "Emailens real-device probe, Outlook.com (Chrome)",
65613
+ "A red text-shadow rendered behind bold text."
65614
+ ),
65615
+ "outlook-android": worker(
65616
+ "supported",
65617
+ "the Outlook Android app",
65618
+ "A green text-shadow drew behind the text."
65619
+ )
65620
+ },
65621
+ // foodpanda's logos and coupon on real Yahoo Mail web (2026-10-28): drawn
65622
+ // at their natural size, the size written inside the `background` shorthand
65623
+ // ignored (yahoo-background-size.test.ts). Written on its own it holds:
65624
+ // AliExpress's 29 product photos drew fitted (fidelity bench, 2026-11-09).
65625
+ "background-size": {
65626
+ "yahoo-mail": {
65627
+ level: "partial",
65628
+ observed: "2026-11-09",
65629
+ source: "Emailens real-device checks, Yahoo Mail web (Chrome): foodpanda campaign (2026-10-28), AliExpress (2026-11-09)",
65630
+ note: "Partial. Ignored inside the background shorthand (`background: url() 0 0 / cover`): the image draws at its natural size. The background-size property written on its own works."
65631
+ }
65632
+ },
65633
+ "text-decoration": {
65634
+ "apple-mail-macos": seen(
65635
+ "partial",
65636
+ "Emailens real-device probe, Apple Mail (macOS)",
65637
+ "The multi-value shorthand `text-decoration: underline wavy #d33` was dropped whole: no line at all. A single line value works; style and colour need -webkit-text-decoration."
65638
+ ),
65639
+ "apple-mail-ios": seen(
65640
+ "partial",
65641
+ "Emailens real-device probe, Apple Mail (iPhone 13)",
65642
+ "The multi-value shorthand `text-decoration: underline wavy #d33` was dropped whole: no line at all. A single line value works; style and colour need -webkit-text-decoration."
65643
+ ),
65644
+ "outlook-macos": seen(
65645
+ "partial",
65646
+ // The legacy app (Outlook 2019 for Mac). Not yet re-checked on the new
65647
+ // Outlook for Mac, which the outlook-macos column now describes.
65648
+ "Emailens real-device probe, Outlook 2019 for Mac (legacy app)",
65649
+ "The multi-value shorthand `text-decoration: underline wavy #d33` was dropped whole: no line at all. A single line value works; style and colour need -webkit-text-decoration."
65650
+ )
65651
+ }
65652
+ };
65486
65653
  function isWordEngineClient(clientId) {
65487
65654
  return clientId === "outlook-windows-legacy";
65488
65655
  }
@@ -65525,14 +65692,35 @@ function mergeInline(state, declText) {
65525
65692
  }
65526
65693
  return serializeStyle(out);
65527
65694
  }
65528
- function inlineStyles($3, keepFontFace = true) {
65695
+ function sameProperty(a2, b2) {
65696
+ const props = (d) => d.split(";").map((p) => p.split(":")[0].trim().toLowerCase());
65697
+ const mine = new Set(props(b2));
65698
+ return props(a2).some((p) => p && mine.has(p));
65699
+ }
65700
+ function linkRule(color) {
65701
+ return { selector: 'a[href]:not([href="mailto:"])', weight: 100.5, declText: `color: ${color}`, client: true };
65702
+ }
65703
+ function specificity2(selector) {
65704
+ let ids = 0;
65705
+ let classes = 0;
65706
+ let types = 0;
65707
+ fy(selector, (node) => {
65708
+ if (node.type === "IdSelector") ids++;
65709
+ else if (node.type === "ClassSelector" || node.type === "AttributeSelector") classes++;
65710
+ else if (node.type === "TypeSelector" && node.name !== "*") types++;
65711
+ });
65712
+ return ids * 1e4 + classes * 100 + types;
65713
+ }
65714
+ function inlineStyles($3, keepFontFace = true, clientRules = []) {
65529
65715
  const styleBlocks = [];
65530
65716
  $3("style").each((_3, el2) => {
65531
65717
  styleBlocks.push($3(el2).text());
65532
65718
  });
65533
- if (styleBlocks.length === 0) return "";
65719
+ if (styleBlocks.length === 0 && clientRules.length === 0) return "";
65534
65720
  const preserved = [];
65535
65721
  const inlined = /* @__PURE__ */ new WeakMap();
65722
+ const rules = [...clientRules];
65723
+ const kept = [];
65536
65724
  for (const block of styleBlocks) {
65537
65725
  let ast;
65538
65726
  try {
@@ -65570,22 +65758,33 @@ function inlineStyles($3, keepFontFace = true) {
65570
65758
  const isClientTargeting = shouldPreserveSelector(selectorText);
65571
65759
  if (hasPseudoSelector(selectorText) || isClientTargeting) {
65572
65760
  preserved.push(hy(node));
65761
+ if (!hasPseudoSelector(selectorText))
65762
+ node.prelude.children.forEach((selector) => {
65763
+ kept.push({ selector: hy(selector), weight: specificity2(selector), declText });
65764
+ });
65573
65765
  return;
65574
65766
  }
65575
- try {
65576
- $3(selectorText).each((_3, el2) => {
65577
- let state = inlined.get(el2);
65578
- if (!state) {
65579
- state = { author: cascade(/* @__PURE__ */ new Map(), $3(el2).attr("style") || ""), sheet: /* @__PURE__ */ new Map() };
65580
- inlined.set(el2, state);
65581
- }
65582
- $3(el2).attr("style", mergeInline(state, declText));
65583
- });
65584
- } catch (e2) {
65585
- }
65767
+ node.prelude.children.forEach((selector) => {
65768
+ rules.push({ selector: hy(selector), weight: specificity2(selector), declText });
65769
+ });
65586
65770
  }
65587
65771
  });
65588
65772
  }
65773
+ for (const { selector, declText, weight, client } of rules.sort((a2, b2) => a2.weight - b2.weight)) {
65774
+ try {
65775
+ $3(selector).each((_3, el2) => {
65776
+ if (client && kept.some((k2) => k2.weight > weight && sameProperty(k2.declText, declText) && $3(el2).is(k2.selector)))
65777
+ return;
65778
+ let state = inlined.get(el2);
65779
+ if (!state) {
65780
+ state = { author: cascade(/* @__PURE__ */ new Map(), $3(el2).attr("style") || ""), sheet: /* @__PURE__ */ new Map() };
65781
+ inlined.set(el2, state);
65782
+ }
65783
+ $3(el2).attr("style", mergeInline(state, declText));
65784
+ });
65785
+ } catch (e2) {
65786
+ }
65787
+ }
65589
65788
  return preserved.join("\n");
65590
65789
  }
65591
65790
  function makeWarning(base, prop2, clientId, framework) {
@@ -65794,9 +65993,10 @@ function superhumanAdditionalChecks($3, clientId, html3) {
65794
65993
  }
65795
65994
  var EMPTY_SET = /* @__PURE__ */ new Set();
65796
65995
  var OUTLOOK_WEB_STRIPPED = /* @__PURE__ */ new Set(["position", "transform", "animation", "transition"]);
65797
- var YAHOO_STRIPPED = /* @__PURE__ */ new Set(["position", "box-shadow", "transform", "animation", "transition", "opacity"]);
65996
+ var YAHOO_STRIPPED = /* @__PURE__ */ new Set(["position", "box-shadow", "transform", "animation", "transition"]);
65997
+ var YAHOO_IOS_STRIPPED = /* @__PURE__ */ new Set([...YAHOO_STRIPPED, "opacity"]);
65798
65998
  var YAHOO_WEB_STRIPPED = /* @__PURE__ */ new Set([
65799
- ...[...YAHOO_STRIPPED].filter((p) => p !== "box-shadow"),
65999
+ ...YAHOO_STRIPPED,
65800
66000
  "flex",
65801
66001
  "flex-basis",
65802
66002
  // A width:100% + padding + border-box CTA came out 566px in a 534px column
@@ -65807,6 +66007,9 @@ var GMAIL_WEB_STRIPPED = /* @__PURE__ */ new Set([...GMAIL_STRIPPED_PROPERTIES,
65807
66007
  var CLIENT_CONFIGS = {
65808
66008
  "gmail-web": {
65809
66009
  id: "gmail-web",
66010
+ // 324 of 458 links with no inline colour came out #15c in real Gmail web
66011
+ // (emailens fidelity bench, 2026-11-09); its weight: see linkRule().
66012
+ linkColor: "#15c",
65810
66013
  // caniemail's set. A 2026-10-14 render said Gmail web kept box-shadow,
65811
66014
  // text-shadow, visibility, animation, gap and grid; caniemail's own tests in
65812
66015
  // real Gmail web (Chrome and Firefox, 2026-10-24) did not, and the <style>
@@ -65864,8 +66067,15 @@ var CLIENT_CONFIGS = {
65864
66067
  strippedProperties: OUTLOOK_WEB_STRIPPED,
65865
66068
  stripMode: "strip",
65866
66069
  stripStyleAnimations: true,
66070
+ // No web font, as on Mac: postmark~welcome's @import of Nunito Sans drew
66071
+ // Arial on the worker's new Outlook (bench 2026-11-09); caniemail agrees.
66072
+ dropAtRules: /^@font-face\b|^@import\b/i,
66073
+ // @media reads the window, not the reading pane: of 27 emails with a
66074
+ // max-width query firing at 620, the worker's new Outlook drew none
66075
+ // mobile (bench 2026-11-09). 766 is that read window, 957 px at 125%.
66076
+ mediaWidth: 766,
65867
66077
  inlineAndStripStyles: false,
65868
- stripExternalStylesheets: false,
66078
+ stripExternalStylesheets: true,
65869
66079
  stripForms: false,
65870
66080
  stripSvg: false
65871
66081
  },
@@ -65882,6 +66092,13 @@ var CLIENT_CONFIGS = {
65882
66092
  { prop: "background", pattern: /linear-gradient|radial-gradient|url\(/ },
65883
66093
  { prop: "background-image", pattern: /linear-gradient|radial-gradient|url\(/ }
65884
66094
  ],
66095
+ // The same in <style> blocks: a `.mh-cta{background-image:radial-gradient}`
66096
+ // rule drew a magenta box in the sim where real Outlook Classic drew no
66097
+ // fill (real-device capture of preview J9vFS4nm_LGl, 2026-11-06).
66098
+ // ponytail: background-image only; a `background:` shorthand in <style>
66099
+ // still draws (it may carry the fallback colour Word keeps). Split it like
66100
+ // backgroundShorthandColor when a capture shows one.
66101
+ dropValues: /^background-image:.*(?:linear-gradient|radial-gradient|url)\(/,
65885
66102
  inlineAndStripStyles: false,
65886
66103
  stripExternalStylesheets: false,
65887
66104
  stripForms: false,
@@ -66001,7 +66218,9 @@ var CLIENT_CONFIGS = {
66001
66218
  dropValues: /radial-gradient\(/i,
66002
66219
  // Real Yahoo web drew foodpanda's `url(...) center / cover` logos at their
66003
66220
  // 236px and its `0% 0% / 100% 100%` coupon at the picture's own size,
66004
- // cropped to the cell (emailens agreement run, 2026-10-28).
66221
+ // cropped to the cell (emailens agreement run, 2026-10-28): the size inside
66222
+ // the shorthand is ignored. Written on its own it holds (AliExpress,
66223
+ // fidelity bench 2026-11-09).
66005
66224
  dropBackgroundSize: true,
66006
66225
  // A <style> with a comma-separated media query list is dropped whole: a
66007
66226
  // probe on real Yahoo web lost the block for `screen and
@@ -66033,7 +66252,7 @@ var CLIENT_CONFIGS = {
66033
66252
  },
66034
66253
  "yahoo-mail-ios": {
66035
66254
  id: "yahoo-mail-ios",
66036
- strippedProperties: YAHOO_STRIPPED,
66255
+ strippedProperties: YAHOO_IOS_STRIPPED,
66037
66256
  stripMode: "strip",
66038
66257
  inlineAndStripStyles: false,
66039
66258
  stripExternalStylesheets: false,
@@ -66125,6 +66344,21 @@ var CLIENT_CONFIGS = {
66125
66344
  additionalChecks: superhumanAdditionalChecks
66126
66345
  }
66127
66346
  };
66347
+ var PLAIN_PROPERTY = /^[a-z][a-z-]*$/;
66348
+ function applyObservations(observations, configs) {
66349
+ for (const [property, byClient] of Object.entries(observations)) {
66350
+ if (!PLAIN_PROPERTY.test(property)) continue;
66351
+ for (const [clientId, o2] of Object.entries(byClient)) {
66352
+ const config = configs[clientId];
66353
+ if (!config || o2.level === "partial") continue;
66354
+ const strip = new Set(config.strippedProperties);
66355
+ if (o2.level === "unsupported") strip.add(property);
66356
+ else strip.delete(property);
66357
+ config.strippedProperties = strip;
66358
+ }
66359
+ }
66360
+ }
66361
+ applyObservations(OBSERVED_OVERRIDES, CLIENT_CONFIGS);
66128
66362
  var TEXT_DECORATION_LINE = /^(?:none|underline|overline|line-through|blink)(?:\s+(?:underline|overline|line-through|blink))*\s*(?:!important)?$/i;
66129
66363
  var isLineOnly = (value) => TEXT_DECORATION_LINE.test(value.trim());
66130
66364
  function dropWarnings(html3, config, clientId, framework) {
@@ -66139,9 +66373,25 @@ function dropWarnings(html3, config, clientId, framework) {
66139
66373
  }
66140
66374
  function hasDrops(config) {
66141
66375
  return Boolean(
66142
- config.dropSelectors || config.dropAtRules || config.dropValues || config.dropProperties || config.dropNesting || config.dropElements || config.dropAttributes
66376
+ config.dropSelectors || config.dropAtRules || config.dropValues || config.dropProperties || config.dropNesting || config.dropElements || config.dropAttributes || config.mediaWidth
66143
66377
  );
66144
66378
  }
66379
+ function mediaAtWidth(prelude, width) {
66380
+ let any = false;
66381
+ for (const query of prelude.toLowerCase().split(",")) {
66382
+ const words = query.replace(/\([^)]*\)/g, " ").trim().split(/\s+/).filter(Boolean);
66383
+ if (words.some((w2) => !["only", "screen", "all", "print", "and"].includes(w2))) return null;
66384
+ let match = !words.includes("print");
66385
+ for (const f3 of query.matchAll(/\(([^)]*)\)/g)) {
66386
+ const m2 = /^\s*(min|max)-width\s*:\s*([\d.]+)px\s*$/.exec(f3[1]);
66387
+ if (!m2) return null;
66388
+ const px2 = Number(m2[2]);
66389
+ if (m2[1] === "min" ? width < px2 : width > px2) match = false;
66390
+ }
66391
+ any || (any = match);
66392
+ }
66393
+ return any;
66394
+ }
66145
66395
  function prepareDropSource(html3, config) {
66146
66396
  if (!hasDrops(config)) return html3;
66147
66397
  const $3 = load(html3);
@@ -66203,9 +66453,16 @@ function applyStyleDrops($3, config) {
66203
66453
  enter(node, item, list) {
66204
66454
  if (!list || !item) return;
66205
66455
  const head = node.type === "Atrule" ? `@${node.name}${node.prelude ? ` ${hy(node.prelude)}` : ""}` : "";
66456
+ const atWidth = config.mediaWidth && node.type === "Atrule" && node.name === "media" && node.prelude ? mediaAtWidth(hy(node.prelude), config.mediaWidth) : null;
66206
66457
  if (dropAtRules && node.type === "Atrule" && dropAtRules.test(head)) {
66207
66458
  list.remove(item);
66208
66459
  dropped.add(`@${node.name}`);
66460
+ } else if (atWidth === false) {
66461
+ list.remove(item);
66462
+ dropped.add("@media (width)");
66463
+ } else if (atWidth === true && node.type === "Atrule" && node.block) {
66464
+ list.insertList(node.block.children, item);
66465
+ list.remove(item);
66209
66466
  } else if (dropSelectors && node.type === "Rule") {
66210
66467
  const m2 = hy(node.prelude).match(dropSelectors);
66211
66468
  if (m2) {
@@ -66343,8 +66600,13 @@ function applyTransformDom($3, html3, config, framework) {
66343
66600
  if (config.additionalChecks && config.inlineAndStripStyles) {
66344
66601
  warnings.push(...config.additionalChecks($3, clientId, html3, framework));
66345
66602
  }
66603
+ applyTargetingSimulation($3, clientId);
66346
66604
  if (config.inlineAndStripStyles) {
66347
- const preserved = inlineStyles($3, ((_a22 = CSS_SUPPORT["@font-face"]) == null ? void 0 : _a22[clientId]) !== "unsupported");
66605
+ const preserved = inlineStyles(
66606
+ $3,
66607
+ ((_a22 = CSS_SUPPORT["@font-face"]) == null ? void 0 : _a22[clientId]) !== "unsupported",
66608
+ config.linkColor ? [linkRule(config.linkColor)] : []
66609
+ );
66348
66610
  $3("style").remove();
66349
66611
  if (preserved.trim()) {
66350
66612
  const head = $3("head");
@@ -66436,7 +66698,7 @@ function applyTransformDom($3, html3, config, framework) {
66436
66698
  }
66437
66699
  if (config.dropBackgroundSize) {
66438
66700
  const SIZE = /url\([^)]*\)|\s*\/\s*(?:cover|contain|auto|[\d.]+(?:px|%|em|rem|vw|vh)?)(?:\s+(?:auto|[\d.]+(?:px|%|em|rem|vw|vh)?))?/gi;
66439
- const unsize = (css2) => css2.replace(/(^|[;{\s])background-size\s*:[^;}]*;?/gi, "$1").replace(
66701
+ const unsize = (css2) => css2.replace(
66440
66702
  /(background\s*:[^;}]*)/gi,
66441
66703
  (decl) => decl.replace(SIZE, (m2) => m2.startsWith("url(") ? m2 : "")
66442
66704
  );
@@ -66535,9 +66797,11 @@ function applyTransformDom($3, html3, config, framework) {
66535
66797
  warnings.push(...config.additionalChecks($3, clientId, html3, framework));
66536
66798
  }
66537
66799
  if (isWordEngineClient(clientId)) applyWordBoxModel($3);
66538
- applyTargetingSimulation($3, clientId);
66539
66800
  return { clientId, html: $3.html(), warnings };
66540
66801
  }
66802
+ function standardsMode(html3) {
66803
+ return /^\s*(?:<!--[\s\S]*?-->\s*)*<!doctype/i.test(html3) ? html3 : `<!DOCTYPE html>${html3}`;
66804
+ }
66541
66805
  function transformForAllClients(html3, framework) {
66542
66806
  if (!html3 || !html3.trim()) {
66543
66807
  return Object.keys(CLIENT_CONFIGS).map((clientId) => ({
@@ -66564,21 +66828,23 @@ function transformForAllClients(html3, framework) {
66564
66828
  }
66565
66829
  return clientIds.map((clientId) => {
66566
66830
  const config = CLIENT_CONFIGS[clientId];
66567
- const dropSource = prepareDropSource(html3, config);
66568
- if (dropSource !== html3) {
66569
- const own = downlevelCSS(dropSource);
66570
- const result2 = applyTransformDom(load(own), own, config, framework);
66571
- result2.warnings.unshift(...dropWarnings(html3, config, clientId, framework));
66572
- return result2;
66573
- }
66574
66831
  const wordEngine = isWordEngineClient(clientId) && hasOutlookBranch;
66575
66832
  const ownSource = isWordEngineClient(clientId) && ownWordSource;
66576
- const source = ownSource ? outlookSource : downleveled;
66577
- const parsedDom = ownSource ? outlookDom : baseDom;
66578
- const clientDom = lastClientForSource.get(parsedDom) === clientId ? parsedDom : load(parsedDom.root().clone().toArray()[0]);
66579
- const result = applyTransformDom(clientDom, source, CLIENT_CONFIGS[clientId], framework);
66833
+ const raw = ownSource ? wordRaw : html3;
66834
+ const dropSource = prepareDropSource(raw, config);
66835
+ let result;
66836
+ if (dropSource !== raw) {
66837
+ const own = downlevelCSS(dropSource);
66838
+ result = applyTransformDom(load(own), own, config, framework);
66839
+ result.warnings.unshift(...dropWarnings(raw, config, clientId, framework));
66840
+ } else {
66841
+ const source = ownSource ? outlookSource : downleveled;
66842
+ const parsedDom = ownSource ? outlookDom : baseDom;
66843
+ const clientDom = lastClientForSource.get(parsedDom) === clientId ? parsedDom : load(parsedDom.root().clone().toArray()[0]);
66844
+ result = applyTransformDom(clientDom, source, config, framework);
66845
+ }
66580
66846
  if (wordEngine) result.html = vmlToCss(result.html);
66581
- if (isWordEngineClient(clientId)) result.html = applyMsoHide(result.html);
66847
+ if (isWordEngineClient(clientId)) result.html = standardsMode(applyMsoHide(result.html));
66582
66848
  return result;
66583
66849
  });
66584
66850
  }
@@ -67784,9 +68050,9 @@ function readSheet(ast) {
67784
68050
  }
67785
68051
  if (parts.length === classes.length && classes.length === 1) {
67786
68052
  const name = classes[0].name;
67787
- const seen = (_a22 = propsByClass.get(name)) != null ? _a22 : /* @__PURE__ */ new Set();
67788
- for (const p of props) seen.add(p);
67789
- propsByClass.set(name, seen);
68053
+ const seen2 = (_a22 = propsByClass.get(name)) != null ? _a22 : /* @__PURE__ */ new Set();
68054
+ for (const p of props) seen2.add(p);
68055
+ propsByClass.set(name, seen2);
67790
68056
  }
67791
68057
  }
67792
68058
  }
@@ -67915,18 +68181,18 @@ function checkStyleSurvivalFromDom($3, source, framework) {
67915
68181
  const names = ((_a22 = $3(el2).attr("class")) != null ? _a22 : "").split(/\s+/).filter(Boolean);
67916
68182
  if (names.length < 2) return;
67917
68183
  const loc = locOfElement(el2);
67918
- const seen = /* @__PURE__ */ new Map();
68184
+ const seen2 = /* @__PURE__ */ new Map();
67919
68185
  for (const sheet of sheets) {
67920
68186
  for (const name of names) {
67921
68187
  for (const prop2 of (_b = sheet.propsByClass.get(name)) != null ? _b : []) {
67922
- const first2 = seen.get(prop2);
68188
+ const first2 = seen2.get(prop2);
67923
68189
  if (first2 && first2 !== name) {
67924
68190
  conflictExample || (conflictExample = `.${first2} and .${name} both set ${prop2}`);
67925
68191
  conflictCount++;
67926
68192
  if (loc) conflicting.push(loc);
67927
68193
  return;
67928
68194
  }
67929
- if (!first2) seen.set(prop2, name);
68195
+ if (!first2) seen2.set(prop2, name);
67930
68196
  }
67931
68197
  }
67932
68198
  if (names.some((n2) => sheet.classesWithDescendants.has(n2))) {
@@ -67987,7 +68253,7 @@ function gmailWrapperOverrides($3) {
67987
68253
  const found = { selector: "", props: [], elements: [], inherits: false };
67988
68254
  const body = $3("body").first();
67989
68255
  if (!body.length) return found;
67990
- const seen = /* @__PURE__ */ new Set();
68256
+ const seen2 = /* @__PURE__ */ new Set();
67991
68257
  const props = /* @__PURE__ */ new Set();
67992
68258
  for (const el2 of $3("style").toArray()) {
67993
68259
  let ast;
@@ -68035,8 +68301,8 @@ function gmailWrapperOverrides($3) {
68035
68301
  if (value === "inherit") found.inherits = true;
68036
68302
  hit2 = true;
68037
68303
  }
68038
- if (hit2 && !seen.has(target)) {
68039
- seen.add(target);
68304
+ if (hit2 && !seen2.has(target)) {
68305
+ seen2.add(target);
68040
68306
  found.elements.push(target);
68041
68307
  found.selector || (found.selector = text3.trim());
68042
68308
  }
@@ -68124,8 +68390,8 @@ function attr2(attrs2, name) {
68124
68390
  );
68125
68391
  return m2 ? (_a22 = m2[1]) != null ? _a22 : m2[2] : void 0;
68126
68392
  }
68127
- function add2(issues, seen, key, issue) {
68128
- const existing = seen.get(key);
68393
+ function add2(issues, seen2, key, issue) {
68394
+ const existing = seen2.get(key);
68129
68395
  if (existing) {
68130
68396
  if (!issue.loc || !existing.locs) return;
68131
68397
  if (existing.locs.some((l2) => l2.offset === issue.loc.offset)) return;
@@ -68136,32 +68402,32 @@ function add2(issues, seen, key, issue) {
68136
68402
  existing.locs.push(issue.loc);
68137
68403
  return;
68138
68404
  }
68139
- seen.set(key, issue);
68405
+ seen2.set(key, issue);
68140
68406
  issues.push(issue);
68141
68407
  }
68142
68408
  function withLoc(issue, loc) {
68143
68409
  return loc ? __spreadProps(__spreadValues({}, issue), { loc, locs: [loc] }) : issue;
68144
68410
  }
68145
68411
  var TEXT_HOSTS = /<\s*(center|v:textbox|div|p|table|h[1-6]|span|font|a)\b/i;
68146
- function checkLooseText(issues, seen, open, inner, source) {
68412
+ function checkLooseText(issues, seen2, open, inner, source) {
68147
68413
  if (TEXT_HOSTS.test(inner)) return;
68148
68414
  const text3 = inner.replace(/<!--[\s\S]*?-->/g, "").replace(/<[^>]*>/g, "").replace(/&nbsp;|\s/g, "");
68149
68415
  if (text3 === "") return;
68150
- add2(issues, seen, `loosetext:${open.name}`, withLoc({
68416
+ add2(issues, seen2, `loosetext:${open.name}`, withLoc({
68151
68417
  rule: "vml-unrendered-text",
68152
68418
  severity: "error",
68153
68419
  message: `<v:${open.name}> has label text with no element around it, which Outlook does not draw.`,
68154
68420
  detail: `Verified in Outlook Classic: the shape renders its fill and shape correctly and shows no text at all, so the reader gets a blank coloured block where the label should be. Nothing errors and the HTML fallback still reads correctly in every other client, so this ships unnoticed. Wrap the text in <center> (what the bulletproof-button pattern uses) or in <v:textbox>.`
68155
68421
  }, locAt(source, open.offset, open.length)));
68156
68422
  }
68157
- function checkFillPicture(issues, seen, open, inner, source) {
68423
+ function checkFillPicture(issues, seen2, open, inner, source) {
68158
68424
  if (/<v:imagedata\b/i.test(inner)) return;
68159
68425
  const fill = inner.match(/<v:fill\b([^>]*)>/i);
68160
68426
  if (!fill || attr2(fill[1], "src") === void 0) return;
68161
68427
  const label = inner.replace(/<!--[\s\S]*?-->/g, "").replace(/<[^>]*>/g, "").replace(/&nbsp;|\s/g, "");
68162
68428
  const picture2 = label === "";
68163
68429
  const measured = `Measured on real Outlook: 2007 and 2010 draw the picture, but 2013, 2016 and 2019 show only the fill's colour.`;
68164
- add2(issues, seen, `fillpicture:${open.name}`, withLoc(picture2 ? {
68430
+ add2(issues, seen2, `fillpicture:${open.name}`, withLoc(picture2 ? {
68165
68431
  rule: "vml-roundrect-fill-picture",
68166
68432
  severity: "error",
68167
68433
  message: `<v:roundrect> paints its picture with <v:fill src>, which Outlook 2013, 2016 and 2019 leave blank.`,
@@ -68193,7 +68459,7 @@ function ghostTags(blocks) {
68193
68459
  }
68194
68460
  return tags;
68195
68461
  }
68196
- function checkGhostTables(issues, seen, blocks, source) {
68462
+ function checkGhostTables(issues, seen2, blocks, source) {
68197
68463
  var _a22;
68198
68464
  const tags = ghostTags(blocks);
68199
68465
  if (tags.length === 0) return;
@@ -68211,7 +68477,7 @@ function checkGhostTables(issues, seen, blocks, source) {
68211
68477
  for (const [name, list] of opens) {
68212
68478
  if (!GHOST_TAGS.has(name)) continue;
68213
68479
  for (const tag of list.slice(0, 1)) {
68214
- add2(issues, seen, `ghost-open:${name}`, withLoc({
68480
+ add2(issues, seen2, `ghost-open:${name}`, withLoc({
68215
68481
  rule: "ghost-table-unbalanced",
68216
68482
  severity: "error",
68217
68483
  message: `<${name}> is opened inside an Outlook conditional comment and never closed.`,
@@ -68220,7 +68486,7 @@ function checkGhostTables(issues, seen, blocks, source) {
68220
68486
  }
68221
68487
  }
68222
68488
  for (const tag of strays.slice(0, 1)) {
68223
- add2(issues, seen, `ghost-stray:${tag.name}`, withLoc({
68489
+ add2(issues, seen2, `ghost-stray:${tag.name}`, withLoc({
68224
68490
  rule: "ghost-table-unbalanced",
68225
68491
  severity: "error",
68226
68492
  message: `Closing </${tag.name}> inside an Outlook conditional comment has no matching opening tag.`,
@@ -68234,8 +68500,8 @@ function checkVml(html3, options) {
68234
68500
  const blocks = msoBlocks(html3);
68235
68501
  const tags = vmlTags(blocks);
68236
68502
  const issues = [];
68237
- const seen = /* @__PURE__ */ new Map();
68238
- checkGhostTables(issues, seen, blocks, source);
68503
+ const seen2 = /* @__PURE__ */ new Map();
68504
+ checkGhostTables(issues, seen2, blocks, source);
68239
68505
  if (tags.length === 0) return { hasVml: false, issues };
68240
68506
  const openShapes = [];
68241
68507
  let groupDepth = 0;
@@ -68251,11 +68517,11 @@ function checkVml(html3, options) {
68251
68517
  if (idx !== -1) {
68252
68518
  const open = openShapes[idx];
68253
68519
  const inner = html3.slice(open.offset + open.length, tag.offset);
68254
- checkLooseText(issues, seen, open, inner, source);
68255
- if (name === "roundrect") checkFillPicture(issues, seen, open, inner, source);
68520
+ checkLooseText(issues, seen2, open, inner, source);
68521
+ if (name === "roundrect") checkFillPicture(issues, seen2, open, inner, source);
68256
68522
  }
68257
68523
  if (idx === -1) {
68258
- add2(issues, seen, `stray:${name}`, withLoc({
68524
+ add2(issues, seen2, `stray:${name}`, withLoc({
68259
68525
  rule: "vml-unbalanced-tag",
68260
68526
  severity: "error",
68261
68527
  message: `Closing </v:${name}> has no matching opening tag.`,
@@ -68271,7 +68537,7 @@ function checkVml(html3, options) {
68271
68537
  if (isShape) {
68272
68538
  const parent2 = openShapes[openShapes.length - 1];
68273
68539
  if (parent2 && groupDepth === 0) {
68274
- add2(issues, seen, `nested:${parent2.name}>${name}`, withLoc({
68540
+ add2(issues, seen2, `nested:${parent2.name}>${name}`, withLoc({
68275
68541
  rule: "vml-nested-shape",
68276
68542
  severity: "error",
68277
68543
  message: `<v:${name}> is nested inside <v:${parent2.name}>. Outlook does not support nesting one VML shape inside another.`,
@@ -68300,7 +68566,7 @@ function checkVml(html3, options) {
68300
68566
  if (!m2) continue;
68301
68567
  const value = m2[1].trim();
68302
68568
  if (value === "" || /^[a-z%]+$/i.test(value)) {
68303
- add2(issues, seen, `dim:${name}:${prop2}:${value}`, withLoc({
68569
+ add2(issues, seen2, `dim:${name}:${prop2}:${value}`, withLoc({
68304
68570
  rule: "vml-invalid-dimension",
68305
68571
  severity: "error",
68306
68572
  message: `<v:${name}> has an invalid ${prop2}: "${prop2}:${value}" is missing its number.`,
@@ -68315,7 +68581,7 @@ function checkVml(html3, options) {
68315
68581
  const raw = arcsize.trim();
68316
68582
  const pct = raw.endsWith("%") ? parseFloat(raw) : parseFloat(raw) * 100;
68317
68583
  if (Number.isFinite(pct) && (pct < 0 || pct > 100)) {
68318
- add2(issues, seen, `arcsize:${raw}`, withLoc({
68584
+ add2(issues, seen2, `arcsize:${raw}`, withLoc({
68319
68585
  rule: "vml-arcsize-range",
68320
68586
  severity: "warning",
68321
68587
  message: `<v:roundrect> has arcsize="${raw}", outside the valid 0%\u2013100% range.`,
@@ -68326,7 +68592,7 @@ function checkVml(html3, options) {
68326
68592
  }
68327
68593
  }
68328
68594
  for (const tag of openShapes) {
68329
- add2(issues, seen, `unclosed:${tag.name}`, withLoc({
68595
+ add2(issues, seen2, `unclosed:${tag.name}`, withLoc({
68330
68596
  rule: "vml-unbalanced-tag",
68331
68597
  severity: "error",
68332
68598
  message: `<v:${tag.name}> is never closed.`,
@@ -68334,7 +68600,7 @@ function checkVml(html3, options) {
68334
68600
  }, locAt(source, tag.offset, tag.length)));
68335
68601
  }
68336
68602
  if (/<head[\s>]/i.test(html3) && !/<o:PixelsPerInch[\s>]/i.test(html3)) {
68337
- add2(issues, seen, "ppi", withLoc({
68603
+ add2(issues, seen2, "ppi", withLoc({
68338
68604
  rule: "vml-pixels-per-inch",
68339
68605
  severity: "warning",
68340
68606
  message: `This email uses VML but does not declare <o:PixelsPerInch>96</o:PixelsPerInch>.`,
@@ -68358,6 +68624,9 @@ function applyIntent(html3, warnings, framework, parsedLiveDom) {
68358
68624
  next2 = adjustBody(live$, next2);
68359
68625
  return appendKillers(next2, html3, wordHtml, vml, framework);
68360
68626
  }
68627
+ var nonZeroPadding = (style) => [...style.matchAll(/(?:^|[^-])padding(?:-(?:top|right|bottom|left))?\s*:\s*([^;]*)/gi)].some(
68628
+ ([, value]) => !/^(?:\s*0(?:px|em|rem|%|pt)?)+\s*(?:!important)?\s*$/i.test(value)
68629
+ );
68361
68630
  var hit = (re) => (style) => re.test(style);
68362
68631
  var LAYER_TOKEN = {
68363
68632
  image: null,
@@ -68414,7 +68683,7 @@ function adjustOutlook(word$, warnings, framework) {
68414
68683
  apply(word$, wordRules, WORD, "linear-gradient", hit(/linear-gradient\s*\(/i), wordFill, "Outlook Classic drops this linear-gradient, and no v:fill covers it.", true);
68415
68684
  apply(word$, wordRules, WORD, "max-width", hit(/max-width\s*:/i), (el2, style) => maxWidthCovered(word$, el2, style), "Outlook Classic only honours max-width on a table. Wrap the element in a table with a fixed width.", true);
68416
68685
  apply(word$, wordRules, WORD, "min-width", hit(/min-width\s*:/i), (el2, style) => minWidthCovered(word$, el2, style), "Outlook Classic ignores min-width. Give the box a width, or put it in a cell with one.", true);
68417
- apply(word$, wordRules, WORD, "padding", hit(/(?:^|[^-])padding(?:-(?:top|right|bottom|left))?\s*:/i), (el2) => paddingCovered(word$, el2, true), "Outlook Classic drops this padding. Put it on a table cell, or set mso-padding-alt on one.", true);
68686
+ apply(word$, wordRules, WORD, "padding", nonZeroPadding, (el2) => paddingCovered(word$, el2, true), "Outlook Classic drops this padding. Put it on a table cell, or set mso-padding-alt on one.", true);
68418
68687
  apply(word$, wordRules, WORD, "float", hit(/float\s*:/i), never, "Outlook Classic drops this float. The MSO branch needs a table with align.", true);
68419
68688
  apply(word$, wordRules, WORD, "display:flex", hit(/display\s*:\s*(?:inline-)?flex\b/i), never, "Outlook Classic receives this flex box. The MSO branch needs a table.", true);
68420
68689
  apply(word$, wordRules, WORD, "display:grid", hit(/display\s*:\s*(?:inline-)?grid\b/i), never, "Outlook Classic receives this grid box. The MSO branch needs a table.", true);
@@ -68843,12 +69112,12 @@ function normalise(value) {
68843
69112
  }
68844
69113
  function appendKillers(warnings, html3, wordHtml, vml, framework) {
68845
69114
  const extra = [];
68846
- const seen = new Set(warnings.map((w2) => `${w2.client}:${w2.property}`));
69115
+ const seen2 = new Set(warnings.map((w2) => `${w2.client}:${w2.property}`));
68847
69116
  const push = (client, property, severity, message) => {
68848
69117
  var _a22;
68849
69118
  const key = `${client}:${property}`;
68850
- if (seen.has(key)) return;
68851
- seen.add(key);
69119
+ if (seen2.has(key)) return;
69120
+ seen2.add(key);
68852
69121
  extra.push({
68853
69122
  severity,
68854
69123
  client,
@@ -68987,11 +69256,11 @@ function applyLint(matcher, hack, policy, extra) {
68987
69256
  suggestion: "Avoid client-specific hacks in strict mode, or switch to progressive targeting policy."
68988
69257
  };
68989
69258
  }
68990
- function recordMatch(report, seen, matcher, policy, matchedText, selector) {
68991
- if (seen.has(matcher.id)) return;
69259
+ function recordMatch(report, seen2, matcher, policy, matchedText, selector) {
69260
+ if (seen2.has(matcher.id)) return;
68992
69261
  const hack = targetingHackForMatcher(matcher);
68993
69262
  if (!hack) return;
68994
- seen.add(matcher.id);
69263
+ seen2.add(matcher.id);
68995
69264
  report.detectedHacks.push({
68996
69265
  hack,
68997
69266
  foundIn: matcher.foundIn,
@@ -69001,14 +69270,14 @@ function recordMatch(report, seen, matcher, policy, matchedText, selector) {
69001
69270
  const warning = applyLint(matcher, hack, policy, { matchedText, selector });
69002
69271
  if (warning) report.warnings.push(warning);
69003
69272
  }
69004
- function scanHtmlForTargeting(html3, report, seen, policy) {
69273
+ function scanHtmlForTargeting(html3, report, seen2, policy) {
69005
69274
  for (const matcher of HTML_MATCHERS) {
69006
69275
  const match = html3.match(matcher.pattern);
69007
69276
  if (!match) continue;
69008
- recordMatch(report, seen, matcher, policy, match[0]);
69277
+ recordMatch(report, seen2, matcher, policy, match[0]);
69009
69278
  }
69010
69279
  }
69011
- function scanCssAstForTargeting(ast, report, seen, policy) {
69280
+ function scanCssAstForTargeting(ast, report, seen2, policy) {
69012
69281
  fy(ast, {
69013
69282
  visit: "Rule",
69014
69283
  enter(node) {
@@ -69017,7 +69286,7 @@ function scanCssAstForTargeting(ast, report, seen, policy) {
69017
69286
  const selectorText = hy(child).trim();
69018
69287
  for (const matcher of SELECTOR_MATCHERS) {
69019
69288
  if (matcher.pattern.test(selectorText)) {
69020
- recordMatch(report, seen, matcher, policy, selectorText, selectorText);
69289
+ recordMatch(report, seen2, matcher, policy, selectorText, selectorText);
69021
69290
  }
69022
69291
  }
69023
69292
  });
@@ -69031,13 +69300,13 @@ function scanCssAstForTargeting(ast, report, seen, policy) {
69031
69300
  const haystack = `@${node.name} ${atRulePrelude}`;
69032
69301
  for (const matcher of ATRULE_MATCHERS) {
69033
69302
  if (matcher.pattern.test(atRulePrelude) || matcher.pattern.test(haystack)) {
69034
- recordMatch(report, seen, matcher, policy, haystack);
69303
+ recordMatch(report, seen2, matcher, policy, haystack);
69035
69304
  }
69036
69305
  }
69037
69306
  }
69038
69307
  });
69039
69308
  }
69040
- function scanStyleBlocks(html3, report, seen, policy) {
69309
+ function scanStyleBlocks(html3, report, seen2, policy) {
69041
69310
  const styleRegex = /<style\b[^>]*>([\s\S]*?)<\/style>/gi;
69042
69311
  let styleMatch;
69043
69312
  while ((styleMatch = styleRegex.exec(html3)) !== null) {
@@ -69047,14 +69316,14 @@ function scanStyleBlocks(html3, report, seen, policy) {
69047
69316
  } catch (e2) {
69048
69317
  continue;
69049
69318
  }
69050
- scanCssAstForTargeting(ast, report, seen, policy);
69319
+ scanCssAstForTargeting(ast, report, seen2, policy);
69051
69320
  }
69052
69321
  }
69053
69322
  function checkTargetingHacks(html3, policy = "progressive") {
69054
69323
  const report = emptyTargetingReport();
69055
- const seen = /* @__PURE__ */ new Set();
69056
- scanHtmlForTargeting(html3, report, seen, policy);
69057
- scanStyleBlocks(html3, report, seen, policy);
69324
+ const seen2 = /* @__PURE__ */ new Set();
69325
+ scanHtmlForTargeting(html3, report, seen2, policy);
69326
+ scanStyleBlocks(html3, report, seen2, policy);
69058
69327
  return report;
69059
69328
  }
69060
69329
  var WORD_ENGINE_CLIENT = "outlook-windows-legacy";
@@ -69327,24 +69596,24 @@ function analyzeEmailFromDom($3, framework, source, targetingPolicy = "progressi
69327
69596
  if (!cssLoc) return;
69328
69597
  const loc = locInCssBlock(blockAnchor, cssLoc);
69329
69598
  if (!loc) return;
69330
- const seen = selectorLocs.get(key);
69331
- if (!seen) {
69599
+ const seen2 = selectorLocs.get(key);
69600
+ if (!seen2) {
69332
69601
  selectorLocs.set(key, { locs: [loc], scopes: [scope != null ? scope : null] });
69333
69602
  return;
69334
69603
  }
69335
- if (seen.locs.some((l2) => l2.offset === loc.offset)) return;
69336
- if (seen.locs.length >= MAX_WARNING_LOCATIONS) {
69337
- seen.truncated = true;
69604
+ if (seen2.locs.some((l2) => l2.offset === loc.offset)) return;
69605
+ if (seen2.locs.length >= MAX_WARNING_LOCATIONS) {
69606
+ seen2.truncated = true;
69338
69607
  return;
69339
69608
  }
69340
- seen.locs.push(loc);
69341
- if (seen.scopes) seen.scopes.push(scope != null ? scope : null);
69609
+ seen2.locs.push(loc);
69610
+ if (seen2.scopes) seen2.scopes.push(scope != null ? scope : null);
69342
69611
  }
69343
69612
  function recordLoc(key, cssLoc, value, scope) {
69344
69613
  const loc = locInCssBlock(blockAnchor, cssLoc);
69345
69614
  if (!loc) return;
69346
- const seen = propertyLocs.get(key);
69347
- if (!seen) {
69615
+ const seen2 = propertyLocs.get(key);
69616
+ if (!seen2) {
69348
69617
  propertyLocs.set(key, __spreadProps(__spreadValues({
69349
69618
  locs: [loc]
69350
69619
  }, value !== void 0 ? { values: [value] } : {}), {
@@ -69352,14 +69621,14 @@ function analyzeEmailFromDom($3, framework, source, targetingPolicy = "progressi
69352
69621
  }));
69353
69622
  return;
69354
69623
  }
69355
- if (seen.locs.some((l2) => l2.offset === loc.offset)) return;
69356
- if (seen.locs.length >= MAX_WARNING_LOCATIONS) {
69357
- seen.truncated = true;
69624
+ if (seen2.locs.some((l2) => l2.offset === loc.offset)) return;
69625
+ if (seen2.locs.length >= MAX_WARNING_LOCATIONS) {
69626
+ seen2.truncated = true;
69358
69627
  return;
69359
69628
  }
69360
- seen.locs.push(loc);
69361
- if (seen.values && value !== void 0) seen.values.push(value);
69362
- if (seen.scopes) seen.scopes.push(scope != null ? scope : null);
69629
+ seen2.locs.push(loc);
69630
+ if (seen2.values && value !== void 0) seen2.values.push(value);
69631
+ if (seen2.scopes) seen2.scopes.push(scope != null ? scope : null);
69363
69632
  }
69364
69633
  $3("style").each((_3, el2) => {
69365
69634
  const cssText = $3(el2).text();
@@ -70179,11 +70448,11 @@ function truncateWarnings(warnings, html3, maxTokens, scope, selectedClientId) {
70179
70448
  return { warnings, truncated: false, removed: 0 };
70180
70449
  }
70181
70450
  let result = [...warnings];
70182
- const seen = /* @__PURE__ */ new Set();
70451
+ const seen2 = /* @__PURE__ */ new Set();
70183
70452
  result = result.filter((w2) => {
70184
70453
  const key = `${w2.property}:${w2.severity}`;
70185
- if (seen.has(key)) return false;
70186
- seen.add(key);
70454
+ if (seen2.has(key)) return false;
70455
+ seen2.add(key);
70187
70456
  return true;
70188
70457
  });
70189
70458
  if (estimateFits(result, html3, maxTokens)) {
@@ -70546,7 +70815,7 @@ function checkHiddenText($3) {
70546
70815
  }
70547
70816
  function checkUrlShorteners($3) {
70548
70817
  const issues = [];
70549
- const seen = /* @__PURE__ */ new Set();
70818
+ const seen2 = /* @__PURE__ */ new Set();
70550
70819
  $3("a[href]").each((_3, el2) => {
70551
70820
  const href = $3(el2).attr("href") || "";
70552
70821
  let hostname;
@@ -70556,8 +70825,8 @@ function checkUrlShorteners($3) {
70556
70825
  return;
70557
70826
  }
70558
70827
  for (const shortener of URL_SHORTENERS) {
70559
- if ((hostname === shortener || hostname.endsWith("." + shortener)) && !seen.has(shortener)) {
70560
- seen.add(shortener);
70828
+ if ((hostname === shortener || hostname.endsWith("." + shortener)) && !seen2.has(shortener)) {
70829
+ seen2.add(shortener);
70561
70830
  issues.push({
70562
70831
  rule: "url-shortener",
70563
70832
  severity: "warning",
@@ -71237,7 +71506,7 @@ function computeCascade($3, ctx) {
71237
71506
  });
71238
71507
  if (!decls.length) return;
71239
71508
  for (const selector of splitTopLevel(selectorList).map((x2) => x2.trim()).filter(Boolean)) {
71240
- const specificity2 = specificityOf(selector);
71509
+ const specificity3 = specificityOf(selector);
71241
71510
  let matched;
71242
71511
  try {
71243
71512
  matched = $3(selector).toArray();
@@ -71249,7 +71518,7 @@ function computeCascade($3, ctx) {
71249
71518
  record(el2, d.prop, __spreadProps(__spreadValues({}, d), {
71250
71519
  inline: false,
71251
71520
  presentational: false,
71252
- specificity: specificity2,
71521
+ specificity: specificity3,
71253
71522
  order: order++
71254
71523
  }));
71255
71524
  }
@@ -71563,10 +71832,10 @@ function lowContrastOnly(issues) {
71563
71832
  return issues.filter((i2) => i2.rule === "low-contrast");
71564
71833
  }
71565
71834
  function contrastDelta(candidates, baseline, rule, prefix, details) {
71566
- const seen = new Set(lowContrastOnly(baseline).map((i2) => i2.element));
71835
+ const seen2 = new Set(lowContrastOnly(baseline).map((i2) => i2.element));
71567
71836
  return lowContrastOnly(candidates).filter((issue) => {
71568
- if (seen.has(issue.element)) return false;
71569
- seen.add(issue.element);
71837
+ if (seen2.has(issue.element)) return false;
71838
+ seen2.add(issue.element);
71570
71839
  return true;
71571
71840
  }).map((issue) => __spreadProps(__spreadValues(__spreadValues({
71572
71841
  severity: issue.severity,
@@ -72061,15 +72330,15 @@ var ESP_SYSTEM_LINK = /unsub|opt[-_ ]?out|preference|update_profile|manage|archi
72061
72330
  function checkTemplateVariablesFromDom($3, source) {
72062
72331
  var _a22;
72063
72332
  const issues = [];
72064
- const seen = /* @__PURE__ */ new Set();
72333
+ const seen2 = /* @__PURE__ */ new Set();
72065
72334
  const textNodes = visibleTextNodes($3);
72066
72335
  const positioned = textNodes.some((n2) => n2.sourceCodeLocation);
72067
72336
  for (const node of positioned ? textNodes : []) {
72068
72337
  const data2 = (_a22 = node.data) != null ? _a22 : "";
72069
72338
  for (const { variable, label, index: index2 } of findVariables(data2)) {
72070
72339
  const key = `text:${variable}`;
72071
- if (seen.has(key)) continue;
72072
- seen.add(key);
72340
+ if (seen2.has(key)) continue;
72341
+ seen2.add(key);
72073
72342
  const loc = locInTextNode(node, index2, variable.length, source);
72074
72343
  issues.push(__spreadValues({
72075
72344
  rule: "unresolved-variable",
@@ -72086,8 +72355,8 @@ function checkTemplateVariablesFromDom($3, source) {
72086
72355
  }).join("");
72087
72356
  for (const { variable, label } of findVariables(textContent2)) {
72088
72357
  const key = `text:${variable}`;
72089
- if (seen.has(key)) continue;
72090
- seen.add(key);
72358
+ if (seen2.has(key)) continue;
72359
+ seen2.add(key);
72091
72360
  issues.push({
72092
72361
  rule: "unresolved-variable",
72093
72362
  severity: "error",
@@ -72105,8 +72374,8 @@ function checkTemplateVariablesFromDom($3, source) {
72105
72374
  if (!value) continue;
72106
72375
  for (const { variable, label } of findVariables(value)) {
72107
72376
  const key = `attr:${attr22}:${variable}`;
72108
- if (seen.has(key)) continue;
72109
- seen.add(key);
72377
+ if (seen2.has(key)) continue;
72378
+ seen2.add(key);
72110
72379
  const loc = locOfAttr(el2, attr22);
72111
72380
  const espLink = attr22 === "href" && ESP_SYSTEM_LINK.test(variable);
72112
72381
  issues.push(__spreadValues({
@@ -72137,9 +72406,9 @@ function isFluid(style) {
72137
72406
  if (maxMatch && parseInt(maxMatch[1], 10) <= EMAIL_MAX_WIDTH) return true;
72138
72407
  return false;
72139
72408
  }
72140
- function addWidthIssue(width, label, issues, seen, loc) {
72409
+ function addWidthIssue(width, label, issues, seen2, loc) {
72141
72410
  const key = `w:${label}:${width}`;
72142
- const existing = seen.get(key);
72411
+ const existing = seen2.get(key);
72143
72412
  if (existing) {
72144
72413
  addOccurrence(existing, loc);
72145
72414
  return;
@@ -72150,7 +72419,7 @@ function addWidthIssue(width, label, issues, seen, loc) {
72150
72419
  message: `${label} has a fixed width of ${width}px, wider than the ${EMAIL_MAX_WIDTH}px email frame; it will force horizontal scrolling, especially on mobile.`,
72151
72420
  detail: `Use width:100% with max-width:${EMAIL_MAX_WIDTH}px instead of a fixed width beyond the frame.`
72152
72421
  }, loc ? { loc, locs: [loc] } : {});
72153
- seen.set(key, issue);
72422
+ seen2.set(key, issue);
72154
72423
  issues.push(issue);
72155
72424
  }
72156
72425
  function locateInNodes(nodes, starts, index2, length, source) {
@@ -72185,7 +72454,7 @@ function addOccurrence(issue, loc) {
72185
72454
  function checkOverflowFromDom($3, source) {
72186
72455
  var _a22;
72187
72456
  const issues = [];
72188
- const seen = /* @__PURE__ */ new Map();
72457
+ const seen2 = /* @__PURE__ */ new Map();
72189
72458
  const tokensSeen = /* @__PURE__ */ new Set();
72190
72459
  $3("[width], [style*='width']").each((_3, el2) => {
72191
72460
  const $el = $3(el2);
@@ -72194,7 +72463,7 @@ function checkOverflowFromDom($3, source) {
72194
72463
  if (isFluid($el.attr("style") || "")) return;
72195
72464
  const tag = (el2.tagName || "element").toLowerCase();
72196
72465
  const fromStyle = /(?:^|[;\s])width\s*:\s*\d+px/i.test($el.attr("style") || "");
72197
- addWidthIssue(width, `<${tag}>`, issues, seen, locOfAttr(el2, fromStyle ? "style" : "width"));
72466
+ addWidthIssue(width, `<${tag}>`, issues, seen2, locOfAttr(el2, fromStyle ? "style" : "width"));
72198
72467
  });
72199
72468
  $3("style").each((_3, el2) => {
72200
72469
  const cssText = $3(el2).text();
@@ -72229,7 +72498,7 @@ function checkOverflowFromDom($3, source) {
72229
72498
  });
72230
72499
  if (widthPx !== null && widthPx > EMAIL_MAX_WIDTH && !fluid) {
72231
72500
  const selector = hy(node.prelude).trim().slice(0, 40);
72232
- addWidthIssue(widthPx, selector || "rule", issues, seen, widthLoc);
72501
+ addWidthIssue(widthPx, selector || "rule", issues, seen2, widthLoc);
72233
72502
  }
72234
72503
  }
72235
72504
  });
@@ -72259,7 +72528,7 @@ function checkOverflowFromDom($3, source) {
72259
72528
  }
72260
72529
  if (!rowHasFluid && explicitCellCount >= 2 && rowFixedPx > EMAIL_MAX_WIDTH) {
72261
72530
  const key = `row:${rowFixedPx}:${explicitCellCount}`;
72262
- if (!seen.has(key)) {
72531
+ if (!seen2.has(key)) {
72263
72532
  const loc = locOfElement(trEl) || locOfElement(tableEl);
72264
72533
  const issue = __spreadValues({
72265
72534
  rule: "table-row-overflow",
@@ -72267,7 +72536,7 @@ function checkOverflowFromDom($3, source) {
72267
72536
  message: `Table row has ${explicitCellCount} columns totaling ${rowFixedPx}px, wider than the ${EMAIL_MAX_WIDTH}px email frame; it will force horizontal scrolling on mobile.`,
72268
72537
  detail: `Make columns fluid with percentage widths (e.g. width:50%) or stack columns vertically on small screens.`
72269
72538
  }, loc ? { loc, locs: [loc] } : {});
72270
- seen.set(key, issue);
72539
+ seen2.set(key, issue);
72271
72540
  issues.push(issue);
72272
72541
  }
72273
72542
  }
@@ -72284,7 +72553,7 @@ function checkOverflowFromDom($3, source) {
72284
72553
  const parentWidth = fixedPxWidth($parent);
72285
72554
  if (parentWidth !== null && parentWidth > 0 && imgWidth > parentWidth) {
72286
72555
  const key = `img-overflow:${imgWidth}:${parentWidth}`;
72287
- if (!seen.has(key)) {
72556
+ if (!seen2.has(key)) {
72288
72557
  const loc = locOfAttr(imgEl, "width") || locOfElement(imgEl);
72289
72558
  const issue = __spreadValues({
72290
72559
  rule: "image-container-overflow",
@@ -72292,7 +72561,7 @@ function checkOverflowFromDom($3, source) {
72292
72561
  message: `<img> has fixed width ${imgWidth}px exceeding its container's width (${parentWidth}px); it will blow out the layout.`,
72293
72562
  detail: `Set width:100% with max-width:${imgWidth}px or reduce the image width to fit within ${parentWidth}px.`
72294
72563
  }, loc ? { loc, locs: [loc] } : {});
72295
- seen.set(key, issue);
72564
+ seen2.set(key, issue);
72296
72565
  issues.push(issue);
72297
72566
  }
72298
72567
  }
@@ -72407,7 +72676,7 @@ function addOccurrence2(issue, loc) {
72407
72676
  }
72408
72677
  issue.locs.push(loc);
72409
72678
  }
72410
- function inspectDeclarations(style, issues, seen, locs) {
72679
+ function inspectDeclarations(style, issues, seen2, locs) {
72411
72680
  var _a22, _b, _c2;
72412
72681
  const combined = `${(_a22 = style.get("background-image")) != null ? _a22 : ""} ${(_b = style.get("background")) != null ? _b : ""}`;
72413
72682
  const isGradient = GRADIENT_RE.test(combined);
@@ -72417,7 +72686,7 @@ function inspectDeclarations(style, issues, seen, locs) {
72417
72686
  const fix = stop ? `background-color: ${stop};` : `background-color: <solid colour matching the image>;`;
72418
72687
  const key = `bg:${fix}`;
72419
72688
  const loc = (_c2 = locs == null ? void 0 : locs.get("background-image")) != null ? _c2 : locs == null ? void 0 : locs.get("background");
72420
- const existing = seen.get(key);
72689
+ const existing = seen2.get(key);
72421
72690
  if (existing) {
72422
72691
  addOccurrence2(existing, loc);
72423
72692
  } else {
@@ -72428,7 +72697,7 @@ function inspectDeclarations(style, issues, seen, locs) {
72428
72697
  detail: isGradient ? `Add a solid fallback beneath the gradient using its first colour stop.` : `Add a solid background-color so the area still has colour when the image is dropped.`,
72429
72698
  fix
72430
72699
  }, loc ? { loc, locs: [loc] } : {});
72431
- seen.set(key, issue);
72700
+ seen2.set(key, issue);
72432
72701
  issues.push(issue);
72433
72702
  }
72434
72703
  }
@@ -72437,7 +72706,7 @@ function inspectDeclarations(style, issues, seen, locs) {
72437
72706
  const fix = `font-family: ${font.trim()}, Arial, sans-serif;`;
72438
72707
  const key = `font:${font.trim().toLowerCase()}`;
72439
72708
  const loc = locs == null ? void 0 : locs.get("font-family");
72440
- const existing = seen.get(key);
72709
+ const existing = seen2.get(key);
72441
72710
  if (existing) {
72442
72711
  addOccurrence2(existing, loc);
72443
72712
  } else {
@@ -72448,7 +72717,7 @@ function inspectDeclarations(style, issues, seen, locs) {
72448
72717
  detail: `End the stack with a web-safe font and a generic family.`,
72449
72718
  fix
72450
72719
  }, loc ? { loc, locs: [loc] } : {});
72451
- seen.set(key, issue);
72720
+ seen2.set(key, issue);
72452
72721
  issues.push(issue);
72453
72722
  }
72454
72723
  }
@@ -72464,12 +72733,12 @@ function ruleToMap(node) {
72464
72733
  }
72465
72734
  function checkVisualFromDom($3, source) {
72466
72735
  const issues = [];
72467
- const seen = /* @__PURE__ */ new Map();
72736
+ const seen2 = /* @__PURE__ */ new Map();
72468
72737
  $3("[style]").each((_3, el2) => {
72469
72738
  const attrLoc = locOfAttr(el2, "style");
72470
72739
  const style = parseInlineStyle($3(el2).attr("style") || "");
72471
72740
  const locs = attrLoc ? new Map([...style.keys()].map((prop2) => [prop2, attrLoc])) : void 0;
72472
- inspectDeclarations(style, issues, seen, locs);
72741
+ inspectDeclarations(style, issues, seen2, locs);
72473
72742
  });
72474
72743
  $3("style").each((_3, el2) => {
72475
72744
  const cssText = $3(el2).text();
@@ -72490,7 +72759,7 @@ function checkVisualFromDom($3, source) {
72490
72759
  const loc = locInCssBlock(anchor, child.loc);
72491
72760
  if (loc) locs.set(child.property.toLowerCase(), loc);
72492
72761
  });
72493
- inspectDeclarations(ruleToMap(node), issues, seen, locs);
72762
+ inspectDeclarations(ruleToMap(node), issues, seen2, locs);
72494
72763
  }
72495
72764
  });
72496
72765
  });
@@ -72597,13 +72866,13 @@ function driftClusters(values) {
72597
72866
  return clusters;
72598
72867
  }
72599
72868
  function distinctValues(values, normalise2) {
72600
- const seen = /* @__PURE__ */ new Map();
72869
+ const seen2 = /* @__PURE__ */ new Map();
72601
72870
  for (const raw of values) {
72602
72871
  const key = normalise2(raw);
72603
72872
  if (!key) continue;
72604
- if (!seen.has(key)) seen.set(key, raw.trim());
72873
+ if (!seen2.has(key)) seen2.set(key, raw.trim());
72605
72874
  }
72606
- return [...seen.values()];
72875
+ return [...seen2.values()];
72607
72876
  }
72608
72877
  function checkDesignConsistencyFromDom($3) {
72609
72878
  const found = collect($3);
@@ -72681,10 +72950,10 @@ var EMPTY_AUDIT = {
72681
72950
  design: EMPTY_DESIGN
72682
72951
  };
72683
72952
  function dedupeByElement(issues) {
72684
- const seen = /* @__PURE__ */ new Set();
72953
+ const seen2 = /* @__PURE__ */ new Set();
72685
72954
  return issues.filter((issue) => {
72686
- if (seen.has(issue.element)) return false;
72687
- seen.add(issue.element);
72955
+ if (seen2.has(issue.element)) return false;
72956
+ seen2.add(issue.element);
72688
72957
  return true;
72689
72958
  });
72690
72959
  }
@@ -72762,7 +73031,10 @@ function parseProjectConfig(source, from) {
72762
73031
  const { rules, invalid } = parseRules(body.rules);
72763
73032
  if (Object.keys(rules).length) config.rules = rules;
72764
73033
  config.invalid = invalid;
72765
- return config.skip || config.rules || invalid.length ? config : void 0;
73034
+ const emailType = body.emailType;
73035
+ if (emailType === "marketing" || emailType === "transactional") config.emailType = emailType;
73036
+ else if (emailType !== void 0) config.invalid.push(`emailType: ${JSON.stringify(emailType)}`);
73037
+ return config.skip || config.rules || config.emailType || config.invalid.length ? config : void 0;
72766
73038
  }
72767
73039
  function loadProjectConfig(from = process.cwd()) {
72768
73040
  const root2 = parse6(from).root;
@@ -72809,7 +73081,7 @@ async function compile4(source, format) {
72809
73081
  case "html":
72810
73082
  return source;
72811
73083
  case "jsx": {
72812
- const { compileReactEmail: compileReactEmail2 } = await import("./react-email-4EWH2SB4-CUKHMPBB.js");
73084
+ const { compileReactEmail: compileReactEmail2 } = await import("./react-email-QQA75STN-LT3O7SQP.js");
72813
73085
  return compileReactEmail2(source);
72814
73086
  }
72815
73087
  case "mjml": {
@@ -72850,7 +73122,7 @@ async function readInput(pathOrStdin) {
72850
73122
  return readFileSync2("/dev/stdin", "utf-8");
72851
73123
  } catch {
72852
73124
  }
72853
- return new Promise((resolve2, reject) => {
73125
+ return new Promise((resolve3, reject) => {
72854
73126
  const chunks = [];
72855
73127
  process.stdin.resume();
72856
73128
  process.stdin.on("data", (chunk) => chunks.push(Buffer.from(chunk)));
@@ -72859,7 +73131,7 @@ async function readInput(pathOrStdin) {
72859
73131
  if (!data2.trim()) {
72860
73132
  reject(new Error("No input received from stdin. Pipe HTML or provide a file path."));
72861
73133
  } else {
72862
- resolve2(data2);
73134
+ resolve3(data2);
72863
73135
  }
72864
73136
  });
72865
73137
  process.stdin.on("error", () => {
@@ -72925,8 +73197,164 @@ function parseTargetingPolicy(raw) {
72925
73197
  }
72926
73198
 
72927
73199
  // src/commands/lint.ts
72928
- import { readdir } from "fs/promises";
72929
- import { resolve, relative } from "path";
73200
+ import { readdir, stat } from "fs/promises";
73201
+
73202
+ // src/react-email.ts
73203
+ import { createRequire } from "module";
73204
+ import { existsSync as existsSync2, mkdtempSync, readdirSync, rmSync, statSync } from "fs";
73205
+ import { tmpdir } from "os";
73206
+ import { dirname as dirname2, join as join2, resolve } from "path";
73207
+ var TEMPLATE = /\.(tsx|jsx)$/;
73208
+ var skipDir = (name) => name.startsWith("_") || name.startsWith(".") || name === "node_modules" || name === "static";
73209
+ function findTemplates(dir) {
73210
+ const out = [];
73211
+ for (const e2 of readdirSync(dir, { withFileTypes: true })) {
73212
+ if (e2.isDirectory()) {
73213
+ if (!skipDir(e2.name)) out.push(...findTemplates(join2(dir, e2.name)));
73214
+ } else if (TEMPLATE.test(e2.name)) {
73215
+ out.push(join2(dir, e2.name));
73216
+ }
73217
+ }
73218
+ return out.sort();
73219
+ }
73220
+ var EMAIL_DIRS = ["emails", "src/emails", "react-email/emails", "src/react-email/emails"];
73221
+ function findEmailsDir(cwd = process.cwd()) {
73222
+ for (const d of EMAIL_DIRS) {
73223
+ const p = resolve(cwd, d);
73224
+ if (existsSync2(p) && statSync(p).isDirectory()) return p;
73225
+ }
73226
+ return null;
73227
+ }
73228
+ function projectEsbuild(file) {
73229
+ const req = createRequire(file);
73230
+ for (const from of [file, "react-email/package.json"]) {
73231
+ try {
73232
+ const base = from === file ? req : createRequire(req.resolve(from));
73233
+ return base("esbuild");
73234
+ } catch {
73235
+ }
73236
+ }
73237
+ return null;
73238
+ }
73239
+ function renderModule(file) {
73240
+ const req = createRequire(file);
73241
+ try {
73242
+ const { version } = req("react-email/package.json");
73243
+ if (Number.parseInt(version, 10) >= 6) return "react-email";
73244
+ } catch {
73245
+ }
73246
+ for (const m2 of ["@react-email/render", "@react-email/components"]) {
73247
+ try {
73248
+ req.resolve(m2);
73249
+ return m2;
73250
+ } catch {
73251
+ }
73252
+ }
73253
+ return null;
73254
+ }
73255
+ function canRenderNatively(file) {
73256
+ return projectEsbuild(file) !== null && renderModule(file) !== null;
73257
+ }
73258
+ var TemplateError = class extends Error {
73259
+ constructor(file, reason) {
73260
+ super(`${file}: ${reason}`);
73261
+ this.file = file;
73262
+ this.reason = reason;
73263
+ }
73264
+ };
73265
+ async function renderTemplate(file) {
73266
+ const esbuild = projectEsbuild(file);
73267
+ const render3 = renderModule(file);
73268
+ if (!esbuild || !render3) throw new TemplateError(file, "esbuild and @react-email/render must be installed in the project");
73269
+ const entry = `
73270
+ import * as mod from ${JSON.stringify(resolve(file))};
73271
+ import { render } from ${JSON.stringify(render3)};
73272
+ import { createElement } from "react";
73273
+ const Email = mod.default;
73274
+ // ponytail: React's server renderer logs a component's error and still
73275
+ // resolves, with fallback HTML. The logged Error is the only trace, so it
73276
+ // is caught here and rethrown; other console.error output passes through.
73277
+ module.exports = typeof Email === "function"
73278
+ ? async () => {
73279
+ let caught;
73280
+ const log = console.error;
73281
+ console.error = (...a) => {
73282
+ const e = a.find((x) => x instanceof Error);
73283
+ if (e) caught ??= e;
73284
+ else log(...a);
73285
+ };
73286
+ try {
73287
+ const html = await render(createElement(Email, Email.PreviewProps ?? {}));
73288
+ if (caught) throw caught;
73289
+ return html;
73290
+ } finally {
73291
+ console.error = log;
73292
+ }
73293
+ }
73294
+ : null;
73295
+ `;
73296
+ const tmp = mkdtempSync(join2(tmpdir(), "emailens-re-"));
73297
+ const out = join2(tmp, "email.cjs");
73298
+ try {
73299
+ try {
73300
+ await esbuild.build({
73301
+ stdin: { contents: entry, resolveDir: dirname2(resolve(file)), loader: "tsx", sourcefile: "emailens-entry.tsx" },
73302
+ bundle: true,
73303
+ platform: "node",
73304
+ format: "cjs",
73305
+ outfile: out,
73306
+ // A Next.js tsconfig says "preserve", which would leave JSX untouched.
73307
+ jsx: "automatic",
73308
+ loader: { ".css": "empty", ".png": "dataurl", ".jpg": "dataurl", ".svg": "dataurl", ".gif": "dataurl" },
73309
+ define: { "process.env.NODE_ENV": '"production"' },
73310
+ logLevel: "silent"
73311
+ });
73312
+ } catch (err) {
73313
+ const e2 = err;
73314
+ throw new TemplateError(file, e2.errors?.[0]?.text ?? err.message);
73315
+ }
73316
+ const run = createRequire(out)(out);
73317
+ if (!run) return null;
73318
+ try {
73319
+ return await run();
73320
+ } catch (err) {
73321
+ throw new TemplateError(file, err.message);
73322
+ }
73323
+ } finally {
73324
+ rmSync(tmp, { recursive: true, force: true });
73325
+ }
73326
+ }
73327
+
73328
+ // src/gate.ts
73329
+ var API_URL = () => process.env.EMAILENS_API_URL ?? "https://app.emailens.dev";
73330
+ var describe = (f3) => {
73331
+ if (f3.check === "worse-than-baseline") return "worse than the last version that passed";
73332
+ if (f3.check === "threshold") return `${f3.clientId} scores ${f3.score}, below ${f3.threshold}`;
73333
+ if (f3.check === "client-errors") return `${f3.clientId} has errors`;
73334
+ return `${f3.family}: ${f3.check}`;
73335
+ };
73336
+ async function gateEmail(html3, ref, apiKey, fetchImpl = fetch) {
73337
+ const fail = (summary) => ({ ref, passed: false, summary });
73338
+ let res;
73339
+ try {
73340
+ res = await fetchImpl(`${API_URL()}/api/gate`, {
73341
+ method: "POST",
73342
+ headers: { Authorization: `Bearer ${apiKey}`, "Content-Type": "application/json" },
73343
+ body: JSON.stringify({ html: html3, ref })
73344
+ });
73345
+ } catch (e2) {
73346
+ return fail(`could not reach Emailens: ${e2.message}`);
73347
+ }
73348
+ const body = await res.json().catch(() => ({}));
73349
+ if (res.status === 401) return fail("invalid or revoked API key (EMAILENS_API_KEY)");
73350
+ if (res.status === 403) return fail("the gate needs an API key on the Pro plan");
73351
+ if (!res.ok) return fail(body.error ?? `Emailens answered ${res.status}`);
73352
+ if (body.passed) return { ref, passed: true, summary: "passed" };
73353
+ return fail((body.failures ?? []).map(describe).join("; ") || "failed");
73354
+ }
73355
+
73356
+ // src/commands/lint.ts
73357
+ import { resolve as resolve2, relative } from "path";
72930
73358
  var VALID_SKIPS = /* @__PURE__ */ new Set([
72931
73359
  "spam",
72932
73360
  "links",
@@ -72986,6 +73414,15 @@ var lint_default = defineCommand({
72986
73414
  type: "string",
72987
73415
  description: "Also print findings as GitHub Actions annotations, on the lines of the pull request: github"
72988
73416
  },
73417
+ "email-type": {
73418
+ type: "string",
73419
+ description: "transactional: sign-in, receipts and alerts need no unsubscribe link (default: emailType in .emailensrc)"
73420
+ },
73421
+ gate: {
73422
+ type: "boolean",
73423
+ description: "Also run each email through the pre-send gate (Pro): fails on a regression against the last version that passed. Needs EMAILENS_API_KEY"
73424
+ },
73425
+ "api-key": { type: "string", description: "API key for --gate (default: EMAILENS_API_KEY)" },
72989
73426
  quiet: {
72990
73427
  type: "boolean",
72991
73428
  alias: "q",
@@ -73039,16 +73476,41 @@ var lint_default = defineCommand({
73039
73476
  process.exit(1);
73040
73477
  }
73041
73478
  const results = [];
73479
+ let renderFailures = 0;
73042
73480
  let totalErrors = 0;
73043
73481
  let totalWarnings = 0;
73482
+ const gateKey = args.gate ? args["api-key"] ?? process.env.EMAILENS_API_KEY : void 0;
73483
+ if (args.gate && !gateKey) {
73484
+ throw new Error("--gate needs an API key on the Pro plan: set EMAILENS_API_KEY (or pass --api-key). Keys are at app.emailens.dev/dashboard/api.");
73485
+ }
73486
+ const gates = [];
73487
+ const emailTypeArg = args["email-type"];
73488
+ if (emailTypeArg !== void 0 && emailTypeArg !== "marketing" && emailTypeArg !== "transactional") {
73489
+ throw new Error(`--email-type must be marketing or transactional, got: ${emailTypeArg}`);
73490
+ }
73491
+ const emailType = emailTypeArg ?? project?.emailType;
73044
73492
  for (const file of files) {
73045
73493
  const source = await readInput(file);
73046
73494
  const format = resolveFormat(args.format, file, source);
73047
- const html3 = await compile4(source, format);
73495
+ let html3;
73496
+ if (format === "jsx" && !args.format && file !== "-" && canRenderNatively(file)) {
73497
+ try {
73498
+ html3 = await renderTemplate(file);
73499
+ } catch (err) {
73500
+ if (!(err instanceof TemplateError)) throw err;
73501
+ console.error(`${import_picocolors.default.red("error")} ${relative(process.cwd(), err.file)}: ${err.reason}`);
73502
+ renderFailures++;
73503
+ continue;
73504
+ }
73505
+ if (html3 === null) continue;
73506
+ } else {
73507
+ html3 = await compile4(source, format);
73508
+ }
73048
73509
  const framework = toFramework(format);
73049
73510
  const positions = positionsApply(format);
73050
73511
  const targetingPolicy = parseTargetingPolicy(args.targetingPolicy);
73051
73512
  const report = auditEmail(html3, {
73513
+ spam: emailType ? { emailType } : void 0,
73052
73514
  framework,
73053
73515
  skip,
73054
73516
  positions,
@@ -73060,12 +73522,15 @@ var lint_default = defineCommand({
73060
73522
  results.push({ file: relative(process.cwd(), file), issues, errors: errors2, warnings });
73061
73523
  totalErrors += errors2;
73062
73524
  totalWarnings += warnings;
73525
+ if (gateKey) gates.push(await gateEmail(html3, relative(process.cwd(), file).split("\\").join("/"), gateKey));
73063
73526
  }
73527
+ totalErrors += renderFailures;
73528
+ const gateFailures = gates.filter((g3) => !g3.passed).length;
73064
73529
  if (args.reporter === "github") {
73065
73530
  for (const line of githubAnnotations(results, { info: args.info })) console.log(line);
73066
73531
  }
73067
73532
  if (args.json) {
73068
- console.log(JSON.stringify({ files: results, totalErrors, totalWarnings }));
73533
+ console.log(JSON.stringify({ files: results, totalErrors, totalWarnings, ...gateKey ? { gate: gates } : {} }));
73069
73534
  } else {
73070
73535
  for (const result of results) {
73071
73536
  console.log(import_picocolors.default.underline(result.file));
@@ -73090,16 +73555,22 @@ var lint_default = defineCommand({
73090
73555
  console.log();
73091
73556
  }
73092
73557
  const summary = [
73093
- `${files.length} file${files.length === 1 ? "" : "s"}`,
73558
+ `${results.length} file${results.length === 1 ? "" : "s"}`,
73094
73559
  totalErrors > 0 ? import_picocolors.default.red(`${totalErrors} error${totalErrors === 1 ? "" : "s"}`) : null,
73095
73560
  totalWarnings > 0 ? import_picocolors.default.yellow(`${totalWarnings} warning${totalWarnings === 1 ? "" : "s"}`) : null,
73096
- totalErrors === 0 && totalWarnings === 0 ? import_picocolors.default.green("all clean") : null
73561
+ totalErrors === 0 && totalWarnings === 0 ? import_picocolors.default.green("all clean") : null,
73562
+ gateKey ? gateFailures > 0 ? import_picocolors.default.red(`gate failed on ${gateFailures}`) : import_picocolors.default.green(`gate passed on ${gates.length}`) : null
73097
73563
  ].filter(Boolean).join(" | ");
73564
+ for (const g3 of gates) if (!g3.passed) console.log(`${import_picocolors.default.red("gate")} ${g3.ref} ${g3.summary}`);
73098
73565
  console.log(summary);
73566
+ if (results.some((r2) => r2.issues.some((i2) => i2.message.includes("(/static/")))) console.log(import_picocolors.default.dim(STATIC_HINT));
73567
+ if (!emailType && results.some((r2) => r2.issues.some((i2) => i2.rule === "missing-unsubscribe" && i2.severity !== "info"))) {
73568
+ console.log(import_picocolors.default.dim(TRANSACTIONAL_HINT));
73569
+ }
73099
73570
  }
73100
73571
  let exitCode = 0;
73101
73572
  let reason = null;
73102
- if (totalErrors > 0) {
73573
+ if (totalErrors > 0 || gateFailures > 0) {
73103
73574
  exitCode = 1;
73104
73575
  } else if (args.failOnWarning && totalWarnings > 0) {
73105
73576
  exitCode = 2;
@@ -73127,6 +73598,8 @@ Exceeded max warnings: ${totalWarnings} > ${maxWarnings}`);
73127
73598
  }
73128
73599
  });
73129
73600
  var HOSTED_HINT = "See it rendered in Gmail, Outlook and Apple Mail, no signup: https://app.emailens.dev/try?utm_source=cli&utm_medium=lint";
73601
+ var STATIC_HINT = "/static/ images load only in React Email's preview server. Set the base URL your templates use for images to a public address before you send.";
73602
+ var TRANSACTIONAL_HINT = 'Sign-in, receipt and alert emails need no unsubscribe link: pass --email-type transactional, or set "emailType": "transactional" in .emailensrc.';
73130
73603
  function failureHint(exitCode, options = {}) {
73131
73604
  if (exitCode === 0 || options.quiet) return null;
73132
73605
  return HOSTED_HINT;
@@ -73138,7 +73611,7 @@ function githubAnnotations(results, options = {}) {
73138
73611
  const prop2 = (s2) => data2(s2).replace(/:/g, "%3A").replace(/,/g, "%2C");
73139
73612
  const lines = [];
73140
73613
  for (const result of results) {
73141
- const file = relative(root2, resolve(result.file)).split("\\").join("/");
73614
+ const file = relative(root2, resolve2(result.file)).split("\\").join("/");
73142
73615
  for (const issue of result.issues) {
73143
73616
  if (issue.severity === "info" && !options.info) continue;
73144
73617
  const loc = issue.loc ?? issue.locs?.[0];
@@ -73152,7 +73625,9 @@ function githubAnnotations(results, options = {}) {
73152
73625
  }
73153
73626
  async function resolveGlob(pattern) {
73154
73627
  if (!pattern.includes("*")) {
73155
- return [resolve(pattern)];
73628
+ const path = resolve2(pattern);
73629
+ const isDir = await stat(path).then((s2) => s2.isDirectory(), () => false);
73630
+ return isDir ? findTemplates(path) : [path];
73156
73631
  }
73157
73632
  if (pattern.includes("**")) {
73158
73633
  throw new Error("Recursive glob (**) is not supported. Use a single-level wildcard (e.g., src/*.html) or list files explicitly.");
@@ -73161,8 +73636,8 @@ async function resolveGlob(pattern) {
73161
73636
  const dir = lastSep >= 0 ? pattern.slice(0, lastSep) : ".";
73162
73637
  const glob = lastSep >= 0 ? pattern.slice(lastSep + 1) : pattern;
73163
73638
  const regex2 = new RegExp("^" + glob.replace(/\*/g, ".*") + "$");
73164
- const entries = await readdir(resolve(dir), { withFileTypes: true });
73165
- return entries.filter((e2) => e2.isFile() && regex2.test(e2.name)).map((e2) => resolve(dir, e2.name)).sort();
73639
+ const entries = await readdir(resolve2(dir), { withFileTypes: true });
73640
+ return entries.filter((e2) => e2.isFile() && regex2.test(e2.name)).map((e2) => resolve2(dir, e2.name)).sort();
73166
73641
  }
73167
73642
  function mergeLocs(into, from) {
73168
73643
  if (!from) return false;
@@ -73431,6 +73906,8 @@ export {
73431
73906
  require_picocolors,
73432
73907
  loadProjectConfig,
73433
73908
  applySeverities,
73909
+ EMAIL_DIRS,
73910
+ findEmailsDir,
73434
73911
  lint_default,
73435
73912
  flattenToLintIssues
73436
73913
  };