@noormdev/sdk 1.0.0-alpha.9 → 1.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.
@@ -0,0 +1,2591 @@
1
+ import { createRequire } from 'module';
2
+ import { attemptSync, observer, attempt } from './chunk-QAECL4RN.js';
3
+ import { dist_default } from './chunk-TBRUDUBQ.js';
4
+ import { readFile as readFile$1, readdir, stat } from 'fs/promises';
5
+ import * as fs from 'fs';
6
+ import { readFileSync, createReadStream, unlinkSync } from 'fs';
7
+ import * as path from 'path';
8
+ import path__default, { dirname, join } from 'path';
9
+ import { pathToFileURL } from 'url';
10
+ import { randomBytes, pbkdf2Sync, createCipheriv, createDecipheriv } from 'crypto';
11
+ import { gunzipSync, createGunzip } from 'zlib';
12
+ import { createInterface } from 'readline';
13
+ import { PassThrough, Transform } from 'stream';
14
+
15
+ createRequire(import.meta.url);
16
+ var EtaError = class extends Error {
17
+ constructor(message) {
18
+ super(message);
19
+ this.name = "Eta Error";
20
+ }
21
+ };
22
+ var EtaParseError = class extends EtaError {
23
+ constructor(message) {
24
+ super(message);
25
+ this.name = "EtaParser Error";
26
+ }
27
+ };
28
+ var EtaRuntimeError = class extends EtaError {
29
+ constructor(message) {
30
+ super(message);
31
+ this.name = "EtaRuntime Error";
32
+ }
33
+ };
34
+ var EtaFileResolutionError = class extends EtaError {
35
+ constructor(message) {
36
+ super(message);
37
+ this.name = "EtaFileResolution Error";
38
+ }
39
+ };
40
+ var EtaNameResolutionError = class extends EtaError {
41
+ constructor(message) {
42
+ super(message);
43
+ this.name = "EtaNameResolution Error";
44
+ }
45
+ };
46
+ function ParseErr(message, str, indx) {
47
+ const whitespace2 = str.slice(0, indx).split(/\n/);
48
+ const lineNo = whitespace2.length;
49
+ const colNo = whitespace2[lineNo - 1].length + 1;
50
+ message += " at line " + lineNo + " col " + colNo + ":\n\n " + str.split(/\n/)[lineNo - 1] + "\n " + Array(colNo).join(" ") + "^";
51
+ throw new EtaParseError(message);
52
+ }
53
+ function RuntimeErr(originalError, str, lineNo, path$1) {
54
+ const lines = str.split("\n");
55
+ const start = Math.max(lineNo - 3, 0);
56
+ const end = Math.min(lines.length, lineNo + 3);
57
+ const filename = path$1;
58
+ const context = lines.slice(start, end).map((line, i) => {
59
+ const curr = i + start + 1;
60
+ return (curr === lineNo ? " >> " : " ") + curr + "| " + line;
61
+ }).join("\n");
62
+ const err = new EtaRuntimeError((filename ? filename + ":" + lineNo + "\n" : "line " + lineNo + "\n") + context + "\n\n" + originalError.message);
63
+ err.name = originalError.name;
64
+ err.cause = originalError;
65
+ throw err;
66
+ }
67
+ function readFile(path$1) {
68
+ let res = "";
69
+ try {
70
+ res = fs.readFileSync(path$1, "utf8");
71
+ } catch (err) {
72
+ if (err?.code === "ENOENT") throw new EtaFileResolutionError(`Could not find template: ${path$1}`);
73
+ else throw err;
74
+ }
75
+ return res;
76
+ }
77
+ function resolvePath(templatePath, options) {
78
+ let resolvedFilePath = "";
79
+ const views = this.config.views;
80
+ if (!views) throw new EtaFileResolutionError("Views directory is not defined");
81
+ const baseFilePath = options?.filepath;
82
+ const defaultExtension = this.config.defaultExtension === void 0 ? ".eta" : this.config.defaultExtension;
83
+ const cacheIndex = JSON.stringify({
84
+ filename: baseFilePath,
85
+ path: templatePath,
86
+ views: this.config.views
87
+ });
88
+ templatePath += path.extname(templatePath) ? "" : defaultExtension;
89
+ if (baseFilePath) {
90
+ if (this.config.cacheFilepaths && this.filepathCache[cacheIndex]) return this.filepathCache[cacheIndex];
91
+ if (absolutePathRegExp.exec(templatePath)?.length) {
92
+ const formattedPath = templatePath.replace(/^\/*|^\\*/, "");
93
+ resolvedFilePath = path.join(views, formattedPath);
94
+ } else resolvedFilePath = path.join(path.dirname(baseFilePath), templatePath);
95
+ } else resolvedFilePath = path.join(views, templatePath);
96
+ if (dirIsChild(views, resolvedFilePath)) {
97
+ if (baseFilePath && this.config.cacheFilepaths) this.filepathCache[cacheIndex] = resolvedFilePath;
98
+ return resolvedFilePath;
99
+ } else throw new EtaFileResolutionError(`Template '${templatePath}' is not in the views directory`);
100
+ }
101
+ function dirIsChild(parent, dir) {
102
+ const relative2 = path.relative(parent, dir);
103
+ return relative2 && !relative2.startsWith("..") && !path.isAbsolute(relative2);
104
+ }
105
+ var absolutePathRegExp = /^\\|^\//;
106
+ var AsyncFunction = (async () => {
107
+ }).constructor;
108
+ function compile(str, options) {
109
+ const config = this.config;
110
+ const ctor = options?.async ? AsyncFunction : Function;
111
+ try {
112
+ return new ctor(config.varName, "options", this.compileToString.call(this, str, options));
113
+ } catch (e) {
114
+ if (e instanceof SyntaxError) throw new EtaParseError("Bad template syntax\n\n" + e.message + "\n" + Array(e.message.length + 1).join("=") + "\n" + this.compileToString.call(this, str, options) + "\n");
115
+ else throw e;
116
+ }
117
+ }
118
+ function compileToString(str, options) {
119
+ const config = this.config;
120
+ const isAsync = options?.async;
121
+ const compileBody$1 = this.compileBody;
122
+ const buffer = this.parse.call(this, str);
123
+ let res = `${config.functionHeader}
124
+ let include = (__eta_t, __eta_d) => this.render(__eta_t, {...${config.varName}, ...(__eta_d ?? {})}, options);
125
+ let includeAsync = (__eta_t, __eta_d) => this.renderAsync(__eta_t, {...${config.varName}, ...(__eta_d ?? {})}, options);
126
+
127
+ let __eta = {res: "", e: this.config.escapeFunction, f: this.config.filterFunction${config.debug ? ', line: 1, templateStr: "' + str.replace(/\\|"/g, "\\$&").replace(/\r\n|\n|\r/g, "\\n") + '"' : ""}};
128
+
129
+ function layout(path, data) {
130
+ __eta.layout = path;
131
+ __eta.layoutData = data;
132
+ }${config.debug ? "try {" : ""}${config.useWith ? "with(" + config.varName + "||{}){" : ""}
133
+
134
+ function ${config.outputFunctionName}(s){__eta.res+=s;}
135
+
136
+ ${compileBody$1.call(this, buffer)}
137
+ if (__eta.layout) {
138
+ __eta.res = ${isAsync ? "await includeAsync" : "include"} (__eta.layout, {...${config.varName}, body: __eta.res, ...__eta.layoutData});
139
+ }
140
+ ${config.useWith ? "}" : ""}${config.debug ? "} catch (e) { this.RuntimeErr(e, __eta.templateStr, __eta.line, options.filepath) }" : ""}
141
+ return __eta.res;
142
+ `;
143
+ if (config.plugins) for (let i = 0; i < config.plugins.length; i++) {
144
+ const plugin = config.plugins[i];
145
+ if (plugin.processFnString) res = plugin.processFnString(res, config);
146
+ }
147
+ return res;
148
+ }
149
+ function compileBody(buff) {
150
+ const config = this.config;
151
+ let i = 0;
152
+ const buffLength = buff.length;
153
+ let returnStr = "";
154
+ for (; i < buffLength; i++) {
155
+ const currentBlock = buff[i];
156
+ if (typeof currentBlock === "string") returnStr += "__eta.res+='" + currentBlock + "';\n";
157
+ else {
158
+ const type = currentBlock.t;
159
+ let content = currentBlock.val || "";
160
+ if (config.debug) returnStr += "__eta.line=" + currentBlock.lineNo + "\n";
161
+ if (type === "r") {
162
+ if (config.autoFilter) content = "__eta.f(" + content + ")";
163
+ returnStr += "__eta.res+=" + content + ";\n";
164
+ } else if (type === "i") {
165
+ if (config.autoFilter) content = "__eta.f(" + content + ")";
166
+ if (config.autoEscape) content = "__eta.e(" + content + ")";
167
+ returnStr += "__eta.res+=" + content + ";\n";
168
+ } else if (type === "e") returnStr += content + "\n";
169
+ }
170
+ }
171
+ return returnStr;
172
+ }
173
+ function trimWS(str, config, wsLeft, wsRight) {
174
+ let leftTrim;
175
+ let rightTrim;
176
+ if (Array.isArray(config.autoTrim)) {
177
+ leftTrim = config.autoTrim[1];
178
+ rightTrim = config.autoTrim[0];
179
+ } else leftTrim = rightTrim = config.autoTrim;
180
+ if (wsLeft || wsLeft === false) leftTrim = wsLeft;
181
+ if (wsRight || wsRight === false) rightTrim = wsRight;
182
+ if (!rightTrim && !leftTrim) return str;
183
+ if (leftTrim === "slurp" && rightTrim === "slurp") return str.trim();
184
+ if (leftTrim === "_" || leftTrim === "slurp") str = str.trimStart();
185
+ else if (leftTrim === "-" || leftTrim === "nl") str = str.replace(/^(?:\r\n|\n|\r)/, "");
186
+ if (rightTrim === "_" || rightTrim === "slurp") str = str.trimEnd();
187
+ else if (rightTrim === "-" || rightTrim === "nl") str = str.replace(/(?:\r\n|\n|\r)$/, "");
188
+ return str;
189
+ }
190
+ var escMap = {
191
+ "&": "&amp;",
192
+ "<": "&lt;",
193
+ ">": "&gt;",
194
+ '"': "&quot;",
195
+ "'": "&#39;"
196
+ };
197
+ function replaceChar(s) {
198
+ return escMap[s];
199
+ }
200
+ function XMLEscape(str) {
201
+ const newStr = String(str);
202
+ if (/[&<>"']/.test(newStr)) return newStr.replace(/[&<>"']/g, replaceChar);
203
+ else return newStr;
204
+ }
205
+ var defaultConfig = {
206
+ autoEscape: true,
207
+ autoFilter: false,
208
+ autoTrim: [false, "nl"],
209
+ cache: false,
210
+ cacheFilepaths: true,
211
+ debug: false,
212
+ escapeFunction: XMLEscape,
213
+ filterFunction: (val) => String(val),
214
+ outputFunctionName: "output",
215
+ functionHeader: "",
216
+ parse: {
217
+ exec: "",
218
+ interpolate: "=",
219
+ raw: "~"
220
+ },
221
+ plugins: [],
222
+ rmWhitespace: false,
223
+ tags: ["<%", "%>"],
224
+ useWith: false,
225
+ varName: "it",
226
+ defaultExtension: ".eta"
227
+ };
228
+ var templateLitReg = /`(?:\\[\s\S]|\${(?:[^{}]|{(?:[^{}]|{[^}]*})*})*}|(?!\${)[^\\`])*`/g;
229
+ var singleQuoteReg = /'(?:\\[\s\w"'\\`]|[^\n\r'\\])*?'/g;
230
+ var doubleQuoteReg = /"(?:\\[\s\w"'\\`]|[^\n\r"\\])*?"/g;
231
+ function escapeRegExp(string) {
232
+ return string.replace(/[.*+\-?^${}()|[\]\\]/g, "\\$&");
233
+ }
234
+ function getLineNo(str, index) {
235
+ return str.slice(0, index).split("\n").length;
236
+ }
237
+ function parse(str) {
238
+ const config = this.config;
239
+ let buffer = [];
240
+ let trimLeftOfNextStr = false;
241
+ let lastIndex = 0;
242
+ const parseOptions = config.parse;
243
+ if (config.plugins) for (let i = 0; i < config.plugins.length; i++) {
244
+ const plugin = config.plugins[i];
245
+ if (plugin.processTemplate) str = plugin.processTemplate(str, config);
246
+ }
247
+ if (config.rmWhitespace) str = str.replace(/[\r\n]+/g, "\n").replace(/^\s+|\s+$/gm, "");
248
+ templateLitReg.lastIndex = 0;
249
+ singleQuoteReg.lastIndex = 0;
250
+ doubleQuoteReg.lastIndex = 0;
251
+ function pushString(strng, shouldTrimRightOfString) {
252
+ if (strng) {
253
+ strng = trimWS(strng, config, trimLeftOfNextStr, shouldTrimRightOfString);
254
+ if (strng) {
255
+ strng = strng.replace(/\\|'/g, "\\$&").replace(/\r\n|\n|\r/g, "\\n");
256
+ buffer.push(strng);
257
+ }
258
+ }
259
+ }
260
+ const prefixes = [
261
+ parseOptions.exec,
262
+ parseOptions.interpolate,
263
+ parseOptions.raw
264
+ ].reduce((accumulator, prefix) => {
265
+ if (accumulator && prefix) return accumulator + "|" + escapeRegExp(prefix);
266
+ else if (prefix) return escapeRegExp(prefix);
267
+ else return accumulator;
268
+ }, "");
269
+ const parseOpenReg = new RegExp(escapeRegExp(config.tags[0]) + "(-|_)?\\s*(" + prefixes + ")?\\s*", "g");
270
+ const parseCloseReg = new RegExp("'|\"|`|\\/\\*|(\\s*(-|_)?" + escapeRegExp(config.tags[1]) + ")", "g");
271
+ let m;
272
+ while (m = parseOpenReg.exec(str)) {
273
+ const precedingString = str.slice(lastIndex, m.index);
274
+ lastIndex = m[0].length + m.index;
275
+ const wsLeft = m[1];
276
+ const prefix = m[2] || "";
277
+ pushString(precedingString, wsLeft);
278
+ parseCloseReg.lastIndex = lastIndex;
279
+ let closeTag;
280
+ let currentObj = false;
281
+ while (closeTag = parseCloseReg.exec(str)) if (closeTag[1]) {
282
+ const content = str.slice(lastIndex, closeTag.index);
283
+ parseOpenReg.lastIndex = lastIndex = parseCloseReg.lastIndex;
284
+ trimLeftOfNextStr = closeTag[2];
285
+ currentObj = {
286
+ t: prefix === parseOptions.exec ? "e" : prefix === parseOptions.raw ? "r" : prefix === parseOptions.interpolate ? "i" : "",
287
+ val: content
288
+ };
289
+ break;
290
+ } else {
291
+ const char = closeTag[0];
292
+ if (char === "/*") {
293
+ const commentCloseInd = str.indexOf("*/", parseCloseReg.lastIndex);
294
+ if (commentCloseInd === -1) ParseErr("unclosed comment", str, closeTag.index);
295
+ parseCloseReg.lastIndex = commentCloseInd;
296
+ } else if (char === "'") {
297
+ singleQuoteReg.lastIndex = closeTag.index;
298
+ if (singleQuoteReg.exec(str)) parseCloseReg.lastIndex = singleQuoteReg.lastIndex;
299
+ else ParseErr("unclosed string", str, closeTag.index);
300
+ } else if (char === '"') {
301
+ doubleQuoteReg.lastIndex = closeTag.index;
302
+ if (doubleQuoteReg.exec(str)) parseCloseReg.lastIndex = doubleQuoteReg.lastIndex;
303
+ else ParseErr("unclosed string", str, closeTag.index);
304
+ } else if (char === "`") {
305
+ templateLitReg.lastIndex = closeTag.index;
306
+ if (templateLitReg.exec(str)) parseCloseReg.lastIndex = templateLitReg.lastIndex;
307
+ else ParseErr("unclosed string", str, closeTag.index);
308
+ }
309
+ }
310
+ if (currentObj) {
311
+ if (config.debug) currentObj.lineNo = getLineNo(str, m.index);
312
+ buffer.push(currentObj);
313
+ } else ParseErr("unclosed tag", str, m.index);
314
+ }
315
+ pushString(str.slice(lastIndex, str.length), false);
316
+ if (config.plugins) for (let i = 0; i < config.plugins.length; i++) {
317
+ const plugin = config.plugins[i];
318
+ if (plugin.processAST) buffer = plugin.processAST(buffer, config);
319
+ }
320
+ return buffer;
321
+ }
322
+ function handleCache(template, options) {
323
+ const templateStore = options?.async ? this.templatesAsync : this.templatesSync;
324
+ if (this.resolvePath && this.readFile && !template.startsWith("@")) {
325
+ const templatePath = options.filepath;
326
+ const cachedTemplate = templateStore.get(templatePath);
327
+ if (this.config.cache && cachedTemplate) return cachedTemplate;
328
+ else {
329
+ const templateString = this.readFile(templatePath);
330
+ const templateFn = this.compile(templateString, options);
331
+ if (this.config.cache) templateStore.define(templatePath, templateFn);
332
+ return templateFn;
333
+ }
334
+ } else {
335
+ const cachedTemplate = templateStore.get(template);
336
+ if (cachedTemplate) return cachedTemplate;
337
+ else throw new EtaNameResolutionError(`Failed to get template '${template}'`);
338
+ }
339
+ }
340
+ function render(template, data, meta) {
341
+ let templateFn;
342
+ const options = {
343
+ ...meta,
344
+ async: false
345
+ };
346
+ if (typeof template === "string") {
347
+ if (this.resolvePath && this.readFile && !template.startsWith("@")) options.filepath = this.resolvePath(template, options);
348
+ templateFn = handleCache.call(this, template, options);
349
+ } else templateFn = template;
350
+ return templateFn.call(this, data, options);
351
+ }
352
+ function renderAsync(template, data, meta) {
353
+ let templateFn;
354
+ const options = {
355
+ ...meta,
356
+ async: true
357
+ };
358
+ if (typeof template === "string") {
359
+ if (this.resolvePath && this.readFile && !template.startsWith("@")) options.filepath = this.resolvePath(template, options);
360
+ templateFn = handleCache.call(this, template, options);
361
+ } else templateFn = template;
362
+ const res = templateFn.call(this, data, options);
363
+ return Promise.resolve(res);
364
+ }
365
+ function renderString(template, data) {
366
+ const templateFn = this.compile(template, { async: false });
367
+ return render.call(this, templateFn, data);
368
+ }
369
+ function renderStringAsync(template, data) {
370
+ const templateFn = this.compile(template, { async: true });
371
+ return renderAsync.call(this, templateFn, data);
372
+ }
373
+ var Cacher = class {
374
+ constructor(cache) {
375
+ this.cache = cache;
376
+ }
377
+ define(key, val) {
378
+ this.cache[key] = val;
379
+ }
380
+ get(key) {
381
+ return this.cache[key];
382
+ }
383
+ remove(key) {
384
+ delete this.cache[key];
385
+ }
386
+ reset() {
387
+ this.cache = {};
388
+ }
389
+ load(cacheObj) {
390
+ this.cache = {
391
+ ...this.cache,
392
+ ...cacheObj
393
+ };
394
+ }
395
+ };
396
+ var Eta$1 = class {
397
+ constructor(customConfig) {
398
+ if (customConfig) this.config = {
399
+ ...defaultConfig,
400
+ ...customConfig
401
+ };
402
+ else this.config = { ...defaultConfig };
403
+ }
404
+ config;
405
+ RuntimeErr = RuntimeErr;
406
+ compile = compile;
407
+ compileToString = compileToString;
408
+ compileBody = compileBody;
409
+ parse = parse;
410
+ render = render;
411
+ renderAsync = renderAsync;
412
+ renderString = renderString;
413
+ renderStringAsync = renderStringAsync;
414
+ filepathCache = {};
415
+ templatesSync = new Cacher({});
416
+ templatesAsync = new Cacher({});
417
+ resolvePath = null;
418
+ readFile = null;
419
+ configure(customConfig) {
420
+ this.config = {
421
+ ...this.config,
422
+ ...customConfig
423
+ };
424
+ }
425
+ withConfig(customConfig) {
426
+ return {
427
+ ...this,
428
+ config: {
429
+ ...this.config,
430
+ ...customConfig
431
+ }
432
+ };
433
+ }
434
+ loadTemplate(name, template, options) {
435
+ if (typeof template === "string") (options?.async ? this.templatesAsync : this.templatesSync).define(name, this.compile(template, options));
436
+ else {
437
+ let templates = this.templatesSync;
438
+ if (template.constructor.name === "AsyncFunction" || options?.async) templates = this.templatesAsync;
439
+ templates.define(name, template);
440
+ }
441
+ }
442
+ };
443
+ var Eta = class extends Eta$1 {
444
+ readFile = readFile;
445
+ resolvePath = resolvePath;
446
+ };
447
+
448
+ // src/core/template/types.ts
449
+ var TEMPLATE_EXTENSION = ".tmpl";
450
+ var HELPER_FILENAME = "$helpers";
451
+ var HELPER_EXTENSIONS = [".ts", ".js", ".mjs"];
452
+
453
+ // node_modules/voca/es/index.js
454
+ function _extends() {
455
+ _extends = Object.assign || function(target) {
456
+ for (var i = 1; i < arguments.length; i++) {
457
+ var source = arguments[i];
458
+ for (var key in source) {
459
+ if (Object.prototype.hasOwnProperty.call(source, key)) {
460
+ target[key] = source[key];
461
+ }
462
+ }
463
+ }
464
+ return target;
465
+ };
466
+ return _extends.apply(this, arguments);
467
+ }
468
+ function _slicedToArray(arr, i) {
469
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
470
+ }
471
+ function _toConsumableArray(arr) {
472
+ return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
473
+ }
474
+ function _arrayWithoutHoles(arr) {
475
+ if (Array.isArray(arr)) {
476
+ for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) arr2[i] = arr[i];
477
+ return arr2;
478
+ }
479
+ }
480
+ function _arrayWithHoles(arr) {
481
+ if (Array.isArray(arr)) return arr;
482
+ }
483
+ function _iterableToArray(iter) {
484
+ if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
485
+ }
486
+ function _iterableToArrayLimit(arr, i) {
487
+ if (!(Symbol.iterator in Object(arr) || Object.prototype.toString.call(arr) === "[object Arguments]")) {
488
+ return;
489
+ }
490
+ var _arr = [];
491
+ var _n = true;
492
+ var _d = false;
493
+ var _e = void 0;
494
+ try {
495
+ for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) {
496
+ _arr.push(_s.value);
497
+ if (i && _arr.length === i) break;
498
+ }
499
+ } catch (err) {
500
+ _d = true;
501
+ _e = err;
502
+ } finally {
503
+ try {
504
+ if (!_n && _i["return"] != null) _i["return"]();
505
+ } finally {
506
+ if (_d) throw _e;
507
+ }
508
+ }
509
+ return _arr;
510
+ }
511
+ function _nonIterableSpread() {
512
+ throw new TypeError("Invalid attempt to spread non-iterable instance");
513
+ }
514
+ function _nonIterableRest() {
515
+ throw new TypeError("Invalid attempt to destructure non-iterable instance");
516
+ }
517
+ function isNil(value) {
518
+ return value === void 0 || value === null;
519
+ }
520
+ function coerceToBoolean(value) {
521
+ var defaultValue = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : false;
522
+ if (isNil(value)) {
523
+ return defaultValue;
524
+ }
525
+ return Boolean(value);
526
+ }
527
+ function isString(subject) {
528
+ return typeof subject === "string";
529
+ }
530
+ function coerceToString(value) {
531
+ var defaultValue = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : "";
532
+ if (isNil(value)) {
533
+ return defaultValue;
534
+ }
535
+ if (isString(value)) {
536
+ return value;
537
+ }
538
+ return String(value);
539
+ }
540
+ function capitalize(subject, restToLower) {
541
+ var subjectString = coerceToString(subject);
542
+ var restToLowerCaseBoolean = coerceToBoolean(restToLower);
543
+ if (subjectString === "") {
544
+ return "";
545
+ }
546
+ if (restToLowerCaseBoolean) {
547
+ subjectString = subjectString.toLowerCase();
548
+ }
549
+ return subjectString.substr(0, 1).toUpperCase() + subjectString.substr(1);
550
+ }
551
+ function lowerCase(subject) {
552
+ var subjectString = coerceToString(subject, "");
553
+ return subjectString.toLowerCase();
554
+ }
555
+ var digit = "\\d";
556
+ var whitespace = "\\s\\uFEFF\\xA0";
557
+ var highSurrogate = "\\uD800-\\uDBFF";
558
+ var lowSurrogate = "\\uDC00-\\uDFFF";
559
+ var diacriticalMark = "\\u0300-\\u036F\\u1AB0-\\u1AFF\\u1DC0-\\u1DFF\\u20D0-\\u20FF\\uFE20-\\uFE2F";
560
+ var base = "\\0-\\u02FF\\u0370-\\u1AAF\\u1B00-\\u1DBF\\u1E00-\\u20CF\\u2100-\\uD7FF\\uE000-\\uFE1F\\uFE30-\\uFFFF";
561
+ var REGEXP_COMBINING_MARKS = new RegExp("([" + base + "]|[" + highSurrogate + "][" + lowSurrogate + "]|[" + highSurrogate + "](?![" + lowSurrogate + "])|(?:[^" + highSurrogate + "]|^)[" + lowSurrogate + "])([" + diacriticalMark + "]+)", "g");
562
+ var REGEXP_SURROGATE_PAIRS = new RegExp("([" + highSurrogate + "])([" + lowSurrogate + "])", "g");
563
+ var REGEXP_UNICODE_CHARACTER = new RegExp("((?:[" + base + "]|[" + highSurrogate + "][" + lowSurrogate + "]|[" + highSurrogate + "](?![" + lowSurrogate + "])|(?:[^" + highSurrogate + "]|^)[" + lowSurrogate + "])(?:[" + diacriticalMark + "]+))|([" + highSurrogate + "][" + lowSurrogate + "])|([\\n\\r\\u2028\\u2029])|(.)", "g");
564
+ var REGEXP_WHITESPACE = new RegExp("[" + whitespace + "]");
565
+ var REGEXP_TRIM_LEFT = new RegExp("^[" + whitespace + "]+");
566
+ var REGEXP_TRIM_RIGHT = new RegExp("[" + whitespace + "]+$");
567
+ var REGEXP_DIGIT = new RegExp("^" + digit + "+$");
568
+ var REGEXP_SPECIAL_CHARACTERS = /[-[\]{}()*+!<=:?./\\^$|#,]/g;
569
+ var REGEXP_NON_LATIN = /[^A-Za-z0-9]/g;
570
+ var REGEXP_HTML_SPECIAL_CHARACTERS = /[<>&"'`]/g;
571
+ var REGEXP_CONVERSION_SPECIFICATION = /(%{1,2})(?:(\d+)\$)?(\+)?([ 0]|'.{1})?(-)?(\d+)?(?:\.(\d+))?([bcdiouxXeEfgGs])?/g;
572
+ var REGEXP_TRAILING_ZEROS = /\.?0+$/g;
573
+ var REGEXP_TAG_LIST = /<([A-Za-z0-9]+)>/g;
574
+ var generalPunctuationBlock = "\\u2000-\\u206F";
575
+ var nonCharacter = "\\x00-\\x2F\\x3A-\\x40\\x5B-\\x60\\x7b-\\xBF\\xD7\\xF7";
576
+ var dingbatBlock = "\\u2700-\\u27BF";
577
+ var lowerCaseLetter = "a-z\\xB5\\xDF-\\xF6\\xF8-\\xFF\\u0101\\u0103\\u0105\\u0107\\u0109\\u010B\\u010D\\u010F\\u0111\\u0113\\u0115\\u0117\\u0119\\u011B\\u011D\\u011F\\u0121\\u0123\\u0125\\u0127\\u0129\\u012B\\u012D\\u012F\\u0131\\u0133\\u0135\\u0137\\u0138\\u013A\\u013C\\u013E\\u0140\\u0142\\u0144\\u0146\\u0148\\u0149\\u014B\\u014D\\u014F\\u0151\\u0153\\u0155\\u0157\\u0159\\u015B\\u015D\\u015F\\u0161\\u0163\\u0165\\u0167\\u0169\\u016B\\u016D\\u016F\\u0171\\u0173\\u0175\\u0177\\u017A\\u017C\\u017E-\\u0180\\u0183\\u0185\\u0188\\u018C\\u018D\\u0192\\u0195\\u0199-\\u019B\\u019E\\u01A1\\u01A3\\u01A5\\u01A8\\u01AA\\u01AB\\u01AD\\u01B0\\u01B4\\u01B6\\u01B9\\u01BA\\u01BD-\\u01BF\\u01C6\\u01C9\\u01CC\\u01CE\\u01D0\\u01D2\\u01D4\\u01D6\\u01D8\\u01DA\\u01DC\\u01DD\\u01DF\\u01E1\\u01E3\\u01E5\\u01E7\\u01E9\\u01EB\\u01ED\\u01EF\\u01F0\\u01F3\\u01F5\\u01F9\\u01FB\\u01FD\\u01FF\\u0201\\u0203\\u0205\\u0207\\u0209\\u020B\\u020D\\u020F\\u0211\\u0213\\u0215\\u0217\\u0219\\u021B\\u021D\\u021F\\u0221\\u0223\\u0225\\u0227\\u0229\\u022B\\u022D\\u022F\\u0231\\u0233-\\u0239\\u023C\\u023F\\u0240\\u0242\\u0247\\u0249\\u024B\\u024D\\u024F";
578
+ var upperCaseLetter = "\\x41-\\x5a\\xc0-\\xd6\\xd8-\\xde\\u0100\\u0102\\u0104\\u0106\\u0108\\u010a\\u010c\\u010e\\u0110\\u0112\\u0114\\u0116\\u0118\\u011a\\u011c\\u011e\\u0120\\u0122\\u0124\\u0126\\u0128\\u012a\\u012c\\u012e\\u0130\\u0132\\u0134\\u0136\\u0139\\u013b\\u013d\\u013f\\u0141\\u0143\\u0145\\u0147\\u014a\\u014c\\u014e\\u0150\\u0152\\u0154\\u0156\\u0158\\u015a\\u015c\\u015e\\u0160\\u0162\\u0164\\u0166\\u0168\\u016a\\u016c\\u016e\\u0170\\u0172\\u0174\\u0176\\u0178\\u0179\\u017b\\u017d\\u0181\\u0182\\u0184\\u0186\\u0187\\u0189-\\u018b\\u018e-\\u0191\\u0193\\u0194\\u0196-\\u0198\\u019c\\u019d\\u019f\\u01a0\\u01a2\\u01a4\\u01a6\\u01a7\\u01a9\\u01ac\\u01ae\\u01af\\u01b1-\\u01b3\\u01b5\\u01b7\\u01b8\\u01bc\\u01c4\\u01c5\\u01c7\\u01c8\\u01ca\\u01cb\\u01cd\\u01cf\\u01d1\\u01d3\\u01d5\\u01d7\\u01d9\\u01db\\u01de\\u01e0\\u01e2\\u01e4\\u01e6\\u01e8\\u01ea\\u01ec\\u01ee\\u01f1\\u01f2\\u01f4\\u01f6-\\u01f8\\u01fa\\u01fc\\u01fe\\u0200\\u0202\\u0204\\u0206\\u0208\\u020a\\u020c\\u020e\\u0210\\u0212\\u0214\\u0216\\u0218\\u021a\\u021c\\u021e\\u0220\\u0222\\u0224\\u0226\\u0228\\u022a\\u022c\\u022e\\u0230\\u0232\\u023a\\u023b\\u023d\\u023e\\u0241\\u0243-\\u0246\\u0248\\u024a\\u024c\\u024e";
579
+ var REGEXP_WORD = new RegExp("(?:[" + upperCaseLetter + "][" + diacriticalMark + "]*)?(?:[" + lowerCaseLetter + "][" + diacriticalMark + "]*)+|(?:[" + upperCaseLetter + "][" + diacriticalMark + "]*)+(?![" + lowerCaseLetter + "])|[" + digit + "]+|[" + dingbatBlock + "]|[^" + nonCharacter + generalPunctuationBlock + whitespace + "]+", "g");
580
+ var REGEXP_LATIN_WORD = /[A-Z\xC0-\xD6\xD8-\xDE]?[a-z\xDF-\xF6\xF8-\xFF]+|[A-Z\xC0-\xD6\xD8-\xDE]+(?![a-z\xDF-\xF6\xF8-\xFF])|\d+/g;
581
+ var REGEXP_ALPHA = new RegExp("^(?:[" + lowerCaseLetter + upperCaseLetter + "][" + diacriticalMark + "]*)+$");
582
+ var REGEXP_ALPHA_DIGIT = new RegExp("^((?:[" + lowerCaseLetter + upperCaseLetter + "][" + diacriticalMark + "]*)|[" + digit + "])+$");
583
+ var REGEXP_EXTENDED_ASCII = /^[\x01-\xFF]*$/;
584
+ function nilDefault(value, defaultValue) {
585
+ return value == null ? defaultValue : value;
586
+ }
587
+ function toString(value) {
588
+ if (isNil(value)) {
589
+ return null;
590
+ }
591
+ if (isString(value)) {
592
+ return value;
593
+ }
594
+ return String(value);
595
+ }
596
+ function words(subject, pattern, flags) {
597
+ var subjectString = coerceToString(subject);
598
+ var patternRegExp;
599
+ if (isNil(pattern)) {
600
+ patternRegExp = REGEXP_EXTENDED_ASCII.test(subjectString) ? REGEXP_LATIN_WORD : REGEXP_WORD;
601
+ } else if (pattern instanceof RegExp) {
602
+ patternRegExp = pattern;
603
+ } else {
604
+ var flagsString = toString(nilDefault(flags, ""));
605
+ patternRegExp = new RegExp(toString(pattern), flagsString);
606
+ }
607
+ return nilDefault(subjectString.match(patternRegExp), []);
608
+ }
609
+ function wordToCamel(word, index) {
610
+ return index === 0 ? lowerCase(word) : capitalize(word, true);
611
+ }
612
+ function camelCase(subject) {
613
+ var subjectString = coerceToString(subject);
614
+ if (subjectString === "") {
615
+ return "";
616
+ }
617
+ return words(subjectString).map(wordToCamel).join("");
618
+ }
619
+ function decapitalize(subject) {
620
+ var subjectString = coerceToString(subject);
621
+ if (subjectString === "") {
622
+ return "";
623
+ }
624
+ return subjectString.substr(0, 1).toLowerCase() + subjectString.substr(1);
625
+ }
626
+ function kebabCase(subject) {
627
+ var subjectString = coerceToString(subject);
628
+ if (subjectString === "") {
629
+ return "";
630
+ }
631
+ return words(subjectString).map(lowerCase).join("-");
632
+ }
633
+ function snakeCase(subject) {
634
+ var subjectString = coerceToString(subject);
635
+ if (subjectString === "") {
636
+ return "";
637
+ }
638
+ return words(subjectString).map(lowerCase).join("_");
639
+ }
640
+ function upperCase(subject) {
641
+ var subjectString = coerceToString(subject);
642
+ return subjectString.toUpperCase();
643
+ }
644
+ function swapCase(subject) {
645
+ var subjectString = coerceToString(subject);
646
+ return subjectString.split("").reduce(swapAndConcat, "");
647
+ }
648
+ function swapAndConcat(swapped, character) {
649
+ var lowerCase2 = character.toLowerCase();
650
+ var upperCase2 = character.toUpperCase();
651
+ return swapped + (character === lowerCase2 ? upperCase2 : lowerCase2);
652
+ }
653
+ function titleCase(subject, noSplit) {
654
+ var subjectString = coerceToString(subject);
655
+ var noSplitArray = Array.isArray(noSplit) ? noSplit : [];
656
+ var wordsRegExp = REGEXP_EXTENDED_ASCII.test(subjectString) ? REGEXP_LATIN_WORD : REGEXP_WORD;
657
+ return subjectString.replace(wordsRegExp, function(word, index) {
658
+ var isNoSplit = index > 0 && noSplitArray.indexOf(subjectString[index - 1]) >= 0;
659
+ return isNoSplit ? word.toLowerCase() : capitalize(word, true);
660
+ });
661
+ }
662
+ function clipNumber(value, downLimit, upLimit) {
663
+ if (value <= downLimit) {
664
+ return downLimit;
665
+ }
666
+ if (value >= upLimit) {
667
+ return upLimit;
668
+ }
669
+ return value;
670
+ }
671
+ var MAX_SAFE_INTEGER = 9007199254740991;
672
+ function toInteger(value) {
673
+ if (value === Infinity) {
674
+ return MAX_SAFE_INTEGER;
675
+ }
676
+ if (value === -Infinity) {
677
+ return -MAX_SAFE_INTEGER;
678
+ }
679
+ return ~~value;
680
+ }
681
+ function truncate(subject, length, end) {
682
+ var subjectString = coerceToString(subject);
683
+ var lengthInt = isNil(length) ? subjectString.length : clipNumber(toInteger(length), 0, MAX_SAFE_INTEGER);
684
+ var endString = coerceToString(end, "...");
685
+ if (lengthInt >= subjectString.length) {
686
+ return subjectString;
687
+ }
688
+ return subjectString.substr(0, length - endString.length) + endString;
689
+ }
690
+ function charAt(subject, position) {
691
+ var subjectString = coerceToString(subject);
692
+ return subjectString.charAt(position);
693
+ }
694
+ var HIGH_SURROGATE_START = 55296;
695
+ var HIGH_SURROGATE_END = 56319;
696
+ var LOW_SURROGATE_START = 56320;
697
+ var LOW_SURROGATE_END = 57343;
698
+ function isHighSurrogate(codePoint) {
699
+ return codePoint >= HIGH_SURROGATE_START && codePoint <= HIGH_SURROGATE_END;
700
+ }
701
+ function isLowSurrogate(codePoint) {
702
+ return codePoint >= LOW_SURROGATE_START && codePoint <= LOW_SURROGATE_END;
703
+ }
704
+ function getAstralNumberFromSurrogatePair(highSurrogate2, lowSurrogate2) {
705
+ return (highSurrogate2 - HIGH_SURROGATE_START) * 1024 + lowSurrogate2 - LOW_SURROGATE_START + 65536;
706
+ }
707
+ function coerceToNumber(value) {
708
+ var defaultValue = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : 0;
709
+ if (isNil(value)) {
710
+ return defaultValue;
711
+ }
712
+ if (typeof value === "number") {
713
+ return value;
714
+ }
715
+ return Number(value);
716
+ }
717
+ function nanDefault(value, defaultValue) {
718
+ return value !== value ? defaultValue : value;
719
+ }
720
+ function codePointAt(subject, position) {
721
+ var subjectString = coerceToString(subject);
722
+ var subjectStringLength = subjectString.length;
723
+ var positionNumber = coerceToNumber(position);
724
+ positionNumber = nanDefault(positionNumber, 0);
725
+ if (positionNumber < 0 || positionNumber >= subjectStringLength) {
726
+ return void 0;
727
+ }
728
+ var firstCodePoint = subjectString.charCodeAt(positionNumber);
729
+ var secondCodePoint;
730
+ if (isHighSurrogate(firstCodePoint) && subjectStringLength > positionNumber + 1) {
731
+ secondCodePoint = subjectString.charCodeAt(positionNumber + 1);
732
+ if (isLowSurrogate(secondCodePoint)) {
733
+ return getAstralNumberFromSurrogatePair(firstCodePoint, secondCodePoint);
734
+ }
735
+ }
736
+ return firstCodePoint;
737
+ }
738
+ function first(subject, length) {
739
+ var subjectString = coerceToString(subject);
740
+ var lengthInt = isNil(length) ? 1 : clipNumber(toInteger(length), 0, MAX_SAFE_INTEGER);
741
+ if (subjectString.length <= lengthInt) {
742
+ return subjectString;
743
+ }
744
+ return subjectString.substr(0, lengthInt);
745
+ }
746
+ function graphemeAt(subject, position) {
747
+ var subjectString = coerceToString(subject);
748
+ var positionNumber = coerceToNumber(position);
749
+ var graphemeMatch;
750
+ var graphemeMatchIndex = 0;
751
+ positionNumber = nanDefault(positionNumber, 0);
752
+ while ((graphemeMatch = REGEXP_UNICODE_CHARACTER.exec(subjectString)) !== null) {
753
+ if (graphemeMatchIndex === positionNumber) {
754
+ REGEXP_UNICODE_CHARACTER.lastIndex = 0;
755
+ return graphemeMatch[0];
756
+ }
757
+ graphemeMatchIndex++;
758
+ }
759
+ return "";
760
+ }
761
+ function last(subject, length) {
762
+ var subjectString = coerceToString(subject);
763
+ var lengthInt = isNil(length) ? 1 : clipNumber(toInteger(length), 0, MAX_SAFE_INTEGER);
764
+ if (subjectString.length <= lengthInt) {
765
+ return subjectString;
766
+ }
767
+ return subjectString.substr(subjectString.length - lengthInt, lengthInt);
768
+ }
769
+ function prune(subject, length, end) {
770
+ var subjectString = coerceToString(subject);
771
+ var lengthInt = isNil(length) ? subjectString.length : clipNumber(toInteger(length), 0, MAX_SAFE_INTEGER);
772
+ var endString = coerceToString(end, "...");
773
+ if (lengthInt >= subjectString.length) {
774
+ return subjectString;
775
+ }
776
+ var pattern = REGEXP_EXTENDED_ASCII.test(subjectString) ? REGEXP_LATIN_WORD : REGEXP_WORD;
777
+ var truncatedLength = 0;
778
+ subjectString.replace(pattern, function(word, offset) {
779
+ var wordInsertLength = offset + word.length;
780
+ if (wordInsertLength <= lengthInt - endString.length) {
781
+ truncatedLength = wordInsertLength;
782
+ }
783
+ });
784
+ return subjectString.substr(0, truncatedLength) + endString;
785
+ }
786
+ function slice(subject, start, end) {
787
+ return coerceToString(subject).slice(start, end);
788
+ }
789
+ function substr(subject, start, length) {
790
+ return coerceToString(subject).substr(start, length);
791
+ }
792
+ function substring(subject, start, end) {
793
+ return coerceToString(subject).substring(start, end);
794
+ }
795
+ function count(subject) {
796
+ return coerceToString(subject).length;
797
+ }
798
+ function countGrapheme(subject) {
799
+ return coerceToString(subject).replace(REGEXP_COMBINING_MARKS, "*").replace(REGEXP_SURROGATE_PAIRS, "*").length;
800
+ }
801
+ function countSubstrings(subject, substring2) {
802
+ var subjectString = coerceToString(subject);
803
+ var substringString = coerceToString(substring2);
804
+ var substringLength = substringString.length;
805
+ var count2 = 0;
806
+ var matchIndex = 0;
807
+ if (subjectString === "" || substringString === "") {
808
+ return count2;
809
+ }
810
+ do {
811
+ matchIndex = subjectString.indexOf(substringString, matchIndex);
812
+ if (matchIndex !== -1) {
813
+ count2++;
814
+ matchIndex += substringLength;
815
+ }
816
+ } while (matchIndex !== -1);
817
+ return count2;
818
+ }
819
+ var reduce = Array.prototype.reduce;
820
+ function countWhere(subject, predicate, context) {
821
+ var subjectString = coerceToString(subject);
822
+ if (subjectString === "" || typeof predicate !== "function") {
823
+ return 0;
824
+ }
825
+ var predicateWithContext = predicate.bind(context);
826
+ return reduce.call(subjectString, function(countTruthy, character, index) {
827
+ return predicateWithContext(character, index, subjectString) ? countTruthy + 1 : countTruthy;
828
+ }, 0);
829
+ }
830
+ function countWords(subject, pattern, flags) {
831
+ return words(subject, pattern, flags).length;
832
+ }
833
+ function ReplacementIndex() {
834
+ this.index = 0;
835
+ }
836
+ ReplacementIndex.prototype.increment = function() {
837
+ this.index++;
838
+ };
839
+ ReplacementIndex.prototype.incrementOnEmptyPosition = function(position) {
840
+ if (isNil(position)) {
841
+ this.increment();
842
+ }
843
+ };
844
+ ReplacementIndex.prototype.getIndexByPosition = function(position) {
845
+ return isNil(position) ? this.index : position - 1;
846
+ };
847
+ var TYPE_INTEGER = "i";
848
+ var TYPE_INTEGER_BINARY = "b";
849
+ var TYPE_INTEGER_ASCII_CHARACTER = "c";
850
+ var TYPE_INTEGER_DECIMAL = "d";
851
+ var TYPE_INTEGER_OCTAL = "o";
852
+ var TYPE_INTEGER_UNSIGNED_DECIMAL = "u";
853
+ var TYPE_INTEGER_HEXADECIMAL = "x";
854
+ var TYPE_INTEGER_HEXADECIMAL_UPPERCASE = "X";
855
+ var TYPE_FLOAT_SCIENTIFIC = "e";
856
+ var TYPE_FLOAT_SCIENTIFIC_UPPERCASE = "E";
857
+ var TYPE_FLOAT = "f";
858
+ var TYPE_FLOAT_SHORT = "g";
859
+ var TYPE_FLOAT_SHORT_UPPERCASE = "G";
860
+ var TYPE_STRING = "s";
861
+ var LITERAL_SINGLE_QUOTE = "'";
862
+ var LITERAL_PLUS = "+";
863
+ var LITERAL_MINUS = "-";
864
+ var LITERAL_PERCENT_SPECIFIER = "%%";
865
+ var RADIX_BINARY = 2;
866
+ var RADIX_OCTAL = 8;
867
+ var RADIX_HEXADECIMAL = 16;
868
+ function repeat(subject, times) {
869
+ var subjectString = coerceToString(subject);
870
+ var timesInt = isNil(times) ? 1 : clipNumber(toInteger(times), 0, MAX_SAFE_INTEGER);
871
+ var repeatString = "";
872
+ while (timesInt) {
873
+ if (timesInt & 1) {
874
+ repeatString += subjectString;
875
+ }
876
+ if (timesInt > 1) {
877
+ subjectString += subjectString;
878
+ }
879
+ timesInt >>= 1;
880
+ }
881
+ return repeatString;
882
+ }
883
+ function buildPadding(padCharacters, length) {
884
+ var padStringRepeat = toInteger(length / padCharacters.length);
885
+ var padStringRest = length % padCharacters.length;
886
+ return repeat(padCharacters, padStringRepeat + padStringRest).substr(0, length);
887
+ }
888
+ function padLeft(subject, length, pad2) {
889
+ var subjectString = coerceToString(subject);
890
+ var lengthInt = isNil(length) ? 0 : clipNumber(toInteger(length), 0, MAX_SAFE_INTEGER);
891
+ var padString = coerceToString(pad2, " ");
892
+ if (lengthInt <= subjectString.length) {
893
+ return subjectString;
894
+ }
895
+ return buildPadding(padString, lengthInt - subjectString.length) + subjectString;
896
+ }
897
+ function padRight(subject, length, pad2) {
898
+ var subjectString = coerceToString(subject);
899
+ var lengthInt = isNil(length) ? 0 : clipNumber(toInteger(length), 0, MAX_SAFE_INTEGER);
900
+ var padString = coerceToString(pad2, " ");
901
+ if (lengthInt <= subjectString.length) {
902
+ return subjectString;
903
+ }
904
+ return subjectString + buildPadding(padString, lengthInt - subjectString.length);
905
+ }
906
+ function alignAndPad(subject, conversion) {
907
+ var width = conversion.width;
908
+ if (isNil(width) || subject.length >= width) {
909
+ return subject;
910
+ }
911
+ var padType = conversion.alignmentSpecifier === LITERAL_MINUS ? padRight : padLeft;
912
+ return padType(subject, width, conversion.getPaddingCharacter());
913
+ }
914
+ function addSignToFormattedNumber(replacementNumber, formattedReplacement, conversion) {
915
+ if (conversion.signSpecifier === LITERAL_PLUS && replacementNumber >= 0) {
916
+ formattedReplacement = LITERAL_PLUS + formattedReplacement;
917
+ }
918
+ return formattedReplacement;
919
+ }
920
+ function float(replacement, conversion) {
921
+ var replacementNumber = parseFloat(replacement);
922
+ var formattedReplacement;
923
+ if (isNaN(replacementNumber)) {
924
+ replacementNumber = 0;
925
+ }
926
+ var precision = coerceToNumber(conversion.precision, 6);
927
+ switch (conversion.typeSpecifier) {
928
+ case TYPE_FLOAT:
929
+ formattedReplacement = replacementNumber.toFixed(precision);
930
+ break;
931
+ case TYPE_FLOAT_SCIENTIFIC:
932
+ formattedReplacement = replacementNumber.toExponential(precision);
933
+ break;
934
+ case TYPE_FLOAT_SCIENTIFIC_UPPERCASE:
935
+ formattedReplacement = replacementNumber.toExponential(precision).toUpperCase();
936
+ break;
937
+ case TYPE_FLOAT_SHORT:
938
+ case TYPE_FLOAT_SHORT_UPPERCASE:
939
+ formattedReplacement = formatFloatAsShort(replacementNumber, precision, conversion);
940
+ break;
941
+ }
942
+ formattedReplacement = addSignToFormattedNumber(replacementNumber, formattedReplacement, conversion);
943
+ return coerceToString(formattedReplacement);
944
+ }
945
+ function formatFloatAsShort(replacementNumber, precision, conversion) {
946
+ if (replacementNumber === 0) {
947
+ return "0";
948
+ }
949
+ var nonZeroPrecision = precision === 0 ? 1 : precision;
950
+ var formattedReplacement = replacementNumber.toPrecision(nonZeroPrecision).replace(REGEXP_TRAILING_ZEROS, "");
951
+ if (conversion.typeSpecifier === TYPE_FLOAT_SHORT_UPPERCASE) {
952
+ formattedReplacement = formattedReplacement.toUpperCase();
953
+ }
954
+ return formattedReplacement;
955
+ }
956
+ function integerBase(replacement, conversion) {
957
+ var integer = parseInt(replacement);
958
+ if (isNaN(integer)) {
959
+ integer = 0;
960
+ }
961
+ integer = integer >>> 0;
962
+ switch (conversion.typeSpecifier) {
963
+ case TYPE_INTEGER_ASCII_CHARACTER:
964
+ integer = String.fromCharCode(integer);
965
+ break;
966
+ case TYPE_INTEGER_BINARY:
967
+ integer = integer.toString(RADIX_BINARY);
968
+ break;
969
+ case TYPE_INTEGER_OCTAL:
970
+ integer = integer.toString(RADIX_OCTAL);
971
+ break;
972
+ case TYPE_INTEGER_HEXADECIMAL:
973
+ integer = integer.toString(RADIX_HEXADECIMAL);
974
+ break;
975
+ case TYPE_INTEGER_HEXADECIMAL_UPPERCASE:
976
+ integer = integer.toString(RADIX_HEXADECIMAL).toUpperCase();
977
+ break;
978
+ }
979
+ return coerceToString(integer);
980
+ }
981
+ function integerDecimal(replacement, conversion) {
982
+ var integer = parseInt(replacement);
983
+ if (isNaN(integer)) {
984
+ integer = 0;
985
+ }
986
+ return addSignToFormattedNumber(integer, toString(integer), conversion);
987
+ }
988
+ function stringFormat(replacement, conversion) {
989
+ var formattedReplacement = replacement;
990
+ var precision = conversion.precision;
991
+ if (!isNil(precision) && formattedReplacement.length > precision) {
992
+ formattedReplacement = truncate(formattedReplacement, precision, "");
993
+ }
994
+ return formattedReplacement;
995
+ }
996
+ function compute(replacement, conversion) {
997
+ var formatFunction;
998
+ switch (conversion.typeSpecifier) {
999
+ case TYPE_STRING:
1000
+ formatFunction = stringFormat;
1001
+ break;
1002
+ case TYPE_INTEGER_DECIMAL:
1003
+ case TYPE_INTEGER:
1004
+ formatFunction = integerDecimal;
1005
+ break;
1006
+ case TYPE_INTEGER_ASCII_CHARACTER:
1007
+ case TYPE_INTEGER_BINARY:
1008
+ case TYPE_INTEGER_OCTAL:
1009
+ case TYPE_INTEGER_HEXADECIMAL:
1010
+ case TYPE_INTEGER_HEXADECIMAL_UPPERCASE:
1011
+ case TYPE_INTEGER_UNSIGNED_DECIMAL:
1012
+ formatFunction = integerBase;
1013
+ break;
1014
+ case TYPE_FLOAT:
1015
+ case TYPE_FLOAT_SCIENTIFIC:
1016
+ case TYPE_FLOAT_SCIENTIFIC_UPPERCASE:
1017
+ case TYPE_FLOAT_SHORT:
1018
+ case TYPE_FLOAT_SHORT_UPPERCASE:
1019
+ formatFunction = float;
1020
+ break;
1021
+ }
1022
+ var formattedString = formatFunction(replacement, conversion);
1023
+ return alignAndPad(formattedString, conversion);
1024
+ }
1025
+ function ConversionSpecification(properties) {
1026
+ this.percent = properties.percent;
1027
+ this.signSpecifier = properties.signSpecifier;
1028
+ this.paddingSpecifier = properties.paddingSpecifier;
1029
+ this.alignmentSpecifier = properties.alignmentSpecifier;
1030
+ this.width = properties.width;
1031
+ this.precision = properties.precision;
1032
+ this.typeSpecifier = properties.typeSpecifier;
1033
+ }
1034
+ ConversionSpecification.prototype.isPercentLiteral = function() {
1035
+ return LITERAL_PERCENT_SPECIFIER === this.percent;
1036
+ };
1037
+ ConversionSpecification.prototype.getPaddingCharacter = function() {
1038
+ var paddingCharacter = nilDefault(this.paddingSpecifier, " ");
1039
+ if (paddingCharacter.length === 2 && paddingCharacter[0] === LITERAL_SINGLE_QUOTE) {
1040
+ paddingCharacter = paddingCharacter[1];
1041
+ }
1042
+ return paddingCharacter;
1043
+ };
1044
+ function validate(index, replacementsLength, conversion) {
1045
+ if (isNil(conversion.typeSpecifier)) {
1046
+ throw new Error("sprintf(): Unknown type specifier");
1047
+ }
1048
+ if (index > replacementsLength - 1) {
1049
+ throw new Error("sprintf(): Too few arguments");
1050
+ }
1051
+ if (index < 0) {
1052
+ throw new Error("sprintf(): Argument number must be greater than zero");
1053
+ }
1054
+ }
1055
+ function match(replacementIndex, replacements, conversionSpecification, percent, position, signSpecifier, paddingSpecifier, alignmentSpecifier, widthSpecifier, precisionSpecifier, typeSpecifier) {
1056
+ var conversion = new ConversionSpecification({
1057
+ percent,
1058
+ signSpecifier,
1059
+ paddingSpecifier,
1060
+ alignmentSpecifier,
1061
+ width: coerceToNumber(widthSpecifier, null),
1062
+ precision: coerceToNumber(precisionSpecifier, null),
1063
+ typeSpecifier
1064
+ });
1065
+ if (conversion.isPercentLiteral()) {
1066
+ return conversionSpecification.slice(1);
1067
+ }
1068
+ var actualReplacementIndex = replacementIndex.getIndexByPosition(position);
1069
+ replacementIndex.incrementOnEmptyPosition(position);
1070
+ validate(actualReplacementIndex, replacements.length, conversion);
1071
+ return compute(replacements[actualReplacementIndex], conversion);
1072
+ }
1073
+ function sprintf(format) {
1074
+ var formatString = coerceToString(format);
1075
+ if (formatString === "") {
1076
+ return formatString;
1077
+ }
1078
+ for (var _len = arguments.length, replacements = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
1079
+ replacements[_key - 1] = arguments[_key];
1080
+ }
1081
+ var boundReplacementMatch = match.bind(void 0, new ReplacementIndex(), replacements);
1082
+ return formatString.replace(REGEXP_CONVERSION_SPECIFICATION, boundReplacementMatch);
1083
+ }
1084
+ function vprintf(format, replacements) {
1085
+ return sprintf.apply(void 0, [format].concat(_toConsumableArray(nilDefault(replacements, []))));
1086
+ }
1087
+ var escapeCharactersMap = {
1088
+ "<": "&lt;",
1089
+ ">": "&gt;",
1090
+ "&": "&amp;",
1091
+ '"': "&quot;",
1092
+ "'": "&#x27;",
1093
+ "`": "&#x60;"
1094
+ };
1095
+ function replaceSpecialCharacter(character) {
1096
+ return escapeCharactersMap[character];
1097
+ }
1098
+ function escapeHtml(subject) {
1099
+ return coerceToString(subject).replace(REGEXP_HTML_SPECIAL_CHARACTERS, replaceSpecialCharacter);
1100
+ }
1101
+ function escapeRegExp2(subject) {
1102
+ return coerceToString(subject).replace(REGEXP_SPECIAL_CHARACTERS, "\\$&");
1103
+ }
1104
+ var unescapeCharactersMap = {
1105
+ "<": /(&lt;)|(&#x0*3c;)|(&#0*60;)/gi,
1106
+ ">": /(&gt;)|(&#x0*3e;)|(&#0*62;)/gi,
1107
+ "&": /(&amp;)|(&#x0*26;)|(&#0*38;)/gi,
1108
+ '"': /(&quot;)|(&#x0*22;)|(&#0*34;)/gi,
1109
+ "'": /(&#x0*27;)|(&#0*39;)/gi,
1110
+ "`": /(&#x0*60;)|(&#0*96;)/gi
1111
+ };
1112
+ var characters = Object.keys(unescapeCharactersMap);
1113
+ function reduceUnescapedString(string, key) {
1114
+ return string.replace(unescapeCharactersMap[key], key);
1115
+ }
1116
+ function unescapeHtml(subject) {
1117
+ var subjectString = coerceToString(subject);
1118
+ return characters.reduce(reduceUnescapedString, subjectString);
1119
+ }
1120
+ function indexOf(subject, search2, fromIndex) {
1121
+ var subjectString = coerceToString(subject);
1122
+ return subjectString.indexOf(search2, fromIndex);
1123
+ }
1124
+ function lastIndexOf(subject, search2, fromIndex) {
1125
+ var subjectString = coerceToString(subject);
1126
+ return subjectString.lastIndexOf(search2, fromIndex);
1127
+ }
1128
+ function search(subject, pattern, fromIndex) {
1129
+ var subjectString = coerceToString(subject);
1130
+ var fromIndexNumber = isNil(fromIndex) ? 0 : clipNumber(toInteger(fromIndex), 0, subjectString.length);
1131
+ var matchIndex = subjectString.substr(fromIndexNumber).search(pattern);
1132
+ if (matchIndex !== -1 && !isNaN(fromIndexNumber)) {
1133
+ matchIndex += fromIndexNumber;
1134
+ }
1135
+ return matchIndex;
1136
+ }
1137
+ function insert(subject, toInsert, position) {
1138
+ var subjectString = coerceToString(subject);
1139
+ var toInsertString = coerceToString(toInsert);
1140
+ var positionNumber = coerceToNumber(position);
1141
+ if (positionNumber < 0 || positionNumber > subjectString.length || toInsertString === "") {
1142
+ return subjectString;
1143
+ }
1144
+ return subjectString.slice(0, positionNumber) + toInsertString + subjectString.slice(positionNumber);
1145
+ }
1146
+ var diacritics = {
1147
+ "3": "\u039E\u03BE",
1148
+ "8": "\u0398\u03B8",
1149
+ A: "A\xC0\xC1\xC2\xC3\xC4\xC5\u0100\u0102\u0104\u01CD\u01DE\u01E0\u01FA\u0200\u0202\u0226\u023A\u0386\u0391\u0410",
1150
+ B: "B\u0181\u0182\u0243\u0392\u0411",
1151
+ C: "C\xC7\u0106\u0108\u010A\u010C\u0187\u023B\u0426",
1152
+ D: "D\u010E\u0110\u0189\u018A\u018B\xD0\u0394\u0414",
1153
+ E: "E\xC8\xC9\xCA\xCB\u0112\u0114\u0116\u0118\u011A\u018E\u0190\u0204\u0206\u0228\u0388\u0395\u0415\u042D",
1154
+ F: "F\u0191\u03A6\u0424",
1155
+ G: "G\u011C\u011E\u0120\u0122\u0193\u01E4\u01E6\u01F4\u0393\u0413\u0490",
1156
+ H: "H\u0124\u0126\u021E\u0389\u0397\u0425",
1157
+ I: "I\xCC\xCD\xCE\xCF\u0128\u012A\u012C\u012E\u0130\u0197\u01CF\u0208\u020A\u038A\u0399\u03AA\u0406\u0418",
1158
+ J: "J\u0134\u0248\u0419",
1159
+ K: "K\u0136\u0198\u01E8\u039A\u041A",
1160
+ L: "L\u0139\u013B\u013D\u013F\u0141\u023D\u039B\u041B",
1161
+ M: "M\u019C\u039C\u041C",
1162
+ N: "N\xD1\u0143\u0145\u0147\u019D\u01F8\u0220\u039D\u041D",
1163
+ O: "O\xD2\xD3\xD4\xD5\xD6\xD8\u014C\u014E\u0150\u0186\u019F\u01A0\u01D1\u01EA\u01EC\u01FE\u020C\u020E\u022A\u022C\u022E\u0230\u038C\u039F\u041E",
1164
+ P: "P\u01A4\u03A0\u041F",
1165
+ Q: "Q\u024A",
1166
+ R: "R\u0154\u0156\u0158\u0210\u0212\u024C\u03A1\u0420",
1167
+ S: "S\u015A\u015C\u015E\u0160\u0218\u03A3\u0421",
1168
+ T: "T\u0162\u0164\u0166\u01AC\u01AE\u021A\u023E\u03A4\u0422",
1169
+ U: "U\xD9\xDA\xDB\xDC\u0168\u016A\u016C\u016E\u0170\u0172\u01AF\u01D3\u01D5\u01D7\u01D9\u01DB\u0214\u0216\u0244\u0423\u042A",
1170
+ V: "V\u01B2\u0245\u0412",
1171
+ W: "W\u0174\u038F\u03A9",
1172
+ X: "X\u03A7",
1173
+ Y: "Y\xDD\u0176\u0178\u01B3\u0232\u024E\u038E\u03A5\u03AB\u042B",
1174
+ Z: "Z\u0179\u017B\u017D\u01B5\u0224\u0396\u0417",
1175
+ a: "a\xE0\xE1\xE2\xE3\xE4\xE5\u0101\u0103\u0105\u01CE\u01DF\u01E1\u01FB\u0201\u0203\u0227\u0250\u03AC\u03B1\u0430",
1176
+ b: "b\u0180\u0183\u0253\u03B2\u0431",
1177
+ c: "c\xE7\u0107\u0109\u010B\u010D\u0188\u023C\u0446",
1178
+ d: "d\u010F\u0111\u018C\u0256\u0257\xF0\u03B4\u0434",
1179
+ e: "e\xE8\xE9\xEA\xEB\u0113\u0115\u0117\u0119\u011B\u01DD\u0205\u0207\u0229\u0247\u025B\u03AD\u03B5\u0435\u044D",
1180
+ f: "f\u0192\u03C6\u0444",
1181
+ g: "g\u011D\u011F\u0121\u0123\u01E5\u01E7\u01F5\u0260\u03B3\u0433\u0491",
1182
+ h: "h\u0125\u0127\u021F\u0265\u03AE\u03B7\u0445",
1183
+ i: "i\xEC\xED\xEE\xEF\u0129\u012B\u012D\u012F\u0131\u01D0\u0209\u020B\u0268\u0390\u03AF\u03B9\u03CA\u0438\u0456",
1184
+ j: "j\u0135\u01F0\u0249\u0439",
1185
+ k: "k\u0137\u0199\u01E9\u03BA\u043A",
1186
+ l: "l\u013A\u013C\u013E\u0140\u0142\u017F\u019A\u026B\u03BB\u043B",
1187
+ m: "m\u026F\u0271\u03BC\u043C",
1188
+ n: "n\xF1\u0144\u0146\u0148\u0149\u019E\u01F9\u0272\u03BD\u043D",
1189
+ o: "o\xF2\xF3\xF4\xF5\xF6\xF8\u014D\u014F\u0151\u01A1\u01D2\u01EB\u01ED\u01FF\u020D\u020F\u022B\u022D\u022F\u0231\u0254\u0275\u03BF\u03CC\u043E",
1190
+ p: "p\u01A5\u03C0\u043F",
1191
+ q: "q\u024B",
1192
+ r: "r\u0155\u0157\u0159\u0211\u0213\u024D\u027D\u03C1\u0440",
1193
+ s: "s\xDF\u015B\u015D\u015F\u0161\u0219\u023F\u03C2\u03C3\u0441",
1194
+ t: "t\u0163\u0165\u0167\u01AD\u021B\u0288\u03C4\u0442",
1195
+ u: "u\xF9\xFA\xFB\xFC\u0169\u016B\u016D\u016F\u0171\u0173\u01B0\u01D4\u01D6\u01D8\u01DA\u01DC\u0215\u0217\u0289\u0443\u044A",
1196
+ v: "v\u028B\u028C\u0432",
1197
+ w: "w\u0175\u03C9\u03CE",
1198
+ x: "x\u03C7",
1199
+ y: "y\xFD\xFF\u0177\u01B4\u0233\u024F\u03B0\u03C5\u03CB\u03CD\u044B",
1200
+ z: "z\u017A\u017C\u017E\u01B6\u0225\u0240\u03B6\u0437",
1201
+ OE: "\x8C\u0152",
1202
+ oe: "\x9C\u0153",
1203
+ AE: "\xC6\u01E2\u01FC",
1204
+ ae: "\xE6\u01E3\u01FD",
1205
+ hv: "\u0195",
1206
+ OI: "\u01A2",
1207
+ oi: "\u01A3",
1208
+ DZ: "\u01C4\u01F1",
1209
+ Dz: "\u01C5\u01F2",
1210
+ dz: "\u01C6\u01F3",
1211
+ LJ: "\u01C7",
1212
+ Lj: "\u01C8",
1213
+ lj: "\u01C9",
1214
+ NJ: "\u01CA",
1215
+ Nj: "\u01CB",
1216
+ nj: "\u01CC",
1217
+ OU: "\u0222",
1218
+ ou: "\u0223",
1219
+ TH: "\xDE",
1220
+ th: "\xFE",
1221
+ PS: "\u03A8",
1222
+ ps: "\u03C8",
1223
+ Yo: "\u0401",
1224
+ Ye: "\u0404",
1225
+ Yi: "\u0407",
1226
+ Zh: "\u0416",
1227
+ Ch: "\u0427",
1228
+ Sh: "\u0428\u0429",
1229
+ "": "\u042A\u042C\u044C",
1230
+ Yu: "\u042E",
1231
+ Ya: "\u042F",
1232
+ zh: "\u0436",
1233
+ ch: "\u0447",
1234
+ sh: "\u0448\u0449",
1235
+ yu: "\u044E",
1236
+ ya: "\u044F",
1237
+ yo: "\u0451",
1238
+ ye: "\u0454",
1239
+ yi: "\u0457"
1240
+ };
1241
+ var diacriticsMap = null;
1242
+ function getDiacriticsMap() {
1243
+ if (diacriticsMap !== null) {
1244
+ return diacriticsMap;
1245
+ }
1246
+ diacriticsMap = {};
1247
+ Object.keys(diacritics).forEach(function(key) {
1248
+ var characters2 = diacritics[key];
1249
+ for (var index = 0; index < characters2.length; index++) {
1250
+ var character = characters2[index];
1251
+ diacriticsMap[character] = key;
1252
+ }
1253
+ });
1254
+ return diacriticsMap;
1255
+ }
1256
+ function getLatinCharacter(character) {
1257
+ var characterWithoutDiacritic = getDiacriticsMap()[character];
1258
+ return characterWithoutDiacritic ? characterWithoutDiacritic : character;
1259
+ }
1260
+ function removeCombiningMarks(character, cleanCharacter) {
1261
+ return cleanCharacter;
1262
+ }
1263
+ function latinise(subject) {
1264
+ var subjectString = coerceToString(subject);
1265
+ if (subjectString === "") {
1266
+ return "";
1267
+ }
1268
+ return subjectString.replace(REGEXP_NON_LATIN, getLatinCharacter).replace(REGEXP_COMBINING_MARKS, removeCombiningMarks);
1269
+ }
1270
+ function pad(subject, length, pad2) {
1271
+ var subjectString = coerceToString(subject);
1272
+ var lengthInt = isNil(length) ? 0 : clipNumber(toInteger(length), 0, MAX_SAFE_INTEGER);
1273
+ var padString = coerceToString(pad2, " ");
1274
+ if (lengthInt <= subjectString.length) {
1275
+ return subjectString;
1276
+ }
1277
+ var paddingLength = lengthInt - subjectString.length;
1278
+ var paddingSideLength = toInteger(paddingLength / 2);
1279
+ var paddingSideRemainingLength = paddingLength % 2;
1280
+ return buildPadding(padString, paddingSideLength) + subjectString + buildPadding(padString, paddingSideLength + paddingSideRemainingLength);
1281
+ }
1282
+ function replace(subject, search2, replace2) {
1283
+ var subjectString = coerceToString(subject);
1284
+ return subjectString.replace(search2, replace2);
1285
+ }
1286
+ function replaceAll(subject, search2, replace2) {
1287
+ var subjectString = coerceToString(subject);
1288
+ if (search2 instanceof RegExp) {
1289
+ if (search2.flags.indexOf("g") === -1) {
1290
+ throw new TypeError("search argument is a non-global regular expression");
1291
+ }
1292
+ return subjectString.replace(search2, replace2);
1293
+ }
1294
+ var searchString = coerceToString(search2);
1295
+ var isFunctionalReplace = typeof replace2 === "function";
1296
+ if (!isFunctionalReplace) {
1297
+ replace2 = coerceToString(replace2);
1298
+ }
1299
+ var searchLength = searchString.length;
1300
+ if (searchLength === 0) {
1301
+ return replaceAll(subject, /(?:)/g, replace2);
1302
+ }
1303
+ var advanceBy = searchLength > 1 ? searchLength : 1;
1304
+ var matchPositions = [];
1305
+ var position = subjectString.indexOf(searchString, 0);
1306
+ while (position !== -1) {
1307
+ matchPositions.push(position);
1308
+ position = subjectString.indexOf(searchString, position + advanceBy);
1309
+ }
1310
+ var endOfLastMatch = 0;
1311
+ var result = "";
1312
+ for (var i = 0; i < matchPositions.length; i++) {
1313
+ var _position = matchPositions[i];
1314
+ var replacement = replace2;
1315
+ if (isFunctionalReplace) {
1316
+ replacement = coerceToString(replace2.call(void 0, searchString, _position, subjectString));
1317
+ }
1318
+ result += subjectString.slice(endOfLastMatch, _position) + replacement;
1319
+ endOfLastMatch = _position + searchLength;
1320
+ }
1321
+ if (endOfLastMatch < subjectString.length) {
1322
+ result += subjectString.slice(endOfLastMatch);
1323
+ }
1324
+ return result;
1325
+ }
1326
+ function reverse(subject) {
1327
+ var subjectString = coerceToString(subject);
1328
+ return subjectString.split("").reverse().join("");
1329
+ }
1330
+ function reverseGrapheme(subject) {
1331
+ var subjectString = coerceToString(subject);
1332
+ subjectString = subjectString.replace(REGEXP_COMBINING_MARKS, function($0, $1, $2) {
1333
+ return reverseGrapheme($2) + $1;
1334
+ }).replace(REGEXP_SURROGATE_PAIRS, "$2$1");
1335
+ var reversedString = "";
1336
+ var index = subjectString.length;
1337
+ while (index--) {
1338
+ reversedString += subjectString.charAt(index);
1339
+ }
1340
+ return reversedString;
1341
+ }
1342
+ function slugify(subject) {
1343
+ var subjectString = coerceToString(subject);
1344
+ if (subjectString === "") {
1345
+ return "";
1346
+ }
1347
+ var cleanSubjectString = latinise(subjectString).replace(REGEXP_NON_LATIN, "-");
1348
+ return kebabCase(cleanSubjectString);
1349
+ }
1350
+ function splice(subject, start, deleteCount, toAdd) {
1351
+ var subjectString = coerceToString(subject);
1352
+ var toAddString = coerceToString(toAdd);
1353
+ var startPosition = coerceToNumber(start);
1354
+ if (startPosition < 0) {
1355
+ startPosition = subjectString.length + startPosition;
1356
+ if (startPosition < 0) {
1357
+ startPosition = 0;
1358
+ }
1359
+ } else if (startPosition > subjectString.length) {
1360
+ startPosition = subjectString.length;
1361
+ }
1362
+ var deleteCountNumber = coerceToNumber(deleteCount, subjectString.length - startPosition);
1363
+ if (deleteCountNumber < 0) {
1364
+ deleteCountNumber = 0;
1365
+ }
1366
+ return subjectString.slice(0, startPosition) + toAddString + subjectString.slice(startPosition + deleteCountNumber);
1367
+ }
1368
+ function tr(subject, from, to) {
1369
+ var subjectString = coerceToString(subject);
1370
+ var keys;
1371
+ var values;
1372
+ if (isString(from) && isString(to)) {
1373
+ keys = from.split("");
1374
+ values = to.split("");
1375
+ } else {
1376
+ var _extractKeysAndValues = extractKeysAndValues(nilDefault(from, {}));
1377
+ var _extractKeysAndValues2 = _slicedToArray(_extractKeysAndValues, 2);
1378
+ keys = _extractKeysAndValues2[0];
1379
+ values = _extractKeysAndValues2[1];
1380
+ }
1381
+ var keysLength = keys.length;
1382
+ if (keysLength === 0) {
1383
+ return subjectString;
1384
+ }
1385
+ var result = "";
1386
+ var valuesLength = values.length;
1387
+ for (var index = 0; index < subjectString.length; index++) {
1388
+ var isMatch = false;
1389
+ var matchValue = void 0;
1390
+ for (var keyIndex = 0; keyIndex < keysLength && keyIndex < valuesLength; keyIndex++) {
1391
+ var key = keys[keyIndex];
1392
+ if (subjectString.substr(index, key.length) === key) {
1393
+ isMatch = true;
1394
+ matchValue = values[keyIndex];
1395
+ index = index + key.length - 1;
1396
+ break;
1397
+ }
1398
+ }
1399
+ result += isMatch ? matchValue : subjectString[index];
1400
+ }
1401
+ return result;
1402
+ }
1403
+ function extractKeysAndValues(object) {
1404
+ var keys = Object.keys(object);
1405
+ var values = keys.sort(sortStringByLength).map(function(key) {
1406
+ return object[key];
1407
+ });
1408
+ return [keys, values];
1409
+ }
1410
+ function sortStringByLength(str1, str2) {
1411
+ if (str1.length === str2.length) {
1412
+ return 0;
1413
+ }
1414
+ return str1.length < str2.length ? 1 : -1;
1415
+ }
1416
+ function includes(subject, search2, position) {
1417
+ var subjectString = coerceToString(subject);
1418
+ var searchString = toString(search2);
1419
+ if (searchString === null) {
1420
+ return false;
1421
+ }
1422
+ if (searchString === "") {
1423
+ return true;
1424
+ }
1425
+ position = isNil(position) ? 0 : clipNumber(toInteger(position), 0, subjectString.length);
1426
+ return subjectString.indexOf(searchString, position) !== -1;
1427
+ }
1428
+ var reduce$1 = Array.prototype.reduce;
1429
+ function trimLeft(subject, whitespace2) {
1430
+ var subjectString = coerceToString(subject);
1431
+ if (whitespace2 === "" || subjectString === "") {
1432
+ return subjectString;
1433
+ }
1434
+ var whitespaceString = toString(whitespace2);
1435
+ if (isNil(whitespaceString)) {
1436
+ return subjectString.replace(REGEXP_TRIM_LEFT, "");
1437
+ }
1438
+ var matchWhitespace = true;
1439
+ return reduce$1.call(subjectString, function(trimmed, character) {
1440
+ if (matchWhitespace && includes(whitespaceString, character)) {
1441
+ return trimmed;
1442
+ }
1443
+ matchWhitespace = false;
1444
+ return trimmed + character;
1445
+ }, "");
1446
+ }
1447
+ var reduceRight = Array.prototype.reduceRight;
1448
+ function trimRight(subject, whitespace2) {
1449
+ var subjectString = coerceToString(subject);
1450
+ if (whitespace2 === "" || subjectString === "") {
1451
+ return subjectString;
1452
+ }
1453
+ var whitespaceString = toString(whitespace2);
1454
+ if (isNil(whitespaceString)) {
1455
+ return subjectString.replace(REGEXP_TRIM_RIGHT, "");
1456
+ }
1457
+ var matchWhitespace = true;
1458
+ return reduceRight.call(subjectString, function(trimmed, character) {
1459
+ if (matchWhitespace && includes(whitespaceString, character)) {
1460
+ return trimmed;
1461
+ }
1462
+ matchWhitespace = false;
1463
+ return character + trimmed;
1464
+ }, "");
1465
+ }
1466
+ function trim(subject, whitespace2) {
1467
+ var subjectString = coerceToString(subject);
1468
+ if (whitespace2 === "" || subjectString === "") {
1469
+ return subjectString;
1470
+ }
1471
+ var whitespaceString = toString(whitespace2);
1472
+ if (isNil(whitespaceString)) {
1473
+ return subjectString.trim();
1474
+ }
1475
+ return trimRight(trimLeft(subjectString, whitespaceString), whitespaceString);
1476
+ }
1477
+ var OPTION_WIDTH = "width";
1478
+ var OPTION_NEW_LINE = "newLine";
1479
+ var OPTION_INDENT = "indent";
1480
+ var OPTION_CUT = "cut";
1481
+ function wordWrap(subject) {
1482
+ var options = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1483
+ var subjectString = coerceToString(subject);
1484
+ var _determineOptions = determineOptions(options), width = _determineOptions.width, newLine = _determineOptions.newLine, indent = _determineOptions.indent, cut = _determineOptions.cut;
1485
+ if (subjectString === "" || width <= 0) {
1486
+ return indent;
1487
+ }
1488
+ var subjectLength = subjectString.length;
1489
+ var substring2 = subjectString.substring.bind(subjectString);
1490
+ var offset = 0;
1491
+ var wrappedLine = "";
1492
+ while (subjectLength - offset > width) {
1493
+ if (subjectString[offset] === " ") {
1494
+ offset++;
1495
+ continue;
1496
+ }
1497
+ var spaceToWrapAt = subjectString.lastIndexOf(" ", width + offset);
1498
+ if (spaceToWrapAt >= offset) {
1499
+ wrappedLine += indent + substring2(offset, spaceToWrapAt) + newLine;
1500
+ offset = spaceToWrapAt + 1;
1501
+ } else {
1502
+ if (cut) {
1503
+ wrappedLine += indent + substring2(offset, width + offset) + newLine;
1504
+ offset += width;
1505
+ } else {
1506
+ spaceToWrapAt = subjectString.indexOf(" ", width + offset);
1507
+ if (spaceToWrapAt >= 0) {
1508
+ wrappedLine += indent + substring2(offset, spaceToWrapAt) + newLine;
1509
+ offset = spaceToWrapAt + 1;
1510
+ } else {
1511
+ wrappedLine += indent + substring2(offset);
1512
+ offset = subjectLength;
1513
+ }
1514
+ }
1515
+ }
1516
+ }
1517
+ if (offset < subjectLength) {
1518
+ wrappedLine += indent + substring2(offset);
1519
+ }
1520
+ return wrappedLine;
1521
+ }
1522
+ function determineOptions(options) {
1523
+ return {
1524
+ width: coerceToNumber(options[OPTION_WIDTH], 75),
1525
+ newLine: coerceToString(options[OPTION_NEW_LINE], "\n"),
1526
+ indent: coerceToString(options[OPTION_INDENT], ""),
1527
+ cut: coerceToBoolean(options[OPTION_CUT], false)
1528
+ };
1529
+ }
1530
+ function endsWith(subject, end, position) {
1531
+ if (isNil(end)) {
1532
+ return false;
1533
+ }
1534
+ var subjectString = coerceToString(subject);
1535
+ var endString = coerceToString(end);
1536
+ if (endString === "") {
1537
+ return true;
1538
+ }
1539
+ position = isNil(position) ? subjectString.length : clipNumber(toInteger(position), 0, subjectString.length);
1540
+ position -= endString.length;
1541
+ var lastIndex = subjectString.indexOf(endString, position);
1542
+ return lastIndex !== -1 && lastIndex === position;
1543
+ }
1544
+ function isAlpha(subject) {
1545
+ var subjectString = coerceToString(subject);
1546
+ return REGEXP_ALPHA.test(subjectString);
1547
+ }
1548
+ function isAlphaDigit(subject) {
1549
+ var subjectString = coerceToString(subject);
1550
+ return REGEXP_ALPHA_DIGIT.test(subjectString);
1551
+ }
1552
+ function isBlank(subject) {
1553
+ var subjectString = coerceToString(subject);
1554
+ return subjectString.trim().length === 0;
1555
+ }
1556
+ function isDigit(subject) {
1557
+ var subjectString = coerceToString(subject);
1558
+ return REGEXP_DIGIT.test(subjectString);
1559
+ }
1560
+ function isEmpty(subject) {
1561
+ var subjectString = coerceToString(subject);
1562
+ return subjectString.length === 0;
1563
+ }
1564
+ function isLowerCase(subject) {
1565
+ var valueString = coerceToString(subject);
1566
+ return isAlpha(valueString) && valueString.toLowerCase() === valueString;
1567
+ }
1568
+ function isNumeric(subject) {
1569
+ var valueNumeric = typeof subject === "object" && !isNil(subject) ? Number(subject) : subject;
1570
+ return (typeof valueNumeric === "number" || typeof valueNumeric === "string") && !isNaN(valueNumeric - parseFloat(valueNumeric));
1571
+ }
1572
+ function isUpperCase(subject) {
1573
+ var subjectString = coerceToString(subject);
1574
+ return isAlpha(subjectString) && subjectString.toUpperCase() === subjectString;
1575
+ }
1576
+ function matches(subject, pattern, flags) {
1577
+ var subjectString = coerceToString(subject);
1578
+ var flagsString = coerceToString(flags);
1579
+ var patternString;
1580
+ if (!(pattern instanceof RegExp)) {
1581
+ patternString = toString(pattern);
1582
+ if (patternString === null) {
1583
+ return false;
1584
+ }
1585
+ pattern = new RegExp(patternString, flagsString);
1586
+ }
1587
+ return pattern.test(subjectString);
1588
+ }
1589
+ function startsWith(subject, start, position) {
1590
+ var subjectString = coerceToString(subject);
1591
+ var startString = toString(start);
1592
+ if (startString === null) {
1593
+ return false;
1594
+ }
1595
+ if (startString === "") {
1596
+ return true;
1597
+ }
1598
+ position = isNil(position) ? 0 : clipNumber(toInteger(position), 0, subjectString.length);
1599
+ return subjectString.substr(position, startString.length) === startString;
1600
+ }
1601
+ function chars(subject) {
1602
+ var subjectString = coerceToString(subject);
1603
+ return subjectString.split("");
1604
+ }
1605
+ function codePoints(subject) {
1606
+ var subjectString = coerceToString(subject);
1607
+ var subjectStringLength = subjectString.length;
1608
+ var codePointArray = [];
1609
+ var index = 0;
1610
+ var codePointNumber;
1611
+ while (index < subjectStringLength) {
1612
+ codePointNumber = codePointAt(subjectString, index);
1613
+ codePointArray.push(codePointNumber);
1614
+ index += codePointNumber > 65535 ? 2 : 1;
1615
+ }
1616
+ return codePointArray;
1617
+ }
1618
+ function graphemes(subject) {
1619
+ var subjectString = coerceToString(subject);
1620
+ return nilDefault(subjectString.match(REGEXP_UNICODE_CHARACTER), []);
1621
+ }
1622
+ function split(subject, separator, limit) {
1623
+ var subjectString = coerceToString(subject);
1624
+ return subjectString.split(separator, limit);
1625
+ }
1626
+ var BYRE_ORDER_MARK = "\uFEFF";
1627
+ function trim$1(subject) {
1628
+ var subjectString = coerceToString(subject);
1629
+ if (subjectString === "") {
1630
+ return "";
1631
+ }
1632
+ if (subjectString[0] === BYRE_ORDER_MARK) {
1633
+ return subjectString.substring(1);
1634
+ }
1635
+ return subjectString;
1636
+ }
1637
+ function hasSubstringAtIndex(subject, substring2, index) {
1638
+ var lookBehind = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : true;
1639
+ var indexOffset = 0;
1640
+ if (lookBehind) {
1641
+ indexOffset = -substring2.length + 1;
1642
+ }
1643
+ var extractedSubstring = subject.substr(index + indexOffset, substring2.length);
1644
+ return extractedSubstring.toLowerCase() === substring2;
1645
+ }
1646
+ function parseTagList(tags) {
1647
+ var tagsList = [];
1648
+ var match2;
1649
+ while ((match2 = REGEXP_TAG_LIST.exec(tags)) !== null) {
1650
+ tagsList.push(match2[1]);
1651
+ }
1652
+ return tagsList;
1653
+ }
1654
+ var STATE_START_TAG = 0;
1655
+ var STATE_NON_WHITESPACE = 1;
1656
+ var STATE_DONE = 2;
1657
+ function parseTagName(tagContent) {
1658
+ var state = STATE_START_TAG;
1659
+ var tagName = "";
1660
+ var index = 0;
1661
+ while (state !== STATE_DONE) {
1662
+ var char = tagContent[index++].toLowerCase();
1663
+ switch (char) {
1664
+ case "<":
1665
+ break;
1666
+ case ">":
1667
+ state = STATE_DONE;
1668
+ break;
1669
+ default:
1670
+ if (REGEXP_WHITESPACE.test(char)) {
1671
+ if (state === STATE_NON_WHITESPACE) {
1672
+ state = STATE_DONE;
1673
+ }
1674
+ } else {
1675
+ if (state === STATE_START_TAG) {
1676
+ state = STATE_NON_WHITESPACE;
1677
+ }
1678
+ if (char !== "/") {
1679
+ tagName += char;
1680
+ }
1681
+ }
1682
+ break;
1683
+ }
1684
+ }
1685
+ return tagName;
1686
+ }
1687
+ var STATE_OUTPUT = 0;
1688
+ var STATE_HTML = 1;
1689
+ var STATE_EXCLAMATION = 2;
1690
+ var STATE_COMMENT = 3;
1691
+ function trim$2(subject, allowableTags, replacement) {
1692
+ subject = coerceToString(subject);
1693
+ if (subject === "") {
1694
+ return "";
1695
+ }
1696
+ if (!Array.isArray(allowableTags)) {
1697
+ var allowableTagsString = coerceToString(allowableTags);
1698
+ allowableTags = allowableTagsString === "" ? [] : parseTagList(allowableTagsString);
1699
+ }
1700
+ var replacementString = coerceToString(replacement);
1701
+ var length = subject.length;
1702
+ var hasAllowableTags = allowableTags.length > 0;
1703
+ var hasSubstring = hasSubstringAtIndex.bind(null, subject);
1704
+ var state = STATE_OUTPUT;
1705
+ var depth = 0;
1706
+ var output = "";
1707
+ var tagContent = "";
1708
+ var quote = null;
1709
+ for (var index = 0; index < length; index++) {
1710
+ var char = subject[index];
1711
+ var advance = false;
1712
+ switch (char) {
1713
+ case "<":
1714
+ if (quote) {
1715
+ break;
1716
+ }
1717
+ if (hasSubstring("< ", index, false)) {
1718
+ advance = true;
1719
+ break;
1720
+ }
1721
+ if (state === STATE_OUTPUT) {
1722
+ advance = true;
1723
+ state = STATE_HTML;
1724
+ break;
1725
+ }
1726
+ if (state === STATE_HTML) {
1727
+ depth++;
1728
+ break;
1729
+ }
1730
+ advance = true;
1731
+ break;
1732
+ case "!":
1733
+ if (state === STATE_HTML && hasSubstring("<!", index)) {
1734
+ state = STATE_EXCLAMATION;
1735
+ break;
1736
+ }
1737
+ advance = true;
1738
+ break;
1739
+ case "-":
1740
+ if (state === STATE_EXCLAMATION && hasSubstring("!--", index)) {
1741
+ state = STATE_COMMENT;
1742
+ break;
1743
+ }
1744
+ advance = true;
1745
+ break;
1746
+ case '"':
1747
+ case "'":
1748
+ if (state === STATE_HTML) {
1749
+ if (quote === char) {
1750
+ quote = null;
1751
+ } else if (!quote) {
1752
+ quote = char;
1753
+ }
1754
+ }
1755
+ advance = true;
1756
+ break;
1757
+ case "E":
1758
+ case "e":
1759
+ if (state === STATE_EXCLAMATION && hasSubstring("doctype", index)) {
1760
+ state = STATE_HTML;
1761
+ break;
1762
+ }
1763
+ advance = true;
1764
+ break;
1765
+ case ">":
1766
+ if (depth > 0) {
1767
+ depth--;
1768
+ break;
1769
+ }
1770
+ if (quote) {
1771
+ break;
1772
+ }
1773
+ if (state === STATE_HTML) {
1774
+ quote = null;
1775
+ state = STATE_OUTPUT;
1776
+ if (hasAllowableTags) {
1777
+ tagContent += ">";
1778
+ var tagName = parseTagName(tagContent);
1779
+ if (allowableTags.indexOf(tagName.toLowerCase()) !== -1) {
1780
+ output += tagContent;
1781
+ } else {
1782
+ output += replacementString;
1783
+ }
1784
+ tagContent = "";
1785
+ } else {
1786
+ output += replacementString;
1787
+ }
1788
+ break;
1789
+ }
1790
+ if (state === STATE_EXCLAMATION || state === STATE_COMMENT && hasSubstring("-->", index)) {
1791
+ quote = null;
1792
+ state = STATE_OUTPUT;
1793
+ tagContent = "";
1794
+ break;
1795
+ }
1796
+ advance = true;
1797
+ break;
1798
+ default:
1799
+ advance = true;
1800
+ }
1801
+ if (advance) {
1802
+ switch (state) {
1803
+ case STATE_OUTPUT:
1804
+ output += char;
1805
+ break;
1806
+ case STATE_HTML:
1807
+ if (hasAllowableTags) {
1808
+ tagContent += char;
1809
+ }
1810
+ break;
1811
+ }
1812
+ }
1813
+ }
1814
+ return output;
1815
+ }
1816
+ var globalObject = null;
1817
+ function getGlobalObject() {
1818
+ if (globalObject !== null) {
1819
+ return globalObject;
1820
+ }
1821
+ if (typeof global === "object" && global.Object === Object) {
1822
+ globalObject = global;
1823
+ } else if (typeof self === "object" && self.Object === Object) {
1824
+ globalObject = self;
1825
+ } else {
1826
+ globalObject = new Function("return this")();
1827
+ }
1828
+ return globalObject;
1829
+ }
1830
+ var globalObject$1 = getGlobalObject();
1831
+ var previousV = globalObject$1.v;
1832
+ function noConflict() {
1833
+ if (this === globalObject$1.v) {
1834
+ globalObject$1.v = previousV;
1835
+ }
1836
+ return this;
1837
+ }
1838
+ var version = "1.4.0";
1839
+ var functions = {
1840
+ camelCase,
1841
+ capitalize,
1842
+ decapitalize,
1843
+ kebabCase,
1844
+ lowerCase,
1845
+ snakeCase,
1846
+ swapCase,
1847
+ titleCase,
1848
+ upperCase,
1849
+ count,
1850
+ countGraphemes: countGrapheme,
1851
+ countSubstrings,
1852
+ countWhere,
1853
+ countWords,
1854
+ escapeHtml,
1855
+ escapeRegExp: escapeRegExp2,
1856
+ unescapeHtml,
1857
+ sprintf,
1858
+ vprintf,
1859
+ indexOf,
1860
+ lastIndexOf,
1861
+ search,
1862
+ charAt,
1863
+ codePointAt,
1864
+ first,
1865
+ graphemeAt,
1866
+ last,
1867
+ prune,
1868
+ slice,
1869
+ substr,
1870
+ substring,
1871
+ truncate,
1872
+ insert,
1873
+ latinise,
1874
+ pad,
1875
+ padLeft,
1876
+ padRight,
1877
+ repeat,
1878
+ replace,
1879
+ replaceAll,
1880
+ reverse,
1881
+ reverseGrapheme,
1882
+ slugify,
1883
+ splice,
1884
+ tr,
1885
+ trim,
1886
+ trimLeft,
1887
+ trimRight,
1888
+ wordWrap,
1889
+ endsWith,
1890
+ includes,
1891
+ isAlpha,
1892
+ isAlphaDigit,
1893
+ isBlank,
1894
+ isDigit,
1895
+ isEmpty,
1896
+ isLowerCase,
1897
+ isNumeric,
1898
+ isString,
1899
+ isUpperCase,
1900
+ matches,
1901
+ startsWith,
1902
+ chars,
1903
+ codePoints,
1904
+ graphemes,
1905
+ split,
1906
+ words,
1907
+ stripBom: trim$1,
1908
+ stripTags: trim$2,
1909
+ noConflict,
1910
+ version
1911
+ };
1912
+ function ChainWrapper(subject, explicitChain) {
1913
+ this._wrappedValue = subject;
1914
+ this._explicitChain = explicitChain;
1915
+ }
1916
+ ChainWrapper.prototype.value = function() {
1917
+ return this._wrappedValue;
1918
+ };
1919
+ ChainWrapper.prototype.valueOf = function() {
1920
+ return this.value();
1921
+ };
1922
+ ChainWrapper.prototype.toJSON = function() {
1923
+ return this.value();
1924
+ };
1925
+ ChainWrapper.prototype.toString = function() {
1926
+ return String(this.value());
1927
+ };
1928
+ ChainWrapper.prototype.chain = function() {
1929
+ return new ChainWrapper(this._wrappedValue, true);
1930
+ };
1931
+ ChainWrapper.prototype.thru = function(changer) {
1932
+ if (typeof changer === "function") {
1933
+ return new ChainWrapper(changer(this._wrappedValue), this._explicitChain);
1934
+ }
1935
+ return this;
1936
+ };
1937
+ ChainWrapper.prototype._explicitChain = true;
1938
+ function makeFunctionChainable(functionInstance) {
1939
+ return function() {
1940
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
1941
+ args[_key] = arguments[_key];
1942
+ }
1943
+ var result = functionInstance.apply(void 0, [this._wrappedValue].concat(args));
1944
+ if (this._explicitChain || typeof result === "string") {
1945
+ return new ChainWrapper(result, this._explicitChain);
1946
+ } else {
1947
+ return result;
1948
+ }
1949
+ };
1950
+ }
1951
+ Object.keys(functions).forEach(function(name) {
1952
+ ChainWrapper.prototype[name] = makeFunctionChainable(functions[name]);
1953
+ });
1954
+ function chain(subject) {
1955
+ return new ChainWrapper(subject, true);
1956
+ }
1957
+ function Voca(subject) {
1958
+ return new ChainWrapper(subject, false);
1959
+ }
1960
+ _extends(Voca, functions, {
1961
+ chain
1962
+ });
1963
+ var es_default = Voca;
1964
+
1965
+ // src/core/template/utils.ts
1966
+ function isWithinRoot(resolved, root) {
1967
+ const normalizedRoot = root.endsWith(path__default.sep) ? root.slice(0, -1) : root;
1968
+ return resolved === normalizedRoot || resolved.startsWith(normalizedRoot + path__default.sep);
1969
+ }
1970
+ function toContextKey(filename) {
1971
+ const ext = path__default.extname(filename);
1972
+ const base2 = path__default.basename(filename, ext);
1973
+ return es_default.camelCase(base2);
1974
+ }
1975
+ function sqlEscape(value) {
1976
+ return value.replace(/'/g, "''");
1977
+ }
1978
+ var UndefinedSqlValueError = class extends Error {
1979
+ name = "UndefinedSqlValueError";
1980
+ constructor() {
1981
+ super("sqlQuote() received undefined \u2014 use null for an explicit SQL NULL, or resolve the missing value before rendering");
1982
+ }
1983
+ };
1984
+ function sqlQuote(value) {
1985
+ if (value === void 0) {
1986
+ throw new UndefinedSqlValueError();
1987
+ }
1988
+ if (value === null) {
1989
+ return "NULL";
1990
+ }
1991
+ return `'${sqlEscape(String(value))}'`;
1992
+ }
1993
+ function generateUuid() {
1994
+ return crypto.randomUUID();
1995
+ }
1996
+ function isoNow() {
1997
+ return (/* @__PURE__ */ new Date()).toISOString();
1998
+ }
1999
+ var IS_COMPILED = import.meta.url.includes("$bunfs");
2000
+ async function loadJs(filepath) {
2001
+ const mod = IS_COMPILED ? await loadWithBunBuild(filepath) : await loadWithImport(filepath);
2002
+ return mod["default"] !== void 0 ? mod["default"] : mod;
2003
+ }
2004
+ async function loadWithBunBuild(filepath) {
2005
+ const fileDir = dirname(filepath);
2006
+ const tmpFile = join(fileDir, `.noorm-helper-${randomBytes(8).toString("hex")}.js`);
2007
+ const result = await Bun.build({
2008
+ entrypoints: [filepath],
2009
+ outdir: fileDir,
2010
+ naming: tmpFile.split("/").pop(),
2011
+ target: "bun",
2012
+ format: "esm"
2013
+ });
2014
+ if (!result.success) {
2015
+ const messages = result.logs.map((l) => l.message).join("; ");
2016
+ throw new Error(`Failed to bundle ${filepath}: ${messages}`);
2017
+ }
2018
+ const mod = await import(pathToFileURL(tmpFile).href);
2019
+ unlinkSync(tmpFile);
2020
+ return mod;
2021
+ }
2022
+ async function loadWithImport(filepath) {
2023
+ const url = pathToFileURL(filepath).href;
2024
+ const urlWithCacheBust = `${url}?t=${Date.now()}`;
2025
+ return await import(urlWithCacheBust);
2026
+ }
2027
+
2028
+ // src/core/template/helpers.ts
2029
+ async function findHelperFiles(fromDir, projectRoot) {
2030
+ const helperPaths = [];
2031
+ let currentDir = path__default.resolve(fromDir);
2032
+ const root = path__default.resolve(projectRoot);
2033
+ while (isWithinRoot(currentDir, root)) {
2034
+ const helperPath = await findHelperInDir(currentDir);
2035
+ if (helperPath) {
2036
+ helperPaths.unshift(helperPath);
2037
+ }
2038
+ const parentDir = path__default.dirname(currentDir);
2039
+ if (parentDir === currentDir) {
2040
+ break;
2041
+ }
2042
+ currentDir = parentDir;
2043
+ }
2044
+ return helperPaths;
2045
+ }
2046
+ async function findHelperInDir(dir) {
2047
+ for (const ext of HELPER_EXTENSIONS) {
2048
+ const filepath = path__default.join(dir, `${HELPER_FILENAME}${ext}`);
2049
+ const [stats] = await attempt(() => stat(filepath));
2050
+ if (stats?.isFile()) {
2051
+ return filepath;
2052
+ }
2053
+ }
2054
+ return null;
2055
+ }
2056
+ async function loadHelpers(fromDir, projectRoot) {
2057
+ const helperPaths = await findHelperFiles(fromDir, projectRoot);
2058
+ const merged = {};
2059
+ const errors = [];
2060
+ for (const filepath of helperPaths) {
2061
+ const [mod, err] = await attempt(() => loadJs(filepath));
2062
+ if (err) {
2063
+ errors.push({ filepath, error: err });
2064
+ observer.emit("error", {
2065
+ source: "template",
2066
+ error: err,
2067
+ context: { filepath, operation: "load-helpers" }
2068
+ });
2069
+ continue;
2070
+ }
2071
+ if (mod && typeof mod === "object") {
2072
+ const exports$1 = mod;
2073
+ const exportCount = Object.keys(exports$1).length;
2074
+ Object.assign(merged, exports$1);
2075
+ observer.emit("template:helpers", {
2076
+ filepath,
2077
+ count: exportCount
2078
+ });
2079
+ }
2080
+ }
2081
+ return { helpers: merged, errors };
2082
+ }
2083
+ async function loadSql(filepath) {
2084
+ return readFile$1(filepath, "utf-8");
2085
+ }
2086
+
2087
+ // src/core/dt/constants.ts
2088
+ var FORMAT_VERSION = 1;
2089
+ var ENCODED_TYPES = {
2090
+ json: true,
2091
+ binary: true,
2092
+ vector: true,
2093
+ array: true,
2094
+ text: true,
2095
+ custom: true
2096
+ };
2097
+ var MAX_DECOMPRESSED_ARCHIVE_BYTES = 1024 * 1024 * 1024;
2098
+ var MAX_ROW_BYTES = 256 * 1024 * 1024;
2099
+ var DT_EXTENSIONS = {
2100
+ /** Raw .dt file (uncompressed JSON5 lines). */
2101
+ RAW: ".dt",
2102
+ /** Gzip-compressed .dt file. */
2103
+ COMPRESSED: ".dtz",
2104
+ /** Gzip-compressed and AES-256-GCM encrypted .dt file. */
2105
+ ENCRYPTED: ".dtzx"
2106
+ };
2107
+ var ALGORITHM = "aes-256-gcm";
2108
+ var IV_LENGTH = 16;
2109
+ var SALT_LENGTH = 32;
2110
+ var AUTH_TAG_LENGTH = 16;
2111
+ var KEY_LENGTH = 32;
2112
+ var PBKDF2_ITERATIONS = 1e5;
2113
+ var PBKDF2_DIGEST = "sha256";
2114
+ var MIN_PASSPHRASE_LENGTH = 12;
2115
+ function encryptWithPassphrase(data, passphrase) {
2116
+ if (passphrase.length < MIN_PASSPHRASE_LENGTH) {
2117
+ throw new Error(`Passphrase must be at least ${MIN_PASSPHRASE_LENGTH} characters`);
2118
+ }
2119
+ const salt = randomBytes(SALT_LENGTH);
2120
+ const iv = randomBytes(IV_LENGTH);
2121
+ const key = pbkdf2Sync(passphrase, salt, PBKDF2_ITERATIONS, KEY_LENGTH, PBKDF2_DIGEST);
2122
+ const cipher = createCipheriv(ALGORITHM, key, iv, {
2123
+ authTagLength: AUTH_TAG_LENGTH
2124
+ });
2125
+ const ciphertext = Buffer.concat([cipher.update(data), cipher.final()]);
2126
+ const authTag = cipher.getAuthTag();
2127
+ return {
2128
+ salt: salt.toString("base64"),
2129
+ iv: iv.toString("base64"),
2130
+ authTag: authTag.toString("base64"),
2131
+ ciphertext: ciphertext.toString("base64")
2132
+ };
2133
+ }
2134
+ function decryptWithPassphrase(payload, passphrase) {
2135
+ const salt = Buffer.from(payload.salt, "base64");
2136
+ const iv = Buffer.from(payload.iv, "base64");
2137
+ const authTag = Buffer.from(payload.authTag, "base64");
2138
+ const ciphertext = Buffer.from(payload.ciphertext, "base64");
2139
+ const key = pbkdf2Sync(passphrase, salt, PBKDF2_ITERATIONS, KEY_LENGTH, PBKDF2_DIGEST);
2140
+ const decipher = createDecipheriv(ALGORITHM, key, iv, {
2141
+ authTagLength: AUTH_TAG_LENGTH
2142
+ });
2143
+ decipher.setAuthTag(authTag);
2144
+ const decrypted = Buffer.concat([decipher.update(ciphertext), decipher.final()]);
2145
+ return decrypted;
2146
+ }
2147
+
2148
+ // src/core/dt/reader.ts
2149
+ function createRowLengthGuard() {
2150
+ let sinceNewline = 0;
2151
+ return new Transform({
2152
+ transform(chunk, _encoding, callback) {
2153
+ const lastNewline = chunk.lastIndexOf(10);
2154
+ sinceNewline = lastNewline === -1 ? sinceNewline + chunk.length : chunk.length - lastNewline - 1;
2155
+ if (sinceNewline > MAX_ROW_BYTES) {
2156
+ callback(new Error(`.dt row exceeds the ${MAX_ROW_BYTES} byte limit without a line break`));
2157
+ return;
2158
+ }
2159
+ callback(null, chunk);
2160
+ }
2161
+ });
2162
+ }
2163
+ function assertDtSchema(parsed) {
2164
+ if (typeof parsed !== "object" || parsed === null || Array.isArray(parsed)) {
2165
+ throw new Error(".dt schema line is not an object");
2166
+ }
2167
+ const schema = parsed;
2168
+ if (schema.v !== FORMAT_VERSION) {
2169
+ throw new Error(`Unsupported .dt format version: ${String(schema.v)}`);
2170
+ }
2171
+ if (!Array.isArray(schema.columns) || schema.columns.length === 0) {
2172
+ throw new Error('.dt schema is missing a non-empty "columns" array');
2173
+ }
2174
+ schema.columns.forEach((column, i) => {
2175
+ if (typeof column !== "object" || column === null) {
2176
+ throw new Error(`.dt schema column ${i} is not an object`);
2177
+ }
2178
+ if (typeof column.name !== "string" || column.name.length === 0) {
2179
+ throw new Error(`.dt schema column ${i} is missing a "name"`);
2180
+ }
2181
+ if (typeof column.type !== "string" || column.type.length === 0) {
2182
+ throw new Error(`.dt schema column "${column.name}" is missing a "type"`);
2183
+ }
2184
+ });
2185
+ return schema;
2186
+ }
2187
+ function guardRows(source, ...upstream) {
2188
+ const guard = createRowLengthGuard();
2189
+ source.on("error", (err) => guard.destroy(err));
2190
+ guard.on("close", () => {
2191
+ for (const stream of [source, ...upstream]) {
2192
+ stream.destroy();
2193
+ }
2194
+ });
2195
+ return source.pipe(guard);
2196
+ }
2197
+ var DtReader = class {
2198
+ #filepath;
2199
+ #passphrase;
2200
+ #extension;
2201
+ #schema = null;
2202
+ #lineReader = null;
2203
+ #inputStream = null;
2204
+ /**
2205
+ * Create a new DtReader.
2206
+ *
2207
+ * @param options - File path and optional passphrase for .dtzx
2208
+ */
2209
+ constructor(options) {
2210
+ this.#filepath = options.filepath;
2211
+ this.#passphrase = options.passphrase;
2212
+ this.#extension = path__default.extname(options.filepath).toLowerCase();
2213
+ }
2214
+ /** The parsed schema from line 1. Available after open(). */
2215
+ get schema() {
2216
+ return this.#schema;
2217
+ }
2218
+ /**
2219
+ * Open the file and parse the schema header.
2220
+ *
2221
+ * Must be called before iterating rows.
2222
+ */
2223
+ async open() {
2224
+ const readable = this.#createReadableStream();
2225
+ this.#inputStream = readable;
2226
+ const rl = createInterface({ input: readable, crlfDelay: Infinity });
2227
+ const lines = rl[Symbol.asyncIterator]();
2228
+ const firstLine = await lines.next();
2229
+ if (firstLine.done || !firstLine.value) {
2230
+ throw new Error("Empty .dt file \u2014 no schema line");
2231
+ }
2232
+ const [parsed, parseErr] = attemptSync(() => dist_default.parse(firstLine.value));
2233
+ if (parseErr) {
2234
+ throw new Error(`.dt schema line is not valid JSON5: ${parseErr.message}`);
2235
+ }
2236
+ this.#schema = assertDtSchema(parsed);
2237
+ this.#lineReader = this.#createRowIterator(lines);
2238
+ }
2239
+ /**
2240
+ * Async generator yielding parsed row value arrays.
2241
+ *
2242
+ * Each yield is a `DtValue[]` in column order matching the schema.
2243
+ *
2244
+ * @example
2245
+ * ```typescript
2246
+ * for await (const values of reader.rows()) {
2247
+ * console.log(values); // [1, "alice@example.com", true, "2024-01-15T10:30:00Z"]
2248
+ * }
2249
+ * ```
2250
+ */
2251
+ async *rows() {
2252
+ if (!this.#lineReader) {
2253
+ throw new Error("Reader not opened \u2014 call open() first");
2254
+ }
2255
+ yield* this.#lineReader;
2256
+ }
2257
+ /**
2258
+ * Close the reader and release resources.
2259
+ */
2260
+ close() {
2261
+ if (this.#inputStream) {
2262
+ this.#inputStream.destroy();
2263
+ this.#inputStream = null;
2264
+ }
2265
+ }
2266
+ /**
2267
+ * Create the readable stream based on file extension.
2268
+ */
2269
+ #createReadableStream() {
2270
+ if (this.#extension === DT_EXTENSIONS.ENCRYPTED) {
2271
+ if (!this.#passphrase) {
2272
+ throw new Error("Passphrase required for .dtzx files");
2273
+ }
2274
+ const encrypted = readFileSync(this.#filepath, "utf8");
2275
+ const payload = JSON.parse(encrypted);
2276
+ const compressed = decryptWithPassphrase(payload, this.#passphrase);
2277
+ const [raw, gunzipErr] = attemptSync(
2278
+ () => gunzipSync(compressed, { maxOutputLength: MAX_DECOMPRESSED_ARCHIVE_BYTES })
2279
+ );
2280
+ if (gunzipErr || !raw) {
2281
+ throw new Error(
2282
+ `.dtzx archive exceeds the ${MAX_DECOMPRESSED_ARCHIVE_BYTES} byte decompression limit or is not valid gzip: ${gunzipErr?.message ?? "unknown error"}`
2283
+ );
2284
+ }
2285
+ const stream = new PassThrough();
2286
+ stream.end(raw);
2287
+ return guardRows(stream);
2288
+ }
2289
+ if (this.#extension === DT_EXTENSIONS.COMPRESSED) {
2290
+ const fileStream = createReadStream(this.#filepath);
2291
+ const gunzip = createGunzip();
2292
+ fileStream.on("error", (err) => gunzip.destroy(err));
2293
+ fileStream.pipe(gunzip);
2294
+ return guardRows(gunzip, fileStream);
2295
+ }
2296
+ return guardRows(createReadStream(this.#filepath));
2297
+ }
2298
+ /**
2299
+ * Create async generator from remaining readline lines.
2300
+ */
2301
+ async *#createRowIterator(lines) {
2302
+ const expected = this.#schema.columns.length;
2303
+ let rowNumber = 0;
2304
+ for await (const line of { [Symbol.asyncIterator]: () => lines }) {
2305
+ const trimmed = line.trim();
2306
+ if (trimmed.length === 0) continue;
2307
+ rowNumber++;
2308
+ const [values, parseErr] = attemptSync(() => dist_default.parse(trimmed));
2309
+ if (parseErr) {
2310
+ throw new Error(`.dt row ${rowNumber} is not valid JSON5: ${parseErr.message}`);
2311
+ }
2312
+ if (!Array.isArray(values)) {
2313
+ throw new Error(`.dt row ${rowNumber} is not an array of values`);
2314
+ }
2315
+ if (values.length !== expected) {
2316
+ throw new Error(
2317
+ `.dt row ${rowNumber} has ${values.length} values but the schema declares ${expected} columns`
2318
+ );
2319
+ }
2320
+ yield values;
2321
+ }
2322
+ }
2323
+ };
2324
+
2325
+ // src/core/template/loaders/dt.ts
2326
+ async function loadDt(filepath) {
2327
+ const reader = new DtReader({ filepath });
2328
+ await reader.open();
2329
+ const schema = reader.schema;
2330
+ if (!schema) {
2331
+ throw new Error(`Failed to read .dt schema from: ${filepath}`);
2332
+ }
2333
+ const columnNames = schema.columns.map((c) => c.name);
2334
+ const rows = [];
2335
+ for await (const values of reader.rows()) {
2336
+ const row = {};
2337
+ for (let i = 0; i < columnNames.length; i++) {
2338
+ row[columnNames[i]] = values[i] ?? null;
2339
+ }
2340
+ rows.push(row);
2341
+ }
2342
+ reader.close();
2343
+ return rows;
2344
+ }
2345
+
2346
+ // src/core/template/loaders/index.ts
2347
+ async function lazyLoadJson5(filepath) {
2348
+ const { loadJson5: loadJson52 } = await import('./json5-LNT3RGJ7.js');
2349
+ return loadJson52(filepath);
2350
+ }
2351
+ async function lazyLoadYaml(filepath) {
2352
+ const { loadYaml: loadYaml2 } = await import('./yaml-XI7RQ2D5.js');
2353
+ return loadYaml2(filepath);
2354
+ }
2355
+ async function lazyLoadCsv(filepath) {
2356
+ const { loadCsv: loadCsv2 } = await import('./csv-T5P3IN4K.js');
2357
+ return loadCsv2(filepath);
2358
+ }
2359
+ var loaders = {
2360
+ ".json": lazyLoadJson5,
2361
+ ".json5": lazyLoadJson5,
2362
+ ".yaml": lazyLoadYaml,
2363
+ ".yml": lazyLoadYaml,
2364
+ ".csv": lazyLoadCsv,
2365
+ ".js": loadJs,
2366
+ ".mjs": loadJs,
2367
+ ".ts": loadJs,
2368
+ ".sql": loadSql,
2369
+ ".dt": loadDt,
2370
+ ".dtz": loadDt
2371
+ // NO .dtzx — can't provide passphrase in template context
2372
+ };
2373
+ var EXECUTABLE_EXTENSIONS = /* @__PURE__ */ new Set([".js", ".mjs", ".ts"]);
2374
+ function hasLoader(ext) {
2375
+ return ext in loaders;
2376
+ }
2377
+ function isExecutableExtension(ext) {
2378
+ return EXECUTABLE_EXTENSIONS.has(ext);
2379
+ }
2380
+ function getLoader(ext) {
2381
+ return loaders[ext];
2382
+ }
2383
+ async function loadDataFile(filepath) {
2384
+ const ext = path__default.extname(filepath).toLowerCase();
2385
+ const loader = getLoader(ext);
2386
+ if (!loader) {
2387
+ throw new Error(`No loader registered for extension: ${ext}`);
2388
+ }
2389
+ return loader(filepath);
2390
+ }
2391
+
2392
+ // src/core/template/context.ts
2393
+ var SECRET_TIERS_SEARCHED = ["config-local", "global-local", "vault"];
2394
+ var MissingSecretError = class extends Error {
2395
+ constructor(key, tiersSearched = SECRET_TIERS_SEARCHED) {
2396
+ super(`Secret "${key}" not found (searched: ${tiersSearched.join(", ")})`);
2397
+ this.key = key;
2398
+ this.tiersSearched = tiersSearched;
2399
+ }
2400
+ name = "MissingSecretError";
2401
+ };
2402
+ function createSecretsProxy(secrets) {
2403
+ return new Proxy(secrets, {
2404
+ get(target, prop, receiver) {
2405
+ if (typeof prop === "symbol" || prop === "toJSON" || prop in target) {
2406
+ return Reflect.get(target, prop, receiver);
2407
+ }
2408
+ throw new MissingSecretError(prop);
2409
+ },
2410
+ has(target, prop) {
2411
+ return Reflect.has(target, prop);
2412
+ }
2413
+ });
2414
+ }
2415
+ async function buildContext(templatePath, options = {}) {
2416
+ const templateDir = path__default.dirname(templatePath);
2417
+ const projectRoot = options.projectRoot ?? process.cwd();
2418
+ const [templateSource] = await attempt(() => readFile$1(templatePath, "utf-8"));
2419
+ const { helpers } = await loadHelpers(templateDir, projectRoot);
2420
+ const dataFiles = await loadDataFilesInDir(templateDir, templateSource ?? "");
2421
+ const hasLocalConfig = "config" in dataFiles;
2422
+ const ctx = {
2423
+ // Inherited helpers (can be overridden by data files with same name)
2424
+ ...helpers,
2425
+ // Auto-loaded data files
2426
+ ...dataFiles,
2427
+ // Config (only if no local config.* file)
2428
+ ...hasLocalConfig ? {} : { config: options.config },
2429
+ // Secrets
2430
+ secrets: createSecretsProxy(options.secrets ?? {}),
2431
+ globalSecrets: options.globalSecrets ?? {},
2432
+ // Environment
2433
+ env: process.env,
2434
+ // Built-in helpers
2435
+ include: createIncludeHelper(templateDir, projectRoot, options),
2436
+ escape: sqlEscape,
2437
+ quote: sqlQuote,
2438
+ json: (value) => JSON.stringify(value),
2439
+ now: isoNow,
2440
+ uuid: generateUuid
2441
+ };
2442
+ return ctx;
2443
+ }
2444
+ function referencesContextKey(templateSource, key) {
2445
+ const escaped = key.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
2446
+ const pattern = new RegExp(
2447
+ `\\$\\s*(?:\\.\\s*${escaped}\\b|\\[\\s*(['"\`])${escaped}\\1\\s*\\])`
2448
+ );
2449
+ return pattern.test(templateSource);
2450
+ }
2451
+ async function loadDataFilesInDir(dir, templateSource) {
2452
+ const data = {};
2453
+ const [entries, readErr] = await attempt(() => readdir(dir, { withFileTypes: true }));
2454
+ if (readErr || !entries) {
2455
+ observer.emit("error", {
2456
+ source: "template",
2457
+ error: readErr ?? new Error("Failed to read directory"),
2458
+ context: { dir, operation: "scan-data-files" }
2459
+ });
2460
+ return data;
2461
+ }
2462
+ for (const entry of entries) {
2463
+ if (!entry.isFile()) {
2464
+ continue;
2465
+ }
2466
+ if (entry.name.startsWith(".") || entry.name.startsWith(HELPER_FILENAME)) {
2467
+ continue;
2468
+ }
2469
+ if (entry.name.endsWith(".tmpl")) {
2470
+ continue;
2471
+ }
2472
+ const ext = path__default.extname(entry.name).toLowerCase();
2473
+ if (!hasLoader(ext)) {
2474
+ continue;
2475
+ }
2476
+ if (ext === ".sql") {
2477
+ continue;
2478
+ }
2479
+ const filepath = path__default.join(dir, entry.name);
2480
+ const key = toContextKey(entry.name);
2481
+ if (isExecutableExtension(ext) && !referencesContextKey(templateSource, key)) {
2482
+ continue;
2483
+ }
2484
+ const [loaded, loadErr] = await attempt(() => loadDataFile(filepath));
2485
+ if (loadErr) {
2486
+ observer.emit("error", {
2487
+ source: "template",
2488
+ error: loadErr,
2489
+ context: { filepath, operation: "load-data-file" }
2490
+ });
2491
+ continue;
2492
+ }
2493
+ data[key] = loaded;
2494
+ observer.emit("template:load", {
2495
+ filepath,
2496
+ format: ext
2497
+ });
2498
+ }
2499
+ return data;
2500
+ }
2501
+ function createIncludeHelper(templateDir, projectRoot, options) {
2502
+ return async (includePath) => {
2503
+ const resolved = path__default.resolve(templateDir, includePath);
2504
+ if (!isWithinRoot(resolved, path__default.resolve(projectRoot))) {
2505
+ throw new Error(`Include path escapes project root: ${includePath}`);
2506
+ }
2507
+ if (resolved.endsWith(".tmpl")) {
2508
+ const { processFile: processFile2 } = await import('./engine-S4DX3V33.js');
2509
+ const result = await processFile2(resolved, options);
2510
+ return result.sql;
2511
+ }
2512
+ const [content, err] = await attempt(() => loadDataFile(resolved));
2513
+ if (err) {
2514
+ throw new Error(`Failed to include '${includePath}': ${err.message}`);
2515
+ }
2516
+ if (typeof content === "string") {
2517
+ return content;
2518
+ }
2519
+ return JSON.stringify(content);
2520
+ };
2521
+ }
2522
+
2523
+ // src/core/template/engine.ts
2524
+ var DIRECTIVE_LINE_RE = /^[ \t]*-- (\{%.*?%\})[ \t]*$(?:\r?\n)?/gm;
2525
+ var eta = new Eta({
2526
+ // Custom tags for code blocks
2527
+ tags: ["{%", "%}"],
2528
+ // Variable name for context ($ instead of it)
2529
+ varName: "$",
2530
+ // Don't auto-escape (SQL doesn't need HTML escaping)
2531
+ autoEscape: false,
2532
+ // Disabled — directive-line stripping handles whitespace instead
2533
+ autoTrim: [false, false],
2534
+ // Allow async functions in templates
2535
+ useWith: false,
2536
+ // Don't cache templates (we handle caching at a higher level)
2537
+ cache: false
2538
+ });
2539
+ function isTemplate(filepath) {
2540
+ return filepath.endsWith(TEMPLATE_EXTENSION);
2541
+ }
2542
+ async function renderTemplate(template, context) {
2543
+ const prepared = template.replace(DIRECTIVE_LINE_RE, "$1");
2544
+ const result = await eta.renderStringAsync(prepared, context);
2545
+ return result.replace(/^\n+|\n+$/g, "");
2546
+ }
2547
+ async function processFile(filepath, options = {}) {
2548
+ const content = await readFile$1(filepath, "utf-8");
2549
+ if (!isTemplate(filepath)) {
2550
+ return {
2551
+ sql: content,
2552
+ isTemplate: false
2553
+ };
2554
+ }
2555
+ const start = performance.now();
2556
+ const context = await buildContext(filepath, options);
2557
+ const sql = await renderTemplate(content, context);
2558
+ const durationMs = performance.now() - start;
2559
+ observer.emit("template:render", {
2560
+ filepath,
2561
+ durationMs
2562
+ });
2563
+ return {
2564
+ sql,
2565
+ isTemplate: true,
2566
+ durationMs
2567
+ };
2568
+ }
2569
+ async function processFiles(filepaths, options = {}) {
2570
+ const results = [];
2571
+ for (const filepath of filepaths) {
2572
+ const result = await processFile(filepath, options);
2573
+ results.push(result);
2574
+ }
2575
+ return results;
2576
+ }
2577
+ /*! Bundled license information:
2578
+
2579
+ voca/es/index.js:
2580
+ (*!
2581
+ * Voca string library 1.4.1
2582
+ * https://vocajs.pages.dev
2583
+ *
2584
+ * Copyright Dmitri Pavlutin and other contributors
2585
+ * Released under the MIT license
2586
+ *)
2587
+ */
2588
+
2589
+ export { DT_EXTENSIONS, DtReader, ENCODED_TYPES, FORMAT_VERSION, encryptWithPassphrase, es_default, eta, isTemplate, processFile, processFiles, renderTemplate };
2590
+ //# sourceMappingURL=chunk-DSXHOXDE.js.map
2591
+ //# sourceMappingURL=chunk-DSXHOXDE.js.map