@formatjs/intl-datetimeformat-calendar-islamic-tbla 1.1.6 → 1.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,552 +1,3 @@
1
- // node_modules/.aspect_rules_js/temporal-utils@1.0.3/node_modules/temporal-utils/dist/errorMessages.js
2
- const expectedPositive = (entityName, num) => `Non-positive ${entityName}: ${num}`;
3
- const expectedFinite = (entityName, num) => `Non-finite ${entityName}: ${num}`;
4
- const forbiddenBigIntToNumber = (entityName) => `Cannot convert bigint to ${entityName}`;
5
- const numberOutOfRange = (entityName, val, min, max) => invalidEntity$1(entityName, val) + `; must be between ${min}-${max}`;
6
- const invalidEntity$1 = (fieldName, val) => `Invalid ${fieldName}: ${val}`;
7
- function toFiniteNumber(arg, entityName = "number") {
8
- if (typeof arg === "bigint") throw new TypeError(forbiddenBigIntToNumber(entityName));
9
- arg = Number(arg);
10
- if (!Number.isFinite(arg)) throw new RangeError(expectedFinite(entityName, arg));
11
- return arg;
12
- }
13
- function toIntegerWithTrunc(arg, entityName) {
14
- return Math.trunc(toFiniteNumber(arg, entityName)) || 0;
15
- }
16
- function toPositiveIntegerWithTruncation(arg, entityName) {
17
- return requireNumberIsPositive(toIntegerWithTrunc(arg, entityName), entityName);
18
- }
19
- function requireNumberIsPositive(num, entityName = "number") {
20
- if (num <= 0) throw new RangeError(expectedPositive(entityName, num));
21
- return num;
22
- }
23
- function constrainToRange$1(num, min, max) {
24
- return Math.min(Math.max(num, min), max);
25
- }
26
- function isObjectLike(arg) {
27
- return arg !== null && (typeof arg === "object" || typeof arg === "function");
28
- }
29
- // node_modules/.aspect_rules_js/temporal-polyfill@1.0.6/node_modules/temporal-polyfill/chunks/internal.js
30
- const invalidEntity = invalidEntity$1;
31
- const missingField = (fieldName) => `Missing ${fieldName}`;
32
- const forbiddenValueOf$1 = "Cannot use valueOf";
33
- const invalidCallingContext = "Invalid calling context";
34
- const exoticCalendarRequired = (calendarId, remedy) => `Unknown calendar ${calendarId}; might need ${remedy}`;
35
- const constrainToRange = constrainToRange$1;
36
- function throwRangeError(message) {
37
- throw new RangeError(message);
38
- }
39
- function throwTypeError(message) {
40
- throw new TypeError(message);
41
- }
42
- function clampProp(props, propName, min, max, overflow) {
43
- return clampEntity(propName, ((props, propName) => {
44
- const propVal = props[propName];
45
- return void 0 === propVal && throwTypeError(missingField(propName)), propVal;
46
- })(props, propName), min, max, overflow);
47
- }
48
- function clampEntity(entityName, num, min, max, overflow, choices) {
49
- const clamped = constrainToRange(num, min, max);
50
- return overflow && num !== clamped && throwRangeError(((entityName, val, min, max, choices) => choices ? numberOutOfRange(entityName, choices[val], choices[min], choices[max]) : numberOutOfRange(entityName, val, min, max))(entityName, num, min, max, choices)), clamped;
51
- }
52
- function memoize(generator, MapClass = Map) {
53
- const map = new MapClass();
54
- return (key, ...otherArgs) => {
55
- if (map.has(key)) return map.get(key);
56
- const val = generator(key, ...otherArgs);
57
- return map.set(key, val), val;
58
- };
59
- }
60
- const createNameDescriptors = (name) => createPropDescriptors({ name }, 1);
61
- const createPropDescriptors = (propVals, readonly) => mapProps((value) => ({
62
- value,
63
- configurable: 1,
64
- writable: !readonly
65
- }), propVals);
66
- const createStringTagDescriptors = (value) => ({ [Symbol.toStringTag]: {
67
- value,
68
- configurable: 1
69
- } });
70
- function mapProps(transformer, props) {
71
- const res = {};
72
- for (const propName in props) res[propName] = transformer(props[propName], propName);
73
- return res;
74
- }
75
- function zipPropsConst(propNames, propVal) {
76
- const res = {};
77
- for (const propName of propNames) res[propName] = propVal;
78
- return res;
79
- }
80
- function createPropGetters(propNames) {
81
- const getters = {};
82
- for (const propName of propNames) getters[propName] = (slots) => slots[propName];
83
- return getters;
84
- }
85
- function pluckProps(propNames, props, dest = Object.create(null)) {
86
- for (const propName of propNames) dest[propName] = props[propName];
87
- return dest;
88
- }
89
- function bindArgs(f, ...boundArgs) {
90
- return (...dynamicArgs) => f(...boundArgs, ...dynamicArgs);
91
- }
92
- function noop() {}
93
- function padNumber(digits, num) {
94
- return String(num).padStart(digits, "0");
95
- }
96
- const padNumber2 = /*@__PURE__*/ bindArgs(padNumber, 2);
97
- function compareNumbers(a, b) {
98
- return Math.sign(a - b);
99
- }
100
- function modFloor(num, divisor) {
101
- return (num % divisor + divisor) % divisor;
102
- }
103
- function divTrunc(num, divisor) {
104
- return Math.trunc(num / divisor) || 0;
105
- }
106
- function getCalendarSlotId(calendar) {
107
- return calendar === void 0 ? "iso8601" : 0 === calendar ? "gregory" : calendar.id;
108
- }
109
- function formatMonthCode(monthCodeNumber, isLeapMonth) {
110
- return "M" + padNumber2(monthCodeNumber) + (isLeapMonth ? "L" : "");
111
- }
112
- function monthCodeNumberToMonth(monthCodeNumber, isLeapMonth, leapMonth) {
113
- return monthCodeNumber + (isLeapMonth || leapMonth && monthCodeNumber >= leapMonth ? 1 : 0);
114
- }
115
- function monthToMonthCodeNumber(month, leapMonth) {
116
- return month - (leapMonth && month >= leapMonth ? 1 : 0);
117
- }
118
- const unitNamesAsc = /*@__PURE__*/ Object.keys({
119
- nanosecond: 0,
120
- microsecond: 1,
121
- millisecond: 2,
122
- second: 3,
123
- minute: 4,
124
- hour: 5,
125
- day: 6,
126
- week: 7,
127
- month: 8,
128
- year: 9
129
- });
130
- const milliInUtcDay = 864e5;
131
- const bigNanoInUtcDay = /*@__PURE__*/ BigInt(864e11);
132
- const timeFieldNamesAsc = /*@__PURE__*/ unitNamesAsc.slice(0, 6);
133
- const calendarDateFieldNamesAsc = [
134
- "day",
135
- "month",
136
- "year"
137
- ];
138
- function isoDateToEpochNano(isoDate) {
139
- return BigInt(isoDateToEpochDays(isoDate)) * bigNanoInUtcDay;
140
- }
141
- function isoDateToEpochDays(isoDate) {
142
- return isoPartsToEpochDays(isoDate.year, isoDate.month, isoDate.day);
143
- }
144
- function isoPartsToEpochDays(isoYear, isoMonth = 1, isoDay = 1) {
145
- const monthIndex = isoMonth - 1;
146
- return isoYear += Math.floor(monthIndex / 12), isoMonth = modFloor(monthIndex, 12), Date.UTC(isoYear % 400 - 400, isoMonth, 0) / 864e5 + 146097 * (divTrunc(isoYear, 400) + 1) + isoDay;
147
- }
148
- function epochDaysToIsoDate(epochDays) {
149
- const legacyDate = /* @__PURE__ */ new Date(864e5 * modFloor(epochDays, 146097));
150
- return {
151
- year: legacyDate.getUTCFullYear() + 400 * Math.floor(epochDays / 146097),
152
- month: legacyDate.getUTCMonth() + 1,
153
- day: legacyDate.getUTCDate()
154
- };
155
- }
156
- function diffEpochMilliDays(epochMilli0, epochMilli1) {
157
- return Math.trunc((epochMilli1 - epochMilli0) / 864e5);
158
- }
159
- function computeIsoMonthCodeParts(month) {
160
- return [month, 0];
161
- }
162
- function computeIsoDaysInMonth(year, month) {
163
- switch (month) {
164
- case 2: return computeIsoInLeapYear(year) ? 29 : 28;
165
- case 4:
166
- case 6:
167
- case 9:
168
- case 11: return 30;
169
- }
170
- return 31;
171
- }
172
- function computeIsoInLeapYear(year) {
173
- return year % 4 == 0 && (year % 100 != 0 || year % 400 == 0);
174
- }
175
- function computeGregoryEraFields({ year }) {
176
- return year < 1 ? {
177
- era: "bce",
178
- eraYear: 1 - year
179
- } : {
180
- era: "ce",
181
- eraYear: year
182
- };
183
- }
184
- function validateIsoDateFields(isoInternals) {
185
- return constrainIsoDateFields(isoInternals, 1), isoInternals;
186
- }
187
- function constrainIsoDateFields(isoDate, overflow) {
188
- const { year } = isoDate;
189
- const month = clampProp(isoDate, "month", 1, 12, overflow);
190
- return {
191
- year,
192
- month,
193
- day: clampProp(isoDate, "day", 1, computeIsoDaysInMonth(year, month), overflow)
194
- };
195
- }
196
- function computeCalendarDateFields(calendar, isoDate) {
197
- return calendar ? calendar.de(isoDate) : isoDate;
198
- }
199
- function computeCalendarMonthCodeParts(calendar, year, month) {
200
- return calendar ? calendar.N(year, month) : computeIsoMonthCodeParts(month);
201
- }
202
- function computeCalendarEraFields(calendar, isoDate) {
203
- return 0 === calendar ? computeGregoryEraFields(isoDate) : calendar && calendar.h?.(isoDate) || {};
204
- }
205
- function computeCalendarMonthCode(calendar, isoDate) {
206
- const { year, month } = computeCalendarDateFields(calendar, isoDate);
207
- const [monthCodeNumber, isLeapMonth] = computeCalendarMonthCodeParts(calendar, year, month);
208
- return formatMonthCode(monthCodeNumber, isLeapMonth);
209
- }
210
- function computeCalendarInLeapYear(calendar, isoDate) {
211
- const { year } = computeCalendarDateFields(calendar, isoDate);
212
- return calendar ? calendar.q(year) : computeIsoInLeapYear(year);
213
- }
214
- const requireString = /*@__PURE__*/ bindArgs(requireType, "string");
215
- function requireType(typeName, arg, entityName = typeName) {
216
- return typeof arg !== typeName && throwTypeError(invalidEntity(entityName, arg)), arg;
217
- }
218
- function toString(arg) {
219
- return "symbol" == typeof arg && throwTypeError("Cannot convert Symbol to string"), String(arg);
220
- }
221
- function toPrimitiveWithStringHint(arg) {
222
- if (!isObjectLike(arg)) return arg;
223
- const exoticToPrimitive = arg[Symbol.toPrimitive];
224
- if (null != exoticToPrimitive) {
225
- "function" != typeof exoticToPrimitive && throwTypeError();
226
- const primitive = Reflect.apply(exoticToPrimitive, arg, ["string"]);
227
- return isObjectLike(primitive) && throwTypeError(), primitive;
228
- }
229
- return Date.prototype[Symbol.toPrimitive].call(arg, "string");
230
- }
231
- const epochNanoMax = /*@__PURE__*/ BigInt(1e8) * bigNanoInUtcDay;
232
- const epochNanoMin = /*@__PURE__*/ BigInt(-1e8) * bigNanoInUtcDay;
233
- const plainDateEpochNanoMin = epochNanoMin - bigNanoInUtcDay;
234
- function checkIsoDateInBounds(isoDate, allowPlainDateLowerEdge = 1) {
235
- const epochNano = isoDateToEpochNano(isoDate);
236
- return (epochNano < (allowPlainDateLowerEdge ? plainDateEpochNanoMin : epochNanoMin) || epochNano > epochNanoMax) && throwRangeError("Out-of-bounds date"), isoDate;
237
- }
238
- function createDateSlots(isoDate, calendar) {
239
- return pluckProps(calendarDateFieldNamesAsc, isoDate, { calendar });
240
- }
241
- ({ .../* @__PURE__ */ Object.assign({}, {
242
- era: toString,
243
- month: toPositiveIntegerWithTruncation,
244
- monthCode(monthCode, fieldName) {
245
- return requireString(toPrimitiveWithStringHint(monthCode), fieldName);
246
- },
247
- day: toPositiveIntegerWithTruncation
248
- }, /* @__PURE__ */ zipPropsConst(timeFieldNamesAsc, toIntegerWithTrunc)) });
249
- Intl.DateTimeFormat;
250
- function formatDateIsoAuto(plainDateSlots) {
251
- return formatIsoDateFields(plainDateSlots) + (plainDateSlots.calendar === void 0 ? "" : formatCalendarId(getCalendarSlotId(plainDateSlots.calendar), 0));
252
- }
253
- function formatIsoDateFields(isoDate) {
254
- return formatIsoYearMonthFields(isoDate) + "-" + padNumber2(isoDate.day);
255
- }
256
- function formatIsoYearMonthFields(isoDate) {
257
- const { year } = isoDate;
258
- return (year < 0 || year > 9999 ? getSignStr(year) + padNumber(6, Math.abs(year)) : padNumber(4, year)) + "-" + padNumber2(isoDate.month);
259
- }
260
- function formatCalendarId(calendarId, isCritical) {
261
- return "[" + (isCritical ? "!" : "") + "u-ca=" + calendarId + "]";
262
- }
263
- function getSignStr(num) {
264
- return num < 0 ? "-" : "+";
265
- }
266
- function timeRegExpStr(separatorIndex) {
267
- return `(\\d{2})(?:(:?)(\\d{2})(?:\\${separatorIndex}(\\d{2})(?:[.,](\\d{1,9}))?)?)?`;
268
- }
269
- "" + timeRegExpStr(8) + timeRegExpStr(15);
270
- "" + timeRegExpStr(2) + `(([+-])${timeRegExpStr(9)})?((?:\\[(!?)([^\\]]*)\\]){0,9})`;
271
- ({ .../* @__PURE__ */ Object.assign({}, {
272
- year: "numeric",
273
- month: "numeric",
274
- day: "numeric"
275
- }, {
276
- hour: "numeric",
277
- minute: "numeric",
278
- second: "numeric"
279
- }) });
280
- // node_modules/.aspect_rules_js/temporal-polyfill@1.0.6/node_modules/temporal-polyfill/chunks/exoticCalendars-utils.js
281
- function computeIntlEpochMilli(intlData, year, month = 1, day = 1) {
282
- return intlData.K(year).X[month - 1] + (day - 1) * milliInUtcDay;
283
- }
284
- function computeIntlDaysInYear(intlData, year) {
285
- return diffEpochMilliDays(computeIntlEpochMilli(intlData, year), computeIntlEpochMilli(intlData, year + 1));
286
- }
287
- function computeIntlDaysInMonth(intlData, year, month) {
288
- const { X: monthEpochMillis } = intlData.K(year);
289
- let nextMonth = month + 1;
290
- let nextMonthEpochMilli = monthEpochMillis;
291
- return nextMonth > monthEpochMillis.length && (nextMonth = 1, nextMonthEpochMilli = intlData.K(year + 1).X), diffEpochMilliDays(monthEpochMillis[month - 1], nextMonthEpochMilli[nextMonth - 1]);
292
- }
293
- function createArithmeticCalendar(ops) {
294
- const monthDayReferenceDate = ops.J(2441683);
295
- const fromIsoDate = memoize((isoDate) => ops.J(isoDateToEpochDays(isoDate) + 2440588), WeakMap);
296
- function computeDefaultMonthCodeParts(year, month) {
297
- const leapMonth = ops.p?.(year);
298
- return [monthToMonthCodeNumber(month, leapMonth), month === leapMonth];
299
- }
300
- return {
301
- k: ops.k,
302
- l: ops.l,
303
- V: ops.V,
304
- U: ops.U,
305
- re: ops.re,
306
- _: ops._,
307
- ge: ops.ge,
308
- de: fromIsoDate,
309
- fe(year, month, day) {
310
- return epochDaysToIsoDate(ops.L(year, month, day) - 2440588);
311
- },
312
- pe(year, month = 1, day = 1) {
313
- return (ops.L(year, month, day) - 2440588) * milliInUtcDay;
314
- },
315
- N(year, month) {
316
- return (ops.N || computeDefaultMonthCodeParts)(year, month);
317
- },
318
- u(monthCodeNumber, isLeapMonth, day) {
319
- return ops.u?.(monthCodeNumber, isLeapMonth, day) || ((monthCodeNumber, isLeapMonth, day) => {
320
- isLeapMonth = Boolean(isLeapMonth);
321
- let referenceYear = ops.re || monthDayReferenceDate.year;
322
- const [referenceMonthCodeNumber, referenceIsLeapMonth] = computeDefaultMonthCodeParts(monthDayReferenceDate.year, monthDayReferenceDate.month);
323
- 1 === (compareNumbers(monthCodeNumber, referenceMonthCodeNumber) || compareNumbers(Number(isLeapMonth), Number(referenceIsLeapMonth)) || compareNumbers(day, monthDayReferenceDate.day)) && referenceYear--;
324
- for (let yearDelta = 0; yearDelta < 100; yearDelta++) for (const year of [referenceYear - yearDelta, referenceYear + yearDelta]) {
325
- const leapMonth = ops.p?.(year);
326
- const month = monthCodeNumberToMonth(monthCodeNumber, isLeapMonth, leapMonth);
327
- if (month <= ops.j(year) && isLeapMonth === (month === leapMonth) && day <= ops.o(year, month)) return {
328
- year,
329
- month
330
- };
331
- }
332
- })(monthCodeNumber, isLeapMonth, day);
333
- },
334
- q: ops.q,
335
- j: ops.j,
336
- o: ops.o,
337
- i: ops.i,
338
- p: ops.p || noop,
339
- h(isoDate) {
340
- const parts = fromIsoDate(isoDate);
341
- return ops.h ? ops.h(parts) : {
342
- era: parts.era,
343
- eraYear: parts.eraYear
344
- };
345
- },
346
- ae(year, month, monthDelta) {
347
- return ((computeMonthsInYear, year, month, monthDelta) => {
348
- if (monthDelta) {
349
- if (Number.isSafeInteger(month += monthDelta) || throwRangeError("Out-of-bounds date"), monthDelta < 0) for (; month < 1;) month += computeMonthsInYear(--year);
350
- else {
351
- let monthsInYear;
352
- for (; month > (monthsInYear = computeMonthsInYear(year));) month -= monthsInYear, year++;
353
- }
354
- }
355
- return {
356
- year,
357
- month
358
- };
359
- })(ops.j, year, month, monthDelta);
360
- },
361
- ee(year0, month0, year1, month1) {
362
- return diffArithmeticMonthSlots(ops.j, year0, month0, year1, month1);
363
- }
364
- };
365
- }
366
- function diffArithmeticMonthSlots(computeMonthsInYear, year0, month0, year1, month1) {
367
- const cmp = compareNumbers(year0, year1) || compareNumbers(month0, month1);
368
- if (!cmp) return 0;
369
- if (year0 === year1) return month1 - month0;
370
- if (cmp < 0) {
371
- let months = computeMonthsInYear(year0) - month0 + month1;
372
- for (let year = year0 + 1; year < year1; year++) months += computeMonthsInYear(year);
373
- return months;
374
- }
375
- return -diffArithmeticMonthSlots(computeMonthsInYear, year1, month1, year0, month0);
376
- }
377
- // node_modules/.aspect_rules_js/temporal-polyfill@1.0.6/node_modules/temporal-polyfill/chunks/exoticCalendars.js
378
- const umalquraPlainMonthDay30ReferenceYears = [
379
- 1392,
380
- 1390,
381
- 1391,
382
- 1392,
383
- 1391,
384
- 1392,
385
- 1389,
386
- 1392,
387
- 1392,
388
- 1390,
389
- 1391,
390
- 1390
391
- ];
392
- function createIslamicCalendar(fromJulianDay, toJulianDay, intlUmalquraData) {
393
- return createArithmeticCalendar({
394
- k: {
395
- "bh": -1,
396
- "ah": 0
397
- },
398
- J: fromJulianDay,
399
- L: toJulianDay,
400
- o(year, month) {
401
- return intlUmalquraData && isUmalquraYear(year) ? computeIntlDaysInMonth(intlUmalquraData, year, month) : ((year, month) => 29 + month % 2 + (12 === month && islamicIsLeapYear(year) ? 1 : 0))(year, month);
402
- },
403
- i(year) {
404
- return intlUmalquraData && isUmalquraYear(year) ? computeIntlDaysInYear(intlUmalquraData, year) : islamicIsLeapYear(year) ? 355 : 354;
405
- },
406
- j() {
407
- return 12;
408
- },
409
- q(year) {
410
- return this.i(year) > 354;
411
- },
412
- u(monthCodeNumber, isLeapMonth, day) {
413
- const umalquraReferenceYear = intlUmalquraData && !isLeapMonth && 30 === day && umalquraPlainMonthDay30ReferenceYears[monthCodeNumber - 1];
414
- return intlUmalquraData && umalquraReferenceYear ? {
415
- year: umalquraReferenceYear,
416
- month: monthCodeNumber
417
- } : void 0;
418
- },
419
- h({ year }) {
420
- return year < 1 ? {
421
- era: "bh",
422
- eraYear: 1 - year
423
- } : {
424
- era: "ah",
425
- eraYear: year
426
- };
427
- }
428
- });
429
- }
430
- function islamicToJulianDay(epoch, year, month, day) {
431
- return day + Math.ceil(29.5 * (month - 1)) + 354 * (year - 1) + Math.floor((3 + 11 * year) / 30) + epoch - 1;
432
- }
433
- function julianDayToIslamic(epoch, julianDay) {
434
- const year = Math.floor((30 * (julianDay - epoch) + 10646) / 10631);
435
- const month = Math.min(12, Math.ceil((julianDay - (29 + islamicToJulianDay(epoch, year, 1, 1))) / 29.5) + 1);
436
- return {
437
- year,
438
- month,
439
- day: julianDay - islamicToJulianDay(epoch, year, month, 1) + 1
440
- };
441
- }
442
- function islamicIsLeapYear(year) {
443
- return modFloor(14 + 11 * year, 30) < 11;
444
- }
445
- function isUmalquraYear(year) {
446
- return year >= 1300 && year <= 1600;
447
- }
448
- const islamicTabularMeta = ["islamic-tbla", () => createIslamicCalendar(bindArgs(julianDayToIslamic, 1948439), bindArgs(islamicToJulianDay, 1948439))];
449
- const getOrCreateExoticCalendar = /*@__PURE__*/ memoize((canonicalId, createExoticCalendar) => {
450
- const calendar = createExoticCalendar(canonicalId);
451
- return calendar.id = canonicalId, calendar;
452
- });
453
- function createExoticCalendarGetter(meta) {
454
- return () => getOrCreateExoticCalendar(...meta);
455
- }
456
- // node_modules/.aspect_rules_js/temporal-polyfill@1.0.6/node_modules/temporal-polyfill/chunks/apiHelpers.js
457
- const PlainDateBranding = "PlainDate";
458
- const CalendarBranding = "Calendar";
459
- function defineTemporalClass(branding, cls, getSlots, ...getterMaps) {
460
- return Object.defineProperties(cls, createNameDescriptors(branding)), Object.defineProperties(cls.prototype, createStringTagDescriptors("Temporal." + branding)), Object.defineProperties(cls.prototype, mapProps((getter) => ({
461
- get() {
462
- return getter(getSlots(this));
463
- },
464
- configurable: 1
465
- }), Object.assign({}, ...getterMaps))), cls;
466
- }
467
- const attachDebugString = "noop" === noop.name ? (instance) => {
468
- Object.defineProperty(instance, "_str_", { value: instance.toJSON() });
469
- } : noop;
470
- function invalidRecordType() {
471
- throwTypeError(invalidCallingContext);
472
- }
473
- function forbiddenValueOf() {
474
- throwTypeError(forbiddenValueOf$1);
475
- }
476
- const dateFieldGetters$1 = {
477
- era(slots) {
478
- return computeCalendarEraFields(slots.calendar, slots).era;
479
- },
480
- eraYear(slots) {
481
- return computeCalendarEraFields(slots.calendar, slots).eraYear;
482
- },
483
- year(slots) {
484
- return computeCalendarDateFields(slots.calendar, slots).year;
485
- },
486
- month(slots) {
487
- return computeCalendarDateFields(slots.calendar, slots).month;
488
- },
489
- monthCode(slots) {
490
- return computeCalendarMonthCode(slots.calendar, slots);
491
- },
492
- day(slots) {
493
- return computeCalendarDateFields(slots.calendar, slots).day;
494
- }
495
- };
496
- function createNativeGetters(shimGetters) {
497
- return createPropGetters(Object.keys(shimGetters));
498
- }
499
- const dateFieldGetters = /*@__PURE__*/ createNativeGetters(dateFieldGetters$1);
500
- // node_modules/.aspect_rules_js/temporal-polyfill@1.0.6/node_modules/temporal-polyfill/chunks/funcApi.js
501
- const PlainDateRecordBranding = `${PlainDateBranding}Record`;
502
- const CalendarRecordBranding = `${CalendarBranding}Record`;
503
- const calendarMap = /*@__PURE__*/ new WeakMap();
504
- const plainDateMap = /*@__PURE__*/ new WeakMap();
505
- function getCalendarSlots(record) {
506
- return getCalendarSlotsIfPresent(record) || invalidRecordType();
507
- }
508
- function getCalendarSlotsIfPresent(record) {
509
- return calendarMap.get(record);
510
- }
511
- function getPlainDateSlots(record) {
512
- return getPlainDateSlotsIfPresent(record) || invalidRecordType();
513
- }
514
- function getPlainDateSlotsIfPresent(record) {
515
- return plainDateMap.get(record);
516
- }
517
- function setPlainDateSlots(instance, slots) {
518
- plainDateMap.set(instance, slots);
519
- }
520
- const CalendarRecord = /*@__PURE__*/ defineTemporalClass(CalendarRecordBranding, class {
521
- toJSON() {
522
- return getCalendarRecordId(this);
523
- }
524
- valueOf() {
525
- return getCalendarRecordId(this);
526
- }
527
- });
528
- function createCalendarRecord(id, getImpl) {
529
- const instance = Object.create(CalendarRecord.prototype);
530
- return ((instance, slots) => {
531
- calendarMap.set(instance, slots);
532
- })(instance, {
533
- id,
534
- xe: getImpl
535
- }), attachDebugString(instance), instance;
536
- }
537
- function getCalendarRecordId(record) {
538
- return getCalendarSlots(record).id;
539
- }
540
- function getCalendarRecordImplCreator(record) {
541
- const getImpl = getCalendarSlots(record).xe;
542
- return getImpl || throwRangeError(exoticCalendarRequired(getCalendarRecordId(record), "getExotic or getAny")), getImpl;
543
- }
544
- // node_modules/.aspect_rules_js/temporal-polyfill@1.0.6/node_modules/temporal-polyfill/fns/Calendar.js
545
- const getIslamicTabular = /*@__PURE__*/ createCanonicalGetter(islamicTabularMeta);
546
- const getOrCreateFoundRecord = /*@__PURE__*/ memoize((rawCalendarId, meta) => createCalendarRecord(rawCalendarId, createExoticCalendarGetter(meta)));
547
- function createCanonicalGetter(meta) {
548
- return () => getOrCreateFoundRecord(meta[0], meta);
549
- }
550
1
  // packages/ecma262-abstract/DateOperations.js
