@11ty/client 4.0.0-alpha.6 → 4.0.0-alpha.8

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.
@@ -1,4 +1,4 @@
1
- /*! Eleventy v4.0.0-alpha.6 (@11ty/client/liquid Engine Bundle) */
1
+ /*! Eleventy (Build Awesome) v4.0.0-alpha.8 (@11ty/client/liquid Engine Bundle) */
2
2
  var __create = Object.create;
3
3
  var __defProp = Object.defineProperty;
4
4
  var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
@@ -12,11 +12,20 @@ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require
12
12
  if (typeof require !== "undefined") return require.apply(this, arguments);
13
13
  throw Error('Dynamic require of "' + x + '" is not supported');
14
14
  });
15
- var __esm = (fn, res) => function __init() {
16
- return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
15
+ var __esm = (fn, res, err) => function __init() {
16
+ if (err) throw err[0];
17
+ try {
18
+ return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
19
+ } catch (e) {
20
+ throw err = [e], e;
21
+ }
17
22
  };
18
23
  var __commonJS = (cb, mod) => function __require2() {
19
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
24
+ try {
25
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
26
+ } catch (e) {
27
+ throw mod = 0, e;
28
+ }
20
29
  };
21
30
  var __export = (target, all) => {
22
31
  for (var name in all)
@@ -1512,10 +1521,15 @@ __export(shim_consume_fs_exports, {
1512
1521
  promises: () => promises,
1513
1522
  readFileSync: () => readFileSync2,
1514
1523
  readSync: () => readSync,
1524
+ readdir: () => readdir,
1525
+ readdirSync: () => readdirSync,
1526
+ realpath: () => realpath,
1527
+ realpathSync: () => realpathSync,
1528
+ stat: () => stat,
1515
1529
  statSync: () => statSync,
1516
1530
  writeFileSync: () => writeFileSync
1517
1531
  });
1518
- var GLOBAL_FS_NAME, fs2, mkdir, existsSync2, mkdirSync, readFileSync2, statSync, writeFileSync, promises, readSync, fstatSync, closeSync, openSync, shim_consume_fs_default;
1532
+ var GLOBAL_FS_NAME, fs2, mkdir, existsSync2, mkdirSync, readFileSync2, statSync, writeFileSync, promises, readSync, fstatSync, closeSync, openSync, readdir, readdirSync, realpath, realpathSync, stat, shim_consume_fs_default;
1519
1533
  var init_shim_consume_fs = __esm({
1520
1534
  "../../node_modules/@11ty/package-bundler/shims/shim-consume-fs.js"() {
1521
1535
  GLOBAL_FS_NAME = "eleventyFileSystem";
@@ -1537,7 +1551,13 @@ var init_shim_consume_fs = __esm({
1537
1551
  readSync: noopError,
1538
1552
  fstatSync: noopError,
1539
1553
  closeSync: noopError,
1540
- openSync: noopError
1554
+ openSync: noopError,
1555
+ // tinyglobby
1556
+ readdir: noopError,
1557
+ readdirSync: noopError,
1558
+ realpath: noopError,
1559
+ realpathSync: noopError,
1560
+ stat: noopError
1541
1561
  };
1542
1562
  }
1543
1563
  mkdir = fs2.mkdir;
@@ -1551,6 +1571,11 @@ var init_shim_consume_fs = __esm({
1551
1571
  fstatSync = fs2.fstatSync;
1552
1572
  closeSync = fs2.closeSync;
1553
1573
  openSync = fs2.openSync;
1574
+ readdir = fs2.readdir;
1575
+ readdirSync = fs2.readdirSync;
1576
+ realpath = fs2.realpath;
1577
+ realpathSync = fs2.realpathSync;
1578
+ stat = fs2.stat;
1554
1579
  shim_consume_fs_default = fs2;
1555
1580
  }
1556
1581
  });
@@ -1876,7 +1901,7 @@ var require_Buffer = __commonJS({
1876
1901
  // ../../node_modules/@11ty/eleventy-utils/src/lib-sha256.js
1877
1902
  var require_lib_sha256 = __commonJS({
1878
1903
  "../../node_modules/@11ty/eleventy-utils/src/lib-sha256.js"(exports, module) {
1879
- module.exports = /* @__PURE__ */ __name(function sha256(data) {
1904
+ module.exports = /* @__PURE__ */ __name(function sha2562(data) {
1880
1905
  let h0 = 1779033703, h1 = 3144134277, h2 = 1013904242, h3 = 2773480762, h4 = 1359893119, h5 = 2600822924, h6 = 528734635, h7 = 1541459225, tsz = 0, bp = 0;
1881
1906
  const k = [
1882
1907
  1116352408,
@@ -2050,7 +2075,7 @@ var require_HashTypes = __commonJS({
2050
2075
  "../../node_modules/@11ty/eleventy-utils/src/HashTypes.js"(exports, module) {
2051
2076
  var { base64UrlSafe } = require_Url();
2052
2077
  var { isBuffer } = require_Buffer();
2053
- var sha256 = require_lib_sha256();
2078
+ var sha2562 = require_lib_sha256();
2054
2079
  function hasNodeCryptoModule() {
2055
2080
  try {
2056
2081
  __require("node:crypto");
@@ -2165,7 +2190,7 @@ var require_HashTypes = __commonJS({
2165
2190
  __name(this, "ScriptHash");
2166
2191
  }
2167
2192
  static toHash(...content) {
2168
- let hash = sha256();
2193
+ let hash = sha2562();
2169
2194
  for (let c of content) {
2170
2195
  hash.add(c);
2171
2196
  }
@@ -2301,10 +2326,6 @@ function isIterator(val) {
2301
2326
  return val && isFunction(val.next) && isFunction(val.throw) && isFunction(val.return);
2302
2327
  }
2303
2328
  __name(isIterator, "isIterator");
2304
- function escapeRegex(str) {
2305
- return str.replace(/[-/\\^$*+?.()|[\]{}]/g, "\\$&");
2306
- }
2307
- __name(escapeRegex, "escapeRegex");
2308
2329
  function stringify(value) {
2309
2330
  value = toValue(value);
2310
2331
  if (isString(value))
@@ -2414,10 +2435,10 @@ function padEnd(str, length, ch = " ") {
2414
2435
  __name(padEnd, "padEnd");
2415
2436
  function pad(str, length, ch, add) {
2416
2437
  str = String(str);
2417
- let n = length - str.length;
2418
- while (n-- > 0)
2419
- str = add(str, ch);
2420
- return str;
2438
+ const n = length - str.length;
2439
+ if (n <= 0)
2440
+ return str;
2441
+ return add(str, ch.repeat(n));
2421
2442
  }
2422
2443
  __name(pad, "pad");
2423
2444
  function identify(val) {
@@ -2433,12 +2454,26 @@ function ellipsis(str, N) {
2433
2454
  return str.length > N ? str.slice(0, N - 3) + "..." : str;
2434
2455
  }
2435
2456
  __name(ellipsis, "ellipsis");
2457
+ function orderedCompare(a, b) {
2458
+ if (isNil(a) && isNil(b))
2459
+ return 0;
2460
+ if (isNil(a))
2461
+ return 1;
2462
+ if (isNil(b))
2463
+ return -1;
2464
+ if (a < b)
2465
+ return -1;
2466
+ if (a > b)
2467
+ return 1;
2468
+ return 0;
2469
+ }
2470
+ __name(orderedCompare, "orderedCompare");
2436
2471
  function caseInsensitiveCompare(a, b) {
2437
- if (a == null && b == null)
2472
+ if (isNil(a) && isNil(b))
2438
2473
  return 0;
2439
- if (a == null)
2474
+ if (isNil(a))
2440
2475
  return 1;
2441
- if (b == null)
2476
+ if (isNil(b))
2442
2477
  return -1;
2443
2478
  a = toLowerCase.call(a);
2444
2479
  b = toLowerCase.call(b);
@@ -2461,10 +2496,6 @@ function argumentsToNumber(fn) {
2461
2496
  };
2462
2497
  }
2463
2498
  __name(argumentsToNumber, "argumentsToNumber");
2464
- function escapeRegExp(text) {
2465
- return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&");
2466
- }
2467
- __name(escapeRegExp, "escapeRegExp");
2468
2499
  function* strictUniq(array) {
2469
2500
  const seen = /* @__PURE__ */ new Set();
2470
2501
  for (const element of array) {
@@ -2869,6 +2900,13 @@ function __awaiter(thisArg, _arguments, P, generator) {
2869
2900
  });
2870
2901
  }
2871
2902
  __name(__awaiter, "__awaiter");
2903
+ function toLiquidAsync(asyncFn, syncFn) {
2904
+ const syncImpl = syncFn || asyncFn;
2905
+ return (sync, ...args) => {
2906
+ return sync ? syncImpl(...args) : asyncFn(...args);
2907
+ };
2908
+ }
2909
+ __name(toLiquidAsync, "toLiquidAsync");
2872
2910
  function toPromise(val) {
2873
2911
  return __awaiter(this, void 0, void 0, function* () {
2874
2912
  if (!isIterator(val))
@@ -3005,8 +3043,10 @@ var formatCodes = {
3005
3043
  m: /* @__PURE__ */ __name((d) => d.getMonth() + 1, "m"),
3006
3044
  M: /* @__PURE__ */ __name((d) => d.getMinutes(), "M"),
3007
3045
  N: /* @__PURE__ */ __name((d, opts) => {
3046
+ var _a;
3008
3047
  const width = Number(opts.width) || 9;
3009
3048
  const str = String(d.getMilliseconds()).slice(0, width);
3049
+ (_a = opts.memoryLimit) === null || _a === void 0 ? void 0 : _a.use(width - str.length);
3010
3050
  return padEnd(str, width, "0");
3011
3051
  }, "N"),
3012
3052
  p: /* @__PURE__ */ __name((d) => d.getHours() < 12 ? "AM" : "PM", "p"),
@@ -3029,19 +3069,19 @@ var formatCodes = {
3029
3069
  "%": /* @__PURE__ */ __name(() => "%", "%")
3030
3070
  };
3031
3071
  formatCodes.h = formatCodes.b;
3032
- function strftime(d, formatStr) {
3072
+ function strftime(d, formatStr, memoryLimit) {
3033
3073
  let output = "";
3034
3074
  let remaining = formatStr;
3035
3075
  let match;
3036
3076
  while (match = rFormat.exec(remaining)) {
3037
3077
  output += remaining.slice(0, match.index);
3038
3078
  remaining = remaining.slice(match.index + match[0].length);
3039
- output += format(d, match);
3079
+ output += format(d, match, memoryLimit);
3040
3080
  }
3041
3081
  return output + remaining;
3042
3082
  }
3043
3083
  __name(strftime, "strftime");
3044
- function format(d, match) {
3084
+ function format(d, match, memoryLimit) {
3045
3085
  const [input, flagStr = "", width, modifier, conversion] = match;
3046
3086
  const convert = formatCodes[conversion];
3047
3087
  if (!convert)
@@ -3049,7 +3089,7 @@ function format(d, match) {
3049
3089
  const flags = {};
3050
3090
  for (const flag of flagStr)
3051
3091
  flags[flag] = true;
3052
- let ret = String(convert(d, { flags, width, modifier }));
3092
+ let ret = String(convert(d, { flags, width, modifier, memoryLimit }));
3053
3093
  let padChar = padSpaceChars.has(conversion) ? " " : "0";
3054
3094
  let padWidth = width || padWidths[conversion] || 0;
3055
3095
  if (flags["^"])
@@ -3062,6 +3102,7 @@ function format(d, match) {
3062
3102
  padChar = "0";
3063
3103
  if (flags["-"])
3064
3104
  padWidth = 0;
3105
+ memoryLimit === null || memoryLimit === void 0 ? void 0 : memoryLimit.use(Number(padWidth) - ret.length);
3065
3106
  return padStart(ret, padWidth, padChar);
3066
3107
  }
3067
3108
  __name(format, "format");
@@ -3228,13 +3269,15 @@ var Limiter = class {
3228
3269
  this.limit = limit2;
3229
3270
  }
3230
3271
  use(count) {
3231
- count = +count || 0;
3232
- assert(this.base + count <= this.limit, this.message);
3233
- this.base += count;
3272
+ if (+count > 0) {
3273
+ assert(this.base + +count <= this.limit, this.message);
3274
+ this.base += +count;
3275
+ }
3234
3276
  }
3235
3277
  check(count) {
3236
- count = +count || 0;
3237
- assert(count <= this.limit, this.message);
3278
+ if (+count > 0) {
3279
+ assert(+count <= this.limit, this.message);
3280
+ }
3238
3281
  }
3239
3282
  };
3240
3283
  var DelimitedToken = class extends Token {
@@ -3546,6 +3589,7 @@ var Render = class {
3546
3589
  if (!emitter) {
3547
3590
  emitter = ctx.opts.keepOutputType ? new KeepingTypeEmitter() : new SimpleEmitter();
3548
3591
  }
3592
+ ctx.renderLimit.check(getPerformance().now());
3549
3593
  const errors = [];
3550
3594
  for (const tpl of templates) {
3551
3595
  ctx.renderLimit.check(getPerformance().now());
@@ -3962,7 +4006,28 @@ __name(newline_to_br, "newline_to_br");
3962
4006
  function strip_html(v) {
3963
4007
  const str = stringify(v);
3964
4008
  this.context.memoryLimit.use(str.length);
3965
- return str.replace(/<script[\s\S]*?<\/script>|<style[\s\S]*?<\/style>|<.*?>|<!--[\s\S]*?-->/g, "");
4009
+ const blocks = /* @__PURE__ */ new Map([["<script", "<\/script>"], ["<style", "</style>"], ["<!--", "-->"], ["<", ">"]]);
4010
+ let out = "";
4011
+ let i = 0;
4012
+ while (i < str.length) {
4013
+ const lt = str.indexOf("<", i);
4014
+ if (lt < 0)
4015
+ return out + str.slice(i);
4016
+ out += str.slice(i, lt);
4017
+ for (const [opener, closer] of blocks) {
4018
+ if (!str.startsWith(opener, lt))
4019
+ continue;
4020
+ const e = str.indexOf(closer, lt + opener.length);
4021
+ if (e >= 0) {
4022
+ i = e + closer.length;
4023
+ break;
4024
+ }
4025
+ blocks.delete(opener);
4026
+ }
4027
+ if (i === lt)
4028
+ return out + str.slice(lt);
4029
+ }
4030
+ return out;
3966
4031
  }
3967
4032
  __name(strip_html, "strip_html");
3968
4033
  var htmlFilters = /* @__PURE__ */ Object.freeze({
@@ -4561,7 +4626,7 @@ var Tokenizer = class {
4561
4626
  }
4562
4627
  *readFileNameTemplate(options) {
4563
4628
  const { outputDelimiterLeft } = options;
4564
- const htmlStopStrings = [",", " ", outputDelimiterLeft];
4629
+ const htmlStopStrings = [",", " ", "\r", "\n", " ", outputDelimiterLeft];
4565
4630
  const htmlStopStringSet = new Set(htmlStopStrings);
4566
4631
  while (this.p < this.N && !htmlStopStringSet.has(this.peek())) {
4567
4632
  yield this.match(outputDelimiterLeft) ? this.readOutputToken(options) : this.readHTMLToken(htmlStopStrings);
@@ -5089,42 +5154,50 @@ var Loader = class {
5089
5154
  __name(this, "Loader");
5090
5155
  }
5091
5156
  constructor(options) {
5157
+ var _a, _b, _c, _d;
5092
5158
  this.options = options;
5093
5159
  if (options.relativeReference) {
5094
5160
  const sep2 = options.fs.sep;
5095
5161
  assert(sep2, "`fs.sep` is required for relative reference");
5096
- const rRelativePath = new RegExp(["." + sep2, ".." + sep2, "./", "../"].map((prefix) => escapeRegex(prefix)).join("|"));
5097
- this.shouldLoadRelative = (referencedFile) => rRelativePath.test(referencedFile);
5162
+ const prefixes = ["." + sep2, ".." + sep2, "./", "../"];
5163
+ this.shouldLoadRelative = (referencedFile) => prefixes.some((prefix) => referencedFile.startsWith(prefix));
5098
5164
  } else {
5099
5165
  this.shouldLoadRelative = (_referencedFile) => false;
5100
5166
  }
5101
- this.contains = this.options.fs.contains || (() => true);
5167
+ const fs3 = options.fs;
5168
+ this.contains = toLiquidAsync(((_a = fs3.contains) === null || _a === void 0 ? void 0 : _a.bind(fs3)) || (() => __awaiter(this, void 0, void 0, function* () {
5169
+ return true;
5170
+ })), ((_b = fs3.containsSync) === null || _b === void 0 ? void 0 : _b.bind(fs3)) || (() => true));
5171
+ this.exists = toLiquidAsync(((_c = fs3.exists) === null || _c === void 0 ? void 0 : _c.bind(fs3)) || (() => __awaiter(this, void 0, void 0, function* () {
5172
+ return false;
5173
+ })), (_d = fs3.existsSync) === null || _d === void 0 ? void 0 : _d.bind(fs3));
5102
5174
  }
5103
5175
  *lookup(file, type, sync, currentFile) {
5104
- const { fs: fs3 } = this.options;
5105
5176
  const dirs = this.options[type];
5106
- for (const filepath of this.candidates(file, dirs, currentFile, type !== LookupType.Root)) {
5107
- if (sync ? fs3.existsSync(filepath) : yield fs3.exists(filepath))
5177
+ for (const filepath of this.candidates(file, dirs, currentFile)) {
5178
+ let allowed = false;
5179
+ for (const dir of dirs) {
5180
+ if (yield this.contains(!!sync, dir, filepath)) {
5181
+ allowed = true;
5182
+ break;
5183
+ }
5184
+ }
5185
+ if (!allowed)
5186
+ continue;
5187
+ if (yield this.exists(!!sync, filepath))
5108
5188
  return filepath;
5109
5189
  }
5110
5190
  throw this.lookupError(file, dirs);
5111
5191
  }
5112
- *candidates(file, dirs, currentFile, enforceRoot) {
5192
+ *candidates(file, dirs, currentFile) {
5113
5193
  const { fs: fs3, extname } = this.options;
5114
5194
  if (this.shouldLoadRelative(file) && currentFile) {
5115
5195
  const referenced = fs3.resolve(this.dirname(currentFile), file, extname);
5116
- for (const dir of dirs) {
5117
- if (!enforceRoot || this.contains(dir, referenced)) {
5118
- yield referenced;
5119
- break;
5120
- }
5121
- }
5196
+ yield referenced;
5122
5197
  }
5123
5198
  for (const dir of dirs) {
5124
5199
  const referenced = fs3.resolve(dir, file, extname);
5125
- if (!enforceRoot || this.contains(dir, referenced)) {
5126
- yield referenced;
5127
- }
5200
+ yield referenced;
5128
5201
  }
5129
5202
  if (fs3.fallback !== void 0) {
5130
5203
  const filepath = fs3.fallback(file);
@@ -5149,12 +5222,16 @@ var Parser = class {
5149
5222
  __name(this, "Parser");
5150
5223
  }
5151
5224
  constructor(liquid) {
5225
+ var _a, _b;
5152
5226
  this.liquid = liquid;
5153
5227
  this.cache = this.liquid.options.cache;
5154
5228
  this.fs = this.liquid.options.fs;
5155
5229
  this.parseFile = this.cache ? this._parseFileCached : this._parseFile;
5156
5230
  this.loader = new Loader(this.liquid.options);
5157
5231
  this.parseLimit = new Limiter("parse length", liquid.options.parseLimit);
5232
+ this.readFile = toLiquidAsync(((_a = this.fs.readFile) === null || _a === void 0 ? void 0 : _a.bind(this.fs)) || (() => __awaiter(this, void 0, void 0, function* () {
5233
+ throw new Error("readFile not implemented");
5234
+ })), (_b = this.fs.readFileSync) === null || _b === void 0 ? void 0 : _b.bind(this.fs));
5158
5235
  }
5159
5236
  parse(html, filepath) {
5160
5237
  html = String(html);
@@ -5219,7 +5296,7 @@ var Parser = class {
5219
5296
  }
5220
5297
  *_parseFile(file, sync, type = LookupType.Root, currentFile) {
5221
5298
  const filepath = yield this.loader.lookup(file, type, sync, currentFile);
5222
- return this.parse(sync ? this.fs.readFileSync(filepath) : yield this.fs.readFile(filepath), filepath);
5299
+ return this.parse(yield this.readFile(!!sync, filepath), filepath);
5223
5300
  }
5224
5301
  };
5225
5302
  var TokenKind;
@@ -5287,13 +5364,20 @@ function getKind(val) {
5287
5364
  return val ? val.kind : -1;
5288
5365
  }
5289
5366
  __name(getKind, "getKind");
5367
+ function createScope(from) {
5368
+ const scope = /* @__PURE__ */ Object.create(null);
5369
+ if (from)
5370
+ Object.assign(scope, from);
5371
+ return scope;
5372
+ }
5373
+ __name(createScope, "createScope");
5290
5374
  var Context = class _Context {
5291
5375
  static {
5292
5376
  __name(this, "Context");
5293
5377
  }
5294
5378
  constructor(env = {}, opts = defaultOptions, renderOptions = {}, { memoryLimit, renderLimit } = {}) {
5295
5379
  var _a, _b, _c, _d, _e;
5296
- this.scopes = [{}];
5380
+ this.scopes = [createScope()];
5297
5381
  this.registers = {};
5298
5382
  this.breakCalled = false;
5299
5383
  this.continueCalled = false;
@@ -5306,8 +5390,8 @@ var Context = class _Context {
5306
5390
  this.memoryLimit = memoryLimit !== null && memoryLimit !== void 0 ? memoryLimit : new Limiter("memory alloc", (_d = renderOptions.memoryLimit) !== null && _d !== void 0 ? _d : opts.memoryLimit);
5307
5391
  this.renderLimit = renderLimit !== null && renderLimit !== void 0 ? renderLimit : new Limiter("template render", getPerformance().now() + ((_e = renderOptions.renderLimit) !== null && _e !== void 0 ? _e : opts.renderLimit));
5308
5392
  }
5309
- getRegister(key) {
5310
- return this.registers[key] = this.registers[key] || {};
5393
+ getRegister(key, defaultValue = void 0) {
5394
+ return this.registers[key] = this.registers[key] || defaultValue;
5311
5395
  }
5312
5396
  setRegister(key, value) {
5313
5397
  return this.registers[key] = value;
@@ -5364,7 +5448,8 @@ var Context = class _Context {
5364
5448
  return new _Context(scope, this.opts, {
5365
5449
  sync: this.sync,
5366
5450
  globals: this.globals,
5367
- strictVariables: this.strictVariables
5451
+ strictVariables: this.strictVariables,
5452
+ ownPropertyOnly: this.ownPropertyOnly
5368
5453
  }, {
5369
5454
  renderLimit: this.renderLimit,
5370
5455
  memoryLimit: this.memoryLimit
@@ -5447,7 +5532,8 @@ function round(v, arg = 0) {
5447
5532
  v = toNumber(v);
5448
5533
  arg = toNumber(arg);
5449
5534
  const amp = Math.pow(10, arg);
5450
- return Math.round(v * amp) / amp;
5535
+ const scaled = v * amp;
5536
+ return Math.sign(v) * Math.round(Math.abs(scaled)) / amp;
5451
5537
  }
5452
5538
  __name(round, "round");
5453
5539
  var mathFilters = /* @__PURE__ */ Object.freeze({
@@ -5514,7 +5600,7 @@ var reverse = argumentsToValue(function(v) {
5514
5600
  this.context.memoryLimit.use(array.length);
5515
5601
  return [...array].reverse();
5516
5602
  });
5517
- function* sort(arr, property) {
5603
+ function* sortBy(arr, property, comparator) {
5518
5604
  const values = [];
5519
5605
  const array = toArray(arr);
5520
5606
  this.context.memoryLimit.use(array.length);
@@ -5524,19 +5610,15 @@ function* sort(arr, property) {
5524
5610
  property ? yield this.context._getFromScope(item, stringify(property).split("."), false) : item
5525
5611
  ]);
5526
5612
  }
5527
- return values.sort((lhs, rhs) => {
5528
- const lvalue = lhs[1];
5529
- const rvalue = rhs[1];
5530
- return lvalue < rvalue ? -1 : lvalue > rvalue ? 1 : 0;
5531
- }).map((tuple) => tuple[0]);
5613
+ return values.sort((lhs, rhs) => comparator(lhs[1], rhs[1])).map((tuple) => tuple[0]);
5614
+ }
5615
+ __name(sortBy, "sortBy");
5616
+ function* sort(arr, property) {
5617
+ return yield* sortBy.call(this, arr, property, orderedCompare);
5532
5618
  }
5533
5619
  __name(sort, "sort");
5534
- function sort_natural(input, property) {
5535
- const propertyString = stringify(property);
5536
- const compare = property === void 0 ? caseInsensitiveCompare : (lhs, rhs) => caseInsensitiveCompare(lhs[propertyString], rhs[propertyString]);
5537
- const array = toArray(input);
5538
- this.context.memoryLimit.use(array.length);
5539
- return [...array].sort(compare);
5620
+ function* sort_natural(arr, property) {
5621
+ return yield* sortBy.call(this, arr, property, caseInsensitiveCompare);
5540
5622
  }
5541
5623
  __name(sort_natural, "sort_natural");
5542
5624
  var size = /* @__PURE__ */ __name((v) => v && v.length || 0, "size");
@@ -5799,15 +5881,16 @@ var arrayFilters = /* @__PURE__ */ Object.freeze({
5799
5881
  sample
5800
5882
  });
5801
5883
  function date(v, format2, timezoneOffset) {
5802
- var _a, _b, _c;
5803
- const size2 = ((_a = v === null || v === void 0 ? void 0 : v.length) !== null && _a !== void 0 ? _a : 0) + ((_b = format2 === null || format2 === void 0 ? void 0 : format2.length) !== null && _b !== void 0 ? _b : 0) + ((_c = timezoneOffset === null || timezoneOffset === void 0 ? void 0 : timezoneOffset.length) !== null && _c !== void 0 ? _c : 0);
5884
+ var _a, _b;
5885
+ const size2 = ((_a = v === null || v === void 0 ? void 0 : v.length) !== null && _a !== void 0 ? _a : 0) + ((_b = timezoneOffset === null || timezoneOffset === void 0 ? void 0 : timezoneOffset.length) !== null && _b !== void 0 ? _b : 0);
5804
5886
  this.context.memoryLimit.use(size2);
5805
5887
  const date2 = parseDate(v, this.context.opts, timezoneOffset);
5806
5888
  if (!date2)
5807
5889
  return v;
5808
5890
  format2 = toValue(format2);
5809
5891
  format2 = isNil(format2) ? this.context.opts.dateFormat : stringify(format2);
5810
- return strftime(date2, format2);
5892
+ this.context.memoryLimit.use(format2.length);
5893
+ return strftime(date2, format2, this.context.memoryLimit);
5811
5894
  }
5812
5895
  __name(date, "date");
5813
5896
  function date_to_xmlschema(v) {
@@ -5830,11 +5913,12 @@ function stringify_date(v, month_type, type, style) {
5830
5913
  const date2 = parseDate(v, this.context.opts);
5831
5914
  if (!date2)
5832
5915
  return v;
5916
+ const ml = this.context.memoryLimit;
5833
5917
  if (type === "ordinal") {
5834
5918
  const d = date2.getDate();
5835
- return style === "US" ? strftime(date2, `${month_type} ${d}%q, %Y`) : strftime(date2, `${d}%q ${month_type} %Y`);
5919
+ return style === "US" ? strftime(date2, `${month_type} ${d}%q, %Y`, ml) : strftime(date2, `${d}%q ${month_type} %Y`, ml);
5836
5920
  }
5837
- return strftime(date2, `%d ${month_type} %Y`);
5921
+ return strftime(date2, `%d ${month_type} %Y`, ml);
5838
5922
  }
5839
5923
  __name(stringify_date, "stringify_date");
5840
5924
  function parseDate(v, opts, timezoneOffset) {
@@ -5842,7 +5926,9 @@ function parseDate(v, opts, timezoneOffset) {
5842
5926
  const defaultTimezoneOffset = timezoneOffset !== null && timezoneOffset !== void 0 ? timezoneOffset : opts.timezoneOffset;
5843
5927
  const locale = opts.locale;
5844
5928
  v = toValue(v);
5845
- if (v === "now" || v === "today") {
5929
+ if (isNil(v)) {
5930
+ return void 0;
5931
+ } else if (v === "now" || v === "today") {
5846
5932
  date2 = new LiquidDate(Date.now(), locale, defaultTimezoneOffset);
5847
5933
  } else if (isNumber(v)) {
5848
5934
  date2 = new LiquidDate(v * 1e3, locale, defaultTimezoneOffset);
@@ -5890,10 +5976,15 @@ function lstrip(v, chars) {
5890
5976
  const str = stringify(v);
5891
5977
  this.context.memoryLimit.use(str.length);
5892
5978
  if (chars) {
5893
- chars = escapeRegExp(stringify(chars));
5894
- return str.replace(new RegExp(`^[${chars}]+`, "g"), "");
5979
+ chars = stringify(chars);
5980
+ this.context.memoryLimit.use(chars.length);
5981
+ for (let i = 0, set = new Set(chars); i < str.length; i++) {
5982
+ if (!set.has(str[i]))
5983
+ return str.slice(i);
5984
+ }
5985
+ return "";
5895
5986
  }
5896
- return str.replace(/^\s+/, "");
5987
+ return str.trimStart();
5897
5988
  }
5898
5989
  __name(lstrip, "lstrip");
5899
5990
  function downcase(v) {
@@ -5910,20 +6001,22 @@ function upcase(v) {
5910
6001
  __name(upcase, "upcase");
5911
6002
  function remove(v, arg) {
5912
6003
  const str = stringify(v);
5913
- this.context.memoryLimit.use(str.length);
5914
- return str.split(stringify(arg)).join("");
6004
+ arg = stringify(arg);
6005
+ this.context.memoryLimit.use(str.length + arg.length);
6006
+ return str.split(arg).join("");
5915
6007
  }
5916
6008
  __name(remove, "remove");
5917
6009
  function remove_first(v, l) {
5918
6010
  const str = stringify(v);
5919
- this.context.memoryLimit.use(str.length);
5920
- return str.replace(stringify(l), "");
6011
+ l = stringify(l);
6012
+ this.context.memoryLimit.use(str.length + l.length);
6013
+ return str.replace(l, "");
5921
6014
  }
5922
6015
  __name(remove_first, "remove_first");
5923
6016
  function remove_last(v, l) {
5924
6017
  const str = stringify(v);
5925
- this.context.memoryLimit.use(str.length);
5926
6018
  const pattern = stringify(l);
6019
+ this.context.memoryLimit.use(str.length + pattern.length);
5927
6020
  const index = str.lastIndexOf(pattern);
5928
6021
  if (index === -1)
5929
6022
  return str;
@@ -5934,10 +6027,15 @@ function rstrip(str, chars) {
5934
6027
  str = stringify(str);
5935
6028
  this.context.memoryLimit.use(str.length);
5936
6029
  if (chars) {
5937
- chars = escapeRegExp(stringify(chars));
5938
- return str.replace(new RegExp(`[${chars}]+$`, "g"), "");
6030
+ chars = stringify(chars);
6031
+ this.context.memoryLimit.use(chars.length);
6032
+ for (let i = str.length - 1, set = new Set(chars); i >= 0; i--) {
6033
+ if (!set.has(str[i]))
6034
+ return str.slice(0, i + 1);
6035
+ }
6036
+ return "";
5939
6037
  }
5940
- return str.replace(/\s+$/, "");
6038
+ return str.trimEnd();
5941
6039
  }
5942
6040
  __name(rstrip, "rstrip");
5943
6041
  function split(v, arg) {
@@ -5953,8 +6051,15 @@ function strip(v, chars) {
5953
6051
  const str = stringify(v);
5954
6052
  this.context.memoryLimit.use(str.length);
5955
6053
  if (chars) {
5956
- chars = escapeRegExp(stringify(chars));
5957
- return str.replace(new RegExp(`^[${chars}]+`, "g"), "").replace(new RegExp(`[${chars}]+$`, "g"), "");
6054
+ const set = new Set(stringify(chars));
6055
+ this.context.memoryLimit.use(set.size);
6056
+ let i = 0;
6057
+ let j = str.length - 1;
6058
+ while (set.has(str[i]))
6059
+ i++;
6060
+ while (j >= i && set.has(str[j]))
6061
+ j--;
6062
+ return str.slice(i, j + 1);
5958
6063
  }
5959
6064
  return str.trim();
5960
6065
  }
@@ -5973,30 +6078,37 @@ function capitalize(str) {
5973
6078
  __name(capitalize, "capitalize");
5974
6079
  function replace(v, pattern, replacement) {
5975
6080
  const str = stringify(v);
5976
- this.context.memoryLimit.use(str.length);
5977
- return str.split(stringify(pattern)).join(replacement);
6081
+ pattern = stringify(pattern);
6082
+ replacement = stringify(replacement);
6083
+ const parts = str.split(pattern);
6084
+ const outputSize = str.length + (parts.length - 1) * (replacement.length - pattern.length);
6085
+ this.context.memoryLimit.use(outputSize);
6086
+ return parts.join(replacement);
5978
6087
  }
5979
6088
  __name(replace, "replace");
5980
6089
  function replace_first(v, arg1, arg2) {
5981
6090
  const str = stringify(v);
5982
- this.context.memoryLimit.use(str.length);
5983
- return str.replace(stringify(arg1), arg2);
6091
+ arg1 = stringify(arg1);
6092
+ arg2 = stringify(arg2);
6093
+ this.context.memoryLimit.use(str.length + arg1.length + arg2.length);
6094
+ return str.replace(arg1, () => arg2);
5984
6095
  }
5985
6096
  __name(replace_first, "replace_first");
5986
6097
  function replace_last(v, arg1, arg2) {
5987
6098
  const str = stringify(v);
5988
- this.context.memoryLimit.use(str.length);
5989
6099
  const pattern = stringify(arg1);
6100
+ const replacement = stringify(arg2);
6101
+ this.context.memoryLimit.use(str.length + pattern.length + replacement.length);
5990
6102
  const index = str.lastIndexOf(pattern);
5991
6103
  if (index === -1)
5992
6104
  return str;
5993
- const replacement = stringify(arg2);
5994
6105
  return str.substring(0, index) + replacement + str.substring(index + pattern.length);
5995
6106
  }
5996
6107
  __name(replace_last, "replace_last");
5997
6108
  function truncate(v, l = 50, o = "...") {
5998
6109
  const str = stringify(v);
5999
- this.context.memoryLimit.use(str.length);
6110
+ o = stringify(o);
6111
+ this.context.memoryLimit.use(str.length + o.length);
6000
6112
  if (str.length <= l)
6001
6113
  return v;
6002
6114
  return str.substring(0, l - o.length) + o;
@@ -6004,7 +6116,8 @@ function truncate(v, l = 50, o = "...") {
6004
6116
  __name(truncate, "truncate");
6005
6117
  function truncatewords(v, words = 15, o = "...") {
6006
6118
  const str = stringify(v);
6007
- this.context.memoryLimit.use(str.length);
6119
+ o = stringify(o);
6120
+ this.context.memoryLimit.use(str.length + o.length);
6008
6121
  const arr = str.split(/\s+/);
6009
6122
  if (words <= 0)
6010
6123
  words = 1;
@@ -6037,7 +6150,8 @@ function number_of_words(input, mode) {
6037
6150
  }
6038
6151
  __name(number_of_words, "number_of_words");
6039
6152
  function array_to_sentence_string(array, connector = "and") {
6040
- this.context.memoryLimit.use(array.length);
6153
+ connector = stringify(connector);
6154
+ this.context.memoryLimit.use(array.length + connector.length);
6041
6155
  switch (array.length) {
6042
6156
  case 0:
6043
6157
  return "";
@@ -6083,6 +6197,10 @@ function base64Decode(str) {
6083
6197
  }
6084
6198
  __name(base64Decode, "base64Decode");
6085
6199
  function base64_encode(value) {
6200
+ if (typeof Buffer !== "undefined" && Buffer.isBuffer(value)) {
6201
+ this.context.memoryLimit.use(value.byteLength);
6202
+ return value.toString("base64");
6203
+ }
6086
6204
  const str = stringify(value);
6087
6205
  this.context.memoryLimit.use(str.length);
6088
6206
  return base64Encode(str);
@@ -6099,7 +6217,51 @@ var base64Filters = /* @__PURE__ */ Object.freeze({
6099
6217
  base64_encode,
6100
6218
  base64_decode
6101
6219
  });
6102
- var filters = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, htmlFilters), mathFilters), urlFilters), arrayFilters), dateFilters), stringFilters), base64Filters), misc);
6220
+ function bufferToHex(buffer) {
6221
+ const bytes = new Uint8Array(buffer);
6222
+ let hex = "";
6223
+ for (let i = 0; i < bytes.length; i++) {
6224
+ hex += bytes[i].toString(16).padStart(2, "0");
6225
+ }
6226
+ return hex;
6227
+ }
6228
+ __name(bufferToHex, "bufferToHex");
6229
+ function sha256(str) {
6230
+ return __awaiter(this, void 0, void 0, function* () {
6231
+ const data = new TextEncoder().encode(str);
6232
+ const digest = yield crypto.subtle.digest("SHA-256", data);
6233
+ return bufferToHex(digest);
6234
+ });
6235
+ }
6236
+ __name(sha256, "sha256");
6237
+ function hmacSha256(str, key) {
6238
+ return __awaiter(this, void 0, void 0, function* () {
6239
+ const encoder = new TextEncoder();
6240
+ const cryptoKey = yield crypto.subtle.importKey("raw", encoder.encode(key), { name: "HMAC", hash: "SHA-256" }, false, ["sign"]);
6241
+ const signature = yield crypto.subtle.sign("HMAC", cryptoKey, encoder.encode(str));
6242
+ return bufferToHex(signature);
6243
+ });
6244
+ }
6245
+ __name(hmacSha256, "hmacSha256");
6246
+ function sha256$1(value) {
6247
+ const str = stringify(value);
6248
+ this.context.memoryLimit.use(str.length);
6249
+ return sha256(str);
6250
+ }
6251
+ __name(sha256$1, "sha256$1");
6252
+ function hmac_sha256(value, key) {
6253
+ const str = stringify(value);
6254
+ const keyStr = stringify(key);
6255
+ this.context.memoryLimit.use(str.length + keyStr.length);
6256
+ return hmacSha256(str, keyStr);
6257
+ }
6258
+ __name(hmac_sha256, "hmac_sha256");
6259
+ var cryptoFilters = /* @__PURE__ */ Object.freeze({
6260
+ __proto__: null,
6261
+ sha256: sha256$1,
6262
+ hmac_sha256
6263
+ });
6264
+ var filters = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, htmlFilters), mathFilters), urlFilters), arrayFilters), dateFilters), stringFilters), base64Filters), cryptoFilters), misc);
6103
6265
  var AssignTag = class extends Tag {
6104
6266
  static {
6105
6267
  __name(this, "AssignTag");
@@ -6162,7 +6324,7 @@ var ForTag = class extends Tag {
6162
6324
  return;
6163
6325
  }
6164
6326
  const continueKey = "continue-" + this.variable + "-" + this.collection.getText();
6165
- ctx.push({ continue: ctx.getRegister(continueKey) });
6327
+ ctx.push(createScope({ continue: ctx.getRegister(continueKey, {}) }));
6166
6328
  const hash = yield this.hash.render(ctx);
6167
6329
  ctx.pop();
6168
6330
  const modifiers = this.liquid.options.orderedFilterParameters ? Object.keys(hash).filter((x) => MODIFIERS.includes(x)) : MODIFIERS.filter((x) => hash[x] !== void 0);
@@ -6174,7 +6336,7 @@ var ForTag = class extends Tag {
6174
6336
  return reversed(collection2);
6175
6337
  }, collection);
6176
6338
  ctx.setRegister(continueKey, (hash["offset"] || 0) + collection.length);
6177
- const scope = { forloop: new ForloopDrop(collection.length, this.collection.getText(), this.variable) };
6339
+ const scope = createScope({ forloop: new ForloopDrop(collection.length, this.collection.getText(), this.variable) });
6178
6340
  ctx.push(scope);
6179
6341
  for (const item of collection) {
6180
6342
  scope[this.variable] = item;
@@ -6417,24 +6579,24 @@ var RenderTag = class extends Tag {
6417
6579
  }
6418
6580
  partialScope() {
6419
6581
  if (isString(this["file"])) {
6420
- const names = Object.keys(this.hash.hash);
6582
+ const names2 = Object.keys(this.hash.hash);
6421
6583
  if (this["with"]) {
6422
6584
  const { value, alias } = this["with"];
6423
6585
  if (isString(alias)) {
6424
- names.push([alias, value]);
6586
+ names2.push([alias, value]);
6425
6587
  } else if (isString(this.file)) {
6426
- names.push([this.file, value]);
6588
+ names2.push([this.file, value]);
6427
6589
  }
6428
6590
  }
6429
6591
  if (this["for"]) {
6430
6592
  const { value, alias } = this["for"];
6431
6593
  if (isString(alias)) {
6432
- names.push([alias, value]);
6594
+ names2.push([alias, value]);
6433
6595
  } else if (isString(this.file)) {
6434
- names.push([this.file, value]);
6596
+ names2.push([this.file, value]);
6435
6597
  }
6436
6598
  }
6437
- return { name: this["file"], isolated: true, scope: names };
6599
+ return { name: this["file"], isolated: true, scope: names2 };
6438
6600
  }
6439
6601
  }
6440
6602
  *arguments() {
@@ -6517,11 +6679,11 @@ var IncludeTag = class extends Tag {
6517
6679
  const saved = ctx.saveRegister("blocks", "blockMode");
6518
6680
  ctx.setRegister("blocks", {});
6519
6681
  ctx.setRegister("blockMode", BlockMode.OUTPUT);
6520
- const scope = yield hash.render(ctx);
6682
+ const scope = createScope(yield hash.render(ctx));
6521
6683
  if (withVar)
6522
6684
  scope[filepath] = yield evalToken(withVar, ctx);
6523
6685
  const templates = yield liquid._parsePartialFile(filepath, ctx.sync, this["currentFile"]);
6524
- ctx.push(ctx.opts.jekyllInclude ? { include: scope } : scope);
6686
+ ctx.push(ctx.opts.jekyllInclude ? createScope({ include: scope }) : scope);
6525
6687
  yield renderer.renderTemplates(templates, ctx, emitter);
6526
6688
  ctx.pop();
6527
6689
  ctx.restoreRegister(saved);
@@ -6534,16 +6696,16 @@ var IncludeTag = class extends Tag {
6534
6696
  }
6535
6697
  partialScope() {
6536
6698
  if (isString(this["file"])) {
6537
- let names;
6699
+ let names2;
6538
6700
  if (this.liquid.options.jekyllInclude) {
6539
- names = ["include"];
6701
+ names2 = ["include"];
6540
6702
  } else {
6541
- names = Object.keys(this.hash.hash);
6703
+ names2 = Object.keys(this.hash.hash);
6542
6704
  if (this.withVar) {
6543
- names.push([this["file"], this.withVar]);
6705
+ names2.push([this["file"], this.withVar]);
6544
6706
  }
6545
6707
  }
6546
- return { name: this["file"], isolated: false, scope: names };
6708
+ return { name: this["file"], isolated: false, scope: names2 };
6547
6709
  }
6548
6710
  }
6549
6711
  *arguments() {
@@ -6603,7 +6765,7 @@ var CycleTag = class extends Tag {
6603
6765
  *render(ctx, emitter) {
6604
6766
  const group = yield evalToken(this.group, ctx);
6605
6767
  const fingerprint = `cycle:${group}:` + this.candidates.join(",");
6606
- const groups = ctx.getRegister("cycle");
6768
+ const groups = ctx.getRegister("cycle", {});
6607
6769
  let idx = groups[fingerprint];
6608
6770
  if (idx === void 0) {
6609
6771
  idx = groups[fingerprint] = 0;
@@ -6716,11 +6878,11 @@ var LayoutTag = class extends Tag {
6716
6878
  const templates = yield liquid._parseLayoutFile(filepath, ctx.sync, this["currentFile"]);
6717
6879
  ctx.setRegister("blockMode", BlockMode.STORE);
6718
6880
  const html = yield renderer.renderTemplates(this.templates, ctx);
6719
- const blocks = ctx.getRegister("blocks");
6881
+ const blocks = ctx.getRegister("blocks", {});
6720
6882
  if (blocks[""] === void 0)
6721
6883
  blocks[""] = (parent, emitter2) => emitter2.write(html);
6722
6884
  ctx.setRegister("blockMode", BlockMode.OUTPUT);
6723
- ctx.push(yield args.render(ctx));
6885
+ ctx.push(createScope(yield args.render(ctx)));
6724
6886
  yield renderer.renderTemplates(templates, ctx, emitter);
6725
6887
  ctx.pop();
6726
6888
  }
@@ -6768,18 +6930,24 @@ var BlockTag = class extends Tag {
6768
6930
  *render(ctx, emitter) {
6769
6931
  const blockRender = this.getBlockRender(ctx);
6770
6932
  if (ctx.getRegister("blockMode") === BlockMode.STORE) {
6771
- ctx.getRegister("blocks")[this.block] = blockRender;
6933
+ ctx.getRegister("blocks", {})[this.block] = blockRender;
6772
6934
  } else {
6773
6935
  yield blockRender(new BlockDrop(), emitter);
6774
6936
  }
6775
6937
  }
6776
6938
  getBlockRender(ctx) {
6939
+ const self = this;
6777
6940
  const { liquid, templates } = this;
6778
- const renderChild = ctx.getRegister("blocks")[this.block];
6941
+ const renderChild = ctx.getRegister("blocks", {})[this.block];
6779
6942
  const renderCurrent = /* @__PURE__ */ __name(function* (superBlock, emitter) {
6780
- ctx.push({ block: superBlock });
6943
+ const stack = ctx.getRegister("blockStack", []);
6944
+ if (stack.includes(self))
6945
+ throw new Error("block tag cannot be nested");
6946
+ stack.push(self);
6947
+ ctx.push(createScope({ block: superBlock }));
6781
6948
  yield liquid.renderer.renderTemplates(templates, ctx, emitter);
6782
6949
  ctx.pop();
6950
+ stack.pop();
6783
6951
  }, "renderCurrent");
6784
6952
  return renderChild ? (superBlock, emitter) => renderChild(new BlockDrop((emitter2) => renderCurrent(superBlock, emitter2)), emitter) : renderCurrent;
6785
6953
  }
@@ -6866,7 +7034,7 @@ var TablerowTag = class extends Tag {
6866
7034
  const cols = args.cols || collection.length;
6867
7035
  const r = this.liquid.renderer;
6868
7036
  const tablerowloop = new TablerowloopDrop(collection.length, cols, this.collection.getText(), this.variable);
6869
- const scope = { tablerowloop };
7037
+ const scope = createScope({ tablerowloop });
6870
7038
  ctx.push(scope);
6871
7039
  for (let idx = 0; idx < collection.length; idx++, tablerowloop.next()) {
6872
7040
  scope[this.variable] = collection[idx];
@@ -7054,8 +7222,8 @@ var Liquid = class _Liquid {
7054
7222
  }
7055
7223
  constructor(opts = {}) {
7056
7224
  this.renderer = new Render();
7057
- this.filters = {};
7058
- this.tags = {};
7225
+ this.filters = /* @__PURE__ */ Object.create(null);
7226
+ this.tags = /* @__PURE__ */ Object.create(null);
7059
7227
  this.options = normalize(opts);
7060
7228
  this.parser = new Parser(this);
7061
7229
  forOwn(tags, (conf, name) => this.registerTag(name, conf));
@@ -7257,21 +7425,289 @@ var Liquid = class _Liquid {
7257
7425
  // ../../src/Engines/Liquid.js
7258
7426
  var import_eleventy_utils = __toESM(require_eleventy_utils(), 1);
7259
7427
 
7260
- // ../../node_modules/@11ty/package-bundler/shims/debug.js
7261
- function debug_default() {
7262
- return function() {
7428
+ // ../../node_modules/obug/dist/core.js
7429
+ function coerce(value) {
7430
+ if (value instanceof Error) return value.stack || value.message;
7431
+ return value;
7432
+ }
7433
+ __name(coerce, "coerce");
7434
+ function selectColor(colors2, namespace) {
7435
+ let hash = 0;
7436
+ for (let i = 0; i < namespace.length; i++) {
7437
+ hash = (hash << 5) - hash + namespace.charCodeAt(i);
7438
+ hash |= 0;
7439
+ }
7440
+ return colors2[Math.abs(hash) % colors2.length];
7441
+ }
7442
+ __name(selectColor, "selectColor");
7443
+ function matchesTemplate(search2, template) {
7444
+ let searchIndex = 0;
7445
+ let templateIndex = 0;
7446
+ let starIndex = -1;
7447
+ let matchIndex = 0;
7448
+ while (searchIndex < search2.length) if (templateIndex < template.length && (template[templateIndex] === search2[searchIndex] || template[templateIndex] === "*")) if (template[templateIndex] === "*") {
7449
+ starIndex = templateIndex;
7450
+ matchIndex = searchIndex;
7451
+ templateIndex++;
7452
+ } else {
7453
+ searchIndex++;
7454
+ templateIndex++;
7455
+ }
7456
+ else if (starIndex !== -1) {
7457
+ templateIndex = starIndex + 1;
7458
+ matchIndex++;
7459
+ searchIndex = matchIndex;
7460
+ } else return false;
7461
+ while (templateIndex < template.length && template[templateIndex] === "*") templateIndex++;
7462
+ return templateIndex === template.length;
7463
+ }
7464
+ __name(matchesTemplate, "matchesTemplate");
7465
+ function humanize(value) {
7466
+ if (value >= 1e3) return `${(value / 1e3).toFixed(1)}s`;
7467
+ return `${value}ms`;
7468
+ }
7469
+ __name(humanize, "humanize");
7470
+ var globalNamespaces = "";
7471
+ function createDebug(namespace, options) {
7472
+ let prevTime;
7473
+ let enableOverride;
7474
+ let namespacesCache;
7475
+ let enabledCache;
7476
+ const debug2 = /* @__PURE__ */ __name((...args) => {
7477
+ if (!debug2.enabled) return;
7478
+ const curr = Date.now();
7479
+ const diff = curr - (prevTime || curr);
7480
+ prevTime = curr;
7481
+ args[0] = coerce(args[0]);
7482
+ if (typeof args[0] !== "string") args.unshift("%O");
7483
+ let index = 0;
7484
+ args[0] = args[0].replace(/%([a-z%])/gi, (match, format2) => {
7485
+ if (match === "%%") return "%";
7486
+ index++;
7487
+ const formatter = options.formatters[format2];
7488
+ if (typeof formatter === "function") {
7489
+ const value = args[index];
7490
+ match = formatter.call(debug2, value);
7491
+ args.splice(index, 1);
7492
+ index--;
7493
+ }
7494
+ return match;
7495
+ });
7496
+ options.formatArgs.call(debug2, diff, args);
7497
+ debug2.log(...args);
7498
+ }, "debug");
7499
+ debug2.extend = function(namespace2, delimiter = ":") {
7500
+ return createDebug(this.namespace + delimiter + namespace2, {
7501
+ useColors: this.useColors,
7502
+ color: this.color,
7503
+ formatArgs: this.formatArgs,
7504
+ formatters: this.formatters,
7505
+ inspectOpts: this.inspectOpts,
7506
+ log: this.log,
7507
+ humanize: this.humanize
7508
+ });
7263
7509
  };
7510
+ Object.assign(debug2, options);
7511
+ debug2.namespace = namespace;
7512
+ Object.defineProperty(debug2, "enabled", {
7513
+ enumerable: true,
7514
+ configurable: false,
7515
+ get: /* @__PURE__ */ __name(() => {
7516
+ if (enableOverride != null) return enableOverride;
7517
+ if (namespacesCache !== globalNamespaces) {
7518
+ namespacesCache = globalNamespaces;
7519
+ enabledCache = enabled(namespace);
7520
+ }
7521
+ return enabledCache;
7522
+ }, "get"),
7523
+ set: /* @__PURE__ */ __name((v) => {
7524
+ enableOverride = v;
7525
+ }, "set")
7526
+ });
7527
+ return debug2;
7528
+ }
7529
+ __name(createDebug, "createDebug");
7530
+ var names = [];
7531
+ var skips = [];
7532
+ function enable(namespaces2) {
7533
+ globalNamespaces = namespaces2;
7534
+ names = [];
7535
+ skips = [];
7536
+ const split2 = globalNamespaces.trim().replace(/\s+/g, ",").split(",").filter(Boolean);
7537
+ for (const ns of split2) if (ns[0] === "-") skips.push(ns.slice(1));
7538
+ else names.push(ns);
7539
+ }
7540
+ __name(enable, "enable");
7541
+ function enabled(name) {
7542
+ for (const skip of skips) if (matchesTemplate(name, skip)) return false;
7543
+ for (const ns of names) if (matchesTemplate(name, ns)) return true;
7544
+ return false;
7545
+ }
7546
+ __name(enabled, "enabled");
7547
+
7548
+ // ../../node_modules/obug/dist/browser.js
7549
+ var colors = [
7550
+ "#0000CC",
7551
+ "#0000FF",
7552
+ "#0033CC",
7553
+ "#0033FF",
7554
+ "#0066CC",
7555
+ "#0066FF",
7556
+ "#0099CC",
7557
+ "#0099FF",
7558
+ "#00CC00",
7559
+ "#00CC33",
7560
+ "#00CC66",
7561
+ "#00CC99",
7562
+ "#00CCCC",
7563
+ "#00CCFF",
7564
+ "#3300CC",
7565
+ "#3300FF",
7566
+ "#3333CC",
7567
+ "#3333FF",
7568
+ "#3366CC",
7569
+ "#3366FF",
7570
+ "#3399CC",
7571
+ "#3399FF",
7572
+ "#33CC00",
7573
+ "#33CC33",
7574
+ "#33CC66",
7575
+ "#33CC99",
7576
+ "#33CCCC",
7577
+ "#33CCFF",
7578
+ "#6600CC",
7579
+ "#6600FF",
7580
+ "#6633CC",
7581
+ "#6633FF",
7582
+ "#66CC00",
7583
+ "#66CC33",
7584
+ "#9900CC",
7585
+ "#9900FF",
7586
+ "#9933CC",
7587
+ "#9933FF",
7588
+ "#99CC00",
7589
+ "#99CC33",
7590
+ "#CC0000",
7591
+ "#CC0033",
7592
+ "#CC0066",
7593
+ "#CC0099",
7594
+ "#CC00CC",
7595
+ "#CC00FF",
7596
+ "#CC3300",
7597
+ "#CC3333",
7598
+ "#CC3366",
7599
+ "#CC3399",
7600
+ "#CC33CC",
7601
+ "#CC33FF",
7602
+ "#CC6600",
7603
+ "#CC6633",
7604
+ "#CC9900",
7605
+ "#CC9933",
7606
+ "#CCCC00",
7607
+ "#CCCC33",
7608
+ "#FF0000",
7609
+ "#FF0033",
7610
+ "#FF0066",
7611
+ "#FF0099",
7612
+ "#FF00CC",
7613
+ "#FF00FF",
7614
+ "#FF3300",
7615
+ "#FF3333",
7616
+ "#FF3366",
7617
+ "#FF3399",
7618
+ "#FF33CC",
7619
+ "#FF33FF",
7620
+ "#FF6600",
7621
+ "#FF6633",
7622
+ "#FF9900",
7623
+ "#FF9933",
7624
+ "#FFCC00",
7625
+ "#FFCC33"
7626
+ ];
7627
+ function formatArgs(diff, args) {
7628
+ const { useColors } = this;
7629
+ args[0] = `${(useColors ? "%c" : "") + this.namespace + (useColors ? " %c" : " ") + args[0] + (useColors ? "%c " : " ")}+${this.humanize(diff)}`;
7630
+ if (!useColors) return;
7631
+ const c = `color: ${this.color}`;
7632
+ args.splice(1, 0, c, "color: inherit");
7633
+ let index = 0;
7634
+ let lastC = 0;
7635
+ args[0].replace(/%[a-z%]/gi, (match) => {
7636
+ if (match === "%%") return;
7637
+ index++;
7638
+ if (match === "%c") lastC = index;
7639
+ });
7640
+ args.splice(lastC, 0, c);
7641
+ }
7642
+ __name(formatArgs, "formatArgs");
7643
+ var log = console.debug || console.log || (() => {
7644
+ });
7645
+ var storage = localstorage();
7646
+ var defaultOptions2 = {
7647
+ useColors: true,
7648
+ formatArgs,
7649
+ formatters: {
7650
+ /**
7651
+ * Map %j to `JSON.stringify()`, since no Web Inspectors do that by default.
7652
+ */
7653
+ j(v) {
7654
+ try {
7655
+ return JSON.stringify(v);
7656
+ } catch (error) {
7657
+ return `[UnexpectedJSONParseError]: ${error.message}`;
7658
+ }
7659
+ }
7660
+ },
7661
+ inspectOpts: {},
7662
+ humanize,
7663
+ log
7664
+ };
7665
+ function createDebug2(namespace, options) {
7666
+ var _ref;
7667
+ const color = (_ref = options && options.color) !== null && _ref !== void 0 ? _ref : selectColor(colors, namespace);
7668
+ return createDebug(namespace, Object.assign(defaultOptions2, { color }, options));
7669
+ }
7670
+ __name(createDebug2, "createDebug");
7671
+ function localstorage() {
7672
+ try {
7673
+ return localStorage;
7674
+ } catch (_unused) {
7675
+ }
7676
+ }
7677
+ __name(localstorage, "localstorage");
7678
+ function load() {
7679
+ let r;
7680
+ try {
7681
+ r = storage.getItem("debug") || storage.getItem("DEBUG");
7682
+ } catch (_unused2) {
7683
+ }
7684
+ if (!r && typeof process !== "undefined" && "env" in process) r = process.env.DEBUG;
7685
+ return r || "";
7686
+ }
7687
+ __name(load, "load");
7688
+ enable(load());
7689
+
7690
+ // ../../src/Util/IsBuildAwesome.js
7691
+ function isUsingBuildAwesome() {
7692
+ return process?.env?.BUILDAWESOME_PACKAGE === "@awesome.me/buildawesome";
7693
+ }
7694
+ __name(isUsingBuildAwesome, "isUsingBuildAwesome");
7695
+
7696
+ // ../../src/Util/DebugLogUtil.js
7697
+ var PREFIX = isUsingBuildAwesome() ? "BuildAwesome:" : "Eleventy:";
7698
+ function createDebug3(name) {
7699
+ return createDebug2(`${PREFIX}:${name}`);
7264
7700
  }
7265
- __name(debug_default, "default");
7701
+ __name(createDebug3, "createDebug");
7266
7702
 
7267
- // ../../src/Errors/EleventyBaseError.js
7268
- var EleventyBaseError = class extends Error {
7703
+ // ../../src/Errors/BaseError.js
7704
+ var BaseError = class extends Error {
7269
7705
  static {
7270
- __name(this, "EleventyBaseError");
7706
+ __name(this, "BaseError");
7271
7707
  }
7272
7708
  /**
7273
7709
  * @param {string} message - The error message to display.
7274
- * @param {unknown} [originalError] - The original error caught.
7710
+ * @param {Error} [originalError] - The original error caught.
7275
7711
  */
7276
7712
  constructor(message, originalError) {
7277
7713
  if (originalError) {
@@ -7288,15 +7724,14 @@ var EleventyBaseError = class extends Error {
7288
7724
  }
7289
7725
  }
7290
7726
  };
7291
- var EleventyBaseError_default = EleventyBaseError;
7292
7727
 
7293
7728
  // ../../src/Engines/TemplateEngine.js
7294
- var TemplateEngineConfigError = class extends EleventyBaseError_default {
7729
+ var TemplateEngineConfigError = class extends BaseError {
7295
7730
  static {
7296
7731
  __name(this, "TemplateEngineConfigError");
7297
7732
  }
7298
7733
  };
7299
- var debug = debug_default("Eleventy:TemplateEngine");
7734
+ var debug = createDebug3("TemplateEngine");
7300
7735
  var AMENDED_INSTANCES = /* @__PURE__ */ new Set();
7301
7736
  var TemplateEngine = class {
7302
7737
  static {
@@ -7742,6 +8177,7 @@ var Liquid2 = class _Liquid extends TemplateEngine {
7742
8177
  {
7743
8178
  page: data?.page,
7744
8179
  eleventy: data?.eleventy,
8180
+ buildawesome: data?.buildawesome,
7745
8181
  collections: data?.collections
7746
8182
  },
7747
8183
  liquidOptions?.globals