@jaredwray/fumanchu 3.1.3 → 4.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,2133 +1,2105 @@
1
- "use strict";
2
- var __create = Object.create;
3
- var __defProp = Object.defineProperty;
4
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
- var __getOwnPropNames = Object.getOwnPropertyNames;
6
- var __getOwnPropSymbols = Object.getOwnPropertySymbols;
7
- var __getProtoOf = Object.getPrototypeOf;
8
- var __hasOwnProp = Object.prototype.hasOwnProperty;
9
- var __propIsEnum = Object.prototype.propertyIsEnumerable;
10
- var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
11
- var __spreadValues = (a, b) => {
12
- for (var prop in b || (b = {}))
13
- if (__hasOwnProp.call(b, prop))
14
- __defNormalProp(a, prop, b[prop]);
15
- if (__getOwnPropSymbols)
16
- for (var prop of __getOwnPropSymbols(b)) {
17
- if (__propIsEnum.call(b, prop))
18
- __defNormalProp(a, prop, b[prop]);
19
- }
20
- return a;
21
- };
22
- var __commonJS = (cb, mod) => function __require() {
23
- return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
24
- };
25
- var __export = (target, all) => {
26
- for (var name in all)
27
- __defProp(target, name, { get: all[name], enumerable: true });
28
- };
29
- var __copyProps = (to, from, except, desc) => {
30
- if (from && typeof from === "object" || typeof from === "function") {
31
- for (let key of __getOwnPropNames(from))
32
- if (!__hasOwnProp.call(to, key) && key !== except)
33
- __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
34
- }
35
- return to;
36
- };
37
- var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
38
- // If the importer is in node compatibility mode or this is not an ESM
39
- // file that has been converted to a CommonJS file using a Babel-
40
- // compatible transform (i.e. "__esModule" has not been set), then set
41
- // "default" to the CommonJS "module.exports" for node compatibility.
42
- isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
43
- mod
44
- ));
45
- var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
46
- var __async = (__this, __arguments, generator) => {
47
- return new Promise((resolve, reject) => {
48
- var fulfilled = (value) => {
49
- try {
50
- step(generator.next(value));
51
- } catch (e) {
52
- reject(e);
53
- }
54
- };
55
- var rejected = (value) => {
56
- try {
57
- step(generator.throw(value));
58
- } catch (e) {
59
- reject(e);
60
- }
61
- };
62
- var step = (x) => x.done ? resolve(x.value) : Promise.resolve(x.value).then(fulfilled, rejected);
63
- step((generator = generator.apply(__this, __arguments)).next());
64
- });
1
+ // src/index.ts
2
+ import * as HandlebarsLib from "handlebars";
3
+
4
+ // src/helpers/array.ts
5
+ var after = (array, n) => {
6
+ if (!Array.isArray(array)) return [];
7
+ return array.slice(n);
8
+ };
9
+ var before = (array, n) => {
10
+ if (!Array.isArray(array)) return [];
11
+ return array.slice(0, -n);
12
+ };
13
+ var arrayify = (value) => {
14
+ if (value == null) return [];
15
+ return Array.isArray(value) ? value : [value];
16
+ };
17
+ var first = (array, n) => {
18
+ if (!Array.isArray(array)) return void 0;
19
+ if (typeof n !== "number") {
20
+ return array[0];
21
+ }
22
+ return array.slice(0, n);
23
+ };
24
+ var last = (value, n) => {
25
+ if (!Array.isArray(value) && typeof value !== "string") {
26
+ return void 0;
27
+ }
28
+ if (typeof n !== "number") {
29
+ const array = value;
30
+ return array[array.length - 1];
31
+ }
32
+ const start = Math.abs(n);
33
+ if (typeof value === "string") {
34
+ return value.slice(-start);
35
+ }
36
+ return value.slice(-start);
37
+ };
38
+ var length = (value) => {
39
+ if (value && typeof value === "object" && !Array.isArray(value)) {
40
+ return Object.keys(value).length;
41
+ }
42
+ if (typeof value === "string" || Array.isArray(value)) {
43
+ return value.length;
44
+ }
45
+ return 0;
46
+ };
47
+ var join = (array, separator = ", ") => {
48
+ if (typeof array === "string") return array;
49
+ if (!Array.isArray(array)) return "";
50
+ return array.join(separator);
51
+ };
52
+ var helpers = [
53
+ {
54
+ name: "after",
55
+ category: "array",
56
+ compatibility: ["browser", "nodejs"],
57
+ fn: after
58
+ },
59
+ {
60
+ name: "before",
61
+ category: "array",
62
+ compatibility: ["browser", "nodejs"],
63
+ fn: before
64
+ },
65
+ {
66
+ name: "arrayify",
67
+ category: "array",
68
+ compatibility: ["browser", "nodejs"],
69
+ fn: arrayify
70
+ },
71
+ {
72
+ name: "first",
73
+ category: "array",
74
+ compatibility: ["browser", "nodejs"],
75
+ fn: first
76
+ },
77
+ {
78
+ name: "last",
79
+ category: "array",
80
+ compatibility: ["browser", "nodejs"],
81
+ fn: last
82
+ },
83
+ {
84
+ name: "length",
85
+ category: "array",
86
+ compatibility: ["browser", "nodejs"],
87
+ fn: length
88
+ },
89
+ {
90
+ name: "join",
91
+ category: "array",
92
+ compatibility: ["browser", "nodejs"],
93
+ fn: join
94
+ }
95
+ ];
96
+
97
+ // src/helpers/code.ts
98
+ import fs from "fs";
99
+ import path from "path";
100
+ import tag from "html-tag";
101
+ import codeBlock from "to-gfm-code-block";
102
+ var embed = (filepath, language) => {
103
+ let ext = typeof language === "string" ? language : path.extname(filepath).slice(1);
104
+ let code = fs.readFileSync(filepath, "utf8");
105
+ if (ext === "markdown" || ext === "md") {
106
+ ext = "markdown";
107
+ code = code.split("`").join("&#x60");
108
+ }
109
+ return `${codeBlock(code, ext).trim()}
110
+ `;
111
+ };
112
+ var gist = (id) => {
113
+ return tag("script", { src: `https://gist.github.com/${id}.js` });
65
114
  };
115
+ var jsfiddle = (options) => {
116
+ if (!options || !options.id) {
117
+ throw new Error("jsfiddle helper expects an `id`");
118
+ }
119
+ const {
120
+ id,
121
+ width = "100%",
122
+ height = "300",
123
+ skin = "/presentation/",
124
+ tabs = "result,js,html,css",
125
+ allowfullscreen = "allowfullscreen",
126
+ frameborder = "0"
127
+ } = options;
128
+ const src = `http://jsfiddle.net/${id}/embedded/${tabs}${skin}`;
129
+ return tag("iframe", { width, height, src, allowfullscreen, frameborder });
130
+ };
131
+ var helpers2 = [
132
+ {
133
+ name: "embed",
134
+ category: "code",
135
+ compatibility: ["nodejs"],
136
+ fn: embed
137
+ },
138
+ {
139
+ name: "gist",
140
+ category: "code",
141
+ compatibility: ["browser", "nodejs"],
142
+ fn: gist
143
+ },
144
+ {
145
+ name: "jsfiddle",
146
+ category: "code",
147
+ compatibility: ["browser", "nodejs"],
148
+ fn: jsfiddle
149
+ }
150
+ ];
66
151
 
67
- // helpers/lib/utils/falsey.js
68
- var require_falsey = __commonJS({
69
- "helpers/lib/utils/falsey.js"(exports2, module2) {
70
- "use strict";
71
- function falsey(val, keywords) {
72
- if (!val) {
73
- return true;
74
- }
75
- let words = keywords || [
76
- "0",
77
- "false",
78
- "nada",
79
- "nil",
80
- "nay",
81
- "nah",
82
- "negative",
83
- "no",
84
- "none",
85
- "nope",
86
- "nul",
87
- "null",
88
- "nix",
89
- "nyet",
90
- "uh-uh",
91
- "veto",
92
- "zero"
93
- ];
94
- if (!Array.isArray(words)) {
95
- words = [words];
96
- }
97
- const lower = typeof val === "string" ? val.toLowerCase() : null;
98
- for (const word of words) {
99
- if (word === val) {
100
- return true;
101
- }
102
- if (word === lower) {
103
- return true;
104
- }
105
- }
106
- return false;
152
+ // src/helpers/collection.ts
153
+ var isEmpty = (collection) => {
154
+ if (collection == null) return true;
155
+ if (Array.isArray(collection)) return collection.length === 0;
156
+ if (typeof collection === "object")
157
+ return Object.keys(collection).length === 0;
158
+ return false;
159
+ };
160
+ var iterate = (collection, fn, inverse) => {
161
+ if (Array.isArray(collection)) {
162
+ let result = "";
163
+ for (let i = 0; i < collection.length; i++) {
164
+ result += fn(collection[i], i);
107
165
  }
108
- module2.exports = falsey;
166
+ return result;
109
167
  }
110
- });
168
+ if (collection && typeof collection === "object") {
169
+ let result = "";
170
+ for (const key of Object.keys(collection)) {
171
+ result += fn(collection[key], key);
172
+ }
173
+ return result;
174
+ }
175
+ return inverse ? inverse() : "";
176
+ };
177
+ var helpers3 = [
178
+ {
179
+ name: "isEmpty",
180
+ category: "collection",
181
+ compatibility: ["browser", "nodejs"],
182
+ fn: isEmpty
183
+ },
184
+ {
185
+ name: "iterate",
186
+ category: "collection",
187
+ compatibility: ["browser", "nodejs"],
188
+ fn: iterate
189
+ }
190
+ ];
111
191
 
112
- // helpers/lib/utils/utils.js
113
- var require_utils = __commonJS({
114
- "helpers/lib/utils/utils.js"(exports2, module2) {
115
- "use strict";
116
- var utils = require("lazy-cache")(require);
117
- var falsey = require_falsey();
118
- var fn = require;
119
- require = utils;
120
- require("array-sort", "sortBy");
121
- require("arr-flatten", "flatten");
122
- require("to-gfm-code-block", "block");
123
- require("html-tag", "tag");
124
- require("kind-of", "typeOf");
125
- require("is-glob");
126
- require("micromatch", "mm");
127
- utils.falsey = falsey;
128
- require("is-even");
129
- require("is-number");
130
- require("create-frame");
131
- require("get-object");
132
- require("get-value", "get");
133
- require("for-own");
134
- require("relative");
135
- require = fn;
136
- module2.exports = utils;
192
+ // src/helpers/comparison.ts
193
+ var and = (...values) => values.every(Boolean);
194
+ var compare = (a, operator, b) => {
195
+ switch (operator) {
196
+ case "==":
197
+ return a == b;
198
+ // eslint-disable-line eqeqeq
199
+ case "===":
200
+ return a === b;
201
+ case "!=":
202
+ return a != b;
203
+ // eslint-disable-line eqeqeq
204
+ case "!==":
205
+ return a !== b;
206
+ case "<":
207
+ return a < b;
208
+ case ">":
209
+ return a > b;
210
+ case "<=":
211
+ return a <= b;
212
+ case ">=":
213
+ return a >= b;
214
+ case "typeof":
215
+ return typeof a === b;
216
+ default:
217
+ throw new Error(`helper {{compare}}: invalid operator: '${operator}'`);
137
218
  }
138
- });
219
+ };
220
+ var contains = (collection, value, startIndex = 0) => {
221
+ if (collection == null) return false;
222
+ if (typeof collection === "string" || Array.isArray(collection)) {
223
+ return collection.indexOf(value, startIndex) > -1;
224
+ }
225
+ if (typeof collection === "object") {
226
+ return value in collection;
227
+ }
228
+ return false;
229
+ };
230
+ var defaultHelper = (...values) => {
231
+ for (const val of values) {
232
+ if (val != null) return val;
233
+ }
234
+ return "";
235
+ };
236
+ var eq = (a, b) => a === b;
237
+ var gt = (a, b) => a > b;
238
+ var gte = (a, b) => a >= b;
239
+ var has = (value, pattern) => {
240
+ if (value == null || pattern == null) return false;
241
+ if (Array.isArray(value) || typeof value === "string") {
242
+ return value.indexOf(pattern) > -1;
243
+ }
244
+ if (typeof value === "object") {
245
+ return pattern in value;
246
+ }
247
+ return false;
248
+ };
249
+ var falsey = (val, keywords) => {
250
+ if (!val) return true;
251
+ const words = Array.isArray(keywords) ? keywords : keywords != null ? [keywords] : [
252
+ "0",
253
+ "false",
254
+ "nada",
255
+ "nil",
256
+ "nay",
257
+ "nah",
258
+ "negative",
259
+ "no",
260
+ "none",
261
+ "nope",
262
+ "nul",
263
+ "null",
264
+ "nix",
265
+ "nyet",
266
+ "uh-uh",
267
+ "veto",
268
+ "zero"
269
+ ];
270
+ const lower = typeof val === "string" ? val.toLowerCase() : null;
271
+ for (const word of words) {
272
+ if (word === val) return true;
273
+ if (lower != null && word === lower) return true;
274
+ }
275
+ return false;
276
+ };
277
+ var isFalsey = (val) => falsey(val);
278
+ var isTruthy = (val) => !falsey(val);
279
+ var ifEven = (num) => typeof num === "number" && num % 2 === 0;
280
+ var ifNth = (a, b) => typeof a === "number" && typeof b === "number" && b % a === 0;
281
+ var ifOdd = (val) => typeof val === "number" && Math.abs(val % 2) === 1;
282
+ var is = (a, b) => a == b;
283
+ var isnt = (a, b) => a != b;
284
+ var lt = (a, b) => a < b;
285
+ var lte = (a, b) => a <= b;
286
+ var neither = (a, b) => !a && !b;
287
+ var not = (val) => !val;
288
+ var or = (...values) => values.some(Boolean);
289
+ var unlessEq = (a, b) => a !== b;
290
+ var unlessGt = (a, b) => a <= b;
291
+ var unlessLt = (a, b) => a >= b;
292
+ var unlessGteq = (a, b) => a < b;
293
+ var unlessLteq = (a, b) => a > b;
294
+ var helpers4 = [
295
+ {
296
+ name: "and",
297
+ category: "comparison",
298
+ compatibility: ["browser", "nodejs"],
299
+ fn: and
300
+ },
301
+ {
302
+ name: "compare",
303
+ category: "comparison",
304
+ compatibility: ["browser", "nodejs"],
305
+ fn: compare
306
+ },
307
+ {
308
+ name: "contains",
309
+ category: "comparison",
310
+ compatibility: ["browser", "nodejs"],
311
+ fn: contains
312
+ },
313
+ {
314
+ name: "default",
315
+ category: "comparison",
316
+ compatibility: ["browser", "nodejs"],
317
+ fn: defaultHelper
318
+ },
319
+ {
320
+ name: "eq",
321
+ category: "comparison",
322
+ compatibility: ["browser", "nodejs"],
323
+ fn: eq
324
+ },
325
+ {
326
+ name: "gt",
327
+ category: "comparison",
328
+ compatibility: ["browser", "nodejs"],
329
+ fn: gt
330
+ },
331
+ {
332
+ name: "gte",
333
+ category: "comparison",
334
+ compatibility: ["browser", "nodejs"],
335
+ fn: gte
336
+ },
337
+ {
338
+ name: "has",
339
+ category: "comparison",
340
+ compatibility: ["browser", "nodejs"],
341
+ fn: has
342
+ },
343
+ {
344
+ name: "isFalsey",
345
+ category: "comparison",
346
+ compatibility: ["browser", "nodejs"],
347
+ fn: isFalsey
348
+ },
349
+ {
350
+ name: "isTruthy",
351
+ category: "comparison",
352
+ compatibility: ["browser", "nodejs"],
353
+ fn: isTruthy
354
+ },
355
+ {
356
+ name: "ifEven",
357
+ category: "comparison",
358
+ compatibility: ["browser", "nodejs"],
359
+ fn: ifEven
360
+ },
361
+ {
362
+ name: "ifNth",
363
+ category: "comparison",
364
+ compatibility: ["browser", "nodejs"],
365
+ fn: ifNth
366
+ },
367
+ {
368
+ name: "ifOdd",
369
+ category: "comparison",
370
+ compatibility: ["browser", "nodejs"],
371
+ fn: ifOdd
372
+ },
373
+ {
374
+ name: "is",
375
+ category: "comparison",
376
+ compatibility: ["browser", "nodejs"],
377
+ fn: is
378
+ },
379
+ {
380
+ name: "isnt",
381
+ category: "comparison",
382
+ compatibility: ["browser", "nodejs"],
383
+ fn: isnt
384
+ },
385
+ {
386
+ name: "lt",
387
+ category: "comparison",
388
+ compatibility: ["browser", "nodejs"],
389
+ fn: lt
390
+ },
391
+ {
392
+ name: "lte",
393
+ category: "comparison",
394
+ compatibility: ["browser", "nodejs"],
395
+ fn: lte
396
+ },
397
+ {
398
+ name: "neither",
399
+ category: "comparison",
400
+ compatibility: ["browser", "nodejs"],
401
+ fn: neither
402
+ },
403
+ {
404
+ name: "not",
405
+ category: "comparison",
406
+ compatibility: ["browser", "nodejs"],
407
+ fn: not
408
+ },
409
+ {
410
+ name: "or",
411
+ category: "comparison",
412
+ compatibility: ["browser", "nodejs"],
413
+ fn: or
414
+ },
415
+ {
416
+ name: "unlessEq",
417
+ category: "comparison",
418
+ compatibility: ["browser", "nodejs"],
419
+ fn: unlessEq
420
+ },
421
+ {
422
+ name: "unlessGt",
423
+ category: "comparison",
424
+ compatibility: ["browser", "nodejs"],
425
+ fn: unlessGt
426
+ },
427
+ {
428
+ name: "unlessLt",
429
+ category: "comparison",
430
+ compatibility: ["browser", "nodejs"],
431
+ fn: unlessLt
432
+ },
433
+ {
434
+ name: "unlessGteq",
435
+ category: "comparison",
436
+ compatibility: ["browser", "nodejs"],
437
+ fn: unlessGteq
438
+ },
439
+ {
440
+ name: "unlessLteq",
441
+ category: "comparison",
442
+ compatibility: ["browser", "nodejs"],
443
+ fn: unlessLteq
444
+ }
445
+ ];
139
446
 
140
- // helpers/lib/utils/index.js
141
- var require_utils2 = __commonJS({
142
- "helpers/lib/utils/index.js"(exports2, module2) {
143
- "use strict";
144
- var util = require("handlebars-utils");
145
- var utils = require_utils();
146
- utils.contains = function(val, obj, start) {
147
- if (val == null || obj == null || !utils.isNumber(val.length)) {
148
- return false;
149
- }
150
- return val.indexOf(obj, start) !== -1;
151
- };
152
- utils.chop = function(str) {
153
- if (!util.isString(str)) return "";
154
- var re = /^[-_.\W\s]+|[-_.\W\s]+$/g;
155
- if (str.length > 1e3) {
156
- throw new Error("utils.chop() regex is too long!");
157
- }
158
- return str.trim().replace(re, "");
159
- };
160
- utils.changecase = function(str, fn) {
161
- if (!util.isString(str)) return "";
162
- if (str.length === 1) {
163
- return str.toLowerCase();
164
- }
165
- str = utils.chop(str).toLowerCase();
166
- if (typeof fn !== "function") {
167
- fn = utils.identity;
168
- }
169
- var re = /[-_.\W\s]+(\w|$)/g;
170
- return str.replace(re, function(_, ch) {
171
- return fn(ch);
172
- });
173
- };
174
- utils.random = function(min, max) {
175
- return min + Math.floor(Math.random() * (max - min + 1));
176
- };
177
- module2.exports = utils;
447
+ // src/helpers/date.ts
448
+ import { parseDate } from "chrono-node";
449
+ import dayjs from "dayjs";
450
+ var year = () => (/* @__PURE__ */ new Date()).getFullYear().toString();
451
+ var date = (humanReadableDate, formatString) => {
452
+ const parsedDate = parseDate(humanReadableDate);
453
+ if (!parsedDate) {
454
+ throw new Error(`Unable to parse date: ${humanReadableDate}`);
178
455
  }
179
- });
456
+ return dayjs(parsedDate).format(formatString);
457
+ };
458
+ var helpers5 = [
459
+ {
460
+ name: "year",
461
+ category: "date",
462
+ compatibility: ["browser", "nodejs"],
463
+ fn: year
464
+ },
465
+ {
466
+ name: "date",
467
+ category: "date",
468
+ compatibility: ["browser", "nodejs"],
469
+ fn: date
470
+ },
471
+ {
472
+ /* Adding this in for legacy support */
473
+ name: "moment",
474
+ category: "date",
475
+ compatibility: ["browser", "nodejs"],
476
+ fn: date
477
+ }
478
+ ];
180
479
 
181
- // helpers/lib/array.js
182
- var require_array = __commonJS({
183
- "helpers/lib/array.js"(exports2, module2) {
184
- "use strict";
185
- var util = require("handlebars-utils");
186
- var utils = require_utils2();
187
- var helpers4 = module2.exports;
188
- helpers4.after = function(array, n) {
189
- if (util.isUndefined(array)) return "";
190
- return array.slice(n);
191
- };
192
- helpers4.arrayify = function(value) {
193
- return value ? Array.isArray(value) ? value : [value] : [];
194
- };
195
- helpers4.before = function(array, n) {
196
- if (util.isUndefined(array)) return "";
197
- return array.slice(0, -n);
198
- };
199
- helpers4.eachIndex = function(array, options) {
200
- var result = "";
201
- for (var i = 0; i < array.length; i++) {
202
- result += options.fn({ item: array[i], index: i });
203
- }
204
- return result;
205
- };
206
- helpers4.filter = function(array, value, options) {
207
- var content = "";
208
- var results = [];
209
- var prop = options.hash && (options.hash.property || options.hash.prop);
210
- if (prop) {
211
- results = array.filter(function(val) {
212
- return value === utils.get(val, prop);
213
- });
214
- } else {
215
- results = array.filter(function(v) {
216
- return value === v;
217
- });
218
- }
219
- if (results && results.length > 0) {
220
- for (var i = 0; i < results.length; i++) {
221
- content += options.fn(results[i]);
222
- }
223
- return content;
224
- }
225
- return options.inverse(this);
226
- };
227
- helpers4.first = function(array, n) {
228
- if (util.isUndefined(array)) return "";
229
- if (!utils.isNumber(n)) {
230
- return array[0];
231
- }
232
- return array.slice(0, n);
233
- };
234
- helpers4.forEach = function(array, options) {
235
- var data = utils.createFrame(options, options.hash);
236
- var len = array.length;
237
- var buffer = "";
238
- var i = -1;
239
- while (++i < len) {
240
- var item = array[i];
241
- data.index = i;
242
- item.index = i + 1;
243
- item.total = len;
244
- item.isFirst = i === 0;
245
- item.isLast = i === len - 1;
246
- buffer += options.fn(item, { data });
247
- }
248
- return buffer;
249
- };
250
- helpers4.inArray = function(array, value, options) {
251
- return util.value(util.indexOf(array, value) > -1, this, options);
252
- };
253
- helpers4.isArray = function(value) {
254
- return Array.isArray(value);
255
- };
256
- helpers4.itemAt = function(array, idx) {
257
- array = util.result(array);
258
- if (Array.isArray(array)) {
259
- idx = utils.isNumber(idx) ? +idx : 0;
260
- if (idx < 0) {
261
- return array[array.length + idx];
262
- }
263
- if (idx < array.length) {
264
- return array[idx];
265
- }
266
- }
267
- };
268
- helpers4.join = function(array, separator) {
269
- if (typeof array === "string") return array;
270
- if (!Array.isArray(array)) return "";
271
- separator = util.isString(separator) ? separator : ", ";
272
- return array.join(separator);
273
- };
274
- helpers4.equalsLength = function(value, length, options) {
275
- if (util.isOptions(length)) {
276
- options = length;
277
- length = 0;
278
- }
279
- var len = 0;
280
- if (typeof value === "string" || Array.isArray(value)) {
281
- len = value.length;
282
- }
283
- return util.value(len === length, this, options);
284
- };
285
- helpers4.last = function(value, n) {
286
- if (!Array.isArray(value) && typeof value !== "string") {
287
- return "";
288
- }
289
- if (!utils.isNumber(n)) {
290
- return value[value.length - 1];
291
- }
292
- return value.slice(-Math.abs(n));
293
- };
294
- helpers4.length = function(value) {
295
- if (util.isObject(value) && !util.isOptions(value)) {
296
- value = Object.keys(value);
297
- }
298
- if (typeof value === "string" || Array.isArray(value)) {
299
- return value.length;
300
- }
301
- return 0;
302
- };
303
- helpers4.lengthEqual = helpers4.equalsLength;
304
- helpers4.map = function(array, iter) {
305
- if (!Array.isArray(array)) return "";
306
- var len = array.length;
307
- var res = new Array(len);
308
- var i = -1;
309
- if (typeof iter !== "function") {
310
- return array;
311
- }
312
- while (++i < len) {
313
- res[i] = iter(array[i], i, array);
314
- }
315
- return res;
316
- };
317
- helpers4.pluck = function(arr, prop) {
318
- if (util.isUndefined(arr)) return "";
319
- var res = [];
320
- for (var i = 0; i < arr.length; i++) {
321
- var val = utils.get(arr[i], prop);
322
- if (typeof val !== "undefined") {
323
- res.push(val);
324
- }
325
- }
326
- return res;
327
- };
328
- helpers4.reverse = function(val) {
329
- if (Array.isArray(val)) {
330
- val.reverse();
331
- return val;
332
- }
333
- if (val && typeof val === "string") {
334
- return val.split("").reverse().join("");
335
- }
336
- };
337
- helpers4.some = function(array, iter, options) {
338
- if (Array.isArray(array)) {
339
- for (var i = 0; i < array.length; i++) {
340
- if (iter(array[i], i, array)) {
341
- return options.fn(this);
342
- }
343
- }
344
- }
345
- return options.inverse(this);
346
- };
347
- helpers4.sort = function(array, options) {
348
- if (!Array.isArray(array)) return "";
349
- if (utils.get(options, "hash.reverse")) {
350
- return array.sort().reverse();
351
- }
352
- return array.sort();
353
- };
354
- helpers4.sortBy = function(array, prop, options) {
355
- if (!Array.isArray(array)) return "";
356
- var args = [].slice.call(arguments);
357
- args.pop();
358
- if (!util.isString(prop) && typeof prop !== "function") {
359
- return array.sort();
360
- }
361
- return utils.sortBy.apply(null, args);
362
- };
363
- helpers4.withAfter = function(array, idx, options) {
364
- if (!Array.isArray(array)) return "";
365
- array = array.slice(idx);
366
- var result = "";
367
- for (var i = 0; i < array.length; i++) {
368
- result += options.fn(array[i]);
369
- }
370
- return result;
371
- };
372
- helpers4.withBefore = function(array, idx, options) {
373
- if (!Array.isArray(array)) return "";
374
- array = array.slice(0, -idx);
375
- var result = "";
376
- for (var i = 0; i < array.length; i++) {
377
- result += options.fn(array[i]);
378
- }
379
- return result;
380
- };
381
- helpers4.withFirst = function(array, idx, options) {
382
- if (util.isUndefined(array)) return "";
383
- array = util.result(array);
384
- if (!util.isUndefined(idx)) {
385
- idx = parseFloat(util.result(idx));
386
- }
387
- if (util.isUndefined(idx)) {
388
- options = idx;
389
- return options.fn(array[0]);
390
- }
391
- array = array.slice(0, idx);
392
- var result = "";
393
- for (var i = 0; i < array.length; i++) {
394
- result += options.fn(array[i]);
395
- }
396
- return result;
397
- };
398
- helpers4.withGroup = function(array, size, options) {
399
- var result = "";
400
- if (Array.isArray(array) && array.length > 0) {
401
- var subcontext = [];
402
- for (var i = 0; i < array.length; i++) {
403
- if (i > 0 && i % size === 0) {
404
- result += options.fn(subcontext);
405
- subcontext = [];
406
- }
407
- subcontext.push(array[i]);
408
- }
409
- result += options.fn(subcontext);
410
- }
411
- return result;
412
- };
413
- helpers4.withLast = function(array, idx, options) {
414
- if (util.isUndefined(array)) return "";
415
- array = util.result(array);
416
- if (!util.isUndefined(idx)) {
417
- idx = parseFloat(util.result(idx));
418
- }
419
- if (util.isUndefined(idx)) {
420
- options = idx;
421
- return options.fn(array[array.length - 1]);
422
- }
423
- array = array.slice(-idx);
424
- var len = array.length, i = -1;
425
- var result = "";
426
- while (++i < len) {
427
- result += options.fn(array[i]);
428
- }
429
- return result;
430
- };
431
- helpers4.withSort = function(array, prop, options) {
432
- if (util.isUndefined(array)) return "";
433
- var result = "";
434
- if (util.isUndefined(prop)) {
435
- options = prop;
436
- array = array.sort();
437
- if (utils.get(options, "hash.reverse")) {
438
- array = array.reverse();
439
- }
440
- for (var i = 0, len = array.length; i < len; i++) {
441
- result += options.fn(array[i]);
442
- }
443
- return result;
444
- }
445
- array.sort(function(a, b) {
446
- a = utils.get(a, prop);
447
- b = utils.get(b, prop);
448
- return a > b ? 1 : a < b ? -1 : 0;
449
- });
450
- if (utils.get(options, "hash.reverse")) {
451
- array = array.reverse();
452
- }
453
- var alen = array.length, j = -1;
454
- while (++j < alen) {
455
- result += options.fn(array[j]);
456
- }
457
- return result;
458
- };
459
- helpers4.unique = function(array, options) {
460
- if (util.isUndefined(array)) return "";
461
- return array.filter(function(item, index, arr) {
462
- return arr.indexOf(item) === index;
480
+ // src/helpers/fs.ts
481
+ import fs2 from "fs";
482
+ import path2 from "path";
483
+ import isGlob from "is-glob";
484
+ import micromatch from "micromatch";
485
+ var fileSize = (value, precision) => {
486
+ if (value == null) return "0 B";
487
+ const number = typeof value === "number" ? value : value.length ?? 0;
488
+ if (!number) return "0 B";
489
+ const precisionNumber = typeof precision === "number" ? precision : 2;
490
+ const abbr = ["B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
491
+ const factor = 10 ** precisionNumber;
492
+ let i = abbr.length - 1;
493
+ do {
494
+ const size = 10 ** (i * 3);
495
+ if (size <= number + 1) {
496
+ const num = Math.round(number * factor / size) / factor;
497
+ return `${num} ${abbr[i]}`;
498
+ }
499
+ } while (--i >= 0);
500
+ return `${number} B`;
501
+ };
502
+ var read = (filepath) => {
503
+ return fs2.readFileSync(filepath, "utf8");
504
+ };
505
+ var isOptions = (value) => {
506
+ return Boolean(
507
+ value && typeof value === "object" && "hash" in value
508
+ );
509
+ };
510
+ var readdir = (dir, filter) => {
511
+ const files = fs2.readdirSync(dir).map((fp) => path2.join(dir, fp));
512
+ const filterArg = isOptions(filter) ? void 0 : filter;
513
+ if (typeof filterArg === "function") {
514
+ return filterArg(files);
515
+ }
516
+ if (filterArg instanceof RegExp) {
517
+ return files.filter((fp) => filterArg.test(fp));
518
+ }
519
+ if (typeof filterArg === "string") {
520
+ if (isGlob(filterArg)) {
521
+ return micromatch(files, filterArg);
522
+ }
523
+ if (filterArg === "isFile" || filterArg === "isDirectory") {
524
+ return files.filter((fp) => {
525
+ const stat = fs2.statSync(fp);
526
+ return filterArg === "isFile" ? stat.isFile() : stat.isDirectory();
463
527
  });
464
- };
528
+ }
465
529
  }
466
- });
530
+ return files;
531
+ };
532
+ var helpers6 = [
533
+ {
534
+ name: "fileSize",
535
+ category: "fs",
536
+ compatibility: ["nodejs"],
537
+ fn: fileSize
538
+ },
539
+ {
540
+ name: "read",
541
+ category: "fs",
542
+ compatibility: ["nodejs"],
543
+ fn: read
544
+ },
545
+ {
546
+ name: "readdir",
547
+ category: "fs",
548
+ compatibility: ["nodejs"],
549
+ fn: readdir
550
+ }
551
+ ];
467
552
 
468
- // helpers/lib/code.js
469
- var require_code = __commonJS({
470
- "helpers/lib/code.js"(exports2, module2) {
471
- "use strict";
472
- var fs2 = require("fs");
473
- var path2 = require("path");
474
- var utils = require_utils2();
475
- var helpers4 = module2.exports;
476
- helpers4.embed = function embed(filepath, ext) {
477
- ext = typeof ext !== "string" ? path2.extname(filepath).slice(1) : ext;
478
- var code = fs2.readFileSync(filepath, "utf8");
479
- if (ext === "markdown" || ext === "md") {
480
- ext = "markdown";
481
- code = code.split("`").join("&#x60");
482
- }
483
- return utils.block(code, ext).trim() + "\n";
484
- };
485
- helpers4.gist = function(id) {
486
- return utils.tag("script", { src: "https://gist.github.com/" + id + ".js" });
487
- };
488
- helpers4.jsfiddle = function jsFiddle(options) {
489
- var attr = Object.assign({}, options && options.hash);
490
- if (typeof attr.id === "undefined") {
491
- throw new Error("jsfiddle helper expects an `id`");
492
- }
493
- attr.id = "http://jsfiddle.net/" + attr.id;
494
- attr.width = attr.width || "100%";
495
- attr.height = attr.height || "300";
496
- attr.skin = attr.skin || "/presentation/";
497
- attr.tabs = (attr.tabs || "result,js,html,css") + attr.skin;
498
- attr.src = attr.id + "/embedded/" + attr.tabs;
499
- attr.allowfullscreen = attr.allowfullscreen || "allowfullscreen";
500
- attr.frameborder = attr.frameborder || "0";
501
- delete attr.tabs;
502
- delete attr.skin;
503
- delete attr.id;
504
- return utils.tag("iframe", attr);
505
- };
553
+ // src/helpers/html.ts
554
+ import path3 from "path";
555
+ import tag2 from "html-tag";
556
+ import striptags from "striptags";
557
+ var parseAttributes = (hash = {}) => Object.keys(hash).map((key) => `${key}="${String(hash[key]).replace(/^['"]|["']$/g, "")}"`).join(" ");
558
+ var attr = (options) => {
559
+ const val = parseAttributes(options?.hash ?? {});
560
+ return val.trim() ? ` ${val}` : "";
561
+ };
562
+ var css = function(list, options) {
563
+ if (arguments.length < 2) {
564
+ options = list;
565
+ list = [];
506
566
  }
507
- });
567
+ let styles = arrayify(list ?? []);
568
+ let assets = "";
569
+ if (this && this.options) {
570
+ assets = this.options.assets || "";
571
+ }
572
+ if (options?.hash?.href) {
573
+ styles = arrayify(options.hash.href);
574
+ }
575
+ return styles.map((item) => {
576
+ const ext = path3.extname(item);
577
+ let fp = item;
578
+ if (!/(^\/\/)|(:\/\/)/.test(item)) {
579
+ fp = path3.posix.join(assets, item);
580
+ }
581
+ if (ext === ".less") {
582
+ return `<link type="text/css" rel="stylesheet/less" href="${fp}">`;
583
+ }
584
+ return `<link type="text/css" rel="stylesheet" href="${fp}">`;
585
+ }).join("\n");
586
+ };
587
+ var js = (context) => {
588
+ if (context && typeof context === "object" && !Array.isArray(context)) {
589
+ const attrStr = parseAttributes(context.hash ?? {});
590
+ return `<script${attrStr ? ` ${attrStr}` : ""}></script>`;
591
+ }
592
+ if (typeof context === "string") {
593
+ return `<script src="${context}"></script>`;
594
+ }
595
+ const items = arrayify(context);
596
+ return items.map(
597
+ (fp) => path3.extname(fp) === ".coffee" ? tag2("script", { type: "text/coffeescript", src: fp }) : tag2("script", { src: fp })
598
+ ).join("\n");
599
+ };
600
+ var sanitize = (str) => {
601
+ if (typeof str !== "string") return "";
602
+ return striptags(str).trim();
603
+ };
604
+ var ul = (context, options) => {
605
+ const attrs = parseAttributes(options.hash ?? {});
606
+ const items = context.map(
607
+ (item) => typeof item === "string" ? item : options.fn(item)
608
+ );
609
+ const open = attrs ? `<ul ${attrs}>` : "<ul>";
610
+ return `${open}${items.map((i) => `<li>${i}</li>`).join("\n")}</ul>`;
611
+ };
612
+ var ol = (context, options) => {
613
+ const attrs = parseAttributes(options.hash ?? {});
614
+ const items = context.map(
615
+ (item) => typeof item === "string" ? item : options.fn(item)
616
+ );
617
+ const open = attrs ? `<ol ${attrs}>` : "<ol>";
618
+ return `${open}${items.map((i) => `<li>${i}</li>`).join("\n")}</ol>`;
619
+ };
620
+ var thumbnailImage = (context) => {
621
+ let figure = "";
622
+ let image = "";
623
+ const link = context.full || false;
624
+ const imageAttributes = {
625
+ alt: context.alt,
626
+ src: context.thumbnail,
627
+ width: context.size.width,
628
+ height: context.size.height
629
+ };
630
+ const figureAttributes = { id: `image-${context.id}` };
631
+ const linkAttributes = { href: link, rel: "thumbnail" };
632
+ if (context.classes) {
633
+ if (context.classes.image) {
634
+ imageAttributes.class = context.classes.image.join(" ");
635
+ }
636
+ if (context.classes.figure) {
637
+ figureAttributes.class = context.classes.figure.join(" ");
638
+ }
639
+ if (context.classes.link) {
640
+ linkAttributes.class = context.classes.link.join(" ");
641
+ }
642
+ }
643
+ figure += `<figure ${parseAttributes(figureAttributes)}>
644
+ `;
645
+ image += `<img ${parseAttributes(imageAttributes)}>
646
+ `;
647
+ if (link) {
648
+ figure += `<a ${parseAttributes(linkAttributes)}>
649
+ ${image}</a>
650
+ `;
651
+ } else {
652
+ figure += image;
653
+ }
654
+ if (context.caption) {
655
+ figure += `<figcaption>${context.caption}</figcaption>
656
+ `;
657
+ }
658
+ figure += "</figure>";
659
+ return figure;
660
+ };
661
+ var helpers7 = [
662
+ {
663
+ name: "attr",
664
+ category: "html",
665
+ compatibility: ["browser", "nodejs"],
666
+ fn: attr
667
+ },
668
+ {
669
+ name: "css",
670
+ category: "html",
671
+ compatibility: ["nodejs"],
672
+ fn: css
673
+ },
674
+ {
675
+ name: "js",
676
+ category: "html",
677
+ compatibility: ["nodejs"],
678
+ fn: js
679
+ },
680
+ {
681
+ name: "sanitize",
682
+ category: "html",
683
+ compatibility: ["browser", "nodejs"],
684
+ fn: sanitize
685
+ },
686
+ {
687
+ name: "ul",
688
+ category: "html",
689
+ compatibility: ["browser", "nodejs"],
690
+ fn: ul
691
+ },
692
+ {
693
+ name: "ol",
694
+ category: "html",
695
+ compatibility: ["browser", "nodejs"],
696
+ fn: ol
697
+ },
698
+ {
699
+ name: "thumbnailImage",
700
+ category: "html",
701
+ compatibility: ["browser", "nodejs"],
702
+ fn: thumbnailImage
703
+ }
704
+ ];
508
705
 
509
- // helpers/lib/object.js
510
- var require_object = __commonJS({
511
- "helpers/lib/object.js"(exports2, module2) {
512
- "use strict";
513
- var hasOwn = Object.hasOwnProperty;
514
- var util = require("handlebars-utils");
515
- var array = require_array();
516
- var utils = require_utils2();
517
- var helpers4 = module2.exports;
518
- helpers4.extend = function() {
519
- var args = [].slice.call(arguments);
520
- var opts = {};
521
- if (util.isOptions(args[args.length - 1])) {
522
- opts = args.pop().hash;
523
- args.push(opts);
524
- }
525
- var context = {};
526
- for (var i = 0; i < args.length; i++) {
527
- var obj = args[i];
528
- if (util.isObject(obj)) {
529
- var keys = Object.keys(obj);
530
- for (var j = 0; j < keys.length; j++) {
531
- var key = keys[j];
532
- context[key] = obj[key];
533
- }
534
- }
535
- }
536
- return context;
537
- };
538
- helpers4.forIn = function(obj, options) {
539
- if (!util.isOptions(options)) {
540
- return obj.inverse(this);
541
- }
542
- var data = utils.createFrame(options, options.hash);
543
- var result = "";
544
- for (var key in obj) {
545
- data.key = key;
546
- result += options.fn(obj[key], { data });
547
- }
548
- return result;
549
- };
550
- helpers4.forOwn = function(obj, options) {
551
- if (!util.isOptions(options)) {
552
- return obj.inverse(this);
553
- }
554
- var data = utils.createFrame(options, options.hash);
555
- var result = "";
556
- for (var key in obj) {
557
- if (obj.hasOwnProperty(key)) {
558
- data.key = key;
559
- result += options.fn(obj[key], { data });
560
- }
561
- }
562
- return result;
563
- };
564
- helpers4.toPath = function() {
565
- var prop = [];
566
- for (var i = 0; i < arguments.length; i++) {
567
- if (typeof arguments[i] === "string" || typeof arguments[i] === "number") {
568
- prop.push(arguments[i]);
569
- }
570
- }
571
- return prop.join(".");
572
- };
573
- helpers4.get = function(prop, context, options) {
574
- var val = utils.get(context, prop);
575
- if (options && options.fn) {
576
- return val ? options.fn(val) : options.inverse(context);
577
- }
578
- return val;
579
- };
580
- helpers4.getObject = function(prop, context) {
581
- return utils.getObject(context, prop);
582
- };
583
- helpers4.hasOwn = function(context, key) {
584
- return hasOwn.call(context, key);
585
- };
586
- helpers4.isObject = function(value) {
587
- return utils.typeOf(value) === "object";
588
- };
589
- helpers4.JSONparse = function(str, options) {
590
- return JSON.parse(str);
591
- };
592
- helpers4.JSONstringify = function(obj, indent) {
593
- if (!utils.isNumber(indent)) {
594
- indent = 0;
595
- }
596
- return JSON.stringify(obj, null, indent);
597
- };
598
- helpers4.merge = function(context) {
599
- var args = [].slice.call(arguments);
600
- var opts = {};
601
- if (util.isOptions(args[args.length - 1])) {
602
- opts = args.pop().hash;
603
- args.push(opts);
604
- }
605
- return Object.assign.apply(null, args);
606
- };
607
- helpers4.parseJSON = helpers4.JSONparse;
608
- helpers4.pick = function(props, context, options) {
609
- var keys = array.arrayify(props);
610
- var len = keys.length, i = -1;
611
- var result = {};
612
- while (++i < len) {
613
- result = helpers4.extend({}, result, utils.getObject(context, keys[i]));
614
- }
615
- if (options.fn) {
616
- if (Object.keys(result).length) {
617
- return options.fn(result);
618
- }
619
- return options.inverse(context);
620
- }
621
- return result;
622
- };
623
- helpers4.stringify = helpers4.JSONstringify;
706
+ // src/helpers/i18n.ts
707
+ import get from "get-value";
708
+ var i18n = function(prop, locals, options) {
709
+ if (locals && typeof locals === "object" && "hash" in locals && options === void 0) {
710
+ options = locals;
711
+ locals = {};
624
712
  }
625
- });
713
+ if (typeof prop !== "string") {
714
+ throw new Error('{{i18n}} helper expected "key" to be a string');
715
+ }
716
+ const context = {
717
+ ...this,
718
+ ...locals,
719
+ ...options?.hash ?? {}
720
+ };
721
+ const lang = context.language || context.lang;
722
+ if (typeof lang !== "string") {
723
+ throw new TypeError('{{i18n}} helper expected "language" to be a string');
724
+ }
725
+ const cache = context[lang];
726
+ if (typeof cache === "undefined") {
727
+ throw new Error(`{{i18n}} helper cannot find language "${lang}"`);
728
+ }
729
+ const result = get(cache, prop);
730
+ if (typeof result === "undefined") {
731
+ throw new Error(
732
+ '{{i18n}} helper cannot find property "' + String(prop) + '" for language "' + lang + '"'
733
+ );
734
+ }
735
+ return String(result);
736
+ };
737
+ var helpers8 = [
738
+ {
739
+ name: "i18n",
740
+ category: "i18n",
741
+ compatibility: ["browser", "nodejs"],
742
+ fn: i18n
743
+ }
744
+ ];
626
745
 
627
- // helpers/lib/collection.js
628
- var require_collection = __commonJS({
629
- "helpers/lib/collection.js"(exports2, module2) {
630
- "use strict";
631
- var util = require("handlebars-utils");
632
- var object = require_object();
633
- var array = require_array();
634
- var forEach = array.forEach;
635
- var forOwn = object.forOwn;
636
- var helpers4 = module2.exports;
637
- helpers4.isEmpty = function(collection, options) {
638
- if (!util.isOptions(options)) {
639
- options = collection;
640
- return util.fn(true, this, options);
641
- }
642
- if (Array.isArray(collection) && !collection.length) {
643
- return util.fn(true, this, options);
644
- }
645
- var keys = Object.keys(collection);
646
- var isEmpty = typeof collection === "object" && !keys.length;
647
- return util.value(isEmpty, this, options);
648
- };
649
- helpers4.iterate = function(collection, options) {
650
- if (Array.isArray(collection)) {
651
- return forEach.apply(null, arguments);
652
- }
653
- if (util.isObject(collection)) {
654
- return forOwn.apply(null, arguments);
655
- }
656
- return options.inverse(this);
657
- };
746
+ // src/helpers/inflection.ts
747
+ var inflect = (count, singular, plural, includeCount) => {
748
+ const word = count > 1 || count === 0 ? plural : singular;
749
+ return includeCount ? `${count} ${word}` : word;
750
+ };
751
+ var ordinalize = (value) => {
752
+ const num = Math.abs(Math.round(Number(value)));
753
+ const str = String(value);
754
+ const res = num % 100;
755
+ if ([11, 12, 13].includes(res)) {
756
+ return `${str}th`;
658
757
  }
659
- });
758
+ switch (num % 10) {
759
+ case 1:
760
+ return `${str}st`;
761
+ case 2:
762
+ return `${str}nd`;
763
+ case 3:
764
+ return `${str}rd`;
765
+ default:
766
+ return `${str}th`;
767
+ }
768
+ };
769
+ var helpers9 = [
770
+ {
771
+ name: "inflect",
772
+ category: "inflection",
773
+ compatibility: ["browser", "nodejs"],
774
+ fn: inflect
775
+ },
776
+ {
777
+ name: "ordinalize",
778
+ category: "inflection",
779
+ compatibility: ["browser", "nodejs"],
780
+ fn: ordinalize
781
+ }
782
+ ];
783
+
784
+ // src/helpers/logging.ts
785
+ import loggingHelpers from "logging-helpers";
786
+ var {
787
+ log,
788
+ ok,
789
+ success,
790
+ info,
791
+ warning,
792
+ warn,
793
+ error,
794
+ danger,
795
+ bold,
796
+ _debug,
797
+ _inspect
798
+ } = loggingHelpers;
799
+ var helpers10 = [
800
+ {
801
+ name: "log",
802
+ category: "logging",
803
+ compatibility: ["nodejs"],
804
+ fn: log
805
+ },
806
+ {
807
+ name: "ok",
808
+ category: "logging",
809
+ compatibility: ["nodejs"],
810
+ fn: ok
811
+ },
812
+ {
813
+ name: "success",
814
+ category: "logging",
815
+ compatibility: ["nodejs"],
816
+ fn: success
817
+ },
818
+ {
819
+ name: "info",
820
+ category: "logging",
821
+ compatibility: ["nodejs"],
822
+ fn: info
823
+ },
824
+ {
825
+ name: "warning",
826
+ category: "logging",
827
+ compatibility: ["nodejs"],
828
+ fn: warning
829
+ },
830
+ {
831
+ name: "warn",
832
+ category: "logging",
833
+ compatibility: ["nodejs"],
834
+ fn: warn
835
+ },
836
+ {
837
+ name: "error",
838
+ category: "logging",
839
+ compatibility: ["nodejs"],
840
+ fn: error
841
+ },
842
+ {
843
+ name: "danger",
844
+ category: "logging",
845
+ compatibility: ["nodejs"],
846
+ fn: danger
847
+ },
848
+ {
849
+ name: "bold",
850
+ category: "logging",
851
+ compatibility: ["nodejs"],
852
+ fn: bold
853
+ },
854
+ {
855
+ name: "_debug",
856
+ category: "logging",
857
+ compatibility: ["nodejs"],
858
+ fn: _debug
859
+ },
860
+ {
861
+ name: "_inspect",
862
+ category: "logging",
863
+ compatibility: ["nodejs"],
864
+ fn: _inspect
865
+ }
866
+ ];
867
+
868
+ // src/helpers/match.ts
869
+ import micromatch2 from "micromatch";
870
+ var match = (files, patterns, options) => {
871
+ const pats = typeof patterns === "string" ? patterns.split(/, */) : patterns;
872
+ return micromatch2(files, pats, options);
873
+ };
874
+ var isMatch = (filepath, pattern, options) => {
875
+ return micromatch2.isMatch(filepath, pattern, options);
876
+ };
877
+ var mm = (...args) => {
878
+ console.log("the {{mm}} helper is depcrecated and will be removed");
879
+ console.log("in handlebars-helpers v1.0.0, please use the {{match}}");
880
+ console.log("helper instead.");
881
+ return match(...args);
882
+ };
883
+ var helpers11 = [
884
+ {
885
+ name: "match",
886
+ category: "match",
887
+ compatibility: ["browser", "nodejs"],
888
+ fn: match
889
+ },
890
+ {
891
+ name: "isMatch",
892
+ category: "match",
893
+ compatibility: ["browser", "nodejs"],
894
+ fn: isMatch
895
+ },
896
+ {
897
+ name: "mm",
898
+ category: "match",
899
+ compatibility: ["browser", "nodejs"],
900
+ fn: mm
901
+ }
902
+ ];
903
+
904
+ // src/helpers/math.ts
905
+ var isNumeric = (value) => typeof value === "number" && !Number.isNaN(value) || typeof value === "string" && value.trim() !== "" && !Number.isNaN(Number(value));
906
+ var toNumber = (value, message = "expected a number") => {
907
+ if (isNumeric(value)) {
908
+ return Number(value);
909
+ }
910
+ throw new TypeError(message);
911
+ };
912
+ var abs = (value) => {
913
+ const num = toNumber(value);
914
+ return Math.abs(num);
915
+ };
916
+ var add = (a, b) => {
917
+ if (isNumeric(a) && isNumeric(b)) {
918
+ return Number(a) + Number(b);
919
+ }
920
+ return "";
921
+ };
922
+ var avg = (...values) => {
923
+ const flat = values.flat().map((n) => Number(n));
924
+ return sum(flat) / flat.length;
925
+ };
926
+ var ceil = (value) => {
927
+ const num = toNumber(value);
928
+ return Math.ceil(num);
929
+ };
930
+ var divide = (a, b) => {
931
+ const numA = toNumber(a, "expected the first argument to be a number");
932
+ const numB = toNumber(b, "expected the second argument to be a number");
933
+ return numA / numB;
934
+ };
935
+ var floor = (value) => {
936
+ const num = toNumber(value);
937
+ return Math.floor(num);
938
+ };
939
+ var minus = (a, b) => {
940
+ const numA = toNumber(a, "expected the first argument to be a number");
941
+ const numB = toNumber(b, "expected the second argument to be a number");
942
+ return numA - numB;
943
+ };
944
+ var modulo = (a, b) => {
945
+ const numA = toNumber(a, "expected the first argument to be a number");
946
+ const numB = toNumber(b, "expected the second argument to be a number");
947
+ return numA % numB;
948
+ };
949
+ var multiply = (a, b) => {
950
+ const numA = toNumber(a, "expected the first argument to be a number");
951
+ const numB = toNumber(b, "expected the second argument to be a number");
952
+ return numA * numB;
953
+ };
954
+ var plus = (a, b) => {
955
+ const numA = toNumber(a, "expected the first argument to be a number");
956
+ const numB = toNumber(b, "expected the second argument to be a number");
957
+ return numA + numB;
958
+ };
959
+ var random = (min, max) => {
960
+ const minNum = toNumber(min, "expected minimum to be a number");
961
+ const maxNum = toNumber(max, "expected maximum to be a number");
962
+ return minNum + Math.floor(Math.random() * (maxNum - minNum + 1));
963
+ };
964
+ var remainder = (a, b) => a % b;
965
+ var round = (value) => {
966
+ const num = toNumber(value);
967
+ return Math.round(num);
968
+ };
969
+ var subtract = (a, b) => {
970
+ const numA = toNumber(a, "expected the first argument to be a number");
971
+ const numB = toNumber(b, "expected the second argument to be a number");
972
+ return numA - numB;
973
+ };
974
+ var sum = (...values) => {
975
+ const flat = values.flat();
976
+ let total = 0;
977
+ for (const value of flat) {
978
+ if (isNumeric(value)) {
979
+ total += Number(value);
980
+ }
981
+ }
982
+ return total;
983
+ };
984
+ var times = (a, b) => multiply(a, b);
985
+ var helpers12 = [
986
+ {
987
+ name: "abs",
988
+ category: "math",
989
+ compatibility: ["browser", "nodejs"],
990
+ fn: abs
991
+ },
992
+ {
993
+ name: "add",
994
+ category: "math",
995
+ compatibility: ["browser", "nodejs"],
996
+ fn: add
997
+ },
998
+ {
999
+ name: "avg",
1000
+ category: "math",
1001
+ compatibility: ["browser", "nodejs"],
1002
+ fn: avg
1003
+ },
1004
+ {
1005
+ name: "ceil",
1006
+ category: "math",
1007
+ compatibility: ["browser", "nodejs"],
1008
+ fn: ceil
1009
+ },
1010
+ {
1011
+ name: "divide",
1012
+ category: "math",
1013
+ compatibility: ["browser", "nodejs"],
1014
+ fn: divide
1015
+ },
1016
+ {
1017
+ name: "floor",
1018
+ category: "math",
1019
+ compatibility: ["browser", "nodejs"],
1020
+ fn: floor
1021
+ },
1022
+ {
1023
+ name: "minus",
1024
+ category: "math",
1025
+ compatibility: ["browser", "nodejs"],
1026
+ fn: minus
1027
+ },
1028
+ {
1029
+ name: "modulo",
1030
+ category: "math",
1031
+ compatibility: ["browser", "nodejs"],
1032
+ fn: modulo
1033
+ },
1034
+ {
1035
+ name: "multiply",
1036
+ category: "math",
1037
+ compatibility: ["browser", "nodejs"],
1038
+ fn: multiply
1039
+ },
1040
+ {
1041
+ name: "plus",
1042
+ category: "math",
1043
+ compatibility: ["browser", "nodejs"],
1044
+ fn: plus
1045
+ },
1046
+ {
1047
+ name: "random",
1048
+ category: "math",
1049
+ compatibility: ["browser", "nodejs"],
1050
+ fn: random
1051
+ },
1052
+ {
1053
+ name: "remainder",
1054
+ category: "math",
1055
+ compatibility: ["browser", "nodejs"],
1056
+ fn: remainder
1057
+ },
1058
+ {
1059
+ name: "round",
1060
+ category: "math",
1061
+ compatibility: ["browser", "nodejs"],
1062
+ fn: round
1063
+ },
1064
+ {
1065
+ name: "subtract",
1066
+ category: "math",
1067
+ compatibility: ["browser", "nodejs"],
1068
+ fn: subtract
1069
+ },
1070
+ {
1071
+ name: "sum",
1072
+ category: "math",
1073
+ compatibility: ["browser", "nodejs"],
1074
+ fn: sum
1075
+ },
1076
+ {
1077
+ name: "times",
1078
+ category: "math",
1079
+ compatibility: ["browser", "nodejs"],
1080
+ fn: times
1081
+ }
1082
+ ];
660
1083
 
661
- // helpers/lib/comparison.js
662
- var require_comparison = __commonJS({
663
- "helpers/lib/comparison.js"(exports2, module2) {
664
- "use strict";
665
- var has = require("has-value");
666
- var util = require("handlebars-utils");
667
- var utils = require_utils2();
668
- var helpers4 = module2.exports;
669
- helpers4.and = function() {
670
- var len = arguments.length - 1;
671
- var options = arguments[len];
672
- var val = true;
673
- for (var i = 0; i < len; i++) {
674
- if (!arguments[i]) {
675
- val = false;
676
- break;
677
- }
678
- }
679
- return util.value(val, this, options);
680
- };
681
- helpers4.compare = function(a, operator, b, options) {
682
- if (arguments.length < 4) {
683
- throw new Error("handlebars Helper {{compare}} expects 4 arguments");
684
- }
685
- var result;
686
- switch (operator) {
687
- case "==":
688
- result = a == b;
689
- break;
690
- case "===":
691
- result = a === b;
692
- break;
693
- case "!=":
694
- result = a != b;
695
- break;
696
- case "!==":
697
- result = a !== b;
698
- break;
699
- case "<":
700
- result = a < b;
701
- break;
702
- case ">":
703
- result = a > b;
704
- break;
705
- case "<=":
706
- result = a <= b;
707
- break;
708
- case ">=":
709
- result = a >= b;
710
- break;
711
- case "typeof":
712
- result = typeof a === b;
713
- break;
714
- default: {
715
- throw new Error("helper {{compare}}: invalid operator: `" + operator + "`");
716
- }
717
- }
718
- return util.value(result, this, options);
719
- };
720
- helpers4.contains = function(collection, value, startIndex, options) {
721
- if (typeof startIndex === "object") {
722
- options = startIndex;
723
- startIndex = void 0;
724
- }
725
- var val = utils.contains(collection, value, startIndex);
726
- return util.value(val, this, options);
727
- };
728
- helpers4.default = function() {
729
- for (var i = 0; i < arguments.length - 1; i++) {
730
- if (arguments[i] != null) return arguments[i];
731
- }
732
- return "";
733
- };
734
- helpers4.eq = function(a, b, options) {
735
- if (arguments.length === 2) {
736
- options = b;
737
- b = options.hash.compare;
738
- }
739
- return util.value(a === b, this, options);
740
- };
741
- helpers4.gt = function(a, b, options) {
742
- if (arguments.length === 2) {
743
- options = b;
744
- b = options.hash.compare;
745
- }
746
- return util.value(a > b, this, options);
747
- };
748
- helpers4.gte = function(a, b, options) {
749
- if (arguments.length === 2) {
750
- options = b;
751
- b = options.hash.compare;
752
- }
753
- return util.value(a >= b, this, options);
754
- };
755
- helpers4.has = function(value, pattern, options) {
756
- if (util.isOptions(value)) {
757
- options = value;
758
- pattern = null;
759
- value = null;
760
- }
761
- if (util.isOptions(pattern)) {
762
- options = pattern;
763
- pattern = null;
764
- }
765
- if (value === null) {
766
- return util.value(false, this, options);
767
- }
768
- if (arguments.length === 2) {
769
- return util.value(has(this, value), this, options);
770
- }
771
- if ((Array.isArray(value) || util.isString(value)) && util.isString(pattern)) {
772
- if (value.indexOf(pattern) > -1) {
773
- return util.fn(true, this, options);
774
- }
775
- }
776
- if (util.isObject(value) && util.isString(pattern) && pattern in value) {
777
- return util.fn(true, this, options);
778
- }
779
- return util.inverse(false, this, options);
780
- };
781
- helpers4.isFalsey = function(val, options) {
782
- return util.value(utils.falsey(val), this, options);
783
- };
784
- helpers4.isTruthy = function(val, options) {
785
- return util.value(!utils.falsey(val), this, options);
786
- };
787
- helpers4.ifEven = function(num, options) {
788
- return util.value(utils.isEven(num), this, options);
789
- };
790
- helpers4.ifNth = function(a, b, options) {
791
- var isNth = utils.isNumber(a) && utils.isNumber(b) && b % a === 0;
792
- return util.value(isNth, this, options);
793
- };
794
- helpers4.ifOdd = function(val, options) {
795
- return util.value(!utils.isEven(val), this, options);
796
- };
797
- helpers4.is = function(a, b, options) {
798
- if (arguments.length === 2) {
799
- options = b;
800
- b = options.hash.compare;
801
- }
802
- return util.value(a == b, this, options);
803
- };
804
- helpers4.isnt = function(a, b, options) {
805
- if (arguments.length === 2) {
806
- options = b;
807
- b = options.hash.compare;
808
- }
809
- return util.value(a != b, this, options);
810
- };
811
- helpers4.lt = function(a, b, options) {
812
- if (arguments.length === 2) {
813
- options = b;
814
- b = options.hash.compare;
815
- }
816
- return util.value(a < b, this, options);
817
- };
818
- helpers4.lte = function(a, b, options) {
819
- if (arguments.length === 2) {
820
- options = b;
821
- b = options.hash.compare;
822
- }
823
- return util.value(a <= b, this, options);
824
- };
825
- helpers4.neither = function(a, b, options) {
826
- return util.value(!a && !b, this, options);
827
- };
828
- helpers4.not = function(val, options) {
829
- return util.value(!val, this, options);
830
- };
831
- helpers4.or = function() {
832
- var len = arguments.length - 1;
833
- var options = arguments[len];
834
- var val = false;
835
- for (var i = 0; i < len; i++) {
836
- if (arguments[i]) {
837
- val = true;
838
- break;
839
- }
840
- }
841
- return util.value(val, this, options);
842
- };
843
- helpers4.unlessEq = function(a, b, options) {
844
- if (util.isOptions(b)) {
845
- options = b;
846
- b = options.hash.compare;
847
- }
848
- return util.value(a !== b, this, options);
849
- };
850
- helpers4.unlessGt = function(a, b, options) {
851
- if (util.isOptions(b)) {
852
- options = b;
853
- b = options.hash.compare;
854
- }
855
- return util.value(a <= b, this, options);
856
- };
857
- helpers4.unlessLt = function(a, b, options) {
858
- if (util.isOptions(b)) {
859
- options = b;
860
- b = options.hash.compare;
861
- }
862
- return util.value(a >= b, this, options);
863
- };
864
- helpers4.unlessGteq = function(a, b, options) {
865
- if (util.isOptions(b)) {
866
- options = b;
867
- b = options.hash.compare;
868
- }
869
- return util.value(a < b, this, options);
870
- };
871
- helpers4.unlessLteq = function(a, b, options) {
872
- if (util.isOptions(b)) {
873
- options = b;
874
- b = options.hash.compare;
875
- }
876
- return util.value(a > b, this, options);
877
- };
1084
+ // src/helpers/md.ts
1085
+ import fs3 from "fs";
1086
+ import path4 from "path";
1087
+ import process2 from "process";
1088
+ import ent from "ent";
1089
+ import Handlebars from "handlebars";
1090
+ import { Remarkable } from "remarkable";
1091
+ var renderMarkdown = (input, options = {}) => {
1092
+ const options_ = { cwd: process2.cwd(), ...options };
1093
+ const md = new Remarkable({
1094
+ breaks: true,
1095
+ html: true,
1096
+ langPrefix: "lang-",
1097
+ typographer: false,
1098
+ xhtmlOut: false
1099
+ });
1100
+ const filepath = path4.resolve(options_.cwd, input);
1101
+ let string_ = input;
1102
+ if (fs3.existsSync(filepath)) {
1103
+ string_ = fs3.readFileSync(filepath, "utf8");
1104
+ }
1105
+ return new Handlebars.SafeString(ent.decode(md.render(string_)));
1106
+ };
1107
+ var helpers13 = [
1108
+ {
1109
+ name: "md",
1110
+ category: "markdown",
1111
+ compatibility: ["nodejs"],
1112
+ fn: renderMarkdown
1113
+ }
1114
+ ];
1115
+
1116
+ // src/helpers/misc.ts
1117
+ import get2 from "get-value";
1118
+ import createFrame from "handlebars-helper-create-frame";
1119
+ import util from "handlebars-utils";
1120
+ import kindOf from "kind-of";
1121
+ var frame = createFrame;
1122
+ function option(prop, locals, options) {
1123
+ return get2(util.options(this, locals, options), prop);
1124
+ }
1125
+ function noop(options) {
1126
+ return options.fn(this);
1127
+ }
1128
+ var typeOf = kindOf;
1129
+ function withHash(options) {
1130
+ if (options.hash && Object.keys(options.hash).length) {
1131
+ return options.fn(options.hash);
1132
+ }
1133
+ return options.inverse(this);
1134
+ }
1135
+ var helpers14 = [
1136
+ {
1137
+ name: "frame",
1138
+ category: "misc",
1139
+ compatibility: ["browser", "nodejs"],
1140
+ fn: frame
1141
+ },
1142
+ {
1143
+ name: "option",
1144
+ category: "misc",
1145
+ compatibility: ["browser", "nodejs"],
1146
+ fn: option
1147
+ },
1148
+ {
1149
+ name: "noop",
1150
+ category: "misc",
1151
+ compatibility: ["browser", "nodejs"],
1152
+ fn: noop
1153
+ },
1154
+ {
1155
+ name: "typeOf",
1156
+ category: "misc",
1157
+ compatibility: ["browser", "nodejs"],
1158
+ fn: typeOf
1159
+ },
1160
+ {
1161
+ name: "withHash",
1162
+ category: "misc",
1163
+ compatibility: ["browser", "nodejs"],
1164
+ fn: withHash
1165
+ }
1166
+ ];
1167
+
1168
+ // src/helpers/number.ts
1169
+ var isNumeric2 = (value) => typeof value === "number" && !Number.isNaN(value);
1170
+ var bytes = (value, precision) => {
1171
+ if (value == null) return "0 B";
1172
+ let num;
1173
+ if (typeof value === "string") {
1174
+ num = value.length;
1175
+ if (!num) return "0 B";
1176
+ } else if (isNumeric2(value)) {
1177
+ num = Number(value);
1178
+ } else if (typeof value.length === "number") {
1179
+ num = value.length;
1180
+ if (!num) return "0 B";
1181
+ } else {
1182
+ return "0 B";
1183
+ }
1184
+ const prec = typeof precision === "number" && !Number.isNaN(precision) ? precision : 2;
1185
+ const abbr = ["B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
1186
+ const factor = 10 ** prec;
1187
+ for (let i = abbr.length - 1; i >= 0; i--) {
1188
+ const size = 10 ** (i * 3);
1189
+ if (size <= num + 1) {
1190
+ const val = Math.round(num * factor / size) / factor;
1191
+ return `${val} ${abbr[i]}`;
1192
+ }
1193
+ }
1194
+ return `${num}`;
1195
+ };
1196
+ var addCommas = (num) => num.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
1197
+ var phoneNumber = (num) => {
1198
+ const str = num.toString();
1199
+ return `(${str.substr(0, 3)}) ${str.substr(3, 3)}-${str.substr(6, 4)}`;
1200
+ };
1201
+ var toAbbr = (value, precision) => {
1202
+ const num = isNumeric2(value) ? Number(value) : 0;
1203
+ const prec = typeof precision === "number" && !Number.isNaN(precision) ? precision : 2;
1204
+ const factor = 10 ** prec;
1205
+ const abbr = ["k", "m", "b", "t", "q"];
1206
+ for (let i = abbr.length - 1; i >= 0; i--) {
1207
+ const size = 10 ** ((i + 1) * 3);
1208
+ if (size <= num + 1) {
1209
+ const val = Math.round(num * factor / size) / factor;
1210
+ return `${val}${abbr[i]}`;
1211
+ }
1212
+ }
1213
+ return `${num}`;
1214
+ };
1215
+ var toExponential = (value, digits) => {
1216
+ const num = isNumeric2(value) ? Number(value) : 0;
1217
+ const d = typeof digits === "number" && !Number.isNaN(digits) ? digits : 0;
1218
+ return Number(num).toExponential(d);
1219
+ };
1220
+ var toFixed = (value, digits) => {
1221
+ const num = isNumeric2(value) ? Number(value) : 0;
1222
+ const d = typeof digits === "number" && !Number.isNaN(digits) ? digits : 0;
1223
+ return Number(num).toFixed(d);
1224
+ };
1225
+ var toFloat = (value) => parseFloat(String(value));
1226
+ var toInt = (value) => parseInt(String(value), 10);
1227
+ var toPrecision = (value, precision) => {
1228
+ const num = isNumeric2(value) ? Number(value) : 0;
1229
+ const prec = typeof precision === "number" && !Number.isNaN(precision) ? precision : 1;
1230
+ return Number(num).toPrecision(prec);
1231
+ };
1232
+ var helpers15 = [
1233
+ {
1234
+ name: "bytes",
1235
+ category: "number",
1236
+ compatibility: ["browser", "nodejs"],
1237
+ fn: bytes
1238
+ },
1239
+ {
1240
+ name: "addCommas",
1241
+ category: "number",
1242
+ compatibility: ["browser", "nodejs"],
1243
+ fn: addCommas
1244
+ },
1245
+ {
1246
+ name: "phoneNumber",
1247
+ category: "number",
1248
+ compatibility: ["browser", "nodejs"],
1249
+ fn: phoneNumber
1250
+ },
1251
+ {
1252
+ name: "toAbbr",
1253
+ category: "number",
1254
+ compatibility: ["browser", "nodejs"],
1255
+ fn: toAbbr
1256
+ },
1257
+ {
1258
+ name: "toExponential",
1259
+ category: "number",
1260
+ compatibility: ["browser", "nodejs"],
1261
+ fn: toExponential
1262
+ },
1263
+ {
1264
+ name: "toFixed",
1265
+ category: "number",
1266
+ compatibility: ["browser", "nodejs"],
1267
+ fn: toFixed
1268
+ },
1269
+ {
1270
+ name: "toFloat",
1271
+ category: "number",
1272
+ compatibility: ["browser", "nodejs"],
1273
+ fn: toFloat
1274
+ },
1275
+ {
1276
+ name: "toInt",
1277
+ category: "number",
1278
+ compatibility: ["browser", "nodejs"],
1279
+ fn: toInt
1280
+ },
1281
+ {
1282
+ name: "toPrecision",
1283
+ category: "number",
1284
+ compatibility: ["browser", "nodejs"],
1285
+ fn: toPrecision
1286
+ }
1287
+ ];
1288
+
1289
+ // src/helpers/object.ts
1290
+ import getObject from "get-object";
1291
+ import get3 from "get-value";
1292
+ var isOptions2 = (value) => {
1293
+ return Boolean(value && typeof value === "object" && "hash" in value);
1294
+ };
1295
+ var createFrame2 = (options, hash) => ({
1296
+ ...options?.data || {},
1297
+ ...hash
1298
+ });
1299
+ var extend = (...objects) => {
1300
+ const args = [...objects];
1301
+ if (args.length && isOptions2(args[args.length - 1])) {
1302
+ const opts = args.pop();
1303
+ args.push(opts.hash);
1304
+ }
1305
+ const result = {};
1306
+ for (const obj of args) {
1307
+ if (obj && typeof obj === "object" && !Array.isArray(obj)) {
1308
+ Object.assign(result, obj);
1309
+ }
1310
+ }
1311
+ return result;
1312
+ };
1313
+ var forIn = (obj, options) => {
1314
+ if (!isOptions2(options)) {
1315
+ return options?.inverse?.(obj) ?? "";
1316
+ }
1317
+ const data = createFrame2(options, options.hash || {});
1318
+ let result = "";
1319
+ for (const key in obj) {
1320
+ data.key = key;
1321
+ result += options.fn(obj[key], { data });
1322
+ }
1323
+ return result;
1324
+ };
1325
+ var forOwn = (obj, options) => {
1326
+ if (!isOptions2(options)) {
1327
+ return options?.inverse?.(obj) ?? "";
1328
+ }
1329
+ const data = createFrame2(options, options.hash || {});
1330
+ let result = "";
1331
+ for (const key in obj) {
1332
+ if (Object.hasOwn(obj, key)) {
1333
+ data.key = key;
1334
+ result += options.fn(obj[key], { data });
1335
+ }
1336
+ }
1337
+ return result;
1338
+ };
1339
+ var toPath = (...prop) => {
1340
+ const parts = [];
1341
+ for (const p of prop) {
1342
+ if (typeof p === "string" || typeof p === "number") {
1343
+ parts.push(p);
1344
+ }
1345
+ }
1346
+ return parts.join(".");
1347
+ };
1348
+ var getHelper = (prop, context, options) => {
1349
+ const val = get3(context, prop);
1350
+ if (options && typeof options.fn === "function") {
1351
+ return val ? options.fn(val) : options.inverse?.(context);
1352
+ }
1353
+ return val;
1354
+ };
1355
+ var getObjectHelper = (prop, context) => {
1356
+ return getObject(context, prop);
1357
+ };
1358
+ var hasOwn = (context, key) => {
1359
+ return Object.hasOwn(context, key);
1360
+ };
1361
+ var isObject = (value) => {
1362
+ return Boolean(value) && typeof value === "object" && !Array.isArray(value);
1363
+ };
1364
+ var JSONparse = (str) => {
1365
+ return JSON.parse(str);
1366
+ };
1367
+ var JSONstringify = (obj, indent) => {
1368
+ const ind = typeof indent === "number" ? indent : 0;
1369
+ return JSON.stringify(obj, null, ind);
1370
+ };
1371
+ var merge = (context, ...objects) => {
1372
+ const args = [context, ...objects];
1373
+ if (args.length && isOptions2(args[args.length - 1])) {
1374
+ const opts = args.pop();
1375
+ args.push(opts.hash);
1376
+ }
1377
+ return Object.assign(...args);
1378
+ };
1379
+ var parseJSON = JSONparse;
1380
+ var stringify = JSONstringify;
1381
+ var pick = (props, context, options) => {
1382
+ const keys = arrayify(props);
1383
+ let result = {};
1384
+ for (const key of keys) {
1385
+ result = Object.assign({}, result, getObject(context, key));
1386
+ }
1387
+ if (options && typeof options.fn === "function") {
1388
+ if (Object.keys(result).length) {
1389
+ return options.fn(result);
1390
+ }
1391
+ return options.inverse?.(context);
1392
+ }
1393
+ return result;
1394
+ };
1395
+ var helpers16 = [
1396
+ {
1397
+ name: "extend",
1398
+ category: "object",
1399
+ compatibility: ["browser", "nodejs"],
1400
+ fn: extend
1401
+ },
1402
+ {
1403
+ name: "forIn",
1404
+ category: "object",
1405
+ compatibility: ["browser", "nodejs"],
1406
+ fn: forIn
1407
+ },
1408
+ {
1409
+ name: "forOwn",
1410
+ category: "object",
1411
+ compatibility: ["browser", "nodejs"],
1412
+ fn: forOwn
1413
+ },
1414
+ {
1415
+ name: "toPath",
1416
+ category: "object",
1417
+ compatibility: ["browser", "nodejs"],
1418
+ fn: toPath
1419
+ },
1420
+ {
1421
+ name: "get",
1422
+ category: "object",
1423
+ compatibility: ["browser", "nodejs"],
1424
+ fn: getHelper
1425
+ },
1426
+ {
1427
+ name: "getObject",
1428
+ category: "object",
1429
+ compatibility: ["browser", "nodejs"],
1430
+ fn: getObjectHelper
1431
+ },
1432
+ {
1433
+ name: "hasOwn",
1434
+ category: "object",
1435
+ compatibility: ["browser", "nodejs"],
1436
+ fn: hasOwn
1437
+ },
1438
+ {
1439
+ name: "isObject",
1440
+ category: "object",
1441
+ compatibility: ["browser", "nodejs"],
1442
+ fn: isObject
1443
+ },
1444
+ {
1445
+ name: "JSONparse",
1446
+ category: "object",
1447
+ compatibility: ["browser", "nodejs"],
1448
+ fn: JSONparse
1449
+ },
1450
+ {
1451
+ name: "JSONstringify",
1452
+ category: "object",
1453
+ compatibility: ["browser", "nodejs"],
1454
+ fn: JSONstringify
1455
+ },
1456
+ {
1457
+ name: "merge",
1458
+ category: "object",
1459
+ compatibility: ["browser", "nodejs"],
1460
+ fn: merge
1461
+ },
1462
+ {
1463
+ name: "parseJSON",
1464
+ category: "object",
1465
+ compatibility: ["browser", "nodejs"],
1466
+ fn: parseJSON
1467
+ },
1468
+ {
1469
+ name: "pick",
1470
+ category: "object",
1471
+ compatibility: ["browser", "nodejs"],
1472
+ fn: pick
1473
+ },
1474
+ {
1475
+ name: "stringify",
1476
+ category: "object",
1477
+ compatibility: ["browser", "nodejs"],
1478
+ fn: stringify
878
1479
  }
879
- });
1480
+ ];
880
1481
 
881
- // helpers/lib/date.js
882
- var require_date = __commonJS({
883
- "helpers/lib/date.js"(exports2, module2) {
884
- "use strict";
885
- var helpers4 = module2.exports;
886
- helpers4.year = require("year");
887
- helpers4.moment = helpers4.date = require("helper-date");
1482
+ // src/helpers/path.ts
1483
+ import path5 from "path";
1484
+ var expectedType = (variableName, expectedType2, variableValue) => {
1485
+ const actualType = Object.prototype.toString.call(variableValue).slice(8, -1).toLowerCase();
1486
+ return `Expected ${variableName} to be of type ${expectedType2}, but got ${actualType}`;
1487
+ };
1488
+ var assertString = (name, value) => {
1489
+ if (typeof value !== "string") {
1490
+ throw new TypeError(expectedType(name, "string", value));
888
1491
  }
889
- });
890
-
891
- // helpers/lib/number.js
892
- var require_number = __commonJS({
893
- "helpers/lib/number.js"(exports2, module2) {
894
- "use strict";
895
- var isNumber = require("is-number");
896
- var util = require("handlebars-utils");
897
- var utils = require_utils2();
898
- var helpers4 = module2.exports;
899
- helpers4.bytes = function(number, precision, options) {
900
- if (number == null) return "0 B";
901
- if (!utils.isNumber(number)) {
902
- number = number.length;
903
- if (!number) return "0 B";
904
- }
905
- if (!utils.isNumber(precision)) {
906
- precision = 2;
907
- }
908
- var abbr = ["B", "kB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"];
909
- precision = Math.pow(10, precision);
910
- number = Number(number);
911
- var len = abbr.length - 1;
912
- while (len-- >= 0) {
913
- var size = Math.pow(10, len * 3);
914
- if (size <= number + 1) {
915
- number = Math.round(number * precision / size) / precision;
916
- number += " " + abbr[len];
917
- break;
918
- }
919
- }
920
- return number;
921
- };
922
- helpers4.addCommas = function(num) {
923
- return num.toString().replace(/(\d)(?=(\d\d\d)+(?!\d))/g, "$1,");
924
- };
925
- helpers4.phoneNumber = function(num) {
926
- num = num.toString();
927
- return "(" + num.substr(0, 3) + ") " + num.substr(3, 3) + "-" + num.substr(6, 4);
928
- };
929
- helpers4.toAbbr = function(number, precision) {
930
- if (!utils.isNumber(number)) {
931
- number = 0;
932
- }
933
- if (util.isUndefined(precision)) {
934
- precision = 2;
935
- }
936
- number = Number(number);
937
- precision = Math.pow(10, precision);
938
- var abbr = ["k", "m", "b", "t", "q"];
939
- var len = abbr.length - 1;
940
- while (len >= 0) {
941
- var size = Math.pow(10, (len + 1) * 3);
942
- if (size <= number + 1) {
943
- number = Math.round(number * precision / size) / precision;
944
- number += abbr[len];
945
- break;
946
- }
947
- len--;
948
- }
949
- return number;
950
- };
951
- helpers4.toExponential = function(number, digits) {
952
- if (!utils.isNumber(number)) {
953
- number = 0;
954
- }
955
- if (util.isUndefined(digits)) {
956
- digits = 0;
957
- }
958
- return Number(number).toExponential(digits);
959
- };
960
- helpers4.toFixed = function(number, digits) {
961
- if (!utils.isNumber(number)) {
962
- number = 0;
963
- }
964
- if (!isNumber(digits)) {
965
- digits = 0;
966
- }
967
- return Number(number).toFixed(digits);
968
- };
969
- helpers4.toFloat = function(number) {
970
- return parseFloat(number);
971
- };
972
- helpers4.toInt = function(number) {
973
- return parseInt(number, 10);
974
- };
975
- helpers4.toPrecision = function(number, precision) {
976
- if (!utils.isNumber(number)) {
977
- number = 0;
978
- }
979
- if (!isNumber(precision)) {
980
- precision = 1;
981
- }
982
- return Number(number).toPrecision(precision);
983
- };
1492
+ return value;
1493
+ };
1494
+ var absolute = function(filepath, options) {
1495
+ const fp = assertString("filepath", filepath);
1496
+ const cwd = options?.data?.root?.cwd ?? this?.cwd ?? process.cwd();
1497
+ return path5.resolve(cwd, fp);
1498
+ };
1499
+ var dirname = (filepath) => {
1500
+ const fp = assertString("filepath", filepath);
1501
+ return path5.dirname(fp);
1502
+ };
1503
+ var relative = (a, b) => {
1504
+ const from = assertString("first path", a);
1505
+ const to = assertString("second path", b);
1506
+ return path5.relative(path5.dirname(from), to);
1507
+ };
1508
+ var basename = (filepath) => {
1509
+ const fp = assertString("filepath", filepath);
1510
+ return path5.basename(fp);
1511
+ };
1512
+ var stem = (filepath) => {
1513
+ const fp = assertString("filepath", filepath);
1514
+ return path5.basename(fp, path5.extname(fp));
1515
+ };
1516
+ var extname = (filepath) => {
1517
+ const fp = assertString("filepath", filepath);
1518
+ return path5.extname(fp);
1519
+ };
1520
+ var resolveFn = function(filepath, ...paths) {
1521
+ let options;
1522
+ const last2 = paths[paths.length - 1];
1523
+ if (typeof last2 === "object" && last2 && "data" in last2) {
1524
+ options = paths.pop();
984
1525
  }
985
- });
986
-
987
- // helpers/lib/fs.js
988
- var require_fs = __commonJS({
989
- "helpers/lib/fs.js"(exports2, module2) {
990
- "use strict";
991
- var fs2 = require("fs");
992
- var path2 = require("path");
993
- var util = require("handlebars-utils");
994
- var utils = require_utils2();
995
- var number = require_number();
996
- var helpers4 = module2.exports;
997
- helpers4.fileSize = number.bytes;
998
- helpers4.read = function(filepath, options) {
999
- return fs2.readFileSync(filepath, "utf8");
1000
- };
1001
- helpers4.readdir = function(dir, filter) {
1002
- var files = fs2.readdirSync(dir);
1003
- files = files.map(function(fp) {
1004
- return path2.join(dir, fp);
1005
- });
1006
- if (util.isOptions(filter)) {
1007
- return files;
1008
- }
1009
- if (typeof filter === "function") {
1010
- return filter(files);
1011
- }
1012
- if (utils.typeOf(filter) === "regexp") {
1013
- return files.filter(function(fp) {
1014
- return filter.test(fp);
1015
- });
1016
- }
1017
- if (utils.isGlob(filter)) {
1018
- const isMatch = utils.mm.matcher(filter);
1019
- const result = [];
1020
- for (let i = 0; i < files.length; i++) {
1021
- if (isMatch(files[i])) {
1022
- result.push(files[i]);
1023
- }
1024
- }
1025
- return result;
1026
- }
1027
- if (["isFile", "isDirectory"].indexOf(filter) !== -1) {
1028
- return files.filter(function(fp) {
1029
- var stat = fs2.statSync(fp);
1030
- return stat[filter]();
1031
- });
1032
- }
1033
- return files;
1034
- };
1526
+ const cwd = options?.data?.root?.cwd ?? this?.cwd ?? process.cwd();
1527
+ const all2 = [
1528
+ cwd,
1529
+ assertString("filepath", filepath),
1530
+ ...paths.map((p, i) => assertString(`path${i}`, p))
1531
+ ];
1532
+ return path5.resolve(...all2);
1533
+ };
1534
+ var segments = (filepath, a, b) => {
1535
+ const fp = assertString("filepath", filepath);
1536
+ const start = Number(a);
1537
+ const end = Number(b);
1538
+ const segmentsArr = fp.split(/[\\/]+/);
1539
+ return segmentsArr.slice(start, end).join("/");
1540
+ };
1541
+ var helpers17 = [
1542
+ {
1543
+ name: "absolute",
1544
+ category: "path",
1545
+ compatibility: ["nodejs"],
1546
+ fn: absolute
1547
+ },
1548
+ {
1549
+ name: "dirname",
1550
+ category: "path",
1551
+ compatibility: ["nodejs"],
1552
+ fn: dirname
1553
+ },
1554
+ {
1555
+ name: "relative",
1556
+ category: "path",
1557
+ compatibility: ["nodejs"],
1558
+ fn: relative
1559
+ },
1560
+ {
1561
+ name: "basename",
1562
+ category: "path",
1563
+ compatibility: ["nodejs"],
1564
+ fn: basename
1565
+ },
1566
+ {
1567
+ name: "stem",
1568
+ category: "path",
1569
+ compatibility: ["nodejs"],
1570
+ fn: stem
1571
+ },
1572
+ {
1573
+ name: "extname",
1574
+ category: "path",
1575
+ compatibility: ["nodejs"],
1576
+ fn: extname
1577
+ },
1578
+ {
1579
+ name: "resolve",
1580
+ category: "path",
1581
+ compatibility: ["nodejs"],
1582
+ fn: resolveFn
1583
+ },
1584
+ {
1585
+ name: "segments",
1586
+ category: "path",
1587
+ compatibility: ["nodejs"],
1588
+ fn: segments
1035
1589
  }
1036
- });
1590
+ ];
1037
1591
 
1038
- // helpers/lib/utils/html.js
1039
- var require_html = __commonJS({
1040
- "helpers/lib/utils/html.js"(exports2, module2) {
1041
- "use strict";
1042
- var util = require("handlebars-utils");
1043
- var striptags = require("striptags");
1044
- var html = module2.exports;
1045
- html.condense = function(str) {
1046
- return str.replace(/(\r\n|\r|\n|\u2028|\u2029) {2,}/g, "\n");
1047
- };
1048
- html.padcomments = function(str) {
1049
- return str.replace(/(\s*<!--)/g, "\n$1");
1050
- };
1051
- html.parseAttributes = function parseAttributes(hash) {
1052
- return Object.keys(hash).map(function(key) {
1053
- var val = String(hash[key]).replace(/^['"]|["']$/g, "");
1054
- return key + '="' + val + '"';
1055
- }).join(" ");
1056
- };
1057
- html.sanitize = function(str) {
1058
- if (!util.isString(str)) return "";
1059
- return striptags(str).trim();
1060
- };
1061
- html.toAttributes = function toAttributes(hash) {
1062
- var res = "";
1063
- var keys = Object.keys(hash);
1064
- for (var i = 0; i < keys.length; i++) {
1065
- var val = hash[keys[i]];
1066
- if (val === true) {
1067
- res += " " + keys[i];
1068
- } else {
1069
- res += " " + keys[i] + '="' + String(val) + '"';
1070
- }
1071
- }
1072
- return res;
1073
- };
1592
+ // src/helpers/regex.ts
1593
+ import util2 from "handlebars-utils";
1594
+ var toRegex = (str, locals, options) => {
1595
+ const opts = util2.options({}, locals, options);
1596
+ return new RegExp(str, opts.flags);
1597
+ };
1598
+ var test = (str, regex) => {
1599
+ if (typeof str !== "string") {
1600
+ return false;
1074
1601
  }
1075
- });
1076
-
1077
- // helpers/lib/html.js
1078
- var require_html2 = __commonJS({
1079
- "helpers/lib/html.js"(exports2, module2) {
1080
- "use strict";
1081
- var path2 = require("path");
1082
- var util = require("handlebars-utils");
1083
- var html = require_html();
1084
- var utils = require_utils2();
1085
- var parseAttr = html.parseAttributes;
1086
- var helpers4 = module2.exports;
1087
- helpers4.attr = function(options) {
1088
- var val = parseAttr(options && options.hash || {});
1089
- return val.trim() ? " " + val : "";
1090
- };
1091
- helpers4.css = function(list, options) {
1092
- if (arguments.length < 2) {
1093
- options = list;
1094
- list = [];
1095
- }
1096
- var styles = util.arrayify(list);
1097
- var assets = "";
1098
- if (this && this.options) {
1099
- assets = this.options.assets || "";
1100
- }
1101
- if (options.hash.href) {
1102
- styles = util.arrayify(options.hash.href);
1103
- }
1104
- return styles.map(function(item) {
1105
- var ext = path2.extname(item);
1106
- var fp = item;
1107
- if (!/(^\/\/)|(:\/\/)/.test(item)) {
1108
- fp = path2.posix.join(assets, item);
1109
- }
1110
- if (ext === ".less") {
1111
- return '<link type="text/css" rel="stylesheet/less" href="' + fp + '">';
1112
- }
1113
- return '<link type="text/css" rel="stylesheet" href="' + fp + '">';
1114
- }).join("\n");
1115
- };
1116
- helpers4.js = function(context) {
1117
- if (utils.typeOf(context) === "object") {
1118
- var attr = parseAttr(context.hash);
1119
- return "<script" + (attr ? " " + attr : "") + "></script>";
1120
- }
1121
- if (utils.typeOf(context) === "string") {
1122
- return '<script src="' + context + '"></script>';
1123
- }
1124
- context = util.arrayify(context);
1125
- return context.map(function(fp) {
1126
- return path2.extname(fp) === ".coffee" ? utils.tag("script", { type: "text/coffeescript", src: fp }) : utils.tag("script", { src: fp });
1127
- }).join("\n");
1128
- };
1129
- helpers4.sanitize = function(str) {
1130
- return html.sanitize(str);
1131
- };
1132
- helpers4.ul = function(context, options) {
1133
- return "<ul " + parseAttr(options.hash) + ">" + context.map(function(item) {
1134
- if (typeof item !== "string") {
1135
- item = options.fn(item);
1136
- }
1137
- return "<li>" + item + "</li>";
1138
- }).join("\n") + "</ul>";
1139
- };
1140
- helpers4.ol = function(context, options) {
1141
- return "<ol " + parseAttr(options.hash) + ">" + context.map(function(item) {
1142
- if (typeof item !== "string") {
1143
- item = options.fn(item);
1144
- }
1145
- return "<li>" + item + "</li>";
1146
- }).join("\n") + "</ol>";
1147
- };
1148
- helpers4.thumbnailImage = function(context) {
1149
- var figure = "";
1150
- var image = "";
1151
- var link = context.full || false;
1152
- var imageAttributes = {
1153
- alt: context.alt,
1154
- src: context.thumbnail,
1155
- width: context.size.width,
1156
- height: context.size.height
1157
- };
1158
- var figureAttributes = { id: "image-" + context.id };
1159
- var linkAttributes = { href: link, rel: "thumbnail" };
1160
- if (context.classes) {
1161
- if (context.classes.image) {
1162
- imageAttributes.class = context.classes.image.join(" ");
1163
- }
1164
- if (context.classes.figure) {
1165
- figureAttributes.class = context.classes.figure.join(" ");
1166
- }
1167
- if (context.classes.link) {
1168
- linkAttributes.class = context.classes.link.join(" ");
1169
- }
1170
- }
1171
- figure += "<figure " + parseAttr(figureAttributes) + ">\n";
1172
- image += "<img " + parseAttr(imageAttributes) + ">\n";
1173
- if (link) {
1174
- figure += "<a " + parseAttr(linkAttributes) + ">\n" + image + "</a>\n";
1175
- } else {
1176
- figure += image;
1177
- }
1178
- if (context.caption) {
1179
- figure += "<figcaption>" + context.caption + "</figcaption>\n";
1180
- }
1181
- figure += "</figure>";
1182
- return figure;
1183
- };
1602
+ if (!(regex instanceof RegExp)) {
1603
+ throw new TypeError("expected a regular expression");
1184
1604
  }
1185
- });
1186
-
1187
- // helpers/lib/i18n.js
1188
- var require_i18n = __commonJS({
1189
- "helpers/lib/i18n.js"(exports2, module2) {
1190
- "use strict";
1191
- var util = require("handlebars-utils");
1192
- var utils = require_utils2();
1193
- var helpers4 = module2.exports;
1194
- helpers4.i18n = function(prop, locals, options) {
1195
- if (util.isOptions(locals)) {
1196
- options = locals;
1197
- locals = {};
1198
- }
1199
- if (!util.isString(prop)) {
1200
- throw new Error('{{i18n}} helper expected "key" to be a string');
1201
- }
1202
- var opts = util.options(this, locals, options);
1203
- var context = Object.assign({}, this, opts);
1204
- var lang = context.language || context.lang;
1205
- if (!util.isString(lang)) {
1206
- throw new TypeError('{{i18n}} helper expected "language" to be a string');
1207
- }
1208
- var cache = context[lang];
1209
- if (typeof cache === "undefined") {
1210
- throw new Error('{{i18n}} helper cannot find language "' + lang + '"');
1211
- }
1212
- var result = utils.get(cache, prop);
1213
- if (typeof result === "undefined") {
1214
- throw new Error('{{i18n}} helper cannot find property "' + prop + '" for language "' + lang + '"');
1215
- }
1216
- return result;
1217
- };
1605
+ return regex.test(str);
1606
+ };
1607
+ var helpers18 = [
1608
+ {
1609
+ name: "toRegex",
1610
+ category: "regex",
1611
+ compatibility: ["browser", "nodejs"],
1612
+ fn: toRegex
1613
+ },
1614
+ {
1615
+ name: "test",
1616
+ category: "regex",
1617
+ compatibility: ["browser", "nodejs"],
1618
+ fn: test
1218
1619
  }
1219
- });
1620
+ ];
1220
1621
 
1221
- // helpers/lib/inflection.js
1222
- var require_inflection = __commonJS({
1223
- "helpers/lib/inflection.js"(exports2, module2) {
1224
- "use strict";
1225
- var util = require("handlebars-utils");
1226
- var helpers4 = module2.exports;
1227
- helpers4.inflect = function(count, singular, plural, includeCount) {
1228
- var word = count > 1 || count === 0 ? plural : singular;
1229
- if (includeCount === true) {
1230
- return String(count) + " " + word;
1231
- } else {
1232
- return word;
1233
- }
1234
- };
1235
- helpers4.ordinalize = function(val) {
1236
- var num = Math.abs(Math.round(val));
1237
- var str = String(val);
1238
- var res = num % 100;
1239
- if (util.indexOf([11, 12, 13], res) >= 0) {
1240
- return str + "th";
1241
- }
1242
- switch (num % 10) {
1243
- case 1:
1244
- return str + "st";
1245
- case 2:
1246
- return str + "nd";
1247
- case 3:
1248
- return str + "rd";
1249
- default: {
1250
- return str + "th";
1251
- }
1252
- }
1253
- };
1622
+ // src/helpers/string.ts
1623
+ var chop = (str) => str.trim().replace(/^[-_.\W\s]+|[-_.\W\s]+$/g, "");
1624
+ var changecase = (str, fn) => {
1625
+ if (str.length === 1) return str.toLowerCase();
1626
+ const res = chop(str).toLowerCase();
1627
+ return res.replace(/[-_.\W\s]+(\w|$)/g, (_, ch) => fn(ch));
1628
+ };
1629
+ var append = (str, suffix) => {
1630
+ if (typeof str === "string" && typeof suffix === "string") {
1631
+ return str + suffix;
1254
1632
  }
1255
- });
1256
-
1257
- // helpers/lib/logging.js
1258
- var require_logging = __commonJS({
1259
- "helpers/lib/logging.js"(exports2, module2) {
1260
- "use strict";
1261
- module2.exports = require("logging-helpers");
1633
+ return str;
1634
+ };
1635
+ var camelcase = (str) => typeof str === "string" ? changecase(str, (ch) => ch.toUpperCase()) : "";
1636
+ var capitalize = (str) => {
1637
+ if (typeof str !== "string" || str.length === 0) return "";
1638
+ return str.charAt(0).toUpperCase() + str.slice(1);
1639
+ };
1640
+ var capitalizeAll = (str) => {
1641
+ if (typeof str !== "string") return "";
1642
+ return str.replace(/\w\S*/g, (word) => capitalize(word));
1643
+ };
1644
+ var center = (str, spaces) => {
1645
+ if (typeof str !== "string") return "";
1646
+ let space = "";
1647
+ for (let i = 0; i < spaces; i++) {
1648
+ space += "&nbsp;";
1262
1649
  }
1263
- });
1264
-
1265
- // helpers/lib/md.js
1266
- var require_md = __commonJS({
1267
- "helpers/lib/md.js"(exports2, module2) {
1268
- "use strict";
1269
- var fs2 = require("fs");
1270
- var path2 = require("path");
1271
- var { Remarkable: Remarkable2 } = require("remarkable");
1272
- var extend = require("extend-shallow");
1273
- var exists = require("fs-exists-sync");
1274
- var ent = require("ent");
1275
- var helper = module2.exports = function(name, options, cb) {
1276
- if (typeof options === "function") {
1277
- cb = options;
1278
- options = {};
1279
- }
1280
- if (typeof cb !== "function") {
1281
- return helper.sync.apply(this, arguments);
1282
- }
1283
- if (typeof this === "undefined" || typeof this.app === "undefined") {
1284
- throw new Error("md async helper expects `app` to be exposed on the context");
1285
- }
1286
- var opts = extend({ cwd: process.cwd() }, this.options, options);
1287
- opts = extend({}, opts, opts.hash);
1288
- var md = markdown(opts);
1289
- var filepath = path2.resolve(opts.cwd, name);
1290
- var view;
1291
- var str = "";
1292
- if (exists(filepath)) {
1293
- this.app.create("mdfiles");
1294
- str = fs2.readFileSync(filepath, "utf8");
1295
- view = this.app.mdfile(filepath, { path: filepath, content: str });
1296
- } else {
1297
- view = this.app.find(name);
1298
- }
1299
- if (typeof view === "undefined") {
1300
- cb(null, "");
1301
- return;
1302
- }
1303
- view.content = ent.decode(md.render(view.content));
1304
- this.app.render(view, this.context, function(err, res) {
1305
- if (err) return cb(err);
1306
- cb(null, res.content);
1307
- });
1308
- };
1309
- helper.sync = function(name, options) {
1310
- var ctx = this || {};
1311
- var app = ctx.app || {};
1312
- var opts = extend({ cwd: process.cwd() }, ctx.options, options);
1313
- opts = extend({}, opts, opts.hash);
1314
- var md = markdown(opts);
1315
- var filepath = path2.resolve(opts.cwd, name);
1316
- var view;
1317
- var html = "";
1318
- var str = "";
1319
- if (exists(filepath)) {
1320
- str = fs2.readFileSync(filepath, "utf8");
1321
- html = ent.decode(md.render(str));
1322
- } else if (app.views) {
1323
- view = app.find(name);
1324
- if (view) {
1325
- html = view.content = ent.decode(md.render(view.content));
1326
- }
1327
- }
1328
- if (view && typeof view.compile === "function") {
1329
- view.compile(opts);
1330
- var data = ctx.cache ? ctx.cache.data : {};
1331
- ctx = extend({}, data, view.data);
1332
- return view.fn(ctx);
1333
- }
1334
- if (typeof this.compile === "function") {
1335
- var fn = this.compile(html);
1336
- return fn(this);
1337
- }
1338
- return html;
1339
- };
1340
- function markdown(options) {
1341
- let optsConfig = options || {};
1342
- optsConfig.breaks = true;
1343
- optsConfig.html = true;
1344
- optsConfig.langPrefix = "lang-";
1345
- optsConfig.typographer = false;
1346
- optsConfig.xhtmlOut = false;
1347
- const md = new Remarkable2(optsConfig);
1348
- return md;
1650
+ return space + str + space;
1651
+ };
1652
+ var chopStr = (str) => typeof str === "string" ? chop(str) : "";
1653
+ var dashcase = (str) => typeof str === "string" ? changecase(str, (ch) => `-${ch}`) : "";
1654
+ var dotcase = (str) => typeof str === "string" ? changecase(str, (ch) => `.${ch}`) : "";
1655
+ var truncate = (str, limit, suffix) => {
1656
+ if (typeof str === "string") {
1657
+ if (typeof suffix !== "string") {
1658
+ suffix = "";
1349
1659
  }
1660
+ if (str.length > limit) {
1661
+ return str.slice(0, limit - suffix.length) + suffix;
1662
+ }
1663
+ return str;
1350
1664
  }
1351
- });
1352
-
1353
- // helpers/lib/markdown.js
1354
- var require_markdown = __commonJS({
1355
- "helpers/lib/markdown.js"(exports2, module2) {
1356
- "use strict";
1357
- var hljs = require("highlight.js");
1358
- var utils = require("handlebars-utils");
1359
- var { Remarkable: Remarkable2 } = require("remarkable");
1360
- var helpers4 = module2.exports;
1361
- var markdown;
1362
- Object.defineProperty(helpers4, "markdown", {
1363
- configurable: true,
1364
- enumerable: true,
1365
- set: function(val) {
1366
- markdown = val;
1367
- },
1368
- get: function() {
1369
- return markdown || (markdown = this.helpersForMarkdown());
1370
- }
1371
- });
1372
- helpers4.md = require_md();
1373
- helpers4.helpersForMarkdown = function(config) {
1374
- const defaults = { html: true, breaks: true, highlight: helpers4.highlightFormMarkdown };
1375
- if (typeof config === "string" || utils.isOptions(config)) {
1376
- return markdown2.apply(defaults, arguments);
1377
- }
1378
- function markdown2(str, locals, options) {
1379
- if (typeof str !== "string") {
1380
- options = locals;
1381
- locals = str;
1382
- str = true;
1383
- }
1384
- if (utils.isOptions(locals)) {
1385
- options = locals;
1386
- locals = {};
1387
- }
1388
- const ctx = utils.context(this, locals, options);
1389
- let opts = utils.options(this, locals, options);
1390
- opts = Object.assign({}, defaults, config, opts);
1391
- if (opts.hasOwnProperty("lang")) {
1392
- opts.langPrefix = opts.lang;
1393
- }
1394
- const md = new Remarkable2(opts);
1395
- const val = utils.value(str, ctx, options);
1396
- return md.render(val);
1397
- }
1398
- return markdown2;
1399
- };
1400
- helpers4.highlightFormMarkdown = function(code, lang) {
1401
- if (lang) {
1402
- return hljs.highlight(code, { language: lang }).value;
1403
- }
1404
- return hljs.highlightAuto(code).value;
1405
- };
1665
+ return "";
1666
+ };
1667
+ var ellipsis = (str, limit) => {
1668
+ if (typeof str === "string") {
1669
+ if (str.length <= limit) {
1670
+ return str;
1671
+ }
1672
+ return `${truncate(str, limit)}\u2026`;
1406
1673
  }
1407
- });
1408
-
1409
- // helpers/lib/match.js
1410
- var require_match = __commonJS({
1411
- "helpers/lib/match.js"(exports2, module2) {
1412
- "use strict";
1413
- var util = require("handlebars-utils");
1414
- var utils = require_utils2();
1415
- var helpers4 = module2.exports;
1416
- helpers4.match = function(files, patterns, locals, options) {
1417
- var opts = util.options(this, locals, options);
1418
- if (typeof patterns === "string") {
1419
- patterns = patterns.split(/, */);
1420
- }
1421
- return utils.mm(files, patterns, opts);
1422
- };
1423
- helpers4.isMatch = function(files, patterns, locals, options) {
1424
- var opts = util.options(this, locals, options);
1425
- return utils.mm.isMatch(files, patterns, opts);
1426
- };
1427
- helpers4.mm = function() {
1428
- console.log("the {{mm}} helper is depcrecated and will be removed");
1429
- console.log("in handlebars-helpers v1.0.0, please use the {{match}}");
1430
- console.log("helper instead.");
1431
- return helpers4.match.apply(this, arguments);
1432
- };
1674
+ return "";
1675
+ };
1676
+ var hyphenate = (str) => typeof str === "string" ? str.split(" ").join("-") : "";
1677
+ var isString = (value) => typeof value === "string";
1678
+ var lowercase = (str) => {
1679
+ if (typeof str === "object" && str !== null && "fn" in str && typeof str.fn === "function") {
1680
+ return String(str.fn()).toLowerCase();
1433
1681
  }
1434
- });
1435
-
1436
- // helpers/lib/math.js
1437
- var require_math = __commonJS({
1438
- "helpers/lib/math.js"(exports2, module2) {
1439
- "use strict";
1440
- var isNumber = require("is-number");
1441
- var utils = require_utils2();
1442
- var helpers4 = module2.exports;
1443
- helpers4.abs = function(num) {
1444
- if (!isNumber(num)) {
1445
- throw new TypeError("expected a number");
1446
- }
1447
- return Math.abs(num);
1448
- };
1449
- helpers4.add = function(a, b) {
1450
- if (isNumber(a) && isNumber(b)) {
1451
- return Number(a) + Number(b);
1452
- }
1453
- return "";
1454
- };
1455
- helpers4.avg = function() {
1456
- var args = [].concat.apply([], arguments);
1457
- args.pop();
1458
- return helpers4.sum(args) / args.length;
1459
- };
1460
- helpers4.ceil = function(num) {
1461
- if (!isNumber(num)) {
1462
- throw new TypeError("expected a number");
1463
- }
1464
- return Math.ceil(num);
1465
- };
1466
- helpers4.divide = function(a, b) {
1467
- if (!isNumber(a)) {
1468
- throw new TypeError("expected the first argument to be a number");
1469
- }
1470
- if (!isNumber(b)) {
1471
- throw new TypeError("expected the second argument to be a number");
1472
- }
1473
- return Number(a) / Number(b);
1474
- };
1475
- helpers4.floor = function(num) {
1476
- if (!isNumber(num)) {
1477
- throw new TypeError("expected a number");
1478
- }
1479
- return Math.floor(num);
1480
- };
1481
- helpers4.minus = function(a, b) {
1482
- if (!isNumber(a)) {
1483
- throw new TypeError("expected the first argument to be a number");
1484
- }
1485
- if (!isNumber(b)) {
1486
- throw new TypeError("expected the second argument to be a number");
1487
- }
1488
- return Number(a) - Number(b);
1489
- };
1490
- helpers4.modulo = function(a, b) {
1491
- if (!isNumber(a)) {
1492
- throw new TypeError("expected the first argument to be a number");
1493
- }
1494
- if (!isNumber(b)) {
1495
- throw new TypeError("expected the second argument to be a number");
1496
- }
1497
- return Number(a) % Number(b);
1498
- };
1499
- helpers4.multiply = function(a, b) {
1500
- if (!isNumber(a)) {
1501
- throw new TypeError("expected the first argument to be a number");
1502
- }
1503
- if (!isNumber(b)) {
1504
- throw new TypeError("expected the second argument to be a number");
1505
- }
1506
- return Number(a) * Number(b);
1507
- };
1508
- helpers4.plus = function(a, b) {
1509
- if (!isNumber(a)) {
1510
- throw new TypeError("expected the first argument to be a number");
1511
- }
1512
- if (!isNumber(b)) {
1513
- throw new TypeError("expected the second argument to be a number");
1514
- }
1515
- return Number(a) + Number(b);
1516
- };
1517
- helpers4.random = function(min, max) {
1518
- if (!isNumber(min)) {
1519
- throw new TypeError("expected minimum to be a number");
1520
- }
1521
- if (!isNumber(max)) {
1522
- throw new TypeError("expected maximum to be a number");
1523
- }
1524
- return utils.random(min, max);
1525
- };
1526
- helpers4.remainder = function(a, b) {
1527
- return a % b;
1528
- };
1529
- helpers4.round = function(num) {
1530
- if (!isNumber(num)) {
1531
- throw new TypeError("expected a number");
1532
- }
1533
- return Math.round(num);
1534
- };
1535
- helpers4.subtract = function(a, b) {
1536
- if (!isNumber(a)) {
1537
- throw new TypeError("expected the first argument to be a number");
1538
- }
1539
- if (!isNumber(b)) {
1540
- throw new TypeError("expected the second argument to be a number");
1541
- }
1542
- return Number(a) - Number(b);
1543
- };
1544
- helpers4.sum = function() {
1545
- var args = [].concat.apply([], arguments);
1546
- var len = args.length;
1547
- var sum = 0;
1548
- while (len--) {
1549
- if (utils.isNumber(args[len])) {
1550
- sum += Number(args[len]);
1551
- }
1552
- }
1553
- return sum;
1554
- };
1555
- helpers4.times = function() {
1556
- return helpers4.multiply.apply(this, arguments);
1557
- };
1682
+ if (typeof str !== "string") return "";
1683
+ return str.toLowerCase();
1684
+ };
1685
+ var downcase = (...args) => lowercase(...args);
1686
+ var occurrences = (str, substring) => {
1687
+ if (typeof str !== "string") return "";
1688
+ const len = substring.length;
1689
+ let pos = str.indexOf(substring, 0);
1690
+ let n = 0;
1691
+ while (pos > -1) {
1692
+ n++;
1693
+ pos = str.indexOf(substring, pos + len);
1558
1694
  }
1559
- });
1560
-
1561
- // helpers/lib/misc.js
1562
- var require_misc = __commonJS({
1563
- "helpers/lib/misc.js"(exports2, module2) {
1564
- "use strict";
1565
- var util = require("handlebars-utils");
1566
- var utils = require_utils2();
1567
- var helpers4 = module2.exports;
1568
- helpers4.frame = require("handlebars-helper-create-frame");
1569
- helpers4.option = function(prop, locals, options) {
1570
- return utils.get(util.options(this, locals, options), prop);
1571
- };
1572
- helpers4.noop = function(options) {
1573
- return options.fn(this);
1574
- };
1575
- helpers4.typeOf = require("kind-of");
1576
- helpers4.withHash = function(options) {
1577
- if (options.hash && Object.keys(options.hash).length) {
1578
- return options.fn(options.hash);
1579
- } else {
1580
- return options.inverse(this);
1581
- }
1582
- };
1695
+ return n;
1696
+ };
1697
+ var pascalcase = (str) => {
1698
+ if (typeof str !== "string") return "";
1699
+ const res = changecase(str, (ch) => ch.toUpperCase());
1700
+ return res.charAt(0).toUpperCase() + res.slice(1);
1701
+ };
1702
+ var pathcase = (str) => typeof str === "string" ? changecase(str, (ch) => `/${ch}`) : "";
1703
+ var plusify = (str, ch) => {
1704
+ if (typeof str !== "string") return "";
1705
+ if (typeof ch !== "string") ch = " ";
1706
+ return str.split(ch).join("+");
1707
+ };
1708
+ var prepend = (str, prefix) => {
1709
+ return typeof str === "string" && typeof prefix === "string" ? prefix + str : str;
1710
+ };
1711
+ var remove = (str, ch) => {
1712
+ if (typeof str !== "string") return "";
1713
+ if (typeof ch !== "string") return str;
1714
+ return str.split(ch).join("");
1715
+ };
1716
+ var removeFirst = (str, ch) => {
1717
+ if (typeof str !== "string") return "";
1718
+ if (typeof ch !== "string") return str;
1719
+ return str.replace(ch, "");
1720
+ };
1721
+ var replace = (str, a, b) => {
1722
+ if (typeof str !== "string") return "";
1723
+ if (typeof a !== "string") return str;
1724
+ if (typeof b !== "string") b = "";
1725
+ return str.split(a).join(b);
1726
+ };
1727
+ var replaceFirst = (str, a, b) => {
1728
+ if (typeof str !== "string") return "";
1729
+ if (typeof a !== "string") return str;
1730
+ if (typeof b !== "string") b = "";
1731
+ return str.replace(a, b);
1732
+ };
1733
+ var reverse = (str) => typeof str === "string" ? str.split("").reverse().join("") : "";
1734
+ var sentence = (str) => {
1735
+ if (typeof str !== "string") return "";
1736
+ return str.replace(
1737
+ /((?:\S[^.?!]*)[.?!]*)/g,
1738
+ (txt) => txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase()
1739
+ );
1740
+ };
1741
+ var snakecase = (str) => typeof str === "string" ? changecase(str, (ch) => `_${ch}`) : "";
1742
+ var trim = (str) => typeof str === "string" ? str.trim() : "";
1743
+ var trimLeft = (str) => typeof str === "string" ? str.replace(/^\s+/, "") : "";
1744
+ var trimRight = (str) => typeof str === "string" ? str.replace(/\s+$/, "") : "";
1745
+ var truncateWords = (str, count, suffix) => {
1746
+ if (typeof str === "string" && typeof count === "number" && Number.isFinite(count)) {
1747
+ if (typeof suffix !== "string") {
1748
+ suffix = "...";
1749
+ }
1750
+ const num = Math.trunc(count);
1751
+ let arr = str.split(" ");
1752
+ if (num < arr.length) {
1753
+ arr = arr.slice(0, num);
1754
+ }
1755
+ const val = arr.join(" ").trim();
1756
+ return val + suffix;
1583
1757
  }
1584
- });
1585
-
1586
- // helpers/lib/path.js
1587
- var require_path = __commonJS({
1588
- "helpers/lib/path.js"(exports2, module2) {
1589
- "use strict";
1590
- var util = require("handlebars-utils");
1591
- var path2 = require("path");
1592
- var utils = require_utils2();
1593
- var helpers4 = module2.exports;
1594
- utils.expectedType = (variableName, expectedType, variableValue) => {
1595
- const actualType = Object.prototype.toString.call(variableValue).slice(8, -1).toLowerCase();
1596
- if (actualType !== expectedType) {
1597
- throw new TypeError(`Expected ${variableName} to be of type ${expectedType}, but got ${actualType}`);
1598
- }
1599
- };
1600
- helpers4.absolute = function(filepath, options) {
1601
- options = options || { data: {} };
1602
- var context = util.options(this, options);
1603
- var ctx = Object.assign({}, options.data.root, context);
1604
- var cwd = ctx.cwd || process.cwd();
1605
- return path2.resolve(cwd, filepath);
1606
- };
1607
- helpers4.dirname = function(filepath, options) {
1608
- if (typeof filepath !== "string") {
1609
- throw new TypeError(utils.expectedType("filepath", "string", filepath));
1610
- }
1611
- return path2.dirname(filepath);
1612
- };
1613
- helpers4.relative = function(a, b) {
1614
- if (typeof a !== "string") {
1615
- throw new TypeError(utils.expectedType("first path", "string", a));
1616
- }
1617
- if (typeof b !== "string") {
1618
- throw new TypeError(utils.expectedType("second path", "string", b));
1619
- }
1620
- return utils.relative(a, b);
1621
- };
1622
- helpers4.basename = function(filepath) {
1623
- if (typeof filepath !== "string") {
1624
- throw new TypeError(utils.expectedType("filepath", "string", filepath));
1625
- }
1626
- return path2.basename(filepath);
1627
- };
1628
- helpers4.stem = function(filepath) {
1629
- if (typeof filepath !== "string") {
1630
- throw new TypeError(utils.expectedType("filepath", "string", filepath));
1631
- }
1632
- return path2.basename(filepath, path2.extname(filepath));
1633
- };
1634
- helpers4.extname = function(filepath) {
1635
- if (typeof filepath !== "string") {
1636
- throw new TypeError(utils.expectedType("filepath", "string", filepath));
1637
- }
1638
- return path2.extname(filepath);
1639
- };
1640
- helpers4.resolve = function(filepath) {
1641
- var args = [].slice.call(arguments);
1642
- var opts = util.options(this, args.pop());
1643
- var cwd = path2.resolve(opts.cwd || process.cwd());
1644
- args.unshift(cwd);
1645
- return path2.resolve.apply(path2, args);
1646
- };
1647
- helpers4.segments = function(filepath, a, b) {
1648
- if (typeof filepath !== "string") {
1649
- throw new TypeError(utils.expectedType("filepath", "string", filepath));
1650
- }
1651
- var segments = filepath.split(/[\\\/]+/);
1652
- return segments.slice(a, b).join("/");
1653
- };
1758
+ return "";
1759
+ };
1760
+ var truncateWordsAlias = truncateWords;
1761
+ var uppercase = (str) => {
1762
+ if (typeof str === "object" && str !== null && "fn" in str && typeof str.fn === "function") {
1763
+ return String(str.fn()).toUpperCase();
1654
1764
  }
1655
- });
1656
-
1657
- // helpers/lib/regex.js
1658
- var require_regex = __commonJS({
1659
- "helpers/lib/regex.js"(exports2, module2) {
1660
- "use strict";
1661
- var util = require("handlebars-utils");
1662
- var utils = require_utils2();
1663
- var helpers4 = module2.exports;
1664
- helpers4.toRegex = function(str, locals, options) {
1665
- var opts = util.options({}, locals, options);
1666
- return new RegExp(str, opts.flags);
1667
- };
1668
- helpers4.test = function(str, regex) {
1669
- if (!util.isString(str)) {
1670
- return false;
1671
- }
1672
- if (utils.typeOf(regex) !== "regexp") {
1673
- throw new TypeError("expected a regular expression");
1674
- }
1675
- return regex.test(str);
1676
- };
1765
+ if (typeof str !== "string") return "";
1766
+ return str.toUpperCase();
1767
+ };
1768
+ var upcase = (...args) => uppercase(...args);
1769
+ var helpers19 = [
1770
+ {
1771
+ name: "append",
1772
+ category: "string",
1773
+ compatibility: ["browser", "nodejs"],
1774
+ fn: append
1775
+ },
1776
+ {
1777
+ name: "camelcase",
1778
+ category: "string",
1779
+ compatibility: ["browser", "nodejs"],
1780
+ fn: camelcase
1781
+ },
1782
+ {
1783
+ name: "capitalize",
1784
+ category: "string",
1785
+ compatibility: ["browser", "nodejs"],
1786
+ fn: capitalize
1787
+ },
1788
+ {
1789
+ name: "capitalizeAll",
1790
+ category: "string",
1791
+ compatibility: ["browser", "nodejs"],
1792
+ fn: capitalizeAll
1793
+ },
1794
+ {
1795
+ name: "center",
1796
+ category: "string",
1797
+ compatibility: ["browser", "nodejs"],
1798
+ fn: center
1799
+ },
1800
+ {
1801
+ name: "chop",
1802
+ category: "string",
1803
+ compatibility: ["browser", "nodejs"],
1804
+ fn: chopStr
1805
+ },
1806
+ {
1807
+ name: "dashcase",
1808
+ category: "string",
1809
+ compatibility: ["browser", "nodejs"],
1810
+ fn: dashcase
1811
+ },
1812
+ {
1813
+ name: "dotcase",
1814
+ category: "string",
1815
+ compatibility: ["browser", "nodejs"],
1816
+ fn: dotcase
1817
+ },
1818
+ {
1819
+ name: "ellipsis",
1820
+ category: "string",
1821
+ compatibility: ["browser", "nodejs"],
1822
+ fn: ellipsis
1823
+ },
1824
+ {
1825
+ name: "hyphenate",
1826
+ category: "string",
1827
+ compatibility: ["browser", "nodejs"],
1828
+ fn: hyphenate
1829
+ },
1830
+ {
1831
+ name: "isString",
1832
+ category: "string",
1833
+ compatibility: ["browser", "nodejs"],
1834
+ fn: isString
1835
+ },
1836
+ {
1837
+ name: "lowercase",
1838
+ category: "string",
1839
+ compatibility: ["browser", "nodejs"],
1840
+ fn: lowercase
1841
+ },
1842
+ {
1843
+ name: "downcase",
1844
+ category: "string",
1845
+ compatibility: ["browser", "nodejs"],
1846
+ fn: downcase
1847
+ },
1848
+ {
1849
+ name: "occurrences",
1850
+ category: "string",
1851
+ compatibility: ["browser", "nodejs"],
1852
+ fn: occurrences
1853
+ },
1854
+ {
1855
+ name: "pascalcase",
1856
+ category: "string",
1857
+ compatibility: ["browser", "nodejs"],
1858
+ fn: pascalcase
1859
+ },
1860
+ {
1861
+ name: "pathcase",
1862
+ category: "string",
1863
+ compatibility: ["browser", "nodejs"],
1864
+ fn: pathcase
1865
+ },
1866
+ {
1867
+ name: "plusify",
1868
+ category: "string",
1869
+ compatibility: ["browser", "nodejs"],
1870
+ fn: plusify
1871
+ },
1872
+ {
1873
+ name: "prepend",
1874
+ category: "string",
1875
+ compatibility: ["browser", "nodejs"],
1876
+ fn: prepend
1877
+ },
1878
+ {
1879
+ name: "remove",
1880
+ category: "string",
1881
+ compatibility: ["browser", "nodejs"],
1882
+ fn: remove
1883
+ },
1884
+ {
1885
+ name: "removeFirst",
1886
+ category: "string",
1887
+ compatibility: ["browser", "nodejs"],
1888
+ fn: removeFirst
1889
+ },
1890
+ {
1891
+ name: "replace",
1892
+ category: "string",
1893
+ compatibility: ["browser", "nodejs"],
1894
+ fn: replace
1895
+ },
1896
+ {
1897
+ name: "replaceFirst",
1898
+ category: "string",
1899
+ compatibility: ["browser", "nodejs"],
1900
+ fn: replaceFirst
1901
+ },
1902
+ {
1903
+ name: "reverse",
1904
+ category: "string",
1905
+ compatibility: ["browser", "nodejs"],
1906
+ fn: reverse
1907
+ },
1908
+ {
1909
+ name: "sentence",
1910
+ category: "string",
1911
+ compatibility: ["browser", "nodejs"],
1912
+ fn: sentence
1913
+ },
1914
+ {
1915
+ name: "snakecase",
1916
+ category: "string",
1917
+ compatibility: ["browser", "nodejs"],
1918
+ fn: snakecase
1919
+ },
1920
+ {
1921
+ name: "trim",
1922
+ category: "string",
1923
+ compatibility: ["browser", "nodejs"],
1924
+ fn: trim
1925
+ },
1926
+ {
1927
+ name: "trimLeft",
1928
+ category: "string",
1929
+ compatibility: ["browser", "nodejs"],
1930
+ fn: trimLeft
1931
+ },
1932
+ {
1933
+ name: "trimRight",
1934
+ category: "string",
1935
+ compatibility: ["browser", "nodejs"],
1936
+ fn: trimRight
1937
+ },
1938
+ {
1939
+ name: "truncate",
1940
+ category: "string",
1941
+ compatibility: ["browser", "nodejs"],
1942
+ fn: truncate
1943
+ },
1944
+ {
1945
+ name: "truncateWords",
1946
+ category: "string",
1947
+ compatibility: ["browser", "nodejs"],
1948
+ fn: truncateWordsAlias
1949
+ },
1950
+ {
1951
+ name: "uppercase",
1952
+ category: "string",
1953
+ compatibility: ["browser", "nodejs"],
1954
+ fn: uppercase
1955
+ },
1956
+ {
1957
+ name: "upcase",
1958
+ category: "string",
1959
+ compatibility: ["browser", "nodejs"],
1960
+ fn: upcase
1677
1961
  }
1678
- });
1962
+ ];
1679
1963
 
1680
- // helpers/lib/string.js
1681
- var require_string = __commonJS({
1682
- "helpers/lib/string.js"(exports2, module2) {
1683
- "use strict";
1684
- var isNumber = require("is-number");
1685
- var util = require("handlebars-utils");
1686
- var utils = require_utils2();
1687
- var helpers4 = module2.exports;
1688
- helpers4.append = function(str, suffix) {
1689
- if (typeof str === "string" && typeof suffix === "string") {
1690
- return str + suffix;
1691
- }
1692
- return str;
1693
- };
1694
- helpers4.camelcase = function(str) {
1695
- if (!util.isString(str)) return "";
1696
- return utils.changecase(str, function(ch) {
1697
- return ch.toUpperCase();
1698
- });
1699
- };
1700
- helpers4.capitalize = function(str) {
1701
- if (!util.isString(str)) return "";
1702
- return str.charAt(0).toUpperCase() + str.slice(1);
1703
- };
1704
- helpers4.capitalizeAll = function(str) {
1705
- if (!util.isString(str)) return "";
1706
- if (util.isString(str)) {
1707
- return str.replace(/\w\S*/g, function(word) {
1708
- return helpers4.capitalize(word);
1709
- });
1710
- }
1711
- };
1712
- helpers4.center = function(str, spaces) {
1713
- if (!util.isString(str)) return "";
1714
- var space = "";
1715
- var i = 0;
1716
- while (i < spaces) {
1717
- space += "&nbsp;";
1718
- i++;
1719
- }
1720
- return space + str + space;
1721
- };
1722
- helpers4.chop = function(str) {
1723
- if (!util.isString(str)) return "";
1724
- return utils.chop(str);
1725
- };
1726
- helpers4.dashcase = function(str) {
1727
- if (!util.isString(str)) return "";
1728
- return utils.changecase(str, function(ch) {
1729
- return "-" + ch;
1730
- });
1731
- };
1732
- helpers4.dotcase = function(str) {
1733
- if (!util.isString(str)) return "";
1734
- return utils.changecase(str, function(ch) {
1735
- return "." + ch;
1736
- });
1737
- };
1738
- helpers4.downcase = function() {
1739
- return helpers4.lowercase.apply(this, arguments);
1740
- };
1741
- helpers4.ellipsis = function(str, limit) {
1742
- if (util.isString(str)) {
1743
- if (str.length <= limit) {
1744
- return str;
1745
- }
1746
- return helpers4.truncate(str, limit) + "\u2026";
1747
- }
1748
- };
1749
- helpers4.hyphenate = function(str) {
1750
- if (!util.isString(str)) return "";
1751
- return str.split(" ").join("-");
1752
- };
1753
- helpers4.isString = function(value) {
1754
- return typeof value === "string";
1755
- };
1756
- helpers4.lowercase = function(str) {
1757
- if (util.isObject(str) && str.fn) {
1758
- return str.fn(this).toLowerCase();
1759
- }
1760
- if (!util.isString(str)) return "";
1761
- return str.toLowerCase();
1762
- };
1763
- helpers4.occurrences = function(str, substring) {
1764
- if (!util.isString(str)) return "";
1765
- var len = substring.length;
1766
- var pos = 0;
1767
- var n = 0;
1768
- while ((pos = str.indexOf(substring, pos)) > -1) {
1769
- n++;
1770
- pos += len;
1771
- }
1772
- return n;
1773
- };
1774
- helpers4.pascalcase = function(str) {
1775
- if (!util.isString(str)) return "";
1776
- str = utils.changecase(str, function(ch) {
1777
- return ch.toUpperCase();
1778
- });
1779
- return str.charAt(0).toUpperCase() + str.slice(1);
1780
- };
1781
- helpers4.pathcase = function(str) {
1782
- if (!util.isString(str)) return "";
1783
- return utils.changecase(str, function(ch) {
1784
- return "/" + ch;
1785
- });
1786
- };
1787
- helpers4.plusify = function(str, ch) {
1788
- if (!util.isString(str)) return "";
1789
- if (!util.isString(ch)) ch = " ";
1790
- return str.split(ch).join("+");
1791
- };
1792
- helpers4.prepend = function(str, prefix) {
1793
- return typeof str === "string" && typeof prefix === "string" ? prefix + str : str;
1794
- };
1795
- helpers4.raw = function(options) {
1796
- var str = options.fn();
1797
- var opts = util.options(this, options);
1798
- if (opts.escape !== false) {
1799
- var idx = 0;
1800
- while ((idx = str.indexOf("{{", idx)) !== -1) {
1801
- if (str[idx - 1] !== "\\") {
1802
- str = str.slice(0, idx) + "\\" + str.slice(idx);
1803
- }
1804
- idx += 3;
1805
- }
1806
- }
1807
- return str;
1808
- };
1809
- helpers4.remove = function(str, ch) {
1810
- if (!util.isString(str)) return "";
1811
- if (!util.isString(ch)) return str;
1812
- return str.split(ch).join("");
1813
- };
1814
- helpers4.removeFirst = function(str, ch) {
1815
- if (!util.isString(str)) return "";
1816
- if (!util.isString(ch)) return str;
1817
- return str.replace(ch, "");
1818
- };
1819
- helpers4.replace = function(str, a, b) {
1820
- if (!util.isString(str)) return "";
1821
- if (!util.isString(a)) return str;
1822
- if (!util.isString(b)) b = "";
1823
- return str.split(a).join(b);
1824
- };
1825
- helpers4.replaceFirst = function(str, a, b) {
1826
- if (!util.isString(str)) return "";
1827
- if (!util.isString(a)) return str;
1828
- if (!util.isString(b)) b = "";
1829
- return str.replace(a, b);
1830
- };
1831
- helpers4.reverse = function(str) {
1832
- if (!util.isString(str)) return "";
1833
- return str.split("").reverse().join("");
1834
- };
1835
- helpers4.sentence = function(str) {
1836
- if (!util.isString(str)) return "";
1837
- return str.replace(/((?:\S[^\.\?\!]*)[\.\?\!]*)/g, function(txt) {
1838
- return txt.charAt(0).toUpperCase() + txt.substr(1).toLowerCase();
1839
- });
1840
- };
1841
- helpers4.snakecase = function(str) {
1842
- if (!util.isString(str)) return "";
1843
- return utils.changecase(str, function(ch) {
1844
- return "_" + ch;
1845
- });
1846
- };
1847
- helpers4.split = function(str, ch) {
1848
- if (!util.isString(str)) return "";
1849
- if (!util.isString(ch)) ch = ",";
1850
- return str.split(ch);
1851
- };
1852
- helpers4.startsWith = function(prefix, str, options) {
1853
- var args = [].slice.call(arguments);
1854
- options = args.pop();
1855
- if (util.isString(str) && str.indexOf(prefix) === 0) {
1856
- return options.fn(this);
1857
- }
1858
- if (typeof options.inverse === "function") {
1859
- return options.inverse(this);
1860
- }
1861
- return "";
1862
- };
1863
- helpers4.titleize = function(str) {
1864
- if (!util.isString(str)) return "";
1865
- var title = str.replace(/[- _]+/g, " ");
1866
- var words = title.split(" ");
1867
- var len = words.length;
1868
- var res = [];
1869
- var i = 0;
1870
- while (len--) {
1871
- var word = words[i++];
1872
- res.push(exports2.capitalize(word));
1873
- }
1874
- return res.join(" ");
1875
- };
1876
- helpers4.trim = function(str) {
1877
- return typeof str === "string" ? str.trim() : "";
1878
- };
1879
- helpers4.trimLeft = function(str) {
1880
- if (util.isString(str)) {
1881
- return str.replace(/^\s+/, "");
1882
- }
1883
- };
1884
- helpers4.trimRight = function(str) {
1885
- if (util.isString(str)) {
1886
- return str.replace(/\s+$/, "");
1887
- }
1888
- };
1889
- helpers4.truncate = function(str, limit, suffix) {
1890
- if (util.isString(str)) {
1891
- if (typeof suffix !== "string") {
1892
- suffix = "";
1893
- }
1894
- if (str.length > limit) {
1895
- return str.slice(0, limit - suffix.length) + suffix;
1896
- }
1897
- return str;
1898
- }
1899
- };
1900
- helpers4.truncateWords = function(str, count, suffix) {
1901
- if (util.isString(str) && isNumber(count)) {
1902
- if (typeof suffix !== "string") {
1903
- suffix = "...";
1904
- }
1905
- var num = Number(count);
1906
- var arr = str.split(" ");
1907
- if (num < arr.length) {
1908
- arr = arr.slice(0, num);
1909
- }
1910
- var val = arr.join(" ").trim();
1911
- return val + suffix;
1912
- }
1913
- };
1914
- helpers4.upcase = function() {
1915
- return helpers4.uppercase.apply(this, arguments);
1916
- };
1917
- helpers4.uppercase = function(str) {
1918
- if (util.isObject(str) && str.fn) {
1919
- return str.fn(this).toUpperCase();
1920
- }
1921
- if (!util.isString(str)) return "";
1922
- return str.toUpperCase();
1923
- };
1964
+ // src/helpers/url.ts
1965
+ import { escape as qsEscape } from "querystring";
1966
+ import { format, parse, resolve } from "url";
1967
+ var all = ["browser", "nodejs"];
1968
+ var encodeUri = (str) => {
1969
+ if (typeof str === "string") {
1970
+ return encodeURIComponent(str);
1924
1971
  }
1925
- });
1926
-
1927
- // helpers/lib/url.js
1928
- var require_url = __commonJS({
1929
- "helpers/lib/url.js"(exports2, module2) {
1930
- "use strict";
1931
- var url = require("url");
1932
- var util = require("handlebars-utils");
1933
- var querystring = require("querystring");
1934
- var helpers4 = module2.exports;
1935
- helpers4.encodeURI = function(str) {
1936
- if (util.isString(str)) {
1937
- return encodeURIComponent(str);
1938
- }
1939
- };
1940
- helpers4.escape = function(str) {
1941
- if (util.isString(str)) {
1942
- return querystring.escape(str);
1943
- }
1944
- };
1945
- helpers4.decodeURI = function(str) {
1946
- if (util.isString(str)) {
1947
- return decodeURIComponent(str);
1948
- }
1949
- };
1950
- helpers4.url_encode = function() {
1951
- return helpers4.encodeURI.apply(this, arguments);
1952
- };
1953
- helpers4.url_decode = function(val) {
1954
- return helpers4.decodeURI.apply(this, arguments);
1955
- };
1956
- helpers4.urlResolve = function(base, href) {
1957
- return url.resolve(base, href);
1958
- };
1959
- helpers4.urlParse = function(str) {
1960
- return url.parse(str);
1961
- };
1962
- helpers4.stripQuerystring = function(str) {
1963
- if (util.isString(str)) {
1964
- return str.split("?")[0];
1965
- }
1966
- };
1967
- helpers4.stripProtocol = function(str) {
1968
- if (util.isString(str)) {
1969
- var parsed = url.parse(str);
1970
- parsed.protocol = "";
1971
- return parsed.format();
1972
- }
1973
- };
1972
+ };
1973
+ var escapeFn = (str) => {
1974
+ if (typeof str === "string") {
1975
+ return qsEscape(str);
1974
1976
  }
1975
- });
1976
-
1977
- // helpers/lib/index.js
1978
- var require_lib = __commonJS({
1979
- "helpers/lib/index.js"(exports2, module2) {
1980
- "use strict";
1981
- module2.exports = {
1982
- array: require_array(),
1983
- code: require_code(),
1984
- collection: require_collection(),
1985
- comparison: require_comparison(),
1986
- date: require_date(),
1987
- fs: require_fs(),
1988
- html: require_html2(),
1989
- i18n: require_i18n(),
1990
- inflection: require_inflection(),
1991
- logging: require_logging(),
1992
- markdown: require_markdown(),
1993
- match: require_match(),
1994
- math: require_math(),
1995
- misc: require_misc(),
1996
- number: require_number(),
1997
- object: require_object(),
1998
- path: require_path(),
1999
- regex: require_regex(),
2000
- string: require_string(),
2001
- url: require_url()
2002
- };
1977
+ };
1978
+ var decodeUri = (str) => {
1979
+ if (typeof str === "string") {
1980
+ return decodeURIComponent(str);
2003
1981
  }
2004
- });
2005
-
2006
- // helpers/helpers.js
2007
- var require_helpers = __commonJS({
2008
- "helpers/helpers.js"(exports2, module2) {
2009
- "use strict";
2010
- var forIn = require("for-in");
2011
- var define = require("define-property");
2012
- var lib = require_lib();
2013
- module2.exports = function helpers4(groups, options) {
2014
- if (typeof groups === "string") {
2015
- groups = [groups];
2016
- } else if (!Array.isArray(groups)) {
2017
- options = groups;
2018
- groups = null;
2019
- }
2020
- options = options || {};
2021
- var hbs = options.handlebars || options.hbs || require("handlebars");
2022
- define(module2.exports, "handlebars", hbs);
2023
- if (groups) {
2024
- groups.forEach(function(key) {
2025
- hbs.registerHelper(lib[key]);
2026
- });
2027
- } else {
2028
- forIn(lib, function(group, key) {
2029
- hbs.registerHelper(group);
2030
- });
2031
- }
2032
- return hbs.helpers;
2033
- };
2034
- forIn(lib, function(group, key) {
2035
- define(module2.exports, key, function(options) {
2036
- options = options || {};
2037
- var hbs = options.handlebars || options.hbs || require("handlebars");
2038
- define(module2.exports, "handlebars", hbs);
2039
- hbs.registerHelper(group);
2040
- return hbs.helpers;
2041
- });
2042
- });
2043
- module2.exports.utils = require_utils2();
1982
+ };
1983
+ function urlEncode(...args) {
1984
+ return encodeUri.apply(this, args);
1985
+ }
1986
+ function urlDecode(...args) {
1987
+ return decodeUri.apply(this, args);
1988
+ }
1989
+ var urlResolve = (base, href) => resolve(String(base), String(href));
1990
+ var urlParse = (str) => parse(String(str));
1991
+ var stripQuerystring = (str) => {
1992
+ if (typeof str === "string") {
1993
+ return str.split("?")[0];
2044
1994
  }
2045
- });
2046
-
2047
- // src/index.ts
2048
- var index_exports = {};
2049
- __export(index_exports, {
2050
- Handlebars: () => Handlebars2,
2051
- HelperRegistry: () => HelperRegistry,
2052
- createHandlebars: () => createHandlebars,
2053
- fumanchu: () => fumanchu,
2054
- handlebars: () => handlebars,
2055
- helpers: () => helpers3
2056
- });
2057
- module.exports = __toCommonJS(index_exports);
2058
- var HandlebarsLib = __toESM(require("handlebars"));
2059
- var import_helpers = __toESM(require_helpers());
2060
-
2061
- // src/helpers/date.ts
2062
- var import_chrono_node = require("chrono-node");
2063
- var import_dayjs = __toESM(require("dayjs"));
2064
- var year = () => (/* @__PURE__ */ new Date()).getFullYear().toString();
2065
- var date = (humanReadableDate, formatString) => {
2066
- const parsedDate = (0, import_chrono_node.parseDate)(humanReadableDate);
2067
- if (!parsedDate) {
2068
- throw new Error(`Unable to parse date: ${humanReadableDate}`);
1995
+ };
1996
+ var stripProtocol = (str) => {
1997
+ if (typeof str === "string") {
1998
+ const parsed = parse(str);
1999
+ parsed.protocol = "";
2000
+ return format(parsed);
2069
2001
  }
2070
- return (0, import_dayjs.default)(parsedDate).format(formatString);
2071
2002
  };
2072
- var helpers = [
2003
+ var helpers20 = [
2073
2004
  {
2074
- name: "year",
2075
- category: "date",
2076
- fn: year
2005
+ name: "encodeURI",
2006
+ category: "url",
2007
+ compatibility: all,
2008
+ fn: encodeUri
2077
2009
  },
2078
2010
  {
2079
- name: "date",
2080
- category: "date",
2081
- fn: date
2011
+ name: "escape",
2012
+ category: "url",
2013
+ compatibility: ["nodejs"],
2014
+ fn: escapeFn
2082
2015
  },
2083
2016
  {
2084
- /* Adding this in for legacy support */
2085
- name: "moment",
2086
- category: "date",
2087
- fn: date
2088
- }
2089
- ];
2090
-
2091
- // src/helpers/md.ts
2092
- var import_node_fs = __toESM(require("fs"));
2093
- var import_node_path = __toESM(require("path"));
2094
- var import_node_process = __toESM(require("process"));
2095
- var import_handlebars = __toESM(require("handlebars"));
2096
- var import_remarkable = require("remarkable");
2097
- var renderMarkdown = (input, options = {}) => {
2098
- const options_ = __spreadValues({ cwd: import_node_process.default.cwd() }, options);
2099
- const md = new import_remarkable.Remarkable({
2100
- breaks: true,
2101
- html: true,
2102
- langPrefix: "lang-",
2103
- typographer: false,
2104
- xhtmlOut: false
2105
- });
2106
- const filepath = import_node_path.default.resolve(options_.cwd, input);
2107
- let string_ = input;
2108
- if (import_node_fs.default.existsSync(filepath)) {
2109
- string_ = import_node_fs.default.readFileSync(filepath, "utf8");
2110
- }
2111
- return new import_handlebars.default.SafeString(md.render(string_));
2112
- };
2113
- var helpers2 = [
2017
+ name: "decodeURI",
2018
+ category: "url",
2019
+ compatibility: all,
2020
+ fn: decodeUri
2021
+ },
2114
2022
  {
2115
- name: "md",
2116
- category: "markdown",
2117
- fn: renderMarkdown
2023
+ name: "url_encode",
2024
+ category: "url",
2025
+ compatibility: all,
2026
+ fn: urlEncode
2027
+ },
2028
+ {
2029
+ name: "url_decode",
2030
+ category: "url",
2031
+ compatibility: all,
2032
+ fn: urlDecode
2033
+ },
2034
+ {
2035
+ name: "urlResolve",
2036
+ category: "url",
2037
+ compatibility: ["nodejs"],
2038
+ fn: urlResolve
2039
+ },
2040
+ {
2041
+ name: "urlParse",
2042
+ category: "url",
2043
+ compatibility: ["nodejs"],
2044
+ fn: urlParse
2045
+ },
2046
+ {
2047
+ name: "stripQuerystring",
2048
+ category: "url",
2049
+ compatibility: all,
2050
+ fn: stripQuerystring
2051
+ },
2052
+ {
2053
+ name: "stripProtocol",
2054
+ category: "url",
2055
+ compatibility: ["nodejs"],
2056
+ fn: stripProtocol
2118
2057
  }
2119
2058
  ];
2120
2059
 
2121
2060
  // src/helper-registry.ts
2122
2061
  var HelperRegistry = class {
2062
+ _helpers = [];
2123
2063
  constructor() {
2124
- this._helpers = [];
2125
2064
  this.init();
2126
2065
  }
2066
+ /**
2067
+ * Get all registered helpers.
2068
+ * @returns {Helper[]} The array of registered helpers.
2069
+ */
2070
+ get helpers() {
2071
+ return this._helpers;
2072
+ }
2073
+ /**
2074
+ * Initialize the helper registry. This is performed during the construction of the registry such as new HelperRegistry().
2075
+ */
2127
2076
  init() {
2128
2077
  this.registerHelpers(helpers);
2078
+ this.registerHelpers(helpers3);
2079
+ this.registerHelpers(helpers5);
2080
+ this.registerHelpers(helpers6);
2129
2081
  this.registerHelpers(helpers2);
2082
+ this.registerHelpers(helpers13);
2083
+ this.registerHelpers(helpers7);
2084
+ this.registerHelpers(helpers4);
2085
+ this.registerHelpers(helpers8);
2086
+ this.registerHelpers(helpers9);
2087
+ this.registerHelpers(helpers10);
2088
+ this.registerHelpers(helpers11);
2089
+ this.registerHelpers(helpers12);
2090
+ this.registerHelpers(helpers14);
2091
+ this.registerHelpers(helpers15);
2092
+ this.registerHelpers(helpers17);
2093
+ this.registerHelpers(helpers18);
2094
+ this.registerHelpers(helpers19);
2095
+ this.registerHelpers(helpers20);
2096
+ this.registerHelpers(helpers16);
2130
2097
  }
2098
+ /**
2099
+ * Register a helper.
2100
+ * @param {Helper} helper The helper to register.
2101
+ * @returns True if the helper was registered, false otherwise.
2102
+ */
2131
2103
  register(helper) {
2132
2104
  const result = false;
2133
2105
  if (!this.has(helper.name)) {
@@ -2135,25 +2107,65 @@ var HelperRegistry = class {
2135
2107
  }
2136
2108
  return result;
2137
2109
  }
2138
- registerHelpers(helpers4) {
2139
- for (const helper of helpers4) {
2110
+ /**
2111
+ * Register multiple helpers.
2112
+ * @param {Helper[]} helpers The array of helpers to register.
2113
+ */
2114
+ registerHelpers(helpers22) {
2115
+ for (const helper of helpers22) {
2140
2116
  this.register(helper);
2141
2117
  }
2142
2118
  }
2119
+ /**
2120
+ * Check if a helper is registered.
2121
+ * @param name The name of the helper.
2122
+ * @returns True if the helper is registered, false otherwise.
2123
+ */
2143
2124
  has(name) {
2144
2125
  return this._helpers.some((helper) => helper.name === name);
2145
2126
  }
2127
+ /**
2128
+ * Filter helpers by the given criteria.
2129
+ * @param filter The filter criteria.
2130
+ * @returns The filtered helpers.
2131
+ */
2146
2132
  filter(filter) {
2147
- return this._helpers.filter(
2148
- (helper) => (!filter.name || helper.name === filter.name) && (!filter.category || helper.category === filter.category) && (!filter.compatibility || helper.compatibility === filter.compatibility)
2149
- );
2133
+ let result = this._helpers;
2134
+ if (filter.names) {
2135
+ result = result.filter((helper) => filter.names?.includes(helper.name));
2136
+ }
2137
+ if (filter.categories) {
2138
+ result = result.filter(
2139
+ (helper) => filter.categories?.includes(helper.category)
2140
+ );
2141
+ }
2142
+ if (filter.compatibility) {
2143
+ result = result.filter(
2144
+ (helper) => helper.compatibility?.some((c) => filter.compatibility?.includes(c))
2145
+ );
2146
+ }
2147
+ return result;
2150
2148
  }
2151
- loadHandlebars(handlebars2) {
2152
- for (const helper of this._helpers) {
2149
+ /**
2150
+ * Load Handlebars helpers.
2151
+ * @param {Handlebars} handlebars The Handlebars instance.
2152
+ * @returns {void}
2153
+ */
2154
+ load(handlebars2, filters) {
2155
+ let helpers22 = this._helpers;
2156
+ if (filters) {
2157
+ helpers22 = this.filter(filters);
2158
+ }
2159
+ for (const helper of helpers22) {
2153
2160
  handlebars2.registerHelper(helper.name, helper.fn);
2154
2161
  }
2155
2162
  }
2156
- swapHelpers(handlebars2) {
2163
+ /**
2164
+ * Swap Handlebars helpers. This is used when you want to swap out legacy helpers for fumanchu helpers.
2165
+ * @param handlebars The Handlebars instance.
2166
+ * @returns {void}
2167
+ */
2168
+ swap(handlebars2) {
2157
2169
  for (const helper of this._helpers) {
2158
2170
  handlebars2.unregisterHelper(helper.name);
2159
2171
  handlebars2.registerHelper(helper.name, helper.fn);
@@ -2164,41 +2176,35 @@ var HelperRegistry = class {
2164
2176
  // src/index.ts
2165
2177
  var Handlebars2 = HandlebarsLib;
2166
2178
  var handlebars = HandlebarsLib.create();
2167
- var helpers3 = import_helpers.default;
2168
- function createHandlebars() {
2169
- return __async(this, null, function* () {
2170
- const registry = new HelperRegistry();
2171
- const handlebars2 = HandlebarsLib.create();
2172
- const helpersFunction = yield import_helpers.default;
2173
- helpersFunction({ handlebars: handlebars2 });
2174
- registry.swapHelpers(handlebars2);
2175
- return handlebars2;
2176
- });
2179
+ function helpers21(options) {
2180
+ const registry = new HelperRegistry();
2181
+ registry.load(options.handlebars ?? options.hbs);
2177
2182
  }
2178
- function fumanchu(options) {
2183
+ async function createHandlebars() {
2179
2184
  const registry = new HelperRegistry();
2180
2185
  const handlebars2 = HandlebarsLib.create();
2181
- registry.loadHandlebars(handlebars2);
2186
+ registry.load(handlebars2);
2187
+ if (process.env.NODE_ENV === "development") {
2188
+ console.warn(
2189
+ "createHandlebars will be deprecated in future versions, use `fumanchu` instead."
2190
+ );
2191
+ }
2192
+ return handlebars2;
2193
+ }
2194
+ function fumanchu(options) {
2195
+ const registry = new HelperRegistry();
2196
+ let handlebars2 = HandlebarsLib.create();
2197
+ if (options?.handlebars) {
2198
+ handlebars2 = options.handlebars;
2199
+ }
2200
+ registry.load(handlebars2);
2182
2201
  return handlebars2;
2183
2202
  }
2184
- // Annotate the CommonJS export names for ESM import in node:
2185
- 0 && (module.exports = {
2186
- Handlebars,
2203
+ export {
2204
+ Handlebars2 as Handlebars,
2187
2205
  HelperRegistry,
2188
2206
  createHandlebars,
2189
2207
  fumanchu,
2190
2208
  handlebars,
2191
- helpers
2192
- });
2193
- /*!
2194
- * helper-markdown <https://github.com/jonschlinkert/helper-markdown>
2195
- *
2196
- * Copyright (c) 2014 Jon Schlinkert, contributors.
2197
- * Licensed under the MIT license.
2198
- */
2199
- /*!
2200
- * handlebars-helpers <https://github.com/helpers/handlebars-helpers>
2201
- *
2202
- * Copyright (c) 2013-2017, Jon Schlinkert, Brian Woodward.
2203
- * Released under the MIT License.
2204
- */
2209
+ helpers21 as helpers
2210
+ };