@velastack/patterns 0.0.5 → 0.0.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,15 +1,15 @@
1
- import re from "prettier";
2
- import ae from "prettier-plugin-svelte";
3
- function oe(t) {
1
+ import Qt from "prettier";
2
+ import te from "prettier-plugin-svelte";
3
+ function ee(t) {
4
4
  return t.language === "ts" || t.language === "svelte" || t.path.endsWith(".json");
5
5
  }
6
- async function se(t) {
7
- if (!oe(t))
6
+ async function ne(t) {
7
+ if (!ee(t))
8
8
  return t;
9
9
  try {
10
- const e = await re.format(t.content, {
10
+ const e = await Qt.format(t.content, {
11
11
  filepath: t.path,
12
- plugins: [ae]
12
+ plugins: [te]
13
13
  });
14
14
  return {
15
15
  ...t,
@@ -20,7 +20,7 @@ async function se(t) {
20
20
  }
21
21
  }
22
22
  async function ct(t) {
23
- return Promise.all(t.map((e) => se(e)));
23
+ return Promise.all(t.map((e) => ne(e)));
24
24
  }
25
25
  async function k(t) {
26
26
  const [e, n] = await Promise.all([
@@ -37,8 +37,8 @@ function mt(t, e) {
37
37
  var n = Object.keys(t);
38
38
  if (Object.getOwnPropertySymbols) {
39
39
  var r = Object.getOwnPropertySymbols(t);
40
- e && (r = r.filter(function(a) {
41
- return Object.getOwnPropertyDescriptor(t, a).enumerable;
40
+ e && (r = r.filter(function(o) {
41
+ return Object.getOwnPropertyDescriptor(t, o).enumerable;
42
42
  })), n.push.apply(n, r);
43
43
  }
44
44
  return n;
@@ -47,21 +47,21 @@ function ut(t) {
47
47
  for (var e = 1; e < arguments.length; e++) {
48
48
  var n = arguments[e] != null ? arguments[e] : {};
49
49
  e % 2 ? mt(Object(n), !0).forEach(function(r) {
50
- ie(t, r, n[r]);
50
+ re(t, r, n[r]);
51
51
  }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(n)) : mt(Object(n)).forEach(function(r) {
52
52
  Object.defineProperty(t, r, Object.getOwnPropertyDescriptor(n, r));
53
53
  });
54
54
  }
55
55
  return t;
56
56
  }
57
- function ie(t, e, n) {
58
- return e = le(e), e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t;
57
+ function re(t, e, n) {
58
+ return e = ae(e), e in t ? Object.defineProperty(t, e, { value: n, enumerable: !0, configurable: !0, writable: !0 }) : t[e] = n, t;
59
59
  }
60
- function le(t) {
61
- var e = ce(t, "string");
60
+ function ae(t) {
61
+ var e = oe(t, "string");
62
62
  return typeof e == "symbol" ? e : String(e);
63
63
  }
64
- function ce(t, e) {
64
+ function oe(t, e) {
65
65
  if (typeof t != "object" || t === null) return t;
66
66
  var n = t[Symbol.toPrimitive];
67
67
  if (n !== void 0) {
@@ -71,20 +71,20 @@ function ce(t, e) {
71
71
  }
72
72
  return (e === "string" ? String : Number)(t);
73
73
  }
74
- const p = zt({});
75
- function zt(t) {
76
- return e.withOptions = (n) => zt(ut(ut({}, t), n)), e;
74
+ const p = Rt({});
75
+ function Rt(t) {
76
+ return e.withOptions = (n) => Rt(ut(ut({}, t), n)), e;
77
77
  function e(n, ...r) {
78
- const a = typeof n == "string" ? [n] : n.raw, {
78
+ const o = typeof n == "string" ? [n] : n.raw, {
79
79
  alignValues: s = !1,
80
80
  escapeSpecialCharacters: i = Array.isArray(n),
81
- trimWhitespace: o = !0
81
+ trimWhitespace: a = !0
82
82
  } = t;
83
83
  let c = "";
84
- for (let f = 0; f < a.length; f++) {
85
- let g = a[f];
84
+ for (let f = 0; f < o.length; f++) {
85
+ let g = o[f];
86
86
  if (i && (g = g.replace(/\\\n[ \t]*/g, "").replace(/\\`/g, "`").replace(/\\\$/g, "$").replace(/\\\{/g, "{")), c += g, f < r.length) {
87
- const x = s ? me(r[f], c) : r[f];
87
+ const x = s ? se(r[f], c) : r[f];
88
88
  c += x;
89
89
  }
90
90
  }
@@ -103,7 +103,7 @@ function zt(t) {
103
103
  c = m.map((g) => g[0] === " " || g[0] === " " ? g.slice(f) : g).join(`
104
104
  `);
105
105
  }
106
- return o && (c = c.trim()), i && (c = c.replace(/\\n/g, `
106
+ return a && (c = c.trim()), i && (c = c.replace(/\\n/g, `
107
107
  `).replace(/\\t/g, " ").replace(/\\r/g, "\r").replace(/\\v/g, "\v").replace(/\\b/g, "\b").replace(/\\f/g, "\f").replace(/\\0/g, "\0").replace(/\\x([\da-fA-F]{2})/g, (f, g) => String.fromCharCode(parseInt(g, 16))).replace(/\\u\{([\da-fA-F]{1,6})\}/g, (f, g) => String.fromCodePoint(parseInt(g, 16))).replace(/\\u([\da-fA-F]{4})/g, (f, g) => String.fromCharCode(parseInt(g, 16)))), typeof Bun < "u" && (c = c.replace(
108
108
  // Matches e.g. \\u{1f60a} or \\u5F1F
109
109
  /\\u(?:\{([\da-fA-F]{1,6})\}|([\da-fA-F]{4}))/g,
@@ -115,20 +115,20 @@ function zt(t) {
115
115
  )), c;
116
116
  }
117
117
  }
118
- function me(t, e) {
118
+ function se(t, e) {
119
119
  if (typeof t != "string" || !t.includes(`
120
120
  `))
121
121
  return t;
122
122
  const r = e.slice(e.lastIndexOf(`
123
123
  `) + 1).match(/^(\s+)/);
124
124
  if (r) {
125
- const a = r[1];
125
+ const o = r[1];
126
126
  return t.replace(/\n/g, `
127
- ${a}`);
127
+ ${o}`);
128
128
  }
129
129
  return t;
130
130
  }
131
- function Dt(t, e) {
131
+ function Et(t, e) {
132
132
  return t.startsWith(e) ? t.slice(e.length) : t.replace(/^\.\//, "");
133
133
  }
134
134
  function j(t) {
@@ -147,7 +147,7 @@ function pt(t) {
147
147
  }
148
148
  );
149
149
  }
150
- const ue = {
150
+ const ie = {
151
151
  text: ["form", "input"],
152
152
  number: ["form", "input"],
153
153
  email: ["form", "input"],
@@ -162,7 +162,7 @@ const ue = {
162
162
  url: ["form", "input"],
163
163
  editor: ["form", "textarea"],
164
164
  autodate: ["form", "input"]
165
- }, pe = {
165
+ }, le = {
166
166
  form: ['import * as Form from "$lib/components/ui/form";'],
167
167
  "file-form": ['import * as FileForm from "$lib/components/ui/file-form";'],
168
168
  multiselect: [
@@ -176,13 +176,13 @@ const ue = {
176
176
  geopoint: ['import { GeopointInput } from "$lib/components/ui/geopoint";'],
177
177
  button: ['import { Button } from "$lib/components/ui/button";']
178
178
  };
179
- function R(t) {
179
+ function M(t) {
180
180
  return `$formData.${t.name}`;
181
181
  }
182
182
  function L(t) {
183
183
  return t.inputProps ? Object.entries(t.inputProps).flatMap(([e, n]) => n == null || n === !1 ? [] : n === !0 ? [` ${e}`] : [` ${e}=${JSON.stringify(String(n))}`]).join("") : "";
184
184
  }
185
- function P(t) {
185
+ function R(t) {
186
186
  return t.labelAside ? p`
187
187
  <div class="flex justify-between">
188
188
  <Form.Label>${t.title}</Form.Label>
@@ -190,68 +190,68 @@ function P(t) {
190
190
  </div>
191
191
  ` : `<Form.Label>${t.title}</Form.Label>`;
192
192
  }
193
- function z(t, e) {
193
+ function I(t, e) {
194
194
  const n = t.required ? " required" : "";
195
195
  return p`
196
196
  <Form.Field {form} name="${t.name}" class="col-span-1">
197
197
  <Form.Control>
198
198
  {#snippet children({ props })}
199
- ${P(t)}
200
- <Input {...props} type="${e}" bind:value={${R(t)}}${n}${L(t)} />
199
+ ${R(t)}
200
+ <Input {...props} type="${e}" bind:value={${M(t)}}${n}${L(t)} />
201
201
  {/snippet}
202
202
  </Form.Control>
203
203
  <Form.FieldErrors class="contents text-destructive" />
204
204
  </Form.Field>
205
205
  `;
206
206
  }
207
- function de(t) {
207
+ function ce(t) {
208
208
  const e = t.required ? " required" : "";
209
209
  return p`
210
210
  <Form.Field {form} name="${t.name}" class="col-span-2">
211
211
  <Form.Control>
212
212
  {#snippet children({ props })}
213
- ${P(t)}
214
- <Textarea {...props} bind:value={${R(t)}}${e}${L(t)} />
213
+ ${R(t)}
214
+ <Textarea {...props} bind:value={${M(t)}}${e}${L(t)} />
215
215
  {/snippet}
216
216
  </Form.Control>
217
217
  <Form.FieldErrors class="contents text-destructive" />
218
218
  </Form.Field>
219
219
  `;
220
220
  }
221
- function fe(t) {
221
+ function me(t) {
222
222
  const e = t.required ? " required" : "";
223
223
  return p`
224
224
  <Form.Field {form} name="${t.name}" class="col-span-1 flex items-start space-x-2">
225
225
  <Form.Control>
226
226
  {#snippet children({ props })}
227
- <Checkbox {...props} bind:checked={${R(t)}}${e}${L(t)} />
228
- ${P(t)}
227
+ <Checkbox {...props} bind:checked={${M(t)}}${e}${L(t)} />
228
+ ${R(t)}
229
229
  {/snippet}
230
230
  </Form.Control>
231
231
  <Form.FieldErrors class="contents text-destructive" />
232
232
  </Form.Field>
233
233
  `;
234
234
  }
235
- function he(t) {
235
+ function ue(t) {
236
236
  return p`
237
237
  <Form.Field {form} name="${t.name}" class="col-span-1">
238
238
  <Form.Control>
239
239
  {#snippet children({ props })}
240
- ${P(t)}
241
- <GeopointInput {...props} bind:value={${R(t)}} />
240
+ ${R(t)}
241
+ <GeopointInput {...props} bind:value={${M(t)}} />
242
242
  {/snippet}
243
243
  </Form.Control>
244
244
  <Form.FieldErrors class="contents text-destructive" />
245
245
  </Form.Field>
246
246
  `;
247
247
  }
248
- function ge(t) {
248
+ function pe(t) {
249
249
  const e = t.required ? " required" : "", n = t.maxSelect > 1 ? "Multiple" : "Single";
250
250
  return p`
251
251
  <FileForm.Field {form} name="${t.name}" class="col-span-1">
252
252
  <Form.Control>
253
253
  {#snippet children({ props })}
254
- ${P(t)}
254
+ ${R(t)}
255
255
  <FileForm.${n}>
256
256
  {#snippet display({ file, filename, onremove })}
257
257
  <div class="flex gap-2 justify-between items-center">
@@ -272,8 +272,8 @@ function ge(t) {
272
272
  </FileForm.Field>
273
273
  `;
274
274
  }
275
- function be(t) {
276
- const e = t.maxSelect > 1 ? "multiple" : "single", n = t.required ? " required" : "", r = t.maxSelect > 1 ? "Select options" : "Select an option", a = t.options.map(
275
+ function de(t) {
276
+ const e = t.maxSelect > 1 ? "multiple" : "single", n = t.required ? " required" : "", r = t.maxSelect > 1 ? "Select options" : "Select an option", o = t.options.map(
277
277
  (s) => `<MultiSelect.Item value=${JSON.stringify(s.value)} label={${t.name}Labels[${JSON.stringify(s.value)}].label} />`
278
278
  ).join(`
279
279
  `);
@@ -281,9 +281,9 @@ function be(t) {
281
281
  <MultiSelect.Field {form} type="${e}" name="${t.name}"${n} class="col-span-1">
282
282
  <Form.Control>
283
283
  {#snippet children({ props })}
284
- ${P(t)}
284
+ ${R(t)}
285
285
  <MultiSelect.Trigger class="w-full justify-between">
286
- <MultiSelect.Input bind:value={${R(t)}} placeholder="${r}" {...props}>
286
+ <MultiSelect.Input bind:value={${M(t)}} placeholder="${r}" {...props}>
287
287
  {#snippet children({ selected })}
288
288
  <div class="flex flex-wrap gap-1">
289
289
  {#each selected as value}
@@ -301,7 +301,7 @@ function be(t) {
301
301
  <Command.Input autofocus placeholder="Search..." />
302
302
  <Command.Empty>No options found</Command.Empty>
303
303
  <Command.Group>
304
- ${a}
304
+ ${o}
305
305
  </Command.Group>
306
306
  </Command.Root>
307
307
  </MultiSelect.Content>
@@ -310,15 +310,15 @@ function be(t) {
310
310
  </MultiSelect.Field>
311
311
  `;
312
312
  }
313
- function ve(t) {
314
- const e = t.maxSelect > 1 ? "multiple" : "single", n = t.maxSelect > 1 ? `Select ${t.relatedModel.pluralDisplayName.toLowerCase()}` : `Select ${t.relatedModel.displayName.toLowerCase()}`, r = `Search ${t.relatedModel.pluralDisplayName.toLowerCase()}...`, a = `No ${t.relatedModel.pluralDisplayName.toLowerCase()} found`, s = t.relatedModel.name, i = t.relatedModel.pluralName;
313
+ function fe(t) {
314
+ const e = t.maxSelect > 1 ? "multiple" : "single", n = t.maxSelect > 1 ? `Select ${t.relatedModel.pluralDisplayName.toLowerCase()}` : `Select ${t.relatedModel.displayName.toLowerCase()}`, r = `Search ${t.relatedModel.pluralDisplayName.toLowerCase()}...`, o = `No ${t.relatedModel.pluralDisplayName.toLowerCase()} found`, s = t.relatedModel.name, i = t.relatedModel.pluralName;
315
315
  return p`
316
316
  <MultiSelect.Field {form} type="${e}" name="${t.name}" class="col-span-1">
317
317
  <Form.Control>
318
318
  {#snippet children({ props })}
319
319
  <Form.Label>${t.title}</Form.Label>
320
320
  <MultiSelect.Trigger class="w-full justify-between">
321
- <MultiSelect.Input bind:value={${R(t)}} placeholder="${n}" {...props}>
321
+ <MultiSelect.Input bind:value={${M(t)}} placeholder="${n}" {...props}>
322
322
  {#snippet children({ selected })}
323
323
  <div class="flex flex-wrap gap-1">
324
324
  {#each selected as value}
@@ -335,7 +335,7 @@ function ve(t) {
335
335
  <MultiSelect.Content class="p-0">
336
336
  <Command.Root>
337
337
  <Command.Input autofocus placeholder="${r}" />
338
- <Command.Empty>${a}</Command.Empty>
338
+ <Command.Empty>${o}</Command.Empty>
339
339
  <Command.Group>
340
340
  {#each data.${i} as ${s}}
341
341
  <MultiSelect.Item value={${s}.id} label={${s}.${t.displayField}} />
@@ -348,13 +348,13 @@ function ve(t) {
348
348
  </MultiSelect.Field>
349
349
  `;
350
350
  }
351
- function we(t) {
351
+ function he(t) {
352
352
  return p`
353
353
  <Form.Field {form} name="${t.name}" class="col-span-1">
354
354
  <Form.Control>
355
355
  {#snippet children({ props })}
356
- ${P(t)}
357
- <Input {...props} type="text" value={${R(t)}}${L(t)} readonly />
356
+ ${R(t)}
357
+ <Input {...props} type="text" value={${M(t)}}${L(t)} readonly />
358
358
  {/snippet}
359
359
  </Form.Control>
360
360
  <Form.FieldErrors class="contents text-destructive" />
@@ -364,37 +364,37 @@ function we(t) {
364
364
  function et(t) {
365
365
  switch (t.type) {
366
366
  case "text":
367
- return z(t, "text");
367
+ return I(t, "text");
368
368
  case "number":
369
- return z(t, "number");
369
+ return I(t, "number");
370
370
  case "date":
371
- return z(t, "date");
371
+ return I(t, "date");
372
372
  case "email":
373
- return z(t, "email");
373
+ return I(t, "email");
374
374
  case "password":
375
- return z(t, "password");
375
+ return I(t, "password");
376
376
  case "url":
377
- return z(t, "url");
377
+ return I(t, "url");
378
378
  case "autodate":
379
- return we(t);
379
+ return he(t);
380
380
  case "editor":
381
381
  case "json":
382
- return de(t);
382
+ return ce(t);
383
383
  case "bool":
384
- return fe(t);
384
+ return me(t);
385
385
  case "geoPoint":
386
- return he(t);
386
+ return ue(t);
387
387
  case "file":
388
- return ge(t);
388
+ return pe(t);
389
389
  case "select":
390
- return be(t);
390
+ return de(t);
391
391
  case "relation":
392
- return ve(t);
392
+ return fe(t);
393
393
  default:
394
394
  return t;
395
395
  }
396
396
  }
397
- function At(t) {
397
+ function Tt(t) {
398
398
  const e = t.options.map(
399
399
  (n) => p`
400
400
  ${JSON.stringify(n.value)}: {
@@ -411,13 +411,13 @@ function At(t) {
411
411
  `;
412
412
  }
413
413
  function O(t) {
414
- const e = t.flatMap((n) => ue[n.type]);
414
+ const e = t.flatMap((n) => ie[n.type]);
415
415
  return [...new Set(e)];
416
416
  }
417
417
  function nt(t) {
418
- return [...new Set(t.flatMap((e) => pe[e]))];
418
+ return [...new Set(t.flatMap((e) => le[e]))];
419
419
  }
420
- function M(t, e) {
420
+ function P(t, e) {
421
421
  return `data.${t.name}.${e.name}`;
422
422
  }
423
423
  function J(t, e, n) {
@@ -428,8 +428,8 @@ function J(t, e, n) {
428
428
  </div>
429
429
  `;
430
430
  }
431
- function ye(t, e) {
432
- const n = M(t, e), r = `<p class="text-muted-foreground">{new Date(${n}).toLocaleDateString()}</p>`, a = e.required ? r : p`
431
+ function ge(t, e) {
432
+ const n = P(t, e), r = `<p class="text-muted-foreground">{new Date(${n}).toLocaleDateString()}</p>`, o = e.required ? r : p`
433
433
  {#if ${n}}
434
434
  ${r}
435
435
  {/if}
@@ -437,16 +437,16 @@ function ye(t, e) {
437
437
  return p`
438
438
  <div class="space-y-2">
439
439
  <h3 class="font-medium leading-none">${e.title}</h3>
440
- ${a}
440
+ ${o}
441
441
  </div>
442
442
  `;
443
443
  }
444
- function xe(t, e) {
445
- const n = M(t, e), r = p`
444
+ function be(t, e) {
445
+ const n = P(t, e), r = p`
446
446
  <a href={${n}} target="_blank" rel="noopener noreferrer">
447
447
  {${n}}
448
448
  </a>
449
- `, a = e.required ? r : p`
449
+ `, o = e.required ? r : p`
450
450
  {#if ${n}}
451
451
  ${r}
452
452
  {/if}
@@ -455,13 +455,13 @@ function xe(t, e) {
455
455
  <div class="space-y-2">
456
456
  <h3 class="font-medium leading-none">${e.title}</h3>
457
457
  <p class="text-muted-foreground">
458
- ${a}
458
+ ${o}
459
459
  </p>
460
460
  </div>
461
461
  `;
462
462
  }
463
- function $e(t, e) {
464
- const n = M(t, e);
463
+ function ve(t, e) {
464
+ const n = P(t, e);
465
465
  if (e.maxSelect > 1)
466
466
  return p`
467
467
  <div class="space-y-2">
@@ -471,7 +471,7 @@ function $e(t, e) {
471
471
  {/each}
472
472
  </div>
473
473
  `;
474
- const r = `<Badge variant="outline" class="mr-1">{${e.name}Labels[${n}].label}</Badge>`, a = e.required ? r : p`
474
+ const r = `<Badge variant="outline" class="mr-1">{${e.name}Labels[${n}].label}</Badge>`, o = e.required ? r : p`
475
475
  {#if ${n}}
476
476
  ${r}
477
477
  {/if}
@@ -479,12 +479,12 @@ function $e(t, e) {
479
479
  return p`
480
480
  <div class="space-y-2">
481
481
  <h3 class="font-medium leading-none">${e.title}</h3>
482
- ${a}
482
+ ${o}
483
483
  </div>
484
484
  `;
485
485
  }
486
- function Fe(t, e) {
487
- const n = M(t, e);
486
+ function we(t, e) {
487
+ const n = P(t, e);
488
488
  return e.maxSelect > 1 ? p`
489
489
  <div class="space-y-2">
490
490
  <h3 class="font-medium leading-none">${e.title}</h3>
@@ -529,11 +529,11 @@ function Fe(t, e) {
529
529
  </div>
530
530
  `;
531
531
  }
532
- function Ce(t) {
532
+ function ye(t) {
533
533
  return `/${t.relatedModel.routeSegment}`;
534
534
  }
535
- function _e(t, e) {
536
- const n = `data.${t.name}.expand?.${e.name}`, r = Ce(e);
535
+ function xe(t, e) {
536
+ const n = `data.${t.name}.expand?.${e.name}`, r = ye(e);
537
537
  return e.maxSelect > 1 ? p`
538
538
  <div class="space-y-2">
539
539
  <h3 class="font-medium leading-none">${e.title}</h3>
@@ -560,8 +560,8 @@ function _e(t, e) {
560
560
  </div>
561
561
  `;
562
562
  }
563
- function Se(t, e) {
564
- const n = M(t, e), r = p`
563
+ function $e(t, e) {
564
+ const n = P(t, e), r = p`
565
565
  {#await import("$lib/components/ui/leaflet/leaflet.svelte")}
566
566
  <div class="h-56.25 w-full bg-input rounded-md"></div>
567
567
  {:then { default: Leaflet }}
@@ -570,7 +570,7 @@ function Se(t, e) {
570
570
  <p class="text-muted-foreground">
571
571
  {${n}?.lat.toFixed(6)}, {${n}?.lon.toFixed(6)}
572
572
  </p>
573
- `, a = e.required ? r : p`
573
+ `, o = e.required ? r : p`
574
574
  {#if ${n}}
575
575
  ${r}
576
576
  {/if}
@@ -578,17 +578,17 @@ function Se(t, e) {
578
578
  return p`
579
579
  <div class="space-y-2">
580
580
  <h3 class="font-medium leading-none">${e.title}</h3>
581
- ${a}
581
+ ${o}
582
582
  </div>
583
583
  `;
584
584
  }
585
- function ke(t, e) {
585
+ function Fe(t, e) {
586
586
  switch (e.type) {
587
587
  case "text":
588
588
  case "number":
589
589
  case "email":
590
590
  case "editor":
591
- return J(t, e, `{${M(t, e)}}`);
591
+ return J(t, e, `{${P(t, e)}}`);
592
592
  case "password":
593
593
  return p`
594
594
  <div class="space-y-2">
@@ -602,31 +602,31 @@ function ke(t, e) {
602
602
  return J(
603
603
  t,
604
604
  e,
605
- `{${M(t, e)} ? "Yes" : "No"}`
605
+ `{${P(t, e)} ? "Yes" : "No"}`
606
606
  );
607
607
  case "date":
608
608
  case "autodate":
609
- return ye(t, e);
609
+ return ge(t, e);
610
610
  case "url":
611
- return xe(t, e);
611
+ return be(t, e);
612
612
  case "select":
613
- return $e(t, e);
613
+ return ve(t, e);
614
614
  case "file":
615
- return Fe(t, e);
615
+ return we(t, e);
616
616
  case "json":
617
- return J(t, e, `{JSON.stringify(${M(t, e)})}`);
617
+ return J(t, e, `{JSON.stringify(${P(t, e)})}`);
618
618
  case "geoPoint":
619
- return Se(t, e);
619
+ return $e(t, e);
620
620
  case "relation":
621
- return _e(t, e);
621
+ return xe(t, e);
622
622
  default:
623
623
  return e;
624
624
  }
625
625
  }
626
- const Me = new RegExp("([\\p{Ll}\\d])(\\p{Lu})", "gu"), Re = new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])", "gu"), Pe = new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d", "u"), Ee = /[^\p{L}\d]+/giu, dt = "$1\0$2", ft = "";
627
- function Nt(t) {
626
+ const Ce = new RegExp("([\\p{Ll}\\d])(\\p{Lu})", "gu"), _e = new RegExp("(\\p{Lu})([\\p{Lu}][\\p{Ll}])", "gu"), Se = new RegExp("(\\d)\\p{Ll}|(\\p{L})\\d", "u"), ke = /[^\p{L}\d]+/giu, dt = "$1\0$2", ft = "";
627
+ function zt(t) {
628
628
  let e = t.trim();
629
- e = e.replace(Me, dt).replace(Re, dt), e = e.replace(Ee, "\0");
629
+ e = e.replace(Ce, dt).replace(_e, dt), e = e.replace(ke, "\0");
630
630
  let n = 0, r = e.length;
631
631
  for (; e.charAt(n) === "\0"; )
632
632
  n++;
@@ -636,38 +636,38 @@ function Nt(t) {
636
636
  r--;
637
637
  return e.slice(n, r).split(/\0/g);
638
638
  }
639
- function Ie(t) {
640
- const e = Nt(t);
639
+ function Pe(t) {
640
+ const e = zt(t);
641
641
  for (let n = 0; n < e.length; n++) {
642
- const r = e[n], a = Pe.exec(r);
643
- if (a) {
644
- const s = a.index + (a[1] ?? a[2]).length;
642
+ const r = e[n], o = Se.exec(r);
643
+ if (o) {
644
+ const s = o.index + (o[1] ?? o[2]).length;
645
645
  e.splice(n, 1, r.slice(0, s), r.slice(s));
646
646
  }
647
647
  }
648
648
  return e;
649
649
  }
650
- function Bt(t, e) {
651
- const [n, r, a] = G(t, e);
652
- return n + r.map(H(e == null ? void 0 : e.locale)).join((e == null ? void 0 : e.delimiter) ?? " ") + a;
650
+ function It(t, e) {
651
+ const [n, r, o] = G(t, e);
652
+ return n + r.map(H(e == null ? void 0 : e.locale)).join((e == null ? void 0 : e.delimiter) ?? " ") + o;
653
653
  }
654
654
  function N(t, e) {
655
- const [n, r, a] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale), o = jt(s, i);
656
- return n + r.map((c, m) => m === 0 ? s(c) : o(c, m)).join("") + a;
655
+ const [n, r, o] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale), a = At(s, i);
656
+ return n + r.map((c, m) => m === 0 ? s(c) : a(c, m)).join("") + o;
657
657
  }
658
- function Te(t, e) {
659
- const [n, r, a] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale), o = jt(s, i);
660
- return n + r.map(o).join("") + a;
658
+ function Me(t, e) {
659
+ const [n, r, o] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale), a = At(s, i);
660
+ return n + r.map(a).join("") + o;
661
661
  }
662
662
  function rt(t, e) {
663
- const [n, r, a] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale);
664
- return n + r.map(Ae(s, i)).join(" ") + a;
663
+ const [n, r, o] = G(t, e), s = H(e == null ? void 0 : e.locale), i = at(e == null ? void 0 : e.locale);
664
+ return n + r.map(Te(s, i)).join(" ") + o;
665
665
  }
666
- function ze(t, e) {
667
- return Bt(t, { delimiter: "-", ...e });
666
+ function Re(t, e) {
667
+ return It(t, { delimiter: "-", ...e });
668
668
  }
669
- function De(t, e) {
670
- return Bt(t, { delimiter: "_", ...e });
669
+ function Ee(t, e) {
670
+ return It(t, { delimiter: "_", ...e });
671
671
  }
672
672
  function H(t) {
673
673
  return t === !1 ? (e) => e.toLowerCase() : (e) => e.toLocaleLowerCase(t);
@@ -675,29 +675,29 @@ function H(t) {
675
675
  function at(t) {
676
676
  return (e) => e.toLocaleUpperCase(t);
677
677
  }
678
- function Ae(t, e) {
678
+ function Te(t, e) {
679
679
  return (n) => `${e(n[0])}${t(n.slice(1))}`;
680
680
  }
681
- function jt(t, e) {
681
+ function At(t, e) {
682
682
  return (n, r) => {
683
- const a = n[0];
684
- return (r > 0 && a >= "0" && a <= "9" ? "_" + a : e(a)) + t(n.slice(1));
683
+ const o = n[0];
684
+ return (r > 0 && o >= "0" && o <= "9" ? "_" + o : e(o)) + t(n.slice(1));
685
685
  };
686
686
  }
687
687
  function G(t, e = {}) {
688
- const n = e.split ?? (e.separateNumbers ? Ie : Nt), r = e.prefixCharacters ?? ft, a = e.suffixCharacters ?? ft;
688
+ const n = e.split ?? (e.separateNumbers ? Pe : zt), r = e.prefixCharacters ?? ft, o = e.suffixCharacters ?? ft;
689
689
  let s = 0, i = t.length;
690
690
  for (; s < t.length; ) {
691
- const o = t.charAt(s);
692
- if (!r.includes(o))
691
+ const a = t.charAt(s);
692
+ if (!r.includes(a))
693
693
  break;
694
694
  s++;
695
695
  }
696
696
  for (; i > s; ) {
697
- const o = i - 1, c = t.charAt(o);
698
- if (!a.includes(c))
697
+ const a = i - 1, c = t.charAt(a);
698
+ if (!o.includes(c))
699
699
  break;
700
- i = o;
700
+ i = a;
701
701
  }
702
702
  return [
703
703
  t.slice(0, s),
@@ -705,20 +705,20 @@ function G(t, e = {}) {
705
705
  t.slice(i)
706
706
  ];
707
707
  }
708
- function Ne(t) {
708
+ function ze(t) {
709
709
  return t && t.__esModule && Object.prototype.hasOwnProperty.call(t, "default") ? t.default : t;
710
710
  }
711
- function Be(t) {
711
+ function Ie(t) {
712
712
  throw new Error('Could not dynamically require "' + t + '". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.');
713
713
  }
714
- var V = { exports: {} }, je = V.exports, ht;
715
- function Le() {
714
+ var V = { exports: {} }, Ae = V.exports, ht;
715
+ function De() {
716
716
  return ht || (ht = 1, (function(t, e) {
717
717
  (function(n, r) {
718
- typeof Be == "function" ? t.exports = r() : n.pluralize = r();
719
- })(je, function() {
720
- var n = [], r = [], a = {}, s = {}, i = {};
721
- function o(l) {
718
+ typeof Ie == "function" ? t.exports = r() : n.pluralize = r();
719
+ })(Ae, function() {
720
+ var n = [], r = [], o = {}, s = {}, i = {};
721
+ function a(l) {
722
722
  return typeof l == "string" ? new RegExp("^" + l + "$", "i") : l;
723
723
  }
724
724
  function c(l, d) {
@@ -736,7 +736,7 @@ function Le() {
736
736
  });
737
737
  }
738
738
  function f(l, d, w) {
739
- if (!l.length || a.hasOwnProperty(l))
739
+ if (!l.length || o.hasOwnProperty(l))
740
740
  return d;
741
741
  for (var $ = w.length; $--; ) {
742
742
  var F = w[$];
@@ -752,8 +752,8 @@ function Le() {
752
752
  }
753
753
  function x(l, d, w, $) {
754
754
  return function(F) {
755
- var I = F.toLowerCase();
756
- return d.hasOwnProperty(I) ? !0 : l.hasOwnProperty(I) ? !1 : f(I, I, w) === I;
755
+ var T = F.toLowerCase();
756
+ return d.hasOwnProperty(T) ? !0 : l.hasOwnProperty(T) ? !1 : f(T, T, w) === T;
757
757
  };
758
758
  }
759
759
  function u(l, d, w) {
@@ -777,12 +777,12 @@ function Le() {
777
777
  i,
778
778
  r
779
779
  ), u.addPluralRule = function(l, d) {
780
- n.push([o(l), d]);
780
+ n.push([a(l), d]);
781
781
  }, u.addSingularRule = function(l, d) {
782
- r.push([o(l), d]);
782
+ r.push([a(l), d]);
783
783
  }, u.addUncountableRule = function(l) {
784
784
  if (typeof l == "string") {
785
- a[l.toLowerCase()] = !0;
785
+ o[l.toLowerCase()] = !0;
786
786
  return;
787
787
  }
788
788
  u.addPluralRule(l, "$0"), u.addSingularRule(l, "$0");
@@ -1011,8 +1011,8 @@ function Le() {
1011
1011
  });
1012
1012
  })(V)), V.exports;
1013
1013
  }
1014
- var Oe = Le();
1015
- const S = /* @__PURE__ */ Ne(Oe), Pa = "data", Ea = "migrations", qe = "(app)", Ue = /* @__PURE__ */ new Set([
1014
+ var Ne = De();
1015
+ const S = /* @__PURE__ */ ze(Ne), $a = "data", Fa = "migrations", Be = "(app)", je = /* @__PURE__ */ new Set([
1016
1016
  "break",
1017
1017
  "case",
1018
1018
  "catch",
@@ -1064,7 +1064,7 @@ const S = /* @__PURE__ */ Ne(Oe), Pa = "data", Ea = "migrations", qe = "(app)",
1064
1064
  "async",
1065
1065
  "arguments",
1066
1066
  "constructor"
1067
- ]), Ve = {
1067
+ ]), Le = {
1068
1068
  function: "fn",
1069
1069
  interface: "iface",
1070
1070
  type: "type_",
@@ -1114,7 +1114,7 @@ const S = /* @__PURE__ */ Ne(Oe), Pa = "data", Ea = "migrations", qe = "(app)",
1114
1114
  constructor: "ctor"
1115
1115
  };
1116
1116
  function Z(t) {
1117
- return Ue.has(t) ? Ve[t] ?? `${t}_` : t;
1117
+ return je.has(t) ? Le[t] ?? `${t}_` : t;
1118
1118
  }
1119
1119
  function K(t) {
1120
1120
  if (!/^[a-zA-Z][a-zA-Z0-9-_/]*$/.test(t))
@@ -1122,24 +1122,24 @@ function K(t) {
1122
1122
  "Model path must start with a letter and contain only alphanumeric characters, dash, slash, or underscore"
1123
1123
  );
1124
1124
  }
1125
- function He(t) {
1126
- return t.features.auth ? `src/routes/${qe}` : "src/routes";
1125
+ function Oe(t) {
1126
+ return t.features.auth ? `src/routes/${Be}` : "src/routes";
1127
1127
  }
1128
1128
  function E(t, e) {
1129
- const n = t.split("/"), r = n[n.length - 1], a = n.slice(0, -1), s = S.singular(rt(r)), i = S.plural(s), o = N(s), c = ze(i), m = [...a, c].join("/");
1129
+ const n = t.split("/"), r = n[n.length - 1], o = n.slice(0, -1), s = S.singular(rt(r)), i = S.plural(s), a = N(s), c = Re(i), m = [...o, c].join("/");
1130
1130
  return {
1131
- name: Z(o),
1131
+ name: Z(a),
1132
1132
  pluralName: Z(N(i)),
1133
- typeName: Te(s),
1134
- tableName: De(i),
1133
+ typeName: Me(s),
1134
+ tableName: Ee(i),
1135
1135
  displayName: s,
1136
1136
  pluralDisplayName: i,
1137
- schemaName: `${Z(o)}Schema`,
1137
+ schemaName: `${Z(a)}Schema`,
1138
1138
  routeSegment: m,
1139
- routesDir: He(e)
1139
+ routesDir: Oe(e)
1140
1140
  };
1141
1141
  }
1142
- function Ge(t) {
1142
+ function qe(t) {
1143
1143
  const e = `${t.routesDir}/${t.routeSegment}`;
1144
1144
  return {
1145
1145
  list: e,
@@ -1148,7 +1148,7 @@ function Ge(t) {
1148
1148
  edit: `${e}/[id]/edit`
1149
1149
  };
1150
1150
  }
1151
- function Ke(t) {
1151
+ function Ue(t) {
1152
1152
  const e = `/${t.routeSegment}`;
1153
1153
  return {
1154
1154
  list: e,
@@ -1157,7 +1157,7 @@ function Ke(t) {
1157
1157
  edit: `${e}/[id]/edit`
1158
1158
  };
1159
1159
  }
1160
- const We = [
1160
+ const Ve = [
1161
1161
  "title",
1162
1162
  "name",
1163
1163
  "label",
@@ -1191,24 +1191,24 @@ const We = [
1191
1191
  "url",
1192
1192
  "id"
1193
1193
  ];
1194
- function Xe(t) {
1195
- for (const e of We)
1194
+ function He(t) {
1195
+ for (const e of Ve)
1196
1196
  if (t.some((n) => n.name === e))
1197
1197
  return e;
1198
1198
  return "id";
1199
1199
  }
1200
- function Ye(t) {
1200
+ function Ge(t) {
1201
1201
  return t.map((e) => e.name).filter((e) => !e.startsWith("_"));
1202
1202
  }
1203
- function Je(t) {
1203
+ function Ke(t) {
1204
1204
  return Object.fromEntries(t.map((e) => [e.name, e.id]));
1205
1205
  }
1206
- function Lt(t) {
1206
+ function Dt(t) {
1207
1207
  return Object.fromEntries(
1208
- t.map((e) => [e.name, Xe(e.fields)])
1208
+ t.map((e) => [e.name, He(e.fields)])
1209
1209
  );
1210
1210
  }
1211
- const Ze = [
1211
+ const We = [
1212
1212
  "user",
1213
1213
  "owner",
1214
1214
  "created_by",
@@ -1217,7 +1217,7 @@ const Ze = [
1217
1217
  "account",
1218
1218
  "creator"
1219
1219
  ];
1220
- function D(t) {
1220
+ function A(t) {
1221
1221
  return t.toLowerCase();
1222
1222
  }
1223
1223
  function gt(t) {
@@ -1228,15 +1228,15 @@ function gt(t) {
1228
1228
  operator: "="
1229
1229
  };
1230
1230
  }
1231
- function Qe(t, e, n = {}) {
1232
- const r = new Set((n.authCollections ?? ["users"]).map(D)), a = new Set(
1233
- (n.userFieldHints ?? Ze).map(D)
1234
- ), s = n.maxDepth ?? 8, i = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Map();
1231
+ function Xe(t, e, n = {}) {
1232
+ const r = new Set((n.authCollections ?? ["users"]).map(A)), o = new Set(
1233
+ (n.userFieldHints ?? We).map(A)
1234
+ ), s = n.maxDepth ?? 8, i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map();
1235
1235
  for (const b of t)
1236
- i.set(b.name, b), o.set(b.id, b);
1236
+ i.set(b.name, b), a.set(b.id, b);
1237
1237
  if (!i.has(e))
1238
1238
  return gt(e);
1239
- if (r.has(D(e)))
1239
+ if (r.has(A(e)))
1240
1240
  return {
1241
1241
  rule: "@request.auth.id = id",
1242
1242
  ownershipChainCollections: [e],
@@ -1244,8 +1244,8 @@ function Qe(t, e, n = {}) {
1244
1244
  operator: "="
1245
1245
  };
1246
1246
  function c(b) {
1247
- const v = D(b);
1248
- return v === "user" ? 50 : a.has(v) ? 20 : 0;
1247
+ const v = A(b);
1248
+ return v === "user" ? 50 : o.has(v) ? 20 : 0;
1249
1249
  }
1250
1250
  function m(b) {
1251
1251
  const v = i.get(b);
@@ -1253,19 +1253,19 @@ function Qe(t, e, n = {}) {
1253
1253
  const C = [];
1254
1254
  for (const y of v.fields) {
1255
1255
  if (y.type !== "relation" || !y.collectionId) continue;
1256
- const T = o.get(y.collectionId);
1257
- T && C.push({
1256
+ const z = a.get(y.collectionId);
1257
+ z && C.push({
1258
1258
  from: b,
1259
1259
  fieldName: y.name,
1260
- to: T.name,
1260
+ to: z.name,
1261
1261
  isMulti: !!(y.maxSelect && y.maxSelect > 1),
1262
1262
  hintScore: c(y.name)
1263
1263
  });
1264
1264
  }
1265
- return C.sort((y, T) => y.fieldName.localeCompare(T.fieldName)), C;
1265
+ return C.sort((y, z) => y.fieldName.localeCompare(z.fieldName)), C;
1266
1266
  }
1267
1267
  function h(b) {
1268
- return r.has(D(b));
1268
+ return r.has(A(b));
1269
1269
  }
1270
1270
  function f(b) {
1271
1271
  if (b.length === 0) return !1;
@@ -1274,8 +1274,8 @@ function Qe(t, e, n = {}) {
1274
1274
  return h(b[b.length - 1].to);
1275
1275
  }
1276
1276
  function g(b) {
1277
- const v = b[b.length - 1], C = v.isMulti ? 1 : 0, y = b.every((Y) => !Y.isMulti) ? 1 : 0, T = b.reduce((Y, ne) => Y + ne.hintScore, 0), ee = D(v.fieldName) === "user" ? 1 : 0;
1278
- return 100 * b.length + 50 * C - 40 * ee - 15 * y - T;
1277
+ const v = b[b.length - 1], C = v.isMulti ? 1 : 0, y = b.every((Y) => !Y.isMulti) ? 1 : 0, z = b.reduce((Y, Zt) => Y + Zt.hintScore, 0), Jt = A(v.fieldName) === "user" ? 1 : 0;
1278
+ return 100 * b.length + 50 * C - 40 * Jt - 15 * y - z;
1279
1279
  }
1280
1280
  function x(b) {
1281
1281
  return b.map((v) => `${v.from}.${v.fieldName}->${v.to}`).join("|");
@@ -1297,18 +1297,18 @@ function Qe(t, e, n = {}) {
1297
1297
  const C = g(b) - g(v);
1298
1298
  return C !== 0 ? C : x(b).localeCompare(x(v));
1299
1299
  });
1300
- const w = u[0], $ = w.map((b) => b.fieldName), F = [e, ...w.map((b) => b.to)], lt = w[w.length - 1].isMulti ? "?=" : "=", Qt = $.join("."), te = n.includeRootPrefix ? (n.rootPrefix ?? e) + "." : "";
1300
+ const w = u[0], $ = w.map((b) => b.fieldName), F = [e, ...w.map((b) => b.to)], lt = w[w.length - 1].isMulti ? "?=" : "=", Xt = $.join("."), Yt = n.includeRootPrefix ? (n.rootPrefix ?? e) + "." : "";
1301
1301
  return {
1302
- rule: `@request.auth.id ${lt} ${te}${Qt}.id`,
1302
+ rule: `@request.auth.id ${lt} ${Yt}${Xt}.id`,
1303
1303
  ownershipChainCollections: F,
1304
1304
  ownershipChainFields: $,
1305
1305
  operator: lt
1306
1306
  };
1307
1307
  }
1308
- function tn(t) {
1308
+ function Ye(t) {
1309
1309
  let e = null, n = !1, r = 0;
1310
- for (let a = 0; a < t.length; a++) {
1311
- const s = t[a];
1310
+ for (let o = 0; o < t.length; o++) {
1311
+ const s = t[o];
1312
1312
  if (n) {
1313
1313
  n = !1;
1314
1314
  continue;
@@ -1334,7 +1334,7 @@ function tn(t) {
1334
1334
  continue;
1335
1335
  }
1336
1336
  if (s === ":" && r === 0)
1337
- return [t.slice(0, a), t.slice(a + 1)];
1337
+ return [t.slice(0, o), t.slice(o + 1)];
1338
1338
  }
1339
1339
  return [t, ""];
1340
1340
  }
@@ -1345,62 +1345,62 @@ function bt(t) {
1345
1345
  function vt(t) {
1346
1346
  let e = -1, n = null, r = !1;
1347
1347
  for (let i = 0; i < t.length; i++) {
1348
- const o = t[i];
1348
+ const a = t[i];
1349
1349
  if (r) {
1350
1350
  r = !1;
1351
1351
  continue;
1352
1352
  }
1353
1353
  if (n) {
1354
- if (o === "\\") {
1354
+ if (a === "\\") {
1355
1355
  r = !0;
1356
1356
  continue;
1357
1357
  }
1358
- o === n && (n = null);
1358
+ a === n && (n = null);
1359
1359
  continue;
1360
1360
  }
1361
- if (o === '"' || o === "'") {
1362
- n = o;
1361
+ if (a === '"' || a === "'") {
1362
+ n = a;
1363
1363
  continue;
1364
1364
  }
1365
- if (o === ":") {
1365
+ if (a === ":") {
1366
1366
  e = i;
1367
1367
  break;
1368
1368
  }
1369
1369
  }
1370
- let a, s;
1371
- return e >= 0 ? (a = t.slice(0, e).trim(), s = t.slice(e + 1).trim()) : (a = t.trim(), s = a), { label: bt(s), value: bt(a) };
1370
+ let o, s;
1371
+ return e >= 0 ? (o = t.slice(0, e).trim(), s = t.slice(e + 1).trim()) : (o = t.trim(), s = o), { label: bt(s), value: bt(o) };
1372
1372
  }
1373
- function en(t) {
1373
+ function Je(t) {
1374
1374
  const e = [];
1375
- let n = "", r = null, a = !1;
1375
+ let n = "", r = null, o = !1;
1376
1376
  for (let i = 0; i < t.length; i++) {
1377
- const o = t[i];
1378
- if (a) {
1379
- n += o, a = !1;
1377
+ const a = t[i];
1378
+ if (o) {
1379
+ n += a, o = !1;
1380
1380
  continue;
1381
1381
  }
1382
1382
  if (r) {
1383
- if (o === "\\") {
1384
- a = !0, n += o;
1383
+ if (a === "\\") {
1384
+ o = !0, n += a;
1385
1385
  continue;
1386
1386
  }
1387
- if (o === r) {
1388
- r = null, n += o;
1387
+ if (a === r) {
1388
+ r = null, n += a;
1389
1389
  continue;
1390
1390
  }
1391
- n += o;
1391
+ n += a;
1392
1392
  continue;
1393
1393
  }
1394
- if (o === '"' || o === "'") {
1395
- r = o, n += o;
1394
+ if (a === '"' || a === "'") {
1395
+ r = a, n += a;
1396
1396
  continue;
1397
1397
  }
1398
- if (o === ",") {
1398
+ if (a === ",") {
1399
1399
  const c = n.trim();
1400
1400
  c.length > 0 && e.push(vt(c)), n = "";
1401
1401
  continue;
1402
1402
  }
1403
- n += o;
1403
+ n += a;
1404
1404
  }
1405
1405
  const s = n.trim();
1406
1406
  return s.length > 0 && e.push(vt(s)), e;
@@ -1418,12 +1418,12 @@ const wt = {
1418
1418
  datetime: "date",
1419
1419
  timestamp: "date"
1420
1420
  };
1421
- function nn(t) {
1421
+ function Ze(t) {
1422
1422
  const e = t.endsWith("!");
1423
1423
  let n = e ? t.slice(0, -1) : t, r = [];
1424
1424
  if (n.startsWith("select(") && n.endsWith(")")) {
1425
- const a = n.slice(7, -1);
1426
- r = en(a), n = "select";
1425
+ const o = n.slice(7, -1);
1426
+ r = Je(o), n = "select";
1427
1427
  }
1428
1428
  return n === "files" ? { type: "file", required: e, selectOptions: r } : (n in wt && (n = wt[n]), { type: n, required: e, selectOptions: r });
1429
1429
  }
@@ -1431,11 +1431,11 @@ function yt(t) {
1431
1431
  const e = S.singular(t), n = S.plural(e);
1432
1432
  return t === n ? 99 : 1;
1433
1433
  }
1434
- function q(t, e, n, r, a, s) {
1435
- const i = E(e, s), o = S.singular(t), c = S.plural(o);
1434
+ function q(t, e, n, r, o, s) {
1435
+ const i = E(e, s), a = S.singular(t), c = S.plural(a);
1436
1436
  return {
1437
1437
  collectionId: r[e],
1438
- displayField: a[e] ?? "id",
1438
+ displayField: o[e] ?? "id",
1439
1439
  relatedModel: i,
1440
1440
  singularRelationName: N(
1441
1441
  `${n.displayName} ${i.displayName}`
@@ -1446,22 +1446,22 @@ function q(t, e, n, r, a, s) {
1446
1446
  maxSelect: t === c ? 999 : 1
1447
1447
  };
1448
1448
  }
1449
- function rn(t, e, n, r, a) {
1450
- const s = rt(t), { type: i, required: o, selectOptions: c } = e, m = Ye(r), h = Je(r), f = Lt(r), g = m.map((u) => S.singular(u));
1451
- if (a.features.auth && i === "current_user" && h.users) {
1449
+ function Qe(t, e, n, r, o) {
1450
+ const s = rt(t), { type: i, required: a, selectOptions: c } = e, m = Ge(r), h = Ke(r), f = Dt(r), g = m.map((u) => S.singular(u));
1451
+ if (o.features.auth && i === "current_user" && h.users) {
1452
1452
  const u = q(
1453
1453
  t,
1454
1454
  "users",
1455
1455
  n,
1456
1456
  h,
1457
1457
  f,
1458
- a
1458
+ o
1459
1459
  );
1460
1460
  return {
1461
1461
  type: "relation",
1462
1462
  name: t,
1463
1463
  title: s,
1464
- required: o,
1464
+ required: a,
1465
1465
  collectionId: u.collectionId,
1466
1466
  maxSelect: 1,
1467
1467
  displayField: u.displayField,
@@ -1477,14 +1477,14 @@ function rn(t, e, n, r, a) {
1477
1477
  throw new Error(
1478
1478
  `Invalid autodate field: ${t}. Must be one of created/created_at/updated/updated_at.`
1479
1479
  );
1480
- return { type: "autodate", name: t, title: s, required: o, onCreate: u, onUpdate: l };
1480
+ return { type: "autodate", name: t, title: s, required: a, onCreate: u, onUpdate: l };
1481
1481
  }
1482
1482
  if (i === "select")
1483
1483
  return {
1484
1484
  type: "select",
1485
1485
  name: t,
1486
1486
  title: s,
1487
- required: o,
1487
+ required: a,
1488
1488
  maxSelect: yt(t),
1489
1489
  options: c
1490
1490
  };
@@ -1493,7 +1493,7 @@ function rn(t, e, n, r, a) {
1493
1493
  type: "file",
1494
1494
  name: t,
1495
1495
  title: s,
1496
- required: o,
1496
+ required: a,
1497
1497
  maxSelect: yt(t)
1498
1498
  };
1499
1499
  if (i === "relation") {
@@ -1508,13 +1508,13 @@ function rn(t, e, n, r, a) {
1508
1508
  n,
1509
1509
  h,
1510
1510
  f,
1511
- a
1511
+ o
1512
1512
  );
1513
1513
  return {
1514
1514
  type: "relation",
1515
1515
  name: t,
1516
1516
  title: s,
1517
- required: o,
1517
+ required: a,
1518
1518
  ...d,
1519
1519
  isCurrentUser: !1
1520
1520
  };
@@ -1526,13 +1526,13 @@ function rn(t, e, n, r, a) {
1526
1526
  n,
1527
1527
  h,
1528
1528
  f,
1529
- a
1529
+ o
1530
1530
  );
1531
1531
  return {
1532
1532
  type: "relation",
1533
1533
  name: t,
1534
1534
  title: s,
1535
- required: o,
1535
+ required: a,
1536
1536
  ...u,
1537
1537
  isCurrentUser: !1
1538
1538
  };
@@ -1546,13 +1546,13 @@ function rn(t, e, n, r, a) {
1546
1546
  n,
1547
1547
  h,
1548
1548
  f,
1549
- a
1549
+ o
1550
1550
  );
1551
1551
  return {
1552
1552
  type: "relation",
1553
1553
  name: t,
1554
1554
  title: s,
1555
- required: o,
1555
+ required: a,
1556
1556
  collectionId: l.collectionId,
1557
1557
  displayField: l.displayField,
1558
1558
  relatedModel: l.relatedModel,
@@ -1579,7 +1579,7 @@ function rn(t, e, n, r, a) {
1579
1579
  "select",
1580
1580
  "file",
1581
1581
  "relation",
1582
- ...a.features.auth ? ["current_user"] : [],
1582
+ ...o.features.auth ? ["current_user"] : [],
1583
1583
  ...m
1584
1584
  ])
1585
1585
  ];
@@ -1598,31 +1598,31 @@ function rn(t, e, n, r, a) {
1598
1598
  throw new Error(
1599
1599
  `Invalid field type: ${i}. Valid types are: ${x.join(", ").replace("relation", "references")}`
1600
1600
  );
1601
- return { type: i, name: t, title: s, required: o };
1601
+ return { type: i, name: t, title: s, required: a };
1602
1602
  }
1603
- function an(t, e, n, r) {
1604
- const a = [];
1603
+ function tn(t, e, n, r) {
1604
+ const o = [];
1605
1605
  for (const i of t) {
1606
- const [o, c] = tn(i);
1607
- if (!o || !c)
1606
+ const [a, c] = Ye(i);
1607
+ if (!a || !c)
1608
1608
  throw new Error(
1609
1609
  `Invalid field format: ${i}. Expected format: name:type or name:type!`
1610
1610
  );
1611
- if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(o))
1611
+ if (!/^[a-zA-Z][a-zA-Z0-9]*$/.test(a))
1612
1612
  throw new Error(
1613
- `Invalid field name: ${o}. Must start with a letter and contain only alphanumeric characters`
1613
+ `Invalid field name: ${a}. Must start with a letter and contain only alphanumeric characters`
1614
1614
  );
1615
- const m = nn(c);
1616
- a.push(rn(o, m, e, n, r));
1615
+ const m = Ze(c);
1616
+ o.push(Qe(a, m, e, n, r));
1617
1617
  }
1618
- const s = r.features.auth ? Qe(
1618
+ const s = r.features.auth ? Xe(
1619
1619
  [
1620
1620
  ...n,
1621
1621
  {
1622
1622
  id: "new",
1623
1623
  name: e.tableName,
1624
1624
  type: "base",
1625
- fields: a.map((i) => ({
1625
+ fields: o.map((i) => ({
1626
1626
  name: i.name,
1627
1627
  type: i.type,
1628
1628
  collectionId: i.type === "relation" ? i.collectionId : void 0,
@@ -1632,20 +1632,20 @@ function an(t, e, n, r) {
1632
1632
  ],
1633
1633
  e.tableName
1634
1634
  ) : void 0;
1635
- return { fields: a, auth: s };
1635
+ return { fields: o, auth: s };
1636
1636
  }
1637
1637
  async function W(t, e, n) {
1638
1638
  let r;
1639
1639
  if (n.env === "runtime") {
1640
- const { getCollections: a } = await import("./env.runtime-BzRhpNR3.js");
1641
- r = await a();
1640
+ const { getCollections: o } = await import("./env.runtime-C0w1qoWl.js");
1641
+ r = await o();
1642
1642
  } else {
1643
- const { getPreviewCollections: a } = await import("./env.preview-HlXZOEL4.js");
1644
- r = a(n);
1643
+ const { getPreviewCollections: o } = await import("./env.preview-HlXZOEL4.js");
1644
+ r = o(n);
1645
1645
  }
1646
- return an(t, e, r, n);
1646
+ return tn(t, e, r, n);
1647
1647
  }
1648
- const on = "2024-01-01T00:00:00.000Z";
1648
+ const en = "2024-01-01T00:00:00.000Z";
1649
1649
  class B {
1650
1650
  constructor(e) {
1651
1651
  this.expression = e;
@@ -1659,7 +1659,7 @@ function Q(t) {
1659
1659
  ([n, r]) => `${JSON.stringify(n)}: ${tt(r)}`
1660
1660
  ).join(", ")} }`;
1661
1661
  }
1662
- function sn(t) {
1662
+ function nn(t) {
1663
1663
  switch (t) {
1664
1664
  case "text":
1665
1665
  case "number":
@@ -1695,11 +1695,11 @@ function sn(t) {
1695
1695
  return;
1696
1696
  }
1697
1697
  }
1698
- function A(t, e) {
1698
+ function D(t, e) {
1699
1699
  return t.replace("[id]", `\${${e}}`);
1700
1700
  }
1701
- function Ot(t, e, n) {
1702
- var r, a, s;
1701
+ function Nt(t, e, n) {
1702
+ var r, o, s;
1703
1703
  switch (t.type) {
1704
1704
  case "text":
1705
1705
  case "editor":
@@ -1709,7 +1709,7 @@ function Ot(t, e, n) {
1709
1709
  case "bool":
1710
1710
  return !0;
1711
1711
  case "date":
1712
- return on;
1712
+ return en;
1713
1713
  case "email":
1714
1714
  return `test-${t.name}@example.com`;
1715
1715
  case "password":
@@ -1721,7 +1721,7 @@ function Ot(t, e, n) {
1721
1721
  case "geoPoint":
1722
1722
  return n.forForm ? JSON.stringify({ lat: 40.7128, lon: -74.006 }) : { lat: 40.7128, lon: -74.006 };
1723
1723
  case "select": {
1724
- const i = ((a = (r = t.options) == null ? void 0 : r[0]) == null ? void 0 : a.value) ?? "default";
1724
+ const i = ((o = (r = t.options) == null ? void 0 : r[0]) == null ? void 0 : o.value) ?? "default";
1725
1725
  return t.maxSelect && t.maxSelect > 1 ? [i] : i;
1726
1726
  }
1727
1727
  case "relation": {
@@ -1739,69 +1739,69 @@ function Ot(t, e, n) {
1739
1739
  }
1740
1740
  function xt(t, e, n) {
1741
1741
  const r = {};
1742
- for (const a of t) {
1743
- if (a.type === "file" || a.type === "autodate")
1742
+ for (const o of t) {
1743
+ if (o.type === "file" || o.type === "autodate")
1744
1744
  continue;
1745
- if (n.authEnabled && a.type === "relation" && a.isCurrentUser) {
1746
- n.forForm || (r[a.name] = new B("context.user.id"));
1745
+ if (n.authEnabled && o.type === "relation" && o.isCurrentUser) {
1746
+ n.forForm || (r[o.name] = new B("context.user.id"));
1747
1747
  continue;
1748
1748
  }
1749
- const s = Ot(a, e, n);
1750
- s !== void 0 && (r[a.name] = s);
1749
+ const s = Nt(o, e, n);
1750
+ s !== void 0 && (r[o.name] = s);
1751
1751
  }
1752
1752
  return r;
1753
1753
  }
1754
- function ln(t, e, n) {
1755
- var a;
1754
+ function rn(t, e, n) {
1755
+ var o;
1756
1756
  const r = {};
1757
1757
  for (const s of t) {
1758
1758
  if (s.system || s.name === "id")
1759
1759
  continue;
1760
- const i = sn(s.type);
1760
+ const i = nn(s.type);
1761
1761
  if (!i || i === "file" || i === "autodate" || i === "relation" && !s.collectionId)
1762
1762
  continue;
1763
- let o;
1763
+ let a;
1764
1764
  if (i === "relation")
1765
- o = s.collectionId ? new B(
1765
+ a = s.collectionId ? new B(
1766
1766
  e[s.collectionId] ?? '"missing-relation-id"'
1767
1767
  ) : void 0;
1768
1768
  else if (i === "select") {
1769
- const c = ((a = s.values) == null ? void 0 : a[0]) ?? "default";
1770
- o = (s.maxSelect ?? 1) > 1 ? [c] : c;
1769
+ const c = ((o = s.values) == null ? void 0 : o[0]) ?? "default";
1770
+ a = (s.maxSelect ?? 1) > 1 ? [c] : c;
1771
1771
  } else
1772
- o = Ot(
1772
+ a = Nt(
1773
1773
  { name: s.name, type: i },
1774
1774
  e,
1775
1775
  { forForm: !1, authEnabled: n.features.auth }
1776
1776
  );
1777
- o !== void 0 && (r[s.name] = o);
1777
+ a !== void 0 && (r[s.name] = a);
1778
1778
  }
1779
1779
  return r;
1780
1780
  }
1781
- function cn(t) {
1781
+ function an(t) {
1782
1782
  t.email = new B(
1783
1783
  "`test-${Math.random().toString(36).slice(2)}@example.com`"
1784
1784
  ), t.password = "password", t.passwordConfirm = "password";
1785
1785
  }
1786
- function mn(t, e) {
1786
+ function on(t, e) {
1787
1787
  if (!t)
1788
1788
  return [];
1789
- const n = new Map(e.map((o) => [o.id, o])), r = /* @__PURE__ */ new Set(), a = /* @__PURE__ */ new Set(), s = [], i = (o) => {
1790
- if (r.has(o) || a.has(o))
1789
+ const n = new Map(e.map((a) => [a.id, a])), r = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), s = [], i = (a) => {
1790
+ if (r.has(a) || o.has(a))
1791
1791
  return;
1792
- const c = n.get(o);
1792
+ const c = n.get(a);
1793
1793
  if (c) {
1794
- a.add(o);
1794
+ o.add(a);
1795
1795
  for (const m of c.fields)
1796
1796
  m.type !== "relation" || !m.collectionId || i(m.collectionId);
1797
- a.delete(o), r.add(o), s.push(c);
1797
+ o.delete(a), r.add(a), s.push(c);
1798
1798
  }
1799
1799
  };
1800
- for (const o of t.fields)
1801
- o.type !== "relation" || !o.collectionId || i(o.collectionId);
1800
+ for (const a of t.fields)
1801
+ a.type !== "relation" || !a.collectionId || i(a.collectionId);
1802
1802
  return s;
1803
1803
  }
1804
- function un(t, e) {
1804
+ function sn(t, e) {
1805
1805
  if (!e.has(t))
1806
1806
  return e.add(t), t;
1807
1807
  let n = 2;
@@ -1810,7 +1810,7 @@ function un(t, e) {
1810
1810
  const r = `${t}${n}`;
1811
1811
  return e.add(r), r;
1812
1812
  }
1813
- function pn(t, e) {
1813
+ function ln(t, e) {
1814
1814
  return {
1815
1815
  id: `generated-${t.tableName}`,
1816
1816
  name: t.tableName,
@@ -1832,25 +1832,25 @@ function pn(t, e) {
1832
1832
  } : { name: n.name, type: n.type })
1833
1833
  };
1834
1834
  }
1835
- function qt(t, e, n, r) {
1836
- const a = r.find((l) => l.name === t.tableName) ?? pn(t, e), s = mn(a, r).filter(
1835
+ function Bt(t, e, n, r) {
1836
+ const o = r.find((l) => l.name === t.tableName) ?? ln(t, e), s = on(o, r).filter(
1837
1837
  (l) => !(n.features.auth && l.name === "users")
1838
- ), i = {}, o = [], c = /* @__PURE__ */ new Set();
1838
+ ), i = {}, a = [], c = /* @__PURE__ */ new Set();
1839
1839
  for (const l of s) {
1840
- const d = un(E(l.name, n).name, c);
1841
- o.push({ varName: d, collection: l }), i[l.id] = `${d}.id`;
1840
+ const d = sn(E(l.name, n).name, c);
1841
+ a.push({ varName: d, collection: l }), i[l.id] = `${d}.id`;
1842
1842
  }
1843
- const m = o.length ? `${o.map((l) => `let ${l.varName}: { id: string };`).join(`
1843
+ const m = a.length ? `${a.map((l) => `let ${l.varName}: { id: string };`).join(`
1844
1844
  `)}
1845
1845
 
1846
- ` : "", h = o.map(({ varName: l, collection: d }) => {
1847
- const w = ln(
1846
+ ` : "", h = a.map(({ varName: l, collection: d }) => {
1847
+ const w = rn(
1848
1848
  d.fields,
1849
1849
  i,
1850
1850
  n
1851
1851
  );
1852
- return d.type === "auth" && cn(w), `${l} = await context.admin.collection("${d.name}").create(${Q(w)});`;
1853
- }), f = o.slice().reverse().map(
1852
+ return d.type === "auth" && an(w), `${l} = await context.admin.collection("${d.name}").create(${Q(w)});`;
1853
+ }), f = a.slice().reverse().map(
1854
1854
  ({ varName: l, collection: d }) => `await context.admin.collection("${d.name}").delete(${l}.id);`
1855
1855
  ), g = n.features.auth ? "context.agent" : "context.request", x = n.features.auth ? `await context.agent.authenticateUser();
1856
1856
  ` : "";
@@ -1885,8 +1885,8 @@ function qt(t, e, n, r) {
1885
1885
  )
1886
1886
  };
1887
1887
  }
1888
- function dn(t, e, n, r, a) {
1889
- const { declarations: s, setupSection: i, requestAgent: o, modelDbData: c, modelFormData: m } = qt(t, n, r, a);
1888
+ function cn(t, e, n, r, o) {
1889
+ const { declarations: s, setupSection: i, requestAgent: a, modelDbData: c, modelFormData: m } = Bt(t, n, r, o);
1890
1890
  return p`
1891
1891
  import { afterEach, beforeEach, describe, expect, it } from "vitest";
1892
1892
 
@@ -1895,24 +1895,24 @@ function dn(t, e, n, r, a) {
1895
1895
 
1896
1896
  describe("GET ${e.list}", () => {
1897
1897
  it("should return a 200 status code", async (context) => {
1898
- const response = await ${o}.get("${e.list}");
1898
+ const response = await ${a}.get("${e.list}");
1899
1899
  expect(response.status).toBe(200);
1900
1900
  });
1901
1901
  });
1902
1902
 
1903
1903
  describe("GET ${e.new}", () => {
1904
1904
  it("should return a 200 status code", async (context) => {
1905
- const response = await ${o}.get("${e.new}");
1905
+ const response = await ${a}.get("${e.new}");
1906
1906
  expect(response.status).toBe(200);
1907
1907
  });
1908
1908
  });
1909
1909
 
1910
1910
  describe("POST ${e.new}", () => {
1911
1911
  it("should create a new ${t.displayName.toLowerCase()}", async (context) => {
1912
- const response = await ${o}.post("${e.new}").type("form").send(${m});
1912
+ const response = await ${a}.post("${e.new}").type("form").send(${m});
1913
1913
  expect(response.body.status).toBe(303);
1914
1914
 
1915
- const response2 = await ${o}.get(response.body.location);
1915
+ const response2 = await ${a}.get(response.body.location);
1916
1916
  expect(response2.status).toBe(200);
1917
1917
  });
1918
1918
  });
@@ -1920,12 +1920,12 @@ function dn(t, e, n, r, a) {
1920
1920
  describe("GET ${e.show}", () => {
1921
1921
  it("should return a 200 status code", async (context) => {
1922
1922
  const { id } = await context.admin.collection("${t.tableName}").create(${c});
1923
- const response = await ${o}.get(\`${A(e.show, "id")}\`);
1923
+ const response = await ${a}.get(\`${D(e.show, "id")}\`);
1924
1924
  expect(response.status).toBe(200);
1925
1925
  });
1926
1926
 
1927
1927
  it("should return a 404 status code", async (context) => {
1928
- const response = await ${o}.get("${e.show.replace("[id]", "non-existent")}");
1928
+ const response = await ${a}.get("${e.show.replace("[id]", "non-existent")}");
1929
1929
  expect(response.status).toBe(404);
1930
1930
  });
1931
1931
  });
@@ -1933,10 +1933,10 @@ function dn(t, e, n, r, a) {
1933
1933
  describe("POST ${e.show}", () => {
1934
1934
  it("should delete a ${t.displayName.toLowerCase()}", async (context) => {
1935
1935
  const { id } = await context.admin.collection("${t.tableName}").create(${c});
1936
- const response = await ${o}.post(\`${A(e.show, "id")}\`).type("form");
1936
+ const response = await ${a}.post(\`${D(e.show, "id")}\`).type("form");
1937
1937
  expect(response.body.status).toBe(303);
1938
1938
 
1939
- const response2 = await ${o}.get(\`${A(e.show, "id")}\`);
1939
+ const response2 = await ${a}.get(\`${D(e.show, "id")}\`);
1940
1940
  expect(response2.status).toBe(404);
1941
1941
  });
1942
1942
  });
@@ -1944,7 +1944,7 @@ function dn(t, e, n, r, a) {
1944
1944
  describe("GET ${e.edit}", () => {
1945
1945
  it("should return a 200 status code", async (context) => {
1946
1946
  const { id } = await context.admin.collection("${t.tableName}").create(${c});
1947
- const response = await ${o}.get(\`${A(e.edit, "id")}\`);
1947
+ const response = await ${a}.get(\`${D(e.edit, "id")}\`);
1948
1948
  expect(response.status).toBe(200);
1949
1949
  });
1950
1950
  });
@@ -1952,19 +1952,19 @@ function dn(t, e, n, r, a) {
1952
1952
  describe("POST ${e.edit}", () => {
1953
1953
  it("should update a ${t.displayName.toLowerCase()}", async (context) => {
1954
1954
  const { id } = await context.admin.collection("${t.tableName}").create(${c});
1955
- const response = await ${o}
1956
- .post(\`${A(e.edit, "id")}\`)
1955
+ const response = await ${a}
1956
+ .post(\`${D(e.edit, "id")}\`)
1957
1957
  .type("form")
1958
1958
  .send(${m});
1959
1959
  expect(response.body.status).toBe(303);
1960
- expect(response.body.location).toBe(\`${A(e.show, "id")}\`);
1960
+ expect(response.body.location).toBe(\`${D(e.show, "id")}\`);
1961
1961
  });
1962
1962
  });
1963
1963
  });
1964
1964
  `;
1965
1965
  }
1966
- function fn(t, e, n, r, a) {
1967
- const { declarations: s, setupSection: i, requestAgent: o, modelFormData: c } = qt(t, n, r, a);
1966
+ function mn(t, e, n, r, o) {
1967
+ const { declarations: s, setupSection: i, requestAgent: a, modelFormData: c } = Bt(t, n, r, o);
1968
1968
  return p`
1969
1969
  import { afterEach, beforeEach, describe, expect, it } from "vitest";
1970
1970
 
@@ -1973,52 +1973,46 @@ function fn(t, e, n, r, a) {
1973
1973
 
1974
1974
  describe("GET ${e}", () => {
1975
1975
  it("should return a 200 status code", async (context) => {
1976
- const response = await ${o}.get("${e}");
1976
+ const response = await ${a}.get("${e}");
1977
1977
  expect(response.status).toBe(200);
1978
1978
  });
1979
1979
  });
1980
1980
 
1981
1981
  describe("POST ${e}", () => {
1982
1982
  it("should submit the form successfully", async (context) => {
1983
- const response = await ${o}.post("${e}").type("form").send(${c});
1983
+ const response = await ${a}.post("${e}").type("form").send(${c});
1984
1984
  expect(response.body.status).toBe(200);
1985
1985
  });
1986
1986
  });
1987
1987
  });
1988
1988
  `;
1989
1989
  }
1990
- var $t = Object.freeze, hn = Object.defineProperty, gn = (t, e) => $t(hn(t, "raw", { value: $t(t.slice()) })), Ft;
1991
- const Ct = 2, bn = 3;
1992
- function vn(t, e) {
1993
- const n = t.replace(/^\/+|\/+$/g, ""), r = `${e}/${n}`, a = `/${n}`;
1990
+ var $t = Object.freeze, un = Object.defineProperty, pn = (t, e) => $t(un(t, "raw", { value: $t(t.slice()) })), Ft;
1991
+ function dn(t, e) {
1992
+ const n = t.replace(/^\/+|\/+$/g, ""), r = `${e}/${n}`, o = `/${n}`;
1994
1993
  return {
1995
1994
  pagePath: `${r}/new`,
1996
- pageUrl: `${a}/new`
1995
+ pageUrl: `${o}/new`
1997
1996
  };
1998
1997
  }
1999
- function wn(t) {
2000
- if (t.length <= Ct)
2001
- throw new Error(
2002
- "Invalid command arguments. Expected: generate form <model> <fields...>"
2003
- );
2004
- const [e, n] = t;
2005
- if (e !== "generate" || n !== "form")
1998
+ function fn(t) {
1999
+ const [e, ...n] = t;
2000
+ if (!e)
2006
2001
  throw new Error(
2007
- `Invalid command "${t.join(" ")}". Expected to start with "generate form".`
2002
+ "Invalid command arguments. Expected: <model> <fields...>"
2008
2003
  );
2009
- const r = t[Ct], a = t.slice(bn);
2010
- if (a.length === 0)
2004
+ if (n.length === 0)
2011
2005
  throw new Error("At least one field definition is required.");
2012
- return { modelPath: r, fields: a };
2006
+ return { modelPath: e, fields: n };
2013
2007
  }
2014
- function Ut(t) {
2008
+ function jt(t) {
2015
2009
  return t.some((e) => e.type === "file");
2016
2010
  }
2017
- function yn(t) {
2011
+ function hn(t) {
2018
2012
  return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t) ? t : `'${t}'`;
2019
2013
  }
2020
- function _t(t) {
2021
- const e = t.type === "select" ? `[${t.options.map((a) => JSON.stringify(a.value)).join(", ")}]` : "";
2014
+ function Ct(t) {
2015
+ const e = t.type === "select" ? `[${t.options.map((o) => JSON.stringify(o.value)).join(", ")}]` : "";
2022
2016
  let n;
2023
2017
  switch (t.type) {
2024
2018
  case "text":
@@ -2073,13 +2067,13 @@ function _t(t) {
2073
2067
  }
2074
2068
  return ["text"].includes(t.type) ? t.required ? `${n}.nonempty()` : `${n}.optional()` : t.required || t.type === "geoPoint" ? n : t.type === "file" && t.maxSelect <= 1 ? `${n}.optional().default("")` : `${n}.optional()`;
2075
2069
  }
2076
- function xn(t) {
2070
+ function gn(t) {
2077
2071
  const e = [];
2078
2072
  for (const n of t) {
2079
2073
  if (n.type === "file" && n.maxSelect > 1) {
2080
2074
  e.push({
2081
2075
  name: n.name,
2082
- schema: _t({ ...n, required: !1 })
2076
+ schema: Ct({ ...n, required: !1 })
2083
2077
  }), e.push({
2084
2078
  name: `${n.name}+`,
2085
2079
  schema: "z.instanceof(File).array().optional()"
@@ -2089,12 +2083,12 @@ function xn(t) {
2089
2083
  });
2090
2084
  continue;
2091
2085
  }
2092
- e.push({ name: n.name, schema: _t(n) });
2086
+ e.push({ name: n.name, schema: Ct(n) });
2093
2087
  }
2094
2088
  return e;
2095
2089
  }
2096
- function $n(t, e) {
2097
- const n = xn(e).map((r) => `${yn(r.name)}: ${r.schema}`).join(`,
2090
+ function bn(t, e) {
2091
+ const n = gn(e).map((r) => `${hn(r.name)}: ${r.schema}`).join(`,
2098
2092
  `);
2099
2093
  return p`
2100
2094
  import { z } from "zod/v3";
@@ -2104,7 +2098,7 @@ function $n(t, e) {
2104
2098
  });
2105
2099
  `;
2106
2100
  }
2107
- function Fn(t, e) {
2101
+ function vn(t, e) {
2108
2102
  const n = O(e), r = [
2109
2103
  'import { untrack } from "svelte";',
2110
2104
  'import { superForm } from "sveltekit-superforms";',
@@ -2114,10 +2108,10 @@ function Fn(t, e) {
2114
2108
  ];
2115
2109
  return [...new Set(r)];
2116
2110
  }
2117
- function Cn(t, e) {
2111
+ function wn(t, e) {
2118
2112
  const r = e.filter(
2119
- (a) => a.type === "select"
2120
- ).map((a) => At(a)).join(`
2113
+ (o) => o.type === "select"
2114
+ ).map((o) => Tt(o)).join(`
2121
2115
 
2122
2116
  `);
2123
2117
  return p`
@@ -2130,11 +2124,11 @@ function Cn(t, e) {
2130
2124
  const { form: formData } = form;
2131
2125
  `;
2132
2126
  }
2133
- function _n(t, e) {
2134
- const n = Fn(t, e).join(`
2135
- `), r = Cn(t, e), a = e.map((i) => et(i)).join(`
2136
- `), s = Ut(e) ? ' enctype="multipart/form-data"' : "";
2137
- return p(Ft || (Ft = gn([`
2127
+ function yn(t, e) {
2128
+ const n = vn(t, e).join(`
2129
+ `), r = wn(t, e), o = e.map((i) => et(i)).join(`
2130
+ `), s = jt(e) ? ' enctype="multipart/form-data"' : "";
2131
+ return p(Ft || (Ft = pn([`
2138
2132
  <script lang="ts">
2139
2133
  `, `
2140
2134
 
@@ -2157,10 +2151,10 @@ function _n(t, e) {
2157
2151
  </form>
2158
2152
  </div>
2159
2153
  </section>
2160
- `])), n, r, t.displayName, s, a);
2154
+ `])), n, r, t.displayName, s, o);
2161
2155
  }
2162
- function Sn(t, e) {
2163
- const n = Ut(e), r = p`
2156
+ function xn(t, e) {
2157
+ const n = jt(e), r = p`
2164
2158
  import { fail, superValidate${n ? ", withFiles" : ""} } from "sveltekit-superforms";
2165
2159
  import { zod } from "sveltekit-superforms/adapters";
2166
2160
  import { ${t.schemaName} } from "$lib/schemas/${t.name}";
@@ -2196,17 +2190,17 @@ function U(t, e) {
2196
2190
  content: e
2197
2191
  };
2198
2192
  }
2199
- async function kn(t) {
2200
- const { modelPath: e, fields: n } = wn(t.argv);
2193
+ async function $n(t) {
2194
+ const { modelPath: e, fields: n } = fn(t.argv);
2201
2195
  K(e);
2202
- const r = E(e, t), s = (await W(n, r, t)).fields, { pagePath: i, pageUrl: o } = vn(e, r.routesDir), c = t.env === "runtime" ? await (await import("./env.runtime-BzRhpNR3.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), m = [
2203
- U(`${i}/+page.svelte`, _n(r, s)),
2204
- U(`${i}/+page.server.ts`, Sn(r, s)),
2196
+ const r = E(e, t), s = (await W(n, r, t)).fields, { pagePath: i, pageUrl: a } = dn(e, r.routesDir), c = t.env === "runtime" ? await (await import("./env.runtime-C0w1qoWl.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), m = [
2197
+ U(`${i}/+page.svelte`, yn(r, s)),
2198
+ U(`${i}/+page.server.ts`, xn(r, s)),
2205
2199
  U(
2206
2200
  `${i}/server.test.ts`,
2207
- fn(r, o, s, t, c)
2201
+ mn(r, a, s, t, c)
2208
2202
  ),
2209
- U(`src/lib/schemas/${r.name}.ts`, $n(r, s))
2203
+ U(`src/lib/schemas/${r.name}.ts`, bn(r, s))
2210
2204
  ], h = O(s);
2211
2205
  return {
2212
2206
  creates: m,
@@ -2217,34 +2211,28 @@ async function kn(t) {
2217
2211
  collections: []
2218
2212
  };
2219
2213
  }
2220
- const Mn = "generate-form";
2221
- async function Rn(t) {
2222
- const e = await kn(t);
2214
+ const Fn = "generate-form";
2215
+ async function Cn(t) {
2216
+ const e = await $n(t);
2223
2217
  if (t.env !== "runtime")
2224
2218
  return k(e);
2225
2219
  const { writeResult: n } = await import("./write-result-DG5OAbe1.js");
2226
2220
  return n(await k(e), t);
2227
2221
  }
2228
- const Pn = {
2229
- slug: Mn,
2222
+ const _n = {
2223
+ slug: Fn,
2230
2224
  title: "Generate a form",
2231
2225
  summary: "Generates a form.",
2232
2226
  categories: ["forms"],
2233
2227
  tags: ["sveltekit", "superforms", "validation", "zod"],
2234
2228
  command: {
2235
2229
  raw: "vela generate form contact name:text email:email message:editor",
2236
- argv: [
2237
- "generate",
2238
- "form",
2239
- "contact",
2240
- "name:text",
2241
- "email:email",
2242
- "message:editor"
2243
- ]
2230
+ base: "vela generate form",
2231
+ argv: ["contact", "name:text", "email:email", "message:editor"]
2244
2232
  },
2245
2233
  baseline: "velastack",
2246
- generate: Rn
2247
- }, En = ["text"], In = {
2234
+ generate: Cn
2235
+ }, Sn = ["text"], kn = {
2248
2236
  string: "text",
2249
2237
  boolean: "bool",
2250
2238
  geopoint: "geoPoint",
@@ -2271,11 +2259,11 @@ const Pn = {
2271
2259
  geoPoint: "geoPoint",
2272
2260
  relation: "relation"
2273
2261
  };
2274
- function Tn(t) {
2262
+ function Pn(t) {
2275
2263
  return /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(t) ? t : `'${t}'`;
2276
2264
  }
2277
- function zn(t, e) {
2278
- const n = t.type === "select" ? `[${(t.options ?? []).map((a) => JSON.stringify(a.value)).join(", ")}]` : "";
2265
+ function Mn(t, e) {
2266
+ const n = t.type === "select" ? `[${(t.options ?? []).map((o) => JSON.stringify(o.value)).join(", ")}]` : "";
2279
2267
  let r;
2280
2268
  switch (t.type) {
2281
2269
  case "text":
@@ -2333,57 +2321,57 @@ function zn(t, e) {
2333
2321
  default:
2334
2322
  return t.type;
2335
2323
  }
2336
- return En.includes(t.type) ? t.required ? `${r}.nonempty()` : `${r}.optional()` : t.required || t.type === "geoPoint" ? r : t.type === "file" && (t.maxSelect ?? 1) <= 1 ? `${r}.optional().default("")` : `${r}.optional()`;
2324
+ return Sn.includes(t.type) ? t.required ? `${r}.nonempty()` : `${r}.optional()` : t.required || t.type === "geoPoint" ? r : t.type === "file" && (t.maxSelect ?? 1) <= 1 ? `${r}.optional().default("")` : `${r}.optional()`;
2337
2325
  }
2338
2326
  function ot(t, e, n) {
2339
2327
  const r = [];
2340
2328
  n.includeModelFields && (r.push({ name: "id", type: "text", required: !1 }), r.push({ name: "collectionId", type: "text", required: !1 }));
2341
- for (const o of e) {
2342
- if (o.type === "file" && o.maxSelect > 1) {
2343
- r.push({ ...o, required: !1 }), r.push({ name: `${o.name}+`, type: "file", required: !1, maxSelect: 999 }), r.push({ name: `${o.name}-`, type: "file", required: !1, maxSelect: 999 });
2329
+ for (const a of e) {
2330
+ if (a.type === "file" && a.maxSelect > 1) {
2331
+ r.push({ ...a, required: !1 }), r.push({ name: `${a.name}+`, type: "file", required: !1, maxSelect: 999 }), r.push({ name: `${a.name}-`, type: "file", required: !1, maxSelect: 999 });
2344
2332
  continue;
2345
2333
  }
2346
- r.push(o);
2334
+ r.push(a);
2347
2335
  }
2348
- const a = r.map((o) => `${Tn(o.name)}: ${zn(o, n)}`).join(`,
2336
+ const o = r.map((a) => `${Pn(a.name)}: ${Mn(a, n)}`).join(`,
2349
2337
  `), s = n.includeModelFields ? `
2350
2338
  import type { Schemas } from "pocketbase-svelte";` : "", i = n.includeModelFields ? ` satisfies Schemas["${t.tableName}"]` : "";
2351
2339
  return p`
2352
2340
  import { z } from "zod/v3";${s}
2353
2341
 
2354
2342
  export const ${t.schemaName} = z.object({
2355
- ${a}
2343
+ ${o}
2356
2344
  })${i};
2357
2345
  `;
2358
2346
  }
2359
- function Dn(t) {
2360
- const e = In[t];
2347
+ function Rn(t) {
2348
+ const e = kn[t];
2361
2349
  if (!e)
2362
2350
  throw new Error(`Unsupported collection field type "${t}" when generating from collection`);
2363
2351
  return e;
2364
2352
  }
2365
2353
  function st(t, e, n) {
2366
- const r = e.find((o) => o.name === t.tableName);
2354
+ const r = e.find((a) => a.name === t.tableName);
2367
2355
  if (!r)
2368
2356
  throw new Error(`Collection "${t.tableName}" not found`);
2369
- const a = Lt(e), s = new Map(e.map((o) => [o.id, o])), i = [];
2370
- for (const o of r.fields) {
2371
- if (o.name === "id" || o.system)
2357
+ const o = Dt(e), s = new Map(e.map((a) => [a.id, a])), i = [];
2358
+ for (const a of r.fields) {
2359
+ if (a.name === "id" || a.system)
2372
2360
  continue;
2373
- const c = Dn(o.type), m = !!o.required, h = rt(o.name);
2361
+ const c = Rn(a.type), m = !!a.required, h = rt(a.name);
2374
2362
  if (c === "relation") {
2375
- const f = o.collectionId ? s.get(o.collectionId) : void 0;
2363
+ const f = a.collectionId ? s.get(a.collectionId) : void 0;
2376
2364
  if (!f)
2377
2365
  continue;
2378
2366
  const g = E(f.name, n);
2379
2367
  i.push({
2380
- name: o.name,
2368
+ name: a.name,
2381
2369
  title: h,
2382
2370
  type: "relation",
2383
2371
  required: m,
2384
2372
  collectionId: f.id,
2385
- maxSelect: o.maxSelect ?? 1,
2386
- displayField: a[f.name] ?? "id",
2373
+ maxSelect: a.maxSelect ?? 1,
2374
+ displayField: o[f.name] ?? "id",
2387
2375
  relatedModel: g,
2388
2376
  singularRelationName: N(
2389
2377
  `${t.displayName} ${g.displayName}`
@@ -2391,62 +2379,62 @@ function st(t, e, n) {
2391
2379
  pluralRelationName: N(
2392
2380
  `${t.displayName} ${g.pluralDisplayName}`
2393
2381
  ),
2394
- isCurrentUser: n.features.auth && f.name === "users" && /user|owner|author/i.test(o.name)
2382
+ isCurrentUser: n.features.auth && f.name === "users" && /user|owner|author/i.test(a.name)
2395
2383
  });
2396
2384
  continue;
2397
2385
  }
2398
2386
  if (c === "select") {
2399
2387
  i.push({
2400
- name: o.name,
2388
+ name: a.name,
2401
2389
  title: h,
2402
2390
  type: "select",
2403
2391
  required: m,
2404
- maxSelect: o.maxSelect ?? 1,
2405
- options: (o.values ?? []).map((f) => ({ label: f, value: f }))
2392
+ maxSelect: a.maxSelect ?? 1,
2393
+ options: (a.values ?? []).map((f) => ({ label: f, value: f }))
2406
2394
  });
2407
2395
  continue;
2408
2396
  }
2409
2397
  if (c === "file") {
2410
2398
  i.push({
2411
- name: o.name,
2399
+ name: a.name,
2412
2400
  title: h,
2413
2401
  type: "file",
2414
2402
  required: m,
2415
- maxSelect: o.maxSelect ?? 1
2403
+ maxSelect: a.maxSelect ?? 1
2416
2404
  });
2417
2405
  continue;
2418
2406
  }
2419
2407
  if (c === "autodate") {
2420
2408
  i.push({
2421
- name: o.name,
2409
+ name: a.name,
2422
2410
  title: h,
2423
2411
  type: "autodate",
2424
2412
  required: m,
2425
- onCreate: o.onCreate ?? o.name.includes("create"),
2426
- onUpdate: o.onUpdate ?? o.name.includes("update")
2413
+ onCreate: a.onCreate ?? a.name.includes("create"),
2414
+ onUpdate: a.onUpdate ?? a.name.includes("update")
2427
2415
  });
2428
2416
  continue;
2429
2417
  }
2430
2418
  i.push({
2431
- name: o.name,
2419
+ name: a.name,
2432
2420
  title: h,
2433
2421
  type: c,
2434
2422
  required: m
2435
2423
  });
2436
2424
  }
2437
- return i.filter((o) => o.name !== "id");
2425
+ return i.filter((a) => a.name !== "id");
2438
2426
  }
2439
- function Vt(t) {
2427
+ function Lt(t) {
2440
2428
  const e = t.filter((n) => n.type === "relation").map((n) => n.name);
2441
2429
  return e.length > 0 ? e.join(",") : void 0;
2442
2430
  }
2443
- function Ht(t) {
2431
+ function Ot(t) {
2444
2432
  const e = /* @__PURE__ */ new Set(), n = [];
2445
2433
  for (const r of t)
2446
2434
  r.type === "relation" && (e.has(r.relatedModel.tableName) || (e.add(r.relatedModel.tableName), n.push(r.relatedModel)));
2447
2435
  return n;
2448
2436
  }
2449
- function An(t) {
2437
+ function En(t) {
2450
2438
  const e = {
2451
2439
  name: t.name,
2452
2440
  type: t.type,
@@ -2469,7 +2457,7 @@ function An(t) {
2469
2457
  onUpdate: t.onUpdate
2470
2458
  } : e;
2471
2459
  }
2472
- function Gt(t, e, n) {
2460
+ function qt(t, e, n) {
2473
2461
  const r = n ? {
2474
2462
  listRule: n.rule,
2475
2463
  viewRule: n.rule,
@@ -2481,96 +2469,85 @@ function Gt(t, e, n) {
2481
2469
  name: t.tableName,
2482
2470
  type: "base",
2483
2471
  ...r,
2484
- fields: e.map(An)
2472
+ fields: e.map(En)
2485
2473
  };
2486
2474
  }
2487
- const St = 2, Nn = 3;
2488
- function Bn(t) {
2489
- if (t.length <= St)
2490
- throw new Error(
2491
- "Invalid command arguments. Expected: generate resource <model> [fields...]"
2492
- );
2493
- const [e, n] = t;
2494
- if (e !== "generate" || n !== "resource")
2475
+ function Tn(t) {
2476
+ const [e, ...n] = t;
2477
+ if (!e)
2495
2478
  throw new Error(
2496
- `Invalid command "${t.join(" ")}". Expected to start with "generate resource".`
2479
+ "Invalid command arguments. Expected: <model> [fields...]"
2497
2480
  );
2498
- const r = t[St], a = t.slice(Nn);
2499
- return { modelPath: r, fields: a };
2481
+ return { modelPath: e, fields: n };
2500
2482
  }
2501
- function jn(t, e) {
2483
+ function zn(t, e) {
2502
2484
  return {
2503
2485
  path: t,
2504
2486
  language: j(t),
2505
2487
  content: e
2506
2488
  };
2507
2489
  }
2508
- async function Ln(t, e, n) {
2490
+ async function In(t, e, n) {
2509
2491
  K(e);
2510
2492
  const r = E(e, t);
2511
2493
  if (n.length > 0) {
2512
2494
  const i = await W(n, r, t);
2513
2495
  return { model: r, fields: i.fields, auth: i.auth, shouldCreateCollection: !0 };
2514
2496
  }
2515
- const a = t.env === "runtime" ? await (await import("./env.runtime-BzRhpNR3.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, a, t);
2497
+ const o = t.env === "runtime" ? await (await import("./env.runtime-C0w1qoWl.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, o, t);
2516
2498
  return { model: r, fields: s, auth: void 0, shouldCreateCollection: !1 };
2517
2499
  }
2518
- async function On(t) {
2519
- const { modelPath: e, fields: n } = Bn(t.argv), { model: r, fields: a, auth: s, shouldCreateCollection: i } = await Ln(
2500
+ async function An(t) {
2501
+ const { modelPath: e, fields: n } = Tn(t.argv), { model: r, fields: o, auth: s, shouldCreateCollection: i } = await In(
2520
2502
  t,
2521
2503
  e,
2522
2504
  n
2523
- ), o = `src/lib/schemas/${r.name}.ts`, c = ot(r, a, {
2505
+ ), a = `src/lib/schemas/${r.name}.ts`, c = ot(r, o, {
2524
2506
  includeModelFields: !0,
2525
2507
  forForm: !0
2526
2508
  });
2527
2509
  return {
2528
- creates: [jn(o, c)],
2510
+ creates: [zn(a, c)],
2529
2511
  modifies: [],
2530
2512
  deletes: [],
2531
2513
  components: [],
2532
2514
  packages: [],
2533
- collections: i ? [Gt(r, a, s)] : []
2515
+ collections: i ? [qt(r, o, s)] : []
2534
2516
  };
2535
2517
  }
2536
- const qn = "generate-resource";
2537
- async function Un(t) {
2538
- const e = await On(t);
2518
+ const Dn = "generate-resource";
2519
+ async function Nn(t) {
2520
+ const e = await An(t);
2539
2521
  if (t.env !== "runtime")
2540
2522
  return k(e);
2541
- const { createCollections: n } = await import("./collections-DVLGhVXc.js"), r = await n(e.collections, t), a = {
2523
+ const { createCollections: n } = await import("./collections-BaY_bexm.js"), r = await n(e.collections, t), o = {
2542
2524
  ...e,
2543
2525
  creates: [...e.creates, ...r]
2544
2526
  }, { writeResult: s } = await import("./write-result-DG5OAbe1.js");
2545
- return s(await k(a), t);
2527
+ return s(await k(o), t);
2546
2528
  }
2547
- const Vn = {
2548
- slug: qn,
2529
+ const Bn = {
2530
+ slug: Dn,
2549
2531
  title: "Generate a resource",
2550
2532
  summary: "Generates model schema resources.",
2551
2533
  categories: ["data"],
2552
2534
  tags: ["pocketbase", "resource", "schema"],
2553
2535
  command: {
2554
2536
  raw: "vela generate resource contact name:text email:email",
2555
- argv: ["generate", "resource", "contact", "name:text", "email:email"]
2537
+ base: "vela generate resource",
2538
+ argv: ["contact", "name:text", "email:email"]
2556
2539
  },
2557
2540
  baseline: "velastack",
2558
- generate: Un
2541
+ generate: Nn
2559
2542
  };
2560
- var kt = Object.freeze, Hn = Object.defineProperty, X = (t, e) => kt(Hn(t, "raw", { value: kt(e || t.slice()) })), Mt, Rt, Pt, Et;
2561
- const It = 2, Gn = 3;
2562
- function Kn(t) {
2563
- if (t.length <= It)
2564
- throw new Error(
2565
- "Invalid command arguments. Expected: generate scaffold <model> [fields...]"
2566
- );
2567
- const [e, n] = t;
2568
- if (e !== "generate" || n !== "scaffold")
2543
+ var _t = Object.freeze, jn = Object.defineProperty, X = (t, e) => _t(jn(t, "raw", { value: _t(e || t.slice()) })), St, kt, Pt, Mt;
2544
+ function Ln(t) {
2545
+ const [e, ...n] = t;
2546
+ if (!e)
2569
2547
  throw new Error(
2570
- `Invalid command "${t.join(" ")}". Expected to start with "generate scaffold".`
2548
+ "Invalid command arguments. Expected: <model> [fields...]"
2571
2549
  );
2572
- const r = t[It], a = t.slice(Gn);
2573
- return { modelPath: r, fields: a };
2550
+ return { modelPath: e, fields: n };
2574
2551
  }
2575
2552
  function _(t, e) {
2576
2553
  return {
@@ -2579,32 +2556,32 @@ function _(t, e) {
2579
2556
  content: e
2580
2557
  };
2581
2558
  }
2582
- function Kt(t) {
2559
+ function Ut(t) {
2583
2560
  return t.some((e) => e.type === "file");
2584
2561
  }
2585
- function Wt(t) {
2562
+ function Vt(t) {
2586
2563
  return [...new Set(t.filter(Boolean))];
2587
2564
  }
2588
2565
  function it(t) {
2589
2566
  return t.filter(
2590
2567
  (e) => e.type === "select"
2591
- ).map((e) => At(e)).join(`
2568
+ ).map((e) => Tt(e)).join(`
2592
2569
 
2593
2570
  `);
2594
2571
  }
2595
- function Xt(t, e) {
2596
- return Ht(t).map(
2572
+ function Ht(t, e) {
2573
+ return Ot(t).map(
2597
2574
  (n) => `const ${n.pluralName} = await ${e}.collection("${n.tableName}").getFullList();`
2598
2575
  ).join(`
2599
2576
  `);
2600
2577
  }
2601
- function Yt(t) {
2602
- return Ht(t).map((e) => e.pluralName).join(", ");
2578
+ function Gt(t) {
2579
+ return Ot(t).map((e) => e.pluralName).join(", ");
2603
2580
  }
2604
- function Wn(t) {
2581
+ function On(t) {
2605
2582
  return t.features.auth ? "locals.pb" : "locals.admin";
2606
2583
  }
2607
- function Jt(t, e, n = !1) {
2584
+ function Kt(t, e, n = !1) {
2608
2585
  const r = it(e);
2609
2586
  return p`
2610
2587
  ${r}
@@ -2617,8 +2594,8 @@ function Jt(t, e, n = !1) {
2617
2594
  const { form: formData } = form;
2618
2595
  `;
2619
2596
  }
2620
- function Xn(t, e, n) {
2621
- const r = n.some((o) => o.type === "select"), a = Wt([
2597
+ function qn(t, e, n) {
2598
+ const r = n.some((a) => a.type === "select"), o = Vt([
2622
2599
  'import { untrack } from "svelte";',
2623
2600
  'import { superForm } from "sveltekit-superforms";',
2624
2601
  'import { zodClient } from "sveltekit-superforms/adapters";',
@@ -2629,9 +2606,9 @@ function Xn(t, e, n) {
2629
2606
  'import * as Form from "$lib/components/ui/form";',
2630
2607
  r ? 'import type { Models } from "pocketbase-svelte";' : ""
2631
2608
  ]).join(`
2632
- `), s = n.map((o) => et(o)).join(`
2633
- `), i = Kt(n) ? ' enctype="multipart/form-data"' : "";
2634
- return p(Mt || (Mt = X([`
2609
+ `), s = n.map((a) => et(a)).join(`
2610
+ `), i = Ut(n) ? ' enctype="multipart/form-data"' : "";
2611
+ return p(St || (St = X([`
2635
2612
  <script lang="ts">
2636
2613
  `, `
2637
2614
  `, `
@@ -2658,10 +2635,10 @@ function Xn(t, e, n) {
2658
2635
  </form>
2659
2636
  </div>
2660
2637
  </section>
2661
- `])), a, Jt(t, n), t.displayName.toLowerCase(), e.list, i, s, e.list);
2638
+ `])), o, Kt(t, n), t.displayName.toLowerCase(), e.list, i, s, e.list);
2662
2639
  }
2663
- function Yn(t, e, n) {
2664
- const r = n.some((o) => o.type === "select"), a = Wt([
2640
+ function Un(t, e, n) {
2641
+ const r = n.some((a) => a.type === "select"), o = Vt([
2665
2642
  'import { untrack } from "svelte";',
2666
2643
  'import { superForm } from "sveltekit-superforms";',
2667
2644
  'import { zodClient } from "sveltekit-superforms/adapters";',
@@ -2672,9 +2649,9 @@ function Yn(t, e, n) {
2672
2649
  'import * as Form from "$lib/components/ui/form";',
2673
2650
  r ? 'import type { Models } from "pocketbase-svelte";' : ""
2674
2651
  ]).join(`
2675
- `), s = n.map((o) => et(o)).join(`
2676
- `), i = Kt(n) ? ' enctype="multipart/form-data"' : "";
2677
- return p(Rt || (Rt = X([`
2652
+ `), s = n.map((a) => et(a)).join(`
2653
+ `), i = Ut(n) ? ' enctype="multipart/form-data"' : "";
2654
+ return p(kt || (kt = X([`
2678
2655
  <script lang="ts">
2679
2656
  `, `
2680
2657
  `, `
@@ -2728,20 +2705,20 @@ function Yn(t, e, n) {
2728
2705
  </form>
2729
2706
  </div>
2730
2707
  </section>
2731
- `])), a, Jt(t, n, !0), t.displayName.toLowerCase(), e.list, i, s, e.list);
2708
+ `])), o, Kt(t, n, !0), t.displayName.toLowerCase(), e.list, i, s, e.list);
2732
2709
  }
2733
- function Jn(t, e, n) {
2734
- const r = n.some((o) => o.type === "select"), a = r ? `${it(n)}` : "", s = n.map((o) => {
2710
+ function Vn(t, e, n) {
2711
+ const r = n.some((a) => a.type === "select"), o = r ? `${it(n)}` : "", s = n.map((a) => {
2735
2712
  let c = "{ getValue }", m = "{ value: getValue() }";
2736
- return o.type === "relation" && (c = "{ getValue, row }", m = `{ value: getValue(), expanded: row.original.expand?.${o.name}, displayField: "${o.displayField}" }`), o.type === "select" && (m = `{ value: getValue(), options: ${o.name}Labels }`), o.type === "file" && (c = "{ getValue, row }", m = "{ value: getValue(), collectionId: row.original.collectionId, id: row.original.id }"), p`
2737
- columnHelper.accessor("${o.name}", {
2738
- header: ({ column }) => renderComponent(ColumnHeader, { column, title: "${o.title}" }),
2739
- cell: (${c}) => renderComponent(Cells.${o.type.charAt(0).toUpperCase() + o.type.slice(1)}Cell, ${m})
2713
+ return a.type === "relation" && (c = "{ getValue, row }", m = `{ value: getValue(), expanded: row.original.expand?.${a.name}, displayField: "${a.displayField}" }`), a.type === "select" && (m = `{ value: getValue(), options: ${a.name}Labels }`), a.type === "file" && (c = "{ getValue, row }", m = "{ value: getValue(), collectionId: row.original.collectionId, id: row.original.id }"), p`
2714
+ columnHelper.accessor("${a.name}", {
2715
+ header: ({ column }) => renderComponent(ColumnHeader, { column, title: "${a.title}" }),
2716
+ cell: (${c}) => renderComponent(Cells.${a.type.charAt(0).toUpperCase() + a.type.slice(1)}Cell, ${m})
2740
2717
  })
2741
2718
  `;
2742
2719
  }).join(`,
2743
- `), i = n.filter((o) => o.type === "select").map(
2744
- (o) => `<FacetedFilter column={table.getColumn("${o.name}")!} title="${o.title}" options={Object.values(${o.name}Labels)} />`
2720
+ `), i = n.filter((a) => a.type === "select").map(
2721
+ (a) => `<FacetedFilter column={table.getColumn("${a.name}")!} title="${a.title}" options={Object.values(${a.name}Labels)} />`
2745
2722
  ).join(`
2746
2723
  `);
2747
2724
  return p(Pt || (Pt = X([`
@@ -3118,21 +3095,21 @@ function Jn(t, e, n) {
3118
3095
  <Pagination {table} />
3119
3096
  </div>
3120
3097
  </section>
3121
- `])), r ? 'import { FacetedFilter } from "$lib/components/ui/faceted-filter";' : "", a, t.tableName, s, n.length > 0 ? "," : "", e.list, e.list, e.list, t.pluralName, t.pluralDisplayName, e.new, t.displayName.toLowerCase(), t.pluralDisplayName.toLowerCase(), i, e.new, t.displayName.toLowerCase());
3098
+ `])), r ? 'import { FacetedFilter } from "$lib/components/ui/faceted-filter";' : "", o, t.tableName, s, n.length > 0 ? "," : "", e.list, e.list, e.list, t.pluralName, t.pluralDisplayName, e.new, t.displayName.toLowerCase(), t.pluralDisplayName.toLowerCase(), i, e.new, t.displayName.toLowerCase());
3122
3099
  }
3123
- function Zn(t, e, n) {
3124
- const r = Vt(e), a = r ? `{ expand: "${r}" }` : "";
3100
+ function Hn(t, e, n) {
3101
+ const r = Lt(e), o = r ? `{ expand: "${r}" }` : "";
3125
3102
  return p`
3126
3103
  export const load = async ({ locals }) => {
3127
- const ${t.pluralName} = await ${n}.collection("${t.tableName}").getFullList(${a});
3104
+ const ${t.pluralName} = await ${n}.collection("${t.tableName}").getFullList(${o});
3128
3105
  return { ${t.pluralName} };
3129
3106
  };
3130
3107
  `;
3131
3108
  }
3132
- function Qn(t, e, n, r, a) {
3133
- const s = Xt(n, r), i = Yt(n), o = i ? `, ${i}` : "", c = n.find(
3109
+ function Gn(t, e, n, r, o) {
3110
+ const s = Ht(n, r), i = Gt(n), a = i ? `, ${i}` : "", c = n.find(
3134
3111
  (h) => h.type === "relation" && h.isCurrentUser
3135
- ), m = a && c ? p`
3112
+ ), m = o && c ? p`
3136
3113
  {
3137
3114
  ...form.data,
3138
3115
  ${c.name}: locals.pb.authStore.record?.id
@@ -3147,7 +3124,7 @@ function Qn(t, e, n, r, a) {
3147
3124
 
3148
3125
  export const load = async ({ locals }) => {
3149
3126
  ${s}
3150
- return { form: await superValidate(zod(${t.schemaName}))${o} };
3127
+ return { form: await superValidate(zod(${t.schemaName}))${a} };
3151
3128
  };
3152
3129
 
3153
3130
  export const actions = {
@@ -3171,8 +3148,8 @@ function Qn(t, e, n, r, a) {
3171
3148
  };
3172
3149
  `;
3173
3150
  }
3174
- function tr(t, e, n, r) {
3175
- const a = Vt(n), s = a ? `, { expand: "${a}" }` : "";
3151
+ function Kn(t, e, n, r) {
3152
+ const o = Lt(n), s = o ? `, { expand: "${o}" }` : "";
3176
3153
  return p`
3177
3154
  import { error, redirect } from "@sveltejs/kit";
3178
3155
 
@@ -3193,17 +3170,17 @@ function tr(t, e, n, r) {
3193
3170
  };
3194
3171
  `;
3195
3172
  }
3196
- function er(t, e, n) {
3197
- const r = n.some((m) => m.type === "select"), a = n.some((m) => m.type === "relation"), s = n.some((m) => m.type === "file"), i = [
3173
+ function Wn(t, e, n) {
3174
+ const r = n.some((m) => m.type === "select"), o = n.some((m) => m.type === "relation"), s = n.some((m) => m.type === "file"), i = [
3198
3175
  'import { Button } from "$lib/components/ui/button";',
3199
3176
  'import ArrowLeftIcon from "@lucide/svelte/icons/arrow-left";',
3200
- r || a ? 'import { Badge } from "$lib/components/ui/badge";' : "",
3201
- a ? 'import CircleArrowRightIcon from "@lucide/svelte/icons/circle-arrow-right";' : "",
3177
+ r || o ? 'import { Badge } from "$lib/components/ui/badge";' : "",
3178
+ o ? 'import CircleArrowRightIcon from "@lucide/svelte/icons/circle-arrow-right";' : "",
3202
3179
  s ? 'import FileIcon from "@lucide/svelte/icons/file";' : ""
3203
3180
  ].filter(Boolean).join(`
3204
- `), o = it(n), c = n.map((m) => ke(t, m)).join(`
3181
+ `), a = it(n), c = n.map((m) => Fe(t, m)).join(`
3205
3182
  `);
3206
- return p(Et || (Et = X([`
3183
+ return p(Mt || (Mt = X([`
3207
3184
  <script lang="ts">
3208
3185
  `, `
3209
3186
  `, `
@@ -3235,10 +3212,10 @@ function er(t, e, n) {
3235
3212
  </div>
3236
3213
  </div>
3237
3214
  </section>
3238
- `])), i, o, t.displayName, e.list, c, e.list, t.name);
3215
+ `])), i, a, t.displayName, e.list, c, e.list, t.name);
3239
3216
  }
3240
- function nr(t, e, n, r) {
3241
- const a = Xt(n, r), s = Yt(n), i = s ? `, ${s}` : "";
3217
+ function Xn(t, e, n, r) {
3218
+ const o = Ht(n, r), s = Gt(n), i = s ? `, ${s}` : "";
3242
3219
  return p`
3243
3220
  import { error, fail, redirect } from "@sveltejs/kit";
3244
3221
  import { setPocketbaseErrors, setDefaultData } from "@velastack/pocketbase";
@@ -3253,7 +3230,7 @@ function nr(t, e, n, r) {
3253
3230
  } catch {
3254
3231
  throw error(404, "Not found");
3255
3232
  }
3256
- ${a}
3233
+ ${o}
3257
3234
  return { form: await superValidate(${t.name}, zod(${t.schemaName}))${i} };
3258
3235
  };
3259
3236
 
@@ -3279,9 +3256,9 @@ function nr(t, e, n, r) {
3279
3256
  };
3280
3257
  `;
3281
3258
  }
3282
- async function rr(t, e, n) {
3259
+ async function Yn(t, e, n) {
3283
3260
  K(e);
3284
- const r = E(e, t), a = t.env === "runtime" ? await (await import("./env.runtime-BzRhpNR3.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t);
3261
+ const r = E(e, t), o = t.env === "runtime" ? await (await import("./env.runtime-C0w1qoWl.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t);
3285
3262
  if (n.length > 0) {
3286
3263
  const i = await W(n, r, t);
3287
3264
  return {
@@ -3289,61 +3266,61 @@ async function rr(t, e, n) {
3289
3266
  fields: i.fields,
3290
3267
  auth: i.auth,
3291
3268
  shouldCreateCollection: !0,
3292
- collections: a
3269
+ collections: o
3293
3270
  };
3294
3271
  }
3295
- const s = st(r, a, t);
3272
+ const s = st(r, o, t);
3296
3273
  return {
3297
3274
  model: r,
3298
3275
  fields: s,
3299
3276
  auth: void 0,
3300
3277
  shouldCreateCollection: !1,
3301
- collections: a
3278
+ collections: o
3302
3279
  };
3303
3280
  }
3304
- async function ar(t) {
3305
- const { modelPath: e, fields: n } = Kn(t.argv), { model: r, fields: a, auth: s, shouldCreateCollection: i, collections: o } = await rr(t, e, n), c = Ge(r), m = Ke(r), h = Wn(t), f = a.filter(
3281
+ async function Jn(t) {
3282
+ const { modelPath: e, fields: n } = Ln(t.argv), { model: r, fields: o, auth: s, shouldCreateCollection: i, collections: a } = await Yn(t, e, n), c = qe(r), m = Ue(r), h = On(t), f = o.filter(
3306
3283
  (u) => !(u.type === "relation" && u.isCurrentUser)
3307
3284
  ), g = [
3308
3285
  _(
3309
3286
  `src/lib/schemas/${r.name}.ts`,
3310
- ot(r, a, {
3287
+ ot(r, o, {
3311
3288
  includeModelFields: !0,
3312
3289
  forForm: !0
3313
3290
  })
3314
3291
  ),
3315
3292
  _(
3316
3293
  `${c.list}/+page.server.ts`,
3317
- Zn(r, f, h)
3294
+ Hn(r, f, h)
3318
3295
  ),
3319
3296
  _(
3320
3297
  `${c.list}/+page.svelte`,
3321
- Jn(r, m, f)
3298
+ Vn(r, m, f)
3322
3299
  ),
3323
3300
  _(
3324
3301
  `${c.new}/+page.server.ts`,
3325
- Qn(r, m, f, h, t.features.auth)
3302
+ Gn(r, m, f, h, t.features.auth)
3326
3303
  ),
3327
- _(`${c.new}/+page.svelte`, Xn(r, m, f)),
3304
+ _(`${c.new}/+page.svelte`, qn(r, m, f)),
3328
3305
  _(
3329
3306
  `${c.show}/+page.server.ts`,
3330
- tr(r, m, f, h)
3307
+ Kn(r, m, f, h)
3331
3308
  ),
3332
3309
  _(
3333
3310
  `${c.show}/+page.svelte`,
3334
- er(r, m, f)
3311
+ Wn(r, m, f)
3335
3312
  ),
3336
3313
  _(
3337
3314
  `${c.edit}/+page.server.ts`,
3338
- nr(r, m, f, h)
3315
+ Xn(r, m, f, h)
3339
3316
  ),
3340
3317
  _(
3341
3318
  `${c.edit}/+page.svelte`,
3342
- Yn(r, m, f)
3319
+ Un(r, m, f)
3343
3320
  ),
3344
3321
  _(
3345
3322
  `${c.list}/server.test.ts`,
3346
- dn(r, m, a, t, o)
3323
+ cn(r, m, o, t, a)
3347
3324
  )
3348
3325
  ], x = [
3349
3326
  ...O(f),
@@ -3369,74 +3346,70 @@ async function ar(t) {
3369
3346
  deletes: [],
3370
3347
  components: [...new Set(x)],
3371
3348
  packages: [],
3372
- collections: i ? [Gt(r, a, s)] : []
3349
+ collections: i ? [qt(r, o, s)] : []
3373
3350
  };
3374
3351
  }
3375
- const or = "generate-scaffold";
3376
- async function sr(t) {
3377
- const e = await ar(t);
3352
+ const Zn = "generate-scaffold";
3353
+ async function Qn(t) {
3354
+ const e = await Jn(t);
3378
3355
  if (t.env !== "runtime")
3379
3356
  return k(e);
3380
- const { createCollections: n } = await import("./collections-DVLGhVXc.js"), r = await n(e.collections, t), a = {
3357
+ const { createCollections: n } = await import("./collections-BaY_bexm.js"), r = await n(e.collections, t), o = {
3381
3358
  ...e,
3382
3359
  creates: [...e.creates, ...r]
3383
3360
  }, { writeResult: s } = await import("./write-result-DG5OAbe1.js");
3384
- return s(await k(a), t);
3361
+ return s(await k(o), t);
3385
3362
  }
3386
- const ir = {
3387
- slug: or,
3363
+ const tr = {
3364
+ slug: Zn,
3388
3365
  title: "Generate a scaffold",
3389
3366
  summary: "Generates CRUD routes and schema.",
3390
3367
  categories: ["data", "forms"],
3391
3368
  tags: ["crud", "scaffold", "pocketbase", "sveltekit"],
3392
3369
  command: {
3393
3370
  raw: "vela generate scaffold contact name:text email:email",
3394
- argv: ["generate", "scaffold", "contact", "name:text", "email:email"]
3371
+ base: "vela generate scaffold",
3372
+ argv: ["contact", "name:text", "email:email"]
3395
3373
  },
3396
3374
  baseline: "velastack",
3397
- generate: sr
3398
- }, Tt = 2, lr = 3;
3399
- function cr(t) {
3400
- if (t.length <= Tt)
3401
- throw new Error(
3402
- "Invalid command arguments. Expected: generate schema <model> [fields...]"
3403
- );
3404
- const [e, n] = t;
3405
- if (e !== "generate" || n !== "schema")
3375
+ generate: Qn
3376
+ };
3377
+ function er(t) {
3378
+ const [e, ...n] = t;
3379
+ if (!e)
3406
3380
  throw new Error(
3407
- `Invalid command "${t.join(" ")}". Expected to start with "generate schema".`
3381
+ "Invalid command arguments. Expected: <model> [fields...]"
3408
3382
  );
3409
- const r = t[Tt], a = t.slice(lr);
3410
- return { modelPath: r, fields: a };
3383
+ return { modelPath: e, fields: n };
3411
3384
  }
3412
- function mr(t, e) {
3385
+ function nr(t, e) {
3413
3386
  return {
3414
3387
  path: t,
3415
3388
  language: j(t),
3416
3389
  content: e
3417
3390
  };
3418
3391
  }
3419
- async function ur(t, e, n) {
3392
+ async function rr(t, e, n) {
3420
3393
  K(e);
3421
3394
  const r = E(e, t);
3422
3395
  if (n.length > 0) {
3423
3396
  const i = await W(n, r, t);
3424
3397
  return { model: r, fields: i.fields, includeModelFields: !1 };
3425
3398
  }
3426
- const a = t.env === "runtime" ? await (await import("./env.runtime-BzRhpNR3.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, a, t);
3399
+ const o = t.env === "runtime" ? await (await import("./env.runtime-C0w1qoWl.js")).getCollections() : (await import("./env.preview-HlXZOEL4.js")).getPreviewCollections(t), s = st(r, o, t);
3427
3400
  return { model: r, fields: s, includeModelFields: !0 };
3428
3401
  }
3429
- async function pr(t) {
3430
- const { modelPath: e, fields: n } = cr(t.argv), { model: r, fields: a, includeModelFields: s } = await ur(
3402
+ async function ar(t) {
3403
+ const { modelPath: e, fields: n } = er(t.argv), { model: r, fields: o, includeModelFields: s } = await rr(
3431
3404
  t,
3432
3405
  e,
3433
3406
  n
3434
- ), i = `src/lib/schemas/${r.name}.ts`, o = ot(r, a, {
3407
+ ), i = `src/lib/schemas/${r.name}.ts`, a = ot(r, o, {
3435
3408
  includeModelFields: s,
3436
3409
  forForm: !0
3437
3410
  });
3438
3411
  return {
3439
- creates: [mr(i, o)],
3412
+ creates: [nr(i, a)],
3440
3413
  modifies: [],
3441
3414
  deletes: [],
3442
3415
  components: [],
@@ -3444,27 +3417,28 @@ async function pr(t) {
3444
3417
  collections: []
3445
3418
  };
3446
3419
  }
3447
- const dr = "generate-schema";
3448
- async function fr(t) {
3449
- const e = await pr(t);
3420
+ const or = "generate-schema";
3421
+ async function sr(t) {
3422
+ const e = await ar(t);
3450
3423
  if (t.env !== "runtime")
3451
3424
  return k(e);
3452
3425
  const { writeResult: n } = await import("./write-result-DG5OAbe1.js");
3453
3426
  return n(await k(e), t);
3454
3427
  }
3455
- const hr = {
3456
- slug: dr,
3428
+ const ir = {
3429
+ slug: or,
3457
3430
  title: "Generate a schema",
3458
3431
  summary: "Generates a zod schema.",
3459
3432
  categories: ["data"],
3460
3433
  tags: ["zod", "schema", "pocketbase"],
3461
3434
  command: {
3462
3435
  raw: "vela generate schema contact name:text email:email",
3463
- argv: ["generate", "schema", "contact", "name:text", "email:email"]
3436
+ base: "vela generate schema",
3437
+ argv: ["contact", "name:text", "email:email"]
3464
3438
  },
3465
3439
  baseline: "velastack",
3466
- generate: fr
3467
- }, gr = `<script lang="ts" module>
3440
+ generate: sr
3441
+ }, lr = `<script lang="ts" module>
3468
3442
  import HomeIcon from '@lucide/svelte/icons/home';
3469
3443
 
3470
3444
  let data = {
@@ -3520,7 +3494,7 @@ const hr = {
3520
3494
  <NavUser {user} />
3521
3495
  </Sidebar.Footer>
3522
3496
  </Sidebar.Root>
3523
- `, br = `<script lang="ts">
3497
+ `, cr = `<script lang="ts">
3524
3498
  import type { Component } from 'svelte';
3525
3499
  import * as Sidebar from '$lib/components/ui/sidebar';
3526
3500
  import { page } from '$app/state';
@@ -3560,7 +3534,7 @@ const hr = {
3560
3534
  {/each}
3561
3535
  </Sidebar.Menu>
3562
3536
  </Sidebar.Group>
3563
- `, vr = `<script lang="ts" module>
3537
+ `, mr = `<script lang="ts" module>
3564
3538
  import Settings2Icon from '@lucide/svelte/icons/settings-2';
3565
3539
 
3566
3540
  let data = {
@@ -3679,7 +3653,7 @@ const hr = {
3679
3653
  </DropdownMenu.Root>
3680
3654
  </Sidebar.MenuItem>
3681
3655
  </Sidebar.Menu>
3682
- `, wr = `<script lang="ts">
3656
+ `, ur = `<script lang="ts">
3683
3657
  import { cn } from '$lib/utils';
3684
3658
  import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
3685
3659
  import { DropdownMenu as DropdownMenuPrimitive } from 'bits-ui';
@@ -3707,7 +3681,7 @@ const hr = {
3707
3681
  {@render children?.()}
3708
3682
  </div>
3709
3683
  {/if}
3710
- `, yr = `<script lang="ts">
3684
+ `, pr = `<script lang="ts">
3711
3685
  import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
3712
3686
  import { getContext } from 'svelte';
3713
3687
  import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';
@@ -3723,7 +3697,7 @@ const hr = {
3723
3697
  {:else}
3724
3698
  {@render children?.()}
3725
3699
  {/if}
3726
- `, xr = `<script lang="ts">
3700
+ `, dr = `<script lang="ts">
3727
3701
  import { goto } from '$app/navigation';
3728
3702
  import * as DropdownMenu from '$lib/components/ui/dropdown-menu';
3729
3703
  import { Button } from '$lib/components/ui/button';
@@ -3759,7 +3733,7 @@ const hr = {
3759
3733
  {@render children?.()}
3760
3734
  </Button>
3761
3735
  {/if}
3762
- `, $r = `<script lang="ts">
3736
+ `, fr = `<script lang="ts">
3763
3737
  import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
3764
3738
  import { getContext } from 'svelte';
3765
3739
  import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';
@@ -3773,7 +3747,7 @@ const hr = {
3773
3747
  {@render children?.()}
3774
3748
  </DropdownMenu.Label>
3775
3749
  {/if}
3776
- `, Fr = `<script lang="ts">
3750
+ `, hr = `<script lang="ts">
3777
3751
  import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
3778
3752
  import { getContext } from 'svelte';
3779
3753
  import { AUTH_MENU_CONTEXT_KEY, type AuthMenuContext } from './context.js';
@@ -3785,7 +3759,7 @@ const hr = {
3785
3759
  {#if isDesktop}
3786
3760
  <DropdownMenu.Separator {...restProps} />
3787
3761
  {/if}
3788
- `, Cr = `<script lang="ts">
3762
+ `, gr = `<script lang="ts">
3789
3763
  import { cn } from '$lib/utils';
3790
3764
  import * as DropdownMenu from '$lib/components/ui/dropdown-menu/index.js';
3791
3765
  import { getContext } from 'svelte';
@@ -3799,7 +3773,7 @@ const hr = {
3799
3773
  {#if isDesktop}
3800
3774
  <DropdownMenu.Trigger class={cn('inline-flex', className)} {...restProps} />
3801
3775
  {/if}
3802
- `, _r = `<script lang="ts">
3776
+ `, br = `<script lang="ts">
3803
3777
  import { page } from '$app/state';
3804
3778
  import { browser } from '$app/environment';
3805
3779
  import { onMount, setContext } from 'svelte';
@@ -3845,12 +3819,12 @@ const hr = {
3845
3819
  {:else}
3846
3820
  {@render guest?.()}
3847
3821
  {/if}
3848
- `, Sr = `export type AuthMenuContext = {
3822
+ `, vr = `export type AuthMenuContext = {
3849
3823
  isDesktop: boolean;
3850
3824
  };
3851
3825
 
3852
3826
  export const AUTH_MENU_CONTEXT_KEY = Symbol('auth-menu-context');
3853
- `, kr = `import Root from './auth-menu.svelte';
3827
+ `, wr = `import Root from './auth-menu.svelte';
3854
3828
  import Content from './auth-menu-content.svelte';
3855
3829
  import Trigger from './auth-menu-trigger.svelte';
3856
3830
  import Group from './auth-menu-group.svelte';
@@ -3859,12 +3833,12 @@ import Separator from './auth-menu-separator.svelte';
3859
3833
  import Item from './auth-menu-item.svelte';
3860
3834
 
3861
3835
  export { Root, Content, Trigger, Group, Label, Separator, Item };
3862
- `, Mr = `import { z } from 'zod/v3';
3836
+ `, yr = `import { z } from 'zod/v3';
3863
3837
 
3864
3838
  export const changeEmailSchema = z.object({
3865
3839
  email: z.string().email()
3866
3840
  });
3867
- `, Rr = `import { z } from 'zod/v3';
3841
+ `, xr = `import { z } from 'zod/v3';
3868
3842
 
3869
3843
  export const changePasswordSchema = z
3870
3844
  .object({
@@ -3875,16 +3849,16 @@ export const changePasswordSchema = z
3875
3849
  message: "Passwords don't match",
3876
3850
  path: ['passwordConfirm']
3877
3851
  });
3878
- `, Pr = `import { z } from 'zod/v3';
3852
+ `, $r = `import { z } from 'zod/v3';
3879
3853
  export const confirmEmailChangeSchema = z.object({
3880
3854
  password: z.string()
3881
3855
  });
3882
- `, Er = `import { z } from 'zod/v3';
3856
+ `, Fr = `import { z } from 'zod/v3';
3883
3857
  export const confirmResetSchema = z.object({
3884
3858
  password: z.string(),
3885
3859
  passwordConfirm: z.string()
3886
3860
  });
3887
- `, Ir = `import { z } from 'zod/v3';
3861
+ `, Cr = `import { z } from 'zod/v3';
3888
3862
 
3889
3863
  const otpSchema = z.object({
3890
3864
  type: z.literal('otp'),
@@ -3903,35 +3877,35 @@ const oAuth2Schema = z.object({
3903
3877
  });
3904
3878
 
3905
3879
  export const loginSchema = z.discriminatedUnion('type', [otpSchema, passwordSchema, oAuth2Schema]);
3906
- `, Tr = `import { z } from 'zod/v3';
3880
+ `, _r = `import { z } from 'zod/v3';
3907
3881
  export const otpSchema = z.object({
3908
3882
  otp: z.string()
3909
3883
  });
3910
- `, zr = `import { z } from 'zod/v3';
3884
+ `, Sr = `import { z } from 'zod/v3';
3911
3885
 
3912
3886
  export const profileSchema = z.object({
3913
3887
  name: z.string().optional(),
3914
3888
  avatar: z.union([z.instanceof(File), z.string()]).optional(),
3915
3889
  emailVisibility: z.boolean().optional()
3916
3890
  });
3917
- `, Dr = `import { z } from 'zod/v3';
3891
+ `, kr = `import { z } from 'zod/v3';
3918
3892
  export const resetSchema = z.object({
3919
3893
  email: z.string().email()
3920
3894
  });
3921
- `, Ar = `import { z } from 'zod/v3';
3895
+ `, Pr = `import { z } from 'zod/v3';
3922
3896
 
3923
3897
  export const signupSchema = z.object({
3924
3898
  email: z.string().email(),
3925
3899
  password: z.string(),
3926
3900
  passwordConfirm: z.string()
3927
3901
  });
3928
- `, Nr = `export const load = ({ locals }) => {
3902
+ `, Mr = `export const load = ({ locals }) => {
3929
3903
  const user = locals.pb.authStore.record!;
3930
3904
  const breadcrumbs = [{ title: 'Home', url: '/dashboard' }];
3931
3905
 
3932
3906
  return { user, breadcrumbs };
3933
3907
  };
3934
- `, Br = `<script lang="ts">
3908
+ `, Rr = `<script lang="ts">
3935
3909
  import * as Sidebar from '$lib/components/ui/sidebar';
3936
3910
  import { Separator } from '$lib/components/ui/separator';
3937
3911
  import AppSidebar from '$lib/components/app-sidebar.svelte';
@@ -3981,7 +3955,7 @@ export const signupSchema = z.object({
3981
3955
  background-color: var(--color-sidebar);
3982
3956
  }
3983
3957
  </style>
3984
- `, jr = "", Lr = `import { describe, it, expect } from 'vitest';
3958
+ `, Er = "", Tr = `import { describe, it, expect } from 'vitest';
3985
3959
  import type { Match } from '@velastack/pocketbase';
3986
3960
  import type { RouteId } from './$types';
3987
3961
 
@@ -3998,14 +3972,14 @@ describe('dashboard', () => {
3998
3972
  expect(response.status).toBe(200);
3999
3973
  });
4000
3974
  });
4001
- `, Or = `export const load = async ({ parent }) => {
3975
+ `, zr = `export const load = async ({ parent }) => {
4002
3976
  const { breadcrumbs } = await parent();
4003
3977
 
4004
3978
  return {
4005
3979
  breadcrumbs: [...breadcrumbs, { title: 'Settings', url: '/settings' }]
4006
3980
  };
4007
3981
  };
4008
- `, qr = `import { superValidate, fail, withFiles } from 'sveltekit-superforms';
3982
+ `, Ir = `import { superValidate, fail, withFiles } from 'sveltekit-superforms';
4009
3983
  import { zod } from 'sveltekit-superforms/adapters';
4010
3984
  import { setFlash } from 'sveltekit-flash-message/server';
4011
3985
  import { profileSchema } from '$lib/schemas/profile';
@@ -4074,7 +4048,7 @@ export const actions = {
4074
4048
  return {};
4075
4049
  }
4076
4050
  };
4077
- `, Ur = `<script lang="ts">
4051
+ `, Ar = `<script lang="ts">
4078
4052
  import { untrack } from 'svelte';
4079
4053
  import { superForm } from 'sveltekit-superforms';
4080
4054
  import { zodClient } from 'sveltekit-superforms/adapters';
@@ -4352,7 +4326,7 @@ export const actions = {
4352
4326
  </form>
4353
4327
  </div>
4354
4328
  </div>
4355
- `, Vr = `import { fail, superValidate } from 'sveltekit-superforms';
4329
+ `, Dr = `import { fail, superValidate } from 'sveltekit-superforms';
4356
4330
  import { zod } from 'sveltekit-superforms/adapters';
4357
4331
  import { confirmEmailChangeSchema } from '$lib/schemas/confirmEmailChange';
4358
4332
  import { redirect } from '@sveltejs/kit';
@@ -4379,7 +4353,7 @@ export const actions = {
4379
4353
  return redirect(303, '/login');
4380
4354
  }
4381
4355
  };
4382
- `, Hr = `<script lang="ts">
4356
+ `, Nr = `<script lang="ts">
4383
4357
  import { untrack } from 'svelte';
4384
4358
  import { Button } from '$lib/components/ui/button';
4385
4359
  import * as Card from '$lib/components/ui/card';
@@ -4447,7 +4421,7 @@ export const actions = {
4447
4421
  </div>
4448
4422
  </div>
4449
4423
  </div>
4450
- `, Gr = `import { describe, it, expect } from 'vitest';
4424
+ `, Br = `import { describe, it, expect } from 'vitest';
4451
4425
  import type { Match } from '@velastack/pocketbase';
4452
4426
  import type { RouteId } from './$types';
4453
4427
 
@@ -4459,7 +4433,7 @@ describe('GET /confirm-email-change/[token]', () => {
4459
4433
  expect(response.status).toBe(200);
4460
4434
  });
4461
4435
  });
4462
- `, Kr = `import { fail, superValidate } from 'sveltekit-superforms';
4436
+ `, jr = `import { fail, superValidate } from 'sveltekit-superforms';
4463
4437
  import { zod } from 'sveltekit-superforms/adapters';
4464
4438
  import { confirmResetSchema } from '$lib/schemas/confirmReset';
4465
4439
  import { redirect } from '@sveltejs/kit';
@@ -4488,7 +4462,7 @@ export const actions = {
4488
4462
  return redirect(303, '/login');
4489
4463
  }
4490
4464
  };
4491
- `, Wr = `<script lang="ts">
4465
+ `, Lr = `<script lang="ts">
4492
4466
  import { untrack } from 'svelte';
4493
4467
  import { Button } from '$lib/components/ui/button';
4494
4468
  import * as Card from '$lib/components/ui/card';
@@ -4572,7 +4546,7 @@ export const actions = {
4572
4546
  </div>
4573
4547
  </div>
4574
4548
  </div>
4575
- `, Xr = `import { describe, it, expect } from 'vitest';
4549
+ `, Or = `import { describe, it, expect } from 'vitest';
4576
4550
  import type { Match } from '@velastack/pocketbase';
4577
4551
  import type { RouteId } from './$types';
4578
4552
 
@@ -4582,7 +4556,7 @@ describe('GET /confirm-reset/[token]', () => {
4582
4556
  expect(response.status).toBe(200);
4583
4557
  });
4584
4558
  });
4585
- `, Yr = `import { redirect } from '@sveltejs/kit';
4559
+ `, qr = `import { redirect } from '@sveltejs/kit';
4586
4560
  import { setFlash } from 'sveltekit-flash-message/server';
4587
4561
 
4588
4562
  export const GET = async ({ params, locals, cookies }) => {
@@ -4601,7 +4575,7 @@ export const GET = async ({ params, locals, cookies }) => {
4601
4575
  setFlash({ type: 'toast', message }, cookies);
4602
4576
  redirect(303, redirectPath);
4603
4577
  };
4604
- `, Jr = `import { describe, it, expect } from 'vitest';
4578
+ `, Ur = `import { describe, it, expect } from 'vitest';
4605
4579
  import type { Match } from '@velastack/pocketbase';
4606
4580
  import type { RouteId } from './$types';
4607
4581
 
@@ -4614,7 +4588,7 @@ describe('GET /confirm-verification/[token]', () => {
4614
4588
  expect(response.headers['location']).toBe('/login');
4615
4589
  });
4616
4590
  });
4617
- `, Zr = `import { fail, superValidate, message } from 'sveltekit-superforms';
4591
+ `, Vr = `import { fail, superValidate, message } from 'sveltekit-superforms';
4618
4592
  import { zod } from 'sveltekit-superforms/adapters';
4619
4593
  import { loginSchema } from '$lib/schemas/login';
4620
4594
  import { redirect } from '@sveltejs/kit';
@@ -4675,7 +4649,7 @@ export const actions = {
4675
4649
  redirect(303, redirectUrl);
4676
4650
  }
4677
4651
  };
4678
- `, Qr = `<script lang="ts">
4652
+ `, Hr = `<script lang="ts">
4679
4653
  import { untrack } from 'svelte';
4680
4654
  import { Button } from '$lib/components/ui/button';
4681
4655
  import * as Card from '$lib/components/ui/card';
@@ -4858,7 +4832,7 @@ export const actions = {
4858
4832
  </div>
4859
4833
  </div>
4860
4834
  </div>
4861
- `, ta = `import { describe, it, expect } from 'vitest';
4835
+ `, Gr = `import { describe, it, expect } from 'vitest';
4862
4836
  import * as devalue from 'devalue';
4863
4837
  import type { Match } from '@velastack/pocketbase';
4864
4838
  import type { RouteId } from './$types';
@@ -4905,14 +4879,14 @@ describe('POST /login', () => {
4905
4879
  expect(data.form.message.text).toBe('Failed to authenticate.');
4906
4880
  });
4907
4881
  });
4908
- `, ea = `import { redirect } from '@sveltejs/kit';
4882
+ `, Kr = `import { redirect } from '@sveltejs/kit';
4909
4883
 
4910
4884
  export const POST = ({ cookies, locals }) => {
4911
4885
  locals.pb.authStore.clear();
4912
4886
  locals.pb.authStore.clearCookie(cookies);
4913
4887
  throw redirect(303, '/');
4914
4888
  };
4915
- `, na = `import { describe, it, expect } from 'vitest';
4889
+ `, Wr = `import { describe, it, expect } from 'vitest';
4916
4890
  import type { Match } from '@velastack/pocketbase';
4917
4891
  import type { RouteId } from './$types';
4918
4892
 
@@ -4924,7 +4898,7 @@ describe('POST /logout', () => {
4924
4898
  expect(response.headers.location).toBe('/');
4925
4899
  });
4926
4900
  });
4927
- `, ra = `import { fail, message, superValidate } from 'sveltekit-superforms';
4901
+ `, Xr = `import { fail, message, superValidate } from 'sveltekit-superforms';
4928
4902
  import { zod } from 'sveltekit-superforms/adapters';
4929
4903
  import { otpSchema } from '$lib/schemas/otp';
4930
4904
  import { redirect } from '@sveltejs/kit';
@@ -4965,7 +4939,7 @@ export const actions = {
4965
4939
  redirect(303, redirectUrl);
4966
4940
  }
4967
4941
  };
4968
- `, aa = `<script lang="ts">
4942
+ `, Yr = `<script lang="ts">
4969
4943
  import { untrack } from 'svelte';
4970
4944
  import { Button } from '$lib/components/ui/button';
4971
4945
  import * as Card from '$lib/components/ui/card';
@@ -5031,7 +5005,7 @@ export const actions = {
5031
5005
  </div>
5032
5006
  </div>
5033
5007
  </div>
5034
- `, oa = `import { describe, it, expect } from 'vitest';
5008
+ `, Jr = `import { describe, it, expect } from 'vitest';
5035
5009
  import type { Match } from '@velastack/pocketbase';
5036
5010
  import type { RouteId } from './$types';
5037
5011
 
@@ -5051,7 +5025,7 @@ describe('POST /otp/[token]', () => {
5051
5025
  expect(response.body.status).toBe(400);
5052
5026
  });
5053
5027
  });
5054
- `, sa = `import { fail, superValidate } from 'sveltekit-superforms';
5028
+ `, Zr = `import { fail, superValidate } from 'sveltekit-superforms';
5055
5029
  import { zod } from 'sveltekit-superforms/adapters';
5056
5030
  import { resetSchema } from '$lib/schemas/reset';
5057
5031
  import { redirect } from '@sveltejs/kit';
@@ -5079,7 +5053,7 @@ export const actions = {
5079
5053
  return { form };
5080
5054
  }
5081
5055
  };
5082
- `, ia = `<script lang="ts">
5056
+ `, Qr = `<script lang="ts">
5083
5057
  import { untrack } from 'svelte';
5084
5058
  import { Button } from '$lib/components/ui/button';
5085
5059
  import * as Card from '$lib/components/ui/card';
@@ -5146,7 +5120,7 @@ export const actions = {
5146
5120
  </div>
5147
5121
  </div>
5148
5122
  </div>
5149
- `, la = `import { describe, it, expect } from 'vitest';
5123
+ `, ta = `import { describe, it, expect } from 'vitest';
5150
5124
  import type { Match } from '@velastack/pocketbase';
5151
5125
  import type { RouteId } from './$types';
5152
5126
 
@@ -5166,7 +5140,7 @@ describe('POST /reset', () => {
5166
5140
  expect(response.body.status).toBe(200);
5167
5141
  });
5168
5142
  });
5169
- `, ca = `import { redirect } from '@sveltejs/kit';
5143
+ `, ea = `import { redirect } from '@sveltejs/kit';
5170
5144
  import { fail, superValidate } from 'sveltekit-superforms';
5171
5145
  import { zod } from 'sveltekit-superforms/adapters';
5172
5146
  import { setFlash } from 'sveltekit-flash-message/server';
@@ -5222,7 +5196,7 @@ export const actions = {
5222
5196
  return redirect(303, redirectUrl);
5223
5197
  }
5224
5198
  };
5225
- `, ma = `<script lang="ts">
5199
+ `, na = `<script lang="ts">
5226
5200
  import { untrack } from 'svelte';
5227
5201
  import { Button } from '$lib/components/ui/button';
5228
5202
  import * as Card from '$lib/components/ui/card';
@@ -5389,7 +5363,7 @@ export const actions = {
5389
5363
  </div>
5390
5364
  </div>
5391
5365
  </div>
5392
- `, ua = `import { describe, it, expect } from 'vitest';
5366
+ `, ra = `import { describe, it, expect } from 'vitest';
5393
5367
  import type { Match } from '@velastack/pocketbase';
5394
5368
  import * as devalue from 'devalue';
5395
5369
  import type { RouteId } from './$types';
@@ -5445,67 +5419,67 @@ describe('POST /signup', () => {
5445
5419
  expect(data.form.errors.email[0]).toBe('Value must be unique.');
5446
5420
  });
5447
5421
  });
5448
- `, pa = /* @__PURE__ */ Object.assign({
5449
- "./creates/src/lib/components/app-sidebar.svelte": gr,
5450
- "./creates/src/lib/components/nav-main.svelte": br,
5451
- "./creates/src/lib/components/nav-user.svelte": vr,
5452
- "./creates/src/lib/components/ui/auth-menu/auth-menu-content.svelte": wr,
5453
- "./creates/src/lib/components/ui/auth-menu/auth-menu-group.svelte": yr,
5454
- "./creates/src/lib/components/ui/auth-menu/auth-menu-item.svelte": xr,
5455
- "./creates/src/lib/components/ui/auth-menu/auth-menu-label.svelte": $r,
5456
- "./creates/src/lib/components/ui/auth-menu/auth-menu-separator.svelte": Fr,
5457
- "./creates/src/lib/components/ui/auth-menu/auth-menu-trigger.svelte": Cr,
5458
- "./creates/src/lib/components/ui/auth-menu/auth-menu.svelte": _r,
5459
- "./creates/src/lib/components/ui/auth-menu/context.ts": Sr,
5460
- "./creates/src/lib/components/ui/auth-menu/index.ts": kr,
5461
- "./creates/src/lib/schemas/changeEmail.ts": Mr,
5462
- "./creates/src/lib/schemas/changePassword.ts": Rr,
5463
- "./creates/src/lib/schemas/confirmEmailChange.ts": Pr,
5464
- "./creates/src/lib/schemas/confirmReset.ts": Er,
5465
- "./creates/src/lib/schemas/login.ts": Ir,
5466
- "./creates/src/lib/schemas/otp.ts": Tr,
5467
- "./creates/src/lib/schemas/profile.ts": zr,
5468
- "./creates/src/lib/schemas/reset.ts": Dr,
5469
- "./creates/src/lib/schemas/signup.ts": Ar,
5470
- "./creates/src/routes/(app)/+layout.server.ts": Nr,
5471
- "./creates/src/routes/(app)/+layout.svelte": Br,
5472
- "./creates/src/routes/(app)/dashboard/+page.svelte": jr,
5473
- "./creates/src/routes/(app)/dashboard/server.test.ts": Lr,
5474
- "./creates/src/routes/(app)/settings/+layout.server.ts": Or,
5475
- "./creates/src/routes/(app)/settings/+page.server.ts": qr,
5476
- "./creates/src/routes/(app)/settings/+page.svelte": Ur,
5477
- "./creates/src/routes/(public)/confirm-email-change/[token]/+page.server.ts": Vr,
5478
- "./creates/src/routes/(public)/confirm-email-change/[token]/+page.svelte": Hr,
5479
- "./creates/src/routes/(public)/confirm-email-change/[token]/server.test.ts": Gr,
5480
- "./creates/src/routes/(public)/confirm-reset/[token]/+page.server.ts": Kr,
5481
- "./creates/src/routes/(public)/confirm-reset/[token]/+page.svelte": Wr,
5482
- "./creates/src/routes/(public)/confirm-reset/[token]/server.test.ts": Xr,
5483
- "./creates/src/routes/(public)/confirm-verification/[token]/+server.ts": Yr,
5484
- "./creates/src/routes/(public)/confirm-verification/[token]/server.test.ts": Jr,
5485
- "./creates/src/routes/(public)/login/+page.server.ts": Zr,
5486
- "./creates/src/routes/(public)/login/+page.svelte": Qr,
5487
- "./creates/src/routes/(public)/login/server.test.ts": ta,
5488
- "./creates/src/routes/(public)/logout/+server.ts": ea,
5489
- "./creates/src/routes/(public)/logout/server.test.ts": na,
5490
- "./creates/src/routes/(public)/otp/[token]/+page.server.ts": ra,
5491
- "./creates/src/routes/(public)/otp/[token]/+page.svelte": aa,
5492
- "./creates/src/routes/(public)/otp/[token]/server.test.ts": oa,
5493
- "./creates/src/routes/(public)/reset/+page.server.ts": sa,
5494
- "./creates/src/routes/(public)/reset/+page.svelte": ia,
5495
- "./creates/src/routes/(public)/reset/server.test.ts": la,
5496
- "./creates/src/routes/(public)/signup/+page.server.ts": ca,
5497
- "./creates/src/routes/(public)/signup/+page.svelte": ma,
5498
- "./creates/src/routes/(public)/signup/server.test.ts": ua
5499
- }), da = "./creates/";
5500
- async function fa(t) {
5501
- const e = Object.entries(pa).map(([a, s]) => {
5502
- const i = Dt(a, da);
5422
+ `, aa = /* @__PURE__ */ Object.assign({
5423
+ "./creates/src/lib/components/app-sidebar.svelte": lr,
5424
+ "./creates/src/lib/components/nav-main.svelte": cr,
5425
+ "./creates/src/lib/components/nav-user.svelte": mr,
5426
+ "./creates/src/lib/components/ui/auth-menu/auth-menu-content.svelte": ur,
5427
+ "./creates/src/lib/components/ui/auth-menu/auth-menu-group.svelte": pr,
5428
+ "./creates/src/lib/components/ui/auth-menu/auth-menu-item.svelte": dr,
5429
+ "./creates/src/lib/components/ui/auth-menu/auth-menu-label.svelte": fr,
5430
+ "./creates/src/lib/components/ui/auth-menu/auth-menu-separator.svelte": hr,
5431
+ "./creates/src/lib/components/ui/auth-menu/auth-menu-trigger.svelte": gr,
5432
+ "./creates/src/lib/components/ui/auth-menu/auth-menu.svelte": br,
5433
+ "./creates/src/lib/components/ui/auth-menu/context.ts": vr,
5434
+ "./creates/src/lib/components/ui/auth-menu/index.ts": wr,
5435
+ "./creates/src/lib/schemas/changeEmail.ts": yr,
5436
+ "./creates/src/lib/schemas/changePassword.ts": xr,
5437
+ "./creates/src/lib/schemas/confirmEmailChange.ts": $r,
5438
+ "./creates/src/lib/schemas/confirmReset.ts": Fr,
5439
+ "./creates/src/lib/schemas/login.ts": Cr,
5440
+ "./creates/src/lib/schemas/otp.ts": _r,
5441
+ "./creates/src/lib/schemas/profile.ts": Sr,
5442
+ "./creates/src/lib/schemas/reset.ts": kr,
5443
+ "./creates/src/lib/schemas/signup.ts": Pr,
5444
+ "./creates/src/routes/(app)/+layout.server.ts": Mr,
5445
+ "./creates/src/routes/(app)/+layout.svelte": Rr,
5446
+ "./creates/src/routes/(app)/dashboard/+page.svelte": Er,
5447
+ "./creates/src/routes/(app)/dashboard/server.test.ts": Tr,
5448
+ "./creates/src/routes/(app)/settings/+layout.server.ts": zr,
5449
+ "./creates/src/routes/(app)/settings/+page.server.ts": Ir,
5450
+ "./creates/src/routes/(app)/settings/+page.svelte": Ar,
5451
+ "./creates/src/routes/(public)/confirm-email-change/[token]/+page.server.ts": Dr,
5452
+ "./creates/src/routes/(public)/confirm-email-change/[token]/+page.svelte": Nr,
5453
+ "./creates/src/routes/(public)/confirm-email-change/[token]/server.test.ts": Br,
5454
+ "./creates/src/routes/(public)/confirm-reset/[token]/+page.server.ts": jr,
5455
+ "./creates/src/routes/(public)/confirm-reset/[token]/+page.svelte": Lr,
5456
+ "./creates/src/routes/(public)/confirm-reset/[token]/server.test.ts": Or,
5457
+ "./creates/src/routes/(public)/confirm-verification/[token]/+server.ts": qr,
5458
+ "./creates/src/routes/(public)/confirm-verification/[token]/server.test.ts": Ur,
5459
+ "./creates/src/routes/(public)/login/+page.server.ts": Vr,
5460
+ "./creates/src/routes/(public)/login/+page.svelte": Hr,
5461
+ "./creates/src/routes/(public)/login/server.test.ts": Gr,
5462
+ "./creates/src/routes/(public)/logout/+server.ts": Kr,
5463
+ "./creates/src/routes/(public)/logout/server.test.ts": Wr,
5464
+ "./creates/src/routes/(public)/otp/[token]/+page.server.ts": Xr,
5465
+ "./creates/src/routes/(public)/otp/[token]/+page.svelte": Yr,
5466
+ "./creates/src/routes/(public)/otp/[token]/server.test.ts": Jr,
5467
+ "./creates/src/routes/(public)/reset/+page.server.ts": Zr,
5468
+ "./creates/src/routes/(public)/reset/+page.svelte": Qr,
5469
+ "./creates/src/routes/(public)/reset/server.test.ts": ta,
5470
+ "./creates/src/routes/(public)/signup/+page.server.ts": ea,
5471
+ "./creates/src/routes/(public)/signup/+page.svelte": na,
5472
+ "./creates/src/routes/(public)/signup/server.test.ts": ra
5473
+ }), oa = "./creates/";
5474
+ async function sa(t) {
5475
+ const e = Object.entries(aa).map(([o, s]) => {
5476
+ const i = Et(o, oa);
5503
5477
  return {
5504
5478
  path: i,
5505
5479
  language: j(i),
5506
5480
  content: s
5507
5481
  };
5508
- }).sort((a, s) => a.path.localeCompare(s.path)), n = [
5482
+ }).sort((o, s) => o.path.localeCompare(s.path)), n = [
5509
5483
  "sidebar",
5510
5484
  "breadcrumb",
5511
5485
  "separator",
@@ -5590,7 +5564,7 @@ async function fa(t) {
5590
5564
  ]
5591
5565
  };
5592
5566
  }
5593
- const ha = `/// <reference path="../pb_data/types.d.ts" />
5567
+ const ia = `/// <reference path="../pb_data/types.d.ts" />
5594
5568
  migrate(
5595
5569
  (app) => {
5596
5570
  const collection = new Collection({
@@ -5776,7 +5750,7 @@ migrate(
5776
5750
  return app.delete(collection);
5777
5751
  }
5778
5752
  );
5779
- `, ga = `/// <reference path="../pb_data/types.d.ts" />
5753
+ `, la = `/// <reference path="../pb_data/types.d.ts" />
5780
5754
  migrate(
5781
5755
  (app) => {
5782
5756
  const collection = app.findCollectionByNameOrId('_pb_users_auth_');
@@ -5831,7 +5805,7 @@ migrate(
5831
5805
  return app.save(collection);
5832
5806
  }
5833
5807
  );
5834
- `, ba = `import {
5808
+ `, ca = `import {
5835
5809
  POCKETBASE_URL,
5836
5810
  POCKETBASE_SUPERUSER_EMAIL,
5837
5811
  POCKETBASE_SUPERUSER_PASSWORD
@@ -5844,7 +5818,7 @@ export const handle = handlePocketbase({
5844
5818
  superuserPassword: POCKETBASE_SUPERUSER_PASSWORD,
5845
5819
  auth: { protectedRoutes: ['/(app)'] }
5846
5820
  });
5847
- `, va = `<script lang="ts">
5821
+ `, ma = `<script lang="ts">
5848
5822
  import { toggleMode } from 'mode-watcher';
5849
5823
  import * as Navbar from '$lib/components/ui/navbar';
5850
5824
  import { Button } from '$lib/components/ui/button';
@@ -5946,26 +5920,26 @@ export const handle = handlePocketbase({
5946
5920
  @apply container mx-auto max-w-7xl px-4 py-8 w-full;
5947
5921
  }
5948
5922
  </style>
5949
- `, wa = `import { loadFlash } from "sveltekit-flash-message/server";
5923
+ `, ua = `import { loadFlash } from "sveltekit-flash-message/server";
5950
5924
 
5951
5925
  export const load = loadFlash(async ({ locals }) => {
5952
5926
  return {
5953
5927
  user: locals.pb.authStore.record,
5954
5928
  };
5955
5929
  });
5956
- `, ya = /* @__PURE__ */ Object.assign({
5957
- "./preview-modifies/migrations/1776099881_created_oauth_accounts.js": ha,
5958
- "./preview-modifies/migrations/1776099881_updated_users.js": ga,
5959
- "./preview-modifies/src/hooks.server.ts": ba,
5960
- "./preview-modifies/src/routes/(public)/root-layout.svelte": va,
5961
- "./preview-modifies/src/routes/+layout.server.ts": wa
5962
- }), xa = "./preview-modifies/";
5963
- async function $a(t) {
5964
- const e = Object.entries(ya).map(([n, r]) => {
5965
- const a = Dt(n, xa);
5930
+ `, pa = /* @__PURE__ */ Object.assign({
5931
+ "./preview-modifies/migrations/1776099881_created_oauth_accounts.js": ia,
5932
+ "./preview-modifies/migrations/1776099881_updated_users.js": la,
5933
+ "./preview-modifies/src/hooks.server.ts": ca,
5934
+ "./preview-modifies/src/routes/(public)/root-layout.svelte": ma,
5935
+ "./preview-modifies/src/routes/+layout.server.ts": ua
5936
+ }), da = "./preview-modifies/";
5937
+ async function fa(t) {
5938
+ const e = Object.entries(pa).map(([n, r]) => {
5939
+ const o = Et(n, da);
5966
5940
  return {
5967
- path: a,
5968
- language: j(a),
5941
+ path: o,
5942
+ language: j(o),
5969
5943
  content: r
5970
5944
  };
5971
5945
  }).sort((n, r) => n.path.localeCompare(r.path));
@@ -5978,18 +5952,18 @@ async function $a(t) {
5978
5952
  collections: []
5979
5953
  };
5980
5954
  }
5981
- const Fa = "enable-auth";
5982
- async function Ca(t) {
5983
- const e = await fa(t);
5955
+ const ha = "enable-auth";
5956
+ async function ga(t) {
5957
+ const e = await sa(t);
5984
5958
  if (t.env === "preview") {
5985
- const s = await $a();
5959
+ const s = await fa();
5986
5960
  return k(pt([e, s]));
5987
5961
  }
5988
- const { generate: n } = await import("./generate.runtime-BCboVR38.js"), r = await n(t), { writeResult: a } = await import("./write-result-DG5OAbe1.js");
5989
- return a(await k(pt([e, r])), t);
5962
+ const { generate: n } = await import("./generate.runtime-vKonp83V.js"), r = await n(t), { writeResult: o } = await import("./write-result-DG5OAbe1.js");
5963
+ return o(await k(pt([e, r])), t);
5990
5964
  }
5991
- const _a = {
5992
- slug: Fa,
5965
+ const ba = {
5966
+ slug: ha,
5993
5967
  title: "Enable authentication",
5994
5968
  summary: "Enables authentication.",
5995
5969
  categories: ["authentication"],
@@ -6003,29 +5977,30 @@ const _a = {
6003
5977
  ],
6004
5978
  command: {
6005
5979
  raw: "vela enable auth",
6006
- argv: ["enable", "auth"]
5980
+ base: "vela enable auth",
5981
+ argv: []
6007
5982
  },
6008
5983
  baseline: "velastack",
6009
- generate: Ca
6010
- }, Zt = [
6011
- Pn,
6012
- hr,
6013
- Vn,
5984
+ generate: ga
5985
+ }, Wt = [
5986
+ _n,
6014
5987
  ir,
6015
- _a
6016
- ], Sa = Zt.reduce(
5988
+ Bn,
5989
+ tr,
5990
+ ba
5991
+ ], va = Wt.reduce(
6017
5992
  (t, e) => (t[e.slug] = e, t),
6018
5993
  {}
6019
- ), Ia = {
5994
+ ), Ca = {
6020
5995
  version: "0.1.0",
6021
- patterns: Zt,
6022
- bySlug: Sa
5996
+ patterns: Wt,
5997
+ bySlug: va
6023
5998
  };
6024
5999
  export {
6025
- Pa as D,
6026
- Ea as M,
6000
+ $a as D,
6001
+ Fa as M,
6027
6002
  p as d,
6028
- Ia as i,
6003
+ Ca as i,
6029
6004
  j as l
6030
6005
  };
6031
- //# sourceMappingURL=index-DBV0rNRK.js.map
6006
+ //# sourceMappingURL=index-CDgw5XzM.js.map