@keycloakify/svelte 0.2.1 → 0.2.3

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.
Files changed (63) hide show
  1. package/README.md +27 -2
  2. package/keycloakify-svelte/account/Template.svelte +1 -1
  3. package/keycloakify-svelte/account/pages/Account.svelte +3 -3
  4. package/keycloakify-svelte/account/pages/Applications.svelte +8 -8
  5. package/keycloakify-svelte/account/pages/FederatedIdentity.svelte +1 -1
  6. package/keycloakify-svelte/account/pages/Log.svelte +2 -2
  7. package/keycloakify-svelte/account/pages/Password.svelte +1 -1
  8. package/keycloakify-svelte/account/pages/Sessions.svelte +2 -2
  9. package/keycloakify-svelte/account/pages/Totp.svelte +2 -2
  10. package/keycloakify-svelte/bin/292.index.js +297 -252
  11. package/keycloakify-svelte/login/Template.svelte +1 -1
  12. package/keycloakify-svelte/login/components/FieldErrors.svelte +1 -1
  13. package/keycloakify-svelte/login/components/InputFieldByType.svelte +1 -1
  14. package/keycloakify-svelte/login/components/InputTagSelects.svelte +1 -1
  15. package/keycloakify-svelte/login/components/SelectTag.svelte +1 -1
  16. package/keycloakify-svelte/login/components/UserProfileFormFields.svelte +1 -1
  17. package/keycloakify-svelte/login/pages/DeleteAccountConfirm.svelte +6 -6
  18. package/keycloakify-svelte/login/pages/FrontchannelLogout.svelte +11 -7
  19. package/keycloakify-svelte/login/pages/Login.svelte +3 -3
  20. package/keycloakify-svelte/login/pages/LoginConfigTotp.svelte +3 -3
  21. package/keycloakify-svelte/login/pages/LoginIdpLinkConfirmOverride.svelte +1 -1
  22. package/keycloakify-svelte/login/pages/LoginOauthGrant.svelte +1 -1
  23. package/keycloakify-svelte/login/pages/LoginOtp.svelte +1 -1
  24. package/keycloakify-svelte/login/pages/LoginPageExpired.svelte +3 -5
  25. package/keycloakify-svelte/login/pages/LoginPasskeysConditionalAuthenticate.svelte +6 -6
  26. package/keycloakify-svelte/login/pages/LoginRecoveryAuthnCodeConfig.svelte +1 -1
  27. package/keycloakify-svelte/login/pages/LoginResetOtp.svelte +1 -1
  28. package/keycloakify-svelte/login/pages/LoginUsername.svelte +2 -2
  29. package/keycloakify-svelte/login/pages/Register.svelte +19 -3
  30. package/keycloakify-svelte/login/pages/SelectAuthenticator.svelte +1 -1
  31. package/keycloakify-svelte/login/pages/WebauthnAuthenticate.svelte +4 -4
  32. package/package.json +21 -21
  33. package/src/account/Template.svelte +1 -1
  34. package/src/account/pages/Account.svelte +3 -3
  35. package/src/account/pages/Applications.svelte +8 -8
  36. package/src/account/pages/FederatedIdentity.svelte +1 -1
  37. package/src/account/pages/Log.svelte +2 -2
  38. package/src/account/pages/Password.svelte +1 -1
  39. package/src/account/pages/Sessions.svelte +2 -2
  40. package/src/account/pages/Totp.svelte +2 -2
  41. package/src/login/Template.svelte +1 -1
  42. package/src/login/components/FieldErrors.svelte +1 -1
  43. package/src/login/components/InputFieldByType.svelte +1 -1
  44. package/src/login/components/InputTagSelects.svelte +1 -1
  45. package/src/login/components/SelectTag.svelte +1 -1
  46. package/src/login/components/UserProfileFormFields.svelte +1 -1
  47. package/src/login/pages/DeleteAccountConfirm.svelte +6 -6
  48. package/src/login/pages/FrontchannelLogout.svelte +11 -7
  49. package/src/login/pages/Login.svelte +3 -3
  50. package/src/login/pages/LoginConfigTotp.svelte +3 -3
  51. package/src/login/pages/LoginIdpLinkConfirmOverride.svelte +1 -1
  52. package/src/login/pages/LoginOauthGrant.svelte +1 -1
  53. package/src/login/pages/LoginOtp.svelte +1 -1
  54. package/src/login/pages/LoginPageExpired.svelte +3 -5
  55. package/src/login/pages/LoginPasskeysConditionalAuthenticate.svelte +6 -6
  56. package/src/login/pages/LoginRecoveryAuthnCodeConfig.svelte +1 -1
  57. package/src/login/pages/LoginResetOtp.svelte +1 -1
  58. package/src/login/pages/LoginUsername.svelte +2 -2
  59. package/src/login/pages/Register.svelte +19 -3
  60. package/src/login/pages/SelectAuthenticator.svelte +1 -1
  61. package/src/login/pages/WebauthnAuthenticate.svelte +4 -4
  62. package/stories/account/KcPage.svelte +1 -0
  63. package/stories/login/KcPage.svelte +1 -0
@@ -59,7 +59,7 @@ __webpack_require__.d(__webpack_exports__, {
59
59
  L5: () => (/* binding */ unknown)
60
60
  });
61
61
 
