@homedev/objector 1.2.40 → 1.2.42

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.d.ts CHANGED
@@ -1,12 +1,53 @@
1
1
  /**
2
+ * Maps an array asynchronously using Promise.all for parallel execution
3
+ * @typeParam T - Type of input array items
4
+ * @typeParam U - Type of async result items
5
+ * @param arr - Array to map
6
+ * @param fn - Async mapping function
7
+ * @returns Promise of mapped array
2
8
  * @public
3
9
  */
4
10
  declare const asyncMap: <T, U>(arr: T[], fn: (item: T, index: number, array: T[]) => Promise<U>) => Promise<U[]>;
5
11
 
12
+ /**
13
+ * Converts a string to camelCase (lowerCamelCase).
14
+ * Handles spaces, underscores, and hyphens as word separators.
15
+ *
16
+ * @example
17
+ * camel('hello_world') // 'helloWorld'
18
+ * camel('hello world') // 'helloWorld'
19
+ * camel('HelloWorld') // 'helloWorld'
20
+ *
21
+ * @param v - The string to convert
22
+ * @returns The string in camelCase
23
+ */
6
24
  declare const camel: (v: string) => string;
7
25
 
26
+ /**
27
+ * Converts a string to Capital Case (each word capitalized, spaces preserved).
28
+ * Only capitalizes words following spaces.
29
+ *
30
+ * @example
31
+ * capital('hello world') // 'Hello World'
32
+ * capital('hello_world') // 'hello_World'
33
+ *
34
+ * @param v - The string to convert
35
+ * @returns The string with each space-separated word capitalized
36
+ */
8
37
  declare const capital: (v: string) => string;
9
38
 
39
+ /**
40
+ * Changes the case of a string to uppercase, lowercase, or returns unchanged.
41
+ *
42
+ * @example
43
+ * changeCase('Hello', 'upper') // 'HELLO'
44
+ * changeCase('Hello', 'lower') // 'hello'
45
+ * changeCase('Hello') // 'Hello'
46
+ *
47
+ * @param v - The string to transform
48
+ * @param arg - The case type: 'upper', 'lower', or undefined to return unchanged
49
+ * @returns The transformed string
50
+ */
10
51
  declare const changeCase: (v: string, arg?: string) => string;
11
52
 
12
53
  /**
@@ -15,11 +56,24 @@ declare const changeCase: (v: string, arg?: string) => string;
15
56
  declare const conditionPredicates: Record<string, (...args: any[]) => boolean>;
16
57
 
17
58
  /**
59
+ * Deep clones an object using structuredClone (faster) with JSON fallback
60
+ * - Uses structuredClone for better performance and broader type support (Date, RegExp, etc.)
61
+ * - Falls back to JSON serialization if structuredClone fails or is unavailable
62
+ * - Note: Functions, symbols, and undefined values are lost in JSON fallback
63
+ * @typeParam T - Type of object to clone
64
+ * @param model - Object to clone
65
+ * @returns Deep clone of the object
18
66
  * @public
19
67
  */
20
- declare const deepClone: (model: any) => any;
68
+ declare const deepClone: <T>(model: T) => T;
21
69
 
22
70
  /**
71
+ * Asserts that a value is defined, throwing an error if undefined
72
+ * @typeParam T - Type of the value
73
+ * @param value - Value to check
74
+ * @param msg - Error message to throw if value is undefined
75
+ * @returns The value if defined
76
+ * @throws Error if value is undefined
23
77
  * @public
24
78
  */
25
79
  declare const defined: <T>(value: T | undefined, msg?: string) => T;
@@ -56,6 +110,12 @@ declare interface FieldProcessorOptions {
56
110
  types?: Record<number, string | any[] | ((value: string, root: any, index: number, quoted: boolean) => any)> | FieldProcessorTypeChecker;
57
111
  }
58
112
 
113
+ declare interface FieldProcessorSection {
114
+ name: string;
115
+ config: Record<string, any>;
116
+ content: string;
117
+ }
118
+
59
119
  declare type FieldProcessorTypeChecker = (n: number, value: any, args: any[]) => any;
60
120
 
61
121
  declare type FieldProcessorTypeCheckers<T = unknown> = Record<keyof T, FieldProcessorTypeChecker>;
@@ -71,12 +131,21 @@ declare interface FilePatternOptions {
71
131
  }
72
132
 
73
133
  /**
134
+ * Finds values in an object tree that match a predicate function.
135
+ *
74
136
  * @public
75
- * @param from
76
- * @param cb
77
- * @returns
137
+ * @param from - The object to search through
138
+ * @param cb - Predicate function that receives the path and value, returns true for matches
139
+ * @returns Array of matching values
140
+ *
141
+ * @example
142
+ * ```typescript
143
+ * const obj = { a: { b: 1 }, c: { d: 2 } }
144
+ * const results = await find(obj, (path, value) => value === 2)
145
+ * // results: [2]
146
+ * ```
78
147
  */
79
- declare const find: (from: any, cb: (path: string, value: string) => any) => Promise<any[]>;
148
+ declare const find: (from: any, cb: (path: string, value: any) => boolean) => Promise<any[]>;
80
149
 
81
150
  declare const globMap: <T>(pattern: string | string[], options: FilePatternOptions) => Promise<T[] | T>;
82
151
 
