@iflyrpa/share 0.0.15-beta.0 → 0.0.15-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -39,17 +39,25 @@ var __webpack_require__ = {};
39
39
  var __webpack_exports__ = {};
40
40
  __webpack_require__.r(__webpack_exports__);
41
41
  __webpack_require__.d(__webpack_exports__, {
42
- getFilenameFromUrl: ()=>getFilenameFromUrl,
42
+ CDPSourceScheme: ()=>CDPSourceScheme,
43
43
  semver: ()=>semver,
44
44
  pathExists: ()=>pathExists,
45
- success: ()=>success,
45
+ CookieSchema: ()=>CookieSchema,
46
+ CDPCookiePriority: ()=>CDPCookiePriority,
46
47
  randomString: ()=>randomString,
47
48
  ensureFile: ()=>ensureFile,
49
+ fetchJSON: ()=>fetchJSON,
50
+ sleep: ()=>sleep,
51
+ getFilenameFromUrl: ()=>getFilenameFromUrl,
52
+ CDPCookieSchema: ()=>CDPCookieSchema,
53
+ success: ()=>success,
54
+ TaskState: ()=>types_TaskState,
55
+ CDPSameSite: ()=>CDPSameSite,
48
56
  ensureFileSync: ()=>ensureFileSync,
49
57
  isNil: ()=>isNil,
58
+ CookieBaseSchema: ()=>CookieBaseSchema,
50
59
  downloadImage: ()=>downloadImage,
51
- fetchJSON: ()=>fetchJSON,
52
- sleep: ()=>sleep,
60
+ response: ()=>utils_response,
53
61
  writeFile: ()=>writeFile
54
62
  });
55
63
  const external_node_fs_namespaceObject = require("node:fs");
@@ -235,17 +243,17 @@ async function downloadImage(url, savePath) {
235
243
  default:
236
244
  break;
237
245
  }
238
- customMessage.message = "请求图片时" + customMessage.message;
246
+ customMessage.message = `请求图片时${customMessage.message}`;
239
247
  customMessage.extra = {
240
248
  url
241
249
  };
242
250
  reject(customMessage);
243
251
  };
244
- const req = external_node_https_default().get(url, handleResponse);
252
+ const req = external_node_https_default().get(decodeURIComponent(url), handleResponse);
245
253
  req.setTimeout(10000, ()=>{
246
254
  req.destroy();
247
255
  reject({
248
- code: 200,
256
+ code: 500,
249
257
  message: "图片下载超时,请检查网络连接或稍后重试!"
250
258
  });
251
259
  });
@@ -254,7 +262,9 @@ async function downloadImage(url, savePath) {
254
262
  }
255
263
  function getFilenameFromUrl(imageUrl) {
256
264
  const parsedUrl = new URL(imageUrl);
257
- return external_node_path_default().basename(parsedUrl.pathname);
265
+ const fileName = external_node_path_default().basename(parsedUrl.pathname);
266
+ const ext = external_node_path_default().extname(fileName);
267
+ return ext ? fileName : `${fileName}.png`;
258
268
  }
259
269
  const sleep = (ms)=>new Promise((resolve)=>setTimeout(resolve, ms));
