UNPKG

258 kBJavaScriptView Raw
1"use strict";
2var __create = Object.create;
3var __defProp = Object.defineProperty;
4var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5var __getOwnPropNames = Object.getOwnPropertyNames;
6var __getProtoOf = Object.getPrototypeOf;
7var __hasOwnProp = Object.prototype.hasOwnProperty;
8var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
9var __commonJS = (cb, mod2) => function __require() {
10 return mod2 || (0, cb[__getOwnPropNames(cb)[0]])((mod2 = { exports: {} }).exports, mod2), mod2.exports;
11};
12var __export = (target, all) => {
13 for (var name in all)
14 __defProp(target, name, { get: all[name], enumerable: true });
15};
16var __copyProps = (to, from, except, desc) => {
17 if (from && typeof from === "object" || typeof from === "function") {
18 for (let key of __getOwnPropNames(from))
19 if (!__hasOwnProp.call(to, key) && key !== except)
20 __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
21 }
22 return to;
23};
24var __toESM = (mod2, isNodeMode, target) => (target = mod2 != null ? __create(__getProtoOf(mod2)) : {}, __copyProps(
25 isNodeMode || !mod2 || !mod2.__esModule ? __defProp(target, "default", { value: mod2, enumerable: true }) : target,
26 mod2
27));
28var __toCommonJS = (mod2) => __copyProps(__defProp({}, "__esModule", { value: true }), mod2);
29var __publicField = (obj, key, value) => {
30 __defNormalProp(obj, typeof key !== "symbol" ? key + "" : key, value);
31 return value;
32};
33
34// ../../node_modules/.pnpm/@stablelib+base64@1.0.1/node_modules/@stablelib/base64/lib/base64.js
35var require_base64 = __commonJS({
36 "../../node_modules/.pnpm/@stablelib+base64@1.0.1/node_modules/@stablelib/base64/lib/base64.js"(exports) {
37 "use strict";
38 var __extends = exports && exports.__extends || function() {
39 var extendStatics = function(d, b) {
40 extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(d2, b2) {
41 d2.__proto__ = b2;
42 } || function(d2, b2) {
43 for (var p in b2)
44 if (b2.hasOwnProperty(p))
45 d2[p] = b2[p];
46 };
47 return extendStatics(d, b);
48 };
49 return function(d, b) {
50 extendStatics(d, b);
51 function __() {
52 this.constructor = d;
53 }
54 d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
55 };
56 }();
57 Object.defineProperty(exports, "__esModule", { value: true });
58 var INVALID_BYTE = 256;
59 var Coder = function() {
60 function Coder2(_paddingCharacter) {
61 if (_paddingCharacter === void 0) {
62 _paddingCharacter = "=";
63 }
64 this._paddingCharacter = _paddingCharacter;
65 }
66 Coder2.prototype.encodedLength = function(length) {
67 if (!this._paddingCharacter) {
68 return (length * 8 + 5) / 6 | 0;
69 }
70 return (length + 2) / 3 * 4 | 0;
71 };
72 Coder2.prototype.encode = function(data) {
73 var out = "";
74 var i = 0;
75 for (; i < data.length - 2; i += 3) {
76 var c = data[i] << 16 | data[i + 1] << 8 | data[i + 2];
77 out += this._encodeByte(c >>> 3 * 6 & 63);
78 out += this._encodeByte(c >>> 2 * 6 & 63);
79 out += this._encodeByte(c >>> 1 * 6 & 63);
80 out += this._encodeByte(c >>> 0 * 6 & 63);
81 }
82 var left = data.length - i;
83 if (left > 0) {
84 var c = data[i] << 16 | (left === 2 ? data[i + 1] << 8 : 0);
85 out += this._encodeByte(c >>> 3 * 6 & 63);
86 out += this._encodeByte(c >>> 2 * 6 & 63);
87 if (left === 2) {
88 out += this._encodeByte(c >>> 1 * 6 & 63);
89 } else {
90 out += this._paddingCharacter || "";
91 }
92 out += this._paddingCharacter || "";
93 }
94 return out;
95 };
96 Coder2.prototype.maxDecodedLength = function(length) {
97 if (!this._paddingCharacter) {
98 return (length * 6 + 7) / 8 | 0;
99 }
100 return length / 4 * 3 | 0;
101 };
102 Coder2.prototype.decodedLength = function(s2) {
103 return this.maxDecodedLength(s2.length - this._getPaddingLength(s2));
104 };
105 Coder2.prototype.decode = function(s2) {
106 if (s2.length === 0) {
107 return new Uint8Array(0);
108 }
109 var paddingLength = this._getPaddingLength(s2);
110 var length = s2.length - paddingLength;
111 var out = new Uint8Array(this.maxDecodedLength(length));
112 var op = 0;
113 var i = 0;
114 var haveBad = 0;
115 var v0 = 0, v1 = 0, v2 = 0, v3 = 0;
116 for (; i < length - 4; i += 4) {
117 v0 = this._decodeChar(s2.charCodeAt(i + 0));
118 v1 = this._decodeChar(s2.charCodeAt(i + 1));
119 v2 = this._decodeChar(s2.charCodeAt(i + 2));
120 v3 = this._decodeChar(s2.charCodeAt(i + 3));
121 out[op++] = v0 << 2 | v1 >>> 4;
122 out[op++] = v1 << 4 | v2 >>> 2;
123 out[op++] = v2 << 6 | v3;
124 haveBad |= v0 & INVALID_BYTE;
125 haveBad |= v1 & INVALID_BYTE;
126 haveBad |= v2 & INVALID_BYTE;
127 haveBad |= v3 & INVALID_BYTE;
128 }
129 if (i < length - 1) {
130 v0 = this._decodeChar(s2.charCodeAt(i));
131 v1 = this._decodeChar(s2.charCodeAt(i + 1));
132 out[op++] = v0 << 2 | v1 >>> 4;
133 haveBad |= v0 & INVALID_BYTE;
134 haveBad |= v1 & INVALID_BYTE;
135 }
136 if (i < length - 2) {
137 v2 = this._decodeChar(s2.charCodeAt(i + 2));
138 out[op++] = v1 << 4 | v2 >>> 2;
139 haveBad |= v2 & INVALID_BYTE;
140 }
141 if (i < length - 3) {
142 v3 = this._decodeChar(s2.charCodeAt(i + 3));
143 out[op++] = v2 << 6 | v3;
144 haveBad |= v3 & INVALID_BYTE;
145 }
146 if (haveBad !== 0) {
147 throw new Error("Base64Coder: incorrect characters for decoding");
148 }
149 return out;
150 };
151 Coder2.prototype._encodeByte = function(b) {
152 var result = b;
153 result += 65;
154 result += 25 - b >>> 8 & 0 - 65 - 26 + 97;
155 result += 51 - b >>> 8 & 26 - 97 - 52 + 48;
156 result += 61 - b >>> 8 & 52 - 48 - 62 + 43;
157 result += 62 - b >>> 8 & 62 - 43 - 63 + 47;
158 return String.fromCharCode(result);
159 };
160 Coder2.prototype._decodeChar = function(c) {
161 var result = INVALID_BYTE;
162 result += (42 - c & c - 44) >>> 8 & -INVALID_BYTE + c - 43 + 62;
163 result += (46 - c & c - 48) >>> 8 & -INVALID_BYTE + c - 47 + 63;
164 result += (47 - c & c - 58) >>> 8 & -INVALID_BYTE + c - 48 + 52;
165 result += (64 - c & c - 91) >>> 8 & -INVALID_BYTE + c - 65 + 0;
166 result += (96 - c & c - 123) >>> 8 & -INVALID_BYTE + c - 97 + 26;
167 return result;
168 };
169 Coder2.prototype._getPaddingLength = function(s2) {
170 var paddingLength = 0;
171 if (this._paddingCharacter) {
172 for (var i = s2.length - 1; i >= 0; i--) {
173 if (s2[i] !== this._paddingCharacter) {
174 break;
175 }
176 paddingLength++;
177 }
178 if (s2.length < 4 || paddingLength > 2) {
179 throw new Error("Base64Coder: incorrect padding");
180 }
181 }
182 return paddingLength;
183 };
184 return Coder2;
185 }();
186 exports.Coder = Coder;
187 var stdCoder = new Coder();
188 function encode(data) {
189 return stdCoder.encode(data);
190 }
191 exports.encode = encode;
192 function decode(s2) {
193 return stdCoder.decode(s2);
194 }
195 exports.decode = decode;
196 var URLSafeCoder = function(_super) {
197 __extends(URLSafeCoder2, _super);
198 function URLSafeCoder2() {
199 return _super !== null && _super.apply(this, arguments) || this;
200 }
201 URLSafeCoder2.prototype._encodeByte = function(b) {
202 var result = b;
203 result += 65;
204 result += 25 - b >>> 8 & 0 - 65 - 26 + 97;
205 result += 51 - b >>> 8 & 26 - 97 - 52 + 48;
206 result += 61 - b >>> 8 & 52 - 48 - 62 + 45;
207 result += 62 - b >>> 8 & 62 - 45 - 63 + 95;
208 return String.fromCharCode(result);
209 };
210 URLSafeCoder2.prototype._decodeChar = function(c) {
211 var result = INVALID_BYTE;
212 result += (44 - c & c - 46) >>> 8 & -INVALID_BYTE + c - 45 + 62;
213 result += (94 - c & c - 96) >>> 8 & -INVALID_BYTE + c - 95 + 63;
214 result += (47 - c & c - 58) >>> 8 & -INVALID_BYTE + c - 48 + 52;
215 result += (64 - c & c - 91) >>> 8 & -INVALID_BYTE + c - 65 + 0;
216 result += (96 - c & c - 123) >>> 8 & -INVALID_BYTE + c - 97 + 26;
217 return result;
218 };
219 return URLSafeCoder2;
220 }(Coder);
221 exports.URLSafeCoder = URLSafeCoder;
222 var urlSafeCoder = new URLSafeCoder();
223 function encodeURLSafe(data) {
224 return urlSafeCoder.encode(data);
225 }
226 exports.encodeURLSafe = encodeURLSafe;
227 function decodeURLSafe(s2) {
228 return urlSafeCoder.decode(s2);
229 }
230 exports.decodeURLSafe = decodeURLSafe;
231 exports.encodedLength = function(length) {
232 return stdCoder.encodedLength(length);
233 };
234 exports.maxDecodedLength = function(length) {
235 return stdCoder.maxDecodedLength(length);
236 };
237 exports.decodedLength = function(s2) {
238 return stdCoder.decodedLength(s2);
239 };
240 }
241});
242
243// ../../node_modules/.pnpm/iso-3166-ts@2.2.0/node_modules/iso-3166-ts/dist/index.js
244var require_dist = __commonJS({
245 "../../node_modules/.pnpm/iso-3166-ts@2.2.0/node_modules/iso-3166-ts/dist/index.js"(exports) {
246 "use strict";
247 Object.defineProperty(exports, "__esModule", { value: true });
248 exports.getIso3166CountryName = exports.isIso3166Alpha2Code = exports.ISO_3166_ALPHA_2 = exports.ISO_3166_ALPHA_2_MAPPINGS = void 0;
249 exports.ISO_3166_ALPHA_2_MAPPINGS = {
250 "AD": "Andorra",
251 "AE": "United Arab Emirates",
252 "AF": "Afghanistan",
253 "AG": "Antigua and Barbuda",
254 "AI": "Anguilla",
255 "AL": "Albania",
256 "AM": "Armenia",
257 "AO": "Angola",
258 "AQ": "Antarctica",
259 "AR": "Argentina",
260 "AS": "American Samoa",
261 "AT": "Austria",
262 "AU": "Australia",
263 "AW": "Aruba",
264 "AX": "\xC5land Islands",
265 "AZ": "Azerbaijan",
266 "BA": "Bosnia and Herzegovina",
267 "BB": "Barbados",
268 "BD": "Bangladesh",
269 "BE": "Belgium",
270 "BF": "Burkina Faso",
271 "BG": "Bulgaria",
272 "BH": "Bahrain",
273 "BI": "Burundi",
274 "BJ": "Benin",
275 "BL": "Saint Barth\xC3\xA9lemy",
276 "BM": "Bermuda",
277 "BN": "Brunei Darussalam",
278 "BO": "Bolivia (Plurinational State of)",
279 "BQ": "Bonaire, Sint Eustatius and Saba",
280 "BR": "Brazil",
281 "BS": "Bahamas",
282 "BT": "Bhutan",
283 "BV": "Bouvet Island",
284 "BW": "Botswana",
285 "BY": "Belarus",
286 "BZ": "Belize",
287 "CA": "Canada",
288 "CC": "Cocos (Keeling) Islands",
289 "CD": "Congo, Democratic Republic of the",
290 "CF": "Central African Republic",
291 "CG": "Congo",
292 "CH": "Switzerland",
293 "CI": "C\xF3te d'Ivoire",
294 "CK": "Cook Islands",
295 "CL": "Chile",
296 "CM": "Cameroon",
297 "CN": "China",
298 "CO": "Colombia",
299 "CR": "Costa Rica",
300 "CU": "Cuba",
301 "CV": "Cabo Verde",
302 "CW": "Cura\xC3\xA7ao",
303 "CX": "Christmas Island",
304 "CY": "Cyprus",
305 "CZ": "Czechia",
306 "DE": "Germany",
307 "DJ": "Djibouti",
308 "DK": "Denmark",
309 "DM": "Dominica",
310 "DO": "Dominican Republic",
311 "DZ": "Algeria",
312 "EC": "Ecuador",
313 "EE": "Estonia",
314 "EG": "Egypt",
315 "EH": "Western Sahara",
316 "ER": "Eritrea",
317 "ES": "Spain",
318 "ET": "Ethiopia",
319 "FI": "Finland",
320 "FJ": "Fiji",
321 "FK": "Falkland Islands (Malvinas)",
322 "FM": "Micronesia (Federated States of)",
323 "FO": "Faroe Islands",
324 "FR": "France",
325 "GA": "Gabon",
326 "GB": "United Kingdom of Great Britain and Northern Ireland",
327 "GD": "Grenada",
328 "GE": "Georgia",
329 "GF": "French Guiana",
330 "GG": "Guernsey",
331 "GH": "Ghana",
332 "GI": "Gibraltar",
333 "GL": "Greenland",
334 "GM": "Gambia",
335 "GN": "Guinea",
336 "GP": "Guadeloupe",
337 "GQ": "Equatorial Guinea",
338 "GR": "Greece",
339 "GS": "South Georgia and the South Sandwich Islands",
340 "GT": "Guatemala",
341 "GU": "Guam",
342 "GW": "Guinea-Bissau",
343 "GY": "Guyana",
344 "HK": "Hong Kong",
345 "HM": "Heard Island and McDonald Islands",
346 "HN": "Honduras",
347 "HR": "Croatia",
348 "HT": "Haiti",
349 "HU": "Hungary",
350 "ID": "Indonesia",
351 "IE": "Ireland",
352 "IL": "Israel",
353 "IM": "Isle of Man",
354 "IN": "India",
355 "IO": "British Indian Ocean Territory",
356 "IQ": "Iraq",
357 "IR": "Iran (Islamic Republic of)",
358 "IS": "Iceland",
359 "IT": "Italy",
360 "JE": "Jersey",
361 "JM": "Jamaica",
362 "JO": "Jordan",
363 "JP": "Japan",
364 "KE": "Kenya",
365 "KG": "Kyrgyzstan",
366 "KH": "Cambodia",
367 "KI": "Kiribati",
368 "KM": "Comoros",
369 "KN": "Saint Kitts and Nevis",
370 "KP": "Korea (Democratic People's Republic of) ",
371 "KR": "Korea, Republic of",
372 "KW": "Kuwait",
373 "KY": "Cayman Islands",
374 "KZ": "Kazakhstan",
375 "LA": "Lao People's Democratic Republic",
376 "LB": "Lebanon",
377 "LC": "Saint Lucia",
378 "LI": "Liechtenstein",
379 "LK": "Sri Lanka",
380 "LR": "Liberia",
381 "LS": "Lesotho",
382 "LT": "Lithuania",
383 "LU": "Luxembourg",
384 "LV": "Latvia",
385 "LY": "Libya",
386 "MA": "Morocco",
387 "MC": "Monaco",
388 "MD": "Moldova, Republic of",
389 "ME": "Montenegro",
390 "MF": "Saint Martin (French part)",
391 "MG": "Madagascar",
392 "MH": "Marshall Islands",
393 "MK": "North Macedonia",
394 "ML": "Mali",
395 "MM": "Myanmar",
396 "MN": "Mongolia",
397 "MO": "Macao",
398 "MP": "Northern Mariana Islands",
399 "MQ": "Martinique",
400 "MR": "Mauritania",
401 "MS": "Montserrat",
402 "MT": "Malta",
403 "MU": "Mauritius",
404 "MV": "Maldives",
405 "MW": "Malawi",
406 "MX": "Mexico",
407 "MY": "Malaysia",
408 "MZ": "Mozambique",
409 "NA": "Namibia",
410 "NC": "New Caledonia",
411 "NE": "Niger",
412 "NF": "Norfolk Island",
413 "NG": "Nigeria",
414 "NI": "Nicaragua",
415 "NL": "Netherlands",
416 "NO": "Norway",
417 "NP": "Nepal",
418 "NR": "Nauru",
419 "NU": "Niue",
420 "NZ": "New Zealand",
421 "OM": "Oman",
422 "PA": "Panama",
423 "PE": "Peru",
424 "PF": "French Polynesia",
425 "PG": "Papua New Guinea",
426 "PH": "Philippines",
427 "PK": "Pakistan",
428 "PL": "Poland",
429 "PM": "Saint Pierre and Miquelon",
430 "PN": "Pitcairn",
431 "PR": "Puerto Rico",
432 "PS": "Palestine, State of",
433 "PT": "Portugal",
434 "PW": "Palau",
435 "PY": "Paraguay",
436 "QA": "Qatar",
437 "RE": "R\xE9union",
438 "RO": "Romania",
439 "RS": "Serbia",
440 "RU": "Russian Federation",
441 "RW": "Rwanda",
442 "SA": "Saudi Arabia",
443 "SB": "Solomon Islands",
444 "SC": "Seychelles",
445 "SD": "Sudan",
446 "SE": "Sweden",
447 "SG": "Singapore",
448 "SH": "Saint Helena, Ascension and Tristan da Cunha",
449 "SI": "Slovenia",
450 "SJ": "Svalbard and Jan Mayen",
451 "SK": "Slovakia",
452 "SL": "Sierra Leone",
453 "SM": "San Marino",
454 "SN": "Senegal",
455 "SO": "Somalia",
456 "SR": "Suriname",
457 "SS": "South Sudan",
458 "ST": "Sao Tome and Principe",
459 "SV": "El Salvador",
460 "SX": "Sint Maarten (Dutch part)",
461 "SY": "Syrian Arab Republic",
462 "SZ": "Eswatini",
463 "TC": "Turks and Caicos Islands",
464 "TD": "Chad",
465 "TF": "French Southern Territories",
466 "TG": "Togo",
467 "TH": "Thailand",
468 "TJ": "Tajikistan",
469 "TK": "Tokelau",
470 "TL": "Timor-Leste",
471 "TM": "Turkmenistan",
472 "TN": "Tunisia",
473 "TO": "Tonga",
474 "TR": "Turkey",
475 "TT": "Trinidad and Tobago",
476 "TV": "Tuvalu",
477 "TW": "Taiwan, Province of China",
478 "TZ": "Tanzania, United Republic of",
479 "UA": "Ukraine",
480 "UG": "Uganda",
481 "UM": "United States Minor Outlying Islands",
482 "US": "United States of America",
483 "UY": "Uruguay",
484 "UZ": "Uzbekistan",
485 "VA": "Holy See",
486 "VC": "Saint Vincent and the Grenadines",
487 "VE": "Venezuela (Bolivarian Republic of)",
488 "VG": "Virgin Islands (British)",
489 "VI": "Virgin Islands (U.S.)",
490 "VN": "Viet Nam",
491 "VU": "Vanuatu",
492 "WF": "Wallis and Futuna",
493 "WS": "Samoa",
494 "XK": "Kosovo",
495 "YE": "Yemen",
496 "YT": "Mayotte",
497 "ZA": "South Africa",
498 "ZM": "Zambia",
499 "ZW": "Zimbabwe"
500 };
501 exports.ISO_3166_ALPHA_2 = Object.keys(exports.ISO_3166_ALPHA_2_MAPPINGS);
502 function isIso3166Alpha2Code2(iso3166Alpha2CountryCode) {
503 return exports.ISO_3166_ALPHA_2.indexOf(iso3166Alpha2CountryCode) != -1;
504 }
505 exports.isIso3166Alpha2Code = isIso3166Alpha2Code2;
506 function getIso3166CountryName(iso3166Alpha2CountryCode) {
507 if (isIso3166Alpha2Code2(iso3166Alpha2CountryCode)) {
508 return exports.ISO_3166_ALPHA_2_MAPPINGS[iso3166Alpha2CountryCode];
509 }
510 return void 0;
511 }
512 exports.getIso3166CountryName = getIso3166CountryName;
513 }
514});
515
516// src/index.ts
517var src_exports = {};
518__export(src_exports, {
519 TruestampClient: () => TruestampClient
520});
521module.exports = __toCommonJS(src_exports);
522
523// ../../node_modules/.pnpm/zod@3.20.2/node_modules/zod/lib/index.mjs
524var util;
525(function(util2) {
526 util2.assertEqual = (val) => val;
527 function assertIs(_arg) {
528 }
529 util2.assertIs = assertIs;
530 function assertNever(_x) {
531 throw new Error();
532 }
533 util2.assertNever = assertNever;
534 util2.arrayToEnum = (items) => {
535 const obj = {};
536 for (const item of items) {
537 obj[item] = item;
538 }
539 return obj;
540 };
541 util2.getValidEnumValues = (obj) => {
542 const validKeys = util2.objectKeys(obj).filter((k) => typeof obj[obj[k]] !== "number");
543 const filtered = {};
544 for (const k of validKeys) {
545 filtered[k] = obj[k];
546 }
547 return util2.objectValues(filtered);
548 };
549 util2.objectValues = (obj) => {
550 return util2.objectKeys(obj).map(function(e) {
551 return obj[e];
552 });
553 };
554 util2.objectKeys = typeof Object.keys === "function" ? (obj) => Object.keys(obj) : (object) => {
555 const keys = [];
556 for (const key in object) {
557 if (Object.prototype.hasOwnProperty.call(object, key)) {
558 keys.push(key);
559 }
560 }
561 return keys;
562 };
563 util2.find = (arr, checker) => {
564 for (const item of arr) {
565 if (checker(item))
566 return item;
567 }
568 return void 0;
569 };
570 util2.isInteger = typeof Number.isInteger === "function" ? (val) => Number.isInteger(val) : (val) => typeof val === "number" && isFinite(val) && Math.floor(val) === val;
571 function joinValues(array, separator = " | ") {
572 return array.map((val) => typeof val === "string" ? `'${val}'` : val).join(separator);
573 }
574 util2.joinValues = joinValues;
575 util2.jsonStringifyReplacer = (_, value) => {
576 if (typeof value === "bigint") {
577 return value.toString();
578 }
579 return value;
580 };
581})(util || (util = {}));
582var ZodParsedType = util.arrayToEnum([
583 "string",
584 "nan",
585 "number",
586 "integer",
587 "float",
588 "boolean",
589 "date",
590 "bigint",
591 "symbol",
592 "function",
593 "undefined",
594 "null",
595 "array",
596 "object",
597 "unknown",
598 "promise",
599 "void",
600 "never",
601 "map",
602 "set"
603]);
604var getParsedType = (data) => {
605 const t = typeof data;
606 switch (t) {
607 case "undefined":
608 return ZodParsedType.undefined;
609 case "string":
610 return ZodParsedType.string;
611 case "number":
612 return isNaN(data) ? ZodParsedType.nan : ZodParsedType.number;
613 case "boolean":
614 return ZodParsedType.boolean;
615 case "function":
616 return ZodParsedType.function;
617 case "bigint":
618 return ZodParsedType.bigint;
619 case "symbol":
620 return ZodParsedType.symbol;
621 case "object":
622 if (Array.isArray(data)) {
623 return ZodParsedType.array;
624 }
625 if (data === null) {
626 return ZodParsedType.null;
627 }
628 if (data.then && typeof data.then === "function" && data.catch && typeof data.catch === "function") {
629 return ZodParsedType.promise;
630 }
631 if (typeof Map !== "undefined" && data instanceof Map) {
632 return ZodParsedType.map;
633 }
634 if (typeof Set !== "undefined" && data instanceof Set) {
635 return ZodParsedType.set;
636 }
637 if (typeof Date !== "undefined" && data instanceof Date) {
638 return ZodParsedType.date;
639 }
640 return ZodParsedType.object;
641 default:
642 return ZodParsedType.unknown;
643 }
644};
645var ZodIssueCode = util.arrayToEnum([
646 "invalid_type",
647 "invalid_literal",
648 "custom",
649 "invalid_union",
650 "invalid_union_discriminator",
651 "invalid_enum_value",
652 "unrecognized_keys",
653 "invalid_arguments",
654 "invalid_return_type",
655 "invalid_date",
656 "invalid_string",
657 "too_small",
658 "too_big",
659 "invalid_intersection_types",
660 "not_multiple_of",
661 "not_finite"
662]);
663var quotelessJson = (obj) => {
664 const json = JSON.stringify(obj, null, 2);
665 return json.replace(/"([^"]+)":/g, "$1:");
666};
667var ZodError = class extends Error {
668 constructor(issues) {
669 super();
670 this.issues = [];
671 this.addIssue = (sub) => {
672 this.issues = [...this.issues, sub];
673 };
674 this.addIssues = (subs = []) => {
675 this.issues = [...this.issues, ...subs];
676 };
677 const actualProto = new.target.prototype;
678 if (Object.setPrototypeOf) {
679 Object.setPrototypeOf(this, actualProto);
680 } else {
681 this.__proto__ = actualProto;
682 }
683 this.name = "ZodError";
684 this.issues = issues;
685 }
686 get errors() {
687 return this.issues;
688 }
689 format(_mapper) {
690 const mapper = _mapper || function(issue) {
691 return issue.message;
692 };
693 const fieldErrors = { _errors: [] };
694 const processError = (error) => {
695 for (const issue of error.issues) {
696 if (issue.code === "invalid_union") {
697 issue.unionErrors.map(processError);
698 } else if (issue.code === "invalid_return_type") {
699 processError(issue.returnTypeError);
700 } else if (issue.code === "invalid_arguments") {
701 processError(issue.argumentsError);
702 } else if (issue.path.length === 0) {
703 fieldErrors._errors.push(mapper(issue));
704 } else {
705 let curr = fieldErrors;
706 let i = 0;
707 while (i < issue.path.length) {
708 const el = issue.path[i];
709 const terminal = i === issue.path.length - 1;
710 if (!terminal) {
711 curr[el] = curr[el] || { _errors: [] };
712 } else {
713 curr[el] = curr[el] || { _errors: [] };
714 curr[el]._errors.push(mapper(issue));
715 }
716 curr = curr[el];
717 i++;
718 }
719 }
720 }
721 };
722 processError(this);
723 return fieldErrors;
724 }
725 toString() {
726 return this.message;
727 }
728 get message() {
729 return JSON.stringify(this.issues, util.jsonStringifyReplacer, 2);
730 }
731 get isEmpty() {
732 return this.issues.length === 0;
733 }
734 flatten(mapper = (issue) => issue.message) {
735 const fieldErrors = {};
736 const formErrors = [];
737 for (const sub of this.issues) {
738 if (sub.path.length > 0) {
739 fieldErrors[sub.path[0]] = fieldErrors[sub.path[0]] || [];
740 fieldErrors[sub.path[0]].push(mapper(sub));
741 } else {
742 formErrors.push(mapper(sub));
743 }
744 }
745 return { formErrors, fieldErrors };
746 }
747 get formErrors() {
748 return this.flatten();
749 }
750};
751ZodError.create = (issues) => {
752 const error = new ZodError(issues);
753 return error;
754};
755var errorMap = (issue, _ctx) => {
756 let message;
757 switch (issue.code) {
758 case ZodIssueCode.invalid_type:
759 if (issue.received === ZodParsedType.undefined) {
760 message = "Required";
761 } else {
762 message = `Expected ${issue.expected}, received ${issue.received}`;
763 }
764 break;
765 case ZodIssueCode.invalid_literal:
766 message = `Invalid literal value, expected ${JSON.stringify(issue.expected, util.jsonStringifyReplacer)}`;
767 break;
768 case ZodIssueCode.unrecognized_keys:
769 message = `Unrecognized key(s) in object: ${util.joinValues(issue.keys, ", ")}`;
770 break;
771 case ZodIssueCode.invalid_union:
772 message = `Invalid input`;
773 break;
774 case ZodIssueCode.invalid_union_discriminator:
775 message = `Invalid discriminator value. Expected ${util.joinValues(issue.options)}`;
776 break;
777 case ZodIssueCode.invalid_enum_value:
778 message = `Invalid enum value. Expected ${util.joinValues(issue.options)}, received '${issue.received}'`;
779 break;
780 case ZodIssueCode.invalid_arguments:
781 message = `Invalid function arguments`;
782 break;
783 case ZodIssueCode.invalid_return_type:
784 message = `Invalid function return type`;
785 break;
786 case ZodIssueCode.invalid_date:
787 message = `Invalid date`;
788 break;
789 case ZodIssueCode.invalid_string:
790 if (typeof issue.validation === "object") {
791 if ("startsWith" in issue.validation) {
792 message = `Invalid input: must start with "${issue.validation.startsWith}"`;
793 } else if ("endsWith" in issue.validation) {
794 message = `Invalid input: must end with "${issue.validation.endsWith}"`;
795 } else {
796 util.assertNever(issue.validation);
797 }
798 } else if (issue.validation !== "regex") {
799 message = `Invalid ${issue.validation}`;
800 } else {
801 message = "Invalid";
802 }
803 break;
804 case ZodIssueCode.too_small:
805 if (issue.type === "array")
806 message = `Array must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `more than`} ${issue.minimum} element(s)`;
807 else if (issue.type === "string")
808 message = `String must contain ${issue.exact ? "exactly" : issue.inclusive ? `at least` : `over`} ${issue.minimum} character(s)`;
809 else if (issue.type === "number")
810 message = `Number must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${issue.minimum}`;
811 else if (issue.type === "date")
812 message = `Date must be ${issue.exact ? `exactly equal to ` : issue.inclusive ? `greater than or equal to ` : `greater than `}${new Date(issue.minimum)}`;
813 else
814 message = "Invalid input";
815 break;
816 case ZodIssueCode.too_big:
817 if (issue.type === "array")
818 message = `Array must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `less than`} ${issue.maximum} element(s)`;
819 else if (issue.type === "string")
820 message = `String must contain ${issue.exact ? `exactly` : issue.inclusive ? `at most` : `under`} ${issue.maximum} character(s)`;
821 else if (issue.type === "number")
822 message = `Number must be ${issue.exact ? `exactly` : issue.inclusive ? `less than or equal to` : `less than`} ${issue.maximum}`;
823 else if (issue.type === "date")
824 message = `Date must be ${issue.exact ? `exactly` : issue.inclusive ? `smaller than or equal to` : `smaller than`} ${new Date(issue.maximum)}`;
825 else
826 message = "Invalid input";
827 break;
828 case ZodIssueCode.custom:
829 message = `Invalid input`;
830 break;
831 case ZodIssueCode.invalid_intersection_types:
832 message = `Intersection results could not be merged`;
833 break;
834 case ZodIssueCode.not_multiple_of:
835 message = `Number must be a multiple of ${issue.multipleOf}`;
836 break;
837 case ZodIssueCode.not_finite:
838 message = "Number must be finite";
839 break;
840 default:
841 message = _ctx.defaultError;
842 util.assertNever(issue);
843 }
844 return { message };
845};
846var overrideErrorMap = errorMap;
847function setErrorMap(map) {
848 overrideErrorMap = map;
849}
850function getErrorMap() {
851 return overrideErrorMap;
852}
853var makeIssue = (params) => {
854 const { data, path, errorMaps, issueData } = params;
855 const fullPath = [...path, ...issueData.path || []];
856 const fullIssue = {
857 ...issueData,
858 path: fullPath
859 };
860 let errorMessage = "";
861 const maps = errorMaps.filter((m) => !!m).slice().reverse();
862 for (const map of maps) {
863 errorMessage = map(fullIssue, { data, defaultError: errorMessage }).message;
864 }
865 return {
866 ...issueData,
867 path: fullPath,
868 message: issueData.message || errorMessage
869 };
870};
871var EMPTY_PATH = [];
872function addIssueToContext(ctx, issueData) {
873 const issue = makeIssue({
874 issueData,
875 data: ctx.data,
876 path: ctx.path,
877 errorMaps: [
878 ctx.common.contextualErrorMap,
879 ctx.schemaErrorMap,
880 getErrorMap(),
881 errorMap
882 ].filter((x) => !!x)
883 });
884 ctx.common.issues.push(issue);
885}
886var ParseStatus = class {
887 constructor() {
888 this.value = "valid";
889 }
890 dirty() {
891 if (this.value === "valid")
892 this.value = "dirty";
893 }
894 abort() {
895 if (this.value !== "aborted")
896 this.value = "aborted";
897 }
898 static mergeArray(status, results) {
899 const arrayValue = [];
900 for (const s2 of results) {
901 if (s2.status === "aborted")
902 return INVALID;
903 if (s2.status === "dirty")
904 status.dirty();
905 arrayValue.push(s2.value);
906 }
907 return { status: status.value, value: arrayValue };
908 }
909 static async mergeObjectAsync(status, pairs) {
910 const syncPairs = [];
911 for (const pair of pairs) {
912 syncPairs.push({
913 key: await pair.key,
914 value: await pair.value
915 });
916 }
917 return ParseStatus.mergeObjectSync(status, syncPairs);
918 }
919 static mergeObjectSync(status, pairs) {
920 const finalObject = {};
921 for (const pair of pairs) {
922 const { key, value } = pair;
923 if (key.status === "aborted")
924 return INVALID;
925 if (value.status === "aborted")
926 return INVALID;
927 if (key.status === "dirty")
928 status.dirty();
929 if (value.status === "dirty")
930 status.dirty();
931 if (typeof value.value !== "undefined" || pair.alwaysSet) {
932 finalObject[key.value] = value.value;
933 }
934 }
935 return { status: status.value, value: finalObject };
936 }
937};
938var INVALID = Object.freeze({
939 status: "aborted"
940});
941var DIRTY = (value) => ({ status: "dirty", value });
942var OK = (value) => ({ status: "valid", value });
943var isAborted = (x) => x.status === "aborted";
944var isDirty = (x) => x.status === "dirty";
945var isValid = (x) => x.status === "valid";
946var isAsync = (x) => typeof Promise !== void 0 && x instanceof Promise;
947var errorUtil;
948(function(errorUtil2) {
949 errorUtil2.errToObj = (message) => typeof message === "string" ? { message } : message || {};
950 errorUtil2.toString = (message) => typeof message === "string" ? message : message === null || message === void 0 ? void 0 : message.message;
951})(errorUtil || (errorUtil = {}));
952var ParseInputLazyPath = class {
953 constructor(parent, value, path, key) {
954 this.parent = parent;
955 this.data = value;
956 this._path = path;
957 this._key = key;
958 }
959 get path() {
960 return this._path.concat(this._key);
961 }
962};
963var handleResult = (ctx, result) => {
964 if (isValid(result)) {
965 return { success: true, data: result.value };
966 } else {
967 if (!ctx.common.issues.length) {
968 throw new Error("Validation failed but no issues detected.");
969 }
970 const error = new ZodError(ctx.common.issues);
971 return { success: false, error };
972 }
973};
974function processCreateParams(params) {
975 if (!params)
976 return {};
977 const { errorMap: errorMap2, invalid_type_error, required_error, description } = params;
978 if (errorMap2 && (invalid_type_error || required_error)) {
979 throw new Error(`Can't use "invalid_type_error" or "required_error" in conjunction with custom error map.`);
980 }
981 if (errorMap2)
982 return { errorMap: errorMap2, description };
983 const customMap = (iss, ctx) => {
984 if (iss.code !== "invalid_type")
985 return { message: ctx.defaultError };
986 if (typeof ctx.data === "undefined") {
987 return { message: required_error !== null && required_error !== void 0 ? required_error : ctx.defaultError };
988 }
989 return { message: invalid_type_error !== null && invalid_type_error !== void 0 ? invalid_type_error : ctx.defaultError };
990 };
991 return { errorMap: customMap, description };
992}
993var ZodType = class {
994 constructor(def) {
995 this.spa = this.safeParseAsync;
996 this._def = def;
997 this.parse = this.parse.bind(this);
998 this.safeParse = this.safeParse.bind(this);
999 this.parseAsync = this.parseAsync.bind(this);
1000 this.safeParseAsync = this.safeParseAsync.bind(this);
1001 this.spa = this.spa.bind(this);
1002 this.refine = this.refine.bind(this);
1003 this.refinement = this.refinement.bind(this);
1004 this.superRefine = this.superRefine.bind(this);
1005 this.optional = this.optional.bind(this);
1006 this.nullable = this.nullable.bind(this);
1007 this.nullish = this.nullish.bind(this);
1008 this.array = this.array.bind(this);
1009 this.promise = this.promise.bind(this);
1010 this.or = this.or.bind(this);
1011 this.and = this.and.bind(this);
1012 this.transform = this.transform.bind(this);
1013 this.brand = this.brand.bind(this);
1014 this.default = this.default.bind(this);
1015 this.catch = this.catch.bind(this);
1016 this.describe = this.describe.bind(this);
1017 this.pipe = this.pipe.bind(this);
1018 this.isNullable = this.isNullable.bind(this);
1019 this.isOptional = this.isOptional.bind(this);
1020 }
1021 get description() {
1022 return this._def.description;
1023 }
1024 _getType(input) {
1025 return getParsedType(input.data);
1026 }
1027 _getOrReturnCtx(input, ctx) {
1028 return ctx || {
1029 common: input.parent.common,
1030 data: input.data,
1031 parsedType: getParsedType(input.data),
1032 schemaErrorMap: this._def.errorMap,
1033 path: input.path,
1034 parent: input.parent
1035 };
1036 }
1037 _processInputParams(input) {
1038 return {
1039 status: new ParseStatus(),
1040 ctx: {
1041 common: input.parent.common,
1042 data: input.data,
1043 parsedType: getParsedType(input.data),
1044 schemaErrorMap: this._def.errorMap,
1045 path: input.path,
1046 parent: input.parent
1047 }
1048 };
1049 }
1050 _parseSync(input) {
1051 const result = this._parse(input);
1052 if (isAsync(result)) {
1053 throw new Error("Synchronous parse encountered promise.");
1054 }
1055 return result;
1056 }
1057 _parseAsync(input) {
1058 const result = this._parse(input);
1059 return Promise.resolve(result);
1060 }
1061 parse(data, params) {
1062 const result = this.safeParse(data, params);
1063 if (result.success)
1064 return result.data;
1065 throw result.error;
1066 }
1067 safeParse(data, params) {
1068 var _a;
1069 const ctx = {
1070 common: {
1071 issues: [],
1072 async: (_a = params === null || params === void 0 ? void 0 : params.async) !== null && _a !== void 0 ? _a : false,
1073 contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap
1074 },
1075 path: (params === null || params === void 0 ? void 0 : params.path) || [],
1076 schemaErrorMap: this._def.errorMap,
1077 parent: null,
1078 data,
1079 parsedType: getParsedType(data)
1080 };
1081 const result = this._parseSync({ data, path: ctx.path, parent: ctx });
1082 return handleResult(ctx, result);
1083 }
1084 async parseAsync(data, params) {
1085 const result = await this.safeParseAsync(data, params);
1086 if (result.success)
1087 return result.data;
1088 throw result.error;
1089 }
1090 async safeParseAsync(data, params) {
1091 const ctx = {
1092 common: {
1093 issues: [],
1094 contextualErrorMap: params === null || params === void 0 ? void 0 : params.errorMap,
1095 async: true
1096 },
1097 path: (params === null || params === void 0 ? void 0 : params.path) || [],
1098 schemaErrorMap: this._def.errorMap,
1099 parent: null,
1100 data,
1101 parsedType: getParsedType(data)
1102 };
1103 const maybeAsyncResult = this._parse({ data, path: ctx.path, parent: ctx });
1104 const result = await (isAsync(maybeAsyncResult) ? maybeAsyncResult : Promise.resolve(maybeAsyncResult));
1105 return handleResult(ctx, result);
1106 }
1107 refine(check, message) {
1108 const getIssueProperties = (val) => {
1109 if (typeof message === "string" || typeof message === "undefined") {
1110 return { message };
1111 } else if (typeof message === "function") {
1112 return message(val);
1113 } else {
1114 return message;
1115 }
1116 };
1117 return this._refinement((val, ctx) => {
1118 const result = check(val);
1119 const setError = () => ctx.addIssue({
1120 code: ZodIssueCode.custom,
1121 ...getIssueProperties(val)
1122 });
1123 if (typeof Promise !== "undefined" && result instanceof Promise) {
1124 return result.then((data) => {
1125 if (!data) {
1126 setError();
1127 return false;
1128 } else {
1129 return true;
1130 }
1131 });
1132 }
1133 if (!result) {
1134 setError();
1135 return false;
1136 } else {
1137 return true;
1138 }
1139 });
1140 }
1141 refinement(check, refinementData) {
1142 return this._refinement((val, ctx) => {
1143 if (!check(val)) {
1144 ctx.addIssue(typeof refinementData === "function" ? refinementData(val, ctx) : refinementData);
1145 return false;
1146 } else {
1147 return true;
1148 }
1149 });
1150 }
1151 _refinement(refinement) {
1152 return new ZodEffects({
1153 schema: this,
1154 typeName: ZodFirstPartyTypeKind.ZodEffects,
1155 effect: { type: "refinement", refinement }
1156 });
1157 }
1158 superRefine(refinement) {
1159 return this._refinement(refinement);
1160 }
1161 optional() {
1162 return ZodOptional.create(this);
1163 }
1164 nullable() {
1165 return ZodNullable.create(this);
1166 }
1167 nullish() {
1168 return this.optional().nullable();
1169 }
1170 array() {
1171 return ZodArray.create(this);
1172 }
1173 promise() {
1174 return ZodPromise.create(this);
1175 }
1176 or(option) {
1177 return ZodUnion.create([this, option]);
1178 }
1179 and(incoming) {
1180 return ZodIntersection.create(this, incoming);
1181 }
1182 transform(transform) {
1183 return new ZodEffects({
1184 schema: this,
1185 typeName: ZodFirstPartyTypeKind.ZodEffects,
1186 effect: { type: "transform", transform }
1187 });
1188 }
1189 default(def) {
1190 const defaultValueFunc = typeof def === "function" ? def : () => def;
1191 return new ZodDefault({
1192 innerType: this,
1193 defaultValue: defaultValueFunc,
1194 typeName: ZodFirstPartyTypeKind.ZodDefault
1195 });
1196 }
1197 brand() {
1198 return new ZodBranded({
1199 typeName: ZodFirstPartyTypeKind.ZodBranded,
1200 type: this,
1201 ...processCreateParams(void 0)
1202 });
1203 }
1204 catch(def) {
1205 const defaultValueFunc = typeof def === "function" ? def : () => def;
1206 return new ZodCatch({
1207 innerType: this,
1208 defaultValue: defaultValueFunc,
1209 typeName: ZodFirstPartyTypeKind.ZodCatch
1210 });
1211 }
1212 describe(description) {
1213 const This = this.constructor;
1214 return new This({
1215 ...this._def,
1216 description
1217 });
1218 }
1219 pipe(target) {
1220 return ZodPipeline.create(this, target);
1221 }
1222 isOptional() {
1223 return this.safeParse(void 0).success;
1224 }
1225 isNullable() {
1226 return this.safeParse(null).success;
1227 }
1228};
1229var cuidRegex = /^c[^\s-]{8,}$/i;
1230var uuidRegex = /^([a-f0-9]{8}-[a-f0-9]{4}-[1-5][a-f0-9]{3}-[a-f0-9]{4}-[a-f0-9]{12}|00000000-0000-0000-0000-000000000000)$/i;
1231var emailRegex = /^(([^<>()[\]\.,;:\s@\"]+(\.[^<>()[\]\.,;:\s@\"]+)*)|(\".+\"))@(([^<>()[\]\.,;:\s@\"]+\.)+[^<>()[\]\.,;:\s@\"]{2,})$/i;
1232var datetimeRegex = (args) => {
1233 if (args.precision) {
1234 if (args.offset) {
1235 return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}(([+-]\\d{2}:\\d{2})|Z)$`);
1236 } else {
1237 return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}\\.\\d{${args.precision}}Z$`);
1238 }
1239 } else if (args.precision === 0) {
1240 if (args.offset) {
1241 return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(([+-]\\d{2}:\\d{2})|Z)$`);
1242 } else {
1243 return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}Z$`);
1244 }
1245 } else {
1246 if (args.offset) {
1247 return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?(([+-]\\d{2}:\\d{2})|Z)$`);
1248 } else {
1249 return new RegExp(`^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d+)?Z$`);
1250 }
1251 }
1252};
1253var ZodString = class extends ZodType {
1254 constructor() {
1255 super(...arguments);
1256 this._regex = (regex, validation, message) => this.refinement((data) => regex.test(data), {
1257 validation,
1258 code: ZodIssueCode.invalid_string,
1259 ...errorUtil.errToObj(message)
1260 });
1261 this.nonempty = (message) => this.min(1, errorUtil.errToObj(message));
1262 this.trim = () => new ZodString({
1263 ...this._def,
1264 checks: [...this._def.checks, { kind: "trim" }]
1265 });
1266 }
1267 _parse(input) {
1268 if (this._def.coerce) {
1269 input.data = String(input.data);
1270 }
1271 const parsedType = this._getType(input);
1272 if (parsedType !== ZodParsedType.string) {
1273 const ctx2 = this._getOrReturnCtx(input);
1274 addIssueToContext(
1275 ctx2,
1276 {
1277 code: ZodIssueCode.invalid_type,
1278 expected: ZodParsedType.string,
1279 received: ctx2.parsedType
1280 }
1281 );
1282 return INVALID;
1283 }
1284 const status = new ParseStatus();
1285 let ctx = void 0;
1286 for (const check of this._def.checks) {
1287 if (check.kind === "min") {
1288 if (input.data.length < check.value) {
1289 ctx = this._getOrReturnCtx(input, ctx);
1290 addIssueToContext(ctx, {
1291 code: ZodIssueCode.too_small,
1292 minimum: check.value,
1293 type: "string",
1294 inclusive: true,
1295 exact: false,
1296 message: check.message
1297 });
1298 status.dirty();
1299 }
1300 } else if (check.kind === "max") {
1301 if (input.data.length > check.value) {
1302 ctx = this._getOrReturnCtx(input, ctx);
1303 addIssueToContext(ctx, {
1304 code: ZodIssueCode.too_big,
1305 maximum: check.value,
1306 type: "string",
1307 inclusive: true,
1308 exact: false,
1309 message: check.message
1310 });
1311 status.dirty();
1312 }
1313 } else if (check.kind === "length") {
1314 const tooBig = input.data.length > check.value;
1315 const tooSmall = input.data.length < check.value;
1316 if (tooBig || tooSmall) {
1317 ctx = this._getOrReturnCtx(input, ctx);
1318 if (tooBig) {
1319 addIssueToContext(ctx, {
1320 code: ZodIssueCode.too_big,
1321 maximum: check.value,
1322 type: "string",
1323 inclusive: true,
1324 exact: true,
1325 message: check.message
1326 });
1327 } else if (tooSmall) {
1328 addIssueToContext(ctx, {
1329 code: ZodIssueCode.too_small,
1330 minimum: check.value,
1331 type: "string",
1332 inclusive: true,
1333 exact: true,
1334 message: check.message
1335 });
1336 }
1337 status.dirty();
1338 }
1339 } else if (check.kind === "email") {
1340 if (!emailRegex.test(input.data)) {
1341 ctx = this._getOrReturnCtx(input, ctx);
1342 addIssueToContext(ctx, {
1343 validation: "email",
1344 code: ZodIssueCode.invalid_string,
1345 message: check.message
1346 });
1347 status.dirty();
1348 }
1349 } else if (check.kind === "uuid") {
1350 if (!uuidRegex.test(input.data)) {
1351 ctx = this._getOrReturnCtx(input, ctx);
1352 addIssueToContext(ctx, {
1353 validation: "uuid",
1354 code: ZodIssueCode.invalid_string,
1355 message: check.message
1356 });
1357 status.dirty();
1358 }
1359 } else if (check.kind === "cuid") {
1360 if (!cuidRegex.test(input.data)) {
1361 ctx = this._getOrReturnCtx(input, ctx);
1362 addIssueToContext(ctx, {
1363 validation: "cuid",
1364 code: ZodIssueCode.invalid_string,
1365 message: check.message
1366 });
1367 status.dirty();
1368 }
1369 } else if (check.kind === "url") {
1370 try {
1371 new URL(input.data);
1372 } catch (_a) {
1373 ctx = this._getOrReturnCtx(input, ctx);
1374 addIssueToContext(ctx, {
1375 validation: "url",
1376 code: ZodIssueCode.invalid_string,
1377 message: check.message
1378 });
1379 status.dirty();
1380 }
1381 } else if (check.kind === "regex") {
1382 check.regex.lastIndex = 0;
1383 const testResult = check.regex.test(input.data);
1384 if (!testResult) {
1385 ctx = this._getOrReturnCtx(input, ctx);
1386 addIssueToContext(ctx, {
1387 validation: "regex",
1388 code: ZodIssueCode.invalid_string,
1389 message: check.message
1390 });
1391 status.dirty();
1392 }
1393 } else if (check.kind === "trim") {
1394 input.data = input.data.trim();
1395 } else if (check.kind === "startsWith") {
1396 if (!input.data.startsWith(check.value)) {
1397 ctx = this._getOrReturnCtx(input, ctx);
1398 addIssueToContext(ctx, {
1399 code: ZodIssueCode.invalid_string,
1400 validation: { startsWith: check.value },
1401 message: check.message
1402 });
1403 status.dirty();
1404 }
1405 } else if (check.kind === "endsWith") {
1406 if (!input.data.endsWith(check.value)) {
1407 ctx = this._getOrReturnCtx(input, ctx);
1408 addIssueToContext(ctx, {
1409 code: ZodIssueCode.invalid_string,
1410 validation: { endsWith: check.value },
1411 message: check.message
1412 });
1413 status.dirty();
1414 }
1415 } else if (check.kind === "datetime") {
1416 const regex = datetimeRegex(check);
1417 if (!regex.test(input.data)) {
1418 ctx = this._getOrReturnCtx(input, ctx);
1419 addIssueToContext(ctx, {
1420 code: ZodIssueCode.invalid_string,
1421 validation: "datetime",
1422 message: check.message
1423 });
1424 status.dirty();
1425 }
1426 } else {
1427 util.assertNever(check);
1428 }
1429 }
1430 return { status: status.value, value: input.data };
1431 }
1432 _addCheck(check) {
1433 return new ZodString({
1434 ...this._def,
1435 checks: [...this._def.checks, check]
1436 });
1437 }
1438 email(message) {
1439 return this._addCheck({ kind: "email", ...errorUtil.errToObj(message) });
1440 }
1441 url(message) {
1442 return this._addCheck({ kind: "url", ...errorUtil.errToObj(message) });
1443 }
1444 uuid(message) {
1445 return this._addCheck({ kind: "uuid", ...errorUtil.errToObj(message) });
1446 }
1447 cuid(message) {
1448 return this._addCheck({ kind: "cuid", ...errorUtil.errToObj(message) });
1449 }
1450 datetime(options) {
1451 var _a;
1452 if (typeof options === "string") {
1453 return this._addCheck({
1454 kind: "datetime",
1455 precision: null,
1456 offset: false,
1457 message: options
1458 });
1459 }
1460 return this._addCheck({
1461 kind: "datetime",
1462 precision: typeof (options === null || options === void 0 ? void 0 : options.precision) === "undefined" ? null : options === null || options === void 0 ? void 0 : options.precision,
1463 offset: (_a = options === null || options === void 0 ? void 0 : options.offset) !== null && _a !== void 0 ? _a : false,
1464 ...errorUtil.errToObj(options === null || options === void 0 ? void 0 : options.message)
1465 });
1466 }
1467 regex(regex, message) {
1468 return this._addCheck({
1469 kind: "regex",
1470 regex,
1471 ...errorUtil.errToObj(message)
1472 });
1473 }
1474 startsWith(value, message) {
1475 return this._addCheck({
1476 kind: "startsWith",
1477 value,
1478 ...errorUtil.errToObj(message)
1479 });
1480 }
1481 endsWith(value, message) {
1482 return this._addCheck({
1483 kind: "endsWith",
1484 value,
1485 ...errorUtil.errToObj(message)
1486 });
1487 }
1488 min(minLength, message) {
1489 return this._addCheck({
1490 kind: "min",
1491 value: minLength,
1492 ...errorUtil.errToObj(message)
1493 });
1494 }
1495 max(maxLength, message) {
1496 return this._addCheck({
1497 kind: "max",
1498 value: maxLength,
1499 ...errorUtil.errToObj(message)
1500 });
1501 }
1502 length(len, message) {
1503 return this._addCheck({
1504 kind: "length",
1505 value: len,
1506 ...errorUtil.errToObj(message)
1507 });
1508 }
1509 get isDatetime() {
1510 return !!this._def.checks.find((ch) => ch.kind === "datetime");
1511 }
1512 get isEmail() {
1513 return !!this._def.checks.find((ch) => ch.kind === "email");
1514 }
1515 get isURL() {
1516 return !!this._def.checks.find((ch) => ch.kind === "url");
1517 }
1518 get isUUID() {
1519 return !!this._def.checks.find((ch) => ch.kind === "uuid");
1520 }
1521 get isCUID() {
1522 return !!this._def.checks.find((ch) => ch.kind === "cuid");
1523 }
1524 get minLength() {
1525 let min = null;
1526 for (const ch of this._def.checks) {
1527 if (ch.kind === "min") {
1528 if (min === null || ch.value > min)
1529 min = ch.value;
1530 }
1531 }
1532 return min;
1533 }
1534 get maxLength() {
1535 let max = null;
1536 for (const ch of this._def.checks) {
1537 if (ch.kind === "max") {
1538 if (max === null || ch.value < max)
1539 max = ch.value;
1540 }
1541 }
1542 return max;
1543 }
1544};
1545ZodString.create = (params) => {
1546 var _a;
1547 return new ZodString({
1548 checks: [],
1549 typeName: ZodFirstPartyTypeKind.ZodString,
1550 coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
1551 ...processCreateParams(params)
1552 });
1553};
1554function floatSafeRemainder(val, step) {
1555 const valDecCount = (val.toString().split(".")[1] || "").length;
1556 const stepDecCount = (step.toString().split(".")[1] || "").length;
1557 const decCount = valDecCount > stepDecCount ? valDecCount : stepDecCount;
1558 const valInt = parseInt(val.toFixed(decCount).replace(".", ""));
1559 const stepInt = parseInt(step.toFixed(decCount).replace(".", ""));
1560 return valInt % stepInt / Math.pow(10, decCount);
1561}
1562var ZodNumber = class extends ZodType {
1563 constructor() {
1564 super(...arguments);
1565 this.min = this.gte;
1566 this.max = this.lte;
1567 this.step = this.multipleOf;
1568 }
1569 _parse(input) {
1570 if (this._def.coerce) {
1571 input.data = Number(input.data);
1572 }
1573 const parsedType = this._getType(input);
1574 if (parsedType !== ZodParsedType.number) {
1575 const ctx2 = this._getOrReturnCtx(input);
1576 addIssueToContext(ctx2, {
1577 code: ZodIssueCode.invalid_type,
1578 expected: ZodParsedType.number,
1579 received: ctx2.parsedType
1580 });
1581 return INVALID;
1582 }
1583 let ctx = void 0;
1584 const status = new ParseStatus();
1585 for (const check of this._def.checks) {
1586 if (check.kind === "int") {
1587 if (!util.isInteger(input.data)) {
1588 ctx = this._getOrReturnCtx(input, ctx);
1589 addIssueToContext(ctx, {
1590 code: ZodIssueCode.invalid_type,
1591 expected: "integer",
1592 received: "float",
1593 message: check.message
1594 });
1595 status.dirty();
1596 }
1597 } else if (check.kind === "min") {
1598 const tooSmall = check.inclusive ? input.data < check.value : input.data <= check.value;
1599 if (tooSmall) {
1600 ctx = this._getOrReturnCtx(input, ctx);
1601 addIssueToContext(ctx, {
1602 code: ZodIssueCode.too_small,
1603 minimum: check.value,
1604 type: "number",
1605 inclusive: check.inclusive,
1606 exact: false,
1607 message: check.message
1608 });
1609 status.dirty();
1610 }
1611 } else if (check.kind === "max") {
1612 const tooBig = check.inclusive ? input.data > check.value : input.data >= check.value;
1613 if (tooBig) {
1614 ctx = this._getOrReturnCtx(input, ctx);
1615 addIssueToContext(ctx, {
1616 code: ZodIssueCode.too_big,
1617 maximum: check.value,
1618 type: "number",
1619 inclusive: check.inclusive,
1620 exact: false,
1621 message: check.message
1622 });
1623 status.dirty();
1624 }
1625 } else if (check.kind === "multipleOf") {
1626 if (floatSafeRemainder(input.data, check.value) !== 0) {
1627 ctx = this._getOrReturnCtx(input, ctx);
1628 addIssueToContext(ctx, {
1629 code: ZodIssueCode.not_multiple_of,
1630 multipleOf: check.value,
1631 message: check.message
1632 });
1633 status.dirty();
1634 }
1635 } else if (check.kind === "finite") {
1636 if (!Number.isFinite(input.data)) {
1637 ctx = this._getOrReturnCtx(input, ctx);
1638 addIssueToContext(ctx, {
1639 code: ZodIssueCode.not_finite,
1640 message: check.message
1641 });
1642 status.dirty();
1643 }
1644 } else {
1645 util.assertNever(check);
1646 }
1647 }
1648 return { status: status.value, value: input.data };
1649 }
1650 gte(value, message) {
1651 return this.setLimit("min", value, true, errorUtil.toString(message));
1652 }
1653 gt(value, message) {
1654 return this.setLimit("min", value, false, errorUtil.toString(message));
1655 }
1656 lte(value, message) {
1657 return this.setLimit("max", value, true, errorUtil.toString(message));
1658 }
1659 lt(value, message) {
1660 return this.setLimit("max", value, false, errorUtil.toString(message));
1661 }
1662 setLimit(kind, value, inclusive, message) {
1663 return new ZodNumber({
1664 ...this._def,
1665 checks: [
1666 ...this._def.checks,
1667 {
1668 kind,
1669 value,
1670 inclusive,
1671 message: errorUtil.toString(message)
1672 }
1673 ]
1674 });
1675 }
1676 _addCheck(check) {
1677 return new ZodNumber({
1678 ...this._def,
1679 checks: [...this._def.checks, check]
1680 });
1681 }
1682 int(message) {
1683 return this._addCheck({
1684 kind: "int",
1685 message: errorUtil.toString(message)
1686 });
1687 }
1688 positive(message) {
1689 return this._addCheck({
1690 kind: "min",
1691 value: 0,
1692 inclusive: false,
1693 message: errorUtil.toString(message)
1694 });
1695 }
1696 negative(message) {
1697 return this._addCheck({
1698 kind: "max",
1699 value: 0,
1700 inclusive: false,
1701 message: errorUtil.toString(message)
1702 });
1703 }
1704 nonpositive(message) {
1705 return this._addCheck({
1706 kind: "max",
1707 value: 0,
1708 inclusive: true,
1709 message: errorUtil.toString(message)
1710 });
1711 }
1712 nonnegative(message) {
1713 return this._addCheck({
1714 kind: "min",
1715 value: 0,
1716 inclusive: true,
1717 message: errorUtil.toString(message)
1718 });
1719 }
1720 multipleOf(value, message) {
1721 return this._addCheck({
1722 kind: "multipleOf",
1723 value,
1724 message: errorUtil.toString(message)
1725 });
1726 }
1727 finite(message) {
1728 return this._addCheck({
1729 kind: "finite",
1730 message: errorUtil.toString(message)
1731 });
1732 }
1733 get minValue() {
1734 let min = null;
1735 for (const ch of this._def.checks) {
1736 if (ch.kind === "min") {
1737 if (min === null || ch.value > min)
1738 min = ch.value;
1739 }
1740 }
1741 return min;
1742 }
1743 get maxValue() {
1744 let max = null;
1745 for (const ch of this._def.checks) {
1746 if (ch.kind === "max") {
1747 if (max === null || ch.value < max)
1748 max = ch.value;
1749 }
1750 }
1751 return max;
1752 }
1753 get isInt() {
1754 return !!this._def.checks.find((ch) => ch.kind === "int");
1755 }
1756};
1757ZodNumber.create = (params) => {
1758 return new ZodNumber({
1759 checks: [],
1760 typeName: ZodFirstPartyTypeKind.ZodNumber,
1761 coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
1762 ...processCreateParams(params)
1763 });
1764};
1765var ZodBigInt = class extends ZodType {
1766 _parse(input) {
1767 if (this._def.coerce) {
1768 input.data = BigInt(input.data);
1769 }
1770 const parsedType = this._getType(input);
1771 if (parsedType !== ZodParsedType.bigint) {
1772 const ctx = this._getOrReturnCtx(input);
1773 addIssueToContext(ctx, {
1774 code: ZodIssueCode.invalid_type,
1775 expected: ZodParsedType.bigint,
1776 received: ctx.parsedType
1777 });
1778 return INVALID;
1779 }
1780 return OK(input.data);
1781 }
1782};
1783ZodBigInt.create = (params) => {
1784 var _a;
1785 return new ZodBigInt({
1786 typeName: ZodFirstPartyTypeKind.ZodBigInt,
1787 coerce: (_a = params === null || params === void 0 ? void 0 : params.coerce) !== null && _a !== void 0 ? _a : false,
1788 ...processCreateParams(params)
1789 });
1790};
1791var ZodBoolean = class extends ZodType {
1792 _parse(input) {
1793 if (this._def.coerce) {
1794 input.data = Boolean(input.data);
1795 }
1796 const parsedType = this._getType(input);
1797 if (parsedType !== ZodParsedType.boolean) {
1798 const ctx = this._getOrReturnCtx(input);
1799 addIssueToContext(ctx, {
1800 code: ZodIssueCode.invalid_type,
1801 expected: ZodParsedType.boolean,
1802 received: ctx.parsedType
1803 });
1804 return INVALID;
1805 }
1806 return OK(input.data);
1807 }
1808};
1809ZodBoolean.create = (params) => {
1810 return new ZodBoolean({
1811 typeName: ZodFirstPartyTypeKind.ZodBoolean,
1812 coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
1813 ...processCreateParams(params)
1814 });
1815};
1816var ZodDate = class extends ZodType {
1817 _parse(input) {
1818 if (this._def.coerce) {
1819 input.data = new Date(input.data);
1820 }
1821 const parsedType = this._getType(input);
1822 if (parsedType !== ZodParsedType.date) {
1823 const ctx2 = this._getOrReturnCtx(input);
1824 addIssueToContext(ctx2, {
1825 code: ZodIssueCode.invalid_type,
1826 expected: ZodParsedType.date,
1827 received: ctx2.parsedType
1828 });
1829 return INVALID;
1830 }
1831 if (isNaN(input.data.getTime())) {
1832 const ctx2 = this._getOrReturnCtx(input);
1833 addIssueToContext(ctx2, {
1834 code: ZodIssueCode.invalid_date
1835 });
1836 return INVALID;
1837 }
1838 const status = new ParseStatus();
1839 let ctx = void 0;
1840 for (const check of this._def.checks) {
1841 if (check.kind === "min") {
1842 if (input.data.getTime() < check.value) {
1843 ctx = this._getOrReturnCtx(input, ctx);
1844 addIssueToContext(ctx, {
1845 code: ZodIssueCode.too_small,
1846 message: check.message,
1847 inclusive: true,
1848 exact: false,
1849 minimum: check.value,
1850 type: "date"
1851 });
1852 status.dirty();
1853 }
1854 } else if (check.kind === "max") {
1855 if (input.data.getTime() > check.value) {
1856 ctx = this._getOrReturnCtx(input, ctx);
1857 addIssueToContext(ctx, {
1858 code: ZodIssueCode.too_big,
1859 message: check.message,
1860 inclusive: true,
1861 exact: false,
1862 maximum: check.value,
1863 type: "date"
1864 });
1865 status.dirty();
1866 }
1867 } else {
1868 util.assertNever(check);
1869 }
1870 }
1871 return {
1872 status: status.value,
1873 value: new Date(input.data.getTime())
1874 };
1875 }
1876 _addCheck(check) {
1877 return new ZodDate({
1878 ...this._def,
1879 checks: [...this._def.checks, check]
1880 });
1881 }
1882 min(minDate, message) {
1883 return this._addCheck({
1884 kind: "min",
1885 value: minDate.getTime(),
1886 message: errorUtil.toString(message)
1887 });
1888 }
1889 max(maxDate, message) {
1890 return this._addCheck({
1891 kind: "max",
1892 value: maxDate.getTime(),
1893 message: errorUtil.toString(message)
1894 });
1895 }
1896 get minDate() {
1897 let min = null;
1898 for (const ch of this._def.checks) {
1899 if (ch.kind === "min") {
1900 if (min === null || ch.value > min)
1901 min = ch.value;
1902 }
1903 }
1904 return min != null ? new Date(min) : null;
1905 }
1906 get maxDate() {
1907 let max = null;
1908 for (const ch of this._def.checks) {
1909 if (ch.kind === "max") {
1910 if (max === null || ch.value < max)
1911 max = ch.value;
1912 }
1913 }
1914 return max != null ? new Date(max) : null;
1915 }
1916};
1917ZodDate.create = (params) => {
1918 return new ZodDate({
1919 checks: [],
1920 coerce: (params === null || params === void 0 ? void 0 : params.coerce) || false,
1921 typeName: ZodFirstPartyTypeKind.ZodDate,
1922 ...processCreateParams(params)
1923 });
1924};
1925var ZodSymbol = class extends ZodType {
1926 _parse(input) {
1927 const parsedType = this._getType(input);
1928 if (parsedType !== ZodParsedType.symbol) {
1929 const ctx = this._getOrReturnCtx(input);
1930 addIssueToContext(ctx, {
1931 code: ZodIssueCode.invalid_type,
1932 expected: ZodParsedType.symbol,
1933 received: ctx.parsedType
1934 });
1935 return INVALID;
1936 }
1937 return OK(input.data);
1938 }
1939};
1940ZodSymbol.create = (params) => {
1941 return new ZodSymbol({
1942 typeName: ZodFirstPartyTypeKind.ZodSymbol,
1943 ...processCreateParams(params)
1944 });
1945};
1946var ZodUndefined = class extends ZodType {
1947 _parse(input) {
1948 const parsedType = this._getType(input);
1949 if (parsedType !== ZodParsedType.undefined) {
1950 const ctx = this._getOrReturnCtx(input);
1951 addIssueToContext(ctx, {
1952 code: ZodIssueCode.invalid_type,
1953 expected: ZodParsedType.undefined,
1954 received: ctx.parsedType
1955 });
1956 return INVALID;
1957 }
1958 return OK(input.data);
1959 }
1960};
1961ZodUndefined.create = (params) => {
1962 return new ZodUndefined({
1963 typeName: ZodFirstPartyTypeKind.ZodUndefined,
1964 ...processCreateParams(params)
1965 });
1966};
1967var ZodNull = class extends ZodType {
1968 _parse(input) {
1969 const parsedType = this._getType(input);
1970 if (parsedType !== ZodParsedType.null) {
1971 const ctx = this._getOrReturnCtx(input);
1972 addIssueToContext(ctx, {
1973 code: ZodIssueCode.invalid_type,
1974 expected: ZodParsedType.null,
1975 received: ctx.parsedType
1976 });
1977 return INVALID;
1978 }
1979 return OK(input.data);
1980 }
1981};
1982ZodNull.create = (params) => {
1983 return new ZodNull({
1984 typeName: ZodFirstPartyTypeKind.ZodNull,
1985 ...processCreateParams(params)
1986 });
1987};
1988var ZodAny = class extends ZodType {
1989 constructor() {
1990 super(...arguments);
1991 this._any = true;
1992 }
1993 _parse(input) {
1994 return OK(input.data);
1995 }
1996};
1997ZodAny.create = (params) => {
1998 return new ZodAny({
1999 typeName: ZodFirstPartyTypeKind.ZodAny,
2000 ...processCreateParams(params)
2001 });
2002};
2003var ZodUnknown = class extends ZodType {
2004 constructor() {
2005 super(...arguments);
2006 this._unknown = true;
2007 }
2008 _parse(input) {
2009 return OK(input.data);
2010 }
2011};
2012ZodUnknown.create = (params) => {
2013 return new ZodUnknown({
2014 typeName: ZodFirstPartyTypeKind.ZodUnknown,
2015 ...processCreateParams(params)
2016 });
2017};
2018var ZodNever = class extends ZodType {
2019 _parse(input) {
2020 const ctx = this._getOrReturnCtx(input);
2021 addIssueToContext(ctx, {
2022 code: ZodIssueCode.invalid_type,
2023 expected: ZodParsedType.never,
2024 received: ctx.parsedType
2025 });
2026 return INVALID;
2027 }
2028};
2029ZodNever.create = (params) => {
2030 return new ZodNever({
2031 typeName: ZodFirstPartyTypeKind.ZodNever,
2032 ...processCreateParams(params)
2033 });
2034};
2035var ZodVoid = class extends ZodType {
2036 _parse(input) {
2037 const parsedType = this._getType(input);
2038 if (parsedType !== ZodParsedType.undefined) {
2039 const ctx = this._getOrReturnCtx(input);
2040 addIssueToContext(ctx, {
2041 code: ZodIssueCode.invalid_type,
2042 expected: ZodParsedType.void,
2043 received: ctx.parsedType
2044 });
2045 return INVALID;
2046 }
2047 return OK(input.data);
2048 }
2049};
2050ZodVoid.create = (params) => {
2051 return new ZodVoid({
2052 typeName: ZodFirstPartyTypeKind.ZodVoid,
2053 ...processCreateParams(params)
2054 });
2055};
2056var ZodArray = class extends ZodType {
2057 _parse(input) {
2058 const { ctx, status } = this._processInputParams(input);
2059 const def = this._def;
2060 if (ctx.parsedType !== ZodParsedType.array) {
2061 addIssueToContext(ctx, {
2062 code: ZodIssueCode.invalid_type,
2063 expected: ZodParsedType.array,
2064 received: ctx.parsedType
2065 });
2066 return INVALID;
2067 }
2068 if (def.exactLength !== null) {
2069 const tooBig = ctx.data.length > def.exactLength.value;
2070 const tooSmall = ctx.data.length < def.exactLength.value;
2071 if (tooBig || tooSmall) {
2072 addIssueToContext(ctx, {
2073 code: tooBig ? ZodIssueCode.too_big : ZodIssueCode.too_small,
2074 minimum: tooSmall ? def.exactLength.value : void 0,
2075 maximum: tooBig ? def.exactLength.value : void 0,
2076 type: "array",
2077 inclusive: true,
2078 exact: true,
2079 message: def.exactLength.message
2080 });
2081 status.dirty();
2082 }
2083 }
2084 if (def.minLength !== null) {
2085 if (ctx.data.length < def.minLength.value) {
2086 addIssueToContext(ctx, {
2087 code: ZodIssueCode.too_small,
2088 minimum: def.minLength.value,
2089 type: "array",
2090 inclusive: true,
2091 exact: false,
2092 message: def.minLength.message
2093 });
2094 status.dirty();
2095 }
2096 }
2097 if (def.maxLength !== null) {
2098 if (ctx.data.length > def.maxLength.value) {
2099 addIssueToContext(ctx, {
2100 code: ZodIssueCode.too_big,
2101 maximum: def.maxLength.value,
2102 type: "array",
2103 inclusive: true,
2104 exact: false,
2105 message: def.maxLength.message
2106 });
2107 status.dirty();
2108 }
2109 }
2110 if (ctx.common.async) {
2111 return Promise.all(ctx.data.map((item, i) => {
2112 return def.type._parseAsync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2113 })).then((result2) => {
2114 return ParseStatus.mergeArray(status, result2);
2115 });
2116 }
2117 const result = ctx.data.map((item, i) => {
2118 return def.type._parseSync(new ParseInputLazyPath(ctx, item, ctx.path, i));
2119 });
2120 return ParseStatus.mergeArray(status, result);
2121 }
2122 get element() {
2123 return this._def.type;
2124 }
2125 min(minLength, message) {
2126 return new ZodArray({
2127 ...this._def,
2128 minLength: { value: minLength, message: errorUtil.toString(message) }
2129 });
2130 }
2131 max(maxLength, message) {
2132 return new ZodArray({
2133 ...this._def,
2134 maxLength: { value: maxLength, message: errorUtil.toString(message) }
2135 });
2136 }
2137 length(len, message) {
2138 return new ZodArray({
2139 ...this._def,
2140 exactLength: { value: len, message: errorUtil.toString(message) }
2141 });
2142 }
2143 nonempty(message) {
2144 return this.min(1, message);
2145 }
2146};
2147ZodArray.create = (schema, params) => {
2148 return new ZodArray({
2149 type: schema,
2150 minLength: null,
2151 maxLength: null,
2152 exactLength: null,
2153 typeName: ZodFirstPartyTypeKind.ZodArray,
2154 ...processCreateParams(params)
2155 });
2156};
2157var objectUtil;
2158(function(objectUtil2) {
2159 objectUtil2.mergeShapes = (first, second) => {
2160 return {
2161 ...first,
2162 ...second
2163 };
2164 };
2165})(objectUtil || (objectUtil = {}));
2166var AugmentFactory = (def) => (augmentation) => {
2167 return new ZodObject({
2168 ...def,
2169 shape: () => ({
2170 ...def.shape(),
2171 ...augmentation
2172 })
2173 });
2174};
2175function deepPartialify(schema) {
2176 if (schema instanceof ZodObject) {
2177 const newShape = {};
2178 for (const key in schema.shape) {
2179 const fieldSchema = schema.shape[key];
2180 newShape[key] = ZodOptional.create(deepPartialify(fieldSchema));
2181 }
2182 return new ZodObject({
2183 ...schema._def,
2184 shape: () => newShape
2185 });
2186 } else if (schema instanceof ZodArray) {
2187 return ZodArray.create(deepPartialify(schema.element));
2188 } else if (schema instanceof ZodOptional) {
2189 return ZodOptional.create(deepPartialify(schema.unwrap()));
2190 } else if (schema instanceof ZodNullable) {
2191 return ZodNullable.create(deepPartialify(schema.unwrap()));
2192 } else if (schema instanceof ZodTuple) {
2193 return ZodTuple.create(schema.items.map((item) => deepPartialify(item)));
2194 } else {
2195 return schema;
2196 }
2197}
2198var ZodObject = class extends ZodType {
2199 constructor() {
2200 super(...arguments);
2201 this._cached = null;
2202 this.nonstrict = this.passthrough;
2203 this.augment = AugmentFactory(this._def);
2204 this.extend = AugmentFactory(this._def);
2205 }
2206 _getCached() {
2207 if (this._cached !== null)
2208 return this._cached;
2209 const shape = this._def.shape();
2210 const keys = util.objectKeys(shape);
2211 return this._cached = { shape, keys };
2212 }
2213 _parse(input) {
2214 const parsedType = this._getType(input);
2215 if (parsedType !== ZodParsedType.object) {
2216 const ctx2 = this._getOrReturnCtx(input);
2217 addIssueToContext(ctx2, {
2218 code: ZodIssueCode.invalid_type,
2219 expected: ZodParsedType.object,
2220 received: ctx2.parsedType
2221 });
2222 return INVALID;
2223 }
2224 const { status, ctx } = this._processInputParams(input);
2225 const { shape, keys: shapeKeys } = this._getCached();
2226 const extraKeys = [];
2227 if (!(this._def.catchall instanceof ZodNever && this._def.unknownKeys === "strip")) {
2228 for (const key in ctx.data) {
2229 if (!shapeKeys.includes(key)) {
2230 extraKeys.push(key);
2231 }
2232 }
2233 }
2234 const pairs = [];
2235 for (const key of shapeKeys) {
2236 const keyValidator = shape[key];
2237 const value = ctx.data[key];
2238 pairs.push({
2239 key: { status: "valid", value: key },
2240 value: keyValidator._parse(new ParseInputLazyPath(ctx, value, ctx.path, key)),
2241 alwaysSet: key in ctx.data
2242 });
2243 }
2244 if (this._def.catchall instanceof ZodNever) {
2245 const unknownKeys = this._def.unknownKeys;
2246 if (unknownKeys === "passthrough") {
2247 for (const key of extraKeys) {
2248 pairs.push({
2249 key: { status: "valid", value: key },
2250 value: { status: "valid", value: ctx.data[key] }
2251 });
2252 }
2253 } else if (unknownKeys === "strict") {
2254 if (extraKeys.length > 0) {
2255 addIssueToContext(ctx, {
2256 code: ZodIssueCode.unrecognized_keys,
2257 keys: extraKeys
2258 });
2259 status.dirty();
2260 }
2261 } else if (unknownKeys === "strip")
2262 ;
2263 else {
2264 throw new Error(`Internal ZodObject error: invalid unknownKeys value.`);
2265 }
2266 } else {
2267 const catchall = this._def.catchall;
2268 for (const key of extraKeys) {
2269 const value = ctx.data[key];
2270 pairs.push({
2271 key: { status: "valid", value: key },
2272 value: catchall._parse(
2273 new ParseInputLazyPath(ctx, value, ctx.path, key)
2274 ),
2275 alwaysSet: key in ctx.data
2276 });
2277 }
2278 }
2279 if (ctx.common.async) {
2280 return Promise.resolve().then(async () => {
2281 const syncPairs = [];
2282 for (const pair of pairs) {
2283 const key = await pair.key;
2284 syncPairs.push({
2285 key,
2286 value: await pair.value,
2287 alwaysSet: pair.alwaysSet
2288 });
2289 }
2290 return syncPairs;
2291 }).then((syncPairs) => {
2292 return ParseStatus.mergeObjectSync(status, syncPairs);
2293 });
2294 } else {
2295 return ParseStatus.mergeObjectSync(status, pairs);
2296 }
2297 }
2298 get shape() {
2299 return this._def.shape();
2300 }
2301 strict(message) {
2302 errorUtil.errToObj;
2303 return new ZodObject({
2304 ...this._def,
2305 unknownKeys: "strict",
2306 ...message !== void 0 ? {
2307 errorMap: (issue, ctx) => {
2308 var _a, _b, _c, _d;
2309 const defaultError = (_c = (_b = (_a = this._def).errorMap) === null || _b === void 0 ? void 0 : _b.call(_a, issue, ctx).message) !== null && _c !== void 0 ? _c : ctx.defaultError;
2310 if (issue.code === "unrecognized_keys")
2311 return {
2312 message: (_d = errorUtil.errToObj(message).message) !== null && _d !== void 0 ? _d : defaultError
2313 };
2314 return {
2315 message: defaultError
2316 };
2317 }
2318 } : {}
2319 });
2320 }
2321 strip() {
2322 return new ZodObject({
2323 ...this._def,
2324 unknownKeys: "strip"
2325 });
2326 }
2327 passthrough() {
2328 return new ZodObject({
2329 ...this._def,
2330 unknownKeys: "passthrough"
2331 });
2332 }
2333 setKey(key, schema) {
2334 return this.augment({ [key]: schema });
2335 }
2336 merge(merging) {
2337 const merged = new ZodObject({
2338 unknownKeys: merging._def.unknownKeys,
2339 catchall: merging._def.catchall,
2340 shape: () => objectUtil.mergeShapes(this._def.shape(), merging._def.shape()),
2341 typeName: ZodFirstPartyTypeKind.ZodObject
2342 });
2343 return merged;
2344 }
2345 catchall(index) {
2346 return new ZodObject({
2347 ...this._def,
2348 catchall: index
2349 });
2350 }
2351 pick(mask) {
2352 const shape = {};
2353 util.objectKeys(mask).map((key) => {
2354 if (this.shape[key])
2355 shape[key] = this.shape[key];
2356 });
2357 return new ZodObject({
2358 ...this._def,
2359 shape: () => shape
2360 });
2361 }
2362 omit(mask) {
2363 const shape = {};
2364 util.objectKeys(this.shape).map((key) => {
2365 if (util.objectKeys(mask).indexOf(key) === -1) {
2366 shape[key] = this.shape[key];
2367 }
2368 });
2369 return new ZodObject({
2370 ...this._def,
2371 shape: () => shape
2372 });
2373 }
2374 deepPartial() {
2375 return deepPartialify(this);
2376 }
2377 partial(mask) {
2378 const newShape = {};
2379 if (mask) {
2380 util.objectKeys(this.shape).map((key) => {
2381 if (util.objectKeys(mask).indexOf(key) === -1) {
2382 newShape[key] = this.shape[key];
2383 } else {
2384 newShape[key] = this.shape[key].optional();
2385 }
2386 });
2387 return new ZodObject({
2388 ...this._def,
2389 shape: () => newShape
2390 });
2391 } else {
2392 for (const key in this.shape) {
2393 const fieldSchema = this.shape[key];
2394 newShape[key] = fieldSchema.optional();
2395 }
2396 }
2397 return new ZodObject({
2398 ...this._def,
2399 shape: () => newShape
2400 });
2401 }
2402 required(mask) {
2403 const newShape = {};
2404 if (mask) {
2405 util.objectKeys(this.shape).map((key) => {
2406 if (util.objectKeys(mask).indexOf(key) === -1) {
2407 newShape[key] = this.shape[key];
2408 } else {
2409 const fieldSchema = this.shape[key];
2410 let newField = fieldSchema;
2411 while (newField instanceof ZodOptional) {
2412 newField = newField._def.innerType;
2413 }
2414 newShape[key] = newField;
2415 }
2416 });
2417 } else {
2418 for (const key in this.shape) {
2419 const fieldSchema = this.shape[key];
2420 let newField = fieldSchema;
2421 while (newField instanceof ZodOptional) {
2422 newField = newField._def.innerType;
2423 }
2424 newShape[key] = newField;
2425 }
2426 }
2427 return new ZodObject({
2428 ...this._def,
2429 shape: () => newShape
2430 });
2431 }
2432 keyof() {
2433 return createZodEnum(util.objectKeys(this.shape));
2434 }
2435};
2436ZodObject.create = (shape, params) => {
2437 return new ZodObject({
2438 shape: () => shape,
2439 unknownKeys: "strip",
2440 catchall: ZodNever.create(),
2441 typeName: ZodFirstPartyTypeKind.ZodObject,
2442 ...processCreateParams(params)
2443 });
2444};
2445ZodObject.strictCreate = (shape, params) => {
2446 return new ZodObject({
2447 shape: () => shape,
2448 unknownKeys: "strict",
2449 catchall: ZodNever.create(),
2450 typeName: ZodFirstPartyTypeKind.ZodObject,
2451 ...processCreateParams(params)
2452 });
2453};
2454ZodObject.lazycreate = (shape, params) => {
2455 return new ZodObject({
2456 shape,
2457 unknownKeys: "strip",
2458 catchall: ZodNever.create(),
2459 typeName: ZodFirstPartyTypeKind.ZodObject,
2460 ...processCreateParams(params)
2461 });
2462};
2463var ZodUnion = class extends ZodType {
2464 _parse(input) {
2465 const { ctx } = this._processInputParams(input);
2466 const options = this._def.options;
2467 function handleResults(results) {
2468 for (const result of results) {
2469 if (result.result.status === "valid") {
2470 return result.result;
2471 }
2472 }
2473 for (const result of results) {
2474 if (result.result.status === "dirty") {
2475 ctx.common.issues.push(...result.ctx.common.issues);
2476 return result.result;
2477 }
2478 }
2479 const unionErrors = results.map((result) => new ZodError(result.ctx.common.issues));
2480 addIssueToContext(ctx, {
2481 code: ZodIssueCode.invalid_union,
2482 unionErrors
2483 });
2484 return INVALID;
2485 }
2486 if (ctx.common.async) {
2487 return Promise.all(options.map(async (option) => {
2488 const childCtx = {
2489 ...ctx,
2490 common: {
2491 ...ctx.common,
2492 issues: []
2493 },
2494 parent: null
2495 };
2496 return {
2497 result: await option._parseAsync({
2498 data: ctx.data,
2499 path: ctx.path,
2500 parent: childCtx
2501 }),
2502 ctx: childCtx
2503 };
2504 })).then(handleResults);
2505 } else {
2506 let dirty = void 0;
2507 const issues = [];
2508 for (const option of options) {
2509 const childCtx = {
2510 ...ctx,
2511 common: {
2512 ...ctx.common,
2513 issues: []
2514 },
2515 parent: null
2516 };
2517 const result = option._parseSync({
2518 data: ctx.data,
2519 path: ctx.path,
2520 parent: childCtx
2521 });
2522 if (result.status === "valid") {
2523 return result;
2524 } else if (result.status === "dirty" && !dirty) {
2525 dirty = { result, ctx: childCtx };
2526 }
2527 if (childCtx.common.issues.length) {
2528 issues.push(childCtx.common.issues);
2529 }
2530 }
2531 if (dirty) {
2532 ctx.common.issues.push(...dirty.ctx.common.issues);
2533 return dirty.result;
2534 }
2535 const unionErrors = issues.map((issues2) => new ZodError(issues2));
2536 addIssueToContext(ctx, {
2537 code: ZodIssueCode.invalid_union,
2538 unionErrors
2539 });
2540 return INVALID;
2541 }
2542 }
2543 get options() {
2544 return this._def.options;
2545 }
2546};
2547ZodUnion.create = (types, params) => {
2548 return new ZodUnion({
2549 options: types,
2550 typeName: ZodFirstPartyTypeKind.ZodUnion,
2551 ...processCreateParams(params)
2552 });
2553};
2554var getDiscriminator = (type) => {
2555 if (type instanceof ZodLazy) {
2556 return getDiscriminator(type.schema);
2557 } else if (type instanceof ZodEffects) {
2558 return getDiscriminator(type.innerType());
2559 } else if (type instanceof ZodLiteral) {
2560 return [type.value];
2561 } else if (type instanceof ZodEnum) {
2562 return type.options;
2563 } else if (type instanceof ZodNativeEnum) {
2564 return Object.keys(type.enum);
2565 } else if (type instanceof ZodDefault) {
2566 return getDiscriminator(type._def.innerType);
2567 } else if (type instanceof ZodUndefined) {
2568 return [void 0];
2569 } else if (type instanceof ZodNull) {
2570 return [null];
2571 } else {
2572 return null;
2573 }
2574};
2575var ZodDiscriminatedUnion = class extends ZodType {
2576 _parse(input) {
2577 const { ctx } = this._processInputParams(input);
2578 if (ctx.parsedType !== ZodParsedType.object) {
2579 addIssueToContext(ctx, {
2580 code: ZodIssueCode.invalid_type,
2581 expected: ZodParsedType.object,
2582 received: ctx.parsedType
2583 });
2584 return INVALID;
2585 }
2586 const discriminator = this.discriminator;
2587 const discriminatorValue = ctx.data[discriminator];
2588 const option = this.optionsMap.get(discriminatorValue);
2589 if (!option) {
2590 addIssueToContext(ctx, {
2591 code: ZodIssueCode.invalid_union_discriminator,
2592 options: Array.from(this.optionsMap.keys()),
2593 path: [discriminator]
2594 });
2595 return INVALID;
2596 }
2597 if (ctx.common.async) {
2598 return option._parseAsync({
2599 data: ctx.data,
2600 path: ctx.path,
2601 parent: ctx
2602 });
2603 } else {
2604 return option._parseSync({
2605 data: ctx.data,
2606 path: ctx.path,
2607 parent: ctx
2608 });
2609 }
2610 }
2611 get discriminator() {
2612 return this._def.discriminator;
2613 }
2614 get options() {
2615 return this._def.options;
2616 }
2617 get optionsMap() {
2618 return this._def.optionsMap;
2619 }
2620 static create(discriminator, options, params) {
2621 const optionsMap = /* @__PURE__ */ new Map();
2622 for (const type of options) {
2623 const discriminatorValues = getDiscriminator(type.shape[discriminator]);
2624 if (!discriminatorValues) {
2625 throw new Error(`A discriminator value for key \`${discriminator}\` could not be extracted from all schema options`);
2626 }
2627 for (const value of discriminatorValues) {
2628 if (optionsMap.has(value)) {
2629 throw new Error(`Discriminator property ${String(discriminator)} has duplicate value ${String(value)}`);
2630 }
2631 optionsMap.set(value, type);
2632 }
2633 }
2634 return new ZodDiscriminatedUnion({
2635 typeName: ZodFirstPartyTypeKind.ZodDiscriminatedUnion,
2636 discriminator,
2637 options,
2638 optionsMap,
2639 ...processCreateParams(params)
2640 });
2641 }
2642};
2643function mergeValues(a, b) {
2644 const aType = getParsedType(a);
2645 const bType = getParsedType(b);
2646 if (a === b) {
2647 return { valid: true, data: a };
2648 } else if (aType === ZodParsedType.object && bType === ZodParsedType.object) {
2649 const bKeys = util.objectKeys(b);
2650 const sharedKeys = util.objectKeys(a).filter((key) => bKeys.indexOf(key) !== -1);
2651 const newObj = { ...a, ...b };
2652 for (const key of sharedKeys) {
2653 const sharedValue = mergeValues(a[key], b[key]);
2654 if (!sharedValue.valid) {
2655 return { valid: false };
2656 }
2657 newObj[key] = sharedValue.data;
2658 }
2659 return { valid: true, data: newObj };
2660 } else if (aType === ZodParsedType.array && bType === ZodParsedType.array) {
2661 if (a.length !== b.length) {
2662 return { valid: false };
2663 }
2664 const newArray = [];
2665 for (let index = 0; index < a.length; index++) {
2666 const itemA = a[index];
2667 const itemB = b[index];
2668 const sharedValue = mergeValues(itemA, itemB);
2669 if (!sharedValue.valid) {
2670 return { valid: false };
2671 }
2672 newArray.push(sharedValue.data);
2673 }
2674 return { valid: true, data: newArray };
2675 } else if (aType === ZodParsedType.date && bType === ZodParsedType.date && +a === +b) {
2676 return { valid: true, data: a };
2677 } else {
2678 return { valid: false };
2679 }
2680}
2681var ZodIntersection = class extends ZodType {
2682 _parse(input) {
2683 const { status, ctx } = this._processInputParams(input);
2684 const handleParsed = (parsedLeft, parsedRight) => {
2685 if (isAborted(parsedLeft) || isAborted(parsedRight)) {
2686 return INVALID;
2687 }
2688 const merged = mergeValues(parsedLeft.value, parsedRight.value);
2689 if (!merged.valid) {
2690 addIssueToContext(ctx, {
2691 code: ZodIssueCode.invalid_intersection_types
2692 });
2693 return INVALID;
2694 }
2695 if (isDirty(parsedLeft) || isDirty(parsedRight)) {
2696 status.dirty();
2697 }
2698 return { status: status.value, value: merged.data };
2699 };
2700 if (ctx.common.async) {
2701 return Promise.all([
2702 this._def.left._parseAsync({
2703 data: ctx.data,
2704 path: ctx.path,
2705 parent: ctx
2706 }),
2707 this._def.right._parseAsync({
2708 data: ctx.data,
2709 path: ctx.path,
2710 parent: ctx
2711 })
2712 ]).then(([left, right]) => handleParsed(left, right));
2713 } else {
2714 return handleParsed(this._def.left._parseSync({
2715 data: ctx.data,
2716 path: ctx.path,
2717 parent: ctx
2718 }), this._def.right._parseSync({
2719 data: ctx.data,
2720 path: ctx.path,
2721 parent: ctx
2722 }));
2723 }
2724 }
2725};
2726ZodIntersection.create = (left, right, params) => {
2727 return new ZodIntersection({
2728 left,
2729 right,
2730 typeName: ZodFirstPartyTypeKind.ZodIntersection,
2731 ...processCreateParams(params)
2732 });
2733};
2734var ZodTuple = class extends ZodType {
2735 _parse(input) {
2736 const { status, ctx } = this._processInputParams(input);
2737 if (ctx.parsedType !== ZodParsedType.array) {
2738 addIssueToContext(ctx, {
2739 code: ZodIssueCode.invalid_type,
2740 expected: ZodParsedType.array,
2741 received: ctx.parsedType
2742 });
2743 return INVALID;
2744 }
2745 if (ctx.data.length < this._def.items.length) {
2746 addIssueToContext(ctx, {
2747 code: ZodIssueCode.too_small,
2748 minimum: this._def.items.length,
2749 inclusive: true,
2750 exact: false,
2751 type: "array"
2752 });
2753 return INVALID;
2754 }
2755 const rest = this._def.rest;
2756 if (!rest && ctx.data.length > this._def.items.length) {
2757 addIssueToContext(ctx, {
2758 code: ZodIssueCode.too_big,
2759 maximum: this._def.items.length,
2760 inclusive: true,
2761 exact: false,
2762 type: "array"
2763 });
2764 status.dirty();
2765 }
2766 const items = ctx.data.map((item, itemIndex) => {
2767 const schema = this._def.items[itemIndex] || this._def.rest;
2768 if (!schema)
2769 return null;
2770 return schema._parse(new ParseInputLazyPath(ctx, item, ctx.path, itemIndex));
2771 }).filter((x) => !!x);
2772 if (ctx.common.async) {
2773 return Promise.all(items).then((results) => {
2774 return ParseStatus.mergeArray(status, results);
2775 });
2776 } else {
2777 return ParseStatus.mergeArray(status, items);
2778 }
2779 }
2780 get items() {
2781 return this._def.items;
2782 }
2783 rest(rest) {
2784 return new ZodTuple({
2785 ...this._def,
2786 rest
2787 });
2788 }
2789};
2790ZodTuple.create = (schemas, params) => {
2791 if (!Array.isArray(schemas)) {
2792 throw new Error("You must pass an array of schemas to z.tuple([ ... ])");
2793 }
2794 return new ZodTuple({
2795 items: schemas,
2796 typeName: ZodFirstPartyTypeKind.ZodTuple,
2797 rest: null,
2798 ...processCreateParams(params)
2799 });
2800};
2801var ZodRecord = class extends ZodType {
2802 get keySchema() {
2803 return this._def.keyType;
2804 }
2805 get valueSchema() {
2806 return this._def.valueType;
2807 }
2808 _parse(input) {
2809 const { status, ctx } = this._processInputParams(input);
2810 if (ctx.parsedType !== ZodParsedType.object) {
2811 addIssueToContext(ctx, {
2812 code: ZodIssueCode.invalid_type,
2813 expected: ZodParsedType.object,
2814 received: ctx.parsedType
2815 });
2816 return INVALID;
2817 }
2818 const pairs = [];
2819 const keyType = this._def.keyType;
2820 const valueType = this._def.valueType;
2821 for (const key in ctx.data) {
2822 pairs.push({
2823 key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, key)),
2824 value: valueType._parse(new ParseInputLazyPath(ctx, ctx.data[key], ctx.path, key))
2825 });
2826 }
2827 if (ctx.common.async) {
2828 return ParseStatus.mergeObjectAsync(status, pairs);
2829 } else {
2830 return ParseStatus.mergeObjectSync(status, pairs);
2831 }
2832 }
2833 get element() {
2834 return this._def.valueType;
2835 }
2836 static create(first, second, third) {
2837 if (second instanceof ZodType) {
2838 return new ZodRecord({
2839 keyType: first,
2840 valueType: second,
2841 typeName: ZodFirstPartyTypeKind.ZodRecord,
2842 ...processCreateParams(third)
2843 });
2844 }
2845 return new ZodRecord({
2846 keyType: ZodString.create(),
2847 valueType: first,
2848 typeName: ZodFirstPartyTypeKind.ZodRecord,
2849 ...processCreateParams(second)
2850 });
2851 }
2852};
2853var ZodMap = class extends ZodType {
2854 _parse(input) {
2855 const { status, ctx } = this._processInputParams(input);
2856 if (ctx.parsedType !== ZodParsedType.map) {
2857 addIssueToContext(ctx, {
2858 code: ZodIssueCode.invalid_type,
2859 expected: ZodParsedType.map,
2860 received: ctx.parsedType
2861 });
2862 return INVALID;
2863 }
2864 const keyType = this._def.keyType;
2865 const valueType = this._def.valueType;
2866 const pairs = [...ctx.data.entries()].map(([key, value], index) => {
2867 return {
2868 key: keyType._parse(new ParseInputLazyPath(ctx, key, ctx.path, [index, "key"])),
2869 value: valueType._parse(new ParseInputLazyPath(ctx, value, ctx.path, [index, "value"]))
2870 };
2871 });
2872 if (ctx.common.async) {
2873 const finalMap = /* @__PURE__ */ new Map();
2874 return Promise.resolve().then(async () => {
2875 for (const pair of pairs) {
2876 const key = await pair.key;
2877 const value = await pair.value;
2878 if (key.status === "aborted" || value.status === "aborted") {
2879 return INVALID;
2880 }
2881 if (key.status === "dirty" || value.status === "dirty") {
2882 status.dirty();
2883 }
2884 finalMap.set(key.value, value.value);
2885 }
2886 return { status: status.value, value: finalMap };
2887 });
2888 } else {
2889 const finalMap = /* @__PURE__ */ new Map();
2890 for (const pair of pairs) {
2891 const key = pair.key;
2892 const value = pair.value;
2893 if (key.status === "aborted" || value.status === "aborted") {
2894 return INVALID;
2895 }
2896 if (key.status === "dirty" || value.status === "dirty") {
2897 status.dirty();
2898 }
2899 finalMap.set(key.value, value.value);
2900 }
2901 return { status: status.value, value: finalMap };
2902 }
2903 }
2904};
2905ZodMap.create = (keyType, valueType, params) => {
2906 return new ZodMap({
2907 valueType,
2908 keyType,
2909 typeName: ZodFirstPartyTypeKind.ZodMap,
2910 ...processCreateParams(params)
2911 });
2912};
2913var ZodSet = class extends ZodType {
2914 _parse(input) {
2915 const { status, ctx } = this._processInputParams(input);
2916 if (ctx.parsedType !== ZodParsedType.set) {
2917 addIssueToContext(ctx, {
2918 code: ZodIssueCode.invalid_type,
2919 expected: ZodParsedType.set,
2920 received: ctx.parsedType
2921 });
2922 return INVALID;
2923 }
2924 const def = this._def;
2925 if (def.minSize !== null) {
2926 if (ctx.data.size < def.minSize.value) {
2927 addIssueToContext(ctx, {
2928 code: ZodIssueCode.too_small,
2929 minimum: def.minSize.value,
2930 type: "set",
2931 inclusive: true,
2932 exact: false,
2933 message: def.minSize.message
2934 });
2935 status.dirty();
2936 }
2937 }
2938 if (def.maxSize !== null) {
2939 if (ctx.data.size > def.maxSize.value) {
2940 addIssueToContext(ctx, {
2941 code: ZodIssueCode.too_big,
2942 maximum: def.maxSize.value,
2943 type: "set",
2944 inclusive: true,
2945 exact: false,
2946 message: def.maxSize.message
2947 });
2948 status.dirty();
2949 }
2950 }
2951 const valueType = this._def.valueType;
2952 function finalizeSet(elements2) {
2953 const parsedSet = /* @__PURE__ */ new Set();
2954 for (const element of elements2) {
2955 if (element.status === "aborted")
2956 return INVALID;
2957 if (element.status === "dirty")
2958 status.dirty();
2959 parsedSet.add(element.value);
2960 }
2961 return { status: status.value, value: parsedSet };
2962 }
2963 const elements = [...ctx.data.values()].map((item, i) => valueType._parse(new ParseInputLazyPath(ctx, item, ctx.path, i)));
2964 if (ctx.common.async) {
2965 return Promise.all(elements).then((elements2) => finalizeSet(elements2));
2966 } else {
2967 return finalizeSet(elements);
2968 }
2969 }
2970 min(minSize, message) {
2971 return new ZodSet({
2972 ...this._def,
2973 minSize: { value: minSize, message: errorUtil.toString(message) }
2974 });
2975 }
2976 max(maxSize, message) {
2977 return new ZodSet({
2978 ...this._def,
2979 maxSize: { value: maxSize, message: errorUtil.toString(message) }
2980 });
2981 }
2982 size(size, message) {
2983 return this.min(size, message).max(size, message);
2984 }
2985 nonempty(message) {
2986 return this.min(1, message);
2987 }
2988};
2989ZodSet.create = (valueType, params) => {
2990 return new ZodSet({
2991 valueType,
2992 minSize: null,
2993 maxSize: null,
2994 typeName: ZodFirstPartyTypeKind.ZodSet,
2995 ...processCreateParams(params)
2996 });
2997};
2998var ZodFunction = class extends ZodType {
2999 constructor() {
3000 super(...arguments);
3001 this.validate = this.implement;
3002 }
3003 _parse(input) {
3004 const { ctx } = this._processInputParams(input);
3005 if (ctx.parsedType !== ZodParsedType.function) {
3006 addIssueToContext(ctx, {
3007 code: ZodIssueCode.invalid_type,
3008 expected: ZodParsedType.function,
3009 received: ctx.parsedType
3010 });
3011 return INVALID;
3012 }
3013 function makeArgsIssue(args, error) {
3014 return makeIssue({
3015 data: args,
3016 path: ctx.path,
3017 errorMaps: [
3018 ctx.common.contextualErrorMap,
3019 ctx.schemaErrorMap,
3020 getErrorMap(),
3021 errorMap
3022 ].filter((x) => !!x),
3023 issueData: {
3024 code: ZodIssueCode.invalid_arguments,
3025 argumentsError: error
3026 }
3027 });
3028 }
3029 function makeReturnsIssue(returns, error) {
3030 return makeIssue({
3031 data: returns,
3032 path: ctx.path,
3033 errorMaps: [
3034 ctx.common.contextualErrorMap,
3035 ctx.schemaErrorMap,
3036 getErrorMap(),
3037 errorMap
3038 ].filter((x) => !!x),
3039 issueData: {
3040 code: ZodIssueCode.invalid_return_type,
3041 returnTypeError: error
3042 }
3043 });
3044 }
3045 const params = { errorMap: ctx.common.contextualErrorMap };
3046 const fn = ctx.data;
3047 if (this._def.returns instanceof ZodPromise) {
3048 return OK(async (...args) => {
3049 const error = new ZodError([]);
3050 const parsedArgs = await this._def.args.parseAsync(args, params).catch((e) => {
3051 error.addIssue(makeArgsIssue(args, e));
3052 throw error;
3053 });
3054 const result = await fn(...parsedArgs);
3055 const parsedReturns = await this._def.returns._def.type.parseAsync(result, params).catch((e) => {
3056 error.addIssue(makeReturnsIssue(result, e));
3057 throw error;
3058 });
3059 return parsedReturns;
3060 });
3061 } else {
3062 return OK((...args) => {
3063 const parsedArgs = this._def.args.safeParse(args, params);
3064 if (!parsedArgs.success) {
3065 throw new ZodError([makeArgsIssue(args, parsedArgs.error)]);
3066 }
3067 const result = fn(...parsedArgs.data);
3068 const parsedReturns = this._def.returns.safeParse(result, params);
3069 if (!parsedReturns.success) {
3070 throw new ZodError([makeReturnsIssue(result, parsedReturns.error)]);
3071 }
3072 return parsedReturns.data;
3073 });
3074 }
3075 }
3076 parameters() {
3077 return this._def.args;
3078 }
3079 returnType() {
3080 return this._def.returns;
3081 }
3082 args(...items) {
3083 return new ZodFunction({
3084 ...this._def,
3085 args: ZodTuple.create(items).rest(ZodUnknown.create())
3086 });
3087 }
3088 returns(returnType) {
3089 return new ZodFunction({
3090 ...this._def,
3091 returns: returnType
3092 });
3093 }
3094 implement(func) {
3095 const validatedFunc = this.parse(func);
3096 return validatedFunc;
3097 }
3098 strictImplement(func) {
3099 const validatedFunc = this.parse(func);
3100 return validatedFunc;
3101 }
3102 static create(args, returns, params) {
3103 return new ZodFunction({
3104 args: args ? args : ZodTuple.create([]).rest(ZodUnknown.create()),
3105 returns: returns || ZodUnknown.create(),
3106 typeName: ZodFirstPartyTypeKind.ZodFunction,
3107 ...processCreateParams(params)
3108 });
3109 }
3110};
3111var ZodLazy = class extends ZodType {
3112 get schema() {
3113 return this._def.getter();
3114 }
3115 _parse(input) {
3116 const { ctx } = this._processInputParams(input);
3117 const lazySchema = this._def.getter();
3118 return lazySchema._parse({ data: ctx.data, path: ctx.path, parent: ctx });
3119 }
3120};
3121ZodLazy.create = (getter, params) => {
3122 return new ZodLazy({
3123 getter,
3124 typeName: ZodFirstPartyTypeKind.ZodLazy,
3125 ...processCreateParams(params)
3126 });
3127};
3128var ZodLiteral = class extends ZodType {
3129 _parse(input) {
3130 if (input.data !== this._def.value) {
3131 const ctx = this._getOrReturnCtx(input);
3132 addIssueToContext(ctx, {
3133 code: ZodIssueCode.invalid_literal,
3134 expected: this._def.value
3135 });
3136 return INVALID;
3137 }
3138 return { status: "valid", value: input.data };
3139 }
3140 get value() {
3141 return this._def.value;
3142 }
3143};
3144ZodLiteral.create = (value, params) => {
3145 return new ZodLiteral({
3146 value,
3147 typeName: ZodFirstPartyTypeKind.ZodLiteral,
3148 ...processCreateParams(params)
3149 });
3150};
3151function createZodEnum(values, params) {
3152 return new ZodEnum({
3153 values,
3154 typeName: ZodFirstPartyTypeKind.ZodEnum,
3155 ...processCreateParams(params)
3156 });
3157}
3158var ZodEnum = class extends ZodType {
3159 _parse(input) {
3160 if (typeof input.data !== "string") {
3161 const ctx = this._getOrReturnCtx(input);
3162 const expectedValues = this._def.values;
3163 addIssueToContext(ctx, {
3164 expected: util.joinValues(expectedValues),
3165 received: ctx.parsedType,
3166 code: ZodIssueCode.invalid_type
3167 });
3168 return INVALID;
3169 }
3170 if (this._def.values.indexOf(input.data) === -1) {
3171 const ctx = this._getOrReturnCtx(input);
3172 const expectedValues = this._def.values;
3173 addIssueToContext(ctx, {
3174 received: ctx.data,
3175 code: ZodIssueCode.invalid_enum_value,
3176 options: expectedValues
3177 });
3178 return INVALID;
3179 }
3180 return OK(input.data);
3181 }
3182 get options() {
3183 return this._def.values;
3184 }
3185 get enum() {
3186 const enumValues = {};
3187 for (const val of this._def.values) {
3188 enumValues[val] = val;
3189 }
3190 return enumValues;
3191 }
3192 get Values() {
3193 const enumValues = {};
3194 for (const val of this._def.values) {
3195 enumValues[val] = val;
3196 }
3197 return enumValues;
3198 }
3199 get Enum() {
3200 const enumValues = {};
3201 for (const val of this._def.values) {
3202 enumValues[val] = val;
3203 }
3204 return enumValues;
3205 }
3206};
3207ZodEnum.create = createZodEnum;
3208var ZodNativeEnum = class extends ZodType {
3209 _parse(input) {
3210 const nativeEnumValues = util.getValidEnumValues(this._def.values);
3211 const ctx = this._getOrReturnCtx(input);
3212 if (ctx.parsedType !== ZodParsedType.string && ctx.parsedType !== ZodParsedType.number) {
3213 const expectedValues = util.objectValues(nativeEnumValues);
3214 addIssueToContext(ctx, {
3215 expected: util.joinValues(expectedValues),
3216 received: ctx.parsedType,
3217 code: ZodIssueCode.invalid_type
3218 });
3219 return INVALID;
3220 }
3221 if (nativeEnumValues.indexOf(input.data) === -1) {
3222 const expectedValues = util.objectValues(nativeEnumValues);
3223 addIssueToContext(ctx, {
3224 received: ctx.data,
3225 code: ZodIssueCode.invalid_enum_value,
3226 options: expectedValues
3227 });
3228 return INVALID;
3229 }
3230 return OK(input.data);
3231 }
3232 get enum() {
3233 return this._def.values;
3234 }
3235};
3236ZodNativeEnum.create = (values, params) => {
3237 return new ZodNativeEnum({
3238 values,
3239 typeName: ZodFirstPartyTypeKind.ZodNativeEnum,
3240 ...processCreateParams(params)
3241 });
3242};
3243var ZodPromise = class extends ZodType {
3244 _parse(input) {
3245 const { ctx } = this._processInputParams(input);
3246 if (ctx.parsedType !== ZodParsedType.promise && ctx.common.async === false) {
3247 addIssueToContext(ctx, {
3248 code: ZodIssueCode.invalid_type,
3249 expected: ZodParsedType.promise,
3250 received: ctx.parsedType
3251 });
3252 return INVALID;
3253 }
3254 const promisified = ctx.parsedType === ZodParsedType.promise ? ctx.data : Promise.resolve(ctx.data);
3255 return OK(promisified.then((data) => {
3256 return this._def.type.parseAsync(data, {
3257 path: ctx.path,
3258 errorMap: ctx.common.contextualErrorMap
3259 });
3260 }));
3261 }
3262};
3263ZodPromise.create = (schema, params) => {
3264 return new ZodPromise({
3265 type: schema,
3266 typeName: ZodFirstPartyTypeKind.ZodPromise,
3267 ...processCreateParams(params)
3268 });
3269};
3270var ZodEffects = class extends ZodType {
3271 innerType() {
3272 return this._def.schema;
3273 }
3274 sourceType() {
3275 return this._def.schema._def.typeName === ZodFirstPartyTypeKind.ZodEffects ? this._def.schema.sourceType() : this._def.schema;
3276 }
3277 _parse(input) {
3278 const { status, ctx } = this._processInputParams(input);
3279 const effect = this._def.effect || null;
3280 if (effect.type === "preprocess") {
3281 const processed = effect.transform(ctx.data);
3282 if (ctx.common.async) {
3283 return Promise.resolve(processed).then((processed2) => {
3284 return this._def.schema._parseAsync({
3285 data: processed2,
3286 path: ctx.path,
3287 parent: ctx
3288 });
3289 });
3290 } else {
3291 return this._def.schema._parseSync({
3292 data: processed,
3293 path: ctx.path,
3294 parent: ctx
3295 });
3296 }
3297 }
3298 const checkCtx = {
3299 addIssue: (arg) => {
3300 addIssueToContext(ctx, arg);
3301 if (arg.fatal) {
3302 status.abort();
3303 } else {
3304 status.dirty();
3305 }
3306 },
3307 get path() {
3308 return ctx.path;
3309 }
3310 };
3311 checkCtx.addIssue = checkCtx.addIssue.bind(checkCtx);
3312 if (effect.type === "refinement") {
3313 const executeRefinement = (acc) => {
3314 const result = effect.refinement(acc, checkCtx);
3315 if (ctx.common.async) {
3316 return Promise.resolve(result);
3317 }
3318 if (result instanceof Promise) {
3319 throw new Error("Async refinement encountered during synchronous parse operation. Use .parseAsync instead.");
3320 }
3321 return acc;
3322 };
3323 if (ctx.common.async === false) {
3324 const inner = this._def.schema._parseSync({
3325 data: ctx.data,
3326 path: ctx.path,
3327 parent: ctx
3328 });
3329 if (inner.status === "aborted")
3330 return INVALID;
3331 if (inner.status === "dirty")
3332 status.dirty();
3333 executeRefinement(inner.value);
3334 return { status: status.value, value: inner.value };
3335 } else {
3336 return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((inner) => {
3337 if (inner.status === "aborted")
3338 return INVALID;
3339 if (inner.status === "dirty")
3340 status.dirty();
3341 return executeRefinement(inner.value).then(() => {
3342 return { status: status.value, value: inner.value };
3343 });
3344 });
3345 }
3346 }
3347 if (effect.type === "transform") {
3348 if (ctx.common.async === false) {
3349 const base = this._def.schema._parseSync({
3350 data: ctx.data,
3351 path: ctx.path,
3352 parent: ctx
3353 });
3354 if (!isValid(base))
3355 return base;
3356 const result = effect.transform(base.value, checkCtx);
3357 if (result instanceof Promise) {
3358 throw new Error(`Asynchronous transform encountered during synchronous parse operation. Use .parseAsync instead.`);
3359 }
3360 return { status: status.value, value: result };
3361 } else {
3362 return this._def.schema._parseAsync({ data: ctx.data, path: ctx.path, parent: ctx }).then((base) => {
3363 if (!isValid(base))
3364 return base;
3365 return Promise.resolve(effect.transform(base.value, checkCtx)).then((result) => ({ status: status.value, value: result }));
3366 });
3367 }
3368 }
3369 util.assertNever(effect);
3370 }
3371};
3372ZodEffects.create = (schema, effect, params) => {
3373 return new ZodEffects({
3374 schema,
3375 typeName: ZodFirstPartyTypeKind.ZodEffects,
3376 effect,
3377 ...processCreateParams(params)
3378 });
3379};
3380ZodEffects.createWithPreprocess = (preprocess, schema, params) => {
3381 return new ZodEffects({
3382 schema,
3383 effect: { type: "preprocess", transform: preprocess },
3384 typeName: ZodFirstPartyTypeKind.ZodEffects,
3385 ...processCreateParams(params)
3386 });
3387};
3388var ZodOptional = class extends ZodType {
3389 _parse(input) {
3390 const parsedType = this._getType(input);
3391 if (parsedType === ZodParsedType.undefined) {
3392 return OK(void 0);
3393 }
3394 return this._def.innerType._parse(input);
3395 }
3396 unwrap() {
3397 return this._def.innerType;
3398 }
3399};
3400ZodOptional.create = (type, params) => {
3401 return new ZodOptional({
3402 innerType: type,
3403 typeName: ZodFirstPartyTypeKind.ZodOptional,
3404 ...processCreateParams(params)
3405 });
3406};
3407var ZodNullable = class extends ZodType {
3408 _parse(input) {
3409 const parsedType = this._getType(input);
3410 if (parsedType === ZodParsedType.null) {
3411 return OK(null);
3412 }
3413 return this._def.innerType._parse(input);
3414 }
3415 unwrap() {
3416 return this._def.innerType;
3417 }
3418};
3419ZodNullable.create = (type, params) => {
3420 return new ZodNullable({
3421 innerType: type,
3422 typeName: ZodFirstPartyTypeKind.ZodNullable,
3423 ...processCreateParams(params)
3424 });
3425};
3426var ZodDefault = class extends ZodType {
3427 _parse(input) {
3428 const { ctx } = this._processInputParams(input);
3429 let data = ctx.data;
3430 if (ctx.parsedType === ZodParsedType.undefined) {
3431 data = this._def.defaultValue();
3432 }
3433 return this._def.innerType._parse({
3434 data,
3435 path: ctx.path,
3436 parent: ctx
3437 });
3438 }
3439 removeDefault() {
3440 return this._def.innerType;
3441 }
3442};
3443ZodDefault.create = (type, params) => {
3444 return new ZodDefault({
3445 innerType: type,
3446 typeName: ZodFirstPartyTypeKind.ZodDefault,
3447 defaultValue: typeof params.default === "function" ? params.default : () => params.default,
3448 ...processCreateParams(params)
3449 });
3450};
3451var ZodCatch = class extends ZodType {
3452 _parse(input) {
3453 const { ctx } = this._processInputParams(input);
3454 const result = this._def.innerType._parse({
3455 data: ctx.data,
3456 path: ctx.path,
3457 parent: ctx
3458 });
3459 if (isAsync(result)) {
3460 return result.then((result2) => {
3461 return {
3462 status: "valid",
3463 value: result2.status === "valid" ? result2.value : this._def.defaultValue()
3464 };
3465 });
3466 } else {
3467 return {
3468 status: "valid",
3469 value: result.status === "valid" ? result.value : this._def.defaultValue()
3470 };
3471 }
3472 }
3473 removeDefault() {
3474 return this._def.innerType;
3475 }
3476};
3477ZodCatch.create = (type, params) => {
3478 return new ZodCatch({
3479 innerType: type,
3480 typeName: ZodFirstPartyTypeKind.ZodCatch,
3481 defaultValue: typeof params.default === "function" ? params.default : () => params.default,
3482 ...processCreateParams(params)
3483 });
3484};
3485var ZodNaN = class extends ZodType {
3486 _parse(input) {
3487 const parsedType = this._getType(input);
3488 if (parsedType !== ZodParsedType.nan) {
3489 const ctx = this._getOrReturnCtx(input);
3490 addIssueToContext(ctx, {
3491 code: ZodIssueCode.invalid_type,
3492 expected: ZodParsedType.nan,
3493 received: ctx.parsedType
3494 });
3495 return INVALID;
3496 }
3497 return { status: "valid", value: input.data };
3498 }
3499};
3500ZodNaN.create = (params) => {
3501 return new ZodNaN({
3502 typeName: ZodFirstPartyTypeKind.ZodNaN,
3503 ...processCreateParams(params)
3504 });
3505};
3506var BRAND = Symbol("zod_brand");
3507var ZodBranded = class extends ZodType {
3508 _parse(input) {
3509 const { ctx } = this._processInputParams(input);
3510 const data = ctx.data;
3511 return this._def.type._parse({
3512 data,
3513 path: ctx.path,
3514 parent: ctx
3515 });
3516 }
3517 unwrap() {
3518 return this._def.type;
3519 }
3520};
3521var ZodPipeline = class extends ZodType {
3522 _parse(input) {
3523 const { status, ctx } = this._processInputParams(input);
3524 if (ctx.common.async) {
3525 const handleAsync = async () => {
3526 const inResult = await this._def.in._parseAsync({
3527 data: ctx.data,
3528 path: ctx.path,
3529 parent: ctx
3530 });
3531 if (inResult.status === "aborted")
3532 return INVALID;
3533 if (inResult.status === "dirty") {
3534 status.dirty();
3535 return DIRTY(inResult.value);
3536 } else {
3537 return this._def.out._parseAsync({
3538 data: inResult.value,
3539 path: ctx.path,
3540 parent: ctx
3541 });
3542 }
3543 };
3544 return handleAsync();
3545 } else {
3546 const inResult = this._def.in._parseSync({
3547 data: ctx.data,
3548 path: ctx.path,
3549 parent: ctx
3550 });
3551 if (inResult.status === "aborted")
3552 return INVALID;
3553 if (inResult.status === "dirty") {
3554 status.dirty();
3555 return {
3556 status: "dirty",
3557 value: inResult.value
3558 };
3559 } else {
3560 return this._def.out._parseSync({
3561 data: inResult.value,
3562 path: ctx.path,
3563 parent: ctx
3564 });
3565 }
3566 }
3567 }
3568 static create(a, b) {
3569 return new ZodPipeline({
3570 in: a,
3571 out: b,
3572 typeName: ZodFirstPartyTypeKind.ZodPipeline
3573 });
3574 }
3575};
3576var custom = (check, params = {}, fatal) => {
3577 if (check)
3578 return ZodAny.create().superRefine((data, ctx) => {
3579 if (!check(data)) {
3580 const p = typeof params === "function" ? params(data) : params;
3581 const p2 = typeof p === "string" ? { message: p } : p;
3582 ctx.addIssue({ code: "custom", ...p2, fatal });
3583 }
3584 });
3585 return ZodAny.create();
3586};
3587var late = {
3588 object: ZodObject.lazycreate
3589};
3590var ZodFirstPartyTypeKind;
3591(function(ZodFirstPartyTypeKind2) {
3592 ZodFirstPartyTypeKind2["ZodString"] = "ZodString";
3593 ZodFirstPartyTypeKind2["ZodNumber"] = "ZodNumber";
3594 ZodFirstPartyTypeKind2["ZodNaN"] = "ZodNaN";
3595 ZodFirstPartyTypeKind2["ZodBigInt"] = "ZodBigInt";
3596 ZodFirstPartyTypeKind2["ZodBoolean"] = "ZodBoolean";
3597 ZodFirstPartyTypeKind2["ZodDate"] = "ZodDate";
3598 ZodFirstPartyTypeKind2["ZodSymbol"] = "ZodSymbol";
3599 ZodFirstPartyTypeKind2["ZodUndefined"] = "ZodUndefined";
3600 ZodFirstPartyTypeKind2["ZodNull"] = "ZodNull";
3601 ZodFirstPartyTypeKind2["ZodAny"] = "ZodAny";
3602 ZodFirstPartyTypeKind2["ZodUnknown"] = "ZodUnknown";
3603 ZodFirstPartyTypeKind2["ZodNever"] = "ZodNever";
3604 ZodFirstPartyTypeKind2["ZodVoid"] = "ZodVoid";
3605 ZodFirstPartyTypeKind2["ZodArray"] = "ZodArray";
3606 ZodFirstPartyTypeKind2["ZodObject"] = "ZodObject";
3607 ZodFirstPartyTypeKind2["ZodUnion"] = "ZodUnion";
3608 ZodFirstPartyTypeKind2["ZodDiscriminatedUnion"] = "ZodDiscriminatedUnion";
3609 ZodFirstPartyTypeKind2["ZodIntersection"] = "ZodIntersection";
3610 ZodFirstPartyTypeKind2["ZodTuple"] = "ZodTuple";
3611 ZodFirstPartyTypeKind2["ZodRecord"] = "ZodRecord";
3612 ZodFirstPartyTypeKind2["ZodMap"] = "ZodMap";
3613 ZodFirstPartyTypeKind2["ZodSet"] = "ZodSet";
3614 ZodFirstPartyTypeKind2["ZodFunction"] = "ZodFunction";
3615 ZodFirstPartyTypeKind2["ZodLazy"] = "ZodLazy";
3616 ZodFirstPartyTypeKind2["ZodLiteral"] = "ZodLiteral";
3617 ZodFirstPartyTypeKind2["ZodEnum"] = "ZodEnum";
3618 ZodFirstPartyTypeKind2["ZodEffects"] = "ZodEffects";
3619 ZodFirstPartyTypeKind2["ZodNativeEnum"] = "ZodNativeEnum";
3620 ZodFirstPartyTypeKind2["ZodOptional"] = "ZodOptional";
3621 ZodFirstPartyTypeKind2["ZodNullable"] = "ZodNullable";
3622 ZodFirstPartyTypeKind2["ZodDefault"] = "ZodDefault";
3623 ZodFirstPartyTypeKind2["ZodCatch"] = "ZodCatch";
3624 ZodFirstPartyTypeKind2["ZodPromise"] = "ZodPromise";
3625 ZodFirstPartyTypeKind2["ZodBranded"] = "ZodBranded";
3626 ZodFirstPartyTypeKind2["ZodPipeline"] = "ZodPipeline";
3627})(ZodFirstPartyTypeKind || (ZodFirstPartyTypeKind = {}));
3628var instanceOfType = (cls, params = {
3629 message: `Input not instance of ${cls.name}`
3630}) => custom((data) => data instanceof cls, params, true);
3631var stringType = ZodString.create;
3632var numberType = ZodNumber.create;
3633var nanType = ZodNaN.create;
3634var bigIntType = ZodBigInt.create;
3635var booleanType = ZodBoolean.create;
3636var dateType = ZodDate.create;
3637var symbolType = ZodSymbol.create;
3638var undefinedType = ZodUndefined.create;
3639var nullType = ZodNull.create;
3640var anyType = ZodAny.create;
3641var unknownType = ZodUnknown.create;
3642var neverType = ZodNever.create;
3643var voidType = ZodVoid.create;
3644var arrayType = ZodArray.create;
3645var objectType = ZodObject.create;
3646var strictObjectType = ZodObject.strictCreate;
3647var unionType = ZodUnion.create;
3648var discriminatedUnionType = ZodDiscriminatedUnion.create;
3649var intersectionType = ZodIntersection.create;
3650var tupleType = ZodTuple.create;
3651var recordType = ZodRecord.create;
3652var mapType = ZodMap.create;
3653var setType = ZodSet.create;
3654var functionType = ZodFunction.create;
3655var lazyType = ZodLazy.create;
3656var literalType = ZodLiteral.create;
3657var enumType = ZodEnum.create;
3658var nativeEnumType = ZodNativeEnum.create;
3659var promiseType = ZodPromise.create;
3660var effectsType = ZodEffects.create;
3661var optionalType = ZodOptional.create;
3662var nullableType = ZodNullable.create;
3663var preprocessType = ZodEffects.createWithPreprocess;
3664var pipelineType = ZodPipeline.create;
3665var ostring = () => stringType().optional();
3666var onumber = () => numberType().optional();
3667var oboolean = () => booleanType().optional();
3668var coerce = {
3669 string: (arg) => ZodString.create({ ...arg, coerce: true }),
3670 number: (arg) => ZodNumber.create({ ...arg, coerce: true }),
3671 boolean: (arg) => ZodBoolean.create({ ...arg, coerce: true }),
3672 bigint: (arg) => ZodBigInt.create({ ...arg, coerce: true }),
3673 date: (arg) => ZodDate.create({ ...arg, coerce: true })
3674};
3675var NEVER = INVALID;
3676var mod = /* @__PURE__ */ Object.freeze({
3677 __proto__: null,
3678 defaultErrorMap: errorMap,
3679 setErrorMap,
3680 getErrorMap,
3681 makeIssue,
3682 EMPTY_PATH,
3683 addIssueToContext,
3684 ParseStatus,
3685 INVALID,
3686 DIRTY,
3687 OK,
3688 isAborted,
3689 isDirty,
3690 isValid,
3691 isAsync,
3692 get util() {
3693 return util;
3694 },
3695 ZodParsedType,
3696 getParsedType,
3697 ZodType,
3698 ZodString,
3699 ZodNumber,
3700 ZodBigInt,
3701 ZodBoolean,
3702 ZodDate,
3703 ZodSymbol,
3704 ZodUndefined,
3705 ZodNull,
3706 ZodAny,
3707 ZodUnknown,
3708 ZodNever,
3709 ZodVoid,
3710 ZodArray,
3711 get objectUtil() {
3712 return objectUtil;
3713 },
3714 ZodObject,
3715 ZodUnion,
3716 ZodDiscriminatedUnion,
3717 ZodIntersection,
3718 ZodTuple,
3719 ZodRecord,
3720 ZodMap,
3721 ZodSet,
3722 ZodFunction,
3723 ZodLazy,
3724 ZodLiteral,
3725 ZodEnum,
3726 ZodNativeEnum,
3727 ZodPromise,
3728 ZodEffects,
3729 ZodTransformer: ZodEffects,
3730 ZodOptional,
3731 ZodNullable,
3732 ZodDefault,
3733 ZodCatch,
3734 ZodNaN,
3735 BRAND,
3736 ZodBranded,
3737 ZodPipeline,
3738 custom,
3739 Schema: ZodType,
3740 ZodSchema: ZodType,
3741 late,
3742 get ZodFirstPartyTypeKind() {
3743 return ZodFirstPartyTypeKind;
3744 },
3745 coerce,
3746 any: anyType,
3747 array: arrayType,
3748 bigint: bigIntType,
3749 boolean: booleanType,
3750 date: dateType,
3751 discriminatedUnion: discriminatedUnionType,
3752 effect: effectsType,
3753 "enum": enumType,
3754 "function": functionType,
3755 "instanceof": instanceOfType,
3756 intersection: intersectionType,
3757 lazy: lazyType,
3758 literal: literalType,
3759 map: mapType,
3760 nan: nanType,
3761 nativeEnum: nativeEnumType,
3762 never: neverType,
3763 "null": nullType,
3764 nullable: nullableType,
3765 number: numberType,
3766 object: objectType,
3767 oboolean,
3768 onumber,
3769 optional: optionalType,
3770 ostring,
3771 pipeline: pipelineType,
3772 preprocess: preprocessType,
3773 promise: promiseType,
3774 record: recordType,
3775 set: setType,
3776 strictObject: strictObjectType,
3777 string: stringType,
3778 symbol: symbolType,
3779 transformer: effectsType,
3780 tuple: tupleType,
3781 "undefined": undefinedType,
3782 union: unionType,
3783 unknown: unknownType,
3784 "void": voidType,
3785 NEVER,
3786 ZodIssueCode,
3787 quotelessJson,
3788 ZodError
3789});
3790
3791// ../../node_modules/.pnpm/zod-validation-error@0.3.0_zod@3.20.2/node_modules/zod-validation-error/dist/esm/utils/joinPath.js
3792function joinPath(arr) {
3793 return arr.reduce((acc, value) => {
3794 if (typeof value === "number") {
3795 return acc + "[" + value + "]";
3796 }
3797 const separator = acc === "" ? "" : ".";
3798 return acc + separator + value;
3799 }, "");
3800}
3801
3802// ../../node_modules/.pnpm/zod-validation-error@0.3.0_zod@3.20.2/node_modules/zod-validation-error/dist/esm/ValidationError.js
3803var ValidationError = class extends Error {
3804 constructor(message, options) {
3805 super(message);
3806 __publicField(this, "details");
3807 __publicField(this, "type");
3808 this.details = options.details;
3809 this.type = "ZodValidationError";
3810 }
3811};
3812function fromZodError(zodError, options = {}) {
3813 const { maxIssuesInMessage = 99, issueSeparator = "; ", prefixSeparator = ": ", prefix = "Validation error" } = options;
3814 const reason = zodError.errors.slice(0, maxIssuesInMessage).map((issue) => {
3815 const { message: message2, path } = issue;
3816 if (path.length > 0) {
3817 return `${message2} at "${joinPath(path)}"`;
3818 }
3819 return message2;
3820 }).join(issueSeparator);
3821 const message = reason ? [prefix, reason].join(prefixSeparator) : prefix;
3822 return new ValidationError(message, {
3823 details: zodError.errors
3824 });
3825}
3826
3827// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/errors.js
3828var LuxonError = class extends Error {
3829};
3830var InvalidDateTimeError = class extends LuxonError {
3831 constructor(reason) {
3832 super(`Invalid DateTime: ${reason.toMessage()}`);
3833 }
3834};
3835var InvalidIntervalError = class extends LuxonError {
3836 constructor(reason) {
3837 super(`Invalid Interval: ${reason.toMessage()}`);
3838 }
3839};
3840var InvalidDurationError = class extends LuxonError {
3841 constructor(reason) {
3842 super(`Invalid Duration: ${reason.toMessage()}`);
3843 }
3844};
3845var ConflictingSpecificationError = class extends LuxonError {
3846};
3847var InvalidUnitError = class extends LuxonError {
3848 constructor(unit) {
3849 super(`Invalid unit ${unit}`);
3850 }
3851};
3852var InvalidArgumentError = class extends LuxonError {
3853};
3854var ZoneIsAbstractError = class extends LuxonError {
3855 constructor() {
3856 super("Zone is an abstract class");
3857 }
3858};
3859
3860// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/formats.js
3861var n = "numeric";
3862var s = "short";
3863var l = "long";
3864var DATE_SHORT = {
3865 year: n,
3866 month: n,
3867 day: n
3868};
3869var DATE_MED = {
3870 year: n,
3871 month: s,
3872 day: n
3873};
3874var DATE_MED_WITH_WEEKDAY = {
3875 year: n,
3876 month: s,
3877 day: n,
3878 weekday: s
3879};
3880var DATE_FULL = {
3881 year: n,
3882 month: l,
3883 day: n
3884};
3885var DATE_HUGE = {
3886 year: n,
3887 month: l,
3888 day: n,
3889 weekday: l
3890};
3891var TIME_SIMPLE = {
3892 hour: n,
3893 minute: n
3894};
3895var TIME_WITH_SECONDS = {
3896 hour: n,
3897 minute: n,
3898 second: n
3899};
3900var TIME_WITH_SHORT_OFFSET = {
3901 hour: n,
3902 minute: n,
3903 second: n,
3904 timeZoneName: s
3905};
3906var TIME_WITH_LONG_OFFSET = {
3907 hour: n,
3908 minute: n,
3909 second: n,
3910 timeZoneName: l
3911};
3912var TIME_24_SIMPLE = {
3913 hour: n,
3914 minute: n,
3915 hourCycle: "h23"
3916};
3917var TIME_24_WITH_SECONDS = {
3918 hour: n,
3919 minute: n,
3920 second: n,
3921 hourCycle: "h23"
3922};
3923var TIME_24_WITH_SHORT_OFFSET = {
3924 hour: n,
3925 minute: n,
3926 second: n,
3927 hourCycle: "h23",
3928 timeZoneName: s
3929};
3930var TIME_24_WITH_LONG_OFFSET = {
3931 hour: n,
3932 minute: n,
3933 second: n,
3934 hourCycle: "h23",
3935 timeZoneName: l
3936};
3937var DATETIME_SHORT = {
3938 year: n,
3939 month: n,
3940 day: n,
3941 hour: n,
3942 minute: n
3943};
3944var DATETIME_SHORT_WITH_SECONDS = {
3945 year: n,
3946 month: n,
3947 day: n,
3948 hour: n,
3949 minute: n,
3950 second: n
3951};
3952var DATETIME_MED = {
3953 year: n,
3954 month: s,
3955 day: n,
3956 hour: n,
3957 minute: n
3958};
3959var DATETIME_MED_WITH_SECONDS = {
3960 year: n,
3961 month: s,
3962 day: n,
3963 hour: n,
3964 minute: n,
3965 second: n
3966};
3967var DATETIME_MED_WITH_WEEKDAY = {
3968 year: n,
3969 month: s,
3970 day: n,
3971 weekday: s,
3972 hour: n,
3973 minute: n
3974};
3975var DATETIME_FULL = {
3976 year: n,
3977 month: l,
3978 day: n,
3979 hour: n,
3980 minute: n,
3981 timeZoneName: s
3982};
3983var DATETIME_FULL_WITH_SECONDS = {
3984 year: n,
3985 month: l,
3986 day: n,
3987 hour: n,
3988 minute: n,
3989 second: n,
3990 timeZoneName: s
3991};
3992var DATETIME_HUGE = {
3993 year: n,
3994 month: l,
3995 day: n,
3996 weekday: l,
3997 hour: n,
3998 minute: n,
3999 timeZoneName: l
4000};
4001var DATETIME_HUGE_WITH_SECONDS = {
4002 year: n,
4003 month: l,
4004 day: n,
4005 weekday: l,
4006 hour: n,
4007 minute: n,
4008 second: n,
4009 timeZoneName: l
4010};
4011
4012// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/zone.js
4013var Zone = class {
4014 get type() {
4015 throw new ZoneIsAbstractError();
4016 }
4017 get name() {
4018 throw new ZoneIsAbstractError();
4019 }
4020 get ianaName() {
4021 return this.name;
4022 }
4023 get isUniversal() {
4024 throw new ZoneIsAbstractError();
4025 }
4026 offsetName(ts, opts) {
4027 throw new ZoneIsAbstractError();
4028 }
4029 formatOffset(ts, format) {
4030 throw new ZoneIsAbstractError();
4031 }
4032 offset(ts) {
4033 throw new ZoneIsAbstractError();
4034 }
4035 equals(otherZone) {
4036 throw new ZoneIsAbstractError();
4037 }
4038 get isValid() {
4039 throw new ZoneIsAbstractError();
4040 }
4041};
4042
4043// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/zones/systemZone.js
4044var singleton = null;
4045var SystemZone = class extends Zone {
4046 static get instance() {
4047 if (singleton === null) {
4048 singleton = new SystemZone();
4049 }
4050 return singleton;
4051 }
4052 get type() {
4053 return "system";
4054 }
4055 get name() {
4056 return new Intl.DateTimeFormat().resolvedOptions().timeZone;
4057 }
4058 get isUniversal() {
4059 return false;
4060 }
4061 offsetName(ts, { format, locale }) {
4062 return parseZoneInfo(ts, format, locale);
4063 }
4064 formatOffset(ts, format) {
4065 return formatOffset(this.offset(ts), format);
4066 }
4067 offset(ts) {
4068 return -new Date(ts).getTimezoneOffset();
4069 }
4070 equals(otherZone) {
4071 return otherZone.type === "system";
4072 }
4073 get isValid() {
4074 return true;
4075 }
4076};
4077
4078// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/zones/IANAZone.js
4079var dtfCache = {};
4080function makeDTF(zone) {
4081 if (!dtfCache[zone]) {
4082 dtfCache[zone] = new Intl.DateTimeFormat("en-US", {
4083 hour12: false,
4084 timeZone: zone,
4085 year: "numeric",
4086 month: "2-digit",
4087 day: "2-digit",
4088 hour: "2-digit",
4089 minute: "2-digit",
4090 second: "2-digit",
4091 era: "short"
4092 });
4093 }
4094 return dtfCache[zone];
4095}
4096var typeToPos = {
4097 year: 0,
4098 month: 1,
4099 day: 2,
4100 era: 3,
4101 hour: 4,
4102 minute: 5,
4103 second: 6
4104};
4105function hackyOffset(dtf, date) {
4106 const formatted = dtf.format(date).replace(/\u200E/g, ""), parsed = /(\d+)\/(\d+)\/(\d+) (AD|BC),? (\d+):(\d+):(\d+)/.exec(formatted), [, fMonth, fDay, fYear, fadOrBc, fHour, fMinute, fSecond] = parsed;
4107 return [fYear, fMonth, fDay, fadOrBc, fHour, fMinute, fSecond];
4108}
4109function partsOffset(dtf, date) {
4110 const formatted = dtf.formatToParts(date);
4111 const filled = [];
4112 for (let i = 0; i < formatted.length; i++) {
4113 const { type, value } = formatted[i];
4114 const pos = typeToPos[type];
4115 if (type === "era") {
4116 filled[pos] = value;
4117 } else if (!isUndefined(pos)) {
4118 filled[pos] = parseInt(value, 10);
4119 }
4120 }
4121 return filled;
4122}
4123var ianaZoneCache = {};
4124var IANAZone = class extends Zone {
4125 static create(name) {
4126 if (!ianaZoneCache[name]) {
4127 ianaZoneCache[name] = new IANAZone(name);
4128 }
4129 return ianaZoneCache[name];
4130 }
4131 static resetCache() {
4132 ianaZoneCache = {};
4133 dtfCache = {};
4134 }
4135 static isValidSpecifier(s2) {
4136 return this.isValidZone(s2);
4137 }
4138 static isValidZone(zone) {
4139 if (!zone) {
4140 return false;
4141 }
4142 try {
4143 new Intl.DateTimeFormat("en-US", { timeZone: zone }).format();
4144 return true;
4145 } catch (e) {
4146 return false;
4147 }
4148 }
4149 constructor(name) {
4150 super();
4151 this.zoneName = name;
4152 this.valid = IANAZone.isValidZone(name);
4153 }
4154 get type() {
4155 return "iana";
4156 }
4157 get name() {
4158 return this.zoneName;
4159 }
4160 get isUniversal() {
4161 return false;
4162 }
4163 offsetName(ts, { format, locale }) {
4164 return parseZoneInfo(ts, format, locale, this.name);
4165 }
4166 formatOffset(ts, format) {
4167 return formatOffset(this.offset(ts), format);
4168 }
4169 offset(ts) {
4170 const date = new Date(ts);
4171 if (isNaN(date))
4172 return NaN;
4173 const dtf = makeDTF(this.name);
4174 let [year, month, day, adOrBc, hour, minute, second] = dtf.formatToParts ? partsOffset(dtf, date) : hackyOffset(dtf, date);
4175 if (adOrBc === "BC") {
4176 year = -Math.abs(year) + 1;
4177 }
4178 const adjustedHour = hour === 24 ? 0 : hour;
4179 const asUTC = objToLocalTS({
4180 year,
4181 month,
4182 day,
4183 hour: adjustedHour,
4184 minute,
4185 second,
4186 millisecond: 0
4187 });
4188 let asTS = +date;
4189 const over = asTS % 1e3;
4190 asTS -= over >= 0 ? over : 1e3 + over;
4191 return (asUTC - asTS) / (60 * 1e3);
4192 }
4193 equals(otherZone) {
4194 return otherZone.type === "iana" && otherZone.name === this.name;
4195 }
4196 get isValid() {
4197 return this.valid;
4198 }
4199};
4200
4201// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/locale.js
4202var intlLFCache = {};
4203function getCachedLF(locString, opts = {}) {
4204 const key = JSON.stringify([locString, opts]);
4205 let dtf = intlLFCache[key];
4206 if (!dtf) {
4207 dtf = new Intl.ListFormat(locString, opts);
4208 intlLFCache[key] = dtf;
4209 }
4210 return dtf;
4211}
4212var intlDTCache = {};
4213function getCachedDTF(locString, opts = {}) {
4214 const key = JSON.stringify([locString, opts]);
4215 let dtf = intlDTCache[key];
4216 if (!dtf) {
4217 dtf = new Intl.DateTimeFormat(locString, opts);
4218 intlDTCache[key] = dtf;
4219 }
4220 return dtf;
4221}
4222var intlNumCache = {};
4223function getCachedINF(locString, opts = {}) {
4224 const key = JSON.stringify([locString, opts]);
4225 let inf = intlNumCache[key];
4226 if (!inf) {
4227 inf = new Intl.NumberFormat(locString, opts);
4228 intlNumCache[key] = inf;
4229 }
4230 return inf;
4231}
4232var intlRelCache = {};
4233function getCachedRTF(locString, opts = {}) {
4234 const { base, ...cacheKeyOpts } = opts;
4235 const key = JSON.stringify([locString, cacheKeyOpts]);
4236 let inf = intlRelCache[key];
4237 if (!inf) {
4238 inf = new Intl.RelativeTimeFormat(locString, opts);
4239 intlRelCache[key] = inf;
4240 }
4241 return inf;
4242}
4243var sysLocaleCache = null;
4244function systemLocale() {
4245 if (sysLocaleCache) {
4246 return sysLocaleCache;
4247 } else {
4248 sysLocaleCache = new Intl.DateTimeFormat().resolvedOptions().locale;
4249 return sysLocaleCache;
4250 }
4251}
4252function parseLocaleString(localeStr) {
4253 const xIndex = localeStr.indexOf("-x-");
4254 if (xIndex !== -1) {
4255 localeStr = localeStr.substring(0, xIndex);
4256 }
4257 const uIndex = localeStr.indexOf("-u-");
4258 if (uIndex === -1) {
4259 return [localeStr];
4260 } else {
4261 let options;
4262 let selectedStr;
4263 try {
4264 options = getCachedDTF(localeStr).resolvedOptions();
4265 selectedStr = localeStr;
4266 } catch (e) {
4267 const smaller = localeStr.substring(0, uIndex);
4268 options = getCachedDTF(smaller).resolvedOptions();
4269 selectedStr = smaller;
4270 }
4271 const { numberingSystem, calendar } = options;
4272 return [selectedStr, numberingSystem, calendar];
4273 }
4274}
4275function intlConfigString(localeStr, numberingSystem, outputCalendar) {
4276 if (outputCalendar || numberingSystem) {
4277 if (!localeStr.includes("-u-")) {
4278 localeStr += "-u";
4279 }
4280 if (outputCalendar) {
4281 localeStr += `-ca-${outputCalendar}`;
4282 }
4283 if (numberingSystem) {
4284 localeStr += `-nu-${numberingSystem}`;
4285 }
4286 return localeStr;
4287 } else {
4288 return localeStr;
4289 }
4290}
4291function mapMonths(f) {
4292 const ms = [];
4293 for (let i = 1; i <= 12; i++) {
4294 const dt = DateTime.utc(2016, i, 1);
4295 ms.push(f(dt));
4296 }
4297 return ms;
4298}
4299function mapWeekdays(f) {
4300 const ms = [];
4301 for (let i = 1; i <= 7; i++) {
4302 const dt = DateTime.utc(2016, 11, 13 + i);
4303 ms.push(f(dt));
4304 }
4305 return ms;
4306}
4307function listStuff(loc, length, defaultOK, englishFn, intlFn) {
4308 const mode = loc.listingMode(defaultOK);
4309 if (mode === "error") {
4310 return null;
4311 } else if (mode === "en") {
4312 return englishFn(length);
4313 } else {
4314 return intlFn(length);
4315 }
4316}
4317function supportsFastNumbers(loc) {
4318 if (loc.numberingSystem && loc.numberingSystem !== "latn") {
4319 return false;
4320 } else {
4321 return loc.numberingSystem === "latn" || !loc.locale || loc.locale.startsWith("en") || new Intl.DateTimeFormat(loc.intl).resolvedOptions().numberingSystem === "latn";
4322 }
4323}
4324var PolyNumberFormatter = class {
4325 constructor(intl, forceSimple, opts) {
4326 this.padTo = opts.padTo || 0;
4327 this.floor = opts.floor || false;
4328 const { padTo, floor, ...otherOpts } = opts;
4329 if (!forceSimple || Object.keys(otherOpts).length > 0) {
4330 const intlOpts = { useGrouping: false, ...opts };
4331 if (opts.padTo > 0)
4332 intlOpts.minimumIntegerDigits = opts.padTo;
4333 this.inf = getCachedINF(intl, intlOpts);
4334 }
4335 }
4336 format(i) {
4337 if (this.inf) {
4338 const fixed = this.floor ? Math.floor(i) : i;
4339 return this.inf.format(fixed);
4340 } else {
4341 const fixed = this.floor ? Math.floor(i) : roundTo(i, 3);
4342 return padStart(fixed, this.padTo);
4343 }
4344 }
4345};
4346var PolyDateFormatter = class {
4347 constructor(dt, intl, opts) {
4348 this.opts = opts;
4349 let z = void 0;
4350 if (dt.zone.isUniversal) {
4351 const gmtOffset = -1 * (dt.offset / 60);
4352 const offsetZ = gmtOffset >= 0 ? `Etc/GMT+${gmtOffset}` : `Etc/GMT${gmtOffset}`;
4353 if (dt.offset !== 0 && IANAZone.create(offsetZ).valid) {
4354 z = offsetZ;
4355 this.dt = dt;
4356 } else {
4357 z = "UTC";
4358 if (opts.timeZoneName) {
4359 this.dt = dt;
4360 } else {
4361 this.dt = dt.offset === 0 ? dt : DateTime.fromMillis(dt.ts + dt.offset * 60 * 1e3);
4362 }
4363 }
4364 } else if (dt.zone.type === "system") {
4365 this.dt = dt;
4366 } else {
4367 this.dt = dt;
4368 z = dt.zone.name;
4369 }
4370 const intlOpts = { ...this.opts };
4371 intlOpts.timeZone = intlOpts.timeZone || z;
4372 this.dtf = getCachedDTF(intl, intlOpts);
4373 }
4374 format() {
4375 return this.dtf.format(this.dt.toJSDate());
4376 }
4377 formatToParts() {
4378 return this.dtf.formatToParts(this.dt.toJSDate());
4379 }
4380 resolvedOptions() {
4381 return this.dtf.resolvedOptions();
4382 }
4383};
4384var PolyRelFormatter = class {
4385 constructor(intl, isEnglish, opts) {
4386 this.opts = { style: "long", ...opts };
4387 if (!isEnglish && hasRelative()) {
4388 this.rtf = getCachedRTF(intl, opts);
4389 }
4390 }
4391 format(count, unit) {
4392 if (this.rtf) {
4393 return this.rtf.format(count, unit);
4394 } else {
4395 return formatRelativeTime(unit, count, this.opts.numeric, this.opts.style !== "long");
4396 }
4397 }
4398 formatToParts(count, unit) {
4399 if (this.rtf) {
4400 return this.rtf.formatToParts(count, unit);
4401 } else {
4402 return [];
4403 }
4404 }
4405};
4406var Locale = class {
4407 static fromOpts(opts) {
4408 return Locale.create(opts.locale, opts.numberingSystem, opts.outputCalendar, opts.defaultToEN);
4409 }
4410 static create(locale, numberingSystem, outputCalendar, defaultToEN = false) {
4411 const specifiedLocale = locale || Settings.defaultLocale;
4412 const localeR = specifiedLocale || (defaultToEN ? "en-US" : systemLocale());
4413 const numberingSystemR = numberingSystem || Settings.defaultNumberingSystem;
4414 const outputCalendarR = outputCalendar || Settings.defaultOutputCalendar;
4415 return new Locale(localeR, numberingSystemR, outputCalendarR, specifiedLocale);
4416 }
4417 static resetCache() {
4418 sysLocaleCache = null;
4419 intlDTCache = {};
4420 intlNumCache = {};
4421 intlRelCache = {};
4422 }
4423 static fromObject({ locale, numberingSystem, outputCalendar } = {}) {
4424 return Locale.create(locale, numberingSystem, outputCalendar);
4425 }
4426 constructor(locale, numbering, outputCalendar, specifiedLocale) {
4427 const [parsedLocale, parsedNumberingSystem, parsedOutputCalendar] = parseLocaleString(locale);
4428 this.locale = parsedLocale;
4429 this.numberingSystem = numbering || parsedNumberingSystem || null;
4430 this.outputCalendar = outputCalendar || parsedOutputCalendar || null;
4431 this.intl = intlConfigString(this.locale, this.numberingSystem, this.outputCalendar);
4432 this.weekdaysCache = { format: {}, standalone: {} };
4433 this.monthsCache = { format: {}, standalone: {} };
4434 this.meridiemCache = null;
4435 this.eraCache = {};
4436 this.specifiedLocale = specifiedLocale;
4437 this.fastNumbersCached = null;
4438 }
4439 get fastNumbers() {
4440 if (this.fastNumbersCached == null) {
4441 this.fastNumbersCached = supportsFastNumbers(this);
4442 }
4443 return this.fastNumbersCached;
4444 }
4445 listingMode() {
4446 const isActuallyEn = this.isEnglish();
4447 const hasNoWeirdness = (this.numberingSystem === null || this.numberingSystem === "latn") && (this.outputCalendar === null || this.outputCalendar === "gregory");
4448 return isActuallyEn && hasNoWeirdness ? "en" : "intl";
4449 }
4450 clone(alts) {
4451 if (!alts || Object.getOwnPropertyNames(alts).length === 0) {
4452 return this;
4453 } else {
4454 return Locale.create(
4455 alts.locale || this.specifiedLocale,
4456 alts.numberingSystem || this.numberingSystem,
4457 alts.outputCalendar || this.outputCalendar,
4458 alts.defaultToEN || false
4459 );
4460 }
4461 }
4462 redefaultToEN(alts = {}) {
4463 return this.clone({ ...alts, defaultToEN: true });
4464 }
4465 redefaultToSystem(alts = {}) {
4466 return this.clone({ ...alts, defaultToEN: false });
4467 }
4468 months(length, format = false, defaultOK = true) {
4469 return listStuff(this, length, defaultOK, months, () => {
4470 const intl = format ? { month: length, day: "numeric" } : { month: length }, formatStr = format ? "format" : "standalone";
4471 if (!this.monthsCache[formatStr][length]) {
4472 this.monthsCache[formatStr][length] = mapMonths((dt) => this.extract(dt, intl, "month"));
4473 }
4474 return this.monthsCache[formatStr][length];
4475 });
4476 }
4477 weekdays(length, format = false, defaultOK = true) {
4478 return listStuff(this, length, defaultOK, weekdays, () => {
4479 const intl = format ? { weekday: length, year: "numeric", month: "long", day: "numeric" } : { weekday: length }, formatStr = format ? "format" : "standalone";
4480 if (!this.weekdaysCache[formatStr][length]) {
4481 this.weekdaysCache[formatStr][length] = mapWeekdays(
4482 (dt) => this.extract(dt, intl, "weekday")
4483 );
4484 }
4485 return this.weekdaysCache[formatStr][length];
4486 });
4487 }
4488 meridiems(defaultOK = true) {
4489 return listStuff(
4490 this,
4491 void 0,
4492 defaultOK,
4493 () => meridiems,
4494 () => {
4495 if (!this.meridiemCache) {
4496 const intl = { hour: "numeric", hourCycle: "h12" };
4497 this.meridiemCache = [DateTime.utc(2016, 11, 13, 9), DateTime.utc(2016, 11, 13, 19)].map(
4498 (dt) => this.extract(dt, intl, "dayperiod")
4499 );
4500 }
4501 return this.meridiemCache;
4502 }
4503 );
4504 }
4505 eras(length, defaultOK = true) {
4506 return listStuff(this, length, defaultOK, eras, () => {
4507 const intl = { era: length };
4508 if (!this.eraCache[length]) {
4509 this.eraCache[length] = [DateTime.utc(-40, 1, 1), DateTime.utc(2017, 1, 1)].map(
4510 (dt) => this.extract(dt, intl, "era")
4511 );
4512 }
4513 return this.eraCache[length];
4514 });
4515 }
4516 extract(dt, intlOpts, field) {
4517 const df = this.dtFormatter(dt, intlOpts), results = df.formatToParts(), matching = results.find((m) => m.type.toLowerCase() === field);
4518 return matching ? matching.value : null;
4519 }
4520 numberFormatter(opts = {}) {
4521 return new PolyNumberFormatter(this.intl, opts.forceSimple || this.fastNumbers, opts);
4522 }
4523 dtFormatter(dt, intlOpts = {}) {
4524 return new PolyDateFormatter(dt, this.intl, intlOpts);
4525 }
4526 relFormatter(opts = {}) {
4527 return new PolyRelFormatter(this.intl, this.isEnglish(), opts);
4528 }
4529 listFormatter(opts = {}) {
4530 return getCachedLF(this.intl, opts);
4531 }
4532 isEnglish() {
4533 return this.locale === "en" || this.locale.toLowerCase() === "en-us" || new Intl.DateTimeFormat(this.intl).resolvedOptions().locale.startsWith("en-us");
4534 }
4535 equals(other) {
4536 return this.locale === other.locale && this.numberingSystem === other.numberingSystem && this.outputCalendar === other.outputCalendar;
4537 }
4538};
4539
4540// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/zones/fixedOffsetZone.js
4541var singleton2 = null;
4542var FixedOffsetZone = class extends Zone {
4543 static get utcInstance() {
4544 if (singleton2 === null) {
4545 singleton2 = new FixedOffsetZone(0);
4546 }
4547 return singleton2;
4548 }
4549 static instance(offset2) {
4550 return offset2 === 0 ? FixedOffsetZone.utcInstance : new FixedOffsetZone(offset2);
4551 }
4552 static parseSpecifier(s2) {
4553 if (s2) {
4554 const r = s2.match(/^utc(?:([+-]\d{1,2})(?::(\d{2}))?)?$/i);
4555 if (r) {
4556 return new FixedOffsetZone(signedOffset(r[1], r[2]));
4557 }
4558 }
4559 return null;
4560 }
4561 constructor(offset2) {
4562 super();
4563 this.fixed = offset2;
4564 }
4565 get type() {
4566 return "fixed";
4567 }
4568 get name() {
4569 return this.fixed === 0 ? "UTC" : `UTC${formatOffset(this.fixed, "narrow")}`;
4570 }
4571 get ianaName() {
4572 if (this.fixed === 0) {
4573 return "Etc/UTC";
4574 } else {
4575 return `Etc/GMT${formatOffset(-this.fixed, "narrow")}`;
4576 }
4577 }
4578 offsetName() {
4579 return this.name;
4580 }
4581 formatOffset(ts, format) {
4582 return formatOffset(this.fixed, format);
4583 }
4584 get isUniversal() {
4585 return true;
4586 }
4587 offset() {
4588 return this.fixed;
4589 }
4590 equals(otherZone) {
4591 return otherZone.type === "fixed" && otherZone.fixed === this.fixed;
4592 }
4593 get isValid() {
4594 return true;
4595 }
4596};
4597
4598// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/zones/invalidZone.js
4599var InvalidZone = class extends Zone {
4600 constructor(zoneName) {
4601 super();
4602 this.zoneName = zoneName;
4603 }
4604 get type() {
4605 return "invalid";
4606 }
4607 get name() {
4608 return this.zoneName;
4609 }
4610 get isUniversal() {
4611 return false;
4612 }
4613 offsetName() {
4614 return null;
4615 }
4616 formatOffset() {
4617 return "";
4618 }
4619 offset() {
4620 return NaN;
4621 }
4622 equals() {
4623 return false;
4624 }
4625 get isValid() {
4626 return false;
4627 }
4628};
4629
4630// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/zoneUtil.js
4631function normalizeZone(input, defaultZone2) {
4632 let offset2;
4633 if (isUndefined(input) || input === null) {
4634 return defaultZone2;
4635 } else if (input instanceof Zone) {
4636 return input;
4637 } else if (isString(input)) {
4638 const lowered = input.toLowerCase();
4639 if (lowered === "default")
4640 return defaultZone2;
4641 else if (lowered === "local" || lowered === "system")
4642 return SystemZone.instance;
4643 else if (lowered === "utc" || lowered === "gmt")
4644 return FixedOffsetZone.utcInstance;
4645 else
4646 return FixedOffsetZone.parseSpecifier(lowered) || IANAZone.create(input);
4647 } else if (isNumber(input)) {
4648 return FixedOffsetZone.instance(input);
4649 } else if (typeof input === "object" && input.offset && typeof input.offset === "number") {
4650 return input;
4651 } else {
4652 return new InvalidZone(input);
4653 }
4654}
4655
4656// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/settings.js
4657var now = () => Date.now();
4658var defaultZone = "system";
4659var defaultLocale = null;
4660var defaultNumberingSystem = null;
4661var defaultOutputCalendar = null;
4662var twoDigitCutoffYear = 60;
4663var throwOnInvalid;
4664var Settings = class {
4665 static get now() {
4666 return now;
4667 }
4668 static set now(n2) {
4669 now = n2;
4670 }
4671 static set defaultZone(zone) {
4672 defaultZone = zone;
4673 }
4674 static get defaultZone() {
4675 return normalizeZone(defaultZone, SystemZone.instance);
4676 }
4677 static get defaultLocale() {
4678 return defaultLocale;
4679 }
4680 static set defaultLocale(locale) {
4681 defaultLocale = locale;
4682 }
4683 static get defaultNumberingSystem() {
4684 return defaultNumberingSystem;
4685 }
4686 static set defaultNumberingSystem(numberingSystem) {
4687 defaultNumberingSystem = numberingSystem;
4688 }
4689 static get defaultOutputCalendar() {
4690 return defaultOutputCalendar;
4691 }
4692 static set defaultOutputCalendar(outputCalendar) {
4693 defaultOutputCalendar = outputCalendar;
4694 }
4695 static get twoDigitCutoffYear() {
4696 return twoDigitCutoffYear;
4697 }
4698 static set twoDigitCutoffYear(cutoffYear) {
4699 twoDigitCutoffYear = cutoffYear % 100;
4700 }
4701 static get throwOnInvalid() {
4702 return throwOnInvalid;
4703 }
4704 static set throwOnInvalid(t) {
4705 throwOnInvalid = t;
4706 }
4707 static resetCaches() {
4708 Locale.resetCache();
4709 IANAZone.resetCache();
4710 }
4711};
4712
4713// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/util.js
4714function isUndefined(o) {
4715 return typeof o === "undefined";
4716}
4717function isNumber(o) {
4718 return typeof o === "number";
4719}
4720function isInteger(o) {
4721 return typeof o === "number" && o % 1 === 0;
4722}
4723function isString(o) {
4724 return typeof o === "string";
4725}
4726function isDate(o) {
4727 return Object.prototype.toString.call(o) === "[object Date]";
4728}
4729function hasRelative() {
4730 try {
4731 return typeof Intl !== "undefined" && !!Intl.RelativeTimeFormat;
4732 } catch (e) {
4733 return false;
4734 }
4735}
4736function maybeArray(thing) {
4737 return Array.isArray(thing) ? thing : [thing];
4738}
4739function bestBy(arr, by, compare) {
4740 if (arr.length === 0) {
4741 return void 0;
4742 }
4743 return arr.reduce((best, next) => {
4744 const pair = [by(next), next];
4745 if (!best) {
4746 return pair;
4747 } else if (compare(best[0], pair[0]) === best[0]) {
4748 return best;
4749 } else {
4750 return pair;
4751 }
4752 }, null)[1];
4753}
4754function pick(obj, keys) {
4755 return keys.reduce((a, k) => {
4756 a[k] = obj[k];
4757 return a;
4758 }, {});
4759}
4760function hasOwnProperty(obj, prop) {
4761 return Object.prototype.hasOwnProperty.call(obj, prop);
4762}
4763function integerBetween(thing, bottom, top) {
4764 return isInteger(thing) && thing >= bottom && thing <= top;
4765}
4766function floorMod(x, n2) {
4767 return x - n2 * Math.floor(x / n2);
4768}
4769function padStart(input, n2 = 2) {
4770 const isNeg = input < 0;
4771 let padded;
4772 if (isNeg) {
4773 padded = "-" + ("" + -input).padStart(n2, "0");
4774 } else {
4775 padded = ("" + input).padStart(n2, "0");
4776 }
4777 return padded;
4778}
4779function parseInteger(string) {
4780 if (isUndefined(string) || string === null || string === "") {
4781 return void 0;
4782 } else {
4783 return parseInt(string, 10);
4784 }
4785}
4786function parseFloating(string) {
4787 if (isUndefined(string) || string === null || string === "") {
4788 return void 0;
4789 } else {
4790 return parseFloat(string);
4791 }
4792}
4793function parseMillis(fraction) {
4794 if (isUndefined(fraction) || fraction === null || fraction === "") {
4795 return void 0;
4796 } else {
4797 const f = parseFloat("0." + fraction) * 1e3;
4798 return Math.floor(f);
4799 }
4800}
4801function roundTo(number, digits, towardZero = false) {
4802 const factor = 10 ** digits, rounder = towardZero ? Math.trunc : Math.round;
4803 return rounder(number * factor) / factor;
4804}
4805function isLeapYear(year) {
4806 return year % 4 === 0 && (year % 100 !== 0 || year % 400 === 0);
4807}
4808function daysInYear(year) {
4809 return isLeapYear(year) ? 366 : 365;
4810}
4811function daysInMonth(year, month) {
4812 const modMonth = floorMod(month - 1, 12) + 1, modYear = year + (month - modMonth) / 12;
4813 if (modMonth === 2) {
4814 return isLeapYear(modYear) ? 29 : 28;
4815 } else {
4816 return [31, null, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][modMonth - 1];
4817 }
4818}
4819function objToLocalTS(obj) {
4820 let d = Date.UTC(
4821 obj.year,
4822 obj.month - 1,
4823 obj.day,
4824 obj.hour,
4825 obj.minute,
4826 obj.second,
4827 obj.millisecond
4828 );
4829 if (obj.year < 100 && obj.year >= 0) {
4830 d = new Date(d);
4831 d.setUTCFullYear(d.getUTCFullYear() - 1900);
4832 }
4833 return +d;
4834}
4835function weeksInWeekYear(weekYear) {
4836 const p1 = (weekYear + Math.floor(weekYear / 4) - Math.floor(weekYear / 100) + Math.floor(weekYear / 400)) % 7, last = weekYear - 1, p2 = (last + Math.floor(last / 4) - Math.floor(last / 100) + Math.floor(last / 400)) % 7;
4837 return p1 === 4 || p2 === 3 ? 53 : 52;
4838}
4839function untruncateYear(year) {
4840 if (year > 99) {
4841 return year;
4842 } else
4843 return year > Settings.twoDigitCutoffYear ? 1900 + year : 2e3 + year;
4844}
4845function parseZoneInfo(ts, offsetFormat, locale, timeZone = null) {
4846 const date = new Date(ts), intlOpts = {
4847 hourCycle: "h23",
4848 year: "numeric",
4849 month: "2-digit",
4850 day: "2-digit",
4851 hour: "2-digit",
4852 minute: "2-digit"
4853 };
4854 if (timeZone) {
4855 intlOpts.timeZone = timeZone;
4856 }
4857 const modified = { timeZoneName: offsetFormat, ...intlOpts };
4858 const parsed = new Intl.DateTimeFormat(locale, modified).formatToParts(date).find((m) => m.type.toLowerCase() === "timezonename");
4859 return parsed ? parsed.value : null;
4860}
4861function signedOffset(offHourStr, offMinuteStr) {
4862 let offHour = parseInt(offHourStr, 10);
4863 if (Number.isNaN(offHour)) {
4864 offHour = 0;
4865 }
4866 const offMin = parseInt(offMinuteStr, 10) || 0, offMinSigned = offHour < 0 || Object.is(offHour, -0) ? -offMin : offMin;
4867 return offHour * 60 + offMinSigned;
4868}
4869function asNumber(value) {
4870 const numericValue = Number(value);
4871 if (typeof value === "boolean" || value === "" || Number.isNaN(numericValue))
4872 throw new InvalidArgumentError(`Invalid unit value ${value}`);
4873 return numericValue;
4874}
4875function normalizeObject(obj, normalizer) {
4876 const normalized = {};
4877 for (const u in obj) {
4878 if (hasOwnProperty(obj, u)) {
4879 const v = obj[u];
4880 if (v === void 0 || v === null)
4881 continue;
4882 normalized[normalizer(u)] = asNumber(v);
4883 }
4884 }
4885 return normalized;
4886}
4887function formatOffset(offset2, format) {
4888 const hours = Math.trunc(Math.abs(offset2 / 60)), minutes = Math.trunc(Math.abs(offset2 % 60)), sign = offset2 >= 0 ? "+" : "-";
4889 switch (format) {
4890 case "short":
4891 return `${sign}${padStart(hours, 2)}:${padStart(minutes, 2)}`;
4892 case "narrow":
4893 return `${sign}${hours}${minutes > 0 ? `:${minutes}` : ""}`;
4894 case "techie":
4895 return `${sign}${padStart(hours, 2)}${padStart(minutes, 2)}`;
4896 default:
4897 throw new RangeError(`Value format ${format} is out of range for property format`);
4898 }
4899}
4900function timeObject(obj) {
4901 return pick(obj, ["hour", "minute", "second", "millisecond"]);
4902}
4903
4904// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/english.js
4905var monthsLong = [
4906 "January",
4907 "February",
4908 "March",
4909 "April",
4910 "May",
4911 "June",
4912 "July",
4913 "August",
4914 "September",
4915 "October",
4916 "November",
4917 "December"
4918];
4919var monthsShort = [
4920 "Jan",
4921 "Feb",
4922 "Mar",
4923 "Apr",
4924 "May",
4925 "Jun",
4926 "Jul",
4927 "Aug",
4928 "Sep",
4929 "Oct",
4930 "Nov",
4931 "Dec"
4932];
4933var monthsNarrow = ["J", "F", "M", "A", "M", "J", "J", "A", "S", "O", "N", "D"];
4934function months(length) {
4935 switch (length) {
4936 case "narrow":
4937 return [...monthsNarrow];
4938 case "short":
4939 return [...monthsShort];
4940 case "long":
4941 return [...monthsLong];
4942 case "numeric":
4943 return ["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"];
4944 case "2-digit":
4945 return ["01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12"];
4946 default:
4947 return null;
4948 }
4949}
4950var weekdaysLong = [
4951 "Monday",
4952 "Tuesday",
4953 "Wednesday",
4954 "Thursday",
4955 "Friday",
4956 "Saturday",
4957 "Sunday"
4958];
4959var weekdaysShort = ["Mon", "Tue", "Wed", "Thu", "Fri", "Sat", "Sun"];
4960var weekdaysNarrow = ["M", "T", "W", "T", "F", "S", "S"];
4961function weekdays(length) {
4962 switch (length) {
4963 case "narrow":
4964 return [...weekdaysNarrow];
4965 case "short":
4966 return [...weekdaysShort];
4967 case "long":
4968 return [...weekdaysLong];
4969 case "numeric":
4970 return ["1", "2", "3", "4", "5", "6", "7"];
4971 default:
4972 return null;
4973 }
4974}
4975var meridiems = ["AM", "PM"];
4976var erasLong = ["Before Christ", "Anno Domini"];
4977var erasShort = ["BC", "AD"];
4978var erasNarrow = ["B", "A"];
4979function eras(length) {
4980 switch (length) {
4981 case "narrow":
4982 return [...erasNarrow];
4983 case "short":
4984 return [...erasShort];
4985 case "long":
4986 return [...erasLong];
4987 default:
4988 return null;
4989 }
4990}
4991function meridiemForDateTime(dt) {
4992 return meridiems[dt.hour < 12 ? 0 : 1];
4993}
4994function weekdayForDateTime(dt, length) {
4995 return weekdays(length)[dt.weekday - 1];
4996}
4997function monthForDateTime(dt, length) {
4998 return months(length)[dt.month - 1];
4999}
5000function eraForDateTime(dt, length) {
5001 return eras(length)[dt.year < 0 ? 0 : 1];
5002}
5003function formatRelativeTime(unit, count, numeric = "always", narrow = false) {
5004 const units = {
5005 years: ["year", "yr."],
5006 quarters: ["quarter", "qtr."],
5007 months: ["month", "mo."],
5008 weeks: ["week", "wk."],
5009 days: ["day", "day", "days"],
5010 hours: ["hour", "hr."],
5011 minutes: ["minute", "min."],
5012 seconds: ["second", "sec."]
5013 };
5014 const lastable = ["hours", "minutes", "seconds"].indexOf(unit) === -1;
5015 if (numeric === "auto" && lastable) {
5016 const isDay = unit === "days";
5017 switch (count) {
5018 case 1:
5019 return isDay ? "tomorrow" : `next ${units[unit][0]}`;
5020 case -1:
5021 return isDay ? "yesterday" : `last ${units[unit][0]}`;
5022 case 0:
5023 return isDay ? "today" : `this ${units[unit][0]}`;
5024 default:
5025 }
5026 }
5027 const isInPast = Object.is(count, -0) || count < 0, fmtValue = Math.abs(count), singular = fmtValue === 1, lilUnits = units[unit], fmtUnit = narrow ? singular ? lilUnits[1] : lilUnits[2] || lilUnits[1] : singular ? units[unit][0] : unit;
5028 return isInPast ? `${fmtValue} ${fmtUnit} ago` : `in ${fmtValue} ${fmtUnit}`;
5029}
5030
5031// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/formatter.js
5032function stringifyTokens(splits, tokenToString) {
5033 let s2 = "";
5034 for (const token of splits) {
5035 if (token.literal) {
5036 s2 += token.val;
5037 } else {
5038 s2 += tokenToString(token.val);
5039 }
5040 }
5041 return s2;
5042}
5043var macroTokenToFormatOpts = {
5044 D: DATE_SHORT,
5045 DD: DATE_MED,
5046 DDD: DATE_FULL,
5047 DDDD: DATE_HUGE,
5048 t: TIME_SIMPLE,
5049 tt: TIME_WITH_SECONDS,
5050 ttt: TIME_WITH_SHORT_OFFSET,
5051 tttt: TIME_WITH_LONG_OFFSET,
5052 T: TIME_24_SIMPLE,
5053 TT: TIME_24_WITH_SECONDS,
5054 TTT: TIME_24_WITH_SHORT_OFFSET,
5055 TTTT: TIME_24_WITH_LONG_OFFSET,
5056 f: DATETIME_SHORT,
5057 ff: DATETIME_MED,
5058 fff: DATETIME_FULL,
5059 ffff: DATETIME_HUGE,
5060 F: DATETIME_SHORT_WITH_SECONDS,
5061 FF: DATETIME_MED_WITH_SECONDS,
5062 FFF: DATETIME_FULL_WITH_SECONDS,
5063 FFFF: DATETIME_HUGE_WITH_SECONDS
5064};
5065var Formatter = class {
5066 static create(locale, opts = {}) {
5067 return new Formatter(locale, opts);
5068 }
5069 static parseFormat(fmt) {
5070 let current = null, currentFull = "", bracketed = false;
5071 const splits = [];
5072 for (let i = 0; i < fmt.length; i++) {
5073 const c = fmt.charAt(i);
5074 if (c === "'") {
5075 if (currentFull.length > 0) {
5076 splits.push({ literal: bracketed, val: currentFull });
5077 }
5078 current = null;
5079 currentFull = "";
5080 bracketed = !bracketed;
5081 } else if (bracketed) {
5082 currentFull += c;
5083 } else if (c === current) {
5084 currentFull += c;
5085 } else {
5086 if (currentFull.length > 0) {
5087 splits.push({ literal: false, val: currentFull });
5088 }
5089 currentFull = c;
5090 current = c;
5091 }
5092 }
5093 if (currentFull.length > 0) {
5094 splits.push({ literal: bracketed, val: currentFull });
5095 }
5096 return splits;
5097 }
5098 static macroTokenToFormatOpts(token) {
5099 return macroTokenToFormatOpts[token];
5100 }
5101 constructor(locale, formatOpts) {
5102 this.opts = formatOpts;
5103 this.loc = locale;
5104 this.systemLoc = null;
5105 }
5106 formatWithSystemDefault(dt, opts) {
5107 if (this.systemLoc === null) {
5108 this.systemLoc = this.loc.redefaultToSystem();
5109 }
5110 const df = this.systemLoc.dtFormatter(dt, { ...this.opts, ...opts });
5111 return df.format();
5112 }
5113 formatDateTime(dt, opts = {}) {
5114 const df = this.loc.dtFormatter(dt, { ...this.opts, ...opts });
5115 return df.format();
5116 }
5117 formatDateTimeParts(dt, opts = {}) {
5118 const df = this.loc.dtFormatter(dt, { ...this.opts, ...opts });
5119 return df.formatToParts();
5120 }
5121 formatInterval(interval, opts = {}) {
5122 const df = this.loc.dtFormatter(interval.start, { ...this.opts, ...opts });
5123 return df.dtf.formatRange(interval.start.toJSDate(), interval.end.toJSDate());
5124 }
5125 resolvedOptions(dt, opts = {}) {
5126 const df = this.loc.dtFormatter(dt, { ...this.opts, ...opts });
5127 return df.resolvedOptions();
5128 }
5129 num(n2, p = 0) {
5130 if (this.opts.forceSimple) {
5131 return padStart(n2, p);
5132 }
5133 const opts = { ...this.opts };
5134 if (p > 0) {
5135 opts.padTo = p;
5136 }
5137 return this.loc.numberFormatter(opts).format(n2);
5138 }
5139 formatDateTimeFromString(dt, fmt) {
5140 const knownEnglish = this.loc.listingMode() === "en", useDateTimeFormatter = this.loc.outputCalendar && this.loc.outputCalendar !== "gregory", string = (opts, extract) => this.loc.extract(dt, opts, extract), formatOffset2 = (opts) => {
5141 if (dt.isOffsetFixed && dt.offset === 0 && opts.allowZ) {
5142 return "Z";
5143 }
5144 return dt.isValid ? dt.zone.formatOffset(dt.ts, opts.format) : "";
5145 }, meridiem = () => knownEnglish ? meridiemForDateTime(dt) : string({ hour: "numeric", hourCycle: "h12" }, "dayperiod"), month = (length, standalone) => knownEnglish ? monthForDateTime(dt, length) : string(standalone ? { month: length } : { month: length, day: "numeric" }, "month"), weekday = (length, standalone) => knownEnglish ? weekdayForDateTime(dt, length) : string(
5146 standalone ? { weekday: length } : { weekday: length, month: "long", day: "numeric" },
5147 "weekday"
5148 ), maybeMacro = (token) => {
5149 const formatOpts = Formatter.macroTokenToFormatOpts(token);
5150 if (formatOpts) {
5151 return this.formatWithSystemDefault(dt, formatOpts);
5152 } else {
5153 return token;
5154 }
5155 }, era = (length) => knownEnglish ? eraForDateTime(dt, length) : string({ era: length }, "era"), tokenToString = (token) => {
5156 switch (token) {
5157 case "S":
5158 return this.num(dt.millisecond);
5159 case "u":
5160 case "SSS":
5161 return this.num(dt.millisecond, 3);
5162 case "s":
5163 return this.num(dt.second);
5164 case "ss":
5165 return this.num(dt.second, 2);
5166 case "uu":
5167 return this.num(Math.floor(dt.millisecond / 10), 2);
5168 case "uuu":
5169 return this.num(Math.floor(dt.millisecond / 100));
5170 case "m":
5171 return this.num(dt.minute);
5172 case "mm":
5173 return this.num(dt.minute, 2);
5174 case "h":
5175 return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12);
5176 case "hh":
5177 return this.num(dt.hour % 12 === 0 ? 12 : dt.hour % 12, 2);
5178 case "H":
5179 return this.num(dt.hour);
5180 case "HH":
5181 return this.num(dt.hour, 2);
5182 case "Z":
5183 return formatOffset2({ format: "narrow", allowZ: this.opts.allowZ });
5184 case "ZZ":
5185 return formatOffset2({ format: "short", allowZ: this.opts.allowZ });
5186 case "ZZZ":
5187 return formatOffset2({ format: "techie", allowZ: this.opts.allowZ });
5188 case "ZZZZ":
5189 return dt.zone.offsetName(dt.ts, { format: "short", locale: this.loc.locale });
5190 case "ZZZZZ":
5191 return dt.zone.offsetName(dt.ts, { format: "long", locale: this.loc.locale });
5192 case "z":
5193 return dt.zoneName;
5194 case "a":
5195 return meridiem();
5196 case "d":
5197 return useDateTimeFormatter ? string({ day: "numeric" }, "day") : this.num(dt.day);
5198 case "dd":
5199 return useDateTimeFormatter ? string({ day: "2-digit" }, "day") : this.num(dt.day, 2);
5200 case "c":
5201 return this.num(dt.weekday);
5202 case "ccc":
5203 return weekday("short", true);
5204 case "cccc":
5205 return weekday("long", true);
5206 case "ccccc":
5207 return weekday("narrow", true);
5208 case "E":
5209 return this.num(dt.weekday);
5210 case "EEE":
5211 return weekday("short", false);
5212 case "EEEE":
5213 return weekday("long", false);
5214 case "EEEEE":
5215 return weekday("narrow", false);
5216 case "L":
5217 return useDateTimeFormatter ? string({ month: "numeric", day: "numeric" }, "month") : this.num(dt.month);
5218 case "LL":
5219 return useDateTimeFormatter ? string({ month: "2-digit", day: "numeric" }, "month") : this.num(dt.month, 2);
5220 case "LLL":
5221 return month("short", true);
5222 case "LLLL":
5223 return month("long", true);
5224 case "LLLLL":
5225 return month("narrow", true);
5226 case "M":
5227 return useDateTimeFormatter ? string({ month: "numeric" }, "month") : this.num(dt.month);
5228 case "MM":
5229 return useDateTimeFormatter ? string({ month: "2-digit" }, "month") : this.num(dt.month, 2);
5230 case "MMM":
5231 return month("short", false);
5232 case "MMMM":
5233 return month("long", false);
5234 case "MMMMM":
5235 return month("narrow", false);
5236 case "y":
5237 return useDateTimeFormatter ? string({ year: "numeric" }, "year") : this.num(dt.year);
5238 case "yy":
5239 return useDateTimeFormatter ? string({ year: "2-digit" }, "year") : this.num(dt.year.toString().slice(-2), 2);
5240 case "yyyy":
5241 return useDateTimeFormatter ? string({ year: "numeric" }, "year") : this.num(dt.year, 4);
5242 case "yyyyyy":
5243 return useDateTimeFormatter ? string({ year: "numeric" }, "year") : this.num(dt.year, 6);
5244 case "G":
5245 return era("short");
5246 case "GG":
5247 return era("long");
5248 case "GGGGG":
5249 return era("narrow");
5250 case "kk":
5251 return this.num(dt.weekYear.toString().slice(-2), 2);
5252 case "kkkk":
5253 return this.num(dt.weekYear, 4);
5254 case "W":
5255 return this.num(dt.weekNumber);
5256 case "WW":
5257 return this.num(dt.weekNumber, 2);
5258 case "o":
5259 return this.num(dt.ordinal);
5260 case "ooo":
5261 return this.num(dt.ordinal, 3);
5262 case "q":
5263 return this.num(dt.quarter);
5264 case "qq":
5265 return this.num(dt.quarter, 2);
5266 case "X":
5267 return this.num(Math.floor(dt.ts / 1e3));
5268 case "x":
5269 return this.num(dt.ts);
5270 default:
5271 return maybeMacro(token);
5272 }
5273 };
5274 return stringifyTokens(Formatter.parseFormat(fmt), tokenToString);
5275 }
5276 formatDurationFromString(dur, fmt) {
5277 const tokenToField = (token) => {
5278 switch (token[0]) {
5279 case "S":
5280 return "millisecond";
5281 case "s":
5282 return "second";
5283 case "m":
5284 return "minute";
5285 case "h":
5286 return "hour";
5287 case "d":
5288 return "day";
5289 case "w":
5290 return "week";
5291 case "M":
5292 return "month";
5293 case "y":
5294 return "year";
5295 default:
5296 return null;
5297 }
5298 }, tokenToString = (lildur) => (token) => {
5299 const mapped = tokenToField(token);
5300 if (mapped) {
5301 return this.num(lildur.get(mapped), token.length);
5302 } else {
5303 return token;
5304 }
5305 }, tokens = Formatter.parseFormat(fmt), realTokens = tokens.reduce(
5306 (found, { literal, val }) => literal ? found : found.concat(val),
5307 []
5308 ), collapsed = dur.shiftTo(...realTokens.map(tokenToField).filter((t) => t));
5309 return stringifyTokens(tokens, tokenToString(collapsed));
5310 }
5311};
5312
5313// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/invalid.js
5314var Invalid = class {
5315 constructor(reason, explanation) {
5316 this.reason = reason;
5317 this.explanation = explanation;
5318 }
5319 toMessage() {
5320 if (this.explanation) {
5321 return `${this.reason}: ${this.explanation}`;
5322 } else {
5323 return this.reason;
5324 }
5325 }
5326};
5327
5328// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/regexParser.js
5329var ianaRegex = /[A-Za-z_+-]{1,256}(?::?\/[A-Za-z0-9_+-]{1,256}(?:\/[A-Za-z0-9_+-]{1,256})?)?/;
5330function combineRegexes(...regexes) {
5331 const full = regexes.reduce((f, r) => f + r.source, "");
5332 return RegExp(`^${full}$`);
5333}
5334function combineExtractors(...extractors) {
5335 return (m) => extractors.reduce(
5336 ([mergedVals, mergedZone, cursor], ex) => {
5337 const [val, zone, next] = ex(m, cursor);
5338 return [{ ...mergedVals, ...val }, zone || mergedZone, next];
5339 },
5340 [{}, null, 1]
5341 ).slice(0, 2);
5342}
5343function parse(s2, ...patterns) {
5344 if (s2 == null) {
5345 return [null, null];
5346 }
5347 for (const [regex, extractor] of patterns) {
5348 const m = regex.exec(s2);
5349 if (m) {
5350 return extractor(m);
5351 }
5352 }
5353 return [null, null];
5354}
5355function simpleParse(...keys) {
5356 return (match2, cursor) => {
5357 const ret = {};
5358 let i;
5359 for (i = 0; i < keys.length; i++) {
5360 ret[keys[i]] = parseInteger(match2[cursor + i]);
5361 }
5362 return [ret, null, cursor + i];
5363 };
5364}
5365var offsetRegex = /(?:(Z)|([+-]\d\d)(?::?(\d\d))?)/;
5366var isoExtendedZone = `(?:${offsetRegex.source}?(?:\\[(${ianaRegex.source})\\])?)?`;
5367var isoTimeBaseRegex = /(\d\d)(?::?(\d\d)(?::?(\d\d)(?:[.,](\d{1,30}))?)?)?/;
5368var isoTimeRegex = RegExp(`${isoTimeBaseRegex.source}${isoExtendedZone}`);
5369var isoTimeExtensionRegex = RegExp(`(?:T${isoTimeRegex.source})?`);
5370var isoYmdRegex = /([+-]\d{6}|\d{4})(?:-?(\d\d)(?:-?(\d\d))?)?/;
5371var isoWeekRegex = /(\d{4})-?W(\d\d)(?:-?(\d))?/;
5372var isoOrdinalRegex = /(\d{4})-?(\d{3})/;
5373var extractISOWeekData = simpleParse("weekYear", "weekNumber", "weekDay");
5374var extractISOOrdinalData = simpleParse("year", "ordinal");
5375var sqlYmdRegex = /(\d{4})-(\d\d)-(\d\d)/;
5376var sqlTimeRegex = RegExp(
5377 `${isoTimeBaseRegex.source} ?(?:${offsetRegex.source}|(${ianaRegex.source}))?`
5378);
5379var sqlTimeExtensionRegex = RegExp(`(?: ${sqlTimeRegex.source})?`);
5380function int(match2, pos, fallback) {
5381 const m = match2[pos];
5382 return isUndefined(m) ? fallback : parseInteger(m);
5383}
5384function extractISOYmd(match2, cursor) {
5385 const item = {
5386 year: int(match2, cursor),
5387 month: int(match2, cursor + 1, 1),
5388 day: int(match2, cursor + 2, 1)
5389 };
5390 return [item, null, cursor + 3];
5391}
5392function extractISOTime(match2, cursor) {
5393 const item = {
5394 hours: int(match2, cursor, 0),
5395 minutes: int(match2, cursor + 1, 0),
5396 seconds: int(match2, cursor + 2, 0),
5397 milliseconds: parseMillis(match2[cursor + 3])
5398 };
5399 return [item, null, cursor + 4];
5400}
5401function extractISOOffset(match2, cursor) {
5402 const local = !match2[cursor] && !match2[cursor + 1], fullOffset = signedOffset(match2[cursor + 1], match2[cursor + 2]), zone = local ? null : FixedOffsetZone.instance(fullOffset);
5403 return [{}, zone, cursor + 3];
5404}
5405function extractIANAZone(match2, cursor) {
5406 const zone = match2[cursor] ? IANAZone.create(match2[cursor]) : null;
5407 return [{}, zone, cursor + 1];
5408}
5409var isoTimeOnly = RegExp(`^T?${isoTimeBaseRegex.source}$`);
5410var isoDuration = /^-?P(?:(?:(-?\d{1,20}(?:\.\d{1,20})?)Y)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20}(?:\.\d{1,20})?)W)?(?:(-?\d{1,20}(?:\.\d{1,20})?)D)?(?:T(?:(-?\d{1,20}(?:\.\d{1,20})?)H)?(?:(-?\d{1,20}(?:\.\d{1,20})?)M)?(?:(-?\d{1,20})(?:[.,](-?\d{1,20}))?S)?)?)$/;
5411function extractISODuration(match2) {
5412 const [s2, yearStr, monthStr, weekStr, dayStr, hourStr, minuteStr, secondStr, millisecondsStr] = match2;
5413 const hasNegativePrefix = s2[0] === "-";
5414 const negativeSeconds = secondStr && secondStr[0] === "-";
5415 const maybeNegate = (num, force = false) => num !== void 0 && (force || num && hasNegativePrefix) ? -num : num;
5416 return [
5417 {
5418 years: maybeNegate(parseFloating(yearStr)),
5419 months: maybeNegate(parseFloating(monthStr)),
5420 weeks: maybeNegate(parseFloating(weekStr)),
5421 days: maybeNegate(parseFloating(dayStr)),
5422 hours: maybeNegate(parseFloating(hourStr)),
5423 minutes: maybeNegate(parseFloating(minuteStr)),
5424 seconds: maybeNegate(parseFloating(secondStr), secondStr === "-0"),
5425 milliseconds: maybeNegate(parseMillis(millisecondsStr), negativeSeconds)
5426 }
5427 ];
5428}
5429var obsOffsets = {
5430 GMT: 0,
5431 EDT: -4 * 60,
5432 EST: -5 * 60,
5433 CDT: -5 * 60,
5434 CST: -6 * 60,
5435 MDT: -6 * 60,
5436 MST: -7 * 60,
5437 PDT: -7 * 60,
5438 PST: -8 * 60
5439};
5440function fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr) {
5441 const result = {
5442 year: yearStr.length === 2 ? untruncateYear(parseInteger(yearStr)) : parseInteger(yearStr),
5443 month: monthsShort.indexOf(monthStr) + 1,
5444 day: parseInteger(dayStr),
5445 hour: parseInteger(hourStr),
5446 minute: parseInteger(minuteStr)
5447 };
5448 if (secondStr)
5449 result.second = parseInteger(secondStr);
5450 if (weekdayStr) {
5451 result.weekday = weekdayStr.length > 3 ? weekdaysLong.indexOf(weekdayStr) + 1 : weekdaysShort.indexOf(weekdayStr) + 1;
5452 }
5453 return result;
5454}
5455var rfc2822 = /^(?:(Mon|Tue|Wed|Thu|Fri|Sat|Sun),\s)?(\d{1,2})\s(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)\s(\d{2,4})\s(\d\d):(\d\d)(?::(\d\d))?\s(?:(UT|GMT|[ECMP][SD]T)|([Zz])|(?:([+-]\d\d)(\d\d)))$/;
5456function extractRFC2822(match2) {
5457 const [
5458 ,
5459 weekdayStr,
5460 dayStr,
5461 monthStr,
5462 yearStr,
5463 hourStr,
5464 minuteStr,
5465 secondStr,
5466 obsOffset,
5467 milOffset,
5468 offHourStr,
5469 offMinuteStr
5470 ] = match2, result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
5471 let offset2;
5472 if (obsOffset) {
5473 offset2 = obsOffsets[obsOffset];
5474 } else if (milOffset) {
5475 offset2 = 0;
5476 } else {
5477 offset2 = signedOffset(offHourStr, offMinuteStr);
5478 }
5479 return [result, new FixedOffsetZone(offset2)];
5480}
5481function preprocessRFC2822(s2) {
5482 return s2.replace(/\([^()]*\)|[\n\t]/g, " ").replace(/(\s\s+)/g, " ").trim();
5483}
5484var rfc1123 = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun), (\d\d) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) (\d{4}) (\d\d):(\d\d):(\d\d) GMT$/;
5485var rfc850 = /^(Monday|Tuesday|Wednesday|Thursday|Friday|Saturday|Sunday), (\d\d)-(Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)-(\d\d) (\d\d):(\d\d):(\d\d) GMT$/;
5486var ascii = /^(Mon|Tue|Wed|Thu|Fri|Sat|Sun) (Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec) ( \d|\d\d) (\d\d):(\d\d):(\d\d) (\d{4})$/;
5487function extractRFC1123Or850(match2) {
5488 const [, weekdayStr, dayStr, monthStr, yearStr, hourStr, minuteStr, secondStr] = match2, result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
5489 return [result, FixedOffsetZone.utcInstance];
5490}
5491function extractASCII(match2) {
5492 const [, weekdayStr, monthStr, dayStr, hourStr, minuteStr, secondStr, yearStr] = match2, result = fromStrings(weekdayStr, yearStr, monthStr, dayStr, hourStr, minuteStr, secondStr);
5493 return [result, FixedOffsetZone.utcInstance];
5494}
5495var isoYmdWithTimeExtensionRegex = combineRegexes(isoYmdRegex, isoTimeExtensionRegex);
5496var isoWeekWithTimeExtensionRegex = combineRegexes(isoWeekRegex, isoTimeExtensionRegex);
5497var isoOrdinalWithTimeExtensionRegex = combineRegexes(isoOrdinalRegex, isoTimeExtensionRegex);
5498var isoTimeCombinedRegex = combineRegexes(isoTimeRegex);
5499var extractISOYmdTimeAndOffset = combineExtractors(
5500 extractISOYmd,
5501 extractISOTime,
5502 extractISOOffset,
5503 extractIANAZone
5504);
5505var extractISOWeekTimeAndOffset = combineExtractors(
5506 extractISOWeekData,
5507 extractISOTime,
5508 extractISOOffset,
5509 extractIANAZone
5510);
5511var extractISOOrdinalDateAndTime = combineExtractors(
5512 extractISOOrdinalData,
5513 extractISOTime,
5514 extractISOOffset,
5515 extractIANAZone
5516);
5517var extractISOTimeAndOffset = combineExtractors(
5518 extractISOTime,
5519 extractISOOffset,
5520 extractIANAZone
5521);
5522function parseISODate(s2) {
5523 return parse(
5524 s2,
5525 [isoYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],
5526 [isoWeekWithTimeExtensionRegex, extractISOWeekTimeAndOffset],
5527 [isoOrdinalWithTimeExtensionRegex, extractISOOrdinalDateAndTime],
5528 [isoTimeCombinedRegex, extractISOTimeAndOffset]
5529 );
5530}
5531function parseRFC2822Date(s2) {
5532 return parse(preprocessRFC2822(s2), [rfc2822, extractRFC2822]);
5533}
5534function parseHTTPDate(s2) {
5535 return parse(
5536 s2,
5537 [rfc1123, extractRFC1123Or850],
5538 [rfc850, extractRFC1123Or850],
5539 [ascii, extractASCII]
5540 );
5541}
5542function parseISODuration(s2) {
5543 return parse(s2, [isoDuration, extractISODuration]);
5544}
5545var extractISOTimeOnly = combineExtractors(extractISOTime);
5546function parseISOTimeOnly(s2) {
5547 return parse(s2, [isoTimeOnly, extractISOTimeOnly]);
5548}
5549var sqlYmdWithTimeExtensionRegex = combineRegexes(sqlYmdRegex, sqlTimeExtensionRegex);
5550var sqlTimeCombinedRegex = combineRegexes(sqlTimeRegex);
5551var extractISOTimeOffsetAndIANAZone = combineExtractors(
5552 extractISOTime,
5553 extractISOOffset,
5554 extractIANAZone
5555);
5556function parseSQL(s2) {
5557 return parse(
5558 s2,
5559 [sqlYmdWithTimeExtensionRegex, extractISOYmdTimeAndOffset],
5560 [sqlTimeCombinedRegex, extractISOTimeOffsetAndIANAZone]
5561 );
5562}
5563
5564// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/duration.js
5565var INVALID2 = "Invalid Duration";
5566var lowOrderMatrix = {
5567 weeks: {
5568 days: 7,
5569 hours: 7 * 24,
5570 minutes: 7 * 24 * 60,
5571 seconds: 7 * 24 * 60 * 60,
5572 milliseconds: 7 * 24 * 60 * 60 * 1e3
5573 },
5574 days: {
5575 hours: 24,
5576 minutes: 24 * 60,
5577 seconds: 24 * 60 * 60,
5578 milliseconds: 24 * 60 * 60 * 1e3
5579 },
5580 hours: { minutes: 60, seconds: 60 * 60, milliseconds: 60 * 60 * 1e3 },
5581 minutes: { seconds: 60, milliseconds: 60 * 1e3 },
5582 seconds: { milliseconds: 1e3 }
5583};
5584var casualMatrix = {
5585 years: {
5586 quarters: 4,
5587 months: 12,
5588 weeks: 52,
5589 days: 365,
5590 hours: 365 * 24,
5591 minutes: 365 * 24 * 60,
5592 seconds: 365 * 24 * 60 * 60,
5593 milliseconds: 365 * 24 * 60 * 60 * 1e3
5594 },
5595 quarters: {
5596 months: 3,
5597 weeks: 13,
5598 days: 91,
5599 hours: 91 * 24,
5600 minutes: 91 * 24 * 60,
5601 seconds: 91 * 24 * 60 * 60,
5602 milliseconds: 91 * 24 * 60 * 60 * 1e3
5603 },
5604 months: {
5605 weeks: 4,
5606 days: 30,
5607 hours: 30 * 24,
5608 minutes: 30 * 24 * 60,
5609 seconds: 30 * 24 * 60 * 60,
5610 milliseconds: 30 * 24 * 60 * 60 * 1e3
5611 },
5612 ...lowOrderMatrix
5613};
5614var daysInYearAccurate = 146097 / 400;
5615var daysInMonthAccurate = 146097 / 4800;
5616var accurateMatrix = {
5617 years: {
5618 quarters: 4,
5619 months: 12,
5620 weeks: daysInYearAccurate / 7,
5621 days: daysInYearAccurate,
5622 hours: daysInYearAccurate * 24,
5623 minutes: daysInYearAccurate * 24 * 60,
5624 seconds: daysInYearAccurate * 24 * 60 * 60,
5625 milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1e3
5626 },
5627 quarters: {
5628 months: 3,
5629 weeks: daysInYearAccurate / 28,
5630 days: daysInYearAccurate / 4,
5631 hours: daysInYearAccurate * 24 / 4,
5632 minutes: daysInYearAccurate * 24 * 60 / 4,
5633 seconds: daysInYearAccurate * 24 * 60 * 60 / 4,
5634 milliseconds: daysInYearAccurate * 24 * 60 * 60 * 1e3 / 4
5635 },
5636 months: {
5637 weeks: daysInMonthAccurate / 7,
5638 days: daysInMonthAccurate,
5639 hours: daysInMonthAccurate * 24,
5640 minutes: daysInMonthAccurate * 24 * 60,
5641 seconds: daysInMonthAccurate * 24 * 60 * 60,
5642 milliseconds: daysInMonthAccurate * 24 * 60 * 60 * 1e3
5643 },
5644 ...lowOrderMatrix
5645};
5646var orderedUnits = [
5647 "years",
5648 "quarters",
5649 "months",
5650 "weeks",
5651 "days",
5652 "hours",
5653 "minutes",
5654 "seconds",
5655 "milliseconds"
5656];
5657var reverseUnits = orderedUnits.slice(0).reverse();
5658function clone(dur, alts, clear = false) {
5659 const conf = {
5660 values: clear ? alts.values : { ...dur.values, ...alts.values || {} },
5661 loc: dur.loc.clone(alts.loc),
5662 conversionAccuracy: alts.conversionAccuracy || dur.conversionAccuracy,
5663 matrix: alts.matrix || dur.matrix
5664 };
5665 return new Duration(conf);
5666}
5667function antiTrunc(n2) {
5668 return n2 < 0 ? Math.floor(n2) : Math.ceil(n2);
5669}
5670function convert(matrix, fromMap, fromUnit, toMap, toUnit) {
5671 const conv = matrix[toUnit][fromUnit], raw = fromMap[fromUnit] / conv, sameSign = Math.sign(raw) === Math.sign(toMap[toUnit]), added = !sameSign && toMap[toUnit] !== 0 && Math.abs(raw) <= 1 ? antiTrunc(raw) : Math.trunc(raw);
5672 toMap[toUnit] += added;
5673 fromMap[fromUnit] -= added * conv;
5674}
5675function normalizeValues(matrix, vals) {
5676 reverseUnits.reduce((previous, current) => {
5677 if (!isUndefined(vals[current])) {
5678 if (previous) {
5679 convert(matrix, vals, previous, vals, current);
5680 }
5681 return current;
5682 } else {
5683 return previous;
5684 }
5685 }, null);
5686}
5687function removeZeroes(vals) {
5688 const newVals = {};
5689 for (const [key, value] of Object.entries(vals)) {
5690 if (value !== 0) {
5691 newVals[key] = value;
5692 }
5693 }
5694 return newVals;
5695}
5696var Duration = class {
5697 constructor(config) {
5698 const accurate = config.conversionAccuracy === "longterm" || false;
5699 let matrix = accurate ? accurateMatrix : casualMatrix;
5700 if (config.matrix) {
5701 matrix = config.matrix;
5702 }
5703 this.values = config.values;
5704 this.loc = config.loc || Locale.create();
5705 this.conversionAccuracy = accurate ? "longterm" : "casual";
5706 this.invalid = config.invalid || null;
5707 this.matrix = matrix;
5708 this.isLuxonDuration = true;
5709 }
5710 static fromMillis(count, opts) {
5711 return Duration.fromObject({ milliseconds: count }, opts);
5712 }
5713 static fromObject(obj, opts = {}) {
5714 if (obj == null || typeof obj !== "object") {
5715 throw new InvalidArgumentError(
5716 `Duration.fromObject: argument expected to be an object, got ${obj === null ? "null" : typeof obj}`
5717 );
5718 }
5719 return new Duration({
5720 values: normalizeObject(obj, Duration.normalizeUnit),
5721 loc: Locale.fromObject(opts),
5722 conversionAccuracy: opts.conversionAccuracy,
5723 matrix: opts.matrix
5724 });
5725 }
5726 static fromDurationLike(durationLike) {
5727 if (isNumber(durationLike)) {
5728 return Duration.fromMillis(durationLike);
5729 } else if (Duration.isDuration(durationLike)) {
5730 return durationLike;
5731 } else if (typeof durationLike === "object") {
5732 return Duration.fromObject(durationLike);
5733 } else {
5734 throw new InvalidArgumentError(
5735 `Unknown duration argument ${durationLike} of type ${typeof durationLike}`
5736 );
5737 }
5738 }
5739 static fromISO(text, opts) {
5740 const [parsed] = parseISODuration(text);
5741 if (parsed) {
5742 return Duration.fromObject(parsed, opts);
5743 } else {
5744 return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`);
5745 }
5746 }
5747 static fromISOTime(text, opts) {
5748 const [parsed] = parseISOTimeOnly(text);
5749 if (parsed) {
5750 return Duration.fromObject(parsed, opts);
5751 } else {
5752 return Duration.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`);
5753 }
5754 }
5755 static invalid(reason, explanation = null) {
5756 if (!reason) {
5757 throw new InvalidArgumentError("need to specify a reason the Duration is invalid");
5758 }
5759 const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);
5760 if (Settings.throwOnInvalid) {
5761 throw new InvalidDurationError(invalid);
5762 } else {
5763 return new Duration({ invalid });
5764 }
5765 }
5766 static normalizeUnit(unit) {
5767 const normalized = {
5768 year: "years",
5769 years: "years",
5770 quarter: "quarters",
5771 quarters: "quarters",
5772 month: "months",
5773 months: "months",
5774 week: "weeks",
5775 weeks: "weeks",
5776 day: "days",
5777 days: "days",
5778 hour: "hours",
5779 hours: "hours",
5780 minute: "minutes",
5781 minutes: "minutes",
5782 second: "seconds",
5783 seconds: "seconds",
5784 millisecond: "milliseconds",
5785 milliseconds: "milliseconds"
5786 }[unit ? unit.toLowerCase() : unit];
5787 if (!normalized)
5788 throw new InvalidUnitError(unit);
5789 return normalized;
5790 }
5791 static isDuration(o) {
5792 return o && o.isLuxonDuration || false;
5793 }
5794 get locale() {
5795 return this.isValid ? this.loc.locale : null;
5796 }
5797 get numberingSystem() {
5798 return this.isValid ? this.loc.numberingSystem : null;
5799 }
5800 toFormat(fmt, opts = {}) {
5801 const fmtOpts = {
5802 ...opts,
5803 floor: opts.round !== false && opts.floor !== false
5804 };
5805 return this.isValid ? Formatter.create(this.loc, fmtOpts).formatDurationFromString(this, fmt) : INVALID2;
5806 }
5807 toHuman(opts = {}) {
5808 const l2 = orderedUnits.map((unit) => {
5809 const val = this.values[unit];
5810 if (isUndefined(val)) {
5811 return null;
5812 }
5813 return this.loc.numberFormatter({ style: "unit", unitDisplay: "long", ...opts, unit: unit.slice(0, -1) }).format(val);
5814 }).filter((n2) => n2);
5815 return this.loc.listFormatter({ type: "conjunction", style: opts.listStyle || "narrow", ...opts }).format(l2);
5816 }
5817 toObject() {
5818 if (!this.isValid)
5819 return {};
5820 return { ...this.values };
5821 }
5822 toISO() {
5823 if (!this.isValid)
5824 return null;
5825 let s2 = "P";
5826 if (this.years !== 0)
5827 s2 += this.years + "Y";
5828 if (this.months !== 0 || this.quarters !== 0)
5829 s2 += this.months + this.quarters * 3 + "M";
5830 if (this.weeks !== 0)
5831 s2 += this.weeks + "W";
5832 if (this.days !== 0)
5833 s2 += this.days + "D";
5834 if (this.hours !== 0 || this.minutes !== 0 || this.seconds !== 0 || this.milliseconds !== 0)
5835 s2 += "T";
5836 if (this.hours !== 0)
5837 s2 += this.hours + "H";
5838 if (this.minutes !== 0)
5839 s2 += this.minutes + "M";
5840 if (this.seconds !== 0 || this.milliseconds !== 0)
5841 s2 += roundTo(this.seconds + this.milliseconds / 1e3, 3) + "S";
5842 if (s2 === "P")
5843 s2 += "T0S";
5844 return s2;
5845 }
5846 toISOTime(opts = {}) {
5847 if (!this.isValid)
5848 return null;
5849 const millis = this.toMillis();
5850 if (millis < 0 || millis >= 864e5)
5851 return null;
5852 opts = {
5853 suppressMilliseconds: false,
5854 suppressSeconds: false,
5855 includePrefix: false,
5856 format: "extended",
5857 ...opts
5858 };
5859 const value = this.shiftTo("hours", "minutes", "seconds", "milliseconds");
5860 let fmt = opts.format === "basic" ? "hhmm" : "hh:mm";
5861 if (!opts.suppressSeconds || value.seconds !== 0 || value.milliseconds !== 0) {
5862 fmt += opts.format === "basic" ? "ss" : ":ss";
5863 if (!opts.suppressMilliseconds || value.milliseconds !== 0) {
5864 fmt += ".SSS";
5865 }
5866 }
5867 let str = value.toFormat(fmt);
5868 if (opts.includePrefix) {
5869 str = "T" + str;
5870 }
5871 return str;
5872 }
5873 toJSON() {
5874 return this.toISO();
5875 }
5876 toString() {
5877 return this.toISO();
5878 }
5879 toMillis() {
5880 return this.as("milliseconds");
5881 }
5882 valueOf() {
5883 return this.toMillis();
5884 }
5885 plus(duration) {
5886 if (!this.isValid)
5887 return this;
5888 const dur = Duration.fromDurationLike(duration), result = {};
5889 for (const k of orderedUnits) {
5890 if (hasOwnProperty(dur.values, k) || hasOwnProperty(this.values, k)) {
5891 result[k] = dur.get(k) + this.get(k);
5892 }
5893 }
5894 return clone(this, { values: result }, true);
5895 }
5896 minus(duration) {
5897 if (!this.isValid)
5898 return this;
5899 const dur = Duration.fromDurationLike(duration);
5900 return this.plus(dur.negate());
5901 }
5902 mapUnits(fn) {
5903 if (!this.isValid)
5904 return this;
5905 const result = {};
5906 for (const k of Object.keys(this.values)) {
5907 result[k] = asNumber(fn(this.values[k], k));
5908 }
5909 return clone(this, { values: result }, true);
5910 }
5911 get(unit) {
5912 return this[Duration.normalizeUnit(unit)];
5913 }
5914 set(values) {
5915 if (!this.isValid)
5916 return this;
5917 const mixed = { ...this.values, ...normalizeObject(values, Duration.normalizeUnit) };
5918 return clone(this, { values: mixed });
5919 }
5920 reconfigure({ locale, numberingSystem, conversionAccuracy, matrix } = {}) {
5921 const loc = this.loc.clone({ locale, numberingSystem });
5922 const opts = { loc, matrix, conversionAccuracy };
5923 return clone(this, opts);
5924 }
5925 as(unit) {
5926 return this.isValid ? this.shiftTo(unit).get(unit) : NaN;
5927 }
5928 normalize() {
5929 if (!this.isValid)
5930 return this;
5931 const vals = this.toObject();
5932 normalizeValues(this.matrix, vals);
5933 return clone(this, { values: vals }, true);
5934 }
5935 rescale() {
5936 if (!this.isValid)
5937 return this;
5938 const vals = removeZeroes(this.normalize().shiftToAll().toObject());
5939 return clone(this, { values: vals }, true);
5940 }
5941 shiftTo(...units) {
5942 if (!this.isValid)
5943 return this;
5944 if (units.length === 0) {
5945 return this;
5946 }
5947 units = units.map((u) => Duration.normalizeUnit(u));
5948 const built = {}, accumulated = {}, vals = this.toObject();
5949 let lastUnit;
5950 for (const k of orderedUnits) {
5951 if (units.indexOf(k) >= 0) {
5952 lastUnit = k;
5953 let own = 0;
5954 for (const ak in accumulated) {
5955 own += this.matrix[ak][k] * accumulated[ak];
5956 accumulated[ak] = 0;
5957 }
5958 if (isNumber(vals[k])) {
5959 own += vals[k];
5960 }
5961 const i = Math.trunc(own);
5962 built[k] = i;
5963 accumulated[k] = (own * 1e3 - i * 1e3) / 1e3;
5964 for (const down in vals) {
5965 if (orderedUnits.indexOf(down) > orderedUnits.indexOf(k)) {
5966 convert(this.matrix, vals, down, built, k);
5967 }
5968 }
5969 } else if (isNumber(vals[k])) {
5970 accumulated[k] = vals[k];
5971 }
5972 }
5973 for (const key in accumulated) {
5974 if (accumulated[key] !== 0) {
5975 built[lastUnit] += key === lastUnit ? accumulated[key] : accumulated[key] / this.matrix[lastUnit][key];
5976 }
5977 }
5978 return clone(this, { values: built }, true).normalize();
5979 }
5980 shiftToAll() {
5981 if (!this.isValid)
5982 return this;
5983 return this.shiftTo(
5984 "years",
5985 "months",
5986 "weeks",
5987 "days",
5988 "hours",
5989 "minutes",
5990 "seconds",
5991 "milliseconds"
5992 );
5993 }
5994 negate() {
5995 if (!this.isValid)
5996 return this;
5997 const negated = {};
5998 for (const k of Object.keys(this.values)) {
5999 negated[k] = this.values[k] === 0 ? 0 : -this.values[k];
6000 }
6001 return clone(this, { values: negated }, true);
6002 }
6003 get years() {
6004 return this.isValid ? this.values.years || 0 : NaN;
6005 }
6006 get quarters() {
6007 return this.isValid ? this.values.quarters || 0 : NaN;
6008 }
6009 get months() {
6010 return this.isValid ? this.values.months || 0 : NaN;
6011 }
6012 get weeks() {
6013 return this.isValid ? this.values.weeks || 0 : NaN;
6014 }
6015 get days() {
6016 return this.isValid ? this.values.days || 0 : NaN;
6017 }
6018 get hours() {
6019 return this.isValid ? this.values.hours || 0 : NaN;
6020 }
6021 get minutes() {
6022 return this.isValid ? this.values.minutes || 0 : NaN;
6023 }
6024 get seconds() {
6025 return this.isValid ? this.values.seconds || 0 : NaN;
6026 }
6027 get milliseconds() {
6028 return this.isValid ? this.values.milliseconds || 0 : NaN;
6029 }
6030 get isValid() {
6031 return this.invalid === null;
6032 }
6033 get invalidReason() {
6034 return this.invalid ? this.invalid.reason : null;
6035 }
6036 get invalidExplanation() {
6037 return this.invalid ? this.invalid.explanation : null;
6038 }
6039 equals(other) {
6040 if (!this.isValid || !other.isValid) {
6041 return false;
6042 }
6043 if (!this.loc.equals(other.loc)) {
6044 return false;
6045 }
6046 function eq(v1, v2) {
6047 if (v1 === void 0 || v1 === 0)
6048 return v2 === void 0 || v2 === 0;
6049 return v1 === v2;
6050 }
6051 for (const u of orderedUnits) {
6052 if (!eq(this.values[u], other.values[u])) {
6053 return false;
6054 }
6055 }
6056 return true;
6057 }
6058};
6059
6060// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/interval.js
6061var INVALID3 = "Invalid Interval";
6062function validateStartEnd(start, end) {
6063 if (!start || !start.isValid) {
6064 return Interval.invalid("missing or invalid start");
6065 } else if (!end || !end.isValid) {
6066 return Interval.invalid("missing or invalid end");
6067 } else if (end < start) {
6068 return Interval.invalid(
6069 "end before start",
6070 `The end of an interval must be after its start, but you had start=${start.toISO()} and end=${end.toISO()}`
6071 );
6072 } else {
6073 return null;
6074 }
6075}
6076var Interval = class {
6077 constructor(config) {
6078 this.s = config.start;
6079 this.e = config.end;
6080 this.invalid = config.invalid || null;
6081 this.isLuxonInterval = true;
6082 }
6083 static invalid(reason, explanation = null) {
6084 if (!reason) {
6085 throw new InvalidArgumentError("need to specify a reason the Interval is invalid");
6086 }
6087 const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);
6088 if (Settings.throwOnInvalid) {
6089 throw new InvalidIntervalError(invalid);
6090 } else {
6091 return new Interval({ invalid });
6092 }
6093 }
6094 static fromDateTimes(start, end) {
6095 const builtStart = friendlyDateTime(start), builtEnd = friendlyDateTime(end);
6096 const validateError = validateStartEnd(builtStart, builtEnd);
6097 if (validateError == null) {
6098 return new Interval({
6099 start: builtStart,
6100 end: builtEnd
6101 });
6102 } else {
6103 return validateError;
6104 }
6105 }
6106 static after(start, duration) {
6107 const dur = Duration.fromDurationLike(duration), dt = friendlyDateTime(start);
6108 return Interval.fromDateTimes(dt, dt.plus(dur));
6109 }
6110 static before(end, duration) {
6111 const dur = Duration.fromDurationLike(duration), dt = friendlyDateTime(end);
6112 return Interval.fromDateTimes(dt.minus(dur), dt);
6113 }
6114 static fromISO(text, opts) {
6115 const [s2, e] = (text || "").split("/", 2);
6116 if (s2 && e) {
6117 let start, startIsValid;
6118 try {
6119 start = DateTime.fromISO(s2, opts);
6120 startIsValid = start.isValid;
6121 } catch (e2) {
6122 startIsValid = false;
6123 }
6124 let end, endIsValid;
6125 try {
6126 end = DateTime.fromISO(e, opts);
6127 endIsValid = end.isValid;
6128 } catch (e2) {
6129 endIsValid = false;
6130 }
6131 if (startIsValid && endIsValid) {
6132 return Interval.fromDateTimes(start, end);
6133 }
6134 if (startIsValid) {
6135 const dur = Duration.fromISO(e, opts);
6136 if (dur.isValid) {
6137 return Interval.after(start, dur);
6138 }
6139 } else if (endIsValid) {
6140 const dur = Duration.fromISO(s2, opts);
6141 if (dur.isValid) {
6142 return Interval.before(end, dur);
6143 }
6144 }
6145 }
6146 return Interval.invalid("unparsable", `the input "${text}" can't be parsed as ISO 8601`);
6147 }
6148 static isInterval(o) {
6149 return o && o.isLuxonInterval || false;
6150 }
6151 get start() {
6152 return this.isValid ? this.s : null;
6153 }
6154 get end() {
6155 return this.isValid ? this.e : null;
6156 }
6157 get isValid() {
6158 return this.invalidReason === null;
6159 }
6160 get invalidReason() {
6161 return this.invalid ? this.invalid.reason : null;
6162 }
6163 get invalidExplanation() {
6164 return this.invalid ? this.invalid.explanation : null;
6165 }
6166 length(unit = "milliseconds") {
6167 return this.isValid ? this.toDuration(...[unit]).get(unit) : NaN;
6168 }
6169 count(unit = "milliseconds") {
6170 if (!this.isValid)
6171 return NaN;
6172 const start = this.start.startOf(unit), end = this.end.startOf(unit);
6173 return Math.floor(end.diff(start, unit).get(unit)) + 1;
6174 }
6175 hasSame(unit) {
6176 return this.isValid ? this.isEmpty() || this.e.minus(1).hasSame(this.s, unit) : false;
6177 }
6178 isEmpty() {
6179 return this.s.valueOf() === this.e.valueOf();
6180 }
6181 isAfter(dateTime) {
6182 if (!this.isValid)
6183 return false;
6184 return this.s > dateTime;
6185 }
6186 isBefore(dateTime) {
6187 if (!this.isValid)
6188 return false;
6189 return this.e <= dateTime;
6190 }
6191 contains(dateTime) {
6192 if (!this.isValid)
6193 return false;
6194 return this.s <= dateTime && this.e > dateTime;
6195 }
6196 set({ start, end } = {}) {
6197 if (!this.isValid)
6198 return this;
6199 return Interval.fromDateTimes(start || this.s, end || this.e);
6200 }
6201 splitAt(...dateTimes) {
6202 if (!this.isValid)
6203 return [];
6204 const sorted = dateTimes.map(friendlyDateTime).filter((d) => this.contains(d)).sort(), results = [];
6205 let { s: s2 } = this, i = 0;
6206 while (s2 < this.e) {
6207 const added = sorted[i] || this.e, next = +added > +this.e ? this.e : added;
6208 results.push(Interval.fromDateTimes(s2, next));
6209 s2 = next;
6210 i += 1;
6211 }
6212 return results;
6213 }
6214 splitBy(duration) {
6215 const dur = Duration.fromDurationLike(duration);
6216 if (!this.isValid || !dur.isValid || dur.as("milliseconds") === 0) {
6217 return [];
6218 }
6219 let { s: s2 } = this, idx = 1, next;
6220 const results = [];
6221 while (s2 < this.e) {
6222 const added = this.start.plus(dur.mapUnits((x) => x * idx));
6223 next = +added > +this.e ? this.e : added;
6224 results.push(Interval.fromDateTimes(s2, next));
6225 s2 = next;
6226 idx += 1;
6227 }
6228 return results;
6229 }
6230 divideEqually(numberOfParts) {
6231 if (!this.isValid)
6232 return [];
6233 return this.splitBy(this.length() / numberOfParts).slice(0, numberOfParts);
6234 }
6235 overlaps(other) {
6236 return this.e > other.s && this.s < other.e;
6237 }
6238 abutsStart(other) {
6239 if (!this.isValid)
6240 return false;
6241 return +this.e === +other.s;
6242 }
6243 abutsEnd(other) {
6244 if (!this.isValid)
6245 return false;
6246 return +other.e === +this.s;
6247 }
6248 engulfs(other) {
6249 if (!this.isValid)
6250 return false;
6251 return this.s <= other.s && this.e >= other.e;
6252 }
6253 equals(other) {
6254 if (!this.isValid || !other.isValid) {
6255 return false;
6256 }
6257 return this.s.equals(other.s) && this.e.equals(other.e);
6258 }
6259 intersection(other) {
6260 if (!this.isValid)
6261 return this;
6262 const s2 = this.s > other.s ? this.s : other.s, e = this.e < other.e ? this.e : other.e;
6263 if (s2 >= e) {
6264 return null;
6265 } else {
6266 return Interval.fromDateTimes(s2, e);
6267 }
6268 }
6269 union(other) {
6270 if (!this.isValid)
6271 return this;
6272 const s2 = this.s < other.s ? this.s : other.s, e = this.e > other.e ? this.e : other.e;
6273 return Interval.fromDateTimes(s2, e);
6274 }
6275 static merge(intervals) {
6276 const [found, final] = intervals.sort((a, b) => a.s - b.s).reduce(
6277 ([sofar, current], item) => {
6278 if (!current) {
6279 return [sofar, item];
6280 } else if (current.overlaps(item) || current.abutsStart(item)) {
6281 return [sofar, current.union(item)];
6282 } else {
6283 return [sofar.concat([current]), item];
6284 }
6285 },
6286 [[], null]
6287 );
6288 if (final) {
6289 found.push(final);
6290 }
6291 return found;
6292 }
6293 static xor(intervals) {
6294 let start = null, currentCount = 0;
6295 const results = [], ends = intervals.map((i) => [
6296 { time: i.s, type: "s" },
6297 { time: i.e, type: "e" }
6298 ]), flattened = Array.prototype.concat(...ends), arr = flattened.sort((a, b) => a.time - b.time);
6299 for (const i of arr) {
6300 currentCount += i.type === "s" ? 1 : -1;
6301 if (currentCount === 1) {
6302 start = i.time;
6303 } else {
6304 if (start && +start !== +i.time) {
6305 results.push(Interval.fromDateTimes(start, i.time));
6306 }
6307 start = null;
6308 }
6309 }
6310 return Interval.merge(results);
6311 }
6312 difference(...intervals) {
6313 return Interval.xor([this].concat(intervals)).map((i) => this.intersection(i)).filter((i) => i && !i.isEmpty());
6314 }
6315 toString() {
6316 if (!this.isValid)
6317 return INVALID3;
6318 return `[${this.s.toISO()} \u2013 ${this.e.toISO()})`;
6319 }
6320 toLocaleString(formatOpts = DATE_SHORT, opts = {}) {
6321 return this.isValid ? Formatter.create(this.s.loc.clone(opts), formatOpts).formatInterval(this) : INVALID3;
6322 }
6323 toISO(opts) {
6324 if (!this.isValid)
6325 return INVALID3;
6326 return `${this.s.toISO(opts)}/${this.e.toISO(opts)}`;
6327 }
6328 toISODate() {
6329 if (!this.isValid)
6330 return INVALID3;
6331 return `${this.s.toISODate()}/${this.e.toISODate()}`;
6332 }
6333 toISOTime(opts) {
6334 if (!this.isValid)
6335 return INVALID3;
6336 return `${this.s.toISOTime(opts)}/${this.e.toISOTime(opts)}`;
6337 }
6338 toFormat(dateFormat, { separator = " \u2013 " } = {}) {
6339 if (!this.isValid)
6340 return INVALID3;
6341 return `${this.s.toFormat(dateFormat)}${separator}${this.e.toFormat(dateFormat)}`;
6342 }
6343 toDuration(unit, opts) {
6344 if (!this.isValid) {
6345 return Duration.invalid(this.invalidReason);
6346 }
6347 return this.e.diff(this.s, unit, opts);
6348 }
6349 mapEndpoints(mapFn) {
6350 return Interval.fromDateTimes(mapFn(this.s), mapFn(this.e));
6351 }
6352};
6353
6354// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/info.js
6355var Info = class {
6356 static hasDST(zone = Settings.defaultZone) {
6357 const proto = DateTime.now().setZone(zone).set({ month: 12 });
6358 return !zone.isUniversal && proto.offset !== proto.set({ month: 6 }).offset;
6359 }
6360 static isValidIANAZone(zone) {
6361 return IANAZone.isValidZone(zone);
6362 }
6363 static normalizeZone(input) {
6364 return normalizeZone(input, Settings.defaultZone);
6365 }
6366 static months(length = "long", { locale = null, numberingSystem = null, locObj = null, outputCalendar = "gregory" } = {}) {
6367 return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length);
6368 }
6369 static monthsFormat(length = "long", { locale = null, numberingSystem = null, locObj = null, outputCalendar = "gregory" } = {}) {
6370 return (locObj || Locale.create(locale, numberingSystem, outputCalendar)).months(length, true);
6371 }
6372 static weekdays(length = "long", { locale = null, numberingSystem = null, locObj = null } = {}) {
6373 return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length);
6374 }
6375 static weekdaysFormat(length = "long", { locale = null, numberingSystem = null, locObj = null } = {}) {
6376 return (locObj || Locale.create(locale, numberingSystem, null)).weekdays(length, true);
6377 }
6378 static meridiems({ locale = null } = {}) {
6379 return Locale.create(locale).meridiems();
6380 }
6381 static eras(length = "short", { locale = null } = {}) {
6382 return Locale.create(locale, null, "gregory").eras(length);
6383 }
6384 static features() {
6385 return { relative: hasRelative() };
6386 }
6387};
6388
6389// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/diff.js
6390function dayDiff(earlier, later) {
6391 const utcDayStart = (dt) => dt.toUTC(0, { keepLocalTime: true }).startOf("day").valueOf(), ms = utcDayStart(later) - utcDayStart(earlier);
6392 return Math.floor(Duration.fromMillis(ms).as("days"));
6393}
6394function highOrderDiffs(cursor, later, units) {
6395 const differs = [
6396 ["years", (a, b) => b.year - a.year],
6397 ["quarters", (a, b) => b.quarter - a.quarter + (b.year - a.year) * 4],
6398 ["months", (a, b) => b.month - a.month + (b.year - a.year) * 12],
6399 [
6400 "weeks",
6401 (a, b) => {
6402 const days = dayDiff(a, b);
6403 return (days - days % 7) / 7;
6404 }
6405 ],
6406 ["days", dayDiff]
6407 ];
6408 const results = {};
6409 const earlier = cursor;
6410 let lowestOrder, highWater;
6411 for (const [unit, differ] of differs) {
6412 if (units.indexOf(unit) >= 0) {
6413 lowestOrder = unit;
6414 results[unit] = differ(cursor, later);
6415 highWater = earlier.plus(results);
6416 if (highWater > later) {
6417 results[unit]--;
6418 cursor = earlier.plus(results);
6419 } else {
6420 cursor = highWater;
6421 }
6422 }
6423 }
6424 return [cursor, results, highWater, lowestOrder];
6425}
6426function diff_default(earlier, later, units, opts) {
6427 let [cursor, results, highWater, lowestOrder] = highOrderDiffs(earlier, later, units);
6428 const remainingMillis = later - cursor;
6429 const lowerOrderUnits = units.filter(
6430 (u) => ["hours", "minutes", "seconds", "milliseconds"].indexOf(u) >= 0
6431 );
6432 if (lowerOrderUnits.length === 0) {
6433 if (highWater < later) {
6434 highWater = cursor.plus({ [lowestOrder]: 1 });
6435 }
6436 if (highWater !== cursor) {
6437 results[lowestOrder] = (results[lowestOrder] || 0) + remainingMillis / (highWater - cursor);
6438 }
6439 }
6440 const duration = Duration.fromObject(results, opts);
6441 if (lowerOrderUnits.length > 0) {
6442 return Duration.fromMillis(remainingMillis, opts).shiftTo(...lowerOrderUnits).plus(duration);
6443 } else {
6444 return duration;
6445 }
6446}
6447
6448// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/digits.js
6449var numberingSystems = {
6450 arab: "[\u0660-\u0669]",
6451 arabext: "[\u06F0-\u06F9]",
6452 bali: "[\u1B50-\u1B59]",
6453 beng: "[\u09E6-\u09EF]",
6454 deva: "[\u0966-\u096F]",
6455 fullwide: "[\uFF10-\uFF19]",
6456 gujr: "[\u0AE6-\u0AEF]",
6457 hanidec: "[\u3007|\u4E00|\u4E8C|\u4E09|\u56DB|\u4E94|\u516D|\u4E03|\u516B|\u4E5D]",
6458 khmr: "[\u17E0-\u17E9]",
6459 knda: "[\u0CE6-\u0CEF]",
6460 laoo: "[\u0ED0-\u0ED9]",
6461 limb: "[\u1946-\u194F]",
6462 mlym: "[\u0D66-\u0D6F]",
6463 mong: "[\u1810-\u1819]",
6464 mymr: "[\u1040-\u1049]",
6465 orya: "[\u0B66-\u0B6F]",
6466 tamldec: "[\u0BE6-\u0BEF]",
6467 telu: "[\u0C66-\u0C6F]",
6468 thai: "[\u0E50-\u0E59]",
6469 tibt: "[\u0F20-\u0F29]",
6470 latn: "\\d"
6471};
6472var numberingSystemsUTF16 = {
6473 arab: [1632, 1641],
6474 arabext: [1776, 1785],
6475 bali: [6992, 7001],
6476 beng: [2534, 2543],
6477 deva: [2406, 2415],
6478 fullwide: [65296, 65303],
6479 gujr: [2790, 2799],
6480 khmr: [6112, 6121],
6481 knda: [3302, 3311],
6482 laoo: [3792, 3801],
6483 limb: [6470, 6479],
6484 mlym: [3430, 3439],
6485 mong: [6160, 6169],
6486 mymr: [4160, 4169],
6487 orya: [2918, 2927],
6488 tamldec: [3046, 3055],
6489 telu: [3174, 3183],
6490 thai: [3664, 3673],
6491 tibt: [3872, 3881]
6492};
6493var hanidecChars = numberingSystems.hanidec.replace(/[\[|\]]/g, "").split("");
6494function parseDigits(str) {
6495 let value = parseInt(str, 10);
6496 if (isNaN(value)) {
6497 value = "";
6498 for (let i = 0; i < str.length; i++) {
6499 const code = str.charCodeAt(i);
6500 if (str[i].search(numberingSystems.hanidec) !== -1) {
6501 value += hanidecChars.indexOf(str[i]);
6502 } else {
6503 for (const key in numberingSystemsUTF16) {
6504 const [min, max] = numberingSystemsUTF16[key];
6505 if (code >= min && code <= max) {
6506 value += code - min;
6507 }
6508 }
6509 }
6510 }
6511 return parseInt(value, 10);
6512 } else {
6513 return value;
6514 }
6515}
6516function digitRegex({ numberingSystem }, append = "") {
6517 return new RegExp(`${numberingSystems[numberingSystem || "latn"]}${append}`);
6518}
6519
6520// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/tokenParser.js
6521var MISSING_FTP = "missing Intl.DateTimeFormat.formatToParts support";
6522function intUnit(regex, post = (i) => i) {
6523 return { regex, deser: ([s2]) => post(parseDigits(s2)) };
6524}
6525var NBSP = String.fromCharCode(160);
6526var spaceOrNBSP = `[ ${NBSP}]`;
6527var spaceOrNBSPRegExp = new RegExp(spaceOrNBSP, "g");
6528function fixListRegex(s2) {
6529 return s2.replace(/\./g, "\\.?").replace(spaceOrNBSPRegExp, spaceOrNBSP);
6530}
6531function stripInsensitivities(s2) {
6532 return s2.replace(/\./g, "").replace(spaceOrNBSPRegExp, " ").toLowerCase();
6533}
6534function oneOf(strings, startIndex) {
6535 if (strings === null) {
6536 return null;
6537 } else {
6538 return {
6539 regex: RegExp(strings.map(fixListRegex).join("|")),
6540 deser: ([s2]) => strings.findIndex((i) => stripInsensitivities(s2) === stripInsensitivities(i)) + startIndex
6541 };
6542 }
6543}
6544function offset(regex, groups) {
6545 return { regex, deser: ([, h, m]) => signedOffset(h, m), groups };
6546}
6547function simple(regex) {
6548 return { regex, deser: ([s2]) => s2 };
6549}
6550function escapeToken(value) {
6551 return value.replace(/[\-\[\]{}()*+?.,\\\^$|#\s]/g, "\\$&");
6552}
6553function unitForToken(token, loc) {
6554 const one = digitRegex(loc), two = digitRegex(loc, "{2}"), three = digitRegex(loc, "{3}"), four = digitRegex(loc, "{4}"), six = digitRegex(loc, "{6}"), oneOrTwo = digitRegex(loc, "{1,2}"), oneToThree = digitRegex(loc, "{1,3}"), oneToSix = digitRegex(loc, "{1,6}"), oneToNine = digitRegex(loc, "{1,9}"), twoToFour = digitRegex(loc, "{2,4}"), fourToSix = digitRegex(loc, "{4,6}"), literal = (t) => ({ regex: RegExp(escapeToken(t.val)), deser: ([s2]) => s2, literal: true }), unitate = (t) => {
6555 if (token.literal) {
6556 return literal(t);
6557 }
6558 switch (t.val) {
6559 case "G":
6560 return oneOf(loc.eras("short", false), 0);
6561 case "GG":
6562 return oneOf(loc.eras("long", false), 0);
6563 case "y":
6564 return intUnit(oneToSix);
6565 case "yy":
6566 return intUnit(twoToFour, untruncateYear);
6567 case "yyyy":
6568 return intUnit(four);
6569 case "yyyyy":
6570 return intUnit(fourToSix);
6571 case "yyyyyy":
6572 return intUnit(six);
6573 case "M":
6574 return intUnit(oneOrTwo);
6575 case "MM":
6576 return intUnit(two);
6577 case "MMM":
6578 return oneOf(loc.months("short", true, false), 1);
6579 case "MMMM":
6580 return oneOf(loc.months("long", true, false), 1);
6581 case "L":
6582 return intUnit(oneOrTwo);
6583 case "LL":
6584 return intUnit(two);
6585 case "LLL":
6586 return oneOf(loc.months("short", false, false), 1);
6587 case "LLLL":
6588 return oneOf(loc.months("long", false, false), 1);
6589 case "d":
6590 return intUnit(oneOrTwo);
6591 case "dd":
6592 return intUnit(two);
6593 case "o":
6594 return intUnit(oneToThree);
6595 case "ooo":
6596 return intUnit(three);
6597 case "HH":
6598 return intUnit(two);
6599 case "H":
6600 return intUnit(oneOrTwo);
6601 case "hh":
6602 return intUnit(two);
6603 case "h":
6604 return intUnit(oneOrTwo);
6605 case "mm":
6606 return intUnit(two);
6607 case "m":
6608 return intUnit(oneOrTwo);
6609 case "q":
6610 return intUnit(oneOrTwo);
6611 case "qq":
6612 return intUnit(two);
6613 case "s":
6614 return intUnit(oneOrTwo);
6615 case "ss":
6616 return intUnit(two);
6617 case "S":
6618 return intUnit(oneToThree);
6619 case "SSS":
6620 return intUnit(three);
6621 case "u":
6622 return simple(oneToNine);
6623 case "uu":
6624 return simple(oneOrTwo);
6625 case "uuu":
6626 return intUnit(one);
6627 case "a":
6628 return oneOf(loc.meridiems(), 0);
6629 case "kkkk":
6630 return intUnit(four);
6631 case "kk":
6632 return intUnit(twoToFour, untruncateYear);
6633 case "W":
6634 return intUnit(oneOrTwo);
6635 case "WW":
6636 return intUnit(two);
6637 case "E":
6638 case "c":
6639 return intUnit(one);
6640 case "EEE":
6641 return oneOf(loc.weekdays("short", false, false), 1);
6642 case "EEEE":
6643 return oneOf(loc.weekdays("long", false, false), 1);
6644 case "ccc":
6645 return oneOf(loc.weekdays("short", true, false), 1);
6646 case "cccc":
6647 return oneOf(loc.weekdays("long", true, false), 1);
6648 case "Z":
6649 case "ZZ":
6650 return offset(new RegExp(`([+-]${oneOrTwo.source})(?::(${two.source}))?`), 2);
6651 case "ZZZ":
6652 return offset(new RegExp(`([+-]${oneOrTwo.source})(${two.source})?`), 2);
6653 case "z":
6654 return simple(/[a-z_+-/]{1,256}?/i);
6655 default:
6656 return literal(t);
6657 }
6658 };
6659 const unit = unitate(token) || {
6660 invalidReason: MISSING_FTP
6661 };
6662 unit.token = token;
6663 return unit;
6664}
6665var partTypeStyleToTokenVal = {
6666 year: {
6667 "2-digit": "yy",
6668 numeric: "yyyyy"
6669 },
6670 month: {
6671 numeric: "M",
6672 "2-digit": "MM",
6673 short: "MMM",
6674 long: "MMMM"
6675 },
6676 day: {
6677 numeric: "d",
6678 "2-digit": "dd"
6679 },
6680 weekday: {
6681 short: "EEE",
6682 long: "EEEE"
6683 },
6684 dayperiod: "a",
6685 dayPeriod: "a",
6686 hour: {
6687 numeric: "h",
6688 "2-digit": "hh"
6689 },
6690 minute: {
6691 numeric: "m",
6692 "2-digit": "mm"
6693 },
6694 second: {
6695 numeric: "s",
6696 "2-digit": "ss"
6697 },
6698 timeZoneName: {
6699 long: "ZZZZZ",
6700 short: "ZZZ"
6701 }
6702};
6703function tokenForPart(part, formatOpts) {
6704 const { type, value } = part;
6705 if (type === "literal") {
6706 return {
6707 literal: true,
6708 val: value
6709 };
6710 }
6711 const style = formatOpts[type];
6712 let val = partTypeStyleToTokenVal[type];
6713 if (typeof val === "object") {
6714 val = val[style];
6715 }
6716 if (val) {
6717 return {
6718 literal: false,
6719 val
6720 };
6721 }
6722 return void 0;
6723}
6724function buildRegex(units) {
6725 const re = units.map((u) => u.regex).reduce((f, r) => `${f}(${r.source})`, "");
6726 return [`^${re}$`, units];
6727}
6728function match(input, regex, handlers) {
6729 const matches = input.match(regex);
6730 if (matches) {
6731 const all = {};
6732 let matchIndex = 1;
6733 for (const i in handlers) {
6734 if (hasOwnProperty(handlers, i)) {
6735 const h = handlers[i], groups = h.groups ? h.groups + 1 : 1;
6736 if (!h.literal && h.token) {
6737 all[h.token.val[0]] = h.deser(matches.slice(matchIndex, matchIndex + groups));
6738 }
6739 matchIndex += groups;
6740 }
6741 }
6742 return [matches, all];
6743 } else {
6744 return [matches, {}];
6745 }
6746}
6747function dateTimeFromMatches(matches) {
6748 const toField = (token) => {
6749 switch (token) {
6750 case "S":
6751 return "millisecond";
6752 case "s":
6753 return "second";
6754 case "m":
6755 return "minute";
6756 case "h":
6757 case "H":
6758 return "hour";
6759 case "d":
6760 return "day";
6761 case "o":
6762 return "ordinal";
6763 case "L":
6764 case "M":
6765 return "month";
6766 case "y":
6767 return "year";
6768 case "E":
6769 case "c":
6770 return "weekday";
6771 case "W":
6772 return "weekNumber";
6773 case "k":
6774 return "weekYear";
6775 case "q":
6776 return "quarter";
6777 default:
6778 return null;
6779 }
6780 };
6781 let zone = null;
6782 let specificOffset;
6783 if (!isUndefined(matches.z)) {
6784 zone = IANAZone.create(matches.z);
6785 }
6786 if (!isUndefined(matches.Z)) {
6787 if (!zone) {
6788 zone = new FixedOffsetZone(matches.Z);
6789 }
6790 specificOffset = matches.Z;
6791 }
6792 if (!isUndefined(matches.q)) {
6793 matches.M = (matches.q - 1) * 3 + 1;
6794 }
6795 if (!isUndefined(matches.h)) {
6796 if (matches.h < 12 && matches.a === 1) {
6797 matches.h += 12;
6798 } else if (matches.h === 12 && matches.a === 0) {
6799 matches.h = 0;
6800 }
6801 }
6802 if (matches.G === 0 && matches.y) {
6803 matches.y = -matches.y;
6804 }
6805 if (!isUndefined(matches.u)) {
6806 matches.S = parseMillis(matches.u);
6807 }
6808 const vals = Object.keys(matches).reduce((r, k) => {
6809 const f = toField(k);
6810 if (f) {
6811 r[f] = matches[k];
6812 }
6813 return r;
6814 }, {});
6815 return [vals, zone, specificOffset];
6816}
6817var dummyDateTimeCache = null;
6818function getDummyDateTime() {
6819 if (!dummyDateTimeCache) {
6820 dummyDateTimeCache = DateTime.fromMillis(1555555555555);
6821 }
6822 return dummyDateTimeCache;
6823}
6824function maybeExpandMacroToken(token, locale) {
6825 if (token.literal) {
6826 return token;
6827 }
6828 const formatOpts = Formatter.macroTokenToFormatOpts(token.val);
6829 const tokens = formatOptsToTokens(formatOpts, locale);
6830 if (tokens == null || tokens.includes(void 0)) {
6831 return token;
6832 }
6833 return tokens;
6834}
6835function expandMacroTokens(tokens, locale) {
6836 return Array.prototype.concat(...tokens.map((t) => maybeExpandMacroToken(t, locale)));
6837}
6838function explainFromTokens(locale, input, format) {
6839 const tokens = expandMacroTokens(Formatter.parseFormat(format), locale), units = tokens.map((t) => unitForToken(t, locale)), disqualifyingUnit = units.find((t) => t.invalidReason);
6840 if (disqualifyingUnit) {
6841 return { input, tokens, invalidReason: disqualifyingUnit.invalidReason };
6842 } else {
6843 const [regexString, handlers] = buildRegex(units), regex = RegExp(regexString, "i"), [rawMatches, matches] = match(input, regex, handlers), [result, zone, specificOffset] = matches ? dateTimeFromMatches(matches) : [null, null, void 0];
6844 if (hasOwnProperty(matches, "a") && hasOwnProperty(matches, "H")) {
6845 throw new ConflictingSpecificationError(
6846 "Can't include meridiem when specifying 24-hour format"
6847 );
6848 }
6849 return { input, tokens, regex, rawMatches, matches, result, zone, specificOffset };
6850 }
6851}
6852function parseFromTokens(locale, input, format) {
6853 const { result, zone, specificOffset, invalidReason } = explainFromTokens(locale, input, format);
6854 return [result, zone, specificOffset, invalidReason];
6855}
6856function formatOptsToTokens(formatOpts, locale) {
6857 if (!formatOpts) {
6858 return null;
6859 }
6860 const formatter = Formatter.create(locale, formatOpts);
6861 const parts = formatter.formatDateTimeParts(getDummyDateTime());
6862 return parts.map((p) => tokenForPart(p, formatOpts));
6863}
6864
6865// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/impl/conversions.js
6866var nonLeapLadder = [0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334];
6867var leapLadder = [0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335];
6868function unitOutOfRange(unit, value) {
6869 return new Invalid(
6870 "unit out of range",
6871 `you specified ${value} (of type ${typeof value}) as a ${unit}, which is invalid`
6872 );
6873}
6874function dayOfWeek(year, month, day) {
6875 const d = new Date(Date.UTC(year, month - 1, day));
6876 if (year < 100 && year >= 0) {
6877 d.setUTCFullYear(d.getUTCFullYear() - 1900);
6878 }
6879 const js = d.getUTCDay();
6880 return js === 0 ? 7 : js;
6881}
6882function computeOrdinal(year, month, day) {
6883 return day + (isLeapYear(year) ? leapLadder : nonLeapLadder)[month - 1];
6884}
6885function uncomputeOrdinal(year, ordinal) {
6886 const table = isLeapYear(year) ? leapLadder : nonLeapLadder, month0 = table.findIndex((i) => i < ordinal), day = ordinal - table[month0];
6887 return { month: month0 + 1, day };
6888}
6889function gregorianToWeek(gregObj) {
6890 const { year, month, day } = gregObj, ordinal = computeOrdinal(year, month, day), weekday = dayOfWeek(year, month, day);
6891 let weekNumber = Math.floor((ordinal - weekday + 10) / 7), weekYear;
6892 if (weekNumber < 1) {
6893 weekYear = year - 1;
6894 weekNumber = weeksInWeekYear(weekYear);
6895 } else if (weekNumber > weeksInWeekYear(year)) {
6896 weekYear = year + 1;
6897 weekNumber = 1;
6898 } else {
6899 weekYear = year;
6900 }
6901 return { weekYear, weekNumber, weekday, ...timeObject(gregObj) };
6902}
6903function weekToGregorian(weekData) {
6904 const { weekYear, weekNumber, weekday } = weekData, weekdayOfJan4 = dayOfWeek(weekYear, 1, 4), yearInDays = daysInYear(weekYear);
6905 let ordinal = weekNumber * 7 + weekday - weekdayOfJan4 - 3, year;
6906 if (ordinal < 1) {
6907 year = weekYear - 1;
6908 ordinal += daysInYear(year);
6909 } else if (ordinal > yearInDays) {
6910 year = weekYear + 1;
6911 ordinal -= daysInYear(weekYear);
6912 } else {
6913 year = weekYear;
6914 }
6915 const { month, day } = uncomputeOrdinal(year, ordinal);
6916 return { year, month, day, ...timeObject(weekData) };
6917}
6918function gregorianToOrdinal(gregData) {
6919 const { year, month, day } = gregData;
6920 const ordinal = computeOrdinal(year, month, day);
6921 return { year, ordinal, ...timeObject(gregData) };
6922}
6923function ordinalToGregorian(ordinalData) {
6924 const { year, ordinal } = ordinalData;
6925 const { month, day } = uncomputeOrdinal(year, ordinal);
6926 return { year, month, day, ...timeObject(ordinalData) };
6927}
6928function hasInvalidWeekData(obj) {
6929 const validYear = isInteger(obj.weekYear), validWeek = integerBetween(obj.weekNumber, 1, weeksInWeekYear(obj.weekYear)), validWeekday = integerBetween(obj.weekday, 1, 7);
6930 if (!validYear) {
6931 return unitOutOfRange("weekYear", obj.weekYear);
6932 } else if (!validWeek) {
6933 return unitOutOfRange("week", obj.week);
6934 } else if (!validWeekday) {
6935 return unitOutOfRange("weekday", obj.weekday);
6936 } else
6937 return false;
6938}
6939function hasInvalidOrdinalData(obj) {
6940 const validYear = isInteger(obj.year), validOrdinal = integerBetween(obj.ordinal, 1, daysInYear(obj.year));
6941 if (!validYear) {
6942 return unitOutOfRange("year", obj.year);
6943 } else if (!validOrdinal) {
6944 return unitOutOfRange("ordinal", obj.ordinal);
6945 } else
6946 return false;
6947}
6948function hasInvalidGregorianData(obj) {
6949 const validYear = isInteger(obj.year), validMonth = integerBetween(obj.month, 1, 12), validDay = integerBetween(obj.day, 1, daysInMonth(obj.year, obj.month));
6950 if (!validYear) {
6951 return unitOutOfRange("year", obj.year);
6952 } else if (!validMonth) {
6953 return unitOutOfRange("month", obj.month);
6954 } else if (!validDay) {
6955 return unitOutOfRange("day", obj.day);
6956 } else
6957 return false;
6958}
6959function hasInvalidTimeData(obj) {
6960 const { hour, minute, second, millisecond } = obj;
6961 const validHour = integerBetween(hour, 0, 23) || hour === 24 && minute === 0 && second === 0 && millisecond === 0, validMinute = integerBetween(minute, 0, 59), validSecond = integerBetween(second, 0, 59), validMillisecond = integerBetween(millisecond, 0, 999);
6962 if (!validHour) {
6963 return unitOutOfRange("hour", hour);
6964 } else if (!validMinute) {
6965 return unitOutOfRange("minute", minute);
6966 } else if (!validSecond) {
6967 return unitOutOfRange("second", second);
6968 } else if (!validMillisecond) {
6969 return unitOutOfRange("millisecond", millisecond);
6970 } else
6971 return false;
6972}
6973
6974// ../../node_modules/.pnpm/luxon@3.2.1/node_modules/luxon/src/datetime.js
6975var INVALID4 = "Invalid DateTime";
6976var MAX_DATE = 864e13;
6977function unsupportedZone(zone) {
6978 return new Invalid("unsupported zone", `the zone "${zone.name}" is not supported`);
6979}
6980function possiblyCachedWeekData(dt) {
6981 if (dt.weekData === null) {
6982 dt.weekData = gregorianToWeek(dt.c);
6983 }
6984 return dt.weekData;
6985}
6986function clone2(inst, alts) {
6987 const current = {
6988 ts: inst.ts,
6989 zone: inst.zone,
6990 c: inst.c,
6991 o: inst.o,
6992 loc: inst.loc,
6993 invalid: inst.invalid
6994 };
6995 return new DateTime({ ...current, ...alts, old: current });
6996}
6997function fixOffset(localTS, o, tz) {
6998 let utcGuess = localTS - o * 60 * 1e3;
6999 const o2 = tz.offset(utcGuess);
7000 if (o === o2) {
7001 return [utcGuess, o];
7002 }
7003 utcGuess -= (o2 - o) * 60 * 1e3;
7004 const o3 = tz.offset(utcGuess);
7005 if (o2 === o3) {
7006 return [utcGuess, o2];
7007 }
7008 return [localTS - Math.min(o2, o3) * 60 * 1e3, Math.max(o2, o3)];
7009}
7010function tsToObj(ts, offset2) {
7011 ts += offset2 * 60 * 1e3;
7012 const d = new Date(ts);
7013 return {
7014 year: d.getUTCFullYear(),
7015 month: d.getUTCMonth() + 1,
7016 day: d.getUTCDate(),
7017 hour: d.getUTCHours(),
7018 minute: d.getUTCMinutes(),
7019 second: d.getUTCSeconds(),
7020 millisecond: d.getUTCMilliseconds()
7021 };
7022}
7023function objToTS(obj, offset2, zone) {
7024 return fixOffset(objToLocalTS(obj), offset2, zone);
7025}
7026function adjustTime(inst, dur) {
7027 const oPre = inst.o, year = inst.c.year + Math.trunc(dur.years), month = inst.c.month + Math.trunc(dur.months) + Math.trunc(dur.quarters) * 3, c = {
7028 ...inst.c,
7029 year,
7030 month,
7031 day: Math.min(inst.c.day, daysInMonth(year, month)) + Math.trunc(dur.days) + Math.trunc(dur.weeks) * 7
7032 }, millisToAdd = Duration.fromObject({
7033 years: dur.years - Math.trunc(dur.years),
7034 quarters: dur.quarters - Math.trunc(dur.quarters),
7035 months: dur.months - Math.trunc(dur.months),
7036 weeks: dur.weeks - Math.trunc(dur.weeks),
7037 days: dur.days - Math.trunc(dur.days),
7038 hours: dur.hours,
7039 minutes: dur.minutes,
7040 seconds: dur.seconds,
7041 milliseconds: dur.milliseconds
7042 }).as("milliseconds"), localTS = objToLocalTS(c);
7043 let [ts, o] = fixOffset(localTS, oPre, inst.zone);
7044 if (millisToAdd !== 0) {
7045 ts += millisToAdd;
7046 o = inst.zone.offset(ts);
7047 }
7048 return { ts, o };
7049}
7050function parseDataToDateTime(parsed, parsedZone, opts, format, text, specificOffset) {
7051 const { setZone, zone } = opts;
7052 if (parsed && Object.keys(parsed).length !== 0) {
7053 const interpretationZone = parsedZone || zone, inst = DateTime.fromObject(parsed, {
7054 ...opts,
7055 zone: interpretationZone,
7056 specificOffset
7057 });
7058 return setZone ? inst : inst.setZone(zone);
7059 } else {
7060 return DateTime.invalid(
7061 new Invalid("unparsable", `the input "${text}" can't be parsed as ${format}`)
7062 );
7063 }
7064}
7065function toTechFormat(dt, format, allowZ = true) {
7066 return dt.isValid ? Formatter.create(Locale.create("en-US"), {
7067 allowZ,
7068 forceSimple: true
7069 }).formatDateTimeFromString(dt, format) : null;
7070}
7071function toISODate(o, extended) {
7072 const longFormat = o.c.year > 9999 || o.c.year < 0;
7073 let c = "";
7074 if (longFormat && o.c.year >= 0)
7075 c += "+";
7076 c += padStart(o.c.year, longFormat ? 6 : 4);
7077 if (extended) {
7078 c += "-";
7079 c += padStart(o.c.month);
7080 c += "-";
7081 c += padStart(o.c.day);
7082 } else {
7083 c += padStart(o.c.month);
7084 c += padStart(o.c.day);
7085 }
7086 return c;
7087}
7088function toISOTime(o, extended, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone) {
7089 let c = padStart(o.c.hour);
7090 if (extended) {
7091 c += ":";
7092 c += padStart(o.c.minute);
7093 if (o.c.second !== 0 || !suppressSeconds) {
7094 c += ":";
7095 }
7096 } else {
7097 c += padStart(o.c.minute);
7098 }
7099 if (o.c.second !== 0 || !suppressSeconds) {
7100 c += padStart(o.c.second);
7101 if (o.c.millisecond !== 0 || !suppressMilliseconds) {
7102 c += ".";
7103 c += padStart(o.c.millisecond, 3);
7104 }
7105 }
7106 if (includeOffset) {
7107 if (o.isOffsetFixed && o.offset === 0 && !extendedZone) {
7108 c += "Z";
7109 } else if (o.o < 0) {
7110 c += "-";
7111 c += padStart(Math.trunc(-o.o / 60));
7112 c += ":";
7113 c += padStart(Math.trunc(-o.o % 60));
7114 } else {
7115 c += "+";
7116 c += padStart(Math.trunc(o.o / 60));
7117 c += ":";
7118 c += padStart(Math.trunc(o.o % 60));
7119 }
7120 }
7121 if (extendedZone) {
7122 c += "[" + o.zone.ianaName + "]";
7123 }
7124 return c;
7125}
7126var defaultUnitValues = {
7127 month: 1,
7128 day: 1,
7129 hour: 0,
7130 minute: 0,
7131 second: 0,
7132 millisecond: 0
7133};
7134var defaultWeekUnitValues = {
7135 weekNumber: 1,
7136 weekday: 1,
7137 hour: 0,
7138 minute: 0,
7139 second: 0,
7140 millisecond: 0
7141};
7142var defaultOrdinalUnitValues = {
7143 ordinal: 1,
7144 hour: 0,
7145 minute: 0,
7146 second: 0,
7147 millisecond: 0
7148};
7149var orderedUnits2 = ["year", "month", "day", "hour", "minute", "second", "millisecond"];
7150var orderedWeekUnits = [
7151 "weekYear",
7152 "weekNumber",
7153 "weekday",
7154 "hour",
7155 "minute",
7156 "second",
7157 "millisecond"
7158];
7159var orderedOrdinalUnits = ["year", "ordinal", "hour", "minute", "second", "millisecond"];
7160function normalizeUnit(unit) {
7161 const normalized = {
7162 year: "year",
7163 years: "year",
7164 month: "month",
7165 months: "month",
7166 day: "day",
7167 days: "day",
7168 hour: "hour",
7169 hours: "hour",
7170 minute: "minute",
7171 minutes: "minute",
7172 quarter: "quarter",
7173 quarters: "quarter",
7174 second: "second",
7175 seconds: "second",
7176 millisecond: "millisecond",
7177 milliseconds: "millisecond",
7178 weekday: "weekday",
7179 weekdays: "weekday",
7180 weeknumber: "weekNumber",
7181 weeksnumber: "weekNumber",
7182 weeknumbers: "weekNumber",
7183 weekyear: "weekYear",
7184 weekyears: "weekYear",
7185 ordinal: "ordinal"
7186 }[unit.toLowerCase()];
7187 if (!normalized)
7188 throw new InvalidUnitError(unit);
7189 return normalized;
7190}
7191function quickDT(obj, opts) {
7192 const zone = normalizeZone(opts.zone, Settings.defaultZone), loc = Locale.fromObject(opts), tsNow = Settings.now();
7193 let ts, o;
7194 if (!isUndefined(obj.year)) {
7195 for (const u of orderedUnits2) {
7196 if (isUndefined(obj[u])) {
7197 obj[u] = defaultUnitValues[u];
7198 }
7199 }
7200 const invalid = hasInvalidGregorianData(obj) || hasInvalidTimeData(obj);
7201 if (invalid) {
7202 return DateTime.invalid(invalid);
7203 }
7204 const offsetProvis = zone.offset(tsNow);
7205 [ts, o] = objToTS(obj, offsetProvis, zone);
7206 } else {
7207 ts = tsNow;
7208 }
7209 return new DateTime({ ts, zone, loc, o });
7210}
7211function diffRelative(start, end, opts) {
7212 const round = isUndefined(opts.round) ? true : opts.round, format = (c, unit) => {
7213 c = roundTo(c, round || opts.calendary ? 0 : 2, true);
7214 const formatter = end.loc.clone(opts).relFormatter(opts);
7215 return formatter.format(c, unit);
7216 }, differ = (unit) => {
7217 if (opts.calendary) {
7218 if (!end.hasSame(start, unit)) {
7219 return end.startOf(unit).diff(start.startOf(unit), unit).get(unit);
7220 } else
7221 return 0;
7222 } else {
7223 return end.diff(start, unit).get(unit);
7224 }
7225 };
7226 if (opts.unit) {
7227 return format(differ(opts.unit), opts.unit);
7228 }
7229 for (const unit of opts.units) {
7230 const count = differ(unit);
7231 if (Math.abs(count) >= 1) {
7232 return format(count, unit);
7233 }
7234 }
7235 return format(start > end ? -0 : 0, opts.units[opts.units.length - 1]);
7236}
7237function lastOpts(argList) {
7238 let opts = {}, args;
7239 if (argList.length > 0 && typeof argList[argList.length - 1] === "object") {
7240 opts = argList[argList.length - 1];
7241 args = Array.from(argList).slice(0, argList.length - 1);
7242 } else {
7243 args = Array.from(argList);
7244 }
7245 return [opts, args];
7246}
7247var DateTime = class {
7248 constructor(config) {
7249 const zone = config.zone || Settings.defaultZone;
7250 let invalid = config.invalid || (Number.isNaN(config.ts) ? new Invalid("invalid input") : null) || (!zone.isValid ? unsupportedZone(zone) : null);
7251 this.ts = isUndefined(config.ts) ? Settings.now() : config.ts;
7252 let c = null, o = null;
7253 if (!invalid) {
7254 const unchanged = config.old && config.old.ts === this.ts && config.old.zone.equals(zone);
7255 if (unchanged) {
7256 [c, o] = [config.old.c, config.old.o];
7257 } else {
7258 const ot = zone.offset(this.ts);
7259 c = tsToObj(this.ts, ot);
7260 invalid = Number.isNaN(c.year) ? new Invalid("invalid input") : null;
7261 c = invalid ? null : c;
7262 o = invalid ? null : ot;
7263 }
7264 }
7265 this._zone = zone;
7266 this.loc = config.loc || Locale.create();
7267 this.invalid = invalid;
7268 this.weekData = null;
7269 this.c = c;
7270 this.o = o;
7271 this.isLuxonDateTime = true;
7272 }
7273 static now() {
7274 return new DateTime({});
7275 }
7276 static local() {
7277 const [opts, args] = lastOpts(arguments), [year, month, day, hour, minute, second, millisecond] = args;
7278 return quickDT({ year, month, day, hour, minute, second, millisecond }, opts);
7279 }
7280 static utc() {
7281 const [opts, args] = lastOpts(arguments), [year, month, day, hour, minute, second, millisecond] = args;
7282 opts.zone = FixedOffsetZone.utcInstance;
7283 return quickDT({ year, month, day, hour, minute, second, millisecond }, opts);
7284 }
7285 static fromJSDate(date, options = {}) {
7286 const ts = isDate(date) ? date.valueOf() : NaN;
7287 if (Number.isNaN(ts)) {
7288 return DateTime.invalid("invalid input");
7289 }
7290 const zoneToUse = normalizeZone(options.zone, Settings.defaultZone);
7291 if (!zoneToUse.isValid) {
7292 return DateTime.invalid(unsupportedZone(zoneToUse));
7293 }
7294 return new DateTime({
7295 ts,
7296 zone: zoneToUse,
7297 loc: Locale.fromObject(options)
7298 });
7299 }
7300 static fromMillis(milliseconds, options = {}) {
7301 if (!isNumber(milliseconds)) {
7302 throw new InvalidArgumentError(
7303 `fromMillis requires a numerical input, but received a ${typeof milliseconds} with value ${milliseconds}`
7304 );
7305 } else if (milliseconds < -MAX_DATE || milliseconds > MAX_DATE) {
7306 return DateTime.invalid("Timestamp out of range");
7307 } else {
7308 return new DateTime({
7309 ts: milliseconds,
7310 zone: normalizeZone(options.zone, Settings.defaultZone),
7311 loc: Locale.fromObject(options)
7312 });
7313 }
7314 }
7315 static fromSeconds(seconds, options = {}) {
7316 if (!isNumber(seconds)) {
7317 throw new InvalidArgumentError("fromSeconds requires a numerical input");
7318 } else {
7319 return new DateTime({
7320 ts: seconds * 1e3,
7321 zone: normalizeZone(options.zone, Settings.defaultZone),
7322 loc: Locale.fromObject(options)
7323 });
7324 }
7325 }
7326 static fromObject(obj, opts = {}) {
7327 obj = obj || {};
7328 const zoneToUse = normalizeZone(opts.zone, Settings.defaultZone);
7329 if (!zoneToUse.isValid) {
7330 return DateTime.invalid(unsupportedZone(zoneToUse));
7331 }
7332 const tsNow = Settings.now(), offsetProvis = !isUndefined(opts.specificOffset) ? opts.specificOffset : zoneToUse.offset(tsNow), normalized = normalizeObject(obj, normalizeUnit), containsOrdinal = !isUndefined(normalized.ordinal), containsGregorYear = !isUndefined(normalized.year), containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), containsGregor = containsGregorYear || containsGregorMD, definiteWeekDef = normalized.weekYear || normalized.weekNumber, loc = Locale.fromObject(opts);
7333 if ((containsGregor || containsOrdinal) && definiteWeekDef) {
7334 throw new ConflictingSpecificationError(
7335 "Can't mix weekYear/weekNumber units with year/month/day or ordinals"
7336 );
7337 }
7338 if (containsGregorMD && containsOrdinal) {
7339 throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");
7340 }
7341 const useWeekData = definiteWeekDef || normalized.weekday && !containsGregor;
7342 let units, defaultValues, objNow = tsToObj(tsNow, offsetProvis);
7343 if (useWeekData) {
7344 units = orderedWeekUnits;
7345 defaultValues = defaultWeekUnitValues;
7346 objNow = gregorianToWeek(objNow);
7347 } else if (containsOrdinal) {
7348 units = orderedOrdinalUnits;
7349 defaultValues = defaultOrdinalUnitValues;
7350 objNow = gregorianToOrdinal(objNow);
7351 } else {
7352 units = orderedUnits2;
7353 defaultValues = defaultUnitValues;
7354 }
7355 let foundFirst = false;
7356 for (const u of units) {
7357 const v = normalized[u];
7358 if (!isUndefined(v)) {
7359 foundFirst = true;
7360 } else if (foundFirst) {
7361 normalized[u] = defaultValues[u];
7362 } else {
7363 normalized[u] = objNow[u];
7364 }
7365 }
7366 const higherOrderInvalid = useWeekData ? hasInvalidWeekData(normalized) : containsOrdinal ? hasInvalidOrdinalData(normalized) : hasInvalidGregorianData(normalized), invalid = higherOrderInvalid || hasInvalidTimeData(normalized);
7367 if (invalid) {
7368 return DateTime.invalid(invalid);
7369 }
7370 const gregorian = useWeekData ? weekToGregorian(normalized) : containsOrdinal ? ordinalToGregorian(normalized) : normalized, [tsFinal, offsetFinal] = objToTS(gregorian, offsetProvis, zoneToUse), inst = new DateTime({
7371 ts: tsFinal,
7372 zone: zoneToUse,
7373 o: offsetFinal,
7374 loc
7375 });
7376 if (normalized.weekday && containsGregor && obj.weekday !== inst.weekday) {
7377 return DateTime.invalid(
7378 "mismatched weekday",
7379 `you can't specify both a weekday of ${normalized.weekday} and a date of ${inst.toISO()}`
7380 );
7381 }
7382 return inst;
7383 }
7384 static fromISO(text, opts = {}) {
7385 const [vals, parsedZone] = parseISODate(text);
7386 return parseDataToDateTime(vals, parsedZone, opts, "ISO 8601", text);
7387 }
7388 static fromRFC2822(text, opts = {}) {
7389 const [vals, parsedZone] = parseRFC2822Date(text);
7390 return parseDataToDateTime(vals, parsedZone, opts, "RFC 2822", text);
7391 }
7392 static fromHTTP(text, opts = {}) {
7393 const [vals, parsedZone] = parseHTTPDate(text);
7394 return parseDataToDateTime(vals, parsedZone, opts, "HTTP", opts);
7395 }
7396 static fromFormat(text, fmt, opts = {}) {
7397 if (isUndefined(text) || isUndefined(fmt)) {
7398 throw new InvalidArgumentError("fromFormat requires an input string and a format");
7399 }
7400 const { locale = null, numberingSystem = null } = opts, localeToUse = Locale.fromOpts({
7401 locale,
7402 numberingSystem,
7403 defaultToEN: true
7404 }), [vals, parsedZone, specificOffset, invalid] = parseFromTokens(localeToUse, text, fmt);
7405 if (invalid) {
7406 return DateTime.invalid(invalid);
7407 } else {
7408 return parseDataToDateTime(vals, parsedZone, opts, `format ${fmt}`, text, specificOffset);
7409 }
7410 }
7411 static fromString(text, fmt, opts = {}) {
7412 return DateTime.fromFormat(text, fmt, opts);
7413 }
7414 static fromSQL(text, opts = {}) {
7415 const [vals, parsedZone] = parseSQL(text);
7416 return parseDataToDateTime(vals, parsedZone, opts, "SQL", text);
7417 }
7418 static invalid(reason, explanation = null) {
7419 if (!reason) {
7420 throw new InvalidArgumentError("need to specify a reason the DateTime is invalid");
7421 }
7422 const invalid = reason instanceof Invalid ? reason : new Invalid(reason, explanation);
7423 if (Settings.throwOnInvalid) {
7424 throw new InvalidDateTimeError(invalid);
7425 } else {
7426 return new DateTime({ invalid });
7427 }
7428 }
7429 static isDateTime(o) {
7430 return o && o.isLuxonDateTime || false;
7431 }
7432 static parseFormatForOpts(formatOpts, localeOpts = {}) {
7433 const tokenList = formatOptsToTokens(formatOpts, Locale.fromObject(localeOpts));
7434 return !tokenList ? null : tokenList.map((t) => t ? t.val : null).join("");
7435 }
7436 static expandFormat(fmt, localeOpts = {}) {
7437 const expanded = expandMacroTokens(Formatter.parseFormat(fmt), Locale.fromObject(localeOpts));
7438 return expanded.map((t) => t.val).join("");
7439 }
7440 get(unit) {
7441 return this[unit];
7442 }
7443 get isValid() {
7444 return this.invalid === null;
7445 }
7446 get invalidReason() {
7447 return this.invalid ? this.invalid.reason : null;
7448 }
7449 get invalidExplanation() {
7450 return this.invalid ? this.invalid.explanation : null;
7451 }
7452 get locale() {
7453 return this.isValid ? this.loc.locale : null;
7454 }
7455 get numberingSystem() {
7456 return this.isValid ? this.loc.numberingSystem : null;
7457 }
7458 get outputCalendar() {
7459 return this.isValid ? this.loc.outputCalendar : null;
7460 }
7461 get zone() {
7462 return this._zone;
7463 }
7464 get zoneName() {
7465 return this.isValid ? this.zone.name : null;
7466 }
7467 get year() {
7468 return this.isValid ? this.c.year : NaN;
7469 }
7470 get quarter() {
7471 return this.isValid ? Math.ceil(this.c.month / 3) : NaN;
7472 }
7473 get month() {
7474 return this.isValid ? this.c.month : NaN;
7475 }
7476 get day() {
7477 return this.isValid ? this.c.day : NaN;
7478 }
7479 get hour() {
7480 return this.isValid ? this.c.hour : NaN;
7481 }
7482 get minute() {
7483 return this.isValid ? this.c.minute : NaN;
7484 }
7485 get second() {
7486 return this.isValid ? this.c.second : NaN;
7487 }
7488 get millisecond() {
7489 return this.isValid ? this.c.millisecond : NaN;
7490 }
7491 get weekYear() {
7492 return this.isValid ? possiblyCachedWeekData(this).weekYear : NaN;
7493 }
7494 get weekNumber() {
7495 return this.isValid ? possiblyCachedWeekData(this).weekNumber : NaN;
7496 }
7497 get weekday() {
7498 return this.isValid ? possiblyCachedWeekData(this).weekday : NaN;
7499 }
7500 get ordinal() {
7501 return this.isValid ? gregorianToOrdinal(this.c).ordinal : NaN;
7502 }
7503 get monthShort() {
7504 return this.isValid ? Info.months("short", { locObj: this.loc })[this.month - 1] : null;
7505 }
7506 get monthLong() {
7507 return this.isValid ? Info.months("long", { locObj: this.loc })[this.month - 1] : null;
7508 }
7509 get weekdayShort() {
7510 return this.isValid ? Info.weekdays("short", { locObj: this.loc })[this.weekday - 1] : null;
7511 }
7512 get weekdayLong() {
7513 return this.isValid ? Info.weekdays("long", { locObj: this.loc })[this.weekday - 1] : null;
7514 }
7515 get offset() {
7516 return this.isValid ? +this.o : NaN;
7517 }
7518 get offsetNameShort() {
7519 if (this.isValid) {
7520 return this.zone.offsetName(this.ts, {
7521 format: "short",
7522 locale: this.locale
7523 });
7524 } else {
7525 return null;
7526 }
7527 }
7528 get offsetNameLong() {
7529 if (this.isValid) {
7530 return this.zone.offsetName(this.ts, {
7531 format: "long",
7532 locale: this.locale
7533 });
7534 } else {
7535 return null;
7536 }
7537 }
7538 get isOffsetFixed() {
7539 return this.isValid ? this.zone.isUniversal : null;
7540 }
7541 get isInDST() {
7542 if (this.isOffsetFixed) {
7543 return false;
7544 } else {
7545 return this.offset > this.set({ month: 1, day: 1 }).offset || this.offset > this.set({ month: 5 }).offset;
7546 }
7547 }
7548 get isInLeapYear() {
7549 return isLeapYear(this.year);
7550 }
7551 get daysInMonth() {
7552 return daysInMonth(this.year, this.month);
7553 }
7554 get daysInYear() {
7555 return this.isValid ? daysInYear(this.year) : NaN;
7556 }
7557 get weeksInWeekYear() {
7558 return this.isValid ? weeksInWeekYear(this.weekYear) : NaN;
7559 }
7560 resolvedLocaleOptions(opts = {}) {
7561 const { locale, numberingSystem, calendar } = Formatter.create(
7562 this.loc.clone(opts),
7563 opts
7564 ).resolvedOptions(this);
7565 return { locale, numberingSystem, outputCalendar: calendar };
7566 }
7567 toUTC(offset2 = 0, opts = {}) {
7568 return this.setZone(FixedOffsetZone.instance(offset2), opts);
7569 }
7570 toLocal() {
7571 return this.setZone(Settings.defaultZone);
7572 }
7573 setZone(zone, { keepLocalTime = false, keepCalendarTime = false } = {}) {
7574 zone = normalizeZone(zone, Settings.defaultZone);
7575 if (zone.equals(this.zone)) {
7576 return this;
7577 } else if (!zone.isValid) {
7578 return DateTime.invalid(unsupportedZone(zone));
7579 } else {
7580 let newTS = this.ts;
7581 if (keepLocalTime || keepCalendarTime) {
7582 const offsetGuess = zone.offset(this.ts);
7583 const asObj = this.toObject();
7584 [newTS] = objToTS(asObj, offsetGuess, zone);
7585 }
7586 return clone2(this, { ts: newTS, zone });
7587 }
7588 }
7589 reconfigure({ locale, numberingSystem, outputCalendar } = {}) {
7590 const loc = this.loc.clone({ locale, numberingSystem, outputCalendar });
7591 return clone2(this, { loc });
7592 }
7593 setLocale(locale) {
7594 return this.reconfigure({ locale });
7595 }
7596 set(values) {
7597 if (!this.isValid)
7598 return this;
7599 const normalized = normalizeObject(values, normalizeUnit), settingWeekStuff = !isUndefined(normalized.weekYear) || !isUndefined(normalized.weekNumber) || !isUndefined(normalized.weekday), containsOrdinal = !isUndefined(normalized.ordinal), containsGregorYear = !isUndefined(normalized.year), containsGregorMD = !isUndefined(normalized.month) || !isUndefined(normalized.day), containsGregor = containsGregorYear || containsGregorMD, definiteWeekDef = normalized.weekYear || normalized.weekNumber;
7600 if ((containsGregor || containsOrdinal) && definiteWeekDef) {
7601 throw new ConflictingSpecificationError(
7602 "Can't mix weekYear/weekNumber units with year/month/day or ordinals"
7603 );
7604 }
7605 if (containsGregorMD && containsOrdinal) {
7606 throw new ConflictingSpecificationError("Can't mix ordinal dates with month/day");
7607 }
7608 let mixed;
7609 if (settingWeekStuff) {
7610 mixed = weekToGregorian({ ...gregorianToWeek(this.c), ...normalized });
7611 } else if (!isUndefined(normalized.ordinal)) {
7612 mixed = ordinalToGregorian({ ...gregorianToOrdinal(this.c), ...normalized });
7613 } else {
7614 mixed = { ...this.toObject(), ...normalized };
7615 if (isUndefined(normalized.day)) {
7616 mixed.day = Math.min(daysInMonth(mixed.year, mixed.month), mixed.day);
7617 }
7618 }
7619 const [ts, o] = objToTS(mixed, this.o, this.zone);
7620 return clone2(this, { ts, o });
7621 }
7622 plus(duration) {
7623 if (!this.isValid)
7624 return this;
7625 const dur = Duration.fromDurationLike(duration);
7626 return clone2(this, adjustTime(this, dur));
7627 }
7628 minus(duration) {
7629 if (!this.isValid)
7630 return this;
7631 const dur = Duration.fromDurationLike(duration).negate();
7632 return clone2(this, adjustTime(this, dur));
7633 }
7634 startOf(unit) {
7635 if (!this.isValid)
7636 return this;
7637 const o = {}, normalizedUnit = Duration.normalizeUnit(unit);
7638 switch (normalizedUnit) {
7639 case "years":
7640 o.month = 1;
7641 case "quarters":
7642 case "months":
7643 o.day = 1;
7644 case "weeks":
7645 case "days":
7646 o.hour = 0;
7647 case "hours":
7648 o.minute = 0;
7649 case "minutes":
7650 o.second = 0;
7651 case "seconds":
7652 o.millisecond = 0;
7653 break;
7654 case "milliseconds":
7655 break;
7656 }
7657 if (normalizedUnit === "weeks") {
7658 o.weekday = 1;
7659 }
7660 if (normalizedUnit === "quarters") {
7661 const q = Math.ceil(this.month / 3);
7662 o.month = (q - 1) * 3 + 1;
7663 }
7664 return this.set(o);
7665 }
7666 endOf(unit) {
7667 return this.isValid ? this.plus({ [unit]: 1 }).startOf(unit).minus(1) : this;
7668 }
7669 toFormat(fmt, opts = {}) {
7670 return this.isValid ? Formatter.create(this.loc.redefaultToEN(opts)).formatDateTimeFromString(this, fmt) : INVALID4;
7671 }
7672 toLocaleString(formatOpts = DATE_SHORT, opts = {}) {
7673 return this.isValid ? Formatter.create(this.loc.clone(opts), formatOpts).formatDateTime(this) : INVALID4;
7674 }
7675 toLocaleParts(opts = {}) {
7676 return this.isValid ? Formatter.create(this.loc.clone(opts), opts).formatDateTimeParts(this) : [];
7677 }
7678 toISO({
7679 format = "extended",
7680 suppressSeconds = false,
7681 suppressMilliseconds = false,
7682 includeOffset = true,
7683 extendedZone = false
7684 } = {}) {
7685 if (!this.isValid) {
7686 return null;
7687 }
7688 const ext = format === "extended";
7689 let c = toISODate(this, ext);
7690 c += "T";
7691 c += toISOTime(this, ext, suppressSeconds, suppressMilliseconds, includeOffset, extendedZone);
7692 return c;
7693 }
7694 toISODate({ format = "extended" } = {}) {
7695 if (!this.isValid) {
7696 return null;
7697 }
7698 return toISODate(this, format === "extended");
7699 }
7700 toISOWeekDate() {
7701 return toTechFormat(this, "kkkk-'W'WW-c");
7702 }
7703 toISOTime({
7704 suppressMilliseconds = false,
7705 suppressSeconds = false,
7706 includeOffset = true,
7707 includePrefix = false,
7708 extendedZone = false,
7709 format = "extended"
7710 } = {}) {
7711 if (!this.isValid) {
7712 return null;
7713 }
7714 let c = includePrefix ? "T" : "";
7715 return c + toISOTime(
7716 this,
7717 format === "extended",
7718 suppressSeconds,
7719 suppressMilliseconds,
7720 includeOffset,
7721 extendedZone
7722 );
7723 }
7724 toRFC2822() {
7725 return toTechFormat(this, "EEE, dd LLL yyyy HH:mm:ss ZZZ", false);
7726 }
7727 toHTTP() {
7728 return toTechFormat(this.toUTC(), "EEE, dd LLL yyyy HH:mm:ss 'GMT'");
7729 }
7730 toSQLDate() {
7731 if (!this.isValid) {
7732 return null;
7733 }
7734 return toISODate(this, true);
7735 }
7736 toSQLTime({ includeOffset = true, includeZone = false, includeOffsetSpace = true } = {}) {
7737 let fmt = "HH:mm:ss.SSS";
7738 if (includeZone || includeOffset) {
7739 if (includeOffsetSpace) {
7740 fmt += " ";
7741 }
7742 if (includeZone) {
7743 fmt += "z";
7744 } else if (includeOffset) {
7745 fmt += "ZZ";
7746 }
7747 }
7748 return toTechFormat(this, fmt, true);
7749 }
7750 toSQL(opts = {}) {
7751 if (!this.isValid) {
7752 return null;
7753 }
7754 return `${this.toSQLDate()} ${this.toSQLTime(opts)}`;
7755 }
7756 toString() {
7757 return this.isValid ? this.toISO() : INVALID4;
7758 }
7759 valueOf() {
7760 return this.toMillis();
7761 }
7762 toMillis() {
7763 return this.isValid ? this.ts : NaN;
7764 }
7765 toSeconds() {
7766 return this.isValid ? this.ts / 1e3 : NaN;
7767 }
7768 toUnixInteger() {
7769 return this.isValid ? Math.floor(this.ts / 1e3) : NaN;
7770 }
7771 toJSON() {
7772 return this.toISO();
7773 }
7774 toBSON() {
7775 return this.toJSDate();
7776 }
7777 toObject(opts = {}) {
7778 if (!this.isValid)
7779 return {};
7780 const base = { ...this.c };
7781 if (opts.includeConfig) {
7782 base.outputCalendar = this.outputCalendar;
7783 base.numberingSystem = this.loc.numberingSystem;
7784 base.locale = this.loc.locale;
7785 }
7786 return base;
7787 }
7788 toJSDate() {
7789 return new Date(this.isValid ? this.ts : NaN);
7790 }
7791 diff(otherDateTime, unit = "milliseconds", opts = {}) {
7792 if (!this.isValid || !otherDateTime.isValid) {
7793 return Duration.invalid("created by diffing an invalid DateTime");
7794 }
7795 const durOpts = { locale: this.locale, numberingSystem: this.numberingSystem, ...opts };
7796 const units = maybeArray(unit).map(Duration.normalizeUnit), otherIsLater = otherDateTime.valueOf() > this.valueOf(), earlier = otherIsLater ? this : otherDateTime, later = otherIsLater ? otherDateTime : this, diffed = diff_default(earlier, later, units, durOpts);
7797 return otherIsLater ? diffed.negate() : diffed;
7798 }
7799 diffNow(unit = "milliseconds", opts = {}) {
7800 return this.diff(DateTime.now(), unit, opts);
7801 }
7802 until(otherDateTime) {
7803 return this.isValid ? Interval.fromDateTimes(this, otherDateTime) : this;
7804 }
7805 hasSame(otherDateTime, unit) {
7806 if (!this.isValid)
7807 return false;
7808 const inputMs = otherDateTime.valueOf();
7809 const adjustedToZone = this.setZone(otherDateTime.zone, { keepLocalTime: true });
7810 return adjustedToZone.startOf(unit) <= inputMs && inputMs <= adjustedToZone.endOf(unit);
7811 }
7812 equals(other) {
7813 return this.isValid && other.isValid && this.valueOf() === other.valueOf() && this.zone.equals(other.zone) && this.loc.equals(other.loc);
7814 }
7815 toRelative(options = {}) {
7816 if (!this.isValid)
7817 return null;
7818 const base = options.base || DateTime.fromObject({}, { zone: this.zone }), padding = options.padding ? this < base ? -options.padding : options.padding : 0;
7819 let units = ["years", "months", "days", "hours", "minutes", "seconds"];
7820 let unit = options.unit;
7821 if (Array.isArray(options.unit)) {
7822 units = options.unit;
7823 unit = void 0;
7824 }
7825 return diffRelative(base, this.plus(padding), {
7826 ...options,
7827 numeric: "always",
7828 units,
7829 unit
7830 });
7831 }
7832 toRelativeCalendar(options = {}) {
7833 if (!this.isValid)
7834 return null;
7835 return diffRelative(options.base || DateTime.fromObject({}, { zone: this.zone }), this, {
7836 ...options,
7837 numeric: "auto",
7838 units: ["years", "months", "days"],
7839 calendary: true
7840 });
7841 }
7842 static min(...dateTimes) {
7843 if (!dateTimes.every(DateTime.isDateTime)) {
7844 throw new InvalidArgumentError("min requires all arguments be DateTimes");
7845 }
7846 return bestBy(dateTimes, (i) => i.valueOf(), Math.min);
7847 }
7848 static max(...dateTimes) {
7849 if (!dateTimes.every(DateTime.isDateTime)) {
7850 throw new InvalidArgumentError("max requires all arguments be DateTimes");
7851 }
7852 return bestBy(dateTimes, (i) => i.valueOf(), Math.max);
7853 }
7854 static fromFormatExplain(text, fmt, options = {}) {
7855 const { locale = null, numberingSystem = null } = options, localeToUse = Locale.fromOpts({
7856 locale,
7857 numberingSystem,
7858 defaultToEN: true
7859 });
7860 return explainFromTokens(localeToUse, text, fmt);
7861 }
7862 static fromStringExplain(text, fmt, options = {}) {
7863 return DateTime.fromFormatExplain(text, fmt, options);
7864 }
7865 static get DATE_SHORT() {
7866 return DATE_SHORT;
7867 }
7868 static get DATE_MED() {
7869 return DATE_MED;
7870 }
7871 static get DATE_MED_WITH_WEEKDAY() {
7872 return DATE_MED_WITH_WEEKDAY;
7873 }
7874 static get DATE_FULL() {
7875 return DATE_FULL;
7876 }
7877 static get DATE_HUGE() {
7878 return DATE_HUGE;
7879 }
7880 static get TIME_SIMPLE() {
7881 return TIME_SIMPLE;
7882 }
7883 static get TIME_WITH_SECONDS() {
7884 return TIME_WITH_SECONDS;
7885 }
7886 static get TIME_WITH_SHORT_OFFSET() {
7887 return TIME_WITH_SHORT_OFFSET;
7888 }
7889 static get TIME_WITH_LONG_OFFSET() {
7890 return TIME_WITH_LONG_OFFSET;
7891 }
7892 static get TIME_24_SIMPLE() {
7893 return TIME_24_SIMPLE;
7894 }
7895 static get TIME_24_WITH_SECONDS() {
7896 return TIME_24_WITH_SECONDS;
7897 }
7898 static get TIME_24_WITH_SHORT_OFFSET() {
7899 return TIME_24_WITH_SHORT_OFFSET;
7900 }
7901 static get TIME_24_WITH_LONG_OFFSET() {
7902 return TIME_24_WITH_LONG_OFFSET;
7903 }
7904 static get DATETIME_SHORT() {
7905 return DATETIME_SHORT;
7906 }
7907 static get DATETIME_SHORT_WITH_SECONDS() {
7908 return DATETIME_SHORT_WITH_SECONDS;
7909 }
7910 static get DATETIME_MED() {
7911 return DATETIME_MED;
7912 }
7913 static get DATETIME_MED_WITH_SECONDS() {
7914 return DATETIME_MED_WITH_SECONDS;
7915 }
7916 static get DATETIME_MED_WITH_WEEKDAY() {
7917 return DATETIME_MED_WITH_WEEKDAY;
7918 }
7919 static get DATETIME_FULL() {
7920 return DATETIME_FULL;
7921 }
7922 static get DATETIME_FULL_WITH_SECONDS() {
7923 return DATETIME_FULL_WITH_SECONDS;
7924 }
7925 static get DATETIME_HUGE() {
7926 return DATETIME_HUGE;
7927 }
7928 static get DATETIME_HUGE_WITH_SECONDS() {
7929 return DATETIME_HUGE_WITH_SECONDS;
7930 }
7931};
7932function friendlyDateTime(dateTimeish) {
7933 if (DateTime.isDateTime(dateTimeish)) {
7934 return dateTimeish;
7935 } else if (dateTimeish && dateTimeish.valueOf && isNumber(dateTimeish.valueOf())) {
7936 return DateTime.fromJSDate(dateTimeish);
7937 } else if (dateTimeish && typeof dateTimeish === "object") {
7938 return DateTime.fromObject(dateTimeish);
7939 } else {
7940 throw new InvalidArgumentError(
7941 `Unknown datetime argument: ${dateTimeish}, of type ${typeof dateTimeish}`
7942 );
7943 }
7944}
7945
7946// ../types/src/index.ts
7947var import_base64 = __toESM(require_base64());
7948var import_iso_3166_ts = __toESM(require_dist());
7949var REGEX_HASH_HEX = /^(([a-fA-F0-9]{2})+)$/i;
7950var HashHex = mod.string().regex(REGEX_HASH_HEX);
7951var REGEX_HASH_HEX_32 = /^(([a-f0-9]{2}){32})$/i;
7952var HashHex32 = mod.string().regex(REGEX_HASH_HEX_32);
7953var REGEX_HASH_HEX_20_64 = /^(([a-f0-9]{2}){20,64})$/i;
7954var HashHex20to64 = mod.string().regex(REGEX_HASH_HEX_20_64);
7955var DEFAULT_REFRESH_TOKEN_EXPIRATION_TTL = 60 * 60 * 24 * 365 * 5;
7956var REGEX_ULID = /^[0123456789ABCDEFGHJKMNPQRSTVWXYZ]{26}$/;
7957var ULID = mod.string().regex(REGEX_ULID);
7958var UnionHashTypes = mod.union([
7959 mod.literal("sha1"),
7960 mod.literal("sha-256"),
7961 mod.literal("sha-384"),
7962 mod.literal("sha-512")
7963]);
7964var UnionProofHashTypes = mod.union([
7965 mod.literal("sha224"),
7966 mod.literal("sha256"),
7967 mod.literal("sha384"),
7968 mod.literal("sha512"),
7969 mod.literal("sha512_256"),
7970 mod.literal("sha3_224"),
7971 mod.literal("sha3_256"),
7972 mod.literal("sha3_384"),
7973 mod.literal("sha3_512")
7974]);
7975var UnionIntentTypes = mod.union([
7976 mod.literal("bitcoin"),
7977 mod.literal("ethereum"),
7978 mod.literal("stellar")
7979]);
7980var UnionEnvironmentTypes = mod.union([
7981 mod.literal("development"),
7982 mod.literal("staging"),
7983 mod.literal("production")
7984]);
7985var HashType = mod.object({
7986 minBytes: mod.number().min(20).max(64),
7987 maxBytes: mod.number().min(20).max(64)
7988});
7989var HashTypes = mod.record(mod.string(), HashType);
7990var TruestampId = mod.string().refine(
7991 (val) => {
7992 const base58CheckPlusUnderscoreEncoding = /^[123456789ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz_]+$/;
7993 try {
7994 return base58CheckPlusUnderscoreEncoding.test(val);
7995 } catch (error) {
7996 return false;
7997 }
7998 },
7999 {
8000 message: `is not a valid Truestamp Id string`
8001 }
8002);
8003var Base64 = mod.string().refine(
8004 (val) => {
8005 try {
8006 (0, import_base64.decode)(val);
8007 return true;
8008 } catch (error) {
8009 return false;
8010 }
8011 },
8012 {
8013 message: `is not a valid Base64 encoded string`
8014 }
8015);
8016var ISO8601 = mod.string().refine(
8017 (val) => {
8018 try {
8019 return DateTime.fromISO(val).isValid;
8020 } catch (error) {
8021 return false;
8022 }
8023 },
8024 {
8025 message: `is not a valid ISO8601 timestamp`
8026 }
8027);
8028var ISO8601UTC = mod.string().refine(
8029 (val) => {
8030 try {
8031 if (!val.endsWith("Z") && !val.endsWith("+00:00")) {
8032 return false;
8033 }
8034 const d = DateTime.fromISO(val, { zone: "utc" });
8035 return d.isValid && d.offsetNameShort === "UTC";
8036 } catch (error) {
8037 return false;
8038 }
8039 },
8040 {
8041 message: `is not a valid ISO8601 UTC timestamp`
8042 }
8043);
8044var ISO3166Alpha2 = mod.string().length(2).refine(
8045 (val) => {
8046 try {
8047 return (0, import_iso_3166_ts.isIso3166Alpha2Code)(val);
8048 } catch (error) {
8049 return false;
8050 }
8051 },
8052 {
8053 message: `is not an ISO3166 Alpha 2 country code`
8054 }
8055);
8056var Address = mod.object({
8057 streetNo: mod.optional(mod.string().min(1).max(8)),
8058 streetName: mod.optional(mod.string().min(1).max(64)),
8059 streetType: mod.optional(mod.string().min(1).max(16)),
8060 floor: mod.optional(mod.string().min(1).max(8)),
8061 town: mod.optional(mod.string().min(1).max(64)),
8062 region: mod.optional(mod.string().min(1).max(64)),
8063 postcode: mod.optional(mod.string().min(1).max(16)),
8064 countryCode: mod.optional(ISO3166Alpha2)
8065});
8066var Latitude = mod.string().refine(
8067 (val) => {
8068 try {
8069 const decimalLatLongValueString = /^[-+]?[0-9]*\.?[0-9]+$/;
8070 if (!decimalLatLongValueString.test(val)) {
8071 return false;
8072 }
8073 const valFloat = parseFloat(val);
8074 return valFloat >= -90 && valFloat <= 90 ? true : false;
8075 } catch (error) {
8076 return false;
8077 }
8078 },
8079 {
8080 message: `is not a valid Latitude`
8081 }
8082);
8083var Longitude = mod.string().refine(
8084 (val) => {
8085 try {
8086 const decimalLatLongValueString = /^[-+]?[0-9]*\.?[0-9]+$/;
8087 if (!decimalLatLongValueString.test(val)) {
8088 return false;
8089 }
8090 const valFloat = parseFloat(val);
8091 return valFloat >= -180 && valFloat <= 180 ? true : false;
8092 } catch (error) {
8093 return false;
8094 }
8095 },
8096 {
8097 message: `is not a valid Longitude`
8098 }
8099);
8100var LatLong = mod.object({
8101 latitude: Latitude,
8102 longitude: Longitude
8103});
8104var Location = mod.object({
8105 coordinate: LatLong,
8106 altitude: mod.optional(mod.number().int().min(-1e5).max(1e5)),
8107 ellipsoidalAltitude: mod.optional(mod.number().int().min(-1e5).max(1e5)),
8108 floor: mod.optional(mod.number().int().min(0).max(200)),
8109 horizontalAccuracy: mod.optional(mod.number().int().min(-1e5).max(1e5)),
8110 verticalAccuracy: mod.optional(mod.number().int().min(-1e5).max(1e5)),
8111 timestamp: mod.optional(ISO8601),
8112 speed: mod.optional(mod.number().int().min(-1e5).max(1e5)),
8113 speedAccuracy: mod.optional(mod.number().int().min(-1e4).max(1e4)),
8114 course: mod.optional(mod.number().int().min(-360).max(360)),
8115 courseAccuracy: mod.optional(mod.number().int().min(-360).max(360)),
8116 magneticHeading: mod.optional(mod.number().int().min(0).max(359)),
8117 headingAccuracy: mod.optional(mod.number().int().min(-180).max(180)),
8118 trueHeading: mod.optional(mod.number().int().min(0).max(359))
8119});
8120var Person = mod.object({
8121 givenName: mod.optional(mod.string().min(1).max(32)),
8122 surname: mod.optional(mod.string().min(1).max(32)),
8123 organizationName: mod.optional(mod.string().min(1).max(64)),
8124 roles: mod.optional(mod.array(mod.string()).min(1).max(32)),
8125 email: mod.optional(mod.string().email()),
8126 uri: mod.optional(mod.string().url()),
8127 address: mod.optional(Address)
8128});
8129var Signature = mod.object({
8130 publicKey: Base64,
8131 signature: Base64,
8132 signatureType: mod.literal("ed25519"),
8133 signer: mod.optional(Person)
8134});
8135var ItemRequestProps = mod.object({
8136 asn: mod.optional(mod.nullable(mod.union([mod.number().int(), mod.string()]))),
8137 colo: mod.optional(mod.nullable(mod.string().min(1))),
8138 country: mod.optional(mod.nullable(mod.string().min(1))),
8139 city: mod.optional(mod.nullable(mod.string().min(1))),
8140 continent: mod.optional(mod.nullable(mod.string().min(1))),
8141 latitude: mod.optional(mod.nullable(mod.string().min(1))),
8142 longitude: mod.optional(mod.nullable(mod.string().min(1))),
8143 postalCode: mod.optional(mod.nullable(mod.string().min(1))),
8144 metroCode: mod.optional(mod.nullable(mod.string().min(1))),
8145 region: mod.optional(mod.nullable(mod.string().min(1))),
8146 regionCode: mod.optional(mod.nullable(mod.string().min(1))),
8147 timezone: mod.optional(mod.nullable(mod.string().min(1)))
8148});
8149var literalSchema = mod.union([mod.string(), mod.number(), mod.boolean(), mod.null()]);
8150var jsonSchema = mod.lazy(
8151 () => mod.union([literalSchema, mod.array(jsonSchema), mod.record(jsonSchema)])
8152);
8153var ItemData = mod.object({
8154 hash: HashHex20to64,
8155 hashType: UnionHashTypes,
8156 people: mod.optional(mod.array(Person).min(1)),
8157 description: mod.optional(mod.string().min(1).max(256)),
8158 address: mod.optional(Address),
8159 location: mod.optional(Location),
8160 timestamp: mod.optional(ISO8601),
8161 extra: mod.optional(jsonSchema)
8162});
8163var ItemSignals = mod.object({
8164 cf: mod.optional(ItemRequestProps),
8165 observableEntropy: mod.optional(HashHex32),
8166 submittedAt: ISO8601UTC
8167});
8168var Item = mod.object({
8169 itemData: mod.array(ItemData).min(1),
8170 itemSignals: mod.optional(ItemSignals),
8171 itemDataSignatures: mod.optional(mod.array(Signature).min(1))
8172});
8173var ItemRequestSchema = Item.pick({
8174 itemData: true,
8175 itemDataSignatures: true
8176});
8177var ItemResponseSchema = mod.object({ id: TruestampId });
8178var ItemEnvelope = mod.object({
8179 owner: mod.string().min(1).max(255),
8180 ulid: ULID,
8181 item: Item
8182});
8183var HealthResponseSchema = mod.object({
8184 status: mod.union([mod.literal("pass"), mod.literal("fail")]),
8185 description: mod.string().optional(),
8186 checks: mod.object({
8187 uptime: mod.array(
8188 mod.object({
8189 status: mod.literal("pass"),
8190 componentType: mod.string(),
8191 time: mod.string()
8192 })
8193 ).optional()
8194 }).optional(),
8195 links: mod.array(mod.string().url()).optional()
8196});
8197var ApiKeyBodySchema = mod.object({
8198 refreshToken: mod.string(),
8199 description: mod.string().max(256).optional(),
8200 ttl: mod.number().min(0).max(DEFAULT_REFRESH_TOKEN_EXPIRATION_TTL).optional()
8201});
8202var ApiKeyResponseSchema = mod.object({
8203 apiKey: mod.string(),
8204 expiration: mod.string().max(256),
8205 description: mod.string().max(256)
8206});
8207var SNSTopicMessage = mod.object({
8208 owner: mod.optional(mod.string().min(1)),
8209 inputHash: HashHex32
8210});
8211var ProofObjectLayer = mod.tuple([
8212 mod.number().int().min(0).max(1),
8213 HashHex20to64
8214]);
8215var ProofObject = mod.object({
8216 v: mod.number().int().min(1).max(1),
8217 h: UnionProofHashTypes,
8218 p: mod.array(ProofObjectLayer)
8219});
8220var CommitProof = mod.object({
8221 inputHash: HashHex32,
8222 inclusionProof: ProofObject,
8223 merkleRoot: HashHex32
8224});
8225var CommitTransactionBase = mod.object({
8226 inputHash: HashHex32
8227});
8228var CommitTransactionBitcoin = CommitTransactionBase.extend({
8229 intent: mod.literal("bitcoin"),
8230 hash: mod.string().regex(/(0x)?[0-9a-f]+/i)
8231}).strict();
8232var CommitTransactionEthereum = CommitTransactionBase.extend({
8233 intent: mod.literal("ethereum"),
8234 hash: mod.string().regex(/(0x)?[0-9a-f]+/i)
8235}).strict();
8236var CommitTransactionStellar = CommitTransactionBase.extend({
8237 intent: mod.literal("stellar"),
8238 hash: HashHex32,
8239 ledger: mod.number().int().min(11111)
8240}).strict();
8241var CommitTransaction = mod.discriminatedUnion("intent", [
8242 CommitTransactionBitcoin,
8243 CommitTransactionEthereum,
8244 CommitTransactionStellar
8245]);
8246var CommitmentData = mod.object({
8247 id: TruestampId,
8248 itemData: mod.array(ItemData).min(1),
8249 itemDataSignatures: mod.optional(mod.array(Signature).min(1)),
8250 itemSignals: mod.optional(ItemSignals),
8251 proofs: mod.array(CommitProof),
8252 transactions: mod.record(mod.string(), mod.array(CommitTransaction).min(1))
8253});
8254var Commitment = mod.object({
8255 commitmentData: CommitmentData,
8256 commitmentDataSignatures: mod.array(Signature).min(1)
8257});
8258var ULIDResponse = mod.object({
8259 t: mod.number(),
8260 ts: ISO8601UTC,
8261 ulid: ULID
8262});
8263var ULIDResponseCollection = mod.array(ULIDResponse);
8264var VerificationProof = mod.object({
8265 inputHash: HashHex32,
8266 merkleRoot: HashHex32
8267}).strict();
8268var VerificationTransaction = mod.object({
8269 intent: UnionIntentTypes,
8270 verified: mod.boolean(),
8271 transaction: CommitTransaction,
8272 timestamp: mod.optional(ISO8601UTC),
8273 urls: mod.optional(
8274 mod.object({
8275 machine: mod.optional(mod.array(mod.string().url())),
8276 human: mod.optional(mod.array(mod.string().url()))
8277 })
8278 ),
8279 error: mod.optional(mod.string())
8280}).strict();
8281var CommitmentVerification = mod.object({
8282 verified: mod.boolean(),
8283 id: mod.optional(TruestampId),
8284 idData: mod.optional(
8285 mod.object({
8286 test: mod.boolean(),
8287 timestamp: mod.string(),
8288 ulid: ULID
8289 })
8290 ),
8291 itemData: mod.optional(
8292 mod.object({
8293 hash: HashHex32,
8294 hashType: UnionHashTypes,
8295 signaturesCount: mod.optional(mod.number().int())
8296 })
8297 ),
8298 item: mod.optional(
8299 mod.object({
8300 hash: HashHex32,
8301 hashType: mod.literal("sha-256")
8302 })
8303 ),
8304 commitmentData: mod.optional(
8305 mod.object({
8306 hash: HashHex32,
8307 hashType: mod.literal("sha-256"),
8308 signaturesCount: mod.optional(mod.number().int())
8309 })
8310 ),
8311 proofs: mod.optional(mod.array(VerificationProof).min(1)),
8312 transactions: mod.optional(mod.array(VerificationTransaction).min(1)),
8313 commitsTo: mod.optional(
8314 mod.object({
8315 hashes: mod.array(
8316 mod.object({
8317 hash: HashHex20to64,
8318 hashType: mod.string()
8319 })
8320 ).min(1),
8321 observableEntropy: mod.optional(HashHex32),
8322 timestamps: mod.object({
8323 submittedAfter: mod.optional(ISO8601UTC),
8324 submittedAt: ISO8601UTC,
8325 submittedBefore: mod.optional(mod.array(mod.string())),
8326 submitWindowMilliseconds: mod.optional(
8327 mod.number().int().min(0).max(3600 * 24 * 365 * 1e3)
8328 )
8329 })
8330 })
8331 ),
8332 error: mod.optional(mod.string())
8333}).strict();
8334var SignedKey = mod.object({
8335 environment: UnionEnvironmentTypes,
8336 expired: mod.boolean(),
8337 handle: mod.string().min(1),
8338 publicKey: Base64,
8339 type: mod.literal("ed25519"),
8340 selfSignature: Base64
8341});
8342var SignedKeys = mod.array(SignedKey).min(1);
8343var UnsignedKey = SignedKey.omit({ selfSignature: true });
8344var CanonicalHash = mod.object({
8345 hash: mod.instanceof(Uint8Array),
8346 hashHex: HashHex32,
8347 hashType: UnionHashTypes,
8348 canonicalData: mod.optional(mod.string())
8349});
8350var EntropyBitcoin = mod.object({
8351 block_index: mod.number().int(),
8352 hash: HashHex,
8353 height: mod.number().int(),
8354 time: mod.number().int()
8355});
8356var EntropyDrandBeaconChainInfo = mod.object({
8357 genesis_time: mod.number().int(),
8358 groupHash: HashHex,
8359 hash: HashHex,
8360 metadata: mod.object({
8361 beaconID: mod.string()
8362 }).optional(),
8363 period: mod.number().int(),
8364 public_key: HashHex,
8365 schemeID: mod.string().optional()
8366});
8367var EntropyDrandBeaconRandomness = mod.object({
8368 previous_signature: HashHex,
8369 randomness: HashHex,
8370 round: mod.number().int(),
8371 signature: HashHex
8372});
8373var EntropyDrandBeacon = mod.object({
8374 chainInfo: EntropyDrandBeaconChainInfo,
8375 randomness: EntropyDrandBeaconRandomness
8376});
8377var EntropyEthereum = mod.object({
8378 hash: HashHex,
8379 height: mod.number().int(),
8380 time: ISO8601UTC
8381});
8382var EntropyHackerNewsStory = mod.object({
8383 by: mod.string(),
8384 id: mod.number().int(),
8385 time: mod.number().int(),
8386 title: mod.string(),
8387 url: mod.string().url().optional()
8388});
8389var EntropyHackerNews = mod.object({
8390 stories: mod.array(EntropyHackerNewsStory)
8391});
8392var EntropyNistBeacon = mod.object({
8393 chainIndex: mod.number().int(),
8394 outputValue: HashHex,
8395 pulseIndex: mod.number().int(),
8396 timeStamp: ISO8601UTC,
8397 uri: mod.string().url()
8398});
8399var EntropyPrevious = mod.object({
8400 hash: HashHex,
8401 uri: mod.string().url()
8402});
8403var EntropyStellar = mod.object({
8404 closed_at: ISO8601UTC,
8405 hash: HashHex,
8406 sequence: mod.number().int()
8407});
8408var EntropyTimestamp = mod.object({
8409 capturedAt: ISO8601UTC
8410});
8411var EntropyResponse = mod.object({
8412 data: mod.object({
8413 bitcoin: EntropyBitcoin.strict().optional(),
8414 "drand-beacon": EntropyDrandBeacon.strict().optional(),
8415 ethereum: EntropyEthereum.strict().optional(),
8416 "hacker-news": EntropyHackerNews.strict().optional(),
8417 "nist-beacon": EntropyNistBeacon.strict().optional(),
8418 previous: EntropyPrevious.strict().optional(),
8419 stellar: EntropyStellar.strict().optional(),
8420 timestamp: EntropyTimestamp.strict()
8421 }),
8422 hash: HashHex32,
8423 hashType: mod.literal("sha-256"),
8424 publicKey: Base64,
8425 signature: Base64,
8426 signatureType: mod.literal("ed25519")
8427}).strict();
8428var RFC7807ErrorSchema = mod.object({
8429 status: mod.number(),
8430 type: mod.optional(mod.string().url()),
8431 title: mod.optional(mod.string()),
8432 detail: mod.optional(mod.string()),
8433 instance: mod.optional(mod.string().url())
8434});
8435var BetterUptimeResponseDataSchema = mod.object({
8436 id: mod.string(),
8437 type: mod.string(),
8438 attributes: mod.object({
8439 announcement: mod.string().nullable().optional(),
8440 aggregate_state: mod.string()
8441 })
8442});
8443var BetterUptimeResponseSchema = mod.object({
8444 data: mod.array(BetterUptimeResponseDataSchema)
8445});
8446
8447// ../utils/src/http/index.ts
8448async function http(input, init) {
8449 const REQUEST_TIMEOUT = 1e4;
8450 try {
8451 const req = new Request(input, init);
8452 const c = new AbortController();
8453 const id = setTimeout(() => c.abort(), REQUEST_TIMEOUT);
8454 const res = await fetch(req, { signal: c.signal });
8455 clearTimeout(id);
8456 if (!res.ok) {
8457 const errorResponse = await res.json();
8458 const parsedErrorResponse = RFC7807ErrorSchema.safeParse(errorResponse);
8459 if (parsedErrorResponse.success) {
8460 throw new Error(
8461 `${res.status} ${res.statusText} : ${parsedErrorResponse.data.title} : ${parsedErrorResponse.data.detail}`
8462 );
8463 }
8464 throw new Error(`${res.status} ${res.statusText}`);
8465 }
8466 return res.json();
8467 } catch (err) {
8468 if (err instanceof DOMException && err.name === "AbortError") {
8469 throw new Error(`HTTP fetch timeout : ${err.message}`);
8470 } else if (err instanceof Error) {
8471 throw new Error(`HTTP fetch error : ${err.message}`);
8472 } else {
8473 throw new Error(`HTTP fetch error : ${err}`);
8474 }
8475 }
8476}
8477async function httpGet(input, config) {
8478 const init = {
8479 ...config,
8480 method: "GET",
8481 headers: {
8482 "Content-Type": "application/json",
8483 Accept: "application/json",
8484 ...config?.headers
8485 }
8486 };
8487 return await http(input, init);
8488}
8489async function httpPost(input, body, config) {
8490 const init = {
8491 ...config,
8492 method: "POST",
8493 body: JSON.stringify(body),
8494 headers: {
8495 "Content-Type": "application/json",
8496 Accept: "application/json",
8497 ...config?.headers
8498 }
8499 };
8500 return await http(input, init);
8501}
8502async function httpPut(input, body, config) {
8503 const init = {
8504 ...config,
8505 method: "PUT",
8506 body: JSON.stringify(body),
8507 headers: {
8508 "Content-Type": "application/json",
8509 Accept: "application/json",
8510 ...config?.headers
8511 }
8512 };
8513 return await http(input, init);
8514}
8515
8516// src/index.ts
8517var ClientConfigSchema = mod.object({
8518 apiBaseUrl: mod.string().url().regex(/https:\/\/(api|staging-api|dev-api)\.truestamp\.com/).optional(),
8519 apiKey: mod.string().min(1)
8520});
8521var TruestampClient = class {
8522 constructor(config) {
8523 try {
8524 ClientConfigSchema.parse(config);
8525 } catch (err) {
8526 if (err instanceof mod.ZodError) {
8527 const validationError = fromZodError(err);
8528 throw new Error(validationError.message);
8529 } else {
8530 throw err;
8531 }
8532 }
8533 const { apiBaseUrl, apiKey } = config;
8534 this.API_KEY = apiKey;
8535 this.API_VERSION = "v1";
8536 this.BASE_URL = apiBaseUrl ?? "https://api.truestamp.com";
8537 this.BASE_URL_W_VERSION = `${this.BASE_URL}/${this.API_VERSION}`;
8538 this.COMMON_HEADERS = {
8539 Authorization: `Bearer ${this.API_KEY}`,
8540 Accept: "application/json",
8541 "Content-Type": "application/json"
8542 };
8543 }
8544 async getHealth() {
8545 return await httpGet(`${this.BASE_URL_W_VERSION}/health`, {
8546 headers: this.COMMON_HEADERS
8547 });
8548 }
8549 async createApiKey(body) {
8550 try {
8551 ApiKeyBodySchema.parse(body);
8552 } catch (err) {
8553 if (err instanceof mod.ZodError) {
8554 const validationError = fromZodError(err);
8555 throw new Error(validationError.message);
8556 } else {
8557 throw err;
8558 }
8559 }
8560 return await httpPost(
8561 `${this.BASE_URL_W_VERSION}/apikeys`,
8562 body,
8563 {
8564 headers: this.COMMON_HEADERS
8565 }
8566 );
8567 }
8568 async getCommitment(id) {
8569 return await httpGet(
8570 `${this.BASE_URL_W_VERSION}/commitments/${id}`,
8571 {
8572 headers: this.COMMON_HEADERS
8573 }
8574 );
8575 }
8576 async getCommitmentVerification(id) {
8577 return await httpGet(
8578 `${this.BASE_URL_W_VERSION}/commitments/${id}/verify`,
8579 {
8580 headers: this.COMMON_HEADERS
8581 }
8582 );
8583 }
8584 async createItem(body, args) {
8585 try {
8586 ItemRequestSchema.parse(body);
8587 } catch (err) {
8588 if (err instanceof mod.ZodError) {
8589 const validationError = fromZodError(err);
8590 throw new Error(validationError.message);
8591 } else {
8592 throw err;
8593 }
8594 }
8595 const newHeaders = {};
8596 if (args?.skipCF) {
8597 newHeaders["skip-cf"] = "true";
8598 }
8599 if (args?.skipOE) {
8600 newHeaders["skip-oe"] = "true";
8601 }
8602 return await httpPost(
8603 `${this.BASE_URL_W_VERSION}/items`,
8604 body,
8605 {
8606 headers: { ...this.COMMON_HEADERS, ...newHeaders }
8607 }
8608 );
8609 }
8610 async updateItem(id, body, args) {
8611 try {
8612 ItemRequestSchema.parse(body);
8613 } catch (err) {
8614 if (err instanceof mod.ZodError) {
8615 const validationError = fromZodError(err);
8616 throw new Error(validationError.message);
8617 } else {
8618 throw err;
8619 }
8620 }
8621 const newHeaders = {};
8622 if (args?.skipCF) {
8623 newHeaders["skip-cf"] = "true";
8624 }
8625 if (args?.skipOE) {
8626 newHeaders["skip-oe"] = "true";
8627 }
8628 return await httpPut(
8629 `${this.BASE_URL_W_VERSION}/items/${id}`,
8630 body,
8631 {
8632 headers: { ...this.COMMON_HEADERS, ...newHeaders }
8633 }
8634 );
8635 }
8636};
8637// Annotate the CommonJS export names for ESM import in node:
86380 && (module.exports = {
8639 TruestampClient
8640});