@@ -104,12 +173,12 @@ declare interface ImportOptions {
104
173
  declare namespace libs {
105
174
  export {
106
175
  conditionPredicates,
107
- deepClone,
108
176
  FieldContext,
109
177
  FieldProcessor,
110
178
  FieldProcessorFunc,
111
179
  FieldProcessorMap,
112
180
  FieldProcessorOptions,
181
+ FieldProcessorSection,
113
182
  FieldProcessorTypeChecker,
114
183
  FieldProcessorTypeCheckers,
115
184
  FieldProcessorTypedFunc,
@@ -144,6 +213,7 @@ declare namespace libs {
144
213
  NavigateContext,
145
214
  NavigateResult,
146
215
  asyncMap,
216
+ deepClone,
147
217
  defined,
148
218
  nonNullMap,
149
219
  sortBy,
@@ -165,9 +235,12 @@ declare namespace libs {
165
235
  }
166
236
  export default libs;
167
237
 
168
- declare interface LoadContext {
238
+ /**
239
+ * @public
240
+ */
241
+ export declare interface LoadContext {
169
242
  included: string[];
170
- document: any;
243
+ document: unknown;
171
244
  }
172
245
 
173
246
  /**
@@ -242,9 +315,20 @@ declare interface MergeOptions {
242
315
  }
243
316
 
244
317
  /**
318
+ * Recursively navigates through an object tree, invoking a callback for each property.
319
+ * Supports various actions like replacing, deleting, or merging values during traversal.
320
+ * Includes circular reference detection to prevent infinite loops.
321
+ *
322
+ * Performance optimizations:
323
+ * - Caches static NavigateResult instances
324
+ * - Uses WeakSet for O(1) circular reference detection
325
+ * - Avoids Object.entries() to prevent array allocations
326
+ * - Optimizes switch statement order for common cases
327
+ *
245
328
  * @public
246
- * @param o
247
- * @param cb
329
+ * @param o - The object to navigate
330
+ * @param cb - Callback function invoked for each property
331
+ * @throws {Error} When attempting to replace the root object
248
332
  */
249
333
  declare const navigate: (o: any, cb: NavigateCallback) => Promise<void>;
250
334
 
@@ -284,9 +368,13 @@ declare interface NavigateContext {
284
368
  declare class NavigateResult {
285
369
  readonly action: NavigateAction;
286
370
  by?: any | undefined;
287
- skipSibilings?: boolean | undefined;
371
+ skipSiblings?: boolean | undefined;
288
372
  reexplore?: boolean | undefined;
289
- constructor(action: NavigateAction, by?: any | undefined, skipSibilings?: boolean | undefined, reexplore?: boolean | undefined);
373
+ constructor(action: NavigateAction, by?: any | undefined, skipSiblings?: boolean | undefined, reexplore?: boolean | undefined);
374
+ private static readonly _explore;
375
+ private static readonly _noExplore;
376
+ private static readonly _skipSiblings;
377
+ private static readonly _deleteParent;
290
378
  static ReplaceParent(by: any, reexplore?: boolean): NavigateResult;
291
379
  static SkipSiblings(): NavigateResult;
292
380
  static Explore(): NavigateResult;
@@ -298,6 +386,13 @@ declare class NavigateResult {
298
386
  }
299
387
 
300
388
  /**
389
+ * Maps an array while filtering out null/undefined values (performance optimized)
390
+ * Combines filter and map operations to avoid double iteration
391
+ * @typeParam T - Type of input array items
392
+ * @typeParam U - Type of mapped result items
393
+ * @param arr - Array to map (can be undefined)
394
+ * @param fn - Mapping function
395
+ * @returns Mapped array with nulls/undefined filtered out, or empty array if input is undefined
301
396
  * @public
302
397
  */
303
398
  declare const nonNullMap: <T, U>(arr: T[] | undefined, fn: (item: T, index: number, array: T[]) => U) => U[];
@@ -306,44 +401,38 @@ declare const nonNullMap: <T, U>(arr: T[] | undefined, fn: (item: T, index: numb
306
401
  * @public
307
402
  */
308
403
  export declare class Objector {
309
- private currentConfig;
310
- private includeDirectories;
311
- private includes;
404
+ private includeManager;
405
+ private includeProcessor;
406
+ private cacheManager;
312
407
  private outputs;
313
408
  private vars;
314
- private cache;
315
409
  private fields;
316
410
  private objectMetadata;
317
- private subDocuments;
318
411
  private currentContext;
412
+ private sections;
319
413
  constructor();
320
414
  use(handler: (o: Objector) => void): this;
321
- config(c: Partial<ObjectorConfig>): this;
322
- getConfig(): ObjectorConfig;
323
415
  includeDirectory(...dirs: string[]): this;
324
416
  getIncludeDirectories(): string[];
325
417
  include(...files: string[]): this;
326
418
  keys(keys: FieldProcessorMap): this;
327
419
  sources(sources: FieldProcessorMap): this;
328
- variables(vars: Record<string, any>): this;
420
+ variables(vars: Record<string, unknown>): this;
329
421
  getOutputs(): Output[];
330
422
  output(o: Output): this;
331
- metadata(path: string, o: any): this;
332
- getMetadata(path: string): any;
333
- getAllMetadata(): Record<string, any>;
334
- subDocument(name: string, value: any): this;
335
- getSubDocument(name: string): any;
423
+ metadata(path: string, o: unknown): this;
424
+ getMetadata(path: string): unknown;
425
+ getAllMetadata(): Record<string, unknown>;
426
+ setCacheMaxSize(size: number): this;
427
+ clearCache(): this;
336
428
  getCurrentContext(): LoadContext | null;
429
+ fieldOptions(options: ProcessFieldsOptions): this;
430
+ section(section: FieldProcessorSection): this;
431
+ getSection(name: string): FieldProcessorSection | undefined;
337
432
  filter(f: RegExp): this;
338
- private docIncludes;
339
433
  loadObject<T = any>(data: T, container?: any, options?: LoadObjectOptions): Promise<T>;
340
- load<T = any>(fileName: string, cwd?: string, container?: any, noProcess?: boolean, ld?: LoadContext): Promise<T | null>;
341
- writeOutputs(options?: WriteOutputsOption, root?: any): Promise<void>;
342
- loadSubDocument(name: string, root?: any, clone?: boolean): Promise<any>;
343
- }
344
-
345
- declare interface ObjectorConfig {
346
- delayedOutputs?: boolean;
434
+ load<T = unknown>(fileName: string, cwd?: string, container?: unknown, noProcess?: boolean, ld?: LoadContext): Promise<T | null>;
435
+ writeAll(option?: WriteOutputsOption): Promise<void>;
347
436
  }
348
437
 
349
438
  declare interface Output {
@@ -353,8 +442,34 @@ declare interface Output {
353
442
  class?: string;
354
443
  }
355
444
 
445
+ /**
446
+ * Adds indentation to each line of a string.
447
+ * Useful for formatting multi-line text with consistent indentation.
448
+ *
449
+ * @example
450
+ * padBlock('hello\\nworld', 2) // ' hello\\n world'
451
+ * padBlock('a|b|c', 1, '|', '-') // '-a|-b|-c'
452
+ *
453
+ * @param str - The string to indent
454
+ * @param indent - The number of padding units to add
455
+ * @param separator - The separator between lines (default: '\\n')
456
+ * @param padder - The character to repeat for padding (default: ' ')
457
+ * @returns The indented string
458
+ */
356
459
  declare const padBlock: (str: string, indent: number, separator?: string, padder?: string) => string;
357
460
 
461
+ /**
462
+ * Converts a string to PascalCase (UpperCamelCase).
463
+ * Handles spaces, underscores, and hyphens as word separators.
464
+ *
465
+ * @example
466
+ * pascal('hello_world') // 'HelloWorld'
467
+ * pascal('hello world') // 'HelloWorld'
468
+ * pascal('helloWorld') // 'HelloWorld'
469
+ *
470
+ * @param v - The string to convert
471
+ * @returns The string in PascalCase
472
+ */
358
473
  declare const pascal: (v: string) => string;
359
474
 
360
475
  /**
@@ -371,28 +486,76 @@ declare interface ProcessFieldsOptions {
371
486
  filters?: RegExp[];
372
487
  root?: Record<any, any>;
373
488
  globalContext?: any;
489
+ onSection?: (section: FieldProcessorSection, path: string, root: Record<string, any>, options: ProcessFieldsOptions) => Promise<void | boolean | string> | void | boolean | string;
374
490
  }
375
491
 
376
492
  /**
493
+ * Selects a value from a nested object using a path string with advanced querying capabilities
494
+ *
495
+ * Supports:
496
+ * - Dot notation: 'user.profile.name'
497
+ * - Array indexing: 'users.0' or 'users[0]'
498
+ * - Array filtering: 'users.[name=John].age'
499
+ * - References: 'users.\{activeUserId\}.name'
500
+ * - Optional paths: 'user.profile?.bio'
501
+ * - Default values: 'config.timeout?=5000'
502
+ *
377
503
  * @public
378
- * @param from
379
- * @param path
380
- * @param set
381
- * @returns
504
+ * @param from - The root object to select from
505
+ * @param path - The path string to navigate
506
+ * @param options - Optional configuration
507
+ * @returns The selected value or undefined
508
+ *
509
+ * @example
510
+ * ```typescript
511
+ * const obj = { user: { name: 'Alice', age: 30 } }
512
+ * select(obj, 'user.name') // 'Alice'
513
+ * select(obj, 'user.email', { defaultValue: 'N/A' }) // 'N/A'
514
+ * ```
382
515
  */
383
516
  declare const select: <T = any>(from: any, path: string, options?: SelectOptions) => T | undefined;
384
517
 
518
+ /**
519
+ * Options for configuring the select function behavior
520
+ * @public
521
+ */
385
522
  declare interface SelectOptions {
523
+ /** Value to set at the selected path */
386
524
  set?: any;
525
+ /** Alternative key to use (currently unused) */
387
526
  key?: string;
527
+ /** Path separator character (default: '.') */
388
528
  separator?: string;
529
+ /** Default value to return when path is not found */
389
530
  defaultValue?: any;
531
+ /** If true, returns undefined instead of throwing on missing paths */
390
532
  optional?: boolean;
391
533
  }
392
534
 
393
- declare const snake: (v: string, separator: string) => string;
535
+ /**
536
+ * Converts a string to snake_case or custom_case.
537
+ * Inserts the separator between lowercase and uppercase characters.
538
+ *
539
+ * @example
540
+ * snake('helloWorld', '_') // 'hello_world'
541
+ * snake('HelloWorld', '-') // 'hello-world'
542
+ * snake('hello world', '_') // 'hello_world'
543
+ *
544
+ * @param v - The string to convert
545
+ * @param separator - The separator to use between words (default: '_')
546
+ * @returns The string in snake case with the specified separator
547
+ */
548
+ declare const snake: (v: string, separator?: string) => string;
394
549
 
395
550
  /**
551
+ * Sorts an array by a selector function with custom comparison
552
+ * Uses a shallow copy to avoid mutating the original array
553
+ * @typeParam T - Type of array items
554
+ * @typeParam U - Type of comparison values
555
+ * @param arr - Array to sort
556
+ * @param selector - Function to extract comparison value from item
557
+ * @param compare - Comparison function (default: numeric comparison)
558
+ * @returns New sorted array
396
559
  * @public
397
560
  */
398
561
  declare const sortBy: <T, U>(arr: T[], selector: (item: T) => U, compare?: (a: U, b: U) => number) => T[];
@@ -431,22 +594,57 @@ declare const splitWithQuotes: (input: string, separator?: string) => {
431
594
  quoted: boolean;
432
595
  }[];
433
596
 
434
- declare const tokenize: (str: string, from: any, tokenizer?: RegExp) => string;
597
+ /**
598
+ * Replaces tokens in a string with values from an object.
599
+ * Tokens are in the format `$\{key\}`.
600
+ *
601
+ * @example
602
+ * tokenize('Hello $\{name\}', { name: 'World' }) // 'Hello World'
603
+ * tokenize('$\{greeting\} $\{name\}!', { greeting: 'Hi', name: 'Alice' }) // 'Hi Alice!'
604
+ * tokenize('$\{missing\}', {}) // ''
605
+ *
606
+ * @param str - The string containing tokens
607
+ * @param from - An object with key-value pairs for token replacement
608
+ * @param tokenizer - The regex pattern for token matching (default: `/\$\{([^}]+)\}/g`)
609
+ * @returns The string with tokens replaced by values from the object
610
+ */
611
+ declare const tokenize: (str: string, from: Record<string, unknown>, tokenizer?: RegExp) => string;
435
612
 
436
613
  /**
614
+ * Converts an object's entries into an array of objects with a key property
615
+ * @typeParam T - The type of items in the resulting array
616
+ * @param from - Object to convert
617
+ * @param key - Property name to use for keys (default: 'name')
618
+ * @returns Array of objects with key properties
619
+ * @example
620
+ * toList({ a: { value: 1 }, b: { value: 2 } }) // [{ name: 'a', value: 1 }, { name: 'b', value: 2 }]
437
621
  * @public
438
622
  */
439
- declare const toList: <T>(from: any, key?: string) => T[];
623
+ declare const toList: <T>(from: Record<string, unknown>, key?: string) => T[];
440
624
 
441
625
  /**
626
+ * Converts an array into an object indexed by a key property, excluding the key from items
627
+ * @typeParam T - The type of the resulting object values
628
+ * @param from - Array to convert
629
+ * @param key - Property name to use as key (default: 'name')
630
+ * @returns Object indexed by key values, without the key property in values
631
+ * @example
632
+ * toObject([{ name: 'a', value: 1 }]) // { a: { value: 1 } }
442
633
  * @public
443
634
  */
444
- declare const toObject: <T>(from: any[], key?: string) => T;
635
+ declare const toObject: <T extends Record<string, unknown>>(from: T[], key?: string) => Record<string, Omit<T, typeof key>>;
445
636
 
446
637
  /**
638
+ * Converts an array into an object indexed by a key property, keeping the full items
639
+ * @typeParam T - The type of the resulting object
640
+ * @param from - Array to convert
641
+ * @param key - Property name to use as key (default: 'name')
642
+ * @returns Object indexed by key values
643
+ * @example
644
+ * toObjectWithKey([{ name: 'a', value: 1 }]) // { a: { name: 'a', value: 1 } }
447
645
  * @public
448
646
  */
449
- declare const toObjectWithKey: <T>(from: any[], key?: string) => T;
647
+ declare const toObjectWithKey: <T extends Record<string, unknown>>(from: T[], key?: string) => Record<string, T>;
450
648
 
451
649
  declare const writeFormat: (filePath: string, content: any, format?: "yaml" | "json" | "text") => Promise<void>;
452
650
 
package/dist/index.js CHANGED
@@ -1,13 +1,13 @@
1
- var at=Object.create;var{getPrototypeOf:it,defineProperty:W,getOwnPropertyNames:re}=Object;var te=Object.prototype.hasOwnProperty,u=(e,r,t)=>{for(let o of re(r))if(!te.call(e,o)&&o!=="default")W(e,o,{get:()=>r[o],enumerable:!0});if(t){for(let o of re(r))if(!te.call(t,o)&&o!=="default")W(t,o,{get:()=>r[o],enumerable:!0});return t}},m=(e,r,t)=>{t=e!=null?at(it(e)):{};let o=r||!e||!e.__esModule?W(t,"default",{value:e,enumerable:!0}):t;for(let n of re(e))if(!te.call(o,n))W(o,n,{get:()=>e[n],enumerable:!0});return o};var I=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var C=(e,r)=>{for(var t in r)W(e,t,{get:r[t],enumerable:!0,configurable:!0,set:(o)=>r[t]=()=>o})};var H=I((no,Oe)=>{var{defineProperty:oe,getOwnPropertyNames:lt,getOwnPropertyDescriptor:ut}=Object,ft=Object.prototype.hasOwnProperty,ke=new WeakMap,pt=(e)=>{var r=ke.get(e),t;if(r)return r;if(r=oe({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function")lt(e).map((o)=>!ft.call(r,o)&&oe(r,o,{get:()=>e[o],enumerable:!(t=ut(e,o))||t.enumerable}));return ke.set(e,r),r},mt=(e,r)=>{for(var t in r)oe(e,t,{get:r[t],enumerable:!0,configurable:!0,set:(o)=>r[t]=()=>o})},Ae={};mt(Ae,{splitWithQuotes:()=>yt,splitNested:()=>ct});Oe.exports=pt(Ae);var ct=(e,r,t="(",o=")")=>{let n=0,s="",i=[];for(let a of e){if(s+=a,a===t)n++;if(a===o)n--;if(n===0&&a===r)i.push(s.slice(0,-1)),s=""}if(s)i.push(s);return i},yt=(e,r=",")=>{let t=[],o=e.length,n=r.length,s=0,i=(a)=>{if(a+n>o)return!1;for(let f=0;f<n;f++)if(e[a+f]!==r[f])return!1;return!0};while(s<o){while(s<o&&e[s]===" ")s++;if(s>=o)break;let a="",f=e[s]==='"'||e[s]==="'";if(f){let c=e[s++];while(s<o&&e[s]!==c)a+=e[s++];if(s<o)s++}else{while(s<o&&!i(s)){let c=e[s];if(c==='"'||c==="'"){a+=c,s++;while(s<o&&e[s]!==c)a+=e[s++];if(s<o)a+=e[s++]}else a+=e[s++]}a=a.trim()}if(a)t.push({value:a,quoted:f});if(i(s))s+=n}return t}});var w=I((so,Ce)=>{var{defineProperty:ne,getOwnPropertyNames:gt,getOwnPropertyDescriptor:dt}=Object,wt=Object.prototype.hasOwnProperty,Me=new WeakMap,bt=(e)=>{var r=Me.get(e),t;if(r)return r;if(r=ne({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function")gt(e).map((o)=>!wt.call(r,o)&&ne(r,o,{get:()=>e[o],enumerable:!(t=dt(e,o))||t.enumerable}));return Me.set(e,r),r},vt=(e,r)=>{for(var t in r)ne(e,t,{get:r[t],enumerable:!0,configurable:!0,set:(o)=>r[t]=()=>o})},$e={};vt($e,{navigate:()=>Ne,find:()=>ht,NavigateResult:()=>k,NavigateAction:()=>Pe});Ce.exports=bt($e);var Pe;((e)=>{e[e.Explore=0]="Explore",e[e.SkipSiblings=1]="SkipSiblings",e[e.NoExplore=2]="NoExplore",e[e.ReplaceParent=3]="ReplaceParent",e[e.DeleteParent=4]="DeleteParent",e[e.MergeParent=5]="MergeParent",e[e.ReplaceItem=6]="ReplaceItem",e[e.DeleteItem=7]="DeleteItem"})(Pe||={});class k{action;by;skipSibilings;reexplore;constructor(e,r,t,o){this.action=e,this.by=r,this.skipSibilings=t,this.reexplore=o}static ReplaceParent(e,r){return new k(3,e,void 0,r)}static SkipSiblings(){return new k(1)}static Explore(){return new k(0)}static NoExplore(){return new k(2)}static DeleteParent(){return new k(4)}static MergeParent(e){return new k(5,e)}static ReplaceItem(e,r){return new k(6,e,r)}static DeleteItem(e){return new k(7,void 0,e)}}var Ne=async(e,r)=>{let t=async(n)=>{let s=n.key===null,i=s?{action:0}:await r(n);if(n.value&&typeof n.value==="object"&&i.action==0){if(!s)n.path.push(n.key),n.parents.push(n.parent);while(await o(n));if(!s)n.parents.pop(),n.path.pop()}return i},o=async(n)=>{for(let[s,i]of Object.entries(n.value)){let a=await t({key:s,value:i,path:n.path,parent:n.value,parents:n.parents});switch(a.action){case 3:if(!n.key)throw Error("Cannot replace root");if(n.parent[n.key]=a.by,a.reexplore)return n.value=a.by,!0;return;case 4:delete n.parent[n.key];return;case 5:delete n.value[s],Object.assign(n.value,a.by);break;case 1:return;case 6:if(n.value[s]=a.by,a.skipSibilings)return;break;case 7:if(delete n.value[s],a.skipSibilings)return;break}}};await t({key:null,value:e,path:[],parent:null,parents:[]})},ht=async(e,r)=>{let t=[];return await Ne(e,(o)=>{if(r([...o.path,o.key].join("."),o.value))t.push(o.value);return k.Explore()}),t}});var b=I((ao,je)=>{var{defineProperty:ae,getOwnPropertyNames:kt,getOwnPropertyDescriptor:At}=Object,Ot=Object.prototype.hasOwnProperty,Re=new WeakMap,Mt=(e)=>{var r=Re.get(e),t;if(r)return r;if(r=ae({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function")kt(e).map((o)=>!Ot.call(r,o)&&ae(r,o,{get:()=>e[o],enumerable:!(t=At(e,o))||t.enumerable}));return Re.set(e,r),r},$t=(e,r)=>{for(var t in r)ae(e,t,{get:r[t],enumerable:!0,configurable:!0,set:(o)=>r[t]=()=>o})},Ee={};$t(Ee,{select:()=>ie});je.exports=Mt(Ee);var Pt=H(),se=(e,r,t,o)=>{if(e.startsWith("{")){let n=e.substring(1,e.length-1);return ie(r,n,t).toString()}return o?e:void 0},Nt=(e,r,t,o)=>{let n=se(r,t,o);if(n)return ie(e,n,o);let s=/^\[([^=\]]*)([=]*)([^\]]*)\]$/.exec(r);if(s){let[a,f,c,p]=s,y=se(f.trim(),t,o,!0),P=se(p.trim(),t,o,!0);if(Array.isArray(e))switch(c){case"==":case"=":return e.find((O)=>O[y]==P)}}let i=/^([^[\]]*)\[([^\]]*)]/.exec(r);if(i)return e[i[1]][i[2]];return e[r]},ie=(e,r,t)=>{let o=void 0,n=void 0;r??="";let s=(p)=>p?.endsWith("?")?[p.substring(0,p.length-1),!0]:[p,!1],i=(p,y)=>{let[P,O]=s(y.pop());if(P){let Y=Nt(p,P,e,t);if(Y===void 0){if(O||t?.defaultValue!==void 0||t?.optional)return;throw Error(`Unknown path element: "${P}" in "${r}"`)}return o=p,n=P,i(Y,y)}if(t?.set&&n)o[n]=t?.set;return p},a=Pt.splitNested(r,t?.separator??".","{","}"),f=a.length>0&&a[a.length-1].startsWith("?=")?a.pop()?.substring(2):void 0;a.reverse();let c=i(e,a);if(c===void 0)return f??t?.defaultValue;return c}});var v=I((io,He)=>{var{defineProperty:le,getOwnPropertyNames:Ct,getOwnPropertyDescriptor:Rt}=Object,Et=Object.prototype.hasOwnProperty,De=new WeakMap,jt=(e)=>{var r=De.get(e),t;if(r)return r;if(r=le({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function")Ct(e).map((o)=>!Et.call(r,o)&&le(r,o,{get:()=>e[o],enumerable:!(t=Rt(e,o))||t.enumerable}));return De.set(e,r),r},Dt=(e,r)=>{for(var t in r)le(e,t,{get:r[t],enumerable:!0,configurable:!0,set:(o)=>r[t]=()=>o})},Te={};Dt(Te,{processFields:()=>Ye,makeFieldProcessorMap:()=>Bt,makeFieldProcessorList:()=>St,makeFieldProcessor:()=>pe,getProcessor:()=>ue,getArgs:()=>Se});He.exports=jt(Te);var Lt=H(),Le=w(),_e=b(),We=(e,r)=>{if(typeof e.value==="string"){if(e.quoted)return e.value;if(e.value.startsWith("[")&&e.value.endsWith("]")){let t=e.value.slice(1,-1);if(t.trim()==="")return[];return t.split(";").map((o)=>{let n=o.trim();if(!isNaN(+n))return+n;return n})}if(e.value.startsWith("{")&&e.value.endsWith("}")){if(e.value.slice(1,-1).trim()==="")return{}}if(e.value==="null")return null;if(e.value==="undefined")return;if(e.value.startsWith("@"))return e.value.slice(1);if(!isNaN(+e.value))return+e.value}return r(e.value)},Q=(e,r,t,o,n,s)=>{let i=o?.(e)??e,a=n(i);if(a[0])return a[1];if(!r){let f=_e.select(t,e),c=n(f);if(c[0])return c[1]}throw Error(s)},Ue=(e,r,t,o,n)=>{let s=typeof e.types==="function"?e.types(o,r.value,n):e.types?.[o];if(!s||s==="ref")return We(r,(a)=>_e.select(t,a));let i=We(r,()=>r.value);if(Array.isArray(s)){if(!s.includes(i))throw Error(`Argument ${o.toString()} must be one of [${s.join(", ")}]: ${i}`);return i}if(typeof s==="string"){if(s.endsWith("?")){let a=s.slice(0,-1);if(r.value==="null")return Le.NavigateResult.ReplaceItem(null);if(r.value==="undefined")return Le.NavigateResult.ReplaceItem(void 0);if(r.value==="")return"";s=a}switch(s){case"any":return i;case"array":return Q(i,r.quoted,t,null,(a)=>[Array.isArray(a),a],`Argument ${o.toString()} must be an array: ${i}`);case"object":return Q(i,r.quoted,t,null,(a)=>[typeof a==="object"&&a!==null,a],`Argument ${o.toString()} must be an object: ${i}`);case"number":return Q(i,r.quoted,t,(a)=>Number(a),(a)=>[!isNaN(a),a],`Argument ${o.toString()} must be a number: ${i}`);case"boolean":return Q(i,r.quoted,t,null,(a)=>{if([!0,"true","1",1,"yes","on"].includes(a))return[!0,!0];if([!1,"false","0",0,"no","off"].includes(a))return[!0,!1];if([null,"null","undefined",void 0,""].includes(a))return[!0,!1];if(Array.isArray(a))return[!0,a.length>0];return[!1,!1]},`Argument ${o.toString()} must be a boolean: ${i}`);case"string":return i.toString();default:throw Error(`Unknown type for argument ${o.toString()}: ${s}`)}}return s(i,t,o,r.quoted)},ue=(e,r)=>{let t=e[r];if(t===void 0)throw Error(`Unhandled field processor type: ${r}`);return typeof t==="function"?{options:{},fn:t}:{options:t,fn:t.fn}},Je=(e)=>!e.quoted&&e.value.startsWith("."),Wt=(e)=>{let r={};for(let t of e){if(!Je(t))continue;let o=t.value.indexOf("="),n=o>-1?t.value.slice(1,o):t.value.slice(1),s=o>-1?t.value.slice(o+1):"";if(s.length>=2){let i=s[0],a=s[s.length-1];if(i==='"'&&a==='"'||i==="'"&&a==="'")s=s.slice(1,-1)}if(!r[n])r[n]=[];r[n].push(s)}return r},Se=(e,r,t)=>{let o=Lt.splitWithQuotes(e??""),n=Wt(o),s=o.filter((a)=>!Je(a)),i=r.options.processArgs===!1?[]:s.map((a,f)=>Ue(r.options,a,t,f,s));return{rawArgs:s,parsedArgs:i,tags:n}},R=w(),Ie=w(),It=(e,r)=>r.keys!==void 0&&e.key.startsWith(".")&&r.keys[e.key.substring(1)]!==void 0,Tt=async(e,r,t,o)=>{let{key:n,parent:s}=e,i=ue(o.keys,n.substring(1));if(i.options.processArgs!==!1&&(typeof i.options.types==="function"||i.options.types?.[0]!==void 0))e.value=Ue(i.options,{value:e.value,quoted:!1},t,0,[]);if(typeof e.value!=="string")await Ye(e.value,{...o,root:{...t,parent:e.parent,parents:e.parents},filters:[...o.filters??[],...i.options.filters??[]]});let a=await i.fn({path:r,root:t,parent:s,key:n,options:o,value:e.value,args:[e.value],rawArgs:[],tags:{}});return a instanceof Ie.NavigateResult?a:Ie.NavigateResult.ReplaceParent(a)},x=w(),_t=b(),Be=(e)=>{let r=[],t=0;while(t<e.length)if(e[t]==="$"&&e[t+1]==="("&&(t===0||e[t-1]!=="\\")){let o=t;t+=2;let n=1;for(;t<e.length;t++)if(e[t]==="(")n++;else if(e[t]===")"){if(n--,n===0){r.push([o,t]);break}}if(n!==0)throw Error(`Unmatched opening $( at position ${o.toString()}`);t++}else t++;return r};class fe{value;constructor(e){this.value=e}}var Ge=async(e,r,t)=>{for(let o=r.length-1;o>=0;o--){let[n,s]=r[o],i=e.slice(n+2,s),a=await Ge(i,Be(i),t);if(typeof a==="object")return a;let f=await t(a,e);if(f instanceof fe)return f.value;e=e.slice(0,n)+f+e.slice(s+1)}return e},Ut=async(e,r)=>Ge(e,Be(e),r),Jt=async(e,r,t,o)=>{let n=await(async()=>{let s=/([\w\d.-_/]+):(.+)/.exec(e);if(!s)return await _t.select(r,e);let[i,a,f]=s,c=ue(o.sources,a),p=Se(f,c,r);return await c.fn({args:p.parsedArgs,rawArgs:p.rawArgs,tags:p.tags,key:a,options:o,root:r,path:t,value:null})})();if(n===null||n===void 0)return"";if(typeof n==="object")return new fe(n);return n},Ke=async(e,r,t,o)=>{let n=await Ut(r,(s)=>Jt(s,t,e,o));if(n instanceof x.NavigateResult)return n;if(n===r)return x.NavigateResult.Explore();if(typeof n==="string"){let s=await Ke(e,n,t,o);if(s.action!==x.NavigateAction.Explore)return s}return x.NavigateResult.ReplaceItem(n)},Ye=async(e,r)=>{return r??={},await R.navigate(e,async(t)=>{let o=[...t.path,t.key].join(".");if(r?.filters?.length&&r.filters.some((a)=>a.test(o)))return R.NavigateResult.NoExplore();let n=t.path.length===0,s=t.parents.length>0?t.parents.toReversed():[];if(n){if(s.length>0)throw Error("Root object should not have a parent");s=r?.root?.parents?[r.root.parent,...r.root.parents.toReversed()]:[]}let i={...e,...r.root,this:t.parent,parent:s.length>0?s[0]:null,parents:s};try{if(t.key.startsWith("$"))return R.NavigateResult.NoExplore();let a=R.NavigateResult.Explore();if(typeof t.value==="string")switch(a=await Ke(o,t.value,i,r),a.action){case R.NavigateAction.Explore:break;case R.NavigateAction.ReplaceItem:t.value=a.by;break;default:return a}if(It(t,r))a=await Tt(t,o,i,r);return a}catch(a){throw Error(`${a.message}
2
- (${o})`)}}),e},pe=(e,r)=>r?{fn:(t)=>e(...t.args),types:r}:(t)=>e(...t.args),St=(e,r)=>Object.fromEntries(e.map((t)=>[t.name,pe(t,r?.types?.[t.name])])),Bt=(e,r)=>Object.fromEntries((r?.keys??Object.keys(e)).map((t)=>[t,pe(e[t],r?.types?.[t])]))});var S=I((an,Wr)=>{var{defineProperty:be,getOwnPropertyNames:Ht,getOwnPropertyDescriptor:Qt}=Object,xt=Object.prototype.hasOwnProperty,jr=new WeakMap,Zt=(e)=>{var r=jr.get(e),t;if(r)return r;if(r=be({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function")Ht(e).map((o)=>!xt.call(r,o)&&be(r,o,{get:()=>e[o],enumerable:!(t=Qt(e,o))||t.enumerable}));return jr.set(e,r),r},Xt=(e,r)=>{for(var t in r)be(e,t,{get:r[t],enumerable:!0,configurable:!0,set:(o)=>r[t]=()=>o})},Dr={};Xt(Dr,{tokenize:()=>ro,snake:()=>qt,pascal:()=>Lr,padBlock:()=>eo,changeCase:()=>zt,capital:()=>Vt,camel:()=>Ft});Wr.exports=Zt(Dr);var Lr=(e)=>e.replace(/((?:[_ ]+)\w|^\w)/g,(r,t)=>t.toUpperCase()).replace(/[_ ]/g,""),Vt=(e)=>e.replace(/((?:[ ]+)\w|^\w)/g,(r,t)=>t.toUpperCase()),Ft=(e)=>Lr(e).replace(/((?:[ ]+\w)|^\w)/g,(r,t)=>t.toLowerCase()),qt=(e,r)=>e.replace(/([a-z])([A-Z])/g,`$1${r}$2`).replace(/\s+/g,r),zt=(e,r)=>{switch(r){case"upper":return e.toUpperCase();case"lower":return e.toLowerCase();default:return e}},eo=(e,r,t=`
3
- `,o=" ")=>{let n=o.repeat(r);return e.split(t).map((s)=>n+s).join(t)},ro=(e,r,t=/\${([^}]+)}/g)=>{return e.replace(t,(o,n)=>r[n]??"")}});var st=m(v(),1);var ze={};C(ze,{writeOutputs:()=>V,writeOutput:()=>ye,writeFormat:()=>ce,locate:()=>E,loadFormat:()=>Z,importList:()=>ge,importGlob:()=>qe,globMap:()=>X,exists:()=>T});import Qe from"fs/promises";import me from"path";import Gt from"path";import Kt from"fs/promises";import Ve from"fs/promises";import xe from"path";import Ze from"path";import Xe from"path";var T=async(e)=>{try{return await Qe.access(e,Qe.constants.R_OK),!0}catch{return!1}},E=async(e,r)=>{let t=!me.isAbsolute(e)&&r?["",...r]:[""];for(let o of t){let n=me.join(o,e);if(await T(n))return me.resolve(n)}throw Error(`File not found: "${e}"`)},Z=async(e,r)=>{let t=await E(e,r?.dirs),o=await Bun.file(t).text(),n=Gt.dirname(t),s={"[.]json$":JSON.parse,"[.](yml|yaml)$":Bun.YAML.parse,"[.]toml$":Bun.TOML.parse,...r?.parsers},i=Object.entries(s).find((a)=>t.match(a[0]));if(!i)throw Error(`Unhandled file type: ${e}`);return{content:i[1](o),fullPath:t,folderPath:n}},ce=async(e,r,t="text")=>{switch(t){case"yaml":await Bun.write(e,Bun.YAML.stringify(r));break;case"json":await Bun.write(e,JSON.stringify(r));break;case"text":default:await Bun.write(e,r.toString())}},X=async(e,r)=>{if(typeof e==="string"&&!e.includes("*"))return await r.map(e,0,[]);let t=await Array.fromAsync(Kt.glob(e,{cwd:r.cwd})),o=r.filter?t.filter(r.filter):t;return await Promise.all(o.map(r.map))},V=async(e,r)=>{if(r?.targetDirectory&&r?.removeFirst)try{await Ve.rm(r?.targetDirectory,{recursive:!0,force:!0})}catch(t){throw Error(`Failed to clean the output directory: ${t.message}`)}for(let t of e)await ye(t,r)},ye=async(e,r)=>{let t=xe.join(r?.targetDirectory??".",e.name),o=xe.dirname(t);if(r?.classes){if(e.class!==void 0&&!r.classes.includes(e.class))return;if(r.classRequired&&e.class===void 0)throw Error(`Output "${e.name}" is missing class field`)}if(r?.writing?.(e)===!1)return;try{await Ve.mkdir(o,{recursive:!0})}catch(n){throw Error(`Failed to create target directory "${o}" for output "${t}": ${n.message}`)}try{await ce(t,e.value,e.type??"text")}catch(n){throw Error(`Failed to write output "${t}": ${n.message}`)}},Fe=(e)=>e?Xe.isAbsolute(e)?e:Xe.join(process.cwd(),e):process.cwd(),ge=async(e,r)=>{let t=[];for(let o of e)try{let n=!Ze.isAbsolute(o)?Ze.join(Fe(r?.cwd),o):o;if(r?.filter?.(n)===!1)continue;let s=await import(n);if(r?.resolveDefault==="only"&&!s.default)throw Error(`Module ${o} does not have a default export`);let i=r?.resolveDefault?s.default??s:s,a=r?.map?await r.map(i,o):i;if(a!==void 0)t.push(a)}catch(n){if(r?.fail?.(o,n)===!1)continue;throw Error(`Failed to import module ${o}: ${n.message??n}`)}return t},qe=async(e,r)=>{let t=[];for(let o of e){let n=await Array.fromAsync(new Bun.Glob(o).scan({cwd:Fe(r?.cwd),absolute:!0}));t.push(...await ge(n,r))}return t};var er={};C(er,{mergeAll:()=>_,merge:()=>M});var M=(e,r,t)=>{for(let o of Object.keys(r)){if(e[o]===void 0)continue;let n=r[o],s=e[o];if(typeof s!==typeof n||Array.isArray(s)!==Array.isArray(n)){let a=t?.mismatch?.(o,s,n,e,r);if(a!==void 0){r[o]=a;continue}throw Error(`Type mismatch: ${o}`)}let i=t?.mode?.(o,s,n,e,r)??r[".merge"]??"merge";switch(i){case"source":r[o]=s;continue;case"target":continue;case"skip":delete r[o],delete e[o];continue;case"merge":break;default:throw Error(`Unknown merge mode: ${i}`)}if(typeof s==="object")if(Array.isArray(s))n.push(...s);else{if(t?.navigate?.(o,s,n,e,r)===!1)continue;M(s,n,t)}else{if(s===n)continue;let a=t?.conflict?.(o,s,n,e,r);r[o]=a===void 0?n:a}}for(let o of Object.keys(e))if(r[o]===void 0)r[o]=e[o]},_=(e,r)=>{let t={};for(let o of e.toReversed())M(o,t,r);return t};import z from"path";var rr=m(w(),1),tr=(e)=>({output:(r)=>{let t=(o)=>{if(e.getConfig().delayedOutputs)e.subDocument(`output.${o.name}`,o);else e.output(o)};delete r.parent[r.key];for(let o of Array.isArray(r.value)?r.value:[r.value])if(typeof o==="string")t({name:o,value:r.parent});else t({...o,value:o.value??r.parent.value});return rr.NavigateResult.SkipSiblings()}});var or=m(w(),1);import Yt from"path";var nr=(e)=>({load:async(r)=>{let t=r.options.globalContext;for(let{file:o}of Array.isArray(r.value)?r.value:[r.value]){if(!o)throw Error("File reference required");await e.load(o,t.file&&Yt.dirname(t.file))}return or.NavigateResult.DeleteItem()}});var cr=m(v(),1);var sr=m(b(),1),ar=(e)=>{if(typeof e.value==="string")return e.parent;let r=e.value.model;if(!r)return e.parent;if(typeof r==="string")return sr.select(e.root,r);return r};var de=m(b(),1),ir=(e)=>{if(typeof e.value==="string")return de.select(e.root,e.value);if(Array.isArray(e.value))return e.value;let r=e.value;if(typeof r.from==="string")return de.select(e.root,r.from);return r.from};var lr=m(v(),1),ur=m(b(),1),fr=async(e,r)=>{let t=e.value;if(t.selector===void 0)return r;if(typeof t.selector!=="string"){let o=JSON.parse(JSON.stringify(t.selector));return await lr.processFields(o,{...e.options,root:{...e.root,result:r}}),o}return await ur.select({...e.root,result:r},t.selector)};var pr={};C(pr,{deepClone:()=>h});var h=(e)=>globalThis.structuredClone!==void 0?structuredClone(e):JSON.parse(JSON.stringify(e));var mr={};C(mr,{conditionPredicatesTypes:()=>U,conditionPredicates:()=>A});var A={and:(...e)=>e.every((r)=>!!r),or:(...e)=>e.some((r)=>!!r),xor:(...e)=>e.filter((r)=>!!r).length===1,true:(...e)=>e.every((r)=>!!r),false:(...e)=>e.every((r)=>!r),eq:(...e)=>e.every((r)=>r===e[0]),ne:(...e)=>e.some((r)=>r!==e[0]),lt:(...e)=>typeof e[0]==="number"&&e.slice(1).every((r)=>typeof r==="number"&&e[0]<r),le:(...e)=>typeof e[0]==="number"&&e.slice(1).every((r)=>typeof r==="number"&&e[0]<=r),gt:(...e)=>typeof e[0]==="number"&&e.slice(1).every((r)=>typeof r==="number"&&e[0]>r),ge:(...e)=>typeof e[0]==="number"&&e.slice(1).every((r)=>typeof r==="number"&&e[0]>=r),in:(e,r)=>{if(Array.isArray(r))return r.includes(e);if(typeof e==="string")return e.includes(r);if(Array.isArray(e))return e.includes(r);return!1},notin:(e,r)=>!A.in(e,r),contains:(e,r)=>e.includes(r),notcontains:(e,r)=>!e.includes(r),containsi:(e,r)=>e.toLowerCase().includes(r.toLowerCase()),notcontainsi:(e,r)=>!e.toLowerCase().includes(r.toLowerCase()),null:(...e)=>e.every((r)=>r===null||r===void 0),notnull:(...e)=>e.every((r)=>r!==null&&r!==void 0),empty:(...e)=>e.every((r)=>r===""),notempty:(...e)=>e.every((r)=>r!==""),nullorempty:(...e)=>e.every((r)=>r===null||r===void 0||r===""),notnullorempty:(...e)=>e.every((r)=>r!==null&&r!==void 0&&r!=="")},U={and:()=>"boolean",or:()=>"boolean",xor:()=>"boolean",true:()=>"boolean",false:()=>"boolean",lt:()=>"number",le:()=>"number",gt:()=>"number",ge:()=>"number"};var yr=()=>({each:{filters:[/select|model/],fn:async(e)=>{let r=e.value;delete e.parent[e.key];let t=await ir(e),o=await ar(e);if(!Array.isArray(t))throw Error('Key "each" requires a source list');if(o===void 0)throw Error('Key "each" must define a model');if(r.extend?.model)o=_([r.model,...Array.isArray(r.extend.model)?r.extend.model:[r.extend.model]]);let n=[];for(let s=0;s<t.length;s++){let i=h(o);if(await cr.processFields(i,{...e.options,root:{...e.root,index:s,item:t[s],instance:i}}),r.extend?.result){let a=r.extend.result;i=_([i,...Array.isArray(a)?a:[a]])}n.push(await fr(e,i))}return n}}});var gr=m(b(),1),dr=()=>({concat:async(e)=>{let r=[];for(let t of Array.isArray(e.value)?e.value:[e.value])r.push(...await gr.select(e.root,t));return r.filter((t)=>t!==void 0)}});var wr=m(v(),1);var we=m(w(),1),br=m(b(),1);var vr=()=>({extends:async(e)=>{let r=async(t,o)=>{for(let n of Array.isArray(o)?o:[o]){let s=await br.select(e.root,n),i=h(s);if(i[e.key])await r(i,i[e.key]);await wr.processFields(i,{...e.options}),M(i,t),delete t[e.key]}};return await r(e.parent,e.value),we.NavigateResult.Explore()},group:(e)=>{let r=e.root.parent,t=e.value,{items:o,...n}=t;return t.items.forEach((s)=>r.push({...n,...s})),we.NavigateResult.DeleteParent()}});var hr=m(v(),1),$=m(w(),1),kr=(e)=>({skip:{types:{0:"boolean"},fn:(r)=>r.value?$.NavigateResult.DeleteParent():$.NavigateResult.DeleteItem()},metadata:({path:r,value:t})=>{return e.metadata(r,t),$.NavigateResult.DeleteItem()},if:{types:{0:"boolean"},fn:async(r)=>{let t=r.parent[".then"],o=r.parent[".else"];if(t!==void 0)delete r.parent[".then"];if(o!==void 0)delete r.parent[".else"];let n=r.value?t:o;if(n===void 0)return $.NavigateResult.DeleteItem();if(typeof n==="string")return(await hr.processFields({value:n},{...r.options,root:{...r.root}})).value;return $.NavigateResult.ReplaceParent(n,!0)}},switch:(r)=>{let t=r.value;if(!t.cases)throw Error("Missing cases for switch");if(t.cases[t.from]!==void 0)return $.NavigateResult.ReplaceParent(t.cases[t.from],!0);if(t.default!==void 0)return $.NavigateResult.ReplaceParent(t.default,!0);return $.NavigateResult.DeleteParent()},subDocument:(r)=>{return e.subDocument(r.value,r.parent),delete r.parent[r.key],$.NavigateResult.DeleteParent()}});var Ar=m(b(),1),Or=()=>({from:async({root:e,parent:r,value:t})=>{let o=await Ar.select(e,t);if(o===null||o===void 0)throw Error(`Unable to resolve reference: ${t}`);if(r.content){if(Array.isArray(r.content)&&Array.isArray(o))return[...o,...r.content];return M(o,r.content),r.content}return o}});var $r=m(w(),1);import Mr from"node:vm";var Pr=(e)=>({modules:async(r)=>{for(let[t,o]of Object.entries(r.value)){let n=Mr.createContext({console,objector:e,document:r.root}),s=new Mr.SourceTextModule(o,{identifier:t,context:n});await s.link((i)=>{throw Error(`Module ${i} is not allowed`)}),await s.evaluate(),e.sources(Object.fromEntries(Object.entries(s.namespace).map(([i,a])=>[`${t}.${i}`,(f)=>a(f,...f.args)])))}return $r.NavigateResult.DeleteItem()}});import Nr from"fs/promises";import J from"path";var Cr=(e)=>({include:async(r)=>{let{file:t}=r.options.globalContext;return await X(r.args[0],{cwd:J.dirname(t),filter:(o)=>J.basename(t)!==o,map:async(o)=>e.load(o,J.dirname(t),{parent:r.root})})},exists:async({args:[r]})=>await T(r),file:async(r)=>await Nr.readFile(await E(r.args[0],e.getIncludeDirectories())).then((t)=>t.toString()),scan:async(r)=>{let t=[],n=(()=>{let a=r.args[2]??["**/node_modules/**"],f=typeof a==="string"?a.split(",").map((c)=>c.trim()):a;if(!Array.isArray(f))throw Error("Scan exclusion must be a list");return f})(),{file:s}=r.options.globalContext,i=r.args[1]?await E(r.args[1],e.getIncludeDirectories()):J.dirname(s);for await(let a of Nr.glob(r.args[0],{cwd:i,exclude:(f)=>n.some((c)=>J.matchesGlob(f,c))}))t.push(a);return t}});var Rr=m(v(),1),Er=()=>Rr.makeFieldProcessorMap({env:(e)=>process.env[e]});var Ir=m(v(),1),d=m(S(),1);var F=(e,r=0,t)=>{let o=" ".repeat(r),n=" ".repeat(r+1);if(e===null||e===void 0)return"null";else if(typeof e==="boolean")return String(e);else if(typeof e==="number")return String(e);else if(typeof e==="string")return`"${e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}"`;else if(Array.isArray(e)){if(e.length===0)return"[]";return`[
4
- ${e.map((i)=>`${n}${F(i,r+1)},`).join(`
1
+ var Mr=Object.create;var{getPrototypeOf:jr,defineProperty:U,getOwnPropertyNames:ae}=Object;var le=Object.prototype.hasOwnProperty,M=(e,r,t)=>{for(let o of ae(r))if(!le.call(e,o)&&o!=="default")U(e,o,{get:()=>r[o],enumerable:!0});if(t){for(let o of ae(r))if(!le.call(t,o)&&o!=="default")U(t,o,{get:()=>r[o],enumerable:!0});return t}},Nr=(e,r,t)=>{t=e!=null?Mr(jr(e)):{};let o=r||!e||!e.__esModule?U(t,"default",{value:e,enumerable:!0}):t;for(let i of ae(e))if(!le.call(o,i))U(o,i,{get:()=>e[i],enumerable:!0});return o};var Wr=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports);var W=(e,r)=>{for(var t in r)U(e,t,{get:r[t],enumerable:!0,configurable:!0,set:(o)=>r[t]=()=>o})};var _r=Wr((ri,Fr)=>{var{defineProperty:Ee,getOwnPropertyNames:Ot,getOwnPropertyDescriptor:At}=Object,$t=Object.prototype.hasOwnProperty,$r=new WeakMap,St=(e)=>{var r=$r.get(e),t;if(r)return r;if(r=Ee({},"__esModule",{value:!0}),e&&typeof e==="object"||typeof e==="function")Ot(e).map((o)=>!$t.call(r,o)&&Ee(r,o,{get:()=>e[o],enumerable:!(t=At(e,o))||t.enumerable}));return $r.set(e,r),r},Ft=(e,r)=>{for(var t in r)Ee(e,t,{get:r[t],enumerable:!0,configurable:!0,set:(o)=>r[t]=()=>o})},Sr={};Ft(Sr,{splitWithQuotes:()=>Mt,splitNested:()=>_t});Fr.exports=St(Sr);var _t=(e,r,t="(",o=")")=>{let i=0,n="",a=[];for(let s of e){if(n+=s,s===t)i++;if(s===o)i--;if(i===0&&s===r)a.push(n.slice(0,-1)),n=""}if(n)a.push(n);return a},Mt=(e,r=",")=>{let t=[],o=e.length,i=r.length,n=0,a=(s)=>{if(s+i>o)return!1;for(let u=0;u<i;u++)if(e[s+u]!==r[u])return!1;return!0};while(n<o){while(n<o&&e[n]===" ")n++;if(n>=o)break;let s="",u=e[n]==='"'||e[n]==="'";if(u){let m=e[n++];while(n<o&&e[n]!==m)s+=e[n++];if(n<o)n++}else{while(n<o&&!a(n)){let m=e[n];if(m==='"'||m==="'"){s+=m,n++;while(n<o&&e[n]!==m)s+=e[n++];if(n<o)s+=e[n++]}else s+=e[n++]}s=s.trim()}if(s)t.push({value:s,quoted:u});if(a(n))n+=i}return t}});var We={};W(We,{processFields:()=>$,makeFieldProcessorMap:()=>F,makeFieldProcessorList:()=>Ne,makeFieldProcessor:()=>z,getProcessor:()=>q,getArgs:()=>pe});var Cr=Object.create,{getPrototypeOf:Rr,defineProperty:Oe,getOwnPropertyNames:xr}=Object,Lr=Object.prototype.hasOwnProperty,Ir=(e,r,t)=>{t=e!=null?Cr(Rr(e)):{};let o=r||!e||!e.__esModule?Oe(t,"default",{value:e,enumerable:!0}):t;for(let i of xr(e))if(!Lr.call(o,i))Oe(o,i,{get:()=>e[i],enumerable:!0});return o},Ur=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Dr=Ur((e,r)=>{var{defineProperty:t,getOwnPropertyNames:o,getOwnPropertyDescriptor:i}=Object,n=Object.prototype.hasOwnProperty,a=new WeakMap,s=(l)=>{var c=a.get(l),b;if(c)return c;if(c=t({},"__esModule",{value:!0}),l&&typeof l==="object"||typeof l==="function")o(l).map((p)=>!n.call(c,p)&&t(c,p,{get:()=>l[p],enumerable:!(b=i(l,p))||b.enumerable}));return a.set(l,c),c},u=(l,c)=>{for(var b in c)t(l,b,{get:c[b],enumerable:!0,configurable:!0,set:(p)=>c[b]=()=>p})},m={};u(m,{splitWithQuotes:()=>g,splitNested:()=>y}),r.exports=s(m);var y=(l,c,b="(",p=")")=>{let d=0,f="",k=[];for(let w of l){if(f+=w,w===b)d++;if(w===p)d--;if(d===0&&w===c)k.push(f.slice(0,-1)),f=""}if(f)k.push(f);return k},g=(l,c=",")=>{let b=[],p=l.length,d=c.length,f=0,k=(w)=>{if(w+d>p)return!1;for(let E=0;E<d;E++)if(l[w+E]!==c[E])return!1;return!0};while(f<p){while(f<p&&l[f]===" ")f++;if(f>=p)break;let w="",E=l[f]==='"'||l[f]==="'";if(E){let A=l[f++];while(f<p&&l[f]!==A)w+=l[f++];if(f<p)f++}else{while(f<p&&!k(f)){let A=l[f];if(A==='"'||A==="'"){w+=A,f++;while(f<p&&l[f]!==A)w+=l[f++];if(f<p)w+=l[f++]}else w+=l[f++]}w=w.trim()}if(w)b.push({value:w,quoted:E});if(k(f))f+=d}return b}}),Br=Ir(Dr(),1),H;((e)=>{e[e.Explore=0]="Explore",e[e.SkipSiblings=1]="SkipSiblings",e[e.NoExplore=2]="NoExplore",e[e.ReplaceParent=3]="ReplaceParent",e[e.DeleteParent=4]="DeleteParent",e[e.MergeParent=5]="MergeParent",e[e.ReplaceItem=6]="ReplaceItem",e[e.DeleteItem=7]="DeleteItem"})(H||={});class O{action;by;skipSiblings;reexplore;constructor(e,r,t,o){this.action=e,this.by=r,this.skipSiblings=t,this.reexplore=o}static _explore=new O(0);static _noExplore=new O(2);static _skipSiblings=new O(1);static _deleteParent=new O(4);static ReplaceParent(e,r){return new O(3,e,void 0,r)}static SkipSiblings(){return O._skipSiblings}static Explore(){return O._explore}static NoExplore(){return O._noExplore}static DeleteParent(){return O._deleteParent}static MergeParent(e){return new O(5,e)}static ReplaceItem(e,r){return new O(6,e,r)}static DeleteItem(e){return new O(7,void 0,e)}}var Jr=async(e,r)=>{let t=new WeakSet,o=[],i=[],n=async(s,u,m)=>{let y=s===null,g=y?O.Explore():await r({key:s,value:u,path:o,parent:m,parents:i});if(u&&typeof u==="object"&&g.action===0){if(t.has(u))return g;if(t.add(u),!y)o.push(s),i.push(m);let l=u;while(await a(l,s,m))l=m[s];if(!y)i.pop(),o.pop()}return g},a=async(s,u,m)=>{let y=Object.keys(s),g=y.length;for(let l=0;l<g;l++){let c=y[l],b=s[c],p=await n(c,b,s),d=p.action;if(d===0||d===2)continue;if(d===6){if(s[c]=p.by,p.skipSiblings)return;continue}if(d===7){if(delete s[c],p.skipSiblings)return;continue}if(d===1)return;if(d===3){if(u===null)throw Error("Cannot replace root object");if(m[u]=p.by,p.reexplore)return!0;return}if(d===4){if(u===null)throw Error("Cannot delete root object");delete m[u];return}if(d===5)delete s[c],Object.assign(s,p.by)}};await n(null,e,null)},Yr=Object.create,{getPrototypeOf:Tr,defineProperty:Ae,getOwnPropertyNames:Qr}=Object,Gr=Object.prototype.hasOwnProperty,Kr=(e,r,t)=>{t=e!=null?Yr(Tr(e)):{};let o=r||!e||!e.__esModule?Ae(t,"default",{value:e,enumerable:!0}):t;for(let i of Qr(e))if(!Gr.call(o,i))Ae(o,i,{get:()=>e[i],enumerable:!0});return o},Zr=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),Vr=Zr((e,r)=>{var{defineProperty:t,getOwnPropertyNames:o,getOwnPropertyDescriptor:i}=Object,n=Object.prototype.hasOwnProperty,a=new WeakMap,s=(l)=>{var c=a.get(l),b;if(c)return c;if(c=t({},"__esModule",{value:!0}),l&&typeof l==="object"||typeof l==="function")o(l).map((p)=>!n.call(c,p)&&t(c,p,{get:()=>l[p],enumerable:!(b=i(l,p))||b.enumerable}));return a.set(l,c),c},u=(l,c)=>{for(var b in c)t(l,b,{get:c[b],enumerable:!0,configurable:!0,set:(p)=>c[b]=()=>p})},m={};u(m,{splitWithQuotes:()=>g,splitNested:()=>y}),r.exports=s(m);var y=(l,c,b="(",p=")")=>{let d=0,f="",k=[];for(let w of l){if(f+=w,w===b)d++;if(w===p)d--;if(d===0&&w===c)k.push(f.slice(0,-1)),f=""}if(f)k.push(f);return k},g=(l,c=",")=>{let b=[],p=l.length,d=c.length,f=0,k=(w)=>{if(w+d>p)return!1;for(let E=0;E<d;E++)if(l[w+E]!==c[E])return!1;return!0};while(f<p){while(f<p&&l[f]===" ")f++;if(f>=p)break;let w="",E=l[f]==='"'||l[f]==="'";if(E){let A=l[f++];while(f<p&&l[f]!==A)w+=l[f++];if(f<p)f++}else{while(f<p&&!k(f)){let A=l[f];if(A==='"'||A==="'"){w+=A,f++;while(f<p&&l[f]!==A)w+=l[f++];if(f<p)w+=l[f++]}else w+=l[f++]}w=w.trim()}if(w)b.push({value:w,quoted:E});if(k(f))f+=d}return b}}),Xr=Kr(Vr(),1),Hr=/^\[([^=\]]*)([=]*)([^\]]*)\]$/,qr=/^([^[\]]*)\[([^\]]*)]$/,ue=(e,r,t,o)=>{if(e.startsWith("{")&&e.endsWith("}")){let i=e.substring(1,e.length-1);return D(r,i,t)?.toString()}return o?e:void 0},zr=(e,r,t,o)=>{let i=ue(r,t,o);if(i)return D(e,i,o);let n=Hr.exec(r);if(n){let[,s,u,m]=n,y=ue(s.trim(),t,o,!0),g=ue(m.trim(),t,o,!0);if(Array.isArray(e)&&(u==="="||u==="==")&&y)return e.find((l)=>l?.[y]==g)}let a=qr.exec(r);if(a){let[,s,u]=a;return e?.[s]?.[u]}return e?.[r]},D=(e,r,t)=>{let o=void 0,i=void 0,n=r??"",a=(g)=>{if(!g)return[g,!1];return g.endsWith("?")?[g.substring(0,g.length-1),!0]:[g,!1]},s=(g,l)=>{let[c,b]=a(l.pop());if(!c){if(t?.set!==void 0&&i!==void 0&&o!==void 0)o[i]=t.set;return g}let p=zr(g,c,e,t);if(p===void 0){if(b||t?.optional||t?.defaultValue!==void 0)return;throw Error(`Unknown path element: "${c}" in "${n}"`)}return o=g,i=c,s(p,l)},u=Xr.splitNested(n,t?.separator??".","{","}"),m=void 0;if(u.length>0&&u[u.length-1].startsWith("?="))m=u.pop()?.substring(2);u.reverse();let y=s(e,u);if(y===void 0)return m??t?.defaultValue;return y},$e=(e,r)=>{if(typeof e.value==="string"){if(e.quoted)return e.value;if(e.value.startsWith("[")&&e.value.endsWith("]")){let t=e.value.slice(1,-1);if(t.trim()==="")return[];return t.split(";").map((o)=>{let i=o.trim();if(!isNaN(+i))return+i;return i})}if(e.value.startsWith("{")&&e.value.endsWith("}")){if(e.value.slice(1,-1).trim()==="")return{}}if(e.value==="null")return null;if(e.value==="undefined")return;if(e.value.startsWith("@"))return e.value.slice(1);if(!isNaN(+e.value))return+e.value}return r(e.value)},X=(e,r,t,o,i,n)=>{let a=o?.(e)??e,s=i(a);if(s[0])return s[1];if(!r){let u=D(t,e),m=i(u);if(m[0])return m[1]}throw Error(n)},Se=(e,r,t,o,i)=>{let n=typeof e.types==="function"?e.types(o,r.value,i):e.types?.[o];if(!n||n==="ref")return $e(r,(s)=>D(t,s));let a=$e(r,()=>r.value);if(Array.isArray(n)){if(!n.includes(a))throw Error(`Argument ${o.toString()} must be one of [${n.join(", ")}]: ${a}`);return a}if(typeof n==="string"){if(n.endsWith("?")){let s=n.slice(0,-1);if(r.value==="null")return O.ReplaceItem(null);if(r.value==="undefined")return O.ReplaceItem(void 0);if(r.value==="")return"";n=s}switch(n){case"any":return a;case"array":return X(a,r.quoted,t,null,(s)=>[Array.isArray(s),s],`Argument ${o.toString()} must be an array: ${a}`);case"object":return X(a,r.quoted,t,null,(s)=>[typeof s==="object"&&s!==null,s],`Argument ${o.toString()} must be an object: ${a}`);case"number":return X(a,r.quoted,t,(s)=>Number(s),(s)=>[!isNaN(s),s],`Argument ${o.toString()} must be a number: ${a}`);case"boolean":return X(a,r.quoted,t,null,(s)=>{if([!0,"true","1",1,"yes","on"].includes(s))return[!0,!0];if([!1,"false","0",0,"no","off"].includes(s))return[!0,!1];if([null,"null","undefined",void 0,""].includes(s))return[!0,!1];if(Array.isArray(s))return[!0,s.length>0];return[!1,!1]},`Argument ${o.toString()} must be a boolean: ${a}`);case"string":return a.toString();default:throw Error(`Unknown type for argument ${o.toString()}: ${n}`)}}return n(a,t,o,r.quoted)},q=(e,r)=>{let t=e?.[r];if(t===void 0)throw Error(`Unhandled field processor type: ${r}`);return typeof t==="function"?{options:{},fn:t}:{options:t,fn:t.fn}},Fe=(e)=>!e.quoted&&e.value.startsWith("."),Pr=(e)=>{let r={};for(let t of e){if(!Fe(t))continue;let o=t.value.indexOf("="),i=o>-1?t.value.slice(1,o):t.value.slice(1),n=o>-1?t.value.slice(o+1):"";if(n.length>=2){let a=n[0],s=n[n.length-1];if(a==='"'&&s==='"'||a==="'"&&s==="'")n=n.slice(1,-1)}if(!r[i])r[i]=[];r[i].push(n)}return r},pe=(e,r,t)=>{let o=Br.splitWithQuotes(e??""),i=Pr(o),n=o.filter((s)=>!Fe(s)),a=r.options.processArgs===!1?[]:n.map((s,u)=>Se(r.options,s,t,u,n));return{rawArgs:n,parsedArgs:a,tags:i}},et=(e)=>{return e!==null&&typeof e==="object"&&"action"in e},rt=(e,r)=>r.keys!==void 0&&e.key.startsWith(".")&&r.keys[e.key.substring(1)]!==void 0,tt=async(e,r,t,o)=>{let{key:i,parent:n}=e,a=q(o.keys,i.substring(1));if(a.options.processArgs!==!1&&(typeof a.options.types==="function"||a.options.types?.[0]!==void 0))e.value=Se(a.options,{value:e.value,quoted:!1},t,0,[]);if(typeof e.value!=="string")await $(e.value,{...o,root:{...t,parent:e.parent,parents:e.parents},filters:[...o.filters??[],...a.options.filters??[]]});let s=await a.fn({path:r,root:t,parent:n,key:i,options:o,value:e.value,args:[],rawArgs:[],tags:{}});return et(s)?s:O.ReplaceParent(s)},_e=(e)=>{let r=[],t=0;while(t<e.length)if(e[t]==="$"&&e[t+1]==="("&&(t===0||e[t-1]!=="\\")){let o=t;t+=2;let i=1;for(;t<e.length;t++)if(e[t]==="(")i++;else if(e[t]===")"){if(i--,i===0){r.push([o,t]);break}}if(i!==0)throw Error(`Unmatched opening $( at position ${o.toString()}`);t++}else t++;return r},fe=Symbol.for("@homedev/fields:OverrideResult"),ot=(e)=>({[fe]:!0,value:e}),nt=(e)=>{return e!==null&&typeof e==="object"&&fe in e&&e[fe]===!0},Me=async(e,r,t)=>{for(let o=r.length-1;o>=0;o--){let[i,n]=r[o],a=e.slice(i+2,n),s=await Me(a,_e(a),t);if(typeof s==="object")return s;let u=await t(s,e);if(nt(u))return u.value;e=e.slice(0,i)+u+e.slice(n+1)}return e},it=async(e,r)=>Me(e,_e(e),r),st=(e)=>{return e!==null&&typeof e==="object"&&"action"in e},at=async(e,r,t,o)=>{let i=await(async()=>{let n=/([\w\d.-_/]+):(.+)/.exec(e);if(!n)return await D(r,e);let[a,s,u]=n,m=q(o.sources,s),y=pe(u,m,r);return await m.fn({args:y.parsedArgs,rawArgs:y.rawArgs,tags:y.tags,key:s,options:o,root:r,path:t,value:null})})();if(i===null||i===void 0)return"";if(typeof i==="object")return ot(i);return i},lt=(e)=>{let r=/{%\s*section\s+([\w\d_-]+)\s*%}([\s\S]*?){%\s*endsection\s+\1\s*%}/g,t,o=[],i=[];while((t=r.exec(e))!==null){let[a,s,u]=t;i.push({fullMatch:a,name:s,body:u})}let n=e;for(let{fullMatch:a,name:s,body:u}of i){let m={},y=u.trim(),g=y.indexOf("---");if(g!==-1){let l=y.slice(0,g).trim();y=y.slice(g+3).trim();try{m=Bun.YAML.parse(l)??{}}catch(c){throw Error(`Failed to parse YAML config for section ${s}: ${c.message}`)}}o.push({name:s,config:m,content:y}),n=n.replace(a,"")}return{sections:o,content:n.trim()}},je=async(e,r,t,o)=>{let i=o?.onSection?lt(r):null,n=r;if(i){n=i.content;for(let s of i.sections){if(Object.keys(s.config).length>0)await $(s.config,o);let u=await o.onSection(s,e,t,o);if(u===!0)n=n+s.content;else if(typeof u==="string")n=n+u}}let a=await it(n,(s)=>at(s,t,e,o));if(st(a))return a;if(a===n){if(i?.sections.length)return O.ReplaceItem(a);return O.Explore()}if(typeof a==="string"){let s=await je(e,a,t,o);if(s.action!==H.Explore)return s}return O.ReplaceItem(a)},$=async(e,r)=>{return r??={},await Jr(e,async(t)=>{let o=[...t.path,t.key].join(".");if(r?.filters?.length&&r.filters.some((s)=>s.test(o)))return O.NoExplore();let i=t.path.length===0,n=t.parents.length>0?t.parents.toReversed():[];if(i){if(n.length>0)throw Error("Root object should not have a parent");n=r?.root?.parents?[r.root.parent,...r.root.parents.toReversed()]:[]}let a={...e,...r.root,this:t.parent,parent:n.length>0?n[0]:null,parents:n};try{if(t.key.startsWith("$"))return O.NoExplore();let s=O.Explore();if(typeof t.value==="string")switch(s=await je(o,t.value,a,r),s.action){case H.Explore:break;case H.ReplaceItem:t.value=s.by;break;default:return s}if(rt(t,r))s=await tt(t,o,a,r);return s}catch(s){throw Error(`${s.message}
2
+ (${o})`)}}),e},z=(e,r)=>r?{fn:(t)=>e(...t.args),types:r}:(t)=>e(...t.args),Ne=(e,r)=>Object.fromEntries(e.map((t)=>[t.name,z(t,r?.types?.[t.name])])),F=(e,r)=>Object.fromEntries((r?.keys??Object.keys(e)).map((t)=>[t,z(e[t],r?.types?.[t])]));var Be={};W(Be,{writeOutputs:()=>re,writeOutput:()=>ye,writeFormat:()=>me,locate:()=>R,loadFormat:()=>P,importList:()=>ge,importGlob:()=>De,globMap:()=>ee,exists:()=>B});import Ce from"fs/promises";import ce from"path";import ut from"path";import ft from"fs/promises";import Ie from"fs/promises";import Re from"path";import xe from"path";import Le from"path";var B=async(e)=>{try{return await Ce.access(e,Ce.constants.R_OK),!0}catch{return!1}},R=async(e,r)=>{let t=!ce.isAbsolute(e)&&r?["",...r]:[""];for(let o of t){let i=ce.join(o,e);if(await B(i))return ce.resolve(i)}throw Error(`File not found: "${e}"`)},P=async(e,r)=>{let t=await R(e,r?.dirs),o=await Bun.file(t).text(),i=ut.dirname(t),n={"[.]json$":JSON.parse,"[.](yml|yaml)$":Bun.YAML.parse,"[.]toml$":Bun.TOML.parse,...r?.parsers},a=Object.entries(n).find((s)=>t.match(s[0]));if(!a)throw Error(`Unhandled file type: ${e}`);return{content:a[1](o),fullPath:t,folderPath:i}},me=async(e,r,t="text")=>{switch(t){case"yaml":await Bun.write(e,Bun.YAML.stringify(r));break;case"json":await Bun.write(e,JSON.stringify(r));break;case"text":default:await Bun.write(e,r.toString())}},ee=async(e,r)=>{if(typeof e==="string"&&!e.includes("*"))return await r.map(e,0,[]);let t=await Array.fromAsync(ft.glob(e,{cwd:r.cwd})),o=r.filter?t.filter(r.filter):t;return await Promise.all(o.map(r.map))},re=async(e,r)=>{if(r?.targetDirectory&&r?.removeFirst)try{await Ie.rm(r?.targetDirectory,{recursive:!0,force:!0})}catch(t){throw Error(`Failed to clean the output directory: ${t.message}`)}for(let t of e)await ye(t,r)},ye=async(e,r)=>{let t=Re.join(r?.targetDirectory??".",e.name),o=Re.dirname(t);if(r?.classes){if(e.class!==void 0&&!r.classes.includes(e.class))return;if(r.classRequired&&e.class===void 0)throw Error(`Output "${e.name}" is missing class field`)}if(r?.writing?.(e)===!1)return;try{await Ie.mkdir(o,{recursive:!0})}catch(i){throw Error(`Failed to create target directory "${o}" for output "${t}": ${i.message}`)}try{await me(t,e.value,e.type??"text")}catch(i){throw Error(`Failed to write output "${t}": ${i.message}`)}},Ue=(e)=>e?Le.isAbsolute(e)?e:Le.join(process.cwd(),e):process.cwd(),ge=async(e,r)=>{let t=[];for(let o of e)try{let i=!xe.isAbsolute(o)?xe.join(Ue(r?.cwd),o):o;if(r?.filter?.(i)===!1)continue;let n=await import(i);if(r?.resolveDefault==="only"&&!n.default)throw Error(`Module ${o} does not have a default export`);let a=r?.resolveDefault?n.default??n:n,s=r?.map?await r.map(a,o):a;if(s!==void 0)t.push(s)}catch(i){if(r?.fail?.(o,i)===!1)continue;throw Error(`Failed to import module ${o}: ${i.message??i}`)}return t},De=async(e,r)=>{let t=[];for(let o of e){let i=await Array.fromAsync(new Bun.Glob(o).scan({cwd:Ue(r?.cwd),absolute:!0}));t.push(...await ge(i,r))}return t};var Ke={};W(Ke,{toObjectWithKey:()=>Je,toObject:()=>te,toList:()=>x,sortBy:()=>Qe,nonNullMap:()=>Ye,defined:()=>Te,deepClone:()=>j,asyncMap:()=>Ge});var x=(e,r="name")=>Object.entries(e).map(([t,o])=>({[r]:t,...o})),Je=(e,r="name")=>Object.fromEntries(e.map((t)=>[t[r],t])),te=(e,r="name")=>Object.fromEntries(e.map((t)=>{let{[r]:o,...i}=t;return[o,i]})),Ye=(e,r)=>{if(!e)return[];let t=[],o=0;for(let i of e)if(i!==null&&i!==void 0)t.push(r(i,o,e)),o++;return t},Te=(e,r="Value is undefined")=>{if(e===void 0)throw Error(r);return e},Qe=(e,r,t=(o,i)=>o-i)=>e.slice().sort((o,i)=>t(r(o),r(i))),Ge=async(e,r)=>Promise.all(e.map(r)),j=(e)=>{if(typeof structuredClone<"u")try{return structuredClone(e)}catch{}return JSON.parse(JSON.stringify(e))};var Ve={};W(Ve,{navigate:()=>de,find:()=>Ze,NavigateResult:()=>h,NavigateAction:()=>we});var we;((e)=>{e[e.Explore=0]="Explore",e[e.SkipSiblings=1]="SkipSiblings",e[e.NoExplore=2]="NoExplore",e[e.ReplaceParent=3]="ReplaceParent",e[e.DeleteParent=4]="DeleteParent",e[e.MergeParent=5]="MergeParent",e[e.ReplaceItem=6]="ReplaceItem",e[e.DeleteItem=7]="DeleteItem"})(we||={});class h{action;by;skipSiblings;reexplore;constructor(e,r,t,o){this.action=e,this.by=r,this.skipSiblings=t,this.reexplore=o}static _explore=new h(0);static _noExplore=new h(2);static _skipSiblings=new h(1);static _deleteParent=new h(4);static ReplaceParent(e,r){return new h(3,e,void 0,r)}static SkipSiblings(){return h._skipSiblings}static Explore(){return h._explore}static NoExplore(){return h._noExplore}static DeleteParent(){return h._deleteParent}static MergeParent(e){return new h(5,e)}static ReplaceItem(e,r){return new h(6,e,r)}static DeleteItem(e){return new h(7,void 0,e)}}var de=async(e,r)=>{let t=new WeakSet,o=[],i=[],n=async(s,u,m)=>{let y=s===null,g=y?h.Explore():await r({key:s,value:u,path:o,parent:m,parents:i});if(u&&typeof u==="object"&&g.action===0){if(t.has(u))return g;if(t.add(u),!y)o.push(s),i.push(m);let l=u;while(await a(l,s,m))l=m[s];if(!y)i.pop(),o.pop()}return g},a=async(s,u,m)=>{let y=Object.keys(s),g=y.length;for(let l=0;l<g;l++){let c=y[l],b=s[c],p=await n(c,b,s),d=p.action;if(d===0||d===2)continue;if(d===6){if(s[c]=p.by,p.skipSiblings)return;continue}if(d===7){if(delete s[c],p.skipSiblings)return;continue}if(d===1)return;if(d===3){if(u===null)throw Error("Cannot replace root object");if(m[u]=p.by,p.reexplore)return!0;return}if(d===4){if(u===null)throw Error("Cannot delete root object");delete m[u];return}if(d===5)delete s[c],Object.assign(s,p.by)}};await n(null,e,null)},Ze=async(e,r)=>{let t=[];return await de(e,(o)=>{if(r([...o.path,o.key].join("."),o.value))t.push(o.value);return h.Explore()}),t};var Xe=(e)=>({output:(r)=>{delete r.parent[r.key];for(let t of Array.isArray(r.value)?r.value:[r.value])if(typeof t==="string")e.output({name:t,value:r.parent});else e.output({...t,value:t.value??r.parent});return h.SkipSiblings()}});import pt from"path";var He=(e)=>({load:async(r)=>{let t=r.options.globalContext;for(let{file:o}of Array.isArray(r.value)?r.value:[r.value]){if(!o)throw Error("File reference required");await e.load(o,t.file&&pt.dirname(t.file))}return h.DeleteItem()}});var qe={};W(qe,{mergeAll:()=>J,merge:()=>N});var N=(e,r,t)=>{for(let o of Object.keys(r)){if(e[o]===void 0)continue;let i=r[o],n=e[o];if(typeof n!==typeof i||Array.isArray(n)!==Array.isArray(i)){let s=t?.mismatch?.(o,n,i,e,r);if(s!==void 0){r[o]=s;continue}throw Error(`Type mismatch: ${o}`)}let a=t?.mode?.(o,n,i,e,r)??r[".merge"]??"merge";switch(a){case"source":r[o]=n;continue;case"target":continue;case"skip":delete r[o],delete e[o];continue;case"merge":break;default:throw Error(`Unknown merge mode: ${a}`)}if(typeof n==="object")if(Array.isArray(n))i.push(...n);else{if(t?.navigate?.(o,n,i,e,r)===!1)continue;N(n,i,t)}else{if(n===i)continue;let s=t?.conflict?.(o,n,i,e,r);r[o]=s===void 0?i:s}}for(let o of Object.keys(e))if(r[o]===void 0)r[o]=e[o]},J=(e,r)=>{let t={};for(let o of e.toReversed())N(o,t,r);return t};class be{cache=new Map;maxSize;constructor(e=100){this.maxSize=e}get(e){return this.cache.get(e)}set(e,r){this.evictIfNeeded(),this.cache.set(e,r)}has(e){return this.cache.has(e)}clear(){this.cache.clear()}setMaxSize(e){this.maxSize=e}size(){return this.cache.size}evictIfNeeded(){if(this.cache.size>=this.maxSize){let e=null,r=1/0;for(let[t,o]of this.cache.entries())if(o.timestamp<r)r=o.timestamp,e=t;if(e)this.cache.delete(e)}}}var Pe={};W(Pe,{select:()=>v});var ct=Object.create,{getPrototypeOf:mt,defineProperty:ze,getOwnPropertyNames:yt}=Object,gt=Object.prototype.hasOwnProperty,wt=(e,r,t)=>{t=e!=null?ct(mt(e)):{};let o=r||!e||!e.__esModule?ze(t,"default",{value:e,enumerable:!0}):t;for(let i of yt(e))if(!gt.call(o,i))ze(o,i,{get:()=>e[i],enumerable:!0});return o},dt=(e,r)=>()=>(r||e((r={exports:{}}).exports,r),r.exports),bt=dt((e,r)=>{var{defineProperty:t,getOwnPropertyNames:o,getOwnPropertyDescriptor:i}=Object,n=Object.prototype.hasOwnProperty,a=new WeakMap,s=(l)=>{var c=a.get(l),b;if(c)return c;if(c=t({},"__esModule",{value:!0}),l&&typeof l==="object"||typeof l==="function")o(l).map((p)=>!n.call(c,p)&&t(c,p,{get:()=>l[p],enumerable:!(b=i(l,p))||b.enumerable}));return a.set(l,c),c},u=(l,c)=>{for(var b in c)t(l,b,{get:c[b],enumerable:!0,configurable:!0,set:(p)=>c[b]=()=>p})},m={};u(m,{splitWithQuotes:()=>g,splitNested:()=>y}),r.exports=s(m);var y=(l,c,b="(",p=")")=>{let d=0,f="",k=[];for(let w of l){if(f+=w,w===b)d++;if(w===p)d--;if(d===0&&w===c)k.push(f.slice(0,-1)),f=""}if(f)k.push(f);return k},g=(l,c=",")=>{let b=[],p=l.length,d=c.length,f=0,k=(w)=>{if(w+d>p)return!1;for(let E=0;E<d;E++)if(l[w+E]!==c[E])return!1;return!0};while(f<p){while(f<p&&l[f]===" ")f++;if(f>=p)break;let w="",E=l[f]==='"'||l[f]==="'";if(E){let A=l[f++];while(f<p&&l[f]!==A)w+=l[f++];if(f<p)f++}else{while(f<p&&!k(f)){let A=l[f];if(A==='"'||A==="'"){w+=A,f++;while(f<p&&l[f]!==A)w+=l[f++];if(f<p)w+=l[f++]}else w+=l[f++]}w=w.trim()}if(w)b.push({value:w,quoted:E});if(k(f))f+=d}return b}}),ht=wt(bt(),1),vt=/^\[([^=\]]*)([=]*)([^\]]*)\]$/,kt=/^([^[\]]*)\[([^\]]*)]$/,he=(e,r,t,o)=>{if(e.startsWith("{")&&e.endsWith("}")){let i=e.substring(1,e.length-1);return v(r,i,t)?.toString()}return o?e:void 0},Et=(e,r,t,o)=>{let i=he(r,t,o);if(i)return v(e,i,o);let n=vt.exec(r);if(n){let[,s,u,m]=n,y=he(s.trim(),t,o,!0),g=he(m.trim(),t,o,!0);if(Array.isArray(e)&&(u==="="||u==="==")&&y)return e.find((l)=>l?.[y]==g)}let a=kt.exec(r);if(a){let[,s,u]=a;return e?.[s]?.[u]}return e?.[r]},v=(e,r,t)=>{let o=void 0,i=void 0,n=r??"",a=(g)=>{if(!g)return[g,!1];return g.endsWith("?")?[g.substring(0,g.length-1),!0]:[g,!1]},s=(g,l)=>{let[c,b]=a(l.pop());if(!c){if(t?.set!==void 0&&i!==void 0&&o!==void 0)o[i]=t.set;return g}let p=Et(g,c,e,t);if(p===void 0){if(b||t?.optional||t?.defaultValue!==void 0)return;throw Error(`Unknown path element: "${c}" in "${n}"`)}return o=g,i=c,s(p,l)},u=ht.splitNested(n,t?.separator??".","{","}"),m=void 0;if(u.length>0&&u[u.length-1].startsWith("?="))m=u.pop()?.substring(2);u.reverse();let y=s(e,u);if(y===void 0)return m??t?.defaultValue;return y};var er=(e)=>{if(typeof e.value==="string")return e.parent;let r=e.value.model;if(!r)return e.parent;if(typeof r==="string")return v(e.root,r);return r};var rr=(e)=>{if(typeof e.value==="string")return v(e.root,e.value);if(Array.isArray(e.value))return e.value;let r=e.value;if(typeof r.from==="string")return v(e.root,r.from);return r.from};var tr=async(e,r)=>{let t=e.value;if(t.selector===void 0)return r;if(typeof t.selector!=="string"){let o=JSON.parse(JSON.stringify(t.selector));return await $(o,{...e.options,root:{...e.root,result:r}}),o}return await v({...e.root,result:r},t.selector)};import L from"path";class I{constructor(){}static normalize(e){return L.normalize(L.resolve(e))}static resolveInContext(e,r){let t=r??process.cwd(),o=L.isAbsolute(e)?e:L.join(t,e);return this.normalize(o)}static isDirectoryPattern(e){return e.endsWith("/")}static isGlobPattern(e){return e.includes("*")}static toAbsolute(e,r){if(L.isAbsolute(e))return e;return L.join(r??process.cwd(),e)}}var or={};W(or,{conditionPredicatesTypes:()=>Y,conditionPredicates:()=>_});var _={and:(...e)=>e.every((r)=>!!r),or:(...e)=>e.some((r)=>!!r),xor:(...e)=>e.filter((r)=>!!r).length===1,true:(...e)=>e.every((r)=>!!r),false:(...e)=>e.every((r)=>!r),eq:(...e)=>e.every((r)=>r===e[0]),ne:(...e)=>e.some((r)=>r!==e[0]),lt:(...e)=>typeof e[0]==="number"&&e.slice(1).every((r)=>typeof r==="number"&&e[0]<r),le:(...e)=>typeof e[0]==="number"&&e.slice(1).every((r)=>typeof r==="number"&&e[0]<=r),gt:(...e)=>typeof e[0]==="number"&&e.slice(1).every((r)=>typeof r==="number"&&e[0]>r),ge:(...e)=>typeof e[0]==="number"&&e.slice(1).every((r)=>typeof r==="number"&&e[0]>=r),in:(e,r)=>{if(Array.isArray(r))return r.includes(e);if(typeof e==="string")return e.includes(r);if(Array.isArray(e))return e.includes(r);return!1},notin:(e,r)=>!_.in(e,r),contains:(e,r)=>e.includes(r),notcontains:(e,r)=>!e.includes(r),containsi:(e,r)=>e.toLowerCase().includes(r.toLowerCase()),notcontainsi:(e,r)=>!e.toLowerCase().includes(r.toLowerCase()),null:(...e)=>e.every((r)=>r===null||r===void 0),notnull:(...e)=>e.every((r)=>r!==null&&r!==void 0),empty:(...e)=>e.every((r)=>r===""),notempty:(...e)=>e.every((r)=>r!==""),nullorempty:(...e)=>e.every((r)=>r===null||r===void 0||r===""),notnullorempty:(...e)=>e.every((r)=>r!==null&&r!==void 0&&r!=="")},Y={and:()=>"boolean",or:()=>"boolean",xor:()=>"boolean",true:()=>"boolean",false:()=>"boolean",lt:()=>"number",le:()=>"number",gt:()=>"number",ge:()=>"number"};var nr=()=>({each:{filters:[/select|model/],fn:async(e)=>{let r=e.value;delete e.parent[e.key];let t=await rr(e),o=await er(e);if(!Array.isArray(t))throw Error('Key "each" requires a source list');if(o===void 0)throw Error('Key "each" must define a model');if(r.extend?.model)o=J([r.model,...Array.isArray(r.extend.model)?r.extend.model:[r.extend.model]]);let i=[];for(let n=0;n<t.length;n++){let a=j(o);if(await $(a,{...e.options,root:{...e.root,index:n,item:t[n],instance:a}}),r.extend?.result){let s=r.extend.result;a=J([a,...Array.isArray(s)?s:[s]])}i.push(await tr(e,a))}return i}}});var ir=()=>({concat:async(e)=>{let r=[];for(let t of Array.isArray(e.value)?e.value:[e.value])r.push(...await v(e.root,t));return r.filter((t)=>t!==void 0)}});var sr=()=>({extends:async(e)=>{let r=async(t,o)=>{for(let i of Array.isArray(o)?o:[o]){let n=await v(e.root,i),a=j(n);if(a[e.key])await r(a,a[e.key]);await $(a,{...e.options}),N(a,t),delete t[e.key]}};return await r(e.parent,e.value),h.Explore()},group:(e)=>{let r=e.root.parent,t=e.value,{items:o,...i}=t;return t.items.forEach((n)=>r.push({...i,...n})),h.DeleteParent()}});var ar=(e)=>({skip:{types:{0:"boolean"},fn:(r)=>r.value?h.DeleteParent():h.DeleteItem()},metadata:({path:r,value:t})=>{return e.metadata(r,t),h.DeleteItem()},if:{types:{0:"boolean"},fn:async(r)=>{let t=r.parent[".then"],o=r.parent[".else"];if(t!==void 0)delete r.parent[".then"];if(o!==void 0)delete r.parent[".else"];let i=r.value?t:o;if(i===void 0)return h.DeleteItem();if(typeof i==="string")return(await $({value:i},{...r.options,root:{...r.root}})).value;return h.ReplaceParent(i,!0)}},switch:(r)=>{let t=r.value;if(!t.cases)throw Error("Missing cases for switch");if(t.cases[t.from]!==void 0)return h.ReplaceParent(t.cases[t.from],!0);if(t.default!==void 0)return h.ReplaceParent(t.default,!0);return h.DeleteParent()}});var lr=()=>({from:async({root:e,parent:r,value:t})=>{let o=await v(e,t);if(o===null||o===void 0)throw Error(`Unable to resolve reference: ${t}`);if(r.content){if(Array.isArray(r.content)&&Array.isArray(o))return[...o,...r.content];return N(o,r.content),r.content}return o}});import ur from"node:vm";var fr=(e)=>({modules:async(r)=>{for(let[t,o]of Object.entries(r.value)){let i=ur.createContext({console,objector:e,document:r.root}),n=new ur.SourceTextModule(o,{identifier:t,context:i});await n.link((a)=>{throw Error(`Module ${a} is not allowed`)}),await n.evaluate(),e.sources(Object.fromEntries(Object.entries(n.namespace).map(([a,s])=>[`${t}.${a}`,(u)=>s(u,...u.args)])))}return h.DeleteItem()}});import pr from"fs/promises";import T from"path";var cr=(e)=>({include:async(r)=>{let{file:t}=r.options.globalContext;return await ee(r.args[0],{cwd:T.dirname(t),filter:(o)=>T.basename(t)!==o,map:async(o)=>e.load(o,T.dirname(t),{parent:r.root})})},exists:async({args:[r]})=>await B(r),file:async(r)=>await pr.readFile(await R(r.args[0],e.getIncludeDirectories())).then((t)=>t.toString()),scan:async(r)=>{let t=[],i=(()=>{let s=r.args[2]??["**/node_modules/**"],u=typeof s==="string"?s.split(",").map((m)=>m.trim()):s;if(!Array.isArray(u))throw Error("Scan exclusion must be a list");return u})(),{file:n}=r.options.globalContext,a=r.args[1]?await R(r.args[1],e.getIncludeDirectories()):T.dirname(n);for await(let s of pr.glob(r.args[0],{cwd:a,exclude:(u)=>i.some((m)=>T.matchesGlob(u,m))}))t.push(s);return t}});var mr=()=>F({env:(e)=>process.env[e]});var gr={};W(gr,{tokenize:()=>yr,snake:()=>G,pascal:()=>Q,padBlock:()=>C,changeCase:()=>K,capital:()=>oe,camel:()=>ne});var Q=(e)=>e.replace(/((?:[_ ]+)\w|^\w)/g,(r,t)=>t.toUpperCase()).replace(/[_ ]/g,""),oe=(e)=>e.replace(/((?:[ ]+)\w|^\w)/g,(r,t)=>t.toUpperCase()),ne=(e)=>{let r=Q(e);return r.charAt(0).toLowerCase()+r.slice(1)},G=(e,r="_")=>e.replace(/([a-z])([A-Z])/g,`$1${r}$2`).replace(/\s+/g,r).toLowerCase(),K=(e,r)=>{switch(r){case"upper":return e.toUpperCase();case"lower":return e.toLowerCase();default:return e}},C=(e,r,t=`
3
+ `,o=" ")=>{let i=o.repeat(r);return e.split(t).map((n)=>i+n).join(t)},yr=(e,r,t=/\${([^}]+)}/g)=>{return e.replace(t,(o,i)=>{let n=r[i];if(n===null||n===void 0)return"";if(typeof n==="string")return n;if(typeof n==="number"||typeof n==="boolean")return String(n);return String(n)})};var ie=(e,r=0,t)=>{let o=" ".repeat(r),i=" ".repeat(r+1);if(e===null||e===void 0)return"null";else if(typeof e==="boolean")return String(e);else if(typeof e==="number")return String(e);else if(typeof e==="string")return`"${e.replace(/\\/g,"\\\\").replace(/"/g,"\\\"").replace(/\n/g,"\\n").replace(/\r/g,"\\r").replace(/\t/g,"\\t")}"`;else if(Array.isArray(e)){if(e.length===0)return"[]";return`[
4
+ ${e.map((a)=>`${i}${ie(a,r+1)},`).join(`
5
5
  `)}
6
- ${o}]`}else if(typeof e==="object"){let s=Object.entries(e).sort((a,f)=>t?.sortKeys?a[0].localeCompare(f[0]):0);if(s.length===0)return"{}";return`{
7
- ${s.map(([a,f])=>`${n}${a} = ${F(f,r+1,t)}`).join(`
6
+ ${o}]`}else if(typeof e==="object"){let n=Object.entries(e).sort((s,u)=>t?.sortKeys?s[0].localeCompare(u[0]):0);if(n.length===0)return"{}";return`{
7
+ ${n.map(([s,u])=>`${i}${s} = ${ie(u,r+1,t)}`).join(`
8
8
  `)}
9
- ${o}}`}else return String(e)},B=(e)=>{if(!e)return e;return e.replaceAll("\\n",`
10
- `).replaceAll("\\$","$").replaceAll("\\t","\t")};var Tr=()=>({substring:{types:{0:"ref",1:"number",2:"number"},fn:(e)=>e.args[0].substring(e.args[1],e.args[2])},repeat:{types:{0:"ref",1:"number"},fn:({args:[e,r]})=>e.repeat(r)},uuid:(e)=>crypto.randomUUID(),pad:{types:{0:"ref",1:"number",2:"string"},fn:({args:[e,r],tags:t})=>{let o=t.join?.[0]??`
11
- `,n=t.padChar?.[0]??" ";return d.padBlock(e,r??2,o,n)}},formatAs:{types:{1:["json","yaml","terraform"]},fn:({args:[e,r],tags:t})=>{switch(r){case"json":return JSON.stringify(e,null,2);case"yaml":return Bun.YAML.stringify(e,null,2);case"terraform":{let o=!!(t?.sort?.length||t?.sortKeys?.length);return F(e,0,{sortKeys:o})}}throw Error("Unsupported format: "+String(r))}},...Ir.makeFieldProcessorMap({pascal:d.pascal,camel:d.camel,capital:d.capital,fromYaml:Bun.YAML.parse,fromJson:JSON.parse,toYaml:(e,r)=>Bun.YAML.stringify(e,null,r??2),toJson:(e,r)=>JSON.stringify(e,null,r!==0?r??2:void 0),concat:(...e)=>e.join(""),len:(e)=>e.length,reverse:(e)=>e.split("").reverse().join(""),trim:(e)=>e.trim(),ltrim:(e)=>e.trimStart(),rtrim:(e)=>e.trimEnd(),lower:(e)=>e.toLowerCase(),upper:(e)=>e.toUpperCase(),snake:(e,r)=>d.changeCase(d.snake(e,"_"),r),kebab:(e,r)=>d.changeCase(d.snake(e,"-"),r),encode:(e,r)=>Buffer.from(e).toString(r??"base64"),decode:(e,r)=>Buffer.from(e,r??"base64").toString()})});var Kr=m(v(),1);var Gr={};C(Gr,{toObjectWithKey:()=>_r,toObject:()=>q,toList:()=>j,sortBy:()=>Sr,nonNullMap:()=>Ur,defined:()=>Jr,asyncMap:()=>Br});var j=(e,r="name")=>Object.entries(e).map(([t,o])=>({[r]:t,...o})),_r=(e,r="name")=>Object.fromEntries(e.map((t)=>[t[r],t])),q=(e,r="name")=>Object.fromEntries(e.map((t)=>{let{[r]:o,...n}=t;return[o,n]})),Ur=(e,r)=>e?.filter((t)=>t!==null&&t!==void 0).map(r)??[],Jr=(e,r="Value is undefined")=>{if(e===void 0)throw Error(r);return e},Sr=(e,r,t=(o,n)=>o-n)=>e.slice().sort((o,n)=>t(r(o),r(n))),Br=async(e,r)=>Promise.all(e.map(r));var ve=m(b(),1),Yr=m(S(),1);var Hr=()=>({...Kr.makeFieldProcessorMap({merge:(...e)=>e.flatMap((r)=>r)}),join:({args:[e],root:r,tags:t})=>{let o=t.key?.[0],n=t.separator?.[0]??t.sep?.[0],s=t.finalize?.length>0,i=B(n);if(typeof e==="string"){if(s&&e.length&&i)return e+i;return e}if(!Array.isArray(e))throw Error("Object is not a list");let a=((o?.length)?e.map((y)=>ve.select({...r,...y},o)):e).join(i),f=t.pad?.[0]??"0",c=t.padChar?.[0]??" ",p=s&&a.length&&i?a+i:a;return f?Yr.padBlock(p,parseInt(f),`
12
- `,c):p},list:({args:e})=>j(e[0],e[1]),object:({args:e})=>q(e[0],e[1]),range:({args:[e,r,t]})=>{let o=parseInt(e),n=parseInt(r),s=parseInt(t)||1;if(isNaN(o))throw Error("Invalid range: start value '"+String(e)+"' is not a number");if(isNaN(n))throw Error("Invalid range: end value '"+String(r)+"' is not a number");if(s===0)throw Error("Invalid range: step cannot be zero");if((n-o)/s<0)throw Error("Invalid range: step "+String(s)+" has wrong direction for range "+String(o)+" to "+String(n));return Array.from({length:Math.floor((n-o)/s)+1},(i,a)=>o+a*s)},filter:{types:(e,r,t)=>{switch(e){case 0:return"array";case 1:return Object.keys(A)}return U[t[1].value]?.(e-2,r,t.slice(2))},fn:({args:[e,r,t],root:o,tags:n})=>{if(e===null||e===void 0)throw Error("Filter source cannot be null or undefined");if(!Array.isArray(e))throw Error("Filter source must be an array");let s=n.key?.[0],i=A[r];if(s){let f=Array(e.length);for(let p=0;p<e.length;p++)try{f[p]=ve.select({...o,...e[p]},s)}catch{f[p]=Symbol("invalid")}let c=[];for(let p=0;p<e.length;p++){let y=f[p];if(typeof y!=="symbol"&&t===void 0?i(y):i(y,t))c.push(e[p])}return c}let a=[];for(let f of e)if(t===void 0?i(f):i(f,t))a.push(f);return a}}});var Qr=m(v(),1);var G=m(b(),1),xr=m(S(),1);var Zr=()=>({each:{processArgs:!1,fn:async({rawArgs:[e,r,...t],root:o,options:n,tags:s})=>{let i=async(g)=>g.quoted?B(g.value):await G.select(o,g.value),a=await G.select(o,e.value),f=await i(r),c=s.key?.[0],p=Array.isArray(a)?a:j(a),y=[],P=await Promise.all(t.map(async(g)=>await i(g))),O={...o,item:void 0,index:0,params:P,instance:void 0,parent:o.this,tags:s},Y={...n,root:O};for(let g=0;g<p.length;g++){let N=h(f),L={instance:N},ee=typeof f==="string"?L:N;if(O.item=p[g],O.index=g,O.instance=N,s?.root?.[0])Object.assign(O,await G.select(O,s.root[0]));if(await Qr.processFields(ee,Y),c!==void 0)y.push(await G.select(L.instance,c));else y.push(L.instance)}if(s.join?.length){if(y.length===0)return"";let g=B(s.join[0]),N=s.pad?.[0]??"0",L=s.padChar?.[0]??" ",ee=s.finalize?.length&&g?g:"",he=`${y.join(g)}${ee}`;return N?xr.padBlock(he,parseInt(N),`
13
- `,L):he}return y}}});var Xr=m(b(),1),K=async(e,r,t)=>e.rawArgs[r].quoted?e.rawArgs[r].value:await Xr.select(e.root,e.rawArgs[r].value,{defaultValue:t}),Vr=()=>({switch:{processArgs:!1,fn:async(e)=>{let r=await K(e,0,!1),t=await K(e,1);if(t[r]===void 0){if(e.rawArgs.length>2)return K(e,2);throw Error(`Unhandled switch case: ${r}`)}return t[r]}}});var Fr=m(v(),1),qr=()=>Fr.makeFieldProcessorMap({log:console.log});var zr=m(v(),1);var et=()=>({if:{types:{0:"boolean"},fn:(e)=>e.args[0]?e.args[1]:e.args[2]},check:{types:{0:Object.keys(A)},fn:(e)=>A[e.args[0]](...e.args.slice(1))},...zr.makeFieldProcessorMap(A,{types:U})});var rt=m(w(),1);var tt=(e)=>({default:{processArgs:!1,fn:async(r)=>{for(let t=0;t<r.rawArgs.length;t++)if(r.rawArgs[t]?.value!==void 0){let n=await K(r,t,null);if(n!==null)return n}if(r.tags.nullable?.length)return rt.NavigateResult.DeleteItem();if(r.tags.fail?.length)throw Error(`No valid value found for default (${r.rawArgs.map((t)=>t.value).join(", ")})`);return""}},subDocument:async(r)=>e.loadSubDocument(r.args[0],r.options.root)});var D=m(w(),1),ot=()=>({convert:({args:[e,r,t]})=>{switch(r){case"string":return String(e);case"number":{let o=Number(e);if(!isNaN(o))return D.NavigateResult.ReplaceItem(o);break}case"boolean":if(e==="true"||e===!0||e===1||e==="1"||e==="yes"||e==="on")return D.NavigateResult.ReplaceItem(!0);else if(e==="false"||e===!1||e===0||e==="0"||e==="no"||e==="off")return D.NavigateResult.ReplaceItem(!1);break;default:throw Error(`Unsupported type for convert: ${r}`)}if(t!==void 0)return D.NavigateResult.ReplaceItem(t);throw Error(`Failed to convert value to ${r}`)},isType:({args:[e,r]})=>{let o=(()=>{switch(r){case"string":return typeof e==="string";case"number":return typeof e==="number";case"boolean":return typeof e==="boolean";case"object":return e!==null&&typeof e==="object"&&!Array.isArray(e);case"array":return Array.isArray(e);case"null":return e===null;case"undefined":return e===void 0;case"function":return typeof e==="function";default:throw Error(`Unknown type for isType: ${r}`)}})();return D.NavigateResult.ReplaceItem(o)},typeOf:({args:[e]})=>{if(e===null)return"null";else if(Array.isArray(e))return"array";else return typeof e}});var nt=(e)=>e.keys(tr(e)).keys(nr(e)).keys(yr()).keys(Or()).keys(dr()).keys(vr()).keys(kr(e)).keys(Pr(e)).sources(Cr(e)).sources(Er()).sources(Tr()).sources(ot()).sources(Hr()).sources(Zr()).sources(Vr()).sources(qr()).sources(et()).sources(tt(e));var l={};C(l,{writeOutputs:()=>V,writeOutput:()=>ye,writeFormat:()=>ce,toObjectWithKey:()=>_r,toObject:()=>q,toList:()=>j,sortBy:()=>Sr,nonNullMap:()=>Ur,mergeAll:()=>_,merge:()=>M,locate:()=>E,loadFormat:()=>Z,importList:()=>ge,importGlob:()=>qe,globMap:()=>X,exists:()=>T,defined:()=>Jr,deepClone:()=>h,conditionPredicates:()=>A,asyncMap:()=>Br});u(l,m(v(),1));u(l,m(w(),1));u(l,m(b(),1));u(l,m(H(),1));u(l,m(S(),1));var gs=l;class to{currentConfig={};includeDirectories=[];includes=[];outputs=[];vars={};cache={};fields={sources:{},keys:{}};objectMetadata={};subDocuments={};currentContext=null;constructor(){this.use(nt)}use(e){return e(this),this}config(e){return Object.assign(this.currentConfig,e),this}getConfig(){return this.currentConfig}includeDirectory(...e){return this.includeDirectories.push(...e),this}getIncludeDirectories(){return this.includeDirectories}include(...e){return this.includes.push(...e),this}keys(e){return Object.assign(this.fields.keys,{...this.fields.keys,...e}),this}sources(e){return Object.assign(this.fields.sources,{...this.fields.sources,...e}),this}variables(e){return this.vars={...this.vars,...e},this}getOutputs(){return this.outputs}output(e){return this.outputs.push(e),this}metadata(e,r){return this.objectMetadata[e]=r,this}getMetadata(e){return this.objectMetadata[e]}getAllMetadata(){return this.objectMetadata}subDocument(e,r){return this.subDocuments[e]=r,this}getSubDocument(e){return this.subDocuments[e]}getCurrentContext(){return this.currentContext}filter(e){return this.fields.filters??=[],this.fields.filters?.push(e),this}async docIncludes(e,r){let t=[];if(e.content.includes)t.push(...e.content.includes),delete e.content.includes;t.push(...this.includes),this.includes.length=0;let o=[];for(let n of t)if(n.includes("*")){let s=new Bun.Glob(n);for await(let i of s.scan({cwd:e.folderPath,absolute:!0}))if(!this.currentContext?.included.includes(i))o.push(i)}else if(n.endsWith("/")){let s=z.isAbsolute(n)?n:z.join(e.folderPath,n);this.includeDirectories.push(s)}else o.push(n);for(let n of o)M(await this.load(n,e.folderPath,{parent:e.content,...r},!0),e.content)}async loadObject(e,r,t){return await st.processFields(e,{...this.fields,globalContext:{file:t?.fullPath??"@internal"},root:{...r,...this.fields.root,...this.vars,context:this.currentContext,$document:{root:{content:e},fileName:t?.fileName??"@internal",folder:t?.folderPath??"@internal",fullPath:t?.fullPath??"@internal"}}}),e}async load(e,r,t,o,n){let s=r?[r]:[];if(n)this.currentContext=n;this.currentContext??={included:[],document:null},s.push(...this.includeDirectories.map((y)=>z.isAbsolute(y)?y:z.join(r??process.cwd(),y)));let i=await Z(e,{dirs:s});if(this.currentContext.included.push(i.fullPath),!i.content)return null;let a=i.fullPath,f=this.cache[a]??i.content,c=h(f);i.content=c,await this.docIncludes(i,t);let p;if(o!==!0)p=await this.loadObject(i.content,t,{fileName:i.fullPath,folderPath:i.folderPath,fullPath:i.fullPath});else p=i.content;return this.currentContext.document=p,this.cache[a]??=f,p}async writeOutputs(e,r){for(let t of Object.entries(this.subDocuments))if(t[0].startsWith("output."))this.output(await this.loadSubDocument(t[0],r));await V(this.getOutputs(),e)}async loadSubDocument(e,r,t){r??=this.currentContext?.document;let o=this.getSubDocument(e);if(o===void 0)throw Error(`Sub document ${e} not found`);let n=await this.loadObject(t?h(o):o,r);if(r)r[e]=n;return n}}export{gs as default,to as Objector};
9
+ ${o}}`}else return String(e)},Z=(e)=>{if(!e)return e;return e.replaceAll("\\n",`
10
+ `).replaceAll("\\$","$").replaceAll("\\t","\t")};var wr=()=>({substring:{types:{0:"ref",1:"number",2:"number"},fn:(e)=>e.args[0].substring(e.args[1],e.args[2])},repeat:{types:{0:"ref",1:"number"},fn:({args:[e,r]})=>e.repeat(r)},uuid:(e)=>crypto.randomUUID(),pad:{types:{0:"ref",1:"number",2:"string"},fn:({args:[e,r],tags:t})=>{let o=t.join?.[0]??`
11
+ `,i=t.padChar?.[0]??" ";return C(e,r??2,o,i)}},formatAs:{types:{1:["json","yaml","terraform"]},fn:({args:[e,r],tags:t})=>{switch(r){case"json":return JSON.stringify(e,null,2);case"yaml":return Bun.YAML.stringify(e,null,2);case"terraform":{let o=!!(t?.sort?.length||t?.sortKeys?.length);return ie(e,0,{sortKeys:o})}}throw Error("Unsupported format: "+String(r))}},...F({pascal:Q,camel:ne,capital:oe,fromYaml:Bun.YAML.parse,fromJson:JSON.parse,toYaml:(e,r)=>Bun.YAML.stringify(e,null,r??2),toJson:(e,r)=>JSON.stringify(e,null,r!==0?r??2:void 0),concat:(...e)=>e.join(""),len:(e)=>e.length,reverse:(e)=>e.split("").reverse().join(""),trim:(e)=>e.trim(),ltrim:(e)=>e.trimStart(),rtrim:(e)=>e.trimEnd(),lower:(e)=>e.toLowerCase(),upper:(e)=>e.toUpperCase(),snake:(e,r)=>K(G(e,"_"),r),kebab:(e,r)=>K(G(e,"-"),r),encode:(e,r)=>Buffer.from(e).toString(r??"base64"),decode:(e,r)=>Buffer.from(e,r??"base64").toString()})});var dr=()=>({...F({merge:(...e)=>e.flatMap((r)=>r)}),join:({args:[e],root:r,tags:t})=>{let o=t.key?.[0],i=t.separator?.[0]??t.sep?.[0],n=t.finalize?.length>0,a=Z(i);if(typeof e==="string"){if(n&&e.length&&a)return e+a;return e}if(!Array.isArray(e))throw Error("Object is not a list");let s=((o?.length)?e.map((g)=>v({...r,...g},o)):e).join(a),u=t.pad?.[0]??"0",m=t.padChar?.[0]??" ",y=n&&s.length&&a?s+a:s;return u?C(y,parseInt(u),`
12
+ `,m):y},list:({args:e})=>x(e[0],e[1]),object:({args:e})=>te(e[0],e[1]),range:({args:[e,r,t]})=>{let o=parseInt(e),i=parseInt(r),n=parseInt(t)||1;if(isNaN(o))throw Error("Invalid range: start value '"+String(e)+"' is not a number");if(isNaN(i))throw Error("Invalid range: end value '"+String(r)+"' is not a number");if(n===0)throw Error("Invalid range: step cannot be zero");if((i-o)/n<0)throw Error("Invalid range: step "+String(n)+" has wrong direction for range "+String(o)+" to "+String(i));return Array.from({length:Math.floor((i-o)/n)+1},(a,s)=>o+s*n)},filter:{types:(e,r,t)=>{switch(e){case 0:return"array";case 1:return Object.keys(_)}return Y[t[1].value]?.(e-2,r,t.slice(2))},fn:({args:[e,r,t],root:o,tags:i})=>{if(e===null||e===void 0)throw Error("Filter source cannot be null or undefined");if(!Array.isArray(e))throw Error("Filter source must be an array");let n=i.key?.[0],a=_[r];if(n){let u=Array(e.length);for(let y=0;y<e.length;y++)try{u[y]=v({...o,...e[y]},n)}catch{u[y]=Symbol("invalid")}let m=[];for(let y=0;y<e.length;y++){let g=u[y];if(typeof g!=="symbol"&&t===void 0?a(g):a(g,t))m.push(e[y])}return m}let s=[];for(let u of e)if(t===void 0?a(u):a(u,t))s.push(u);return s}}});var br=()=>({each:{processArgs:!1,fn:async({rawArgs:[e,r,...t],root:o,options:i,tags:n})=>{let a=async(p)=>p.quoted?Z(p.value):await v(o,p.value),s=await v(o,e.value),u=await a(r),m=n.key?.[0],y=Array.isArray(s)?s:x(s),g=[],l=await Promise.all(t.map(async(p)=>await a(p))),c={...o,item:void 0,index:0,params:l,instance:void 0,parent:o.this,tags:n},b={...i,root:c};for(let p=0;p<y.length;p++){let d=j(u),f={instance:d},k=typeof u==="string"?f:d;if(c.item=y[p],c.index=p,c.instance=d,n?.root?.[0])Object.assign(c,await v(c,n.root[0]));if(await $(k,b),m!==void 0)g.push(await v(f.instance,m));else g.push(f.instance)}if(n.join?.length){if(g.length===0)return"";let p=Z(n.join[0]),d=n.pad?.[0]??"0",f=n.padChar?.[0]??" ",k=n.finalize?.length&&p?p:"",w=`${g.join(p)}${k}`;return d?C(w,parseInt(d),`
13
+ `,f):w}return g}}});var V=async(e,r,t)=>e.rawArgs[r].quoted?e.rawArgs[r].value:await v(e.root,e.rawArgs[r].value,{defaultValue:t}),hr=()=>({switch:{processArgs:!1,fn:async(e)=>{let r=await V(e,0,!1),t=await V(e,1);if(t[r]===void 0){if(e.rawArgs.length>2)return V(e,2);throw Error(`Unhandled switch case: ${r}`)}return t[r]}}});var vr=()=>F({log:console.log});var kr=()=>({if:{types:{0:"boolean"},fn:(e)=>e.args[0]?e.args[1]:e.args[2]},check:{types:{0:Object.keys(_)},fn:(e)=>_[e.args[0]](...e.args.slice(1))},...F(_,{types:Y})});var Er=(e)=>({default:{processArgs:!1,fn:async(r)=>{for(let t=0;t<r.rawArgs.length;t++)if(r.rawArgs[t]?.value!==void 0){let i=await V(r,t,null);if(i!==null)return i}if(r.tags.nullable?.length)return h.DeleteItem();if(r.tags.fail?.length)throw Error(`No valid value found for default (${r.rawArgs.map((t)=>t.value).join(", ")})`);return""}},section:(r)=>{let t=r.args[0],o=e.getSection(t);if(!o)throw Error(`Section not found: ${t}`);return o.content}});var Or=()=>({convert:({args:[e,r,t]})=>{switch(r){case"string":return String(e);case"number":{let o=Number(e);if(!isNaN(o))return h.ReplaceItem(o);break}case"boolean":if(e==="true"||e===!0||e===1||e==="1"||e==="yes"||e==="on")return h.ReplaceItem(!0);else if(e==="false"||e===!1||e===0||e==="0"||e==="no"||e==="off")return h.ReplaceItem(!1);break;default:throw Error(`Unsupported type for convert: ${r}`)}if(t!==void 0)return h.ReplaceItem(t);throw Error(`Failed to convert value to ${r}`)},isType:({args:[e,r]})=>{let o=(()=>{switch(r){case"string":return typeof e==="string";case"number":return typeof e==="number";case"boolean":return typeof e==="boolean";case"object":return e!==null&&typeof e==="object"&&!Array.isArray(e);case"array":return Array.isArray(e);case"null":return e===null;case"undefined":return e===void 0;case"function":return typeof e==="function";default:throw Error(`Unknown type for isType: ${r}`)}})();return h.ReplaceItem(o)},typeOf:({args:[e]})=>{if(e===null)return"null";else if(Array.isArray(e))return"array";else return typeof e}});var Ar=(e)=>e.keys(Xe(e)).keys(He(e)).keys(nr()).keys(lr()).keys(ir()).keys(sr()).keys(ar(e)).keys(fr(e)).sources(cr(e)).sources(mr()).sources(wr()).sources(Or()).sources(dr()).sources(br()).sources(hr()).sources(vr()).sources(kr()).sources(Er(e)).fieldOptions({onSection:(r)=>{e.section(r)}});import se from"path";class ve{includeDirectories=[];baseIncludeDirectories=[];includes=[];addDirectories(...e){this.includeDirectories.push(...e),this.baseIncludeDirectories.push(...e)}getDirectories(){return this.includeDirectories}reset(){this.includeDirectories=[...this.baseIncludeDirectories]}restore(e){this.includeDirectories=[...e]}snapshot(){return[...this.includeDirectories]}addFiles(...e){this.includes.push(...e)}getPendingAndClear(){let e=[...this.includes];return this.includes.length=0,e}async processPatterns(e,r,t){let o=[];for(let i of e)if(I.isGlobPattern(i)){let n=new Bun.Glob(i);for await(let a of n.scan({cwd:r,absolute:!0}))if(!t.included.includes(a))o.push(a)}else if(I.isDirectoryPattern(i)){let n=se.isAbsolute(i)?i:se.join(r,i);if(!this.includeDirectories.includes(n))this.includeDirectories.push(n)}else o.push(i);return o}buildSearchDirs(e){let r=e?[e]:[];return r.push(...this.includeDirectories.map((t)=>se.isAbsolute(t)?t:se.join(e??process.cwd(),t))),r}}class ke{includeManager;loadFn;constructor(e,r){this.includeManager=e;this.loadFn=r}async processIncludes(e,r,t){let o=[];if(e.content.includes)o.push(...e.content.includes),delete e.content.includes;o.push(...this.includeManager.getPendingAndClear());let i=await this.includeManager.processPatterns(o,e.folderPath,t);for(let n of i)N(await this.loadFn(n,e.folderPath,{parent:e.content,...r},!0,t),e.content)}}var S={};W(S,{writeOutputs:()=>re,writeOutput:()=>ye,writeFormat:()=>me,tokenize:()=>yr,toObjectWithKey:()=>Je,toObject:()=>te,toList:()=>x,sortBy:()=>Qe,snake:()=>G,select:()=>v,processFields:()=>$,pascal:()=>Q,padBlock:()=>C,nonNullMap:()=>Ye,navigate:()=>de,mergeAll:()=>J,merge:()=>N,makeFieldProcessorMap:()=>F,makeFieldProcessorList:()=>Ne,makeFieldProcessor:()=>z,locate:()=>R,loadFormat:()=>P,importList:()=>ge,importGlob:()=>De,globMap:()=>ee,getProcessor:()=>q,getArgs:()=>pe,find:()=>Ze,exists:()=>B,defined:()=>Te,deepClone:()=>j,conditionPredicates:()=>_,changeCase:()=>K,capital:()=>oe,camel:()=>ne,asyncMap:()=>Ge,NavigateResult:()=>h,NavigateAction:()=>we});M(S,Nr(_r(),1));var Ai=S;class jt{includeManager=new ve;includeProcessor;cacheManager=new be(100);outputs=[];vars={};fields={sources:{},keys:{}};objectMetadata={};currentContext=null;sections={};constructor(){this.includeProcessor=new ke(this.includeManager,this.load.bind(this)),this.use(Ar)}use(e){return e(this),this}includeDirectory(...e){return this.includeManager.addDirectories(...e),this}getIncludeDirectories(){return this.includeManager.getDirectories()}include(...e){return this.includeManager.addFiles(...e),this}keys(e){return Object.assign(this.fields.keys,{...this.fields.keys,...e}),this}sources(e){return Object.assign(this.fields.sources,{...this.fields.sources,...e}),this}variables(e){return this.vars={...this.vars,...e},this}getOutputs(){return this.outputs}output(e){return this.outputs.push(e),this}metadata(e,r){return this.objectMetadata[e]=r,this}getMetadata(e){return this.objectMetadata[e]}getAllMetadata(){return this.objectMetadata}setCacheMaxSize(e){return this.cacheManager.setMaxSize(e),this}clearCache(){return this.cacheManager.clear(),this}getCurrentContext(){return this.currentContext}fieldOptions(e){return this.fields={...this.fields,...e},this}section(e){return this.sections[e.name]=e,this}getSection(e){return this.sections[e]}filter(e){return this.fields.filters??=[],this.fields.filters?.push(e),this}async loadObject(e,r,t){return await $(e,{...this.fields,globalContext:{file:t?.fullPath??"@internal"},root:{...r,...this.fields.root,...this.vars,context:this.currentContext,sections:this.sections,$document:{root:{content:e},fileName:t?.fileName??"@internal",folder:t?.folderPath??"@internal",fullPath:t?.fullPath??"@internal"}}}),e}async load(e,r,t,o,i){let n=this.includeManager.snapshot();try{this.includeManager.reset();let a=this.includeManager.buildSearchDirs(r);if(i)this.currentContext=i;this.currentContext??={included:[],document:null};let s=await P(e,{dirs:a}),u=I.normalize(s.fullPath);if(this.currentContext.included.push(u),!s.content)return null;let m=this.cacheManager.get(u),y;if(m)y=m.raw;else y=s.content,this.cacheManager.set(u,{raw:y,timestamp:Date.now()});let g=j(y);s.content=g,await this.includeProcessor.processIncludes(s,t,this.currentContext);let l;if(o!==!0)l=await this.loadObject(s.content,t,{fileName:s.fullPath,folderPath:s.folderPath,fullPath:s.fullPath});else l=s.content;return this.currentContext.document=l,l}catch(a){throw this.includeManager.restore(n),a}finally{this.includeManager.restore(n)}}async writeAll(e){await re(this.getOutputs(),e)}}export{Ai as default,jt as Objector};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@homedev/objector",
3
- "version": "1.2.40",
3
+ "version": "1.2.42",
4
4
  "description": "object extensions for YAML/JSON",
5
5
  "author": "julzor",
6
6
  "license": "ISC",