551
2
  const MS_PER_DAY = 864e5;
552
3
  function Day(t) {
@@ -610,75 +61,223 @@ function DateFromTime(t) {
610
61
  if (mft === 11) return dwy - 333 - leap;
611
62
  throw new Error("Invalid time");
612
63
  }
613
- // node_modules/.aspect_rules_js/temporal-polyfill@1.0.6/node_modules/temporal-polyfill/chunks/root.js
614
- const NativeTemporal = globalThis.Temporal;
615
- // node_modules/.aspect_rules_js/temporal-polyfill@1.0.6/node_modules/temporal-polyfill/chunks/funcApi-native.js
616
- function refineNativeCalendarArgMaybe(calendarRecord) {
617
- if (void 0 !== calendarRecord) return getValidatedCalendarId(calendarRecord);
618
- }
619
- function getValidatedCalendarId(record) {
620
- return getCalendarRecordImplCreator(record), getCalendarRecordId(record);
621
- }
622
- const getNativePlainDate = getPlainDateSlots;
623
- const NativePlainDateRecord = /*@__PURE__*/ defineTemporalClass(PlainDateRecordBranding, class {
624
- get calendarId() {
625
- return getNativePlainDate(this).calendarId;
64
+ // packages/ecma402-abstract/Calendar/Arithmetic.js
65
+ const monthStarts = [
66
+ 0,
67
+ 31,
68
+ 59,
69
+ 90,
70
+ 120,
71
+ 151,
72
+ 181,
73
+ 212,
74
+ 243,
75
+ 273,
76
+ 304,
77
+ 334
78
+ ];
79
+ const mod = (value, divisor) => value - Math.floor(value / divisor) * divisor;
80
+ function integer(value) {
81
+ if (!Number.isSafeInteger(value)) throw new RangeError("Expected safe integer");
82
+ return value;
83
+ }
84
+ function HebrewLeapYear(year) {
85
+ return mod(7 * year + 1, 19) < 7;
86
+ }
87
+ function HebrewElapsedMonths(year) {
88
+ return Math.floor((235 * year - 234) / 19);
89
+ }
90
+ function hebrewDelay(year) {
91
+ const months = HebrewElapsedMonths(year);
92
+ const day = 29 * months + Math.floor((12084 + 13753 * months) / 25920);
93
+ return day + Number(mod(3 * (day + 1), 7) < 3);
94
+ }
95
+ function IsISOCalendar(calendar) {
96
+ return [
97
+ "iso8601",
98
+ "gregory",
99
+ "buddhist",
100
+ "japanese",
101
+ "roc"
102
+ ].includes(calendar);
103
+ }
104
+ function CalendarISOYear(calendar, year) {
105
+ return year + (calendar === "buddhist" ? -543 : calendar === "roc" ? 1911 : 0);
106
+ }
107
+ function ArithmeticCalendarStartOfYear(calendar, year) {
108
+ if (IsISOCalendar(calendar)) return DayFromYear(CalendarISOYear(calendar, year));
109
+ switch (calendar) {
110
+ case "coptic": return -615923 + 365 * year + Math.floor(year / 4);
111
+ case "ethiopic": return -716732 + 365 * year + Math.floor(year / 4);
112
+ case "ethioaa": {
113
+ const value = year - 5500;
114
+ return -716732 + 365 * value + Math.floor(value / 4);
115
+ }
116
+ case "indian": return DayFromYear(year + 78) + 80;
117
+ case "islamic-civil":
118
+ case "islamic-tbla": return -492148 - Number(calendar === "islamic-tbla") + 354 * (year - 1) + Math.floor((3 + 11 * year) / 30);
119
+ case "persian": return -492268 + 365 * (year - 1) + Math.floor((8 * year + 21) / 33);
626
120
  }
627
- toJSON() {
628
- return getNativePlainDate(this).toJSON();
121
+ const present = hebrewDelay(year);
122
+ return -2092590 + present + (hebrewDelay(year + 1) - present === 356 ? 2 : present - hebrewDelay(year - 1) === 382 ? 1 : 0);
123
+ }
124
+ function ArithmeticCalendarMonthsInYear(calendar, year) {
125
+ return [
126
+ "coptic",
127
+ "ethiopic",
128
+ "ethioaa"
129
+ ].includes(calendar) || calendar === "hebrew" && HebrewLeapYear(year) ? 13 : 12;
130
+ }
131
+ function ArithmeticCalendarDaysInMonth(calendar, year, month) {
132
+ const count = ArithmeticCalendarMonthsInYear(calendar, year);
133
+ if (integer(month) < 1 || month > count) throw new RangeError("Invalid calendar month");
134
+ if (IsISOCalendar(calendar)) return month === 12 ? 31 : monthStarts[month] - monthStarts[month - 1] + Number(month === 2 && DaysInYear(CalendarISOYear(calendar, year)) === 366);
135
+ const length = ArithmeticCalendarStartOfYear(calendar, year + 1) - ArithmeticCalendarStartOfYear(calendar, year);
136
+ if ([
137
+ "coptic",
138
+ "ethiopic",
139
+ "ethioaa"
140
+ ].includes(calendar)) return month === 13 ? length - 360 : 30;
141
+ if (calendar === "indian") return month === 1 ? 30 + Number(DaysInYear(year + 78) === 366) : month <= 6 ? 31 : 30;
142
+ if (calendar === "islamic-civil" || calendar === "islamic-tbla") return month % 2 === 1 || month === 12 && length === 355 ? 30 : 29;
143
+ if (calendar === "persian") return month <= 6 ? 31 : month < 12 ? 30 : length - 336;
144
+ const code = month + Number(!HebrewLeapYear(year) && month >= 6);
145
+ if ([
146
+ 4,
147
+ 7,
148
+ 9,
149
+ 11,
150
+ 13
151
+ ].includes(code)) return 29;
152
+ if (code === 2) return length % 10 === 5 ? 30 : 29;
153
+ if (code === 3) return length % 10 === 3 ? 29 : 30;
154
+ return 30;
155
+ }
156
+ function ArithmeticCalendarMonthCode(calendar, year, month) {
157
+ const leap = calendar === "hebrew" && HebrewLeapYear(year);
158
+ if (leap && month === 6) return "M05L";
159
+ const code = month - Number(leap && month > 6);
160
+ return "M" + (code < 10 ? "0" : "") + code;
161
+ }
162
+ function ArithmeticCalendarFromEpochDay(calendar, epoch) {
163
+ const t = epoch * 864e5, civilYear = YearFromTime(t);
164
+ if (IsISOCalendar(calendar)) {
165
+ const year = civilYear - (calendar === "buddhist" ? -543 : calendar === "roc" ? 1911 : 0), month = MonthFromTime(t) + 1;
166
+ return {
167
+ year,
168
+ month,
169
+ monthCode: ArithmeticCalendarMonthCode(calendar, year, month),
170
+ day: DateFromTime(t)
171
+ };
629
172
  }
630
- valueOf() {
631
- return getNativePlainDate(this).valueOf();
173
+ const jd = epoch + 2440588;
174
+ let year;
175
+ switch (calendar) {
176
+ case "coptic":
177
+ year = Math.floor((4 * (jd - 1824665) + 3) / 1461);
178
+ break;
179
+ case "ethiopic":
180
+ case "ethioaa":
181
+ year = Math.floor((4 * (jd - 1723856) + 3) / 1461) + (calendar === "ethioaa" ? 5500 : 0);
182
+ break;
183
+ case "islamic-civil":
184
+ case "islamic-tbla":
185
+ year = Math.floor((30 * (jd - 1948440 + Number(calendar === "islamic-tbla")) + 10646) / 10631);
186
+ break;
187
+ case "persian":
188
+ year = 1 + Math.floor((33 * (jd - 1948320) + 3) / 12053);
189
+ break;
190
+ case "indian":
191
+ year = civilYear - 78;
192
+ break;
193
+ default: year = Math.floor((epoch + 2092590) * 492480 / 179876755) + 1;
632
194
  }
633
- }, getNativePlainDate, dateFieldGetters);
634
- function createNativePlainDateRecord(native) {
635
- const instance = Object.create(NativePlainDateRecord.prototype);
636
- return setPlainDateSlots(instance, native), attachDebugString(instance), instance;
637
- }
638
- function create$2$1(isoYear, isoMonth, isoDay, calendar) {
639
- return createNativePlainDateRecord(new NativeTemporal.PlainDate(isoYear, isoMonth, isoDay, refineNativeCalendarArgMaybe(calendar)));
640
- }
641
- function inLeapYear$1$1(record) {
642
- return getNativePlainDate(record).inLeapYear;
643
- }
644
- // node_modules/.aspect_rules_js/temporal-polyfill@1.0.6/node_modules/temporal-polyfill/chunks/funcApi-shim.js
645
- function refineShimCalendarArgMaybe(calendarRecord) {
646
- return void 0 === calendarRecord ? void 0 : getCalendarRecordImpl(calendarRecord);
647
- }
648
- function getCalendarRecordImpl(record) {
649
- return getCalendarRecordImplCreator(record)();
195
+ while (ArithmeticCalendarStartOfYear(calendar, year) > epoch) year--;
196
+ while (ArithmeticCalendarStartOfYear(calendar, year + 1) <= epoch) year++;
197
+ let month = 1, remaining = epoch - ArithmeticCalendarStartOfYear(calendar, year);
198
+ while (remaining >= ArithmeticCalendarDaysInMonth(calendar, year, month)) remaining -= ArithmeticCalendarDaysInMonth(calendar, year, month++);
199
+ return {
200
+ year,
201
+ month,
202
+ monthCode: ArithmeticCalendarMonthCode(calendar, year, month),
203
+ day: remaining + 1
204
+ };
650
205
  }
651
- const getShimPlainDateSlots = getPlainDateSlots;
652
- const ShimPlainDateRecord = /*@__PURE__*/ defineTemporalClass(PlainDateRecordBranding, class {
653
- get calendarId() {
654
- return getCalendarSlotId(getShimPlainDateSlots(this).calendar);
655
- }
656
- toJSON() {
657
- return formatDateIsoAuto(getShimPlainDateSlots(this));
658
- }
659
- valueOf() {
660
- return forbiddenValueOf();
206
+ const JapaneseEras = [
207
+ [
208
+ 18017,
209
+ "reiwa",
210
+ 2018
211
+ ],
212
+ [
213
+ 6947,
214
+ "heisei",
215
+ 1988
216
+ ],
217
+ [
218
+ -15713,
219
+ "showa",
220
+ 1925
221
+ ],
222
+ [
223
+ -20974,
224
+ "taisho",
225
+ 1911
226
+ ],
227
+ [
228
+ -35428,
229
+ "meiji",
230
+ 1867
231
+ ]
232
+ ];
233
+ function ArithmeticCalendarEra(calendar, epoch, year) {
234
+ switch (calendar) {
235
+ case "iso8601": return;
236
+ case "buddhist": return {
237
+ era: "be",
238
+ eraYear: year
239
+ };
240
+ case "coptic":
241
+ case "hebrew": return {
242
+ era: "am",
243
+ eraYear: year
244
+ };
245
+ case "ethiopic": return {
246
+ era: year > 0 ? "am" : "aa",
247
+ eraYear: year > 0 ? year : year + 5500
248
+ };
249
+ case "ethioaa": return {
250
+ era: "aa",
251
+ eraYear: year
252
+ };
253
+ case "indian": return {
254
+ era: "shaka",
255
+ eraYear: year
256
+ };
257
+ case "persian": return {
258
+ era: "ap",
259
+ eraYear: year
260
+ };
261
+ case "roc": return {
262
+ era: year > 0 ? "roc" : "broc",
263
+ eraYear: year > 0 ? year : 1 - year
264
+ };
265
+ case "islamic-civil":
266
+ case "islamic-tbla": return {
267
+ era: year > 0 ? "ah" : "bh",
268
+ eraYear: year > 0 ? year : 1 - year
269
+ };
270
+ case "japanese": for (const [start, era, offset] of JapaneseEras) if (epoch >= start) return {
271
+ era,
272
+ eraYear: year - offset
273
+ };
661
274
  }
662
- }, getShimPlainDateSlots, dateFieldGetters$1);
663
- function createShimPlainDateRecord(slots) {
664
- const instance = Object.create(ShimPlainDateRecord.prototype);
665
- return setPlainDateSlots(instance, slots), attachDebugString(instance), instance;
666
- }
667
- function create$2(isoYear, isoMonth, isoDay, calendar) {
668
- return createShimPlainDateRecord(createDateSlots(checkIsoDateInBounds(validateIsoDateFields(mapProps(toIntegerWithTrunc, {
669
- year: isoYear,
670
- month: isoMonth,
671
- day: isoDay
672
- }))), refineShimCalendarArgMaybe(calendar)));
673
- }
674
- function inLeapYear$1(record) {
675
- const slots = getShimPlainDateSlots(record);
676
- return computeCalendarInLeapYear(slots.calendar, slots);
275
+ return {
276
+ era: year > 0 ? "ce" : "bce",
277
+ eraYear: year > 0 ? year : 1 - year
278
+ };
677
279
  }
678
- // node_modules/.aspect_rules_js/temporal-polyfill@1.0.6/node_modules/temporal-polyfill/fns/PlainDate.js
679
- const create = NativeTemporal ? create$2$1 : create$2;
680
- const inLeapYear = NativeTemporal ? inLeapYear$1$1 : inLeapYear$1;
681
- // packages/intl-datetimeformat/calendars/temporal.js
280
+ // packages/intl-datetimeformat/calendars/arithmetic.js
682
281
  const eras = {
683
282
  be: "0",
684
283
  am: "1",
@@ -698,19 +297,21 @@ const eras = {
698
297
  ap: "0"
699
298
  };
700
299
  /**
701
- * Adapt Temporal calendar fields to CLDR era keys and month-name indices.
300
+ * Adapt shared calendar fields to CLDR era keys and month-name indices.
702
301
  * This is an implementation helper for ECMA-402 ToLocalTime, not a spec AO.
703
302
  * https://tc39.es/ecma402/#sec-tolocaltime
704
303
  * https://unicode.org/reports/tr35/tr35-dates.html#Calendar_Elements
705
304
  */
706
- function temporalCalendar(calendar, getCalendar, hebrew = false) {
305
+ function arithmeticCalendar(calendar, hebrew = false) {
707
306
  return {
708
307
  calendar,
709
308
  dateFromTime(t) {
710
- const date = create(YearFromTime(t), MonthFromTime(t) + 1, DateFromTime(t), getCalendar());
309
+ const epochDay = Math.floor(t / 864e5);
310
+ if (!Number.isFinite(t) || epochDay < -100000001 || epochDay > 1e8) throw new RangeError("Calendar date out of range");
311
+ const date = ArithmeticCalendarFromEpochDay(calendar, epochDay);
711
312
  if (hebrew) {
712
313
  const monthCode = Number(date.monthCode.slice(1, 3));
713
- const monthNameIndex = date.monthCode === "M05L" ? 5 : monthCode === 6 && inLeapYear(date) ? 13 : monthCode >= 6 ? monthCode : monthCode - 1;
314
+ const monthNameIndex = date.monthCode === "M05L" ? 5 : monthCode === 6 && ArithmeticCalendarMonthsInYear(calendar, date.year) === 13 ? 13 : monthCode >= 6 ? monthCode : monthCode - 1;
714
315
  return {
715
316
  era: "0",
716
317
  year: date.year,
@@ -719,9 +320,10 @@ function temporalCalendar(calendar, getCalendar, hebrew = false) {
719
320
  day: date.day
720
321
  };
721
322
  }
323
+ const era = ArithmeticCalendarEra(calendar, epochDay, date.year);
722
324
  return {
723
- era: eras[date.era],
724
- year: date.eraYear ?? date.year,
325
+ era: eras[era.era],
326
+ year: era?.eraYear ?? date.year,
725
327
  month: date.month - 1,
726
328
  day: date.day
727
329
  };
@@ -729,7 +331,7 @@ function temporalCalendar(calendar, getCalendar, hebrew = false) {
729
331
  };
730
332
  }
731
333
  // packages/intl-datetimeformat/calendars/implementations/islamic-tbla.js
732
- const data = temporalCalendar("islamic-tbla", getIslamicTabular);
334
+ const data = arithmeticCalendar("islamic-tbla");
733
335
  // packages/intl-datetimeformat/register-calendar-data.ts
734
336
  /** Register after installation, or queue until the polyfill is installed. */
735
337
  function registerCalendarData(...data) {