@shad0wz7/nestjs-pdf 2.4.3 → 2.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,3840 @@
1
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
+ //#region \0rolldown/runtime.js
3
+ var __create = Object.create;
4
+ var __defProp = Object.defineProperty;
5
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
6
+ var __getOwnPropNames = Object.getOwnPropertyNames;
7
+ var __getProtoOf = Object.getPrototypeOf;
8
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
9
+ var __commonJSMin = (cb, mod) => () => (mod || (cb((mod = { exports: {} }).exports, mod), cb = null), mod.exports);
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
12
+ key = keys[i];
13
+ if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
14
+ get: ((k) => from[k]).bind(null, key),
15
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
16
+ });
17
+ }
18
+ return to;
19
+ };
20
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(isNodeMode || !mod || !mod.__esModule || !__hasOwnProp.call(mod, "default") ? __defProp(target, "default", {
21
+ value: mod,
22
+ enumerable: true
23
+ }) : target, mod));
24
+ //#endregion
25
+ let _nestjs_common = require("@nestjs/common");
26
+ let node_fs = require("node:fs");
27
+ let node_path = require("node:path");
28
+ let puppeteer = require("puppeteer");
29
+ let _puppeteer_browsers = require("@puppeteer/browsers");
30
+ let deepmerge_ts = require("deepmerge-ts");
31
+ let p_limit = require("p-limit");
32
+ p_limit = __toESM(p_limit);
33
+ let _gboutte_nestjs_hbs = require("@gboutte/nestjs-hbs");
34
+ let mjml = require("mjml");
35
+ mjml = __toESM(mjml);
36
+ let pug = require("pug");
37
+ let ejs = require("ejs");
38
+ let nunjucks = require("nunjucks");
39
+ let eta = require("eta");
40
+ let mustache = require("mustache");
41
+ mustache = __toESM(mustache);
42
+ let pdf_lib = require("pdf-lib");
43
+ //#region src/helpers/tokens.ts
44
+ const PDF_PARAMETERS = "PDF_PARAMETERS";
45
+ const HANDLEBARS_PARAMETERS = "HANDLEBARS_PARAMETERS";
46
+ //#endregion
47
+ //#region \0@oxc-project+runtime@0.142.0/helpers/esm/decorateMetadata.js
48
+ function __decorateMetadata(k, v) {
49
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
50
+ }
51
+ //#endregion
52
+ //#region \0@oxc-project+runtime@0.142.0/helpers/esm/decorateParam.js
53
+ function __decorateParam(paramIndex, decorator) {
54
+ return function(target, key) {
55
+ decorator(target, key, paramIndex);
56
+ };
57
+ }
58
+ //#endregion
59
+ //#region \0@oxc-project+runtime@0.142.0/helpers/esm/decorate.js
60
+ function __decorate(decorators, target, key, desc) {
61
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
62
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
63
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
64
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
65
+ }
66
+ //#endregion
67
+ //#region src/puppeteer/browser/browser.service.ts
68
+ async function sleep(ms) {
69
+ await new Promise((r) => setTimeout(r, ms));
70
+ }
71
+ async function rmWithRetries(dir, retries = 5) {
72
+ for (let attempt = 1; attempt <= retries; attempt++) try {
73
+ await node_fs.promises.rm(dir, {
74
+ recursive: true,
75
+ force: true
76
+ });
77
+ return;
78
+ } catch (err) {
79
+ const code = err?.code;
80
+ if (!(code === "EPERM" || code === "EBUSY" || code === "ENOTEMPTY") || attempt === retries) throw err;
81
+ await sleep(50 * 2 ** (attempt - 1));
82
+ }
83
+ }
84
+ function isTargetClosedError(error) {
85
+ if (!(error instanceof Error)) return false;
86
+ return error.name === "TargetCloseError" || error.message.includes("Target closed") || error.message.includes("Target.createTarget");
87
+ }
88
+ let BrowserService = class BrowserService {
89
+ cacheDir;
90
+ options;
91
+ _browserInstance = null;
92
+ browser;
93
+ activeJobs = 0;
94
+ totalJobs = 0;
95
+ recycleRequested = false;
96
+ recycling = false;
97
+ browserTag;
98
+ useLockedBrowser;
99
+ buildId;
100
+ constructor(pdfParams) {
101
+ this.cacheDir = (0, node_path.resolve)(".cache/puppeteer-browser");
102
+ this.options = pdfParams;
103
+ if (pdfParams.cleanupBrowserCacheOnExit) this.registerCleanupHooks();
104
+ this.loadBuildId();
105
+ this.loadBrowser();
106
+ this.loadBrowserTag();
107
+ this.loadUseLockedBrowser();
108
+ }
109
+ async onModuleDestroy() {
110
+ if (this._browserInstance?.connected) try {
111
+ await this._browserInstance.close();
112
+ } catch (error) {
113
+ _nestjs_common.Logger.warn(`Failed to close browser on module destroy: ${error instanceof Error ? error.message : String(error)}`);
114
+ }
115
+ await this.cleanupCacheBestEffort();
116
+ }
117
+ async getBrowserInstance(args, headless, executablePathBin) {
118
+ if (!this._browserInstance?.connected) this._browserInstance = await this.launchBrowser(args, headless, executablePathBin);
119
+ return this._browserInstance;
120
+ }
121
+ async createContext(args, headless, executablePath) {
122
+ const browser = await this.getBrowserInstance(args, headless, executablePath);
123
+ try {
124
+ return await browser.createBrowserContext();
125
+ } catch (error) {
126
+ if (!isTargetClosedError(error)) throw error;
127
+ _nestjs_common.Logger.warn("Puppeteer browser closed while creating a context, retrying once");
128
+ this._browserInstance = null;
129
+ return await (await this.getBrowserInstance(args, headless, executablePath)).createBrowserContext();
130
+ }
131
+ }
132
+ markJobStarted() {
133
+ this.activeJobs += 1;
134
+ this.totalJobs += 1;
135
+ if (this.totalJobs >= 200) this.recycleRequested = true;
136
+ }
137
+ async markJobFinished() {
138
+ this.activeJobs = Math.max(0, this.activeJobs - 1);
139
+ await this.recycleBrowserIfNeeded();
140
+ }
141
+ async recycleBrowserIfNeeded() {
142
+ if (!this.recycleRequested) return;
143
+ if (this.recycling) return;
144
+ if (this.activeJobs > 0) return;
145
+ if (!this._browserInstance) return;
146
+ this.recycling = true;
147
+ try {
148
+ if (this._browserInstance.connected) await this._browserInstance.close();
149
+ this._browserInstance = null;
150
+ this.totalJobs = 0;
151
+ this.recycleRequested = false;
152
+ _nestjs_common.Logger.log("Puppeteer browser recycled successfully");
153
+ } catch (error) {
154
+ _nestjs_common.Logger.warn(`Failed to recycle browser: ${error instanceof Error ? error.message : String(error)}`);
155
+ } finally {
156
+ this.recycling = false;
157
+ }
158
+ }
159
+ async cleanupCacheBestEffort() {
160
+ const logger = new _nestjs_common.Logger("NestJsPdf");
161
+ const dir = this.cacheDir;
162
+ try {
163
+ if (!(0, node_fs.existsSync)(dir)) return;
164
+ logger.log(`Cleanup puppeteer cache on signal: ${dir}`);
165
+ await rmWithRetries(dir, 6);
166
+ if ((0, node_fs.existsSync)(dir)) {
167
+ await sleep(100);
168
+ await rmWithRetries(dir, 3);
169
+ }
170
+ logger.log("Cleanup done");
171
+ } catch (err) {
172
+ logger.error(`Cleanup failed for ${dir}`, err instanceof Error ? err.stack : String(err));
173
+ }
174
+ try {
175
+ const leftover = await node_fs.promises.readdir(dir, { recursive: true });
176
+ logger.warn(`Leftover files: ${leftover.slice(0, 20).join(", ")}...`);
177
+ } catch {
178
+ logger.log(`No leftover files in ${dir}`);
179
+ }
180
+ }
181
+ async install(lock = false) {
182
+ const browser = this.browser;
183
+ const versionTag = this.browserTag;
184
+ const browserPlatform = (0, _puppeteer_browsers.detectBrowserPlatform)() ?? _puppeteer_browsers.BrowserPlatform.LINUX;
185
+ let buildId;
186
+ if (this.buildId === void 0) buildId = await (0, _puppeteer_browsers.resolveBuildId)(browser, browserPlatform, versionTag);
187
+ else buildId = this.buildId;
188
+ _nestjs_common.Logger.log(`Browser ${browser} ${versionTag} build id: ${buildId}`, "NestJsPdf");
189
+ if (await this.hasBrowserInstalled(browser, buildId)) {
190
+ _nestjs_common.Logger.log("Browser already installed", "NestJsPdf");
191
+ if (lock) this.writeLockFile(browser, buildId);
192
+ return;
193
+ } else {
194
+ _nestjs_common.Logger.log("Starting browser installation", "NestJsPdf");
195
+ const installOption = {
196
+ cacheDir: this.cacheDir,
197
+ browser,
198
+ buildId,
199
+ baseUrl: this.options?.browserInstallBaseUrl ?? void 0
200
+ };
201
+ if (await (0, _puppeteer_browsers.canDownload)(installOption)) {
202
+ _nestjs_common.Logger.log(`Installing ${installOption.browser} ${installOption.buildId}`, "NestJsPdf");
203
+ const installedBrowser = await (0, _puppeteer_browsers.install)(installOption);
204
+ if (await this.hasBrowserInstalled(browser, buildId)) {
205
+ _nestjs_common.Logger.log("Browser installed successfully", "NestJsPdf");
206
+ if (lock) this.writeLockFile(browser, buildId);
207
+ return installedBrowser;
208
+ } else _nestjs_common.Logger.error("Browser installation failed", "NestJsPdf");
209
+ } else _nestjs_common.Logger.error(`Error, can't install ${installOption.browser} ${installOption.buildId}`, "NestJsPdf");
210
+ }
211
+ return null;
212
+ }
213
+ registerCleanupHooks() {
214
+ const cleanup = async (signal) => {
215
+ try {
216
+ _nestjs_common.Logger.log(`Received ${signal}, cleaning up puppeteer cache...`, "NestJsPdf");
217
+ await this.cleanupCacheBestEffort();
218
+ process.exit(0);
219
+ } catch {
220
+ process.exit(1);
221
+ }
222
+ };
223
+ const cleanupHandler = (signal) => {
224
+ cleanup(signal);
225
+ };
226
+ process.once("SIGTERM", cleanupHandler);
227
+ process.once("SIGINT", cleanupHandler);
228
+ process.once("exit", cleanupHandler);
229
+ }
230
+ loadBrowser() {
231
+ let browser;
232
+ if (this.options?.browser === void 0) browser = _puppeteer_browsers.Browser.CHROMIUM;
233
+ else browser = this.options.browser;
234
+ this.browser = browser;
235
+ }
236
+ setBrowser(browser) {
237
+ this.browser = browser;
238
+ }
239
+ getBrowser() {
240
+ return this.browser;
241
+ }
242
+ loadBrowserTag() {
243
+ let versionTag;
244
+ if (this.options?.browserTag === void 0) if (this.browser === _puppeteer_browsers.Browser.CHROMIUM) versionTag = "latest";
245
+ else versionTag = "stable";
246
+ else versionTag = this.options.browserTag;
247
+ this.browserTag = versionTag;
248
+ }
249
+ loadBuildId() {
250
+ let buildId;
251
+ if (this.options?.buildId === void 0) buildId = void 0;
252
+ else buildId = this.options.buildId;
253
+ this.buildId = buildId;
254
+ }
255
+ setBrowserTag(browserTag) {
256
+ this.browserTag = browserTag;
257
+ }
258
+ getBrowserTag() {
259
+ return this.browserTag;
260
+ }
261
+ getBuildId() {
262
+ return this.buildId;
263
+ }
264
+ setBuildId(value) {
265
+ this.buildId = value;
266
+ }
267
+ loadUseLockedBrowser() {
268
+ let useLockedBrowser;
269
+ if (this.options?.useLockedBrowser === void 0) useLockedBrowser = false;
270
+ else useLockedBrowser = this.options.useLockedBrowser;
271
+ this.useLockedBrowser = useLockedBrowser;
272
+ }
273
+ async hasBrowserInstalled(browser, buildId) {
274
+ return (await (0, _puppeteer_browsers.getInstalledBrowsers)({ cacheDir: this.cacheDir })).find((installedBrowser) => {
275
+ return installedBrowser.browser === browser && installedBrowser.buildId === buildId;
276
+ }) !== void 0;
277
+ }
278
+ async getExecutablePath() {
279
+ const browser = this.browser;
280
+ const versionTag = this.browserTag;
281
+ const browserPlatform = (0, _puppeteer_browsers.detectBrowserPlatform)() ?? _puppeteer_browsers.BrowserPlatform.LINUX;
282
+ let buildId = null;
283
+ if (this.useLockedBrowser) {
284
+ buildId = this.getLockedBuildId(browser);
285
+ _nestjs_common.Logger.log(`Using locked browser ${buildId}`, "NestJsPdf");
286
+ }
287
+ buildId ??= await (0, _puppeteer_browsers.resolveBuildId)(browser, browserPlatform, versionTag);
288
+ const installedBrowser = (await (0, _puppeteer_browsers.getInstalledBrowsers)({ cacheDir: this.cacheDir })).find((installedBrowser) => {
289
+ return installedBrowser.browser === browser && installedBrowser.buildId === buildId;
290
+ });
291
+ if (installedBrowser === void 0) {
292
+ const newinstalledBrowser = await this.install();
293
+ if (newinstalledBrowser === null || newinstalledBrowser === void 0) throw new Error("Could not install browser");
294
+ else return newinstalledBrowser.executablePath;
295
+ }
296
+ return installedBrowser.executablePath;
297
+ }
298
+ async launchBrowser(args, headless, executablePathBin) {
299
+ const executablePath = executablePathBin ?? await this.getExecutablePath();
300
+ const browser = await (0, puppeteer.launch)({
301
+ executablePath,
302
+ headless,
303
+ args
304
+ });
305
+ browser.on("disconnected", () => {
306
+ _nestjs_common.Logger.warn("Puppeteer browser disconnected");
307
+ if (this._browserInstance === browser) this._browserInstance = null;
308
+ });
309
+ return browser;
310
+ }
311
+ writeLockFile(browser, buildId) {
312
+ const lockFile = (0, node_path.resolve)(this.cacheDir, `${browser}.lock`);
313
+ const data = JSON.stringify({
314
+ browser,
315
+ buildId,
316
+ date: (/* @__PURE__ */ new Date()).toISOString()
317
+ });
318
+ (0, node_fs.writeFileSync)(lockFile, data);
319
+ _nestjs_common.Logger.log(`Browser ${browser} locked to build ${buildId}`, "NestJsPdf");
320
+ }
321
+ getLockedBuildId(browser) {
322
+ const lockFile = (0, node_path.resolve)(this.cacheDir, `${browser}.lock`);
323
+ if ((0, node_fs.existsSync)(lockFile)) {
324
+ const data = (0, node_fs.readFileSync)(lockFile);
325
+ return JSON.parse(data.toString()).buildId;
326
+ }
327
+ return null;
328
+ }
329
+ };
330
+ BrowserService = __decorate([
331
+ (0, _nestjs_common.Injectable)(),
332
+ __decorateParam(0, (0, _nestjs_common.Inject)("PDF_PARAMETERS")),
333
+ __decorateMetadata("design:paramtypes", [Object])
334
+ ], BrowserService);
335
+ //#endregion
336
+ //#region src/helpers/deepMergePdfparams.ts
337
+ function mergePuppeteerParameters(defaults, overrides) {
338
+ if (!overrides) return { ...defaults };
339
+ return (0, deepmerge_ts.deepmerge)(defaults, overrides);
340
+ }
341
+ //#endregion
342
+ //#region src/puppeteer/engines/mjml/mjml.service.ts
343
+ let MjmlService = class MjmlService {
344
+ async render(template, options) {
345
+ const { html } = await (0, mjml.default)(template, options);
346
+ return html;
347
+ }
348
+ async renderFile(filePath, options) {
349
+ const template = (0, node_fs.readFileSync)(filePath, "utf-8");
350
+ return await this.render(template, options);
351
+ }
352
+ };
353
+ MjmlService = __decorate([(0, _nestjs_common.Injectable)()], MjmlService);
354
+ //#endregion
355
+ //#region src/puppeteer/engines/pug/pug.service.ts
356
+ let PugService = class PugService {
357
+ render(template, data = {}, options) {
358
+ try {
359
+ return (0, pug.compile)(template, { ...options })(data);
360
+ } catch (error) {
361
+ throw new Error(`Pug rendering failed: ${String(error)}`, { cause: error });
362
+ }
363
+ }
364
+ renderFile(filePath, data = {}, options) {
365
+ try {
366
+ const template = (0, node_fs.readFileSync)(filePath, "utf-8");
367
+ return this.render(template, data, options);
368
+ } catch (error) {
369
+ throw new Error(`Pug file rendering failed: ${String(error)}`, { cause: error });
370
+ }
371
+ }
372
+ };
373
+ PugService = __decorate([(0, _nestjs_common.Injectable)()], PugService);
374
+ //#endregion
375
+ //#region src/puppeteer/engines/ejs/ejs.service.ts
376
+ let EjsService = class EjsService {
377
+ async render(template, data = {}, options) {
378
+ try {
379
+ return await (0, ejs.render)(template, data, {
380
+ async: true,
381
+ ...options
382
+ });
383
+ } catch (error) {
384
+ throw new Error(`EJS rendering failed: ${String(error)}`, { cause: error });
385
+ }
386
+ }
387
+ async renderFile(filePath, data = {}, options) {
388
+ try {
389
+ return await (0, ejs.renderFile)(filePath, data, {
390
+ async: true,
391
+ ...options
392
+ });
393
+ } catch (error) {
394
+ throw new Error(`EJS file rendering failed: ${String(error)}`, { cause: error });
395
+ }
396
+ }
397
+ };
398
+ EjsService = __decorate([(0, _nestjs_common.Injectable)()], EjsService);
399
+ //#endregion
400
+ //#region src/puppeteer/engines/nunjucks/nunjucks.service.ts
401
+ let NunjucksService = class NunjucksService {
402
+ constructor() {
403
+ (0, nunjucks.configure)({
404
+ noCache: true,
405
+ trimBlocks: true,
406
+ lstripBlocks: true
407
+ });
408
+ }
409
+ render(template, data = {}, options) {
410
+ try {
411
+ if (options) {
412
+ const configOptions = {
413
+ noCache: options.noCache ?? true,
414
+ watch: options.watch ?? false,
415
+ throwOnUndefined: options.throwOnUndefined ?? false,
416
+ trimBlocks: options.trimBlocks ?? true,
417
+ lstripBlocks: options.lstripBlocks ?? true
418
+ };
419
+ (0, nunjucks.configure)(configOptions);
420
+ }
421
+ return (0, nunjucks.renderString)(template, data);
422
+ } catch (error) {
423
+ throw new Error(`Nunjucks rendering failed: ${String(error)}`, { cause: error });
424
+ }
425
+ }
426
+ renderFile(filePath, data = {}, options) {
427
+ try {
428
+ if (options) {
429
+ const configOptions = {
430
+ noCache: options.noCache ?? true,
431
+ watch: options.watch ?? false,
432
+ throwOnUndefined: options.throwOnUndefined ?? false,
433
+ trimBlocks: options.trimBlocks ?? true,
434
+ lstripBlocks: options.lstripBlocks ?? true
435
+ };
436
+ (0, nunjucks.configure)(configOptions);
437
+ }
438
+ return (0, nunjucks.render)(filePath, data);
439
+ } catch (error) {
440
+ throw new Error(`Nunjucks file rendering failed: ${String(error)}`, { cause: error });
441
+ }
442
+ }
443
+ };
444
+ NunjucksService = __decorate([(0, _nestjs_common.Injectable)(), __decorateMetadata("design:paramtypes", [])], NunjucksService);
445
+ //#endregion
446
+ //#region src/puppeteer/engines/eta/eta.service.ts
447
+ let EtaService = class EtaService {
448
+ eta;
449
+ templateCache = /* @__PURE__ */ new Map();
450
+ maxCacheSize = 100;
451
+ constructor() {
452
+ this.eta = new eta.Eta({
453
+ cache: true,
454
+ autoEscape: true,
455
+ useWith: true
456
+ });
457
+ }
458
+ /**
459
+ * Render an Eta template from a string
460
+ * @param template The template string to render
461
+ * @param data The data object to use for rendering
462
+ * @param options Optional Eta rendering options
463
+ * @returns The rendered HTML string
464
+ */
465
+ render(template, data = {}, options) {
466
+ try {
467
+ return (options && Object.keys(options).length > 0 ? new eta.Eta({
468
+ cache: true,
469
+ autoEscape: true,
470
+ useWith: true,
471
+ ...options,
472
+ varName: options.varName ?? "it"
473
+ }) : this.eta).renderString(template, data);
474
+ } catch (error) {
475
+ throw new Error(`Eta rendering failed: ${String(error)}`, { cause: error });
476
+ }
477
+ }
478
+ /**
479
+ * Render an Eta template from a file
480
+ * @param filePath The path to the template file
481
+ * @param data The data object to use for rendering
482
+ * @param options Optional Eta rendering options
483
+ * @returns The rendered HTML string
484
+ */
485
+ renderFile(filePath, data = {}, options) {
486
+ try {
487
+ const resolvedPath = (0, node_path.resolve)(filePath);
488
+ const useCache = options?.cache ?? true;
489
+ let template = useCache ? this.templateCache.get(resolvedPath) : void 0;
490
+ if (!template) {
491
+ template = (0, node_fs.readFileSync)(resolvedPath, "utf-8");
492
+ if (useCache && this.templateCache.size < this.maxCacheSize) this.templateCache.set(resolvedPath, template);
493
+ }
494
+ return this.render(template, data, options);
495
+ } catch (error) {
496
+ throw new Error(`Eta file rendering failed for ${filePath}: ${String(error)}`, { cause: error });
497
+ }
498
+ }
499
+ /**
500
+ * Clear the template cache
501
+ */
502
+ clearCache() {
503
+ this.templateCache.clear();
504
+ }
505
+ /**
506
+ * Get the current cache size
507
+ * @returns The number of cached templates
508
+ */
509
+ getCacheSize() {
510
+ return this.templateCache.size;
511
+ }
512
+ };
513
+ EtaService = __decorate([(0, _nestjs_common.Injectable)(), __decorateMetadata("design:paramtypes", [])], EtaService);
514
+ //#endregion
515
+ //#region src/puppeteer/engines/mustache/mustache.service.ts
516
+ let MustacheService = class MustacheService {
517
+ templateCache = /* @__PURE__ */ new Map();
518
+ maxCacheSize = 100;
519
+ /**
520
+ * Render a Mustache template from a string
521
+ * @param template The template string to render
522
+ * @param data The data object to use for rendering
523
+ * @param options Optional Mustache rendering options
524
+ * @returns The rendered HTML string
525
+ */
526
+ render(template, data = {}, options) {
527
+ try {
528
+ const tags = options?.tags ?? ["{{", "}}"];
529
+ return mustache.default.render(template, data, void 0, {
530
+ tags,
531
+ escape: options?.escape
532
+ });
533
+ } catch (error) {
534
+ throw new Error(`Mustache rendering failed: ${String(error)}`, { cause: error });
535
+ }
536
+ }
537
+ /**
538
+ * Render a Mustache template from a file
539
+ * @param filePath The path to the template file
540
+ * @param data The data object to use for rendering
541
+ * @param options Optional Mustache rendering options
542
+ * @returns The rendered HTML string
543
+ */
544
+ renderFile(filePath, data = {}, options) {
545
+ try {
546
+ const resolvedPath = (0, node_path.resolve)(filePath);
547
+ let template = this.templateCache.get(resolvedPath);
548
+ if (!template) {
549
+ template = (0, node_fs.readFileSync)(resolvedPath, "utf-8");
550
+ if (this.templateCache.size < this.maxCacheSize) this.templateCache.set(resolvedPath, template);
551
+ }
552
+ return this.render(template, data, options);
553
+ } catch (error) {
554
+ throw new Error(`Mustache file rendering failed for ${filePath}: ${String(error)}`, { cause: error });
555
+ }
556
+ }
557
+ /**
558
+ * Clear the template cache
559
+ */
560
+ clearCache() {
561
+ this.templateCache.clear();
562
+ }
563
+ /**
564
+ * Get the current cache size
565
+ * @returns The number of cached templates
566
+ */
567
+ getCacheSize() {
568
+ return this.templateCache.size;
569
+ }
570
+ };
571
+ MustacheService = __decorate([(0, _nestjs_common.Injectable)()], MustacheService);
572
+ //#endregion
573
+ //#region src/puppeteer/libs/requireService.utils.ts
574
+ function requireService(service, name) {
575
+ if (!service) throw new Error(`${name} service is not available. If the problem persists, open an issue in the repo.`);
576
+ return service;
577
+ }
578
+ //#endregion
579
+ //#region src/puppeteer/puppeteer.service.ts
580
+ let PuppeteerService = class PuppeteerService {
581
+ browserService;
582
+ options;
583
+ hbsService;
584
+ mjmlService;
585
+ pugService;
586
+ ejsService;
587
+ nunjucksService;
588
+ etaService;
589
+ mustacheService;
590
+ constructor(browserService, options, hbsService, mjmlService, pugService, ejsService, nunjucksService, etaService, mustacheService) {
591
+ this.browserService = browserService;
592
+ this.options = options;
593
+ this.hbsService = hbsService;
594
+ this.mjmlService = mjmlService;
595
+ this.pugService = pugService;
596
+ this.ejsService = ejsService;
597
+ this.nunjucksService = nunjucksService;
598
+ this.etaService = etaService;
599
+ this.mustacheService = mustacheService;
600
+ }
601
+ limit = (0, p_limit.default)(3);
602
+ async generatePdfFromHtml(html, options) {
603
+ return this.limit(async () => {
604
+ const mergePuppeteerOptions = mergePuppeteerParameters(this.options, options);
605
+ if (mergePuppeteerOptions.chromiumRevision !== void 0) _nestjs_common.Logger.warn("Using `chromiumRevision` is no longer supported since the puppeteer update.");
606
+ const headless = mergePuppeteerOptions.headless ?? true;
607
+ const executablePath = mergePuppeteerOptions.executablePath || void 0;
608
+ const args = mergePuppeteerOptions.extraPuppeteerArgs || [
609
+ "--autoplay-policy=user-gesture-required",
610
+ "--disable-background-networking",
611
+ "--disable-background-timer-throttling",
612
+ "--disable-backgrounding-occluded-windows",
613
+ "--disable-breakpad",
614
+ "--disable-client-side-phishing-detection",
615
+ "--disable-component-update",
616
+ "--disable-default-apps",
617
+ "--disable-dev-shm-usage",
618
+ "--disable-domain-reliability",
619
+ "--disable-extensions",
620
+ "--disable-features=AudioServiceOutOfProcess",
621
+ "--disable-hang-monitor",
622
+ "--disable-ipc-flooding-protection",
623
+ "--disable-notifications",
624
+ "--disable-offer-store-unmasked-wallet-cards",
625
+ "--disable-popup-blocking",
626
+ "--disable-print-preview",
627
+ "--disable-prompt-on-repost",
628
+ "--disable-renderer-backgrounding",
629
+ "--disable-setuid-sandbox",
630
+ "--disable-speech-api",
631
+ "--disable-sync",
632
+ "--hide-scrollbars",
633
+ "--ignore-gpu-blacklist",
634
+ "--metrics-recording-only",
635
+ "--mute-audio",
636
+ "--no-default-browser-check",
637
+ "--no-first-run",
638
+ "--no-pings",
639
+ "--password-store=basic",
640
+ "--use-gl=swiftshader",
641
+ "--use-mock-keychain",
642
+ "--disable-accelerated-2d-canvas",
643
+ "--no-zygote",
644
+ "--disable-gpu"
645
+ ];
646
+ this.browserService.markJobStarted();
647
+ let context = null;
648
+ try {
649
+ context = await this.browserService.createContext(args, headless, executablePath);
650
+ const page = await context.newPage();
651
+ const pdfOptions = mergePuppeteerOptions.pdfOptions ?? { format: "A4" };
652
+ await page.setContent(html, { waitUntil: "domcontentloaded" });
653
+ await page.emulateMediaType("screen");
654
+ await page.waitForNetworkIdle({
655
+ idleTime: 500,
656
+ timeout: 3e4
657
+ });
658
+ await page.evaluate(() => document.fonts.ready);
659
+ return await page.pdf(pdfOptions);
660
+ } catch (e) {
661
+ _nestjs_common.Logger.error(e);
662
+ throw e;
663
+ } finally {
664
+ if (context) try {
665
+ await context.close();
666
+ } catch (error) {
667
+ _nestjs_common.Logger.error(error);
668
+ }
669
+ await this.browserService.markJobFinished();
670
+ }
671
+ });
672
+ }
673
+ async generatePdfFromTemplateHbsString(template, parameters = {}, options) {
674
+ const html = requireService(this.hbsService, "Handlebars").render(template, parameters);
675
+ return this.generatePdfFromHtml(html, options);
676
+ }
677
+ async generatePdfFromTemplateHbsFile(file, parameters = {}, options) {
678
+ const html = requireService(this.hbsService, "Handlebars").renderFile(file, parameters);
679
+ return this.generatePdfFromHtml(html, options);
680
+ }
681
+ async generatePdfFromMjmlString(template, options) {
682
+ const html = await requireService(this.mjmlService, "MJML").render(template, options?.mjmlOptions ?? this.options.mjmlOptions);
683
+ return this.generatePdfFromHtml(html, options);
684
+ }
685
+ async generatePdfFromMjmlFile(file, options) {
686
+ const html = await requireService(this.mjmlService, "MJML").renderFile(file, options?.mjmlOptions ?? this.options.mjmlOptions);
687
+ return this.generatePdfFromHtml(html, options);
688
+ }
689
+ async generatePdfFromPugString(template, data = {}, options) {
690
+ const html = requireService(this.pugService, "Pug").render(template, data, options?.pugOptions ?? this.options.pugOptions);
691
+ return this.generatePdfFromHtml(html, options);
692
+ }
693
+ async generatePdfFromPugFile(file, data = {}, options) {
694
+ const html = requireService(this.pugService, "Pug").renderFile(file, data, options?.pugOptions ?? this.options.pugOptions);
695
+ return this.generatePdfFromHtml(html, options);
696
+ }
697
+ async generatePdfFromEjsString(template, data = {}, options) {
698
+ const html = await requireService(this.ejsService, "EJS").render(template, data, options?.ejsOptions ?? this.options.ejsOptions);
699
+ return this.generatePdfFromHtml(html, options);
700
+ }
701
+ async generatePdfFromEjsFile(file, data = {}, options) {
702
+ const html = await requireService(this.ejsService, "EJS").renderFile(file, data, options?.ejsOptions ?? this.options.ejsOptions);
703
+ return this.generatePdfFromHtml(html, options);
704
+ }
705
+ async generatePdfFromNunjucksString(template, data = {}, options) {
706
+ const html = requireService(this.nunjucksService, "Nunjucks").render(template, data, options?.nunjucksOptions ?? this.options.nunjucksOptions);
707
+ return this.generatePdfFromHtml(html, options);
708
+ }
709
+ async generatePdfFromNunjucksFile(file, data = {}, options) {
710
+ const html = requireService(this.nunjucksService, "Nunjucks").renderFile(file, data, options?.nunjucksOptions ?? this.options.nunjucksOptions);
711
+ return this.generatePdfFromHtml(html, options);
712
+ }
713
+ async generatePdfFromEtaString(template, data = {}, options) {
714
+ const html = requireService(this.etaService, "Eta").render(template, data, options?.etaOptions ?? this.options.etaOptions);
715
+ return this.generatePdfFromHtml(html, options);
716
+ }
717
+ async generatePdfFromEtaFile(file, data = {}, options) {
718
+ const html = requireService(this.etaService, "Eta").renderFile(file, data, options?.etaOptions ?? this.options.etaOptions);
719
+ return this.generatePdfFromHtml(html, options);
720
+ }
721
+ async generatePdfFromMustacheString(template, data = {}, options) {
722
+ const html = requireService(this.mustacheService, "Mustache").render(template, data, options?.mustacheOptions ?? this.options.mustacheOptions);
723
+ return this.generatePdfFromHtml(html, options);
724
+ }
725
+ async generatePdfFromMustacheFile(file, data = {}, options) {
726
+ const html = requireService(this.mustacheService, "Mustache").renderFile(file, data, options?.mustacheOptions ?? this.options.mustacheOptions);
727
+ return this.generatePdfFromHtml(html, options);
728
+ }
729
+ };
730
+ PuppeteerService = __decorate([
731
+ (0, _nestjs_common.Injectable)(),
732
+ __decorateParam(1, (0, _nestjs_common.Inject)(PDF_PARAMETERS)),
733
+ __decorateParam(2, (0, _nestjs_common.Optional)()),
734
+ __decorateParam(3, (0, _nestjs_common.Optional)()),
735
+ __decorateParam(4, (0, _nestjs_common.Optional)()),
736
+ __decorateParam(5, (0, _nestjs_common.Optional)()),
737
+ __decorateParam(6, (0, _nestjs_common.Optional)()),
738
+ __decorateParam(7, (0, _nestjs_common.Optional)()),
739
+ __decorateParam(8, (0, _nestjs_common.Optional)()),
740
+ __decorateMetadata("design:paramtypes", [
741
+ typeof BrowserService === "undefined" ? Object : BrowserService,
742
+ Object,
743
+ typeof _gboutte_nestjs_hbs.HandlebarsService === "undefined" ? Object : _gboutte_nestjs_hbs.HandlebarsService,
744
+ typeof MjmlService === "undefined" ? Object : MjmlService,
745
+ typeof PugService === "undefined" ? Object : PugService,
746
+ typeof EjsService === "undefined" ? Object : EjsService,
747
+ typeof NunjucksService === "undefined" ? Object : NunjucksService,
748
+ typeof EtaService === "undefined" ? Object : EtaService,
749
+ typeof MustacheService === "undefined" ? Object : MustacheService
750
+ ])
751
+ ], PuppeteerService);
752
+ //#endregion
753
+ //#region src/helpers/signature.helper.ts
754
+ let pdfjsPromise;
755
+ async function loadPdfjs() {
756
+ if (!pdfjsPromise) try {
757
+ pdfjsPromise = await import("pdfjs-dist/legacy/build/pdf.mjs");
758
+ } catch (error) {
759
+ pdfjsPromise = void 0;
760
+ throw new Error([
761
+ "Failed to load pdfjs-dist.",
762
+ "If you use anchor-based signature placement in Node.js, make sure @napi-rs/canvas is installed.",
763
+ "Try: npm install @napi-rs/canvas",
764
+ "",
765
+ `Original error: ${error instanceof Error ? error.message : String(error)}`
766
+ ].join("\n"), { cause: error });
767
+ }
768
+ return pdfjsPromise;
769
+ }
770
+ function toU8(input) {
771
+ return new Uint8Array(input);
772
+ }
773
+ async function findAnchorPosition(pdfBytes, anchorText) {
774
+ const pdfjsLib = await loadPdfjs();
775
+ const loadingTask = pdfjsLib.getDocument({ data: pdfBytes });
776
+ try {
777
+ const pdf = await loadingTask.promise;
778
+ for (let pageNum = 1; pageNum <= pdf.numPages; pageNum++) {
779
+ const page = await pdf.getPage(pageNum);
780
+ const viewport = page.getViewport({ scale: 1 });
781
+ const textContent = await page.getTextContent();
782
+ for (const itemRaw of textContent.items) {
783
+ const item = itemRaw;
784
+ if (!item.str?.includes(anchorText)) continue;
785
+ const [_a, _b, _c, _d, e, f] = pdfjsLib.Util.transform(viewport.transform, item.transform);
786
+ const x = e;
787
+ const y = viewport.height - f;
788
+ return {
789
+ pageIndex: pageNum - 1,
790
+ x,
791
+ y,
792
+ pageWidth: viewport.width,
793
+ pageHeight: viewport.height
794
+ };
795
+ }
796
+ }
797
+ return null;
798
+ } finally {
799
+ await loadingTask.destroy();
800
+ }
801
+ }
802
+ function addSignatureFieldAt(pdfDoc, pageIndex, opts) {
803
+ const { fieldName, x, y, width, height } = opts;
804
+ const context = pdfDoc.context;
805
+ const page = pdfDoc.getPages()[pageIndex];
806
+ if (!page) throw new Error(`Page ${pageIndex} not found`);
807
+ const rectArray = context.obj([
808
+ pdf_lib.PDFNumber.of(x),
809
+ pdf_lib.PDFNumber.of(y),
810
+ pdf_lib.PDFNumber.of(x + width),
811
+ pdf_lib.PDFNumber.of(y + height)
812
+ ]);
813
+ const widgetDict = context.obj({
814
+ Type: pdf_lib.PDFName.of("Annot"),
815
+ Subtype: pdf_lib.PDFName.of("Widget"),
816
+ Rect: rectArray,
817
+ F: pdf_lib.PDFNumber.of(4),
818
+ P: page.ref
819
+ });
820
+ const widgetRef = context.register(widgetDict);
821
+ const fieldDict = context.obj({
822
+ FT: pdf_lib.PDFName.of("Sig"),
823
+ T: pdf_lib.PDFString.of(fieldName),
824
+ Ff: pdf_lib.PDFNumber.of(0),
825
+ Kids: context.obj([widgetRef])
826
+ });
827
+ const fieldRef = context.register(fieldDict);
828
+ widgetDict.set(pdf_lib.PDFName.of("Parent"), fieldRef);
829
+ let annots = page.node.lookupMaybe(pdf_lib.PDFName.of("Annots"), pdf_lib.PDFArray);
830
+ if (!annots) {
831
+ annots = context.obj([]);
832
+ page.node.set(pdf_lib.PDFName.of("Annots"), annots);
833
+ }
834
+ annots.push(widgetRef);
835
+ let acroForm = pdfDoc.catalog.lookupMaybe(pdf_lib.PDFName.of("AcroForm"), pdf_lib.PDFDict);
836
+ if (!acroForm) {
837
+ acroForm = context.obj({
838
+ Fields: context.obj([]),
839
+ SigFlags: pdf_lib.PDFNumber.of(3)
840
+ });
841
+ const acroFormRef = context.register(acroForm);
842
+ pdfDoc.catalog.set(pdf_lib.PDFName.of("AcroForm"), acroFormRef);
843
+ }
844
+ let fields = acroForm.lookupMaybe(pdf_lib.PDFName.of("Fields"), pdf_lib.PDFArray);
845
+ if (!fields) {
846
+ fields = context.obj([]);
847
+ acroForm.set(pdf_lib.PDFName.of("Fields"), fields);
848
+ }
849
+ fields.push(fieldRef);
850
+ return {
851
+ fieldRef,
852
+ widgetRef
853
+ };
854
+ }
855
+ async function addSignatureFieldUsingAnchor(pdf, fieldName = "SignatureDebtor", anchorText = "__SIG_DEBTOR_ANCHOR__") {
856
+ const bytes = toU8(pdf);
857
+ const anchor = await findAnchorPosition(bytes.slice(), anchorText);
858
+ const pdfDoc = await pdf_lib.PDFDocument.load(bytes);
859
+ const sigWidth = 240;
860
+ const sigHeight = 50;
861
+ if (anchor) {
862
+ const pageIndex = anchor.pageIndex;
863
+ const { width: pw, height: ph } = pdfDoc.getPages()[pageIndex].getSize();
864
+ const padX = 40;
865
+ const padY = 7;
866
+ let x = anchor.x - sigWidth / 2 + padX;
867
+ let y = anchor.y - sigHeight + padY;
868
+ const margin = 10;
869
+ x = Math.max(margin, Math.min(x, pw - sigWidth - margin));
870
+ y = Math.max(margin, Math.min(y, ph - sigHeight - margin));
871
+ addSignatureFieldAt(pdfDoc, anchor.pageIndex, {
872
+ fieldName,
873
+ x,
874
+ y,
875
+ width: sigWidth,
876
+ height: sigHeight
877
+ });
878
+ } else {
879
+ const pages = pdfDoc.getPages();
880
+ const pageIndex = pages.length - 1;
881
+ const { width: pageWidth } = pages[pageIndex].getSize();
882
+ addSignatureFieldAt(pdfDoc, pageIndex, {
883
+ fieldName,
884
+ x: (pageWidth - sigWidth) / 2,
885
+ y: 90,
886
+ width: sigWidth,
887
+ height: sigHeight
888
+ });
889
+ }
890
+ return await pdfDoc.save();
891
+ }
892
+ //#endregion
893
+ //#region src/nestjs-pdf.service.ts
894
+ let NestjsPdfService = class NestjsPdfService {
895
+ puppeteerService;
896
+ constructor(puppeteerService) {
897
+ this.puppeteerService = puppeteerService;
898
+ }
899
+ /**
900
+ * @param html HTML string to convert to PDF
901
+ * @param options PDF generation options (optional)
902
+ * @returns PDF generated from the provided HTML
903
+ * @description This method uses the Puppeteer service to generate a PDF from an HTML string. Generation options can be customized by passing a `PuppeteerParameters` object as the second argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
904
+ */
905
+ generatePdfFromHtml(html, options) {
906
+ return this.puppeteerService.generatePdfFromHtml(html, options);
907
+ }
908
+ /**
909
+ * @param template Handlebars template string
910
+ * @param parameters Data parameters to inject into the template
911
+ * @param options PDF generation options (optional)
912
+ * @returns PDF generated from the provided Handlebars template with parameters applied
913
+ * @description This method generates a PDF from a Handlebars template provided as a string. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
914
+ */
915
+ generatePdfFromTemplateHbsString(template, parameters = {}, options) {
916
+ return this.puppeteerService.generatePdfFromTemplateHbsString(template, parameters, options);
917
+ }
918
+ /**
919
+ * @param file Path to the Handlebars template file
920
+ * @param parameters Data parameters to inject into the template
921
+ * @param options PDF generation options (optional)
922
+ * @returns PDF generated from the Handlebars template at the provided file path with parameters applied
923
+ * @description This method generates a PDF from a Handlebars template located at the specified file path. The file path is passed as a string in the `file` parameter. The parameters to inject into the template are passed in the `parameters` object, which is used to render the template before converting it to PDF. PDF generation options can also be customized by passing a `PuppeteerParameters` object as the third argument. This allows you to control various aspects of PDF rendering, such as page size, margins, background display, etc. If no options are provided, the default parameters defined in the Puppeteer service will be used.
924
+ */
925
+ generatePdfFromTemplateHbsFile(file, parameters = {}, options) {
926
+ return this.puppeteerService.generatePdfFromTemplateHbsFile(file, parameters, options);
927
+ }
928
+ /**
929
+ * @param template MJML template string
930
+ * @param options PDF generation options (optional)
931
+ * @returns PDF generated from the provided MJML template
932
+ * @description This method generates a PDF from an MJML template provided as a string. MJML (MJML Markup Language) is a markup language designed to reduce the pain of coding a responsive email. The template is first rendered to HTML using the MJML renderer, then converted to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the second argument.
933
+ */
934
+ generatePdfFromMjmlString(template, options) {
935
+ return this.puppeteerService.generatePdfFromMjmlString(template, options);
936
+ }
937
+ /**
938
+ * @param file Path to the MJML template file
939
+ * @param options PDF generation options (optional)
940
+ * @returns PDF generated from the MJML template at the provided file path
941
+ * @description This method generates a PDF from an MJML template located at the specified file path. The file path is passed as a string in the `file` parameter. The template is first rendered to HTML using the MJML renderer, then converted to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the second argument.
942
+ */
943
+ generatePdfFromMjmlFile(file, options) {
944
+ return this.puppeteerService.generatePdfFromMjmlFile(file, options);
945
+ }
946
+ /**
947
+ * @param template EJS template string
948
+ * @param data Data to inject into the template
949
+ * @param options PDF generation options (optional)
950
+ * @returns PDF generated from the provided EJS template with data applied
951
+ * @description This method generates a PDF from an EJS (Embedded JavaScript) template provided as a string. EJS is a templating language with a simple, straightforward syntax. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
952
+ */
953
+ generatePdfFromEjsString(template, data = {}, options) {
954
+ return this.puppeteerService.generatePdfFromEjsString(template, data, options);
955
+ }
956
+ /**
957
+ * @param file Path to the EJS template file
958
+ * @param data Data to inject into the template
959
+ * @param options PDF generation options (optional)
960
+ * @returns PDF generated from the EJS template at the provided file path with data applied
961
+ * @description This method generates a PDF from an EJS template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
962
+ */
963
+ generatePdfFromEjsFile(file, data = {}, options) {
964
+ return this.puppeteerService.generatePdfFromEjsFile(file, data, options);
965
+ }
966
+ /**
967
+ * @param template Pug template string
968
+ * @param data Data to inject into the template
969
+ * @param options PDF generation options (optional)
970
+ * @returns PDF generated from the provided Pug template with data applied
971
+ * @description This method generates a PDF from a Pug template provided as a string. Pug is a clean, whitespace-sensitive syntax for writing HTML. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
972
+ */
973
+ generatePdfFromPugString(template, data = {}, options) {
974
+ return this.puppeteerService.generatePdfFromPugString(template, data, options);
975
+ }
976
+ /**
977
+ * @param file Path to the Pug template file
978
+ * @param data Data to inject into the template
979
+ * @param options PDF generation options (optional)
980
+ * @returns PDF generated from the Pug template at the provided file path with data applied
981
+ * @description This method generates a PDF from a Pug template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
982
+ */
983
+ generatePdfFromPugFile(file, data = {}, options) {
984
+ return this.puppeteerService.generatePdfFromPugFile(file, data, options);
985
+ }
986
+ /**
987
+ * @param template Nunjucks template string
988
+ * @param data Data to inject into the template
989
+ * @param options PDF generation options (optional)
990
+ * @returns PDF generated from the provided Nunjucks template with data applied
991
+ * @description This method generates a PDF from a Nunjucks template provided as a string. Nunjucks is a powerful templating language with support for inheritance, macros, and filters. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
992
+ */
993
+ generatePdfFromNunjucksString(template, data = {}, options) {
994
+ return this.puppeteerService.generatePdfFromNunjucksString(template, data, options);
995
+ }
996
+ /**
997
+ * @param file Path to the Nunjucks template file
998
+ * @param data Data to inject into the template
999
+ * @param options PDF generation options (optional)
1000
+ * @returns PDF generated from the Nunjucks template at the provided file path with data applied
1001
+ * @description This method generates a PDF from a Nunjucks template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
1002
+ */
1003
+ generatePdfFromNunjucksFile(file, data = {}, options) {
1004
+ return this.puppeteerService.generatePdfFromNunjucksFile(file, data, options);
1005
+ }
1006
+ /**
1007
+ * @param template Eta template string
1008
+ * @param data Data to inject into the template
1009
+ * @param options PDF generation options (optional)
1010
+ * @returns PDF generated from the provided Eta template with data applied
1011
+ * @description This method generates a PDF from an Eta template provided as a string. Eta is a fast and lightweight embedded templating language with a syntax similar to EJS but with better performance. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
1012
+ */
1013
+ generatePdfFromEtaString(template, data = {}, options) {
1014
+ return this.puppeteerService.generatePdfFromEtaString(template, data, options);
1015
+ }
1016
+ /**
1017
+ * @param file Path to the Eta template file
1018
+ * @param data Data to inject into the template
1019
+ * @param options PDF generation options (optional)
1020
+ * @returns PDF generated from the Eta template at the provided file path with data applied
1021
+ * @description This method generates a PDF from an Eta template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
1022
+ */
1023
+ generatePdfFromEtaFile(file, data = {}, options) {
1024
+ return this.puppeteerService.generatePdfFromEtaFile(file, data, options);
1025
+ }
1026
+ /**
1027
+ * @param template Mustache template string
1028
+ * @param data Data to inject into the template
1029
+ * @param options PDF generation options (optional)
1030
+ * @returns PDF generated from the provided Mustache template with data applied
1031
+ * @description This method generates a PDF from a Mustache template provided as a string. Mustache is a logic-less template language that emphasizes readable and simple templates. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
1032
+ */
1033
+ generatePdfFromMustacheString(template, data = {}, options) {
1034
+ return this.puppeteerService.generatePdfFromMustacheString(template, data, options);
1035
+ }
1036
+ /**
1037
+ * @param file Path to the Mustache template file
1038
+ * @param data Data to inject into the template
1039
+ * @param options PDF generation options (optional)
1040
+ * @returns PDF generated from the Mustache template at the provided file path with data applied
1041
+ * @description This method generates a PDF from a Mustache template located at the specified file path. The file path is passed as a string in the `file` parameter. The data to inject into the template is passed in the `data` object, which is used to render the template before converting it to PDF. PDF generation options can be customized by passing a `PuppeteerParameters` object as the third argument.
1042
+ */
1043
+ generatePdfFromMustacheFile(file, data = {}, options) {
1044
+ return this.puppeteerService.generatePdfFromMustacheFile(file, data, options);
1045
+ }
1046
+ /**
1047
+ * @param pdf The PDF bytes to modify
1048
+ * @param fieldName The name of the signature field to add (default: 'SignatureDebtor')
1049
+ * @param anchorText The text anchor to locate the signature field position (default: '__SIG_DEBTOR_ANCHOR__')
1050
+ * @returns Modified PDF with a signature field added at the anchor position
1051
+ * @description This method adds a signature field to a PDF using a text anchor as a reference for the field position. It uses the `addSignatureFieldUsingAnchor` function which finds the anchor in the PDF and inserts a signature field at that location. The signature field is named according to the `fieldName` parameter and the anchor is defined by `anchorText`.
1052
+ *
1053
+ * Usage example:
1054
+ * ```typescript
1055
+ * const modifiedPdf = await pdfService.addSignatureFieldSignatureDebtorRaw(
1056
+ * originalPdfBytes,
1057
+ * 'SignatureDebtor',
1058
+ * '__SIG_DEBTOR_ANCHOR__'
1059
+ * );
1060
+ * ```
1061
+ *
1062
+ * In this example, `originalPdfBytes` is a byte array representing the original PDF, `SignatureDebtor` is the name of the signature field to add, and `__SIG_DEBTOR_ANCHOR__` is the anchor text used to position the signature field in the PDF.
1063
+ *
1064
+ * If the anchor is not found, the signature field will be added at a default position (centered at the bottom of the last page).
1065
+ *
1066
+ * Note: Ensure that the input PDF contains the anchor defined by `anchorText` for the signature field to be positioned correctly. Otherwise, it will be added at a default position.
1067
+ */
1068
+ async addSignatureFieldSignatureDebtorRaw(pdf, fieldName = "SignatureDebtor", anchorText = "__SIG_DEBTOR_ANCHOR__") {
1069
+ return await addSignatureFieldUsingAnchor(pdf, fieldName, anchorText);
1070
+ }
1071
+ };
1072
+ NestjsPdfService = __decorate([(0, _nestjs_common.Injectable)(), __decorateMetadata("design:paramtypes", [typeof PuppeteerService === "undefined" ? Object : PuppeteerService])], NestjsPdfService);
1073
+ //#endregion
1074
+ //#region node_modules/.pnpm/dotenv@17.4.1/node_modules/dotenv/lib/main.js
1075
+ var require_main$1 = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1076
+ const fs$1 = require("fs");
1077
+ const path = require("path");
1078
+ const os = require("os");
1079
+ const crypto = require("crypto");
1080
+ const TIPS = [
1081
+ "◈ encrypted .env [www.dotenvx.com]",
1082
+ "◈ secrets for agents [www.dotenvx.com]",
1083
+ "⌁ auth for agents [www.vestauth.com]",
1084
+ "⌘ custom filepath { path: '/custom/path/.env' }",
1085
+ "⌘ enable debugging { debug: true }",
1086
+ "⌘ override existing { override: true }",
1087
+ "⌘ suppress logs { quiet: true }",
1088
+ "⌘ multiple files { path: ['.env.local', '.env'] }"
1089
+ ];
1090
+ function _getRandomTip() {
1091
+ return TIPS[Math.floor(Math.random() * TIPS.length)];
1092
+ }
1093
+ function parseBoolean(value) {
1094
+ if (typeof value === "string") return ![
1095
+ "false",
1096
+ "0",
1097
+ "no",
1098
+ "off",
1099
+ ""
1100
+ ].includes(value.toLowerCase());
1101
+ return Boolean(value);
1102
+ }
1103
+ function supportsAnsi() {
1104
+ return process.stdout.isTTY;
1105
+ }
1106
+ function dim(text) {
1107
+ return supportsAnsi() ? `\x1b[2m${text}\x1b[0m` : text;
1108
+ }
1109
+ const LINE = /(?:^|^)\s*(?:export\s+)?([\w.-]+)(?:\s*=\s*?|:\s+?)(\s*'(?:\\'|[^'])*'|\s*"(?:\\"|[^"])*"|\s*`(?:\\`|[^`])*`|[^#\r\n]+)?\s*(?:#.*)?(?:$|$)/gm;
1110
+ function parse(src) {
1111
+ const obj = {};
1112
+ let lines = src.toString();
1113
+ lines = lines.replace(/\r\n?/gm, "\n");
1114
+ let match;
1115
+ while ((match = LINE.exec(lines)) != null) {
1116
+ const key = match[1];
1117
+ let value = match[2] || "";
1118
+ value = value.trim();
1119
+ const maybeQuote = value[0];
1120
+ value = value.replace(/^(['"`])([\s\S]*)\1$/gm, "$2");
1121
+ if (maybeQuote === "\"") {
1122
+ value = value.replace(/\\n/g, "\n");
1123
+ value = value.replace(/\\r/g, "\r");
1124
+ }
1125
+ obj[key] = value;
1126
+ }
1127
+ return obj;
1128
+ }
1129
+ function _parseVault(options) {
1130
+ options = options || {};
1131
+ const vaultPath = _vaultPath(options);
1132
+ options.path = vaultPath;
1133
+ const result = DotenvModule.configDotenv(options);
1134
+ if (!result.parsed) {
1135
+ const err = /* @__PURE__ */ new Error(`MISSING_DATA: Cannot parse ${vaultPath} for an unknown reason`);
1136
+ err.code = "MISSING_DATA";
1137
+ throw err;
1138
+ }
1139
+ const keys = _dotenvKey(options).split(",");
1140
+ const length = keys.length;
1141
+ let decrypted;
1142
+ for (let i = 0; i < length; i++) try {
1143
+ const attrs = _instructions(result, keys[i].trim());
1144
+ decrypted = DotenvModule.decrypt(attrs.ciphertext, attrs.key);
1145
+ break;
1146
+ } catch (error) {
1147
+ if (i + 1 >= length) throw error;
1148
+ }
1149
+ return DotenvModule.parse(decrypted);
1150
+ }
1151
+ function _warn(message) {
1152
+ console.error(`⚠ ${message}`);
1153
+ }
1154
+ function _debug(message) {
1155
+ console.log(`┆ ${message}`);
1156
+ }
1157
+ function _log(message) {
1158
+ console.log(`◇ ${message}`);
1159
+ }
1160
+ function _dotenvKey(options) {
1161
+ if (options && options.DOTENV_KEY && options.DOTENV_KEY.length > 0) return options.DOTENV_KEY;
1162
+ if (process.env.DOTENV_KEY && process.env.DOTENV_KEY.length > 0) return process.env.DOTENV_KEY;
1163
+ return "";
1164
+ }
1165
+ function _instructions(result, dotenvKey) {
1166
+ let uri;
1167
+ try {
1168
+ uri = new URL(dotenvKey);
1169
+ } catch (error) {
1170
+ if (error.code === "ERR_INVALID_URL") {
1171
+ const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: Wrong format. Must be in valid uri format like dotenv://:key_1234@dotenvx.com/vault/.env.vault?environment=development");
1172
+ err.code = "INVALID_DOTENV_KEY";
1173
+ throw err;
1174
+ }
1175
+ throw error;
1176
+ }
1177
+ const key = uri.password;
1178
+ if (!key) {
1179
+ const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: Missing key part");
1180
+ err.code = "INVALID_DOTENV_KEY";
1181
+ throw err;
1182
+ }
1183
+ const environment = uri.searchParams.get("environment");
1184
+ if (!environment) {
1185
+ const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: Missing environment part");
1186
+ err.code = "INVALID_DOTENV_KEY";
1187
+ throw err;
1188
+ }
1189
+ const environmentKey = `DOTENV_VAULT_${environment.toUpperCase()}`;
1190
+ const ciphertext = result.parsed[environmentKey];
1191
+ if (!ciphertext) {
1192
+ const err = /* @__PURE__ */ new Error(`NOT_FOUND_DOTENV_ENVIRONMENT: Cannot locate environment ${environmentKey} in your .env.vault file.`);
1193
+ err.code = "NOT_FOUND_DOTENV_ENVIRONMENT";
1194
+ throw err;
1195
+ }
1196
+ return {
1197
+ ciphertext,
1198
+ key
1199
+ };
1200
+ }
1201
+ function _vaultPath(options) {
1202
+ let possibleVaultPath = null;
1203
+ if (options && options.path && options.path.length > 0) if (Array.isArray(options.path)) {
1204
+ for (const filepath of options.path) if (fs$1.existsSync(filepath)) possibleVaultPath = filepath.endsWith(".vault") ? filepath : `${filepath}.vault`;
1205
+ } else possibleVaultPath = options.path.endsWith(".vault") ? options.path : `${options.path}.vault`;
1206
+ else possibleVaultPath = path.resolve(process.cwd(), ".env.vault");
1207
+ if (fs$1.existsSync(possibleVaultPath)) return possibleVaultPath;
1208
+ return null;
1209
+ }
1210
+ function _resolveHome(envPath) {
1211
+ return envPath[0] === "~" ? path.join(os.homedir(), envPath.slice(1)) : envPath;
1212
+ }
1213
+ function _configVault(options) {
1214
+ const debug = parseBoolean(process.env.DOTENV_CONFIG_DEBUG || options && options.debug);
1215
+ const quiet = parseBoolean(process.env.DOTENV_CONFIG_QUIET || options && options.quiet);
1216
+ if (debug || !quiet) _log("loading env from encrypted .env.vault");
1217
+ const parsed = DotenvModule._parseVault(options);
1218
+ let processEnv = process.env;
1219
+ if (options && options.processEnv != null) processEnv = options.processEnv;
1220
+ DotenvModule.populate(processEnv, parsed, options);
1221
+ return { parsed };
1222
+ }
1223
+ function configDotenv(options) {
1224
+ const dotenvPath = path.resolve(process.cwd(), ".env");
1225
+ let encoding = "utf8";
1226
+ let processEnv = process.env;
1227
+ if (options && options.processEnv != null) processEnv = options.processEnv;
1228
+ let debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || options && options.debug);
1229
+ let quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || options && options.quiet);
1230
+ if (options && options.encoding) encoding = options.encoding;
1231
+ else if (debug) _debug("no encoding is specified (UTF-8 is used by default)");
1232
+ let optionPaths = [dotenvPath];
1233
+ if (options && options.path) if (!Array.isArray(options.path)) optionPaths = [_resolveHome(options.path)];
1234
+ else {
1235
+ optionPaths = [];
1236
+ for (const filepath of options.path) optionPaths.push(_resolveHome(filepath));
1237
+ }
1238
+ let lastError;
1239
+ const parsedAll = {};
1240
+ for (const path of optionPaths) try {
1241
+ const parsed = DotenvModule.parse(fs$1.readFileSync(path, { encoding }));
1242
+ DotenvModule.populate(parsedAll, parsed, options);
1243
+ } catch (e) {
1244
+ if (debug) _debug(`failed to load ${path} ${e.message}`);
1245
+ lastError = e;
1246
+ }
1247
+ const populated = DotenvModule.populate(processEnv, parsedAll, options);
1248
+ debug = parseBoolean(processEnv.DOTENV_CONFIG_DEBUG || debug);
1249
+ quiet = parseBoolean(processEnv.DOTENV_CONFIG_QUIET || quiet);
1250
+ if (debug || !quiet) {
1251
+ const keysCount = Object.keys(populated).length;
1252
+ const shortPaths = [];
1253
+ for (const filePath of optionPaths) try {
1254
+ const relative = path.relative(process.cwd(), filePath);
1255
+ shortPaths.push(relative);
1256
+ } catch (e) {
1257
+ if (debug) _debug(`failed to load ${filePath} ${e.message}`);
1258
+ lastError = e;
1259
+ }
1260
+ _log(`injected env (${keysCount}) from ${shortPaths.join(",")} ${dim(`// tip: ${_getRandomTip()}`)}`);
1261
+ }
1262
+ if (lastError) return {
1263
+ parsed: parsedAll,
1264
+ error: lastError
1265
+ };
1266
+ else return { parsed: parsedAll };
1267
+ }
1268
+ function config(options) {
1269
+ if (_dotenvKey(options).length === 0) return DotenvModule.configDotenv(options);
1270
+ const vaultPath = _vaultPath(options);
1271
+ if (!vaultPath) {
1272
+ _warn(`you set DOTENV_KEY but you are missing a .env.vault file at ${vaultPath}`);
1273
+ return DotenvModule.configDotenv(options);
1274
+ }
1275
+ return DotenvModule._configVault(options);
1276
+ }
1277
+ function decrypt(encrypted, keyStr) {
1278
+ const key = Buffer.from(keyStr.slice(-64), "hex");
1279
+ let ciphertext = Buffer.from(encrypted, "base64");
1280
+ const nonce = ciphertext.subarray(0, 12);
1281
+ const authTag = ciphertext.subarray(-16);
1282
+ ciphertext = ciphertext.subarray(12, -16);
1283
+ try {
1284
+ const aesgcm = crypto.createDecipheriv("aes-256-gcm", key, nonce);
1285
+ aesgcm.setAuthTag(authTag);
1286
+ return `${aesgcm.update(ciphertext)}${aesgcm.final()}`;
1287
+ } catch (error) {
1288
+ const isRange = error instanceof RangeError;
1289
+ const invalidKeyLength = error.message === "Invalid key length";
1290
+ const decryptionFailed = error.message === "Unsupported state or unable to authenticate data";
1291
+ if (isRange || invalidKeyLength) {
1292
+ const err = /* @__PURE__ */ new Error("INVALID_DOTENV_KEY: It must be 64 characters long (or more)");
1293
+ err.code = "INVALID_DOTENV_KEY";
1294
+ throw err;
1295
+ } else if (decryptionFailed) {
1296
+ const err = /* @__PURE__ */ new Error("DECRYPTION_FAILED: Please check your DOTENV_KEY");
1297
+ err.code = "DECRYPTION_FAILED";
1298
+ throw err;
1299
+ } else throw error;
1300
+ }
1301
+ }
1302
+ function populate(processEnv, parsed, options = {}) {
1303
+ const debug = Boolean(options && options.debug);
1304
+ const override = Boolean(options && options.override);
1305
+ const populated = {};
1306
+ if (typeof parsed !== "object") {
1307
+ const err = /* @__PURE__ */ new Error("OBJECT_REQUIRED: Please check the processEnv argument being passed to populate");
1308
+ err.code = "OBJECT_REQUIRED";
1309
+ throw err;
1310
+ }
1311
+ for (const key of Object.keys(parsed)) if (Object.prototype.hasOwnProperty.call(processEnv, key)) {
1312
+ if (override === true) {
1313
+ processEnv[key] = parsed[key];
1314
+ populated[key] = parsed[key];
1315
+ }
1316
+ if (debug) if (override === true) _debug(`"${key}" is already defined and WAS overwritten`);
1317
+ else _debug(`"${key}" is already defined and was NOT overwritten`);
1318
+ } else {
1319
+ processEnv[key] = parsed[key];
1320
+ populated[key] = parsed[key];
1321
+ }
1322
+ return populated;
1323
+ }
1324
+ const DotenvModule = {
1325
+ configDotenv,
1326
+ _configVault,
1327
+ _parseVault,
1328
+ config,
1329
+ decrypt,
1330
+ parse,
1331
+ populate
1332
+ };
1333
+ module.exports.configDotenv = DotenvModule.configDotenv;
1334
+ module.exports._configVault = DotenvModule._configVault;
1335
+ module.exports._parseVault = DotenvModule._parseVault;
1336
+ module.exports.config = DotenvModule.config;
1337
+ module.exports.decrypt = DotenvModule.decrypt;
1338
+ module.exports.parse = DotenvModule.parse;
1339
+ module.exports.populate = DotenvModule.populate;
1340
+ module.exports = DotenvModule;
1341
+ }));
1342
+ //#endregion
1343
+ //#region node_modules/.pnpm/dotenv-expand@12.0.3/node_modules/dotenv-expand/lib/main.js
1344
+ var require_main = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1345
+ function _resolveEscapeSequences(value) {
1346
+ return value.replace(/\\\$/g, "$");
1347
+ }
1348
+ function expandValue(value, processEnv, runningParsed) {
1349
+ const env = {
1350
+ ...runningParsed,
1351
+ ...processEnv
1352
+ };
1353
+ const regex = /(?<!\\)\${([^{}]+)}|(?<!\\)\$([A-Za-z_][A-Za-z0-9_]*)/g;
1354
+ let result = value;
1355
+ let match;
1356
+ const seen = /* @__PURE__ */ new Set();
1357
+ while ((match = regex.exec(result)) !== null) {
1358
+ seen.add(result);
1359
+ const [template, bracedExpression, unbracedExpression] = match;
1360
+ const expression = bracedExpression || unbracedExpression;
1361
+ const opMatch = expression.match(/(:\+|\+|:-|-)/);
1362
+ const splitter = opMatch ? opMatch[0] : null;
1363
+ const r = expression.split(splitter);
1364
+ let defaultValue;
1365
+ let value;
1366
+ const key = r.shift();
1367
+ if ([":+", "+"].includes(splitter)) {
1368
+ defaultValue = env[key] ? r.join(splitter) : "";
1369
+ value = null;
1370
+ } else {
1371
+ defaultValue = r.join(splitter);
1372
+ value = env[key];
1373
+ }
1374
+ if (value) if (seen.has(value)) result = result.replace(template, defaultValue);
1375
+ else result = result.replace(template, value);
1376
+ else result = result.replace(template, defaultValue);
1377
+ if (result === runningParsed[key]) break;
1378
+ regex.lastIndex = 0;
1379
+ }
1380
+ return result;
1381
+ }
1382
+ function expand(options) {
1383
+ const runningParsed = {};
1384
+ let processEnv = process.env;
1385
+ if (options && options.processEnv != null) processEnv = options.processEnv;
1386
+ for (const key in options.parsed) {
1387
+ let value = options.parsed[key];
1388
+ if (processEnv[key] && processEnv[key] !== value) value = processEnv[key];
1389
+ else value = expandValue(value, processEnv, runningParsed);
1390
+ options.parsed[key] = _resolveEscapeSequences(value);
1391
+ runningParsed[key] = _resolveEscapeSequences(value);
1392
+ }
1393
+ for (const processKey in options.parsed) processEnv[processKey] = options.parsed[processKey];
1394
+ return options;
1395
+ }
1396
+ module.exports.expand = expand;
1397
+ }));
1398
+ //#endregion
1399
+ //#region node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.27_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/config.constants.js
1400
+ var require_config_constants = /* @__PURE__ */ __commonJSMin(((exports) => {
1401
+ Object.defineProperty(exports, "__esModule", { value: true });
1402
+ exports.AS_PROVIDER_METHOD_KEY = exports.VALIDATED_ENV_PROPNAME = exports.PARTIAL_CONFIGURATION_PROPNAME = exports.PARTIAL_CONFIGURATION_KEY = exports.VALIDATED_ENV_LOADER = exports.CONFIGURATION_LOADER = exports.CONFIGURATION_TOKEN = exports.CONFIGURATION_SERVICE_TOKEN = void 0;
1403
+ /**
1404
+ * Injection tokens
1405
+ */
1406
+ exports.CONFIGURATION_SERVICE_TOKEN = Symbol("CONFIG_SERVICE");
1407
+ exports.CONFIGURATION_TOKEN = "CONFIGURATION_TOKEN";
1408
+ exports.CONFIGURATION_LOADER = "CONFIGURATION_LOADER";
1409
+ exports.VALIDATED_ENV_LOADER = "VALIDATED_ENV_LOADER";
1410
+ exports.PARTIAL_CONFIGURATION_KEY = "PARTIAL_CONFIGURATION_KEY";
1411
+ exports.PARTIAL_CONFIGURATION_PROPNAME = "KEY";
1412
+ exports.VALIDATED_ENV_PROPNAME = "_PROCESS_ENV_VALIDATED";
1413
+ exports.AS_PROVIDER_METHOD_KEY = "asProvider";
1414
+ }));
1415
+ //#endregion
1416
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/isArray.js
1417
+ var require_isArray = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1418
+ module.exports = Array.isArray;
1419
+ }));
1420
+ //#endregion
1421
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_freeGlobal.js
1422
+ var require__freeGlobal = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1423
+ module.exports = typeof global == "object" && global && global.Object === Object && global;
1424
+ }));
1425
+ //#endregion
1426
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_root.js
1427
+ var require__root = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1428
+ var freeGlobal = require__freeGlobal();
1429
+ /** Detect free variable `self`. */
1430
+ var freeSelf = typeof self == "object" && self && self.Object === Object && self;
1431
+ module.exports = freeGlobal || freeSelf || Function("return this")();
1432
+ }));
1433
+ //#endregion
1434
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_Symbol.js
1435
+ var require__Symbol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1436
+ module.exports = require__root().Symbol;
1437
+ }));
1438
+ //#endregion
1439
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_getRawTag.js
1440
+ var require__getRawTag = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1441
+ var Symbol = require__Symbol();
1442
+ /** Used for built-in method references. */
1443
+ var objectProto = Object.prototype;
1444
+ /** Used to check objects for own properties. */
1445
+ var hasOwnProperty = objectProto.hasOwnProperty;
1446
+ /**
1447
+ * Used to resolve the
1448
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
1449
+ * of values.
1450
+ */
1451
+ var nativeObjectToString = objectProto.toString;
1452
+ /** Built-in value references. */
1453
+ var symToStringTag = Symbol ? Symbol.toStringTag : void 0;
1454
+ /**
1455
+ * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values.
1456
+ *
1457
+ * @private
1458
+ * @param {*} value The value to query.
1459
+ * @returns {string} Returns the raw `toStringTag`.
1460
+ */
1461
+ function getRawTag(value) {
1462
+ var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag];
1463
+ try {
1464
+ value[symToStringTag] = void 0;
1465
+ var unmasked = true;
1466
+ } catch (e) {}
1467
+ var result = nativeObjectToString.call(value);
1468
+ if (unmasked) if (isOwn) value[symToStringTag] = tag;
1469
+ else delete value[symToStringTag];
1470
+ return result;
1471
+ }
1472
+ module.exports = getRawTag;
1473
+ }));
1474
+ //#endregion
1475
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_objectToString.js
1476
+ var require__objectToString = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1477
+ /**
1478
+ * Used to resolve the
1479
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
1480
+ * of values.
1481
+ */
1482
+ var nativeObjectToString = Object.prototype.toString;
1483
+ /**
1484
+ * Converts `value` to a string using `Object.prototype.toString`.
1485
+ *
1486
+ * @private
1487
+ * @param {*} value The value to convert.
1488
+ * @returns {string} Returns the converted string.
1489
+ */
1490
+ function objectToString(value) {
1491
+ return nativeObjectToString.call(value);
1492
+ }
1493
+ module.exports = objectToString;
1494
+ }));
1495
+ //#endregion
1496
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseGetTag.js
1497
+ var require__baseGetTag = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1498
+ var Symbol = require__Symbol();
1499
+ var getRawTag = require__getRawTag();
1500
+ var objectToString = require__objectToString();
1501
+ /** `Object#toString` result references. */
1502
+ var nullTag = "[object Null]";
1503
+ var undefinedTag = "[object Undefined]";
1504
+ /** Built-in value references. */
1505
+ var symToStringTag = Symbol ? Symbol.toStringTag : void 0;
1506
+ /**
1507
+ * The base implementation of `getTag` without fallbacks for buggy environments.
1508
+ *
1509
+ * @private
1510
+ * @param {*} value The value to query.
1511
+ * @returns {string} Returns the `toStringTag`.
1512
+ */
1513
+ function baseGetTag(value) {
1514
+ if (value == null) return value === void 0 ? undefinedTag : nullTag;
1515
+ return symToStringTag && symToStringTag in Object(value) ? getRawTag(value) : objectToString(value);
1516
+ }
1517
+ module.exports = baseGetTag;
1518
+ }));
1519
+ //#endregion
1520
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/isObjectLike.js
1521
+ var require_isObjectLike = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1522
+ /**
1523
+ * Checks if `value` is object-like. A value is object-like if it's not `null`
1524
+ * and has a `typeof` result of "object".
1525
+ *
1526
+ * @static
1527
+ * @memberOf _
1528
+ * @since 4.0.0
1529
+ * @category Lang
1530
+ * @param {*} value The value to check.
1531
+ * @returns {boolean} Returns `true` if `value` is object-like, else `false`.
1532
+ * @example
1533
+ *
1534
+ * _.isObjectLike({});
1535
+ * // => true
1536
+ *
1537
+ * _.isObjectLike([1, 2, 3]);
1538
+ * // => true
1539
+ *
1540
+ * _.isObjectLike(_.noop);
1541
+ * // => false
1542
+ *
1543
+ * _.isObjectLike(null);
1544
+ * // => false
1545
+ */
1546
+ function isObjectLike(value) {
1547
+ return value != null && typeof value == "object";
1548
+ }
1549
+ module.exports = isObjectLike;
1550
+ }));
1551
+ //#endregion
1552
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/isSymbol.js
1553
+ var require_isSymbol = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1554
+ var baseGetTag = require__baseGetTag();
1555
+ var isObjectLike = require_isObjectLike();
1556
+ /** `Object#toString` result references. */
1557
+ var symbolTag = "[object Symbol]";
1558
+ /**
1559
+ * Checks if `value` is classified as a `Symbol` primitive or object.
1560
+ *
1561
+ * @static
1562
+ * @memberOf _
1563
+ * @since 4.0.0
1564
+ * @category Lang
1565
+ * @param {*} value The value to check.
1566
+ * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.
1567
+ * @example
1568
+ *
1569
+ * _.isSymbol(Symbol.iterator);
1570
+ * // => true
1571
+ *
1572
+ * _.isSymbol('abc');
1573
+ * // => false
1574
+ */
1575
+ function isSymbol(value) {
1576
+ return typeof value == "symbol" || isObjectLike(value) && baseGetTag(value) == symbolTag;
1577
+ }
1578
+ module.exports = isSymbol;
1579
+ }));
1580
+ //#endregion
1581
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_isKey.js
1582
+ var require__isKey = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1583
+ var isArray = require_isArray();
1584
+ var isSymbol = require_isSymbol();
1585
+ /** Used to match property names within property paths. */
1586
+ var reIsDeepProp = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/;
1587
+ var reIsPlainProp = /^\w*$/;
1588
+ /**
1589
+ * Checks if `value` is a property name and not a property path.
1590
+ *
1591
+ * @private
1592
+ * @param {*} value The value to check.
1593
+ * @param {Object} [object] The object to query keys on.
1594
+ * @returns {boolean} Returns `true` if `value` is a property name, else `false`.
1595
+ */
1596
+ function isKey(value, object) {
1597
+ if (isArray(value)) return false;
1598
+ var type = typeof value;
1599
+ if (type == "number" || type == "symbol" || type == "boolean" || value == null || isSymbol(value)) return true;
1600
+ return reIsPlainProp.test(value) || !reIsDeepProp.test(value) || object != null && value in Object(object);
1601
+ }
1602
+ module.exports = isKey;
1603
+ }));
1604
+ //#endregion
1605
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/isObject.js
1606
+ var require_isObject = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1607
+ /**
1608
+ * Checks if `value` is the
1609
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
1610
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
1611
+ *
1612
+ * @static
1613
+ * @memberOf _
1614
+ * @since 0.1.0
1615
+ * @category Lang
1616
+ * @param {*} value The value to check.
1617
+ * @returns {boolean} Returns `true` if `value` is an object, else `false`.
1618
+ * @example
1619
+ *
1620
+ * _.isObject({});
1621
+ * // => true
1622
+ *
1623
+ * _.isObject([1, 2, 3]);
1624
+ * // => true
1625
+ *
1626
+ * _.isObject(_.noop);
1627
+ * // => true
1628
+ *
1629
+ * _.isObject(null);
1630
+ * // => false
1631
+ */
1632
+ function isObject(value) {
1633
+ var type = typeof value;
1634
+ return value != null && (type == "object" || type == "function");
1635
+ }
1636
+ module.exports = isObject;
1637
+ }));
1638
+ //#endregion
1639
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/isFunction.js
1640
+ var require_isFunction = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1641
+ var baseGetTag = require__baseGetTag();
1642
+ var isObject = require_isObject();
1643
+ /** `Object#toString` result references. */
1644
+ var asyncTag = "[object AsyncFunction]";
1645
+ var funcTag = "[object Function]";
1646
+ var genTag = "[object GeneratorFunction]";
1647
+ var proxyTag = "[object Proxy]";
1648
+ /**
1649
+ * Checks if `value` is classified as a `Function` object.
1650
+ *
1651
+ * @static
1652
+ * @memberOf _
1653
+ * @since 0.1.0
1654
+ * @category Lang
1655
+ * @param {*} value The value to check.
1656
+ * @returns {boolean} Returns `true` if `value` is a function, else `false`.
1657
+ * @example
1658
+ *
1659
+ * _.isFunction(_);
1660
+ * // => true
1661
+ *
1662
+ * _.isFunction(/abc/);
1663
+ * // => false
1664
+ */
1665
+ function isFunction(value) {
1666
+ if (!isObject(value)) return false;
1667
+ var tag = baseGetTag(value);
1668
+ return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag;
1669
+ }
1670
+ module.exports = isFunction;
1671
+ }));
1672
+ //#endregion
1673
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_coreJsData.js
1674
+ var require__coreJsData = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1675
+ module.exports = require__root()["__core-js_shared__"];
1676
+ }));
1677
+ //#endregion
1678
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_isMasked.js
1679
+ var require__isMasked = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1680
+ var coreJsData = require__coreJsData();
1681
+ /** Used to detect methods masquerading as native. */
1682
+ var maskSrcKey = function() {
1683
+ var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || "");
1684
+ return uid ? "Symbol(src)_1." + uid : "";
1685
+ }();
1686
+ /**
1687
+ * Checks if `func` has its source masked.
1688
+ *
1689
+ * @private
1690
+ * @param {Function} func The function to check.
1691
+ * @returns {boolean} Returns `true` if `func` is masked, else `false`.
1692
+ */
1693
+ function isMasked(func) {
1694
+ return !!maskSrcKey && maskSrcKey in func;
1695
+ }
1696
+ module.exports = isMasked;
1697
+ }));
1698
+ //#endregion
1699
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_toSource.js
1700
+ var require__toSource = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1701
+ /** Used to resolve the decompiled source of functions. */
1702
+ var funcToString = Function.prototype.toString;
1703
+ /**
1704
+ * Converts `func` to its source code.
1705
+ *
1706
+ * @private
1707
+ * @param {Function} func The function to convert.
1708
+ * @returns {string} Returns the source code.
1709
+ */
1710
+ function toSource(func) {
1711
+ if (func != null) {
1712
+ try {
1713
+ return funcToString.call(func);
1714
+ } catch (e) {}
1715
+ try {
1716
+ return func + "";
1717
+ } catch (e) {}
1718
+ }
1719
+ return "";
1720
+ }
1721
+ module.exports = toSource;
1722
+ }));
1723
+ //#endregion
1724
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseIsNative.js
1725
+ var require__baseIsNative = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1726
+ var isFunction = require_isFunction();
1727
+ var isMasked = require__isMasked();
1728
+ var isObject = require_isObject();
1729
+ var toSource = require__toSource();
1730
+ /**
1731
+ * Used to match `RegExp`
1732
+ * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns).
1733
+ */
1734
+ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g;
1735
+ /** Used to detect host constructors (Safari). */
1736
+ var reIsHostCtor = /^\[object .+?Constructor\]$/;
1737
+ /** Used for built-in method references. */
1738
+ var funcProto = Function.prototype;
1739
+ var objectProto = Object.prototype;
1740
+ /** Used to resolve the decompiled source of functions. */
1741
+ var funcToString = funcProto.toString;
1742
+ /** Used to check objects for own properties. */
1743
+ var hasOwnProperty = objectProto.hasOwnProperty;
1744
+ /** Used to detect if a method is native. */
1745
+ var reIsNative = RegExp("^" + funcToString.call(hasOwnProperty).replace(reRegExpChar, "\\$&").replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, "$1.*?") + "$");
1746
+ /**
1747
+ * The base implementation of `_.isNative` without bad shim checks.
1748
+ *
1749
+ * @private
1750
+ * @param {*} value The value to check.
1751
+ * @returns {boolean} Returns `true` if `value` is a native function,
1752
+ * else `false`.
1753
+ */
1754
+ function baseIsNative(value) {
1755
+ if (!isObject(value) || isMasked(value)) return false;
1756
+ return (isFunction(value) ? reIsNative : reIsHostCtor).test(toSource(value));
1757
+ }
1758
+ module.exports = baseIsNative;
1759
+ }));
1760
+ //#endregion
1761
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_getValue.js
1762
+ var require__getValue = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1763
+ /**
1764
+ * Gets the value at `key` of `object`.
1765
+ *
1766
+ * @private
1767
+ * @param {Object} [object] The object to query.
1768
+ * @param {string} key The key of the property to get.
1769
+ * @returns {*} Returns the property value.
1770
+ */
1771
+ function getValue(object, key) {
1772
+ return object == null ? void 0 : object[key];
1773
+ }
1774
+ module.exports = getValue;
1775
+ }));
1776
+ //#endregion
1777
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_getNative.js
1778
+ var require__getNative = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1779
+ var baseIsNative = require__baseIsNative();
1780
+ var getValue = require__getValue();
1781
+ /**
1782
+ * Gets the native function at `key` of `object`.
1783
+ *
1784
+ * @private
1785
+ * @param {Object} object The object to query.
1786
+ * @param {string} key The key of the method to get.
1787
+ * @returns {*} Returns the function if it's native, else `undefined`.
1788
+ */
1789
+ function getNative(object, key) {
1790
+ var value = getValue(object, key);
1791
+ return baseIsNative(value) ? value : void 0;
1792
+ }
1793
+ module.exports = getNative;
1794
+ }));
1795
+ //#endregion
1796
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_nativeCreate.js
1797
+ var require__nativeCreate = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1798
+ module.exports = require__getNative()(Object, "create");
1799
+ }));
1800
+ //#endregion
1801
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_hashClear.js
1802
+ var require__hashClear = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1803
+ var nativeCreate = require__nativeCreate();
1804
+ /**
1805
+ * Removes all key-value entries from the hash.
1806
+ *
1807
+ * @private
1808
+ * @name clear
1809
+ * @memberOf Hash
1810
+ */
1811
+ function hashClear() {
1812
+ this.__data__ = nativeCreate ? nativeCreate(null) : {};
1813
+ this.size = 0;
1814
+ }
1815
+ module.exports = hashClear;
1816
+ }));
1817
+ //#endregion
1818
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_hashDelete.js
1819
+ var require__hashDelete = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1820
+ /**
1821
+ * Removes `key` and its value from the hash.
1822
+ *
1823
+ * @private
1824
+ * @name delete
1825
+ * @memberOf Hash
1826
+ * @param {Object} hash The hash to modify.
1827
+ * @param {string} key The key of the value to remove.
1828
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
1829
+ */
1830
+ function hashDelete(key) {
1831
+ var result = this.has(key) && delete this.__data__[key];
1832
+ this.size -= result ? 1 : 0;
1833
+ return result;
1834
+ }
1835
+ module.exports = hashDelete;
1836
+ }));
1837
+ //#endregion
1838
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_hashGet.js
1839
+ var require__hashGet = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1840
+ var nativeCreate = require__nativeCreate();
1841
+ /** Used to stand-in for `undefined` hash values. */
1842
+ var HASH_UNDEFINED = "__lodash_hash_undefined__";
1843
+ /** Used to check objects for own properties. */
1844
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
1845
+ /**
1846
+ * Gets the hash value for `key`.
1847
+ *
1848
+ * @private
1849
+ * @name get
1850
+ * @memberOf Hash
1851
+ * @param {string} key The key of the value to get.
1852
+ * @returns {*} Returns the entry value.
1853
+ */
1854
+ function hashGet(key) {
1855
+ var data = this.__data__;
1856
+ if (nativeCreate) {
1857
+ var result = data[key];
1858
+ return result === HASH_UNDEFINED ? void 0 : result;
1859
+ }
1860
+ return hasOwnProperty.call(data, key) ? data[key] : void 0;
1861
+ }
1862
+ module.exports = hashGet;
1863
+ }));
1864
+ //#endregion
1865
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_hashHas.js
1866
+ var require__hashHas = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1867
+ var nativeCreate = require__nativeCreate();
1868
+ /** Used to check objects for own properties. */
1869
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
1870
+ /**
1871
+ * Checks if a hash value for `key` exists.
1872
+ *
1873
+ * @private
1874
+ * @name has
1875
+ * @memberOf Hash
1876
+ * @param {string} key The key of the entry to check.
1877
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
1878
+ */
1879
+ function hashHas(key) {
1880
+ var data = this.__data__;
1881
+ return nativeCreate ? data[key] !== void 0 : hasOwnProperty.call(data, key);
1882
+ }
1883
+ module.exports = hashHas;
1884
+ }));
1885
+ //#endregion
1886
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_hashSet.js
1887
+ var require__hashSet = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1888
+ var nativeCreate = require__nativeCreate();
1889
+ /** Used to stand-in for `undefined` hash values. */
1890
+ var HASH_UNDEFINED = "__lodash_hash_undefined__";
1891
+ /**
1892
+ * Sets the hash `key` to `value`.
1893
+ *
1894
+ * @private
1895
+ * @name set
1896
+ * @memberOf Hash
1897
+ * @param {string} key The key of the value to set.
1898
+ * @param {*} value The value to set.
1899
+ * @returns {Object} Returns the hash instance.
1900
+ */
1901
+ function hashSet(key, value) {
1902
+ var data = this.__data__;
1903
+ this.size += this.has(key) ? 0 : 1;
1904
+ data[key] = nativeCreate && value === void 0 ? HASH_UNDEFINED : value;
1905
+ return this;
1906
+ }
1907
+ module.exports = hashSet;
1908
+ }));
1909
+ //#endregion
1910
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_Hash.js
1911
+ var require__Hash = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1912
+ var hashClear = require__hashClear();
1913
+ var hashDelete = require__hashDelete();
1914
+ var hashGet = require__hashGet();
1915
+ var hashHas = require__hashHas();
1916
+ var hashSet = require__hashSet();
1917
+ /**
1918
+ * Creates a hash object.
1919
+ *
1920
+ * @private
1921
+ * @constructor
1922
+ * @param {Array} [entries] The key-value pairs to cache.
1923
+ */
1924
+ function Hash(entries) {
1925
+ var index = -1, length = entries == null ? 0 : entries.length;
1926
+ this.clear();
1927
+ while (++index < length) {
1928
+ var entry = entries[index];
1929
+ this.set(entry[0], entry[1]);
1930
+ }
1931
+ }
1932
+ Hash.prototype.clear = hashClear;
1933
+ Hash.prototype["delete"] = hashDelete;
1934
+ Hash.prototype.get = hashGet;
1935
+ Hash.prototype.has = hashHas;
1936
+ Hash.prototype.set = hashSet;
1937
+ module.exports = Hash;
1938
+ }));
1939
+ //#endregion
1940
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_listCacheClear.js
1941
+ var require__listCacheClear = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1942
+ /**
1943
+ * Removes all key-value entries from the list cache.
1944
+ *
1945
+ * @private
1946
+ * @name clear
1947
+ * @memberOf ListCache
1948
+ */
1949
+ function listCacheClear() {
1950
+ this.__data__ = [];
1951
+ this.size = 0;
1952
+ }
1953
+ module.exports = listCacheClear;
1954
+ }));
1955
+ //#endregion
1956
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/eq.js
1957
+ var require_eq = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1958
+ /**
1959
+ * Performs a
1960
+ * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
1961
+ * comparison between two values to determine if they are equivalent.
1962
+ *
1963
+ * @static
1964
+ * @memberOf _
1965
+ * @since 4.0.0
1966
+ * @category Lang
1967
+ * @param {*} value The value to compare.
1968
+ * @param {*} other The other value to compare.
1969
+ * @returns {boolean} Returns `true` if the values are equivalent, else `false`.
1970
+ * @example
1971
+ *
1972
+ * var object = { 'a': 1 };
1973
+ * var other = { 'a': 1 };
1974
+ *
1975
+ * _.eq(object, object);
1976
+ * // => true
1977
+ *
1978
+ * _.eq(object, other);
1979
+ * // => false
1980
+ *
1981
+ * _.eq('a', 'a');
1982
+ * // => true
1983
+ *
1984
+ * _.eq('a', Object('a'));
1985
+ * // => false
1986
+ *
1987
+ * _.eq(NaN, NaN);
1988
+ * // => true
1989
+ */
1990
+ function eq(value, other) {
1991
+ return value === other || value !== value && other !== other;
1992
+ }
1993
+ module.exports = eq;
1994
+ }));
1995
+ //#endregion
1996
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_assocIndexOf.js
1997
+ var require__assocIndexOf = /* @__PURE__ */ __commonJSMin(((exports, module) => {
1998
+ var eq = require_eq();
1999
+ /**
2000
+ * Gets the index at which the `key` is found in `array` of key-value pairs.
2001
+ *
2002
+ * @private
2003
+ * @param {Array} array The array to inspect.
2004
+ * @param {*} key The key to search for.
2005
+ * @returns {number} Returns the index of the matched value, else `-1`.
2006
+ */
2007
+ function assocIndexOf(array, key) {
2008
+ var length = array.length;
2009
+ while (length--) if (eq(array[length][0], key)) return length;
2010
+ return -1;
2011
+ }
2012
+ module.exports = assocIndexOf;
2013
+ }));
2014
+ //#endregion
2015
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_listCacheDelete.js
2016
+ var require__listCacheDelete = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2017
+ var assocIndexOf = require__assocIndexOf();
2018
+ /** Built-in value references. */
2019
+ var splice = Array.prototype.splice;
2020
+ /**
2021
+ * Removes `key` and its value from the list cache.
2022
+ *
2023
+ * @private
2024
+ * @name delete
2025
+ * @memberOf ListCache
2026
+ * @param {string} key The key of the value to remove.
2027
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2028
+ */
2029
+ function listCacheDelete(key) {
2030
+ var data = this.__data__, index = assocIndexOf(data, key);
2031
+ if (index < 0) return false;
2032
+ if (index == data.length - 1) data.pop();
2033
+ else splice.call(data, index, 1);
2034
+ --this.size;
2035
+ return true;
2036
+ }
2037
+ module.exports = listCacheDelete;
2038
+ }));
2039
+ //#endregion
2040
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_listCacheGet.js
2041
+ var require__listCacheGet = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2042
+ var assocIndexOf = require__assocIndexOf();
2043
+ /**
2044
+ * Gets the list cache value for `key`.
2045
+ *
2046
+ * @private
2047
+ * @name get
2048
+ * @memberOf ListCache
2049
+ * @param {string} key The key of the value to get.
2050
+ * @returns {*} Returns the entry value.
2051
+ */
2052
+ function listCacheGet(key) {
2053
+ var data = this.__data__, index = assocIndexOf(data, key);
2054
+ return index < 0 ? void 0 : data[index][1];
2055
+ }
2056
+ module.exports = listCacheGet;
2057
+ }));
2058
+ //#endregion
2059
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_listCacheHas.js
2060
+ var require__listCacheHas = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2061
+ var assocIndexOf = require__assocIndexOf();
2062
+ /**
2063
+ * Checks if a list cache value for `key` exists.
2064
+ *
2065
+ * @private
2066
+ * @name has
2067
+ * @memberOf ListCache
2068
+ * @param {string} key The key of the entry to check.
2069
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2070
+ */
2071
+ function listCacheHas(key) {
2072
+ return assocIndexOf(this.__data__, key) > -1;
2073
+ }
2074
+ module.exports = listCacheHas;
2075
+ }));
2076
+ //#endregion
2077
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_listCacheSet.js
2078
+ var require__listCacheSet = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2079
+ var assocIndexOf = require__assocIndexOf();
2080
+ /**
2081
+ * Sets the list cache `key` to `value`.
2082
+ *
2083
+ * @private
2084
+ * @name set
2085
+ * @memberOf ListCache
2086
+ * @param {string} key The key of the value to set.
2087
+ * @param {*} value The value to set.
2088
+ * @returns {Object} Returns the list cache instance.
2089
+ */
2090
+ function listCacheSet(key, value) {
2091
+ var data = this.__data__, index = assocIndexOf(data, key);
2092
+ if (index < 0) {
2093
+ ++this.size;
2094
+ data.push([key, value]);
2095
+ } else data[index][1] = value;
2096
+ return this;
2097
+ }
2098
+ module.exports = listCacheSet;
2099
+ }));
2100
+ //#endregion
2101
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_ListCache.js
2102
+ var require__ListCache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2103
+ var listCacheClear = require__listCacheClear();
2104
+ var listCacheDelete = require__listCacheDelete();
2105
+ var listCacheGet = require__listCacheGet();
2106
+ var listCacheHas = require__listCacheHas();
2107
+ var listCacheSet = require__listCacheSet();
2108
+ /**
2109
+ * Creates an list cache object.
2110
+ *
2111
+ * @private
2112
+ * @constructor
2113
+ * @param {Array} [entries] The key-value pairs to cache.
2114
+ */
2115
+ function ListCache(entries) {
2116
+ var index = -1, length = entries == null ? 0 : entries.length;
2117
+ this.clear();
2118
+ while (++index < length) {
2119
+ var entry = entries[index];
2120
+ this.set(entry[0], entry[1]);
2121
+ }
2122
+ }
2123
+ ListCache.prototype.clear = listCacheClear;
2124
+ ListCache.prototype["delete"] = listCacheDelete;
2125
+ ListCache.prototype.get = listCacheGet;
2126
+ ListCache.prototype.has = listCacheHas;
2127
+ ListCache.prototype.set = listCacheSet;
2128
+ module.exports = ListCache;
2129
+ }));
2130
+ //#endregion
2131
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_Map.js
2132
+ var require__Map = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2133
+ module.exports = require__getNative()(require__root(), "Map");
2134
+ }));
2135
+ //#endregion
2136
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_mapCacheClear.js
2137
+ var require__mapCacheClear = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2138
+ var Hash = require__Hash();
2139
+ var ListCache = require__ListCache();
2140
+ var Map = require__Map();
2141
+ /**
2142
+ * Removes all key-value entries from the map.
2143
+ *
2144
+ * @private
2145
+ * @name clear
2146
+ * @memberOf MapCache
2147
+ */
2148
+ function mapCacheClear() {
2149
+ this.size = 0;
2150
+ this.__data__ = {
2151
+ "hash": new Hash(),
2152
+ "map": new (Map || ListCache)(),
2153
+ "string": new Hash()
2154
+ };
2155
+ }
2156
+ module.exports = mapCacheClear;
2157
+ }));
2158
+ //#endregion
2159
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_isKeyable.js
2160
+ var require__isKeyable = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2161
+ /**
2162
+ * Checks if `value` is suitable for use as unique object key.
2163
+ *
2164
+ * @private
2165
+ * @param {*} value The value to check.
2166
+ * @returns {boolean} Returns `true` if `value` is suitable, else `false`.
2167
+ */
2168
+ function isKeyable(value) {
2169
+ var type = typeof value;
2170
+ return type == "string" || type == "number" || type == "symbol" || type == "boolean" ? value !== "__proto__" : value === null;
2171
+ }
2172
+ module.exports = isKeyable;
2173
+ }));
2174
+ //#endregion
2175
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_getMapData.js
2176
+ var require__getMapData = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2177
+ var isKeyable = require__isKeyable();
2178
+ /**
2179
+ * Gets the data for `map`.
2180
+ *
2181
+ * @private
2182
+ * @param {Object} map The map to query.
2183
+ * @param {string} key The reference key.
2184
+ * @returns {*} Returns the map data.
2185
+ */
2186
+ function getMapData(map, key) {
2187
+ var data = map.__data__;
2188
+ return isKeyable(key) ? data[typeof key == "string" ? "string" : "hash"] : data.map;
2189
+ }
2190
+ module.exports = getMapData;
2191
+ }));
2192
+ //#endregion
2193
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_mapCacheDelete.js
2194
+ var require__mapCacheDelete = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2195
+ var getMapData = require__getMapData();
2196
+ /**
2197
+ * Removes `key` and its value from the map.
2198
+ *
2199
+ * @private
2200
+ * @name delete
2201
+ * @memberOf MapCache
2202
+ * @param {string} key The key of the value to remove.
2203
+ * @returns {boolean} Returns `true` if the entry was removed, else `false`.
2204
+ */
2205
+ function mapCacheDelete(key) {
2206
+ var result = getMapData(this, key)["delete"](key);
2207
+ this.size -= result ? 1 : 0;
2208
+ return result;
2209
+ }
2210
+ module.exports = mapCacheDelete;
2211
+ }));
2212
+ //#endregion
2213
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_mapCacheGet.js
2214
+ var require__mapCacheGet = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2215
+ var getMapData = require__getMapData();
2216
+ /**
2217
+ * Gets the map value for `key`.
2218
+ *
2219
+ * @private
2220
+ * @name get
2221
+ * @memberOf MapCache
2222
+ * @param {string} key The key of the value to get.
2223
+ * @returns {*} Returns the entry value.
2224
+ */
2225
+ function mapCacheGet(key) {
2226
+ return getMapData(this, key).get(key);
2227
+ }
2228
+ module.exports = mapCacheGet;
2229
+ }));
2230
+ //#endregion
2231
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_mapCacheHas.js
2232
+ var require__mapCacheHas = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2233
+ var getMapData = require__getMapData();
2234
+ /**
2235
+ * Checks if a map value for `key` exists.
2236
+ *
2237
+ * @private
2238
+ * @name has
2239
+ * @memberOf MapCache
2240
+ * @param {string} key The key of the entry to check.
2241
+ * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`.
2242
+ */
2243
+ function mapCacheHas(key) {
2244
+ return getMapData(this, key).has(key);
2245
+ }
2246
+ module.exports = mapCacheHas;
2247
+ }));
2248
+ //#endregion
2249
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_mapCacheSet.js
2250
+ var require__mapCacheSet = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2251
+ var getMapData = require__getMapData();
2252
+ /**
2253
+ * Sets the map `key` to `value`.
2254
+ *
2255
+ * @private
2256
+ * @name set
2257
+ * @memberOf MapCache
2258
+ * @param {string} key The key of the value to set.
2259
+ * @param {*} value The value to set.
2260
+ * @returns {Object} Returns the map cache instance.
2261
+ */
2262
+ function mapCacheSet(key, value) {
2263
+ var data = getMapData(this, key), size = data.size;
2264
+ data.set(key, value);
2265
+ this.size += data.size == size ? 0 : 1;
2266
+ return this;
2267
+ }
2268
+ module.exports = mapCacheSet;
2269
+ }));
2270
+ //#endregion
2271
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_MapCache.js
2272
+ var require__MapCache = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2273
+ var mapCacheClear = require__mapCacheClear();
2274
+ var mapCacheDelete = require__mapCacheDelete();
2275
+ var mapCacheGet = require__mapCacheGet();
2276
+ var mapCacheHas = require__mapCacheHas();
2277
+ var mapCacheSet = require__mapCacheSet();
2278
+ /**
2279
+ * Creates a map cache object to store key-value pairs.
2280
+ *
2281
+ * @private
2282
+ * @constructor
2283
+ * @param {Array} [entries] The key-value pairs to cache.
2284
+ */
2285
+ function MapCache(entries) {
2286
+ var index = -1, length = entries == null ? 0 : entries.length;
2287
+ this.clear();
2288
+ while (++index < length) {
2289
+ var entry = entries[index];
2290
+ this.set(entry[0], entry[1]);
2291
+ }
2292
+ }
2293
+ MapCache.prototype.clear = mapCacheClear;
2294
+ MapCache.prototype["delete"] = mapCacheDelete;
2295
+ MapCache.prototype.get = mapCacheGet;
2296
+ MapCache.prototype.has = mapCacheHas;
2297
+ MapCache.prototype.set = mapCacheSet;
2298
+ module.exports = MapCache;
2299
+ }));
2300
+ //#endregion
2301
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/memoize.js
2302
+ var require_memoize = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2303
+ var MapCache = require__MapCache();
2304
+ /** Error message constants. */
2305
+ var FUNC_ERROR_TEXT = "Expected a function";
2306
+ /**
2307
+ * Creates a function that memoizes the result of `func`. If `resolver` is
2308
+ * provided, it determines the cache key for storing the result based on the
2309
+ * arguments provided to the memoized function. By default, the first argument
2310
+ * provided to the memoized function is used as the map cache key. The `func`
2311
+ * is invoked with the `this` binding of the memoized function.
2312
+ *
2313
+ * **Note:** The cache is exposed as the `cache` property on the memoized
2314
+ * function. Its creation may be customized by replacing the `_.memoize.Cache`
2315
+ * constructor with one whose instances implement the
2316
+ * [`Map`](http://ecma-international.org/ecma-262/7.0/#sec-properties-of-the-map-prototype-object)
2317
+ * method interface of `clear`, `delete`, `get`, `has`, and `set`.
2318
+ *
2319
+ * @static
2320
+ * @memberOf _
2321
+ * @since 0.1.0
2322
+ * @category Function
2323
+ * @param {Function} func The function to have its output memoized.
2324
+ * @param {Function} [resolver] The function to resolve the cache key.
2325
+ * @returns {Function} Returns the new memoized function.
2326
+ * @example
2327
+ *
2328
+ * var object = { 'a': 1, 'b': 2 };
2329
+ * var other = { 'c': 3, 'd': 4 };
2330
+ *
2331
+ * var values = _.memoize(_.values);
2332
+ * values(object);
2333
+ * // => [1, 2]
2334
+ *
2335
+ * values(other);
2336
+ * // => [3, 4]
2337
+ *
2338
+ * object.a = 2;
2339
+ * values(object);
2340
+ * // => [1, 2]
2341
+ *
2342
+ * // Modify the result cache.
2343
+ * values.cache.set(object, ['a', 'b']);
2344
+ * values(object);
2345
+ * // => ['a', 'b']
2346
+ *
2347
+ * // Replace `_.memoize.Cache`.
2348
+ * _.memoize.Cache = WeakMap;
2349
+ */
2350
+ function memoize(func, resolver) {
2351
+ if (typeof func != "function" || resolver != null && typeof resolver != "function") throw new TypeError(FUNC_ERROR_TEXT);
2352
+ var memoized = function() {
2353
+ var args = arguments, key = resolver ? resolver.apply(this, args) : args[0], cache = memoized.cache;
2354
+ if (cache.has(key)) return cache.get(key);
2355
+ var result = func.apply(this, args);
2356
+ memoized.cache = cache.set(key, result) || cache;
2357
+ return result;
2358
+ };
2359
+ memoized.cache = new (memoize.Cache || MapCache)();
2360
+ return memoized;
2361
+ }
2362
+ memoize.Cache = MapCache;
2363
+ module.exports = memoize;
2364
+ }));
2365
+ //#endregion
2366
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_memoizeCapped.js
2367
+ var require__memoizeCapped = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2368
+ var memoize = require_memoize();
2369
+ /** Used as the maximum memoize cache size. */
2370
+ var MAX_MEMOIZE_SIZE = 500;
2371
+ /**
2372
+ * A specialized version of `_.memoize` which clears the memoized function's
2373
+ * cache when it exceeds `MAX_MEMOIZE_SIZE`.
2374
+ *
2375
+ * @private
2376
+ * @param {Function} func The function to have its output memoized.
2377
+ * @returns {Function} Returns the new memoized function.
2378
+ */
2379
+ function memoizeCapped(func) {
2380
+ var result = memoize(func, function(key) {
2381
+ if (cache.size === MAX_MEMOIZE_SIZE) cache.clear();
2382
+ return key;
2383
+ });
2384
+ var cache = result.cache;
2385
+ return result;
2386
+ }
2387
+ module.exports = memoizeCapped;
2388
+ }));
2389
+ //#endregion
2390
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_stringToPath.js
2391
+ var require__stringToPath = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2392
+ var memoizeCapped = require__memoizeCapped();
2393
+ /** Used to match property names within property paths. */
2394
+ var rePropName = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g;
2395
+ /** Used to match backslashes in property paths. */
2396
+ var reEscapeChar = /\\(\\)?/g;
2397
+ module.exports = memoizeCapped(function(string) {
2398
+ var result = [];
2399
+ if (string.charCodeAt(0) === 46) result.push("");
2400
+ string.replace(rePropName, function(match, number, quote, subString) {
2401
+ result.push(quote ? subString.replace(reEscapeChar, "$1") : number || match);
2402
+ });
2403
+ return result;
2404
+ });
2405
+ }));
2406
+ //#endregion
2407
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_arrayMap.js
2408
+ var require__arrayMap = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2409
+ /**
2410
+ * A specialized version of `_.map` for arrays without support for iteratee
2411
+ * shorthands.
2412
+ *
2413
+ * @private
2414
+ * @param {Array} [array] The array to iterate over.
2415
+ * @param {Function} iteratee The function invoked per iteration.
2416
+ * @returns {Array} Returns the new mapped array.
2417
+ */
2418
+ function arrayMap(array, iteratee) {
2419
+ var index = -1, length = array == null ? 0 : array.length, result = Array(length);
2420
+ while (++index < length) result[index] = iteratee(array[index], index, array);
2421
+ return result;
2422
+ }
2423
+ module.exports = arrayMap;
2424
+ }));
2425
+ //#endregion
2426
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseToString.js
2427
+ var require__baseToString = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2428
+ var Symbol = require__Symbol();
2429
+ var arrayMap = require__arrayMap();
2430
+ var isArray = require_isArray();
2431
+ var isSymbol = require_isSymbol();
2432
+ /** Used as references for various `Number` constants. */
2433
+ var INFINITY = Infinity;
2434
+ /** Used to convert symbols to primitives and strings. */
2435
+ var symbolProto = Symbol ? Symbol.prototype : void 0;
2436
+ var symbolToString = symbolProto ? symbolProto.toString : void 0;
2437
+ /**
2438
+ * The base implementation of `_.toString` which doesn't convert nullish
2439
+ * values to empty strings.
2440
+ *
2441
+ * @private
2442
+ * @param {*} value The value to process.
2443
+ * @returns {string} Returns the string.
2444
+ */
2445
+ function baseToString(value) {
2446
+ if (typeof value == "string") return value;
2447
+ if (isArray(value)) return arrayMap(value, baseToString) + "";
2448
+ if (isSymbol(value)) return symbolToString ? symbolToString.call(value) : "";
2449
+ var result = value + "";
2450
+ return result == "0" && 1 / value == -INFINITY ? "-0" : result;
2451
+ }
2452
+ module.exports = baseToString;
2453
+ }));
2454
+ //#endregion
2455
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/toString.js
2456
+ var require_toString = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2457
+ var baseToString = require__baseToString();
2458
+ /**
2459
+ * Converts `value` to a string. An empty string is returned for `null`
2460
+ * and `undefined` values. The sign of `-0` is preserved.
2461
+ *
2462
+ * @static
2463
+ * @memberOf _
2464
+ * @since 4.0.0
2465
+ * @category Lang
2466
+ * @param {*} value The value to convert.
2467
+ * @returns {string} Returns the converted string.
2468
+ * @example
2469
+ *
2470
+ * _.toString(null);
2471
+ * // => ''
2472
+ *
2473
+ * _.toString(-0);
2474
+ * // => '-0'
2475
+ *
2476
+ * _.toString([1, 2, 3]);
2477
+ * // => '1,2,3'
2478
+ */
2479
+ function toString(value) {
2480
+ return value == null ? "" : baseToString(value);
2481
+ }
2482
+ module.exports = toString;
2483
+ }));
2484
+ //#endregion
2485
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_castPath.js
2486
+ var require__castPath = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2487
+ var isArray = require_isArray();
2488
+ var isKey = require__isKey();
2489
+ var stringToPath = require__stringToPath();
2490
+ var toString = require_toString();
2491
+ /**
2492
+ * Casts `value` to a path array if it's not one.
2493
+ *
2494
+ * @private
2495
+ * @param {*} value The value to inspect.
2496
+ * @param {Object} [object] The object to query keys on.
2497
+ * @returns {Array} Returns the cast property path array.
2498
+ */
2499
+ function castPath(value, object) {
2500
+ if (isArray(value)) return value;
2501
+ return isKey(value, object) ? [value] : stringToPath(toString(value));
2502
+ }
2503
+ module.exports = castPath;
2504
+ }));
2505
+ //#endregion
2506
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_toKey.js
2507
+ var require__toKey = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2508
+ var isSymbol = require_isSymbol();
2509
+ /** Used as references for various `Number` constants. */
2510
+ var INFINITY = Infinity;
2511
+ /**
2512
+ * Converts `value` to a string key if it's not a string or symbol.
2513
+ *
2514
+ * @private
2515
+ * @param {*} value The value to inspect.
2516
+ * @returns {string|symbol} Returns the key.
2517
+ */
2518
+ function toKey(value) {
2519
+ if (typeof value == "string" || isSymbol(value)) return value;
2520
+ var result = value + "";
2521
+ return result == "0" && 1 / value == -INFINITY ? "-0" : result;
2522
+ }
2523
+ module.exports = toKey;
2524
+ }));
2525
+ //#endregion
2526
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseGet.js
2527
+ var require__baseGet = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2528
+ var castPath = require__castPath();
2529
+ var toKey = require__toKey();
2530
+ /**
2531
+ * The base implementation of `_.get` without support for default values.
2532
+ *
2533
+ * @private
2534
+ * @param {Object} object The object to query.
2535
+ * @param {Array|string} path The path of the property to get.
2536
+ * @returns {*} Returns the resolved value.
2537
+ */
2538
+ function baseGet(object, path) {
2539
+ path = castPath(path, object);
2540
+ var index = 0, length = path.length;
2541
+ while (object != null && index < length) object = object[toKey(path[index++])];
2542
+ return index && index == length ? object : void 0;
2543
+ }
2544
+ module.exports = baseGet;
2545
+ }));
2546
+ //#endregion
2547
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/get.js
2548
+ var require_get = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2549
+ var baseGet = require__baseGet();
2550
+ /**
2551
+ * Gets the value at `path` of `object`. If the resolved value is
2552
+ * `undefined`, the `defaultValue` is returned in its place.
2553
+ *
2554
+ * @static
2555
+ * @memberOf _
2556
+ * @since 3.7.0
2557
+ * @category Object
2558
+ * @param {Object} object The object to query.
2559
+ * @param {Array|string} path The path of the property to get.
2560
+ * @param {*} [defaultValue] The value returned for `undefined` resolved values.
2561
+ * @returns {*} Returns the resolved value.
2562
+ * @example
2563
+ *
2564
+ * var object = { 'a': [{ 'b': { 'c': 3 } }] };
2565
+ *
2566
+ * _.get(object, 'a[0].b.c');
2567
+ * // => 3
2568
+ *
2569
+ * _.get(object, ['a', '0', 'b', 'c']);
2570
+ * // => 3
2571
+ *
2572
+ * _.get(object, 'a.b.c', 'default');
2573
+ * // => 'default'
2574
+ */
2575
+ function get(object, path, defaultValue) {
2576
+ var result = object == null ? void 0 : baseGet(object, path);
2577
+ return result === void 0 ? defaultValue : result;
2578
+ }
2579
+ module.exports = get;
2580
+ }));
2581
+ //#endregion
2582
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseHas.js
2583
+ var require__baseHas = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2584
+ /** Used to check objects for own properties. */
2585
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
2586
+ /**
2587
+ * The base implementation of `_.has` without support for deep paths.
2588
+ *
2589
+ * @private
2590
+ * @param {Object} [object] The object to query.
2591
+ * @param {Array|string} key The key to check.
2592
+ * @returns {boolean} Returns `true` if `key` exists, else `false`.
2593
+ */
2594
+ function baseHas(object, key) {
2595
+ return object != null && hasOwnProperty.call(object, key);
2596
+ }
2597
+ module.exports = baseHas;
2598
+ }));
2599
+ //#endregion
2600
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseIsArguments.js
2601
+ var require__baseIsArguments = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2602
+ var baseGetTag = require__baseGetTag();
2603
+ var isObjectLike = require_isObjectLike();
2604
+ /** `Object#toString` result references. */
2605
+ var argsTag = "[object Arguments]";
2606
+ /**
2607
+ * The base implementation of `_.isArguments`.
2608
+ *
2609
+ * @private
2610
+ * @param {*} value The value to check.
2611
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
2612
+ */
2613
+ function baseIsArguments(value) {
2614
+ return isObjectLike(value) && baseGetTag(value) == argsTag;
2615
+ }
2616
+ module.exports = baseIsArguments;
2617
+ }));
2618
+ //#endregion
2619
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/isArguments.js
2620
+ var require_isArguments = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2621
+ var baseIsArguments = require__baseIsArguments();
2622
+ var isObjectLike = require_isObjectLike();
2623
+ /** Used for built-in method references. */
2624
+ var objectProto = Object.prototype;
2625
+ /** Used to check objects for own properties. */
2626
+ var hasOwnProperty = objectProto.hasOwnProperty;
2627
+ /** Built-in value references. */
2628
+ var propertyIsEnumerable = objectProto.propertyIsEnumerable;
2629
+ module.exports = baseIsArguments(function() {
2630
+ return arguments;
2631
+ }()) ? baseIsArguments : function(value) {
2632
+ return isObjectLike(value) && hasOwnProperty.call(value, "callee") && !propertyIsEnumerable.call(value, "callee");
2633
+ };
2634
+ }));
2635
+ //#endregion
2636
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_isIndex.js
2637
+ var require__isIndex = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2638
+ /** Used as references for various `Number` constants. */
2639
+ var MAX_SAFE_INTEGER = 9007199254740991;
2640
+ /** Used to detect unsigned integer values. */
2641
+ var reIsUint = /^(?:0|[1-9]\d*)$/;
2642
+ /**
2643
+ * Checks if `value` is a valid array-like index.
2644
+ *
2645
+ * @private
2646
+ * @param {*} value The value to check.
2647
+ * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index.
2648
+ * @returns {boolean} Returns `true` if `value` is a valid index, else `false`.
2649
+ */
2650
+ function isIndex(value, length) {
2651
+ var type = typeof value;
2652
+ length = length == null ? MAX_SAFE_INTEGER : length;
2653
+ return !!length && (type == "number" || type != "symbol" && reIsUint.test(value)) && value > -1 && value % 1 == 0 && value < length;
2654
+ }
2655
+ module.exports = isIndex;
2656
+ }));
2657
+ //#endregion
2658
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/isLength.js
2659
+ var require_isLength = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2660
+ /** Used as references for various `Number` constants. */
2661
+ var MAX_SAFE_INTEGER = 9007199254740991;
2662
+ /**
2663
+ * Checks if `value` is a valid array-like length.
2664
+ *
2665
+ * **Note:** This method is loosely based on
2666
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
2667
+ *
2668
+ * @static
2669
+ * @memberOf _
2670
+ * @since 4.0.0
2671
+ * @category Lang
2672
+ * @param {*} value The value to check.
2673
+ * @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
2674
+ * @example
2675
+ *
2676
+ * _.isLength(3);
2677
+ * // => true
2678
+ *
2679
+ * _.isLength(Number.MIN_VALUE);
2680
+ * // => false
2681
+ *
2682
+ * _.isLength(Infinity);
2683
+ * // => false
2684
+ *
2685
+ * _.isLength('3');
2686
+ * // => false
2687
+ */
2688
+ function isLength(value) {
2689
+ return typeof value == "number" && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER;
2690
+ }
2691
+ module.exports = isLength;
2692
+ }));
2693
+ //#endregion
2694
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_hasPath.js
2695
+ var require__hasPath = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2696
+ var castPath = require__castPath();
2697
+ var isArguments = require_isArguments();
2698
+ var isArray = require_isArray();
2699
+ var isIndex = require__isIndex();
2700
+ var isLength = require_isLength();
2701
+ var toKey = require__toKey();
2702
+ /**
2703
+ * Checks if `path` exists on `object`.
2704
+ *
2705
+ * @private
2706
+ * @param {Object} object The object to query.
2707
+ * @param {Array|string} path The path to check.
2708
+ * @param {Function} hasFunc The function to check properties.
2709
+ * @returns {boolean} Returns `true` if `path` exists, else `false`.
2710
+ */
2711
+ function hasPath(object, path, hasFunc) {
2712
+ path = castPath(path, object);
2713
+ var index = -1, length = path.length, result = false;
2714
+ while (++index < length) {
2715
+ var key = toKey(path[index]);
2716
+ if (!(result = object != null && hasFunc(object, key))) break;
2717
+ object = object[key];
2718
+ }
2719
+ if (result || ++index != length) return result;
2720
+ length = object == null ? 0 : object.length;
2721
+ return !!length && isLength(length) && isIndex(key, length) && (isArray(object) || isArguments(object));
2722
+ }
2723
+ module.exports = hasPath;
2724
+ }));
2725
+ //#endregion
2726
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/has.js
2727
+ var require_has = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2728
+ var baseHas = require__baseHas();
2729
+ var hasPath = require__hasPath();
2730
+ /**
2731
+ * Checks if `path` is a direct property of `object`.
2732
+ *
2733
+ * @static
2734
+ * @since 0.1.0
2735
+ * @memberOf _
2736
+ * @category Object
2737
+ * @param {Object} object The object to query.
2738
+ * @param {Array|string} path The path to check.
2739
+ * @returns {boolean} Returns `true` if `path` exists, else `false`.
2740
+ * @example
2741
+ *
2742
+ * var object = { 'a': { 'b': 2 } };
2743
+ * var other = _.create({ 'a': _.create({ 'b': 2 }) });
2744
+ *
2745
+ * _.has(object, 'a');
2746
+ * // => true
2747
+ *
2748
+ * _.has(object, 'a.b');
2749
+ * // => true
2750
+ *
2751
+ * _.has(object, ['a', 'b']);
2752
+ * // => true
2753
+ *
2754
+ * _.has(other, 'a');
2755
+ * // => false
2756
+ */
2757
+ function has(object, path) {
2758
+ return object != null && hasPath(object, path, baseHas);
2759
+ }
2760
+ module.exports = has;
2761
+ }));
2762
+ //#endregion
2763
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_defineProperty.js
2764
+ var require__defineProperty = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2765
+ var getNative = require__getNative();
2766
+ module.exports = function() {
2767
+ try {
2768
+ var func = getNative(Object, "defineProperty");
2769
+ func({}, "", {});
2770
+ return func;
2771
+ } catch (e) {}
2772
+ }();
2773
+ }));
2774
+ //#endregion
2775
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseAssignValue.js
2776
+ var require__baseAssignValue = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2777
+ var defineProperty = require__defineProperty();
2778
+ /**
2779
+ * The base implementation of `assignValue` and `assignMergeValue` without
2780
+ * value checks.
2781
+ *
2782
+ * @private
2783
+ * @param {Object} object The object to modify.
2784
+ * @param {string} key The key of the property to assign.
2785
+ * @param {*} value The value to assign.
2786
+ */
2787
+ function baseAssignValue(object, key, value) {
2788
+ if (key == "__proto__" && defineProperty) defineProperty(object, key, {
2789
+ "configurable": true,
2790
+ "enumerable": true,
2791
+ "value": value,
2792
+ "writable": true
2793
+ });
2794
+ else object[key] = value;
2795
+ }
2796
+ module.exports = baseAssignValue;
2797
+ }));
2798
+ //#endregion
2799
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_assignValue.js
2800
+ var require__assignValue = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2801
+ var baseAssignValue = require__baseAssignValue();
2802
+ var eq = require_eq();
2803
+ /** Used to check objects for own properties. */
2804
+ var hasOwnProperty = Object.prototype.hasOwnProperty;
2805
+ /**
2806
+ * Assigns `value` to `key` of `object` if the existing value is not equivalent
2807
+ * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero)
2808
+ * for equality comparisons.
2809
+ *
2810
+ * @private
2811
+ * @param {Object} object The object to modify.
2812
+ * @param {string} key The key of the property to assign.
2813
+ * @param {*} value The value to assign.
2814
+ */
2815
+ function assignValue(object, key, value) {
2816
+ var objValue = object[key];
2817
+ if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || value === void 0 && !(key in object)) baseAssignValue(object, key, value);
2818
+ }
2819
+ module.exports = assignValue;
2820
+ }));
2821
+ //#endregion
2822
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/_baseSet.js
2823
+ var require__baseSet = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2824
+ var assignValue = require__assignValue();
2825
+ var castPath = require__castPath();
2826
+ var isIndex = require__isIndex();
2827
+ var isObject = require_isObject();
2828
+ var toKey = require__toKey();
2829
+ /**
2830
+ * The base implementation of `_.set`.
2831
+ *
2832
+ * @private
2833
+ * @param {Object} object The object to modify.
2834
+ * @param {Array|string} path The path of the property to set.
2835
+ * @param {*} value The value to set.
2836
+ * @param {Function} [customizer] The function to customize path creation.
2837
+ * @returns {Object} Returns `object`.
2838
+ */
2839
+ function baseSet(object, path, value, customizer) {
2840
+ if (!isObject(object)) return object;
2841
+ path = castPath(path, object);
2842
+ var index = -1, length = path.length, lastIndex = length - 1, nested = object;
2843
+ while (nested != null && ++index < length) {
2844
+ var key = toKey(path[index]), newValue = value;
2845
+ if (key === "__proto__" || key === "constructor" || key === "prototype") return object;
2846
+ if (index != lastIndex) {
2847
+ var objValue = nested[key];
2848
+ newValue = customizer ? customizer(objValue, key, nested) : void 0;
2849
+ if (newValue === void 0) newValue = isObject(objValue) ? objValue : isIndex(path[index + 1]) ? [] : {};
2850
+ }
2851
+ assignValue(nested, key, newValue);
2852
+ nested = nested[key];
2853
+ }
2854
+ return object;
2855
+ }
2856
+ module.exports = baseSet;
2857
+ }));
2858
+ //#endregion
2859
+ //#region node_modules/.pnpm/lodash@4.18.1/node_modules/lodash/set.js
2860
+ var require_set = /* @__PURE__ */ __commonJSMin(((exports, module) => {
2861
+ var baseSet = require__baseSet();
2862
+ /**
2863
+ * Sets the value at `path` of `object`. If a portion of `path` doesn't exist,
2864
+ * it's created. Arrays are created for missing index properties while objects
2865
+ * are created for all other missing properties. Use `_.setWith` to customize
2866
+ * `path` creation.
2867
+ *
2868
+ * **Note:** This method mutates `object`.
2869
+ *
2870
+ * @static
2871
+ * @memberOf _
2872
+ * @since 3.7.0
2873
+ * @category Object
2874
+ * @param {Object} object The object to modify.
2875
+ * @param {Array|string} path The path of the property to set.
2876
+ * @param {*} value The value to set.
2877
+ * @returns {Object} Returns `object`.
2878
+ * @example
2879
+ *
2880
+ * var object = { 'a': [{ 'b': { 'c': 3 } }] };
2881
+ *
2882
+ * _.set(object, 'a[0].b.c', 4);
2883
+ * console.log(object.a[0].b.c);
2884
+ * // => 4
2885
+ *
2886
+ * _.set(object, ['x', '0', 'y', 'z'], 5);
2887
+ * console.log(object.x[0].y.z);
2888
+ * // => 5
2889
+ */
2890
+ function set(object, path, value) {
2891
+ return object == null ? object : baseSet(object, path, value);
2892
+ }
2893
+ module.exports = set;
2894
+ }));
2895
+ //#endregion
2896
+ //#region node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.27_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/config.service.js
2897
+ var require_config_service = /* @__PURE__ */ __commonJSMin(((exports) => {
2898
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
2899
+ if (k2 === void 0) k2 = k;
2900
+ var desc = Object.getOwnPropertyDescriptor(m, k);
2901
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
2902
+ enumerable: true,
2903
+ get: function() {
2904
+ return m[k];
2905
+ }
2906
+ };
2907
+ Object.defineProperty(o, k2, desc);
2908
+ }) : (function(o, m, k, k2) {
2909
+ if (k2 === void 0) k2 = k;
2910
+ o[k2] = m[k];
2911
+ }));
2912
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
2913
+ Object.defineProperty(o, "default", {
2914
+ enumerable: true,
2915
+ value: v
2916
+ });
2917
+ }) : function(o, v) {
2918
+ o["default"] = v;
2919
+ });
2920
+ var __decorate = exports && exports.__decorate || function(decorators, target, key, desc) {
2921
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
2922
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
2923
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
2924
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
2925
+ };
2926
+ var __importStar = exports && exports.__importStar || (function() {
2927
+ var ownKeys = function(o) {
2928
+ ownKeys = Object.getOwnPropertyNames || function(o) {
2929
+ var ar = [];
2930
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
2931
+ return ar;
2932
+ };
2933
+ return ownKeys(o);
2934
+ };
2935
+ return function(mod) {
2936
+ if (mod && mod.__esModule) return mod;
2937
+ var result = {};
2938
+ if (mod != null) {
2939
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
2940
+ }
2941
+ __setModuleDefault(result, mod);
2942
+ return result;
2943
+ };
2944
+ })();
2945
+ var __metadata = exports && exports.__metadata || function(k, v) {
2946
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
2947
+ };
2948
+ var __param = exports && exports.__param || function(paramIndex, decorator) {
2949
+ return function(target, key) {
2950
+ decorator(target, key, paramIndex);
2951
+ };
2952
+ };
2953
+ var __importDefault = exports && exports.__importDefault || function(mod) {
2954
+ return mod && mod.__esModule ? mod : { "default": mod };
2955
+ };
2956
+ Object.defineProperty(exports, "__esModule", { value: true });
2957
+ exports.ConfigService = void 0;
2958
+ const common_1$3 = require("@nestjs/common");
2959
+ const shared_utils_1$1 = require("@nestjs/common/utils/shared.utils");
2960
+ const dotenv = __importStar(require_main$1());
2961
+ const fs_1 = __importDefault(require("fs"));
2962
+ const get_1 = __importDefault(require_get());
2963
+ const has_1 = __importDefault(require_has());
2964
+ const set_1 = __importDefault(require_set());
2965
+ const rxjs_1 = require("rxjs");
2966
+ const config_constants_1 = require_config_constants();
2967
+ /**
2968
+ * @publicApi
2969
+ */
2970
+ let ConfigService = class ConfigService {
2971
+ set isCacheEnabled(value) {
2972
+ this._isCacheEnabled = value;
2973
+ }
2974
+ get isCacheEnabled() {
2975
+ return this._isCacheEnabled;
2976
+ }
2977
+ set skipProcessEnv(value) {
2978
+ this._skipProcessEnv = value;
2979
+ }
2980
+ get skipProcessEnv() {
2981
+ return this._skipProcessEnv;
2982
+ }
2983
+ constructor(internalConfig = {}) {
2984
+ this.internalConfig = internalConfig;
2985
+ this.cache = {};
2986
+ this._changes$ = new rxjs_1.Subject();
2987
+ this._skipProcessEnv = false;
2988
+ this._isCacheEnabled = false;
2989
+ this.envFilePaths = [];
2990
+ }
2991
+ /**
2992
+ * Returns a stream of configuration changes.
2993
+ * Each event contains the attribute path, the old value and the new value.
2994
+ */
2995
+ get changes$() {
2996
+ return this._changes$.asObservable();
2997
+ }
2998
+ /**
2999
+ * Get a configuration value (either custom configuration or process environment variable)
3000
+ * based on property path (you can use dot notation to traverse nested object, e.g. "database.host").
3001
+ * It returns a default value if the key does not exist.
3002
+ * @param propertyPath
3003
+ * @param defaultValueOrOptions
3004
+ */
3005
+ get(propertyPath, defaultValueOrOptions, options) {
3006
+ const internalValue = this.getFromInternalConfig(propertyPath);
3007
+ if (!(0, shared_utils_1$1.isUndefined)(internalValue)) return internalValue;
3008
+ const validatedEnvValue = this.getFromValidatedEnv(propertyPath);
3009
+ if (!(0, shared_utils_1$1.isUndefined)(validatedEnvValue)) return validatedEnvValue;
3010
+ const defaultValue = this.isGetOptionsObject(defaultValueOrOptions) && !options ? void 0 : defaultValueOrOptions;
3011
+ if (!this._skipProcessEnv) {
3012
+ const processEnvValue = this.getFromProcessEnv(propertyPath, defaultValue);
3013
+ if (!(0, shared_utils_1$1.isUndefined)(processEnvValue)) return processEnvValue;
3014
+ }
3015
+ return defaultValue;
3016
+ }
3017
+ /**
3018
+ * Get a configuration value (either custom configuration or process environment variable)
3019
+ * based on property path (you can use dot notation to traverse nested object, e.g. "database.host").
3020
+ * It returns a default value if the key does not exist.
3021
+ * If the default value is undefined an exception will be thrown.
3022
+ * @param propertyPath
3023
+ * @param defaultValueOrOptions
3024
+ */
3025
+ getOrThrow(propertyPath, defaultValueOrOptions, options) {
3026
+ const value = this.get(propertyPath, defaultValueOrOptions, options);
3027
+ if ((0, shared_utils_1$1.isUndefined)(value)) throw new TypeError(`Configuration key "${propertyPath.toString()}" does not exist`);
3028
+ return value;
3029
+ }
3030
+ /**
3031
+ * Sets a configuration value based on property path.
3032
+ * @param propertyPath
3033
+ * @param value
3034
+ */
3035
+ set(propertyPath, value) {
3036
+ const oldValue = this.get(propertyPath);
3037
+ (0, set_1.default)(this.internalConfig, propertyPath, value);
3038
+ if (typeof propertyPath === "string") {
3039
+ process.env[propertyPath] = String(value);
3040
+ this.updateInterpolatedEnv(propertyPath, String(value));
3041
+ }
3042
+ if (this.isCacheEnabled) this.setInCacheIfDefined(propertyPath, value);
3043
+ this._changes$.next({
3044
+ path: propertyPath,
3045
+ oldValue,
3046
+ newValue: value
3047
+ });
3048
+ }
3049
+ /**
3050
+ * Sets env file paths from `config.module.ts` to parse.
3051
+ * @param paths
3052
+ */
3053
+ setEnvFilePaths(paths) {
3054
+ this.envFilePaths = paths;
3055
+ }
3056
+ getFromCache(propertyPath, defaultValue) {
3057
+ const cachedValue = (0, get_1.default)(this.cache, propertyPath);
3058
+ return (0, shared_utils_1$1.isUndefined)(cachedValue) ? defaultValue : cachedValue;
3059
+ }
3060
+ getFromValidatedEnv(propertyPath) {
3061
+ return (0, get_1.default)(this.internalConfig[config_constants_1.VALIDATED_ENV_PROPNAME], propertyPath);
3062
+ }
3063
+ getFromProcessEnv(propertyPath, defaultValue) {
3064
+ if (this.isCacheEnabled && (0, has_1.default)(this.cache, propertyPath)) {
3065
+ const cachedValue = this.getFromCache(propertyPath, defaultValue);
3066
+ return !(0, shared_utils_1$1.isUndefined)(cachedValue) ? cachedValue : defaultValue;
3067
+ }
3068
+ const processValue = (0, get_1.default)(process.env, propertyPath);
3069
+ this.setInCacheIfDefined(propertyPath, processValue);
3070
+ return processValue;
3071
+ }
3072
+ getFromInternalConfig(propertyPath) {
3073
+ return (0, get_1.default)(this.internalConfig, propertyPath);
3074
+ }
3075
+ setInCacheIfDefined(propertyPath, value) {
3076
+ if (typeof value === "undefined") return;
3077
+ (0, set_1.default)(this.cache, propertyPath, value);
3078
+ }
3079
+ isGetOptionsObject(options) {
3080
+ return options && options?.infer && Object.keys(options).length === 1;
3081
+ }
3082
+ updateInterpolatedEnv(propertyPath, value) {
3083
+ let config = {};
3084
+ for (const envFilePath of this.envFilePaths) if (fs_1.default.existsSync(envFilePath)) config = Object.assign(dotenv.parse(fs_1.default.readFileSync(envFilePath)), config);
3085
+ const regex = new RegExp(`\\$\\{?${propertyPath}\\}?`, "g");
3086
+ for (const [k, v] of Object.entries(config)) if (regex.test(v)) process.env[k] = v.replace(regex, value);
3087
+ }
3088
+ };
3089
+ exports.ConfigService = ConfigService;
3090
+ exports.ConfigService = ConfigService = __decorate([
3091
+ (0, common_1$3.Injectable)(),
3092
+ __param(0, (0, common_1$3.Optional)()),
3093
+ __param(0, (0, common_1$3.Inject)(config_constants_1.CONFIGURATION_TOKEN)),
3094
+ __metadata("design:paramtypes", [Object])
3095
+ ], ConfigService);
3096
+ }));
3097
+ //#endregion
3098
+ //#region node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.27_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/config-host.module.js
3099
+ var require_config_host_module = /* @__PURE__ */ __commonJSMin(((exports) => {
3100
+ var __decorate = exports && exports.__decorate || function(decorators, target, key, desc) {
3101
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3102
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3103
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3104
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
3105
+ };
3106
+ Object.defineProperty(exports, "__esModule", { value: true });
3107
+ exports.ConfigHostModule = void 0;
3108
+ const common_1$2 = require("@nestjs/common");
3109
+ const config_constants_1 = require_config_constants();
3110
+ const config_service_1 = require_config_service();
3111
+ /**
3112
+ * @publicApi
3113
+ */
3114
+ let ConfigHostModule = class ConfigHostModule {};
3115
+ exports.ConfigHostModule = ConfigHostModule;
3116
+ exports.ConfigHostModule = ConfigHostModule = __decorate([(0, common_1$2.Global)(), (0, common_1$2.Module)({
3117
+ providers: [{
3118
+ provide: config_constants_1.CONFIGURATION_TOKEN,
3119
+ useFactory: () => ({})
3120
+ }, {
3121
+ provide: config_constants_1.CONFIGURATION_SERVICE_TOKEN,
3122
+ useClass: config_service_1.ConfigService
3123
+ }],
3124
+ exports: [config_constants_1.CONFIGURATION_TOKEN, config_constants_1.CONFIGURATION_SERVICE_TOKEN]
3125
+ })], ConfigHostModule);
3126
+ }));
3127
+ //#endregion
3128
+ //#region node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.27_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/get-config-token.util.js
3129
+ var require_get_config_token_util = /* @__PURE__ */ __commonJSMin(((exports) => {
3130
+ Object.defineProperty(exports, "__esModule", { value: true });
3131
+ exports.getConfigToken = getConfigToken;
3132
+ /**
3133
+ * @publicApi
3134
+ */
3135
+ function getConfigToken(token) {
3136
+ return `CONFIGURATION(${token.toString()})`;
3137
+ }
3138
+ }));
3139
+ //#endregion
3140
+ //#region node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.27_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/create-config-factory.util.js
3141
+ var require_create_config_factory_util = /* @__PURE__ */ __commonJSMin(((exports) => {
3142
+ Object.defineProperty(exports, "__esModule", { value: true });
3143
+ exports.createConfigProvider = createConfigProvider;
3144
+ const get_config_token_util_1 = require_get_config_token_util();
3145
+ const crypto_1 = require("crypto");
3146
+ /**
3147
+ * @publicApi
3148
+ */
3149
+ function createConfigProvider(factory) {
3150
+ return {
3151
+ provide: factory.KEY || (0, get_config_token_util_1.getConfigToken)((0, crypto_1.randomUUID)()),
3152
+ useFactory: factory,
3153
+ inject: []
3154
+ };
3155
+ }
3156
+ }));
3157
+ //#endregion
3158
+ //#region node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.27_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/get-registration-token.util.js
3159
+ var require_get_registration_token_util = /* @__PURE__ */ __commonJSMin(((exports) => {
3160
+ Object.defineProperty(exports, "__esModule", { value: true });
3161
+ exports.getRegistrationToken = getRegistrationToken;
3162
+ const config_constants_1 = require_config_constants();
3163
+ /**
3164
+ * @publicApi
3165
+ */
3166
+ function getRegistrationToken(config) {
3167
+ return config[config_constants_1.PARTIAL_CONFIGURATION_KEY];
3168
+ }
3169
+ }));
3170
+ //#endregion
3171
+ //#region node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.27_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/merge-configs.util.js
3172
+ var require_merge_configs_util = /* @__PURE__ */ __commonJSMin(((exports) => {
3173
+ var __importDefault = exports && exports.__importDefault || function(mod) {
3174
+ return mod && mod.__esModule ? mod : { "default": mod };
3175
+ };
3176
+ Object.defineProperty(exports, "__esModule", { value: true });
3177
+ exports.mergeConfigObject = mergeConfigObject;
3178
+ const set_1 = __importDefault(require_set());
3179
+ /**
3180
+ * @publicApi
3181
+ */
3182
+ function mergeConfigObject(host, partial, token) {
3183
+ if (token) {
3184
+ (0, set_1.default)(host, token, partial);
3185
+ return partial;
3186
+ }
3187
+ Object.assign(host, partial);
3188
+ }
3189
+ }));
3190
+ //#endregion
3191
+ //#region node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.27_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/config.module.js
3192
+ var require_config_module = /* @__PURE__ */ __commonJSMin(((exports) => {
3193
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
3194
+ if (k2 === void 0) k2 = k;
3195
+ var desc = Object.getOwnPropertyDescriptor(m, k);
3196
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
3197
+ enumerable: true,
3198
+ get: function() {
3199
+ return m[k];
3200
+ }
3201
+ };
3202
+ Object.defineProperty(o, k2, desc);
3203
+ }) : (function(o, m, k, k2) {
3204
+ if (k2 === void 0) k2 = k;
3205
+ o[k2] = m[k];
3206
+ }));
3207
+ var __setModuleDefault = exports && exports.__setModuleDefault || (Object.create ? (function(o, v) {
3208
+ Object.defineProperty(o, "default", {
3209
+ enumerable: true,
3210
+ value: v
3211
+ });
3212
+ }) : function(o, v) {
3213
+ o["default"] = v;
3214
+ });
3215
+ var __decorate = exports && exports.__decorate || function(decorators, target, key, desc) {
3216
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
3217
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
3218
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
3219
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
3220
+ };
3221
+ var __importStar = exports && exports.__importStar || (function() {
3222
+ var ownKeys = function(o) {
3223
+ ownKeys = Object.getOwnPropertyNames || function(o) {
3224
+ var ar = [];
3225
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
3226
+ return ar;
3227
+ };
3228
+ return ownKeys(o);
3229
+ };
3230
+ return function(mod) {
3231
+ if (mod && mod.__esModule) return mod;
3232
+ var result = {};
3233
+ if (mod != null) {
3234
+ for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
3235
+ }
3236
+ __setModuleDefault(result, mod);
3237
+ return result;
3238
+ };
3239
+ })();
3240
+ var ConfigModule_1;
3241
+ Object.defineProperty(exports, "__esModule", { value: true });
3242
+ exports.ConfigModule = void 0;
3243
+ const common_1$1 = require("@nestjs/common");
3244
+ const shared_utils_1 = require("@nestjs/common/utils/shared.utils");
3245
+ const dotenv = __importStar(require_main$1());
3246
+ const dotenv_expand_1 = require_main();
3247
+ const fs = __importStar(require("fs"));
3248
+ const path_1 = require("path");
3249
+ const config_host_module_1 = require_config_host_module();
3250
+ const config_constants_1 = require_config_constants();
3251
+ const config_service_1 = require_config_service();
3252
+ const create_config_factory_util_1 = require_create_config_factory_util();
3253
+ const get_registration_token_util_1 = require_get_registration_token_util();
3254
+ const merge_configs_util_1 = require_merge_configs_util();
3255
+ /**
3256
+ * @publicApi
3257
+ */
3258
+ let ConfigModule = ConfigModule_1 = class ConfigModule {
3259
+ /**
3260
+ * This promise resolves when "dotenv" completes loading environment variables.
3261
+ * When "ignoreEnvFile" is set to true, then it will resolve immediately after the
3262
+ * "ConfigModule#forRoot" method is called.
3263
+ */
3264
+ static get envVariablesLoaded() {
3265
+ return this._envVariablesLoaded;
3266
+ }
3267
+ /**
3268
+ * Loads environment variables based on the "ignoreEnvFile" flag and "envFilePath" value.
3269
+ * Additionally, registers custom configurations globally.
3270
+ * @param options
3271
+ */
3272
+ static async forRoot(options = {}) {
3273
+ const envFilePaths = Array.isArray(options.envFilePath) ? options.envFilePath : [options.envFilePath || (0, path_1.resolve)(process.cwd(), ".env")];
3274
+ let validatedEnvConfig = void 0;
3275
+ let config = options.ignoreEnvFile ? {} : this.loadEnvFile(envFilePaths, options);
3276
+ if (!options.ignoreEnvVars && options.validatePredefined !== false) config = {
3277
+ ...config,
3278
+ ...process.env
3279
+ };
3280
+ if (options.validate) {
3281
+ const validatedConfig = options.validate(config);
3282
+ validatedEnvConfig = validatedConfig;
3283
+ this.assignVariablesToProcess(validatedConfig);
3284
+ } else if (options.validationSchema) {
3285
+ const validationOptions = this.getSchemaValidationOptions(options);
3286
+ const { error, value: validatedConfig } = options.validationSchema.validate(config, validationOptions);
3287
+ if (error) throw new Error(`Config validation error: ${error.message}`);
3288
+ validatedEnvConfig = validatedConfig;
3289
+ this.assignVariablesToProcess(validatedConfig);
3290
+ } else this.assignVariablesToProcess(config);
3291
+ const isConfigToLoad = options.load && options.load.length;
3292
+ const providers = (await Promise.all(options.load || [])).map((factory) => (0, create_config_factory_util_1.createConfigProvider)(factory)).filter((item) => item);
3293
+ const configProviderTokens = providers.map((item) => item.provide);
3294
+ const configServiceProvider = {
3295
+ provide: config_service_1.ConfigService,
3296
+ useFactory: (configService) => {
3297
+ const untypedConfigService = configService;
3298
+ if (options.cache) untypedConfigService.isCacheEnabled = true;
3299
+ if (options.skipProcessEnv) untypedConfigService.skipProcessEnv = true;
3300
+ configService.setEnvFilePaths(envFilePaths);
3301
+ return configService;
3302
+ },
3303
+ inject: [config_constants_1.CONFIGURATION_SERVICE_TOKEN, ...configProviderTokens]
3304
+ };
3305
+ providers.push(configServiceProvider);
3306
+ if (validatedEnvConfig) {
3307
+ const validatedEnvConfigLoader = {
3308
+ provide: config_constants_1.VALIDATED_ENV_LOADER,
3309
+ useFactory: (host) => {
3310
+ host[config_constants_1.VALIDATED_ENV_PROPNAME] = validatedEnvConfig;
3311
+ },
3312
+ inject: [config_constants_1.CONFIGURATION_TOKEN]
3313
+ };
3314
+ providers.push(validatedEnvConfigLoader);
3315
+ }
3316
+ this.environmentVariablesLoadedSignal();
3317
+ return {
3318
+ module: ConfigModule_1,
3319
+ global: options.isGlobal,
3320
+ providers: isConfigToLoad ? [...providers, {
3321
+ provide: config_constants_1.CONFIGURATION_LOADER,
3322
+ useFactory: (host, ...configurations) => {
3323
+ configurations.forEach((item, index) => this.mergePartial(host, item, providers[index]));
3324
+ },
3325
+ inject: [config_constants_1.CONFIGURATION_TOKEN, ...configProviderTokens]
3326
+ }] : providers,
3327
+ exports: [config_service_1.ConfigService, ...configProviderTokens]
3328
+ };
3329
+ }
3330
+ /**
3331
+ * Registers configuration object (partial registration).
3332
+ * @param config
3333
+ */
3334
+ static forFeature(config) {
3335
+ const configProvider = (0, create_config_factory_util_1.createConfigProvider)(config);
3336
+ const serviceProvider = {
3337
+ provide: config_service_1.ConfigService,
3338
+ useFactory: (configService) => configService,
3339
+ inject: [config_constants_1.CONFIGURATION_SERVICE_TOKEN, configProvider.provide]
3340
+ };
3341
+ return {
3342
+ module: ConfigModule_1,
3343
+ providers: [
3344
+ configProvider,
3345
+ serviceProvider,
3346
+ {
3347
+ provide: config_constants_1.CONFIGURATION_LOADER,
3348
+ useFactory: (host, partialConfig) => {
3349
+ this.mergePartial(host, partialConfig, configProvider);
3350
+ },
3351
+ inject: [config_constants_1.CONFIGURATION_TOKEN, configProvider.provide]
3352
+ }
3353
+ ],
3354
+ exports: [config_service_1.ConfigService, configProvider.provide]
3355
+ };
3356
+ }
3357
+ static loadEnvFile(envFilePaths, options) {
3358
+ let config = {};
3359
+ for (const envFilePath of envFilePaths) if (fs.existsSync(envFilePath)) {
3360
+ config = Object.assign(dotenv.parse(fs.readFileSync(envFilePath)), config);
3361
+ if (options.expandVariables) {
3362
+ const expandOptions = typeof options.expandVariables === "object" ? options.expandVariables : {};
3363
+ config = (0, dotenv_expand_1.expand)({
3364
+ ...expandOptions,
3365
+ parsed: config
3366
+ }).parsed || config;
3367
+ }
3368
+ }
3369
+ return config;
3370
+ }
3371
+ static assignVariablesToProcess(config) {
3372
+ if (!(0, shared_utils_1.isObject)(config)) return;
3373
+ Object.keys(config).filter((key) => !(key in process.env)).forEach((key) => {
3374
+ const value = config[key];
3375
+ if (typeof value === "string") process.env[key] = value;
3376
+ else if (typeof value === "boolean" || typeof value === "number") process.env[key] = `${value}`;
3377
+ });
3378
+ }
3379
+ static mergePartial(host, item, provider) {
3380
+ const factoryRef = provider.useFactory;
3381
+ const token = (0, get_registration_token_util_1.getRegistrationToken)(factoryRef);
3382
+ (0, merge_configs_util_1.mergeConfigObject)(host, item, token);
3383
+ }
3384
+ static getSchemaValidationOptions(options) {
3385
+ if (options.validationOptions) {
3386
+ if (typeof options.validationOptions.allowUnknown === "undefined") options.validationOptions.allowUnknown = true;
3387
+ return options.validationOptions;
3388
+ }
3389
+ return {
3390
+ abortEarly: false,
3391
+ allowUnknown: true
3392
+ };
3393
+ }
3394
+ };
3395
+ exports.ConfigModule = ConfigModule;
3396
+ ConfigModule._envVariablesLoaded = new Promise((resolve) => ConfigModule_1.environmentVariablesLoadedSignal = resolve);
3397
+ exports.ConfigModule = ConfigModule = ConfigModule_1 = __decorate([(0, common_1$1.Module)({
3398
+ imports: [config_host_module_1.ConfigHostModule],
3399
+ providers: [{
3400
+ provide: config_service_1.ConfigService,
3401
+ useExisting: config_constants_1.CONFIGURATION_SERVICE_TOKEN
3402
+ }],
3403
+ exports: [config_host_module_1.ConfigHostModule, config_service_1.ConfigService]
3404
+ })], ConfigModule);
3405
+ }));
3406
+ //#endregion
3407
+ //#region node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.27_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/conditional.module.js
3408
+ var require_conditional_module = /* @__PURE__ */ __commonJSMin(((exports) => {
3409
+ Object.defineProperty(exports, "__esModule", { value: true });
3410
+ exports.ConditionalModule = void 0;
3411
+ const common_1 = require("@nestjs/common");
3412
+ const config_module_1 = require_config_module();
3413
+ /**
3414
+ * Same logic as in `@nestjs/core` package.
3415
+ * @param instance The instance which should get the name from
3416
+ * @returns The name of an instance or `undefined`
3417
+ */
3418
+ const getInstanceName = (instance) => {
3419
+ if (instance?.forwardRef) return instance.forwardRef()?.name;
3420
+ if (instance.module) return instance.module?.name;
3421
+ return instance.name;
3422
+ };
3423
+ exports.ConditionalModule = class ConditionalModule {
3424
+ /**
3425
+ * @publicApi
3426
+ */
3427
+ static async registerWhen(module$1, condition, options) {
3428
+ const { timeout = 5e3, debug = true } = options ?? {};
3429
+ const moduleName = getInstanceName(module$1) || module$1.toString();
3430
+ const timer = setTimeout(() => {
3431
+ throw new Error(`Nest was not able to resolve the config variables within ${timeout} milliseconds. Bause of this, the ConditionalModule was not able to determine if ${moduleName} should be registered or not`);
3432
+ }, timeout);
3433
+ timer.unref();
3434
+ const returnModule = {
3435
+ module: ConditionalModule,
3436
+ imports: [],
3437
+ exports: []
3438
+ };
3439
+ if (typeof condition === "string") {
3440
+ const key = condition;
3441
+ condition = (env) => {
3442
+ return env[key]?.toLowerCase() !== "false";
3443
+ };
3444
+ }
3445
+ await config_module_1.ConfigModule.envVariablesLoaded;
3446
+ clearTimeout(timer);
3447
+ if (condition(process.env)) {
3448
+ returnModule.imports.push(module$1);
3449
+ returnModule.exports.push(module$1);
3450
+ } else if (debug) common_1.Logger.debug(`${condition.toString()} evaluated to false. Skipping the registration of ${moduleName}`, ConditionalModule.name);
3451
+ return returnModule;
3452
+ }
3453
+ };
3454
+ }));
3455
+ //#endregion
3456
+ //#region node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.27_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/types/config-object.type.js
3457
+ var require_config_object_type = /* @__PURE__ */ __commonJSMin(((exports) => {
3458
+ Object.defineProperty(exports, "__esModule", { value: true });
3459
+ }));
3460
+ //#endregion
3461
+ //#region node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.27_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/types/config.type.js
3462
+ var require_config_type = /* @__PURE__ */ __commonJSMin(((exports) => {
3463
+ Object.defineProperty(exports, "__esModule", { value: true });
3464
+ }));
3465
+ //#endregion
3466
+ //#region node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.27_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/types/no-infer.type.js
3467
+ var require_no_infer_type = /* @__PURE__ */ __commonJSMin(((exports) => {
3468
+ Object.defineProperty(exports, "__esModule", { value: true });
3469
+ }));
3470
+ //#endregion
3471
+ //#region node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.27_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/types/path-value.type.js
3472
+ var require_path_value_type = /* @__PURE__ */ __commonJSMin(((exports) => {
3473
+ Object.defineProperty(exports, "__esModule", { value: true });
3474
+ }));
3475
+ //#endregion
3476
+ //#region node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.27_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/types/index.js
3477
+ var require_types = /* @__PURE__ */ __commonJSMin(((exports) => {
3478
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
3479
+ if (k2 === void 0) k2 = k;
3480
+ var desc = Object.getOwnPropertyDescriptor(m, k);
3481
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
3482
+ enumerable: true,
3483
+ get: function() {
3484
+ return m[k];
3485
+ }
3486
+ };
3487
+ Object.defineProperty(o, k2, desc);
3488
+ }) : (function(o, m, k, k2) {
3489
+ if (k2 === void 0) k2 = k;
3490
+ o[k2] = m[k];
3491
+ }));
3492
+ var __exportStar = exports && exports.__exportStar || function(m, exports$4) {
3493
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$4, p)) __createBinding(exports$4, m, p);
3494
+ };
3495
+ Object.defineProperty(exports, "__esModule", { value: true });
3496
+ __exportStar(require_config_object_type(), exports);
3497
+ __exportStar(require_config_type(), exports);
3498
+ __exportStar(require_no_infer_type(), exports);
3499
+ __exportStar(require_path_value_type(), exports);
3500
+ }));
3501
+ //#endregion
3502
+ //#region node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.27_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/register-as.util.js
3503
+ var require_register_as_util = /* @__PURE__ */ __commonJSMin(((exports) => {
3504
+ Object.defineProperty(exports, "__esModule", { value: true });
3505
+ exports.registerAs = registerAs;
3506
+ const __1 = require_dist();
3507
+ const config_constants_1 = require_config_constants();
3508
+ const get_config_token_util_1 = require_get_config_token_util();
3509
+ /**
3510
+ * @publicApi
3511
+ *
3512
+ * Registers the configuration object behind a specified token.
3513
+ */
3514
+ function registerAs(token, configFactory) {
3515
+ const defineProperty = (key, value) => {
3516
+ Object.defineProperty(configFactory, key, {
3517
+ configurable: false,
3518
+ enumerable: false,
3519
+ value,
3520
+ writable: false
3521
+ });
3522
+ };
3523
+ defineProperty(config_constants_1.PARTIAL_CONFIGURATION_KEY, token);
3524
+ defineProperty(config_constants_1.PARTIAL_CONFIGURATION_PROPNAME, (0, get_config_token_util_1.getConfigToken)(token));
3525
+ defineProperty(config_constants_1.AS_PROVIDER_METHOD_KEY, () => ({
3526
+ imports: [__1.ConfigModule.forFeature(configFactory)],
3527
+ useFactory: (config) => config,
3528
+ inject: [(0, get_config_token_util_1.getConfigToken)(token)]
3529
+ }));
3530
+ return configFactory;
3531
+ }
3532
+ }));
3533
+ //#endregion
3534
+ //#region node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.27_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/utils/index.js
3535
+ var require_utils = /* @__PURE__ */ __commonJSMin(((exports) => {
3536
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
3537
+ if (k2 === void 0) k2 = k;
3538
+ var desc = Object.getOwnPropertyDescriptor(m, k);
3539
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
3540
+ enumerable: true,
3541
+ get: function() {
3542
+ return m[k];
3543
+ }
3544
+ };
3545
+ Object.defineProperty(o, k2, desc);
3546
+ }) : (function(o, m, k, k2) {
3547
+ if (k2 === void 0) k2 = k;
3548
+ o[k2] = m[k];
3549
+ }));
3550
+ var __exportStar = exports && exports.__exportStar || function(m, exports$3) {
3551
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$3, p)) __createBinding(exports$3, m, p);
3552
+ };
3553
+ Object.defineProperty(exports, "__esModule", { value: true });
3554
+ __exportStar(require_register_as_util(), exports);
3555
+ __exportStar(require_get_config_token_util(), exports);
3556
+ }));
3557
+ //#endregion
3558
+ //#region node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.27_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/interfaces/config-change-event.interface.js
3559
+ var require_config_change_event_interface = /* @__PURE__ */ __commonJSMin(((exports) => {
3560
+ Object.defineProperty(exports, "__esModule", { value: true });
3561
+ }));
3562
+ //#endregion
3563
+ //#region node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.27_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/interfaces/config-factory.interface.js
3564
+ var require_config_factory_interface = /* @__PURE__ */ __commonJSMin(((exports) => {
3565
+ Object.defineProperty(exports, "__esModule", { value: true });
3566
+ }));
3567
+ //#endregion
3568
+ //#region node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.27_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/interfaces/config-module-options.interface.js
3569
+ var require_config_module_options_interface = /* @__PURE__ */ __commonJSMin(((exports) => {
3570
+ Object.defineProperty(exports, "__esModule", { value: true });
3571
+ }));
3572
+ //#endregion
3573
+ //#region node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.27_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/interfaces/index.js
3574
+ var require_interfaces = /* @__PURE__ */ __commonJSMin(((exports) => {
3575
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
3576
+ if (k2 === void 0) k2 = k;
3577
+ var desc = Object.getOwnPropertyDescriptor(m, k);
3578
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
3579
+ enumerable: true,
3580
+ get: function() {
3581
+ return m[k];
3582
+ }
3583
+ };
3584
+ Object.defineProperty(o, k2, desc);
3585
+ }) : (function(o, m, k, k2) {
3586
+ if (k2 === void 0) k2 = k;
3587
+ o[k2] = m[k];
3588
+ }));
3589
+ var __exportStar = exports && exports.__exportStar || function(m, exports$2) {
3590
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$2, p)) __createBinding(exports$2, m, p);
3591
+ };
3592
+ Object.defineProperty(exports, "__esModule", { value: true });
3593
+ __exportStar(require_config_change_event_interface(), exports);
3594
+ __exportStar(require_config_factory_interface(), exports);
3595
+ __exportStar(require_config_module_options_interface(), exports);
3596
+ }));
3597
+ //#endregion
3598
+ //#region node_modules/.pnpm/@nestjs+config@4.0.4_@nestjs+common@11.1.27_reflect-metadata@0.2.2_rxjs@7.8.2_supports-color@8.1.1__rxjs@7.8.2/node_modules/@nestjs/config/dist/index.js
3599
+ var require_dist = /* @__PURE__ */ __commonJSMin(((exports) => {
3600
+ var __createBinding = exports && exports.__createBinding || (Object.create ? (function(o, m, k, k2) {
3601
+ if (k2 === void 0) k2 = k;
3602
+ var desc = Object.getOwnPropertyDescriptor(m, k);
3603
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) desc = {
3604
+ enumerable: true,
3605
+ get: function() {
3606
+ return m[k];
3607
+ }
3608
+ };
3609
+ Object.defineProperty(o, k2, desc);
3610
+ }) : (function(o, m, k, k2) {
3611
+ if (k2 === void 0) k2 = k;
3612
+ o[k2] = m[k];
3613
+ }));
3614
+ var __exportStar = exports && exports.__exportStar || function(m, exports$1) {
3615
+ for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports$1, p)) __createBinding(exports$1, m, p);
3616
+ };
3617
+ Object.defineProperty(exports, "__esModule", { value: true });
3618
+ __exportStar(require_conditional_module(), exports);
3619
+ __exportStar(require_config_module(), exports);
3620
+ __exportStar(require_config_service(), exports);
3621
+ __exportStar(require_types(), exports);
3622
+ __exportStar(require_utils(), exports);
3623
+ __exportStar(require_interfaces(), exports);
3624
+ }));
3625
+ //#endregion
3626
+ //#region src/puppeteer/puppeteer.module.ts
3627
+ var import_config = (/* @__PURE__ */ __commonJSMin(((exports) => {
3628
+ function __export(m) {
3629
+ for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
3630
+ }
3631
+ exports.__esModule = true;
3632
+ __export(require_dist());
3633
+ })))();
3634
+ var _PuppeteerModule;
3635
+ let PuppeteerModule = _PuppeteerModule = class PuppeteerModule {
3636
+ browserService;
3637
+ pdfParams;
3638
+ constructor(browserService, pdfParams) {
3639
+ this.browserService = browserService;
3640
+ this.pdfParams = pdfParams;
3641
+ }
3642
+ async onModuleInit() {
3643
+ if (!this.pdfParams.executablePath) await this.browserService.install(this.pdfParams.useLockedBrowser ?? false);
3644
+ }
3645
+ static forRoot(pdfParameters) {
3646
+ const providers = [
3647
+ {
3648
+ provide: PDF_PARAMETERS,
3649
+ useValue: pdfParameters
3650
+ },
3651
+ {
3652
+ provide: HANDLEBARS_PARAMETERS,
3653
+ useValue: pdfParameters.hbsOptions ?? {}
3654
+ },
3655
+ _gboutte_nestjs_hbs.HandlebarsService,
3656
+ MjmlService,
3657
+ PugService,
3658
+ EjsService,
3659
+ NunjucksService,
3660
+ EtaService,
3661
+ MustacheService
3662
+ ];
3663
+ return {
3664
+ module: _PuppeteerModule,
3665
+ imports: [import_config.ConfigModule.forRoot()],
3666
+ providers,
3667
+ exports: [
3668
+ PuppeteerService,
3669
+ MjmlService,
3670
+ PugService,
3671
+ EjsService,
3672
+ NunjucksService,
3673
+ EtaService,
3674
+ MustacheService
3675
+ ]
3676
+ };
3677
+ }
3678
+ static forRootAsync(options) {
3679
+ const pdfParamsProvider = {
3680
+ provide: PDF_PARAMETERS,
3681
+ inject: options.inject ?? [],
3682
+ useFactory: async (...args) => options.useFactory(...args)
3683
+ };
3684
+ const hbsParamsProvider = {
3685
+ provide: HANDLEBARS_PARAMETERS,
3686
+ inject: [PDF_PARAMETERS],
3687
+ useFactory: (params) => params.hbsOptions ?? {}
3688
+ };
3689
+ return {
3690
+ module: _PuppeteerModule,
3691
+ imports: [...options.imports ?? [], import_config.ConfigModule.forRoot()],
3692
+ providers: [
3693
+ pdfParamsProvider,
3694
+ hbsParamsProvider,
3695
+ PuppeteerService,
3696
+ BrowserService,
3697
+ _gboutte_nestjs_hbs.HandlebarsService,
3698
+ MjmlService,
3699
+ PugService,
3700
+ EjsService,
3701
+ NunjucksService,
3702
+ EtaService,
3703
+ MustacheService
3704
+ ],
3705
+ exports: [
3706
+ PuppeteerService,
3707
+ MjmlService,
3708
+ PugService,
3709
+ EjsService,
3710
+ NunjucksService,
3711
+ EtaService,
3712
+ MustacheService
3713
+ ]
3714
+ };
3715
+ }
3716
+ };
3717
+ PuppeteerModule = _PuppeteerModule = __decorate([
3718
+ (0, _nestjs_common.Module)({
3719
+ providers: [
3720
+ PuppeteerService,
3721
+ BrowserService,
3722
+ MjmlService,
3723
+ PugService,
3724
+ EjsService,
3725
+ NunjucksService,
3726
+ EtaService,
3727
+ MustacheService
3728
+ ],
3729
+ exports: [
3730
+ PuppeteerService,
3731
+ MjmlService,
3732
+ PugService,
3733
+ EjsService,
3734
+ NunjucksService,
3735
+ EtaService,
3736
+ MustacheService
3737
+ ]
3738
+ }),
3739
+ __decorateParam(1, (0, _nestjs_common.Inject)(PDF_PARAMETERS)),
3740
+ __decorateMetadata("design:paramtypes", [typeof BrowserService === "undefined" ? Object : BrowserService, Object])
3741
+ ], PuppeteerModule);
3742
+ //#endregion
3743
+ //#region src/nestjs-pdf.module.ts
3744
+ var _NestjsPdfModule;
3745
+ let NestjsPdfModule = _NestjsPdfModule = class NestjsPdfModule {
3746
+ static forRoot(options) {
3747
+ return {
3748
+ module: _NestjsPdfModule,
3749
+ imports: [PuppeteerModule.forRoot(options)],
3750
+ providers: [NestjsPdfService],
3751
+ exports: [NestjsPdfService]
3752
+ };
3753
+ }
3754
+ static forRootAsync(options) {
3755
+ return {
3756
+ module: _NestjsPdfModule,
3757
+ imports: [PuppeteerModule.forRootAsync(options)],
3758
+ providers: [NestjsPdfService],
3759
+ exports: [NestjsPdfService]
3760
+ };
3761
+ }
3762
+ };
3763
+ NestjsPdfModule = _NestjsPdfModule = __decorate([(0, _nestjs_common.Module)({})], NestjsPdfModule);
3764
+ //#endregion
3765
+ //#region src/helpers/getRelativePath.helper.ts
3766
+ /**
3767
+ * Get the relative path to a value from the module directory.
3768
+ * @param moduleDir the path of the module, typically __dirname
3769
+ * @param relativeToModule the path to the value relative to the module directory
3770
+ * @returns the relative path from the current working directory to the value
3771
+ * @example
3772
+ * getRelativePathToValue(__dirname, './templates/my-template.hbs');
3773
+ * // returns 'context/pdf/templates/my-template.hbs' if the current working directory is '/
3774
+ */
3775
+ function getRelativePathToValue(moduleDir, relativeToModule) {
3776
+ const fullTemplatePath = (0, node_path.resolve)(moduleDir, relativeToModule);
3777
+ return (0, node_path.relative)(process.cwd(), fullTemplatePath);
3778
+ }
3779
+ //#endregion
3780
+ Object.defineProperty(exports, "EjsService", {
3781
+ enumerable: true,
3782
+ get: function() {
3783
+ return EjsService;
3784
+ }
3785
+ });
3786
+ Object.defineProperty(exports, "EtaService", {
3787
+ enumerable: true,
3788
+ get: function() {
3789
+ return EtaService;
3790
+ }
3791
+ });
3792
+ Object.defineProperty(exports, "MjmlService", {
3793
+ enumerable: true,
3794
+ get: function() {
3795
+ return MjmlService;
3796
+ }
3797
+ });
3798
+ Object.defineProperty(exports, "MustacheService", {
3799
+ enumerable: true,
3800
+ get: function() {
3801
+ return MustacheService;
3802
+ }
3803
+ });
3804
+ Object.defineProperty(exports, "NestjsPdfModule", {
3805
+ enumerable: true,
3806
+ get: function() {
3807
+ return NestjsPdfModule;
3808
+ }
3809
+ });
3810
+ Object.defineProperty(exports, "NestjsPdfService", {
3811
+ enumerable: true,
3812
+ get: function() {
3813
+ return NestjsPdfService;
3814
+ }
3815
+ });
3816
+ Object.defineProperty(exports, "NunjucksService", {
3817
+ enumerable: true,
3818
+ get: function() {
3819
+ return NunjucksService;
3820
+ }
3821
+ });
3822
+ Object.defineProperty(exports, "PugService", {
3823
+ enumerable: true,
3824
+ get: function() {
3825
+ return PugService;
3826
+ }
3827
+ });
3828
+ Object.defineProperty(exports, "PuppeteerModule", {
3829
+ enumerable: true,
3830
+ get: function() {
3831
+ return PuppeteerModule;
3832
+ }
3833
+ });
3834
+ Object.defineProperty(exports, "PuppeteerService", {
3835
+ enumerable: true,
3836
+ get: function() {
3837
+ return PuppeteerService;
3838
+ }
3839
+ });
3840
+ exports.getRelativePathToValue = getRelativePathToValue;