62
- // UNUSED EXPORTS: ZodAny, ZodArray, ZodBase64, ZodBase64URL, ZodBigInt, ZodBigIntFormat, ZodBoolean, ZodCIDRv4, ZodCIDRv6, ZodCUID, ZodCUID2, ZodCatch, ZodCustom, ZodCustomStringFormat, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodE164, ZodEmail, ZodEmoji, ZodEnum, ZodFile, ZodGUID, ZodIPv4, ZodIPv6, ZodIntersection, ZodJWT, ZodKSUID, ZodLazy, ZodLiteral, ZodMap, ZodNaN, ZodNanoID, ZodNever, ZodNonOptional, ZodNull, ZodNullable, ZodNumber, ZodNumberFormat, ZodObject, ZodOptional, ZodPipe, ZodPrefault, ZodPromise, ZodReadonly, ZodRecord, ZodSet, ZodString, ZodStringFormat, ZodSuccess, ZodSymbol, ZodTemplateLiteral, ZodTransform, ZodTuple, ZodType, ZodULID, ZodURL, ZodUUID, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, ZodXID, _ZodString, _default, any, array, base64, base64url, bigint, boolean, catch, check, cidrv4, cidrv6, cuid, cuid2, custom, date, discriminatedUnion, e164, email, emoji, enum, file, float32, float64, guid, instanceof, int, int32, int64, intersection, ipv4, ipv6, json, jwt, keyof, ksuid, lazy, literal, looseObject, map, nan, nanoid, nativeEnum, never, nonoptional, null, nullable, nullish, number, optional, partialRecord, pipe, prefault, preprocess, promise, readonly, refine, set, strictObject, string, stringFormat, stringbool, success, superRefine, symbol, templateLiteral, transform, tuple, uint32, uint64, ulid, undefined, union, url, uuid, uuidv4, uuidv6, uuidv7, void, xid
62
+ // UNUSED EXPORTS: ZodAny, ZodArray, ZodBase64, ZodBase64URL, ZodBigInt, ZodBigIntFormat, ZodBoolean, ZodCIDRv4, ZodCIDRv6, ZodCUID, ZodCUID2, ZodCatch, ZodCustom, ZodCustomStringFormat, ZodDate, ZodDefault, ZodDiscriminatedUnion, ZodE164, ZodEmail, ZodEmoji, ZodEnum, ZodFile, ZodGUID, ZodIPv4, ZodIPv6, ZodIntersection, ZodJWT, ZodKSUID, ZodLazy, ZodLiteral, ZodMap, ZodNaN, ZodNanoID, ZodNever, ZodNonOptional, ZodNull, ZodNullable, ZodNumber, ZodNumberFormat, ZodObject, ZodOptional, ZodPipe, ZodPrefault, ZodPromise, ZodReadonly, ZodRecord, ZodSet, ZodString, ZodStringFormat, ZodSuccess, ZodSymbol, ZodTemplateLiteral, ZodTransform, ZodTuple, ZodType, ZodULID, ZodURL, ZodUUID, ZodUndefined, ZodUnion, ZodUnknown, ZodVoid, ZodXID, _ZodString, _default, any, array, base64, base64url, bigint, boolean, catch, check, cidrv4, cidrv6, cuid, cuid2, custom, date, discriminatedUnion, e164, email, emoji, enum, file, float32, float64, guid, hostname, instanceof, int, int32, int64, intersection, ipv4, ipv6, json, jwt, keyof, ksuid, lazy, literal, looseObject, map, nan, nanoid, nativeEnum, never, nonoptional, null, nullable, nullish, number, optional, partialRecord, pipe, prefault, preprocess, promise, readonly, refine, set, strictObject, string, stringFormat, stringbool, success, superRefine, symbol, templateLiteral, transform, tuple, uint32, uint64, ulid, undefined, union, url, uuid, uuidv4, uuidv6, uuidv7, void, xid
63
63
 
64
64
  ;// CONCATENATED MODULE: ./node_modules/zod/v4/core/core.js
65
65
  /** A special constant with type `never` */
@@ -175,22 +175,33 @@ function cleanRegex(source) {
175
175
  }
176
176
  function floatSafeRemainder(val, step) {
177
177
  const valDecCount = (val.toString().split(".")[1] || "").length;
178
- const stepDecCount = (step.toString().split(".")[1] || "").length;
178
+ const stepString = step.toString();
179
+ let stepDecCount = (stepString.split(".")[1] || "").length;
180
+ if (stepDecCount === 0 && /\d?e-\d?/.test(stepString)) {
181
+ const match = stepString.match(/\d?e-(\d?)/);
182
+ if (match?.[1]) {
183
+ stepDecCount = Number.parseInt(match[1]);
184
+ }
185
+ }
179
186
  const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
180
187
  const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
181
188
  const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
182
189
  return (valInt % stepInt) / 10 ** decCount;
183
190
  }
