@useinsider/ab-components 0.0.116-beta.7 → 0.0.116-beta.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,3665 +0,0 @@
1
- class z {
2
- constructor(e, s, i, n, r) {
3
- this.kind = e, this.input = s, this.begin = i, this.end = n, this.file = r;
4
- }
5
- getText() {
6
- return this.input.slice(this.begin, this.end);
7
- }
8
- getPosition() {
9
- let [e, s] = [1, 1];
10
- for (let i = 0; i < this.begin; i++)
11
- this.input[i] === `
12
- ` ? (e++, s = 1) : s++;
13
- return [e, s];
14
- }
15
- size() {
16
- return this.end - this.begin;
17
- }
18
- }
19
- class Y {
20
- liquidMethodMissing(e, s) {
21
- }
22
- }
23
- const Gt = Object.prototype.toString, He = String.prototype.toLowerCase, Re = Object.hasOwnProperty;
24
- function d(t) {
25
- return typeof t == "string";
26
- }
27
- function x(t) {
28
- return typeof t == "function";
29
- }
30
- function Xt(t) {
31
- return t && x(t.then);
32
- }
33
- function he(t) {
34
- return t && x(t.next) && x(t.throw) && x(t.return);
35
- }
36
- function u(t) {
37
- return t = g(t), d(t) ? t : T(t) ? "" : S(t) ? t.map((e) => u(e)).join("") : String(t);
38
- }
39
- function re(t) {
40
- return t = g(t), S(t) ? t : d(t) && t.length > 0 ? [t] : es(t) ? Array.from(t) : me(t) ? Object.keys(t).map((e) => [e, t[e]]) : [];
41
- }
42
- function _(t) {
43
- return t = g(t), T(t) ? [] : S(t) ? t : [t];
44
- }
45
- function g(t) {
46
- return t instanceof Y && x(t.valueOf) ? t.valueOf() : t;
47
- }
48
- function Se(t) {
49
- return +g(t) || 0;
50
- }
51
- function ge(t) {
52
- return typeof t == "number";
53
- }
54
- function bt(t) {
55
- return t && x(t.toLiquid) ? bt(t.toLiquid()) : t;
56
- }
57
- function T(t) {
58
- return t == null;
59
- }
60
- function Kt(t) {
61
- return t === void 0;
62
- }
63
- function S(t) {
64
- return Gt.call(t) === "[object Array]";
65
- }
66
- function kt(t) {
67
- return t && ge(t.length);
68
- }
69
- function es(t) {
70
- return me(t) && Symbol.iterator in t;
71
- }
72
- function We(t, e) {
73
- t = t || {};
74
- for (const s in t)
75
- if (Re.call(t, s) && e(t[s], s, t) === !1)
76
- break;
77
- return t;
78
- }
79
- function Tt(t) {
80
- return t[t.length - 1];
81
- }
82
- function me(t) {
83
- const e = typeof t;
84
- return t !== null && (e === "object" || e === "function");
85
- }
86
- function vt(t, e, s = 1) {
87
- const i = [];
88
- for (let n = t; n < e; n += s)
89
- i.push(n);
90
- return i;
91
- }
92
- function ne(t, e, s = " ") {
93
- return xt(t, e, s, (i, n) => n + i);
94
- }
95
- function ts(t, e, s = " ") {
96
- return xt(t, e, s, (i, n) => i + n);
97
- }
98
- function xt(t, e, s, i) {
99
- t = String(t);
100
- const n = e - t.length;
101
- return n <= 0 ? t : i(t, s.repeat(n));
102
- }
103
- function St(t) {
104
- return t;
105
- }
106
- function ss(t) {
107
- return [...t].some((s) => s >= "a" && s <= "z") ? t.toUpperCase() : t.toLowerCase();
108
- }
109
- function is(t, e) {
110
- return t.length > e ? t.slice(0, e - 3) + "..." : t;
111
- }
112
- function ns(t, e) {
113
- return T(t) && T(e) ? 0 : T(t) ? 1 : T(e) || t < e ? -1 : t > e ? 1 : 0;
114
- }
115
- function rs(t, e) {
116
- return T(t) && T(e) ? 0 : T(t) ? 1 : T(e) || (t = He.call(t), e = He.call(e), t < e) ? -1 : t > e ? 1 : 0;
117
- }
118
- function ye(t) {
119
- return function(...e) {
120
- return t.call(this, ...e.map(g));
121
- };
122
- }
123
- function M(t) {
124
- return function(...e) {
125
- return t.call(this, ...e.map(Se));
126
- };
127
- }
128
- function* oe(t) {
129
- const e = /* @__PURE__ */ new Set();
130
- for (const s of t) {
131
- const i = JSON.stringify(s);
132
- e.has(i) || (e.add(i), yield s);
133
- }
134
- }
135
- const Ye = "__liquidClass__";
136
- class Z extends Error {
137
- constructor(e, s) {
138
- super(typeof e == "string" ? e : e.message), this.context = "", typeof e != "string" && Object.defineProperty(this, "originalError", { value: e, enumerable: !1 }), Object.defineProperty(this, "token", { value: s, enumerable: !1 }), Object.defineProperty(this, Ye, { value: "LiquidError", enumerable: !1 });
139
- }
140
- update() {
141
- Object.defineProperty(this, "context", { value: fs(this.token), enumerable: !1 }), this.message = ds(this.message, this.token), this.stack = this.message + `
142
- ` + this.context + `
143
- ` + this.stack, this.originalError && (this.stack += `
144
- From ` + this.originalError.stack);
145
- }
146
- static is(e) {
147
- return (e == null ? void 0 : e[Ye]) === "LiquidError";
148
- }
149
- }
150
- class os extends Z {
151
- constructor(e, s) {
152
- super(e, s), this.name = "TokenizationError", super.update();
153
- }
154
- }
155
- class as extends Z {
156
- constructor(e, s) {
157
- super(e, s), this.name = "ParseError", this.message = e.message, super.update();
158
- }
159
- }
160
- class ls extends Z {
161
- constructor(e, s) {
162
- super(e, s.token), this.name = "RenderError", this.message = e.message, super.update();
163
- }
164
- static is(e) {
165
- return e.name === "RenderError";
166
- }
167
- }
168
- class _t extends Z {
169
- constructor(e) {
170
- super(e[0], e[0].token), this.errors = e, this.name = "LiquidErrors";
171
- const s = e.length > 1 ? "s" : "";
172
- this.message = `${e.length} error${s} found`, super.update();
173
- }
174
- static is(e) {
175
- return e.name === "LiquidErrors";
176
- }
177
- }
178
- class cs extends Z {
179
- constructor(e, s) {
180
- super(e, s), this.name = "UndefinedVariableError", this.message = e.message, super.update();
181
- }
182
- }
183
- class hs extends Error {
184
- constructor(e) {
185
- super(`undefined variable: ${e}`), this.name = "InternalUndefinedVariableError", this.variableName = e;
186
- }
187
- }
188
- class us extends Error {
189
- constructor(e) {
190
- super(e), this.name = "AssertionError", this.message = e + "";
191
- }
192
- }
193
- function fs(t) {
194
- const [e, s] = t.getPosition(), i = t.input.split(`
195
- `), n = Math.max(e - 2, 1), r = Math.min(e + 3, i.length);
196
- return vt(n, r + 1).map((a) => {
197
- const l = a === e ? ">> " : " ", h = ne(String(a), String(r).length);
198
- let c = `${l}${h}| `;
199
- const f = a === e ? `
200
- ` + ne("^", s + c.length) : "";
201
- return c += i[a - 1], c += f, c;
202
- }).join(`
203
- `);
204
- }
205
- function ds(t, e) {
206
- e.file && (t += `, file:${e.file}`);
207
- const [s, i] = e.getPosition();
208
- return t += `, line:${s}, col:${i}`, t;
209
- }
210
- const m = [0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 4, 4, 4, 20, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 20, 2, 8, 0, 0, 0, 0, 8, 0, 0, 0, 64, 0, 65, 0, 0, 33, 33, 33, 33, 33, 33, 33, 33, 33, 33, 0, 0, 2, 2, 2, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 1, 0, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0], ps = 1, K = 4, Ze = 8, Lt = 16, gs = 32, ms = 64, ys = 128;
211
- function ae(t) {
212
- const e = t.charCodeAt(0);
213
- return e >= 128 ? !m[e] : !!(m[e] & ps);
214
- }
215
- m[160] = m[5760] = m[6158] = m[8192] = m[8193] = m[8194] = m[8195] = m[8196] = m[8197] = m[8198] = m[8199] = m[8200] = m[8201] = m[8202] = m[8232] = m[8233] = m[8239] = m[8287] = m[12288] = K;
216
- m[8220] = m[8221] = ys;
217
- function L(t, e) {
218
- if (!t) {
219
- const s = typeof e == "function" ? e() : e || `expect ${t} to be true`;
220
- throw new us(s);
221
- }
222
- }
223
- function ue(t, e = `unexpected ${JSON.stringify(t)}`) {
224
- L(!t, e);
225
- }
226
- class ws extends Y {
227
- equals(e) {
228
- return T(g(e));
229
- }
230
- gt() {
231
- return !1;
232
- }
233
- geq() {
234
- return !1;
235
- }
236
- lt() {
237
- return !1;
238
- }
239
- leq() {
240
- return !1;
241
- }
242
- valueOf() {
243
- return null;
244
- }
245
- }
246
- class ee extends Y {
247
- equals(e) {
248
- return e instanceof ee ? !1 : (e = g(e), d(e) || S(e) ? e.length === 0 : me(e) ? Object.keys(e).length === 0 : !1);
249
- }
250
- gt() {
251
- return !1;
252
- }
253
- geq() {
254
- return !1;
255
- }
256
- lt() {
257
- return !1;
258
- }
259
- leq() {
260
- return !1;
261
- }
262
- valueOf() {
263
- return "";
264
- }
265
- static is(e) {
266
- return e instanceof ee;
267
- }
268
- }
269
- class Ae extends ee {
270
- equals(e) {
271
- return e === !1 || T(g(e)) ? !0 : d(e) ? /^\s*$/.test(e) : super.equals(e);
272
- }
273
- static is(e) {
274
- return e instanceof Ae;
275
- }
276
- }
277
- class Ne extends Y {
278
- constructor(e, s, i) {
279
- super(), this.i = 0, this.length = e, this.name = `${i}-${s}`;
280
- }
281
- next() {
282
- this.i++;
283
- }
284
- index0() {
285
- return this.i;
286
- }
287
- index() {
288
- return this.i + 1;
289
- }
290
- first() {
291
- return this.i === 0;
292
- }
293
- last() {
294
- return this.i === this.length - 1;
295
- }
296
- rindex() {
297
- return this.length - this.i;
298
- }
299
- rindex0() {
300
- return this.length - this.i - 1;
301
- }
302
- valueOf() {
303
- return JSON.stringify(this);
304
- }
305
- }
306
- class Ot {
307
- constructor() {
308
- this.buffer = "";
309
- }
310
- write(e) {
311
- this.buffer += u(e);
312
- }
313
- }
314
- class bs {
315
- constructor() {
316
- throw this.buffer = "", this.stream = null, new Error("streaming not supported in browser");
317
- }
318
- }
319
- class ks {
320
- constructor() {
321
- this.buffer = "";
322
- }
323
- write(e) {
324
- e = g(e), typeof e != "string" && this.buffer === "" ? this.buffer = e : this.buffer = u(this.buffer) + u(e);
325
- }
326
- }
327
- class Je extends Y {
328
- constructor(e = () => "") {
329
- super(), this.superBlockRender = e;
330
- }
331
- /**
332
- * Provide parent access in child block by
333
- * {{ block.super }}
334
- */
335
- *super() {
336
- const e = new Ot();
337
- return yield this.superBlockRender(e), e.buffer;
338
- }
339
- }
340
- function A(t) {
341
- return t && x(t.equals) && x(t.gt) && x(t.geq) && x(t.lt) && x(t.leq);
342
- }
343
- const Qe = new ws(), Ft = {
344
- true: !0,
345
- false: !1,
346
- nil: Qe,
347
- null: Qe,
348
- empty: new ee(),
349
- blank: new Ae()
350
- }, Ge = /* @__PURE__ */ new WeakMap();
351
- function Xe(t) {
352
- const e = Ge.get(t);
353
- if (e)
354
- return e;
355
- const s = {};
356
- for (const [i, n] of Object.entries(t)) {
357
- let r = s;
358
- for (let o = 0; o < i.length; o++) {
359
- const a = i[o];
360
- r[a] = r[a] || {}, o === i.length - 1 && ae(i[o]) && (r[a].needBoundary = !0), r = r[a];
361
- }
362
- r.data = n, r.end = !0;
363
- }
364
- return Ge.set(t, s), s;
365
- }
366
- var fe = function() {
367
- return fe = Object.assign || function(e) {
368
- for (var s, i = 1, n = arguments.length; i < n; i++) {
369
- s = arguments[i];
370
- for (var r in s) Object.prototype.hasOwnProperty.call(s, r) && (e[r] = s[r]);
371
- }
372
- return e;
373
- }, fe.apply(this, arguments);
374
- };
375
- function b(t, e, s, i) {
376
- function n(r) {
377
- return r instanceof s ? r : new s(function(o) {
378
- o(r);
379
- });
380
- }
381
- return new (s || (s = Promise))(function(r, o) {
382
- function a(c) {
383
- try {
384
- h(i.next(c));
385
- } catch (f) {
386
- o(f);
387
- }
388
- }
389
- function l(c) {
390
- try {
391
- h(i.throw(c));
392
- } catch (f) {
393
- o(f);
394
- }
395
- }
396
- function h(c) {
397
- c.done ? r(c.value) : n(c.value).then(a, l);
398
- }
399
- h((i = i.apply(t, [])).next());
400
- });
401
- }
402
- function _e(t, e) {
403
- const s = e || t;
404
- return (i, ...n) => i ? s(...n) : t(...n);
405
- }
406
- function D(t) {
407
- return b(this, void 0, void 0, function* () {
408
- if (!he(t))
409
- return t;
410
- let e, s = !1, i = "next";
411
- do {
412
- const n = t[i](e);
413
- s = !!n.done, e = n.value, i = "next";
414
- try {
415
- he(e) && (e = D(e)), Xt(e) && (e = yield e);
416
- } catch (r) {
417
- i = "throw", e = r;
418
- }
419
- } while (!s);
420
- return e;
421
- });
422
- }
423
- function V(t) {
424
- if (!he(t))
425
- return t;
426
- let e, s = !1, i = "next";
427
- do {
428
- const n = t[i](e);
429
- if (s = !!n.done, e = n.value, i = "next", he(e))
430
- try {
431
- e = V(e);
432
- } catch (r) {
433
- i = "throw", e = r;
434
- }
435
- } while (!s);
436
- return e;
437
- }
438
- const Ts = /%([-_0^#:]+)?(\d+)?([EO])?(.)/;
439
- function vs(t) {
440
- return [31, xs(t) ? 29 : 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31];
441
- }
442
- function zt(t) {
443
- let e = 0;
444
- for (let s = 0; s < t.getMonth(); ++s)
445
- e += vs(t)[s];
446
- return e + t.getDate();
447
- }
448
- function Ke(t, e) {
449
- const s = zt(t) + (e - t.getDay()), n = 7 - new Date(t.getFullYear(), 0, 1).getDay() + e;
450
- return String(Math.floor((s - n) / 7) + 1);
451
- }
452
- function xs(t) {
453
- const e = t.getFullYear();
454
- return !!(!(e & 3) && (e % 100 || e % 400 === 0 && e));
455
- }
456
- function Ss(t) {
457
- const e = t.getDate();
458
- if ([11, 12, 13].includes(e))
459
- return "th";
460
- switch (e % 10) {
461
- case 1:
462
- return "st";
463
- case 2:
464
- return "nd";
465
- case 3:
466
- return "rd";
467
- default:
468
- return "th";
469
- }
470
- }
471
- function _s(t) {
472
- return parseInt(t.getFullYear().toString().substring(0, 2), 10);
473
- }
474
- const Ls = {
475
- d: 2,
476
- e: 2,
477
- H: 2,
478
- I: 2,
479
- j: 3,
480
- k: 2,
481
- l: 2,
482
- L: 3,
483
- m: 2,
484
- M: 2,
485
- S: 2,
486
- U: 2,
487
- W: 2
488
- }, Os = new Set("aAbBceklpP");
489
- function et(t, e) {
490
- const s = Math.abs(t.getTimezoneOffset()), i = Math.floor(s / 60), n = s % 60;
491
- return (t.getTimezoneOffset() > 0 ? "-" : "+") + ne(i, 2, "0") + (e.flags[":"] ? ":" : "") + ne(n, 2, "0");
492
- }
493
- const Le = {
494
- a: (t) => t.getShortWeekdayName(),
495
- A: (t) => t.getLongWeekdayName(),
496
- b: (t) => t.getShortMonthName(),
497
- B: (t) => t.getLongMonthName(),
498
- c: (t) => t.toLocaleString(),
499
- C: (t) => _s(t),
500
- d: (t) => t.getDate(),
501
- e: (t) => t.getDate(),
502
- H: (t) => t.getHours(),
503
- I: (t) => String(t.getHours() % 12 || 12),
504
- j: (t) => zt(t),
505
- k: (t) => t.getHours(),
506
- l: (t) => String(t.getHours() % 12 || 12),
507
- L: (t) => t.getMilliseconds(),
508
- m: (t) => t.getMonth() + 1,
509
- M: (t) => t.getMinutes(),
510
- N: (t, e) => {
511
- var s;
512
- const i = Number(e.width) || 9, n = String(t.getMilliseconds()).slice(0, i);
513
- return (s = e.memoryLimit) === null || s === void 0 || s.use(i - n.length), ts(n, i, "0");
514
- },
515
- p: (t) => t.getHours() < 12 ? "AM" : "PM",
516
- P: (t) => t.getHours() < 12 ? "am" : "pm",
517
- q: (t) => Ss(t),
518
- s: (t) => Math.round(t.getTime() / 1e3),
519
- S: (t) => t.getSeconds(),
520
- u: (t) => t.getDay() || 7,
521
- U: (t) => Ke(t, 0),
522
- w: (t) => t.getDay(),
523
- W: (t) => Ke(t, 1),
524
- x: (t) => t.toLocaleDateString(),
525
- X: (t) => t.toLocaleTimeString(),
526
- y: (t) => t.getFullYear().toString().slice(2, 4),
527
- Y: (t) => t.getFullYear(),
528
- z: et,
529
- Z: (t, e) => t.getTimeZoneName() || et(t, e),
530
- t: () => " ",
531
- n: () => `
532
- `,
533
- "%": () => "%"
534
- };
535
- Le.h = Le.b;
536
- function le(t, e, s) {
537
- let i = "", n = e, r;
538
- for (; r = Ts.exec(n); )
539
- i += n.slice(0, r.index), n = n.slice(r.index + r[0].length), i += Fs(t, r, s);
540
- return i + n;
541
- }
542
- function Fs(t, e, s) {
543
- const [i, n = "", r, o, a] = e, l = Le[a];
544
- if (!l)
545
- return i;
546
- const h = {};
547
- for (const w of n)
548
- h[w] = !0;
549
- let c = String(l(t, { flags: h, width: r, modifier: o, memoryLimit: s })), f = Os.has(a) ? " " : "0", p = Number(r) || Ls[a] || 0;
550
- return h["^"] ? c = c.toUpperCase() : h["#"] && (c = ss(c)), h._ ? f = " " : h[0] && (f = "0"), h["-"] && (p = 0), s == null || s.use(Number(p) - c.length), ne(c, p, f);
551
- }
552
- function Et() {
553
- return typeof Intl < "u" ? Intl.DateTimeFormat : void 0;
554
- }
555
- const zs = 6e4, Es = /([zZ]|([+-])(\d{2}):?(\d{2}))$/, Rt = [
556
- "January",
557
- "February",
558
- "March",
559
- "April",
560
- "May",
561
- "June",
562
- "July",
563
- "August",
564
- "September",
565
- "October",
566
- "November",
567
- "December"
568
- ], Rs = Rt.map((t) => t.slice(0, 3)), At = [
569
- "Sunday",
570
- "Monday",
571
- "Tuesday",
572
- "Wednesday",
573
- "Thursday",
574
- "Friday",
575
- "Saturday"
576
- ], As = At.map((t) => t.slice(0, 3));
577
- class E {
578
- constructor(e, s, i) {
579
- this.locale = s, this.DateTimeFormat = Et(), this.date = new Date(e), this.timezoneFixed = i !== void 0, i === void 0 && (i = this.date.getTimezoneOffset()), this.timezoneOffset = d(i) ? E.getTimezoneOffset(i, this.date) : i, this.timezoneName = d(i) ? i : "";
580
- const n = (this.date.getTimezoneOffset() - this.timezoneOffset) * zs, r = this.date.getTime() + n;
581
- this.displayDate = new Date(r);
582
- }
583
- getTime() {
584
- return this.displayDate.getTime();
585
- }
586
- getMilliseconds() {
587
- return this.displayDate.getMilliseconds();
588
- }
589
- getSeconds() {
590
- return this.displayDate.getSeconds();
591
- }
592
- getMinutes() {
593
- return this.displayDate.getMinutes();
594
- }
595
- getHours() {
596
- return this.displayDate.getHours();
597
- }
598
- getDay() {
599
- return this.displayDate.getDay();
600
- }
601
- getDate() {
602
- return this.displayDate.getDate();
603
- }
604
- getMonth() {
605
- return this.displayDate.getMonth();
606
- }
607
- getFullYear() {
608
- return this.displayDate.getFullYear();
609
- }
610
- toLocaleString(e, s) {
611
- return s != null && s.timeZone ? this.date.toLocaleString(e, s) : this.displayDate.toLocaleString(e, s);
612
- }
613
- toLocaleTimeString(e) {
614
- return this.displayDate.toLocaleTimeString(e);
615
- }
616
- toLocaleDateString(e) {
617
- return this.displayDate.toLocaleDateString(e);
618
- }
619
- getTimezoneOffset() {
620
- return this.timezoneOffset;
621
- }
622
- getTimeZoneName() {
623
- if (this.timezoneFixed)
624
- return this.timezoneName;
625
- if (this.DateTimeFormat)
626
- return this.DateTimeFormat().resolvedOptions().timeZone;
627
- }
628
- getLongMonthName() {
629
- var e;
630
- return (e = this.format({ month: "long" })) !== null && e !== void 0 ? e : Rt[this.getMonth()];
631
- }
632
- getShortMonthName() {
633
- var e;
634
- return (e = this.format({ month: "short" })) !== null && e !== void 0 ? e : Rs[this.getMonth()];
635
- }
636
- getLongWeekdayName() {
637
- var e;
638
- return (e = this.format({ weekday: "long" })) !== null && e !== void 0 ? e : At[this.displayDate.getDay()];
639
- }
640
- getShortWeekdayName() {
641
- var e;
642
- return (e = this.format({ weekday: "short" })) !== null && e !== void 0 ? e : As[this.displayDate.getDay()];
643
- }
644
- valid() {
645
- return !isNaN(this.getTime());
646
- }
647
- format(e) {
648
- return this.DateTimeFormat && this.DateTimeFormat(this.locale, e).format(this.displayDate);
649
- }
650
- /**
651
- * Create a Date object fixed to it's declared Timezone. Both
652
- * - 2021-08-06T02:29:00.000Z and
653
- * - 2021-08-06T02:29:00.000+08:00
654
- * will always be displayed as
655
- * - 2021-08-06 02:29:00
656
- * regardless timezoneOffset in JavaScript realm
657
- *
658
- * The implementation hack:
659
- * Instead of calling `.getMonth()`/`.getUTCMonth()` respect to `preserveTimezones`,
660
- * we create a different Date to trick strftime, it's both simpler and more performant.
661
- * Given that a template is expected to be parsed fewer times than rendered.
662
- */
663
- static createDateFixedToTimezone(e, s) {
664
- const i = e.match(Es);
665
- if (i && i[1] === "Z")
666
- return new E(+new Date(e), s, 0);
667
- if (i && i[2] && i[3] && i[4]) {
668
- const [, , n, r, o] = i, a = (n === "+" ? -1 : 1) * (parseInt(r, 10) * 60 + parseInt(o, 10));
669
- return new E(+new Date(e), s, a);
670
- }
671
- return new E(e, s);
672
- }
673
- static getTimezoneOffset(e, s) {
674
- const i = s.toLocaleString("en-US", { timeZone: e }), n = s.toLocaleString("en-US", { timeZone: "UTC" }), r = new Date(i);
675
- return (+new Date(n) - +r) / (60 * 1e3);
676
- }
677
- }
678
- class Oe {
679
- constructor(e, s) {
680
- this.base = 0, this.message = `${e} limit exceeded`, this.limit = s;
681
- }
682
- use(e) {
683
- +e > 0 && (L(this.base + +e <= this.limit, this.message), this.base += +e);
684
- }
685
- check(e) {
686
- +e > 0 && L(+e <= this.limit, this.message);
687
- }
688
- }
689
- class Me extends z {
690
- constructor(e, [s, i], n, r, o, a, l, h) {
691
- super(e, n, r, o, h), this.trimLeft = !1, this.trimRight = !1;
692
- const c = n[s] === "-", f = n[i - 1] === "-";
693
- let p = c ? s + 1 : s, w = f ? i - 1 : i;
694
- for (; p < w && m[n.charCodeAt(p)] & K; )
695
- p++;
696
- for (; w > p && m[n.charCodeAt(w - 1)] & K; )
697
- w--;
698
- this.contentRange = [p, w], this.trimLeft = c || a, this.trimRight = f || l;
699
- }
700
- get content() {
701
- return this.input.slice(this.contentRange[0], this.contentRange[1]);
702
- }
703
- }
704
- class tt extends Me {
705
- constructor(e, s, i, n, r) {
706
- const { trimTagLeft: o, trimTagRight: a, tagDelimiterLeft: l, tagDelimiterRight: h } = n, [c, f] = [s + l.length, i - h.length];
707
- super(y.Tag, [c, f], e, s, i, o, a, r), this.tokenizer = new N(e, n.operators, r, this.contentRange), this.name = this.tokenizer.readTagName(), this.tokenizer.assert(this.name, "illegal tag syntax, tag name expected"), this.tokenizer.skipBlank(), this.args = this.tokenizer.input.slice(this.tokenizer.p, this.contentRange[1]);
708
- }
709
- }
710
- class Ns extends Me {
711
- constructor(e, s, i, n, r) {
712
- const { trimOutputLeft: o, trimOutputRight: a, outputDelimiterLeft: l, outputDelimiterRight: h } = n, c = [s + l.length, i - h.length];
713
- super(y.Output, c, e, s, i, o, a, r);
714
- }
715
- }
716
- class st extends z {
717
- constructor(e, s, i, n) {
718
- super(y.HTML, e, s, i, n), this.input = e, this.begin = s, this.end = i, this.file = n, this.trimLeft = 0, this.trimRight = 0;
719
- }
720
- getContent() {
721
- return this.input.slice(this.begin + this.trimLeft, this.end - this.trimRight);
722
- }
723
- }
724
- class Ms extends z {
725
- constructor(e, s, i, n) {
726
- super(y.Number, e, s, i, n), this.input = e, this.begin = s, this.end = i, this.file = n, this.content = Number(this.getText());
727
- }
728
- }
729
- class ke extends z {
730
- constructor(e, s, i, n) {
731
- super(y.Word, e, s, i, n), this.input = e, this.begin = s, this.end = i, this.file = n, this.content = this.getText();
732
- }
733
- }
734
- class Ds extends z {
735
- constructor(e, s, i, n) {
736
- super(y.Literal, e, s, i, n), this.input = e, this.begin = s, this.end = i, this.file = n, this.literal = this.getText(), this.content = Ft[this.literal];
737
- }
738
- }
739
- const it = {
740
- "==": 2,
741
- "!=": 2,
742
- ">": 2,
743
- "<": 2,
744
- ">=": 2,
745
- "<=": 2,
746
- contains: 2,
747
- not: 1,
748
- and: 0,
749
- or: 0
750
- }, Vs = {
751
- "==": 0,
752
- "!=": 0,
753
- ">": 0,
754
- "<": 0,
755
- ">=": 0,
756
- "<=": 0,
757
- contains: 0,
758
- not: 1,
759
- and: 0,
760
- or: 0
761
- /* OperatorType.Binary */
762
- };
763
- class Cs extends z {
764
- constructor(e, s, i, n) {
765
- super(y.Operator, e, s, i, n), this.input = e, this.begin = s, this.end = i, this.file = n, this.operator = this.getText();
766
- }
767
- getPrecedence() {
768
- return this.operator in it ? it[this.operator] : 1;
769
- }
770
- }
771
- class nt extends z {
772
- constructor(e, s, i, n, r, o) {
773
- super(y.PropertyAccess, i, n, r, o), this.variable = e, this.props = s;
774
- }
775
- }
776
- class Nt extends z {
777
- constructor(e, s, i, n, r, o) {
778
- super(y.Filter, i, n, r, o), this.name = e, this.args = s;
779
- }
780
- }
781
- class js extends z {
782
- constructor(e, s, i, n, r, o) {
783
- super(y.Hash, e, s, i, o), this.input = e, this.begin = s, this.end = i, this.name = n, this.value = r, this.file = o;
784
- }
785
- }
786
- const qs = /[\da-fA-F]/, rt = /[0-7]/, ot = {
787
- b: "\b",
788
- f: "\f",
789
- n: `
790
- `,
791
- r: "\r",
792
- t: " ",
793
- v: "\v"
794
- };
795
- function at(t) {
796
- const e = t.charCodeAt(0);
797
- return e >= 97 ? e - 87 : e >= 65 ? e - 55 : e - 48;
798
- }
799
- function Ps(t) {
800
- let e = "";
801
- for (let s = 1; s < t.length - 1; s++) {
802
- if (t[s] !== "\\") {
803
- e += t[s];
804
- continue;
805
- }
806
- if (ot[t[s + 1]] !== void 0)
807
- e += ot[t[++s]];
808
- else if (t[s + 1] === "u") {
809
- let i = 0, n = s + 2;
810
- for (; n <= s + 5 && qs.test(t[n]); )
811
- i = i * 16 + at(t[n++]);
812
- s = n - 1, e += String.fromCharCode(i);
813
- } else if (!rt.test(t[s + 1]))
814
- e += t[++s];
815
- else {
816
- let i = s + 1, n = 0;
817
- for (; i <= s + 3 && rt.test(t[i]); )
818
- n = n * 8 + at(t[i++]);
819
- s = i - 1, e += String.fromCharCode(n);
820
- }
821
- }
822
- return e;
823
- }
824
- class Is extends z {
825
- constructor(e, s, i, n) {
826
- super(y.Quoted, e, s, i, n), this.input = e, this.begin = s, this.end = i, this.file = n, this.content = Ps(this.getText());
827
- }
828
- }
829
- class $s extends z {
830
- constructor(e, s, i, n, r, o) {
831
- super(y.Range, e, s, i, o), this.input = e, this.begin = s, this.end = i, this.lhs = n, this.rhs = r, this.file = o;
832
- }
833
- }
834
- class Bs extends Me {
835
- constructor(e, s, i, n, r) {
836
- super(y.Tag, [s, i], e, s, i, !1, !1, r), this.tokenizer = new N(e, n.operators, r, this.contentRange), this.name = this.tokenizer.readTagName(), this.tokenizer.assert(this.name, "illegal liquid tag syntax"), this.tokenizer.skipBlank();
837
- }
838
- get args() {
839
- return this.tokenizer.input.slice(this.tokenizer.p, this.contentRange[1]);
840
- }
841
- }
842
- class Us extends z {
843
- constructor(e, s, i, n, r, o) {
844
- super(y.FilteredValue, i, n, r, o), this.initial = e, this.filters = s, this.input = i, this.begin = n, this.end = r, this.file = o;
845
- }
846
- }
847
- const Hs = {
848
- now: () => Date.now()
849
- };
850
- function Fe() {
851
- return typeof global == "object" && global.performance || typeof window == "object" && window.performance || Hs;
852
- }
853
- class Ws {
854
- renderTemplatesToNodeStream(e, s) {
855
- const i = new bs();
856
- return Promise.resolve().then(() => D(this.renderTemplates(e, s, i))).then(() => i.end(), (n) => i.error(n)), i.stream;
857
- }
858
- *renderTemplates(e, s, i) {
859
- i || (i = s.opts.keepOutputType ? new ks() : new Ot()), s.renderLimit.check(Fe().now());
860
- const n = [];
861
- for (const r of e) {
862
- s.renderLimit.check(Fe().now());
863
- try {
864
- const o = yield r.render(s, i);
865
- if (o && i.write(o), s.breakCalled || s.continueCalled)
866
- break;
867
- } catch (o) {
868
- const a = Z.is(o) ? o : new ls(o, r);
869
- if (s.opts.catchAllErrors)
870
- n.push(a);
871
- else
872
- throw a;
873
- }
874
- }
875
- if (n.length)
876
- throw new _t(n);
877
- return i.buffer;
878
- }
879
- }
880
- class Ys {
881
- constructor(e) {
882
- this.postfix = [...Gs(e)];
883
- }
884
- *evaluate(e, s) {
885
- L(e, "unable to evaluate: context not defined");
886
- const i = [];
887
- for (const n of this.postfix)
888
- if (Pt(n)) {
889
- const r = i.pop();
890
- let o;
891
- if (Vs[n.operator] === 1)
892
- o = yield e.opts.operators[n.operator](r, e);
893
- else {
894
- const a = i.pop();
895
- o = yield e.opts.operators[n.operator](a, r, e);
896
- }
897
- i.push(o);
898
- } else
899
- i.push(yield v(n, e, s));
900
- return i[0];
901
- }
902
- valid() {
903
- return !!this.postfix.length;
904
- }
905
- }
906
- function* v(t, e, s = !1) {
907
- if (t) {
908
- if ("content" in t)
909
- return t.content;
910
- if (pe(t))
911
- return yield Zs(t, e, s);
912
- if (It(t))
913
- return yield Qs(t, e);
914
- }
915
- }
916
- function* Zs(t, e, s) {
917
- const i = [];
918
- for (const n of t.props)
919
- i.push(yield v(n, e, !1));
920
- try {
921
- if (t.variable) {
922
- const n = yield v(t.variable, e, s);
923
- return yield e._getFromScope(n, i);
924
- } else
925
- return yield e._get(i);
926
- } catch (n) {
927
- if (s && n.name === "InternalUndefinedVariableError")
928
- return null;
929
- throw new cs(n, t);
930
- }
931
- }
932
- function Js(t) {
933
- return t.content;
934
- }
935
- function* Qs(t, e) {
936
- const s = yield v(t.lhs, e), i = yield v(t.rhs, e);
937
- return e.memoryLimit.use(i - s + 1), vt(+s, +i + 1);
938
- }
939
- function* Gs(t) {
940
- const e = [];
941
- for (const s of t)
942
- if (Pt(s)) {
943
- for (; e.length && e[e.length - 1].getPrecedence() > s.getPrecedence(); )
944
- yield e.pop();
945
- e.push(s);
946
- } else
947
- yield s;
948
- for (; e.length; )
949
- yield e.pop();
950
- }
951
- function U(t, e) {
952
- return !we(t, e);
953
- }
954
- function we(t, e) {
955
- return t = g(t), e.opts.jsTruthy ? !t : t === !1 || t === void 0 || t === null;
956
- }
957
- const Xs = {
958
- "==": C,
959
- "!=": (t, e) => !C(t, e),
960
- ">": (t, e) => A(t) ? t.gt(e) : A(e) ? e.lt(t) : g(t) > g(e),
961
- "<": (t, e) => A(t) ? t.lt(e) : A(e) ? e.gt(t) : g(t) < g(e),
962
- ">=": (t, e) => A(t) ? t.geq(e) : A(e) ? e.leq(t) : g(t) >= g(e),
963
- "<=": (t, e) => A(t) ? t.leq(e) : A(e) ? e.geq(t) : g(t) <= g(e),
964
- contains: (t, e) => (t = g(t), S(t) ? t.some((s) => C(s, e)) : x(t == null ? void 0 : t.indexOf) ? t.indexOf(g(e)) > -1 : !1),
965
- not: (t, e) => we(g(t), e),
966
- and: (t, e, s) => U(g(t), s) && U(g(e), s),
967
- or: (t, e, s) => U(g(t), s) || U(g(e), s)
968
- };
969
- function C(t, e) {
970
- return A(t) ? t.equals(e) : A(e) ? e.equals(t) : (t = g(t), e = g(e), S(t) ? S(e) && Ks(t, e) : t === e);
971
- }
972
- function Ks(t, e) {
973
- return t.length !== e.length ? !1 : !t.some((s, i) => !C(s, e[i]));
974
- }
975
- function ei(t, e) {
976
- return t.some((s) => C(s, e));
977
- }
978
- class Te {
979
- constructor(e, s, i, n) {
980
- this.key = e, this.value = s, this.next = i, this.prev = n;
981
- }
982
- }
983
- class lt {
984
- constructor(e, s = 0) {
985
- this.limit = e, this.size = s, this.cache = {}, this.head = new Te("HEAD", null, null, null), this.tail = new Te("TAIL", null, null, null), this.head.next = this.tail, this.tail.prev = this.head;
986
- }
987
- write(e, s) {
988
- if (this.cache[e])
989
- this.cache[e].value = s;
990
- else {
991
- const i = new Te(e, s, this.head.next, this.head);
992
- this.head.next.prev = i, this.head.next = i, this.cache[e] = i, this.size++, this.ensureLimit();
993
- }
994
- }
995
- read(e) {
996
- if (!this.cache[e])
997
- return;
998
- const { value: s } = this.cache[e];
999
- return this.remove(e), this.write(e, s), s;
1000
- }
1001
- remove(e) {
1002
- const s = this.cache[e];
1003
- s.prev.next = s.next, s.next.prev = s.prev, delete this.cache[e], this.size--;
1004
- }
1005
- clear() {
1006
- this.head.next = this.tail, this.tail.prev = this.head, this.size = 0, this.cache = {};
1007
- }
1008
- ensureLimit() {
1009
- this.size > this.limit && this.remove(this.tail.prev.key);
1010
- }
1011
- }
1012
- function Mt(t, e) {
1013
- const s = document.createElement("base");
1014
- s.href = t;
1015
- const i = document.getElementsByTagName("head")[0];
1016
- i.insertBefore(s, i.firstChild);
1017
- const n = document.createElement("a");
1018
- n.href = e;
1019
- const r = n.href;
1020
- return i.removeChild(s), r;
1021
- }
1022
- function ti(t, e, s) {
1023
- return t.length && Tt(t) !== "/" && (t += "/"), Mt(t, e).replace(/^(\w+:\/\/[^/]+)(\/[^?]+)/, (n, r, o) => {
1024
- const a = o.split("/").pop();
1025
- return /\.\w+$/.test(a) ? n : r + o + s;
1026
- });
1027
- }
1028
- function si(t) {
1029
- return b(this, void 0, void 0, function* () {
1030
- return new Promise((e, s) => {
1031
- const i = new XMLHttpRequest();
1032
- i.onload = () => {
1033
- i.status >= 200 && i.status < 300 ? e(i.responseText) : s(new Error(i.statusText));
1034
- }, i.onerror = () => {
1035
- s(new Error("An error occurred whilst receiving the response."));
1036
- }, i.open("GET", t), i.send();
1037
- });
1038
- });
1039
- }
1040
- function ii(t) {
1041
- const e = new XMLHttpRequest();
1042
- if (e.open("GET", t, !1), e.send(), e.status < 200 || e.status >= 300)
1043
- throw new Error(e.statusText);
1044
- return e.responseText;
1045
- }
1046
- function ni(t) {
1047
- return b(this, void 0, void 0, function* () {
1048
- return !0;
1049
- });
1050
- }
1051
- function ri(t) {
1052
- return !0;
1053
- }
1054
- function oi(t) {
1055
- return Mt(t, ".");
1056
- }
1057
- const ai = "/";
1058
- var li = /* @__PURE__ */ Object.freeze({
1059
- __proto__: null,
1060
- resolve: ti,
1061
- readFile: si,
1062
- readFileSync: ii,
1063
- exists: ni,
1064
- existsSync: ri,
1065
- dirname: oi,
1066
- sep: ai
1067
- });
1068
- function ci(t, e, ...s) {
1069
- return t = g(t), S(t) || d(t) ? t.length ? t : e : t === !1 && new Map(s).get("allow_false") ? !1 : we(t, this.context) ? e : t;
1070
- }
1071
- function ct(t, e = 0) {
1072
- return JSON.stringify(t, null, e);
1073
- }
1074
- function hi(t, e = 0) {
1075
- const s = [];
1076
- return JSON.stringify(t, function(i, n) {
1077
- if (typeof n != "object" || n === null)
1078
- return n;
1079
- for (; s.length > 0 && s[s.length - 1] !== this; )
1080
- s.pop();
1081
- return s.includes(n) ? "[Circular]" : (s.push(n), n);
1082
- }, e);
1083
- }
1084
- function ui(t) {
1085
- return Number(t);
1086
- }
1087
- const fi = {
1088
- raw: !0,
1089
- handler: St
1090
- };
1091
- var Dt = {
1092
- default: ci,
1093
- raw: fi,
1094
- jsonify: ct,
1095
- to_integer: ui,
1096
- json: ct,
1097
- inspect: hi
1098
- };
1099
- const di = {
1100
- "&": "&amp;",
1101
- "<": "&lt;",
1102
- ">": "&gt;",
1103
- '"': "&#34;",
1104
- "'": "&#39;"
1105
- }, pi = {
1106
- "&amp;": "&",
1107
- "&lt;": "<",
1108
- "&gt;": ">",
1109
- "&#34;": '"',
1110
- "&#39;": "'"
1111
- };
1112
- function be(t) {
1113
- return t = u(t), this.context.memoryLimit.use(t.length), t.replace(/&|<|>|"|'/g, (e) => di[e]);
1114
- }
1115
- function gi(t) {
1116
- return be.call(this, t);
1117
- }
1118
- function mi(t) {
1119
- return t = u(t), this.context.memoryLimit.use(t.length), t.replace(/&(amp|lt|gt|#34|#39);/g, (e) => pi[e]);
1120
- }
1121
- function yi(t) {
1122
- return be.call(this, mi.call(this, t));
1123
- }
1124
- function wi(t) {
1125
- const e = u(t);
1126
- return this.context.memoryLimit.use(e.length), e.replace(/\r?\n/gm, `<br />
1127
- `);
1128
- }
1129
- function bi(t) {
1130
- const e = u(t);
1131
- this.context.memoryLimit.use(e.length);
1132
- const s = /* @__PURE__ */ new Map([["<script", "<\/script>"], ["<style", "</style>"], ["<!--", "-->"], ["<", ">"]]);
1133
- let i = "", n = 0;
1134
- for (; n < e.length; ) {
1135
- const r = e.indexOf("<", n);
1136
- if (r < 0)
1137
- return i + e.slice(n);
1138
- i += e.slice(n, r);
1139
- for (const [o, a] of s) {
1140
- if (!e.startsWith(o, r))
1141
- continue;
1142
- const l = e.indexOf(a, r + o.length);
1143
- if (l >= 0) {
1144
- n = l + a.length;
1145
- break;
1146
- }
1147
- s.delete(o);
1148
- }
1149
- if (n <= r)
1150
- return i + e.slice(r);
1151
- }
1152
- return i;
1153
- }
1154
- var ki = /* @__PURE__ */ Object.freeze({
1155
- __proto__: null,
1156
- escape: be,
1157
- xml_escape: gi,
1158
- escape_once: yi,
1159
- newline_to_br: wi,
1160
- strip_html: bi
1161
- });
1162
- class Ti {
1163
- constructor(e) {
1164
- this.mapping = e, this.sep = "/";
1165
- }
1166
- exists(e) {
1167
- return b(this, void 0, void 0, function* () {
1168
- return this.existsSync(e);
1169
- });
1170
- }
1171
- existsSync(e) {
1172
- return !T(this.mapping[e]);
1173
- }
1174
- readFile(e) {
1175
- return b(this, void 0, void 0, function* () {
1176
- return this.readFileSync(e);
1177
- });
1178
- }
1179
- readFileSync(e) {
1180
- const s = this.mapping[e];
1181
- if (T(s))
1182
- throw new Error(`ENOENT: ${e}`);
1183
- return s;
1184
- }
1185
- dirname(e) {
1186
- const s = e.split(this.sep);
1187
- return s.pop(), s.join(this.sep);
1188
- }
1189
- resolve(e, s, i) {
1190
- if (s += i, e === ".")
1191
- return s;
1192
- const n = e.split(/\/+/);
1193
- for (const r of s.split(this.sep))
1194
- r === "." || r === "" || (r === ".." ? (n.length > 1 || n[0] !== "") && n.pop() : n.push(r));
1195
- return n.join(this.sep);
1196
- }
1197
- }
1198
- const G = {
1199
- root: ["."],
1200
- layouts: ["."],
1201
- partials: ["."],
1202
- relativeReference: !0,
1203
- jekyllInclude: !1,
1204
- keyValueSeparator: ":",
1205
- cache: void 0,
1206
- extname: "",
1207
- fs: li,
1208
- dynamicPartials: !0,
1209
- jsTruthy: !1,
1210
- dateFormat: "%A, %B %-e, %Y at %-l:%M %P %z",
1211
- locale: "",
1212
- trimTagRight: !1,
1213
- trimTagLeft: !1,
1214
- trimOutputRight: !1,
1215
- trimOutputLeft: !1,
1216
- greedy: !0,
1217
- tagDelimiterLeft: "{%",
1218
- tagDelimiterRight: "%}",
1219
- outputDelimiterLeft: "{{",
1220
- outputDelimiterRight: "}}",
1221
- preserveTimezones: !1,
1222
- strictFilters: !1,
1223
- strictVariables: !1,
1224
- ownPropertyOnly: !0,
1225
- lenientIf: !1,
1226
- globals: {},
1227
- keepOutputType: !1,
1228
- operators: Xs,
1229
- memoryLimit: 1 / 0,
1230
- parseLimit: 1 / 0,
1231
- renderLimit: 1 / 0
1232
- };
1233
- function vi(t) {
1234
- var e, s;
1235
- if (t.hasOwnProperty("root") && (t.hasOwnProperty("partials") || (t.partials = t.root), t.hasOwnProperty("layouts") || (t.layouts = t.root)), t.hasOwnProperty("cache")) {
1236
- let i;
1237
- typeof t.cache == "number" ? i = t.cache > 0 ? new lt(t.cache) : void 0 : typeof t.cache == "object" ? i = t.cache : i = t.cache ? new lt(1024) : void 0, t.cache = i;
1238
- }
1239
- return t = Object.assign(Object.assign(Object.assign({}, G), t.jekyllInclude ? { dynamicPartials: !1 } : {}), t), (!t.fs.dirname || !t.fs.sep) && t.relativeReference && (console.warn("[LiquidJS] `fs.dirname` and `fs.sep` are required for relativeReference, set relativeReference to `false` to suppress this warning"), t.relativeReference = !1), t.root = ce(t.root), t.partials = ce(t.partials), t.layouts = ce(t.layouts), t.outputEscape = t.outputEscape && xi(t.outputEscape), t.locale || (t.locale = (s = (e = Et()) === null || e === void 0 ? void 0 : e().resolvedOptions().locale) !== null && s !== void 0 ? s : "en-US"), t.templates && (t.fs = new Ti(t.templates), t.relativeReference = !0, t.root = t.partials = t.layouts = "."), t;
1240
- }
1241
- function xi(t) {
1242
- return t === "escape" ? be : t === "json" ? Dt.json : (L(x(t), "`outputEscape` need to be of type string or function"), t);
1243
- }
1244
- function ce(t) {
1245
- let e = [];
1246
- return S(t) && (e = t), d(t) && (e = [t]), e;
1247
- }
1248
- function Si(t, e) {
1249
- let s = !1;
1250
- for (let i = 0; i < t.length; i++) {
1251
- const n = t[i];
1252
- Ni(n) && (!s && n.trimLeft && _i(t[i - 1], e.greedy), J(n) && (n.name === "raw" ? s = !0 : n.name === "endraw" && (s = !1)), !s && n.trimRight && Li(t[i + 1], e.greedy));
1253
- }
1254
- }
1255
- function _i(t, e) {
1256
- if (!t || !Ve(t))
1257
- return;
1258
- const s = e ? K : Lt;
1259
- for (; m[t.input.charCodeAt(t.end - 1 - t.trimRight)] & s; )
1260
- t.trimRight++;
1261
- }
1262
- function Li(t, e) {
1263
- if (!t || !Ve(t))
1264
- return;
1265
- const s = e ? K : Lt;
1266
- for (; m[t.input.charCodeAt(t.begin + t.trimLeft)] & s; )
1267
- t.trimLeft++;
1268
- t.input.charAt(t.begin + t.trimLeft) === `
1269
- ` && t.trimLeft++;
1270
- }
1271
- class N {
1272
- constructor(e, s = G.operators, i, n) {
1273
- this.input = e, this.file = i, this.rawBeginAt = -1, this.p = n ? n[0] : 0, this.N = n ? n[1] : e.length, this.opTrie = Xe(s), this.literalTrie = Xe(Ft);
1274
- }
1275
- readExpression() {
1276
- return new Ys(this.readExpressionTokens());
1277
- }
1278
- *readExpressionTokens() {
1279
- for (; this.p < this.N; ) {
1280
- const e = this.readOperator();
1281
- if (e) {
1282
- yield e;
1283
- continue;
1284
- }
1285
- const s = this.readValue();
1286
- if (s) {
1287
- yield s;
1288
- continue;
1289
- }
1290
- return;
1291
- }
1292
- }
1293
- readOperator() {
1294
- this.skipBlank();
1295
- const e = this.matchTrie(this.opTrie);
1296
- if (e !== -1)
1297
- return new Cs(this.input, this.p, this.p = e, this.file);
1298
- }
1299
- matchTrie(e) {
1300
- let s = e, i = this.p, n;
1301
- for (; s[this.input[i]] && i < this.N; )
1302
- s = s[this.input[i++]], s.end && (n = s);
1303
- return !n || n.needBoundary && ae(this.peek(i - this.p)) ? -1 : i;
1304
- }
1305
- readFilteredValue() {
1306
- const e = this.p, s = this.readExpression();
1307
- this.assert(s.valid(), `invalid value expression: ${this.snapshot()}`);
1308
- const i = this.readFilters();
1309
- return new Us(s, i, this.input, e, this.p, this.file);
1310
- }
1311
- readFilters() {
1312
- const e = [];
1313
- for (; ; ) {
1314
- const s = this.readFilter();
1315
- if (!s)
1316
- return e;
1317
- e.push(s);
1318
- }
1319
- }
1320
- readFilter() {
1321
- if (this.skipBlank(), this.end())
1322
- return null;
1323
- this.assert(this.read() === "|", 'expected "|" before filter');
1324
- const e = this.readIdentifier();
1325
- if (!e.size())
1326
- return this.assert(this.end(), "expected filter name"), null;
1327
- const s = [];
1328
- if (this.skipBlank(), this.peek() === ":")
1329
- do {
1330
- ++this.p;
1331
- const i = this.readFilterArg();
1332
- i && s.push(i), this.skipBlank(), this.assert(this.end() || this.peek() === "," || this.peek() === "|", () => `unexpected character ${this.snapshot()}`);
1333
- } while (this.peek() === ",");
1334
- else if (!(this.peek() === "|" || this.end())) throw this.error('expected ":" after filter name');
1335
- return new Nt(e.getText(), s, this.input, e.begin, this.p, this.file);
1336
- }
1337
- readFilterArg() {
1338
- const e = this.readValue();
1339
- if (!e)
1340
- return;
1341
- if (this.skipBlank(), this.peek() !== ":")
1342
- return e;
1343
- ++this.p;
1344
- const s = this.readValue();
1345
- return [e.getText(), s];
1346
- }
1347
- readTopLevelTokens(e = G) {
1348
- const s = [];
1349
- for (; this.p < this.N; ) {
1350
- const i = this.readTopLevelToken(e);
1351
- s.push(i);
1352
- }
1353
- return Si(s, e), s;
1354
- }
1355
- readTopLevelToken(e) {
1356
- const { tagDelimiterLeft: s, outputDelimiterLeft: i } = e;
1357
- return this.rawBeginAt > -1 ? this.readEndrawOrRawContent(e) : this.match(s) ? this.readTagToken(e) : this.match(i) ? this.readOutputToken(e) : this.readHTMLToken([s, i]);
1358
- }
1359
- readHTMLToken(e) {
1360
- const s = this.p;
1361
- for (; this.p < this.N && !e.some((i) => this.match(i)); )
1362
- ++this.p;
1363
- return new st(this.input, s, this.p, this.file);
1364
- }
1365
- readTagToken(e) {
1366
- const { file: s, input: i } = this, n = this.p;
1367
- if (this.readToDelimiter(e.tagDelimiterRight) === -1)
1368
- throw this.error(`tag ${this.snapshot(n)} not closed`, n);
1369
- const r = new tt(i, n, this.p, e, s);
1370
- return r.name === "raw" && (this.rawBeginAt = n), r;
1371
- }
1372
- readToDelimiter(e, s = !1) {
1373
- for (this.skipBlank(); this.p < this.N; ) {
1374
- if (s && this.peekType() & Ze) {
1375
- this.readQuoted();
1376
- continue;
1377
- }
1378
- if (++this.p, this.rmatch(e))
1379
- return this.p;
1380
- }
1381
- return -1;
1382
- }
1383
- readOutputToken(e = G) {
1384
- const { file: s, input: i } = this, { outputDelimiterRight: n } = e, r = this.p;
1385
- if (this.readToDelimiter(n, !0) === -1)
1386
- throw this.error(`output ${this.snapshot(r)} not closed`, r);
1387
- return new Ns(i, r, this.p, e, s);
1388
- }
1389
- readEndrawOrRawContent(e) {
1390
- const { tagDelimiterLeft: s, tagDelimiterRight: i } = e, n = this.p;
1391
- let r = this.readTo(s) - s.length;
1392
- for (; this.p < this.N; ) {
1393
- if (this.readIdentifier().getText() !== "endraw") {
1394
- r = this.readTo(s) - s.length;
1395
- continue;
1396
- }
1397
- for (; this.p <= this.N; ) {
1398
- if (this.rmatch(i)) {
1399
- const o = this.p;
1400
- return n === r ? (this.rawBeginAt = -1, new tt(this.input, n, o, e, this.file)) : (this.p = r, new st(this.input, n, r, this.file));
1401
- }
1402
- if (this.rmatch(s))
1403
- break;
1404
- this.p++;
1405
- }
1406
- }
1407
- throw this.error(`raw ${this.snapshot(this.rawBeginAt)} not closed`, n);
1408
- }
1409
- readLiquidTagTokens(e = G) {
1410
- const s = [];
1411
- for (; this.p < this.N; ) {
1412
- const i = this.readLiquidTagToken(e);
1413
- i && s.push(i);
1414
- }
1415
- return s;
1416
- }
1417
- readLiquidTagToken(e) {
1418
- if (this.skipBlank(), this.end())
1419
- return;
1420
- const s = this.p;
1421
- this.readToDelimiter(`
1422
- `);
1423
- const i = this.p;
1424
- return new Bs(this.input, s, i, e, this.file);
1425
- }
1426
- error(e, s = this.p) {
1427
- return new os(e, new ke(this.input, s, this.N, this.file));
1428
- }
1429
- assert(e, s, i) {
1430
- if (!e)
1431
- throw this.error(typeof s == "function" ? s() : s, i);
1432
- }
1433
- snapshot(e = this.p) {
1434
- return JSON.stringify(is(this.input.slice(e, this.N), 32));
1435
- }
1436
- /**
1437
- * @deprecated use #readIdentifier instead
1438
- */
1439
- readWord() {
1440
- return this.readIdentifier();
1441
- }
1442
- readIdentifier() {
1443
- this.skipBlank();
1444
- const e = this.p;
1445
- for (; !this.end() && ae(this.peek()); )
1446
- ++this.p;
1447
- return new ke(this.input, e, this.p, this.file);
1448
- }
1449
- readNonEmptyIdentifier() {
1450
- const e = this.readIdentifier();
1451
- return e.size() ? e : void 0;
1452
- }
1453
- readTagName() {
1454
- return this.skipBlank(), this.input[this.p] === "#" ? this.input.slice(this.p, ++this.p) : this.readIdentifier().getText();
1455
- }
1456
- readHashes(e) {
1457
- const s = [];
1458
- for (; ; ) {
1459
- const i = this.readHash(e);
1460
- if (!i)
1461
- return s;
1462
- s.push(i);
1463
- }
1464
- }
1465
- readHash(e) {
1466
- this.skipBlank(), this.peek() === "," && ++this.p;
1467
- const s = this.p, i = this.readNonEmptyIdentifier();
1468
- if (!i)
1469
- return;
1470
- let n;
1471
- this.skipBlank();
1472
- const r = d(e) ? e : e ? "=" : ":";
1473
- return this.peek() === r && (++this.p, n = this.readValue()), new js(this.input, s, this.p, i, n, this.file);
1474
- }
1475
- remaining() {
1476
- return this.input.slice(this.p, this.N);
1477
- }
1478
- advance(e = 1) {
1479
- this.p += e;
1480
- }
1481
- end() {
1482
- return this.p >= this.N;
1483
- }
1484
- read() {
1485
- return this.input[this.p++];
1486
- }
1487
- readTo(e) {
1488
- for (; this.p < this.N; )
1489
- if (++this.p, this.rmatch(e))
1490
- return this.p;
1491
- return -1;
1492
- }
1493
- readValue() {
1494
- this.skipBlank();
1495
- const e = this.p, s = this.readLiteral() || this.readQuoted() || this.readRange() || this.readNumber(), i = this.readProperties(!s);
1496
- return i.length ? new nt(s, i, this.input, e, this.p) : s;
1497
- }
1498
- readScopeValue() {
1499
- this.skipBlank();
1500
- const e = this.p, s = this.readProperties();
1501
- if (s.length)
1502
- return new nt(void 0, s, this.input, e, this.p);
1503
- }
1504
- readProperties(e = !0) {
1505
- const s = [];
1506
- for (; ; ) {
1507
- if (this.peek() === "[") {
1508
- this.p++;
1509
- const i = this.readValue() || new ke(this.input, this.p, this.p, this.file);
1510
- this.assert(this.readTo("]") !== -1, "[ not closed"), s.push(i);
1511
- continue;
1512
- }
1513
- if (e && !s.length) {
1514
- const i = this.readNonEmptyIdentifier();
1515
- if (i) {
1516
- s.push(i);
1517
- continue;
1518
- }
1519
- }
1520
- if (this.peek() === "." && this.peek(1) !== ".") {
1521
- this.p++;
1522
- const i = this.readNonEmptyIdentifier();
1523
- if (!i)
1524
- break;
1525
- s.push(i);
1526
- continue;
1527
- }
1528
- break;
1529
- }
1530
- return s;
1531
- }
1532
- readNumber() {
1533
- this.skipBlank();
1534
- let e = !1, s = !1, i = 0;
1535
- for (this.peekType() & ms && i++; this.p + i <= this.N; )
1536
- if (this.peekType(i) & gs)
1537
- s = !0, i++;
1538
- else if (this.peek(i) === "." && this.peek(i + 1) !== ".") {
1539
- if (e || !s)
1540
- return;
1541
- e = !0, i++;
1542
- } else
1543
- break;
1544
- if (s && !ae(this.peek(i))) {
1545
- const n = new Ms(this.input, this.p, this.p + i, this.file);
1546
- return this.advance(i), n;
1547
- }
1548
- }
1549
- readLiteral() {
1550
- this.skipBlank();
1551
- const e = this.matchTrie(this.literalTrie);
1552
- if (e === -1)
1553
- return;
1554
- const s = new Ds(this.input, this.p, e, this.file);
1555
- return this.p = e, s;
1556
- }
1557
- readRange() {
1558
- this.skipBlank();
1559
- const e = this.p;
1560
- if (this.peek() !== "(")
1561
- return;
1562
- ++this.p;
1563
- const s = this.readValueOrThrow();
1564
- this.skipBlank(), this.assert(this.read() === "." && this.read() === ".", "invalid range syntax");
1565
- const i = this.readValueOrThrow();
1566
- return this.skipBlank(), this.assert(this.read() === ")", "invalid range syntax"), new $s(this.input, e, this.p, s, i, this.file);
1567
- }
1568
- readValueOrThrow() {
1569
- const e = this.readValue();
1570
- return this.assert(e, () => `unexpected token ${this.snapshot()}, value expected`), e;
1571
- }
1572
- readQuoted() {
1573
- this.skipBlank();
1574
- const e = this.p;
1575
- if (!(this.peekType() & Ze))
1576
- return;
1577
- ++this.p;
1578
- let s = !1;
1579
- for (; this.p < this.N && (++this.p, !(this.input[this.p - 1] === this.input[e] && !s)); )
1580
- s ? s = !1 : this.input[this.p - 1] === "\\" && (s = !0);
1581
- return new Is(this.input, e, this.p, this.file);
1582
- }
1583
- *readFileNameTemplate(e) {
1584
- const { outputDelimiterLeft: s } = e, i = [",", " ", "\r", `
1585
- `, " ", s], n = new Set(i);
1586
- for (; this.p < this.N && !n.has(this.peek()); )
1587
- yield this.match(s) ? this.readOutputToken(e) : this.readHTMLToken(i);
1588
- }
1589
- match(e) {
1590
- for (let s = 0; s < e.length; s++)
1591
- if (e[s] !== this.input[this.p + s])
1592
- return !1;
1593
- return !0;
1594
- }
1595
- rmatch(e) {
1596
- for (let s = 0; s < e.length; s++)
1597
- if (e[e.length - 1 - s] !== this.input[this.p - 1 - s])
1598
- return !1;
1599
- return !0;
1600
- }
1601
- peekType(e = 0) {
1602
- return this.p + e >= this.N ? 0 : m[this.input.charCodeAt(this.p + e)];
1603
- }
1604
- peek(e = 0) {
1605
- return this.p + e >= this.N ? "" : this.input[this.p + e];
1606
- }
1607
- skipBlank() {
1608
- for (; this.peekType() & K; )
1609
- ++this.p;
1610
- }
1611
- }
1612
- class Oi {
1613
- constructor(e, s) {
1614
- this.handlers = {}, this.stopRequested = !1, this.tokens = e, this.parseToken = s;
1615
- }
1616
- on(e, s) {
1617
- return this.handlers[e] = s, this;
1618
- }
1619
- trigger(e, s) {
1620
- const i = this.handlers[e];
1621
- return i ? (i.call(this, s), !0) : !1;
1622
- }
1623
- start() {
1624
- this.trigger("start");
1625
- let e;
1626
- for (; !this.stopRequested && (e = this.tokens.shift()); ) {
1627
- if (this.trigger("token", e) || J(e) && this.trigger(`tag:${e.name}`, e))
1628
- continue;
1629
- const s = this.parseToken(e, this.tokens);
1630
- this.trigger("template", s);
1631
- }
1632
- return this.stopRequested || this.trigger("end"), this;
1633
- }
1634
- stop() {
1635
- return this.stopRequested = !0, this;
1636
- }
1637
- }
1638
- class De {
1639
- constructor(e) {
1640
- this.token = e;
1641
- }
1642
- }
1643
- class k extends De {
1644
- constructor(e, s, i) {
1645
- super(e), this.name = e.name, this.liquid = i, this.tokenizer = e.tokenizer;
1646
- }
1647
- }
1648
- class se {
1649
- constructor(e, s) {
1650
- this.hash = {};
1651
- const i = e instanceof N ? e : new N(e, {});
1652
- for (const n of i.readHashes(s))
1653
- this.hash[n.name.content] = n.value;
1654
- }
1655
- *render(e) {
1656
- const s = {};
1657
- for (const i of Object.keys(this.hash))
1658
- s[i] = this.hash[i] === void 0 ? !0 : yield v(this.hash[i], e);
1659
- return s;
1660
- }
1661
- }
1662
- function Fi(t) {
1663
- return class extends k {
1664
- constructor(e, s, i) {
1665
- super(e, s, i), x(t.parse) && t.parse.call(this, e, s);
1666
- }
1667
- *render(e, s) {
1668
- const i = yield new se(this.token.args, e.opts.keyValueSeparator).render(e);
1669
- return yield t.render.call(this, e, s, i);
1670
- }
1671
- };
1672
- }
1673
- function Vt(t) {
1674
- return S(t);
1675
- }
1676
- class Ct {
1677
- constructor(e, s, i) {
1678
- this.token = e, this.name = e.name, this.handler = x(s) ? s : x(s == null ? void 0 : s.handler) ? s.handler : St, this.raw = !x(s) && !!(s != null && s.raw), this.args = e.args, this.liquid = i;
1679
- }
1680
- *render(e, s) {
1681
- const i = [];
1682
- for (const n of this.args)
1683
- Vt(n) ? i.push([n[0], yield v(n[1], s)]) : i.push(yield v(n, s));
1684
- return yield this.handler.apply({ context: s, token: this.token, liquid: this.liquid }, [e, ...i]);
1685
- }
1686
- }
1687
- class F {
1688
- /**
1689
- * @param str the value to be valuated, eg.: "foobar" | truncate: 3
1690
- */
1691
- constructor(e, s) {
1692
- this.filters = [];
1693
- const i = typeof e == "string" ? new N(e, s.options.operators).readFilteredValue() : e;
1694
- this.initial = i.initial, this.filters = i.filters.map((n) => new Ct(n, this.getFilter(s, n.name), s));
1695
- }
1696
- *value(e, s) {
1697
- s = s || e.opts.lenientIf && this.filters.length > 0 && this.filters[0].name === "default";
1698
- let i = yield this.initial.evaluate(e, s);
1699
- for (const n of this.filters)
1700
- i = yield n.render(i, e);
1701
- return i;
1702
- }
1703
- getFilter(e, s) {
1704
- const i = e.filters[s];
1705
- return L(i || !e.options.strictFilters, () => `undefined filter: ${s}`), i;
1706
- }
1707
- }
1708
- class zi extends De {
1709
- constructor(e, s) {
1710
- var i;
1711
- super(e);
1712
- const n = new N(e.input, s.options.operators, e.file, e.contentRange);
1713
- this.value = new F(n.readFilteredValue(), s);
1714
- const r = this.value.filters, o = s.options.outputEscape;
1715
- if (!(!((i = r[r.length - 1]) === null || i === void 0) && i.raw) && o) {
1716
- const a = new Nt(toString.call(o), [], "", 0, 0);
1717
- r.push(new Ct(a, o, s));
1718
- }
1719
- }
1720
- *render(e, s) {
1721
- const i = yield this.value.value(e, !1);
1722
- s.write(i);
1723
- }
1724
- *arguments() {
1725
- yield this.value;
1726
- }
1727
- }
1728
- class Ei extends De {
1729
- constructor(e) {
1730
- super(e), this.str = e.getContent();
1731
- }
1732
- *render(e, s) {
1733
- s.write(this.str);
1734
- }
1735
- }
1736
- class W {
1737
- constructor(e, s) {
1738
- this.segments = e, this.location = s;
1739
- }
1740
- toString() {
1741
- return de(this.segments, !0);
1742
- }
1743
- /** Return this variable's segments as an array, possibly with nested arrays for nested paths. */
1744
- toArray() {
1745
- function* e(...s) {
1746
- for (const i of s)
1747
- i instanceof W ? yield Array.from(e(...i.segments)) : yield i;
1748
- }
1749
- return Array.from(e(...this.segments));
1750
- }
1751
- }
1752
- class ve {
1753
- constructor() {
1754
- this.map = /* @__PURE__ */ new Map();
1755
- }
1756
- get(e) {
1757
- const s = de([e.segments[0]]);
1758
- return this.map.has(s) || this.map.set(s, []), this.map.get(s);
1759
- }
1760
- has(e) {
1761
- return this.map.has(de([e.segments[0]]));
1762
- }
1763
- push(e) {
1764
- this.get(e).push(e);
1765
- }
1766
- asObject() {
1767
- return Object.fromEntries(this.map);
1768
- }
1769
- }
1770
- const jt = {
1771
- partials: !0
1772
- };
1773
- function* qt(t, e, s) {
1774
- const i = new ve(), n = new ve(), r = new ve(), o = new ht(/* @__PURE__ */ new Set()), a = /* @__PURE__ */ new Set();
1775
- function l(c, f) {
1776
- i.push(c);
1777
- const p = f.alias(c);
1778
- if (p !== void 0) {
1779
- const w = p.segments[0];
1780
- d(w) && !o.has(w) && n.push(p);
1781
- } else {
1782
- const w = c.segments[0];
1783
- d(w) && !f.has(w) && n.push(c);
1784
- }
1785
- for (const w of c.segments)
1786
- w instanceof W && l(w, f);
1787
- }
1788
- function* h(c, f) {
1789
- if (c.arguments)
1790
- for (const p of c.arguments())
1791
- for (const w of ut(p))
1792
- l(w, f);
1793
- if (c.localScope)
1794
- for (const p of c.localScope()) {
1795
- f.add(p.content), f.deleteAlias(p.content);
1796
- const [w, ie] = p.getPosition();
1797
- r.push(new W([p.content], { row: w, col: ie, file: p.file }));
1798
- }
1799
- if (c.children)
1800
- if (c.partialScope) {
1801
- const p = c.partialScope();
1802
- if (p === void 0) {
1803
- for (const I of yield c.children(e, s))
1804
- yield h(I, f);
1805
- return;
1806
- }
1807
- if (a.has(p.name))
1808
- return;
1809
- const w = /* @__PURE__ */ new Set(), ie = p.isolated ? new ht(w) : f.push(w);
1810
- for (const I of p.scope)
1811
- if (d(I))
1812
- w.add(I);
1813
- else {
1814
- const [Be, Qt] = I;
1815
- w.add(Be);
1816
- const Ue = Array.from(ut(Qt));
1817
- Ue.length && ie.setAlias(Be, Ue[0].segments);
1818
- }
1819
- for (const I of yield c.children(e, s))
1820
- yield h(I, ie), a.add(p.name);
1821
- ie.pop();
1822
- } else {
1823
- c.blockScope && f.push(new Set(c.blockScope()));
1824
- for (const p of yield c.children(e, s))
1825
- yield h(p, f);
1826
- c.blockScope && f.pop();
1827
- }
1828
- }
1829
- for (const c of t)
1830
- yield h(c, o);
1831
- return {
1832
- variables: i.asObject(),
1833
- globals: n.asObject(),
1834
- locals: r.asObject()
1835
- };
1836
- }
1837
- function j(t, e = {}) {
1838
- const s = Object.assign(Object.assign({}, jt), e);
1839
- return D(qt(t, s.partials, !1));
1840
- }
1841
- function q(t, e = {}) {
1842
- const s = Object.assign(Object.assign({}, jt), e);
1843
- return V(qt(t, s.partials, !0));
1844
- }
1845
- class ht {
1846
- constructor(e) {
1847
- this.stack = [{ names: e, aliases: /* @__PURE__ */ new Map() }];
1848
- }
1849
- /** Return true if `name` is in scope. */
1850
- has(e) {
1851
- for (const s of this.stack)
1852
- if (s.names.has(e))
1853
- return !0;
1854
- return !1;
1855
- }
1856
- push(e) {
1857
- return this.stack.push({ names: e, aliases: /* @__PURE__ */ new Map() }), this;
1858
- }
1859
- pop() {
1860
- var e;
1861
- return (e = this.stack.pop()) === null || e === void 0 ? void 0 : e.names;
1862
- }
1863
- // Add a name to the template scope.
1864
- add(e) {
1865
- this.stack[0].names.add(e);
1866
- }
1867
- /** Return the variable that `variable` aliases, or `variable` if it doesn't alias anything. */
1868
- alias(e) {
1869
- const s = e.segments[0];
1870
- if (!d(s))
1871
- return;
1872
- const i = this.getAlias(s);
1873
- if (i !== void 0)
1874
- return new W([...i, ...e.segments.slice(1)], e.location);
1875
- }
1876
- // TODO: `from` could be a path with multiple segments, like `include.x`.
1877
- setAlias(e, s) {
1878
- this.stack[this.stack.length - 1].aliases.set(e, s);
1879
- }
1880
- deleteAlias(e) {
1881
- this.stack[this.stack.length - 1].aliases.delete(e);
1882
- }
1883
- getAlias(e) {
1884
- for (const s of this.stack) {
1885
- if (s.aliases.has(e))
1886
- return s.aliases.get(e);
1887
- if (s.names.has(e))
1888
- return;
1889
- }
1890
- }
1891
- }
1892
- function* ut(t) {
1893
- O(t) ? yield* X(t) : t instanceof F && (yield* Ri(t));
1894
- }
1895
- function* Ri(t) {
1896
- for (const e of t.initial.postfix)
1897
- O(e) && (yield* X(e));
1898
- for (const e of t.filters)
1899
- for (const s of e.args)
1900
- Vt(s) && s[1] ? yield* X(s[1]) : O(s) && (yield* X(s));
1901
- }
1902
- function* X(t) {
1903
- It(t) ? (yield* X(t.lhs), yield* X(t.rhs)) : pe(t) && (yield ze(t));
1904
- }
1905
- function ze(t) {
1906
- const e = [];
1907
- let s = t.file;
1908
- const i = t.props[0];
1909
- s = s || i.file, Ee(i) || dt(i) || pt(i) ? e.push(i.content) : pe(i) && e.push(...ze(i).segments);
1910
- for (const o of t.props.slice(1))
1911
- s = s || o.file, Ee(o) || dt(o) || pt(o) ? e.push(o.content) : pe(o) && e.push(ze(o));
1912
- const [n, r] = t.getPosition();
1913
- return new W(e, {
1914
- row: n,
1915
- col: r,
1916
- file: s
1917
- });
1918
- }
1919
- const ft = /^[\u0080-\uFFFFa-zA-Z_][\u0080-\uFFFFa-zA-Z0-9_-]*$/;
1920
- function de(t, e = !1) {
1921
- const s = [], i = t[0];
1922
- d(i) && (!e || i.match(ft) ? s.push(`${i}`) : s.push(`['${i}']`));
1923
- for (const n of t.slice(1))
1924
- n instanceof W ? s.push(`[${de(n.segments)}]`) : d(n) ? n.match(ft) ? s.push(`.${n}`) : s.push(`['${n}']`) : s.push(`[${n}]`);
1925
- return s.join("");
1926
- }
1927
- var te;
1928
- (function(t) {
1929
- t.Partials = "partials", t.Layouts = "layouts", t.Root = "root";
1930
- })(te || (te = {}));
1931
- class Ai {
1932
- constructor(e) {
1933
- var s, i, n, r;
1934
- if (this.options = e, e.relativeReference) {
1935
- const a = e.fs.sep;
1936
- L(a, "`fs.sep` is required for relative reference");
1937
- const l = ["." + a, ".." + a, "./", "../"];
1938
- this.shouldLoadRelative = (h) => l.some((c) => h.startsWith(c));
1939
- } else
1940
- this.shouldLoadRelative = (a) => !1;
1941
- const o = e.fs;
1942
- this.contains = _e(((s = o.contains) === null || s === void 0 ? void 0 : s.bind(o)) || (() => b(this, void 0, void 0, function* () {
1943
- return !0;
1944
- })), ((i = o.containsSync) === null || i === void 0 ? void 0 : i.bind(o)) || (() => !0)), this.exists = _e(((n = o.exists) === null || n === void 0 ? void 0 : n.bind(o)) || (() => b(this, void 0, void 0, function* () {
1945
- return !1;
1946
- })), (r = o.existsSync) === null || r === void 0 ? void 0 : r.bind(o));
1947
- }
1948
- *lookup(e, s, i, n) {
1949
- const r = this.options[s];
1950
- for (const o of this.candidates(e, r, n)) {
1951
- let a = !1;
1952
- for (const l of r)
1953
- if (yield this.contains(!!i, l, o)) {
1954
- a = !0;
1955
- break;
1956
- }
1957
- if (a && (yield this.exists(!!i, o)))
1958
- return o;
1959
- }
1960
- throw this.lookupError(e, r);
1961
- }
1962
- *candidates(e, s, i) {
1963
- const { fs: n, extname: r } = this.options;
1964
- this.shouldLoadRelative(e) && i && (yield n.resolve(this.dirname(i), e, r));
1965
- for (const o of s)
1966
- yield n.resolve(o, e, r);
1967
- if (n.fallback !== void 0) {
1968
- const o = n.fallback(e);
1969
- o !== void 0 && (yield o);
1970
- }
1971
- }
1972
- dirname(e) {
1973
- const s = this.options.fs;
1974
- return L(s.dirname, "`fs.dirname` is required for relative reference"), s.dirname(e);
1975
- }
1976
- lookupError(e, s) {
1977
- const i = new Error("ENOENT");
1978
- return i.message = `ENOENT: Failed to lookup "${e}" in "${s}"`, i.code = "ENOENT", i;
1979
- }
1980
- }
1981
- class $ {
1982
- constructor(e) {
1983
- var s, i;
1984
- this.liquid = e, this.cache = this.liquid.options.cache, this.fs = this.liquid.options.fs, this.parseFile = this.cache ? this._parseFileCached : this._parseFile, this.loader = new Ai(this.liquid.options), this.parseLimit = new Oe("parse length", e.options.parseLimit), this.readFile = _e(((s = this.fs.readFile) === null || s === void 0 ? void 0 : s.bind(this.fs)) || (() => b(this, void 0, void 0, function* () {
1985
- throw new Error("readFile not implemented");
1986
- })), (i = this.fs.readFileSync) === null || i === void 0 ? void 0 : i.bind(this.fs));
1987
- }
1988
- parse(e, s) {
1989
- e = String(e), this.parseLimit.use(e.length);
1990
- const n = new N(e, this.liquid.options.operators, s).readTopLevelTokens(this.liquid.options);
1991
- return this.parseTokens(n);
1992
- }
1993
- parseTokens(e) {
1994
- let s;
1995
- const i = [], n = [];
1996
- for (; s = e.shift(); )
1997
- try {
1998
- i.push(this.parseToken(s, e));
1999
- } catch (r) {
2000
- if (this.liquid.options.catchAllErrors)
2001
- n.push(r);
2002
- else
2003
- throw r;
2004
- }
2005
- if (n.length)
2006
- throw new _t(n);
2007
- return i;
2008
- }
2009
- parseToken(e, s) {
2010
- try {
2011
- if (J(e)) {
2012
- const i = this.liquid.tags[e.name];
2013
- return L(i, `tag "${e.name}" not found`), new i(e, s, this.liquid, this);
2014
- }
2015
- return Mi(e) ? new zi(e, this.liquid) : new Ei(e);
2016
- } catch (i) {
2017
- throw Z.is(i) ? i : new as(i, e);
2018
- }
2019
- }
2020
- parseStream(e) {
2021
- return new Oi(e, (s, i) => this.parseToken(s, i));
2022
- }
2023
- *_parseFileCached(e, s, i = te.Root, n) {
2024
- const r = this.cache, o = this.loader.shouldLoadRelative(e) ? n + "," + e : i + ":" + e, a = yield r.read(o);
2025
- if (a)
2026
- return a;
2027
- const l = this._parseFile(e, s, i, n), h = s ? yield l : D(l);
2028
- r.write(o, h);
2029
- try {
2030
- return yield h;
2031
- } catch (c) {
2032
- throw r.remove(o), c;
2033
- }
2034
- }
2035
- *_parseFile(e, s, i = te.Root, n) {
2036
- const r = yield this.loader.lookup(e, i, s, n);
2037
- return this.parse(yield this.readFile(!!s, r), r);
2038
- }
2039
- }
2040
- var y;
2041
- (function(t) {
2042
- t[t.Number = 1] = "Number", t[t.Literal = 2] = "Literal", t[t.Tag = 4] = "Tag", t[t.Output = 8] = "Output", t[t.HTML = 16] = "HTML", t[t.Filter = 32] = "Filter", t[t.Hash = 64] = "Hash", t[t.PropertyAccess = 128] = "PropertyAccess", t[t.Word = 256] = "Word", t[t.Range = 512] = "Range", t[t.Quoted = 1024] = "Quoted", t[t.Operator = 2048] = "Operator", t[t.FilteredValue = 4096] = "FilteredValue", t[t.Delimited = 12] = "Delimited";
2043
- })(y || (y = {}));
2044
- function Ni(t) {
2045
- return !!(R(t) & y.Delimited);
2046
- }
2047
- function Pt(t) {
2048
- return R(t) === y.Operator;
2049
- }
2050
- function Ve(t) {
2051
- return R(t) === y.HTML;
2052
- }
2053
- function Mi(t) {
2054
- return R(t) === y.Output;
2055
- }
2056
- function J(t) {
2057
- return R(t) === y.Tag;
2058
- }
2059
- function Ee(t) {
2060
- return R(t) === y.Quoted;
2061
- }
2062
- function dt(t) {
2063
- return R(t) === y.Number;
2064
- }
2065
- function pe(t) {
2066
- return R(t) === y.PropertyAccess;
2067
- }
2068
- function pt(t) {
2069
- return R(t) === y.Word;
2070
- }
2071
- function It(t) {
2072
- return R(t) === y.Range;
2073
- }
2074
- function O(t) {
2075
- return (R(t) & 1667) > 0;
2076
- }
2077
- function R(t) {
2078
- return t ? t.kind : -1;
2079
- }
2080
- function P(t) {
2081
- const e = /* @__PURE__ */ Object.create(null);
2082
- return t && Object.assign(e, t), e;
2083
- }
2084
- class B {
2085
- constructor(e = {}, s = G, i = {}, { memoryLimit: n, renderLimit: r } = {}) {
2086
- var o, a, l, h, c;
2087
- this.scopes = [P()], this.registers = {}, this.breakCalled = !1, this.continueCalled = !1, this.sync = !!i.sync, this.opts = s, this.globals = (o = i.globals) !== null && o !== void 0 ? o : s.globals, this.environments = me(e) ? e : Object(e), this.strictVariables = (a = i.strictVariables) !== null && a !== void 0 ? a : this.opts.strictVariables, this.ownPropertyOnly = (l = i.ownPropertyOnly) !== null && l !== void 0 ? l : s.ownPropertyOnly, this.memoryLimit = n ?? new Oe("memory alloc", (h = i.memoryLimit) !== null && h !== void 0 ? h : s.memoryLimit), this.renderLimit = r ?? new Oe("template render", Fe().now() + ((c = i.renderLimit) !== null && c !== void 0 ? c : s.renderLimit));
2088
- }
2089
- getRegister(e, s = void 0) {
2090
- return this.registers[e] = this.registers[e] || s;
2091
- }
2092
- setRegister(e, s) {
2093
- return this.registers[e] = s;
2094
- }
2095
- saveRegister(...e) {
2096
- return e.map((s) => [s, this.getRegister(s)]);
2097
- }
2098
- restoreRegister(e) {
2099
- return e.forEach(([s, i]) => this.setRegister(s, i));
2100
- }
2101
- getAll() {
2102
- return [this.globals, this.environments, ...this.scopes].reduce((e, s) => fe(e, s), {});
2103
- }
2104
- /**
2105
- * @deprecated use `_get()` or `getSync()` instead
2106
- */
2107
- get(e) {
2108
- return this.getSync(e);
2109
- }
2110
- getSync(e) {
2111
- return V(this._get(e));
2112
- }
2113
- *_get(e) {
2114
- const s = this.findScope(e[0]);
2115
- return yield this._getFromScope(s, e);
2116
- }
2117
- /**
2118
- * @deprecated use `_get()` instead
2119
- */
2120
- getFromScope(e, s) {
2121
- return V(this._getFromScope(e, s));
2122
- }
2123
- *_getFromScope(e, s, i = this.strictVariables) {
2124
- d(s) && (s = s.split("."));
2125
- for (let n = 0; n < s.length; n++)
2126
- if (e = yield this.readProperty(e, s[n]), i && Kt(e))
2127
- throw new hs(s.slice(0, n + 1).join("."));
2128
- return e;
2129
- }
2130
- push(e) {
2131
- return this.scopes.push(e);
2132
- }
2133
- pop() {
2134
- return this.scopes.pop();
2135
- }
2136
- bottom() {
2137
- return this.scopes[0];
2138
- }
2139
- spawn(e = {}) {
2140
- return new B(e, this.opts, {
2141
- sync: this.sync,
2142
- globals: this.globals,
2143
- strictVariables: this.strictVariables,
2144
- ownPropertyOnly: this.ownPropertyOnly
2145
- }, {
2146
- renderLimit: this.renderLimit,
2147
- memoryLimit: this.memoryLimit
2148
- });
2149
- }
2150
- findScope(e) {
2151
- for (let s = this.scopes.length - 1; s >= 0; s--) {
2152
- const i = this.scopes[s];
2153
- if (e in i)
2154
- return i;
2155
- }
2156
- return e in this.environments ? this.environments : this.globals;
2157
- }
2158
- readProperty(e, s) {
2159
- if (e = bt(e), s = g(s), T(e))
2160
- return e;
2161
- if (S(e) && s < 0)
2162
- return e[e.length + +s];
2163
- const i = Di(e, s, this.ownPropertyOnly);
2164
- return i === void 0 && e instanceof Y ? e.liquidMethodMissing(s, this) : x(i) ? i.call(e) : s === "size" ? ji(e) : s === "first" ? Vi(e) : s === "last" ? Ci(e) : i;
2165
- }
2166
- }
2167
- function Di(t, e, s) {
2168
- if (!(s && !Re.call(t, e) && !(t instanceof Y)))
2169
- return t[e];
2170
- }
2171
- function Vi(t) {
2172
- return S(t) ? t[0] : t.first;
2173
- }
2174
- function Ci(t) {
2175
- return S(t) ? t[t.length - 1] : t.last;
2176
- }
2177
- function ji(t) {
2178
- if (Re.call(t, "size") || t.size !== void 0)
2179
- return t.size;
2180
- if (S(t) || d(t))
2181
- return t.length;
2182
- if (typeof t == "object")
2183
- return Object.keys(t).length;
2184
- }
2185
- var H;
2186
- (function(t) {
2187
- t[t.OUTPUT = 0] = "OUTPUT", t[t.STORE = 1] = "STORE";
2188
- })(H || (H = {}));
2189
- const qi = M(Math.abs), Pi = M(Math.max), Ii = M(Math.min), $i = M(Math.ceil), Bi = M((t, e, s = !1) => s ? Math.floor(t / e) : t / e), Ui = M(Math.floor), Hi = M((t, e) => t - e), Wi = M((t, e) => t + e), Yi = M((t, e) => t % e), Zi = M((t, e) => t * e);
2190
- function Ji(t, e = 0) {
2191
- t = Se(t), e = Se(e);
2192
- const s = Math.pow(10, e), i = t * s * (1 + Number.EPSILON);
2193
- return Math.round(i) / s;
2194
- }
2195
- var Qi = /* @__PURE__ */ Object.freeze({
2196
- __proto__: null,
2197
- abs: qi,
2198
- at_least: Pi,
2199
- at_most: Ii,
2200
- ceil: $i,
2201
- divided_by: Bi,
2202
- floor: Ui,
2203
- minus: Hi,
2204
- plus: Wi,
2205
- modulo: Yi,
2206
- times: Zi,
2207
- round: Ji
2208
- });
2209
- const Gi = (t) => decodeURIComponent(u(t)).replace(/\+/g, " "), Xi = (t) => encodeURIComponent(u(t)).replace(/%20/g, "+"), Ki = (t) => encodeURIComponent(u(t)).replace(/%20/g, "+").replace(/[!'()*]/g, (e) => "%" + e.charCodeAt(0).toString(16).toUpperCase()), en = (t) => encodeURI(u(t)).replace(/%5B/g, "[").replace(/%5D/g, "]"), gt = /[^\p{M}\p{L}\p{Nd}]+/ug, tn = {
2210
- raw: /\s+/g,
2211
- default: gt,
2212
- pretty: /[^\p{M}\p{L}\p{Nd}._~!$&'()+,;=@]+/ug,
2213
- ascii: /[^A-Za-z0-9]+/g,
2214
- latin: gt,
2215
- none: null
2216
- };
2217
- function sn(t, e = "default", s = !1) {
2218
- t = u(t);
2219
- const i = tn[e];
2220
- return i && (e === "latin" && (t = nn(t)), t = t.replace(i, "-").replace(/^-|-$/g, "")), s ? t : t.toLowerCase();
2221
- }
2222
- function nn(t) {
2223
- return t.replace(/[àáâãäå]/g, "a").replace(/[æ]/g, "ae").replace(/[ç]/g, "c").replace(/[èéêë]/g, "e").replace(/[ìíîï]/g, "i").replace(/[ð]/g, "d").replace(/[ñ]/g, "n").replace(/[òóôõöø]/g, "o").replace(/[ùúûü]/g, "u").replace(/[ýÿ]/g, "y").replace(/[ß]/g, "ss").replace(/[œ]/g, "oe").replace(/[þ]/g, "th").replace(/[ẞ]/g, "SS").replace(/[Œ]/g, "OE").replace(/[Þ]/g, "TH");
2224
- }
2225
- var rn = /* @__PURE__ */ Object.freeze({
2226
- __proto__: null,
2227
- url_decode: Gi,
2228
- url_encode: Xi,
2229
- cgi_escape: Ki,
2230
- uri_escape: en,
2231
- slugify: sn
2232
- });
2233
- const on = ye(function(t, e) {
2234
- const s = _(t), i = T(e) ? " " : u(e), n = s.length * (1 + i.length);
2235
- return this.context.memoryLimit.use(n), s.join(i);
2236
- }), an = ye((t) => kt(t) ? Tt(t) : ""), ln = ye((t) => kt(t) ? t[0] : ""), cn = ye(function(t) {
2237
- const e = _(t);
2238
- return this.context.memoryLimit.use(e.length), [...e].reverse();
2239
- });
2240
- function* $t(t, e, s) {
2241
- const i = [], n = _(t);
2242
- this.context.memoryLimit.use(n.length);
2243
- for (const r of n)
2244
- i.push([
2245
- r,
2246
- e ? yield this.context._getFromScope(r, u(e).split("."), !1) : r
2247
- ]);
2248
- return i.sort((r, o) => s(r[1], o[1])).map((r) => r[0]);
2249
- }
2250
- function* hn(t, e) {
2251
- return yield* $t.call(this, t, e, ns);
2252
- }
2253
- function* un(t, e) {
2254
- return yield* $t.call(this, t, e, rs);
2255
- }
2256
- const fn = (t) => t && t.length || 0;
2257
- function* dn(t, e) {
2258
- const s = [], i = _(t);
2259
- this.context.memoryLimit.use(i.length);
2260
- for (const n of i)
2261
- s.push(yield this.context._getFromScope(n, u(e), !1));
2262
- return s;
2263
- }
2264
- function* pn(t, e) {
2265
- let s = 0;
2266
- const i = _(t);
2267
- for (const n of i) {
2268
- const r = Number(e ? yield this.context._getFromScope(n, u(e), !1) : n);
2269
- s += Number.isNaN(r) ? 0 : r;
2270
- }
2271
- return s;
2272
- }
2273
- function gn(t) {
2274
- const e = _(t);
2275
- return this.context.memoryLimit.use(e.length), e.filter((s) => !T(g(s)));
2276
- }
2277
- function Bt(t, e = []) {
2278
- const s = _(t), i = _(e);
2279
- return this.context.memoryLimit.use(s.length + i.length), s.concat(i);
2280
- }
2281
- function mn(t, e) {
2282
- return Bt.call(this, t, [e]);
2283
- }
2284
- function yn(t, e) {
2285
- const s = _(t);
2286
- this.context.memoryLimit.use(s.length);
2287
- const i = [...s];
2288
- return i.unshift(e), i;
2289
- }
2290
- function wn(t) {
2291
- const e = _(t);
2292
- this.context.memoryLimit.use(e.length);
2293
- const s = [...e];
2294
- return s.pop(), s;
2295
- }
2296
- function bn(t) {
2297
- const e = _(t);
2298
- this.context.memoryLimit.use(e.length);
2299
- const s = [...e];
2300
- return s.shift(), s;
2301
- }
2302
- function kn(t, e, s = 1) {
2303
- return t = g(t), T(t) ? [] : (S(t) || (t = u(t)), e = e < 0 ? t.length + e : e, this.context.memoryLimit.use(s), t.slice(e, e + s));
2304
- }
2305
- function Ut(t) {
2306
- return this.context.opts.jekyllWhere ? (e) => ee.is(t) ? C(e, t) : S(e) ? ei(e, t) : C(e, t) : t === void 0 ? (e) => U(e, this.context) : (e) => C(e, t);
2307
- }
2308
- function* Ht(t, e, s, i) {
2309
- const n = [];
2310
- e = _(e), this.context.memoryLimit.use(e.length);
2311
- const r = new N(u(s)).readScopeValue();
2312
- for (const a of e)
2313
- n.push(yield v(r, this.context.spawn(a)));
2314
- const o = Ut.call(this, i);
2315
- return e.filter((a, l) => o(n[l]) === t);
2316
- }
2317
- function* Wt(t, e, s, i) {
2318
- const n = [], r = new F(u(i), this.liquid), o = _(e);
2319
- this.context.memoryLimit.use(o.length);
2320
- for (const a of o) {
2321
- this.context.push({ [s]: a });
2322
- const l = yield r.value(this.context);
2323
- this.context.pop(), l === t && n.push(a);
2324
- }
2325
- return n;
2326
- }
2327
- function* Tn(t, e, s) {
2328
- return yield* Ht.call(this, !0, t, e, s);
2329
- }
2330
- function* vn(t, e, s) {
2331
- return yield* Ht.call(this, !1, t, e, s);
2332
- }
2333
- function* xn(t, e, s) {
2334
- return yield* Wt.call(this, !0, t, e, s);
2335
- }
2336
- function* Sn(t, e, s) {
2337
- return yield* Wt.call(this, !1, t, e, s);
2338
- }
2339
- function* _n(t, e) {
2340
- const s = /* @__PURE__ */ new Map();
2341
- t = re(t);
2342
- const i = new N(u(e)).readScopeValue();
2343
- this.context.memoryLimit.use(t.length);
2344
- for (const n of t) {
2345
- const r = yield v(i, this.context.spawn(n));
2346
- s.has(r) || s.set(r, []), s.get(r).push(n);
2347
- }
2348
- return [...s.entries()].map(([n, r]) => ({ name: n, items: r }));
2349
- }
2350
- function* Ln(t, e, s) {
2351
- const i = /* @__PURE__ */ new Map(), n = new F(u(s), this.liquid);
2352
- t = re(t), this.context.memoryLimit.use(t.length);
2353
- for (const r of t) {
2354
- this.context.push({ [e]: r });
2355
- const o = yield n.value(this.context);
2356
- this.context.pop(), i.has(o) || i.set(o, []), i.get(o).push(r);
2357
- }
2358
- return [...i.entries()].map(([r, o]) => ({ name: r, items: o }));
2359
- }
2360
- function* Ce(t, e, s) {
2361
- const i = new N(u(e)).readScopeValue(), n = _(t), r = Ut.call(this, s);
2362
- for (let o = 0; o < n.length; o++) {
2363
- const a = yield v(i, this.context.spawn(n[o]));
2364
- if (r(a))
2365
- return [o, n[o]];
2366
- }
2367
- }
2368
- function* je(t, e, s) {
2369
- const i = new F(u(s), this.liquid), n = _(t);
2370
- for (let r = 0; r < n.length; r++) {
2371
- this.context.push({ [e]: n[r] });
2372
- const o = yield i.value(this.context);
2373
- if (this.context.pop(), o)
2374
- return [r, n[r]];
2375
- }
2376
- }
2377
- function* On(t, e, s) {
2378
- return !!(yield* Ce.call(this, t, e, s));
2379
- }
2380
- function* Fn(t, e, s) {
2381
- return !!(yield* je.call(this, t, e, s));
2382
- }
2383
- function* zn(t, e, s) {
2384
- const i = yield* Ce.call(this, t, e, s);
2385
- return i ? i[0] : void 0;
2386
- }
2387
- function* En(t, e, s) {
2388
- const i = yield* je.call(this, t, e, s);
2389
- return i ? i[0] : void 0;
2390
- }
2391
- function* Rn(t, e, s) {
2392
- const i = yield* Ce.call(this, t, e, s);
2393
- return i ? i[1] : void 0;
2394
- }
2395
- function* An(t, e, s) {
2396
- const i = yield* je.call(this, t, e, s);
2397
- return i ? i[1] : void 0;
2398
- }
2399
- function Nn(t) {
2400
- return t = _(t), this.context.memoryLimit.use(t.length), [...new Set(t)];
2401
- }
2402
- function Mn(t, e = 1) {
2403
- if (t = g(t), T(t))
2404
- return [];
2405
- S(t) || (t = u(t)), this.context.memoryLimit.use(t.length);
2406
- const s = [...t].sort(() => Math.random() - 0.5);
2407
- return e === 1 ? s[0] : s.slice(0, e);
2408
- }
2409
- var Dn = /* @__PURE__ */ Object.freeze({
2410
- __proto__: null,
2411
- join: on,
2412
- last: an,
2413
- first: ln,
2414
- reverse: cn,
2415
- sort: hn,
2416
- sort_natural: un,
2417
- size: fn,
2418
- map: dn,
2419
- sum: pn,
2420
- compact: gn,
2421
- concat: Bt,
2422
- push: mn,
2423
- unshift: yn,
2424
- pop: wn,
2425
- shift: bn,
2426
- slice: kn,
2427
- where: Tn,
2428
- reject: vn,
2429
- where_exp: xn,
2430
- reject_exp: Sn,
2431
- group_by: _n,
2432
- group_by_exp: Ln,
2433
- has: On,
2434
- has_exp: Fn,
2435
- find_index: zn,
2436
- find_index_exp: En,
2437
- find: Rn,
2438
- find_exp: An,
2439
- uniq: Nn,
2440
- sample: Mn
2441
- });
2442
- function qe(t, e, s) {
2443
- var i, n;
2444
- const r = ((i = t == null ? void 0 : t.length) !== null && i !== void 0 ? i : 0) + ((n = s == null ? void 0 : s.length) !== null && n !== void 0 ? n : 0);
2445
- this.context.memoryLimit.use(r);
2446
- const o = Zt(t, this.context.opts, s);
2447
- return o ? (e = g(e), e = T(e) ? this.context.opts.dateFormat : u(e), this.context.memoryLimit.use(e.length), le(o, e, this.context.memoryLimit)) : t;
2448
- }
2449
- function Vn(t) {
2450
- return qe.call(this, t, "%Y-%m-%dT%H:%M:%S%:z");
2451
- }
2452
- function Cn(t) {
2453
- return qe.call(this, t, "%a, %d %b %Y %H:%M:%S %z");
2454
- }
2455
- function jn(t, e, s) {
2456
- return Yt.call(this, t, "%b", e, s);
2457
- }
2458
- function qn(t, e, s) {
2459
- return Yt.call(this, t, "%B", e, s);
2460
- }
2461
- function Yt(t, e, s, i) {
2462
- const n = Zt(t, this.context.opts);
2463
- if (!n)
2464
- return t;
2465
- const r = this.context.memoryLimit;
2466
- if (s === "ordinal") {
2467
- const o = n.getDate();
2468
- return i === "US" ? le(n, `${e} ${o}%q, %Y`, r) : le(n, `${o}%q ${e} %Y`, r);
2469
- }
2470
- return le(n, `%d ${e} %Y`, r);
2471
- }
2472
- function Zt(t, e, s) {
2473
- let i;
2474
- const n = s ?? e.timezoneOffset, r = e.locale;
2475
- if (t = g(t), !T(t))
2476
- return t === "now" || t === "today" ? i = new E(Date.now(), r, n) : ge(t) ? i = new E(t * 1e3, r, n) : d(t) ? /^\d+$/.test(t) ? i = new E(+t * 1e3, r, n) : e.preserveTimezones && s === void 0 ? i = E.createDateFixedToTimezone(t, r) : i = new E(t, r, n) : i = new E(t, r, n), i.valid() ? i : void 0;
2477
- }
2478
- var Pn = /* @__PURE__ */ Object.freeze({
2479
- __proto__: null,
2480
- date: qe,
2481
- date_to_xmlschema: Vn,
2482
- date_to_rfc822: Cn,
2483
- date_to_string: jn,
2484
- date_to_long_string: qn
2485
- });
2486
- const xe = /[\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF]/gu, mt = /[^\u4E00-\u9FFF\uF900-\uFAFF\u3400-\u4DBF\u3040-\u309F\u30A0-\u30FF\uAC00-\uD7AF\s]+/gu;
2487
- function In(t, e) {
2488
- L(arguments.length === 2, "append expect 2 arguments");
2489
- const s = u(t), i = u(e);
2490
- return this.context.memoryLimit.use(s.length + i.length), s + i;
2491
- }
2492
- function $n(t, e) {
2493
- L(arguments.length === 2, "prepend expect 2 arguments");
2494
- const s = u(t), i = u(e);
2495
- return this.context.memoryLimit.use(s.length + i.length), i + s;
2496
- }
2497
- function Bn(t, e) {
2498
- const s = u(t);
2499
- if (this.context.memoryLimit.use(s.length), e) {
2500
- e = u(e), this.context.memoryLimit.use(e.length);
2501
- for (let i = 0, n = new Set(e); i < s.length; i++)
2502
- if (!n.has(s[i]))
2503
- return s.slice(i);
2504
- return "";
2505
- }
2506
- return s.trimStart();
2507
- }
2508
- function Un(t) {
2509
- const e = u(t);
2510
- return this.context.memoryLimit.use(e.length), e.toLowerCase();
2511
- }
2512
- function Hn(t) {
2513
- const e = u(t);
2514
- return this.context.memoryLimit.use(e.length), u(e).toUpperCase();
2515
- }
2516
- function Wn(t, e) {
2517
- const s = u(t);
2518
- return e = u(e), this.context.memoryLimit.use(s.length + e.length), s.split(e).join("");
2519
- }
2520
- function Yn(t, e) {
2521
- const s = u(t);
2522
- return e = u(e), this.context.memoryLimit.use(s.length + e.length), s.replace(e, "");
2523
- }
2524
- function Zn(t, e) {
2525
- const s = u(t), i = u(e);
2526
- this.context.memoryLimit.use(s.length + i.length);
2527
- const n = s.lastIndexOf(i);
2528
- return n === -1 ? s : s.substring(0, n) + s.substring(n + i.length);
2529
- }
2530
- function Jn(t, e) {
2531
- if (t = u(t), this.context.memoryLimit.use(t.length), e) {
2532
- e = u(e), this.context.memoryLimit.use(e.length);
2533
- for (let s = t.length - 1, i = new Set(e); s >= 0; s--)
2534
- if (!i.has(t[s]))
2535
- return t.slice(0, s + 1);
2536
- return "";
2537
- }
2538
- return t.trimEnd();
2539
- }
2540
- function Qn(t, e) {
2541
- const s = u(t);
2542
- this.context.memoryLimit.use(s.length);
2543
- const i = s.split(u(e));
2544
- for (; i.length && i[i.length - 1] === ""; )
2545
- i.pop();
2546
- return i;
2547
- }
2548
- function Gn(t, e) {
2549
- const s = u(t);
2550
- if (this.context.memoryLimit.use(s.length), e) {
2551
- const i = new Set(u(e));
2552
- this.context.memoryLimit.use(i.size);
2553
- let n = 0, r = s.length - 1;
2554
- for (; i.has(s[n]); )
2555
- n++;
2556
- for (; r >= n && i.has(s[r]); )
2557
- r--;
2558
- return s.slice(n, r + 1);
2559
- }
2560
- return s.trim();
2561
- }
2562
- function Xn(t) {
2563
- const e = u(t);
2564
- return this.context.memoryLimit.use(e.length), e.replace(/\r?\n/gm, "");
2565
- }
2566
- function Kn(t) {
2567
- return t = u(t), this.context.memoryLimit.use(t.length), t.charAt(0).toUpperCase() + t.slice(1).toLowerCase();
2568
- }
2569
- function er(t, e, s) {
2570
- const i = u(t);
2571
- e = u(e), s = u(s);
2572
- const n = i.split(e), r = i.length + (n.length - 1) * (s.length - e.length);
2573
- return this.context.memoryLimit.use(r), n.join(s);
2574
- }
2575
- function tr(t, e, s) {
2576
- const i = u(t);
2577
- return e = u(e), s = u(s), this.context.memoryLimit.use(i.length + e.length + s.length), i.replace(e, () => s);
2578
- }
2579
- function sr(t, e, s) {
2580
- const i = u(t), n = u(e), r = u(s);
2581
- this.context.memoryLimit.use(i.length + n.length + r.length);
2582
- const o = i.lastIndexOf(n);
2583
- return o === -1 ? i : i.substring(0, o) + r + i.substring(o + n.length);
2584
- }
2585
- function ir(t, e = 50, s = "...") {
2586
- const i = u(t);
2587
- return s = u(s), this.context.memoryLimit.use(i.length + s.length), i.length <= e ? t : i.substring(0, e - s.length) + s;
2588
- }
2589
- function nr(t, e = 15, s = "...") {
2590
- const i = u(t);
2591
- s = u(s), this.context.memoryLimit.use(i.length + s.length);
2592
- const n = i.split(/\s+/);
2593
- e <= 0 && (e = 1);
2594
- let r = n.slice(0, e).join(" ");
2595
- return n.length >= e && (r += s), r;
2596
- }
2597
- function rr(t) {
2598
- const e = u(t);
2599
- return this.context.memoryLimit.use(e.length), e.replace(/\s+/g, " ");
2600
- }
2601
- function or(t, e) {
2602
- const s = u(t);
2603
- if (this.context.memoryLimit.use(s.length), t = s.trim(), !t)
2604
- return 0;
2605
- switch (e) {
2606
- case "cjk":
2607
- return (t.match(xe) || []).length + (t.match(mt) || []).length;
2608
- case "auto":
2609
- return xe.test(t) ? t.match(xe).length + (t.match(mt) || []).length : t.split(/\s+/).length;
2610
- default:
2611
- return t.split(/\s+/).length;
2612
- }
2613
- }
2614
- function ar(t, e = "and") {
2615
- switch (e = u(e), this.context.memoryLimit.use(t.length + e.length), t.length) {
2616
- case 0:
2617
- return "";
2618
- case 1:
2619
- return t[0];
2620
- case 2:
2621
- return `${t[0]} ${e} ${t[1]}`;
2622
- default:
2623
- return `${t.slice(0, -1).join(", ")}, ${e} ${t[t.length - 1]}`;
2624
- }
2625
- }
2626
- var lr = /* @__PURE__ */ Object.freeze({
2627
- __proto__: null,
2628
- append: In,
2629
- prepend: $n,
2630
- lstrip: Bn,
2631
- downcase: Un,
2632
- upcase: Hn,
2633
- remove: Wn,
2634
- remove_first: Yn,
2635
- remove_last: Zn,
2636
- rstrip: Jn,
2637
- split: Qn,
2638
- strip: Gn,
2639
- strip_newlines: Xn,
2640
- capitalize: Kn,
2641
- replace: er,
2642
- replace_first: tr,
2643
- replace_last: sr,
2644
- truncate: ir,
2645
- truncatewords: nr,
2646
- normalize_whitespace: rr,
2647
- number_of_words: or,
2648
- array_to_sentence_string: ar
2649
- });
2650
- function cr(t) {
2651
- return btoa(String.fromCharCode(...new TextEncoder().encode(t)));
2652
- }
2653
- function hr(t) {
2654
- return new TextDecoder().decode(Uint8Array.from(atob(t), (e) => e.charCodeAt(0)));
2655
- }
2656
- function ur(t) {
2657
- if (typeof Buffer < "u" && Buffer.isBuffer(t))
2658
- return this.context.memoryLimit.use(t.byteLength), t.toString("base64");
2659
- const e = u(t);
2660
- return this.context.memoryLimit.use(e.length), cr(e);
2661
- }
2662
- function fr(t) {
2663
- const e = u(t);
2664
- return this.context.memoryLimit.use(e.length), hr(e);
2665
- }
2666
- var dr = /* @__PURE__ */ Object.freeze({
2667
- __proto__: null,
2668
- base64_encode: ur,
2669
- base64_decode: fr
2670
- });
2671
- function Jt(t) {
2672
- const e = new Uint8Array(t);
2673
- let s = "";
2674
- for (let i = 0; i < e.length; i++)
2675
- s += e[i].toString(16).padStart(2, "0");
2676
- return s;
2677
- }
2678
- function pr(t) {
2679
- return b(this, void 0, void 0, function* () {
2680
- const e = new TextEncoder().encode(t), s = yield crypto.subtle.digest("SHA-256", e);
2681
- return Jt(s);
2682
- });
2683
- }
2684
- function gr(t, e) {
2685
- return b(this, void 0, void 0, function* () {
2686
- const s = new TextEncoder(), i = yield crypto.subtle.importKey("raw", s.encode(e), { name: "HMAC", hash: "SHA-256" }, !1, ["sign"]), n = yield crypto.subtle.sign("HMAC", i, s.encode(t));
2687
- return Jt(n);
2688
- });
2689
- }
2690
- function mr(t) {
2691
- const e = u(t);
2692
- return this.context.memoryLimit.use(e.length), pr(e);
2693
- }
2694
- function yr(t, e) {
2695
- const s = u(t), i = u(e);
2696
- return this.context.memoryLimit.use(s.length + i.length), gr(s, i);
2697
- }
2698
- var wr = /* @__PURE__ */ Object.freeze({
2699
- __proto__: null,
2700
- sha256: mr,
2701
- hmac_sha256: yr
2702
- });
2703
- const br = Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign(Object.assign({}, ki), Qi), rn), Dn), Pn), lr), dr), wr), Dt);
2704
- class kr extends k {
2705
- constructor(e, s, i) {
2706
- super(e, s, i), this.identifier = this.tokenizer.readIdentifier(), this.key = this.identifier.content, this.tokenizer.assert(this.key, "expected variable name"), this.tokenizer.skipBlank(), this.tokenizer.assert(this.tokenizer.peek() === "=", 'expected "="'), this.tokenizer.advance(), this.value = new F(this.tokenizer.readFilteredValue(), this.liquid);
2707
- }
2708
- *render(e) {
2709
- e.bottom()[this.key] = yield this.value.value(e, this.liquid.options.lenientIf);
2710
- }
2711
- *arguments() {
2712
- yield this.value;
2713
- }
2714
- *localScope() {
2715
- yield this.identifier;
2716
- }
2717
- }
2718
- const yt = ["offset", "limit", "reversed"];
2719
- class Tr extends k {
2720
- constructor(e, s, i, n) {
2721
- super(e, s, i);
2722
- const r = this.tokenizer.readIdentifier(), o = this.tokenizer.readIdentifier(), a = this.tokenizer.readValue();
2723
- if (!r.size() || o.content !== "in" || !a)
2724
- throw new Error(`illegal tag: ${e.getText()}`);
2725
- this.variable = r.content, this.collection = a, this.hash = new se(this.tokenizer, i.options.keyValueSeparator), this.templates = [], this.elseTemplates = [];
2726
- let l;
2727
- const h = n.parseStream(s).on("start", () => l = this.templates).on("tag:else", (c) => {
2728
- ue(c.args), l = this.elseTemplates;
2729
- }).on("tag:endfor", (c) => {
2730
- ue(c.args), h.stop();
2731
- }).on("template", (c) => l.push(c)).on("end", () => {
2732
- throw new Error(`tag ${e.getText()} not closed`);
2733
- });
2734
- h.start();
2735
- }
2736
- *render(e, s) {
2737
- const i = this.liquid.renderer;
2738
- let n = re(yield v(this.collection, e));
2739
- if (!n.length) {
2740
- yield i.renderTemplates(this.elseTemplates, e, s);
2741
- return;
2742
- }
2743
- const r = "continue-" + this.variable + "-" + this.collection.getText();
2744
- e.push(P({ continue: e.getRegister(r, {}) }));
2745
- const o = yield this.hash.render(e);
2746
- e.pop(), n = (this.liquid.options.orderedFilterParameters ? Object.keys(o).filter((h) => yt.includes(h)) : yt.filter((h) => o[h] !== void 0)).reduce((h, c) => c === "offset" ? xr(h, o.offset) : c === "limit" ? Sr(h, o.limit) : vr(h), n), e.setRegister(r, (o.offset || 0) + n.length);
2747
- const l = P({ forloop: new Ne(n.length, this.collection.getText(), this.variable) });
2748
- e.push(l);
2749
- for (const h of n) {
2750
- if (l[this.variable] = h, e.continueCalled = e.breakCalled = !1, yield i.renderTemplates(this.templates, e, s), e.breakCalled)
2751
- break;
2752
- l.forloop.next();
2753
- }
2754
- e.continueCalled = e.breakCalled = !1, e.pop();
2755
- }
2756
- *children() {
2757
- const e = this.templates.slice();
2758
- return this.elseTemplates && e.push(...this.elseTemplates), e;
2759
- }
2760
- *arguments() {
2761
- yield this.collection;
2762
- for (const e of Object.values(this.hash.hash))
2763
- O(e) && (yield e);
2764
- }
2765
- blockScope() {
2766
- return [this.variable, "forloop"];
2767
- }
2768
- }
2769
- function vr(t) {
2770
- return [...t].reverse();
2771
- }
2772
- function xr(t, e) {
2773
- return t.slice(e);
2774
- }
2775
- function Sr(t, e) {
2776
- return t.slice(0, e);
2777
- }
2778
- class _r extends k {
2779
- constructor(e, s, i, n) {
2780
- for (super(e, s, i), this.templates = [], this.identifier = this.readVariable(), this.variable = this.identifier.content; s.length; ) {
2781
- const r = s.shift();
2782
- if (J(r) && r.name === "endcapture")
2783
- return;
2784
- this.templates.push(n.parseToken(r, s));
2785
- }
2786
- throw new Error(`tag ${e.getText()} not closed`);
2787
- }
2788
- readVariable() {
2789
- let e = this.tokenizer.readIdentifier();
2790
- if (e.content || (e = this.tokenizer.readQuoted(), e))
2791
- return e;
2792
- throw this.tokenizer.error("invalid capture name");
2793
- }
2794
- *render(e) {
2795
- const i = yield this.liquid.renderer.renderTemplates(this.templates, e);
2796
- e.bottom()[this.variable] = i;
2797
- }
2798
- *children() {
2799
- return this.templates;
2800
- }
2801
- *localScope() {
2802
- yield this.identifier;
2803
- }
2804
- }
2805
- class Lr extends k {
2806
- constructor(e, s, i, n) {
2807
- super(e, s, i), this.branches = [], this.elseTemplates = [], this.value = new F(this.tokenizer.readFilteredValue(), this.liquid), this.elseTemplates = [];
2808
- let r = [], o = 0;
2809
- const a = n.parseStream(s).on("tag:when", (l) => {
2810
- if (o > 0)
2811
- return;
2812
- r = [];
2813
- const h = [];
2814
- for (; !l.tokenizer.end(); )
2815
- h.push(l.tokenizer.readValueOrThrow()), l.tokenizer.skipBlank(), l.tokenizer.peek() === "," ? l.tokenizer.readTo(",") : l.tokenizer.readTo("or");
2816
- this.branches.push({
2817
- values: h,
2818
- templates: r
2819
- });
2820
- }).on("tag:else", () => {
2821
- o++, r = this.elseTemplates;
2822
- }).on("tag:endcase", () => a.stop()).on("template", (l) => {
2823
- (r !== this.elseTemplates || o === 1) && r.push(l);
2824
- }).on("end", () => {
2825
- throw new Error(`tag ${e.getText()} not closed`);
2826
- });
2827
- a.start();
2828
- }
2829
- *render(e, s) {
2830
- const i = this.liquid.renderer, n = g(yield this.value.value(e, e.opts.lenientIf));
2831
- let r = !1;
2832
- for (const o of this.branches)
2833
- for (const a of o.values) {
2834
- const l = yield v(a, e, e.opts.lenientIf);
2835
- if (C(n, l)) {
2836
- yield i.renderTemplates(o.templates, e, s), r = !0;
2837
- break;
2838
- }
2839
- }
2840
- r || (yield i.renderTemplates(this.elseTemplates, e, s));
2841
- }
2842
- *arguments() {
2843
- yield this.value, yield* this.branches.flatMap((e) => e.values);
2844
- }
2845
- *children() {
2846
- const e = this.branches.flatMap((s) => s.templates);
2847
- return this.elseTemplates && e.push(...this.elseTemplates), e;
2848
- }
2849
- }
2850
- class Or extends k {
2851
- constructor(e, s, i) {
2852
- for (super(e, s, i); s.length; ) {
2853
- const n = s.shift();
2854
- if (J(n) && n.name === "endcomment")
2855
- return;
2856
- }
2857
- throw new Error(`tag ${e.getText()} not closed`);
2858
- }
2859
- render() {
2860
- }
2861
- }
2862
- class Fr extends k {
2863
- constructor(e, s, i, n) {
2864
- super(e, s, i);
2865
- const r = this.tokenizer;
2866
- for (this.file = Pe(r, this.liquid, n), this.currentFile = e.file; !r.end(); ) {
2867
- r.skipBlank();
2868
- const o = r.p, a = r.readIdentifier();
2869
- if ((a.content === "with" || a.content === "for") && (r.skipBlank(), r.peek() !== ":")) {
2870
- const l = r.readValue();
2871
- if (l) {
2872
- const h = r.p, c = r.readIdentifier();
2873
- let f;
2874
- c.content === "as" ? f = r.readIdentifier() : r.p = h;
2875
- const p = { value: l, alias: f && f.content };
2876
- a.content === "with" ? this.with = p : this.forBinding = p, r.skipBlank(), r.peek() === "," && r.advance();
2877
- continue;
2878
- }
2879
- }
2880
- r.p = o;
2881
- break;
2882
- }
2883
- this.hash = new se(r, i.options.keyValueSeparator);
2884
- }
2885
- *render(e, s) {
2886
- const { liquid: i, hash: n } = this, r = yield Ie(this.file, e, i);
2887
- L(r, () => `illegal file path "${r}"`);
2888
- const o = e.spawn(), a = o.bottom();
2889
- if (fe(a, yield n.render(e)), this.with) {
2890
- const { value: l, alias: h } = this.with;
2891
- a[h || r] = yield v(l, e);
2892
- }
2893
- if (this.forBinding) {
2894
- const { value: l, alias: h } = this.forBinding, c = re(yield v(l, e));
2895
- a.forloop = new Ne(c.length, l.getText(), h);
2896
- for (const f of c) {
2897
- a[h] = f;
2898
- const p = yield i._parsePartialFile(r, o.sync, this.currentFile);
2899
- yield i.renderer.renderTemplates(p, o, s), a.forloop.next();
2900
- }
2901
- } else {
2902
- const l = yield i._parsePartialFile(r, o.sync, this.currentFile);
2903
- yield i.renderer.renderTemplates(l, o, s);
2904
- }
2905
- }
2906
- *children(e, s) {
2907
- return e && d(this.file) ? yield this.liquid._parsePartialFile(this.file, s, this.currentFile) : [];
2908
- }
2909
- partialScope() {
2910
- if (d(this.file)) {
2911
- const e = Object.keys(this.hash.hash);
2912
- if (this.with) {
2913
- const { value: s, alias: i } = this.with;
2914
- d(i) ? e.push([i, s]) : d(this.file) && e.push([this.file, s]);
2915
- }
2916
- if (this.forBinding) {
2917
- const { value: s, alias: i } = this.forBinding;
2918
- d(i) ? e.push([i, s]) : d(this.file) && e.push([this.file, s]);
2919
- }
2920
- return { name: this.file, isolated: !0, scope: e };
2921
- }
2922
- }
2923
- *arguments() {
2924
- for (const e of Object.values(this.hash.hash))
2925
- O(e) && (yield e);
2926
- if (this.with) {
2927
- const { value: e } = this.with;
2928
- O(e) && (yield e);
2929
- }
2930
- if (this.forBinding) {
2931
- const { value: e } = this.forBinding;
2932
- O(e) && (yield e);
2933
- }
2934
- }
2935
- }
2936
- function Pe(t, e, s) {
2937
- if (e.options.dynamicPartials) {
2938
- const r = t.readValue();
2939
- if (t.assert(r, "illegal file path"), r.getText() === "none")
2940
- return;
2941
- if (Ee(r)) {
2942
- const o = s.parse(Js(r));
2943
- return wt(o);
2944
- }
2945
- return r;
2946
- }
2947
- const i = [...t.readFileNameTemplate(e.options)], n = wt(s.parseTokens(i));
2948
- return n === "none" ? void 0 : n;
2949
- }
2950
- function wt(t) {
2951
- return t.length === 1 && Ve(t[0].token) ? t[0].token.getContent() : t;
2952
- }
2953
- function* Ie(t, e, s) {
2954
- return typeof t == "string" ? t : Array.isArray(t) ? s.renderer.renderTemplates(t, e) : yield v(t, e);
2955
- }
2956
- class zr extends k {
2957
- constructor(e, s, i, n) {
2958
- super(e, s, i);
2959
- const { tokenizer: r } = e;
2960
- this.file = Pe(r, this.liquid, n), this.currentFile = e.file;
2961
- const o = r.p;
2962
- r.readIdentifier().content === "with" ? (r.skipBlank(), r.peek() !== ":" ? this.withVar = r.readValue() : r.p = o) : r.p = o, this.hash = new se(r, i.options.jekyllInclude || i.options.keyValueSeparator);
2963
- }
2964
- *render(e, s) {
2965
- const { liquid: i, hash: n, withVar: r } = this, { renderer: o } = i, a = yield Ie(this.file, e, i);
2966
- L(a, () => `illegal file path "${a}"`);
2967
- const l = e.saveRegister("blocks", "blockMode");
2968
- e.setRegister("blocks", {}), e.setRegister("blockMode", H.OUTPUT);
2969
- const h = P(yield n.render(e));
2970
- r && (h[a] = yield v(r, e));
2971
- const c = yield i._parsePartialFile(a, e.sync, this.currentFile);
2972
- e.push(e.opts.jekyllInclude ? P({ include: h }) : h), yield o.renderTemplates(c, e, s), e.pop(), e.restoreRegister(l);
2973
- }
2974
- *children(e, s) {
2975
- return e && d(this.file) ? yield this.liquid._parsePartialFile(this.file, s, this.currentFile) : [];
2976
- }
2977
- partialScope() {
2978
- if (d(this.file)) {
2979
- let e;
2980
- return this.liquid.options.jekyllInclude ? e = ["include"] : (e = Object.keys(this.hash.hash), this.withVar && e.push([this.file, this.withVar])), { name: this.file, isolated: !1, scope: e };
2981
- }
2982
- }
2983
- *arguments() {
2984
- yield* Object.values(this.hash.hash).filter(O), O(this.file) && (yield this.file), O(this.withVar) && (yield this.withVar);
2985
- }
2986
- }
2987
- class Er extends k {
2988
- constructor(e, s, i) {
2989
- super(e, s, i), this.identifier = this.tokenizer.readIdentifier(), this.variable = this.identifier.content;
2990
- }
2991
- render(e, s) {
2992
- const i = e.environments;
2993
- ge(i[this.variable]) || (i[this.variable] = 0), s.write(u(--i[this.variable]));
2994
- }
2995
- *localScope() {
2996
- yield this.identifier;
2997
- }
2998
- }
2999
- class Rr extends k {
3000
- constructor(e, s, i) {
3001
- super(e, s, i), this.candidates = [];
3002
- const n = this.tokenizer.readValue();
3003
- for (this.tokenizer.skipBlank(), n && (this.tokenizer.peek() === ":" ? (this.group = n, this.tokenizer.advance()) : this.candidates.push(n)); !this.tokenizer.end(); ) {
3004
- const r = this.tokenizer.readValue();
3005
- r && this.candidates.push(r), this.tokenizer.readTo(",");
3006
- }
3007
- this.tokenizer.assert(this.candidates.length, () => `empty candidates: "${e.getText()}"`);
3008
- }
3009
- *render(e, s) {
3010
- const n = `cycle:${yield v(this.group, e)}:` + this.candidates.join(","), r = e.getRegister("cycle", {});
3011
- let o = r[n];
3012
- o === void 0 && (o = r[n] = 0);
3013
- const a = this.candidates[o];
3014
- return o = (o + 1) % this.candidates.length, r[n] = o, yield v(a, e);
3015
- }
3016
- *arguments() {
3017
- yield* this.candidates, this.group && (yield this.group);
3018
- }
3019
- }
3020
- class Ar extends k {
3021
- constructor(e, s, i, n) {
3022
- super(e, s, i), this.branches = [];
3023
- let r = [];
3024
- n.parseStream(s).on("start", () => this.branches.push({
3025
- value: new F(e.tokenizer.readFilteredValue(), this.liquid),
3026
- templates: r = []
3027
- })).on("tag:elsif", (o) => {
3028
- L(!this.elseTemplates, "unexpected elsif after else"), this.branches.push({
3029
- value: new F(o.tokenizer.readFilteredValue(), this.liquid),
3030
- templates: r = []
3031
- });
3032
- }).on("tag:else", (o) => {
3033
- ue(o.args), L(!this.elseTemplates, "duplicated else"), r = this.elseTemplates = [];
3034
- }).on("tag:endif", function(o) {
3035
- ue(o.args), this.stop();
3036
- }).on("template", (o) => r.push(o)).on("end", () => {
3037
- throw new Error(`tag ${e.getText()} not closed`);
3038
- }).start();
3039
- }
3040
- *render(e, s) {
3041
- const i = this.liquid.renderer;
3042
- for (const { value: n, templates: r } of this.branches) {
3043
- const o = yield n.value(e, e.opts.lenientIf);
3044
- if (U(o, e)) {
3045
- yield i.renderTemplates(r, e, s);
3046
- return;
3047
- }
3048
- }
3049
- yield i.renderTemplates(this.elseTemplates || [], e, s);
3050
- }
3051
- *children() {
3052
- const e = this.branches.flatMap((s) => s.templates);
3053
- return this.elseTemplates && e.push(...this.elseTemplates), e;
3054
- }
3055
- arguments() {
3056
- return this.branches.map((e) => e.value);
3057
- }
3058
- }
3059
- class Nr extends k {
3060
- constructor(e, s, i) {
3061
- super(e, s, i), this.identifier = this.tokenizer.readIdentifier(), this.variable = this.identifier.content;
3062
- }
3063
- render(e, s) {
3064
- const i = e.environments;
3065
- ge(i[this.variable]) || (i[this.variable] = 0);
3066
- const n = i[this.variable];
3067
- i[this.variable]++, s.write(u(n));
3068
- }
3069
- *localScope() {
3070
- yield this.identifier;
3071
- }
3072
- }
3073
- class Mr extends k {
3074
- constructor(e, s, i, n) {
3075
- super(e, s, i), this.file = Pe(this.tokenizer, this.liquid, n), this.currentFile = e.file, this.args = new se(this.tokenizer, i.options.keyValueSeparator), this.templates = n.parseTokens(s);
3076
- }
3077
- *render(e, s) {
3078
- const { liquid: i, args: n, file: r } = this, { renderer: o } = i;
3079
- if (r === void 0) {
3080
- e.setRegister("blockMode", H.OUTPUT), yield o.renderTemplates(this.templates, e, s);
3081
- return;
3082
- }
3083
- const a = yield Ie(this.file, e, i);
3084
- L(a, () => `illegal file path "${a}"`);
3085
- const l = yield i._parseLayoutFile(a, e.sync, this.currentFile);
3086
- e.setRegister("blockMode", H.STORE);
3087
- const h = yield o.renderTemplates(this.templates, e), c = e.getRegister("blocks", {});
3088
- c[""] === void 0 && (c[""] = (f, p) => p.write(h)), e.setRegister("blockMode", H.OUTPUT), e.push(P(yield n.render(e))), yield o.renderTemplates(l, e, s), e.pop();
3089
- }
3090
- *children(e) {
3091
- const s = this.templates.slice();
3092
- return e && d(this.file) && s.push(...yield this.liquid._parsePartialFile(this.file, !0, this.currentFile)), s;
3093
- }
3094
- *arguments() {
3095
- for (const e of Object.values(this.args.hash))
3096
- O(e) && (yield e);
3097
- O(this.file) && (yield this.file);
3098
- }
3099
- partialScope() {
3100
- if (d(this.file))
3101
- return { name: this.file, isolated: !1, scope: Object.keys(this.args.hash) };
3102
- }
3103
- }
3104
- class Dr extends k {
3105
- constructor(e, s, i, n) {
3106
- super(e, s, i), this.templates = [];
3107
- const r = /\w+/.exec(e.args);
3108
- for (this.block = r ? r[0] : ""; s.length; ) {
3109
- const o = s.shift();
3110
- if (J(o) && o.name === "endblock")
3111
- return;
3112
- const a = n.parseToken(o, s);
3113
- this.templates.push(a);
3114
- }
3115
- throw new Error(`tag ${e.getText()} not closed`);
3116
- }
3117
- *render(e, s) {
3118
- const i = this.getBlockRender(e);
3119
- e.getRegister("blockMode") === H.STORE ? e.getRegister("blocks", {})[this.block] = i : yield i(new Je(), s);
3120
- }
3121
- getBlockRender(e) {
3122
- const s = this, { liquid: i, templates: n } = this, r = e.getRegister("blocks", {})[this.block], o = function* (a, l) {
3123
- const h = e.getRegister("blockStack", []);
3124
- if (h.includes(s))
3125
- throw new Error("block tag cannot be nested");
3126
- h.push(s), e.push(P({ block: a })), yield i.renderer.renderTemplates(n, e, l), e.pop(), h.pop();
3127
- };
3128
- return r ? (a, l) => r(new Je((h) => o(a, h)), l) : o;
3129
- }
3130
- *children() {
3131
- return this.templates;
3132
- }
3133
- blockScope() {
3134
- return ["block"];
3135
- }
3136
- }
3137
- class Vr extends k {
3138
- constructor(e, s, i) {
3139
- for (super(e, s, i), this.tokens = []; s.length; ) {
3140
- const n = s.shift();
3141
- if (J(n) && n.name === "endraw")
3142
- return;
3143
- this.tokens.push(n);
3144
- }
3145
- throw new Error(`tag ${e.getText()} not closed`);
3146
- }
3147
- render() {
3148
- return this.tokens.map((e) => e.getText()).join("");
3149
- }
3150
- }
3151
- class Cr extends Ne {
3152
- constructor(e, s, i, n) {
3153
- super(e, i, n), this.length = e, this.cols = s;
3154
- }
3155
- row() {
3156
- return Math.floor(this.i / this.cols) + 1;
3157
- }
3158
- col0() {
3159
- return this.i % this.cols;
3160
- }
3161
- col() {
3162
- return this.col0() + 1;
3163
- }
3164
- col_first() {
3165
- return this.col0() === 0;
3166
- }
3167
- col_last() {
3168
- return this.col() === this.cols;
3169
- }
3170
- }
3171
- class jr extends k {
3172
- constructor(e, s, i, n) {
3173
- super(e, s, i);
3174
- const r = this.tokenizer.readIdentifier();
3175
- this.tokenizer.skipBlank();
3176
- const o = this.tokenizer.readIdentifier(), a = this.tokenizer.readValue();
3177
- if (o.content !== "in" || !a)
3178
- throw new Error(`illegal tag: ${e.getText()}`);
3179
- this.variable = r.content, this.collection = a, this.args = new se(this.tokenizer, i.options.keyValueSeparator), this.templates = [];
3180
- let l;
3181
- const h = n.parseStream(s).on("start", () => l = this.templates).on("tag:endtablerow", () => h.stop()).on("template", (c) => l.push(c)).on("end", () => {
3182
- throw new Error(`tag ${e.getText()} not closed`);
3183
- });
3184
- h.start();
3185
- }
3186
- *render(e, s) {
3187
- let i = re(yield v(this.collection, e));
3188
- const n = yield this.args.render(e), r = n.offset || 0, o = n.limit === void 0 ? i.length : n.limit;
3189
- i = i.slice(r, r + o);
3190
- const a = n.cols || i.length, l = this.liquid.renderer, h = new Cr(i.length, a, this.collection.getText(), this.variable), c = P({ tablerowloop: h });
3191
- e.push(c);
3192
- for (let f = 0; f < i.length; f++, h.next())
3193
- c[this.variable] = i[f], h.col0() === 0 && (h.row() !== 1 && s.write("</tr>"), s.write(`<tr class="row${h.row()}">`)), s.write(`<td class="col${h.col()}">`), yield l.renderTemplates(this.templates, e, s), s.write("</td>");
3194
- i.length && s.write("</tr>"), e.pop();
3195
- }
3196
- *children() {
3197
- return this.templates;
3198
- }
3199
- *arguments() {
3200
- yield this.collection;
3201
- for (const e of Object.values(this.args.hash))
3202
- O(e) && (yield e);
3203
- }
3204
- blockScope() {
3205
- return [this.variable, "tablerowloop"];
3206
- }
3207
- }
3208
- class qr extends k {
3209
- constructor(e, s, i, n) {
3210
- super(e, s, i), this.branches = [], this.elseTemplates = [];
3211
- let r = [], o = 0;
3212
- n.parseStream(s).on("start", () => this.branches.push({
3213
- value: new F(e.tokenizer.readFilteredValue(), this.liquid),
3214
- test: we,
3215
- templates: r = []
3216
- })).on("tag:elsif", (a) => {
3217
- if (o > 0) {
3218
- r = [];
3219
- return;
3220
- }
3221
- this.branches.push({
3222
- value: new F(a.tokenizer.readFilteredValue(), this.liquid),
3223
- test: U,
3224
- templates: r = []
3225
- });
3226
- }).on("tag:else", () => {
3227
- o++, r = this.elseTemplates;
3228
- }).on("tag:endunless", function() {
3229
- this.stop();
3230
- }).on("template", (a) => {
3231
- (r !== this.elseTemplates || o === 1) && r.push(a);
3232
- }).on("end", () => {
3233
- throw new Error(`tag ${e.getText()} not closed`);
3234
- }).start();
3235
- }
3236
- *render(e, s) {
3237
- const i = this.liquid.renderer;
3238
- for (const { value: n, test: r, templates: o } of this.branches) {
3239
- const a = yield n.value(e, e.opts.lenientIf);
3240
- if (r(a, e)) {
3241
- yield i.renderTemplates(o, e, s);
3242
- return;
3243
- }
3244
- }
3245
- yield i.renderTemplates(this.elseTemplates, e, s);
3246
- }
3247
- *children() {
3248
- const e = this.branches.flatMap((s) => s.templates);
3249
- return this.elseTemplates && e.push(...this.elseTemplates), e;
3250
- }
3251
- arguments() {
3252
- return this.branches.map((e) => e.value);
3253
- }
3254
- }
3255
- class Pr extends k {
3256
- render(e, s) {
3257
- e.breakCalled = !0;
3258
- }
3259
- }
3260
- class Ir extends k {
3261
- render(e, s) {
3262
- e.continueCalled = !0;
3263
- }
3264
- }
3265
- class $r extends k {
3266
- constructor(e, s, i) {
3267
- super(e, s, i), this.tokenizer.skipBlank(), this.tokenizer.end() || (this.value = new F(this.tokenizer.readFilteredValue(), this.liquid));
3268
- }
3269
- *render(e, s) {
3270
- if (!this.value)
3271
- return;
3272
- const i = yield this.value.value(e, !1);
3273
- s.write(i);
3274
- }
3275
- *arguments() {
3276
- this.value && (yield this.value);
3277
- }
3278
- }
3279
- class Br extends k {
3280
- constructor(e, s, i, n) {
3281
- super(e, s, i);
3282
- const r = this.tokenizer.readLiquidTagTokens(this.liquid.options);
3283
- this.templates = n.parseTokens(r);
3284
- }
3285
- *render(e, s) {
3286
- yield this.liquid.renderer.renderTemplates(this.templates, e, s);
3287
- }
3288
- *children() {
3289
- return this.templates;
3290
- }
3291
- }
3292
- class Ur extends k {
3293
- constructor(e, s, i) {
3294
- if (super(e, s, i), e.args.search(/\n\s*[^#\s]/g) !== -1)
3295
- throw new Error("every line of an inline comment must start with a '#' character");
3296
- }
3297
- render() {
3298
- }
3299
- }
3300
- const Hr = {
3301
- assign: kr,
3302
- for: Tr,
3303
- capture: _r,
3304
- case: Lr,
3305
- comment: Or,
3306
- include: zr,
3307
- render: Fr,
3308
- decrement: Er,
3309
- increment: Nr,
3310
- cycle: Rr,
3311
- if: Ar,
3312
- layout: Mr,
3313
- block: Dr,
3314
- raw: Vr,
3315
- tablerow: jr,
3316
- unless: qr,
3317
- break: Pr,
3318
- continue: Ir,
3319
- echo: $r,
3320
- liquid: Br,
3321
- "#": Ur
3322
- };
3323
- class $e {
3324
- constructor(e = {}) {
3325
- this.renderer = new Ws(), this.filters = /* @__PURE__ */ Object.create(null), this.tags = /* @__PURE__ */ Object.create(null), this.options = vi(e), this.parser = new $(this), We(Hr, (s, i) => this.registerTag(i, s)), We(br, (s, i) => this.registerFilter(i, s));
3326
- }
3327
- parse(e, s) {
3328
- return new $(this).parse(e, s);
3329
- }
3330
- _render(e, s, i) {
3331
- const n = s instanceof B ? s : new B(s, this.options, i);
3332
- return this.renderer.renderTemplates(e, n);
3333
- }
3334
- render(e, s, i) {
3335
- return b(this, void 0, void 0, function* () {
3336
- return D(this._render(e, s, Object.assign(Object.assign({}, i), { sync: !1 })));
3337
- });
3338
- }
3339
- renderSync(e, s, i) {
3340
- return V(this._render(e, s, Object.assign(Object.assign({}, i), { sync: !0 })));
3341
- }
3342
- renderToNodeStream(e, s, i = {}) {
3343
- const n = new B(s, this.options, i);
3344
- return this.renderer.renderTemplatesToNodeStream(e, n);
3345
- }
3346
- _parseAndRender(e, s, i) {
3347
- const n = this.parse(e);
3348
- return this._render(n, s, i);
3349
- }
3350
- parseAndRender(e, s, i) {
3351
- return b(this, void 0, void 0, function* () {
3352
- return D(this._parseAndRender(e, s, Object.assign(Object.assign({}, i), { sync: !1 })));
3353
- });
3354
- }
3355
- parseAndRenderSync(e, s, i) {
3356
- return V(this._parseAndRender(e, s, Object.assign(Object.assign({}, i), { sync: !0 })));
3357
- }
3358
- _parsePartialFile(e, s, i) {
3359
- return new $(this).parseFile(e, s, te.Partials, i);
3360
- }
3361
- _parseLayoutFile(e, s, i) {
3362
- return new $(this).parseFile(e, s, te.Layouts, i);
3363
- }
3364
- _parseFile(e, s, i, n) {
3365
- return new $(this).parseFile(e, s, i, n);
3366
- }
3367
- parseFile(e, s) {
3368
- return b(this, void 0, void 0, function* () {
3369
- return D(new $(this).parseFile(e, !1, s));
3370
- });
3371
- }
3372
- parseFileSync(e, s) {
3373
- return V(new $(this).parseFile(e, !0, s));
3374
- }
3375
- *_renderFile(e, s, i) {
3376
- const n = yield this._parseFile(e, i.sync, i.lookupType);
3377
- return yield this._render(n, s, i);
3378
- }
3379
- renderFile(e, s, i) {
3380
- return b(this, void 0, void 0, function* () {
3381
- return D(this._renderFile(e, s, Object.assign(Object.assign({}, i), { sync: !1 })));
3382
- });
3383
- }
3384
- renderFileSync(e, s, i) {
3385
- return V(this._renderFile(e, s, Object.assign(Object.assign({}, i), { sync: !0 })));
3386
- }
3387
- renderFileToNodeStream(e, s, i) {
3388
- return b(this, void 0, void 0, function* () {
3389
- const n = yield this.parseFile(e);
3390
- return this.renderToNodeStream(n, s, i);
3391
- });
3392
- }
3393
- _evalValue(e, s) {
3394
- const i = new F(e, this), n = s instanceof B ? s : new B(s, this.options);
3395
- return i.value(n);
3396
- }
3397
- evalValue(e, s) {
3398
- return b(this, void 0, void 0, function* () {
3399
- return D(this._evalValue(e, s));
3400
- });
3401
- }
3402
- evalValueSync(e, s) {
3403
- return V(this._evalValue(e, s));
3404
- }
3405
- registerFilter(e, s) {
3406
- this.filters[e] = s;
3407
- }
3408
- registerTag(e, s) {
3409
- this.tags[e] = x(s) ? s : Fi(s);
3410
- }
3411
- plugin(e) {
3412
- return e.call(this, $e);
3413
- }
3414
- express() {
3415
- const e = this;
3416
- let s = !0;
3417
- return function(i, n, r) {
3418
- if (s) {
3419
- s = !1;
3420
- const o = ce(this.root);
3421
- e.options.root.unshift(...o), e.options.layouts.unshift(...o), e.options.partials.unshift(...o);
3422
- }
3423
- e.renderFile(i, n).then((o) => r(null, o), r);
3424
- };
3425
- }
3426
- analyze(e, s = {}) {
3427
- return b(this, void 0, void 0, function* () {
3428
- return j(e, s);
3429
- });
3430
- }
3431
- analyzeSync(e, s = {}) {
3432
- return q(e, s);
3433
- }
3434
- parseAndAnalyze(e, s, i = {}) {
3435
- return b(this, void 0, void 0, function* () {
3436
- return j(this.parse(e, s), i);
3437
- });
3438
- }
3439
- parseAndAnalyzeSync(e, s, i = {}) {
3440
- return q(this.parse(e, s), i);
3441
- }
3442
- /** Return an array of all variables without their properties. */
3443
- variables(e, s = {}) {
3444
- return b(this, void 0, void 0, function* () {
3445
- const i = yield j(d(e) ? this.parse(e) : e, s);
3446
- return Object.keys(i.variables);
3447
- });
3448
- }
3449
- /** Return an array of all variables without their properties. */
3450
- variablesSync(e, s = {}) {
3451
- const i = q(d(e) ? this.parse(e) : e, s);
3452
- return Object.keys(i.variables);
3453
- }
3454
- /** Return an array of all variables including their properties/paths. */
3455
- fullVariables(e, s = {}) {
3456
- return b(this, void 0, void 0, function* () {
3457
- const i = yield j(d(e) ? this.parse(e) : e, s);
3458
- return Array.from(new Set(Object.values(i.variables).flatMap((n) => n.map((r) => String(r)))));
3459
- });
3460
- }
3461
- /** Return an array of all variables including their properties/paths. */
3462
- fullVariablesSync(e, s = {}) {
3463
- const i = q(d(e) ? this.parse(e) : e, s);
3464
- return Array.from(new Set(Object.values(i.variables).flatMap((n) => n.map((r) => String(r)))));
3465
- }
3466
- /** Return an array of all variables, each as an array of properties/segments. */
3467
- variableSegments(e, s = {}) {
3468
- return b(this, void 0, void 0, function* () {
3469
- const i = yield j(d(e) ? this.parse(e) : e, s);
3470
- return Array.from(oe(Object.values(i.variables).flatMap((n) => n.map((r) => r.toArray()))));
3471
- });
3472
- }
3473
- /** Return an array of all variables, each as an array of properties/segments. */
3474
- variableSegmentsSync(e, s = {}) {
3475
- const i = q(d(e) ? this.parse(e) : e, s);
3476
- return Array.from(oe(Object.values(i.variables).flatMap((n) => n.map((r) => r.toArray()))));
3477
- }
3478
- /** Return an array of all expected context variables without their properties. */
3479
- globalVariables(e, s = {}) {
3480
- return b(this, void 0, void 0, function* () {
3481
- const i = yield j(d(e) ? this.parse(e) : e, s);
3482
- return Object.keys(i.globals);
3483
- });
3484
- }
3485
- /** Return an array of all expected context variables without their properties. */
3486
- globalVariablesSync(e, s = {}) {
3487
- const i = q(d(e) ? this.parse(e) : e, s);
3488
- return Object.keys(i.globals);
3489
- }
3490
- /** Return an array of all expected context variables including their properties/paths. */
3491
- globalFullVariables(e, s = {}) {
3492
- return b(this, void 0, void 0, function* () {
3493
- const i = yield j(d(e) ? this.parse(e) : e, s);
3494
- return Array.from(new Set(Object.values(i.globals).flatMap((n) => n.map((r) => String(r)))));
3495
- });
3496
- }
3497
- /** Return an array of all expected context variables including their properties/paths. */
3498
- globalFullVariablesSync(e, s = {}) {
3499
- const i = q(d(e) ? this.parse(e) : e, s);
3500
- return Array.from(new Set(Object.values(i.globals).flatMap((n) => n.map((r) => String(r)))));
3501
- }
3502
- /** Return an array of all expected context variables, each as an array of properties/segments. */
3503
- globalVariableSegments(e, s = {}) {
3504
- return b(this, void 0, void 0, function* () {
3505
- const i = yield j(d(e) ? this.parse(e) : e, s);
3506
- return Array.from(oe(Object.values(i.globals).flatMap((n) => n.map((r) => r.toArray()))));
3507
- });
3508
- }
3509
- /** Return an array of all expected context variables, each as an array of properties/segments. */
3510
- globalVariableSegmentsSync(e, s = {}) {
3511
- const i = q(d(e) ? this.parse(e) : e, s);
3512
- return Array.from(oe(Object.values(i.globals).flatMap((n) => n.map((r) => r.toArray()))));
3513
- }
3514
- }
3515
- const Wr = new $e(), Yr = /* @__PURE__ */ new Set(["if", "unless", "for", "case", "capture", "comment", "raw", "tablerow"]), Zr = {
3516
- endif: "if",
3517
- endunless: "unless",
3518
- endfor: "for",
3519
- endcase: "case",
3520
- endcapture: "capture",
3521
- endcomment: "comment",
3522
- endraw: "raw",
3523
- endtablerow: "tablerow"
3524
- };
3525
- function Q(t, e) {
3526
- let s = 1, i = -1;
3527
- for (let n = 0; n < e; n += 1)
3528
- t[n] === `
3529
- ` && (s += 1, i = n);
3530
- return { line: s, column: e - i };
3531
- }
3532
- function Jr(t) {
3533
- const e = [], s = [], i = /\{\{|\}\}|\{%|%\}/g;
3534
- let n = null, r = -1, o = null, a = i.exec(t);
3535
- for (; a !== null; ) {
3536
- const l = a[0];
3537
- if (l === "{{" || l === "{%") {
3538
- if (n) {
3539
- const h = Q(t, r);
3540
- e.push({ ...h, message: `Unclosed ${n} — '${n === "{{" ? "}}" : "%}"}' expected.` });
3541
- }
3542
- n = l, r = a.index;
3543
- } else if (n) {
3544
- const h = n === "{{" ? "}}" : "%}";
3545
- if (l !== h) {
3546
- const c = Q(t, r);
3547
- e.push({ ...c, message: `Mismatched delimiter — '${h}' expected.` });
3548
- } else if (n === "{%") {
3549
- const c = t.slice(r + 2, a.index).trim().split(/\s+/)[0] ?? "";
3550
- if (o)
3551
- c === `end${o}` && (s.pop(), o = null);
3552
- else if (Yr.has(c))
3553
- s.push({ tag: c, index: r }), (c === "comment" || c === "raw") && (o = c);
3554
- else {
3555
- const f = Zr[c];
3556
- if (f)
3557
- if (s.length > 0 && s[s.length - 1].tag === f)
3558
- s.pop();
3559
- else {
3560
- const p = Q(t, r);
3561
- e.push({ ...p, message: `Unexpected {% ${c} %}.` });
3562
- }
3563
- }
3564
- }
3565
- n = null, r = -1;
3566
- }
3567
- a = i.exec(t);
3568
- }
3569
- if (n) {
3570
- const l = Q(t, r);
3571
- e.push({ ...l, message: `Unclosed ${n}.` });
3572
- }
3573
- return s.forEach((l) => {
3574
- const h = Q(t, l.index);
3575
- e.push({ ...h, message: `Unclosed {% ${l.tag} %} — '{% end${l.tag} %}' missing.` });
3576
- }), e;
3577
- }
3578
- const Qr = /* @__PURE__ */ new Set(["true", "false", "nil", "null", "empty", "blank", "forloop", "tablerowloop"]);
3579
- function Gr(t) {
3580
- const e = /* @__PURE__ */ new Set(), s = /\{%-?\s*(?:assign|capture)\s+([a-zA-Z_]\w*)/g, i = /\{%-?\s*(?:for|tablerow)\s+([a-zA-Z_]\w*)\s+in\b/g;
3581
- let n = s.exec(t);
3582
- for (; n !== null; )
3583
- e.add(n[1]), n = s.exec(t);
3584
- for (n = i.exec(t); n !== null; )
3585
- e.add(n[1]), n = i.exec(t);
3586
- return e;
3587
- }
3588
- function Xr(t, e) {
3589
- var o;
3590
- const s = [], i = new Set(Qr);
3591
- e.forEach((a) => {
3592
- i.add(a);
3593
- const [l] = a.split(".");
3594
- l && i.add(l);
3595
- }), Gr(t).forEach((a) => i.add(a));
3596
- const n = /\{\{-?([\s\S]*?)-?\}\}/g;
3597
- let r = n.exec(t);
3598
- for (; r !== null; ) {
3599
- const l = (o = (r[1].split("|")[0] ?? "").trim().match(/^[a-zA-Z_][\w.]*/)) == null ? void 0 : o[0];
3600
- if (l) {
3601
- const [h] = l.split(".");
3602
- !i.has(l) && !i.has(h) && s.push({ ...Q(t, r.index), message: `Unknown dynamic content variable: ${l}` });
3603
- }
3604
- r = n.exec(t);
3605
- }
3606
- return s;
3607
- }
3608
- function Kr(t) {
3609
- const e = t == null ? void 0 : t.token;
3610
- if (e && typeof e.getPosition == "function") {
3611
- const [n, r] = e.getPosition();
3612
- return { line: n || 1, column: r || 1 };
3613
- }
3614
- const i = ((t == null ? void 0 : t.message) ?? "").match(/line:(\d+),\s*col:(\d+)/);
3615
- return i ? { line: Number(i[1]), column: Number(i[2]) } : { line: 1, column: 1 };
3616
- }
3617
- const eo = (t, e, s = []) => {
3618
- const i = t.getModel();
3619
- if (!i)
3620
- return {
3621
- valid: !0,
3622
- results: []
3623
- };
3624
- const n = t.getValue(), r = (a) => ({
3625
- startLineNumber: a.line,
3626
- endLineNumber: a.line,
3627
- startColumn: a.column,
3628
- endColumn: a.column + 1,
3629
- message: a.message,
3630
- severity: e.MarkerSeverity.Error
3631
- }), o = [
3632
- ...Jr(n),
3633
- ...s.length > 0 ? Xr(n, s) : []
3634
- ];
3635
- if (o.length > 0) {
3636
- const a = o.map(r);
3637
- return e.editor.setModelMarkers(i, "owner", a), {
3638
- valid: !1,
3639
- results: a
3640
- };
3641
- }
3642
- try {
3643
- return Wr.parse(n), e.editor.setModelMarkers(i, "owner", []), {
3644
- valid: !0,
3645
- results: []
3646
- };
3647
- } catch (a) {
3648
- const l = r({
3649
- ...Kr(a),
3650
- message: (a == null ? void 0 : a.message) ?? "Invalid Liquid syntax"
3651
- });
3652
- return e.editor.setModelMarkers(i, "owner", [l]), {
3653
- valid: !1,
3654
- results: [l]
3655
- };
3656
- }
3657
- };
3658
- export {
3659
- Gr as collectLocalVariables,
3660
- eo as default,
3661
- Jr as findStructuralErrors,
3662
- Xr as findUnknownVariables,
3663
- Q as positionAt
3664
- };
3665
- //# sourceMappingURL=liquid-hNC9E8-o.js.map