@ogc-maps/storybook-components 0.14.0 → 0.16.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (203) hide show
  1. package/LICENSE +661 -0
  2. package/dist/{BasemapSwitcher-BW7lyZ2Y.js → BasemapSwitcher-DuqVusX0.js} +9 -9
  3. package/dist/CollapsibleControl-BTIkiTmU.js +60 -0
  4. package/dist/CoordinateDisplay-BblQ34mS.js +154 -0
  5. package/dist/{ExportButton-Ck1dESnc.js → ExportButton-C8hCCsav.js} +7 -7
  6. package/dist/{FeatureDetailPanel-CkFpdEKW.js → FeatureDetailPanel-DgCHiNi9.js} +16 -16
  7. package/dist/FeatureTooltip-DHjMZC0u.js +49 -0
  8. package/dist/{LayerPanel-SCdJ8948.js → LayerPanel-BkDbZ66Z.js} +23 -23
  9. package/dist/Legend-CvBd-v0n.js +285 -0
  10. package/dist/PropertyList-0EonV_BQ.js +33 -0
  11. package/dist/SearchPanel-DIb7aYVs.js +725 -0
  12. package/dist/components/BasemapSwitcher/index.js +1 -1
  13. package/dist/components/CollapsibleControl/CollapsibleControl.d.ts +4 -1
  14. package/dist/components/CollapsibleControl/CollapsibleControl.d.ts.map +1 -1
  15. package/dist/components/CollapsibleControl/index.js +1 -1
  16. package/dist/components/CompassControl/CompassControl.d.ts +19 -0
  17. package/dist/components/CompassControl/CompassControl.d.ts.map +1 -0
  18. package/dist/components/CompassControl/index.d.ts +3 -0
  19. package/dist/components/CompassControl/index.d.ts.map +1 -0
  20. package/dist/components/CoordinateDisplay/CoordinateDisplay.d.ts +35 -4
  21. package/dist/components/CoordinateDisplay/CoordinateDisplay.d.ts.map +1 -1
  22. package/dist/components/CoordinateDisplay/CoordinateDisplay.test.d.ts +2 -0
  23. package/dist/components/CoordinateDisplay/CoordinateDisplay.test.d.ts.map +1 -0
  24. package/dist/components/CoordinateDisplay/index.d.ts +1 -1
  25. package/dist/components/CoordinateDisplay/index.d.ts.map +1 -1
  26. package/dist/components/CoordinateDisplay/index.js +5 -3
  27. package/dist/components/Cql2FilterEditor/Cql2FilterEditor.d.ts +9 -0
  28. package/dist/components/Cql2FilterEditor/Cql2FilterEditor.d.ts.map +1 -0
  29. package/dist/components/Cql2FilterEditor/Cql2Preview.d.ts +6 -0
  30. package/dist/components/Cql2FilterEditor/Cql2Preview.d.ts.map +1 -0
  31. package/dist/components/Cql2FilterEditor/FilterRuleEditor.d.ts +9 -0
  32. package/dist/components/Cql2FilterEditor/FilterRuleEditor.d.ts.map +1 -0
  33. package/dist/components/Cql2FilterEditor/FilterRuleGroupEditor.d.ts +10 -0
  34. package/dist/components/Cql2FilterEditor/FilterRuleGroupEditor.d.ts.map +1 -0
  35. package/dist/components/Cql2FilterEditor/FilterValueInput.d.ts +12 -0
  36. package/dist/components/Cql2FilterEditor/FilterValueInput.d.ts.map +1 -0
  37. package/dist/components/Cql2FilterEditor/ParameterizableField.d.ts +30 -0
  38. package/dist/components/Cql2FilterEditor/ParameterizableField.d.ts.map +1 -0
  39. package/dist/components/Cql2FilterEditor/index.d.ts +2 -0
  40. package/dist/components/Cql2FilterEditor/index.d.ts.map +1 -0
  41. package/dist/components/Cql2FilterEditor/operatorOptions.d.ts +9 -0
  42. package/dist/components/Cql2FilterEditor/operatorOptions.d.ts.map +1 -0
  43. package/dist/components/Cql2FilterEditor/styles.d.ts +3 -0
  44. package/dist/components/Cql2FilterEditor/styles.d.ts.map +1 -0
  45. package/dist/components/ExportButton/index.js +1 -1
  46. package/dist/components/ExportModal/ExportModal.d.ts +20 -1
  47. package/dist/components/ExportModal/ExportModal.d.ts.map +1 -1
  48. package/dist/components/ExportModal/index.d.ts +1 -1
  49. package/dist/components/ExportModal/index.d.ts.map +1 -1
  50. package/dist/components/FeatureDetailPanel/index.js +1 -1
  51. package/dist/components/FeatureTooltip/index.js +1 -1
  52. package/dist/components/GlobalSearchBar/GlobalSearchBar.d.ts +25 -0
  53. package/dist/components/GlobalSearchBar/GlobalSearchBar.d.ts.map +1 -0
  54. package/dist/components/GlobalSearchBar/GlobalSearchBar.test.d.ts +2 -0
  55. package/dist/components/GlobalSearchBar/GlobalSearchBar.test.d.ts.map +1 -0
  56. package/dist/components/GlobalSearchBar/index.d.ts +3 -0
  57. package/dist/components/GlobalSearchBar/index.d.ts.map +1 -0
  58. package/dist/components/GlobalSearchConfigEditor/GlobalSearchConfigEditor.d.ts +22 -0
  59. package/dist/components/GlobalSearchConfigEditor/GlobalSearchConfigEditor.d.ts.map +1 -0
  60. package/dist/components/GlobalSearchConfigEditor/GlobalSearchConfigEditor.test.d.ts +2 -0
  61. package/dist/components/GlobalSearchConfigEditor/GlobalSearchConfigEditor.test.d.ts.map +1 -0
  62. package/dist/components/GlobalSearchConfigEditor/index.d.ts +3 -0
  63. package/dist/components/GlobalSearchConfigEditor/index.d.ts.map +1 -0
  64. package/dist/components/ImageryEditor/ImageryEditor.d.ts +0 -1
  65. package/dist/components/ImageryEditor/ImageryEditor.d.ts.map +1 -1
  66. package/dist/components/ImageryEditor/index.d.ts +2 -1
  67. package/dist/components/ImageryEditor/index.d.ts.map +1 -1
  68. package/dist/components/ImageryPanel/ImageryPanel.d.ts.map +1 -1
  69. package/dist/components/InfoControl/InfoControl.d.ts +12 -0
  70. package/dist/components/InfoControl/InfoControl.d.ts.map +1 -0
  71. package/dist/components/InfoControl/InfoModal.d.ts +16 -0
  72. package/dist/components/InfoControl/InfoModal.d.ts.map +1 -0
  73. package/dist/components/InfoControl/index.d.ts +5 -0
  74. package/dist/components/InfoControl/index.d.ts.map +1 -0
  75. package/dist/components/LayerEditor/LayerEditor.d.ts +6 -1
  76. package/dist/components/LayerEditor/LayerEditor.d.ts.map +1 -1
  77. package/dist/components/LayerEditor/LayerList.d.ts +8 -1
  78. package/dist/components/LayerEditor/LayerList.d.ts.map +1 -1
  79. package/dist/components/LayerEditor/index.d.ts +1 -1
  80. package/dist/components/LayerEditor/index.d.ts.map +1 -1
  81. package/dist/components/LayerPanel/index.js +1 -1
  82. package/dist/components/Legend/Legend.d.ts +7 -1
  83. package/dist/components/Legend/Legend.d.ts.map +1 -1
  84. package/dist/components/Legend/index.js +1 -1
  85. package/dist/components/PropertyFilterPanel/PropertyFilterPanel.d.ts +21 -0
  86. package/dist/components/PropertyFilterPanel/PropertyFilterPanel.d.ts.map +1 -0
  87. package/dist/components/PropertyFilterPanel/index.d.ts +3 -0
  88. package/dist/components/PropertyFilterPanel/index.d.ts.map +1 -0
  89. package/dist/components/QueryPanel/QueryPanel.d.ts +14 -0
  90. package/dist/components/QueryPanel/QueryPanel.d.ts.map +1 -0
  91. package/dist/components/QueryPanel/index.d.ts +3 -0
  92. package/dist/components/QueryPanel/index.d.ts.map +1 -0
  93. package/dist/components/ResultsDrawer/ResultsDrawer.d.ts +29 -4
  94. package/dist/components/ResultsDrawer/ResultsDrawer.d.ts.map +1 -1
  95. package/dist/components/ResultsDrawer/index.d.ts +1 -1
  96. package/dist/components/ResultsDrawer/index.d.ts.map +1 -1
  97. package/dist/components/ResultsDrawer/tableUtils.d.ts +11 -0
  98. package/dist/components/ResultsDrawer/tableUtils.d.ts.map +1 -0
  99. package/dist/components/ScaleBarControl/ScaleBarControl.d.ts +32 -0
  100. package/dist/components/ScaleBarControl/ScaleBarControl.d.ts.map +1 -0
  101. package/dist/components/ScaleBarControl/index.d.ts +2 -0
  102. package/dist/components/ScaleBarControl/index.d.ts.map +1 -0
  103. package/dist/components/SearchPanel/SearchPanel.d.ts +15 -2
  104. package/dist/components/SearchPanel/SearchPanel.d.ts.map +1 -1
  105. package/dist/components/SearchPanel/index.js +1 -1
  106. package/dist/components/SelectionPanel/SelectionPanel.d.ts +3 -1
  107. package/dist/components/SelectionPanel/SelectionPanel.d.ts.map +1 -1
  108. package/dist/components/SideMenuPanel/SideMenuPanel.d.ts +51 -0
  109. package/dist/components/SideMenuPanel/SideMenuPanel.d.ts.map +1 -0
  110. package/dist/components/SideMenuPanel/index.d.ts +3 -0
  111. package/dist/components/SideMenuPanel/index.d.ts.map +1 -0
  112. package/dist/components/SourceEditor/SourceEditor.d.ts +3 -1
  113. package/dist/components/SourceEditor/SourceEditor.d.ts.map +1 -1
  114. package/dist/components/SourceEditor/SourceList.d.ts +6 -1
  115. package/dist/components/SourceEditor/SourceList.d.ts.map +1 -1
  116. package/dist/components/SourceEditor/index.d.ts +1 -1
  117. package/dist/components/SourceEditor/index.d.ts.map +1 -1
  118. package/dist/components/StyleEditor/DataDrivenColorEditor.d.ts +8 -3
  119. package/dist/components/StyleEditor/DataDrivenColorEditor.d.ts.map +1 -1
  120. package/dist/components/StyleEditor/PropertyField.d.ts +6 -3
  121. package/dist/components/StyleEditor/PropertyField.d.ts.map +1 -1
  122. package/dist/components/StyleEditor/PropertyGroup.d.ts +6 -3
  123. package/dist/components/StyleEditor/PropertyGroup.d.ts.map +1 -1
  124. package/dist/components/StyleEditor/StyleEditor.d.ts +7 -3
  125. package/dist/components/StyleEditor/StyleEditor.d.ts.map +1 -1
  126. package/dist/components/UIConfigEditor/UIConfigEditor.d.ts +13 -2
  127. package/dist/components/UIConfigEditor/UIConfigEditor.d.ts.map +1 -1
  128. package/dist/components/UserMenu/UserMenu.d.ts +15 -0
  129. package/dist/components/UserMenu/UserMenu.d.ts.map +1 -0
  130. package/dist/components/UserMenu/index.d.ts +3 -0
  131. package/dist/components/UserMenu/index.d.ts.map +1 -0
  132. package/dist/components/ViewEditor/ViewEditor.d.ts.map +1 -1
  133. package/dist/components/index.d.ts +26 -5
  134. package/dist/components/index.d.ts.map +1 -1
  135. package/dist/components/shared/controlIcons.d.ts +10 -0
  136. package/dist/components/shared/controlIcons.d.ts.map +1 -0
  137. package/dist/geo-DUdRIR7u.js +9776 -0
  138. package/dist/hooks/index.d.ts +5 -3
  139. package/dist/hooks/index.d.ts.map +1 -1
  140. package/dist/hooks/index.js +68 -59
  141. package/dist/hooks/useExport.d.ts +7 -7
  142. package/dist/hooks/useExport.d.ts.map +1 -1
  143. package/dist/id-C2J6iu8_.js +11 -0
  144. package/dist/index-BtQnyWPg.js +3718 -0
  145. package/dist/main.js +13801 -2600
  146. package/dist/schemas/config.d.ts +2127 -5011
  147. package/dist/schemas/config.d.ts.map +1 -1
  148. package/dist/schemas/index.d.ts +1 -1
  149. package/dist/schemas/index.d.ts.map +1 -1
  150. package/dist/schemas/index.js +35 -24
  151. package/dist/style.css +1 -1
  152. package/dist/types/index.d.ts +47 -2
  153. package/dist/types/index.d.ts.map +1 -1
  154. package/dist/types/index.js +56 -33
  155. package/dist/useSelection-BFHYsPvU.js +224 -0
  156. package/dist/utils/colorPalettes.d.ts +4 -2
  157. package/dist/utils/colorPalettes.d.ts.map +1 -1
  158. package/dist/utils/colorThemes.d.ts +12 -0
  159. package/dist/utils/colorThemes.d.ts.map +1 -0
  160. package/dist/utils/cql2.d.ts +34 -5
  161. package/dist/utils/cql2.d.ts.map +1 -1
  162. package/dist/utils/exportConverters.d.ts +16 -0
  163. package/dist/utils/exportConverters.d.ts.map +1 -0
  164. package/dist/utils/geo.d.ts +59 -0
  165. package/dist/utils/geo.d.ts.map +1 -1
  166. package/dist/utils/id.d.ts +2 -0
  167. package/dist/utils/id.d.ts.map +1 -0
  168. package/dist/utils/index.d.ts +9 -0
  169. package/dist/utils/index.d.ts.map +1 -1
  170. package/dist/utils/index.js +477 -0
  171. package/dist/utils/ogcApi.d.ts +31 -6
  172. package/dist/utils/ogcApi.d.ts.map +1 -1
  173. package/dist/utils/propertyFilters.d.ts +35 -0
  174. package/dist/utils/propertyFilters.d.ts.map +1 -0
  175. package/dist/utils/queryParameters.d.ts +23 -0
  176. package/dist/utils/queryParameters.d.ts.map +1 -0
  177. package/dist/utils/queryableHelpers.d.ts +4 -0
  178. package/dist/utils/queryableHelpers.d.ts.map +1 -1
  179. package/dist/utils/slugify.d.ts +2 -0
  180. package/dist/utils/slugify.d.ts.map +1 -0
  181. package/package.json +31 -14
  182. package/dist/CollapsibleControl-qo9daiD8.js +0 -53
  183. package/dist/CoordinateDisplay-PxPmVjpm.js +0 -47
  184. package/dist/FeatureTooltip-DxzN-jnp.js +0 -49
  185. package/dist/Legend-BLWBzD7Y.js +0 -275
  186. package/dist/PropertyList-BGXHLVBM.js +0 -33
  187. package/dist/SearchPanel-4Y12jfuP.js +0 -401
  188. package/dist/components/PropertyDisplayEditor/__tests__/PropertyDisplayEditor.test.d.ts +0 -2
  189. package/dist/components/PropertyDisplayEditor/__tests__/PropertyDisplayEditor.test.d.ts.map +0 -1
  190. package/dist/geo-PA_KiJwy.js +0 -1169
  191. package/dist/index-Cz_PEKV1.js +0 -3035
  192. package/dist/schemas/__tests__/config.test.d.ts +0 -2
  193. package/dist/schemas/__tests__/config.test.d.ts.map +0 -1
  194. package/dist/utils/__tests__/cql2.test.d.ts +0 -2
  195. package/dist/utils/__tests__/cql2.test.d.ts.map +0 -1
  196. package/dist/utils/__tests__/expressionColors.test.d.ts +0 -2
  197. package/dist/utils/__tests__/expressionColors.test.d.ts.map +0 -1
  198. package/dist/utils/__tests__/propertyDisplay.test.d.ts +0 -2
  199. package/dist/utils/__tests__/propertyDisplay.test.d.ts.map +0 -1
  200. package/dist/utils/__tests__/queryableHelpers.test.d.ts +0 -2
  201. package/dist/utils/__tests__/queryableHelpers.test.d.ts.map +0 -1
  202. package/dist/utils/__tests__/wkt.test.d.ts +0 -2
  203. package/dist/utils/__tests__/wkt.test.d.ts.map +0 -1