191
+ const EVALUATING = Symbol("evaluating");
184
192
  function defineLazy(object, key, getter) {
185
- const set = false;
193
+ let value = undefined;
186
194
  Object.defineProperty(object, key, {
187
195
  get() {
188
- if (!set) {
189
- const value = getter();
190
- object[key] = value;
191
- return value;
196
+ if (value === EVALUATING) {
197
+ // Circular reference detected, return undefined to break the cycle
198
+ return undefined;
192
199
  }
193
- throw new Error("cached value already set");
200
+ if (value === undefined) {
201
+ value = EVALUATING;
202
+ value = getter();
203
+ }
204
+ return value;
194
205
  },
195
206
  set(v) {
196
207
  Object.defineProperty(object, key, {
@@ -202,6 +213,9 @@ function defineLazy(object, key, getter) {
202
213
  configurable: true,
203
214
  });
204
215
  }
216
+ function objectClone(obj) {
217
+ return Object.create(Object.getPrototypeOf(obj), Object.getOwnPropertyDescriptors(obj));
218
+ }
205
219
  function assignProp(target, prop, value) {
206
220
  Object.defineProperty(target, prop, {
207
221
  value,
@@ -210,6 +224,17 @@ function assignProp(target, prop, value) {
210
224
  configurable: true,
211
225
  });
212
226
  }
227
+ function mergeDefs(...defs) {
228
+ const mergedDescriptors = {};
229
+ for (const def of defs) {
230
+ const descriptors = Object.getOwnPropertyDescriptors(def);
231
+ Object.assign(mergedDescriptors, descriptors);
232
+ }
233
+ return Object.defineProperties({}, mergedDescriptors);
234
+ }
235
+ function cloneDef(schema) {
236
+ return mergeDefs(schema._zod.def);
237
+ }
213
238
  function getElementAtPath(obj, path) {
214
239
  if (!path)
215
240
  return obj;
@@ -237,13 +262,12 @@ function randomString(length = 10) {
237
262
  function esc(str) {
238
263
  return JSON.stringify(str);
239
264
  }
240
- const captureStackTrace = Error.captureStackTrace
241
- ? Error.captureStackTrace
242
- : (..._args) => { };
265
+ const captureStackTrace = ("captureStackTrace" in Error ? Error.captureStackTrace : (..._args) => { });
243
266
  function util_isObject(data) {
244
267
  return typeof data === "object" && data !== null && !Array.isArray(data);
245
268
  }
246
269
  const util_allowsEval = cached(() => {
270
+ // @ts-ignore
247
271
  if (typeof navigator !== "undefined" && navigator?.userAgent?.includes("Cloudflare")) {
248
272
  return false;
249
273
  }
@@ -273,6 +297,11 @@ function isPlainObject(o) {
273
297
  }
274
298
  return true;
275
299
  }
300
+ function shallowClone(o) {
301
+ if (isPlainObject(o))
302
+ return { ...o };
303
+ return o;
304
+ }
276
305
  function numKeys(data) {
277
306
  let keyCount = 0;
278
307
  for (const key in data) {
@@ -318,6 +347,7 @@ const getParsedType = (data) => {
318
347
  if (typeof Date !== "undefined" && data instanceof Date) {
319
348
  return "date";
320
349
  }
350
+ // @ts-ignore
321
351
  if (typeof File !== "undefined" && data instanceof File) {
322
352
  return "file";
323
353
  }
@@ -411,140 +441,153 @@ const BIGINT_FORMAT_RANGES = {
411
441
  uint64: [/* @__PURE__*/ BigInt(0), /* @__PURE__*/ BigInt("18446744073709551615")],
412
442
  };
413
443
  function pick(schema, mask) {
414
- const newShape = {};
415
- const currDef = schema._zod.def; //.shape;
416
- for (const key in mask) {
417
- if (!(key in currDef.shape)) {
418
- throw new Error(`Unrecognized key: "${key}"`);
419
- }
420
- if (!mask[key])
421
- continue;
422
- // pick key
423
- newShape[key] = currDef.shape[key];
424
- }
425
- return clone(schema, {
426
- ...schema._zod.def,
427
- shape: newShape,
444
+ const currDef = schema._zod.def;
445
+ const def = mergeDefs(schema._zod.def, {
446
+ get shape() {
447
+ const newShape = {};
448
+ for (const key in mask) {
449
+ if (!(key in currDef.shape)) {
450
+ throw new Error(`Unrecognized key: "${key}"`);
451
+ }
452
+ if (!mask[key])
453
+ continue;
454
+ newShape[key] = currDef.shape[key];
455
+ }
456
+ assignProp(this, "shape", newShape); // self-caching
457
+ return newShape;
458
+ },
428
459
  checks: [],
429
460
  });
461
+ return clone(schema, def);
430
462
  }
431
463
  function omit(schema, mask) {
432
- const newShape = { ...schema._zod.def.shape };
433
- const currDef = schema._zod.def; //.shape;
434
- for (const key in mask) {
435
- if (!(key in currDef.shape)) {
436
- throw new Error(`Unrecognized key: "${key}"`);
437
- }
438
- if (!mask[key])
439
- continue;
440
- delete newShape[key];
441
- }
442
- return clone(schema, {
443
- ...schema._zod.def,
444
- shape: newShape,
464
+ const currDef = schema._zod.def;
465
+ const def = mergeDefs(schema._zod.def, {
466
+ get shape() {
467
+ const newShape = { ...schema._zod.def.shape };
468
+ for (const key in mask) {
469
+ if (!(key in currDef.shape)) {
470
+ throw new Error(`Unrecognized key: "${key}"`);
471
+ }
472
+ if (!mask[key])
473
+ continue;
474
+ delete newShape[key];
475
+ }
476
+ assignProp(this, "shape", newShape); // self-caching
477
+ return newShape;
478
+ },
445
479
  checks: [],
446
480
  });
481
+ return clone(schema, def);
447
482
  }
448
483
  function extend(schema, shape) {
449
484
  if (!isPlainObject(shape)) {
450
485
  throw new Error("Invalid input to extend: expected a plain object");
451
486
  }
452
- const def = {
453
- ...schema._zod.def,
487
+ const def = mergeDefs(schema._zod.def, {
454
488
  get shape() {
455
489
  const _shape = { ...schema._zod.def.shape, ...shape };
456
490
  assignProp(this, "shape", _shape); // self-caching
457
491
  return _shape;
458
492
  },
459
- checks: [], // delete existing checks
460
- };
493
+ checks: [],
494
+ });
461
495
  return clone(schema, def);
462
496
  }
463
497
  function merge(a, b) {
464
- return clone(a, {
465
- ...a._zod.def,
498
+ const def = mergeDefs(a._zod.def, {
466
499
  get shape() {
467
500
  const _shape = { ...a._zod.def.shape, ...b._zod.def.shape };
468
501
  assignProp(this, "shape", _shape); // self-caching
469
502
  return _shape;
470
503
  },
471
- catchall: b._zod.def.catchall,
504
+ get catchall() {
505
+ return b._zod.def.catchall;
506
+ },
472
507
  checks: [], // delete existing checks
473
508
  });
509
+ return clone(a, def);
474
510
  }
475
511
  function partial(Class, schema, mask) {
476
- const oldShape = schema._zod.def.shape;
477
- const shape = { ...oldShape };
478
- if (mask) {
479
- for (const key in mask) {
480
- if (!(key in oldShape)) {
481
- throw new Error(`Unrecognized key: "${key}"`);
512
+ const def = mergeDefs(schema._zod.def, {
513
+ get shape() {
514
+ const oldShape = schema._zod.def.shape;
515
+ const shape = { ...oldShape };
516
+ if (mask) {
517
+ for (const key in mask) {
518
+ if (!(key in oldShape)) {
519
+ throw new Error(`Unrecognized key: "${key}"`);
520
+ }
521
+ if (!mask[key])
522
+ continue;
523
+ // if (oldShape[key]!._zod.optin === "optional") continue;
524
+ shape[key] = Class
525
+ ? new Class({
526
+ type: "optional",
527
+ innerType: oldShape[key],
528
+ })
529
+ : oldShape[key];
530
+ }
482
531
  }
483
- if (!mask[key])
484
- continue;
485
- // if (oldShape[key]!._zod.optin === "optional") continue;
486
- shape[key] = Class
487
- ? new Class({
488
- type: "optional",
489
- innerType: oldShape[key],
490
- })
491
- : oldShape[key];
492
- }
493
- }
494
- else {
495
- for (const key in oldShape) {
496
- // if (oldShape[key]!._zod.optin === "optional") continue;
497
- shape[key] = Class
498
- ? new Class({
499
- type: "optional",
500
- innerType: oldShape[key],
501
- })
502
- : oldShape[key];
503
- }
504
- }
505
- return clone(schema, {
506
- ...schema._zod.def,
507
- shape,
532
+ else {
533
+ for (const key in oldShape) {
534
+ // if (oldShape[key]!._zod.optin === "optional") continue;
535
+ shape[key] = Class
536
+ ? new Class({
537
+ type: "optional",
538
+ innerType: oldShape[key],
539
+ })
540
+ : oldShape[key];
541
+ }
542
+ }
543
+ assignProp(this, "shape", shape); // self-caching
544
+ return shape;
545
+ },
508
546
  checks: [],
509
547
  });
548
+ return clone(schema, def);
510
549
  }
511
550
  function required(Class, schema, mask) {
512
- const oldShape = schema._zod.def.shape;
513
- const shape = { ...oldShape };
514
- if (mask) {
515
- for (const key in mask) {
516
- if (!(key in shape)) {
517
- throw new Error(`Unrecognized key: "${key}"`);
551
+ const def = mergeDefs(schema._zod.def, {
552
+ get shape() {
553
+ const oldShape = schema._zod.def.shape;
554
+ const shape = { ...oldShape };
555
+ if (mask) {
556
+ for (const key in mask) {
557
+ if (!(key in shape)) {
558
+ throw new Error(`Unrecognized key: "${key}"`);
559
+ }
560
+ if (!mask[key])
561
+ continue;
562
+ // overwrite with non-optional
563
+ shape[key] = new Class({
564
+ type: "nonoptional",
565
+ innerType: oldShape[key],
566
+ });
567
+ }
518
568
  }
519
- if (!mask[key])
520
- continue;
521
- // overwrite with non-optional
522
- shape[key] = new Class({
523
- type: "nonoptional",
524
- innerType: oldShape[key],
525
- });
526
- }
527
- }
528
- else {
529
- for (const key in oldShape) {
530
- // overwrite with non-optional
531
- shape[key] = new Class({
532
- type: "nonoptional",
533
- innerType: oldShape[key],
534
- });
535
- }
536
- }
537
- return clone(schema, {
538
- ...schema._zod.def,
539
- shape,
540
- // optional: [],
569
+ else {
570
+ for (const key in oldShape) {
571
+ // overwrite with non-optional
572
+ shape[key] = new Class({
573
+ type: "nonoptional",
574
+ innerType: oldShape[key],
575
+ });
576
+ }
577
+ }
578
+ assignProp(this, "shape", shape); // self-caching
579
+ return shape;
580
+ },
541
581
  checks: [],
542
582
  });
583
+ return clone(schema, def);
543
584
  }
585
+ // invalid_type | too_big | too_small | invalid_format | not_multiple_of | unrecognized_keys | invalid_union | invalid_key | invalid_element | invalid_value | custom
544
586
  function aborted(x, startIndex = 0) {
545
587
  for (let i = startIndex; i < x.issues.length; i++) {
546
- if (x.issues[i]?.continue !== true)
588
+ if (x.issues[i]?.continue !== true) {
547
589
  return true;
590
+ }
548
591
  }
549
592
  return false;
550
593
  }
@@ -583,6 +626,7 @@ function getSizableOrigin(input) {
583
626
  return "set";
584
627
  if (input instanceof Map)
585
628
  return "map";
629
+ // @ts-ignore
586
630
  if (input instanceof File)
587
631
  return "file";
588
632
  return "unknown";
@@ -747,6 +791,7 @@ const $ZodCheckNumberFormat = /*@__PURE__*/ (/* unused pure expression or super
747
791
  expected: origin,
748
792
  format: def.format,
749
793
  code: "invalid_type",
794
+ continue: false,
750
795
  input,
751
796
  inst,
752
797
  });
@@ -1176,6 +1221,7 @@ const $ZodCheckMimeType = /*@__PURE__*/ (/* unused pure expression or super */ n
1176
1221
  values: def.mime,
1177
1222
  input: payload.value.type,
1178
1223
  inst,
1224
+ continue: !def.abort,
1179
1225
  });
1180
1226
  };
1181
1227
  })));
@@ -1236,13 +1282,7 @@ const initializer = (inst, def) => {
1236
1282
  value: def,
1237
1283
  enumerable: false,
1238
1284
  });
1239
- Object.defineProperty(inst, "message", {
1240
- get() {
1241
- return JSON.stringify(def, jsonStringifyReplacer, 2);
1242
- },
1243
- enumerable: true,
1244
- // configurable: false,
1245
- });
1285
+ inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
1246
1286
  Object.defineProperty(inst, "toString", {
1247
1287
  value: () => inst.message,
1248
1288
  enumerable: false,
@@ -1389,8 +1429,9 @@ function treeifyError(error, _mapper) {
1389
1429
  * ✖ Invalid input: expected number
1390
1430
  * ```
1391
1431
  */
1392
- function toDotPath(path) {
1432
+ function toDotPath(_path) {
1393
1433
  const segs = [];
1434
+ const path = _path.map((seg) => (typeof seg === "object" ? seg.key : seg));
1394
1435
  for (const seg of path) {
1395
1436
  if (typeof seg === "number")
1396
1437
  segs.push(`[${seg}]`);
@@ -1409,7 +1450,7 @@ function toDotPath(path) {
1409
1450
  function prettifyError(error) {
1410
1451
  const lines = [];
1411
1452
  // sort by path length
1412
- const issues = [...error.issues].sort((a, b) => a.path.length - b.path.length);
1453
+ const issues = [...error.issues].sort((a, b) => (a.path ?? []).length - (b.path ?? []).length);
1413
1454
  // Process each issue
1414
1455
  for (const issue of issues) {
1415
1456
  lines.push(`✖ ${issue.message}`);
@@ -1483,7 +1524,7 @@ const safeParseAsync = /* @__PURE__*/ _safeParseAsync($ZodRealError);
1483
1524
  const version = {
1484
1525
  major: 4,
1485
1526
  minor: 0,
1486
- patch: 5,
1527
+ patch: 17,
1487
1528
  };
1488
1529
 
1489
1530
  ;// CONCATENATED MODULE: ./node_modules/zod/v4/core/schemas.js
@@ -1645,9 +1686,10 @@ const $ZodURL = /*@__PURE__*/ (/* unused pure expression or super */ null && (co
1645
1686
  $ZodStringFormat.init(inst, def);
1646
1687
  inst._zod.check = (payload) => {
1647
1688
  try {
1648
- const orig = payload.value;
1649
- const url = new URL(orig);
1650
- const href = url.href;
1689
+ // Trim whitespace from input
1690
+ const trimmed = payload.value.trim();
1691
+ // @ts-ignore
1692
+ const url = new URL(trimmed);
1651
1693
  if (def.hostname) {
1652
1694
  def.hostname.lastIndex = 0;
1653
1695
  if (!def.hostname.test(url.hostname)) {
@@ -1676,12 +1718,14 @@ const $ZodURL = /*@__PURE__*/ (/* unused pure expression or super */ null && (co
1676
1718
  });
1677
1719
  }
1678
1720
  }
1679
- // payload.value = url.href;
1680
- if (!orig.endsWith("/") && href.endsWith("/")) {
1681
- payload.value = href.slice(0, -1);
1721
+ // Set the output value based on normalize flag
1722
+ if (def.normalize) {
1723
+ // Use normalized URL
1724
+ payload.value = url.href;
1682
1725
  }
1683
1726
  else {
1684
- payload.value = href;
1727
+ // Preserve the original input (trimmed)
1728
+ payload.value = trimmed;
1685
1729
  }
1686
1730
  return;
1687
1731
  }
@@ -1757,6 +1801,7 @@ const $ZodIPv6 = /*@__PURE__*/ (/* unused pure expression or super */ null && (c
1757
1801
  });
1758
1802
  inst._zod.check = (payload) => {
1759
1803
  try {
1804
+ // @ts-ignore
1760
1805
  new URL(`http://[${payload.value}]`);
1761
1806
  // return;
1762
1807
  }
@@ -1788,6 +1833,7 @@ const $ZodCIDRv6 = /*@__PURE__*/ (/* unused pure expression or super */ null &&
1788
1833
  throw new Error();
1789
1834
  if (prefixNum < 0 || prefixNum > 128)
1790
1835
  throw new Error();
1836
+ // @ts-ignore
1791
1837
  new URL(`http://[${address}]`);
1792
1838
  }
1793
1839
  catch {
@@ -1808,6 +1854,7 @@ function isValidBase64(data) {
1808
1854
  if (data.length % 4 !== 0)
1809
1855
  return false;
1810
1856
  try {
1857
+ // @ts-ignore
1811
1858
  atob(data);
1812
1859
  return true;
1813
1860
  }
@@ -1872,6 +1919,7 @@ function isValidJWT(token, algorithm = null) {
1872
1919
  const [header] = tokensParts;
1873
1920
  if (!header)
1874
1921
  return false;
1922
+ // @ts-ignore
1875
1923
  const parsedHeader = JSON.parse(atob(header));
1876
1924
  if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT")
1877
1925
  return false;
@@ -2142,36 +2190,16 @@ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def) => {
2142
2190
  return payload; //handleArrayResultsAsync(parseResults, final);
2143
2191
  };
2144
2192
  });
2145
- function handleObjectResult(result, final, key) {
2146
- // if(isOptional)
2193
+ function handlePropertyResult(result, final, key, input) {
2147
2194
  if (result.issues.length) {
2148
2195
  final.issues.push(...prefixIssues(key, result.issues));
2149
2196
  }
2150
- final.value[key] = result.value;
2151
- }
2152
- function handleOptionalObjectResult(result, final, key, input) {
2153
- if (result.issues.length) {
2154
- // validation failed against value schema
2155
- if (input[key] === undefined) {
2156
- // if input was undefined, ignore the error
2157
- if (key in input) {
2158
- final.value[key] = undefined;
2159
- }
2160
- else {
2161
- final.value[key] = result.value;
2162
- }
2163
- }
2164
- else {
2165
- final.issues.push(...prefixIssues(key, result.issues));
2166
- }
2167
- }
2168
- else if (result.value === undefined) {
2169
- // validation returned `undefined`
2170
- if (key in input)
2197
+ if (result.value === undefined) {
2198
+ if (key in input) {
2171
2199
  final.value[key] = undefined;
2200
+ }
2172
2201
  }
2173
2202
  else {
2174
- // non-undefined value
2175
2203
  final.value[key] = result.value;
2176
2204
  }
2177
2205
  }
@@ -2181,7 +2209,7 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
2181
2209
  const _normalized = cached(() => {
2182
2210
  const keys = Object.keys(def.shape);
2183
2211
  for (const k of keys) {
2184
- if (!(def.shape[k] instanceof $ZodType)) {
2212
+ if (!def.shape[k]._zod.traits.has("$ZodType")) {
2185
2213
  throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
2186
2214
  }
2187
2215
  }
@@ -2223,42 +2251,25 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
2223
2251
  // A: preserve key order {
2224
2252
  doc.write(`const newResult = {}`);
2225
2253
  for (const key of normalized.keys) {
2226
- if (normalized.optionalKeys.has(key)) {
2227
- const id = ids[key];
2228
- doc.write(`const ${id} = ${parseStr(key)};`);
2229
- const k = esc(key);
2230
- doc.write(`
2254
+ const id = ids[key];
2255
+ const k = esc(key);
2256
+ doc.write(`const ${id} = ${parseStr(key)};`);
2257
+ doc.write(`
2231
2258
  if (${id}.issues.length) {
2232
- if (input[${k}] === undefined) {
2233
- if (${k} in input) {
2234
- newResult[${k}] = undefined;
2235
- }
2236
- } else {
2237
- payload.issues = payload.issues.concat(
2238
- ${id}.issues.map((iss) => ({
2239
- ...iss,
2240
- path: iss.path ? [${k}, ...iss.path] : [${k}],
2241
- }))
2242
- );
2259
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
2260
+ ...iss,
2261
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
2262
+ })));
2263
+ }
2264
+
2265
+ if (${id}.value === undefined) {
2266
+ if (${k} in input) {
2267
+ newResult[${k}] = undefined;
2243
2268
  }
2244
- } else if (${id}.value === undefined) {
2245
- if (${k} in input) newResult[${k}] = undefined;
2246
2269
  } else {
2247
2270
  newResult[${k}] = ${id}.value;
2248
2271
  }
2249
- `);
2250
- }
2251
- else {
2252
- const id = ids[key];
2253
- // const id = ids[key];
2254
- doc.write(`const ${id} = ${parseStr(key)};`);
2255
- doc.write(`
2256
- if (${id}.issues.length) payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
2257
- ...iss,
2258
- path: iss.path ? [${esc(key)}, ...iss.path] : [${esc(key)}]
2259
- })));`);
2260
- doc.write(`newResult[${esc(key)}] = ${id}.value`);
2261
- }
2272
+ `);
2262
2273
  }
2263
2274
  doc.write(`payload.value = newResult;`);
2264
2275
  doc.write(`return payload;`);
@@ -2296,33 +2307,16 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
2296
2307
  const shape = value.shape;
2297
2308
  for (const key of value.keys) {
2298
2309
  const el = shape[key];
2299
- // do not add omitted optional keys
2300
- // if (!(key in input)) {
2301
- // if (optionalKeys.has(key)) continue;
2302
- // payload.issues.push({
2303
- // code: "invalid_type",
2304
- // path: [key],
2305
- // expected: "nonoptional",
2306
- // note: `Missing required key: "${key}"`,
2307
- // input,
2308
- // inst,
2309
- // });
2310
- // }
2311
2310
  const r = el._zod.run({ value: input[key], issues: [] }, ctx);
2312
- const isOptional = el._zod.optin === "optional" && el._zod.optout === "optional";
2313
2311
  if (r instanceof Promise) {
2314
- proms.push(r.then((r) => isOptional ? handleOptionalObjectResult(r, payload, key, input) : handleObjectResult(r, payload, key)));
2315
- }
2316
- else if (isOptional) {
2317
- handleOptionalObjectResult(r, payload, key, input);
2312
+ proms.push(r.then((r) => handlePropertyResult(r, payload, key, input)));
2318
2313
  }
2319
2314
  else {
2320
- handleObjectResult(r, payload, key);
2315
+ handlePropertyResult(r, payload, key, input);
2321
2316
  }
2322
2317
  }
2323
2318
  }
2324
2319
  if (!catchall) {
2325
- // return payload;
2326
2320
  return proms.length ? Promise.all(proms).then(() => payload) : payload;
2327
2321
  }
2328
2322
  const unrecognized = [];
@@ -2339,10 +2333,10 @@ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def) => {
2339
2333
  }
2340
2334
  const r = _catchall.run({ value: input[key], issues: [] }, ctx);
2341
2335
  if (r instanceof Promise) {
2342
- proms.push(r.then((r) => handleObjectResult(r, payload, key)));
2336
+ proms.push(r.then((r) => handlePropertyResult(r, payload, key, input)));
2343
2337
  }
2344
2338
  else {
2345
- handleObjectResult(r, payload, key);
2339
+ handlePropertyResult(r, payload, key, input);
2346
2340
  }
2347
2341
  }
2348
2342
  if (unrecognized.length) {
@@ -2367,6 +2361,11 @@ function handleUnionResults(results, final, inst, ctx) {
2367
2361
  return final;
2368
2362
  }
2369
2363
  }
2364
+ const nonaborted = results.filter((r) => !aborted(r));
2365
+ if (nonaborted.length === 1) {
2366
+ final.value = nonaborted[0].value;
2367
+ return nonaborted[0];
2368
+ }
2370
2369
  final.issues.push({
2371
2370
  code: "invalid_union",
2372
2371
  input: final.value,
@@ -2392,7 +2391,12 @@ const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def) => {
2392
2391
  }
2393
2392
  return undefined;
2394
2393
  });
2394
+ const single = def.options.length === 1;
2395
+ const first = def.options[0]._zod.run;
2395
2396
  inst._zod.parse = (payload, ctx) => {
2397
+ if (single) {
2398
+ return first(payload, ctx);
2399
+ }
2396
2400
  let async = false;
2397
2401
  const results = [];
2398
2402
  for (const option of def.options) {
@@ -2477,6 +2481,7 @@ const $ZodDiscriminatedUnion =
2477
2481
  code: "invalid_union",
2478
2482
  errors: [],
2479
2483
  note: "No matching discriminator",
2484
+ discriminator: def.discriminator,
2480
2485
  input,
2481
2486
  path: [def.discriminator],
2482
2487
  inst,
@@ -2583,10 +2588,10 @@ const $ZodTuple = /*@__PURE__*/ (/* unused pure expression or super */ null && (
2583
2588
  const tooSmall = input.length < optStart - 1;
2584
2589
  if (tooBig || tooSmall) {
2585
2590
  payload.issues.push({
2591
+ ...(tooBig ? { code: "too_big", maximum: items.length } : { code: "too_small", minimum: items.length }),
2586
2592
  input,
2587
2593
  inst,
2588
2594
  origin: "array",
2589
- ...(tooBig ? { code: "too_big", maximum: items.length } : { code: "too_small", minimum: items.length }),
2590
2595
  });
2591
2596
  return payload;
2592
2597
  }
@@ -2698,8 +2703,8 @@ const $ZodRecord = /*@__PURE__*/ $constructor("$ZodRecord", (inst, def) => {
2698
2703
  }
2699
2704
  if (keyResult.issues.length) {
2700
2705
  payload.issues.push({
2701
- origin: "record",
2702
2706
  code: "invalid_key",
2707
+ origin: "record",
2703
2708
  issues: keyResult.issues.map((iss) => finalizeIssue(iss, ctx, config())),
2704
2709
  input: key,
2705
2710
  path: [key],
@@ -2770,8 +2775,8 @@ function handleMapResult(keyResult, valueResult, final, key, input, inst, ctx) {
2770
2775
  }
2771
2776
  else {
2772
2777
  final.issues.push({
2773
- origin: "map",
2774
2778
  code: "invalid_key",
2779
+ origin: "map",
2775
2780
  input,
2776
2781
  inst,
2777
2782
  issues: keyResult.issues.map((iss) => util.finalizeIssue(iss, ctx, core.config())),
@@ -2832,14 +2837,15 @@ function handleSetResult(result, final) {
2832
2837
  const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
2833
2838
  $ZodType.init(inst, def);
2834
2839
  const values = getEnumValues(def.entries);
2835
- inst._zod.values = new Set(values);
2840
+ const valuesSet = new Set(values);
2841
+ inst._zod.values = valuesSet;
2836
2842
  inst._zod.pattern = new RegExp(`^(${values
2837
2843
  .filter((k) => propertyKeyTypes.has(typeof k))
2838
2844
  .map((o) => (typeof o === "string" ? escapeRegex(o) : o.toString()))
2839
2845
  .join("|")})$`);
2840
2846
  inst._zod.parse = (payload, _ctx) => {
2841
2847
  const input = payload.value;
2842
- if (inst._zod.values.has(input)) {
2848
+ if (valuesSet.has(input)) {
2843
2849
  return payload;
2844
2850
  }
2845
2851
  payload.issues.push({
@@ -2853,9 +2859,12 @@ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def) => {
2853
2859
  });
2854
2860
  const $ZodLiteral = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("$ZodLiteral", (inst, def) => {
2855
2861
  $ZodType.init(inst, def);
2862
+ if (def.values.length === 0) {
2863
+ throw new Error("Cannot create literal schema with no valid values");
2864
+ }
2856
2865
  inst._zod.values = new Set(def.values);
2857
2866
  inst._zod.pattern = new RegExp(`^(${def.values
2858
- .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o ? o.toString() : String(o)))
2867
+ .map((o) => (typeof o === "string" ? util.escapeRegex(o) : o ? util.escapeRegex(o.toString()) : String(o)))
2859
2868
  .join("|")})$`);
2860
2869
  inst._zod.parse = (payload, _ctx) => {
2861
2870
  const input = payload.value;
@@ -2875,6 +2884,7 @@ const $ZodFile = /*@__PURE__*/ (/* unused pure expression or super */ null && (c
2875
2884
  $ZodType.init(inst, def);
2876
2885
  inst._zod.parse = (payload, _ctx) => {
2877
2886
  const input = payload.value;
2887
+ // @ts-ignore
2878
2888
  if (input instanceof File)
2879
2889
  return payload;
2880
2890
  payload.issues.push({
@@ -2904,6 +2914,12 @@ const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def) =>
2904
2914
  return payload;
2905
2915
  };
2906
2916
  });
2917
+ function handleOptionalResult(result, input) {
2918
+ if (result.issues.length && input === undefined) {
2919
+ return { issues: [], value: undefined };
2920
+ }
2921
+ return result;
2922
+ }
2907
2923
  const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
2908
2924
  $ZodType.init(inst, def);
2909
2925
  inst._zod.optin = "optional";
@@ -2917,7 +2933,10 @@ const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def) => {
2917
2933
  });
2918
2934
  inst._zod.parse = (payload, ctx) => {
2919
2935
  if (def.innerType._zod.optin === "optional") {
2920
- return def.innerType._zod.run(payload, ctx);
2936
+ const result = def.innerType._zod.run(payload, ctx);
2937
+ if (result instanceof Promise)
2938
+ return result.then((r) => handleOptionalResult(r, payload.value));
2939
+ return handleOptionalResult(result, payload.value);
2921
2940
  }
2922
2941
  if (payload.value === undefined) {
2923
2942
  return payload;
@@ -3020,7 +3039,7 @@ const $ZodSuccess = /*@__PURE__*/ (/* unused pure expression or super */ null &&
3020
3039
  })));
3021
3040
  const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def) => {
3022
3041
  $ZodType.init(inst, def);
3023
- inst._zod.optin = "optional";
3042
+ defineLazy(inst._zod, "optin", () => def.innerType._zod.optin);
3024
3043
  defineLazy(inst._zod, "optout", () => def.innerType._zod.optout);
3025
3044
  defineLazy(inst._zod, "values", () => def.innerType._zod.values);
3026
3045
  inst._zod.parse = (payload, ctx) => {
@@ -3085,7 +3104,7 @@ const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def) => {
3085
3104
  };
3086
3105
  });
3087
3106
  function handlePipeResult(left, def, ctx) {
3088
- if (aborted(left)) {
3107
+ if (left.issues.length) {
3089
3108
  return left;
3090
3109
  }
3091
3110
  return def.out._zod.run({ value: left.value, issues: left.issues }, ctx);
@@ -3112,7 +3131,8 @@ const $ZodTemplateLiteral = /*@__PURE__*/ (/* unused pure expression or super */
3112
3131
  $ZodType.init(inst, def);
3113
3132
  const regexParts = [];
3114
3133
  for (const part of def.parts) {
3115
- if (part instanceof $ZodType) {
3134
+ if (typeof part === "object" && part !== null) {
3135
+ // is Zod schema
3116
3136
  if (!part._zod.pattern) {
3117
3137
  // if (!source)
3118
3138
  throw new Error(`Invalid template literal part, no pattern found: ${[...part._zod.traits].shift()}`);
@@ -3164,11 +3184,18 @@ const $ZodPromise = /*@__PURE__*/ (/* unused pure expression or super */ null &&
3164
3184
  })));
3165
3185
  const $ZodLazy = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("$ZodLazy", (inst, def) => {
3166
3186
  $ZodType.init(inst, def);
3187
+ // let _innerType!: any;
3188
+ // util.defineLazy(def, "getter", () => {
3189
+ // if (!_innerType) {
3190
+ // _innerType = def.getter();
3191
+ // }
3192
+ // return () => _innerType;
3193
+ // });
3167
3194
  util.defineLazy(inst._zod, "innerType", () => def.getter());
3168
3195
  util.defineLazy(inst._zod, "pattern", () => inst._zod.innerType._zod.pattern);
3169
3196
  util.defineLazy(inst._zod, "propValues", () => inst._zod.innerType._zod.propValues);
3170
- util.defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin);
3171
- util.defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout);
3197
+ util.defineLazy(inst._zod, "optin", () => inst._zod.innerType._zod.optin ?? undefined);
3198
+ util.defineLazy(inst._zod, "optout", () => inst._zod.innerType._zod.optout ?? undefined);
3172
3199
  inst._zod.parse = (payload, ctx) => {
3173
3200
  const inner = inst._zod.innerType;
3174
3201
  return inner._zod.run(payload, ctx);
@@ -3245,7 +3272,8 @@ class $ZodRegistry {
3245
3272
  if (p) {
3246
3273
  const pm = { ...(this.get(p) ?? {}) };
3247
3274
  delete pm.id; // do not inherit id
3248
- return { ...pm, ...this._map.get(schema) };
3275
+ const f = { ...pm, ...this._map.get(schema) };
3276
+ return Object.keys(f).length ? f : undefined;
3249
3277
  }
3250
3278
  return this._map.get(schema);
3251
3279
  }
@@ -4005,7 +4033,7 @@ function _default(Class, innerType, defaultValue) {
4005
4033
  type: "default",
4006
4034
  innerType,
4007
4035
  get defaultValue() {
4008
- return typeof defaultValue === "function" ? defaultValue() : defaultValue;
4036
+ return typeof defaultValue === "function" ? defaultValue() : util.shallowClone(defaultValue);
4009
4037
  },
4010
4038
  });
4011
4039
  }
@@ -4072,13 +4100,6 @@ function _custom(Class, fn, _params) {
4072
4100
  });
4073
4101
  return schema;
4074
4102
  }
4075
- // export function _refine<T>(
4076
- // Class: util.SchemaClass<schemas.$ZodCustom>,
4077
- // fn: (arg: NoInfer<T>) => util.MaybeAsync<unknown>,
4078
- // _params: string | $ZodCustomParams = {}
4079
- // ): checks.$ZodCheck<T> {
4080
- // return _custom(Class, fn, _params);
4081
- // }
4082
4103
  // same as _custom but defaults to abort:false
4083
4104
  function _refine(Class, fn, _params) {
4084
4105
  const schema = new Class({
@@ -4089,6 +4110,36 @@ function _refine(Class, fn, _params) {
4089
4110
  });
4090
4111
  return schema;
4091
4112
  }
4113
+ function _superRefine(fn) {
4114
+ const ch = _check((payload) => {
4115
+ payload.addIssue = (issue) => {
4116
+ if (typeof issue === "string") {
4117
+ payload.issues.push(util_issue(issue, payload.value, ch._zod.def));
4118
+ }
4119
+ else {
4120
+ // for Zod 3 backwards compatibility
4121
+ const _issue = issue;
4122
+ if (_issue.fatal)
4123
+ _issue.continue = false;
4124
+ _issue.code ?? (_issue.code = "custom");
4125
+ _issue.input ?? (_issue.input = payload.value);
4126
+ _issue.inst ?? (_issue.inst = ch);
4127
+ _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
4128
+ payload.issues.push(util_issue(_issue));
4129
+ }
4130
+ };
4131
+ return fn(payload.value, payload);
4132
+ });
4133
+ return ch;
4134
+ }
4135
+ function _check(fn, params) {
4136
+ const ch = new $ZodCheck({
4137
+ check: "custom",
4138
+ ...normalizeParams(params),
4139
+ });
4140
+ ch._zod.check = fn;
4141
+ return ch;
4142
+ }
4092
4143
  function _stringbool(Classes, _params) {
4093
4144
  const params = util.normalizeParams(_params);
4094
4145
  let truthyArray = params.truthy ?? ["true", "1", "yes", "on", "y", "enabled"];
@@ -4122,6 +4173,7 @@ function _stringbool(Classes, _params) {
4122
4173
  values: [...truthySet, ...falsySet],
4123
4174
  input: payload.value,
4124
4175
  inst: tx,
4176
+ continue: false,
4125
4177
  });
4126
4178
  return {};
4127
4179
  }
@@ -4166,6 +4218,7 @@ function _stringFormat(Class, format, fnOrRegex, _params = {}) {
4166
4218
  ;// CONCATENATED MODULE: ./node_modules/zod/v4/classic/errors.js
4167
4219
 
4168
4220
 
4221
+
4169
4222
  const errors_initializer = (inst, issues) => {
4170
4223
  $ZodError.init(inst, issues);
4171
4224
  inst.name = "ZodError";
@@ -4179,11 +4232,17 @@ const errors_initializer = (inst, issues) => {
4179
4232
  // enumerable: false,
4180
4233
  },
4181
4234
  addIssue: {
4182
- value: (issue) => inst.issues.push(issue),
4235
+ value: (issue) => {
4236
+ inst.issues.push(issue);
4237
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
4238
+ },
4183
4239
  // enumerable: false,
4184
4240
  },
4185
4241
  addIssues: {
4186
- value: (issues) => inst.issues.push(...issues),
4242
+ value: (issues) => {
4243
+ inst.issues.push(...issues);
4244
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
4245
+ },
4187
4246
  // enumerable: false,
4188
4247
  },
4189
4248
  isEmpty: {
@@ -4525,6 +4584,9 @@ const ZodCustomStringFormat = /*@__PURE__*/ (/* unused pure expression or super
4525
4584
  function stringFormat(format, fnOrRegex, _params = {}) {
4526
4585
  return core._stringFormat(ZodCustomStringFormat, format, fnOrRegex, _params);
4527
4586
  }
4587
+ function hostname(_params) {
4588
+ return core._stringFormat(ZodCustomStringFormat, "hostname", core.regexes.hostname, _params);
4589
+ }
4528
4590
  const ZodNumber = /*@__PURE__*/ (/* unused pure expression or super */ null && (core.$constructor("ZodNumber", (inst, def) => {
4529
4591
  core.$ZodNumber.init(inst, def);
4530
4592
  ZodType.init(inst, def);
@@ -4698,7 +4760,7 @@ function array(element, params) {
4698
4760
  // .keyof
4699
4761
  function keyof(schema) {
4700
4762
  const shape = schema._zod.def.shape;
4701
- return literal(Object.keys(shape));
4763
+ return schemas_enum(Object.keys(shape));
4702
4764
  }
4703
4765
  const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
4704
4766
  $ZodObject.init(inst, def);
@@ -4707,7 +4769,6 @@ const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def) => {
4707
4769
  inst.keyof = () => schemas_enum(Object.keys(inst._zod.def.shape));
4708
4770
  inst.catchall = (catchall) => inst.clone({ ...inst._zod.def, catchall: catchall });
4709
4771
  inst.passthrough = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
4710
- // inst.nonstrict = () => inst.clone({ ...inst._zod.def, catchall: api.unknown() });
4711
4772
  inst.loose = () => inst.clone({ ...inst._zod.def, catchall: unknown() });
4712
4773
  inst.strict = () => inst.clone({ ...inst._zod.def, catchall: never() });
4713
4774
  inst.strip = () => inst.clone({ ...inst._zod.def, catchall: undefined });
@@ -4724,7 +4785,7 @@ function object(shape, params) {
4724
4785
  const def = {
4725
4786
  type: "object",
4726
4787
  get shape() {
4727
- assignProp(this, "shape", { ...shape });
4788
+ assignProp(this, "shape", shape ? objectClone(shape) : {});
4728
4789
  return this.shape;
4729
4790
  },
4730
4791
  ...normalizeParams(params),
@@ -4736,7 +4797,7 @@ function strictObject(shape, params) {
4736
4797
  return new ZodObject({
4737
4798
  type: "object",
4738
4799
  get shape() {
4739
- util.assignProp(this, "shape", { ...shape });
4800
+ util.assignProp(this, "shape", util.objectClone(shape));
4740
4801
  return this.shape;
4741
4802
  },
4742
4803
  catchall: never(),
@@ -4748,7 +4809,7 @@ function looseObject(shape, params) {
4748
4809
  return new ZodObject({
4749
4810
  type: "object",
4750
4811
  get shape() {
4751
- util.assignProp(this, "shape", { ...shape });
4812
+ util.assignProp(this, "shape", util.objectClone(shape));
4752
4813
  return this.shape;
4753
4814
  },
4754
4815
  catchall: unknown(),
@@ -4826,9 +4887,11 @@ function record(keyType, valueType, params) {
4826
4887
  }
4827
4888
  // type alksjf = core.output<core.$ZodRecordKey>;
4828
4889
  function partialRecord(keyType, valueType, params) {
4890
+ const k = core.clone(keyType);
4891
+ k._zod.values = undefined;
4829
4892
  return new ZodRecord({
4830
4893
  type: "record",
4831
- keyType: union([keyType, never()]),
4894
+ keyType: k,
4832
4895
  valueType: valueType,
4833
4896
  ...util.normalizeParams(params),
4834
4897
  });
@@ -4970,7 +5033,7 @@ const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def) => {
4970
5033
  _issue.code ?? (_issue.code = "custom");
4971
5034
  _issue.input ?? (_issue.input = payload.value);
4972
5035
  _issue.inst ?? (_issue.inst = inst);
4973
- _issue.continue ?? (_issue.continue = true);
5036
+ // _issue.continue ??= true;
4974
5037
  payload.issues.push(util_issue(_issue));
4975
5038
  }
4976
5039
  };
@@ -5028,7 +5091,7 @@ function schemas_default(innerType, defaultValue) {
5028
5091
  type: "default",
5029
5092
  innerType: innerType,
5030
5093
  get defaultValue() {
5031
- return typeof defaultValue === "function" ? defaultValue() : defaultValue;
5094
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
5032
5095
  },
5033
5096
  });
5034
5097
  }
@@ -5042,7 +5105,7 @@ function prefault(innerType, defaultValue) {
5042
5105
  type: "prefault",
5043
5106
  innerType: innerType,
5044
5107
  get defaultValue() {
5045
- return typeof defaultValue === "function" ? defaultValue() : defaultValue;
5108
+ return typeof defaultValue === "function" ? defaultValue() : shallowClone(defaultValue);
5046
5109
  },
5047
5110
  });
5048
5111
  }
@@ -5107,6 +5170,7 @@ function pipe(in_, out) {
5107
5170
  const ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def) => {
5108
5171
  $ZodReadonly.init(inst, def);
5109
5172
  ZodType.init(inst, def);
5173
+ inst.unwrap = () => inst._zod.def.innerType;
5110
5174
  });
5111
5175
  function readonly(innerType) {
5112
5176
  return new ZodReadonly({
@@ -5153,7 +5217,7 @@ const ZodCustom = /*@__PURE__*/ $constructor("ZodCustom", (inst, def) => {
5153
5217
  });
5154
5218
  // custom checks
5155
5219
  function check(fn) {
5156
- const ch = new $ZodCheck({
5220
+ const ch = new core.$ZodCheck({
5157
5221
  check: "custom",
5158
5222
  // ...util.normalizeParams(params),
5159
5223
  });
@@ -5168,26 +5232,7 @@ function refine(fn, _params = {}) {
5168
5232
  }
5169
5233
  // superRefine
5170
5234
  function superRefine(fn) {
5171
- const ch = check((payload) => {
5172
- payload.addIssue = (issue) => {
5173
- if (typeof issue === "string") {
5174
- payload.issues.push(util_issue(issue, payload.value, ch._zod.def));
5175
- }
5176
- else {
5177
- // for Zod 3 backwards compatibility
5178
- const _issue = issue;
5179
- if (_issue.fatal)
5180
- _issue.continue = false;
5181
- _issue.code ?? (_issue.code = "custom");
5182
- _issue.input ?? (_issue.input = payload.value);
5183
- _issue.inst ?? (_issue.inst = ch);
5184
- _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
5185
- payload.issues.push(util_issue(_issue));
5186
- }
5187
- };
5188
- return fn(payload.value, payload);
5189
- });
5190
- return ch;
5235
+ return _superRefine(fn);
5191
5236
  }
5192
5237
  function _instanceof(cls, params = {
5193
5238
  error: `Input not instance of ${cls.name}`,