260
270
  const success = (data, message)=>({
@@ -262,12 +272,3404 @@ const success = (data, message)=>({
262
272
  message: message || "发布成功",
263
273
  data
264
274
  });
275
+ const utils_response = (code, message, data)=>({
276
+ code,
277
+ message: message || "操作成功",
278
+ data
279
+ });
265
280
  const randomString = (length)=>{
266
281
  let T = "";
267
282
  const H = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
268
283
  for(let de = 0; de < length; de++)T += H.charAt(Math.floor(Math.random() * H.length));
269
284
  return T;
270
285
  };
286
+ Object.freeze({
287
+ status: "aborted"
288
+ });
289
+ function $constructor(name, initializer, params) {
290
+ function init(inst, def) {
291
+ var _a;
292
+ Object.defineProperty(inst, "_zod", {
293
+ value: inst._zod ?? {},
294
+ enumerable: false
295
+ });
296
+ (_a = inst._zod).traits ?? (_a.traits = new Set());
297
+ inst._zod.traits.add(name);
298
+ initializer(inst, def);
299
+ for(const k in _.prototype)if (!(k in inst)) Object.defineProperty(inst, k, {
300
+ value: _.prototype[k].bind(inst)
301
+ });
302
+ inst._zod.constr = _;
303
+ inst._zod.def = def;
304
+ }
305
+ const Parent = params?.Parent ?? Object;
306
+ class Definition extends Parent {
307
+ }
308
+ Object.defineProperty(Definition, "name", {
309
+ value: name
310
+ });
311
+ function _(def) {
312
+ var _a;
313
+ const inst = params?.Parent ? new Definition() : this;
314
+ init(inst, def);
315
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
316
+ for (const fn of inst._zod.deferred)fn();
317
+ return inst;
318
+ }
319
+ Object.defineProperty(_, "init", {
320
+ value: init
321
+ });
322
+ Object.defineProperty(_, Symbol.hasInstance, {
323
+ value: (inst)=>{
324
+ if (params?.Parent && inst instanceof params.Parent) return true;
325
+ return inst?._zod?.traits?.has(name);
326
+ }
327
+ });
328
+ Object.defineProperty(_, "name", {
329
+ value: name
330
+ });
331
+ return _;
332
+ }
333
+ Symbol("zod_brand");
334
+ class $ZodAsyncError extends Error {
335
+ constructor(){
336
+ super("Encountered Promise during synchronous parse. Use .parseAsync() instead.");
337
+ }
338
+ }
339
+ class $ZodEncodeError extends Error {
340
+ constructor(name){
341
+ super(`Encountered unidirectional transform during encode: ${name}`);
342
+ this.name = "ZodEncodeError";
343
+ }
344
+ }
345
+ const globalConfig = {};
346
+ function core_config(newConfig) {
347
+ if (newConfig) Object.assign(globalConfig, newConfig);
348
+ return globalConfig;
349
+ }
350
+ function util_getEnumValues(entries) {
351
+ const numericValues = Object.values(entries).filter((v)=>"number" == typeof v);
352
+ const values = Object.entries(entries).filter(([k, _])=>-1 === numericValues.indexOf(+k)).map(([_, v])=>v);
353
+ return values;
354
+ }
355
+ function joinValues(array, separator = "|") {
356
+ return array.map((val)=>stringifyPrimitive(val)).join(separator);
357
+ }
358
+ function jsonStringifyReplacer(_, value) {
359
+ if ("bigint" == typeof value) return value.toString();
360
+ return value;
361
+ }
362
+ function cached(getter) {
363
+ const set = false;
364
+ return {
365
+ get value () {
366
+ if (!set) {
367
+ const value = getter();
368
+ Object.defineProperty(this, "value", {
369
+ value
370
+ });
371
+ return value;
372
+ }
373
+ throw new Error("cached value already set");
374
+ }
375
+ };
376
+ }
377
+ function nullish(input) {
378
+ return null == input;
379
+ }
380
+ function cleanRegex(source) {
381
+ const start = source.startsWith("^") ? 1 : 0;
382
+ const end = source.endsWith("$") ? source.length - 1 : source.length;
383
+ return source.slice(start, end);
384
+ }
385
+ function floatSafeRemainder(val, step) {
386
+ const valDecCount = (val.toString().split(".")[1] || "").length;
387
+ const stepString = step.toString();
388
+ let stepDecCount = (stepString.split(".")[1] || "").length;
389
+ if (0 === stepDecCount && /\d?e-\d?/.test(stepString)) {
390
+ const match = stepString.match(/\d?e-(\d?)/);
391
+ if (match?.[1]) stepDecCount = Number.parseInt(match[1]);
392
+ }
393
+ const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
394
+ const valInt = Number.parseInt(val.toFixed(decCount).replace(".", ""));
395
+ const stepInt = Number.parseInt(step.toFixed(decCount).replace(".", ""));
396
+ return valInt % stepInt / 10 ** decCount;
397
+ }
398
+ const EVALUATING = Symbol("evaluating");
399
+ function defineLazy(object, key, getter) {
400
+ let value;
401
+ Object.defineProperty(object, key, {
402
+ get () {
403
+ if (value === EVALUATING) return;
404
+ if (void 0 === value) {
405
+ value = EVALUATING;
406
+ value = getter();
407
+ }
408
+ return value;
409
+ },
410
+ set (v) {
411
+ Object.defineProperty(object, key, {
412
+ value: v
413
+ });
414
+ },
415
+ configurable: true
416
+ });
417
+ }
418
+ function assignProp(target, prop, value) {
419
+ Object.defineProperty(target, prop, {
420
+ value,
421
+ writable: true,
422
+ enumerable: true,
423
+ configurable: true
424
+ });
425
+ }
426
+ function mergeDefs(...defs) {
427
+ const mergedDescriptors = {};
428
+ for (const def of defs){
429
+ const descriptors = Object.getOwnPropertyDescriptors(def);
430
+ Object.assign(mergedDescriptors, descriptors);
431
+ }
432
+ return Object.defineProperties({}, mergedDescriptors);
433
+ }
434
+ function esc(str) {
435
+ return JSON.stringify(str);
436
+ }
437
+ const captureStackTrace = "captureStackTrace" in Error ? Error.captureStackTrace : (..._args)=>{};
438
+ function util_isObject(data) {
439
+ return "object" == typeof data && null !== data && !Array.isArray(data);
440
+ }
441
+ const util_allowsEval = cached(()=>{
442
+ if ("undefined" != typeof navigator && navigator?.userAgent?.includes("Cloudflare")) return false;
443
+ try {
444
+ const F = Function;
445
+ new F("");
446
+ return true;
447
+ } catch (_) {
448
+ return false;
449
+ }
450
+ });
451
+ function isPlainObject(o) {
452
+ if (false === util_isObject(o)) return false;
453
+ const ctor = o.constructor;
454
+ if (void 0 === ctor) return true;
455
+ const prot = ctor.prototype;
456
+ if (false === util_isObject(prot)) return false;
457
+ if (false === Object.prototype.hasOwnProperty.call(prot, "isPrototypeOf")) return false;
458
+ return true;
459
+ }
460
+ function shallowClone(o) {
461
+ if (isPlainObject(o)) return {
462
+ ...o
463
+ };
464
+ if (Array.isArray(o)) return [
465
+ ...o
466
+ ];
467
+ return o;
468
+ }
469
+ const propertyKeyTypes = new Set([
470
+ "string",
471
+ "number",
472
+ "symbol"
473
+ ]);
474
+ new Set([
475
+ "string",
476
+ "number",
477
+ "bigint",
478
+ "boolean",
479
+ "symbol",
480
+ "undefined"
481
+ ]);
482
+ function escapeRegex(str) {
483
+ return str.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
484
+ }
485
+ function clone(inst, def, params) {
486
+ const cl = new inst._zod.constr(def ?? inst._zod.def);
487
+ if (!def || params?.parent) cl._zod.parent = inst;
488
+ return cl;
489
+ }
490
+ function normalizeParams(_params) {
491
+ const params = _params;
492
+ if (!params) return {};
493
+ if ("string" == typeof params) return {
494
+ error: ()=>params
495
+ };
496
+ if (params?.message !== void 0) {
497
+ if (params?.error !== void 0) throw new Error("Cannot specify both `message` and `error` params");
498
+ params.error = params.message;
499
+ }
500
+ delete params.message;
501
+ if ("string" == typeof params.error) return {
502
+ ...params,
503
+ error: ()=>params.error
504
+ };
505
+ return params;
506
+ }
507
+ function stringifyPrimitive(value) {
508
+ if ("bigint" == typeof value) return value.toString() + "n";
509
+ if ("string" == typeof value) return `"${value}"`;
510
+ return `${value}`;
511
+ }
512
+ function optionalKeys(shape) {
513
+ return Object.keys(shape).filter((k)=>"optional" === shape[k]._zod.optin && "optional" === shape[k]._zod.optout);
514
+ }
515
+ const NUMBER_FORMAT_RANGES = {
516
+ safeint: [
517
+ Number.MIN_SAFE_INTEGER,
518
+ Number.MAX_SAFE_INTEGER
519
+ ],
520
+ int32: [
521
+ -2147483648,
522
+ 2147483647
523
+ ],
524
+ uint32: [
525
+ 0,
526
+ 4294967295
527
+ ],
528
+ float32: [
529
+ -340282346638528860000000000000000000000,
530
+ 3.4028234663852886e38
531
+ ],
532
+ float64: [
533
+ -Number.MAX_VALUE,
534
+ Number.MAX_VALUE
535
+ ]
536
+ };
537
+ function pick(schema, mask) {
538
+ const currDef = schema._zod.def;
539
+ const def = mergeDefs(schema._zod.def, {
540
+ get shape () {
541
+ const newShape = {};
542
+ for(const key in mask){
543
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
544
+ if (!!mask[key]) newShape[key] = currDef.shape[key];
545
+ }
546
+ assignProp(this, "shape", newShape);
547
+ return newShape;
548
+ },
549
+ checks: []
550
+ });
551
+ return clone(schema, def);
552
+ }
553
+ function omit(schema, mask) {
554
+ const currDef = schema._zod.def;
555
+ const def = mergeDefs(schema._zod.def, {
556
+ get shape () {
557
+ const newShape = {
558
+ ...schema._zod.def.shape
559
+ };
560
+ for(const key in mask){
561
+ if (!(key in currDef.shape)) throw new Error(`Unrecognized key: "${key}"`);
562
+ if (!!mask[key]) delete newShape[key];
563
+ }
564
+ assignProp(this, "shape", newShape);
565
+ return newShape;
566
+ },
567
+ checks: []
568
+ });
569
+ return clone(schema, def);
570
+ }
571
+ function extend(schema, shape) {
572
+ if (!isPlainObject(shape)) throw new Error("Invalid input to extend: expected a plain object");
573
+ const checks = schema._zod.def.checks;
574
+ const hasChecks = checks && checks.length > 0;
575
+ if (hasChecks) throw new Error("Object schemas containing refinements cannot be extended. Use `.safeExtend()` instead.");
576
+ const def = mergeDefs(schema._zod.def, {
577
+ get shape () {
578
+ const _shape = {
579
+ ...schema._zod.def.shape,
580
+ ...shape
581
+ };
582
+ assignProp(this, "shape", _shape);
583
+ return _shape;
584
+ },
585
+ checks: []
586
+ });
587
+ return clone(schema, def);
588
+ }
589
+ function safeExtend(schema, shape) {
590
+ if (!isPlainObject(shape)) throw new Error("Invalid input to safeExtend: expected a plain object");
591
+ const def = {
592
+ ...schema._zod.def,
593
+ get shape () {
594
+ const _shape = {
595
+ ...schema._zod.def.shape,
596
+ ...shape
597
+ };
598
+ assignProp(this, "shape", _shape);
599
+ return _shape;
600
+ },
601
+ checks: schema._zod.def.checks
602
+ };
603
+ return clone(schema, def);
604
+ }
605
+ function merge(a, b) {
606
+ const def = mergeDefs(a._zod.def, {
607
+ get shape () {
608
+ const _shape = {
609
+ ...a._zod.def.shape,
610
+ ...b._zod.def.shape
611
+ };
612
+ assignProp(this, "shape", _shape);
613
+ return _shape;
614
+ },
615
+ get catchall () {
616
+ return b._zod.def.catchall;
617
+ },
618
+ checks: []
619
+ });
620
+ return clone(a, def);
621
+ }
622
+ function partial(Class, schema, mask) {
623
+ const def = mergeDefs(schema._zod.def, {
624
+ get shape () {
625
+ const oldShape = schema._zod.def.shape;
626
+ const shape = {
627
+ ...oldShape
628
+ };
629
+ if (mask) for(const key in mask){
630
+ if (!(key in oldShape)) throw new Error(`Unrecognized key: "${key}"`);
631
+ if (!!mask[key]) shape[key] = Class ? new Class({
632
+ type: "optional",
633
+ innerType: oldShape[key]
634
+ }) : oldShape[key];
635
+ }
636
+ else for(const key in oldShape)shape[key] = Class ? new Class({
637
+ type: "optional",
638
+ innerType: oldShape[key]
639
+ }) : oldShape[key];
640
+ assignProp(this, "shape", shape);
641
+ return shape;
642
+ },
643
+ checks: []
644
+ });
645
+ return clone(schema, def);
646
+ }
647
+ function required(Class, schema, mask) {
648
+ const def = mergeDefs(schema._zod.def, {
649
+ get shape () {
650
+ const oldShape = schema._zod.def.shape;
651
+ const shape = {
652
+ ...oldShape
653
+ };
654
+ if (mask) for(const key in mask){
655
+ if (!(key in shape)) throw new Error(`Unrecognized key: "${key}"`);
656
+ if (!!mask[key]) shape[key] = new Class({
657
+ type: "nonoptional",
658
+ innerType: oldShape[key]
659
+ });
660
+ }
661
+ else for(const key in oldShape)shape[key] = new Class({
662
+ type: "nonoptional",
663
+ innerType: oldShape[key]
664
+ });
665
+ assignProp(this, "shape", shape);
666
+ return shape;
667
+ },
668
+ checks: []
669
+ });
670
+ return clone(schema, def);
671
+ }
672
+ function aborted(x, startIndex = 0) {
673
+ if (true === x.aborted) return true;
674
+ for(let i = startIndex; i < x.issues.length; i++)if (x.issues[i]?.continue !== true) return true;
675
+ return false;
676
+ }
677
+ function prefixIssues(path, issues) {
678
+ return issues.map((iss)=>{
679
+ var _a;
680
+ (_a = iss).path ?? (_a.path = []);
681
+ iss.path.unshift(path);
682
+ return iss;
683
+ });
684
+ }
685
+ function unwrapMessage(message) {
686
+ return "string" == typeof message ? message : message?.message;
687
+ }
688
+ function finalizeIssue(iss, ctx, config) {
689
+ const full = {
690
+ ...iss,
691
+ path: iss.path ?? []
692
+ };
693
+ if (!iss.message) {
694
+ const message = unwrapMessage(iss.inst?._zod.def?.error?.(iss)) ?? unwrapMessage(ctx?.error?.(iss)) ?? unwrapMessage(config.customError?.(iss)) ?? unwrapMessage(config.localeError?.(iss)) ?? "Invalid input";
695
+ full.message = message;
696
+ }
697
+ delete full.inst;
698
+ delete full.continue;
699
+ if (!ctx?.reportInput) delete full.input;
700
+ return full;
701
+ }
702
+ function getLengthableOrigin(input) {
703
+ if (Array.isArray(input)) return "array";
704
+ if ("string" == typeof input) return "string";
705
+ return "unknown";
706
+ }
707
+ function util_issue(...args) {
708
+ const [iss, input, inst] = args;
709
+ if ("string" == typeof iss) return {
710
+ message: iss,
711
+ code: "custom",
712
+ input,
713
+ inst
714
+ };
715
+ return {
716
+ ...iss
717
+ };
718
+ }
719
+ const errors_initializer = (inst, def)=>{
720
+ inst.name = "$ZodError";
721
+ Object.defineProperty(inst, "_zod", {
722
+ value: inst._zod,
723
+ enumerable: false
724
+ });
725
+ Object.defineProperty(inst, "issues", {
726
+ value: def,
727
+ enumerable: false
728
+ });
729
+ inst.message = JSON.stringify(def, jsonStringifyReplacer, 2);
730
+ Object.defineProperty(inst, "toString", {
731
+ value: ()=>inst.message,
732
+ enumerable: false
733
+ });
734
+ };
735
+ const $ZodError = $constructor("$ZodError", errors_initializer);
736
+ const $ZodRealError = $constructor("$ZodError", errors_initializer, {
737
+ Parent: Error
738
+ });
739
+ function flattenError(error, mapper = (issue)=>issue.message) {
740
+ const fieldErrors = {};
741
+ const formErrors = [];
742
+ for (const sub of error.issues)if (sub.path.length > 0) {
743
+ fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
744
+ fieldErrors[sub.path[0]].push(mapper(sub));
745
+ } else formErrors.push(mapper(sub));
746
+ return {
747
+ formErrors,
748
+ fieldErrors
749
+ };
750
+ }
751
+ function formatError(error, mapper = (issue)=>issue.message) {
752
+ const fieldErrors = {
753
+ _errors: []
754
+ };
755
+ const processError = (error)=>{
756
+ for (const issue of error.issues)if ("invalid_union" === issue.code && issue.errors.length) issue.errors.map((issues)=>processError({
757
+ issues
758
+ }));
759
+ else if ("invalid_key" === issue.code) processError({
760
+ issues: issue.issues
761
+ });
762
+ else if ("invalid_element" === issue.code) processError({
763
+ issues: issue.issues
764
+ });
765
+ else if (0 === issue.path.length) fieldErrors._errors.push(mapper(issue));
766
+ else {
767
+ let curr = fieldErrors;
768
+ let i = 0;
769
+ while(i < issue.path.length){
770
+ const el = issue.path[i];
771
+ const terminal = i === issue.path.length - 1;
772
+ if (terminal) {
773
+ curr[el] = curr[el] || {
774
+ _errors: []
775
+ };
776
+ curr[el]._errors.push(mapper(issue));
777
+ } else curr[el] = curr[el] || {
778
+ _errors: []
779
+ };
780
+ curr = curr[el];
781
+ i++;
782
+ }
783
+ }
784
+ };
785
+ processError(error);
786
+ return fieldErrors;
787
+ }
788
+ const _parse = (_Err)=>(schema, value, _ctx, _params)=>{
789
+ const ctx = _ctx ? Object.assign(_ctx, {
790
+ async: false
791
+ }) : {
792
+ async: false
793
+ };
794
+ const result = schema._zod.run({
795
+ value,
796
+ issues: []
797
+ }, ctx);
798
+ if (result instanceof Promise) throw new $ZodAsyncError();
799
+ if (result.issues.length) {
800
+ const e = new (_params?.Err ?? _Err)(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())));
801
+ captureStackTrace(e, _params?.callee);
802
+ throw e;
803
+ }
804
+ return result.value;
805
+ };
806
+ const _parseAsync = (_Err)=>async (schema, value, _ctx, params)=>{
807
+ const ctx = _ctx ? Object.assign(_ctx, {
808
+ async: true
809
+ }) : {
810
+ async: true
811
+ };
812
+ let result = schema._zod.run({
813
+ value,
814
+ issues: []
815
+ }, ctx);
816
+ if (result instanceof Promise) result = await result;
817
+ if (result.issues.length) {
818
+ const e = new (params?.Err ?? _Err)(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())));
819
+ captureStackTrace(e, params?.callee);
820
+ throw e;
821
+ }
822
+ return result.value;
823
+ };
824
+ const _safeParse = (_Err)=>(schema, value, _ctx)=>{
825
+ const ctx = _ctx ? {
826
+ ..._ctx,
827
+ async: false
828
+ } : {
829
+ async: false
830
+ };
831
+ const result = schema._zod.run({
832
+ value,
833
+ issues: []
834
+ }, ctx);
835
+ if (result instanceof Promise) throw new $ZodAsyncError();
836
+ return result.issues.length ? {
837
+ success: false,
838
+ error: new (_Err ?? $ZodError)(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())))
839
+ } : {
840
+ success: true,
841
+ data: result.value
842
+ };
843
+ };
844
+ const safeParse = /* @__PURE__*/ _safeParse($ZodRealError);
845
+ const _safeParseAsync = (_Err)=>async (schema, value, _ctx)=>{
846
+ const ctx = _ctx ? Object.assign(_ctx, {
847
+ async: true
848
+ }) : {
849
+ async: true
850
+ };
851
+ let result = schema._zod.run({
852
+ value,
853
+ issues: []
854
+ }, ctx);
855
+ if (result instanceof Promise) result = await result;
856
+ return result.issues.length ? {
857
+ success: false,
858
+ error: new _Err(result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())))
859
+ } : {
860
+ success: true,
861
+ data: result.value
862
+ };
863
+ };
864
+ const safeParseAsync = /* @__PURE__*/ _safeParseAsync($ZodRealError);
865
+ const _encode = (_Err)=>(schema, value, _ctx)=>{
866
+ const ctx = _ctx ? Object.assign(_ctx, {
867
+ direction: "backward"
868
+ }) : {
869
+ direction: "backward"
870
+ };
871
+ return _parse(_Err)(schema, value, ctx);
872
+ };
873
+ const _decode = (_Err)=>(schema, value, _ctx)=>_parse(_Err)(schema, value, _ctx);
874
+ const _encodeAsync = (_Err)=>async (schema, value, _ctx)=>{
875
+ const ctx = _ctx ? Object.assign(_ctx, {
876
+ direction: "backward"
877
+ }) : {
878
+ direction: "backward"
879
+ };
880
+ return _parseAsync(_Err)(schema, value, ctx);
881
+ };
882
+ const _decodeAsync = (_Err)=>async (schema, value, _ctx)=>_parseAsync(_Err)(schema, value, _ctx);
883
+ const _safeEncode = (_Err)=>(schema, value, _ctx)=>{
884
+ const ctx = _ctx ? Object.assign(_ctx, {
885
+ direction: "backward"
886
+ }) : {
887
+ direction: "backward"
888
+ };
889
+ return _safeParse(_Err)(schema, value, ctx);
890
+ };
891
+ const _safeDecode = (_Err)=>(schema, value, _ctx)=>_safeParse(_Err)(schema, value, _ctx);
892
+ const _safeEncodeAsync = (_Err)=>async (schema, value, _ctx)=>{
893
+ const ctx = _ctx ? Object.assign(_ctx, {
894
+ direction: "backward"
895
+ }) : {
896
+ direction: "backward"
897
+ };
898
+ return _safeParseAsync(_Err)(schema, value, ctx);
899
+ };
900
+ const _safeDecodeAsync = (_Err)=>async (schema, value, _ctx)=>_safeParseAsync(_Err)(schema, value, _ctx);
901
+ const cuid = /^[cC][^\s-]{8,}$/;
902
+ const cuid2 = /^[0-9a-z]+$/;
903
+ const ulid = /^[0-9A-HJKMNP-TV-Za-hjkmnp-tv-z]{26}$/;
904
+ const xid = /^[0-9a-vA-V]{20}$/;
905
+ const ksuid = /^[A-Za-z0-9]{27}$/;
906
+ const nanoid = /^[a-zA-Z0-9_-]{21}$/;
907
+ const duration = /^P(?:(\d+W)|(?!.*W)(?=\d|T\d)(\d+Y)?(\d+M)?(\d+D)?(T(?=\d)(\d+H)?(\d+M)?(\d+([.,]\d+)?S)?)?)$/;
908
+ const guid = /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12})$/;
909
+ const uuid = (version)=>{
910
+ if (!version) return /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[1-8][0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12}|00000000-0000-0000-0000-000000000000|ffffffff-ffff-ffff-ffff-ffffffffffff)$/;
911
+ return new RegExp(`^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-${version}[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$`);
912
+ };
913
+ const email = /^(?!\.)(?!.*\.\.)([A-Za-z0-9_'+\-\.]*)[A-Za-z0-9_+-]@([A-Za-z0-9][A-Za-z0-9\-]*\.)+[A-Za-z]{2,}$/;
914
+ const _emoji = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
915
+ function emoji() {
916
+ return new RegExp(_emoji, "u");
917
+ }
918
+ const ipv4 = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/;
919
+ const ipv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:))$/;
920
+ const cidrv4 = /^((25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/([0-9]|[1-2][0-9]|3[0-2])$/;
921
+ const cidrv6 = /^(([0-9a-fA-F]{1,4}:){7}[0-9a-fA-F]{1,4}|::|([0-9a-fA-F]{1,4})?::([0-9a-fA-F]{1,4}:?){0,6})\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/;
922
+ const regexes_base64 = /^$|^(?:[0-9a-zA-Z+/]{4})*(?:(?:[0-9a-zA-Z+/]{2}==)|(?:[0-9a-zA-Z+/]{3}=))?$/;
923
+ const regexes_base64url = /^[A-Za-z0-9_-]*$/;
924
+ const hostname = /^(?=.{1,253}\.?$)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[-0-9a-zA-Z]{0,61}[0-9a-zA-Z])?)*\.?$/;
925
+ const e164 = /^\+(?:[0-9]){6,14}[0-9]$/;
926
+ const dateSource = "(?:(?:\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-(?:(?:0[13578]|1[02])-(?:0[1-9]|[12]\\d|3[01])|(?:0[469]|11)-(?:0[1-9]|[12]\\d|30)|(?:02)-(?:0[1-9]|1\\d|2[0-8])))";
927
+ const date = /*@__PURE__*/ new RegExp(`^${dateSource}$`);
928
+ function timeSource(args) {
929
+ const hhmm = "(?:[01]\\d|2[0-3]):[0-5]\\d";
930
+ const regex = "number" == typeof args.precision ? -1 === args.precision ? `${hhmm}` : 0 === args.precision ? `${hhmm}:[0-5]\\d` : `${hhmm}:[0-5]\\d\\.\\d{${args.precision}}` : `${hhmm}(?::[0-5]\\d(?:\\.\\d+)?)?`;
931
+ return regex;
932
+ }
933
+ function regexes_time(args) {
934
+ return new RegExp(`^${timeSource(args)}$`);
935
+ }
936
+ function datetime(args) {
937
+ const time = timeSource({
938
+ precision: args.precision
939
+ });
940
+ const opts = [
941
+ "Z"
942
+ ];
943
+ if (args.local) opts.push("");
944
+ if (args.offset) opts.push("([+-](?:[01]\\d|2[0-3]):[0-5]\\d)");
945
+ const timeRegex = `${time}(?:${opts.join("|")})`;
946
+ return new RegExp(`^${dateSource}T(?:${timeRegex})$`);
947
+ }
948
+ const string = (params)=>{
949
+ const regex = params ? `[\\s\\S]{${params?.minimum ?? 0},${params?.maximum ?? ""}}` : "[\\s\\S]*";
950
+ return new RegExp(`^${regex}$`);
951
+ };
952
+ const integer = /^-?\d+$/;
953
+ const regexes_number = /^-?\d+(?:\.\d+)?/;
954
+ const regexes_boolean = /^(?:true|false)$/i;
955
+ const lowercase = /^[^A-Z]*$/;
956
+ const uppercase = /^[^a-z]*$/;
957
+ const $ZodCheck = /*@__PURE__*/ $constructor("$ZodCheck", (inst, def)=>{
958
+ var _a;
959
+ inst._zod ?? (inst._zod = {});
960
+ inst._zod.def = def;
961
+ (_a = inst._zod).onattach ?? (_a.onattach = []);
962
+ });
963
+ const numericOriginMap = {
964
+ number: "number",
965
+ bigint: "bigint",
966
+ object: "date"
967
+ };
968
+ const $ZodCheckLessThan = /*@__PURE__*/ $constructor("$ZodCheckLessThan", (inst, def)=>{
969
+ $ZodCheck.init(inst, def);
970
+ const origin = numericOriginMap[typeof def.value];
971
+ inst._zod.onattach.push((inst)=>{
972
+ const bag = inst._zod.bag;
973
+ const curr = (def.inclusive ? bag.maximum : bag.exclusiveMaximum) ?? Number.POSITIVE_INFINITY;
974
+ if (def.value < curr) {
975
+ if (def.inclusive) bag.maximum = def.value;
976
+ else bag.exclusiveMaximum = def.value;
977
+ }
978
+ });
979
+ inst._zod.check = (payload)=>{
980
+ if (def.inclusive ? payload.value <= def.value : payload.value < def.value) return;
981
+ payload.issues.push({
982
+ origin,
983
+ code: "too_big",
984
+ maximum: def.value,
985
+ input: payload.value,
986
+ inclusive: def.inclusive,
987
+ inst,
988
+ continue: !def.abort
989
+ });
990
+ };
991
+ });
992
+ const $ZodCheckGreaterThan = /*@__PURE__*/ $constructor("$ZodCheckGreaterThan", (inst, def)=>{
993
+ $ZodCheck.init(inst, def);
994
+ const origin = numericOriginMap[typeof def.value];
995
+ inst._zod.onattach.push((inst)=>{
996
+ const bag = inst._zod.bag;
997
+ const curr = (def.inclusive ? bag.minimum : bag.exclusiveMinimum) ?? Number.NEGATIVE_INFINITY;
998
+ if (def.value > curr) {
999
+ if (def.inclusive) bag.minimum = def.value;
1000
+ else bag.exclusiveMinimum = def.value;
1001
+ }
1002
+ });
1003
+ inst._zod.check = (payload)=>{
1004
+ if (def.inclusive ? payload.value >= def.value : payload.value > def.value) return;
1005
+ payload.issues.push({
1006
+ origin,
1007
+ code: "too_small",
1008
+ minimum: def.value,
1009
+ input: payload.value,
1010
+ inclusive: def.inclusive,
1011
+ inst,
1012
+ continue: !def.abort
1013
+ });
1014
+ };
1015
+ });
1016
+ const $ZodCheckMultipleOf = /*@__PURE__*/ $constructor("$ZodCheckMultipleOf", (inst, def)=>{
1017
+ $ZodCheck.init(inst, def);
1018
+ inst._zod.onattach.push((inst)=>{
1019
+ var _a;
1020
+ (_a = inst._zod.bag).multipleOf ?? (_a.multipleOf = def.value);
1021
+ });
1022
+ inst._zod.check = (payload)=>{
1023
+ if (typeof payload.value !== typeof def.value) throw new Error("Cannot mix number and bigint in multiple_of check.");
1024
+ const isMultiple = "bigint" == typeof payload.value ? payload.value % def.value === BigInt(0) : 0 === floatSafeRemainder(payload.value, def.value);
1025
+ if (isMultiple) return;
1026
+ payload.issues.push({
1027
+ origin: typeof payload.value,
1028
+ code: "not_multiple_of",
1029
+ divisor: def.value,
1030
+ input: payload.value,
1031
+ inst,
1032
+ continue: !def.abort
1033
+ });
1034
+ };
1035
+ });
1036
+ const $ZodCheckNumberFormat = /*@__PURE__*/ $constructor("$ZodCheckNumberFormat", (inst, def)=>{
1037
+ $ZodCheck.init(inst, def);
1038
+ def.format = def.format || "float64";
1039
+ const isInt = def.format?.includes("int");
1040
+ const origin = isInt ? "int" : "number";
1041
+ const [minimum, maximum] = NUMBER_FORMAT_RANGES[def.format];
1042
+ inst._zod.onattach.push((inst)=>{
1043
+ const bag = inst._zod.bag;
1044
+ bag.format = def.format;
1045
+ bag.minimum = minimum;
1046
+ bag.maximum = maximum;
1047
+ if (isInt) bag.pattern = integer;
1048
+ });
1049
+ inst._zod.check = (payload)=>{
1050
+ const input = payload.value;
1051
+ if (isInt) {
1052
+ if (!Number.isInteger(input)) {
1053
+ payload.issues.push({
1054
+ expected: origin,
1055
+ format: def.format,
1056
+ code: "invalid_type",
1057
+ continue: false,
1058
+ input,
1059
+ inst
1060
+ });
1061
+ return;
1062
+ }
1063
+ if (!Number.isSafeInteger(input)) {
1064
+ if (input > 0) payload.issues.push({
1065
+ input,
1066
+ code: "too_big",
1067
+ maximum: Number.MAX_SAFE_INTEGER,
1068
+ note: "Integers must be within the safe integer range.",
1069
+ inst,
1070
+ origin,
1071
+ continue: !def.abort
1072
+ });
1073
+ else payload.issues.push({
1074
+ input,
1075
+ code: "too_small",
1076
+ minimum: Number.MIN_SAFE_INTEGER,
1077
+ note: "Integers must be within the safe integer range.",
1078
+ inst,
1079
+ origin,
1080
+ continue: !def.abort
1081
+ });
1082
+ return;
1083
+ }
1084
+ }
1085
+ if (input < minimum) payload.issues.push({
1086
+ origin: "number",
1087
+ input,
1088
+ code: "too_small",
1089
+ minimum,
1090
+ inclusive: true,
1091
+ inst,
1092
+ continue: !def.abort
1093
+ });
1094
+ if (input > maximum) payload.issues.push({
1095
+ origin: "number",
1096
+ input,
1097
+ code: "too_big",
1098
+ maximum,
1099
+ inst
1100
+ });
1101
+ };
1102
+ });
1103
+ const $ZodCheckMaxLength = /*@__PURE__*/ $constructor("$ZodCheckMaxLength", (inst, def)=>{
1104
+ var _a;
1105
+ $ZodCheck.init(inst, def);
1106
+ (_a = inst._zod.def).when ?? (_a.when = (payload)=>{
1107
+ const val = payload.value;
1108
+ return !nullish(val) && void 0 !== val.length;
1109
+ });
1110
+ inst._zod.onattach.push((inst)=>{
1111
+ const curr = inst._zod.bag.maximum ?? Number.POSITIVE_INFINITY;
1112
+ if (def.maximum < curr) inst._zod.bag.maximum = def.maximum;
1113
+ });
1114
+ inst._zod.check = (payload)=>{
1115
+ const input = payload.value;
1116
+ const length = input.length;
1117
+ if (length <= def.maximum) return;
1118
+ const origin = getLengthableOrigin(input);
1119
+ payload.issues.push({
1120
+ origin,
1121
+ code: "too_big",
1122
+ maximum: def.maximum,
1123
+ inclusive: true,
1124
+ input,
1125
+ inst,
1126
+ continue: !def.abort
1127
+ });
1128
+ };
1129
+ });
1130
+ const $ZodCheckMinLength = /*@__PURE__*/ $constructor("$ZodCheckMinLength", (inst, def)=>{
1131
+ var _a;
1132
+ $ZodCheck.init(inst, def);
1133
+ (_a = inst._zod.def).when ?? (_a.when = (payload)=>{
1134
+ const val = payload.value;
1135
+ return !nullish(val) && void 0 !== val.length;
1136
+ });
1137
+ inst._zod.onattach.push((inst)=>{
1138
+ const curr = inst._zod.bag.minimum ?? Number.NEGATIVE_INFINITY;
1139
+ if (def.minimum > curr) inst._zod.bag.minimum = def.minimum;
1140
+ });
1141
+ inst._zod.check = (payload)=>{
1142
+ const input = payload.value;
1143
+ const length = input.length;
1144
+ if (length >= def.minimum) return;
1145
+ const origin = getLengthableOrigin(input);
1146
+ payload.issues.push({
1147
+ origin,
1148
+ code: "too_small",
1149
+ minimum: def.minimum,
1150
+ inclusive: true,
1151
+ input,
1152
+ inst,
1153
+ continue: !def.abort
1154
+ });
1155
+ };
1156
+ });
1157
+ const $ZodCheckLengthEquals = /*@__PURE__*/ $constructor("$ZodCheckLengthEquals", (inst, def)=>{
1158
+ var _a;
1159
+ $ZodCheck.init(inst, def);
1160
+ (_a = inst._zod.def).when ?? (_a.when = (payload)=>{
1161
+ const val = payload.value;
1162
+ return !nullish(val) && void 0 !== val.length;
1163
+ });
1164
+ inst._zod.onattach.push((inst)=>{
1165
+ const bag = inst._zod.bag;
1166
+ bag.minimum = def.length;
1167
+ bag.maximum = def.length;
1168
+ bag.length = def.length;
1169
+ });
1170
+ inst._zod.check = (payload)=>{
1171
+ const input = payload.value;
1172
+ const length = input.length;
1173
+ if (length === def.length) return;
1174
+ const origin = getLengthableOrigin(input);
1175
+ const tooBig = length > def.length;
1176
+ payload.issues.push({
1177
+ origin,
1178
+ ...tooBig ? {
1179
+ code: "too_big",
1180
+ maximum: def.length
1181
+ } : {
1182
+ code: "too_small",
1183
+ minimum: def.length
1184
+ },
1185
+ inclusive: true,
1186
+ exact: true,
1187
+ input: payload.value,
1188
+ inst,
1189
+ continue: !def.abort
1190
+ });
1191
+ };
1192
+ });
1193
+ const $ZodCheckStringFormat = /*@__PURE__*/ $constructor("$ZodCheckStringFormat", (inst, def)=>{
1194
+ var _a, _b;
1195
+ $ZodCheck.init(inst, def);
1196
+ inst._zod.onattach.push((inst)=>{
1197
+ const bag = inst._zod.bag;
1198
+ bag.format = def.format;
1199
+ if (def.pattern) {
1200
+ bag.patterns ?? (bag.patterns = new Set());
1201
+ bag.patterns.add(def.pattern);
1202
+ }
1203
+ });
1204
+ if (def.pattern) (_a = inst._zod).check ?? (_a.check = (payload)=>{
1205
+ def.pattern.lastIndex = 0;
1206
+ if (def.pattern.test(payload.value)) return;
1207
+ payload.issues.push({
1208
+ origin: "string",
1209
+ code: "invalid_format",
1210
+ format: def.format,
1211
+ input: payload.value,
1212
+ ...def.pattern ? {
1213
+ pattern: def.pattern.toString()
1214
+ } : {},
1215
+ inst,
1216
+ continue: !def.abort
1217
+ });
1218
+ });
1219
+ else (_b = inst._zod).check ?? (_b.check = ()=>{});
1220
+ });
1221
+ const $ZodCheckRegex = /*@__PURE__*/ $constructor("$ZodCheckRegex", (inst, def)=>{
1222
+ $ZodCheckStringFormat.init(inst, def);
1223
+ inst._zod.check = (payload)=>{
1224
+ def.pattern.lastIndex = 0;
1225
+ if (def.pattern.test(payload.value)) return;
1226
+ payload.issues.push({
1227
+ origin: "string",
1228
+ code: "invalid_format",
1229
+ format: "regex",
1230
+ input: payload.value,
1231
+ pattern: def.pattern.toString(),
1232
+ inst,
1233
+ continue: !def.abort
1234
+ });
1235
+ };
1236
+ });
1237
+ const $ZodCheckLowerCase = /*@__PURE__*/ $constructor("$ZodCheckLowerCase", (inst, def)=>{
1238
+ def.pattern ?? (def.pattern = lowercase);
1239
+ $ZodCheckStringFormat.init(inst, def);
1240
+ });
1241
+ const $ZodCheckUpperCase = /*@__PURE__*/ $constructor("$ZodCheckUpperCase", (inst, def)=>{
1242
+ def.pattern ?? (def.pattern = uppercase);
1243
+ $ZodCheckStringFormat.init(inst, def);
1244
+ });
1245
+ const $ZodCheckIncludes = /*@__PURE__*/ $constructor("$ZodCheckIncludes", (inst, def)=>{
1246
+ $ZodCheck.init(inst, def);
1247
+ const escapedRegex = escapeRegex(def.includes);
1248
+ const pattern = new RegExp("number" == typeof def.position ? `^.{${def.position}}${escapedRegex}` : escapedRegex);
1249
+ def.pattern = pattern;
1250
+ inst._zod.onattach.push((inst)=>{
1251
+ const bag = inst._zod.bag;
1252
+ bag.patterns ?? (bag.patterns = new Set());
1253
+ bag.patterns.add(pattern);
1254
+ });
1255
+ inst._zod.check = (payload)=>{
1256
+ if (payload.value.includes(def.includes, def.position)) return;
1257
+ payload.issues.push({
1258
+ origin: "string",
1259
+ code: "invalid_format",
1260
+ format: "includes",
1261
+ includes: def.includes,
1262
+ input: payload.value,
1263
+ inst,
1264
+ continue: !def.abort
1265
+ });
1266
+ };
1267
+ });
1268
+ const $ZodCheckStartsWith = /*@__PURE__*/ $constructor("$ZodCheckStartsWith", (inst, def)=>{
1269
+ $ZodCheck.init(inst, def);
1270
+ const pattern = new RegExp(`^${escapeRegex(def.prefix)}.*`);
1271
+ def.pattern ?? (def.pattern = pattern);
1272
+ inst._zod.onattach.push((inst)=>{
1273
+ const bag = inst._zod.bag;
1274
+ bag.patterns ?? (bag.patterns = new Set());
1275
+ bag.patterns.add(pattern);
1276
+ });
1277
+ inst._zod.check = (payload)=>{
1278
+ if (payload.value.startsWith(def.prefix)) return;
1279
+ payload.issues.push({
1280
+ origin: "string",
1281
+ code: "invalid_format",
1282
+ format: "starts_with",
1283
+ prefix: def.prefix,
1284
+ input: payload.value,
1285
+ inst,
1286
+ continue: !def.abort
1287
+ });
1288
+ };
1289
+ });
1290
+ const $ZodCheckEndsWith = /*@__PURE__*/ $constructor("$ZodCheckEndsWith", (inst, def)=>{
1291
+ $ZodCheck.init(inst, def);
1292
+ const pattern = new RegExp(`.*${escapeRegex(def.suffix)}$`);
1293
+ def.pattern ?? (def.pattern = pattern);
1294
+ inst._zod.onattach.push((inst)=>{
1295
+ const bag = inst._zod.bag;
1296
+ bag.patterns ?? (bag.patterns = new Set());
1297
+ bag.patterns.add(pattern);
1298
+ });
1299
+ inst._zod.check = (payload)=>{
1300
+ if (payload.value.endsWith(def.suffix)) return;
1301
+ payload.issues.push({
1302
+ origin: "string",
1303
+ code: "invalid_format",
1304
+ format: "ends_with",
1305
+ suffix: def.suffix,
1306
+ input: payload.value,
1307
+ inst,
1308
+ continue: !def.abort
1309
+ });
1310
+ };
1311
+ });
1312
+ const $ZodCheckOverwrite = /*@__PURE__*/ $constructor("$ZodCheckOverwrite", (inst, def)=>{
1313
+ $ZodCheck.init(inst, def);
1314
+ inst._zod.check = (payload)=>{
1315
+ payload.value = def.tx(payload.value);
1316
+ };
1317
+ });
1318
+ class Doc {
1319
+ constructor(args = []){
1320
+ this.content = [];
1321
+ this.indent = 0;
1322
+ if (this) this.args = args;
1323
+ }
1324
+ indented(fn) {
1325
+ this.indent += 1;
1326
+ fn(this);
1327
+ this.indent -= 1;
1328
+ }
1329
+ write(arg) {
1330
+ if ("function" == typeof arg) {
1331
+ arg(this, {
1332
+ execution: "sync"
1333
+ });
1334
+ arg(this, {
1335
+ execution: "async"
1336
+ });
1337
+ return;
1338
+ }
1339
+ const content = arg;
1340
+ const lines = content.split("\n").filter((x)=>x);
1341
+ const minIndent = Math.min(...lines.map((x)=>x.length - x.trimStart().length));
1342
+ const dedented = lines.map((x)=>x.slice(minIndent)).map((x)=>" ".repeat(2 * this.indent) + x);
1343
+ for (const line of dedented)this.content.push(line);
1344
+ }
1345
+ compile() {
1346
+ const F = Function;
1347
+ const args = this?.args;
1348
+ const content = this?.content ?? [
1349
+ ""
1350
+ ];
1351
+ const lines = [
1352
+ ...content.map((x)=>` ${x}`)
1353
+ ];
1354
+ return new F(...args, lines.join("\n"));
1355
+ }
1356
+ }
1357
+ const versions_version = {
1358
+ major: 4,
1359
+ minor: 1,
1360
+ patch: 12
1361
+ };
1362
+ const $ZodType = /*@__PURE__*/ $constructor("$ZodType", (inst, def)=>{
1363
+ var _a;
1364
+ inst ?? (inst = {});
1365
+ inst._zod.def = def;
1366
+ inst._zod.bag = inst._zod.bag || {};
1367
+ inst._zod.version = versions_version;
1368
+ const checks = [
1369
+ ...inst._zod.def.checks ?? []
1370
+ ];
1371
+ if (inst._zod.traits.has("$ZodCheck")) checks.unshift(inst);
1372
+ for (const ch of checks)for (const fn of ch._zod.onattach)fn(inst);
1373
+ if (0 === checks.length) {
1374
+ (_a = inst._zod).deferred ?? (_a.deferred = []);
1375
+ inst._zod.deferred?.push(()=>{
1376
+ inst._zod.run = inst._zod.parse;
1377
+ });
1378
+ } else {
1379
+ const runChecks = (payload, checks, ctx)=>{
1380
+ let isAborted = aborted(payload);
1381
+ let asyncResult;
1382
+ for (const ch of checks){
1383
+ if (ch._zod.def.when) {
1384
+ const shouldRun = ch._zod.def.when(payload);
1385
+ if (!shouldRun) continue;
1386
+ } else if (isAborted) continue;
1387
+ const currLen = payload.issues.length;
1388
+ const _ = ch._zod.check(payload);
1389
+ if (_ instanceof Promise && ctx?.async === false) throw new $ZodAsyncError();
1390
+ if (asyncResult || _ instanceof Promise) asyncResult = (asyncResult ?? Promise.resolve()).then(async ()=>{
1391
+ await _;
1392
+ const nextLen = payload.issues.length;
1393
+ if (nextLen === currLen) return;
1394
+ if (!isAborted) isAborted = aborted(payload, currLen);
1395
+ });
1396
+ else {
1397
+ const nextLen = payload.issues.length;
1398
+ if (nextLen === currLen) continue;
1399
+ if (!isAborted) isAborted = aborted(payload, currLen);
1400
+ }
1401
+ }
1402
+ if (asyncResult) return asyncResult.then(()=>payload);
1403
+ return payload;
1404
+ };
1405
+ const handleCanaryResult = (canary, payload, ctx)=>{
1406
+ if (aborted(canary)) {
1407
+ canary.aborted = true;
1408
+ return canary;
1409
+ }
1410
+ const checkResult = runChecks(payload, checks, ctx);
1411
+ if (checkResult instanceof Promise) {
1412
+ if (false === ctx.async) throw new $ZodAsyncError();
1413
+ return checkResult.then((checkResult)=>inst._zod.parse(checkResult, ctx));
1414
+ }
1415
+ return inst._zod.parse(checkResult, ctx);
1416
+ };
1417
+ inst._zod.run = (payload, ctx)=>{
1418
+ if (ctx.skipChecks) return inst._zod.parse(payload, ctx);
1419
+ if ("backward" === ctx.direction) {
1420
+ const canary = inst._zod.parse({
1421
+ value: payload.value,
1422
+ issues: []
1423
+ }, {
1424
+ ...ctx,
1425
+ skipChecks: true
1426
+ });
1427
+ if (canary instanceof Promise) return canary.then((canary)=>handleCanaryResult(canary, payload, ctx));
1428
+ return handleCanaryResult(canary, payload, ctx);
1429
+ }
1430
+ const result = inst._zod.parse(payload, ctx);
1431
+ if (result instanceof Promise) {
1432
+ if (false === ctx.async) throw new $ZodAsyncError();
1433
+ return result.then((result)=>runChecks(result, checks, ctx));
1434
+ }
1435
+ return runChecks(result, checks, ctx);
1436
+ };
1437
+ }
1438
+ inst["~standard"] = {
1439
+ validate: (value)=>{
1440
+ try {
1441
+ const r = safeParse(inst, value);
1442
+ return r.success ? {
1443
+ value: r.data
1444
+ } : {
1445
+ issues: r.error?.issues
1446
+ };
1447
+ } catch (_) {
1448
+ return safeParseAsync(inst, value).then((r)=>r.success ? {
1449
+ value: r.data
1450
+ } : {
1451
+ issues: r.error?.issues
1452
+ });
1453
+ }
1454
+ },
1455
+ vendor: "zod",
1456
+ version: 1
1457
+ };
1458
+ });
1459
+ const $ZodString = /*@__PURE__*/ $constructor("$ZodString", (inst, def)=>{
1460
+ $ZodType.init(inst, def);
1461
+ inst._zod.pattern = [
1462
+ ...inst?._zod.bag?.patterns ?? []
1463
+ ].pop() ?? string(inst._zod.bag);
1464
+ inst._zod.parse = (payload, _)=>{
1465
+ if (def.coerce) try {
1466
+ payload.value = String(payload.value);
1467
+ } catch (_) {}
1468
+ if ("string" == typeof payload.value) return payload;
1469
+ payload.issues.push({
1470
+ expected: "string",
1471
+ code: "invalid_type",
1472
+ input: payload.value,
1473
+ inst
1474
+ });
1475
+ return payload;
1476
+ };
1477
+ });
1478
+ const $ZodStringFormat = /*@__PURE__*/ $constructor("$ZodStringFormat", (inst, def)=>{
1479
+ $ZodCheckStringFormat.init(inst, def);
1480
+ $ZodString.init(inst, def);
1481
+ });
1482
+ const $ZodGUID = /*@__PURE__*/ $constructor("$ZodGUID", (inst, def)=>{
1483
+ def.pattern ?? (def.pattern = guid);
1484
+ $ZodStringFormat.init(inst, def);
1485
+ });
1486
+ const $ZodUUID = /*@__PURE__*/ $constructor("$ZodUUID", (inst, def)=>{
1487
+ if (def.version) {
1488
+ const versionMap = {
1489
+ v1: 1,
1490
+ v2: 2,
1491
+ v3: 3,
1492
+ v4: 4,
1493
+ v5: 5,
1494
+ v6: 6,
1495
+ v7: 7,
1496
+ v8: 8
1497
+ };
1498
+ const v = versionMap[def.version];
1499
+ if (void 0 === v) throw new Error(`Invalid UUID version: "${def.version}"`);
1500
+ def.pattern ?? (def.pattern = uuid(v));
1501
+ } else def.pattern ?? (def.pattern = uuid());
1502
+ $ZodStringFormat.init(inst, def);
1503
+ });
1504
+ const $ZodEmail = /*@__PURE__*/ $constructor("$ZodEmail", (inst, def)=>{
1505
+ def.pattern ?? (def.pattern = email);
1506
+ $ZodStringFormat.init(inst, def);
1507
+ });
1508
+ const $ZodURL = /*@__PURE__*/ $constructor("$ZodURL", (inst, def)=>{
1509
+ $ZodStringFormat.init(inst, def);
1510
+ inst._zod.check = (payload)=>{
1511
+ try {
1512
+ const trimmed = payload.value.trim();
1513
+ const url = new URL(trimmed);
1514
+ if (def.hostname) {
1515
+ def.hostname.lastIndex = 0;
1516
+ if (!def.hostname.test(url.hostname)) payload.issues.push({
1517
+ code: "invalid_format",
1518
+ format: "url",
1519
+ note: "Invalid hostname",
1520
+ pattern: hostname.source,
1521
+ input: payload.value,
1522
+ inst,
1523
+ continue: !def.abort
1524
+ });
1525
+ }
1526
+ if (def.protocol) {
1527
+ def.protocol.lastIndex = 0;
1528
+ if (!def.protocol.test(url.protocol.endsWith(":") ? url.protocol.slice(0, -1) : url.protocol)) payload.issues.push({
1529
+ code: "invalid_format",
1530
+ format: "url",
1531
+ note: "Invalid protocol",
1532
+ pattern: def.protocol.source,
1533
+ input: payload.value,
1534
+ inst,
1535
+ continue: !def.abort
1536
+ });
1537
+ }
1538
+ if (def.normalize) payload.value = url.href;
1539
+ else payload.value = trimmed;
1540
+ return;
1541
+ } catch (_) {
1542
+ payload.issues.push({
1543
+ code: "invalid_format",
1544
+ format: "url",
1545
+ input: payload.value,
1546
+ inst,
1547
+ continue: !def.abort
1548
+ });
1549
+ }
1550
+ };
1551
+ });
1552
+ const $ZodEmoji = /*@__PURE__*/ $constructor("$ZodEmoji", (inst, def)=>{
1553
+ def.pattern ?? (def.pattern = emoji());
1554
+ $ZodStringFormat.init(inst, def);
1555
+ });
1556
+ const $ZodNanoID = /*@__PURE__*/ $constructor("$ZodNanoID", (inst, def)=>{
1557
+ def.pattern ?? (def.pattern = nanoid);
1558
+ $ZodStringFormat.init(inst, def);
1559
+ });
1560
+ const $ZodCUID = /*@__PURE__*/ $constructor("$ZodCUID", (inst, def)=>{
1561
+ def.pattern ?? (def.pattern = cuid);
1562
+ $ZodStringFormat.init(inst, def);
1563
+ });
1564
+ const $ZodCUID2 = /*@__PURE__*/ $constructor("$ZodCUID2", (inst, def)=>{
1565
+ def.pattern ?? (def.pattern = cuid2);
1566
+ $ZodStringFormat.init(inst, def);
1567
+ });
1568
+ const $ZodULID = /*@__PURE__*/ $constructor("$ZodULID", (inst, def)=>{
1569
+ def.pattern ?? (def.pattern = ulid);
1570
+ $ZodStringFormat.init(inst, def);
1571
+ });
1572
+ const $ZodXID = /*@__PURE__*/ $constructor("$ZodXID", (inst, def)=>{
1573
+ def.pattern ?? (def.pattern = xid);
1574
+ $ZodStringFormat.init(inst, def);
1575
+ });
1576
+ const $ZodKSUID = /*@__PURE__*/ $constructor("$ZodKSUID", (inst, def)=>{
1577
+ def.pattern ?? (def.pattern = ksuid);
1578
+ $ZodStringFormat.init(inst, def);
1579
+ });
1580
+ const $ZodISODateTime = /*@__PURE__*/ $constructor("$ZodISODateTime", (inst, def)=>{
1581
+ def.pattern ?? (def.pattern = datetime(def));
1582
+ $ZodStringFormat.init(inst, def);
1583
+ });
1584
+ const $ZodISODate = /*@__PURE__*/ $constructor("$ZodISODate", (inst, def)=>{
1585
+ def.pattern ?? (def.pattern = date);
1586
+ $ZodStringFormat.init(inst, def);
1587
+ });
1588
+ const $ZodISOTime = /*@__PURE__*/ $constructor("$ZodISOTime", (inst, def)=>{
1589
+ def.pattern ?? (def.pattern = regexes_time(def));
1590
+ $ZodStringFormat.init(inst, def);
1591
+ });
1592
+ const $ZodISODuration = /*@__PURE__*/ $constructor("$ZodISODuration", (inst, def)=>{
1593
+ def.pattern ?? (def.pattern = duration);
1594
+ $ZodStringFormat.init(inst, def);
1595
+ });
1596
+ const $ZodIPv4 = /*@__PURE__*/ $constructor("$ZodIPv4", (inst, def)=>{
1597
+ def.pattern ?? (def.pattern = ipv4);
1598
+ $ZodStringFormat.init(inst, def);
1599
+ inst._zod.onattach.push((inst)=>{
1600
+ const bag = inst._zod.bag;
1601
+ bag.format = "ipv4";
1602
+ });
1603
+ });
1604
+ const $ZodIPv6 = /*@__PURE__*/ $constructor("$ZodIPv6", (inst, def)=>{
1605
+ def.pattern ?? (def.pattern = ipv6);
1606
+ $ZodStringFormat.init(inst, def);
1607
+ inst._zod.onattach.push((inst)=>{
1608
+ const bag = inst._zod.bag;
1609
+ bag.format = "ipv6";
1610
+ });
1611
+ inst._zod.check = (payload)=>{
1612
+ try {
1613
+ new URL(`http://[${payload.value}]`);
1614
+ } catch {
1615
+ payload.issues.push({
1616
+ code: "invalid_format",
1617
+ format: "ipv6",
1618
+ input: payload.value,
1619
+ inst,
1620
+ continue: !def.abort
1621
+ });
1622
+ }
1623
+ };
1624
+ });
1625
+ const $ZodCIDRv4 = /*@__PURE__*/ $constructor("$ZodCIDRv4", (inst, def)=>{
1626
+ def.pattern ?? (def.pattern = cidrv4);
1627
+ $ZodStringFormat.init(inst, def);
1628
+ });
1629
+ const $ZodCIDRv6 = /*@__PURE__*/ $constructor("$ZodCIDRv6", (inst, def)=>{
1630
+ def.pattern ?? (def.pattern = cidrv6);
1631
+ $ZodStringFormat.init(inst, def);
1632
+ inst._zod.check = (payload)=>{
1633
+ const parts = payload.value.split("/");
1634
+ try {
1635
+ if (2 !== parts.length) throw new Error();
1636
+ const [address, prefix] = parts;
1637
+ if (!prefix) throw new Error();
1638
+ const prefixNum = Number(prefix);
1639
+ if (`${prefixNum}` !== prefix) throw new Error();
1640
+ if (prefixNum < 0 || prefixNum > 128) throw new Error();
1641
+ new URL(`http://[${address}]`);
1642
+ } catch {
1643
+ payload.issues.push({
1644
+ code: "invalid_format",
1645
+ format: "cidrv6",
1646
+ input: payload.value,
1647
+ inst,
1648
+ continue: !def.abort
1649
+ });
1650
+ }
1651
+ };
1652
+ });
1653
+ function isValidBase64(data) {
1654
+ if ("" === data) return true;
1655
+ if (data.length % 4 !== 0) return false;
1656
+ try {
1657
+ atob(data);
1658
+ return true;
1659
+ } catch {
1660
+ return false;
1661
+ }
1662
+ }
1663
+ const $ZodBase64 = /*@__PURE__*/ $constructor("$ZodBase64", (inst, def)=>{
1664
+ def.pattern ?? (def.pattern = regexes_base64);
1665
+ $ZodStringFormat.init(inst, def);
1666
+ inst._zod.onattach.push((inst)=>{
1667
+ inst._zod.bag.contentEncoding = "base64";
1668
+ });
1669
+ inst._zod.check = (payload)=>{
1670
+ if (isValidBase64(payload.value)) return;
1671
+ payload.issues.push({
1672
+ code: "invalid_format",
1673
+ format: "base64",
1674
+ input: payload.value,
1675
+ inst,
1676
+ continue: !def.abort
1677
+ });
1678
+ };
1679
+ });
1680
+ function isValidBase64URL(data) {
1681
+ if (!regexes_base64url.test(data)) return false;
1682
+ const base64 = data.replace(/[-_]/g, (c)=>"-" === c ? "+" : "/");
1683
+ const padded = base64.padEnd(4 * Math.ceil(base64.length / 4), "=");
1684
+ return isValidBase64(padded);
1685
+ }
1686
+ const $ZodBase64URL = /*@__PURE__*/ $constructor("$ZodBase64URL", (inst, def)=>{
1687
+ def.pattern ?? (def.pattern = regexes_base64url);
1688
+ $ZodStringFormat.init(inst, def);
1689
+ inst._zod.onattach.push((inst)=>{
1690
+ inst._zod.bag.contentEncoding = "base64url";
1691
+ });
1692
+ inst._zod.check = (payload)=>{
1693
+ if (isValidBase64URL(payload.value)) return;
1694
+ payload.issues.push({
1695
+ code: "invalid_format",
1696
+ format: "base64url",
1697
+ input: payload.value,
1698
+ inst,
1699
+ continue: !def.abort
1700
+ });
1701
+ };
1702
+ });
1703
+ const $ZodE164 = /*@__PURE__*/ $constructor("$ZodE164", (inst, def)=>{
1704
+ def.pattern ?? (def.pattern = e164);
1705
+ $ZodStringFormat.init(inst, def);
1706
+ });
1707
+ function isValidJWT(token, algorithm = null) {
1708
+ try {
1709
+ const tokensParts = token.split(".");
1710
+ if (3 !== tokensParts.length) return false;
1711
+ const [header] = tokensParts;
1712
+ if (!header) return false;
1713
+ const parsedHeader = JSON.parse(atob(header));
1714
+ if ("typ" in parsedHeader && parsedHeader?.typ !== "JWT") return false;
1715
+ if (!parsedHeader.alg) return false;
1716
+ if (algorithm && (!("alg" in parsedHeader) || parsedHeader.alg !== algorithm)) return false;
1717
+ return true;
1718
+ } catch {
1719
+ return false;
1720
+ }
1721
+ }
1722
+ const $ZodJWT = /*@__PURE__*/ $constructor("$ZodJWT", (inst, def)=>{
1723
+ $ZodStringFormat.init(inst, def);
1724
+ inst._zod.check = (payload)=>{
1725
+ if (isValidJWT(payload.value, def.alg)) return;
1726
+ payload.issues.push({
1727
+ code: "invalid_format",
1728
+ format: "jwt",
1729
+ input: payload.value,
1730
+ inst,
1731
+ continue: !def.abort
1732
+ });
1733
+ };
1734
+ });
1735
+ const $ZodNumber = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def)=>{
1736
+ $ZodType.init(inst, def);
1737
+ inst._zod.pattern = inst._zod.bag.pattern ?? regexes_number;
1738
+ inst._zod.parse = (payload, _ctx)=>{
1739
+ if (def.coerce) try {
1740
+ payload.value = Number(payload.value);
1741
+ } catch (_) {}
1742
+ const input = payload.value;
1743
+ if ("number" == typeof input && !Number.isNaN(input) && Number.isFinite(input)) return payload;
1744
+ const received = "number" == typeof input ? Number.isNaN(input) ? "NaN" : Number.isFinite(input) ? void 0 : "Infinity" : void 0;
1745
+ payload.issues.push({
1746
+ expected: "number",
1747
+ code: "invalid_type",
1748
+ input,
1749
+ inst,
1750
+ ...received ? {
1751
+ received
1752
+ } : {}
1753
+ });
1754
+ return payload;
1755
+ };
1756
+ });
1757
+ const $ZodNumberFormat = /*@__PURE__*/ $constructor("$ZodNumber", (inst, def)=>{
1758
+ $ZodCheckNumberFormat.init(inst, def);
1759
+ $ZodNumber.init(inst, def);
1760
+ });
1761
+ const $ZodBoolean = /*@__PURE__*/ $constructor("$ZodBoolean", (inst, def)=>{
1762
+ $ZodType.init(inst, def);
1763
+ inst._zod.pattern = regexes_boolean;
1764
+ inst._zod.parse = (payload, _ctx)=>{
1765
+ if (def.coerce) try {
1766
+ payload.value = Boolean(payload.value);
1767
+ } catch (_) {}
1768
+ const input = payload.value;
1769
+ if ("boolean" == typeof input) return payload;
1770
+ payload.issues.push({
1771
+ expected: "boolean",
1772
+ code: "invalid_type",
1773
+ input,
1774
+ inst
1775
+ });
1776
+ return payload;
1777
+ };
1778
+ });
1779
+ const $ZodUnknown = /*@__PURE__*/ $constructor("$ZodUnknown", (inst, def)=>{
1780
+ $ZodType.init(inst, def);
1781
+ inst._zod.parse = (payload)=>payload;
1782
+ });
1783
+ const $ZodNever = /*@__PURE__*/ $constructor("$ZodNever", (inst, def)=>{
1784
+ $ZodType.init(inst, def);
1785
+ inst._zod.parse = (payload, _ctx)=>{
1786
+ payload.issues.push({
1787
+ expected: "never",
1788
+ code: "invalid_type",
1789
+ input: payload.value,
1790
+ inst
1791
+ });
1792
+ return payload;
1793
+ };
1794
+ });
1795
+ function handleArrayResult(result, final, index) {
1796
+ if (result.issues.length) final.issues.push(...prefixIssues(index, result.issues));
1797
+ final.value[index] = result.value;
1798
+ }
1799
+ const $ZodArray = /*@__PURE__*/ $constructor("$ZodArray", (inst, def)=>{
1800
+ $ZodType.init(inst, def);
1801
+ inst._zod.parse = (payload, ctx)=>{
1802
+ const input = payload.value;
1803
+ if (!Array.isArray(input)) {
1804
+ payload.issues.push({
1805
+ expected: "array",
1806
+ code: "invalid_type",
1807
+ input,
1808
+ inst
1809
+ });
1810
+ return payload;
1811
+ }
1812
+ payload.value = Array(input.length);
1813
+ const proms = [];
1814
+ for(let i = 0; i < input.length; i++){
1815
+ const item = input[i];
1816
+ const result = def.element._zod.run({
1817
+ value: item,
1818
+ issues: []
1819
+ }, ctx);
1820
+ if (result instanceof Promise) proms.push(result.then((result)=>handleArrayResult(result, payload, i)));
1821
+ else handleArrayResult(result, payload, i);
1822
+ }
1823
+ if (proms.length) return Promise.all(proms).then(()=>payload);
1824
+ return payload;
1825
+ };
1826
+ });
1827
+ function handlePropertyResult(result, final, key, input) {
1828
+ if (result.issues.length) final.issues.push(...prefixIssues(key, result.issues));
1829
+ if (void 0 === result.value) {
1830
+ if (key in input) final.value[key] = void 0;
1831
+ } else final.value[key] = result.value;
1832
+ }
1833
+ function normalizeDef(def) {
1834
+ const keys = Object.keys(def.shape);
1835
+ for (const k of keys)if (!def.shape?.[k]?._zod?.traits?.has("$ZodType")) throw new Error(`Invalid element at key "${k}": expected a Zod schema`);
1836
+ const okeys = optionalKeys(def.shape);
1837
+ return {
1838
+ ...def,
1839
+ keys,
1840
+ keySet: new Set(keys),
1841
+ numKeys: keys.length,
1842
+ optionalKeys: new Set(okeys)
1843
+ };
1844
+ }
1845
+ function handleCatchall(proms, input, payload, ctx, def, inst) {
1846
+ const unrecognized = [];
1847
+ const keySet = def.keySet;
1848
+ const _catchall = def.catchall._zod;
1849
+ const t = _catchall.def.type;
1850
+ for (const key of Object.keys(input)){
1851
+ if (keySet.has(key)) continue;
1852
+ if ("never" === t) {
1853
+ unrecognized.push(key);
1854
+ continue;
1855
+ }
1856
+ const r = _catchall.run({
1857
+ value: input[key],
1858
+ issues: []
1859
+ }, ctx);
1860
+ if (r instanceof Promise) proms.push(r.then((r)=>handlePropertyResult(r, payload, key, input)));
1861
+ else handlePropertyResult(r, payload, key, input);
1862
+ }
1863
+ if (unrecognized.length) payload.issues.push({
1864
+ code: "unrecognized_keys",
1865
+ keys: unrecognized,
1866
+ input,
1867
+ inst
1868
+ });
1869
+ if (!proms.length) return payload;
1870
+ return Promise.all(proms).then(()=>payload);
1871
+ }
1872
+ const $ZodObject = /*@__PURE__*/ $constructor("$ZodObject", (inst, def)=>{
1873
+ $ZodType.init(inst, def);
1874
+ const desc = Object.getOwnPropertyDescriptor(def, "shape");
1875
+ if (!desc?.get) {
1876
+ const sh = def.shape;
1877
+ Object.defineProperty(def, "shape", {
1878
+ get: ()=>{
1879
+ const newSh = {
1880
+ ...sh
1881
+ };
1882
+ Object.defineProperty(def, "shape", {
1883
+ value: newSh
1884
+ });
1885
+ return newSh;
1886
+ }
1887
+ });
1888
+ }
1889
+ const _normalized = cached(()=>normalizeDef(def));
1890
+ defineLazy(inst._zod, "propValues", ()=>{
1891
+ const shape = def.shape;
1892
+ const propValues = {};
1893
+ for(const key in shape){
1894
+ const field = shape[key]._zod;
1895
+ if (field.values) {
1896
+ propValues[key] ?? (propValues[key] = new Set());
1897
+ for (const v of field.values)propValues[key].add(v);
1898
+ }
1899
+ }
1900
+ return propValues;
1901
+ });
1902
+ const isObject = util_isObject;
1903
+ const catchall = def.catchall;
1904
+ let value;
1905
+ inst._zod.parse = (payload, ctx)=>{
1906
+ value ?? (value = _normalized.value);
1907
+ const input = payload.value;
1908
+ if (!isObject(input)) {
1909
+ payload.issues.push({
1910
+ expected: "object",
1911
+ code: "invalid_type",
1912
+ input,
1913
+ inst
1914
+ });
1915
+ return payload;
1916
+ }
1917
+ payload.value = {};
1918
+ const proms = [];
1919
+ const shape = value.shape;
1920
+ for (const key of value.keys){
1921
+ const el = shape[key];
1922
+ const r = el._zod.run({
1923
+ value: input[key],
1924
+ issues: []
1925
+ }, ctx);
1926
+ if (r instanceof Promise) proms.push(r.then((r)=>handlePropertyResult(r, payload, key, input)));
1927
+ else handlePropertyResult(r, payload, key, input);
1928
+ }
1929
+ if (!catchall) return proms.length ? Promise.all(proms).then(()=>payload) : payload;
1930
+ return handleCatchall(proms, input, payload, ctx, _normalized.value, inst);
1931
+ };
1932
+ });
1933
+ const $ZodObjectJIT = /*@__PURE__*/ $constructor("$ZodObjectJIT", (inst, def)=>{
1934
+ $ZodObject.init(inst, def);
1935
+ const superParse = inst._zod.parse;
1936
+ const _normalized = cached(()=>normalizeDef(def));
1937
+ const generateFastpass = (shape)=>{
1938
+ const doc = new Doc([
1939
+ "shape",
1940
+ "payload",
1941
+ "ctx"
1942
+ ]);
1943
+ const normalized = _normalized.value;
1944
+ const parseStr = (key)=>{
1945
+ const k = esc(key);
1946
+ return `shape[${k}]._zod.run({ value: input[${k}], issues: [] }, ctx)`;
1947
+ };
1948
+ doc.write("const input = payload.value;");
1949
+ const ids = Object.create(null);
1950
+ let counter = 0;
1951
+ for (const key of normalized.keys)ids[key] = `key_${counter++}`;
1952
+ doc.write("const newResult = {};");
1953
+ for (const key of normalized.keys){
1954
+ const id = ids[key];
1955
+ const k = esc(key);
1956
+ doc.write(`const ${id} = ${parseStr(key)};`);
1957
+ doc.write(`
1958
+ if (${id}.issues.length) {
1959
+ payload.issues = payload.issues.concat(${id}.issues.map(iss => ({
1960
+ ...iss,
1961
+ path: iss.path ? [${k}, ...iss.path] : [${k}]
1962
+ })));
1963
+ }
1964
+
1965
+
1966
+ if (${id}.value === undefined) {
1967
+ if (${k} in input) {
1968
+ newResult[${k}] = undefined;
1969
+ }
1970
+ } else {
1971
+ newResult[${k}] = ${id}.value;
1972
+ }
1973
+
1974
+ `);
1975
+ }
1976
+ doc.write("payload.value = newResult;");
1977
+ doc.write("return payload;");
1978
+ const fn = doc.compile();
1979
+ return (payload, ctx)=>fn(shape, payload, ctx);
1980
+ };
1981
+ let fastpass;
1982
+ const isObject = util_isObject;
1983
+ const jit = !globalConfig.jitless;
1984
+ const allowsEval = util_allowsEval;
1985
+ const fastEnabled = jit && allowsEval.value;
1986
+ const catchall = def.catchall;
1987
+ let value;
1988
+ inst._zod.parse = (payload, ctx)=>{
1989
+ value ?? (value = _normalized.value);
1990
+ const input = payload.value;
1991
+ if (!isObject(input)) {
1992
+ payload.issues.push({
1993
+ expected: "object",
1994
+ code: "invalid_type",
1995
+ input,
1996
+ inst
1997
+ });
1998
+ return payload;
1999
+ }
2000
+ if (jit && fastEnabled && ctx?.async === false && true !== ctx.jitless) {
2001
+ if (!fastpass) fastpass = generateFastpass(def.shape);
2002
+ payload = fastpass(payload, ctx);
2003
+ if (!catchall) return payload;
2004
+ return handleCatchall([], input, payload, ctx, value, inst);
2005
+ }
2006
+ return superParse(payload, ctx);
2007
+ };
2008
+ });
2009
+ function handleUnionResults(results, final, inst, ctx) {
2010
+ for (const result of results)if (0 === result.issues.length) {
2011
+ final.value = result.value;
2012
+ return final;
2013
+ }
2014
+ const nonaborted = results.filter((r)=>!aborted(r));
2015
+ if (1 === nonaborted.length) {
2016
+ final.value = nonaborted[0].value;
2017
+ return nonaborted[0];
2018
+ }
2019
+ final.issues.push({
2020
+ code: "invalid_union",
2021
+ input: final.value,
2022
+ inst,
2023
+ errors: results.map((result)=>result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config())))
2024
+ });
2025
+ return final;
2026
+ }
2027
+ const $ZodUnion = /*@__PURE__*/ $constructor("$ZodUnion", (inst, def)=>{
2028
+ $ZodType.init(inst, def);
2029
+ defineLazy(inst._zod, "optin", ()=>def.options.some((o)=>"optional" === o._zod.optin) ? "optional" : void 0);
2030
+ defineLazy(inst._zod, "optout", ()=>def.options.some((o)=>"optional" === o._zod.optout) ? "optional" : void 0);
2031
+ defineLazy(inst._zod, "values", ()=>{
2032
+ if (def.options.every((o)=>o._zod.values)) return new Set(def.options.flatMap((option)=>Array.from(option._zod.values)));
2033
+ });
2034
+ defineLazy(inst._zod, "pattern", ()=>{
2035
+ if (def.options.every((o)=>o._zod.pattern)) {
2036
+ const patterns = def.options.map((o)=>o._zod.pattern);
2037
+ return new RegExp(`^(${patterns.map((p)=>cleanRegex(p.source)).join("|")})$`);
2038
+ }
2039
+ });
2040
+ const single = 1 === def.options.length;
2041
+ const first = def.options[0]._zod.run;
2042
+ inst._zod.parse = (payload, ctx)=>{
2043
+ if (single) return first(payload, ctx);
2044
+ let async = false;
2045
+ const results = [];
2046
+ for (const option of def.options){
2047
+ const result = option._zod.run({
2048
+ value: payload.value,
2049
+ issues: []
2050
+ }, ctx);
2051
+ if (result instanceof Promise) {
2052
+ results.push(result);
2053
+ async = true;
2054
+ } else {
2055
+ if (0 === result.issues.length) return result;
2056
+ results.push(result);
2057
+ }
2058
+ }
2059
+ if (!async) return handleUnionResults(results, payload, inst, ctx);
2060
+ return Promise.all(results).then((results)=>handleUnionResults(results, payload, inst, ctx));
2061
+ };
2062
+ });
2063
+ const $ZodIntersection = /*@__PURE__*/ $constructor("$ZodIntersection", (inst, def)=>{
2064
+ $ZodType.init(inst, def);
2065
+ inst._zod.parse = (payload, ctx)=>{
2066
+ const input = payload.value;
2067
+ const left = def.left._zod.run({
2068
+ value: input,
2069
+ issues: []
2070
+ }, ctx);
2071
+ const right = def.right._zod.run({
2072
+ value: input,
2073
+ issues: []
2074
+ }, ctx);
2075
+ const async = left instanceof Promise || right instanceof Promise;
2076
+ if (async) return Promise.all([
2077
+ left,
2078
+ right
2079
+ ]).then(([left, right])=>handleIntersectionResults(payload, left, right));
2080
+ return handleIntersectionResults(payload, left, right);
2081
+ };
2082
+ });
2083
+ function mergeValues(a, b) {
2084
+ if (a === b) return {
2085
+ valid: true,
2086
+ data: a
2087
+ };
2088
+ if (a instanceof Date && b instanceof Date && +a === +b) return {
2089
+ valid: true,
2090
+ data: a
2091
+ };
2092
+ if (isPlainObject(a) && isPlainObject(b)) {
2093
+ const bKeys = Object.keys(b);
2094
+ const sharedKeys = Object.keys(a).filter((key)=>-1 !== bKeys.indexOf(key));
2095
+ const newObj = {
2096
+ ...a,
2097
+ ...b
2098
+ };
2099
+ for (const key of sharedKeys){
2100
+ const sharedValue = mergeValues(a[key], b[key]);
2101
+ if (!sharedValue.valid) return {
2102
+ valid: false,
2103
+ mergeErrorPath: [
2104
+ key,
2105
+ ...sharedValue.mergeErrorPath
2106
+ ]
2107
+ };
2108
+ newObj[key] = sharedValue.data;
2109
+ }
2110
+ return {
2111
+ valid: true,
2112
+ data: newObj
2113
+ };
2114
+ }
2115
+ if (Array.isArray(a) && Array.isArray(b)) {
2116
+ if (a.length !== b.length) return {
2117
+ valid: false,
2118
+ mergeErrorPath: []
2119
+ };
2120
+ const newArray = [];
2121
+ for(let index = 0; index < a.length; index++){
2122
+ const itemA = a[index];
2123
+ const itemB = b[index];
2124
+ const sharedValue = mergeValues(itemA, itemB);
2125
+ if (!sharedValue.valid) return {
2126
+ valid: false,
2127
+ mergeErrorPath: [
2128
+ index,
2129
+ ...sharedValue.mergeErrorPath
2130
+ ]
2131
+ };
2132
+ newArray.push(sharedValue.data);
2133
+ }
2134
+ return {
2135
+ valid: true,
2136
+ data: newArray
2137
+ };
2138
+ }
2139
+ return {
2140
+ valid: false,
2141
+ mergeErrorPath: []
2142
+ };
2143
+ }
2144
+ function handleIntersectionResults(result, left, right) {
2145
+ if (left.issues.length) result.issues.push(...left.issues);
2146
+ if (right.issues.length) result.issues.push(...right.issues);
2147
+ if (aborted(result)) return result;
2148
+ const merged = mergeValues(left.value, right.value);
2149
+ if (!merged.valid) throw new Error(`Unmergable intersection. Error path: ${JSON.stringify(merged.mergeErrorPath)}`);
2150
+ result.value = merged.data;
2151
+ return result;
2152
+ }
2153
+ const $ZodEnum = /*@__PURE__*/ $constructor("$ZodEnum", (inst, def)=>{
2154
+ $ZodType.init(inst, def);
2155
+ const values = util_getEnumValues(def.entries);
2156
+ const valuesSet = new Set(values);
2157
+ inst._zod.values = valuesSet;
2158
+ inst._zod.pattern = new RegExp(`^(${values.filter((k)=>propertyKeyTypes.has(typeof k)).map((o)=>"string" == typeof o ? escapeRegex(o) : o.toString()).join("|")})$`);
2159
+ inst._zod.parse = (payload, _ctx)=>{
2160
+ const input = payload.value;
2161
+ if (valuesSet.has(input)) return payload;
2162
+ payload.issues.push({
2163
+ code: "invalid_value",
2164
+ values,
2165
+ input,
2166
+ inst
2167
+ });
2168
+ return payload;
2169
+ };
2170
+ });
2171
+ const $ZodTransform = /*@__PURE__*/ $constructor("$ZodTransform", (inst, def)=>{
2172
+ $ZodType.init(inst, def);
2173
+ inst._zod.parse = (payload, ctx)=>{
2174
+ if ("backward" === ctx.direction) throw new $ZodEncodeError(inst.constructor.name);
2175
+ const _out = def.transform(payload.value, payload);
2176
+ if (ctx.async) {
2177
+ const output = _out instanceof Promise ? _out : Promise.resolve(_out);
2178
+ return output.then((output)=>{
2179
+ payload.value = output;
2180
+ return payload;
2181
+ });
2182
+ }
2183
+ if (_out instanceof Promise) throw new $ZodAsyncError();
2184
+ payload.value = _out;
2185
+ return payload;
2186
+ };
2187
+ });
2188
+ function handleOptionalResult(result, input) {
2189
+ if (result.issues.length && void 0 === input) return {
2190
+ issues: [],
2191
+ value: void 0
2192
+ };
2193
+ return result;
2194
+ }
2195
+ const $ZodOptional = /*@__PURE__*/ $constructor("$ZodOptional", (inst, def)=>{
2196
+ $ZodType.init(inst, def);
2197
+ inst._zod.optin = "optional";
2198
+ inst._zod.optout = "optional";
2199
+ defineLazy(inst._zod, "values", ()=>def.innerType._zod.values ? new Set([
2200
+ ...def.innerType._zod.values,
2201
+ void 0
2202
+ ]) : void 0);
2203
+ defineLazy(inst._zod, "pattern", ()=>{
2204
+ const pattern = def.innerType._zod.pattern;
2205
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)})?$`) : void 0;
2206
+ });
2207
+ inst._zod.parse = (payload, ctx)=>{
2208
+ if ("optional" === def.innerType._zod.optin) {
2209
+ const result = def.innerType._zod.run(payload, ctx);
2210
+ if (result instanceof Promise) return result.then((r)=>handleOptionalResult(r, payload.value));
2211
+ return handleOptionalResult(result, payload.value);
2212
+ }
2213
+ if (void 0 === payload.value) return payload;
2214
+ return def.innerType._zod.run(payload, ctx);
2215
+ };
2216
+ });
2217
+ const $ZodNullable = /*@__PURE__*/ $constructor("$ZodNullable", (inst, def)=>{
2218
+ $ZodType.init(inst, def);
2219
+ defineLazy(inst._zod, "optin", ()=>def.innerType._zod.optin);
2220
+ defineLazy(inst._zod, "optout", ()=>def.innerType._zod.optout);
2221
+ defineLazy(inst._zod, "pattern", ()=>{
2222
+ const pattern = def.innerType._zod.pattern;
2223
+ return pattern ? new RegExp(`^(${cleanRegex(pattern.source)}|null)$`) : void 0;
2224
+ });
2225
+ defineLazy(inst._zod, "values", ()=>def.innerType._zod.values ? new Set([
2226
+ ...def.innerType._zod.values,
2227
+ null
2228
+ ]) : void 0);
2229
+ inst._zod.parse = (payload, ctx)=>{
2230
+ if (null === payload.value) return payload;
2231
+ return def.innerType._zod.run(payload, ctx);
2232
+ };
2233
+ });
2234
+ const $ZodDefault = /*@__PURE__*/ $constructor("$ZodDefault", (inst, def)=>{
2235
+ $ZodType.init(inst, def);
2236
+ inst._zod.optin = "optional";
2237
+ defineLazy(inst._zod, "values", ()=>def.innerType._zod.values);
2238
+ inst._zod.parse = (payload, ctx)=>{
2239
+ if ("backward" === ctx.direction) return def.innerType._zod.run(payload, ctx);
2240
+ if (void 0 === payload.value) {
2241
+ payload.value = def.defaultValue;
2242
+ return payload;
2243
+ }
2244
+ const result = def.innerType._zod.run(payload, ctx);
2245
+ if (result instanceof Promise) return result.then((result)=>handleDefaultResult(result, def));
2246
+ return handleDefaultResult(result, def);
2247
+ };
2248
+ });
2249
+ function handleDefaultResult(payload, def) {
2250
+ if (void 0 === payload.value) payload.value = def.defaultValue;
2251
+ return payload;
2252
+ }
2253
+ const $ZodPrefault = /*@__PURE__*/ $constructor("$ZodPrefault", (inst, def)=>{
2254
+ $ZodType.init(inst, def);
2255
+ inst._zod.optin = "optional";
2256
+ defineLazy(inst._zod, "values", ()=>def.innerType._zod.values);
2257
+ inst._zod.parse = (payload, ctx)=>{
2258
+ if ("backward" === ctx.direction) return def.innerType._zod.run(payload, ctx);
2259
+ if (void 0 === payload.value) payload.value = def.defaultValue;
2260
+ return def.innerType._zod.run(payload, ctx);
2261
+ };
2262
+ });
2263
+ const $ZodNonOptional = /*@__PURE__*/ $constructor("$ZodNonOptional", (inst, def)=>{
2264
+ $ZodType.init(inst, def);
2265
+ defineLazy(inst._zod, "values", ()=>{
2266
+ const v = def.innerType._zod.values;
2267
+ return v ? new Set([
2268
+ ...v
2269
+ ].filter((x)=>void 0 !== x)) : void 0;
2270
+ });
2271
+ inst._zod.parse = (payload, ctx)=>{
2272
+ const result = def.innerType._zod.run(payload, ctx);
2273
+ if (result instanceof Promise) return result.then((result)=>handleNonOptionalResult(result, inst));
2274
+ return handleNonOptionalResult(result, inst);
2275
+ };
2276
+ });
2277
+ function handleNonOptionalResult(payload, inst) {
2278
+ if (!payload.issues.length && void 0 === payload.value) payload.issues.push({
2279
+ code: "invalid_type",
2280
+ expected: "nonoptional",
2281
+ input: payload.value,
2282
+ inst
2283
+ });
2284
+ return payload;
2285
+ }
2286
+ const $ZodCatch = /*@__PURE__*/ $constructor("$ZodCatch", (inst, def)=>{
2287
+ $ZodType.init(inst, def);
2288
+ defineLazy(inst._zod, "optin", ()=>def.innerType._zod.optin);
2289
+ defineLazy(inst._zod, "optout", ()=>def.innerType._zod.optout);
2290
+ defineLazy(inst._zod, "values", ()=>def.innerType._zod.values);
2291
+ inst._zod.parse = (payload, ctx)=>{
2292
+ if ("backward" === ctx.direction) return def.innerType._zod.run(payload, ctx);
2293
+ const result = def.innerType._zod.run(payload, ctx);
2294
+ if (result instanceof Promise) return result.then((result)=>{
2295
+ payload.value = result.value;
2296
+ if (result.issues.length) {
2297
+ payload.value = def.catchValue({
2298
+ ...payload,
2299
+ error: {
2300
+ issues: result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config()))
2301
+ },
2302
+ input: payload.value
2303
+ });
2304
+ payload.issues = [];
2305
+ }
2306
+ return payload;
2307
+ });
2308
+ payload.value = result.value;
2309
+ if (result.issues.length) {
2310
+ payload.value = def.catchValue({
2311
+ ...payload,
2312
+ error: {
2313
+ issues: result.issues.map((iss)=>finalizeIssue(iss, ctx, core_config()))
2314
+ },
2315
+ input: payload.value
2316
+ });
2317
+ payload.issues = [];
2318
+ }
2319
+ return payload;
2320
+ };
2321
+ });
2322
+ const $ZodPipe = /*@__PURE__*/ $constructor("$ZodPipe", (inst, def)=>{
2323
+ $ZodType.init(inst, def);
2324
+ defineLazy(inst._zod, "values", ()=>def.in._zod.values);
2325
+ defineLazy(inst._zod, "optin", ()=>def.in._zod.optin);
2326
+ defineLazy(inst._zod, "optout", ()=>def.out._zod.optout);
2327
+ defineLazy(inst._zod, "propValues", ()=>def.in._zod.propValues);
2328
+ inst._zod.parse = (payload, ctx)=>{
2329
+ if ("backward" === ctx.direction) {
2330
+ const right = def.out._zod.run(payload, ctx);
2331
+ if (right instanceof Promise) return right.then((right)=>handlePipeResult(right, def.in, ctx));
2332
+ return handlePipeResult(right, def.in, ctx);
2333
+ }
2334
+ const left = def.in._zod.run(payload, ctx);
2335
+ if (left instanceof Promise) return left.then((left)=>handlePipeResult(left, def.out, ctx));
2336
+ return handlePipeResult(left, def.out, ctx);
2337
+ };
2338
+ });
2339
+ function handlePipeResult(left, next, ctx) {
2340
+ if (left.issues.length) {
2341
+ left.aborted = true;
2342
+ return left;
2343
+ }
2344
+ return next._zod.run({
2345
+ value: left.value,
2346
+ issues: left.issues
2347
+ }, ctx);
2348
+ }
2349
+ const $ZodReadonly = /*@__PURE__*/ $constructor("$ZodReadonly", (inst, def)=>{
2350
+ $ZodType.init(inst, def);
2351
+ defineLazy(inst._zod, "propValues", ()=>def.innerType._zod.propValues);
2352
+ defineLazy(inst._zod, "values", ()=>def.innerType._zod.values);
2353
+ defineLazy(inst._zod, "optin", ()=>def.innerType._zod.optin);
2354
+ defineLazy(inst._zod, "optout", ()=>def.innerType._zod.optout);
2355
+ inst._zod.parse = (payload, ctx)=>{
2356
+ if ("backward" === ctx.direction) return def.innerType._zod.run(payload, ctx);
2357
+ const result = def.innerType._zod.run(payload, ctx);
2358
+ if (result instanceof Promise) return result.then(handleReadonlyResult);
2359
+ return handleReadonlyResult(result);
2360
+ };
2361
+ });
2362
+ function handleReadonlyResult(payload) {
2363
+ payload.value = Object.freeze(payload.value);
2364
+ return payload;
2365
+ }
2366
+ const $ZodCustom = /*@__PURE__*/ $constructor("$ZodCustom", (inst, def)=>{
2367
+ $ZodCheck.init(inst, def);
2368
+ $ZodType.init(inst, def);
2369
+ inst._zod.parse = (payload, _)=>payload;
2370
+ inst._zod.check = (payload)=>{
2371
+ const input = payload.value;
2372
+ const r = def.fn(input);
2373
+ if (r instanceof Promise) return r.then((r)=>handleRefineResult(r, payload, input, inst));
2374
+ handleRefineResult(r, payload, input, inst);
2375
+ };
2376
+ });
2377
+ function handleRefineResult(result, payload, input, inst) {
2378
+ if (!result) {
2379
+ const _iss = {
2380
+ code: "custom",
2381
+ input,
2382
+ inst,
2383
+ path: [
2384
+ ...inst._zod.def.path ?? []
2385
+ ],
2386
+ continue: !inst._zod.def.abort
2387
+ };
2388
+ if (inst._zod.def.params) _iss.params = inst._zod.def.params;
2389
+ payload.issues.push(util_issue(_iss));
2390
+ }
2391
+ }
2392
+ const en_parsedType = (data)=>{
2393
+ const t = typeof data;
2394
+ switch(t){
2395
+ case "number":
2396
+ return Number.isNaN(data) ? "NaN" : "number";
2397
+ case "object":
2398
+ if (Array.isArray(data)) return "array";
2399
+ if (null === data) return "null";
2400
+ if (Object.getPrototypeOf(data) !== Object.prototype && data.constructor) return data.constructor.name;
2401
+ }
2402
+ return t;
2403
+ };
2404
+ const en_error = ()=>{
2405
+ const Sizable = {
2406
+ string: {
2407
+ unit: "characters",
2408
+ verb: "to have"
2409
+ },
2410
+ file: {
2411
+ unit: "bytes",
2412
+ verb: "to have"
2413
+ },
2414
+ array: {
2415
+ unit: "items",
2416
+ verb: "to have"
2417
+ },
2418
+ set: {
2419
+ unit: "items",
2420
+ verb: "to have"
2421
+ }
2422
+ };
2423
+ function getSizing(origin) {
2424
+ return Sizable[origin] ?? null;
2425
+ }
2426
+ const Nouns = {
2427
+ regex: "input",
2428
+ email: "email address",
2429
+ url: "URL",
2430
+ emoji: "emoji",
2431
+ uuid: "UUID",
2432
+ uuidv4: "UUIDv4",
2433
+ uuidv6: "UUIDv6",
2434
+ nanoid: "nanoid",
2435
+ guid: "GUID",
2436
+ cuid: "cuid",
2437
+ cuid2: "cuid2",
2438
+ ulid: "ULID",
2439
+ xid: "XID",
2440
+ ksuid: "KSUID",
2441
+ datetime: "ISO datetime",
2442
+ date: "ISO date",
2443
+ time: "ISO time",
2444
+ duration: "ISO duration",
2445
+ ipv4: "IPv4 address",
2446
+ ipv6: "IPv6 address",
2447
+ cidrv4: "IPv4 range",
2448
+ cidrv6: "IPv6 range",
2449
+ base64: "base64-encoded string",
2450
+ base64url: "base64url-encoded string",
2451
+ json_string: "JSON string",
2452
+ e164: "E.164 number",
2453
+ jwt: "JWT",
2454
+ template_literal: "input"
2455
+ };
2456
+ return (issue)=>{
2457
+ switch(issue.code){
2458
+ case "invalid_type":
2459
+ return `Invalid input: expected ${issue.expected}, received ${en_parsedType(issue.input)}`;
2460
+ case "invalid_value":
2461
+ if (1 === issue.values.length) return `Invalid input: expected ${stringifyPrimitive(issue.values[0])}`;
2462
+ return `Invalid option: expected one of ${joinValues(issue.values, "|")}`;
2463
+ case "too_big":
2464
+ {
2465
+ const adj = issue.inclusive ? "<=" : "<";
2466
+ const sizing = getSizing(issue.origin);
2467
+ if (sizing) return `Too big: expected ${issue.origin ?? "value"} to have ${adj}${issue.maximum.toString()} ${sizing.unit ?? "elements"}`;
2468
+ return `Too big: expected ${issue.origin ?? "value"} to be ${adj}${issue.maximum.toString()}`;
2469
+ }
2470
+ case "too_small":
2471
+ {
2472
+ const adj = issue.inclusive ? ">=" : ">";
2473
+ const sizing = getSizing(issue.origin);
2474
+ if (sizing) return `Too small: expected ${issue.origin} to have ${adj}${issue.minimum.toString()} ${sizing.unit}`;
2475
+ return `Too small: expected ${issue.origin} to be ${adj}${issue.minimum.toString()}`;
2476
+ }
2477
+ case "invalid_format":
2478
+ {
2479
+ const _issue = issue;
2480
+ if ("starts_with" === _issue.format) return `Invalid string: must start with "${_issue.prefix}"`;
2481
+ if ("ends_with" === _issue.format) return `Invalid string: must end with "${_issue.suffix}"`;
2482
+ if ("includes" === _issue.format) return `Invalid string: must include "${_issue.includes}"`;
2483
+ if ("regex" === _issue.format) return `Invalid string: must match pattern ${_issue.pattern}`;
2484
+ return `Invalid ${Nouns[_issue.format] ?? issue.format}`;
2485
+ }
2486
+ case "not_multiple_of":
2487
+ return `Invalid number: must be a multiple of ${issue.divisor}`;
2488
+ case "unrecognized_keys":
2489
+ return `Unrecognized key${issue.keys.length > 1 ? "s" : ""}: ${joinValues(issue.keys, ", ")}`;
2490
+ case "invalid_key":
2491
+ return `Invalid key in ${issue.origin}`;
2492
+ case "invalid_union":
2493
+ return "Invalid input";
2494
+ case "invalid_element":
2495
+ return `Invalid value in ${issue.origin}`;
2496
+ default:
2497
+ return "Invalid input";
2498
+ }
2499
+ };
2500
+ };
2501
+ function en() {
2502
+ return {
2503
+ localeError: en_error()
2504
+ };
2505
+ }
2506
+ Symbol("ZodOutput");
2507
+ Symbol("ZodInput");
2508
+ class registries_$ZodRegistry {
2509
+ constructor(){
2510
+ this._map = new WeakMap();
2511
+ this._idmap = new Map();
2512
+ }
2513
+ add(schema, ..._meta) {
2514
+ const meta = _meta[0];
2515
+ this._map.set(schema, meta);
2516
+ if (meta && "object" == typeof meta && "id" in meta) {
2517
+ if (this._idmap.has(meta.id)) throw new Error(`ID ${meta.id} already exists in the registry`);
2518
+ this._idmap.set(meta.id, schema);
2519
+ }
2520
+ return this;
2521
+ }
2522
+ clear() {
2523
+ this._map = new WeakMap();
2524
+ this._idmap = new Map();
2525
+ return this;
2526
+ }
2527
+ remove(schema) {
2528
+ const meta = this._map.get(schema);
2529
+ if (meta && "object" == typeof meta && "id" in meta) this._idmap.delete(meta.id);
2530
+ this._map.delete(schema);
2531
+ return this;
2532
+ }
2533
+ get(schema) {
2534
+ const p = schema._zod.parent;
2535
+ if (p) {
2536
+ const pm = {
2537
+ ...this.get(p) ?? {}
2538
+ };
2539
+ delete pm.id;
2540
+ const f = {
2541
+ ...pm,
2542
+ ...this._map.get(schema)
2543
+ };
2544
+ return Object.keys(f).length ? f : void 0;
2545
+ }
2546
+ return this._map.get(schema);
2547
+ }
2548
+ has(schema) {
2549
+ return this._map.has(schema);
2550
+ }
2551
+ }
2552
+ function registry() {
2553
+ return new registries_$ZodRegistry();
2554
+ }
2555
+ const globalRegistry = /*@__PURE__*/ registry();
2556
+ function _string(Class, params) {
2557
+ return new Class({
2558
+ type: "string",
2559
+ ...normalizeParams(params)
2560
+ });
2561
+ }
2562
+ function _email(Class, params) {
2563
+ return new Class({
2564
+ type: "string",
2565
+ format: "email",
2566
+ check: "string_format",
2567
+ abort: false,
2568
+ ...normalizeParams(params)
2569
+ });
2570
+ }
2571
+ function _guid(Class, params) {
2572
+ return new Class({
2573
+ type: "string",
2574
+ format: "guid",
2575
+ check: "string_format",
2576
+ abort: false,
2577
+ ...normalizeParams(params)
2578
+ });
2579
+ }
2580
+ function _uuid(Class, params) {
2581
+ return new Class({
2582
+ type: "string",
2583
+ format: "uuid",
2584
+ check: "string_format",
2585
+ abort: false,
2586
+ ...normalizeParams(params)
2587
+ });
2588
+ }
2589
+ function _uuidv4(Class, params) {
2590
+ return new Class({
2591
+ type: "string",
2592
+ format: "uuid",
2593
+ check: "string_format",
2594
+ abort: false,
2595
+ version: "v4",
2596
+ ...normalizeParams(params)
2597
+ });
2598
+ }
2599
+ function _uuidv6(Class, params) {
2600
+ return new Class({
2601
+ type: "string",
2602
+ format: "uuid",
2603
+ check: "string_format",
2604
+ abort: false,
2605
+ version: "v6",
2606
+ ...normalizeParams(params)
2607
+ });
2608
+ }
2609
+ function _uuidv7(Class, params) {
2610
+ return new Class({
2611
+ type: "string",
2612
+ format: "uuid",
2613
+ check: "string_format",
2614
+ abort: false,
2615
+ version: "v7",
2616
+ ...normalizeParams(params)
2617
+ });
2618
+ }
2619
+ function _url(Class, params) {
2620
+ return new Class({
2621
+ type: "string",
2622
+ format: "url",
2623
+ check: "string_format",
2624
+ abort: false,
2625
+ ...normalizeParams(params)
2626
+ });
2627
+ }
2628
+ function api_emoji(Class, params) {
2629
+ return new Class({
2630
+ type: "string",
2631
+ format: "emoji",
2632
+ check: "string_format",
2633
+ abort: false,
2634
+ ...normalizeParams(params)
2635
+ });
2636
+ }
2637
+ function _nanoid(Class, params) {
2638
+ return new Class({
2639
+ type: "string",
2640
+ format: "nanoid",
2641
+ check: "string_format",
2642
+ abort: false,
2643
+ ...normalizeParams(params)
2644
+ });
2645
+ }
2646
+ function _cuid(Class, params) {
2647
+ return new Class({
2648
+ type: "string",
2649
+ format: "cuid",
2650
+ check: "string_format",
2651
+ abort: false,
2652
+ ...normalizeParams(params)
2653
+ });
2654
+ }
2655
+ function _cuid2(Class, params) {
2656
+ return new Class({
2657
+ type: "string",
2658
+ format: "cuid2",
2659
+ check: "string_format",
2660
+ abort: false,
2661
+ ...normalizeParams(params)
2662
+ });
2663
+ }
2664
+ function _ulid(Class, params) {
2665
+ return new Class({
2666
+ type: "string",
2667
+ format: "ulid",
2668
+ check: "string_format",
2669
+ abort: false,
2670
+ ...normalizeParams(params)
2671
+ });
2672
+ }
2673
+ function _xid(Class, params) {
2674
+ return new Class({
2675
+ type: "string",
2676
+ format: "xid",
2677
+ check: "string_format",
2678
+ abort: false,
2679
+ ...normalizeParams(params)
2680
+ });
2681
+ }
2682
+ function _ksuid(Class, params) {
2683
+ return new Class({
2684
+ type: "string",
2685
+ format: "ksuid",
2686
+ check: "string_format",
2687
+ abort: false,
2688
+ ...normalizeParams(params)
2689
+ });
2690
+ }
2691
+ function _ipv4(Class, params) {
2692
+ return new Class({
2693
+ type: "string",
2694
+ format: "ipv4",
2695
+ check: "string_format",
2696
+ abort: false,
2697
+ ...normalizeParams(params)
2698
+ });
2699
+ }
2700
+ function _ipv6(Class, params) {
2701
+ return new Class({
2702
+ type: "string",
2703
+ format: "ipv6",
2704
+ check: "string_format",
2705
+ abort: false,
2706
+ ...normalizeParams(params)
2707
+ });
2708
+ }
2709
+ function _cidrv4(Class, params) {
2710
+ return new Class({
2711
+ type: "string",
2712
+ format: "cidrv4",
2713
+ check: "string_format",
2714
+ abort: false,
2715
+ ...normalizeParams(params)
2716
+ });
2717
+ }
2718
+ function _cidrv6(Class, params) {
2719
+ return new Class({
2720
+ type: "string",
2721
+ format: "cidrv6",
2722
+ check: "string_format",
2723
+ abort: false,
2724
+ ...normalizeParams(params)
2725
+ });
2726
+ }
2727
+ function _base64(Class, params) {
2728
+ return new Class({
2729
+ type: "string",
2730
+ format: "base64",
2731
+ check: "string_format",
2732
+ abort: false,
2733
+ ...normalizeParams(params)
2734
+ });
2735
+ }
2736
+ function _base64url(Class, params) {
2737
+ return new Class({
2738
+ type: "string",
2739
+ format: "base64url",
2740
+ check: "string_format",
2741
+ abort: false,
2742
+ ...normalizeParams(params)
2743
+ });
2744
+ }
2745
+ function _e164(Class, params) {
2746
+ return new Class({
2747
+ type: "string",
2748
+ format: "e164",
2749
+ check: "string_format",
2750
+ abort: false,
2751
+ ...normalizeParams(params)
2752
+ });
2753
+ }
2754
+ function _jwt(Class, params) {
2755
+ return new Class({
2756
+ type: "string",
2757
+ format: "jwt",
2758
+ check: "string_format",
2759
+ abort: false,
2760
+ ...normalizeParams(params)
2761
+ });
2762
+ }
2763
+ function _isoDateTime(Class, params) {
2764
+ return new Class({
2765
+ type: "string",
2766
+ format: "datetime",
2767
+ check: "string_format",
2768
+ offset: false,
2769
+ local: false,
2770
+ precision: null,
2771
+ ...normalizeParams(params)
2772
+ });
2773
+ }
2774
+ function _isoDate(Class, params) {
2775
+ return new Class({
2776
+ type: "string",
2777
+ format: "date",
2778
+ check: "string_format",
2779
+ ...normalizeParams(params)
2780
+ });
2781
+ }
2782
+ function _isoTime(Class, params) {
2783
+ return new Class({
2784
+ type: "string",
2785
+ format: "time",
2786
+ check: "string_format",
2787
+ precision: null,
2788
+ ...normalizeParams(params)
2789
+ });
2790
+ }
2791
+ function _isoDuration(Class, params) {
2792
+ return new Class({
2793
+ type: "string",
2794
+ format: "duration",
2795
+ check: "string_format",
2796
+ ...normalizeParams(params)
2797
+ });
2798
+ }
2799
+ function _number(Class, params) {
2800
+ return new Class({
2801
+ type: "number",
2802
+ checks: [],
2803
+ ...normalizeParams(params)
2804
+ });
2805
+ }
2806
+ function _int(Class, params) {
2807
+ return new Class({
2808
+ type: "number",
2809
+ check: "number_format",
2810
+ abort: false,
2811
+ format: "safeint",
2812
+ ...normalizeParams(params)
2813
+ });
2814
+ }
2815
+ function _boolean(Class, params) {
2816
+ return new Class({
2817
+ type: "boolean",
2818
+ ...normalizeParams(params)
2819
+ });
2820
+ }
2821
+ function _unknown(Class) {
2822
+ return new Class({
2823
+ type: "unknown"
2824
+ });
2825
+ }
2826
+ function _never(Class, params) {
2827
+ return new Class({
2828
+ type: "never",
2829
+ ...normalizeParams(params)
2830
+ });
2831
+ }
2832
+ function _lt(value, params) {
2833
+ return new $ZodCheckLessThan({
2834
+ check: "less_than",
2835
+ ...normalizeParams(params),
2836
+ value,
2837
+ inclusive: false
2838
+ });
2839
+ }
2840
+ function _lte(value, params) {
2841
+ return new $ZodCheckLessThan({
2842
+ check: "less_than",
2843
+ ...normalizeParams(params),
2844
+ value,
2845
+ inclusive: true
2846
+ });
2847
+ }
2848
+ function _gt(value, params) {
2849
+ return new $ZodCheckGreaterThan({
2850
+ check: "greater_than",
2851
+ ...normalizeParams(params),
2852
+ value,
2853
+ inclusive: false
2854
+ });
2855
+ }
2856
+ function _gte(value, params) {
2857
+ return new $ZodCheckGreaterThan({
2858
+ check: "greater_than",
2859
+ ...normalizeParams(params),
2860
+ value,
2861
+ inclusive: true
2862
+ });
2863
+ }
2864
+ function _multipleOf(value, params) {
2865
+ return new $ZodCheckMultipleOf({
2866
+ check: "multiple_of",
2867
+ ...normalizeParams(params),
2868
+ value
2869
+ });
2870
+ }
2871
+ function _maxLength(maximum, params) {
2872
+ const ch = new $ZodCheckMaxLength({
2873
+ check: "max_length",
2874
+ ...normalizeParams(params),
2875
+ maximum
2876
+ });
2877
+ return ch;
2878
+ }
2879
+ function _minLength(minimum, params) {
2880
+ return new $ZodCheckMinLength({
2881
+ check: "min_length",
2882
+ ...normalizeParams(params),
2883
+ minimum
2884
+ });
2885
+ }
2886
+ function _length(length, params) {
2887
+ return new $ZodCheckLengthEquals({
2888
+ check: "length_equals",
2889
+ ...normalizeParams(params),
2890
+ length
2891
+ });
2892
+ }
2893
+ function _regex(pattern, params) {
2894
+ return new $ZodCheckRegex({
2895
+ check: "string_format",
2896
+ format: "regex",
2897
+ ...normalizeParams(params),
2898
+ pattern
2899
+ });
2900
+ }
2901
+ function _lowercase(params) {
2902
+ return new $ZodCheckLowerCase({
2903
+ check: "string_format",
2904
+ format: "lowercase",
2905
+ ...normalizeParams(params)
2906
+ });
2907
+ }
2908
+ function _uppercase(params) {
2909
+ return new $ZodCheckUpperCase({
2910
+ check: "string_format",
2911
+ format: "uppercase",
2912
+ ...normalizeParams(params)
2913
+ });
2914
+ }
2915
+ function _includes(includes, params) {
2916
+ return new $ZodCheckIncludes({
2917
+ check: "string_format",
2918
+ format: "includes",
2919
+ ...normalizeParams(params),
2920
+ includes
2921
+ });
2922
+ }
2923
+ function _startsWith(prefix, params) {
2924
+ return new $ZodCheckStartsWith({
2925
+ check: "string_format",
2926
+ format: "starts_with",
2927
+ ...normalizeParams(params),
2928
+ prefix
2929
+ });
2930
+ }
2931
+ function _endsWith(suffix, params) {
2932
+ return new $ZodCheckEndsWith({
2933
+ check: "string_format",
2934
+ format: "ends_with",
2935
+ ...normalizeParams(params),
2936
+ suffix
2937
+ });
2938
+ }
2939
+ function _overwrite(tx) {
2940
+ return new $ZodCheckOverwrite({
2941
+ check: "overwrite",
2942
+ tx
2943
+ });
2944
+ }
2945
+ function _normalize(form) {
2946
+ return _overwrite((input)=>input.normalize(form));
2947
+ }
2948
+ function _trim() {
2949
+ return _overwrite((input)=>input.trim());
2950
+ }
2951
+ function _toLowerCase() {
2952
+ return _overwrite((input)=>input.toLowerCase());
2953
+ }
2954
+ function _toUpperCase() {
2955
+ return _overwrite((input)=>input.toUpperCase());
2956
+ }
2957
+ function _array(Class, element, params) {
2958
+ return new Class({
2959
+ type: "array",
2960
+ element,
2961
+ ...normalizeParams(params)
2962
+ });
2963
+ }
2964
+ function _refine(Class, fn, _params) {
2965
+ const schema = new Class({
2966
+ type: "custom",
2967
+ check: "custom",
2968
+ fn: fn,
2969
+ ...normalizeParams(_params)
2970
+ });
2971
+ return schema;
2972
+ }
2973
+ function _superRefine(fn) {
2974
+ const ch = _check((payload)=>{
2975
+ payload.addIssue = (issue)=>{
2976
+ if ("string" == typeof issue) payload.issues.push(util_issue(issue, payload.value, ch._zod.def));
2977
+ else {
2978
+ const _issue = issue;
2979
+ if (_issue.fatal) _issue.continue = false;
2980
+ _issue.code ?? (_issue.code = "custom");
2981
+ _issue.input ?? (_issue.input = payload.value);
2982
+ _issue.inst ?? (_issue.inst = ch);
2983
+ _issue.continue ?? (_issue.continue = !ch._zod.def.abort);
2984
+ payload.issues.push(util_issue(_issue));
2985
+ }
2986
+ };
2987
+ return fn(payload.value, payload);
2988
+ });
2989
+ return ch;
2990
+ }
2991
+ function _check(fn, params) {
2992
+ const ch = new $ZodCheck({
2993
+ check: "custom",
2994
+ ...normalizeParams(params)
2995
+ });
2996
+ ch._zod.check = fn;
2997
+ return ch;
2998
+ }
2999
+ const ZodISODateTime = /*@__PURE__*/ $constructor("ZodISODateTime", (inst, def)=>{
3000
+ $ZodISODateTime.init(inst, def);
3001
+ ZodStringFormat.init(inst, def);
3002
+ });
3003
+ function iso_datetime(params) {
3004
+ return _isoDateTime(ZodISODateTime, params);
3005
+ }
3006
+ const ZodISODate = /*@__PURE__*/ $constructor("ZodISODate", (inst, def)=>{
3007
+ $ZodISODate.init(inst, def);
3008
+ ZodStringFormat.init(inst, def);
3009
+ });
3010
+ function iso_date(params) {
3011
+ return _isoDate(ZodISODate, params);
3012
+ }
3013
+ const ZodISOTime = /*@__PURE__*/ $constructor("ZodISOTime", (inst, def)=>{
3014
+ $ZodISOTime.init(inst, def);
3015
+ ZodStringFormat.init(inst, def);
3016
+ });
3017
+ function iso_time(params) {
3018
+ return _isoTime(ZodISOTime, params);
3019
+ }
3020
+ const ZodISODuration = /*@__PURE__*/ $constructor("ZodISODuration", (inst, def)=>{
3021
+ $ZodISODuration.init(inst, def);
3022
+ ZodStringFormat.init(inst, def);
3023
+ });
3024
+ function iso_duration(params) {
3025
+ return _isoDuration(ZodISODuration, params);
3026
+ }
3027
+ const classic_errors_initializer = (inst, issues)=>{
3028
+ $ZodError.init(inst, issues);
3029
+ inst.name = "ZodError";
3030
+ Object.defineProperties(inst, {
3031
+ format: {
3032
+ value: (mapper)=>formatError(inst, mapper)
3033
+ },
3034
+ flatten: {
3035
+ value: (mapper)=>flattenError(inst, mapper)
3036
+ },
3037
+ addIssue: {
3038
+ value: (issue)=>{
3039
+ inst.issues.push(issue);
3040
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
3041
+ }
3042
+ },
3043
+ addIssues: {
3044
+ value: (issues)=>{
3045
+ inst.issues.push(...issues);
3046
+ inst.message = JSON.stringify(inst.issues, jsonStringifyReplacer, 2);
3047
+ }
3048
+ },
3049
+ isEmpty: {
3050
+ get () {
3051
+ return 0 === inst.issues.length;
3052
+ }
3053
+ }
3054
+ });
3055
+ };
3056
+ $constructor("ZodError", classic_errors_initializer);
3057
+ const ZodRealError = $constructor("ZodError", classic_errors_initializer, {
3058
+ Parent: Error
3059
+ });
3060
+ const classic_parse_parse = /* @__PURE__ */ _parse(ZodRealError);
3061
+ const classic_parse_parseAsync = /* @__PURE__ */ _parseAsync(ZodRealError);
3062
+ const parse_safeParse = /* @__PURE__ */ _safeParse(ZodRealError);
3063
+ const parse_safeParseAsync = /* @__PURE__ */ _safeParseAsync(ZodRealError);
3064
+ const parse_encode = /* @__PURE__ */ _encode(ZodRealError);
3065
+ const parse_decode = /* @__PURE__ */ _decode(ZodRealError);
3066
+ const parse_encodeAsync = /* @__PURE__ */ _encodeAsync(ZodRealError);
3067
+ const parse_decodeAsync = /* @__PURE__ */ _decodeAsync(ZodRealError);
3068
+ const parse_safeEncode = /* @__PURE__ */ _safeEncode(ZodRealError);
3069
+ const parse_safeDecode = /* @__PURE__ */ _safeDecode(ZodRealError);
3070
+ const parse_safeEncodeAsync = /* @__PURE__ */ _safeEncodeAsync(ZodRealError);
3071
+ const parse_safeDecodeAsync = /* @__PURE__ */ _safeDecodeAsync(ZodRealError);
3072
+ const ZodType = /*@__PURE__*/ $constructor("ZodType", (inst, def)=>{
3073
+ $ZodType.init(inst, def);
3074
+ inst.def = def;
3075
+ inst.type = def.type;
3076
+ Object.defineProperty(inst, "_def", {
3077
+ value: def
3078
+ });
3079
+ inst.check = (...checks)=>inst.clone(mergeDefs(def, {
3080
+ checks: [
3081
+ ...def.checks ?? [],
3082
+ ...checks.map((ch)=>"function" == typeof ch ? {
3083
+ _zod: {
3084
+ check: ch,
3085
+ def: {
3086
+ check: "custom"
3087
+ },
3088
+ onattach: []
3089
+ }
3090
+ } : ch)
3091
+ ]
3092
+ }));
3093
+ inst.clone = (def, params)=>clone(inst, def, params);
3094
+ inst.brand = ()=>inst;
3095
+ inst.register = (reg, meta)=>{
3096
+ reg.add(inst, meta);
3097
+ return inst;
3098
+ };
3099
+ inst.parse = (data, params)=>classic_parse_parse(inst, data, params, {
3100
+ callee: inst.parse
3101
+ });
3102
+ inst.safeParse = (data, params)=>parse_safeParse(inst, data, params);
3103
+ inst.parseAsync = async (data, params)=>classic_parse_parseAsync(inst, data, params, {
3104
+ callee: inst.parseAsync
3105
+ });
3106
+ inst.safeParseAsync = async (data, params)=>parse_safeParseAsync(inst, data, params);
3107
+ inst.spa = inst.safeParseAsync;
3108
+ inst.encode = (data, params)=>parse_encode(inst, data, params);
3109
+ inst.decode = (data, params)=>parse_decode(inst, data, params);
3110
+ inst.encodeAsync = async (data, params)=>parse_encodeAsync(inst, data, params);
3111
+ inst.decodeAsync = async (data, params)=>parse_decodeAsync(inst, data, params);
3112
+ inst.safeEncode = (data, params)=>parse_safeEncode(inst, data, params);
3113
+ inst.safeDecode = (data, params)=>parse_safeDecode(inst, data, params);
3114
+ inst.safeEncodeAsync = async (data, params)=>parse_safeEncodeAsync(inst, data, params);
3115
+ inst.safeDecodeAsync = async (data, params)=>parse_safeDecodeAsync(inst, data, params);
3116
+ inst.refine = (check, params)=>inst.check(refine(check, params));
3117
+ inst.superRefine = (refinement)=>inst.check(superRefine(refinement));
3118
+ inst.overwrite = (fn)=>inst.check(_overwrite(fn));
3119
+ inst.optional = ()=>optional(inst);
3120
+ inst.nullable = ()=>nullable(inst);
3121
+ inst.nullish = ()=>optional(nullable(inst));
3122
+ inst.nonoptional = (params)=>nonoptional(inst, params);
3123
+ inst.array = ()=>schemas_array(inst);
3124
+ inst.or = (arg)=>union([
3125
+ inst,
3126
+ arg
3127
+ ]);
3128
+ inst.and = (arg)=>intersection(inst, arg);
3129
+ inst.transform = (tx)=>pipe(inst, transform(tx));
3130
+ inst.default = (def)=>schemas_default(inst, def);
3131
+ inst.prefault = (def)=>prefault(inst, def);
3132
+ inst.catch = (params)=>schemas_catch(inst, params);
3133
+ inst.pipe = (target)=>pipe(inst, target);
3134
+ inst.readonly = ()=>readonly(inst);
3135
+ inst.describe = (description)=>{
3136
+ const cl = inst.clone();
3137
+ globalRegistry.add(cl, {
3138
+ description
3139
+ });
3140
+ return cl;
3141
+ };
3142
+ Object.defineProperty(inst, "description", {
3143
+ get () {
3144
+ return globalRegistry.get(inst)?.description;
3145
+ },
3146
+ configurable: true
3147
+ });
3148
+ inst.meta = (...args)=>{
3149
+ if (0 === args.length) return globalRegistry.get(inst);
3150
+ const cl = inst.clone();
3151
+ globalRegistry.add(cl, args[0]);
3152
+ return cl;
3153
+ };
3154
+ inst.isOptional = ()=>inst.safeParse(void 0).success;
3155
+ inst.isNullable = ()=>inst.safeParse(null).success;
3156
+ return inst;
3157
+ });
3158
+ const _ZodString = /*@__PURE__*/ $constructor("_ZodString", (inst, def)=>{
3159
+ $ZodString.init(inst, def);
3160
+ ZodType.init(inst, def);
3161
+ const bag = inst._zod.bag;
3162
+ inst.format = bag.format ?? null;
3163
+ inst.minLength = bag.minimum ?? null;
3164
+ inst.maxLength = bag.maximum ?? null;
3165
+ inst.regex = (...args)=>inst.check(_regex(...args));
3166
+ inst.includes = (...args)=>inst.check(_includes(...args));
3167
+ inst.startsWith = (...args)=>inst.check(_startsWith(...args));
3168
+ inst.endsWith = (...args)=>inst.check(_endsWith(...args));
3169
+ inst.min = (...args)=>inst.check(_minLength(...args));
3170
+ inst.max = (...args)=>inst.check(_maxLength(...args));
3171
+ inst.length = (...args)=>inst.check(_length(...args));
3172
+ inst.nonempty = (...args)=>inst.check(_minLength(1, ...args));
3173
+ inst.lowercase = (params)=>inst.check(_lowercase(params));
3174
+ inst.uppercase = (params)=>inst.check(_uppercase(params));
3175
+ inst.trim = ()=>inst.check(_trim());
3176
+ inst.normalize = (...args)=>inst.check(_normalize(...args));
3177
+ inst.toLowerCase = ()=>inst.check(_toLowerCase());
3178
+ inst.toUpperCase = ()=>inst.check(_toUpperCase());
3179
+ });
3180
+ const ZodString = /*@__PURE__*/ $constructor("ZodString", (inst, def)=>{
3181
+ $ZodString.init(inst, def);
3182
+ _ZodString.init(inst, def);
3183
+ inst.email = (params)=>inst.check(_email(ZodEmail, params));
3184
+ inst.url = (params)=>inst.check(_url(ZodURL, params));
3185
+ inst.jwt = (params)=>inst.check(_jwt(ZodJWT, params));
3186
+ inst.emoji = (params)=>inst.check(api_emoji(ZodEmoji, params));
3187
+ inst.guid = (params)=>inst.check(_guid(ZodGUID, params));
3188
+ inst.uuid = (params)=>inst.check(_uuid(ZodUUID, params));
3189
+ inst.uuidv4 = (params)=>inst.check(_uuidv4(ZodUUID, params));
3190
+ inst.uuidv6 = (params)=>inst.check(_uuidv6(ZodUUID, params));
3191
+ inst.uuidv7 = (params)=>inst.check(_uuidv7(ZodUUID, params));
3192
+ inst.nanoid = (params)=>inst.check(_nanoid(ZodNanoID, params));
3193
+ inst.guid = (params)=>inst.check(_guid(ZodGUID, params));
3194
+ inst.cuid = (params)=>inst.check(_cuid(ZodCUID, params));
3195
+ inst.cuid2 = (params)=>inst.check(_cuid2(ZodCUID2, params));
3196
+ inst.ulid = (params)=>inst.check(_ulid(ZodULID, params));
3197
+ inst.base64 = (params)=>inst.check(_base64(ZodBase64, params));
3198
+ inst.base64url = (params)=>inst.check(_base64url(ZodBase64URL, params));
3199
+ inst.xid = (params)=>inst.check(_xid(ZodXID, params));
3200
+ inst.ksuid = (params)=>inst.check(_ksuid(ZodKSUID, params));
3201
+ inst.ipv4 = (params)=>inst.check(_ipv4(ZodIPv4, params));
3202
+ inst.ipv6 = (params)=>inst.check(_ipv6(ZodIPv6, params));
3203
+ inst.cidrv4 = (params)=>inst.check(_cidrv4(ZodCIDRv4, params));
3204
+ inst.cidrv6 = (params)=>inst.check(_cidrv6(ZodCIDRv6, params));
3205
+ inst.e164 = (params)=>inst.check(_e164(ZodE164, params));
3206
+ inst.datetime = (params)=>inst.check(iso_datetime(params));
3207
+ inst.date = (params)=>inst.check(iso_date(params));
3208
+ inst.time = (params)=>inst.check(iso_time(params));
3209
+ inst.duration = (params)=>inst.check(iso_duration(params));
3210
+ });
3211
+ function schemas_string(params) {
3212
+ return _string(ZodString, params);
3213
+ }
3214
+ const ZodStringFormat = /*@__PURE__*/ $constructor("ZodStringFormat", (inst, def)=>{
3215
+ $ZodStringFormat.init(inst, def);
3216
+ _ZodString.init(inst, def);
3217
+ });
3218
+ const ZodEmail = /*@__PURE__*/ $constructor("ZodEmail", (inst, def)=>{
3219
+ $ZodEmail.init(inst, def);
3220
+ ZodStringFormat.init(inst, def);
3221
+ });
3222
+ const ZodGUID = /*@__PURE__*/ $constructor("ZodGUID", (inst, def)=>{
3223
+ $ZodGUID.init(inst, def);
3224
+ ZodStringFormat.init(inst, def);
3225
+ });
3226
+ const ZodUUID = /*@__PURE__*/ $constructor("ZodUUID", (inst, def)=>{
3227
+ $ZodUUID.init(inst, def);
3228
+ ZodStringFormat.init(inst, def);
3229
+ });
3230
+ const ZodURL = /*@__PURE__*/ $constructor("ZodURL", (inst, def)=>{
3231
+ $ZodURL.init(inst, def);
3232
+ ZodStringFormat.init(inst, def);
3233
+ });
3234
+ const ZodEmoji = /*@__PURE__*/ $constructor("ZodEmoji", (inst, def)=>{
3235
+ $ZodEmoji.init(inst, def);
3236
+ ZodStringFormat.init(inst, def);
3237
+ });
3238
+ const ZodNanoID = /*@__PURE__*/ $constructor("ZodNanoID", (inst, def)=>{
3239
+ $ZodNanoID.init(inst, def);
3240
+ ZodStringFormat.init(inst, def);
3241
+ });
3242
+ const ZodCUID = /*@__PURE__*/ $constructor("ZodCUID", (inst, def)=>{
3243
+ $ZodCUID.init(inst, def);
3244
+ ZodStringFormat.init(inst, def);
3245
+ });
3246
+ const ZodCUID2 = /*@__PURE__*/ $constructor("ZodCUID2", (inst, def)=>{
3247
+ $ZodCUID2.init(inst, def);
3248
+ ZodStringFormat.init(inst, def);
3249
+ });
3250
+ const ZodULID = /*@__PURE__*/ $constructor("ZodULID", (inst, def)=>{
3251
+ $ZodULID.init(inst, def);
3252
+ ZodStringFormat.init(inst, def);
3253
+ });
3254
+ const ZodXID = /*@__PURE__*/ $constructor("ZodXID", (inst, def)=>{
3255
+ $ZodXID.init(inst, def);
3256
+ ZodStringFormat.init(inst, def);
3257
+ });
3258
+ const ZodKSUID = /*@__PURE__*/ $constructor("ZodKSUID", (inst, def)=>{
3259
+ $ZodKSUID.init(inst, def);
3260
+ ZodStringFormat.init(inst, def);
3261
+ });
3262
+ const ZodIPv4 = /*@__PURE__*/ $constructor("ZodIPv4", (inst, def)=>{
3263
+ $ZodIPv4.init(inst, def);
3264
+ ZodStringFormat.init(inst, def);
3265
+ });
3266
+ const ZodIPv6 = /*@__PURE__*/ $constructor("ZodIPv6", (inst, def)=>{
3267
+ $ZodIPv6.init(inst, def);
3268
+ ZodStringFormat.init(inst, def);
3269
+ });
3270
+ const ZodCIDRv4 = /*@__PURE__*/ $constructor("ZodCIDRv4", (inst, def)=>{
3271
+ $ZodCIDRv4.init(inst, def);
3272
+ ZodStringFormat.init(inst, def);
3273
+ });
3274
+ const ZodCIDRv6 = /*@__PURE__*/ $constructor("ZodCIDRv6", (inst, def)=>{
3275
+ $ZodCIDRv6.init(inst, def);
3276
+ ZodStringFormat.init(inst, def);
3277
+ });
3278
+ const ZodBase64 = /*@__PURE__*/ $constructor("ZodBase64", (inst, def)=>{
3279
+ $ZodBase64.init(inst, def);
3280
+ ZodStringFormat.init(inst, def);
3281
+ });
3282
+ const ZodBase64URL = /*@__PURE__*/ $constructor("ZodBase64URL", (inst, def)=>{
3283
+ $ZodBase64URL.init(inst, def);
3284
+ ZodStringFormat.init(inst, def);
3285
+ });
3286
+ const ZodE164 = /*@__PURE__*/ $constructor("ZodE164", (inst, def)=>{
3287
+ $ZodE164.init(inst, def);
3288
+ ZodStringFormat.init(inst, def);
3289
+ });
3290
+ const ZodJWT = /*@__PURE__*/ $constructor("ZodJWT", (inst, def)=>{
3291
+ $ZodJWT.init(inst, def);
3292
+ ZodStringFormat.init(inst, def);
3293
+ });
3294
+ const ZodNumber = /*@__PURE__*/ $constructor("ZodNumber", (inst, def)=>{
3295
+ $ZodNumber.init(inst, def);
3296
+ ZodType.init(inst, def);
3297
+ inst.gt = (value, params)=>inst.check(_gt(value, params));
3298
+ inst.gte = (value, params)=>inst.check(_gte(value, params));
3299
+ inst.min = (value, params)=>inst.check(_gte(value, params));
3300
+ inst.lt = (value, params)=>inst.check(_lt(value, params));
3301
+ inst.lte = (value, params)=>inst.check(_lte(value, params));
3302
+ inst.max = (value, params)=>inst.check(_lte(value, params));
3303
+ inst.int = (params)=>inst.check(schemas_int(params));
3304
+ inst.safe = (params)=>inst.check(schemas_int(params));
3305
+ inst.positive = (params)=>inst.check(_gt(0, params));
3306
+ inst.nonnegative = (params)=>inst.check(_gte(0, params));
3307
+ inst.negative = (params)=>inst.check(_lt(0, params));
3308
+ inst.nonpositive = (params)=>inst.check(_lte(0, params));
3309
+ inst.multipleOf = (value, params)=>inst.check(_multipleOf(value, params));
3310
+ inst.step = (value, params)=>inst.check(_multipleOf(value, params));
3311
+ inst.finite = ()=>inst;
3312
+ const bag = inst._zod.bag;
3313
+ inst.minValue = Math.max(bag.minimum ?? Number.NEGATIVE_INFINITY, bag.exclusiveMinimum ?? Number.NEGATIVE_INFINITY) ?? null;
3314
+ inst.maxValue = Math.min(bag.maximum ?? Number.POSITIVE_INFINITY, bag.exclusiveMaximum ?? Number.POSITIVE_INFINITY) ?? null;
3315
+ inst.isInt = (bag.format ?? "").includes("int") || Number.isSafeInteger(bag.multipleOf ?? 0.5);
3316
+ inst.isFinite = true;
3317
+ inst.format = bag.format ?? null;
3318
+ });
3319
+ function schemas_number(params) {
3320
+ return _number(ZodNumber, params);
3321
+ }
3322
+ const ZodNumberFormat = /*@__PURE__*/ $constructor("ZodNumberFormat", (inst, def)=>{
3323
+ $ZodNumberFormat.init(inst, def);
3324
+ ZodNumber.init(inst, def);
3325
+ });
3326
+ function schemas_int(params) {
3327
+ return _int(ZodNumberFormat, params);
3328
+ }
3329
+ const ZodBoolean = /*@__PURE__*/ $constructor("ZodBoolean", (inst, def)=>{
3330
+ $ZodBoolean.init(inst, def);
3331
+ ZodType.init(inst, def);
3332
+ });
3333
+ function schemas_boolean(params) {
3334
+ return _boolean(ZodBoolean, params);
3335
+ }
3336
+ const ZodUnknown = /*@__PURE__*/ $constructor("ZodUnknown", (inst, def)=>{
3337
+ $ZodUnknown.init(inst, def);
3338
+ ZodType.init(inst, def);
3339
+ });
3340
+ function unknown() {
3341
+ return _unknown(ZodUnknown);
3342
+ }
3343
+ const ZodNever = /*@__PURE__*/ $constructor("ZodNever", (inst, def)=>{
3344
+ $ZodNever.init(inst, def);
3345
+ ZodType.init(inst, def);
3346
+ });
3347
+ function never(params) {
3348
+ return _never(ZodNever, params);
3349
+ }
3350
+ const ZodArray = /*@__PURE__*/ $constructor("ZodArray", (inst, def)=>{
3351
+ $ZodArray.init(inst, def);
3352
+ ZodType.init(inst, def);
3353
+ inst.element = def.element;
3354
+ inst.min = (minLength, params)=>inst.check(_minLength(minLength, params));
3355
+ inst.nonempty = (params)=>inst.check(_minLength(1, params));
3356
+ inst.max = (maxLength, params)=>inst.check(_maxLength(maxLength, params));
3357
+ inst.length = (len, params)=>inst.check(_length(len, params));
3358
+ inst.unwrap = ()=>inst.element;
3359
+ });
3360
+ function schemas_array(element, params) {
3361
+ return _array(ZodArray, element, params);
3362
+ }
3363
+ const ZodObject = /*@__PURE__*/ $constructor("ZodObject", (inst, def)=>{
3364
+ $ZodObjectJIT.init(inst, def);
3365
+ ZodType.init(inst, def);
3366
+ defineLazy(inst, "shape", ()=>def.shape);
3367
+ inst.keyof = ()=>schemas_enum(Object.keys(inst._zod.def.shape));
3368
+ inst.catchall = (catchall)=>inst.clone({
3369
+ ...inst._zod.def,
3370
+ catchall: catchall
3371
+ });
3372
+ inst.passthrough = ()=>inst.clone({
3373
+ ...inst._zod.def,
3374
+ catchall: unknown()
3375
+ });
3376
+ inst.loose = ()=>inst.clone({
3377
+ ...inst._zod.def,
3378
+ catchall: unknown()
3379
+ });
3380
+ inst.strict = ()=>inst.clone({
3381
+ ...inst._zod.def,
3382
+ catchall: never()
3383
+ });
3384
+ inst.strip = ()=>inst.clone({
3385
+ ...inst._zod.def,
3386
+ catchall: void 0
3387
+ });
3388
+ inst.extend = (incoming)=>extend(inst, incoming);
3389
+ inst.safeExtend = (incoming)=>safeExtend(inst, incoming);
3390
+ inst.merge = (other)=>merge(inst, other);
3391
+ inst.pick = (mask)=>pick(inst, mask);
3392
+ inst.omit = (mask)=>omit(inst, mask);
3393
+ inst.partial = (...args)=>partial(ZodOptional, inst, args[0]);
3394
+ inst.required = (...args)=>required(ZodNonOptional, inst, args[0]);
3395
+ });
3396
+ function schemas_object(shape, params) {
3397
+ const def = {
3398
+ type: "object",
3399
+ shape: shape ?? {},
3400
+ ...normalizeParams(params)
3401
+ };
3402
+ return new ZodObject(def);
3403
+ }
3404
+ const ZodUnion = /*@__PURE__*/ $constructor("ZodUnion", (inst, def)=>{
3405
+ $ZodUnion.init(inst, def);
3406
+ ZodType.init(inst, def);
3407
+ inst.options = def.options;
3408
+ });
3409
+ function union(options, params) {
3410
+ return new ZodUnion({
3411
+ type: "union",
3412
+ options: options,
3413
+ ...normalizeParams(params)
3414
+ });
3415
+ }
3416
+ const ZodIntersection = /*@__PURE__*/ $constructor("ZodIntersection", (inst, def)=>{
3417
+ $ZodIntersection.init(inst, def);
3418
+ ZodType.init(inst, def);
3419
+ });
3420
+ function intersection(left, right) {
3421
+ return new ZodIntersection({
3422
+ type: "intersection",
3423
+ left: left,
3424
+ right: right
3425
+ });
3426
+ }
3427
+ const ZodEnum = /*@__PURE__*/ $constructor("ZodEnum", (inst, def)=>{
3428
+ $ZodEnum.init(inst, def);
3429
+ ZodType.init(inst, def);
3430
+ inst.enum = def.entries;
3431
+ inst.options = Object.values(def.entries);
3432
+ const keys = new Set(Object.keys(def.entries));
3433
+ inst.extract = (values, params)=>{
3434
+ const newEntries = {};
3435
+ for (const value of values)if (keys.has(value)) newEntries[value] = def.entries[value];
3436
+ else throw new Error(`Key ${value} not found in enum`);
3437
+ return new ZodEnum({
3438
+ ...def,
3439
+ checks: [],
3440
+ ...normalizeParams(params),
3441
+ entries: newEntries
3442
+ });
3443
+ };
3444
+ inst.exclude = (values, params)=>{
3445
+ const newEntries = {
3446
+ ...def.entries
3447
+ };
3448
+ for (const value of values)if (keys.has(value)) delete newEntries[value];
3449
+ else throw new Error(`Key ${value} not found in enum`);
3450
+ return new ZodEnum({
3451
+ ...def,
3452
+ checks: [],
3453
+ ...normalizeParams(params),
3454
+ entries: newEntries
3455
+ });
3456
+ };
3457
+ });
3458
+ function schemas_enum(values, params) {
3459
+ const entries = Array.isArray(values) ? Object.fromEntries(values.map((v)=>[
3460
+ v,
3461
+ v
3462
+ ])) : values;
3463
+ return new ZodEnum({
3464
+ type: "enum",
3465
+ entries,
3466
+ ...normalizeParams(params)
3467
+ });
3468
+ }
3469
+ const ZodTransform = /*@__PURE__*/ $constructor("ZodTransform", (inst, def)=>{
3470
+ $ZodTransform.init(inst, def);
3471
+ ZodType.init(inst, def);
3472
+ inst._zod.parse = (payload, _ctx)=>{
3473
+ if ("backward" === _ctx.direction) throw new $ZodEncodeError(inst.constructor.name);
3474
+ payload.addIssue = (issue)=>{
3475
+ if ("string" == typeof issue) payload.issues.push(util_issue(issue, payload.value, def));
3476
+ else {
3477
+ const _issue = issue;
3478
+ if (_issue.fatal) _issue.continue = false;
3479
+ _issue.code ?? (_issue.code = "custom");
3480
+ _issue.input ?? (_issue.input = payload.value);
3481
+ _issue.inst ?? (_issue.inst = inst);
3482
+ payload.issues.push(util_issue(_issue));
3483
+ }
3484
+ };
3485
+ const output = def.transform(payload.value, payload);
3486
+ if (output instanceof Promise) return output.then((output)=>{
3487
+ payload.value = output;
3488
+ return payload;
3489
+ });
3490
+ payload.value = output;
3491
+ return payload;
3492
+ };
3493
+ });
3494
+ function transform(fn) {
3495
+ return new ZodTransform({
3496
+ type: "transform",
3497
+ transform: fn
3498
+ });
3499
+ }
3500
+ const ZodOptional = /*@__PURE__*/ $constructor("ZodOptional", (inst, def)=>{
3501
+ $ZodOptional.init(inst, def);
3502
+ ZodType.init(inst, def);
3503
+ inst.unwrap = ()=>inst._zod.def.innerType;
3504
+ });
3505
+ function optional(innerType) {
3506
+ return new ZodOptional({
3507
+ type: "optional",
3508
+ innerType: innerType
3509
+ });
3510
+ }
3511
+ const ZodNullable = /*@__PURE__*/ $constructor("ZodNullable", (inst, def)=>{
3512
+ $ZodNullable.init(inst, def);
3513
+ ZodType.init(inst, def);
3514
+ inst.unwrap = ()=>inst._zod.def.innerType;
3515
+ });
3516
+ function nullable(innerType) {
3517
+ return new ZodNullable({
3518
+ type: "nullable",
3519
+ innerType: innerType
3520
+ });
3521
+ }
3522
+ const ZodDefault = /*@__PURE__*/ $constructor("ZodDefault", (inst, def)=>{
3523
+ $ZodDefault.init(inst, def);
3524
+ ZodType.init(inst, def);
3525
+ inst.unwrap = ()=>inst._zod.def.innerType;
3526
+ inst.removeDefault = inst.unwrap;
3527
+ });
3528
+ function schemas_default(innerType, defaultValue) {
3529
+ return new ZodDefault({
3530
+ type: "default",
3531
+ innerType: innerType,
3532
+ get defaultValue () {
3533
+ return "function" == typeof defaultValue ? defaultValue() : shallowClone(defaultValue);
3534
+ }
3535
+ });
3536
+ }
3537
+ const ZodPrefault = /*@__PURE__*/ $constructor("ZodPrefault", (inst, def)=>{
3538
+ $ZodPrefault.init(inst, def);
3539
+ ZodType.init(inst, def);
3540
+ inst.unwrap = ()=>inst._zod.def.innerType;
3541
+ });
3542
+ function prefault(innerType, defaultValue) {
3543
+ return new ZodPrefault({
3544
+ type: "prefault",
3545
+ innerType: innerType,
3546
+ get defaultValue () {
3547
+ return "function" == typeof defaultValue ? defaultValue() : shallowClone(defaultValue);
3548
+ }
3549
+ });
3550
+ }
3551
+ const ZodNonOptional = /*@__PURE__*/ $constructor("ZodNonOptional", (inst, def)=>{
3552
+ $ZodNonOptional.init(inst, def);
3553
+ ZodType.init(inst, def);
3554
+ inst.unwrap = ()=>inst._zod.def.innerType;
3555
+ });
3556
+ function nonoptional(innerType, params) {
3557
+ return new ZodNonOptional({
3558
+ type: "nonoptional",
3559
+ innerType: innerType,
3560
+ ...normalizeParams(params)
3561
+ });
3562
+ }
3563
+ const ZodCatch = /*@__PURE__*/ $constructor("ZodCatch", (inst, def)=>{
3564
+ $ZodCatch.init(inst, def);
3565
+ ZodType.init(inst, def);
3566
+ inst.unwrap = ()=>inst._zod.def.innerType;
3567
+ inst.removeCatch = inst.unwrap;
3568
+ });
3569
+ function schemas_catch(innerType, catchValue) {
3570
+ return new ZodCatch({
3571
+ type: "catch",
3572
+ innerType: innerType,
3573
+ catchValue: "function" == typeof catchValue ? catchValue : ()=>catchValue
3574
+ });
3575
+ }
3576
+ const ZodPipe = /*@__PURE__*/ $constructor("ZodPipe", (inst, def)=>{
3577
+ $ZodPipe.init(inst, def);
3578
+ ZodType.init(inst, def);
3579
+ inst.in = def.in;
3580
+ inst.out = def.out;
3581
+ });
3582
+ function pipe(in_, out) {
3583
+ return new ZodPipe({
3584
+ type: "pipe",
3585
+ in: in_,
3586
+ out: out
3587
+ });
3588
+ }
3589
+ const ZodReadonly = /*@__PURE__*/ $constructor("ZodReadonly", (inst, def)=>{
3590
+ $ZodReadonly.init(inst, def);
3591
+ ZodType.init(inst, def);
3592
+ inst.unwrap = ()=>inst._zod.def.innerType;
3593
+ });
3594
+ function readonly(innerType) {
3595
+ return new ZodReadonly({
3596
+ type: "readonly",
3597
+ innerType: innerType
3598
+ });
3599
+ }
3600
+ const ZodCustom = /*@__PURE__*/ $constructor("ZodCustom", (inst, def)=>{
3601
+ $ZodCustom.init(inst, def);
3602
+ ZodType.init(inst, def);
3603
+ });
3604
+ function refine(fn, _params = {}) {
3605
+ return _refine(ZodCustom, fn, _params);
3606
+ }
3607
+ function superRefine(fn) {
3608
+ return _superRefine(fn);
3609
+ }
3610
+ var compat_ZodFirstPartyTypeKind;
3611
+ compat_ZodFirstPartyTypeKind || (compat_ZodFirstPartyTypeKind = {});
3612
+ core_config(en());
3613
+ const CookieBaseSchema = schemas_object({
3614
+ domain: schemas_string().optional(),
3615
+ path: schemas_string().optional(),
3616
+ expires: schemas_number().optional(),
3617
+ httpOnly: schemas_boolean().optional(),
3618
+ secure: schemas_boolean().optional(),
3619
+ session: schemas_boolean().optional()
3620
+ });
3621
+ const CookieSchema = CookieBaseSchema.extend({
3622
+ url: schemas_string(),
3623
+ name: schemas_string().optional(),
3624
+ value: schemas_string().optional(),
3625
+ sameSite: schemas_enum([
3626
+ 'unspecified',
3627
+ 'no_restriction',
3628
+ 'lax',
3629
+ 'strict'
3630
+ ]).optional()
3631
+ });
3632
+ const CDPSameSite = schemas_enum([
3633
+ "Strict",
3634
+ "Lax",
3635
+ "None"
3636
+ ]);
3637
+ const CDPCookiePriority = schemas_enum([
3638
+ "Low",
3639
+ "Medium",
3640
+ "High"
3641
+ ]);
3642
+ const CDPSourceScheme = schemas_enum([
3643
+ "Unset",
3644
+ "NonSecure",
3645
+ "Secure"
3646
+ ]);
3647
+ const CDPCookieSchema = CookieBaseSchema.extend({
3648
+ name: schemas_string(),
3649
+ value: schemas_string(),
3650
+ url: schemas_string().optional(),
3651
+ sameSite: CDPSameSite.optional(),
3652
+ size: schemas_number().optional(),
3653
+ partitionKey: schemas_object({
3654
+ topLevelSite: schemas_string(),
3655
+ hasCrossSiteAncestor: schemas_boolean()
3656
+ }).optional(),
3657
+ priority: CDPCookiePriority.optional(),
3658
+ sameParty: schemas_boolean().optional(),
3659
+ sourceScheme: CDPSourceScheme.optional(),
3660
+ sourcePort: schemas_number().optional()
3661
+ });
3662
+ var types_TaskState = /*#__PURE__*/ function(TaskState) {
3663
+ TaskState["INIT"] = "INIT";
3664
+ TaskState["ACTION"] = "ACTION";
3665
+ TaskState["WAIT_SCAN"] = "WAIT_SCAN";
3666
+ TaskState["SCANNED"] = "SCANNED";
3667
+ TaskState["CONFIRMED"] = "CONFIRMED";
3668
+ TaskState["SUCCESS"] = "SUCCESS";
3669
+ TaskState["FAILED"] = "FAILED";
3670
+ TaskState["TIMEOUT"] = "TIMEOUT";
3671
+ return TaskState;
3672
+ }({});
271
3673
  var __webpack_export_target__ = exports;
272
3674
  for(var __webpack_i__ in __webpack_exports__)__webpack_export_target__[__webpack_i__] = __webpack_exports__[__webpack_i__];
273
3675
  if (__webpack_exports__.__esModule) Object.defineProperty(__webpack_export_target__, '__esModule', {