@wise/dynamic-flow-client 2.9.0-beta-8dbf7a.29 → 2.9.1
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/build/main.js +332 -1986
- package/build/main.min.js +1 -1
- package/build/types/{legacy/common/contexts → common}/httpClientContext/HttpClientContext.d.ts +1 -1
- package/build/types/common/httpClientContext/index.d.ts +1 -0
- package/build/types/common/messages/persist-async.messages.d.ts +8 -0
- package/build/types/common/utils/api-utils.d.ts +1 -0
- package/build/types/legacy/common/contexts/index.d.ts +0 -1
- package/build/types/legacy/common/contexts/logContext/LogContext.d.ts +1 -1
- package/build/types/legacy/common/utils/api-utils.d.ts +0 -1
- package/build/types/legacy/formControl/FormControl.d.ts +3 -2
- package/build/types/legacy/jsonSchemaForm/JsonSchemaForm.d.ts +1 -0
- package/build/types/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.d.ts +1 -1
- package/build/types/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.d.ts +2 -1
- package/build/types/revamp/domain/components/AllOfComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/BooleanInputComponent.d.ts +3 -1
- package/build/types/revamp/domain/components/DateInputComponent.d.ts +3 -1
- package/build/types/revamp/domain/components/HeadingComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/ImageComponent.d.ts +9 -0
- package/build/types/revamp/domain/components/InstructionsComponent.d.ts +11 -0
- package/build/types/revamp/domain/components/IntegerInputComponent.d.ts +3 -1
- package/build/types/revamp/domain/components/LoadingIndicatorComponent.d.ts +8 -0
- package/build/types/revamp/domain/components/MarkdownComponent.d.ts +7 -0
- package/build/types/revamp/domain/components/ModalComponent.d.ts +12 -0
- package/build/types/revamp/domain/components/NumberInputComponent.d.ts +3 -1
- package/build/types/revamp/domain/components/ObjectComponent.d.ts +1 -1
- package/build/types/revamp/domain/components/ReviewComponent.d.ts +17 -0
- package/build/types/revamp/domain/components/SelectInputComponent.d.ts +3 -1
- package/build/types/revamp/domain/components/StatusListComponent.d.ts +8 -0
- package/build/types/revamp/domain/components/TextInputComponent.d.ts +3 -1
- package/build/types/revamp/domain/components/UploadInputComponent.d.ts +3 -1
- package/build/types/revamp/domain/components/repeatableComponent/RepeatableComponent.d.ts +2 -2
- package/build/types/revamp/domain/features/persistAsync/getComponentPersistAsync.d.ts +15 -0
- package/build/types/revamp/domain/features/persistAsync/getPerformPersistAsync.d.ts +22 -0
- package/build/types/revamp/domain/features/persistAsync/persist-async-utils.d.ts +2 -0
- package/build/types/revamp/domain/features/validation/spec-utils.d.ts +1 -0
- package/build/types/revamp/domain/features/validation/validation-functions.d.ts +7 -0
- package/build/types/revamp/domain/mappers/layout/imageLayoutToComponent.d.ts +2 -0
- package/build/types/revamp/domain/mappers/layout/infoLayoutToComponent.d.ts +2 -0
- package/build/types/revamp/domain/mappers/layout/instructionsLayoutToComponent.d.ts +2 -0
- package/build/types/revamp/domain/mappers/layout/listLayoutToComponent.d.ts +2 -0
- package/build/types/revamp/domain/mappers/layout/loadingIndicatorLayoutToComponent.d.ts +2 -0
- package/build/types/revamp/domain/mappers/layout/markdownLayoutToComponent.d.ts +2 -0
- package/build/types/revamp/domain/mappers/layout/modalLayoutToComponent.d.ts +3 -0
- package/build/types/revamp/domain/mappers/layout/reviewLayoutToComponent.d.ts +3 -0
- package/build/types/revamp/domain/mappers/layout/statusListLayoutToComponent.d.ts +2 -0
- package/build/types/revamp/domain/mappers/schema/hiddenSchemaToComponent.d.ts +7 -0
- package/build/types/revamp/domain/mappers/schema/tests/test-utils.d.ts +1 -0
- package/build/types/revamp/domain/mappers/schema/types.d.ts +2 -1
- package/build/types/revamp/domain/mappers/schema/utils/mapCommonSchemaProps.d.ts +14 -13
- package/build/types/revamp/domain/mappers/types.d.ts +3 -0
- package/build/types/revamp/domain/types.d.ts +18 -3
- package/build/types/revamp/renderers/mappers/dividerComponentToProps.d.ts +1 -1
- package/build/types/revamp/renderers/mappers/imageComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/mappers/instructionsComponentToProps.d.ts +8 -0
- package/build/types/revamp/renderers/mappers/loadingIndicatorComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/mappers/markdownComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/mappers/modalComponentToProps.d.ts +4 -0
- package/build/types/revamp/renderers/mappers/reviewComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/mappers/statusListComponentToProps.d.ts +3 -0
- package/build/types/revamp/renderers/types.d.ts +60 -2
- package/build/types/revamp/utils/{getSubmittableData.d.ts → component-utils.d.ts} +1 -0
- package/build/types/revamp/utils/type-utils.d.ts +10 -1
- package/build/types/revamp/wise/renderers/ImageRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/InstructionsRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/LoadingIndicatorRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/MarkdownRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/ModalRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/ReviewRenderer.d.ts +3 -0
- package/build/types/revamp/wise/renderers/StatusListRenderer.d.ts +4 -0
- package/build/types/revamp/wise/renderers/components/Help.d.ts +4 -0
- package/build/types/test-utils/fetch-utils.d.ts +2 -2
- package/package.json +25 -25
- package/build/types/legacy/jsonSchemaForm/persistAsyncSchema/PersistAsyncSchema.messages.d.ts +0 -8
- package/build/types/revamp/domain/features/validation/getModelValidationErrors.d.ts +0 -5
- package/build/types/revamp/domain/features/validation/validateComponents.d.ts +0 -2
- package/build/types/revamp/domain/validation/validation-functions.d.ts +0 -7
- /package/build/types/revamp/{domain/mappers/utils → utils}/type-validators.d.ts +0 -0
package/build/main.js
CHANGED
|
@@ -22,6 +22,18 @@ var __spreadValues = (a, b) => {
|
|
|
22
22
|
return a;
|
|
23
23
|
};
|
|
24
24
|
var __spreadProps = (a, b) => __defProps(a, __getOwnPropDescs(b));
|
|
25
|
+
var __objRest = (source, exclude) => {
|
|
26
|
+
var target = {};
|
|
27
|
+
for (var prop in source)
|
|
28
|
+
if (__hasOwnProp.call(source, prop) && exclude.indexOf(prop) < 0)
|
|
29
|
+
target[prop] = source[prop];
|
|
30
|
+
if (source != null && __getOwnPropSymbols)
|
|
31
|
+
for (var prop of __getOwnPropSymbols(source)) {
|
|
32
|
+
if (exclude.indexOf(prop) < 0 && __propIsEnum.call(source, prop))
|
|
33
|
+
target[prop] = source[prop];
|
|
34
|
+
}
|
|
35
|
+
return target;
|
|
36
|
+
};
|
|
25
37
|
var __commonJS = (cb, mod) => function __require() {
|
|
26
38
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
27
39
|
};
|
|
@@ -643,1731 +655,62 @@ var require_screenfull = __commonJS({
|
|
|
643
655
|
}
|
|
644
656
|
}.bind(this));
|
|
645
657
|
},
|
|
646
|
-
toggle: function(element, options) {
|
|
647
|
-
return this.isFullscreen ? this.exit() : this.request(element, options);
|
|
648
|
-
},
|
|
649
|
-
onchange: function(callback) {
|
|
650
|
-
this.on("change", callback);
|
|
651
|
-
},
|
|
652
|
-
onerror: function(callback) {
|
|
653
|
-
this.on("error", callback);
|
|
654
|
-
},
|
|
655
|
-
on: function(event, callback) {
|
|
656
|
-
var eventName = eventNameMap[event];
|
|
657
|
-
if (eventName) {
|
|
658
|
-
document2.addEventListener(eventName, callback, false);
|
|
659
|
-
}
|
|
660
|
-
},
|
|
661
|
-
off: function(event, callback) {
|
|
662
|
-
var eventName = eventNameMap[event];
|
|
663
|
-
if (eventName) {
|
|
664
|
-
document2.removeEventListener(eventName, callback, false);
|
|
665
|
-
}
|
|
666
|
-
},
|
|
667
|
-
raw: fn
|
|
668
|
-
};
|
|
669
|
-
if (!fn) {
|
|
670
|
-
if (isCommonjs) {
|
|
671
|
-
module2.exports = { isEnabled: false };
|
|
672
|
-
} else {
|
|
673
|
-
window.screenfull = { isEnabled: false };
|
|
674
|
-
}
|
|
675
|
-
return;
|
|
676
|
-
}
|
|
677
|
-
Object.defineProperties(screenfull2, {
|
|
678
|
-
isFullscreen: {
|
|
679
|
-
get: function() {
|
|
680
|
-
return Boolean(document2[fn.fullscreenElement]);
|
|
681
|
-
}
|
|
682
|
-
},
|
|
683
|
-
element: {
|
|
684
|
-
enumerable: true,
|
|
685
|
-
get: function() {
|
|
686
|
-
return document2[fn.fullscreenElement];
|
|
687
|
-
}
|
|
688
|
-
},
|
|
689
|
-
isEnabled: {
|
|
690
|
-
enumerable: true,
|
|
691
|
-
get: function() {
|
|
692
|
-
return Boolean(document2[fn.fullscreenEnabled]);
|
|
693
|
-
}
|
|
694
|
-
}
|
|
695
|
-
});
|
|
696
|
-
if (isCommonjs) {
|
|
697
|
-
module2.exports = screenfull2;
|
|
698
|
-
} else {
|
|
699
|
-
window.screenfull = screenfull2;
|
|
700
|
-
}
|
|
701
|
-
})();
|
|
702
|
-
}
|
|
703
|
-
});
|
|
704
|
-
|
|
705
|
-
// ../types/build/main.min.js
|
|
706
|
-
var require_main_min = __commonJS({
|
|
707
|
-
"../types/build/main.min.js"(exports, module2) {
|
|
708
|
-
"use strict";
|
|
709
|
-
var we = Object.defineProperty;
|
|
710
|
-
var ot = Object.defineProperties;
|
|
711
|
-
var st = Object.getOwnPropertyDescriptor;
|
|
712
|
-
var lt = Object.getOwnPropertyDescriptors;
|
|
713
|
-
var ct = Object.getOwnPropertyNames;
|
|
714
|
-
var Ue = Object.getOwnPropertySymbols;
|
|
715
|
-
var qe = Object.prototype.hasOwnProperty;
|
|
716
|
-
var dt = Object.prototype.propertyIsEnumerable;
|
|
717
|
-
var Be = (n, e, a) => e in n ? we(n, e, { enumerable: true, configurable: true, writable: true, value: a }) : n[e] = a;
|
|
718
|
-
var c = (n, e) => {
|
|
719
|
-
for (var a in e || (e = {}))
|
|
720
|
-
qe.call(e, a) && Be(n, a, e[a]);
|
|
721
|
-
if (Ue)
|
|
722
|
-
for (var a of Ue(e))
|
|
723
|
-
dt.call(e, a) && Be(n, a, e[a]);
|
|
724
|
-
return n;
|
|
725
|
-
};
|
|
726
|
-
var y = (n, e) => ot(n, lt(e));
|
|
727
|
-
var ut = (n, e) => {
|
|
728
|
-
for (var a in e)
|
|
729
|
-
we(n, a, { get: e[a], enumerable: true });
|
|
730
|
-
};
|
|
731
|
-
var pt = (n, e, a, r) => {
|
|
732
|
-
if (e && typeof e == "object" || typeof e == "function")
|
|
733
|
-
for (let i of ct(e))
|
|
734
|
-
!qe.call(n, i) && i !== a && we(n, i, { get: () => e[i], enumerable: !(r = st(e, i)) || r.enumerable });
|
|
735
|
-
return n;
|
|
736
|
-
};
|
|
737
|
-
var ht = (n) => pt(we({}, "__esModule", { value: true }), n);
|
|
738
|
-
var gn = {};
|
|
739
|
-
ut(gn, { actionResponseBodySchema: () => nt, errorResponseBodySchema: () => tt, searchResponseBodySchema: () => rt, stepSchema: () => it });
|
|
740
|
-
module2.exports = ht(gn);
|
|
741
|
-
var S;
|
|
742
|
-
(function(n) {
|
|
743
|
-
n.assertEqual = (i) => i;
|
|
744
|
-
function e(i) {
|
|
745
|
-
}
|
|
746
|
-
n.assertIs = e;
|
|
747
|
-
function a(i) {
|
|
748
|
-
throw new Error();
|
|
749
|
-
}
|
|
750
|
-
n.assertNever = a, n.arrayToEnum = (i) => {
|
|
751
|
-
let o = {};
|
|
752
|
-
for (let s of i)
|
|
753
|
-
o[s] = s;
|
|
754
|
-
return o;
|
|
755
|
-
}, n.getValidEnumValues = (i) => {
|
|
756
|
-
let o = n.objectKeys(i).filter((l) => typeof i[i[l]] != "number"), s = {};
|
|
757
|
-
for (let l of o)
|
|
758
|
-
s[l] = i[l];
|
|
759
|
-
return n.objectValues(s);
|
|
760
|
-
}, n.objectValues = (i) => n.objectKeys(i).map(function(o) {
|
|
761
|
-
return i[o];
|
|
762
|
-
}), n.objectKeys = typeof Object.keys == "function" ? (i) => Object.keys(i) : (i) => {
|
|
763
|
-
let o = [];
|
|
764
|
-
for (let s in i)
|
|
765
|
-
Object.prototype.hasOwnProperty.call(i, s) && o.push(s);
|
|
766
|
-
return o;
|
|
767
|
-
}, n.find = (i, o) => {
|
|
768
|
-
for (let s of i)
|
|
769
|
-
if (o(s))
|
|
770
|
-
return s;
|
|
771
|
-
}, n.isInteger = typeof Number.isInteger == "function" ? (i) => Number.isInteger(i) : (i) => typeof i == "number" && isFinite(i) && Math.floor(i) === i;
|
|
772
|
-
function r(i, o = " | ") {
|
|
773
|
-
return i.map((s) => typeof s == "string" ? `'${s}'` : s).join(o);
|
|
774
|
-
}
|
|
775
|
-
n.joinValues = r, n.jsonStringifyReplacer = (i, o) => typeof o == "bigint" ? o.toString() : o;
|
|
776
|
-
})(S || (S = {}));
|
|
777
|
-
var Me;
|
|
778
|
-
(function(n) {
|
|
779
|
-
n.mergeShapes = (e, a) => c(c({}, e), a);
|
|
780
|
-
})(Me || (Me = {}));
|
|
781
|
-
var p = S.arrayToEnum(["string", "nan", "number", "integer", "float", "boolean", "date", "bigint", "symbol", "function", "undefined", "null", "array", "object", "unknown", "promise", "void", "never", "map", "set"]);
|
|
782
|
-
var B = (n) => {
|
|
783
|
-
switch (typeof n) {
|
|
784
|
-
case "undefined":
|
|
785
|
-
return p.undefined;
|
|
786
|
-
case "string":
|
|
787
|
-
return p.string;
|
|
788
|
-
case "number":
|
|
789
|
-
return isNaN(n) ? p.nan : p.number;
|
|
790
|
-
case "boolean":
|
|
791
|
-
return p.boolean;
|
|
792
|
-
case "function":
|
|
793
|
-
return p.function;
|
|
794
|
-
case "bigint":
|
|
795
|
-
return p.bigint;
|
|
796
|
-
case "symbol":
|
|
797
|
-
return p.symbol;
|
|
798
|
-
case "object":
|
|
799
|
-
return Array.isArray(n) ? p.array : n === null ? p.null : n.then && typeof n.then == "function" && n.catch && typeof n.catch == "function" ? p.promise : typeof Map != "undefined" && n instanceof Map ? p.map : typeof Set != "undefined" && n instanceof Set ? p.set : typeof Date != "undefined" && n instanceof Date ? p.date : p.object;
|
|
800
|
-
default:
|
|
801
|
-
return p.unknown;
|
|
802
|
-
}
|
|
803
|
-
};
|
|
804
|
-
var d = S.arrayToEnum(["invalid_type", "invalid_literal", "custom", "invalid_union", "invalid_union_discriminator", "invalid_enum_value", "unrecognized_keys", "invalid_arguments", "invalid_return_type", "invalid_date", "invalid_string", "too_small", "too_big", "invalid_intersection_types", "not_multiple_of", "not_finite"]);
|
|
805
|
-
var mt = (n) => JSON.stringify(n, null, 2).replace(/"([^"]+)":/g, "$1:");
|
|
806
|
-
var C = class extends Error {
|
|
807
|
-
constructor(e) {
|
|
808
|
-
super(), this.issues = [], this.addIssue = (r) => {
|
|
809
|
-
this.issues = [...this.issues, r];
|
|
810
|
-
}, this.addIssues = (r = []) => {
|
|
811
|
-
this.issues = [...this.issues, ...r];
|
|
812
|
-
};
|
|
813
|
-
let a = new.target.prototype;
|
|
814
|
-
Object.setPrototypeOf ? Object.setPrototypeOf(this, a) : this.__proto__ = a, this.name = "ZodError", this.issues = e;
|
|
815
|
-
}
|
|
816
|
-
get errors() {
|
|
817
|
-
return this.issues;
|
|
818
|
-
}
|
|
819
|
-
format(e) {
|
|
820
|
-
let a = e || function(o) {
|
|
821
|
-
return o.message;
|
|
822
|
-
}, r = { _errors: [] }, i = (o) => {
|
|
823
|
-
for (let s of o.issues)
|
|
824
|
-
if (s.code === "invalid_union")
|
|
825
|
-
s.unionErrors.map(i);
|
|
826
|
-
else if (s.code === "invalid_return_type")
|
|
827
|
-
i(s.returnTypeError);
|
|
828
|
-
else if (s.code === "invalid_arguments")
|
|
829
|
-
i(s.argumentsError);
|
|
830
|
-
else if (s.path.length === 0)
|
|
831
|
-
r._errors.push(a(s));
|
|
832
|
-
else {
|
|
833
|
-
let l = r, m = 0;
|
|
834
|
-
for (; m < s.path.length; ) {
|
|
835
|
-
let u = s.path[m];
|
|
836
|
-
m === s.path.length - 1 ? (l[u] = l[u] || { _errors: [] }, l[u]._errors.push(a(s))) : l[u] = l[u] || { _errors: [] }, l = l[u], m++;
|
|
837
|
-
}
|
|
838
|
-
}
|
|
839
|
-
};
|
|
840
|
-
return i(this), r;
|
|
841
|
-
}
|
|
842
|
-
toString() {
|
|
843
|
-
return this.message;
|
|
844
|
-
}
|
|
845
|
-
get message() {
|
|
846
|
-
return JSON.stringify(this.issues, S.jsonStringifyReplacer, 2);
|
|
847
|
-
}
|
|
848
|
-
get isEmpty() {
|
|
849
|
-
return this.issues.length === 0;
|
|
850
|
-
}
|
|
851
|
-
flatten(e = (a) => a.message) {
|
|
852
|
-
let a = {}, r = [];
|
|
853
|
-
for (let i of this.issues)
|
|
854
|
-
i.path.length > 0 ? (a[i.path[0]] = a[i.path[0]] || [], a[i.path[0]].push(e(i))) : r.push(e(i));
|
|
855
|
-
return { formErrors: r, fieldErrors: a };
|
|
856
|
-
}
|
|
857
|
-
get formErrors() {
|
|
858
|
-
return this.flatten();
|
|
859
|
-
}
|
|
860
|
-
};
|
|
861
|
-
C.create = (n) => new C(n);
|
|
862
|
-
var ve = (n, e) => {
|
|
863
|
-
let a;
|
|
864
|
-
switch (n.code) {
|
|
865
|
-
case d.invalid_type:
|
|
866
|
-
n.received === p.undefined ? a = "Required" : a = `Expected ${n.expected}, received ${n.received}`;
|
|
867
|
-
break;
|
|
868
|
-
case d.invalid_literal:
|
|
869
|
-
a = `Invalid literal value, expected ${JSON.stringify(n.expected, S.jsonStringifyReplacer)}`;
|
|
870
|
-
break;
|
|
871
|
-
case d.unrecognized_keys:
|
|
872
|
-
a = `Unrecognized key(s) in object: ${S.joinValues(n.keys, ", ")}`;
|
|
873
|
-
break;
|
|
874
|
-
case d.invalid_union:
|
|
875
|
-
a = "Invalid input";
|
|
876
|
-
break;
|
|
877
|
-
case d.invalid_union_discriminator:
|
|
878
|
-
a = `Invalid discriminator value. Expected ${S.joinValues(n.options)}`;
|
|
879
|
-
break;
|
|
880
|
-
case d.invalid_enum_value:
|
|
881
|
-
a = `Invalid enum value. Expected ${S.joinValues(n.options)}, received '${n.received}'`;
|
|
882
|
-
break;
|
|
883
|
-
case d.invalid_arguments:
|
|
884
|
-
a = "Invalid function arguments";
|
|
885
|
-
break;
|
|
886
|
-
case d.invalid_return_type:
|
|
887
|
-
a = "Invalid function return type";
|
|
888
|
-
break;
|
|
889
|
-
case d.invalid_date:
|
|
890
|
-
a = "Invalid date";
|
|
891
|
-
break;
|
|
892
|
-
case d.invalid_string:
|
|
893
|
-
typeof n.validation == "object" ? "includes" in n.validation ? (a = `Invalid input: must include "${n.validation.includes}"`, typeof n.validation.position == "number" && (a = `${a} at one or more positions greater than or equal to ${n.validation.position}`)) : "startsWith" in n.validation ? a = `Invalid input: must start with "${n.validation.startsWith}"` : "endsWith" in n.validation ? a = `Invalid input: must end with "${n.validation.endsWith}"` : S.assertNever(n.validation) : n.validation !== "regex" ? a = `Invalid ${n.validation}` : a = "Invalid";
|
|
894
|
-
break;
|
|
895
|
-
case d.too_small:
|
|
896
|
-
n.type === "array" ? a = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "more than"} ${n.minimum} element(s)` : n.type === "string" ? a = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at least" : "over"} ${n.minimum} character(s)` : n.type === "number" ? a = `Number must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${n.minimum}` : n.type === "date" ? a = `Date must be ${n.exact ? "exactly equal to " : n.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(n.minimum))}` : a = "Invalid input";
|
|
897
|
-
break;
|
|
898
|
-
case d.too_big:
|
|
899
|
-
n.type === "array" ? a = `Array must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "less than"} ${n.maximum} element(s)` : n.type === "string" ? a = `String must contain ${n.exact ? "exactly" : n.inclusive ? "at most" : "under"} ${n.maximum} character(s)` : n.type === "number" ? a = `Number must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "bigint" ? a = `BigInt must be ${n.exact ? "exactly" : n.inclusive ? "less than or equal to" : "less than"} ${n.maximum}` : n.type === "date" ? a = `Date must be ${n.exact ? "exactly" : n.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(n.maximum))}` : a = "Invalid input";
|
|
900
|
-
break;
|
|
901
|
-
case d.custom:
|
|
902
|
-
a = "Invalid input";
|
|
903
|
-
break;
|
|
904
|
-
case d.invalid_intersection_types:
|
|
905
|
-
a = "Intersection results could not be merged";
|
|
906
|
-
break;
|
|
907
|
-
case d.not_multiple_of:
|
|
908
|
-
a = `Number must be a multiple of ${n.multipleOf}`;
|
|
909
|
-
break;
|
|
910
|
-
case d.not_finite:
|
|
911
|
-
a = "Number must be finite";
|
|
912
|
-
break;
|
|
913
|
-
default:
|
|
914
|
-
a = e.defaultError, S.assertNever(n);
|
|
915
|
-
}
|
|
916
|
-
return { message: a };
|
|
917
|
-
};
|
|
918
|
-
var Fe = ve;
|
|
919
|
-
function ft(n) {
|
|
920
|
-
Fe = n;
|
|
921
|
-
}
|
|
922
|
-
function je() {
|
|
923
|
-
return Fe;
|
|
924
|
-
}
|
|
925
|
-
var Oe = (n) => {
|
|
926
|
-
let { data: e, path: a, errorMaps: r, issueData: i } = n, o = [...a, ...i.path || []], s = y(c({}, i), { path: o }), l = "", m = r.filter((u) => !!u).slice().reverse();
|
|
927
|
-
for (let u of m)
|
|
928
|
-
l = u(s, { data: e, defaultError: l }).message;
|
|
929
|
-
return y(c({}, i), { path: o, message: i.message || l });
|
|
930
|
-
};
|
|
931
|
-
var gt = [];
|
|
932
|
-
function h(n, e) {
|
|
933
|
-
let a = Oe({ issueData: e, data: n.data, path: n.path, errorMaps: [n.common.contextualErrorMap, n.schemaErrorMap, je(), ve].filter((r) => !!r) });
|
|
934
|
-
n.common.issues.push(a);
|
|
935
|
-
}
|
|
936
|
-
var T = class n {
|
|
937
|
-
constructor() {
|
|
938
|
-
this.value = "valid";
|
|
939
|
-
}
|
|
940
|
-
dirty() {
|
|
941
|
-
this.value === "valid" && (this.value = "dirty");
|
|
942
|
-
}
|
|
943
|
-
abort() {
|
|
944
|
-
this.value !== "aborted" && (this.value = "aborted");
|
|
945
|
-
}
|
|
946
|
-
static mergeArray(e, a) {
|
|
947
|
-
let r = [];
|
|
948
|
-
for (let i of a) {
|
|
949
|
-
if (i.status === "aborted")
|
|
950
|
-
return v;
|
|
951
|
-
i.status === "dirty" && e.dirty(), r.push(i.value);
|
|
952
|
-
}
|
|
953
|
-
return { status: e.value, value: r };
|
|
954
|
-
}
|
|
955
|
-
static async mergeObjectAsync(e, a) {
|
|
956
|
-
let r = [];
|
|
957
|
-
for (let i of a)
|
|
958
|
-
r.push({ key: await i.key, value: await i.value });
|
|
959
|
-
return n.mergeObjectSync(e, r);
|
|
960
|
-
}
|
|
961
|
-
static mergeObjectSync(e, a) {
|
|
962
|
-
let r = {};
|
|
963
|
-
for (let i of a) {
|
|
964
|
-
let { key: o, value: s } = i;
|
|
965
|
-
if (o.status === "aborted" || s.status === "aborted")
|
|
966
|
-
return v;
|
|
967
|
-
o.status === "dirty" && e.dirty(), s.status === "dirty" && e.dirty(), o.value !== "__proto__" && (typeof s.value != "undefined" || i.alwaysSet) && (r[o.value] = s.value);
|
|
968
|
-
}
|
|
969
|
-
return { status: e.value, value: r };
|
|
970
|
-
}
|
|
971
|
-
};
|
|
972
|
-
var v = Object.freeze({ status: "aborted" });
|
|
973
|
-
var Je = (n) => ({ status: "dirty", value: n });
|
|
974
|
-
var j = (n) => ({ status: "valid", value: n });
|
|
975
|
-
var $e = (n) => n.status === "aborted";
|
|
976
|
-
var Pe = (n) => n.status === "dirty";
|
|
977
|
-
var _e = (n) => n.status === "valid";
|
|
978
|
-
var Ce = (n) => typeof Promise != "undefined" && n instanceof Promise;
|
|
979
|
-
var f;
|
|
980
|
-
(function(n) {
|
|
981
|
-
n.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, n.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
|
|
982
|
-
})(f || (f = {}));
|
|
983
|
-
var E = class {
|
|
984
|
-
constructor(e, a, r, i) {
|
|
985
|
-
this._cachedPath = [], this.parent = e, this.data = a, this._path = r, this._key = i;
|
|
986
|
-
}
|
|
987
|
-
get path() {
|
|
988
|
-
return this._cachedPath.length || (this._key instanceof Array ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
|
|
989
|
-
}
|
|
990
|
-
};
|
|
991
|
-
var We = (n, e) => {
|
|
992
|
-
if (_e(e))
|
|
993
|
-
return { success: true, data: e.value };
|
|
994
|
-
if (!n.common.issues.length)
|
|
995
|
-
throw new Error("Validation failed but no issues detected.");
|
|
996
|
-
return { success: false, get error() {
|
|
997
|
-
if (this._error)
|
|
998
|
-
return this._error;
|
|
999
|
-
let a = new C(n.common.issues);
|
|
1000
|
-
return this._error = a, this._error;
|
|
1001
|
-
} };
|
|
1002
|
-
};
|
|
1003
|
-
function _(n) {
|
|
1004
|
-
if (!n)
|
|
1005
|
-
return {};
|
|
1006
|
-
let { errorMap: e, invalid_type_error: a, required_error: r, description: i } = n;
|
|
1007
|
-
if (e && (a || r))
|
|
1008
|
-
throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
|
|
1009
|
-
return e ? { errorMap: e, description: i } : { errorMap: (s, l) => s.code !== "invalid_type" ? { message: l.defaultError } : typeof l.data == "undefined" ? { message: r != null ? r : l.defaultError } : { message: a != null ? a : l.defaultError }, description: i };
|
|
1010
|
-
}
|
|
1011
|
-
var b = class {
|
|
1012
|
-
constructor(e) {
|
|
1013
|
-
this.spa = this.safeParseAsync, this._def = e, this.parse = this.parse.bind(this), this.safeParse = this.safeParse.bind(this), this.parseAsync = this.parseAsync.bind(this), this.safeParseAsync = this.safeParseAsync.bind(this), this.spa = this.spa.bind(this), this.refine = this.refine.bind(this), this.refinement = this.refinement.bind(this), this.superRefine = this.superRefine.bind(this), this.optional = this.optional.bind(this), this.nullable = this.nullable.bind(this), this.nullish = this.nullish.bind(this), this.array = this.array.bind(this), this.promise = this.promise.bind(this), this.or = this.or.bind(this), this.and = this.and.bind(this), this.transform = this.transform.bind(this), this.brand = this.brand.bind(this), this.default = this.default.bind(this), this.catch = this.catch.bind(this), this.describe = this.describe.bind(this), this.pipe = this.pipe.bind(this), this.readonly = this.readonly.bind(this), this.isNullable = this.isNullable.bind(this), this.isOptional = this.isOptional.bind(this);
|
|
1014
|
-
}
|
|
1015
|
-
get description() {
|
|
1016
|
-
return this._def.description;
|
|
1017
|
-
}
|
|
1018
|
-
_getType(e) {
|
|
1019
|
-
return B(e.data);
|
|
1020
|
-
}
|
|
1021
|
-
_getOrReturnCtx(e, a) {
|
|
1022
|
-
return a || { common: e.parent.common, data: e.data, parsedType: B(e.data), schemaErrorMap: this._def.errorMap, path: e.path, parent: e.parent };
|
|
1023
|
-
}
|
|
1024
|
-
_processInputParams(e) {
|
|
1025
|
-
return { status: new T(), ctx: { common: e.parent.common, data: e.data, parsedType: B(e.data), schemaErrorMap: this._def.errorMap, path: e.path, parent: e.parent } };
|
|
1026
|
-
}
|
|
1027
|
-
_parseSync(e) {
|
|
1028
|
-
let a = this._parse(e);
|
|
1029
|
-
if (Ce(a))
|
|
1030
|
-
throw new Error("Synchronous parse encountered promise.");
|
|
1031
|
-
return a;
|
|
1032
|
-
}
|
|
1033
|
-
_parseAsync(e) {
|
|
1034
|
-
let a = this._parse(e);
|
|
1035
|
-
return Promise.resolve(a);
|
|
1036
|
-
}
|
|
1037
|
-
parse(e, a) {
|
|
1038
|
-
let r = this.safeParse(e, a);
|
|
1039
|
-
if (r.success)
|
|
1040
|
-
return r.data;
|
|
1041
|
-
throw r.error;
|
|
1042
|
-
}
|
|
1043
|
-
safeParse(e, a) {
|
|
1044
|
-
var r;
|
|
1045
|
-
let i = { common: { issues: [], async: (r = a == null ? void 0 : a.async) !== null && r !== void 0 ? r : false, contextualErrorMap: a == null ? void 0 : a.errorMap }, path: (a == null ? void 0 : a.path) || [], schemaErrorMap: this._def.errorMap, parent: null, data: e, parsedType: B(e) }, o = this._parseSync({ data: e, path: i.path, parent: i });
|
|
1046
|
-
return We(i, o);
|
|
1047
|
-
}
|
|
1048
|
-
async parseAsync(e, a) {
|
|
1049
|
-
let r = await this.safeParseAsync(e, a);
|
|
1050
|
-
if (r.success)
|
|
1051
|
-
return r.data;
|
|
1052
|
-
throw r.error;
|
|
1053
|
-
}
|
|
1054
|
-
async safeParseAsync(e, a) {
|
|
1055
|
-
let r = { common: { issues: [], contextualErrorMap: a == null ? void 0 : a.errorMap, async: true }, path: (a == null ? void 0 : a.path) || [], schemaErrorMap: this._def.errorMap, parent: null, data: e, parsedType: B(e) }, i = this._parse({ data: e, path: r.path, parent: r }), o = await (Ce(i) ? i : Promise.resolve(i));
|
|
1056
|
-
return We(r, o);
|
|
1057
|
-
}
|
|
1058
|
-
refine(e, a) {
|
|
1059
|
-
let r = (i) => typeof a == "string" || typeof a == "undefined" ? { message: a } : typeof a == "function" ? a(i) : a;
|
|
1060
|
-
return this._refinement((i, o) => {
|
|
1061
|
-
let s = e(i), l = () => o.addIssue(c({ code: d.custom }, r(i)));
|
|
1062
|
-
return typeof Promise != "undefined" && s instanceof Promise ? s.then((m) => m ? true : (l(), false)) : s ? true : (l(), false);
|
|
1063
|
-
});
|
|
1064
|
-
}
|
|
1065
|
-
refinement(e, a) {
|
|
1066
|
-
return this._refinement((r, i) => e(r) ? true : (i.addIssue(typeof a == "function" ? a(r, i) : a), false));
|
|
1067
|
-
}
|
|
1068
|
-
_refinement(e) {
|
|
1069
|
-
return new Z({ schema: this, typeName: g.ZodEffects, effect: { type: "refinement", refinement: e } });
|
|
1070
|
-
}
|
|
1071
|
-
superRefine(e) {
|
|
1072
|
-
return this._refinement(e);
|
|
1073
|
-
}
|
|
1074
|
-
optional() {
|
|
1075
|
-
return A.create(this, this._def);
|
|
1076
|
-
}
|
|
1077
|
-
nullable() {
|
|
1078
|
-
return U.create(this, this._def);
|
|
1079
|
-
}
|
|
1080
|
-
nullish() {
|
|
1081
|
-
return this.nullable().optional();
|
|
1082
|
-
}
|
|
1083
|
-
array() {
|
|
1084
|
-
return D.create(this, this._def);
|
|
1085
|
-
}
|
|
1086
|
-
promise() {
|
|
1087
|
-
return H.create(this, this._def);
|
|
1088
|
-
}
|
|
1089
|
-
or(e) {
|
|
1090
|
-
return Q.create([this, e], this._def);
|
|
1091
|
-
}
|
|
1092
|
-
and(e) {
|
|
1093
|
-
return ee.create(this, e, this._def);
|
|
1094
|
-
}
|
|
1095
|
-
transform(e) {
|
|
1096
|
-
return new Z(y(c({}, _(this._def)), { schema: this, typeName: g.ZodEffects, effect: { type: "transform", transform: e } }));
|
|
1097
|
-
}
|
|
1098
|
-
default(e) {
|
|
1099
|
-
let a = typeof e == "function" ? e : () => e;
|
|
1100
|
-
return new ie(y(c({}, _(this._def)), { innerType: this, defaultValue: a, typeName: g.ZodDefault }));
|
|
1101
|
-
}
|
|
1102
|
-
brand() {
|
|
1103
|
-
return new Ne(c({ typeName: g.ZodBranded, type: this }, _(this._def)));
|
|
1104
|
-
}
|
|
1105
|
-
catch(e) {
|
|
1106
|
-
let a = typeof e == "function" ? e : () => e;
|
|
1107
|
-
return new me(y(c({}, _(this._def)), { innerType: this, catchValue: a, typeName: g.ZodCatch }));
|
|
1108
|
-
}
|
|
1109
|
-
describe(e) {
|
|
1110
|
-
let a = this.constructor;
|
|
1111
|
-
return new a(y(c({}, this._def), { description: e }));
|
|
1112
|
-
}
|
|
1113
|
-
pipe(e) {
|
|
1114
|
-
return be.create(this, e);
|
|
1115
|
-
}
|
|
1116
|
-
readonly() {
|
|
1117
|
-
return ge.create(this);
|
|
1118
|
-
}
|
|
1119
|
-
isOptional() {
|
|
1120
|
-
return this.safeParse(void 0).success;
|
|
1121
|
-
}
|
|
1122
|
-
isNullable() {
|
|
1123
|
-
return this.safeParse(null).success;
|
|
1124
|
-
}
|
|
1125
|
-
};
|
|
1126
|
-
var yt = /^c[^\s-]{8,}$/i;
|
|
1127
|
-
var vt = /^[a-z][a-z0-9]*$/;
|
|
1128
|
-
var _t = /^[0-9A-HJKMNP-TV-Z]{26}$/;
|
|
1129
|
-
var bt = /^[0-9a-fA-F]{8}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{4}\b-[0-9a-fA-F]{12}$/i;
|
|
1130
|
-
var xt = /^(?!\.)(?!.*\.\.)([A-Z0-9_+-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i;
|
|
1131
|
-
var St = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
|
|
1132
|
-
var ze;
|
|
1133
|
-
var kt = /^(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))$/;
|
|
1134
|
-
var wt = /^(([a-f0-9]{1,4}:){7}|::([a-f0-9]{1,4}:){0,6}|([a-f0-9]{1,4}:){1}:([a-f0-9]{1,4}:){0,5}|([a-f0-9]{1,4}:){2}:([a-f0-9]{1,4}:){0,4}|([a-f0-9]{1,4}:){3}:([a-f0-9]{1,4}:){0,3}|([a-f0-9]{1,4}:){4}:([a-f0-9]{1,4}:){0,2}|([a-f0-9]{1,4}:){5}:([a-f0-9]{1,4}:){0,1})([a-f0-9]{1,4}|(((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2}))\.){3}((25[0-5])|(2[0-4][0-9])|(1[0-9]{2})|([0-9]{1,2})))$/;
|
|
1135
|
-
var Tt = (n) => n.precision ? n.offset ? new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${n.precision}}(([+-]\\d{2}(:?\\d{2})?)|Z)$`) : new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${n.precision}}Z$`) : n.precision === 0 ? n.offset ? new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}(:?\\d{2})?)|Z)$") : new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$") : n.offset ? new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}(:?\\d{2})?)|Z)$") : new RegExp("^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$");
|
|
1136
|
-
function jt(n, e) {
|
|
1137
|
-
return !!((e === "v4" || !e) && kt.test(n) || (e === "v6" || !e) && wt.test(n));
|
|
1138
|
-
}
|
|
1139
|
-
var q = class n extends b {
|
|
1140
|
-
_parse(e) {
|
|
1141
|
-
if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== p.string) {
|
|
1142
|
-
let o = this._getOrReturnCtx(e);
|
|
1143
|
-
return h(o, { code: d.invalid_type, expected: p.string, received: o.parsedType }), v;
|
|
1144
|
-
}
|
|
1145
|
-
let r = new T(), i;
|
|
1146
|
-
for (let o of this._def.checks)
|
|
1147
|
-
if (o.kind === "min")
|
|
1148
|
-
e.data.length < o.value && (i = this._getOrReturnCtx(e, i), h(i, { code: d.too_small, minimum: o.value, type: "string", inclusive: true, exact: false, message: o.message }), r.dirty());
|
|
1149
|
-
else if (o.kind === "max")
|
|
1150
|
-
e.data.length > o.value && (i = this._getOrReturnCtx(e, i), h(i, { code: d.too_big, maximum: o.value, type: "string", inclusive: true, exact: false, message: o.message }), r.dirty());
|
|
1151
|
-
else if (o.kind === "length") {
|
|
1152
|
-
let s = e.data.length > o.value, l = e.data.length < o.value;
|
|
1153
|
-
(s || l) && (i = this._getOrReturnCtx(e, i), s ? h(i, { code: d.too_big, maximum: o.value, type: "string", inclusive: true, exact: true, message: o.message }) : l && h(i, { code: d.too_small, minimum: o.value, type: "string", inclusive: true, exact: true, message: o.message }), r.dirty());
|
|
1154
|
-
} else if (o.kind === "email")
|
|
1155
|
-
xt.test(e.data) || (i = this._getOrReturnCtx(e, i), h(i, { validation: "email", code: d.invalid_string, message: o.message }), r.dirty());
|
|
1156
|
-
else if (o.kind === "emoji")
|
|
1157
|
-
ze || (ze = new RegExp(St, "u")), ze.test(e.data) || (i = this._getOrReturnCtx(e, i), h(i, { validation: "emoji", code: d.invalid_string, message: o.message }), r.dirty());
|
|
1158
|
-
else if (o.kind === "uuid")
|
|
1159
|
-
bt.test(e.data) || (i = this._getOrReturnCtx(e, i), h(i, { validation: "uuid", code: d.invalid_string, message: o.message }), r.dirty());
|
|
1160
|
-
else if (o.kind === "cuid")
|
|
1161
|
-
yt.test(e.data) || (i = this._getOrReturnCtx(e, i), h(i, { validation: "cuid", code: d.invalid_string, message: o.message }), r.dirty());
|
|
1162
|
-
else if (o.kind === "cuid2")
|
|
1163
|
-
vt.test(e.data) || (i = this._getOrReturnCtx(e, i), h(i, { validation: "cuid2", code: d.invalid_string, message: o.message }), r.dirty());
|
|
1164
|
-
else if (o.kind === "ulid")
|
|
1165
|
-
_t.test(e.data) || (i = this._getOrReturnCtx(e, i), h(i, { validation: "ulid", code: d.invalid_string, message: o.message }), r.dirty());
|
|
1166
|
-
else if (o.kind === "url")
|
|
1167
|
-
try {
|
|
1168
|
-
new URL(e.data);
|
|
1169
|
-
} catch (s) {
|
|
1170
|
-
i = this._getOrReturnCtx(e, i), h(i, { validation: "url", code: d.invalid_string, message: o.message }), r.dirty();
|
|
1171
|
-
}
|
|
1172
|
-
else
|
|
1173
|
-
o.kind === "regex" ? (o.regex.lastIndex = 0, o.regex.test(e.data) || (i = this._getOrReturnCtx(e, i), h(i, { validation: "regex", code: d.invalid_string, message: o.message }), r.dirty())) : o.kind === "trim" ? e.data = e.data.trim() : o.kind === "includes" ? e.data.includes(o.value, o.position) || (i = this._getOrReturnCtx(e, i), h(i, { code: d.invalid_string, validation: { includes: o.value, position: o.position }, message: o.message }), r.dirty()) : o.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : o.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : o.kind === "startsWith" ? e.data.startsWith(o.value) || (i = this._getOrReturnCtx(e, i), h(i, { code: d.invalid_string, validation: { startsWith: o.value }, message: o.message }), r.dirty()) : o.kind === "endsWith" ? e.data.endsWith(o.value) || (i = this._getOrReturnCtx(e, i), h(i, { code: d.invalid_string, validation: { endsWith: o.value }, message: o.message }), r.dirty()) : o.kind === "datetime" ? Tt(o).test(e.data) || (i = this._getOrReturnCtx(e, i), h(i, { code: d.invalid_string, validation: "datetime", message: o.message }), r.dirty()) : o.kind === "ip" ? jt(e.data, o.version) || (i = this._getOrReturnCtx(e, i), h(i, { validation: "ip", code: d.invalid_string, message: o.message }), r.dirty()) : S.assertNever(o);
|
|
1174
|
-
return { status: r.value, value: e.data };
|
|
1175
|
-
}
|
|
1176
|
-
_regex(e, a, r) {
|
|
1177
|
-
return this.refinement((i) => e.test(i), c({ validation: a, code: d.invalid_string }, f.errToObj(r)));
|
|
1178
|
-
}
|
|
1179
|
-
_addCheck(e) {
|
|
1180
|
-
return new n(y(c({}, this._def), { checks: [...this._def.checks, e] }));
|
|
1181
|
-
}
|
|
1182
|
-
email(e) {
|
|
1183
|
-
return this._addCheck(c({ kind: "email" }, f.errToObj(e)));
|
|
1184
|
-
}
|
|
1185
|
-
url(e) {
|
|
1186
|
-
return this._addCheck(c({ kind: "url" }, f.errToObj(e)));
|
|
1187
|
-
}
|
|
1188
|
-
emoji(e) {
|
|
1189
|
-
return this._addCheck(c({ kind: "emoji" }, f.errToObj(e)));
|
|
1190
|
-
}
|
|
1191
|
-
uuid(e) {
|
|
1192
|
-
return this._addCheck(c({ kind: "uuid" }, f.errToObj(e)));
|
|
1193
|
-
}
|
|
1194
|
-
cuid(e) {
|
|
1195
|
-
return this._addCheck(c({ kind: "cuid" }, f.errToObj(e)));
|
|
1196
|
-
}
|
|
1197
|
-
cuid2(e) {
|
|
1198
|
-
return this._addCheck(c({ kind: "cuid2" }, f.errToObj(e)));
|
|
1199
|
-
}
|
|
1200
|
-
ulid(e) {
|
|
1201
|
-
return this._addCheck(c({ kind: "ulid" }, f.errToObj(e)));
|
|
1202
|
-
}
|
|
1203
|
-
ip(e) {
|
|
1204
|
-
return this._addCheck(c({ kind: "ip" }, f.errToObj(e)));
|
|
1205
|
-
}
|
|
1206
|
-
datetime(e) {
|
|
1207
|
-
var a;
|
|
1208
|
-
return typeof e == "string" ? this._addCheck({ kind: "datetime", precision: null, offset: false, message: e }) : this._addCheck(c({ kind: "datetime", precision: typeof (e == null ? void 0 : e.precision) == "undefined" ? null : e == null ? void 0 : e.precision, offset: (a = e == null ? void 0 : e.offset) !== null && a !== void 0 ? a : false }, f.errToObj(e == null ? void 0 : e.message)));
|
|
1209
|
-
}
|
|
1210
|
-
regex(e, a) {
|
|
1211
|
-
return this._addCheck(c({ kind: "regex", regex: e }, f.errToObj(a)));
|
|
1212
|
-
}
|
|
1213
|
-
includes(e, a) {
|
|
1214
|
-
return this._addCheck(c({ kind: "includes", value: e, position: a == null ? void 0 : a.position }, f.errToObj(a == null ? void 0 : a.message)));
|
|
1215
|
-
}
|
|
1216
|
-
startsWith(e, a) {
|
|
1217
|
-
return this._addCheck(c({ kind: "startsWith", value: e }, f.errToObj(a)));
|
|
1218
|
-
}
|
|
1219
|
-
endsWith(e, a) {
|
|
1220
|
-
return this._addCheck(c({ kind: "endsWith", value: e }, f.errToObj(a)));
|
|
1221
|
-
}
|
|
1222
|
-
min(e, a) {
|
|
1223
|
-
return this._addCheck(c({ kind: "min", value: e }, f.errToObj(a)));
|
|
1224
|
-
}
|
|
1225
|
-
max(e, a) {
|
|
1226
|
-
return this._addCheck(c({ kind: "max", value: e }, f.errToObj(a)));
|
|
1227
|
-
}
|
|
1228
|
-
length(e, a) {
|
|
1229
|
-
return this._addCheck(c({ kind: "length", value: e }, f.errToObj(a)));
|
|
1230
|
-
}
|
|
1231
|
-
nonempty(e) {
|
|
1232
|
-
return this.min(1, f.errToObj(e));
|
|
1233
|
-
}
|
|
1234
|
-
trim() {
|
|
1235
|
-
return new n(y(c({}, this._def), { checks: [...this._def.checks, { kind: "trim" }] }));
|
|
1236
|
-
}
|
|
1237
|
-
toLowerCase() {
|
|
1238
|
-
return new n(y(c({}, this._def), { checks: [...this._def.checks, { kind: "toLowerCase" }] }));
|
|
1239
|
-
}
|
|
1240
|
-
toUpperCase() {
|
|
1241
|
-
return new n(y(c({}, this._def), { checks: [...this._def.checks, { kind: "toUpperCase" }] }));
|
|
1242
|
-
}
|
|
1243
|
-
get isDatetime() {
|
|
1244
|
-
return !!this._def.checks.find((e) => e.kind === "datetime");
|
|
1245
|
-
}
|
|
1246
|
-
get isEmail() {
|
|
1247
|
-
return !!this._def.checks.find((e) => e.kind === "email");
|
|
1248
|
-
}
|
|
1249
|
-
get isURL() {
|
|
1250
|
-
return !!this._def.checks.find((e) => e.kind === "url");
|
|
1251
|
-
}
|
|
1252
|
-
get isEmoji() {
|
|
1253
|
-
return !!this._def.checks.find((e) => e.kind === "emoji");
|
|
1254
|
-
}
|
|
1255
|
-
get isUUID() {
|
|
1256
|
-
return !!this._def.checks.find((e) => e.kind === "uuid");
|
|
1257
|
-
}
|
|
1258
|
-
get isCUID() {
|
|
1259
|
-
return !!this._def.checks.find((e) => e.kind === "cuid");
|
|
1260
|
-
}
|
|
1261
|
-
get isCUID2() {
|
|
1262
|
-
return !!this._def.checks.find((e) => e.kind === "cuid2");
|
|
1263
|
-
}
|
|
1264
|
-
get isULID() {
|
|
1265
|
-
return !!this._def.checks.find((e) => e.kind === "ulid");
|
|
1266
|
-
}
|
|
1267
|
-
get isIP() {
|
|
1268
|
-
return !!this._def.checks.find((e) => e.kind === "ip");
|
|
1269
|
-
}
|
|
1270
|
-
get minLength() {
|
|
1271
|
-
let e = null;
|
|
1272
|
-
for (let a of this._def.checks)
|
|
1273
|
-
a.kind === "min" && (e === null || a.value > e) && (e = a.value);
|
|
1274
|
-
return e;
|
|
1275
|
-
}
|
|
1276
|
-
get maxLength() {
|
|
1277
|
-
let e = null;
|
|
1278
|
-
for (let a of this._def.checks)
|
|
1279
|
-
a.kind === "max" && (e === null || a.value < e) && (e = a.value);
|
|
1280
|
-
return e;
|
|
1281
|
-
}
|
|
1282
|
-
};
|
|
1283
|
-
q.create = (n) => {
|
|
1284
|
-
var e;
|
|
1285
|
-
return new q(c({ checks: [], typeName: g.ZodString, coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : false }, _(n)));
|
|
1286
|
-
};
|
|
1287
|
-
function Ot(n, e) {
|
|
1288
|
-
let a = (n.toString().split(".")[1] || "").length, r = (e.toString().split(".")[1] || "").length, i = a > r ? a : r, o = parseInt(n.toFixed(i).replace(".", "")), s = parseInt(e.toFixed(i).replace(".", ""));
|
|
1289
|
-
return o % s / Math.pow(10, i);
|
|
1290
|
-
}
|
|
1291
|
-
var F = class n extends b {
|
|
1292
|
-
constructor() {
|
|
1293
|
-
super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
|
|
1294
|
-
}
|
|
1295
|
-
_parse(e) {
|
|
1296
|
-
if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== p.number) {
|
|
1297
|
-
let o = this._getOrReturnCtx(e);
|
|
1298
|
-
return h(o, { code: d.invalid_type, expected: p.number, received: o.parsedType }), v;
|
|
1299
|
-
}
|
|
1300
|
-
let r, i = new T();
|
|
1301
|
-
for (let o of this._def.checks)
|
|
1302
|
-
o.kind === "int" ? S.isInteger(e.data) || (r = this._getOrReturnCtx(e, r), h(r, { code: d.invalid_type, expected: "integer", received: "float", message: o.message }), i.dirty()) : o.kind === "min" ? (o.inclusive ? e.data < o.value : e.data <= o.value) && (r = this._getOrReturnCtx(e, r), h(r, { code: d.too_small, minimum: o.value, type: "number", inclusive: o.inclusive, exact: false, message: o.message }), i.dirty()) : o.kind === "max" ? (o.inclusive ? e.data > o.value : e.data >= o.value) && (r = this._getOrReturnCtx(e, r), h(r, { code: d.too_big, maximum: o.value, type: "number", inclusive: o.inclusive, exact: false, message: o.message }), i.dirty()) : o.kind === "multipleOf" ? Ot(e.data, o.value) !== 0 && (r = this._getOrReturnCtx(e, r), h(r, { code: d.not_multiple_of, multipleOf: o.value, message: o.message }), i.dirty()) : o.kind === "finite" ? Number.isFinite(e.data) || (r = this._getOrReturnCtx(e, r), h(r, { code: d.not_finite, message: o.message }), i.dirty()) : S.assertNever(o);
|
|
1303
|
-
return { status: i.value, value: e.data };
|
|
1304
|
-
}
|
|
1305
|
-
gte(e, a) {
|
|
1306
|
-
return this.setLimit("min", e, true, f.toString(a));
|
|
1307
|
-
}
|
|
1308
|
-
gt(e, a) {
|
|
1309
|
-
return this.setLimit("min", e, false, f.toString(a));
|
|
1310
|
-
}
|
|
1311
|
-
lte(e, a) {
|
|
1312
|
-
return this.setLimit("max", e, true, f.toString(a));
|
|
1313
|
-
}
|
|
1314
|
-
lt(e, a) {
|
|
1315
|
-
return this.setLimit("max", e, false, f.toString(a));
|
|
1316
|
-
}
|
|
1317
|
-
setLimit(e, a, r, i) {
|
|
1318
|
-
return new n(y(c({}, this._def), { checks: [...this._def.checks, { kind: e, value: a, inclusive: r, message: f.toString(i) }] }));
|
|
1319
|
-
}
|
|
1320
|
-
_addCheck(e) {
|
|
1321
|
-
return new n(y(c({}, this._def), { checks: [...this._def.checks, e] }));
|
|
1322
|
-
}
|
|
1323
|
-
int(e) {
|
|
1324
|
-
return this._addCheck({ kind: "int", message: f.toString(e) });
|
|
1325
|
-
}
|
|
1326
|
-
positive(e) {
|
|
1327
|
-
return this._addCheck({ kind: "min", value: 0, inclusive: false, message: f.toString(e) });
|
|
1328
|
-
}
|
|
1329
|
-
negative(e) {
|
|
1330
|
-
return this._addCheck({ kind: "max", value: 0, inclusive: false, message: f.toString(e) });
|
|
1331
|
-
}
|
|
1332
|
-
nonpositive(e) {
|
|
1333
|
-
return this._addCheck({ kind: "max", value: 0, inclusive: true, message: f.toString(e) });
|
|
1334
|
-
}
|
|
1335
|
-
nonnegative(e) {
|
|
1336
|
-
return this._addCheck({ kind: "min", value: 0, inclusive: true, message: f.toString(e) });
|
|
1337
|
-
}
|
|
1338
|
-
multipleOf(e, a) {
|
|
1339
|
-
return this._addCheck({ kind: "multipleOf", value: e, message: f.toString(a) });
|
|
1340
|
-
}
|
|
1341
|
-
finite(e) {
|
|
1342
|
-
return this._addCheck({ kind: "finite", message: f.toString(e) });
|
|
1343
|
-
}
|
|
1344
|
-
safe(e) {
|
|
1345
|
-
return this._addCheck({ kind: "min", inclusive: true, value: Number.MIN_SAFE_INTEGER, message: f.toString(e) })._addCheck({ kind: "max", inclusive: true, value: Number.MAX_SAFE_INTEGER, message: f.toString(e) });
|
|
1346
|
-
}
|
|
1347
|
-
get minValue() {
|
|
1348
|
-
let e = null;
|
|
1349
|
-
for (let a of this._def.checks)
|
|
1350
|
-
a.kind === "min" && (e === null || a.value > e) && (e = a.value);
|
|
1351
|
-
return e;
|
|
1352
|
-
}
|
|
1353
|
-
get maxValue() {
|
|
1354
|
-
let e = null;
|
|
1355
|
-
for (let a of this._def.checks)
|
|
1356
|
-
a.kind === "max" && (e === null || a.value < e) && (e = a.value);
|
|
1357
|
-
return e;
|
|
1358
|
-
}
|
|
1359
|
-
get isInt() {
|
|
1360
|
-
return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && S.isInteger(e.value));
|
|
1361
|
-
}
|
|
1362
|
-
get isFinite() {
|
|
1363
|
-
let e = null, a = null;
|
|
1364
|
-
for (let r of this._def.checks) {
|
|
1365
|
-
if (r.kind === "finite" || r.kind === "int" || r.kind === "multipleOf")
|
|
1366
|
-
return true;
|
|
1367
|
-
r.kind === "min" ? (a === null || r.value > a) && (a = r.value) : r.kind === "max" && (e === null || r.value < e) && (e = r.value);
|
|
1368
|
-
}
|
|
1369
|
-
return Number.isFinite(a) && Number.isFinite(e);
|
|
1370
|
-
}
|
|
1371
|
-
};
|
|
1372
|
-
F.create = (n) => new F(c({ checks: [], typeName: g.ZodNumber, coerce: (n == null ? void 0 : n.coerce) || false }, _(n)));
|
|
1373
|
-
var J = class n extends b {
|
|
1374
|
-
constructor() {
|
|
1375
|
-
super(...arguments), this.min = this.gte, this.max = this.lte;
|
|
1376
|
-
}
|
|
1377
|
-
_parse(e) {
|
|
1378
|
-
if (this._def.coerce && (e.data = BigInt(e.data)), this._getType(e) !== p.bigint) {
|
|
1379
|
-
let o = this._getOrReturnCtx(e);
|
|
1380
|
-
return h(o, { code: d.invalid_type, expected: p.bigint, received: o.parsedType }), v;
|
|
1381
|
-
}
|
|
1382
|
-
let r, i = new T();
|
|
1383
|
-
for (let o of this._def.checks)
|
|
1384
|
-
o.kind === "min" ? (o.inclusive ? e.data < o.value : e.data <= o.value) && (r = this._getOrReturnCtx(e, r), h(r, { code: d.too_small, type: "bigint", minimum: o.value, inclusive: o.inclusive, message: o.message }), i.dirty()) : o.kind === "max" ? (o.inclusive ? e.data > o.value : e.data >= o.value) && (r = this._getOrReturnCtx(e, r), h(r, { code: d.too_big, type: "bigint", maximum: o.value, inclusive: o.inclusive, message: o.message }), i.dirty()) : o.kind === "multipleOf" ? e.data % o.value !== BigInt(0) && (r = this._getOrReturnCtx(e, r), h(r, { code: d.not_multiple_of, multipleOf: o.value, message: o.message }), i.dirty()) : S.assertNever(o);
|
|
1385
|
-
return { status: i.value, value: e.data };
|
|
1386
|
-
}
|
|
1387
|
-
gte(e, a) {
|
|
1388
|
-
return this.setLimit("min", e, true, f.toString(a));
|
|
1389
|
-
}
|
|
1390
|
-
gt(e, a) {
|
|
1391
|
-
return this.setLimit("min", e, false, f.toString(a));
|
|
1392
|
-
}
|
|
1393
|
-
lte(e, a) {
|
|
1394
|
-
return this.setLimit("max", e, true, f.toString(a));
|
|
1395
|
-
}
|
|
1396
|
-
lt(e, a) {
|
|
1397
|
-
return this.setLimit("max", e, false, f.toString(a));
|
|
1398
|
-
}
|
|
1399
|
-
setLimit(e, a, r, i) {
|
|
1400
|
-
return new n(y(c({}, this._def), { checks: [...this._def.checks, { kind: e, value: a, inclusive: r, message: f.toString(i) }] }));
|
|
1401
|
-
}
|
|
1402
|
-
_addCheck(e) {
|
|
1403
|
-
return new n(y(c({}, this._def), { checks: [...this._def.checks, e] }));
|
|
1404
|
-
}
|
|
1405
|
-
positive(e) {
|
|
1406
|
-
return this._addCheck({ kind: "min", value: BigInt(0), inclusive: false, message: f.toString(e) });
|
|
1407
|
-
}
|
|
1408
|
-
negative(e) {
|
|
1409
|
-
return this._addCheck({ kind: "max", value: BigInt(0), inclusive: false, message: f.toString(e) });
|
|
1410
|
-
}
|
|
1411
|
-
nonpositive(e) {
|
|
1412
|
-
return this._addCheck({ kind: "max", value: BigInt(0), inclusive: true, message: f.toString(e) });
|
|
1413
|
-
}
|
|
1414
|
-
nonnegative(e) {
|
|
1415
|
-
return this._addCheck({ kind: "min", value: BigInt(0), inclusive: true, message: f.toString(e) });
|
|
1416
|
-
}
|
|
1417
|
-
multipleOf(e, a) {
|
|
1418
|
-
return this._addCheck({ kind: "multipleOf", value: e, message: f.toString(a) });
|
|
1419
|
-
}
|
|
1420
|
-
get minValue() {
|
|
1421
|
-
let e = null;
|
|
1422
|
-
for (let a of this._def.checks)
|
|
1423
|
-
a.kind === "min" && (e === null || a.value > e) && (e = a.value);
|
|
1424
|
-
return e;
|
|
1425
|
-
}
|
|
1426
|
-
get maxValue() {
|
|
1427
|
-
let e = null;
|
|
1428
|
-
for (let a of this._def.checks)
|
|
1429
|
-
a.kind === "max" && (e === null || a.value < e) && (e = a.value);
|
|
1430
|
-
return e;
|
|
1431
|
-
}
|
|
1432
|
-
};
|
|
1433
|
-
J.create = (n) => {
|
|
1434
|
-
var e;
|
|
1435
|
-
return new J(c({ checks: [], typeName: g.ZodBigInt, coerce: (e = n == null ? void 0 : n.coerce) !== null && e !== void 0 ? e : false }, _(n)));
|
|
1436
|
-
};
|
|
1437
|
-
var Y = class extends b {
|
|
1438
|
-
_parse(e) {
|
|
1439
|
-
if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== p.boolean) {
|
|
1440
|
-
let r = this._getOrReturnCtx(e);
|
|
1441
|
-
return h(r, { code: d.invalid_type, expected: p.boolean, received: r.parsedType }), v;
|
|
1442
|
-
}
|
|
1443
|
-
return j(e.data);
|
|
1444
|
-
}
|
|
1445
|
-
};
|
|
1446
|
-
Y.create = (n) => new Y(c({ typeName: g.ZodBoolean, coerce: (n == null ? void 0 : n.coerce) || false }, _(n)));
|
|
1447
|
-
var K = class n extends b {
|
|
1448
|
-
_parse(e) {
|
|
1449
|
-
if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== p.date) {
|
|
1450
|
-
let o = this._getOrReturnCtx(e);
|
|
1451
|
-
return h(o, { code: d.invalid_type, expected: p.date, received: o.parsedType }), v;
|
|
1452
|
-
}
|
|
1453
|
-
if (isNaN(e.data.getTime())) {
|
|
1454
|
-
let o = this._getOrReturnCtx(e);
|
|
1455
|
-
return h(o, { code: d.invalid_date }), v;
|
|
1456
|
-
}
|
|
1457
|
-
let r = new T(), i;
|
|
1458
|
-
for (let o of this._def.checks)
|
|
1459
|
-
o.kind === "min" ? e.data.getTime() < o.value && (i = this._getOrReturnCtx(e, i), h(i, { code: d.too_small, message: o.message, inclusive: true, exact: false, minimum: o.value, type: "date" }), r.dirty()) : o.kind === "max" ? e.data.getTime() > o.value && (i = this._getOrReturnCtx(e, i), h(i, { code: d.too_big, message: o.message, inclusive: true, exact: false, maximum: o.value, type: "date" }), r.dirty()) : S.assertNever(o);
|
|
1460
|
-
return { status: r.value, value: new Date(e.data.getTime()) };
|
|
1461
|
-
}
|
|
1462
|
-
_addCheck(e) {
|
|
1463
|
-
return new n(y(c({}, this._def), { checks: [...this._def.checks, e] }));
|
|
1464
|
-
}
|
|
1465
|
-
min(e, a) {
|
|
1466
|
-
return this._addCheck({ kind: "min", value: e.getTime(), message: f.toString(a) });
|
|
1467
|
-
}
|
|
1468
|
-
max(e, a) {
|
|
1469
|
-
return this._addCheck({ kind: "max", value: e.getTime(), message: f.toString(a) });
|
|
1470
|
-
}
|
|
1471
|
-
get minDate() {
|
|
1472
|
-
let e = null;
|
|
1473
|
-
for (let a of this._def.checks)
|
|
1474
|
-
a.kind === "min" && (e === null || a.value > e) && (e = a.value);
|
|
1475
|
-
return e != null ? new Date(e) : null;
|
|
1476
|
-
}
|
|
1477
|
-
get maxDate() {
|
|
1478
|
-
let e = null;
|
|
1479
|
-
for (let a of this._def.checks)
|
|
1480
|
-
a.kind === "max" && (e === null || a.value < e) && (e = a.value);
|
|
1481
|
-
return e != null ? new Date(e) : null;
|
|
1482
|
-
}
|
|
1483
|
-
};
|
|
1484
|
-
K.create = (n) => new K(c({ checks: [], coerce: (n == null ? void 0 : n.coerce) || false, typeName: g.ZodDate }, _(n)));
|
|
1485
|
-
var de = class extends b {
|
|
1486
|
-
_parse(e) {
|
|
1487
|
-
if (this._getType(e) !== p.symbol) {
|
|
1488
|
-
let r = this._getOrReturnCtx(e);
|
|
1489
|
-
return h(r, { code: d.invalid_type, expected: p.symbol, received: r.parsedType }), v;
|
|
1490
|
-
}
|
|
1491
|
-
return j(e.data);
|
|
1492
|
-
}
|
|
1493
|
-
};
|
|
1494
|
-
de.create = (n) => new de(c({ typeName: g.ZodSymbol }, _(n)));
|
|
1495
|
-
var G = class extends b {
|
|
1496
|
-
_parse(e) {
|
|
1497
|
-
if (this._getType(e) !== p.undefined) {
|
|
1498
|
-
let r = this._getOrReturnCtx(e);
|
|
1499
|
-
return h(r, { code: d.invalid_type, expected: p.undefined, received: r.parsedType }), v;
|
|
1500
|
-
}
|
|
1501
|
-
return j(e.data);
|
|
1502
|
-
}
|
|
1503
|
-
};
|
|
1504
|
-
G.create = (n) => new G(c({ typeName: g.ZodUndefined }, _(n)));
|
|
1505
|
-
var X = class extends b {
|
|
1506
|
-
_parse(e) {
|
|
1507
|
-
if (this._getType(e) !== p.null) {
|
|
1508
|
-
let r = this._getOrReturnCtx(e);
|
|
1509
|
-
return h(r, { code: d.invalid_type, expected: p.null, received: r.parsedType }), v;
|
|
1510
|
-
}
|
|
1511
|
-
return j(e.data);
|
|
1512
|
-
}
|
|
1513
|
-
};
|
|
1514
|
-
X.create = (n) => new X(c({ typeName: g.ZodNull }, _(n)));
|
|
1515
|
-
var W = class extends b {
|
|
1516
|
-
constructor() {
|
|
1517
|
-
super(...arguments), this._any = true;
|
|
1518
|
-
}
|
|
1519
|
-
_parse(e) {
|
|
1520
|
-
return j(e.data);
|
|
1521
|
-
}
|
|
1522
|
-
};
|
|
1523
|
-
W.create = (n) => new W(c({ typeName: g.ZodAny }, _(n)));
|
|
1524
|
-
var V = class extends b {
|
|
1525
|
-
constructor() {
|
|
1526
|
-
super(...arguments), this._unknown = true;
|
|
1527
|
-
}
|
|
1528
|
-
_parse(e) {
|
|
1529
|
-
return j(e.data);
|
|
1530
|
-
}
|
|
1531
|
-
};
|
|
1532
|
-
V.create = (n) => new V(c({ typeName: g.ZodUnknown }, _(n)));
|
|
1533
|
-
var R = class extends b {
|
|
1534
|
-
_parse(e) {
|
|
1535
|
-
let a = this._getOrReturnCtx(e);
|
|
1536
|
-
return h(a, { code: d.invalid_type, expected: p.never, received: a.parsedType }), v;
|
|
1537
|
-
}
|
|
1538
|
-
};
|
|
1539
|
-
R.create = (n) => new R(c({ typeName: g.ZodNever }, _(n)));
|
|
1540
|
-
var ue = class extends b {
|
|
1541
|
-
_parse(e) {
|
|
1542
|
-
if (this._getType(e) !== p.undefined) {
|
|
1543
|
-
let r = this._getOrReturnCtx(e);
|
|
1544
|
-
return h(r, { code: d.invalid_type, expected: p.void, received: r.parsedType }), v;
|
|
1545
|
-
}
|
|
1546
|
-
return j(e.data);
|
|
1547
|
-
}
|
|
1548
|
-
};
|
|
1549
|
-
ue.create = (n) => new ue(c({ typeName: g.ZodVoid }, _(n)));
|
|
1550
|
-
var D = class n extends b {
|
|
1551
|
-
_parse(e) {
|
|
1552
|
-
let { ctx: a, status: r } = this._processInputParams(e), i = this._def;
|
|
1553
|
-
if (a.parsedType !== p.array)
|
|
1554
|
-
return h(a, { code: d.invalid_type, expected: p.array, received: a.parsedType }), v;
|
|
1555
|
-
if (i.exactLength !== null) {
|
|
1556
|
-
let s = a.data.length > i.exactLength.value, l = a.data.length < i.exactLength.value;
|
|
1557
|
-
(s || l) && (h(a, { code: s ? d.too_big : d.too_small, minimum: l ? i.exactLength.value : void 0, maximum: s ? i.exactLength.value : void 0, type: "array", inclusive: true, exact: true, message: i.exactLength.message }), r.dirty());
|
|
1558
|
-
}
|
|
1559
|
-
if (i.minLength !== null && a.data.length < i.minLength.value && (h(a, { code: d.too_small, minimum: i.minLength.value, type: "array", inclusive: true, exact: false, message: i.minLength.message }), r.dirty()), i.maxLength !== null && a.data.length > i.maxLength.value && (h(a, { code: d.too_big, maximum: i.maxLength.value, type: "array", inclusive: true, exact: false, message: i.maxLength.message }), r.dirty()), a.common.async)
|
|
1560
|
-
return Promise.all([...a.data].map((s, l) => i.type._parseAsync(new E(a, s, a.path, l)))).then((s) => T.mergeArray(r, s));
|
|
1561
|
-
let o = [...a.data].map((s, l) => i.type._parseSync(new E(a, s, a.path, l)));
|
|
1562
|
-
return T.mergeArray(r, o);
|
|
1563
|
-
}
|
|
1564
|
-
get element() {
|
|
1565
|
-
return this._def.type;
|
|
1566
|
-
}
|
|
1567
|
-
min(e, a) {
|
|
1568
|
-
return new n(y(c({}, this._def), { minLength: { value: e, message: f.toString(a) } }));
|
|
1569
|
-
}
|
|
1570
|
-
max(e, a) {
|
|
1571
|
-
return new n(y(c({}, this._def), { maxLength: { value: e, message: f.toString(a) } }));
|
|
1572
|
-
}
|
|
1573
|
-
length(e, a) {
|
|
1574
|
-
return new n(y(c({}, this._def), { exactLength: { value: e, message: f.toString(a) } }));
|
|
1575
|
-
}
|
|
1576
|
-
nonempty(e) {
|
|
1577
|
-
return this.min(1, e);
|
|
1578
|
-
}
|
|
1579
|
-
};
|
|
1580
|
-
D.create = (n, e) => new D(c({ type: n, minLength: null, maxLength: null, exactLength: null, typeName: g.ZodArray }, _(e)));
|
|
1581
|
-
function ce(n) {
|
|
1582
|
-
if (n instanceof O) {
|
|
1583
|
-
let e = {};
|
|
1584
|
-
for (let a in n.shape) {
|
|
1585
|
-
let r = n.shape[a];
|
|
1586
|
-
e[a] = A.create(ce(r));
|
|
1587
|
-
}
|
|
1588
|
-
return new O(y(c({}, n._def), { shape: () => e }));
|
|
1589
|
-
} else
|
|
1590
|
-
return n instanceof D ? new D(y(c({}, n._def), { type: ce(n.element) })) : n instanceof A ? A.create(ce(n.unwrap())) : n instanceof U ? U.create(ce(n.unwrap())) : n instanceof M ? M.create(n.items.map((e) => ce(e))) : n;
|
|
1591
|
-
}
|
|
1592
|
-
var O = class n extends b {
|
|
1593
|
-
constructor() {
|
|
1594
|
-
super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
|
|
1595
|
-
}
|
|
1596
|
-
_getCached() {
|
|
1597
|
-
if (this._cached !== null)
|
|
1598
|
-
return this._cached;
|
|
1599
|
-
let e = this._def.shape(), a = S.objectKeys(e);
|
|
1600
|
-
return this._cached = { shape: e, keys: a };
|
|
1601
|
-
}
|
|
1602
|
-
_parse(e) {
|
|
1603
|
-
if (this._getType(e) !== p.object) {
|
|
1604
|
-
let u = this._getOrReturnCtx(e);
|
|
1605
|
-
return h(u, { code: d.invalid_type, expected: p.object, received: u.parsedType }), v;
|
|
1606
|
-
}
|
|
1607
|
-
let { status: r, ctx: i } = this._processInputParams(e), { shape: o, keys: s } = this._getCached(), l = [];
|
|
1608
|
-
if (!(this._def.catchall instanceof R && this._def.unknownKeys === "strip"))
|
|
1609
|
-
for (let u in i.data)
|
|
1610
|
-
s.includes(u) || l.push(u);
|
|
1611
|
-
let m = [];
|
|
1612
|
-
for (let u of s) {
|
|
1613
|
-
let x = o[u], I = i.data[u];
|
|
1614
|
-
m.push({ key: { status: "valid", value: u }, value: x._parse(new E(i, I, i.path, u)), alwaysSet: u in i.data });
|
|
1615
|
-
}
|
|
1616
|
-
if (this._def.catchall instanceof R) {
|
|
1617
|
-
let u = this._def.unknownKeys;
|
|
1618
|
-
if (u === "passthrough")
|
|
1619
|
-
for (let x of l)
|
|
1620
|
-
m.push({ key: { status: "valid", value: x }, value: { status: "valid", value: i.data[x] } });
|
|
1621
|
-
else if (u === "strict")
|
|
1622
|
-
l.length > 0 && (h(i, { code: d.unrecognized_keys, keys: l }), r.dirty());
|
|
1623
|
-
else if (u !== "strip")
|
|
1624
|
-
throw new Error("Internal ZodObject error: invalid unknownKeys value.");
|
|
1625
|
-
} else {
|
|
1626
|
-
let u = this._def.catchall;
|
|
1627
|
-
for (let x of l) {
|
|
1628
|
-
let I = i.data[x];
|
|
1629
|
-
m.push({ key: { status: "valid", value: x }, value: u._parse(new E(i, I, i.path, x)), alwaysSet: x in i.data });
|
|
1630
|
-
}
|
|
1631
|
-
}
|
|
1632
|
-
return i.common.async ? Promise.resolve().then(async () => {
|
|
1633
|
-
let u = [];
|
|
1634
|
-
for (let x of m) {
|
|
1635
|
-
let I = await x.key;
|
|
1636
|
-
u.push({ key: I, value: await x.value, alwaysSet: x.alwaysSet });
|
|
1637
|
-
}
|
|
1638
|
-
return u;
|
|
1639
|
-
}).then((u) => T.mergeObjectSync(r, u)) : T.mergeObjectSync(r, m);
|
|
1640
|
-
}
|
|
1641
|
-
get shape() {
|
|
1642
|
-
return this._def.shape();
|
|
1643
|
-
}
|
|
1644
|
-
strict(e) {
|
|
1645
|
-
return f.errToObj, new n(c(y(c({}, this._def), { unknownKeys: "strict" }), e !== void 0 ? { errorMap: (a, r) => {
|
|
1646
|
-
var i, o, s, l;
|
|
1647
|
-
let m = (s = (o = (i = this._def).errorMap) === null || o === void 0 ? void 0 : o.call(i, a, r).message) !== null && s !== void 0 ? s : r.defaultError;
|
|
1648
|
-
return a.code === "unrecognized_keys" ? { message: (l = f.errToObj(e).message) !== null && l !== void 0 ? l : m } : { message: m };
|
|
1649
|
-
} } : {}));
|
|
1650
|
-
}
|
|
1651
|
-
strip() {
|
|
1652
|
-
return new n(y(c({}, this._def), { unknownKeys: "strip" }));
|
|
1653
|
-
}
|
|
1654
|
-
passthrough() {
|
|
1655
|
-
return new n(y(c({}, this._def), { unknownKeys: "passthrough" }));
|
|
1656
|
-
}
|
|
1657
|
-
extend(e) {
|
|
1658
|
-
return new n(y(c({}, this._def), { shape: () => c(c({}, this._def.shape()), e) }));
|
|
1659
|
-
}
|
|
1660
|
-
merge(e) {
|
|
1661
|
-
return new n({ unknownKeys: e._def.unknownKeys, catchall: e._def.catchall, shape: () => c(c({}, this._def.shape()), e._def.shape()), typeName: g.ZodObject });
|
|
1662
|
-
}
|
|
1663
|
-
setKey(e, a) {
|
|
1664
|
-
return this.augment({ [e]: a });
|
|
1665
|
-
}
|
|
1666
|
-
catchall(e) {
|
|
1667
|
-
return new n(y(c({}, this._def), { catchall: e }));
|
|
1668
|
-
}
|
|
1669
|
-
pick(e) {
|
|
1670
|
-
let a = {};
|
|
1671
|
-
return S.objectKeys(e).forEach((r) => {
|
|
1672
|
-
e[r] && this.shape[r] && (a[r] = this.shape[r]);
|
|
1673
|
-
}), new n(y(c({}, this._def), { shape: () => a }));
|
|
1674
|
-
}
|
|
1675
|
-
omit(e) {
|
|
1676
|
-
let a = {};
|
|
1677
|
-
return S.objectKeys(this.shape).forEach((r) => {
|
|
1678
|
-
e[r] || (a[r] = this.shape[r]);
|
|
1679
|
-
}), new n(y(c({}, this._def), { shape: () => a }));
|
|
1680
|
-
}
|
|
1681
|
-
deepPartial() {
|
|
1682
|
-
return ce(this);
|
|
1683
|
-
}
|
|
1684
|
-
partial(e) {
|
|
1685
|
-
let a = {};
|
|
1686
|
-
return S.objectKeys(this.shape).forEach((r) => {
|
|
1687
|
-
let i = this.shape[r];
|
|
1688
|
-
e && !e[r] ? a[r] = i : a[r] = i.optional();
|
|
1689
|
-
}), new n(y(c({}, this._def), { shape: () => a }));
|
|
1690
|
-
}
|
|
1691
|
-
required(e) {
|
|
1692
|
-
let a = {};
|
|
1693
|
-
return S.objectKeys(this.shape).forEach((r) => {
|
|
1694
|
-
if (e && !e[r])
|
|
1695
|
-
a[r] = this.shape[r];
|
|
1696
|
-
else {
|
|
1697
|
-
let o = this.shape[r];
|
|
1698
|
-
for (; o instanceof A; )
|
|
1699
|
-
o = o._def.innerType;
|
|
1700
|
-
a[r] = o;
|
|
1701
|
-
}
|
|
1702
|
-
}), new n(y(c({}, this._def), { shape: () => a }));
|
|
1703
|
-
}
|
|
1704
|
-
keyof() {
|
|
1705
|
-
return Ye(S.objectKeys(this.shape));
|
|
1706
|
-
}
|
|
1707
|
-
};
|
|
1708
|
-
O.create = (n, e) => new O(c({ shape: () => n, unknownKeys: "strip", catchall: R.create(), typeName: g.ZodObject }, _(e)));
|
|
1709
|
-
O.strictCreate = (n, e) => new O(c({ shape: () => n, unknownKeys: "strict", catchall: R.create(), typeName: g.ZodObject }, _(e)));
|
|
1710
|
-
O.lazycreate = (n, e) => new O(c({ shape: n, unknownKeys: "strip", catchall: R.create(), typeName: g.ZodObject }, _(e)));
|
|
1711
|
-
var Q = class extends b {
|
|
1712
|
-
_parse(e) {
|
|
1713
|
-
let { ctx: a } = this._processInputParams(e), r = this._def.options;
|
|
1714
|
-
function i(o) {
|
|
1715
|
-
for (let l of o)
|
|
1716
|
-
if (l.result.status === "valid")
|
|
1717
|
-
return l.result;
|
|
1718
|
-
for (let l of o)
|
|
1719
|
-
if (l.result.status === "dirty")
|
|
1720
|
-
return a.common.issues.push(...l.ctx.common.issues), l.result;
|
|
1721
|
-
let s = o.map((l) => new C(l.ctx.common.issues));
|
|
1722
|
-
return h(a, { code: d.invalid_union, unionErrors: s }), v;
|
|
1723
|
-
}
|
|
1724
|
-
if (a.common.async)
|
|
1725
|
-
return Promise.all(r.map(async (o) => {
|
|
1726
|
-
let s = y(c({}, a), { common: y(c({}, a.common), { issues: [] }), parent: null });
|
|
1727
|
-
return { result: await o._parseAsync({ data: a.data, path: a.path, parent: s }), ctx: s };
|
|
1728
|
-
})).then(i);
|
|
1729
|
-
{
|
|
1730
|
-
let o, s = [];
|
|
1731
|
-
for (let m of r) {
|
|
1732
|
-
let u = y(c({}, a), { common: y(c({}, a.common), { issues: [] }), parent: null }), x = m._parseSync({ data: a.data, path: a.path, parent: u });
|
|
1733
|
-
if (x.status === "valid")
|
|
1734
|
-
return x;
|
|
1735
|
-
x.status === "dirty" && !o && (o = { result: x, ctx: u }), u.common.issues.length && s.push(u.common.issues);
|
|
1736
|
-
}
|
|
1737
|
-
if (o)
|
|
1738
|
-
return a.common.issues.push(...o.ctx.common.issues), o.result;
|
|
1739
|
-
let l = s.map((m) => new C(m));
|
|
1740
|
-
return h(a, { code: d.invalid_union, unionErrors: l }), v;
|
|
1741
|
-
}
|
|
1742
|
-
}
|
|
1743
|
-
get options() {
|
|
1744
|
-
return this._def.options;
|
|
1745
|
-
}
|
|
1746
|
-
};
|
|
1747
|
-
Q.create = (n, e) => new Q(c({ options: n, typeName: g.ZodUnion }, _(e)));
|
|
1748
|
-
var Te = (n) => n instanceof te ? Te(n.schema) : n instanceof Z ? Te(n.innerType()) : n instanceof ae ? [n.value] : n instanceof ne ? n.options : n instanceof re ? Object.keys(n.enum) : n instanceof ie ? Te(n._def.innerType) : n instanceof G ? [void 0] : n instanceof X ? [null] : null;
|
|
1749
|
-
var Ze = class n extends b {
|
|
1750
|
-
_parse(e) {
|
|
1751
|
-
let { ctx: a } = this._processInputParams(e);
|
|
1752
|
-
if (a.parsedType !== p.object)
|
|
1753
|
-
return h(a, { code: d.invalid_type, expected: p.object, received: a.parsedType }), v;
|
|
1754
|
-
let r = this.discriminator, i = a.data[r], o = this.optionsMap.get(i);
|
|
1755
|
-
return o ? a.common.async ? o._parseAsync({ data: a.data, path: a.path, parent: a }) : o._parseSync({ data: a.data, path: a.path, parent: a }) : (h(a, { code: d.invalid_union_discriminator, options: Array.from(this.optionsMap.keys()), path: [r] }), v);
|
|
1756
|
-
}
|
|
1757
|
-
get discriminator() {
|
|
1758
|
-
return this._def.discriminator;
|
|
1759
|
-
}
|
|
1760
|
-
get options() {
|
|
1761
|
-
return this._def.options;
|
|
1762
|
-
}
|
|
1763
|
-
get optionsMap() {
|
|
1764
|
-
return this._def.optionsMap;
|
|
1765
|
-
}
|
|
1766
|
-
static create(e, a, r) {
|
|
1767
|
-
let i = /* @__PURE__ */ new Map();
|
|
1768
|
-
for (let o of a) {
|
|
1769
|
-
let s = Te(o.shape[e]);
|
|
1770
|
-
if (!s)
|
|
1771
|
-
throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
|
|
1772
|
-
for (let l of s) {
|
|
1773
|
-
if (i.has(l))
|
|
1774
|
-
throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(l)}`);
|
|
1775
|
-
i.set(l, o);
|
|
1776
|
-
}
|
|
1777
|
-
}
|
|
1778
|
-
return new n(c({ typeName: g.ZodDiscriminatedUnion, discriminator: e, options: a, optionsMap: i }, _(r)));
|
|
1779
|
-
}
|
|
1780
|
-
};
|
|
1781
|
-
function Ve(n, e) {
|
|
1782
|
-
let a = B(n), r = B(e);
|
|
1783
|
-
if (n === e)
|
|
1784
|
-
return { valid: true, data: n };
|
|
1785
|
-
if (a === p.object && r === p.object) {
|
|
1786
|
-
let i = S.objectKeys(e), o = S.objectKeys(n).filter((l) => i.indexOf(l) !== -1), s = c(c({}, n), e);
|
|
1787
|
-
for (let l of o) {
|
|
1788
|
-
let m = Ve(n[l], e[l]);
|
|
1789
|
-
if (!m.valid)
|
|
1790
|
-
return { valid: false };
|
|
1791
|
-
s[l] = m.data;
|
|
1792
|
-
}
|
|
1793
|
-
return { valid: true, data: s };
|
|
1794
|
-
} else if (a === p.array && r === p.array) {
|
|
1795
|
-
if (n.length !== e.length)
|
|
1796
|
-
return { valid: false };
|
|
1797
|
-
let i = [];
|
|
1798
|
-
for (let o = 0; o < n.length; o++) {
|
|
1799
|
-
let s = n[o], l = e[o], m = Ve(s, l);
|
|
1800
|
-
if (!m.valid)
|
|
1801
|
-
return { valid: false };
|
|
1802
|
-
i.push(m.data);
|
|
1803
|
-
}
|
|
1804
|
-
return { valid: true, data: i };
|
|
1805
|
-
} else
|
|
1806
|
-
return a === p.date && r === p.date && +n == +e ? { valid: true, data: n } : { valid: false };
|
|
1807
|
-
}
|
|
1808
|
-
var ee = class extends b {
|
|
1809
|
-
_parse(e) {
|
|
1810
|
-
let { status: a, ctx: r } = this._processInputParams(e), i = (o, s) => {
|
|
1811
|
-
if ($e(o) || $e(s))
|
|
1812
|
-
return v;
|
|
1813
|
-
let l = Ve(o.value, s.value);
|
|
1814
|
-
return l.valid ? ((Pe(o) || Pe(s)) && a.dirty(), { status: a.value, value: l.data }) : (h(r, { code: d.invalid_intersection_types }), v);
|
|
1815
|
-
};
|
|
1816
|
-
return r.common.async ? Promise.all([this._def.left._parseAsync({ data: r.data, path: r.path, parent: r }), this._def.right._parseAsync({ data: r.data, path: r.path, parent: r })]).then(([o, s]) => i(o, s)) : i(this._def.left._parseSync({ data: r.data, path: r.path, parent: r }), this._def.right._parseSync({ data: r.data, path: r.path, parent: r }));
|
|
1817
|
-
}
|
|
1818
|
-
};
|
|
1819
|
-
ee.create = (n, e, a) => new ee(c({ left: n, right: e, typeName: g.ZodIntersection }, _(a)));
|
|
1820
|
-
var M = class n extends b {
|
|
1821
|
-
_parse(e) {
|
|
1822
|
-
let { status: a, ctx: r } = this._processInputParams(e);
|
|
1823
|
-
if (r.parsedType !== p.array)
|
|
1824
|
-
return h(r, { code: d.invalid_type, expected: p.array, received: r.parsedType }), v;
|
|
1825
|
-
if (r.data.length < this._def.items.length)
|
|
1826
|
-
return h(r, { code: d.too_small, minimum: this._def.items.length, inclusive: true, exact: false, type: "array" }), v;
|
|
1827
|
-
!this._def.rest && r.data.length > this._def.items.length && (h(r, { code: d.too_big, maximum: this._def.items.length, inclusive: true, exact: false, type: "array" }), a.dirty());
|
|
1828
|
-
let o = [...r.data].map((s, l) => {
|
|
1829
|
-
let m = this._def.items[l] || this._def.rest;
|
|
1830
|
-
return m ? m._parse(new E(r, s, r.path, l)) : null;
|
|
1831
|
-
}).filter((s) => !!s);
|
|
1832
|
-
return r.common.async ? Promise.all(o).then((s) => T.mergeArray(a, s)) : T.mergeArray(a, o);
|
|
1833
|
-
}
|
|
1834
|
-
get items() {
|
|
1835
|
-
return this._def.items;
|
|
1836
|
-
}
|
|
1837
|
-
rest(e) {
|
|
1838
|
-
return new n(y(c({}, this._def), { rest: e }));
|
|
1839
|
-
}
|
|
1840
|
-
};
|
|
1841
|
-
M.create = (n, e) => {
|
|
1842
|
-
if (!Array.isArray(n))
|
|
1843
|
-
throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
|
|
1844
|
-
return new M(c({ items: n, typeName: g.ZodTuple, rest: null }, _(e)));
|
|
1845
|
-
};
|
|
1846
|
-
var Ie = class n extends b {
|
|
1847
|
-
get keySchema() {
|
|
1848
|
-
return this._def.keyType;
|
|
1849
|
-
}
|
|
1850
|
-
get valueSchema() {
|
|
1851
|
-
return this._def.valueType;
|
|
1852
|
-
}
|
|
1853
|
-
_parse(e) {
|
|
1854
|
-
let { status: a, ctx: r } = this._processInputParams(e);
|
|
1855
|
-
if (r.parsedType !== p.object)
|
|
1856
|
-
return h(r, { code: d.invalid_type, expected: p.object, received: r.parsedType }), v;
|
|
1857
|
-
let i = [], o = this._def.keyType, s = this._def.valueType;
|
|
1858
|
-
for (let l in r.data)
|
|
1859
|
-
i.push({ key: o._parse(new E(r, l, r.path, l)), value: s._parse(new E(r, r.data[l], r.path, l)) });
|
|
1860
|
-
return r.common.async ? T.mergeObjectAsync(a, i) : T.mergeObjectSync(a, i);
|
|
1861
|
-
}
|
|
1862
|
-
get element() {
|
|
1863
|
-
return this._def.valueType;
|
|
1864
|
-
}
|
|
1865
|
-
static create(e, a, r) {
|
|
1866
|
-
return a instanceof b ? new n(c({ keyType: e, valueType: a, typeName: g.ZodRecord }, _(r))) : new n(c({ keyType: q.create(), valueType: e, typeName: g.ZodRecord }, _(a)));
|
|
1867
|
-
}
|
|
1868
|
-
};
|
|
1869
|
-
var pe = class extends b {
|
|
1870
|
-
get keySchema() {
|
|
1871
|
-
return this._def.keyType;
|
|
1872
|
-
}
|
|
1873
|
-
get valueSchema() {
|
|
1874
|
-
return this._def.valueType;
|
|
1875
|
-
}
|
|
1876
|
-
_parse(e) {
|
|
1877
|
-
let { status: a, ctx: r } = this._processInputParams(e);
|
|
1878
|
-
if (r.parsedType !== p.map)
|
|
1879
|
-
return h(r, { code: d.invalid_type, expected: p.map, received: r.parsedType }), v;
|
|
1880
|
-
let i = this._def.keyType, o = this._def.valueType, s = [...r.data.entries()].map(([l, m], u) => ({ key: i._parse(new E(r, l, r.path, [u, "key"])), value: o._parse(new E(r, m, r.path, [u, "value"])) }));
|
|
1881
|
-
if (r.common.async) {
|
|
1882
|
-
let l = /* @__PURE__ */ new Map();
|
|
1883
|
-
return Promise.resolve().then(async () => {
|
|
1884
|
-
for (let m of s) {
|
|
1885
|
-
let u = await m.key, x = await m.value;
|
|
1886
|
-
if (u.status === "aborted" || x.status === "aborted")
|
|
1887
|
-
return v;
|
|
1888
|
-
(u.status === "dirty" || x.status === "dirty") && a.dirty(), l.set(u.value, x.value);
|
|
1889
|
-
}
|
|
1890
|
-
return { status: a.value, value: l };
|
|
1891
|
-
});
|
|
1892
|
-
} else {
|
|
1893
|
-
let l = /* @__PURE__ */ new Map();
|
|
1894
|
-
for (let m of s) {
|
|
1895
|
-
let u = m.key, x = m.value;
|
|
1896
|
-
if (u.status === "aborted" || x.status === "aborted")
|
|
1897
|
-
return v;
|
|
1898
|
-
(u.status === "dirty" || x.status === "dirty") && a.dirty(), l.set(u.value, x.value);
|
|
1899
|
-
}
|
|
1900
|
-
return { status: a.value, value: l };
|
|
1901
|
-
}
|
|
1902
|
-
}
|
|
1903
|
-
};
|
|
1904
|
-
pe.create = (n, e, a) => new pe(c({ valueType: e, keyType: n, typeName: g.ZodMap }, _(a)));
|
|
1905
|
-
var he = class n extends b {
|
|
1906
|
-
_parse(e) {
|
|
1907
|
-
let { status: a, ctx: r } = this._processInputParams(e);
|
|
1908
|
-
if (r.parsedType !== p.set)
|
|
1909
|
-
return h(r, { code: d.invalid_type, expected: p.set, received: r.parsedType }), v;
|
|
1910
|
-
let i = this._def;
|
|
1911
|
-
i.minSize !== null && r.data.size < i.minSize.value && (h(r, { code: d.too_small, minimum: i.minSize.value, type: "set", inclusive: true, exact: false, message: i.minSize.message }), a.dirty()), i.maxSize !== null && r.data.size > i.maxSize.value && (h(r, { code: d.too_big, maximum: i.maxSize.value, type: "set", inclusive: true, exact: false, message: i.maxSize.message }), a.dirty());
|
|
1912
|
-
let o = this._def.valueType;
|
|
1913
|
-
function s(m) {
|
|
1914
|
-
let u = /* @__PURE__ */ new Set();
|
|
1915
|
-
for (let x of m) {
|
|
1916
|
-
if (x.status === "aborted")
|
|
1917
|
-
return v;
|
|
1918
|
-
x.status === "dirty" && a.dirty(), u.add(x.value);
|
|
1919
|
-
}
|
|
1920
|
-
return { status: a.value, value: u };
|
|
1921
|
-
}
|
|
1922
|
-
let l = [...r.data.values()].map((m, u) => o._parse(new E(r, m, r.path, u)));
|
|
1923
|
-
return r.common.async ? Promise.all(l).then((m) => s(m)) : s(l);
|
|
1924
|
-
}
|
|
1925
|
-
min(e, a) {
|
|
1926
|
-
return new n(y(c({}, this._def), { minSize: { value: e, message: f.toString(a) } }));
|
|
1927
|
-
}
|
|
1928
|
-
max(e, a) {
|
|
1929
|
-
return new n(y(c({}, this._def), { maxSize: { value: e, message: f.toString(a) } }));
|
|
1930
|
-
}
|
|
1931
|
-
size(e, a) {
|
|
1932
|
-
return this.min(e, a).max(e, a);
|
|
1933
|
-
}
|
|
1934
|
-
nonempty(e) {
|
|
1935
|
-
return this.min(1, e);
|
|
1936
|
-
}
|
|
1937
|
-
};
|
|
1938
|
-
he.create = (n, e) => new he(c({ valueType: n, minSize: null, maxSize: null, typeName: g.ZodSet }, _(e)));
|
|
1939
|
-
var Ee = class n extends b {
|
|
1940
|
-
constructor() {
|
|
1941
|
-
super(...arguments), this.validate = this.implement;
|
|
1942
|
-
}
|
|
1943
|
-
_parse(e) {
|
|
1944
|
-
let { ctx: a } = this._processInputParams(e);
|
|
1945
|
-
if (a.parsedType !== p.function)
|
|
1946
|
-
return h(a, { code: d.invalid_type, expected: p.function, received: a.parsedType }), v;
|
|
1947
|
-
function r(l, m) {
|
|
1948
|
-
return Oe({ data: l, path: a.path, errorMaps: [a.common.contextualErrorMap, a.schemaErrorMap, je(), ve].filter((u) => !!u), issueData: { code: d.invalid_arguments, argumentsError: m } });
|
|
1949
|
-
}
|
|
1950
|
-
function i(l, m) {
|
|
1951
|
-
return Oe({ data: l, path: a.path, errorMaps: [a.common.contextualErrorMap, a.schemaErrorMap, je(), ve].filter((u) => !!u), issueData: { code: d.invalid_return_type, returnTypeError: m } });
|
|
1952
|
-
}
|
|
1953
|
-
let o = { errorMap: a.common.contextualErrorMap }, s = a.data;
|
|
1954
|
-
if (this._def.returns instanceof H) {
|
|
1955
|
-
let l = this;
|
|
1956
|
-
return j(async function(...m) {
|
|
1957
|
-
let u = new C([]), x = await l._def.args.parseAsync(m, o).catch((Le) => {
|
|
1958
|
-
throw u.addIssue(r(m, Le)), u;
|
|
1959
|
-
}), I = await Reflect.apply(s, this, x);
|
|
1960
|
-
return await l._def.returns._def.type.parseAsync(I, o).catch((Le) => {
|
|
1961
|
-
throw u.addIssue(i(I, Le)), u;
|
|
1962
|
-
});
|
|
1963
|
-
});
|
|
1964
|
-
} else {
|
|
1965
|
-
let l = this;
|
|
1966
|
-
return j(function(...m) {
|
|
1967
|
-
let u = l._def.args.safeParse(m, o);
|
|
1968
|
-
if (!u.success)
|
|
1969
|
-
throw new C([r(m, u.error)]);
|
|
1970
|
-
let x = Reflect.apply(s, this, u.data), I = l._def.returns.safeParse(x, o);
|
|
1971
|
-
if (!I.success)
|
|
1972
|
-
throw new C([i(x, I.error)]);
|
|
1973
|
-
return I.data;
|
|
1974
|
-
});
|
|
1975
|
-
}
|
|
1976
|
-
}
|
|
1977
|
-
parameters() {
|
|
1978
|
-
return this._def.args;
|
|
1979
|
-
}
|
|
1980
|
-
returnType() {
|
|
1981
|
-
return this._def.returns;
|
|
1982
|
-
}
|
|
1983
|
-
args(...e) {
|
|
1984
|
-
return new n(y(c({}, this._def), { args: M.create(e).rest(V.create()) }));
|
|
1985
|
-
}
|
|
1986
|
-
returns(e) {
|
|
1987
|
-
return new n(y(c({}, this._def), { returns: e }));
|
|
1988
|
-
}
|
|
1989
|
-
implement(e) {
|
|
1990
|
-
return this.parse(e);
|
|
1991
|
-
}
|
|
1992
|
-
strictImplement(e) {
|
|
1993
|
-
return this.parse(e);
|
|
1994
|
-
}
|
|
1995
|
-
static create(e, a, r) {
|
|
1996
|
-
return new n(c({ args: e || M.create([]).rest(V.create()), returns: a || V.create(), typeName: g.ZodFunction }, _(r)));
|
|
1997
|
-
}
|
|
1998
|
-
};
|
|
1999
|
-
var te = class extends b {
|
|
2000
|
-
get schema() {
|
|
2001
|
-
return this._def.getter();
|
|
2002
|
-
}
|
|
2003
|
-
_parse(e) {
|
|
2004
|
-
let { ctx: a } = this._processInputParams(e);
|
|
2005
|
-
return this._def.getter()._parse({ data: a.data, path: a.path, parent: a });
|
|
2006
|
-
}
|
|
2007
|
-
};
|
|
2008
|
-
te.create = (n, e) => new te(c({ getter: n, typeName: g.ZodLazy }, _(e)));
|
|
2009
|
-
var ae = class extends b {
|
|
2010
|
-
_parse(e) {
|
|
2011
|
-
if (e.data !== this._def.value) {
|
|
2012
|
-
let a = this._getOrReturnCtx(e);
|
|
2013
|
-
return h(a, { received: a.data, code: d.invalid_literal, expected: this._def.value }), v;
|
|
2014
|
-
}
|
|
2015
|
-
return { status: "valid", value: e.data };
|
|
2016
|
-
}
|
|
2017
|
-
get value() {
|
|
2018
|
-
return this._def.value;
|
|
2019
|
-
}
|
|
2020
|
-
};
|
|
2021
|
-
ae.create = (n, e) => new ae(c({ value: n, typeName: g.ZodLiteral }, _(e)));
|
|
2022
|
-
function Ye(n, e) {
|
|
2023
|
-
return new ne(c({ values: n, typeName: g.ZodEnum }, _(e)));
|
|
2024
|
-
}
|
|
2025
|
-
var ne = class n extends b {
|
|
2026
|
-
_parse(e) {
|
|
2027
|
-
if (typeof e.data != "string") {
|
|
2028
|
-
let a = this._getOrReturnCtx(e), r = this._def.values;
|
|
2029
|
-
return h(a, { expected: S.joinValues(r), received: a.parsedType, code: d.invalid_type }), v;
|
|
2030
|
-
}
|
|
2031
|
-
if (this._def.values.indexOf(e.data) === -1) {
|
|
2032
|
-
let a = this._getOrReturnCtx(e), r = this._def.values;
|
|
2033
|
-
return h(a, { received: a.data, code: d.invalid_enum_value, options: r }), v;
|
|
2034
|
-
}
|
|
2035
|
-
return j(e.data);
|
|
2036
|
-
}
|
|
2037
|
-
get options() {
|
|
2038
|
-
return this._def.values;
|
|
2039
|
-
}
|
|
2040
|
-
get enum() {
|
|
2041
|
-
let e = {};
|
|
2042
|
-
for (let a of this._def.values)
|
|
2043
|
-
e[a] = a;
|
|
2044
|
-
return e;
|
|
2045
|
-
}
|
|
2046
|
-
get Values() {
|
|
2047
|
-
let e = {};
|
|
2048
|
-
for (let a of this._def.values)
|
|
2049
|
-
e[a] = a;
|
|
2050
|
-
return e;
|
|
2051
|
-
}
|
|
2052
|
-
get Enum() {
|
|
2053
|
-
let e = {};
|
|
2054
|
-
for (let a of this._def.values)
|
|
2055
|
-
e[a] = a;
|
|
2056
|
-
return e;
|
|
2057
|
-
}
|
|
2058
|
-
extract(e) {
|
|
2059
|
-
return n.create(e);
|
|
2060
|
-
}
|
|
2061
|
-
exclude(e) {
|
|
2062
|
-
return n.create(this.options.filter((a) => !e.includes(a)));
|
|
2063
|
-
}
|
|
2064
|
-
};
|
|
2065
|
-
ne.create = Ye;
|
|
2066
|
-
var re = class extends b {
|
|
2067
|
-
_parse(e) {
|
|
2068
|
-
let a = S.getValidEnumValues(this._def.values), r = this._getOrReturnCtx(e);
|
|
2069
|
-
if (r.parsedType !== p.string && r.parsedType !== p.number) {
|
|
2070
|
-
let i = S.objectValues(a);
|
|
2071
|
-
return h(r, { expected: S.joinValues(i), received: r.parsedType, code: d.invalid_type }), v;
|
|
2072
|
-
}
|
|
2073
|
-
if (a.indexOf(e.data) === -1) {
|
|
2074
|
-
let i = S.objectValues(a);
|
|
2075
|
-
return h(r, { received: r.data, code: d.invalid_enum_value, options: i }), v;
|
|
2076
|
-
}
|
|
2077
|
-
return j(e.data);
|
|
2078
|
-
}
|
|
2079
|
-
get enum() {
|
|
2080
|
-
return this._def.values;
|
|
2081
|
-
}
|
|
2082
|
-
};
|
|
2083
|
-
re.create = (n, e) => new re(c({ values: n, typeName: g.ZodNativeEnum }, _(e)));
|
|
2084
|
-
var H = class extends b {
|
|
2085
|
-
unwrap() {
|
|
2086
|
-
return this._def.type;
|
|
2087
|
-
}
|
|
2088
|
-
_parse(e) {
|
|
2089
|
-
let { ctx: a } = this._processInputParams(e);
|
|
2090
|
-
if (a.parsedType !== p.promise && a.common.async === false)
|
|
2091
|
-
return h(a, { code: d.invalid_type, expected: p.promise, received: a.parsedType }), v;
|
|
2092
|
-
let r = a.parsedType === p.promise ? a.data : Promise.resolve(a.data);
|
|
2093
|
-
return j(r.then((i) => this._def.type.parseAsync(i, { path: a.path, errorMap: a.common.contextualErrorMap })));
|
|
2094
|
-
}
|
|
2095
|
-
};
|
|
2096
|
-
H.create = (n, e) => new H(c({ type: n, typeName: g.ZodPromise }, _(e)));
|
|
2097
|
-
var Z = class extends b {
|
|
2098
|
-
innerType() {
|
|
2099
|
-
return this._def.schema;
|
|
2100
|
-
}
|
|
2101
|
-
sourceType() {
|
|
2102
|
-
return this._def.schema._def.typeName === g.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
|
|
2103
|
-
}
|
|
2104
|
-
_parse(e) {
|
|
2105
|
-
let { status: a, ctx: r } = this._processInputParams(e), i = this._def.effect || null, o = { addIssue: (s) => {
|
|
2106
|
-
h(r, s), s.fatal ? a.abort() : a.dirty();
|
|
2107
|
-
}, get path() {
|
|
2108
|
-
return r.path;
|
|
2109
|
-
} };
|
|
2110
|
-
if (o.addIssue = o.addIssue.bind(o), i.type === "preprocess") {
|
|
2111
|
-
let s = i.transform(r.data, o);
|
|
2112
|
-
return r.common.issues.length ? { status: "dirty", value: r.data } : r.common.async ? Promise.resolve(s).then((l) => this._def.schema._parseAsync({ data: l, path: r.path, parent: r })) : this._def.schema._parseSync({ data: s, path: r.path, parent: r });
|
|
2113
|
-
}
|
|
2114
|
-
if (i.type === "refinement") {
|
|
2115
|
-
let s = (l) => {
|
|
2116
|
-
let m = i.refinement(l, o);
|
|
2117
|
-
if (r.common.async)
|
|
2118
|
-
return Promise.resolve(m);
|
|
2119
|
-
if (m instanceof Promise)
|
|
2120
|
-
throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2121
|
-
return l;
|
|
2122
|
-
};
|
|
2123
|
-
if (r.common.async === false) {
|
|
2124
|
-
let l = this._def.schema._parseSync({ data: r.data, path: r.path, parent: r });
|
|
2125
|
-
return l.status === "aborted" ? v : (l.status === "dirty" && a.dirty(), s(l.value), { status: a.value, value: l.value });
|
|
2126
|
-
} else
|
|
2127
|
-
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((l) => l.status === "aborted" ? v : (l.status === "dirty" && a.dirty(), s(l.value).then(() => ({ status: a.value, value: l.value }))));
|
|
2128
|
-
}
|
|
2129
|
-
if (i.type === "transform")
|
|
2130
|
-
if (r.common.async === false) {
|
|
2131
|
-
let s = this._def.schema._parseSync({ data: r.data, path: r.path, parent: r });
|
|
2132
|
-
if (!_e(s))
|
|
2133
|
-
return s;
|
|
2134
|
-
let l = i.transform(s.value, o);
|
|
2135
|
-
if (l instanceof Promise)
|
|
2136
|
-
throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
|
|
2137
|
-
return { status: a.value, value: l };
|
|
2138
|
-
} else
|
|
2139
|
-
return this._def.schema._parseAsync({ data: r.data, path: r.path, parent: r }).then((s) => _e(s) ? Promise.resolve(i.transform(s.value, o)).then((l) => ({ status: a.value, value: l })) : s);
|
|
2140
|
-
S.assertNever(i);
|
|
2141
|
-
}
|
|
2142
|
-
};
|
|
2143
|
-
Z.create = (n, e, a) => new Z(c({ schema: n, typeName: g.ZodEffects, effect: e }, _(a)));
|
|
2144
|
-
Z.createWithPreprocess = (n, e, a) => new Z(c({ schema: e, effect: { type: "preprocess", transform: n }, typeName: g.ZodEffects }, _(a)));
|
|
2145
|
-
var A = class extends b {
|
|
2146
|
-
_parse(e) {
|
|
2147
|
-
return this._getType(e) === p.undefined ? j(void 0) : this._def.innerType._parse(e);
|
|
2148
|
-
}
|
|
2149
|
-
unwrap() {
|
|
2150
|
-
return this._def.innerType;
|
|
2151
|
-
}
|
|
2152
|
-
};
|
|
2153
|
-
A.create = (n, e) => new A(c({ innerType: n, typeName: g.ZodOptional }, _(e)));
|
|
2154
|
-
var U = class extends b {
|
|
2155
|
-
_parse(e) {
|
|
2156
|
-
return this._getType(e) === p.null ? j(null) : this._def.innerType._parse(e);
|
|
2157
|
-
}
|
|
2158
|
-
unwrap() {
|
|
2159
|
-
return this._def.innerType;
|
|
2160
|
-
}
|
|
2161
|
-
};
|
|
2162
|
-
U.create = (n, e) => new U(c({ innerType: n, typeName: g.ZodNullable }, _(e)));
|
|
2163
|
-
var ie = class extends b {
|
|
2164
|
-
_parse(e) {
|
|
2165
|
-
let { ctx: a } = this._processInputParams(e), r = a.data;
|
|
2166
|
-
return a.parsedType === p.undefined && (r = this._def.defaultValue()), this._def.innerType._parse({ data: r, path: a.path, parent: a });
|
|
2167
|
-
}
|
|
2168
|
-
removeDefault() {
|
|
2169
|
-
return this._def.innerType;
|
|
2170
|
-
}
|
|
2171
|
-
};
|
|
2172
|
-
ie.create = (n, e) => new ie(c({ innerType: n, typeName: g.ZodDefault, defaultValue: typeof e.default == "function" ? e.default : () => e.default }, _(e)));
|
|
2173
|
-
var me = class extends b {
|
|
2174
|
-
_parse(e) {
|
|
2175
|
-
let { ctx: a } = this._processInputParams(e), r = y(c({}, a), { common: y(c({}, a.common), { issues: [] }) }), i = this._def.innerType._parse({ data: r.data, path: r.path, parent: c({}, r) });
|
|
2176
|
-
return Ce(i) ? i.then((o) => ({ status: "valid", value: o.status === "valid" ? o.value : this._def.catchValue({ get error() {
|
|
2177
|
-
return new C(r.common.issues);
|
|
2178
|
-
}, input: r.data }) })) : { status: "valid", value: i.status === "valid" ? i.value : this._def.catchValue({ get error() {
|
|
2179
|
-
return new C(r.common.issues);
|
|
2180
|
-
}, input: r.data }) };
|
|
2181
|
-
}
|
|
2182
|
-
removeCatch() {
|
|
2183
|
-
return this._def.innerType;
|
|
2184
|
-
}
|
|
2185
|
-
};
|
|
2186
|
-
me.create = (n, e) => new me(c({ innerType: n, typeName: g.ZodCatch, catchValue: typeof e.catch == "function" ? e.catch : () => e.catch }, _(e)));
|
|
2187
|
-
var fe = class extends b {
|
|
2188
|
-
_parse(e) {
|
|
2189
|
-
if (this._getType(e) !== p.nan) {
|
|
2190
|
-
let r = this._getOrReturnCtx(e);
|
|
2191
|
-
return h(r, { code: d.invalid_type, expected: p.nan, received: r.parsedType }), v;
|
|
658
|
+
toggle: function(element, options) {
|
|
659
|
+
return this.isFullscreen ? this.exit() : this.request(element, options);
|
|
660
|
+
},
|
|
661
|
+
onchange: function(callback) {
|
|
662
|
+
this.on("change", callback);
|
|
663
|
+
},
|
|
664
|
+
onerror: function(callback) {
|
|
665
|
+
this.on("error", callback);
|
|
666
|
+
},
|
|
667
|
+
on: function(event, callback) {
|
|
668
|
+
var eventName = eventNameMap[event];
|
|
669
|
+
if (eventName) {
|
|
670
|
+
document2.addEventListener(eventName, callback, false);
|
|
671
|
+
}
|
|
672
|
+
},
|
|
673
|
+
off: function(event, callback) {
|
|
674
|
+
var eventName = eventNameMap[event];
|
|
675
|
+
if (eventName) {
|
|
676
|
+
document2.removeEventListener(eventName, callback, false);
|
|
677
|
+
}
|
|
678
|
+
},
|
|
679
|
+
raw: fn
|
|
680
|
+
};
|
|
681
|
+
if (!fn) {
|
|
682
|
+
if (isCommonjs) {
|
|
683
|
+
module2.exports = { isEnabled: false };
|
|
684
|
+
} else {
|
|
685
|
+
window.screenfull = { isEnabled: false };
|
|
2192
686
|
}
|
|
2193
|
-
return
|
|
2194
|
-
}
|
|
2195
|
-
};
|
|
2196
|
-
fe.create = (n) => new fe(c({ typeName: g.ZodNaN }, _(n)));
|
|
2197
|
-
var Ct = Symbol("zod_brand");
|
|
2198
|
-
var Ne = class extends b {
|
|
2199
|
-
_parse(e) {
|
|
2200
|
-
let { ctx: a } = this._processInputParams(e), r = a.data;
|
|
2201
|
-
return this._def.type._parse({ data: r, path: a.path, parent: a });
|
|
2202
|
-
}
|
|
2203
|
-
unwrap() {
|
|
2204
|
-
return this._def.type;
|
|
687
|
+
return;
|
|
2205
688
|
}
|
|
2206
|
-
|
|
2207
|
-
|
|
2208
|
-
|
|
2209
|
-
|
|
2210
|
-
|
|
2211
|
-
|
|
2212
|
-
|
|
2213
|
-
|
|
2214
|
-
|
|
2215
|
-
|
|
2216
|
-
|
|
2217
|
-
|
|
689
|
+
Object.defineProperties(screenfull2, {
|
|
690
|
+
isFullscreen: {
|
|
691
|
+
get: function() {
|
|
692
|
+
return Boolean(document2[fn.fullscreenElement]);
|
|
693
|
+
}
|
|
694
|
+
},
|
|
695
|
+
element: {
|
|
696
|
+
enumerable: true,
|
|
697
|
+
get: function() {
|
|
698
|
+
return document2[fn.fullscreenElement];
|
|
699
|
+
}
|
|
700
|
+
},
|
|
701
|
+
isEnabled: {
|
|
702
|
+
enumerable: true,
|
|
703
|
+
get: function() {
|
|
704
|
+
return Boolean(document2[fn.fullscreenEnabled]);
|
|
705
|
+
}
|
|
2218
706
|
}
|
|
707
|
+
});
|
|
708
|
+
if (isCommonjs) {
|
|
709
|
+
module2.exports = screenfull2;
|
|
710
|
+
} else {
|
|
711
|
+
window.screenfull = screenfull2;
|
|
2219
712
|
}
|
|
2220
|
-
|
|
2221
|
-
return new n({ in: e, out: a, typeName: g.ZodPipeline });
|
|
2222
|
-
}
|
|
2223
|
-
};
|
|
2224
|
-
var ge = class extends b {
|
|
2225
|
-
_parse(e) {
|
|
2226
|
-
let a = this._def.innerType._parse(e);
|
|
2227
|
-
return _e(a) && (a.value = Object.freeze(a.value)), a;
|
|
2228
|
-
}
|
|
2229
|
-
};
|
|
2230
|
-
ge.create = (n, e) => new ge(c({ innerType: n, typeName: g.ZodReadonly }, _(e)));
|
|
2231
|
-
var Ke = (n, e = {}, a) => n ? W.create().superRefine((r, i) => {
|
|
2232
|
-
var o, s;
|
|
2233
|
-
if (!n(r)) {
|
|
2234
|
-
let l = typeof e == "function" ? e(r) : typeof e == "string" ? { message: e } : e, m = (s = (o = l.fatal) !== null && o !== void 0 ? o : a) !== null && s !== void 0 ? s : true, u = typeof l == "string" ? { message: l } : l;
|
|
2235
|
-
i.addIssue(y(c({ code: "custom" }, u), { fatal: m }));
|
|
2236
|
-
}
|
|
2237
|
-
}) : W.create();
|
|
2238
|
-
var Zt = { object: O.lazycreate };
|
|
2239
|
-
var g;
|
|
2240
|
-
(function(n) {
|
|
2241
|
-
n.ZodString = "ZodString", n.ZodNumber = "ZodNumber", n.ZodNaN = "ZodNaN", n.ZodBigInt = "ZodBigInt", n.ZodBoolean = "ZodBoolean", n.ZodDate = "ZodDate", n.ZodSymbol = "ZodSymbol", n.ZodUndefined = "ZodUndefined", n.ZodNull = "ZodNull", n.ZodAny = "ZodAny", n.ZodUnknown = "ZodUnknown", n.ZodNever = "ZodNever", n.ZodVoid = "ZodVoid", n.ZodArray = "ZodArray", n.ZodObject = "ZodObject", n.ZodUnion = "ZodUnion", n.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", n.ZodIntersection = "ZodIntersection", n.ZodTuple = "ZodTuple", n.ZodRecord = "ZodRecord", n.ZodMap = "ZodMap", n.ZodSet = "ZodSet", n.ZodFunction = "ZodFunction", n.ZodLazy = "ZodLazy", n.ZodLiteral = "ZodLiteral", n.ZodEnum = "ZodEnum", n.ZodEffects = "ZodEffects", n.ZodNativeEnum = "ZodNativeEnum", n.ZodOptional = "ZodOptional", n.ZodNullable = "ZodNullable", n.ZodDefault = "ZodDefault", n.ZodCatch = "ZodCatch", n.ZodPromise = "ZodPromise", n.ZodBranded = "ZodBranded", n.ZodPipeline = "ZodPipeline", n.ZodReadonly = "ZodReadonly";
|
|
2242
|
-
})(g || (g = {}));
|
|
2243
|
-
var It = (n, e = { message: `Input not instance of ${n.name}` }) => Ke((a) => a instanceof n, e);
|
|
2244
|
-
var Ge = q.create;
|
|
2245
|
-
var Xe = F.create;
|
|
2246
|
-
var Et = fe.create;
|
|
2247
|
-
var Nt = J.create;
|
|
2248
|
-
var Qe = Y.create;
|
|
2249
|
-
var At = K.create;
|
|
2250
|
-
var Rt = de.create;
|
|
2251
|
-
var Lt = G.create;
|
|
2252
|
-
var zt = X.create;
|
|
2253
|
-
var Mt = W.create;
|
|
2254
|
-
var $t = V.create;
|
|
2255
|
-
var Pt = R.create;
|
|
2256
|
-
var Vt = ue.create;
|
|
2257
|
-
var Dt = D.create;
|
|
2258
|
-
var Ut = O.create;
|
|
2259
|
-
var Bt = O.strictCreate;
|
|
2260
|
-
var qt = Q.create;
|
|
2261
|
-
var Wt = Ze.create;
|
|
2262
|
-
var Ht = ee.create;
|
|
2263
|
-
var Ft = M.create;
|
|
2264
|
-
var Jt = Ie.create;
|
|
2265
|
-
var Yt = pe.create;
|
|
2266
|
-
var Kt = he.create;
|
|
2267
|
-
var Gt = Ee.create;
|
|
2268
|
-
var Xt = te.create;
|
|
2269
|
-
var Qt = ae.create;
|
|
2270
|
-
var ea = ne.create;
|
|
2271
|
-
var ta = re.create;
|
|
2272
|
-
var aa = H.create;
|
|
2273
|
-
var He = Z.create;
|
|
2274
|
-
var na = A.create;
|
|
2275
|
-
var ra = U.create;
|
|
2276
|
-
var ia = Z.createWithPreprocess;
|
|
2277
|
-
var oa = be.create;
|
|
2278
|
-
var sa = () => Ge().optional();
|
|
2279
|
-
var la = () => Xe().optional();
|
|
2280
|
-
var ca = () => Qe().optional();
|
|
2281
|
-
var da = { string: (n) => q.create(y(c({}, n), { coerce: true })), number: (n) => F.create(y(c({}, n), { coerce: true })), boolean: (n) => Y.create(y(c({}, n), { coerce: true })), bigint: (n) => J.create(y(c({}, n), { coerce: true })), date: (n) => K.create(y(c({}, n), { coerce: true })) };
|
|
2282
|
-
var ua = v;
|
|
2283
|
-
var t = Object.freeze({ __proto__: null, defaultErrorMap: ve, setErrorMap: ft, getErrorMap: je, makeIssue: Oe, EMPTY_PATH: gt, addIssueToContext: h, ParseStatus: T, INVALID: v, DIRTY: Je, OK: j, isAborted: $e, isDirty: Pe, isValid: _e, isAsync: Ce, get util() {
|
|
2284
|
-
return S;
|
|
2285
|
-
}, get objectUtil() {
|
|
2286
|
-
return Me;
|
|
2287
|
-
}, ZodParsedType: p, getParsedType: B, ZodType: b, ZodString: q, ZodNumber: F, ZodBigInt: J, ZodBoolean: Y, ZodDate: K, ZodSymbol: de, ZodUndefined: G, ZodNull: X, ZodAny: W, ZodUnknown: V, ZodNever: R, ZodVoid: ue, ZodArray: D, ZodObject: O, ZodUnion: Q, ZodDiscriminatedUnion: Ze, ZodIntersection: ee, ZodTuple: M, ZodRecord: Ie, ZodMap: pe, ZodSet: he, ZodFunction: Ee, ZodLazy: te, ZodLiteral: ae, ZodEnum: ne, ZodNativeEnum: re, ZodPromise: H, ZodEffects: Z, ZodTransformer: Z, ZodOptional: A, ZodNullable: U, ZodDefault: ie, ZodCatch: me, ZodNaN: fe, BRAND: Ct, ZodBranded: Ne, ZodPipeline: be, ZodReadonly: ge, custom: Ke, Schema: b, ZodSchema: b, late: Zt, get ZodFirstPartyTypeKind() {
|
|
2288
|
-
return g;
|
|
2289
|
-
}, coerce: da, any: Mt, array: Dt, bigint: Nt, boolean: Qe, date: At, discriminatedUnion: Wt, effect: He, enum: ea, function: Gt, instanceof: It, intersection: Ht, lazy: Xt, literal: Qt, map: Yt, nan: Et, nativeEnum: ta, never: Pt, null: zt, nullable: ra, number: Xe, object: Ut, oboolean: ca, onumber: la, optional: na, ostring: sa, pipeline: oa, preprocess: ia, promise: aa, record: Jt, set: Kt, strictObject: Bt, string: Ge, symbol: Rt, transformer: He, tuple: Ft, undefined: Lt, union: qt, unknown: $t, void: Vt, NEVER: ua, ZodIssueCode: d, quotelessJson: mt, ZodError: C });
|
|
2290
|
-
var L = t.object({ url: t.string(), text: t.string().optional(), accessibilityDescription: t.string().optional() });
|
|
2291
|
-
var pa = t.union([t.literal("date"), t.literal("email"), t.literal("numeric"), t.literal("password"), t.literal("phone-number"), t.literal("base64url")]);
|
|
2292
|
-
var z = t.object({ providesTitle: t.boolean().optional(), providesDescription: t.boolean().optional(), providesIcon: t.boolean().optional(), providesImage: t.boolean().optional() });
|
|
2293
|
-
var Ae = t.union([t.literal("on"), t.literal("name"), t.literal("name-prefix"), t.literal("given-name"), t.literal("additional-name"), t.literal("family-name"), t.literal("name-suffix"), t.literal("nickname"), t.literal("email"), t.literal("username"), t.literal("new-username"), t.literal("new-password"), t.literal("password"), t.literal("one-time-code"), t.literal("job-title"), t.literal("organization-name"), t.literal("full-street-address"), t.literal("street-address-line-1"), t.literal("street-address-line-2"), t.literal("street-address-line-3"), t.literal("address-level-1"), t.literal("address-level-2"), t.literal("address-level-3"), t.literal("address-level-4"), t.literal("country-code"), t.literal("country-name"), t.literal("postal-code"), t.literal("credit-card-name"), t.literal("credit-card-given-name"), t.literal("credit-card-middle-name"), t.literal("credit-card-family-name"), t.literal("credit-card-number"), t.literal("credit-card-expiration"), t.literal("credit-card-expiration-month"), t.literal("credit-card-expiration-year"), t.literal("credit-card-security-code"), t.literal("credit-card-type"), t.literal("transaction-currency"), t.literal("transaction-amount"), t.literal("language"), t.literal("birthdate"), t.literal("birthdate-day"), t.literal("birthdate-month"), t.literal("birthdate-year"), t.literal("gender"), t.literal("phone-number"), t.literal("phone-country-code"), t.literal("phone-national"), t.literal("phone-area-code"), t.literal("phone-local"), t.literal("phone-local-prefix"), t.literal("phone-local-suffix"), t.literal("phone-extension"), t.literal("url"), t.literal("photo"), t.literal("impp"), t.literal("shipping"), t.literal("billing"), t.literal("home"), t.literal("work"), t.literal("mobile"), t.literal("fax"), t.literal("pager")]);
|
|
2294
|
-
var oe = t.object({ markdown: t.string() });
|
|
2295
|
-
var ha = t.union([t.literal("camera"), t.literal("file")]);
|
|
2296
|
-
var $ = t.lazy(() => t.union([t.string(), t.number(), t.boolean(), t.record($), t.array($)]).nullable());
|
|
2297
|
-
var ma = t.union([t.literal("file"), t.literal("camera")]);
|
|
2298
|
-
var fa = t.union([t.literal("warning"), t.literal("neutral"), t.literal("positive")]);
|
|
2299
|
-
var De = t.union([t.literal("positive"), t.literal("neutral"), t.literal("warning"), t.literal("negative"), t.literal("success"), t.literal("failure"), t.literal("info"), t.literal("primary")]);
|
|
2300
|
-
var k = t.union([t.literal("xs"), t.literal("sm"), t.literal("md"), t.literal("lg"), t.literal("xl")]);
|
|
2301
|
-
var ga = t.object({ label: t.string(), value: t.string(), help: oe.optional() });
|
|
2302
|
-
var ya = t.object({ text: t.string(), context: De });
|
|
2303
|
-
var va = t.union([t.literal("not-done"), t.literal("pending"), t.literal("done")]);
|
|
2304
|
-
var Se = t.object({ type: t.literal("image"), url: t.string(), size: k.optional(), control: t.string().optional(), margin: k.optional(), text: t.string().optional(), accessibilityDescription: t.string().optional() });
|
|
2305
|
-
var _a = t.union([t.literal("none"), t.literal("left"), t.literal("right")]);
|
|
2306
|
-
var ba = t.object({ $ref: t.string() });
|
|
2307
|
-
var xa = t.object({ type: t.literal("divider"), control: t.string().optional(), margin: k.optional() });
|
|
2308
|
-
var Sa = t.object({ title: t.string() });
|
|
2309
|
-
var ka = t.object({ type: t.literal("form"), schemaId: t.string(), control: t.string().optional(), margin: k.optional(), schema: ba.optional() });
|
|
2310
|
-
var wa = t.object({ type: t.literal("instructions"), title: t.string().optional(), items: t.array(ya), control: t.string().optional(), margin: k.optional() });
|
|
2311
|
-
var Ta = t.object({ type: t.literal("loading-indicator"), size: k.optional(), control: t.string().optional(), margin: k.optional() });
|
|
2312
|
-
var Re = t.union([t.literal("left"), t.literal("center"), t.literal("right")]);
|
|
2313
|
-
var ke = t.union([t.literal("GET"), t.literal("POST"), t.literal("PUT"), t.literal("PATCH"), t.literal("DELETE")]);
|
|
2314
|
-
var ja = t.object({ url: t.string() });
|
|
2315
|
-
var Oa = t.object({ error: t.string().optional(), validation: $.optional() });
|
|
2316
|
-
var Ca = t.object({ name: t.string() });
|
|
2317
|
-
var Za = t.object({ text: t.string() });
|
|
2318
|
-
var Ia = t.union([t.literal("primary"), t.literal("secondary"), t.literal("link"), t.literal("positive"), t.literal("negative")]);
|
|
2319
|
-
var tt = t.object({ error: t.string().optional(), validation: $.optional(), refreshUrl: t.string().optional(), refreshFormUrl: t.string().optional(), analytics: t.record(t.string()).optional() });
|
|
2320
|
-
var Ea = t.object({ url: t.string(), method: ke, param: t.string(), query: t.string() });
|
|
2321
|
-
var w = t.union([Ca, Za]);
|
|
2322
|
-
var at = t.object({ defaultTitle: t.string().optional(), defaultDescription: t.string().optional(), defaultIcon: w.optional(), defaultImage: Se.optional(), providesTitle: t.boolean().optional(), providesDescription: t.boolean().optional(), providesIcon: t.boolean().optional(), providesImage: t.boolean().optional() });
|
|
2323
|
-
var se = t.object({ param: t.string(), method: ke, url: t.string() });
|
|
2324
|
-
var N = t.object({ type: t.literal("alert"), markdown: t.string(), context: De.optional(), control: t.string().optional(), margin: k.optional() });
|
|
2325
|
-
var Na = t.object({ disabled: t.boolean().optional(), hidden: t.boolean().optional(), alert: N.optional(), control: t.string().optional(), $id: t.string().optional(), const: $, title: t.string().optional(), description: t.string().optional(), icon: w.optional(), image: L.optional(), keywords: t.array(t.string()).optional(), summary: z.optional(), analyticsId: t.string().optional(), promoted: t.boolean().optional() });
|
|
2326
|
-
var Aa = t.object({ type: t.literal("blob"), disabled: t.boolean().optional(), $id: t.string().optional(), accepts: t.array(t.string()), maxSize: t.number().optional(), source: ma.optional(), title: t.string().optional(), description: t.string().optional(), control: t.string().optional(), hidden: t.boolean().optional(), icon: w.optional(), image: L.optional(), keywords: t.array(t.string()).optional(), summary: z.optional(), analyticsId: t.string().optional(), validationAsync: se.optional(), validationMessages: t.record(t.string()).optional(), alert: N.optional(), promoted: t.boolean().optional() });
|
|
2327
|
-
var P = t.object({ id: t.string().optional(), url: t.string().optional(), method: ke.optional(), exit: t.boolean().optional(), result: $.optional(), data: $.optional(), timeout: t.number().optional(), title: t.string().optional(), type: Ia.optional(), disabled: t.boolean().optional(), $id: t.string().optional(), $ref: t.string().optional(), skipValidation: t.boolean().optional() });
|
|
2328
|
-
var Ra = t.object({ type: t.literal("button"), title: t.string().optional(), action: P, context: De.optional(), disabled: t.boolean().optional(), pinOrder: t.number().optional(), control: t.string().optional(), margin: k.optional(), size: k.optional() });
|
|
2329
|
-
var La = t.object({ title: t.string(), description: t.string().optional(), icon: w, status: fa.optional() });
|
|
2330
|
-
var za = t.object({ type: t.literal("heading"), text: t.string(), size: k.optional(), align: Re.optional(), control: t.string().optional(), margin: k.optional() });
|
|
2331
|
-
var Ma = t.object({ type: t.literal("info"), markdown: t.string(), align: Re.optional(), control: t.string().optional(), margin: k.optional() });
|
|
2332
|
-
var $a = t.object({ type: t.literal("list"), items: t.array(La), title: t.string().optional(), control: t.string().optional(), margin: k.optional() });
|
|
2333
|
-
var Pa = t.object({ type: t.literal("markdown"), content: t.string(), align: Re.optional(), control: t.string().optional(), margin: k.optional() });
|
|
2334
|
-
var Va = t.object({ type: t.literal("paragraph"), text: t.string(), align: Re.optional(), control: t.string().optional(), margin: k.optional() });
|
|
2335
|
-
var Da = t.object({ type: t.literal("search"), title: t.string(), method: ke, url: t.string(), param: t.string(), emptyMessage: t.string().optional(), control: t.string().optional(), margin: k.optional() });
|
|
2336
|
-
var Ua = t.object({ title: t.string(), description: t.string().optional(), icon: w, status: va.optional() });
|
|
2337
|
-
var Ba = t.object({ action: P, title: t.string(), description: t.string().optional(), disabled: t.boolean().optional(), icon: w.optional(), image: Se.optional() });
|
|
2338
|
-
var qa = t.object({ regexPattern: t.string(), action: P });
|
|
2339
|
-
var Wa = t.object({ action: P });
|
|
2340
|
-
var Sn = t.union([z, at]);
|
|
2341
|
-
var et = t.object({ title: t.string().optional(), action: P });
|
|
2342
|
-
var nt = t.object({ action: P });
|
|
2343
|
-
var Ha = t.object({ type: t.literal("search"), title: t.string(), description: t.string().optional(), icon: w.optional(), image: Se.optional(), value: Ea });
|
|
2344
|
-
var Fa = t.object({ type: t.literal("action"), title: t.string(), description: t.string().optional(), icon: w.optional(), image: Se.optional(), value: P });
|
|
2345
|
-
var Ja = t.object({ title: t.string(), action: P });
|
|
2346
|
-
var Ya = t.object({ type: t.literal("decision"), options: t.array(Ba), control: t.string().optional(), margin: k.optional() });
|
|
2347
|
-
var Ka = t.object({ type: t.literal("review"), fields: t.array(ga), title: t.string().optional(), callToAction: Ja.optional(), control: t.string().optional(), margin: k.optional(), orientation: t.string().optional(), action: P.optional() });
|
|
2348
|
-
var Ga = t.object({ type: t.literal("status-list"), items: t.array(Ua), title: t.string().optional(), control: t.string().optional(), margin: k.optional() });
|
|
2349
|
-
var Xa = t.object({ url: t.string(), interval: t.number(), maxAttempts: t.number(), onError: Wa });
|
|
2350
|
-
var Qa = t.object({ back: et.optional(), backButton: et.optional() });
|
|
2351
|
-
var en = t.union([Fa, Ha]);
|
|
2352
|
-
var rt = t.object({ results: t.array(en) });
|
|
2353
|
-
var tn = t.lazy(() => t.object({ type: t.literal("array"), $id: t.string().optional(), items: le, addItemTitle: t.string(), editItemTitle: t.string(), minItems: t.number().optional(), maxItems: t.number().optional(), title: t.string().optional(), description: t.string().optional(), control: t.string().optional(), hidden: t.boolean().optional(), icon: w.optional(), image: L.optional(), keywords: t.array(t.string()).optional(), summary: at.optional(), analyticsId: t.string().optional(), persistAsync: ye.optional(), validationAsync: se.optional(), alert: N.optional(), validationMessages: t.record(t.string()).optional(), disabled: t.boolean().optional(), promoted: t.boolean().optional() }));
|
|
2354
|
-
var le = t.lazy(() => t.union([un, cn, Aa, rn, Na, an, sn, ln, on, nn]));
|
|
2355
|
-
var ye = t.lazy(() => t.object({ param: t.string(), idProperty: t.string(), schema: le, url: t.string(), method: ke }));
|
|
2356
|
-
var an = t.lazy(() => t.object({ type: t.literal("integer"), placeholder: t.string().optional(), minimum: t.number().optional(), maximum: t.number().optional(), $id: t.string().optional(), title: t.string().optional(), description: t.string().optional(), control: t.string().optional(), default: t.number().optional(), hidden: t.boolean().optional(), disabled: t.boolean().optional(), icon: w.optional(), image: L.optional(), keywords: t.array(t.string()).optional(), summary: z.optional(), analyticsId: t.string().optional(), persistAsync: ye.optional(), refreshStepOnChange: t.boolean().optional(), validationAsync: se.optional(), validationMessages: t.record(t.string()).optional(), alert: N.optional(), autocompleteHint: t.array(Ae).optional(), autofillKey: t.string().optional(), help: oe.optional(), autofillProvider: t.string().optional(), promoted: t.boolean().optional(), refreshFormOnChange: t.boolean().optional(), refreshUrl: t.string().optional(), refreshFormUrl: t.string().optional() }));
|
|
2357
|
-
var nn = t.lazy(() => t.object({ type: t.literal("string"), format: pa.optional(), displayFormat: t.string().optional(), placeholder: t.string().optional(), minLength: t.number().optional(), maxLength: t.number().optional(), minimum: t.string().optional(), maximum: t.string().optional(), pattern: t.string().optional(), $id: t.string().optional(), title: t.string().optional(), description: t.string().optional(), control: t.string().optional(), default: t.string().optional(), hidden: t.boolean().optional(), disabled: t.boolean().optional(), icon: w.optional(), image: L.optional(), keywords: t.array(t.string()).optional(), summary: z.optional(), analyticsId: t.string().optional(), persistAsync: ye.optional(), refreshStepOnChange: t.boolean().optional(), validationAsync: se.optional(), validationMessages: t.record(t.string()).optional(), alert: N.optional(), autocompleteHint: t.array(Ae).optional(), autofillKey: t.string().optional(), help: oe.optional(), autofillProvider: t.string().optional(), promoted: t.boolean().optional(), refreshFormOnChange: t.boolean().optional(), refreshUrl: t.string().optional(), refreshFormUrl: t.string().optional(), cameraConfig: t.unknown().optional(), accepts: t.array(t.string()).optional(), maxSize: t.number().optional(), source: ha.optional() }));
|
|
2358
|
-
var rn = t.lazy(() => t.object({ type: t.literal("boolean"), $id: t.string().optional(), title: t.string().optional(), description: t.string().optional(), control: t.string().optional(), default: t.boolean().optional(), hidden: t.boolean().optional(), disabled: t.boolean().optional(), icon: w.optional(), image: L.optional(), keywords: t.array(t.string()).optional(), summary: z.optional(), analyticsId: t.string().optional(), persistAsync: ye.optional(), refreshStepOnChange: t.boolean().optional(), validationAsync: se.optional(), alert: N.optional(), autofillKey: t.string().optional(), help: oe.optional(), autofillProvider: t.string().optional(), promoted: t.boolean().optional(), refreshFormOnChange: t.boolean().optional(), refreshUrl: t.string().optional(), refreshFormUrl: t.string().optional() }));
|
|
2359
|
-
var on = t.lazy(() => t.object({ disabled: t.boolean().optional(), oneOf: t.array(le), placeholder: t.string().optional(), $id: t.string().optional(), title: t.string().optional(), description: t.string().optional(), control: t.string().optional(), default: $.optional(), hidden: t.boolean().optional(), icon: w.optional(), image: L.optional(), keywords: t.array(t.string()).optional(), summary: z.optional(), analyticsId: t.string().optional(), refreshStepOnChange: t.boolean().optional(), alert: N.optional(), help: oe.optional(), autocompleteHint: t.array(Ae).optional(), autofillKey: t.string().optional(), validationMessages: t.record(t.string()).optional(), autofillProvider: t.string().optional(), promoted: t.boolean().optional(), refreshFormOnChange: t.boolean().optional(), refreshUrl: t.string().optional(), refreshFormUrl: t.string().optional(), promotion: $.optional() }));
|
|
2360
|
-
var sn = t.lazy(() => t.object({ type: t.literal("number"), placeholder: t.string().optional(), minimum: t.number().optional(), maximum: t.number().optional(), $id: t.string().optional(), title: t.string().optional(), description: t.string().optional(), control: t.string().optional(), default: t.number().optional(), hidden: t.boolean().optional(), disabled: t.boolean().optional(), icon: w.optional(), image: L.optional(), keywords: t.array(t.string()).optional(), summary: z.optional(), analyticsId: t.string().optional(), persistAsync: ye.optional(), refreshStepOnChange: t.boolean().optional(), validationAsync: se.optional(), validationMessages: t.record(t.string()).optional(), alert: N.optional(), autocompleteHint: t.array(Ae).optional(), autofillKey: t.string().optional(), help: oe.optional(), autofillProvider: t.string().optional(), promoted: t.boolean().optional(), refreshFormOnChange: t.boolean().optional(), refreshUrl: t.string().optional(), refreshFormUrl: t.string().optional() }));
|
|
2361
|
-
var ln = t.lazy(() => t.object({ type: t.literal("object"), disabled: t.boolean().optional(), properties: t.record(le), displayOrder: t.array(t.string()), required: t.array(t.string()).optional(), $id: t.string().optional(), title: t.string().optional(), description: t.string().optional(), control: t.string().optional(), hidden: t.boolean().optional(), icon: w.optional(), image: L.optional(), keywords: t.array(t.string()).optional(), summary: z.optional(), analyticsId: t.string().optional(), alert: N.optional(), promoted: t.boolean().optional(), help: oe.optional() }));
|
|
2362
|
-
var cn = t.lazy(() => t.union([tn, dn]));
|
|
2363
|
-
var dn = t.lazy(() => t.object({ type: t.literal("array"), $id: t.string().optional(), items: t.array(le), title: t.string().optional(), description: t.string().optional(), control: t.string().optional(), hidden: t.boolean().optional(), icon: w.optional(), image: L.optional(), keywords: t.array(t.string()).optional(), summary: z.optional(), analyticsId: t.string().optional(), persistAsync: ye.optional(), validationAsync: se.optional(), alert: N.optional(), disabled: t.boolean().optional(), promoted: t.boolean().optional() }));
|
|
2364
|
-
var un = t.lazy(() => t.object({ disabled: t.boolean().optional(), allOf: t.array(le), $id: t.string().optional(), title: t.string().optional(), description: t.string().optional(), control: t.string().optional(), hidden: t.boolean().optional(), icon: w.optional(), image: L.optional(), keywords: t.array(t.string()).optional(), summary: z.optional(), analyticsId: t.string().optional(), alert: N.optional(), promoted: t.boolean().optional() }));
|
|
2365
|
-
var pn = t.lazy(() => t.object({ type: t.literal("columns"), left: t.array(xe), right: t.array(xe), bias: _a.optional(), control: t.string().optional(), margin: k.optional() }));
|
|
2366
|
-
var xe = t.lazy(() => t.union([N, fn, Ra, pn, Ya, xa, ka, za, Se, Ma, wa, $a, Ta, Pa, hn, Va, Ka, Da, Ga]));
|
|
2367
|
-
var hn = t.lazy(() => t.object({ type: t.literal("modal"), control: t.string().optional(), margin: k.optional(), trigger: Sa, content: mn }));
|
|
2368
|
-
var mn = t.lazy(() => t.object({ components: t.array(xe) }));
|
|
2369
|
-
var fn = t.lazy(() => t.object({ type: t.literal("box"), components: t.array(xe), width: k.optional(), border: t.boolean().optional(), control: t.string().optional(), margin: k.optional() }));
|
|
2370
|
-
var it = t.lazy(() => t.object({ id: t.string(), title: t.string(), schemas: t.array(le), layout: t.array(xe), model: $.optional(), external: ja.optional(), polling: Xa.optional(), linkHandlers: t.array(qa).optional(), analytics: t.record(t.string()).optional(), errors: Oa.optional(), navigation: Qa.optional(), refreshUrl: t.string().optional(), key: t.string().optional(), type: t.string().optional(), actions: t.array(P).optional(), refreshFormUrl: t.string().optional() }));
|
|
713
|
+
})();
|
|
2371
714
|
}
|
|
2372
715
|
});
|
|
2373
716
|
|
|
@@ -2690,7 +1033,7 @@ function isReference(block) {
|
|
|
2690
1033
|
}
|
|
2691
1034
|
|
|
2692
1035
|
// src/legacy/dynamicFlow/DynamicFlow.tsx
|
|
2693
|
-
var
|
|
1036
|
+
var import_react45 = require("react");
|
|
2694
1037
|
var import_react_intl30 = require("react-intl");
|
|
2695
1038
|
|
|
2696
1039
|
// src/legacy/common/contexts/dynamicFlowContexts/DynamicFlowContexts.tsx
|
|
@@ -2761,57 +1104,9 @@ var getEventDispatcher = (onEvent, metadata) => (eventName, properties = {}) =>
|
|
|
2761
1104
|
}
|
|
2762
1105
|
};
|
|
2763
1106
|
|
|
2764
|
-
// src/legacy/common/contexts/
|
|
1107
|
+
// src/legacy/common/contexts/logContext/LogContext.tsx
|
|
2765
1108
|
var import_react4 = require("react");
|
|
2766
|
-
|
|
2767
|
-
// src/common/makeHttpClient/makeHttpClient.ts
|
|
2768
|
-
var makeHttpClient = (baseUrl, additionalHeaders) => (
|
|
2769
|
-
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
2770
|
-
(input, init) => {
|
|
2771
|
-
const resource = applyBaseUrl(input, baseUrl || "");
|
|
2772
|
-
const headers2 = mergeHeaders(init == null ? void 0 : init.headers, additionalHeaders);
|
|
2773
|
-
return fetch(resource, __spreadProps(__spreadValues({}, init != null ? init : {}), { headers: headers2 }));
|
|
2774
|
-
}
|
|
2775
|
-
);
|
|
2776
|
-
var applyBaseUrl = (input, baseUrl) => typeof input === "string" && isRelativePath(input) ? baseUrl + input : input;
|
|
2777
|
-
var mergeHeaders = (initHeaders, additionalHeaders) => {
|
|
2778
|
-
if (!initHeaders && !additionalHeaders) {
|
|
2779
|
-
return {};
|
|
2780
|
-
}
|
|
2781
|
-
const headers2 = new Headers(initHeaders);
|
|
2782
|
-
for (const [key, value] of Object.entries(additionalHeaders != null ? additionalHeaders : {})) {
|
|
2783
|
-
headers2.set(key, value);
|
|
2784
|
-
}
|
|
2785
|
-
return headers2;
|
|
2786
|
-
};
|
|
2787
|
-
function isRelativePath(url = "") {
|
|
2788
|
-
return !["https://", "http://", "data:"].some(
|
|
2789
|
-
(prefix) => url.startsWith(prefix) && url.length > prefix.length
|
|
2790
|
-
);
|
|
2791
|
-
}
|
|
2792
|
-
|
|
2793
|
-
// src/legacy/common/contexts/httpClientContext/HttpClientContext.tsx
|
|
2794
1109
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
2795
|
-
var HttpClientContext = (0, import_react4.createContext)(void 0);
|
|
2796
|
-
function HttpClientProvider({ httpClient, children }) {
|
|
2797
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(HttpClientContext.Provider, { value: httpClient, children });
|
|
2798
|
-
}
|
|
2799
|
-
function HttpClientProviderFromBaseUrl({ baseUrl, children }) {
|
|
2800
|
-
const httpClient = (0, import_react4.useMemo)(() => makeHttpClient(baseUrl), [baseUrl]);
|
|
2801
|
-
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(HttpClientContext.Provider, { value: httpClient, children });
|
|
2802
|
-
}
|
|
2803
|
-
var useHttpClient = () => {
|
|
2804
|
-
const contextFetch = (0, import_react4.useContext)(HttpClientContext);
|
|
2805
|
-
return contextFetch != null ? contextFetch : fetch;
|
|
2806
|
-
};
|
|
2807
|
-
var useHasHttpClientProvider = () => {
|
|
2808
|
-
const context = (0, import_react4.useContext)(HttpClientContext);
|
|
2809
|
-
return Boolean(context);
|
|
2810
|
-
};
|
|
2811
|
-
|
|
2812
|
-
// src/legacy/common/contexts/logContext/LogContext.tsx
|
|
2813
|
-
var import_react5 = require("react");
|
|
2814
|
-
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
2815
1110
|
var getLogger = (level, onLog, flowId = "UNKNOWN-FLOW-ID", stepId = "UNKNOWN-FLOW-ID") => (title, description, extra) => {
|
|
2816
1111
|
try {
|
|
2817
1112
|
onLog(level, `Dynamic Flow ${level} - ${title} - ${description}`, __spreadValues({
|
|
@@ -2821,9 +1116,9 @@ var getLogger = (level, onLog, flowId = "UNKNOWN-FLOW-ID", stepId = "UNKNOWN-FLO
|
|
|
2821
1116
|
} catch (e) {
|
|
2822
1117
|
}
|
|
2823
1118
|
};
|
|
2824
|
-
var LogContext = (0,
|
|
1119
|
+
var LogContext = (0, import_react4.createContext)(null);
|
|
2825
1120
|
function LogProvider({ flowId, stepId, children, onLog }) {
|
|
2826
|
-
const value = (0,
|
|
1121
|
+
const value = (0, import_react4.useMemo)(
|
|
2827
1122
|
() => ({
|
|
2828
1123
|
debug: getLogger("debug", onLog, flowId, stepId),
|
|
2829
1124
|
info: getLogger("info", onLog, flowId, stepId),
|
|
@@ -2833,10 +1128,10 @@ function LogProvider({ flowId, stepId, children, onLog }) {
|
|
|
2833
1128
|
}),
|
|
2834
1129
|
[onLog, flowId, stepId]
|
|
2835
1130
|
);
|
|
2836
|
-
return /* @__PURE__ */ (0,
|
|
1131
|
+
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(LogContext.Provider, { value, children });
|
|
2837
1132
|
}
|
|
2838
1133
|
var useLogger = () => {
|
|
2839
|
-
const logging = (0,
|
|
1134
|
+
const logging = (0, import_react4.useContext)(LogContext);
|
|
2840
1135
|
if (logging == null) {
|
|
2841
1136
|
throw new Error(
|
|
2842
1137
|
"Logging context not found. Did you forget to wrap your component in a <LogProvider />?"
|
|
@@ -2846,11 +1141,11 @@ var useLogger = () => {
|
|
|
2846
1141
|
};
|
|
2847
1142
|
|
|
2848
1143
|
// src/legacy/common/contexts/featureContext/FeatureContext.tsx
|
|
2849
|
-
var
|
|
2850
|
-
var
|
|
2851
|
-
var FeatureContext = (0,
|
|
1144
|
+
var import_react5 = require("react");
|
|
1145
|
+
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
1146
|
+
var FeatureContext = (0, import_react5.createContext)([]);
|
|
2852
1147
|
function FeatureContextProvider({ features, children }) {
|
|
2853
|
-
return /* @__PURE__ */ (0,
|
|
1148
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FeatureContext.Provider, { value: features, children });
|
|
2854
1149
|
}
|
|
2855
1150
|
|
|
2856
1151
|
// src/legacy/common/utils/api-utils.ts
|
|
@@ -2860,11 +1155,6 @@ function isStatus2xx(status) {
|
|
|
2860
1155
|
function isStatus422(status) {
|
|
2861
1156
|
return status === 422;
|
|
2862
1157
|
}
|
|
2863
|
-
function isRelativePath2(url = "") {
|
|
2864
|
-
return !["https://", "http://", "data:"].some(
|
|
2865
|
-
(prefix) => url.startsWith(prefix) && url.length > prefix.length
|
|
2866
|
-
);
|
|
2867
|
-
}
|
|
2868
1158
|
|
|
2869
1159
|
// src/legacy/common/validators/types/type-validators.ts
|
|
2870
1160
|
var isString = (value) => typeof value === "string";
|
|
@@ -3571,18 +1861,18 @@ var isTouchScreen = (navigator2 = window.navigator, matchMedia = window.matchMed
|
|
|
3571
1861
|
};
|
|
3572
1862
|
|
|
3573
1863
|
// src/legacy/common/hooks/useDebouncedFunction/useDebouncedFunction.tsx
|
|
3574
|
-
var
|
|
1864
|
+
var import_react6 = require("react");
|
|
3575
1865
|
function useDebouncedFunction(callback, waitMs) {
|
|
3576
|
-
return (0,
|
|
1866
|
+
return (0, import_react6.useCallback)(debounce(callback, waitMs), [callback, waitMs]);
|
|
3577
1867
|
}
|
|
3578
1868
|
|
|
3579
1869
|
// src/legacy/common/hooks/useExternal/useExternal.tsx
|
|
3580
|
-
var
|
|
1870
|
+
var import_react7 = require("react");
|
|
3581
1871
|
function useExternal(url) {
|
|
3582
|
-
const [externalWindow, setExternalWindow] = (0,
|
|
3583
|
-
const [hasManuallyTriggered, setHasManuallyTriggered] = (0,
|
|
1872
|
+
const [externalWindow, setExternalWindow] = (0, import_react7.useState)(null);
|
|
1873
|
+
const [hasManuallyTriggered, setHasManuallyTriggered] = (0, import_react7.useState)(false);
|
|
3584
1874
|
const dismissConfirmation = () => setHasManuallyTriggered(true);
|
|
3585
|
-
(0,
|
|
1875
|
+
(0, import_react7.useEffect)(() => {
|
|
3586
1876
|
if (url) {
|
|
3587
1877
|
setHasManuallyTriggered(false);
|
|
3588
1878
|
setExternalWindow(window.open(url, "_blank"));
|
|
@@ -3594,6 +1884,58 @@ function useExternal(url) {
|
|
|
3594
1884
|
|
|
3595
1885
|
// src/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.tsx
|
|
3596
1886
|
var import_react9 = require("react");
|
|
1887
|
+
|
|
1888
|
+
// src/common/httpClientContext/HttpClientContext.tsx
|
|
1889
|
+
var import_react8 = require("react");
|
|
1890
|
+
|
|
1891
|
+
// src/common/utils/api-utils.ts
|
|
1892
|
+
function isRelativePath(url = "") {
|
|
1893
|
+
return !["https://", "http://", "data:"].some(
|
|
1894
|
+
(prefix) => url.startsWith(prefix) && url.length > prefix.length
|
|
1895
|
+
);
|
|
1896
|
+
}
|
|
1897
|
+
|
|
1898
|
+
// src/common/makeHttpClient/makeHttpClient.ts
|
|
1899
|
+
var makeHttpClient = (baseUrl, additionalHeaders) => (
|
|
1900
|
+
// eslint-disable-next-line @typescript-eslint/promise-function-async
|
|
1901
|
+
(input, init) => {
|
|
1902
|
+
const resource = applyBaseUrl(input, baseUrl || "");
|
|
1903
|
+
const headers2 = mergeHeaders(init == null ? void 0 : init.headers, additionalHeaders);
|
|
1904
|
+
return fetch(resource, __spreadProps(__spreadValues({}, init != null ? init : {}), { headers: headers2 }));
|
|
1905
|
+
}
|
|
1906
|
+
);
|
|
1907
|
+
var applyBaseUrl = (input, baseUrl) => typeof input === "string" && isRelativePath(input) ? baseUrl + input : input;
|
|
1908
|
+
var mergeHeaders = (initHeaders, additionalHeaders) => {
|
|
1909
|
+
if (!initHeaders && !additionalHeaders) {
|
|
1910
|
+
return {};
|
|
1911
|
+
}
|
|
1912
|
+
const headers2 = new Headers(initHeaders);
|
|
1913
|
+
for (const [key, value] of Object.entries(additionalHeaders != null ? additionalHeaders : {})) {
|
|
1914
|
+
headers2.set(key, value);
|
|
1915
|
+
}
|
|
1916
|
+
return headers2;
|
|
1917
|
+
};
|
|
1918
|
+
|
|
1919
|
+
// src/common/httpClientContext/HttpClientContext.tsx
|
|
1920
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
1921
|
+
var HttpClientContext = (0, import_react8.createContext)(void 0);
|
|
1922
|
+
function HttpClientProvider({ httpClient, children }) {
|
|
1923
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HttpClientContext.Provider, { value: httpClient, children });
|
|
1924
|
+
}
|
|
1925
|
+
function HttpClientProviderFromBaseUrl({ baseUrl, children }) {
|
|
1926
|
+
const httpClient = (0, import_react8.useMemo)(() => makeHttpClient(baseUrl), [baseUrl]);
|
|
1927
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(HttpClientContext.Provider, { value: httpClient, children });
|
|
1928
|
+
}
|
|
1929
|
+
var useHttpClient = () => {
|
|
1930
|
+
const contextFetch = (0, import_react8.useContext)(HttpClientContext);
|
|
1931
|
+
return contextFetch != null ? contextFetch : fetch;
|
|
1932
|
+
};
|
|
1933
|
+
var useHasHttpClientProvider = () => {
|
|
1934
|
+
const context = (0, import_react8.useContext)(HttpClientContext);
|
|
1935
|
+
return Boolean(context);
|
|
1936
|
+
};
|
|
1937
|
+
|
|
1938
|
+
// src/legacy/common/hooks/useExternalStepPolling/useExternalStepPolling.tsx
|
|
3597
1939
|
function useExternalStepPolling(polling, onAction) {
|
|
3598
1940
|
const httpClient = useHttpClient();
|
|
3599
1941
|
const asyncFn = (0, import_react9.useMemo)(() => {
|
|
@@ -3650,12 +1992,12 @@ function useExternalStepPolling(polling, onAction) {
|
|
|
3650
1992
|
}
|
|
3651
1993
|
|
|
3652
1994
|
// src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
3653
|
-
var
|
|
1995
|
+
var import_react32 = require("react");
|
|
3654
1996
|
var import_react_intl21 = require("react-intl");
|
|
3655
1997
|
|
|
3656
|
-
// src/
|
|
1998
|
+
// src/common/messages/persist-async.messages.ts
|
|
3657
1999
|
var import_react_intl = require("react-intl");
|
|
3658
|
-
var
|
|
2000
|
+
var persist_async_messages_default = (0, import_react_intl.defineMessages)({
|
|
3659
2001
|
genericError: {
|
|
3660
2002
|
id: "dynamicFlows.PersistAsyncSchema.genericError",
|
|
3661
2003
|
defaultMessage: "Something went wrong, please try again later!",
|
|
@@ -3664,7 +2006,7 @@ var PersistAsyncSchema_messages_default = (0, import_react_intl.defineMessages)(
|
|
|
3664
2006
|
});
|
|
3665
2007
|
|
|
3666
2008
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBasicSchema/PersistAsyncBasicSchema.tsx
|
|
3667
|
-
var
|
|
2009
|
+
var import_react31 = require("react");
|
|
3668
2010
|
var import_react_intl20 = require("react-intl");
|
|
3669
2011
|
|
|
3670
2012
|
// src/legacy/common/constants/DateMode.ts
|
|
@@ -3713,7 +2055,7 @@ var Size = {
|
|
|
3713
2055
|
|
|
3714
2056
|
// src/legacy/jsonSchemaForm/basicTypeSchema/BasicTypeSchema.tsx
|
|
3715
2057
|
var import_classnames7 = __toESM(require_classnames());
|
|
3716
|
-
var
|
|
2058
|
+
var import_react30 = require("react");
|
|
3717
2059
|
|
|
3718
2060
|
// src/legacy/layout/alert/DynamicAlert.tsx
|
|
3719
2061
|
var import_components2 = require("@transferwise/components");
|
|
@@ -4290,7 +2632,7 @@ var DynamicExternal = ({ component, onAction }) => {
|
|
|
4290
2632
|
var DynamicExternal_default = DynamicExternal;
|
|
4291
2633
|
|
|
4292
2634
|
// src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
4293
|
-
var
|
|
2635
|
+
var import_react23 = require("react");
|
|
4294
2636
|
|
|
4295
2637
|
// src/legacy/jsonSchemaForm/allOfSchema/AllOfSchema.tsx
|
|
4296
2638
|
var import_components6 = require("@transferwise/components");
|
|
@@ -4668,7 +3010,7 @@ function getValidationMessages(schema, required, defaultErrorMessages) {
|
|
|
4668
3010
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
4669
3011
|
var import_components10 = require("@transferwise/components");
|
|
4670
3012
|
var import_icons = require("@transferwise/icons");
|
|
4671
|
-
var
|
|
3013
|
+
var import_react14 = require("react");
|
|
4672
3014
|
var import_react_intl11 = require("react-intl");
|
|
4673
3015
|
|
|
4674
3016
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/ItemSummary.tsx
|
|
@@ -4716,6 +3058,7 @@ var repeatable_messages_default = (0, import_react_intl9.defineMessages)({
|
|
|
4716
3058
|
});
|
|
4717
3059
|
|
|
4718
3060
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchemaStep.tsx
|
|
3061
|
+
var import_react13 = require("react");
|
|
4719
3062
|
var import_react_intl10 = require("react-intl");
|
|
4720
3063
|
var import_jsx_runtime21 = require("react/jsx-runtime");
|
|
4721
3064
|
function RepeatableSchemaStep({
|
|
@@ -4728,6 +3071,7 @@ function RepeatableSchemaStep({
|
|
|
4728
3071
|
onAction
|
|
4729
3072
|
}) {
|
|
4730
3073
|
const { formatMessage } = (0, import_react_intl10.useIntl)();
|
|
3074
|
+
const [filename, setFilename] = (0, import_react13.useState)(void 0);
|
|
4731
3075
|
const step = {
|
|
4732
3076
|
layout: [
|
|
4733
3077
|
{
|
|
@@ -4757,6 +3101,13 @@ function RepeatableSchemaStep({
|
|
|
4757
3101
|
actions: [],
|
|
4758
3102
|
schemas: []
|
|
4759
3103
|
};
|
|
3104
|
+
const onChange = (props) => {
|
|
3105
|
+
const _a = props, { metadata, model: model2 } = _a, modelChangeProps = __objRest(_a, ["metadata", "model"]);
|
|
3106
|
+
if (schema.items.format === "base64url" && typeof model2 === "string" && typeof (metadata == null ? void 0 : metadata.filename) === "string") {
|
|
3107
|
+
setFilename(metadata.filename);
|
|
3108
|
+
}
|
|
3109
|
+
onModelChange(__spreadProps(__spreadValues({}, modelChangeProps), { model: model2 }));
|
|
3110
|
+
};
|
|
4760
3111
|
return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
|
|
4761
3112
|
DynamicFlowStep,
|
|
4762
3113
|
{
|
|
@@ -4767,9 +3118,10 @@ function RepeatableSchemaStep({
|
|
|
4767
3118
|
formErrors: errors,
|
|
4768
3119
|
globalError: null,
|
|
4769
3120
|
onAction: (action) => {
|
|
4770
|
-
onAction(action.url);
|
|
3121
|
+
onAction(action.url, filename);
|
|
3122
|
+
setFilename(void 0);
|
|
4771
3123
|
},
|
|
4772
|
-
onModelChange
|
|
3124
|
+
onModelChange: onChange
|
|
4773
3125
|
}
|
|
4774
3126
|
);
|
|
4775
3127
|
}
|
|
@@ -4963,8 +3315,8 @@ var schemaSummaryProvides = (summary, providesProp) => (
|
|
|
4963
3315
|
// src/legacy/jsonSchemaForm/arrayTypeSchema/arrayListSchema/repeatableSchema/RepeatableSchema.tsx
|
|
4964
3316
|
var import_jsx_runtime22 = require("react/jsx-runtime");
|
|
4965
3317
|
function RepeatableSchema({ schema, model, errors, submitted, onChange }) {
|
|
4966
|
-
const [openModalType, setOpenModalType] = (0,
|
|
4967
|
-
const [itemSummaries, setItemSummaries] = (0,
|
|
3318
|
+
const [openModalType, setOpenModalType] = (0, import_react14.useState)(null);
|
|
3319
|
+
const [itemSummaries, setItemSummaries] = (0, import_react14.useState)(() => {
|
|
4968
3320
|
if (isObject(model) && !isArray(model)) {
|
|
4969
3321
|
throw new Error(
|
|
4970
3322
|
"RepeatableSchema does not support object models. Ensure your array schema is wrapped inside an object schema."
|
|
@@ -4972,7 +3324,7 @@ function RepeatableSchema({ schema, model, errors, submitted, onChange }) {
|
|
|
4972
3324
|
}
|
|
4973
3325
|
return model ? model.map((item) => getItemSummaryFromSchema(schema.items, item, schema == null ? void 0 : schema.summary)) : null;
|
|
4974
3326
|
});
|
|
4975
|
-
const [editableItem, setEditableItem] = (0,
|
|
3327
|
+
const [editableItem, setEditableItem] = (0, import_react14.useState)({ item: null, model: null });
|
|
4976
3328
|
const broadcastModelChange = (updatedItems) => {
|
|
4977
3329
|
const updatedModel = updatedItems ? updatedItems.map(({ value }) => value) : null;
|
|
4978
3330
|
onChange({
|
|
@@ -4988,9 +3340,13 @@ function RepeatableSchema({ schema, model, errors, submitted, onChange }) {
|
|
|
4988
3340
|
setEditableItem({ item, model: item.value });
|
|
4989
3341
|
setOpenModalType("edit");
|
|
4990
3342
|
};
|
|
4991
|
-
const onSaveItem = (action) => {
|
|
3343
|
+
const onSaveItem = (action, summaryTextOverride) => {
|
|
4992
3344
|
var _a;
|
|
4993
|
-
const updatedItem = action === "remove" ? null : getItemSummaryFromSchema(
|
|
3345
|
+
const updatedItem = action === "remove" ? null : getItemSummaryFromSchema(
|
|
3346
|
+
schema.items,
|
|
3347
|
+
summaryTextOverride != null ? summaryTextOverride : editableItem.model,
|
|
3348
|
+
schema.summary
|
|
3349
|
+
);
|
|
4994
3350
|
if (action !== "remove" && !isValidSchema((_a = updatedItem == null ? void 0 : updatedItem.value) != null ? _a : null, schema.items)) {
|
|
4995
3351
|
return;
|
|
4996
3352
|
}
|
|
@@ -5109,7 +3465,7 @@ var ArraySchema_default = ArraySchema;
|
|
|
5109
3465
|
// src/legacy/jsonSchemaForm/objectSchema/ObjectSchema.tsx
|
|
5110
3466
|
var import_components11 = require("@transferwise/components");
|
|
5111
3467
|
var import_classnames3 = __toESM(require_classnames());
|
|
5112
|
-
var
|
|
3468
|
+
var import_react15 = require("react");
|
|
5113
3469
|
var import_jsx_runtime25 = require("react/jsx-runtime");
|
|
5114
3470
|
var getSchemaColumnClasses2 = (width) => ({
|
|
5115
3471
|
"col-xs-12": true,
|
|
@@ -5117,7 +3473,7 @@ var getSchemaColumnClasses2 = (width) => ({
|
|
|
5117
3473
|
"col-sm-4": width === "sm"
|
|
5118
3474
|
});
|
|
5119
3475
|
function ObjectSchema(props) {
|
|
5120
|
-
const [model, setModel] = (0,
|
|
3476
|
+
const [model, setModel] = (0, import_react15.useState)(() => __spreadValues({}, getValidObjectModelParts(props.model, props.schema)));
|
|
5121
3477
|
const onChangeProperty = (propertyName, onChangeProps) => {
|
|
5122
3478
|
if (onChangeProps.model !== null) {
|
|
5123
3479
|
model[propertyName] = onChangeProps.model;
|
|
@@ -5128,7 +3484,7 @@ function ObjectSchema(props) {
|
|
|
5128
3484
|
props.onChange(__spreadProps(__spreadValues({}, onChangeProps), { model }));
|
|
5129
3485
|
};
|
|
5130
3486
|
const isRequired = (propertyName) => props.schema.required && props.schema.required.includes(propertyName);
|
|
5131
|
-
(0,
|
|
3487
|
+
(0, import_react15.useEffect)(() => {
|
|
5132
3488
|
const newModel = getValidObjectModelParts(model, props.schema) || {};
|
|
5133
3489
|
setModel(newModel);
|
|
5134
3490
|
if (!isEqual(newModel, model)) {
|
|
@@ -5189,7 +3545,7 @@ var ObjectSchema_default = ObjectSchema;
|
|
|
5189
3545
|
// src/legacy/jsonSchemaForm/oneOfSchema/OneOfSchema.tsx
|
|
5190
3546
|
var import_components15 = require("@transferwise/components");
|
|
5191
3547
|
var import_classnames4 = __toESM(require_classnames());
|
|
5192
|
-
var
|
|
3548
|
+
var import_react18 = require("react");
|
|
5193
3549
|
|
|
5194
3550
|
// src/legacy/jsonSchemaForm/help/Help.tsx
|
|
5195
3551
|
var import_components12 = require("@transferwise/components");
|
|
@@ -5213,7 +3569,7 @@ function Help(props) {
|
|
|
5213
3569
|
import_components12.Info,
|
|
5214
3570
|
{
|
|
5215
3571
|
className: "m-l-1",
|
|
5216
|
-
content: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components12.Markdown, { children: props.help.markdown }),
|
|
3572
|
+
content: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components12.Markdown, { config: { link: { target: "_blank" } }, children: props.help.markdown }),
|
|
5217
3573
|
presentation: "POPOVER",
|
|
5218
3574
|
size: "sm",
|
|
5219
3575
|
"aria-label": intl.formatMessage(help_messages_default.helpAria)
|
|
@@ -5223,11 +3579,11 @@ function Help(props) {
|
|
|
5223
3579
|
var Help_default = Help;
|
|
5224
3580
|
|
|
5225
3581
|
// src/legacy/jsonSchemaForm/schemaFormControl/SchemaFormControl.tsx
|
|
5226
|
-
var
|
|
3582
|
+
var import_react17 = require("react");
|
|
5227
3583
|
|
|
5228
3584
|
// src/legacy/formControl/FormControl.tsx
|
|
5229
3585
|
var import_components13 = require("@transferwise/components");
|
|
5230
|
-
var
|
|
3586
|
+
var import_react16 = require("react");
|
|
5231
3587
|
|
|
5232
3588
|
// src/legacy/formControl/utils/value-utils.ts
|
|
5233
3589
|
var getSafeStringValue = (value, options = {}) => {
|
|
@@ -5413,7 +3769,7 @@ var autocompleteTokenMap = {
|
|
|
5413
3769
|
|
|
5414
3770
|
// src/legacy/formControl/FormControl.tsx
|
|
5415
3771
|
var import_jsx_runtime27 = require("react/jsx-runtime");
|
|
5416
|
-
var _FormControl = class _FormControl extends
|
|
3772
|
+
var _FormControl = class _FormControl extends import_react16.PureComponent {
|
|
5417
3773
|
constructor(props) {
|
|
5418
3774
|
super(props);
|
|
5419
3775
|
this.getAutocompleteValue = () => {
|
|
@@ -5426,8 +3782,8 @@ var _FormControl = class _FormControl extends import_react15.PureComponent {
|
|
|
5426
3782
|
}
|
|
5427
3783
|
return "off";
|
|
5428
3784
|
};
|
|
5429
|
-
this.handleOnChange = (value) => {
|
|
5430
|
-
this.props.onChange(value);
|
|
3785
|
+
this.handleOnChange = (value, metadata) => {
|
|
3786
|
+
this.props.onChange(value, void 0, metadata);
|
|
5431
3787
|
};
|
|
5432
3788
|
this.handleInputOnChange = (event) => {
|
|
5433
3789
|
this.props.onChange(event.target.value);
|
|
@@ -5730,8 +4086,8 @@ var _FormControl = class _FormControl extends import_react15.PureComponent {
|
|
|
5730
4086
|
__spreadProps(__spreadValues({}, uploadProps), {
|
|
5731
4087
|
usAccept: uploadProps.usAccept || "*",
|
|
5732
4088
|
usDisabled: uploadProps.usDisabled || disabled,
|
|
5733
|
-
onSuccess: (base64url) => {
|
|
5734
|
-
this.handleOnChange(base64url);
|
|
4089
|
+
onSuccess: (base64url, filename) => {
|
|
4090
|
+
this.handleOnChange(base64url, { filename });
|
|
5735
4091
|
},
|
|
5736
4092
|
onFailure: () => {
|
|
5737
4093
|
this.handleOnChange(null);
|
|
@@ -5967,11 +4323,11 @@ function SchemaFormControl(props) {
|
|
|
5967
4323
|
const { id, schema, value, disabled, onChange, onFocus, onBlur, onSearchChange, describedBy } = props;
|
|
5968
4324
|
const log = useLogger();
|
|
5969
4325
|
const getSanitisedValue = (value2) => isNativeInput(schema.type) && (isNull(value2) || isUndefined(value2)) ? "" : value2;
|
|
5970
|
-
const onModelChange = (value2, type) => {
|
|
5971
|
-
onChange(getValidBasicModelOrNull(value2, schema), type);
|
|
4326
|
+
const onModelChange = (value2, type, metadata) => {
|
|
4327
|
+
onChange(getValidBasicModelOrNull(value2, schema), type, metadata);
|
|
5972
4328
|
};
|
|
5973
4329
|
const controlType = getControlType(schema);
|
|
5974
|
-
(0,
|
|
4330
|
+
(0, import_react17.useEffect)(() => {
|
|
5975
4331
|
warnIfInvalidSchema(schema, log, controlType);
|
|
5976
4332
|
}, [JSON.stringify(schema), log, controlType]);
|
|
5977
4333
|
const options = schema.values || getOptions(schema, controlType);
|
|
@@ -6028,14 +4384,14 @@ var SchemaFormControl_default = SchemaFormControl;
|
|
|
6028
4384
|
var import_jsx_runtime30 = require("react/jsx-runtime");
|
|
6029
4385
|
function OneOfSchema(props) {
|
|
6030
4386
|
const onEvent = useEventDispatcher();
|
|
6031
|
-
const [changed, setChanged] = (0,
|
|
6032
|
-
const [focused, setFocused] = (0,
|
|
6033
|
-
const [blurred, setBlurred] = (0,
|
|
6034
|
-
const id = (0,
|
|
6035
|
-
const [schemaIndex, setSchemaIndex] = (0,
|
|
4387
|
+
const [changed, setChanged] = (0, import_react18.useState)(false);
|
|
4388
|
+
const [focused, setFocused] = (0, import_react18.useState)(false);
|
|
4389
|
+
const [blurred, setBlurred] = (0, import_react18.useState)(false);
|
|
4390
|
+
const id = (0, import_react18.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
4391
|
+
const [schemaIndex, setSchemaIndex] = (0, import_react18.useState)(
|
|
6036
4392
|
getActiveSchemaIndex(props.schema, props.model)
|
|
6037
4393
|
);
|
|
6038
|
-
const [models, setModels] = (0,
|
|
4394
|
+
const [models, setModels] = (0, import_react18.useState)(getModelPartsForSchemas(props.model, props.schema.oneOf));
|
|
6039
4395
|
const debouncedTrackEvent = useDebouncedFunction(onEvent, 200);
|
|
6040
4396
|
const onSearchChange = (searchValue) => {
|
|
6041
4397
|
debouncedTrackEvent("Dynamic Flow - OneOf Searched", {
|
|
@@ -6043,7 +4399,7 @@ function OneOfSchema(props) {
|
|
|
6043
4399
|
searchValueLength: searchValue.length
|
|
6044
4400
|
});
|
|
6045
4401
|
};
|
|
6046
|
-
(0,
|
|
4402
|
+
(0, import_react18.useEffect)(() => {
|
|
6047
4403
|
const modelIndex = getValidIndexFromValue(props.schema, props.model);
|
|
6048
4404
|
const defaultIndex = getValidIndexFromValue(props.schema, props.schema.default);
|
|
6049
4405
|
if (modelIndex === -1 && defaultIndex >= 0) {
|
|
@@ -6066,7 +4422,7 @@ function OneOfSchema(props) {
|
|
|
6066
4422
|
setFocused(false);
|
|
6067
4423
|
setBlurred(true);
|
|
6068
4424
|
};
|
|
6069
|
-
const onChooseNewSchema = (index, type) => {
|
|
4425
|
+
const onChooseNewSchema = (index, type, metadata) => {
|
|
6070
4426
|
setSchemaIndex(index);
|
|
6071
4427
|
const newSchema = props.schema.oneOf[index];
|
|
6072
4428
|
if (isConstSchema(newSchema)) {
|
|
@@ -6075,14 +4431,16 @@ function OneOfSchema(props) {
|
|
|
6075
4431
|
model,
|
|
6076
4432
|
triggerSchema: props.schema,
|
|
6077
4433
|
triggerModel: model,
|
|
6078
|
-
type
|
|
4434
|
+
type,
|
|
4435
|
+
metadata
|
|
6079
4436
|
});
|
|
6080
4437
|
} else {
|
|
6081
4438
|
props.onChange({
|
|
6082
4439
|
model: models[index],
|
|
6083
4440
|
triggerSchema: newSchema,
|
|
6084
4441
|
triggerModel: models[index],
|
|
6085
|
-
type
|
|
4442
|
+
type,
|
|
4443
|
+
metadata
|
|
6086
4444
|
});
|
|
6087
4445
|
}
|
|
6088
4446
|
if (type !== "init" && props.schema.analyticsId) {
|
|
@@ -6197,11 +4555,11 @@ var OneOfSchema_default = OneOfSchema;
|
|
|
6197
4555
|
|
|
6198
4556
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
6199
4557
|
var import_classnames5 = __toESM(require_classnames());
|
|
6200
|
-
var
|
|
4558
|
+
var import_react20 = require("react");
|
|
6201
4559
|
|
|
6202
4560
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/UploadInputAdapter.tsx
|
|
6203
4561
|
var import_components16 = require("@transferwise/components");
|
|
6204
|
-
var
|
|
4562
|
+
var import_react19 = require("react");
|
|
6205
4563
|
var import_jsx_runtime31 = require("react/jsx-runtime");
|
|
6206
4564
|
function UploadInputAdapter(props) {
|
|
6207
4565
|
const {
|
|
@@ -6218,7 +4576,7 @@ function UploadInputAdapter(props) {
|
|
|
6218
4576
|
onCancel
|
|
6219
4577
|
} = props;
|
|
6220
4578
|
const onEvent = useEventDispatcher();
|
|
6221
|
-
const files = (0,
|
|
4579
|
+
const files = (0, import_react19.useMemo)(() => fileId ? [{ id: fileId, status: import_components16.Status.SUCCEEDED }] : [], [fileId]);
|
|
6222
4580
|
const uploadFile = (formData) => {
|
|
6223
4581
|
onEvent("Dynamic Flow - PersistAsync", { status: "pending", schemaId: id });
|
|
6224
4582
|
return httpClient(String(httpOptions.url), {
|
|
@@ -6257,65 +4615,67 @@ function UploadInputAdapter(props) {
|
|
|
6257
4615
|
// src/legacy/jsonSchemaForm/persistAsyncSchema/persistAsyncBlobSchema/PersistAsyncBlobSchema.tsx
|
|
6258
4616
|
var import_jsx_runtime32 = require("react/jsx-runtime");
|
|
6259
4617
|
function PersistAsyncBlobSchema(props) {
|
|
6260
|
-
const
|
|
6261
|
-
const [
|
|
6262
|
-
const [
|
|
6263
|
-
const [
|
|
4618
|
+
const { model, schema, submitted, required, errors, onChange } = props;
|
|
4619
|
+
const [persistAsyncValidationMessages, setPersistAsyncValidationMessages] = (0, import_react20.useState)({});
|
|
4620
|
+
const [persistAsyncValidations, setPersistAsyncValidations] = (0, import_react20.useState)(null);
|
|
4621
|
+
const [validations, setValidations] = (0, import_react20.useState)([]);
|
|
4622
|
+
const [changed, setChanged] = (0, import_react20.useState)(false);
|
|
6264
4623
|
const httpClient = useHttpClient();
|
|
6265
4624
|
const onEvent = useEventDispatcher();
|
|
6266
|
-
|
|
6267
|
-
if (
|
|
6268
|
-
setValidations(getValidationFailures(
|
|
4625
|
+
(0, import_react20.useEffect)(() => {
|
|
4626
|
+
if (submitted) {
|
|
4627
|
+
setValidations(getValidationFailures(model, schema, Boolean(required)));
|
|
4628
|
+
} else {
|
|
4629
|
+
setValidations([]);
|
|
6269
4630
|
}
|
|
6270
|
-
};
|
|
6271
|
-
(0, import_react19.useEffect)(refreshValidations, [props.model, props.submitted]);
|
|
4631
|
+
}, [model, schema, submitted, required]);
|
|
6272
4632
|
const onSuccess = async (httpResponse, _fileName) => {
|
|
6273
4633
|
const jsonResponse = await httpResponse.json();
|
|
6274
|
-
const id2 = getIdFromResponse(
|
|
6275
|
-
|
|
4634
|
+
const id2 = getIdFromResponse(schema.persistAsync.idProperty, jsonResponse);
|
|
4635
|
+
onChange({ model: id2, triggerSchema: schema, triggerModel: id2 });
|
|
6276
4636
|
setChanged(true);
|
|
6277
|
-
onEvent("Dynamic Flow - PersistAsync", { status: "success", schemaId:
|
|
4637
|
+
onEvent("Dynamic Flow - PersistAsync", { status: "success", schemaId: schema.$id });
|
|
6278
4638
|
};
|
|
6279
4639
|
const onFailure = async (errorResponse) => {
|
|
6280
4640
|
if (errorResponse.response && isStatus422(errorResponse.response.status)) {
|
|
6281
4641
|
const jsonResponse = await errorResponse.response.json();
|
|
6282
4642
|
setPersistAsyncValidationMessages(jsonResponse.validation || {});
|
|
6283
|
-
setPersistAsyncValidations([
|
|
4643
|
+
setPersistAsyncValidations([schema.persistAsync.param]);
|
|
6284
4644
|
}
|
|
6285
|
-
|
|
4645
|
+
onChange({ model: null, triggerSchema: schema, triggerModel: null });
|
|
6286
4646
|
setChanged(true);
|
|
6287
|
-
onEvent("Dynamic Flow - PersistAsync", { status: "failure", schemaId:
|
|
4647
|
+
onEvent("Dynamic Flow - PersistAsync", { status: "failure", schemaId: schema.$id });
|
|
6288
4648
|
};
|
|
6289
4649
|
const onCancel = () => {
|
|
6290
4650
|
setPersistAsyncValidations(null);
|
|
6291
|
-
|
|
4651
|
+
onChange({ model: null, triggerSchema: schema, triggerModel: null });
|
|
6292
4652
|
setChanged(true);
|
|
6293
4653
|
};
|
|
6294
|
-
const { url, method } =
|
|
4654
|
+
const { url, method } = schema.persistAsync;
|
|
6295
4655
|
const combinedValidations = persistAsyncValidations || validations;
|
|
6296
4656
|
const formGroupClasses = {
|
|
6297
4657
|
"form-group": true,
|
|
6298
|
-
"has-error": (
|
|
4658
|
+
"has-error": (submitted || changed) && Boolean(combinedValidations.length)
|
|
6299
4659
|
};
|
|
6300
|
-
const id =
|
|
4660
|
+
const id = schema.$id || schema.persistAsync.schema.$id || schema.persistAsync.idProperty;
|
|
6301
4661
|
const feedbackId = `${id}-feedback`;
|
|
6302
4662
|
return /* @__PURE__ */ (0, import_jsx_runtime32.jsxs)("div", { className: (0, import_classnames5.default)(formGroupClasses), children: [
|
|
6303
4663
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)("div", { "aria-describedby": feedbackId, children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6304
4664
|
UploadInputAdapter,
|
|
6305
4665
|
__spreadValues({
|
|
6306
4666
|
id,
|
|
6307
|
-
fileId:
|
|
6308
|
-
idProperty:
|
|
4667
|
+
fileId: model,
|
|
4668
|
+
idProperty: schema.persistAsync.idProperty,
|
|
6309
4669
|
animationDelay: 0,
|
|
6310
|
-
maxSize:
|
|
6311
|
-
usLabel:
|
|
6312
|
-
usPlaceholder:
|
|
6313
|
-
httpOptions: { url, method, fileInputName:
|
|
4670
|
+
maxSize: schema.persistAsync.schema.maxSize,
|
|
4671
|
+
usLabel: schema.title || schema.persistAsync.schema.title,
|
|
4672
|
+
usPlaceholder: schema.description || schema.persistAsync.schema.description,
|
|
4673
|
+
httpOptions: { url, method, fileInputName: schema.persistAsync.param },
|
|
6314
4674
|
httpClient,
|
|
6315
4675
|
onSuccess,
|
|
6316
4676
|
onFailure,
|
|
6317
4677
|
onCancel
|
|
6318
|
-
}, mapSchemaToUploadOptions(
|
|
4678
|
+
}, mapSchemaToUploadOptions(schema.persistAsync.schema))
|
|
6319
4679
|
) }),
|
|
6320
4680
|
/* @__PURE__ */ (0, import_jsx_runtime32.jsx)(
|
|
6321
4681
|
ControlFeedback_default,
|
|
@@ -6324,9 +4684,9 @@ function PersistAsyncBlobSchema(props) {
|
|
|
6324
4684
|
blurred: true,
|
|
6325
4685
|
focused: false,
|
|
6326
4686
|
changed,
|
|
6327
|
-
submitted
|
|
6328
|
-
errors
|
|
6329
|
-
schema
|
|
4687
|
+
submitted,
|
|
4688
|
+
errors,
|
|
4689
|
+
schema,
|
|
6330
4690
|
validations: combinedValidations,
|
|
6331
4691
|
validationMessages: __spreadValues({
|
|
6332
4692
|
required: "Value is required..."
|
|
@@ -6360,7 +4720,7 @@ PersistAsyncSchema.defaultProps = {
|
|
|
6360
4720
|
var PersistAsyncSchema_default = PersistAsyncSchema;
|
|
6361
4721
|
|
|
6362
4722
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/PromotedOneOfSchema.tsx
|
|
6363
|
-
var
|
|
4723
|
+
var import_react21 = require("react");
|
|
6364
4724
|
|
|
6365
4725
|
// src/legacy/jsonSchemaForm/promotedOneOfSchema/promoted-one-of-utils.ts
|
|
6366
4726
|
var getSelectionFromModel = (schema, model) => {
|
|
@@ -6451,7 +4811,7 @@ var import_jsx_runtime37 = require("react/jsx-runtime");
|
|
|
6451
4811
|
var isPromoted = (schema) => schema.promoted === true;
|
|
6452
4812
|
var PromotedOneOfSchema = (props) => {
|
|
6453
4813
|
var _a;
|
|
6454
|
-
const [selection, setSelection] = (0,
|
|
4814
|
+
const [selection, setSelection] = (0, import_react21.useState)(
|
|
6455
4815
|
getSelectionFromModel(props.schema, props.model) || ((_a = props.schema.promotion) == null ? void 0 : _a.default) || "promoted"
|
|
6456
4816
|
);
|
|
6457
4817
|
const promotedAlert = props.schema.alert;
|
|
@@ -6567,22 +4927,22 @@ function getValueFromOption(option) {
|
|
|
6567
4927
|
}
|
|
6568
4928
|
|
|
6569
4929
|
// src/legacy/jsonSchemaForm/validationAsyncSchema/ValidationAsyncSchema.tsx
|
|
6570
|
-
var
|
|
4930
|
+
var import_react22 = require("react");
|
|
6571
4931
|
var import_jsx_runtime39 = require("react/jsx-runtime");
|
|
6572
4932
|
function ValidationAsyncSchema(props) {
|
|
6573
4933
|
const { schema, model, required, submitted, errors, onChange } = props;
|
|
6574
|
-
const [validationAsyncModel, setValidationAsyncModel] = (0,
|
|
6575
|
-
const previousRequestedModelReference = (0,
|
|
6576
|
-
const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] = (0,
|
|
4934
|
+
const [validationAsyncModel, setValidationAsyncModel] = (0, import_react22.useState)(model);
|
|
4935
|
+
const previousRequestedModelReference = (0, import_react22.useRef)(null);
|
|
4936
|
+
const [validationAsyncSuccessMessage, setValidationAsyncSuccessMessage] = (0, import_react22.useState)(
|
|
6577
4937
|
null
|
|
6578
4938
|
);
|
|
6579
|
-
const [validationAsyncErrors, setValidationAsyncErrors] = (0,
|
|
6580
|
-
const [fieldSubmitted, setFieldSubmitted] = (0,
|
|
6581
|
-
const [abortController, setAbortController] = (0,
|
|
4939
|
+
const [validationAsyncErrors, setValidationAsyncErrors] = (0, import_react22.useState)(null);
|
|
4940
|
+
const [fieldSubmitted, setFieldSubmitted] = (0, import_react22.useState)(false);
|
|
4941
|
+
const [abortController, setAbortController] = (0, import_react22.useState)(null);
|
|
6582
4942
|
const httpClient = useHttpClient();
|
|
6583
4943
|
const onEvent = useEventDispatcher();
|
|
6584
4944
|
const log = useLogger();
|
|
6585
|
-
(0,
|
|
4945
|
+
(0, import_react22.useEffect)(() => {
|
|
6586
4946
|
if (!schema.validationAsync.method) {
|
|
6587
4947
|
log.warning(
|
|
6588
4948
|
"Invalid schema or model",
|
|
@@ -6659,13 +5019,13 @@ var ValidationAsyncSchema_default = ValidationAsyncSchema;
|
|
|
6659
5019
|
|
|
6660
5020
|
// src/legacy/jsonSchemaForm/genericSchema/GenericSchema.tsx
|
|
6661
5021
|
var import_jsx_runtime40 = require("react/jsx-runtime");
|
|
6662
|
-
var
|
|
5022
|
+
var import_react24 = require("react");
|
|
6663
5023
|
function GenericSchemaForm(props) {
|
|
6664
5024
|
const { schema, model = null, errors = null, hideTitle = false, disabled = false } = props;
|
|
6665
5025
|
const schemaProps = __spreadProps(__spreadValues({}, props), { model, errors, hideTitle, disabled });
|
|
6666
5026
|
const type = getSchemaType(schema);
|
|
6667
5027
|
const log = useLogger();
|
|
6668
|
-
(0,
|
|
5028
|
+
(0, import_react23.useEffect)(() => {
|
|
6669
5029
|
if (!isValidGenericSchema(schema, model, errors)) {
|
|
6670
5030
|
log.error(
|
|
6671
5031
|
"Invalid schema or model",
|
|
@@ -6687,7 +5047,7 @@ function GenericSchemaForm(props) {
|
|
|
6687
5047
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(BasicTypeSchema_default, __spreadValues({}, basicTypeProps));
|
|
6688
5048
|
}
|
|
6689
5049
|
case "object":
|
|
6690
|
-
return /* @__PURE__ */ (0,
|
|
5050
|
+
return /* @__PURE__ */ (0, import_react24.createElement)(ObjectSchema_default, __spreadProps(__spreadValues({}, schemaProps), { key: JSON.stringify(schema) }));
|
|
6691
5051
|
case "array":
|
|
6692
5052
|
return /* @__PURE__ */ (0, import_jsx_runtime40.jsx)(ArraySchema_default, __spreadValues({}, schemaProps));
|
|
6693
5053
|
case "promotedOneOf":
|
|
@@ -6802,13 +5162,13 @@ var DynamicInfo = ({ component }) => {
|
|
|
6802
5162
|
|
|
6803
5163
|
// src/legacy/layout/image/DynamicImage.tsx
|
|
6804
5164
|
var import_components22 = require("@transferwise/components");
|
|
6805
|
-
var
|
|
5165
|
+
var import_react25 = require("react");
|
|
6806
5166
|
var import_jsx_runtime44 = require("react/jsx-runtime");
|
|
6807
5167
|
function DynamicImage({ component: image }) {
|
|
6808
5168
|
const { url, size, text, margin, accessibilityDescription } = image;
|
|
6809
5169
|
const httpClient = useHttpClient();
|
|
6810
|
-
const [imageSource, setImageSource] = (0,
|
|
6811
|
-
(0,
|
|
5170
|
+
const [imageSource, setImageSource] = (0, import_react25.useState)("");
|
|
5171
|
+
(0, import_react25.useEffect)(() => {
|
|
6812
5172
|
void getImageSource(httpClient, url).then(setImageSource);
|
|
6813
5173
|
}, [url, httpClient]);
|
|
6814
5174
|
const imageProps = {
|
|
@@ -6836,7 +5196,7 @@ var readImageBlobAsDataURL = (imageBlob) => (
|
|
|
6836
5196
|
var getImageSource = async (httpClient, imageUrl) => {
|
|
6837
5197
|
var _a;
|
|
6838
5198
|
try {
|
|
6839
|
-
if (
|
|
5199
|
+
if (isRelativePath(imageUrl) || (imageUrl == null ? void 0 : imageUrl.startsWith(`${(_a = window == null ? void 0 : window.location) == null ? void 0 : _a.origin}/`))) {
|
|
6840
5200
|
return httpClient(imageUrl, {
|
|
6841
5201
|
method: "GET",
|
|
6842
5202
|
headers: { "Content-Type": "image/image" },
|
|
@@ -7044,9 +5404,9 @@ var paragraph_messages_default = (0, import_react_intl16.defineMessages)({
|
|
|
7044
5404
|
|
|
7045
5405
|
// src/legacy/layout/paragraph/useSnackBarIfAvailable.ts
|
|
7046
5406
|
var import_components26 = require("@transferwise/components");
|
|
7047
|
-
var
|
|
5407
|
+
var import_react26 = require("react");
|
|
7048
5408
|
function useSnackBarIfAvailable() {
|
|
7049
|
-
const context = (0,
|
|
5409
|
+
const context = (0, import_react26.useContext)(import_components26.SnackbarContext);
|
|
7050
5410
|
return context ? context.createSnackbar : noop2;
|
|
7051
5411
|
}
|
|
7052
5412
|
function noop2() {
|
|
@@ -7144,7 +5504,7 @@ function DynamicReview(props) {
|
|
|
7144
5504
|
var DynamicReview_default = DynamicReview;
|
|
7145
5505
|
|
|
7146
5506
|
// src/legacy/layout/search/DynamicSearch.tsx
|
|
7147
|
-
var
|
|
5507
|
+
var import_react28 = require("react");
|
|
7148
5508
|
|
|
7149
5509
|
// src/legacy/layout/search/SearchInput.tsx
|
|
7150
5510
|
var import_components29 = require("@transferwise/components");
|
|
@@ -7225,15 +5585,15 @@ var ErrorResult = ({ onRetrySearch }) => {
|
|
|
7225
5585
|
};
|
|
7226
5586
|
|
|
7227
5587
|
// src/legacy/layout/search/useSearch.tsx
|
|
7228
|
-
var
|
|
5588
|
+
var import_react27 = require("react");
|
|
7229
5589
|
var headers = { "Content-Type": "application/json" };
|
|
7230
5590
|
var useSearch = (defaultSearchConfig) => {
|
|
7231
|
-
const [state, setState] = (0,
|
|
5591
|
+
const [state, setState] = (0, import_react27.useState)({
|
|
7232
5592
|
status: "idle"
|
|
7233
5593
|
});
|
|
7234
|
-
const abortControllerRef = (0,
|
|
5594
|
+
const abortControllerRef = (0, import_react27.useRef)(null);
|
|
7235
5595
|
const httpClient = useHttpClient();
|
|
7236
|
-
const search = (0,
|
|
5596
|
+
const search = (0, import_react27.useCallback)(
|
|
7237
5597
|
async (query, { url, method, param } = defaultSearchConfig) => {
|
|
7238
5598
|
var _a;
|
|
7239
5599
|
(_a = abortControllerRef.current) == null ? void 0 : _a.abort();
|
|
@@ -7297,11 +5657,11 @@ var addQueryParameter = (url, key, value) => {
|
|
|
7297
5657
|
var import_jsx_runtime53 = require("react/jsx-runtime");
|
|
7298
5658
|
var DEBOUNCE_TIME = 400;
|
|
7299
5659
|
function DynamicSearch({ component, onAction }) {
|
|
7300
|
-
const [query, setQuery] = (0,
|
|
5660
|
+
const [query, setQuery] = (0, import_react28.useState)("");
|
|
7301
5661
|
const { title, margin, url, method, param, emptyMessage } = component;
|
|
7302
5662
|
const { status, results, search } = useSearch({ url, method, param });
|
|
7303
5663
|
const onEvent = useEventDispatcher();
|
|
7304
|
-
const debouncedSearch = (0,
|
|
5664
|
+
const debouncedSearch = (0, import_react28.useMemo)(() => debounce(search, DEBOUNCE_TIME), [search]);
|
|
7305
5665
|
const onSearchStart = () => {
|
|
7306
5666
|
onEvent("Dynamic Flow - Search Started", {});
|
|
7307
5667
|
};
|
|
@@ -7339,10 +5699,10 @@ var DynamicSearch_default = DynamicSearch;
|
|
|
7339
5699
|
|
|
7340
5700
|
// src/legacy/layout/modal/DynamicModal.tsx
|
|
7341
5701
|
var import_components31 = require("@transferwise/components");
|
|
7342
|
-
var
|
|
5702
|
+
var import_react29 = require("react");
|
|
7343
5703
|
var import_jsx_runtime54 = require("react/jsx-runtime");
|
|
7344
5704
|
var DynamicModal = (props) => {
|
|
7345
|
-
const [visible, isVisible] = (0,
|
|
5705
|
+
const [visible, isVisible] = (0, import_react29.useState)(false);
|
|
7346
5706
|
const { component, onAction } = props;
|
|
7347
5707
|
const { margin = "md" } = component;
|
|
7348
5708
|
return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: getTextAlignmentAndMargin({ margin }), children: [
|
|
@@ -7369,12 +5729,12 @@ var getDefaultValue = (schema) => {
|
|
|
7369
5729
|
};
|
|
7370
5730
|
var BasicTypeSchema = (props) => {
|
|
7371
5731
|
var _a, _b, _c;
|
|
7372
|
-
const onChange = (newModel) => {
|
|
5732
|
+
const onChange = (newModel, _type, metadata) => {
|
|
7373
5733
|
setChanged(true);
|
|
7374
|
-
setModelAndBroadcast(sanitiseModel(newModel), "user");
|
|
5734
|
+
setModelAndBroadcast(sanitiseModel(newModel), "user", metadata);
|
|
7375
5735
|
};
|
|
7376
5736
|
const getValidationKeys = (newModel) => getValidationFailures(newModel, props.schema, props.required);
|
|
7377
|
-
const setModelAndBroadcast = (newModel, type) => {
|
|
5737
|
+
const setModelAndBroadcast = (newModel, type, metadata) => {
|
|
7378
5738
|
setModel(newModel);
|
|
7379
5739
|
const validationKeys = getValidationKeys(newModel);
|
|
7380
5740
|
setValidations(validationKeys);
|
|
@@ -7386,7 +5746,8 @@ var BasicTypeSchema = (props) => {
|
|
|
7386
5746
|
triggerSchema: props.schema,
|
|
7387
5747
|
triggerModel: broadcastModel,
|
|
7388
5748
|
lastTriggerModel: lastModel,
|
|
7389
|
-
type
|
|
5749
|
+
type,
|
|
5750
|
+
metadata
|
|
7390
5751
|
});
|
|
7391
5752
|
}
|
|
7392
5753
|
};
|
|
@@ -7399,13 +5760,13 @@ var BasicTypeSchema = (props) => {
|
|
|
7399
5760
|
props.onBlur();
|
|
7400
5761
|
}
|
|
7401
5762
|
};
|
|
7402
|
-
const [model, setModel] = (0,
|
|
7403
|
-
const [lastModel, setLastModel] = (0,
|
|
7404
|
-
const [changed, setChanged] = (0,
|
|
7405
|
-
const [focused, setFocused] = (0,
|
|
7406
|
-
const [blurred, setBlurred] = (0,
|
|
7407
|
-
const [validations, setValidations] = (0,
|
|
7408
|
-
const id = (0,
|
|
5763
|
+
const [model, setModel] = (0, import_react30.useState)((_a = props.model) != null ? _a : null);
|
|
5764
|
+
const [lastModel, setLastModel] = (0, import_react30.useState)((_b = props.model) != null ? _b : null);
|
|
5765
|
+
const [changed, setChanged] = (0, import_react30.useState)(false);
|
|
5766
|
+
const [focused, setFocused] = (0, import_react30.useState)(false);
|
|
5767
|
+
const [blurred, setBlurred] = (0, import_react30.useState)(false);
|
|
5768
|
+
const [validations, setValidations] = (0, import_react30.useState)([]);
|
|
5769
|
+
const id = (0, import_react30.useMemo)(() => props.schema.$id || generateRandomId(), [props.schema.$id]);
|
|
7409
5770
|
const onSchemaChange = () => {
|
|
7410
5771
|
const defaultValue = getDefaultValue(props.schema);
|
|
7411
5772
|
if (isNullish(model) && !isNullish(defaultValue)) {
|
|
@@ -7420,9 +5781,9 @@ var BasicTypeSchema = (props) => {
|
|
|
7420
5781
|
};
|
|
7421
5782
|
const isConst = props.schema.const;
|
|
7422
5783
|
const isHidden = props.schema.hidden || isConst;
|
|
7423
|
-
(0,
|
|
7424
|
-
(0,
|
|
7425
|
-
(0,
|
|
5784
|
+
(0, import_react30.useEffect)(refreshValidations, [props.model, props.submitted]);
|
|
5785
|
+
(0, import_react30.useEffect)(onSchemaChange, [props.schema]);
|
|
5786
|
+
(0, import_react30.useEffect)(() => {
|
|
7426
5787
|
var _a2;
|
|
7427
5788
|
const newModel = (_a2 = props.model) != null ? _a2 : null;
|
|
7428
5789
|
if (newModel !== model) {
|
|
@@ -7501,12 +5862,12 @@ function PersistAsyncBasicSchema(props) {
|
|
|
7501
5862
|
const intl = (0, import_react_intl20.useIntl)();
|
|
7502
5863
|
const httpClient = useHttpClient();
|
|
7503
5864
|
const onEvent = useEventDispatcher();
|
|
7504
|
-
const [persistAsyncModel, setPersistAsyncModel] = (0,
|
|
5865
|
+
const [persistAsyncModel, setPersistAsyncModel] = (0, import_react31.useState)(null);
|
|
7505
5866
|
const previousPersistAsyncModel = usePrevious(persistAsyncModel);
|
|
7506
|
-
const [persistAsyncError, setPersistAsyncError] = (0,
|
|
7507
|
-
const [fieldSubmitted, setFieldSubmitted] = (0,
|
|
7508
|
-
const [abortController, setAbortController] = (0,
|
|
7509
|
-
(0,
|
|
5867
|
+
const [persistAsyncError, setPersistAsyncError] = (0, import_react31.useState)(null);
|
|
5868
|
+
const [fieldSubmitted, setFieldSubmitted] = (0, import_react31.useState)(false);
|
|
5869
|
+
const [abortController, setAbortController] = (0, import_react31.useState)(null);
|
|
5870
|
+
(0, import_react31.useEffect)(() => {
|
|
7510
5871
|
if (controlTypesWithPersistOnChange.has(
|
|
7511
5872
|
// TODO: LOW avoid type assertion below -- control type may be nullish. consider ?? ''
|
|
7512
5873
|
getControlType(schema.persistAsync.schema)
|
|
@@ -7514,7 +5875,7 @@ function PersistAsyncBasicSchema(props) {
|
|
|
7514
5875
|
persistAsyncIfValid();
|
|
7515
5876
|
}
|
|
7516
5877
|
}, [persistAsyncModel]);
|
|
7517
|
-
const setGenericPersistAsyncError = () => setPersistAsyncError(intl.formatMessage(
|
|
5878
|
+
const setGenericPersistAsyncError = () => setPersistAsyncError(intl.formatMessage(persist_async_messages_default.genericError));
|
|
7518
5879
|
const getPersistAsyncResponse = async (currentPersistAsyncModel, persistAsyncSpec) => {
|
|
7519
5880
|
const signal = abortCurrentRequestAndGetNewAbortSignal();
|
|
7520
5881
|
const requestBody = { [persistAsyncSpec.param]: currentPersistAsyncModel };
|
|
@@ -7594,7 +5955,7 @@ var PersistAsyncBasicSchema_default = PersistAsyncBasicSchema;
|
|
|
7594
5955
|
|
|
7595
5956
|
// src/legacy/common/hooks/usePersistAsync/usePersistAsync.ts
|
|
7596
5957
|
var usePersistAsync = (persistAsync) => {
|
|
7597
|
-
const [abortController, setAbortController] = (0,
|
|
5958
|
+
const [abortController, setAbortController] = (0, import_react32.useState)(null);
|
|
7598
5959
|
const httpClient = useHttpClient();
|
|
7599
5960
|
const intl = (0, import_react_intl21.useIntl)();
|
|
7600
5961
|
const { schema } = persistAsync;
|
|
@@ -7653,10 +6014,10 @@ var usePersistAsync = (persistAsync) => {
|
|
|
7653
6014
|
}
|
|
7654
6015
|
}
|
|
7655
6016
|
}
|
|
7656
|
-
throw new Error(intl.formatMessage(
|
|
6017
|
+
throw new Error(intl.formatMessage(persist_async_messages_default.genericError));
|
|
7657
6018
|
}
|
|
7658
6019
|
const handleError = (error) => {
|
|
7659
|
-
const message = hasStringMessage(error) ? error.message : intl.formatMessage(
|
|
6020
|
+
const message = hasStringMessage(error) ? error.message : intl.formatMessage(persist_async_messages_default.genericError);
|
|
7660
6021
|
throw new Error(message);
|
|
7661
6022
|
};
|
|
7662
6023
|
return handlePersistAsync;
|
|
@@ -7673,7 +6034,7 @@ function hasStringMessage(value) {
|
|
|
7673
6034
|
}
|
|
7674
6035
|
|
|
7675
6036
|
// src/legacy/common/hooks/usePolling/usePolling.tsx
|
|
7676
|
-
var
|
|
6037
|
+
var import_react33 = require("react");
|
|
7677
6038
|
function usePolling({
|
|
7678
6039
|
asyncFn,
|
|
7679
6040
|
interval,
|
|
@@ -7682,9 +6043,9 @@ function usePolling({
|
|
|
7682
6043
|
onPollingResponse,
|
|
7683
6044
|
onFailure
|
|
7684
6045
|
}) {
|
|
7685
|
-
const onPollingResponseReference = (0,
|
|
7686
|
-
const onFailureReference = (0,
|
|
7687
|
-
const poll = (0,
|
|
6046
|
+
const onPollingResponseReference = (0, import_react33.useRef)(onPollingResponse);
|
|
6047
|
+
const onFailureReference = (0, import_react33.useRef)(onFailure);
|
|
6048
|
+
const poll = (0, import_react33.useMemo)(
|
|
7688
6049
|
() => createPollingClosure(
|
|
7689
6050
|
asyncFn,
|
|
7690
6051
|
maxAttempts,
|
|
@@ -7694,7 +6055,7 @@ function usePolling({
|
|
|
7694
6055
|
),
|
|
7695
6056
|
[asyncFn, maxAttempts, maxConsecutiveFails]
|
|
7696
6057
|
);
|
|
7697
|
-
(0,
|
|
6058
|
+
(0, import_react33.useEffect)(() => {
|
|
7698
6059
|
if (interval > 0) {
|
|
7699
6060
|
const intervalReference = setInterval(() => {
|
|
7700
6061
|
poll();
|
|
@@ -7702,7 +6063,7 @@ function usePolling({
|
|
|
7702
6063
|
return () => clearInterval(intervalReference);
|
|
7703
6064
|
}
|
|
7704
6065
|
}, [poll, interval]);
|
|
7705
|
-
(0,
|
|
6066
|
+
(0, import_react33.useEffect)(() => {
|
|
7706
6067
|
onPollingResponseReference.current = onPollingResponse;
|
|
7707
6068
|
onFailureReference.current = onFailure;
|
|
7708
6069
|
}, [onPollingResponse, onFailure]);
|
|
@@ -7733,20 +6094,20 @@ function createPollingClosure(asyncFn, maxAttempts, maxConsecutiveFails, onPolli
|
|
|
7733
6094
|
}
|
|
7734
6095
|
|
|
7735
6096
|
// src/legacy/common/hooks/usePrevious/usePrevious.js
|
|
7736
|
-
var
|
|
6097
|
+
var import_react34 = require("react");
|
|
7737
6098
|
var usePrevious = (value) => {
|
|
7738
|
-
const reference = (0,
|
|
7739
|
-
(0,
|
|
6099
|
+
const reference = (0, import_react34.useRef)();
|
|
6100
|
+
(0, import_react34.useEffect)(() => {
|
|
7740
6101
|
reference.current = value;
|
|
7741
6102
|
}, [value]);
|
|
7742
6103
|
return reference.current;
|
|
7743
6104
|
};
|
|
7744
6105
|
|
|
7745
6106
|
// src/legacy/common/hooks/useStepPolling/useStepPolling.tsx
|
|
7746
|
-
var
|
|
6107
|
+
var import_react35 = require("react");
|
|
7747
6108
|
function useStepPolling(polling, onAction) {
|
|
7748
6109
|
const httpClient = useHttpClient();
|
|
7749
|
-
const asyncFn = (0,
|
|
6110
|
+
const asyncFn = (0, import_react35.useMemo)(() => {
|
|
7750
6111
|
if (polling) {
|
|
7751
6112
|
return () => httpClient(polling.url).then((response) => {
|
|
7752
6113
|
if (response.ok) {
|
|
@@ -7759,7 +6120,7 @@ function useStepPolling(polling, onAction) {
|
|
|
7759
6120
|
}
|
|
7760
6121
|
return void 0;
|
|
7761
6122
|
}, [polling, httpClient]);
|
|
7762
|
-
const onPollingResponse = (0,
|
|
6123
|
+
const onPollingResponse = (0, import_react35.useCallback)(
|
|
7763
6124
|
(pollingResponse) => {
|
|
7764
6125
|
if (pollingResponse == null ? void 0 : pollingResponse.action) {
|
|
7765
6126
|
onAction(pollingResponse.action);
|
|
@@ -7775,7 +6136,7 @@ function useStepPolling(polling, onAction) {
|
|
|
7775
6136
|
maxAttempts: (polling == null ? void 0 : polling.maxAttempts) || 0,
|
|
7776
6137
|
maxConsecutiveFails: 1,
|
|
7777
6138
|
onPollingResponse,
|
|
7778
|
-
onFailure: (0,
|
|
6139
|
+
onFailure: (0, import_react35.useCallback)(() => {
|
|
7779
6140
|
if (polling) {
|
|
7780
6141
|
onAction(polling.onError.action);
|
|
7781
6142
|
}
|
|
@@ -7823,10 +6184,10 @@ var LayoutStep = (props) => {
|
|
|
7823
6184
|
var LayoutStep_default = LayoutStep;
|
|
7824
6185
|
|
|
7825
6186
|
// src/legacy/step/cameraStep/CameraStep.tsx
|
|
7826
|
-
var
|
|
6187
|
+
var import_react40 = require("react");
|
|
7827
6188
|
|
|
7828
6189
|
// src/legacy/step/cameraStep/cameraCapture/CameraCapture.tsx
|
|
7829
|
-
var
|
|
6190
|
+
var import_react39 = require("react");
|
|
7830
6191
|
var import_react_intl26 = require("react-intl");
|
|
7831
6192
|
var import_react_webcam = __toESM(require_react_webcam());
|
|
7832
6193
|
|
|
@@ -7983,7 +6344,7 @@ function CameraErrorScreen({ title, description, actionButton, onAction }) {
|
|
|
7983
6344
|
var CameraErrorScreen_default = CameraErrorScreen;
|
|
7984
6345
|
|
|
7985
6346
|
// src/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
7986
|
-
var
|
|
6347
|
+
var import_react36 = require("react");
|
|
7987
6348
|
var import_screenfull = __toESM(require_screenfull());
|
|
7988
6349
|
|
|
7989
6350
|
// src/legacy/step/cameraStep/cameraCapture/utils/index.ts
|
|
@@ -8062,16 +6423,16 @@ var trackCameraOrientationLocked = (onEvent) => {
|
|
|
8062
6423
|
|
|
8063
6424
|
// src/legacy/step/cameraStep/cameraCapture/hooks/useFullScreenOrientationLock.ts
|
|
8064
6425
|
var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
8065
|
-
const lockOrientation = (0,
|
|
6426
|
+
const lockOrientation = (0, import_react36.useCallback)(() => {
|
|
8066
6427
|
if (window.screen.orientation && "lock" in window.screen.orientation && typeof window.screen.orientation.lock === "function") {
|
|
8067
6428
|
window.screen.orientation.lock("portrait").then(() => trackCameraOrientationLocked(onEvent)).catch(noop4);
|
|
8068
6429
|
}
|
|
8069
6430
|
}, [onEvent]);
|
|
8070
|
-
const unlockOrientation = (0,
|
|
6431
|
+
const unlockOrientation = (0, import_react36.useCallback)(() => {
|
|
8071
6432
|
var _a, _b, _c;
|
|
8072
6433
|
return (_c = (_b = (_a = window == null ? void 0 : window.screen) == null ? void 0 : _a.orientation) == null ? void 0 : _b.unlock) == null ? void 0 : _c.call(_b);
|
|
8073
6434
|
}, []);
|
|
8074
|
-
const enterFullScreen = (0,
|
|
6435
|
+
const enterFullScreen = (0, import_react36.useCallback)(() => {
|
|
8075
6436
|
setTimeout(() => {
|
|
8076
6437
|
if (shouldLockOrientation && !import_screenfull.default.isFullscreen && import_screenfull.default.isEnabled) {
|
|
8077
6438
|
import_screenfull.default.request(document.documentElement, { navigationUI: "show" }).then(() => {
|
|
@@ -8080,13 +6441,13 @@ var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
|
8080
6441
|
}
|
|
8081
6442
|
}, 100);
|
|
8082
6443
|
}, [shouldLockOrientation, lockOrientation]);
|
|
8083
|
-
const exitFullScreen = (0,
|
|
6444
|
+
const exitFullScreen = (0, import_react36.useCallback)(() => {
|
|
8084
6445
|
if (import_screenfull.default.isFullscreen) {
|
|
8085
6446
|
import_screenfull.default.exit().catch(noop4);
|
|
8086
6447
|
}
|
|
8087
6448
|
unlockOrientation();
|
|
8088
6449
|
}, [unlockOrientation]);
|
|
8089
|
-
const handleOrientationChange = (0,
|
|
6450
|
+
const handleOrientationChange = (0, import_react36.useCallback)(
|
|
8090
6451
|
(event) => {
|
|
8091
6452
|
var _a, _b;
|
|
8092
6453
|
if ((_a = event == null ? void 0 : event.target) == null ? void 0 : _a.type.includes("landscape")) {
|
|
@@ -8097,7 +6458,7 @@ var useFullScreenOrientationLock = (shouldLockOrientation, onEvent) => {
|
|
|
8097
6458
|
},
|
|
8098
6459
|
[onEvent]
|
|
8099
6460
|
);
|
|
8100
|
-
(0,
|
|
6461
|
+
(0, import_react36.useEffect)(() => {
|
|
8101
6462
|
var _a, _b;
|
|
8102
6463
|
if (shouldLockOrientation) {
|
|
8103
6464
|
(_b = (_a = window.screen) == null ? void 0 : _a.orientation) == null ? void 0 : _b.addEventListener(
|
|
@@ -8120,9 +6481,9 @@ var noop4 = () => {
|
|
|
8120
6481
|
};
|
|
8121
6482
|
|
|
8122
6483
|
// src/legacy/step/cameraStep/cameraCapture/hooks/useVideoConstraints.ts
|
|
8123
|
-
var
|
|
6484
|
+
var import_react37 = require("react");
|
|
8124
6485
|
var useVideoConstraints = (direction) => {
|
|
8125
|
-
const [videoConstraints, setVideoConstraints] = (0,
|
|
6486
|
+
const [videoConstraints, setVideoConstraints] = (0, import_react37.useState)();
|
|
8126
6487
|
const defaultVideoConstraints = {
|
|
8127
6488
|
facingMode: direction === "front" ? "user" : "environment",
|
|
8128
6489
|
height: { min: 480, max: 1080, ideal: 720 },
|
|
@@ -8130,7 +6491,7 @@ var useVideoConstraints = (direction) => {
|
|
|
8130
6491
|
frameRate: 30,
|
|
8131
6492
|
aspectRatio: 16 / 9
|
|
8132
6493
|
};
|
|
8133
|
-
(0,
|
|
6494
|
+
(0, import_react37.useEffect)(() => {
|
|
8134
6495
|
void getVideoConstraints(direction).then(setVideoConstraints);
|
|
8135
6496
|
}, [direction]);
|
|
8136
6497
|
const getVideoConstraints = async (direction2) => {
|
|
@@ -8148,7 +6509,7 @@ var useVideoConstraints = (direction) => {
|
|
|
8148
6509
|
};
|
|
8149
6510
|
|
|
8150
6511
|
// src/legacy/step/cameraStep/cameraCapture/overlay/Overlay.tsx
|
|
8151
|
-
var
|
|
6512
|
+
var import_react38 = require("react");
|
|
8152
6513
|
var import_jsx_runtime61 = require("react/jsx-runtime");
|
|
8153
6514
|
var captureButtonHeight = 92;
|
|
8154
6515
|
var reviewButtonsHeight = 120;
|
|
@@ -8158,8 +6519,8 @@ var instructionsHeight = 48;
|
|
|
8158
6519
|
var reviewInstructionsHeight = 40;
|
|
8159
6520
|
var overlayMaxWidth = 800;
|
|
8160
6521
|
function Overlay({ overlay, outline, imageUrl, title, instructions, reviewInstructions }) {
|
|
8161
|
-
const svgReference = (0,
|
|
8162
|
-
(0,
|
|
6522
|
+
const svgReference = (0, import_react38.useRef)(null);
|
|
6523
|
+
(0, import_react38.useEffect)(() => {
|
|
8163
6524
|
const listener = debounce(() => {
|
|
8164
6525
|
var _a;
|
|
8165
6526
|
if ((_a = svgReference.current) == null ? void 0 : _a.innerHTML) {
|
|
@@ -8225,14 +6586,14 @@ function CameraCapture({
|
|
|
8225
6586
|
onCapture,
|
|
8226
6587
|
onEvent
|
|
8227
6588
|
}) {
|
|
8228
|
-
const [mode, setMode] = (0,
|
|
8229
|
-
const [cameraError, setCameraError] = (0,
|
|
8230
|
-
const [isVideoMirrored, setIsVideoMirrored] = (0,
|
|
8231
|
-
const [ready, setReady] = (0,
|
|
8232
|
-
const [reviewImage, setReviewImage] = (0,
|
|
8233
|
-
const webcamReference = (0,
|
|
6589
|
+
const [mode, setMode] = (0, import_react39.useState)("CAPTURE" /* CAPTURE */);
|
|
6590
|
+
const [cameraError, setCameraError] = (0, import_react39.useState)();
|
|
6591
|
+
const [isVideoMirrored, setIsVideoMirrored] = (0, import_react39.useState)(false);
|
|
6592
|
+
const [ready, setReady] = (0, import_react39.useState)(false);
|
|
6593
|
+
const [reviewImage, setReviewImage] = (0, import_react39.useState)();
|
|
6594
|
+
const webcamReference = (0, import_react39.useRef)(null);
|
|
8234
6595
|
const { videoConstraints } = useVideoConstraints(direction);
|
|
8235
|
-
const shouldLockOrientation = (0,
|
|
6596
|
+
const shouldLockOrientation = (0, import_react39.useMemo)(
|
|
8236
6597
|
() => !!(isMobile() && mode === "CAPTURE" /* CAPTURE */),
|
|
8237
6598
|
[mode]
|
|
8238
6599
|
);
|
|
@@ -8241,7 +6602,7 @@ function CameraCapture({
|
|
|
8241
6602
|
onEvent
|
|
8242
6603
|
);
|
|
8243
6604
|
const intl = (0, import_react_intl26.useIntl)();
|
|
8244
|
-
const handleCapture = (0,
|
|
6605
|
+
const handleCapture = (0, import_react39.useCallback)(async () => {
|
|
8245
6606
|
var _a, _b, _c, _d, _e, _f;
|
|
8246
6607
|
if (((_a = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _a.video) && ((_c = (_b = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _b.video) == null ? void 0 : _c.readyState) >= 3) {
|
|
8247
6608
|
(_e = (_d = webcamReference == null ? void 0 : webcamReference.current) == null ? void 0 : _d.video) == null ? void 0 : _e.pause();
|
|
@@ -8263,7 +6624,7 @@ function CameraCapture({
|
|
|
8263
6624
|
);
|
|
8264
6625
|
}
|
|
8265
6626
|
}, [webcamReference, showReview, setReviewImage, setMode, onCapture, isVideoMirrored]);
|
|
8266
|
-
const handleUserMediaError = (0,
|
|
6627
|
+
const handleUserMediaError = (0, import_react39.useCallback)(
|
|
8267
6628
|
(error) => {
|
|
8268
6629
|
setMode("ERROR" /* ERROR */);
|
|
8269
6630
|
if (error instanceof DOMException) {
|
|
@@ -8299,7 +6660,7 @@ function CameraCapture({
|
|
|
8299
6660
|
},
|
|
8300
6661
|
[intl, onEvent]
|
|
8301
6662
|
);
|
|
8302
|
-
const handleUserMedia = (0,
|
|
6663
|
+
const handleUserMedia = (0, import_react39.useCallback)(
|
|
8303
6664
|
(stream) => {
|
|
8304
6665
|
enterFullScreen();
|
|
8305
6666
|
setReady(true);
|
|
@@ -8316,7 +6677,7 @@ function CameraCapture({
|
|
|
8316
6677
|
setReviewImage(void 0);
|
|
8317
6678
|
};
|
|
8318
6679
|
const handleRetryCameraAccess = () => setMode("CAPTURE" /* CAPTURE */);
|
|
8319
|
-
(0,
|
|
6680
|
+
(0, import_react39.useEffect)(() => {
|
|
8320
6681
|
if (mode !== "CAPTURE" /* CAPTURE */) {
|
|
8321
6682
|
exitFullScreen();
|
|
8322
6683
|
}
|
|
@@ -8394,8 +6755,8 @@ function CameraStep(props) {
|
|
|
8394
6755
|
const { assets, direction, instructions } = cameraConfig || {};
|
|
8395
6756
|
const { overlay, outline } = assets || {};
|
|
8396
6757
|
const { url: imageUrl } = image || {};
|
|
8397
|
-
const [captureClicked, setCaptureClicked] = (0,
|
|
8398
|
-
(0,
|
|
6758
|
+
const [captureClicked, setCaptureClicked] = (0, import_react40.useState)(false);
|
|
6759
|
+
(0, import_react40.useEffect)(() => {
|
|
8399
6760
|
if (captureClicked) {
|
|
8400
6761
|
onAction(action);
|
|
8401
6762
|
}
|
|
@@ -8612,10 +6973,10 @@ function DynamicFlowStep(props) {
|
|
|
8612
6973
|
}
|
|
8613
6974
|
|
|
8614
6975
|
// src/legacy/dynamicFlow/utils/useDebouncedRefresh/useDebouncedRefresh.ts
|
|
8615
|
-
var
|
|
6976
|
+
var import_react41 = require("react");
|
|
8616
6977
|
var DEBOUNCE_DELAY = 1e3;
|
|
8617
6978
|
function useDebouncedRefresh(fetchRefresh) {
|
|
8618
|
-
const map = (0,
|
|
6979
|
+
const map = (0, import_react41.useRef)(/* @__PURE__ */ new Map());
|
|
8619
6980
|
const retrieveOrCreate = (key) => {
|
|
8620
6981
|
if (map.current.has(key)) {
|
|
8621
6982
|
return map.current.get(key);
|
|
@@ -8638,12 +6999,12 @@ function useDebouncedRefresh(fetchRefresh) {
|
|
|
8638
6999
|
var shouldDebounceSchema = (schema) => getSchemaType(schema) === "basic" && schema.type !== "boolean" && schema.format !== "base64url";
|
|
8639
7000
|
|
|
8640
7001
|
// src/legacy/dynamicFlow/utils/useDynamicFlowState.ts
|
|
8641
|
-
var
|
|
7002
|
+
var import_react42 = require("react");
|
|
8642
7003
|
var useDynamicFlowState = (initialStep) => {
|
|
8643
7004
|
var _a, _b;
|
|
8644
|
-
const [formErrors, setFormErrors] = (0,
|
|
8645
|
-
const [globalError, setGlobalError] = (0,
|
|
8646
|
-
const [stepAndModels, setStepAndModels] = (0,
|
|
7005
|
+
const [formErrors, setFormErrors] = (0, import_react42.useState)((_a = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _a.validation);
|
|
7006
|
+
const [globalError, setGlobalError] = (0, import_react42.useState)((_b = initialStep == null ? void 0 : initialStep.errors) == null ? void 0 : _b.error);
|
|
7007
|
+
const [stepAndModels, setStepAndModels] = (0, import_react42.useState)({
|
|
8647
7008
|
step: initialStep || void 0,
|
|
8648
7009
|
models: (initialStep == null ? void 0 : initialStep.model) ? buildInitialModels(initialStep.model, getAllSchemas(initialStep)) : {},
|
|
8649
7010
|
etag: void 0
|
|
@@ -8673,7 +7034,7 @@ var useDynamicFlowState = (initialStep) => {
|
|
|
8673
7034
|
return updatedState;
|
|
8674
7035
|
});
|
|
8675
7036
|
};
|
|
8676
|
-
const modelIsValid = (0,
|
|
7037
|
+
const modelIsValid = (0, import_react42.useMemo)(
|
|
8677
7038
|
() => areModelsValid(models, getAllValidatableSchemas(step)),
|
|
8678
7039
|
[models, step]
|
|
8679
7040
|
);
|
|
@@ -8746,7 +7107,7 @@ var isInlineSchema = (schema) => schema !== void 0 && typeof schema === "object"
|
|
|
8746
7107
|
|
|
8747
7108
|
// src/legacy/dynamicFlow/utils/useLoader.tsx
|
|
8748
7109
|
var import_components36 = require("@transferwise/components");
|
|
8749
|
-
var
|
|
7110
|
+
var import_react43 = require("react");
|
|
8750
7111
|
var import_jsx_runtime67 = require("react/jsx-runtime");
|
|
8751
7112
|
function useLoader(loaderConfig, initialState) {
|
|
8752
7113
|
const config = __spreadValues({
|
|
@@ -8754,7 +7115,7 @@ function useLoader(loaderConfig, initialState) {
|
|
|
8754
7115
|
initial: true,
|
|
8755
7116
|
submission: false
|
|
8756
7117
|
}, loaderConfig);
|
|
8757
|
-
const [loadingState, setLoadingState] = (0,
|
|
7118
|
+
const [loadingState, setLoadingState] = (0, import_react43.useState)(initialState);
|
|
8758
7119
|
const shouldDisplayLoader = config.initial && loadingState === "initial" || config.submission && loadingState === "submission";
|
|
8759
7120
|
const loader = shouldDisplayLoader ? /* @__PURE__ */ (0, import_jsx_runtime67.jsx)(
|
|
8760
7121
|
import_components36.Loader,
|
|
@@ -8768,7 +7129,7 @@ function useLoader(loaderConfig, initialState) {
|
|
|
8768
7129
|
}
|
|
8769
7130
|
|
|
8770
7131
|
// src/common/errorBoundary/ErrorBoundary.tsx
|
|
8771
|
-
var
|
|
7132
|
+
var import_react44 = require("react");
|
|
8772
7133
|
|
|
8773
7134
|
// src/common/errorBoundary/ErrorBoundaryAlert.tsx
|
|
8774
7135
|
var import_components37 = require("@transferwise/components");
|
|
@@ -8795,7 +7156,7 @@ function ErrorBoundaryAlert({ onDismiss }) {
|
|
|
8795
7156
|
var import_jsx_runtime69 = require("react/jsx-runtime");
|
|
8796
7157
|
var noop6 = () => {
|
|
8797
7158
|
};
|
|
8798
|
-
var ErrorBoundary = class extends
|
|
7159
|
+
var ErrorBoundary = class extends import_react44.Component {
|
|
8799
7160
|
constructor(props) {
|
|
8800
7161
|
super(props);
|
|
8801
7162
|
this.handleErrorReset = () => {
|
|
@@ -8917,7 +7278,6 @@ var assertResponseIsValid = (response) => {
|
|
|
8917
7278
|
var isResponse = (response) => typeof response === "object" && response !== null && "clone" in response && "bodyUsed" in response;
|
|
8918
7279
|
|
|
8919
7280
|
// src/legacy/dynamicFlow/DynamicFlow.tsx
|
|
8920
|
-
var import_dynamic_flow_types = __toESM(require_main_min());
|
|
8921
7281
|
var import_jsx_runtime70 = require("react/jsx-runtime");
|
|
8922
7282
|
var noop7 = () => {
|
|
8923
7283
|
};
|
|
@@ -8947,25 +7307,24 @@ var DynamicFlowComponent = ({
|
|
|
8947
7307
|
setStepAndEtag,
|
|
8948
7308
|
setSchemaModel
|
|
8949
7309
|
} = useDynamicFlowState(initialStep);
|
|
8950
|
-
const [submitted, setSubmitted] = (0,
|
|
7310
|
+
const [submitted, setSubmitted] = (0, import_react45.useState)(false);
|
|
8951
7311
|
const { isLoading, loader, setLoadingState } = useLoader(
|
|
8952
7312
|
loaderConfig,
|
|
8953
7313
|
initialStep ? "idle" : "initial"
|
|
8954
7314
|
);
|
|
8955
7315
|
const logCritical = getLogger("critical", onLog, flowId, (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key));
|
|
8956
|
-
const
|
|
8957
|
-
const analyticsMetadata = (0, import_react44.useMemo)(
|
|
7316
|
+
const analyticsMetadata = (0, import_react45.useMemo)(
|
|
8958
7317
|
() => {
|
|
8959
7318
|
var _a;
|
|
8960
7319
|
return __spreadValues({ flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key) }, (_a = step == null ? void 0 : step.analytics) != null ? _a : {});
|
|
8961
7320
|
},
|
|
8962
7321
|
[flowId, step]
|
|
8963
7322
|
);
|
|
8964
|
-
const dispatchEvent = (0,
|
|
7323
|
+
const dispatchEvent = (0, import_react45.useMemo)(
|
|
8965
7324
|
() => getEventDispatcher(onEvent, analyticsMetadata),
|
|
8966
7325
|
[onEvent, analyticsMetadata]
|
|
8967
7326
|
);
|
|
8968
|
-
const dfHttpClient = (0,
|
|
7327
|
+
const dfHttpClient = (0, import_react45.useCallback)(
|
|
8969
7328
|
({
|
|
8970
7329
|
action,
|
|
8971
7330
|
data,
|
|
@@ -9017,17 +7376,17 @@ var DynamicFlowComponent = ({
|
|
|
9017
7376
|
dispatchEventAndComplete(__spreadValues(__spreadValues({}, exitResult), actionResult));
|
|
9018
7377
|
};
|
|
9019
7378
|
const debouncedRefresh = useDebouncedRefresh(performRefresh);
|
|
9020
|
-
const dispatchEventAndComplete = (0,
|
|
7379
|
+
const dispatchEventAndComplete = (0, import_react45.useCallback)(
|
|
9021
7380
|
(result) => {
|
|
9022
7381
|
dispatchEvent("Dynamic Flow - Flow Finished", { result: "success" });
|
|
9023
7382
|
onCompletion(result);
|
|
9024
7383
|
},
|
|
9025
7384
|
[onCompletion, dispatchEvent]
|
|
9026
7385
|
);
|
|
9027
|
-
(0,
|
|
7386
|
+
(0, import_react45.useEffect)(() => {
|
|
9028
7387
|
dispatchEvent("Dynamic Flow - Flow Started", {});
|
|
9029
7388
|
}, []);
|
|
9030
|
-
(0,
|
|
7389
|
+
(0, import_react45.useEffect)(() => {
|
|
9031
7390
|
if (!initialStep) {
|
|
9032
7391
|
const action = __spreadValues({
|
|
9033
7392
|
id: "#initial-step-request",
|
|
@@ -9060,7 +7419,6 @@ var DynamicFlowComponent = ({
|
|
|
9060
7419
|
}
|
|
9061
7420
|
};
|
|
9062
7421
|
const updateStep = (newStep, etag2, fetchType) => {
|
|
9063
|
-
validateStepWithZod(newStep, logInfo);
|
|
9064
7422
|
setStepAndEtag(newStep, etag2);
|
|
9065
7423
|
setLoadingState("idle");
|
|
9066
7424
|
if (fetchType === "submission") {
|
|
@@ -9142,9 +7500,6 @@ var DynamicFlowComponent = ({
|
|
|
9142
7500
|
await performAction(action);
|
|
9143
7501
|
}
|
|
9144
7502
|
};
|
|
9145
|
-
if (initialStep) {
|
|
9146
|
-
validateStepWithZod(initialStep, logInfo);
|
|
9147
|
-
}
|
|
9148
7503
|
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(LogProvider, { flowId, stepId: (step == null ? void 0 : step.id) || (step == null ? void 0 : step.key), onLog, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(EventsContextProvider, { metadata: analyticsMetadata, onEvent, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(DynamicFlowProvider, { loading: isLoading, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(HttpClientProvider, { httpClient, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(FeatureContextProvider, { features, children: loader !== null ? loader : /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(
|
|
9149
7504
|
DynamicFlowStep,
|
|
9150
7505
|
{
|
|
@@ -9165,15 +7520,6 @@ function DynamicFlow(props) {
|
|
|
9165
7520
|
return /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(ErrorBoundary_default, { onError: props.onError, children: /* @__PURE__ */ (0, import_jsx_runtime70.jsx)(DynamicFlowComponent, __spreadValues({}, props)) });
|
|
9166
7521
|
}
|
|
9167
7522
|
var DynamicFlow_default = DynamicFlow;
|
|
9168
|
-
var validateStepWithZod = (step, logger) => {
|
|
9169
|
-
const result = import_dynamic_flow_types.stepSchema.safeParse(step);
|
|
9170
|
-
if (!result.success) {
|
|
9171
|
-
logger(
|
|
9172
|
-
"Invalid schema or model",
|
|
9173
|
-
"Your schema might be invalid. Test your step with the Zod schemas exported from @wise/dynamic-flow-types."
|
|
9174
|
-
);
|
|
9175
|
-
}
|
|
9176
|
-
};
|
|
9177
7523
|
var combineModels2 = (formModels) => Object.values(formModels).reduce((previous, model) => __spreadValues(__spreadValues({}, previous), model), {});
|
|
9178
7524
|
var isSubmissionMethod = (method = "POST") => {
|
|
9179
7525
|
const submissionMethods = ["POST", "PUT", "PATCH"];
|