@@ -1,3035 +0,0 @@
1
- var b;
2
- (function(a) {
3
- a.assertEqual = (r) => {
4
- };
5
- function e(r) {
6
- }
7
- a.assertIs = e;
8
- function t(r) {
9
- throw new Error();
10
- }
11
- a.assertNever = t, a.arrayToEnum = (r) => {
12
- const s = {};
13
- for (const i of r)
14
- s[i] = i;
15
- return s;
16
- }, a.getValidEnumValues = (r) => {
17
- const s = a.objectKeys(r).filter((o) => typeof r[r[o]] != "number"), i = {};
18
- for (const o of s)
19
- i[o] = r[o];
20
- return a.objectValues(i);
21
- }, a.objectValues = (r) => a.objectKeys(r).map(function(s) {
22
- return r[s];
23
- }), a.objectKeys = typeof Object.keys == "function" ? (r) => Object.keys(r) : (r) => {
24
- const s = [];
25
- for (const i in r)
26
- Object.prototype.hasOwnProperty.call(r, i) && s.push(i);
27
- return s;
28
- }, a.find = (r, s) => {
29
- for (const i of r)
30
- if (s(i))
31
- return i;
32
- }, a.isInteger = typeof Number.isInteger == "function" ? (r) => Number.isInteger(r) : (r) => typeof r == "number" && Number.isFinite(r) && Math.floor(r) === r;
33
- function n(r, s = " | ") {
34
- return r.map((i) => typeof i == "string" ? `'${i}'` : i).join(s);
35
- }
36
- a.joinValues = n, a.jsonStringifyReplacer = (r, s) => typeof s == "bigint" ? s.toString() : s;
37
- })(b || (b = {}));
38
- var be;
39
- (function(a) {
40
- a.mergeShapes = (e, t) => ({
41
- ...e,
42
- ...t
43
- // second overwrites first
44
- });
45
- })(be || (be = {}));
46
- const u = b.arrayToEnum([
47
- "string",
48
- "nan",
49
- "number",
50
- "integer",
51
- "float",
52
- "boolean",
53
- "date",
54
- "bigint",
55
- "symbol",
56
- "function",
57
- "undefined",
58
- "null",
59
- "array",
60
- "object",
61
- "unknown",
62
- "promise",
63
- "void",
64
- "never",
65
- "map",
66
- "set"
67
- ]), L = (a) => {
68
- switch (typeof a) {
69
- case "undefined":
70
- return u.undefined;
71
- case "string":
72
- return u.string;
73
- case "number":
74
- return Number.isNaN(a) ? u.nan : u.number;
75
- case "boolean":
76
- return u.boolean;
77
- case "function":
78
- return u.function;
79
- case "bigint":
80
- return u.bigint;
81
- case "symbol":
82
- return u.symbol;
83
- case "object":
84
- return Array.isArray(a) ? u.array : a === null ? u.null : a.then && typeof a.then == "function" && a.catch && typeof a.catch == "function" ? u.promise : typeof Map < "u" && a instanceof Map ? u.map : typeof Set < "u" && a instanceof Set ? u.set : typeof Date < "u" && a instanceof Date ? u.date : u.object;
85
- default:
86
- return u.unknown;
87
- }
88
- }, l = b.arrayToEnum([
89
- "invalid_type",
90
- "invalid_literal",
91
- "custom",
92
- "invalid_union",
93
- "invalid_union_discriminator",
94
- "invalid_enum_value",
95
- "unrecognized_keys",
96
- "invalid_arguments",
97
- "invalid_return_type",
98
- "invalid_date",
99
- "invalid_string",
100
- "too_small",
101
- "too_big",
102
- "invalid_intersection_types",
103
- "not_multiple_of",
104
- "not_finite"
105
- ]);
106
- class $ extends Error {
107
- get errors() {
108
- return this.issues;
109
- }
110
- constructor(e) {
111
- super(), this.issues = [], this.addIssue = (n) => {
112
- this.issues = [...this.issues, n];
113
- }, this.addIssues = (n = []) => {
114
- this.issues = [...this.issues, ...n];
115
- };
116
- const t = new.target.prototype;
117
- Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e;
118
- }
119
- format(e) {
120
- const t = e || function(s) {
121
- return s.message;
122
- }, n = { _errors: [] }, r = (s) => {
123
- for (const i of s.issues)
124
- if (i.code === "invalid_union")
125
- i.unionErrors.map(r);
126
- else if (i.code === "invalid_return_type")
127
- r(i.returnTypeError);
128
- else if (i.code === "invalid_arguments")
129
- r(i.argumentsError);
130
- else if (i.path.length === 0)
131
- n._errors.push(t(i));
132
- else {
133
- let o = n, h = 0;
134
- for (; h < i.path.length; ) {
135
- const p = i.path[h];
136
- h === i.path.length - 1 ? (o[p] = o[p] || { _errors: [] }, o[p]._errors.push(t(i))) : o[p] = o[p] || { _errors: [] }, o = o[p], h++;
137
- }
138
- }
139
- };
140
- return r(this), n;
141
- }
142
- static assert(e) {
143
- if (!(e instanceof $))
144
- throw new Error(`Not a ZodError: ${e}`);
145
- }
146
- toString() {
147
- return this.message;
148
- }
149
- get message() {
150
- return JSON.stringify(this.issues, b.jsonStringifyReplacer, 2);
151
- }
152
- get isEmpty() {
153
- return this.issues.length === 0;
154
- }
155
- flatten(e = (t) => t.message) {
156
- const t = {}, n = [];
157
- for (const r of this.issues)
158
- if (r.path.length > 0) {
159
- const s = r.path[0];
160
- t[s] = t[s] || [], t[s].push(e(r));
161
- } else
162
- n.push(e(r));
163
- return { formErrors: n, fieldErrors: t };
164
- }
165
- get formErrors() {
166
- return this.flatten();
167
- }
168
- }
169
- $.create = (a) => new $(a);
170
- const de = (a, e) => {
171
- let t;
172
- switch (a.code) {
173
- case l.invalid_type:
174
- a.received === u.undefined ? t = "Required" : t = `Expected ${a.expected}, received ${a.received}`;
175
- break;
176
- case l.invalid_literal:
177
- t = `Invalid literal value, expected ${JSON.stringify(a.expected, b.jsonStringifyReplacer)}`;
178
- break;
179
- case l.unrecognized_keys:
180
- t = `Unrecognized key(s) in object: ${b.joinValues(a.keys, ", ")}`;
181
- break;
182
- case l.invalid_union:
183
- t = "Invalid input";
184
- break;
185
- case l.invalid_union_discriminator:
186
- t = `Invalid discriminator value. Expected ${b.joinValues(a.options)}`;
187
- break;
188
- case l.invalid_enum_value:
189
- t = `Invalid enum value. Expected ${b.joinValues(a.options)}, received '${a.received}'`;
190
- break;
191
- case l.invalid_arguments:
192
- t = "Invalid function arguments";
193
- break;
194
- case l.invalid_return_type:
195
- t = "Invalid function return type";
196
- break;
197
- case l.invalid_date:
198
- t = "Invalid date";
199
- break;
200
- case l.invalid_string:
201
- typeof a.validation == "object" ? "includes" in a.validation ? (t = `Invalid input: must include "${a.validation.includes}"`, typeof a.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${a.validation.position}`)) : "startsWith" in a.validation ? t = `Invalid input: must start with "${a.validation.startsWith}"` : "endsWith" in a.validation ? t = `Invalid input: must end with "${a.validation.endsWith}"` : b.assertNever(a.validation) : a.validation !== "regex" ? t = `Invalid ${a.validation}` : t = "Invalid";
202
- break;
203
- case l.too_small:
204
- a.type === "array" ? t = `Array must contain ${a.exact ? "exactly" : a.inclusive ? "at least" : "more than"} ${a.minimum} element(s)` : a.type === "string" ? t = `String must contain ${a.exact ? "exactly" : a.inclusive ? "at least" : "over"} ${a.minimum} character(s)` : a.type === "number" ? t = `Number must be ${a.exact ? "exactly equal to " : a.inclusive ? "greater than or equal to " : "greater than "}${a.minimum}` : a.type === "bigint" ? t = `Number must be ${a.exact ? "exactly equal to " : a.inclusive ? "greater than or equal to " : "greater than "}${a.minimum}` : a.type === "date" ? t = `Date must be ${a.exact ? "exactly equal to " : a.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(a.minimum))}` : t = "Invalid input";
205
- break;
206
- case l.too_big:
207
- a.type === "array" ? t = `Array must contain ${a.exact ? "exactly" : a.inclusive ? "at most" : "less than"} ${a.maximum} element(s)` : a.type === "string" ? t = `String must contain ${a.exact ? "exactly" : a.inclusive ? "at most" : "under"} ${a.maximum} character(s)` : a.type === "number" ? t = `Number must be ${a.exact ? "exactly" : a.inclusive ? "less than or equal to" : "less than"} ${a.maximum}` : a.type === "bigint" ? t = `BigInt must be ${a.exact ? "exactly" : a.inclusive ? "less than or equal to" : "less than"} ${a.maximum}` : a.type === "date" ? t = `Date must be ${a.exact ? "exactly" : a.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(a.maximum))}` : t = "Invalid input";
208
- break;
209
- case l.custom:
210
- t = "Invalid input";
211
- break;
212
- case l.invalid_intersection_types:
213
- t = "Intersection results could not be merged";
214
- break;
215
- case l.not_multiple_of:
216
- t = `Number must be a multiple of ${a.multipleOf}`;
217
- break;
218
- case l.not_finite:
219
- t = "Number must be finite";
220
- break;
221
- default:
222
- t = e.defaultError, b.assertNever(a);
223
- }
224
- return { message: t };
225
- };
226
- let De = de;
227
- function ze() {
228
- return De;
229
- }
230
- const Fe = (a) => {
231
- const { data: e, path: t, errorMaps: n, issueData: r } = a, s = [...t, ...r.path || []], i = {
232
- ...r,
233
- path: s
234
- };
235
- if (r.message !== void 0)
236
- return {
237
- ...r,
238
- path: s,
239
- message: r.message
240
- };
241
- let o = "";
242
- const h = n.filter((p) => !!p).slice().reverse();
243
- for (const p of h)
244
- o = p(i, { data: e, defaultError: o }).message;
245
- return {
246
- ...r,
247
- path: s,
248
- message: o
249
- };
250
- };
251
- function c(a, e) {
252
- const t = ze(), n = Fe({
253
- issueData: e,
254
- data: a.data,
255
- path: a.path,
256
- errorMaps: [
257
- a.common.contextualErrorMap,
258
- // contextual error map is first priority
259
- a.schemaErrorMap,
260
- // then schema-bound map if available
261
- t,
262
- // then global override map
263
- t === de ? void 0 : de
264
- // then global default map
265
- ].filter((r) => !!r)
266
- });
267
- a.common.issues.push(n);
268
- }
269
- class O {
270
- constructor() {
271
- this.value = "valid";
272
- }
273
- dirty() {
274
- this.value === "valid" && (this.value = "dirty");
275
- }
276
- abort() {
277
- this.value !== "aborted" && (this.value = "aborted");
278
- }
279
- static mergeArray(e, t) {
280
- const n = [];
281
- for (const r of t) {
282
- if (r.status === "aborted")
283
- return m;
284
- r.status === "dirty" && e.dirty(), n.push(r.value);
285
- }
286
- return { status: e.value, value: n };
287
- }
288
- static async mergeObjectAsync(e, t) {
289
- const n = [];
290
- for (const r of t) {
291
- const s = await r.key, i = await r.value;
292
- n.push({
293
- key: s,
294
- value: i
295
- });
296
- }
297
- return O.mergeObjectSync(e, n);
298
- }
299
- static mergeObjectSync(e, t) {
300
- const n = {};
301
- for (const r of t) {
302
- const { key: s, value: i } = r;
303
- if (s.status === "aborted" || i.status === "aborted")
304
- return m;
305
- s.status === "dirty" && e.dirty(), i.status === "dirty" && e.dirty(), s.value !== "__proto__" && (typeof i.value < "u" || r.alwaysSet) && (n[s.value] = i.value);
306
- }
307
- return { status: e.value, value: n };
308
- }
309
- }
310
- const m = Object.freeze({
311
- status: "aborted"
312
- }), H = (a) => ({ status: "dirty", value: a }), A = (a) => ({ status: "valid", value: a }), we = (a) => a.status === "aborted", Se = (a) => a.status === "dirty", q = (a) => a.status === "valid", Q = (a) => typeof Promise < "u" && a instanceof Promise;
313
- var f;
314
- (function(a) {
315
- a.errToObj = (e) => typeof e == "string" ? { message: e } : e || {}, a.toString = (e) => typeof e == "string" ? e : e == null ? void 0 : e.message;
316
- })(f || (f = {}));
317
- class Z {
318
- constructor(e, t, n, r) {
319
- this._cachedPath = [], this.parent = e, this.data = t, this._path = n, this._key = r;
320
- }
321
- get path() {
322
- return this._cachedPath.length || (Array.isArray(this._key) ? this._cachedPath.push(...this._path, ...this._key) : this._cachedPath.push(...this._path, this._key)), this._cachedPath;
323
- }
324
- }
325
- const Te = (a, e) => {
326
- if (q(e))
327
- return { success: !0, data: e.value };
328
- if (!a.common.issues.length)
329
- throw new Error("Validation failed but no issues detected.");
330
- return {
331
- success: !1,
332
- get error() {
333
- if (this._error)
334
- return this._error;
335
- const t = new $(a.common.issues);
336
- return this._error = t, this._error;
337
- }
338
- };
339
- };
340
- function _(a) {
341
- if (!a)
342
- return {};
343
- const { errorMap: e, invalid_type_error: t, required_error: n, description: r } = a;
344
- if (e && (t || n))
345
- throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
346
- return e ? { errorMap: e, description: r } : { errorMap: (i, o) => {
347
- const { message: h } = a;
348
- return i.code === "invalid_enum_value" ? { message: h ?? o.defaultError } : typeof o.data > "u" ? { message: h ?? n ?? o.defaultError } : i.code !== "invalid_type" ? { message: o.defaultError } : { message: h ?? t ?? o.defaultError };
349
- }, description: r };
350
- }
351
- class x {
352
- get description() {
353
- return this._def.description;
354
- }
355
- _getType(e) {
356
- return L(e.data);
357
- }
358
- _getOrReturnCtx(e, t) {
359
- return t || {
360
- common: e.parent.common,
361
- data: e.data,
362
- parsedType: L(e.data),
363
- schemaErrorMap: this._def.errorMap,
364
- path: e.path,
365
- parent: e.parent
366
- };
367
- }
368
- _processInputParams(e) {
369
- return {
370
- status: new O(),
371
- ctx: {
372
- common: e.parent.common,
373
- data: e.data,
374
- parsedType: L(e.data),
375
- schemaErrorMap: this._def.errorMap,
376
- path: e.path,
377
- parent: e.parent
378
- }
379
- };
380
- }
381
- _parseSync(e) {
382
- const t = this._parse(e);
383
- if (Q(t))
384
- throw new Error("Synchronous parse encountered promise.");
385
- return t;
386
- }
387
- _parseAsync(e) {
388
- const t = this._parse(e);
389
- return Promise.resolve(t);
390
- }
391
- parse(e, t) {
392
- const n = this.safeParse(e, t);
393
- if (n.success)
394
- return n.data;
395
- throw n.error;
396
- }
397
- safeParse(e, t) {
398
- const n = {
399
- common: {
400
- issues: [],
401
- async: (t == null ? void 0 : t.async) ?? !1,
402
- contextualErrorMap: t == null ? void 0 : t.errorMap
403
- },
404
- path: (t == null ? void 0 : t.path) || [],
405
- schemaErrorMap: this._def.errorMap,
406
- parent: null,
407
- data: e,
408
- parsedType: L(e)
409
- }, r = this._parseSync({ data: e, path: n.path, parent: n });
410
- return Te(n, r);
411
- }
412
- "~validate"(e) {
413
- var n, r;
414
- const t = {
415
- common: {
416
- issues: [],
417
- async: !!this["~standard"].async
418
- },
419
- path: [],
420
- schemaErrorMap: this._def.errorMap,
421
- parent: null,
422
- data: e,
423
- parsedType: L(e)
424
- };
425
- if (!this["~standard"].async)
426
- try {
427
- const s = this._parseSync({ data: e, path: [], parent: t });
428
- return q(s) ? {
429
- value: s.value
430
- } : {
431
- issues: t.common.issues
432
- };
433
- } catch (s) {
434
- (r = (n = s == null ? void 0 : s.message) == null ? void 0 : n.toLowerCase()) != null && r.includes("encountered") && (this["~standard"].async = !0), t.common = {
435
- issues: [],
436
- async: !0
437
- };
438
- }
439
- return this._parseAsync({ data: e, path: [], parent: t }).then((s) => q(s) ? {
440
- value: s.value
441
- } : {
442
- issues: t.common.issues
443
- });
444
- }
445
- async parseAsync(e, t) {
446
- const n = await this.safeParseAsync(e, t);
447
- if (n.success)
448
- return n.data;
449
- throw n.error;
450
- }
451
- async safeParseAsync(e, t) {
452
- const n = {
453
- common: {
454
- issues: [],
455
- contextualErrorMap: t == null ? void 0 : t.errorMap,
456
- async: !0
457
- },
458
- path: (t == null ? void 0 : t.path) || [],
459
- schemaErrorMap: this._def.errorMap,
460
- parent: null,
461
- data: e,
462
- parsedType: L(e)
463
- }, r = this._parse({ data: e, path: n.path, parent: n }), s = await (Q(r) ? r : Promise.resolve(r));
464
- return Te(n, s);
465
- }
466
- refine(e, t) {
467
- const n = (r) => typeof t == "string" || typeof t > "u" ? { message: t } : typeof t == "function" ? t(r) : t;
468
- return this._refinement((r, s) => {
469
- const i = e(r), o = () => s.addIssue({
470
- code: l.custom,
471
- ...n(r)
472
- });
473
- return typeof Promise < "u" && i instanceof Promise ? i.then((h) => h ? !0 : (o(), !1)) : i ? !0 : (o(), !1);
474
- });
475
- }
476
- refinement(e, t) {
477
- return this._refinement((n, r) => e(n) ? !0 : (r.addIssue(typeof t == "function" ? t(n, r) : t), !1));
478
- }
479
- _refinement(e) {
480
- return new P({
481
- schema: this,
482
- typeName: y.ZodEffects,
483
- effect: { type: "refinement", refinement: e }
484
- });
485
- }
486
- superRefine(e) {
487
- return this._refinement(e);
488
- }
489
- constructor(e) {
490
- 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), this["~standard"] = {
491
- version: 1,
492
- vendor: "zod",
493
- validate: (t) => this["~validate"](t)
494
- };
495
- }
496
- optional() {
497
- return j.create(this, this._def);
498
- }
499
- nullable() {
500
- return F.create(this, this._def);
501
- }
502
- nullish() {
503
- return this.nullable().optional();
504
- }
505
- array() {
506
- return N.create(this);
507
- }
508
- promise() {
509
- return ne.create(this, this._def);
510
- }
511
- or(e) {
512
- return K.create([this, e], this._def);
513
- }
514
- and(e) {
515
- return ee.create(this, e, this._def);
516
- }
517
- transform(e) {
518
- return new P({
519
- ..._(this._def),
520
- schema: this,
521
- typeName: y.ZodEffects,
522
- effect: { type: "transform", transform: e }
523
- });
524
- }
525
- default(e) {
526
- const t = typeof e == "function" ? e : () => e;
527
- return new re({
528
- ..._(this._def),
529
- innerType: this,
530
- defaultValue: t,
531
- typeName: y.ZodDefault
532
- });
533
- }
534
- brand() {
535
- return new Ee({
536
- typeName: y.ZodBranded,
537
- type: this,
538
- ..._(this._def)
539
- });
540
- }
541
- catch(e) {
542
- const t = typeof e == "function" ? e : () => e;
543
- return new se({
544
- ..._(this._def),
545
- innerType: this,
546
- catchValue: t,
547
- typeName: y.ZodCatch
548
- });
549
- }
550
- describe(e) {
551
- const t = this.constructor;
552
- return new t({
553
- ...this._def,
554
- description: e
555
- });
556
- }
557
- pipe(e) {
558
- return ve.create(this, e);
559
- }
560
- readonly() {
561
- return ie.create(this);
562
- }
563
- isOptional() {
564
- return this.safeParse(void 0).success;
565
- }
566
- isNullable() {
567
- return this.safeParse(null).success;
568
- }
569
- }
570
- const Ue = /^c[^\s-]{8,}$/i, Be = /^[0-9a-z]+$/, qe = /^[0-9A-HJKMNP-TV-Z]{26}$/i, We = /^[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, Je = /^[a-z0-9_-]{21}$/i, He = /^[A-Za-z0-9-_]+\.[A-Za-z0-9-_]+\.[A-Za-z0-9-_]*$/, Ge = /^[-+]?P(?!$)(?:(?:[-+]?\d+Y)|(?:[-+]?\d+[.,]\d+Y$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:(?:[-+]?\d+W)|(?:[-+]?\d+[.,]\d+W$))?(?:(?:[-+]?\d+D)|(?:[-+]?\d+[.,]\d+D$))?(?:T(?=[\d+-])(?:(?:[-+]?\d+H)|(?:[-+]?\d+[.,]\d+H$))?(?:(?:[-+]?\d+M)|(?:[-+]?\d+[.,]\d+M$))?(?:[-+]?\d+(?:[.,]\d+)?S)?)??$/, Ye = /^(?!\.)(?!.*\.\.)([A-Z0-9_'+\-\.]*)[A-Z0-9_+-]@([A-Z0-9][A-Z0-9\-]*\.)+[A-Z]{2,}$/i, Qe = "^(\\p{Extended_Pictographic}|\\p{Emoji_Component})+$";
571
- let ce;
572
- const Xe = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])$/, Ke = /^(?:(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\.){3}(?:25[0-5]|2[0-4][0-9]|1[0-9][0-9]|[1-9][0-9]|[0-9])\/(3[0-2]|[12]?[0-9])$/, et = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))$/, tt = /^(([0-9a-fA-F]{1,4}:){7,7}[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,7}:|([0-9a-fA-F]{1,4}:){1,6}:[0-9a-fA-F]{1,4}|([0-9a-fA-F]{1,4}:){1,5}(:[0-9a-fA-F]{1,4}){1,2}|([0-9a-fA-F]{1,4}:){1,4}(:[0-9a-fA-F]{1,4}){1,3}|([0-9a-fA-F]{1,4}:){1,3}(:[0-9a-fA-F]{1,4}){1,4}|([0-9a-fA-F]{1,4}:){1,2}(:[0-9a-fA-F]{1,4}){1,5}|[0-9a-fA-F]{1,4}:((:[0-9a-fA-F]{1,4}){1,6})|:((:[0-9a-fA-F]{1,4}){1,7}|:)|fe80:(:[0-9a-fA-F]{0,4}){0,4}%[0-9a-zA-Z]{1,}|::(ffff(:0{1,4}){0,1}:){0,1}((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])|([0-9a-fA-F]{1,4}:){1,4}:((25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9])\.){3,3}(25[0-5]|(2[0-4]|1{0,1}[0-9]){0,1}[0-9]))\/(12[0-8]|1[01][0-9]|[1-9]?[0-9])$/, at = /^([0-9a-zA-Z+/]{4})*(([0-9a-zA-Z+/]{2}==)|([0-9a-zA-Z+/]{3}=))?$/, nt = /^([0-9a-zA-Z-_]{4})*(([0-9a-zA-Z-_]{2}(==)?)|([0-9a-zA-Z-_]{3}(=)?))?$/, Re = "((\\d\\d[2468][048]|\\d\\d[13579][26]|\\d\\d0[48]|[02468][048]00|[13579][26]00)-02-29|\\d{4}-((0[13578]|1[02])-(0[1-9]|[12]\\d|3[01])|(0[469]|11)-(0[1-9]|[12]\\d|30)|(02)-(0[1-9]|1\\d|2[0-8])))", rt = new RegExp(`^${Re}$`);
573
- function Ie(a) {
574
- let e = "[0-5]\\d";
575
- a.precision ? e = `${e}\\.\\d{${a.precision}}` : a.precision == null && (e = `${e}(\\.\\d+)?`);
576
- const t = a.precision ? "+" : "?";
577
- return `([01]\\d|2[0-3]):[0-5]\\d(:${e})${t}`;
578
- }
579
- function st(a) {
580
- return new RegExp(`^${Ie(a)}$`);
581
- }
582
- function it(a) {
583
- let e = `${Re}T${Ie(a)}`;
584
- const t = [];
585
- return t.push(a.local ? "Z?" : "Z"), a.offset && t.push("([+-]\\d{2}:?\\d{2})"), e = `${e}(${t.join("|")})`, new RegExp(`^${e}$`);
586
- }
587
- function ot(a, e) {
588
- return !!((e === "v4" || !e) && Xe.test(a) || (e === "v6" || !e) && et.test(a));
589
- }
590
- function lt(a, e) {
591
- if (!He.test(a))
592
- return !1;
593
- try {
594
- const [t] = a.split(".");
595
- if (!t)
596
- return !1;
597
- const n = t.replace(/-/g, "+").replace(/_/g, "/").padEnd(t.length + (4 - t.length % 4) % 4, "="), r = JSON.parse(atob(n));
598
- return !(typeof r != "object" || r === null || "typ" in r && (r == null ? void 0 : r.typ) !== "JWT" || !r.alg || e && r.alg !== e);
599
- } catch {
600
- return !1;
601
- }
602
- }
603
- function ct(a, e) {
604
- return !!((e === "v4" || !e) && Ke.test(a) || (e === "v6" || !e) && tt.test(a));
605
- }
606
- class I extends x {
607
- _parse(e) {
608
- if (this._def.coerce && (e.data = String(e.data)), this._getType(e) !== u.string) {
609
- const s = this._getOrReturnCtx(e);
610
- return c(s, {
611
- code: l.invalid_type,
612
- expected: u.string,
613
- received: s.parsedType
614
- }), m;
615
- }
616
- const n = new O();
617
- let r;
618
- for (const s of this._def.checks)
619
- if (s.kind === "min")
620
- e.data.length < s.value && (r = this._getOrReturnCtx(e, r), c(r, {
621
- code: l.too_small,
622
- minimum: s.value,
623
- type: "string",
624
- inclusive: !0,
625
- exact: !1,
626
- message: s.message
627
- }), n.dirty());
628
- else if (s.kind === "max")
629
- e.data.length > s.value && (r = this._getOrReturnCtx(e, r), c(r, {
630
- code: l.too_big,
631
- maximum: s.value,
632
- type: "string",
633
- inclusive: !0,
634
- exact: !1,
635
- message: s.message
636
- }), n.dirty());
637
- else if (s.kind === "length") {
638
- const i = e.data.length > s.value, o = e.data.length < s.value;
639
- (i || o) && (r = this._getOrReturnCtx(e, r), i ? c(r, {
640
- code: l.too_big,
641
- maximum: s.value,
642
- type: "string",
643
- inclusive: !0,
644
- exact: !0,
645
- message: s.message
646
- }) : o && c(r, {
647
- code: l.too_small,
648
- minimum: s.value,
649
- type: "string",
650
- inclusive: !0,
651
- exact: !0,
652
- message: s.message
653
- }), n.dirty());
654
- } else if (s.kind === "email")
655
- Ye.test(e.data) || (r = this._getOrReturnCtx(e, r), c(r, {
656
- validation: "email",
657
- code: l.invalid_string,
658
- message: s.message
659
- }), n.dirty());
660
- else if (s.kind === "emoji")
661
- ce || (ce = new RegExp(Qe, "u")), ce.test(e.data) || (r = this._getOrReturnCtx(e, r), c(r, {
662
- validation: "emoji",
663
- code: l.invalid_string,
664
- message: s.message
665
- }), n.dirty());
666
- else if (s.kind === "uuid")
667
- We.test(e.data) || (r = this._getOrReturnCtx(e, r), c(r, {
668
- validation: "uuid",
669
- code: l.invalid_string,
670
- message: s.message
671
- }), n.dirty());
672
- else if (s.kind === "nanoid")
673
- Je.test(e.data) || (r = this._getOrReturnCtx(e, r), c(r, {
674
- validation: "nanoid",
675
- code: l.invalid_string,
676
- message: s.message
677
- }), n.dirty());
678
- else if (s.kind === "cuid")
679
- Ue.test(e.data) || (r = this._getOrReturnCtx(e, r), c(r, {
680
- validation: "cuid",
681
- code: l.invalid_string,
682
- message: s.message
683
- }), n.dirty());
684
- else if (s.kind === "cuid2")
685
- Be.test(e.data) || (r = this._getOrReturnCtx(e, r), c(r, {
686
- validation: "cuid2",
687
- code: l.invalid_string,
688
- message: s.message
689
- }), n.dirty());
690
- else if (s.kind === "ulid")
691
- qe.test(e.data) || (r = this._getOrReturnCtx(e, r), c(r, {
692
- validation: "ulid",
693
- code: l.invalid_string,
694
- message: s.message
695
- }), n.dirty());
696
- else if (s.kind === "url")
697
- try {
698
- new URL(e.data);
699
- } catch {
700
- r = this._getOrReturnCtx(e, r), c(r, {
701
- validation: "url",
702
- code: l.invalid_string,
703
- message: s.message
704
- }), n.dirty();
705
- }
706
- else s.kind === "regex" ? (s.regex.lastIndex = 0, s.regex.test(e.data) || (r = this._getOrReturnCtx(e, r), c(r, {
707
- validation: "regex",
708
- code: l.invalid_string,
709
- message: s.message
710
- }), n.dirty())) : s.kind === "trim" ? e.data = e.data.trim() : s.kind === "includes" ? e.data.includes(s.value, s.position) || (r = this._getOrReturnCtx(e, r), c(r, {
711
- code: l.invalid_string,
712
- validation: { includes: s.value, position: s.position },
713
- message: s.message
714
- }), n.dirty()) : s.kind === "toLowerCase" ? e.data = e.data.toLowerCase() : s.kind === "toUpperCase" ? e.data = e.data.toUpperCase() : s.kind === "startsWith" ? e.data.startsWith(s.value) || (r = this._getOrReturnCtx(e, r), c(r, {
715
- code: l.invalid_string,
716
- validation: { startsWith: s.value },
717
- message: s.message
718
- }), n.dirty()) : s.kind === "endsWith" ? e.data.endsWith(s.value) || (r = this._getOrReturnCtx(e, r), c(r, {
719
- code: l.invalid_string,
720
- validation: { endsWith: s.value },
721
- message: s.message
722
- }), n.dirty()) : s.kind === "datetime" ? it(s).test(e.data) || (r = this._getOrReturnCtx(e, r), c(r, {
723
- code: l.invalid_string,
724
- validation: "datetime",
725
- message: s.message
726
- }), n.dirty()) : s.kind === "date" ? rt.test(e.data) || (r = this._getOrReturnCtx(e, r), c(r, {
727
- code: l.invalid_string,
728
- validation: "date",
729
- message: s.message
730
- }), n.dirty()) : s.kind === "time" ? st(s).test(e.data) || (r = this._getOrReturnCtx(e, r), c(r, {
731
- code: l.invalid_string,
732
- validation: "time",
733
- message: s.message
734
- }), n.dirty()) : s.kind === "duration" ? Ge.test(e.data) || (r = this._getOrReturnCtx(e, r), c(r, {
735
- validation: "duration",
736
- code: l.invalid_string,
737
- message: s.message
738
- }), n.dirty()) : s.kind === "ip" ? ot(e.data, s.version) || (r = this._getOrReturnCtx(e, r), c(r, {
739
- validation: "ip",
740
- code: l.invalid_string,
741
- message: s.message
742
- }), n.dirty()) : s.kind === "jwt" ? lt(e.data, s.alg) || (r = this._getOrReturnCtx(e, r), c(r, {
743
- validation: "jwt",
744
- code: l.invalid_string,
745
- message: s.message
746
- }), n.dirty()) : s.kind === "cidr" ? ct(e.data, s.version) || (r = this._getOrReturnCtx(e, r), c(r, {
747
- validation: "cidr",
748
- code: l.invalid_string,
749
- message: s.message
750
- }), n.dirty()) : s.kind === "base64" ? at.test(e.data) || (r = this._getOrReturnCtx(e, r), c(r, {
751
- validation: "base64",
752
- code: l.invalid_string,
753
- message: s.message
754
- }), n.dirty()) : s.kind === "base64url" ? nt.test(e.data) || (r = this._getOrReturnCtx(e, r), c(r, {
755
- validation: "base64url",
756
- code: l.invalid_string,
757
- message: s.message
758
- }), n.dirty()) : b.assertNever(s);
759
- return { status: n.value, value: e.data };
760
- }
761
- _regex(e, t, n) {
762
- return this.refinement((r) => e.test(r), {
763
- validation: t,
764
- code: l.invalid_string,
765
- ...f.errToObj(n)
766
- });
767
- }
768
- _addCheck(e) {
769
- return new I({
770
- ...this._def,
771
- checks: [...this._def.checks, e]
772
- });
773
- }
774
- email(e) {
775
- return this._addCheck({ kind: "email", ...f.errToObj(e) });
776
- }
777
- url(e) {
778
- return this._addCheck({ kind: "url", ...f.errToObj(e) });
779
- }
780
- emoji(e) {
781
- return this._addCheck({ kind: "emoji", ...f.errToObj(e) });
782
- }
783
- uuid(e) {
784
- return this._addCheck({ kind: "uuid", ...f.errToObj(e) });
785
- }
786
- nanoid(e) {
787
- return this._addCheck({ kind: "nanoid", ...f.errToObj(e) });
788
- }
789
- cuid(e) {
790
- return this._addCheck({ kind: "cuid", ...f.errToObj(e) });
791
- }
792
- cuid2(e) {
793
- return this._addCheck({ kind: "cuid2", ...f.errToObj(e) });
794
- }
795
- ulid(e) {
796
- return this._addCheck({ kind: "ulid", ...f.errToObj(e) });
797
- }
798
- base64(e) {
799
- return this._addCheck({ kind: "base64", ...f.errToObj(e) });
800
- }
801
- base64url(e) {
802
- return this._addCheck({
803
- kind: "base64url",
804
- ...f.errToObj(e)
805
- });
806
- }
807
- jwt(e) {
808
- return this._addCheck({ kind: "jwt", ...f.errToObj(e) });
809
- }
810
- ip(e) {
811
- return this._addCheck({ kind: "ip", ...f.errToObj(e) });
812
- }
813
- cidr(e) {
814
- return this._addCheck({ kind: "cidr", ...f.errToObj(e) });
815
- }
816
- datetime(e) {
817
- return typeof e == "string" ? this._addCheck({
818
- kind: "datetime",
819
- precision: null,
820
- offset: !1,
821
- local: !1,
822
- message: e
823
- }) : this._addCheck({
824
- kind: "datetime",
825
- precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
826
- offset: (e == null ? void 0 : e.offset) ?? !1,
827
- local: (e == null ? void 0 : e.local) ?? !1,
828
- ...f.errToObj(e == null ? void 0 : e.message)
829
- });
830
- }
831
- date(e) {
832
- return this._addCheck({ kind: "date", message: e });
833
- }
834
- time(e) {
835
- return typeof e == "string" ? this._addCheck({
836
- kind: "time",
837
- precision: null,
838
- message: e
839
- }) : this._addCheck({
840
- kind: "time",
841
- precision: typeof (e == null ? void 0 : e.precision) > "u" ? null : e == null ? void 0 : e.precision,
842
- ...f.errToObj(e == null ? void 0 : e.message)
843
- });
844
- }
845
- duration(e) {
846
- return this._addCheck({ kind: "duration", ...f.errToObj(e) });
847
- }
848
- regex(e, t) {
849
- return this._addCheck({
850
- kind: "regex",
851
- regex: e,
852
- ...f.errToObj(t)
853
- });
854
- }
855
- includes(e, t) {
856
- return this._addCheck({
857
- kind: "includes",
858
- value: e,
859
- position: t == null ? void 0 : t.position,
860
- ...f.errToObj(t == null ? void 0 : t.message)
861
- });
862
- }
863
- startsWith(e, t) {
864
- return this._addCheck({
865
- kind: "startsWith",
866
- value: e,
867
- ...f.errToObj(t)
868
- });
869
- }
870
- endsWith(e, t) {
871
- return this._addCheck({
872
- kind: "endsWith",
873
- value: e,
874
- ...f.errToObj(t)
875
- });
876
- }
877
- min(e, t) {
878
- return this._addCheck({
879
- kind: "min",
880
- value: e,
881
- ...f.errToObj(t)
882
- });
883
- }
884
- max(e, t) {
885
- return this._addCheck({
886
- kind: "max",
887
- value: e,
888
- ...f.errToObj(t)
889
- });
890
- }
891
- length(e, t) {
892
- return this._addCheck({
893
- kind: "length",
894
- value: e,
895
- ...f.errToObj(t)
896
- });
897
- }
898
- /**
899
- * Equivalent to `.min(1)`
900
- */
901
- nonempty(e) {
902
- return this.min(1, f.errToObj(e));
903
- }
904
- trim() {
905
- return new I({
906
- ...this._def,
907
- checks: [...this._def.checks, { kind: "trim" }]
908
- });
909
- }
910
- toLowerCase() {
911
- return new I({
912
- ...this._def,
913
- checks: [...this._def.checks, { kind: "toLowerCase" }]
914
- });
915
- }
916
- toUpperCase() {
917
- return new I({
918
- ...this._def,
919
- checks: [...this._def.checks, { kind: "toUpperCase" }]
920
- });
921
- }
922
- get isDatetime() {
923
- return !!this._def.checks.find((e) => e.kind === "datetime");
924
- }
925
- get isDate() {
926
- return !!this._def.checks.find((e) => e.kind === "date");
927
- }
928
- get isTime() {
929
- return !!this._def.checks.find((e) => e.kind === "time");
930
- }
931
- get isDuration() {
932
- return !!this._def.checks.find((e) => e.kind === "duration");
933
- }
934
- get isEmail() {
935
- return !!this._def.checks.find((e) => e.kind === "email");
936
- }
937
- get isURL() {
938
- return !!this._def.checks.find((e) => e.kind === "url");
939
- }
940
- get isEmoji() {
941
- return !!this._def.checks.find((e) => e.kind === "emoji");
942
- }
943
- get isUUID() {
944
- return !!this._def.checks.find((e) => e.kind === "uuid");
945
- }
946
- get isNANOID() {
947
- return !!this._def.checks.find((e) => e.kind === "nanoid");
948
- }
949
- get isCUID() {
950
- return !!this._def.checks.find((e) => e.kind === "cuid");
951
- }
952
- get isCUID2() {
953
- return !!this._def.checks.find((e) => e.kind === "cuid2");
954
- }
955
- get isULID() {
956
- return !!this._def.checks.find((e) => e.kind === "ulid");
957
- }
958
- get isIP() {
959
- return !!this._def.checks.find((e) => e.kind === "ip");
960
- }
961
- get isCIDR() {
962
- return !!this._def.checks.find((e) => e.kind === "cidr");
963
- }
964
- get isBase64() {
965
- return !!this._def.checks.find((e) => e.kind === "base64");
966
- }
967
- get isBase64url() {
968
- return !!this._def.checks.find((e) => e.kind === "base64url");
969
- }
970
- get minLength() {
971
- let e = null;
972
- for (const t of this._def.checks)
973
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
974
- return e;
975
- }
976
- get maxLength() {
977
- let e = null;
978
- for (const t of this._def.checks)
979
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
980
- return e;
981
- }
982
- }
983
- I.create = (a) => new I({
984
- checks: [],
985
- typeName: y.ZodString,
986
- coerce: (a == null ? void 0 : a.coerce) ?? !1,
987
- ..._(a)
988
- });
989
- function dt(a, e) {
990
- const t = (a.toString().split(".")[1] || "").length, n = (e.toString().split(".")[1] || "").length, r = t > n ? t : n, s = Number.parseInt(a.toFixed(r).replace(".", "")), i = Number.parseInt(e.toFixed(r).replace(".", ""));
991
- return s % i / 10 ** r;
992
- }
993
- class W extends x {
994
- constructor() {
995
- super(...arguments), this.min = this.gte, this.max = this.lte, this.step = this.multipleOf;
996
- }
997
- _parse(e) {
998
- if (this._def.coerce && (e.data = Number(e.data)), this._getType(e) !== u.number) {
999
- const s = this._getOrReturnCtx(e);
1000
- return c(s, {
1001
- code: l.invalid_type,
1002
- expected: u.number,
1003
- received: s.parsedType
1004
- }), m;
1005
- }
1006
- let n;
1007
- const r = new O();
1008
- for (const s of this._def.checks)
1009
- s.kind === "int" ? b.isInteger(e.data) || (n = this._getOrReturnCtx(e, n), c(n, {
1010
- code: l.invalid_type,
1011
- expected: "integer",
1012
- received: "float",
1013
- message: s.message
1014
- }), r.dirty()) : s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (n = this._getOrReturnCtx(e, n), c(n, {
1015
- code: l.too_small,
1016
- minimum: s.value,
1017
- type: "number",
1018
- inclusive: s.inclusive,
1019
- exact: !1,
1020
- message: s.message
1021
- }), r.dirty()) : s.kind === "max" ? (s.inclusive ? e.data > s.value : e.data >= s.value) && (n = this._getOrReturnCtx(e, n), c(n, {
1022
- code: l.too_big,
1023
- maximum: s.value,
1024
- type: "number",
1025
- inclusive: s.inclusive,
1026
- exact: !1,
1027
- message: s.message
1028
- }), r.dirty()) : s.kind === "multipleOf" ? dt(e.data, s.value) !== 0 && (n = this._getOrReturnCtx(e, n), c(n, {
1029
- code: l.not_multiple_of,
1030
- multipleOf: s.value,
1031
- message: s.message
1032
- }), r.dirty()) : s.kind === "finite" ? Number.isFinite(e.data) || (n = this._getOrReturnCtx(e, n), c(n, {
1033
- code: l.not_finite,
1034
- message: s.message
1035
- }), r.dirty()) : b.assertNever(s);
1036
- return { status: r.value, value: e.data };
1037
- }
1038
- gte(e, t) {
1039
- return this.setLimit("min", e, !0, f.toString(t));
1040
- }
1041
- gt(e, t) {
1042
- return this.setLimit("min", e, !1, f.toString(t));
1043
- }
1044
- lte(e, t) {
1045
- return this.setLimit("max", e, !0, f.toString(t));
1046
- }
1047
- lt(e, t) {
1048
- return this.setLimit("max", e, !1, f.toString(t));
1049
- }
1050
- setLimit(e, t, n, r) {
1051
- return new W({
1052
- ...this._def,
1053
- checks: [
1054
- ...this._def.checks,
1055
- {
1056
- kind: e,
1057
- value: t,
1058
- inclusive: n,
1059
- message: f.toString(r)
1060
- }
1061
- ]
1062
- });
1063
- }
1064
- _addCheck(e) {
1065
- return new W({
1066
- ...this._def,
1067
- checks: [...this._def.checks, e]
1068
- });
1069
- }
1070
- int(e) {
1071
- return this._addCheck({
1072
- kind: "int",
1073
- message: f.toString(e)
1074
- });
1075
- }
1076
- positive(e) {
1077
- return this._addCheck({
1078
- kind: "min",
1079
- value: 0,
1080
- inclusive: !1,
1081
- message: f.toString(e)
1082
- });
1083
- }
1084
- negative(e) {
1085
- return this._addCheck({
1086
- kind: "max",
1087
- value: 0,
1088
- inclusive: !1,
1089
- message: f.toString(e)
1090
- });
1091
- }
1092
- nonpositive(e) {
1093
- return this._addCheck({
1094
- kind: "max",
1095
- value: 0,
1096
- inclusive: !0,
1097
- message: f.toString(e)
1098
- });
1099
- }
1100
- nonnegative(e) {
1101
- return this._addCheck({
1102
- kind: "min",
1103
- value: 0,
1104
- inclusive: !0,
1105
- message: f.toString(e)
1106
- });
1107
- }
1108
- multipleOf(e, t) {
1109
- return this._addCheck({
1110
- kind: "multipleOf",
1111
- value: e,
1112
- message: f.toString(t)
1113
- });
1114
- }
1115
- finite(e) {
1116
- return this._addCheck({
1117
- kind: "finite",
1118
- message: f.toString(e)
1119
- });
1120
- }
1121
- safe(e) {
1122
- return this._addCheck({
1123
- kind: "min",
1124
- inclusive: !0,
1125
- value: Number.MIN_SAFE_INTEGER,
1126
- message: f.toString(e)
1127
- })._addCheck({
1128
- kind: "max",
1129
- inclusive: !0,
1130
- value: Number.MAX_SAFE_INTEGER,
1131
- message: f.toString(e)
1132
- });
1133
- }
1134
- get minValue() {
1135
- let e = null;
1136
- for (const t of this._def.checks)
1137
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1138
- return e;
1139
- }
1140
- get maxValue() {
1141
- let e = null;
1142
- for (const t of this._def.checks)
1143
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1144
- return e;
1145
- }
1146
- get isInt() {
1147
- return !!this._def.checks.find((e) => e.kind === "int" || e.kind === "multipleOf" && b.isInteger(e.value));
1148
- }
1149
- get isFinite() {
1150
- let e = null, t = null;
1151
- for (const n of this._def.checks) {
1152
- if (n.kind === "finite" || n.kind === "int" || n.kind === "multipleOf")
1153
- return !0;
1154
- n.kind === "min" ? (t === null || n.value > t) && (t = n.value) : n.kind === "max" && (e === null || n.value < e) && (e = n.value);
1155
- }
1156
- return Number.isFinite(t) && Number.isFinite(e);
1157
- }
1158
- }
1159
- W.create = (a) => new W({
1160
- checks: [],
1161
- typeName: y.ZodNumber,
1162
- coerce: (a == null ? void 0 : a.coerce) || !1,
1163
- ..._(a)
1164
- });
1165
- class G extends x {
1166
- constructor() {
1167
- super(...arguments), this.min = this.gte, this.max = this.lte;
1168
- }
1169
- _parse(e) {
1170
- if (this._def.coerce)
1171
- try {
1172
- e.data = BigInt(e.data);
1173
- } catch {
1174
- return this._getInvalidInput(e);
1175
- }
1176
- if (this._getType(e) !== u.bigint)
1177
- return this._getInvalidInput(e);
1178
- let n;
1179
- const r = new O();
1180
- for (const s of this._def.checks)
1181
- s.kind === "min" ? (s.inclusive ? e.data < s.value : e.data <= s.value) && (n = this._getOrReturnCtx(e, n), c(n, {
1182
- code: l.too_small,
1183
- type: "bigint",
1184
- minimum: s.value,
1185
- inclusive: s.inclusive,
1186
- message: s.message
1187
- }), r.dirty()) : s.kind === "max" ? (s.inclusive ? e.data > s.value : e.data >= s.value) && (n = this._getOrReturnCtx(e, n), c(n, {
1188
- code: l.too_big,
1189
- type: "bigint",
1190
- maximum: s.value,
1191
- inclusive: s.inclusive,
1192
- message: s.message
1193
- }), r.dirty()) : s.kind === "multipleOf" ? e.data % s.value !== BigInt(0) && (n = this._getOrReturnCtx(e, n), c(n, {
1194
- code: l.not_multiple_of,
1195
- multipleOf: s.value,
1196
- message: s.message
1197
- }), r.dirty()) : b.assertNever(s);
1198
- return { status: r.value, value: e.data };
1199
- }
1200
- _getInvalidInput(e) {
1201
- const t = this._getOrReturnCtx(e);
1202
- return c(t, {
1203
- code: l.invalid_type,
1204
- expected: u.bigint,
1205
- received: t.parsedType
1206
- }), m;
1207
- }
1208
- gte(e, t) {
1209
- return this.setLimit("min", e, !0, f.toString(t));
1210
- }
1211
- gt(e, t) {
1212
- return this.setLimit("min", e, !1, f.toString(t));
1213
- }
1214
- lte(e, t) {
1215
- return this.setLimit("max", e, !0, f.toString(t));
1216
- }
1217
- lt(e, t) {
1218
- return this.setLimit("max", e, !1, f.toString(t));
1219
- }
1220
- setLimit(e, t, n, r) {
1221
- return new G({
1222
- ...this._def,
1223
- checks: [
1224
- ...this._def.checks,
1225
- {
1226
- kind: e,
1227
- value: t,
1228
- inclusive: n,
1229
- message: f.toString(r)
1230
- }
1231
- ]
1232
- });
1233
- }
1234
- _addCheck(e) {
1235
- return new G({
1236
- ...this._def,
1237
- checks: [...this._def.checks, e]
1238
- });
1239
- }
1240
- positive(e) {
1241
- return this._addCheck({
1242
- kind: "min",
1243
- value: BigInt(0),
1244
- inclusive: !1,
1245
- message: f.toString(e)
1246
- });
1247
- }
1248
- negative(e) {
1249
- return this._addCheck({
1250
- kind: "max",
1251
- value: BigInt(0),
1252
- inclusive: !1,
1253
- message: f.toString(e)
1254
- });
1255
- }
1256
- nonpositive(e) {
1257
- return this._addCheck({
1258
- kind: "max",
1259
- value: BigInt(0),
1260
- inclusive: !0,
1261
- message: f.toString(e)
1262
- });
1263
- }
1264
- nonnegative(e) {
1265
- return this._addCheck({
1266
- kind: "min",
1267
- value: BigInt(0),
1268
- inclusive: !0,
1269
- message: f.toString(e)
1270
- });
1271
- }
1272
- multipleOf(e, t) {
1273
- return this._addCheck({
1274
- kind: "multipleOf",
1275
- value: e,
1276
- message: f.toString(t)
1277
- });
1278
- }
1279
- get minValue() {
1280
- let e = null;
1281
- for (const t of this._def.checks)
1282
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1283
- return e;
1284
- }
1285
- get maxValue() {
1286
- let e = null;
1287
- for (const t of this._def.checks)
1288
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1289
- return e;
1290
- }
1291
- }
1292
- G.create = (a) => new G({
1293
- checks: [],
1294
- typeName: y.ZodBigInt,
1295
- coerce: (a == null ? void 0 : a.coerce) ?? !1,
1296
- ..._(a)
1297
- });
1298
- class ue extends x {
1299
- _parse(e) {
1300
- if (this._def.coerce && (e.data = !!e.data), this._getType(e) !== u.boolean) {
1301
- const n = this._getOrReturnCtx(e);
1302
- return c(n, {
1303
- code: l.invalid_type,
1304
- expected: u.boolean,
1305
- received: n.parsedType
1306
- }), m;
1307
- }
1308
- return A(e.data);
1309
- }
1310
- }
1311
- ue.create = (a) => new ue({
1312
- typeName: y.ZodBoolean,
1313
- coerce: (a == null ? void 0 : a.coerce) || !1,
1314
- ..._(a)
1315
- });
1316
- class X extends x {
1317
- _parse(e) {
1318
- if (this._def.coerce && (e.data = new Date(e.data)), this._getType(e) !== u.date) {
1319
- const s = this._getOrReturnCtx(e);
1320
- return c(s, {
1321
- code: l.invalid_type,
1322
- expected: u.date,
1323
- received: s.parsedType
1324
- }), m;
1325
- }
1326
- if (Number.isNaN(e.data.getTime())) {
1327
- const s = this._getOrReturnCtx(e);
1328
- return c(s, {
1329
- code: l.invalid_date
1330
- }), m;
1331
- }
1332
- const n = new O();
1333
- let r;
1334
- for (const s of this._def.checks)
1335
- s.kind === "min" ? e.data.getTime() < s.value && (r = this._getOrReturnCtx(e, r), c(r, {
1336
- code: l.too_small,
1337
- message: s.message,
1338
- inclusive: !0,
1339
- exact: !1,
1340
- minimum: s.value,
1341
- type: "date"
1342
- }), n.dirty()) : s.kind === "max" ? e.data.getTime() > s.value && (r = this._getOrReturnCtx(e, r), c(r, {
1343
- code: l.too_big,
1344
- message: s.message,
1345
- inclusive: !0,
1346
- exact: !1,
1347
- maximum: s.value,
1348
- type: "date"
1349
- }), n.dirty()) : b.assertNever(s);
1350
- return {
1351
- status: n.value,
1352
- value: new Date(e.data.getTime())
1353
- };
1354
- }
1355
- _addCheck(e) {
1356
- return new X({
1357
- ...this._def,
1358
- checks: [...this._def.checks, e]
1359
- });
1360
- }
1361
- min(e, t) {
1362
- return this._addCheck({
1363
- kind: "min",
1364
- value: e.getTime(),
1365
- message: f.toString(t)
1366
- });
1367
- }
1368
- max(e, t) {
1369
- return this._addCheck({
1370
- kind: "max",
1371
- value: e.getTime(),
1372
- message: f.toString(t)
1373
- });
1374
- }
1375
- get minDate() {
1376
- let e = null;
1377
- for (const t of this._def.checks)
1378
- t.kind === "min" && (e === null || t.value > e) && (e = t.value);
1379
- return e != null ? new Date(e) : null;
1380
- }
1381
- get maxDate() {
1382
- let e = null;
1383
- for (const t of this._def.checks)
1384
- t.kind === "max" && (e === null || t.value < e) && (e = t.value);
1385
- return e != null ? new Date(e) : null;
1386
- }
1387
- }
1388
- X.create = (a) => new X({
1389
- checks: [],
1390
- coerce: (a == null ? void 0 : a.coerce) || !1,
1391
- typeName: y.ZodDate,
1392
- ..._(a)
1393
- });
1394
- class Ce extends x {
1395
- _parse(e) {
1396
- if (this._getType(e) !== u.symbol) {
1397
- const n = this._getOrReturnCtx(e);
1398
- return c(n, {
1399
- code: l.invalid_type,
1400
- expected: u.symbol,
1401
- received: n.parsedType
1402
- }), m;
1403
- }
1404
- return A(e.data);
1405
- }
1406
- }
1407
- Ce.create = (a) => new Ce({
1408
- typeName: y.ZodSymbol,
1409
- ..._(a)
1410
- });
1411
- class fe extends x {
1412
- _parse(e) {
1413
- if (this._getType(e) !== u.undefined) {
1414
- const n = this._getOrReturnCtx(e);
1415
- return c(n, {
1416
- code: l.invalid_type,
1417
- expected: u.undefined,
1418
- received: n.parsedType
1419
- }), m;
1420
- }
1421
- return A(e.data);
1422
- }
1423
- }
1424
- fe.create = (a) => new fe({
1425
- typeName: y.ZodUndefined,
1426
- ..._(a)
1427
- });
1428
- class he extends x {
1429
- _parse(e) {
1430
- if (this._getType(e) !== u.null) {
1431
- const n = this._getOrReturnCtx(e);
1432
- return c(n, {
1433
- code: l.invalid_type,
1434
- expected: u.null,
1435
- received: n.parsedType
1436
- }), m;
1437
- }
1438
- return A(e.data);
1439
- }
1440
- }
1441
- he.create = (a) => new he({
1442
- typeName: y.ZodNull,
1443
- ..._(a)
1444
- });
1445
- class Oe extends x {
1446
- constructor() {
1447
- super(...arguments), this._any = !0;
1448
- }
1449
- _parse(e) {
1450
- return A(e.data);
1451
- }
1452
- }
1453
- Oe.create = (a) => new Oe({
1454
- typeName: y.ZodAny,
1455
- ..._(a)
1456
- });
1457
- class pe extends x {
1458
- constructor() {
1459
- super(...arguments), this._unknown = !0;
1460
- }
1461
- _parse(e) {
1462
- return A(e.data);
1463
- }
1464
- }
1465
- pe.create = (a) => new pe({
1466
- typeName: y.ZodUnknown,
1467
- ..._(a)
1468
- });
1469
- class M extends x {
1470
- _parse(e) {
1471
- const t = this._getOrReturnCtx(e);
1472
- return c(t, {
1473
- code: l.invalid_type,
1474
- expected: u.never,
1475
- received: t.parsedType
1476
- }), m;
1477
- }
1478
- }
1479
- M.create = (a) => new M({
1480
- typeName: y.ZodNever,
1481
- ..._(a)
1482
- });
1483
- class Ae extends x {
1484
- _parse(e) {
1485
- if (this._getType(e) !== u.undefined) {
1486
- const n = this._getOrReturnCtx(e);
1487
- return c(n, {
1488
- code: l.invalid_type,
1489
- expected: u.void,
1490
- received: n.parsedType
1491
- }), m;
1492
- }
1493
- return A(e.data);
1494
- }
1495
- }
1496
- Ae.create = (a) => new Ae({
1497
- typeName: y.ZodVoid,
1498
- ..._(a)
1499
- });
1500
- class N extends x {
1501
- _parse(e) {
1502
- const { ctx: t, status: n } = this._processInputParams(e), r = this._def;
1503
- if (t.parsedType !== u.array)
1504
- return c(t, {
1505
- code: l.invalid_type,
1506
- expected: u.array,
1507
- received: t.parsedType
1508
- }), m;
1509
- if (r.exactLength !== null) {
1510
- const i = t.data.length > r.exactLength.value, o = t.data.length < r.exactLength.value;
1511
- (i || o) && (c(t, {
1512
- code: i ? l.too_big : l.too_small,
1513
- minimum: o ? r.exactLength.value : void 0,
1514
- maximum: i ? r.exactLength.value : void 0,
1515
- type: "array",
1516
- inclusive: !0,
1517
- exact: !0,
1518
- message: r.exactLength.message
1519
- }), n.dirty());
1520
- }
1521
- if (r.minLength !== null && t.data.length < r.minLength.value && (c(t, {
1522
- code: l.too_small,
1523
- minimum: r.minLength.value,
1524
- type: "array",
1525
- inclusive: !0,
1526
- exact: !1,
1527
- message: r.minLength.message
1528
- }), n.dirty()), r.maxLength !== null && t.data.length > r.maxLength.value && (c(t, {
1529
- code: l.too_big,
1530
- maximum: r.maxLength.value,
1531
- type: "array",
1532
- inclusive: !0,
1533
- exact: !1,
1534
- message: r.maxLength.message
1535
- }), n.dirty()), t.common.async)
1536
- return Promise.all([...t.data].map((i, o) => r.type._parseAsync(new Z(t, i, t.path, o)))).then((i) => O.mergeArray(n, i));
1537
- const s = [...t.data].map((i, o) => r.type._parseSync(new Z(t, i, t.path, o)));
1538
- return O.mergeArray(n, s);
1539
- }
1540
- get element() {
1541
- return this._def.type;
1542
- }
1543
- min(e, t) {
1544
- return new N({
1545
- ...this._def,
1546
- minLength: { value: e, message: f.toString(t) }
1547
- });
1548
- }
1549
- max(e, t) {
1550
- return new N({
1551
- ...this._def,
1552
- maxLength: { value: e, message: f.toString(t) }
1553
- });
1554
- }
1555
- length(e, t) {
1556
- return new N({
1557
- ...this._def,
1558
- exactLength: { value: e, message: f.toString(t) }
1559
- });
1560
- }
1561
- nonempty(e) {
1562
- return this.min(1, e);
1563
- }
1564
- }
1565
- N.create = (a, e) => new N({
1566
- type: a,
1567
- minLength: null,
1568
- maxLength: null,
1569
- exactLength: null,
1570
- typeName: y.ZodArray,
1571
- ..._(e)
1572
- });
1573
- function U(a) {
1574
- if (a instanceof T) {
1575
- const e = {};
1576
- for (const t in a.shape) {
1577
- const n = a.shape[t];
1578
- e[t] = j.create(U(n));
1579
- }
1580
- return new T({
1581
- ...a._def,
1582
- shape: () => e
1583
- });
1584
- } else return a instanceof N ? new N({
1585
- ...a._def,
1586
- type: U(a.element)
1587
- }) : a instanceof j ? j.create(U(a.unwrap())) : a instanceof F ? F.create(U(a.unwrap())) : a instanceof D ? D.create(a.items.map((e) => U(e))) : a;
1588
- }
1589
- class T extends x {
1590
- constructor() {
1591
- super(...arguments), this._cached = null, this.nonstrict = this.passthrough, this.augment = this.extend;
1592
- }
1593
- _getCached() {
1594
- if (this._cached !== null)
1595
- return this._cached;
1596
- const e = this._def.shape(), t = b.objectKeys(e);
1597
- return this._cached = { shape: e, keys: t }, this._cached;
1598
- }
1599
- _parse(e) {
1600
- if (this._getType(e) !== u.object) {
1601
- const p = this._getOrReturnCtx(e);
1602
- return c(p, {
1603
- code: l.invalid_type,
1604
- expected: u.object,
1605
- received: p.parsedType
1606
- }), m;
1607
- }
1608
- const { status: n, ctx: r } = this._processInputParams(e), { shape: s, keys: i } = this._getCached(), o = [];
1609
- if (!(this._def.catchall instanceof M && this._def.unknownKeys === "strip"))
1610
- for (const p in r.data)
1611
- i.includes(p) || o.push(p);
1612
- const h = [];
1613
- for (const p of i) {
1614
- const w = s[p], J = r.data[p];
1615
- h.push({
1616
- key: { status: "valid", value: p },
1617
- value: w._parse(new Z(r, J, r.path, p)),
1618
- alwaysSet: p in r.data
1619
- });
1620
- }
1621
- if (this._def.catchall instanceof M) {
1622
- const p = this._def.unknownKeys;
1623
- if (p === "passthrough")
1624
- for (const w of o)
1625
- h.push({
1626
- key: { status: "valid", value: w },
1627
- value: { status: "valid", value: r.data[w] }
1628
- });
1629
- else if (p === "strict")
1630
- o.length > 0 && (c(r, {
1631
- code: l.unrecognized_keys,
1632
- keys: o
1633
- }), n.dirty());
1634
- else if (p !== "strip") throw new Error("Internal ZodObject error: invalid unknownKeys value.");
1635
- } else {
1636
- const p = this._def.catchall;
1637
- for (const w of o) {
1638
- const J = r.data[w];
1639
- h.push({
1640
- key: { status: "valid", value: w },
1641
- value: p._parse(
1642
- new Z(r, J, r.path, w)
1643
- //, ctx.child(key), value, getParsedType(value)
1644
- ),
1645
- alwaysSet: w in r.data
1646
- });
1647
- }
1648
- }
1649
- return r.common.async ? Promise.resolve().then(async () => {
1650
- const p = [];
1651
- for (const w of h) {
1652
- const J = await w.key, Ve = await w.value;
1653
- p.push({
1654
- key: J,
1655
- value: Ve,
1656
- alwaysSet: w.alwaysSet
1657
- });
1658
- }
1659
- return p;
1660
- }).then((p) => O.mergeObjectSync(n, p)) : O.mergeObjectSync(n, h);
1661
- }
1662
- get shape() {
1663
- return this._def.shape();
1664
- }
1665
- strict(e) {
1666
- return f.errToObj, new T({
1667
- ...this._def,
1668
- unknownKeys: "strict",
1669
- ...e !== void 0 ? {
1670
- errorMap: (t, n) => {
1671
- var s, i;
1672
- const r = ((i = (s = this._def).errorMap) == null ? void 0 : i.call(s, t, n).message) ?? n.defaultError;
1673
- return t.code === "unrecognized_keys" ? {
1674
- message: f.errToObj(e).message ?? r
1675
- } : {
1676
- message: r
1677
- };
1678
- }
1679
- } : {}
1680
- });
1681
- }
1682
- strip() {
1683
- return new T({
1684
- ...this._def,
1685
- unknownKeys: "strip"
1686
- });
1687
- }
1688
- passthrough() {
1689
- return new T({
1690
- ...this._def,
1691
- unknownKeys: "passthrough"
1692
- });
1693
- }
1694
- // const AugmentFactory =
1695
- // <Def extends ZodObjectDef>(def: Def) =>
1696
- // <Augmentation extends ZodRawShape>(
1697
- // augmentation: Augmentation
1698
- // ): ZodObject<
1699
- // extendShape<ReturnType<Def["shape"]>, Augmentation>,
1700
- // Def["unknownKeys"],
1701
- // Def["catchall"]
1702
- // > => {
1703
- // return new ZodObject({
1704
- // ...def,
1705
- // shape: () => ({
1706
- // ...def.shape(),
1707
- // ...augmentation,
1708
- // }),
1709
- // }) as any;
1710
- // };
1711
- extend(e) {
1712
- return new T({
1713
- ...this._def,
1714
- shape: () => ({
1715
- ...this._def.shape(),
1716
- ...e
1717
- })
1718
- });
1719
- }
1720
- /**
1721
- * Prior to zod@1.0.12 there was a bug in the
1722
- * inferred type of merged objects. Please
1723
- * upgrade if you are experiencing issues.
1724
- */
1725
- merge(e) {
1726
- return new T({
1727
- unknownKeys: e._def.unknownKeys,
1728
- catchall: e._def.catchall,
1729
- shape: () => ({
1730
- ...this._def.shape(),
1731
- ...e._def.shape()
1732
- }),
1733
- typeName: y.ZodObject
1734
- });
1735
- }
1736
- // merge<
1737
- // Incoming extends AnyZodObject,
1738
- // Augmentation extends Incoming["shape"],
1739
- // NewOutput extends {
1740
- // [k in keyof Augmentation | keyof Output]: k extends keyof Augmentation
1741
- // ? Augmentation[k]["_output"]
1742
- // : k extends keyof Output
1743
- // ? Output[k]
1744
- // : never;
1745
- // },
1746
- // NewInput extends {
1747
- // [k in keyof Augmentation | keyof Input]: k extends keyof Augmentation
1748
- // ? Augmentation[k]["_input"]
1749
- // : k extends keyof Input
1750
- // ? Input[k]
1751
- // : never;
1752
- // }
1753
- // >(
1754
- // merging: Incoming
1755
- // ): ZodObject<
1756
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1757
- // Incoming["_def"]["unknownKeys"],
1758
- // Incoming["_def"]["catchall"],
1759
- // NewOutput,
1760
- // NewInput
1761
- // > {
1762
- // const merged: any = new ZodObject({
1763
- // unknownKeys: merging._def.unknownKeys,
1764
- // catchall: merging._def.catchall,
1765
- // shape: () =>
1766
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1767
- // typeName: ZodFirstPartyTypeKind.ZodObject,
1768
- // }) as any;
1769
- // return merged;
1770
- // }
1771
- setKey(e, t) {
1772
- return this.augment({ [e]: t });
1773
- }
1774
- // merge<Incoming extends AnyZodObject>(
1775
- // merging: Incoming
1776
- // ): //ZodObject<T & Incoming["_shape"], UnknownKeys, Catchall> = (merging) => {
1777
- // ZodObject<
1778
- // extendShape<T, ReturnType<Incoming["_def"]["shape"]>>,
1779
- // Incoming["_def"]["unknownKeys"],
1780
- // Incoming["_def"]["catchall"]
1781
- // > {
1782
- // // const mergedShape = objectUtil.mergeShapes(
1783
- // // this._def.shape(),
1784
- // // merging._def.shape()
1785
- // // );
1786
- // const merged: any = new ZodObject({
1787
- // unknownKeys: merging._def.unknownKeys,
1788
- // catchall: merging._def.catchall,
1789
- // shape: () =>
1790
- // objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
1791
- // typeName: ZodFirstPartyTypeKind.ZodObject,
1792
- // }) as any;
1793
- // return merged;
1794
- // }
1795
- catchall(e) {
1796
- return new T({
1797
- ...this._def,
1798
- catchall: e
1799
- });
1800
- }
1801
- pick(e) {
1802
- const t = {};
1803
- for (const n of b.objectKeys(e))
1804
- e[n] && this.shape[n] && (t[n] = this.shape[n]);
1805
- return new T({
1806
- ...this._def,
1807
- shape: () => t
1808
- });
1809
- }
1810
- omit(e) {
1811
- const t = {};
1812
- for (const n of b.objectKeys(this.shape))
1813
- e[n] || (t[n] = this.shape[n]);
1814
- return new T({
1815
- ...this._def,
1816
- shape: () => t
1817
- });
1818
- }
1819
- /**
1820
- * @deprecated
1821
- */
1822
- deepPartial() {
1823
- return U(this);
1824
- }
1825
- partial(e) {
1826
- const t = {};
1827
- for (const n of b.objectKeys(this.shape)) {
1828
- const r = this.shape[n];
1829
- e && !e[n] ? t[n] = r : t[n] = r.optional();
1830
- }
1831
- return new T({
1832
- ...this._def,
1833
- shape: () => t
1834
- });
1835
- }
1836
- required(e) {
1837
- const t = {};
1838
- for (const n of b.objectKeys(this.shape))
1839
- if (e && !e[n])
1840
- t[n] = this.shape[n];
1841
- else {
1842
- let s = this.shape[n];
1843
- for (; s instanceof j; )
1844
- s = s._def.innerType;
1845
- t[n] = s;
1846
- }
1847
- return new T({
1848
- ...this._def,
1849
- shape: () => t
1850
- });
1851
- }
1852
- keyof() {
1853
- return je(b.objectKeys(this.shape));
1854
- }
1855
- }
1856
- T.create = (a, e) => new T({
1857
- shape: () => a,
1858
- unknownKeys: "strip",
1859
- catchall: M.create(),
1860
- typeName: y.ZodObject,
1861
- ..._(e)
1862
- });
1863
- T.strictCreate = (a, e) => new T({
1864
- shape: () => a,
1865
- unknownKeys: "strict",
1866
- catchall: M.create(),
1867
- typeName: y.ZodObject,
1868
- ..._(e)
1869
- });
1870
- T.lazycreate = (a, e) => new T({
1871
- shape: a,
1872
- unknownKeys: "strip",
1873
- catchall: M.create(),
1874
- typeName: y.ZodObject,
1875
- ..._(e)
1876
- });
1877
- class K extends x {
1878
- _parse(e) {
1879
- const { ctx: t } = this._processInputParams(e), n = this._def.options;
1880
- function r(s) {
1881
- for (const o of s)
1882
- if (o.result.status === "valid")
1883
- return o.result;
1884
- for (const o of s)
1885
- if (o.result.status === "dirty")
1886
- return t.common.issues.push(...o.ctx.common.issues), o.result;
1887
- const i = s.map((o) => new $(o.ctx.common.issues));
1888
- return c(t, {
1889
- code: l.invalid_union,
1890
- unionErrors: i
1891
- }), m;
1892
- }
1893
- if (t.common.async)
1894
- return Promise.all(n.map(async (s) => {
1895
- const i = {
1896
- ...t,
1897
- common: {
1898
- ...t.common,
1899
- issues: []
1900
- },
1901
- parent: null
1902
- };
1903
- return {
1904
- result: await s._parseAsync({
1905
- data: t.data,
1906
- path: t.path,
1907
- parent: i
1908
- }),
1909
- ctx: i
1910
- };
1911
- })).then(r);
1912
- {
1913
- let s;
1914
- const i = [];
1915
- for (const h of n) {
1916
- const p = {
1917
- ...t,
1918
- common: {
1919
- ...t.common,
1920
- issues: []
1921
- },
1922
- parent: null
1923
- }, w = h._parseSync({
1924
- data: t.data,
1925
- path: t.path,
1926
- parent: p
1927
- });
1928
- if (w.status === "valid")
1929
- return w;
1930
- w.status === "dirty" && !s && (s = { result: w, ctx: p }), p.common.issues.length && i.push(p.common.issues);
1931
- }
1932
- if (s)
1933
- return t.common.issues.push(...s.ctx.common.issues), s.result;
1934
- const o = i.map((h) => new $(h));
1935
- return c(t, {
1936
- code: l.invalid_union,
1937
- unionErrors: o
1938
- }), m;
1939
- }
1940
- }
1941
- get options() {
1942
- return this._def.options;
1943
- }
1944
- }
1945
- K.create = (a, e) => new K({
1946
- options: a,
1947
- typeName: y.ZodUnion,
1948
- ..._(e)
1949
- });
1950
- const R = (a) => a instanceof ye ? R(a.schema) : a instanceof P ? R(a.innerType()) : a instanceof ae ? [a.value] : a instanceof z ? a.options : a instanceof ge ? b.objectValues(a.enum) : a instanceof re ? R(a._def.innerType) : a instanceof fe ? [void 0] : a instanceof he ? [null] : a instanceof j ? [void 0, ...R(a.unwrap())] : a instanceof F ? [null, ...R(a.unwrap())] : a instanceof Ee || a instanceof ie ? R(a.unwrap()) : a instanceof se ? R(a._def.innerType) : [];
1951
- class _e extends x {
1952
- _parse(e) {
1953
- const { ctx: t } = this._processInputParams(e);
1954
- if (t.parsedType !== u.object)
1955
- return c(t, {
1956
- code: l.invalid_type,
1957
- expected: u.object,
1958
- received: t.parsedType
1959
- }), m;
1960
- const n = this.discriminator, r = t.data[n], s = this.optionsMap.get(r);
1961
- return s ? t.common.async ? s._parseAsync({
1962
- data: t.data,
1963
- path: t.path,
1964
- parent: t
1965
- }) : s._parseSync({
1966
- data: t.data,
1967
- path: t.path,
1968
- parent: t
1969
- }) : (c(t, {
1970
- code: l.invalid_union_discriminator,
1971
- options: Array.from(this.optionsMap.keys()),
1972
- path: [n]
1973
- }), m);
1974
- }
1975
- get discriminator() {
1976
- return this._def.discriminator;
1977
- }
1978
- get options() {
1979
- return this._def.options;
1980
- }
1981
- get optionsMap() {
1982
- return this._def.optionsMap;
1983
- }
1984
- /**
1985
- * The constructor of the discriminated union schema. Its behaviour is very similar to that of the normal z.union() constructor.
1986
- * However, it only allows a union of objects, all of which need to share a discriminator property. This property must
1987
- * have a different value for each object in the union.
1988
- * @param discriminator the name of the discriminator property
1989
- * @param types an array of object schemas
1990
- * @param params
1991
- */
1992
- static create(e, t, n) {
1993
- const r = /* @__PURE__ */ new Map();
1994
- for (const s of t) {
1995
- const i = R(s.shape[e]);
1996
- if (!i.length)
1997
- throw new Error(`A discriminator value for key \`${e}\` could not be extracted from all schema options`);
1998
- for (const o of i) {
1999
- if (r.has(o))
2000
- throw new Error(`Discriminator property ${String(e)} has duplicate value ${String(o)}`);
2001
- r.set(o, s);
2002
- }
2003
- }
2004
- return new _e({
2005
- typeName: y.ZodDiscriminatedUnion,
2006
- discriminator: e,
2007
- options: t,
2008
- optionsMap: r,
2009
- ..._(n)
2010
- });
2011
- }
2012
- }
2013
- function me(a, e) {
2014
- const t = L(a), n = L(e);
2015
- if (a === e)
2016
- return { valid: !0, data: a };
2017
- if (t === u.object && n === u.object) {
2018
- const r = b.objectKeys(e), s = b.objectKeys(a).filter((o) => r.indexOf(o) !== -1), i = { ...a, ...e };
2019
- for (const o of s) {
2020
- const h = me(a[o], e[o]);
2021
- if (!h.valid)
2022
- return { valid: !1 };
2023
- i[o] = h.data;
2024
- }
2025
- return { valid: !0, data: i };
2026
- } else if (t === u.array && n === u.array) {
2027
- if (a.length !== e.length)
2028
- return { valid: !1 };
2029
- const r = [];
2030
- for (let s = 0; s < a.length; s++) {
2031
- const i = a[s], o = e[s], h = me(i, o);
2032
- if (!h.valid)
2033
- return { valid: !1 };
2034
- r.push(h.data);
2035
- }
2036
- return { valid: !0, data: r };
2037
- } else return t === u.date && n === u.date && +a == +e ? { valid: !0, data: a } : { valid: !1 };
2038
- }
2039
- class ee extends x {
2040
- _parse(e) {
2041
- const { status: t, ctx: n } = this._processInputParams(e), r = (s, i) => {
2042
- if (we(s) || we(i))
2043
- return m;
2044
- const o = me(s.value, i.value);
2045
- return o.valid ? ((Se(s) || Se(i)) && t.dirty(), { status: t.value, value: o.data }) : (c(n, {
2046
- code: l.invalid_intersection_types
2047
- }), m);
2048
- };
2049
- return n.common.async ? Promise.all([
2050
- this._def.left._parseAsync({
2051
- data: n.data,
2052
- path: n.path,
2053
- parent: n
2054
- }),
2055
- this._def.right._parseAsync({
2056
- data: n.data,
2057
- path: n.path,
2058
- parent: n
2059
- })
2060
- ]).then(([s, i]) => r(s, i)) : r(this._def.left._parseSync({
2061
- data: n.data,
2062
- path: n.path,
2063
- parent: n
2064
- }), this._def.right._parseSync({
2065
- data: n.data,
2066
- path: n.path,
2067
- parent: n
2068
- }));
2069
- }
2070
- }
2071
- ee.create = (a, e, t) => new ee({
2072
- left: a,
2073
- right: e,
2074
- typeName: y.ZodIntersection,
2075
- ..._(t)
2076
- });
2077
- class D extends x {
2078
- _parse(e) {
2079
- const { status: t, ctx: n } = this._processInputParams(e);
2080
- if (n.parsedType !== u.array)
2081
- return c(n, {
2082
- code: l.invalid_type,
2083
- expected: u.array,
2084
- received: n.parsedType
2085
- }), m;
2086
- if (n.data.length < this._def.items.length)
2087
- return c(n, {
2088
- code: l.too_small,
2089
- minimum: this._def.items.length,
2090
- inclusive: !0,
2091
- exact: !1,
2092
- type: "array"
2093
- }), m;
2094
- !this._def.rest && n.data.length > this._def.items.length && (c(n, {
2095
- code: l.too_big,
2096
- maximum: this._def.items.length,
2097
- inclusive: !0,
2098
- exact: !1,
2099
- type: "array"
2100
- }), t.dirty());
2101
- const s = [...n.data].map((i, o) => {
2102
- const h = this._def.items[o] || this._def.rest;
2103
- return h ? h._parse(new Z(n, i, n.path, o)) : null;
2104
- }).filter((i) => !!i);
2105
- return n.common.async ? Promise.all(s).then((i) => O.mergeArray(t, i)) : O.mergeArray(t, s);
2106
- }
2107
- get items() {
2108
- return this._def.items;
2109
- }
2110
- rest(e) {
2111
- return new D({
2112
- ...this._def,
2113
- rest: e
2114
- });
2115
- }
2116
- }
2117
- D.create = (a, e) => {
2118
- if (!Array.isArray(a))
2119
- throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2120
- return new D({
2121
- items: a,
2122
- typeName: y.ZodTuple,
2123
- rest: null,
2124
- ..._(e)
2125
- });
2126
- };
2127
- class te extends x {
2128
- get keySchema() {
2129
- return this._def.keyType;
2130
- }
2131
- get valueSchema() {
2132
- return this._def.valueType;
2133
- }
2134
- _parse(e) {
2135
- const { status: t, ctx: n } = this._processInputParams(e);
2136
- if (n.parsedType !== u.object)
2137
- return c(n, {
2138
- code: l.invalid_type,
2139
- expected: u.object,
2140
- received: n.parsedType
2141
- }), m;
2142
- const r = [], s = this._def.keyType, i = this._def.valueType;
2143
- for (const o in n.data)
2144
- r.push({
2145
- key: s._parse(new Z(n, o, n.path, o)),
2146
- value: i._parse(new Z(n, n.data[o], n.path, o)),
2147
- alwaysSet: o in n.data
2148
- });
2149
- return n.common.async ? O.mergeObjectAsync(t, r) : O.mergeObjectSync(t, r);
2150
- }
2151
- get element() {
2152
- return this._def.valueType;
2153
- }
2154
- static create(e, t, n) {
2155
- return t instanceof x ? new te({
2156
- keyType: e,
2157
- valueType: t,
2158
- typeName: y.ZodRecord,
2159
- ..._(n)
2160
- }) : new te({
2161
- keyType: I.create(),
2162
- valueType: e,
2163
- typeName: y.ZodRecord,
2164
- ..._(t)
2165
- });
2166
- }
2167
- }
2168
- class Ne extends x {
2169
- get keySchema() {
2170
- return this._def.keyType;
2171
- }
2172
- get valueSchema() {
2173
- return this._def.valueType;
2174
- }
2175
- _parse(e) {
2176
- const { status: t, ctx: n } = this._processInputParams(e);
2177
- if (n.parsedType !== u.map)
2178
- return c(n, {
2179
- code: l.invalid_type,
2180
- expected: u.map,
2181
- received: n.parsedType
2182
- }), m;
2183
- const r = this._def.keyType, s = this._def.valueType, i = [...n.data.entries()].map(([o, h], p) => ({
2184
- key: r._parse(new Z(n, o, n.path, [p, "key"])),
2185
- value: s._parse(new Z(n, h, n.path, [p, "value"]))
2186
- }));
2187
- if (n.common.async) {
2188
- const o = /* @__PURE__ */ new Map();
2189
- return Promise.resolve().then(async () => {
2190
- for (const h of i) {
2191
- const p = await h.key, w = await h.value;
2192
- if (p.status === "aborted" || w.status === "aborted")
2193
- return m;
2194
- (p.status === "dirty" || w.status === "dirty") && t.dirty(), o.set(p.value, w.value);
2195
- }
2196
- return { status: t.value, value: o };
2197
- });
2198
- } else {
2199
- const o = /* @__PURE__ */ new Map();
2200
- for (const h of i) {
2201
- const p = h.key, w = h.value;
2202
- if (p.status === "aborted" || w.status === "aborted")
2203
- return m;
2204
- (p.status === "dirty" || w.status === "dirty") && t.dirty(), o.set(p.value, w.value);
2205
- }
2206
- return { status: t.value, value: o };
2207
- }
2208
- }
2209
- }
2210
- Ne.create = (a, e, t) => new Ne({
2211
- valueType: e,
2212
- keyType: a,
2213
- typeName: y.ZodMap,
2214
- ..._(t)
2215
- });
2216
- class Y extends x {
2217
- _parse(e) {
2218
- const { status: t, ctx: n } = this._processInputParams(e);
2219
- if (n.parsedType !== u.set)
2220
- return c(n, {
2221
- code: l.invalid_type,
2222
- expected: u.set,
2223
- received: n.parsedType
2224
- }), m;
2225
- const r = this._def;
2226
- r.minSize !== null && n.data.size < r.minSize.value && (c(n, {
2227
- code: l.too_small,
2228
- minimum: r.minSize.value,
2229
- type: "set",
2230
- inclusive: !0,
2231
- exact: !1,
2232
- message: r.minSize.message
2233
- }), t.dirty()), r.maxSize !== null && n.data.size > r.maxSize.value && (c(n, {
2234
- code: l.too_big,
2235
- maximum: r.maxSize.value,
2236
- type: "set",
2237
- inclusive: !0,
2238
- exact: !1,
2239
- message: r.maxSize.message
2240
- }), t.dirty());
2241
- const s = this._def.valueType;
2242
- function i(h) {
2243
- const p = /* @__PURE__ */ new Set();
2244
- for (const w of h) {
2245
- if (w.status === "aborted")
2246
- return m;
2247
- w.status === "dirty" && t.dirty(), p.add(w.value);
2248
- }
2249
- return { status: t.value, value: p };
2250
- }
2251
- const o = [...n.data.values()].map((h, p) => s._parse(new Z(n, h, n.path, p)));
2252
- return n.common.async ? Promise.all(o).then((h) => i(h)) : i(o);
2253
- }
2254
- min(e, t) {
2255
- return new Y({
2256
- ...this._def,
2257
- minSize: { value: e, message: f.toString(t) }
2258
- });
2259
- }
2260
- max(e, t) {
2261
- return new Y({
2262
- ...this._def,
2263
- maxSize: { value: e, message: f.toString(t) }
2264
- });
2265
- }
2266
- size(e, t) {
2267
- return this.min(e, t).max(e, t);
2268
- }
2269
- nonempty(e) {
2270
- return this.min(1, e);
2271
- }
2272
- }
2273
- Y.create = (a, e) => new Y({
2274
- valueType: a,
2275
- minSize: null,
2276
- maxSize: null,
2277
- typeName: y.ZodSet,
2278
- ..._(e)
2279
- });
2280
- class ye extends x {
2281
- get schema() {
2282
- return this._def.getter();
2283
- }
2284
- _parse(e) {
2285
- const { ctx: t } = this._processInputParams(e);
2286
- return this._def.getter()._parse({ data: t.data, path: t.path, parent: t });
2287
- }
2288
- }
2289
- ye.create = (a, e) => new ye({
2290
- getter: a,
2291
- typeName: y.ZodLazy,
2292
- ..._(e)
2293
- });
2294
- class ae extends x {
2295
- _parse(e) {
2296
- if (e.data !== this._def.value) {
2297
- const t = this._getOrReturnCtx(e);
2298
- return c(t, {
2299
- received: t.data,
2300
- code: l.invalid_literal,
2301
- expected: this._def.value
2302
- }), m;
2303
- }
2304
- return { status: "valid", value: e.data };
2305
- }
2306
- get value() {
2307
- return this._def.value;
2308
- }
2309
- }
2310
- ae.create = (a, e) => new ae({
2311
- value: a,
2312
- typeName: y.ZodLiteral,
2313
- ..._(e)
2314
- });
2315
- function je(a, e) {
2316
- return new z({
2317
- values: a,
2318
- typeName: y.ZodEnum,
2319
- ..._(e)
2320
- });
2321
- }
2322
- class z extends x {
2323
- _parse(e) {
2324
- if (typeof e.data != "string") {
2325
- const t = this._getOrReturnCtx(e), n = this._def.values;
2326
- return c(t, {
2327
- expected: b.joinValues(n),
2328
- received: t.parsedType,
2329
- code: l.invalid_type
2330
- }), m;
2331
- }
2332
- if (this._cache || (this._cache = new Set(this._def.values)), !this._cache.has(e.data)) {
2333
- const t = this._getOrReturnCtx(e), n = this._def.values;
2334
- return c(t, {
2335
- received: t.data,
2336
- code: l.invalid_enum_value,
2337
- options: n
2338
- }), m;
2339
- }
2340
- return A(e.data);
2341
- }
2342
- get options() {
2343
- return this._def.values;
2344
- }
2345
- get enum() {
2346
- const e = {};
2347
- for (const t of this._def.values)
2348
- e[t] = t;
2349
- return e;
2350
- }
2351
- get Values() {
2352
- const e = {};
2353
- for (const t of this._def.values)
2354
- e[t] = t;
2355
- return e;
2356
- }
2357
- get Enum() {
2358
- const e = {};
2359
- for (const t of this._def.values)
2360
- e[t] = t;
2361
- return e;
2362
- }
2363
- extract(e, t = this._def) {
2364
- return z.create(e, {
2365
- ...this._def,
2366
- ...t
2367
- });
2368
- }
2369
- exclude(e, t = this._def) {
2370
- return z.create(this.options.filter((n) => !e.includes(n)), {
2371
- ...this._def,
2372
- ...t
2373
- });
2374
- }
2375
- }
2376
- z.create = je;
2377
- class ge extends x {
2378
- _parse(e) {
2379
- const t = b.getValidEnumValues(this._def.values), n = this._getOrReturnCtx(e);
2380
- if (n.parsedType !== u.string && n.parsedType !== u.number) {
2381
- const r = b.objectValues(t);
2382
- return c(n, {
2383
- expected: b.joinValues(r),
2384
- received: n.parsedType,
2385
- code: l.invalid_type
2386
- }), m;
2387
- }
2388
- if (this._cache || (this._cache = new Set(b.getValidEnumValues(this._def.values))), !this._cache.has(e.data)) {
2389
- const r = b.objectValues(t);
2390
- return c(n, {
2391
- received: n.data,
2392
- code: l.invalid_enum_value,
2393
- options: r
2394
- }), m;
2395
- }
2396
- return A(e.data);
2397
- }
2398
- get enum() {
2399
- return this._def.values;
2400
- }
2401
- }
2402
- ge.create = (a, e) => new ge({
2403
- values: a,
2404
- typeName: y.ZodNativeEnum,
2405
- ..._(e)
2406
- });
2407
- class ne extends x {
2408
- unwrap() {
2409
- return this._def.type;
2410
- }
2411
- _parse(e) {
2412
- const { ctx: t } = this._processInputParams(e);
2413
- if (t.parsedType !== u.promise && t.common.async === !1)
2414
- return c(t, {
2415
- code: l.invalid_type,
2416
- expected: u.promise,
2417
- received: t.parsedType
2418
- }), m;
2419
- const n = t.parsedType === u.promise ? t.data : Promise.resolve(t.data);
2420
- return A(n.then((r) => this._def.type.parseAsync(r, {
2421
- path: t.path,
2422
- errorMap: t.common.contextualErrorMap
2423
- })));
2424
- }
2425
- }
2426
- ne.create = (a, e) => new ne({
2427
- type: a,
2428
- typeName: y.ZodPromise,
2429
- ..._(e)
2430
- });
2431
- class P extends x {
2432
- innerType() {
2433
- return this._def.schema;
2434
- }
2435
- sourceType() {
2436
- return this._def.schema._def.typeName === y.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
2437
- }
2438
- _parse(e) {
2439
- const { status: t, ctx: n } = this._processInputParams(e), r = this._def.effect || null, s = {
2440
- addIssue: (i) => {
2441
- c(n, i), i.fatal ? t.abort() : t.dirty();
2442
- },
2443
- get path() {
2444
- return n.path;
2445
- }
2446
- };
2447
- if (s.addIssue = s.addIssue.bind(s), r.type === "preprocess") {
2448
- const i = r.transform(n.data, s);
2449
- if (n.common.async)
2450
- return Promise.resolve(i).then(async (o) => {
2451
- if (t.value === "aborted")
2452
- return m;
2453
- const h = await this._def.schema._parseAsync({
2454
- data: o,
2455
- path: n.path,
2456
- parent: n
2457
- });
2458
- return h.status === "aborted" ? m : h.status === "dirty" || t.value === "dirty" ? H(h.value) : h;
2459
- });
2460
- {
2461
- if (t.value === "aborted")
2462
- return m;
2463
- const o = this._def.schema._parseSync({
2464
- data: i,
2465
- path: n.path,
2466
- parent: n
2467
- });
2468
- return o.status === "aborted" ? m : o.status === "dirty" || t.value === "dirty" ? H(o.value) : o;
2469
- }
2470
- }
2471
- if (r.type === "refinement") {
2472
- const i = (o) => {
2473
- const h = r.refinement(o, s);
2474
- if (n.common.async)
2475
- return Promise.resolve(h);
2476
- if (h instanceof Promise)
2477
- throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
2478
- return o;
2479
- };
2480
- if (n.common.async === !1) {
2481
- const o = this._def.schema._parseSync({
2482
- data: n.data,
2483
- path: n.path,
2484
- parent: n
2485
- });
2486
- return o.status === "aborted" ? m : (o.status === "dirty" && t.dirty(), i(o.value), { status: t.value, value: o.value });
2487
- } else
2488
- return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((o) => o.status === "aborted" ? m : (o.status === "dirty" && t.dirty(), i(o.value).then(() => ({ status: t.value, value: o.value }))));
2489
- }
2490
- if (r.type === "transform")
2491
- if (n.common.async === !1) {
2492
- const i = this._def.schema._parseSync({
2493
- data: n.data,
2494
- path: n.path,
2495
- parent: n
2496
- });
2497
- if (!q(i))
2498
- return m;
2499
- const o = r.transform(i.value, s);
2500
- if (o instanceof Promise)
2501
- throw new Error("Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.");
2502
- return { status: t.value, value: o };
2503
- } else
2504
- return this._def.schema._parseAsync({ data: n.data, path: n.path, parent: n }).then((i) => q(i) ? Promise.resolve(r.transform(i.value, s)).then((o) => ({
2505
- status: t.value,
2506
- value: o
2507
- })) : m);
2508
- b.assertNever(r);
2509
- }
2510
- }
2511
- P.create = (a, e, t) => new P({
2512
- schema: a,
2513
- typeName: y.ZodEffects,
2514
- effect: e,
2515
- ..._(t)
2516
- });
2517
- P.createWithPreprocess = (a, e, t) => new P({
2518
- schema: e,
2519
- effect: { type: "preprocess", transform: a },
2520
- typeName: y.ZodEffects,
2521
- ..._(t)
2522
- });
2523
- class j extends x {
2524
- _parse(e) {
2525
- return this._getType(e) === u.undefined ? A(void 0) : this._def.innerType._parse(e);
2526
- }
2527
- unwrap() {
2528
- return this._def.innerType;
2529
- }
2530
- }
2531
- j.create = (a, e) => new j({
2532
- innerType: a,
2533
- typeName: y.ZodOptional,
2534
- ..._(e)
2535
- });
2536
- class F extends x {
2537
- _parse(e) {
2538
- return this._getType(e) === u.null ? A(null) : this._def.innerType._parse(e);
2539
- }
2540
- unwrap() {
2541
- return this._def.innerType;
2542
- }
2543
- }
2544
- F.create = (a, e) => new F({
2545
- innerType: a,
2546
- typeName: y.ZodNullable,
2547
- ..._(e)
2548
- });
2549
- class re extends x {
2550
- _parse(e) {
2551
- const { ctx: t } = this._processInputParams(e);
2552
- let n = t.data;
2553
- return t.parsedType === u.undefined && (n = this._def.defaultValue()), this._def.innerType._parse({
2554
- data: n,
2555
- path: t.path,
2556
- parent: t
2557
- });
2558
- }
2559
- removeDefault() {
2560
- return this._def.innerType;
2561
- }
2562
- }
2563
- re.create = (a, e) => new re({
2564
- innerType: a,
2565
- typeName: y.ZodDefault,
2566
- defaultValue: typeof e.default == "function" ? e.default : () => e.default,
2567
- ..._(e)
2568
- });
2569
- class se extends x {
2570
- _parse(e) {
2571
- const { ctx: t } = this._processInputParams(e), n = {
2572
- ...t,
2573
- common: {
2574
- ...t.common,
2575
- issues: []
2576
- }
2577
- }, r = this._def.innerType._parse({
2578
- data: n.data,
2579
- path: n.path,
2580
- parent: {
2581
- ...n
2582
- }
2583
- });
2584
- return Q(r) ? r.then((s) => ({
2585
- status: "valid",
2586
- value: s.status === "valid" ? s.value : this._def.catchValue({
2587
- get error() {
2588
- return new $(n.common.issues);
2589
- },
2590
- input: n.data
2591
- })
2592
- })) : {
2593
- status: "valid",
2594
- value: r.status === "valid" ? r.value : this._def.catchValue({
2595
- get error() {
2596
- return new $(n.common.issues);
2597
- },
2598
- input: n.data
2599
- })
2600
- };
2601
- }
2602
- removeCatch() {
2603
- return this._def.innerType;
2604
- }
2605
- }
2606
- se.create = (a, e) => new se({
2607
- innerType: a,
2608
- typeName: y.ZodCatch,
2609
- catchValue: typeof e.catch == "function" ? e.catch : () => e.catch,
2610
- ..._(e)
2611
- });
2612
- class Ze extends x {
2613
- _parse(e) {
2614
- if (this._getType(e) !== u.nan) {
2615
- const n = this._getOrReturnCtx(e);
2616
- return c(n, {
2617
- code: l.invalid_type,
2618
- expected: u.nan,
2619
- received: n.parsedType
2620
- }), m;
2621
- }
2622
- return { status: "valid", value: e.data };
2623
- }
2624
- }
2625
- Ze.create = (a) => new Ze({
2626
- typeName: y.ZodNaN,
2627
- ..._(a)
2628
- });
2629
- class Ee extends x {
2630
- _parse(e) {
2631
- const { ctx: t } = this._processInputParams(e), n = t.data;
2632
- return this._def.type._parse({
2633
- data: n,
2634
- path: t.path,
2635
- parent: t
2636
- });
2637
- }
2638
- unwrap() {
2639
- return this._def.type;
2640
- }
2641
- }
2642
- class ve extends x {
2643
- _parse(e) {
2644
- const { status: t, ctx: n } = this._processInputParams(e);
2645
- if (n.common.async)
2646
- return (async () => {
2647
- const s = await this._def.in._parseAsync({
2648
- data: n.data,
2649
- path: n.path,
2650
- parent: n
2651
- });
2652
- return s.status === "aborted" ? m : s.status === "dirty" ? (t.dirty(), H(s.value)) : this._def.out._parseAsync({
2653
- data: s.value,
2654
- path: n.path,
2655
- parent: n
2656
- });
2657
- })();
2658
- {
2659
- const r = this._def.in._parseSync({
2660
- data: n.data,
2661
- path: n.path,
2662
- parent: n
2663
- });
2664
- return r.status === "aborted" ? m : r.status === "dirty" ? (t.dirty(), {
2665
- status: "dirty",
2666
- value: r.value
2667
- }) : this._def.out._parseSync({
2668
- data: r.value,
2669
- path: n.path,
2670
- parent: n
2671
- });
2672
- }
2673
- }
2674
- static create(e, t) {
2675
- return new ve({
2676
- in: e,
2677
- out: t,
2678
- typeName: y.ZodPipeline
2679
- });
2680
- }
2681
- }
2682
- class ie extends x {
2683
- _parse(e) {
2684
- const t = this._def.innerType._parse(e), n = (r) => (q(r) && (r.value = Object.freeze(r.value)), r);
2685
- return Q(t) ? t.then((r) => n(r)) : n(t);
2686
- }
2687
- unwrap() {
2688
- return this._def.innerType;
2689
- }
2690
- }
2691
- ie.create = (a, e) => new ie({
2692
- innerType: a,
2693
- typeName: y.ZodReadonly,
2694
- ..._(e)
2695
- });
2696
- var y;
2697
- (function(a) {
2698
- a.ZodString = "ZodString", a.ZodNumber = "ZodNumber", a.ZodNaN = "ZodNaN", a.ZodBigInt = "ZodBigInt", a.ZodBoolean = "ZodBoolean", a.ZodDate = "ZodDate", a.ZodSymbol = "ZodSymbol", a.ZodUndefined = "ZodUndefined", a.ZodNull = "ZodNull", a.ZodAny = "ZodAny", a.ZodUnknown = "ZodUnknown", a.ZodNever = "ZodNever", a.ZodVoid = "ZodVoid", a.ZodArray = "ZodArray", a.ZodObject = "ZodObject", a.ZodUnion = "ZodUnion", a.ZodDiscriminatedUnion = "ZodDiscriminatedUnion", a.ZodIntersection = "ZodIntersection", a.ZodTuple = "ZodTuple", a.ZodRecord = "ZodRecord", a.ZodMap = "ZodMap", a.ZodSet = "ZodSet", a.ZodFunction = "ZodFunction", a.ZodLazy = "ZodLazy", a.ZodLiteral = "ZodLiteral", a.ZodEnum = "ZodEnum", a.ZodEffects = "ZodEffects", a.ZodNativeEnum = "ZodNativeEnum", a.ZodOptional = "ZodOptional", a.ZodNullable = "ZodNullable", a.ZodDefault = "ZodDefault", a.ZodCatch = "ZodCatch", a.ZodPromise = "ZodPromise", a.ZodBranded = "ZodBranded", a.ZodPipeline = "ZodPipeline", a.ZodReadonly = "ZodReadonly";
2699
- })(y || (y = {}));
2700
- const g = I.create, d = W.create, v = ue.create, ut = pe.create;
2701
- M.create;
2702
- const C = N.create, S = T.create, xe = K.create, $e = _e.create;
2703
- ee.create;
2704
- const E = D.create, Le = te.create, V = ae.create, k = z.create;
2705
- ne.create;
2706
- j.create;
2707
- F.create;
2708
- const ft = P.createWithPreprocess, oe = k([
2709
- "Point",
2710
- "MultiPoint",
2711
- "LineString",
2712
- "MultiLineString",
2713
- "Polygon",
2714
- "MultiPolygon"
2715
- ]), Me = C(ut()), ke = (a) => xe([g(), Me]).default(a), B = () => xe([g(), Me]).optional(), ht = S({
2716
- latitude: d().min(-90).max(90),
2717
- longitude: d().min(-180).max(180),
2718
- zoom: d().min(0).max(24),
2719
- pitch: d().min(0).max(85).default(0),
2720
- bearing: d().min(-180).max(180).default(0)
2721
- }), pt = S({
2722
- type: k(["query_param", "header"]),
2723
- name: g().min(1),
2724
- value: g().min(1)
2725
- }), mt = S({
2726
- id: g().min(1),
2727
- url: g().url(),
2728
- label: g().optional(),
2729
- tileMatrixSetId: g().optional().default("WebMercatorQuad"),
2730
- type: k(["features", "imagery"]).optional(),
2731
- auth: pt.optional()
2732
- }), yt = S({
2733
- "fill-color": ke("#000000"),
2734
- "fill-opacity": d().min(0).max(1).default(1),
2735
- "fill-outline-color": B(),
2736
- "fill-antialias": v().optional(),
2737
- "fill-translate": E([d(), d()]).optional(),
2738
- "fill-translate-anchor": k(["map", "viewport"]).optional(),
2739
- "fill-pattern": g().optional()
2740
- }), gt = S({
2741
- "line-color": ke("#000000"),
2742
- "line-width": d().min(0).default(1),
2743
- "line-opacity": d().min(0).max(1).default(1),
2744
- "line-dasharray": C(d()).optional(),
2745
- "line-translate": E([d(), d()]).optional(),
2746
- "line-translate-anchor": k(["map", "viewport"]).optional(),
2747
- "line-gap-width": d().min(0).optional(),
2748
- "line-offset": d().optional(),
2749
- "line-blur": d().min(0).optional(),
2750
- "line-pattern": g().optional(),
2751
- "line-gradient": g().optional()
2752
- }), _t = S({
2753
- "circle-color": ke("#000000"),
2754
- "circle-radius": d().min(0).default(5),
2755
- "circle-opacity": d().min(0).max(1).default(1),
2756
- "circle-stroke-color": B(),
2757
- "circle-stroke-width": d().min(0).optional(),
2758
- "circle-blur": d().min(0).optional(),
2759
- "circle-translate": E([d(), d()]).optional(),
2760
- "circle-translate-anchor": k(["map", "viewport"]).optional(),
2761
- "circle-pitch-scale": k(["map", "viewport"]).optional(),
2762
- "circle-pitch-alignment": k(["map", "viewport"]).optional(),
2763
- "circle-stroke-opacity": d().min(0).max(1).optional()
2764
- }), vt = S({
2765
- "icon-opacity": d().min(0).max(1).optional(),
2766
- "icon-color": B(),
2767
- "icon-halo-color": B(),
2768
- "icon-halo-width": d().min(0).optional(),
2769
- "icon-halo-blur": d().min(0).optional(),
2770
- "icon-translate": E([d(), d()]).optional(),
2771
- "icon-translate-anchor": k(["map", "viewport"]).optional(),
2772
- "text-opacity": d().min(0).max(1).optional(),
2773
- "text-color": B(),
2774
- "text-halo-color": B(),
2775
- "text-halo-width": d().min(0).optional(),
2776
- "text-halo-blur": d().min(0).optional(),
2777
- "text-translate": E([d(), d()]).optional(),
2778
- "text-translate-anchor": k(["map", "viewport"]).optional()
2779
- }), xt = S({
2780
- "fill-sort-key": d().optional(),
2781
- visibility: k(["visible", "none"]).optional()
2782
- }), kt = S({
2783
- "line-cap": k(["butt", "round", "square"]).optional(),
2784
- "line-join": k(["bevel", "round", "miter"]).optional(),
2785
- "line-miter-limit": d().optional(),
2786
- "line-round-limit": d().optional(),
2787
- "line-sort-key": d().optional(),
2788
- visibility: k(["visible", "none"]).optional()
2789
- }), bt = S({
2790
- "circle-sort-key": d().optional(),
2791
- visibility: k(["visible", "none"]).optional()
2792
- }), wt = S({
2793
- "symbol-placement": k(["point", "line", "line-center"]).optional(),
2794
- "symbol-spacing": d().min(1).optional(),
2795
- "symbol-avoid-edges": v().optional(),
2796
- "symbol-sort-key": d().optional(),
2797
- "symbol-z-order": k(["auto", "viewport-y", "source"]).optional(),
2798
- "icon-allow-overlap": v().optional(),
2799
- "icon-ignore-placement": v().optional(),
2800
- "icon-optional": v().optional(),
2801
- "icon-rotation-alignment": k(["map", "viewport", "auto"]).optional(),
2802
- "icon-size": d().min(0).optional(),
2803
- "icon-text-fit": k(["none", "width", "height", "both"]).optional(),
2804
- "icon-text-fit-padding": E([d(), d(), d(), d()]).optional(),
2805
- "icon-image": g().optional(),
2806
- "icon-rotate": d().optional(),
2807
- "icon-padding": d().min(0).optional(),
2808
- "icon-keep-upright": v().optional(),
2809
- "icon-offset": E([d(), d()]).optional(),
2810
- "icon-anchor": k(["center", "left", "right", "top", "bottom", "top-left", "top-right", "bottom-left", "bottom-right"]).optional(),
2811
- "icon-pitch-alignment": k(["map", "viewport", "auto"]).optional(),
2812
- "text-pitch-alignment": k(["map", "viewport", "auto"]).optional(),
2813
- "text-rotation-alignment": k(["map", "viewport", "viewport-glyph", "auto"]).optional(),
2814
- "text-field": g().optional(),
2815
- "text-font": C(g()).optional(),
2816
- "text-size": d().min(0).optional(),
2817
- "text-max-width": d().min(0).optional(),
2818
- "text-line-height": d().optional(),
2819
- "text-letter-spacing": d().optional(),
2820
- "text-justify": k(["auto", "left", "center", "right"]).optional(),
2821
- "text-anchor": k(["center", "left", "right", "top", "bottom", "top-left", "top-right", "bottom-left", "bottom-right"]).optional(),
2822
- "text-max-angle": d().optional(),
2823
- "text-rotate": d().optional(),
2824
- "text-padding": d().min(0).optional(),
2825
- "text-keep-upright": v().optional(),
2826
- "text-transform": k(["none", "uppercase", "lowercase"]).optional(),
2827
- "text-offset": E([d(), d()]).optional(),
2828
- "text-allow-overlap": v().optional(),
2829
- "text-ignore-placement": v().optional(),
2830
- "text-optional": v().optional(),
2831
- visibility: k(["visible", "none"]).optional()
2832
- }), St = S({
2833
- type: V("fill"),
2834
- paint: yt,
2835
- layout: xt.optional(),
2836
- geometryFilter: C(oe).optional()
2837
- }), Tt = S({
2838
- type: V("line"),
2839
- paint: gt,
2840
- layout: kt.optional(),
2841
- geometryFilter: C(oe).optional()
2842
- }), Ct = S({
2843
- type: V("circle"),
2844
- paint: _t,
2845
- layout: bt.optional(),
2846
- geometryFilter: C(oe).optional()
2847
- }), Ot = S({
2848
- type: V("symbol"),
2849
- paint: vt,
2850
- layout: wt.optional(),
2851
- geometryFilter: C(oe).optional()
2852
- }), At = $e("type", [
2853
- St,
2854
- Tt,
2855
- Ct,
2856
- Ot
2857
- ]), Nt = S({
2858
- label: g(),
2859
- color: g(),
2860
- shape: k(["circle", "line", "square"]).optional()
2861
- }), Zt = S({
2862
- entries: C(Nt).min(1),
2863
- displayMode: k(["categorical", "gradient", "simple"]).optional(),
2864
- showLabelsCollapsed: v().optional(),
2865
- showColorBar: v().optional(),
2866
- showDisclosureArrow: v().optional(),
2867
- gradientProperty: g().optional()
2868
- }), le = {
2869
- property: g().min(1),
2870
- label: g(),
2871
- placeholder: g().optional()
2872
- }, Rt = S({
2873
- ...le,
2874
- type: V("text"),
2875
- autocomplete: v().default(!1),
2876
- prefetch: v().optional(),
2877
- options: C(g()).optional(),
2878
- zoomTo: v().optional()
2879
- }), It = S({
2880
- ...le,
2881
- type: V("number"),
2882
- inputMode: k(["input", "slider"]).default("input"),
2883
- operator: k(["eq", "gt", "lt", "gte", "lte", "between"]).default("eq"),
2884
- operatorLabelStyle: k(["symbol", "word"]).optional(),
2885
- showRange: v().optional(),
2886
- min: d().optional(),
2887
- max: d().optional(),
2888
- step: d().optional()
2889
- }), jt = S({
2890
- ...le,
2891
- type: V("datetime"),
2892
- range: v().default(!1)
2893
- }), Et = S({
2894
- ...le,
2895
- type: V("select"),
2896
- options: C(g()).optional(),
2897
- prefetch: v().optional(),
2898
- zoomTo: v().optional()
2899
- }), $t = $e("type", [
2900
- Rt,
2901
- It,
2902
- jt,
2903
- Et
2904
- ]), Lt = S({
2905
- fields: C($t).min(1)
2906
- }), Mt = S({
2907
- label: g().optional(),
2908
- visible: v().optional().default(!0)
2909
- }), Pt = Le(g(), Mt), Vt = S({
2910
- properties: Le(xe([g(), d(), v(), C(g())])).optional(),
2911
- bbox: E([d(), d(), d(), d()]).optional(),
2912
- datetime: g().optional()
2913
- }), Dt = {
2914
- id: g().min(1),
2915
- sourceId: g().min(1),
2916
- collection: g().min(1),
2917
- label: g(),
2918
- visible: v().default(!0),
2919
- dataMode: k(["vector-tiles", "geojson"]),
2920
- minZoom: d().min(0).max(24).optional(),
2921
- maxZoom: d().min(0).max(24).optional(),
2922
- styles: C(At).optional(),
2923
- legend: Zt.optional(),
2924
- filters: Vt.optional(),
2925
- search: Lt.optional(),
2926
- propertyDisplay: Pt.optional(),
2927
- showTooltip: v().optional(),
2928
- showDetailPanel: v().optional()
2929
- }, zt = ft(
2930
- (a) => {
2931
- if (a && typeof a == "object" && "style" in a && !("styles" in a)) {
2932
- const { style: e, ...t } = a;
2933
- return { ...t, styles: e ? [e] : void 0 };
2934
- }
2935
- return a;
2936
- },
2937
- S(Dt)
2938
- ), Ft = S({
2939
- id: g().min(1),
2940
- label: g(),
2941
- url: g().url(),
2942
- thumbnail: g().url().optional()
2943
- }), Ut = S({
2944
- id: g().min(1),
2945
- url: g().url()
2946
- }), Bt = S({
2947
- showLayerPanel: v().default(!0),
2948
- showLegend: v().default(!0),
2949
- showBasemapSwitcher: v().default(!0),
2950
- showSearchPanel: v().default(!1),
2951
- showCoordinateDisplay: v().default(!0),
2952
- showFeatureDetail: v().default(!0),
2953
- showFeatureTooltip: v().default(!0),
2954
- showExportButton: v().default(!0),
2955
- showLegendOpacity: v().default(!1),
2956
- showMeasureTool: v().default(!1),
2957
- showSelectionTool: v().default(!1),
2958
- showImageryPanel: v().default(!1)
2959
- }), Jt = "#1e293b", qt = S({
2960
- headerTitle: g().optional(),
2961
- headerColor: g().optional(),
2962
- browserTitle: g().optional(),
2963
- faviconDataUrl: g().optional(),
2964
- logoDataUrl: g().optional(),
2965
- logoHeight: d().int().min(16).max(200).optional()
2966
- }), Wt = S({
2967
- id: g().min(1),
2968
- sourceId: g().default(""),
2969
- collection: g().default(""),
2970
- label: g(),
2971
- visible: v().default(!1),
2972
- opacity: d().min(0).max(1).default(1),
2973
- exclusive: v().default(!1),
2974
- minZoom: d().min(0).max(24).optional(),
2975
- maxZoom: d().min(0).max(24).optional(),
2976
- tileSize: d().default(256),
2977
- tileUrlTemplate: g().optional()
2978
- }).superRefine((a, e) => {
2979
- a.tileUrlTemplate || (a.sourceId || e.addIssue({ code: l.too_small, minimum: 1, type: "string", inclusive: !0, path: ["sourceId"], message: "Source is required when not using a custom tile URL" }), a.collection || e.addIssue({ code: l.too_small, minimum: 1, type: "string", inclusive: !0, path: ["collection"], message: "Collection is required when not using a custom tile URL" }));
2980
- }), Pe = S({
2981
- sources: C(mt).min(1),
2982
- layers: C(zt),
2983
- imageryLayers: C(Wt).optional(),
2984
- basemaps: C(Ft).min(1),
2985
- sprites: C(Ut).optional(),
2986
- ui: Bt.default({}),
2987
- initialView: ht,
2988
- branding: qt.optional()
2989
- });
2990
- function Ht(a) {
2991
- return Pe.parse(a);
2992
- }
2993
- function Gt(a) {
2994
- return Pe.safeParse(a);
2995
- }
2996
- export {
2997
- Ft as B,
2998
- bt as C,
2999
- Jt as D,
3000
- xt as F,
3001
- oe as G,
3002
- Wt as I,
3003
- zt as L,
3004
- Pe as M,
3005
- It as N,
3006
- mt as O,
3007
- Pt as P,
3008
- Lt as S,
3009
- Rt as T,
3010
- Bt as U,
3011
- ht as V,
3012
- qt as a,
3013
- _t as b,
3014
- Ct as c,
3015
- jt as d,
3016
- yt as e,
3017
- St as f,
3018
- Vt as g,
3019
- Zt as h,
3020
- Nt as i,
3021
- kt as j,
3022
- gt as k,
3023
- Tt as l,
3024
- Mt as m,
3025
- $t as n,
3026
- Et as o,
3027
- pt as p,
3028
- Ut as q,
3029
- At as r,
3030
- Gt as s,
3031
- wt as t,
3032
- vt as u,
3033
- Ot as v,
3034
- Ht as w
3035
- };