@unicom-cloud/utils 0.1.14 → 0.1.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (40) hide show
  1. package/content-disposition/index.js +34 -31
  2. package/contentDisposition.js +7 -5
  3. package/file/saveAs.js +13 -14
  4. package/lunar/lib/Holiday.js +2 -6
  5. package/lunar/lib/HolidayUtil.js +113 -99
  6. package/lunar/lib/I18n.js +395 -975
  7. package/lunar/lib/JieQi.js +12 -16
  8. package/lunar/lib/Lunar.js +224 -672
  9. package/lunar/lib/LunarMonth.js +35 -98
  10. package/lunar/lib/LunarTime.js +24 -103
  11. package/lunar/lib/LunarUtil.js +426 -1728
  12. package/lunar/lib/LunarYear.js +473 -566
  13. package/lunar/lib/ShouXingUtil.js +6714 -6690
  14. package/lunar/lib/Solar.js +24 -49
  15. package/lunar/lib/SolarHalfYear.js +0 -2
  16. package/lunar/lib/SolarMonth.js +4 -6
  17. package/lunar/lib/SolarSeason.js +0 -2
  18. package/lunar/lib/SolarUtil.js +238 -226
  19. package/lunar/lib/SolarWeek.js +7 -11
  20. package/lunar/lib/SolarYear.js +0 -1
  21. package/mock/MockWebSocket.js +2 -2
  22. package/package.json +1 -1
  23. package/snapdom/src/api/snapdom.js +72 -71
  24. package/snapdom/src/core/prepare.js +21 -21
  25. package/snapdom/src/modules/background.js +23 -17
  26. package/snapdom/src/modules/fonts.js +99 -91
  27. package/snapdom/src/modules/pseudo.js +59 -70
  28. package/tinycolor/src/conversion.js +1 -1
  29. package/tinycolor/src/index.js +2 -19
  30. package/turbo-stream/src/encode.js +5 -8
  31. package/turbo-stream/src/shared.js +117 -119
  32. package/types/file/saveAs.d.ts +1 -1
  33. package/types/lunar/lib/Lunar.d.ts +0 -98
  34. package/types/lunar/lib/LunarMonth.d.ts +0 -12
  35. package/types/lunar/lib/LunarTime.d.ts +0 -22
  36. package/types/lunar/lib/LunarUtil.d.ts +0 -90
  37. package/types/lunar/lib/LunarYear.d.ts +0 -30
  38. package/types/lunar/lib/Solar.d.ts +0 -5
  39. package/types/snapdom/src/modules/pseudo.d.ts +1 -1
  40. package/types/tinycolor/src/conversion.d.ts +1 -1
@@ -1,87 +1,59 @@
1
- import { I18n as s } from "./I18n.js";
2
- import { JieQi as G } from "./JieQi.js";
3
- import { LunarTime as E } from "./LunarTime.js";
4
- import { LunarUtil as e } from "./LunarUtil.js";
5
- import { LunarYear as Z } from "./LunarYear.js";
6
- import { Solar as c } from "./Solar.js";
7
- import { SolarUtil as S } from "./SolarUtil.js";
8
- class _ {
9
- _year;
10
- _month;
11
- _day;
12
- _hour;
13
- _minute;
14
- _second;
15
- _timeGanIndex;
16
- _timeZhiIndex;
17
- _dayGanIndex;
18
- _dayZhiIndex;
19
- _dayGanIndexExact;
20
- _dayZhiIndexExact;
21
- _dayGanIndexExact2;
22
- _dayZhiIndexExact2;
23
- _monthGanIndex;
24
- _monthZhiIndex;
25
- _monthGanIndexExact;
26
- _monthZhiIndexExact;
27
- _yearGanIndex;
28
- _yearZhiIndex;
29
- _yearGanIndexByLiChun;
30
- _yearZhiIndexByLiChun;
31
- _yearGanIndexExact;
32
- _yearZhiIndexExact;
33
- _weekIndex;
34
- _jieQi;
35
- _jieQiList;
36
- _solar;
37
- static fromYmd(t, n, i) {
38
- return _.fromYmdHms(t, n, i, 0, 0, 0);
39
- }
40
- static fromYmdHms(t, n, i, a, r, g) {
41
- let I = Z.fromYear(t);
42
- const u = I.getMonth(n);
43
- if (u == null)
44
- throw new Error(`wrong lunar year ${t} month ${n}`);
45
- if (i < 1)
1
+ import { I18n as _ } from "./I18n.js";
2
+ import { JieQi as E } from "./JieQi.js";
3
+ import { LunarTime as l } from "./LunarTime.js";
4
+ import { LunarUtil as h } from "./LunarUtil.js";
5
+ import { LunarYear as G } from "./LunarYear.js";
6
+ import { Solar as u } from "./Solar.js";
7
+ import { SolarUtil as Y } from "./SolarUtil.js";
8
+ class I {
9
+ static fromYmd(t, e, n) {
10
+ return I.fromYmdHms(t, e, n, 0, 0, 0);
11
+ }
12
+ static fromYmdHms(t, e, n, i, r, s) {
13
+ let g = G.fromYear(t);
14
+ const d = g.getMonth(e);
15
+ if (d == null)
16
+ throw new Error(`wrong lunar year ${t} month ${e}`);
17
+ if (n < 1)
46
18
  throw new Error("lunar day must bigger than 0");
47
- const h = u.getDayCount();
48
- if (i > h)
19
+ const a = d.getDayCount();
20
+ if (n > a)
49
21
  throw new Error(
50
- `only ${h} days in lunar year ${t} month ${n}`
22
+ `only ${a} days in lunar year ${t} month ${e}`
51
23
  );
52
- const o = c.fromJulianDay(u.getFirstJulianDay() + i - 1), d = c.fromYmdHms(
24
+ const o = u.fromJulianDay(d.getFirstJulianDay() + n - 1), x = u.fromYmdHms(
53
25
  o.getYear(),
54
26
  o.getMonth(),
55
27
  o.getDay(),
56
- a,
28
+ i,
57
29
  r,
58
- g
30
+ s
59
31
  );
60
- return o.getYear() !== t && (I = Z.fromYear(o.getYear())), new _(
32
+ return o.getYear() !== t && (g = G.fromYear(o.getYear())), new I(
61
33
  t,
34
+ e,
62
35
  n,
63
36
  i,
64
- a,
65
37
  r,
66
- g,
67
- d,
68
- I
38
+ s,
39
+ x,
40
+ g
69
41
  );
70
42
  }
71
43
  static fromSolar(t) {
72
- let n = 0, i = 0, a = 0;
73
- const r = Z.fromYear(t.getYear()), g = r.getMonths();
74
- for (let I = 0, u = g.length; I < u; I++) {
75
- const h = g[I], o = t.subtract(c.fromJulianDay(h.getFirstJulianDay()));
76
- if (o < h.getDayCount()) {
77
- n = h.getYear(), i = h.getMonth(), a = o + 1;
44
+ let e = 0, n = 0, i = 0;
45
+ const r = G.fromYear(t.getYear()), s = r.getMonths();
46
+ for (let g = 0, d = s.length; g < d; g++) {
47
+ const a = s[g], o = t.subtract(u.fromJulianDay(a.getFirstJulianDay()));
48
+ if (o < a.getDayCount()) {
49
+ e = a.getYear(), n = a.getMonth(), i = o + 1;
78
50
  break;
79
51
  }
80
52
  }
81
- return new _(
53
+ return new I(
54
+ e,
82
55
  n,
83
56
  i,
84
- a,
85
57
  t.getHour(),
86
58
  t.getMinute(),
87
59
  t.getSecond(),
@@ -90,73 +62,73 @@ class _ {
90
62
  );
91
63
  }
92
64
  static fromDate(t) {
93
- return _.fromSolar(c.fromDate(t));
65
+ return I.fromSolar(u.fromDate(t));
94
66
  }
95
- static _computeJieQi(t, n) {
96
- const i = n.getJieQiJulianDays();
97
- for (let a = 0, r = e.JIE_QI_IN_USE.length; a < r; a++) {
98
- const g = e.JIE_QI_IN_USE[a];
99
- t.jieQiList.push(g), t.jieQi[g] = c.fromJulianDay(i[a]);
67
+ static _computeJieQi(t, e) {
68
+ const n = e.getJieQiJulianDays();
69
+ for (let i = 0, r = h.JIE_QI_IN_USE.length; i < r; i++) {
70
+ const s = h.JIE_QI_IN_USE[i];
71
+ t.jieQiList.push(s), t.jieQi[s] = u.fromJulianDay(n[i]);
100
72
  }
101
73
  }
102
- static _computeYear(t, n, i) {
103
- const a = i - 4;
104
- let r = a % 10, g = a % 12;
105
- r < 0 && (r += 10), g < 0 && (g += 12);
106
- let I = r, u = g, h = r, o = g;
107
- const d = n.getYear(), x = n.toYmd(), y = n.toYmdHms();
108
- let m = t.jieQi[s.getMessage("jq.liChun")];
109
- m.getYear() != d && (m = t.jieQi.LI_CHUN);
110
- const D = m.toYmd(), l = m.toYmdHms();
111
- i === d ? (x < D && (I--, u--), y < l && (h--, o--)) : i < d && (x >= D && (I++, u++), y >= l && (h++, o++)), t.yearGanIndex = r, t.yearZhiIndex = g, t.yearGanIndexByLiChun = (I < 0 ? I + 10 : I) % 10, t.yearZhiIndexByLiChun = (u < 0 ? u + 12 : u) % 12, t.yearGanIndexExact = (h < 0 ? h + 10 : h) % 10, t.yearZhiIndexExact = (o < 0 ? o + 12 : o) % 12;
112
- }
113
- static _computeMonth(t, n) {
114
- let i = null, a, r;
115
- const g = n.toYmd(), I = n.toYmdHms(), u = e.JIE_QI_IN_USE.length;
116
- let h = -3;
117
- for (a = 0; a < u; a += 2) {
118
- r = t.jieQi[e.JIE_QI_IN_USE[a]];
119
- const d = i == null ? g : i.toYmd();
120
- if (g >= d && g < r.toYmd())
74
+ static _computeYear(t, e, n) {
75
+ const i = n - 4;
76
+ let r = i % 10, s = i % 12;
77
+ r < 0 && (r += 10), s < 0 && (s += 12);
78
+ let g = r, d = s, a = r, o = s;
79
+ const x = e.getYear(), c = e.toYmd(), y = e.toYmdHms();
80
+ let m = t.jieQi[_.getMessage("jq.liChun")];
81
+ m.getYear() != x && (m = t.jieQi.LI_CHUN);
82
+ const Z = m.toYmd(), f = m.toYmdHms();
83
+ n === x ? (c < Z && (g--, d--), y < f && (a--, o--)) : n < x && (c >= Z && (g++, d++), y >= f && (a++, o++)), t.yearGanIndex = r, t.yearZhiIndex = s, t.yearGanIndexByLiChun = (g < 0 ? g + 10 : g) % 10, t.yearZhiIndexByLiChun = (d < 0 ? d + 12 : d) % 12, t.yearGanIndexExact = (a < 0 ? a + 10 : a) % 10, t.yearZhiIndexExact = (o < 0 ? o + 12 : o) % 12;
84
+ }
85
+ static _computeMonth(t, e) {
86
+ let n = null, i, r;
87
+ const s = e.toYmd(), g = e.toYmdHms(), d = h.JIE_QI_IN_USE.length;
88
+ let a = -3;
89
+ for (i = 0; i < d; i += 2) {
90
+ r = t.jieQi[h.JIE_QI_IN_USE[i]];
91
+ const x = n == null ? s : n.toYmd();
92
+ if (s >= x && s < r.toYmd())
121
93
  break;
122
- i = r, h++;
94
+ n = r, a++;
123
95
  }
124
- let o = ((t.yearGanIndexByLiChun + (h < 0 ? 1 : 0)) % 5 + 1) * 2 % 10;
125
- for (t.monthGanIndex = ((h < 0 ? h + 10 : h) + o) % 10, t.monthZhiIndex = ((h < 0 ? h + 12 : h) + e.BASE_MONTH_ZHI_INDEX) % 12, i = null, h = -3, a = 0; a < u; a += 2) {
126
- r = t.jieQi[e.JIE_QI_IN_USE[a]];
127
- const d = i == null ? I : i.toYmdHms();
128
- if (I >= d && I < r.toYmdHms())
96
+ let o = ((t.yearGanIndexByLiChun + (a < 0 ? 1 : 0)) % 5 + 1) * 2 % 10;
97
+ for (t.monthGanIndex = ((a < 0 ? a + 10 : a) + o) % 10, t.monthZhiIndex = ((a < 0 ? a + 12 : a) + h.BASE_MONTH_ZHI_INDEX) % 12, n = null, a = -3, i = 0; i < d; i += 2) {
98
+ r = t.jieQi[h.JIE_QI_IN_USE[i]];
99
+ const x = n == null ? g : n.toYmdHms();
100
+ if (g >= x && g < r.toYmdHms())
129
101
  break;
130
- i = r, h++;
102
+ n = r, a++;
131
103
  }
132
- o = ((t.yearGanIndexExact + (h < 0 ? 1 : 0)) % 5 + 1) * 2 % 10, t.monthGanIndexExact = ((h < 0 ? h + 10 : h) + o) % 10, t.monthZhiIndexExact = ((h < 0 ? h + 12 : h) + e.BASE_MONTH_ZHI_INDEX) % 12;
104
+ o = ((t.yearGanIndexExact + (a < 0 ? 1 : 0)) % 5 + 1) * 2 % 10, t.monthGanIndexExact = ((a < 0 ? a + 10 : a) + o) % 10, t.monthZhiIndexExact = ((a < 0 ? a + 12 : a) + h.BASE_MONTH_ZHI_INDEX) % 12;
133
105
  }
134
- static _computeDay(t, n, i, a) {
135
- const r = c.fromYmdHms(
136
- n.getYear(),
137
- n.getMonth(),
138
- n.getDay(),
106
+ static _computeDay(t, e, n, i) {
107
+ const r = u.fromYmdHms(
108
+ e.getYear(),
109
+ e.getMonth(),
110
+ e.getDay(),
139
111
  12,
140
112
  0,
141
113
  0
142
- ), g = Math.floor(r.getJulianDay()) - 11, I = g % 10, u = g % 12;
143
- t.dayGanIndex = I, t.dayZhiIndex = u;
144
- let h = I, o = u;
145
- t.dayGanIndexExact2 = h, t.dayZhiIndexExact2 = o;
146
- const d = (i < 10 ? "0" : "") + i + ":" + (a < 10 ? "0" : "") + a;
147
- d >= "23:00" && d <= "23:59" && (h++, h >= 10 && (h -= 10), o++, o >= 12 && (o -= 12)), t.dayGanIndexExact = h, t.dayZhiIndexExact = o;
148
- }
149
- static _computeTime(t, n, i) {
150
- const a = e.getTimeZhiIndex(
151
- (n < 10 ? "0" : "") + n + ":" + (i < 10 ? "0" : "") + i
114
+ ), s = Math.floor(r.getJulianDay()) - 11, g = s % 10, d = s % 12;
115
+ t.dayGanIndex = g, t.dayZhiIndex = d;
116
+ let a = g, o = d;
117
+ t.dayGanIndexExact2 = a, t.dayZhiIndexExact2 = o;
118
+ const x = (n < 10 ? "0" : "") + n + ":" + (i < 10 ? "0" : "") + i;
119
+ x >= "23:00" && x <= "23:59" && (a++, a >= 10 && (a -= 10), o++, o >= 12 && (o -= 12)), t.dayGanIndexExact = a, t.dayZhiIndexExact = o;
120
+ }
121
+ static _computeTime(t, e, n) {
122
+ const i = h.getTimeZhiIndex(
123
+ (e < 10 ? "0" : "") + e + ":" + (n < 10 ? "0" : "") + n
152
124
  );
153
- t.timeZhiIndex = a, t.timeGanIndex = (t.dayGanIndexExact % 5 * 2 + a) % 10;
125
+ t.timeZhiIndex = i, t.timeGanIndex = (t.dayGanIndexExact % 5 * 2 + i) % 10;
154
126
  }
155
- static _computeWeek(t, n) {
156
- t.weekIndex = n.getWeek();
127
+ static _computeWeek(t, e) {
128
+ t.weekIndex = e.getWeek();
157
129
  }
158
- static _compute(t, n, i, a, r) {
159
- const g = {
130
+ static _compute(t, e, n, i, r) {
131
+ const s = {
160
132
  timeGanIndex: 0,
161
133
  timeZhiIndex: 0,
162
134
  dayGanIndex: 0,
@@ -179,11 +151,11 @@ class _ {
179
151
  jieQi: {},
180
152
  jieQiList: []
181
153
  };
182
- return _._computeJieQi(g, r), _._computeYear(g, a, t), _._computeMonth(g, a), _._computeDay(g, a, n, i), _._computeTime(g, n, i), _._computeWeek(g, a), g;
154
+ return I._computeJieQi(s, r), I._computeYear(s, i, t), I._computeMonth(s, i), I._computeDay(s, i, e, n), I._computeTime(s, e, n), I._computeWeek(s, i), s;
183
155
  }
184
- constructor(t, n, i, a, r, g, I, u) {
185
- const h = _._compute(t, a, r, I, u);
186
- this._year = t, this._month = n, this._day = i, this._hour = a, this._minute = r, this._second = g, this._timeGanIndex = h.timeGanIndex, this._timeZhiIndex = h.timeZhiIndex, this._dayGanIndex = h.dayGanIndex, this._dayZhiIndex = h.dayZhiIndex, this._dayGanIndexExact = h.dayGanIndexExact, this._dayZhiIndexExact = h.dayZhiIndexExact, this._dayGanIndexExact2 = h.dayGanIndexExact2, this._dayZhiIndexExact2 = h.dayZhiIndexExact2, this._monthGanIndex = h.monthGanIndex, this._monthZhiIndex = h.monthZhiIndex, this._monthGanIndexExact = h.monthGanIndexExact, this._monthZhiIndexExact = h.monthZhiIndexExact, this._yearGanIndex = h.yearGanIndex, this._yearZhiIndex = h.yearZhiIndex, this._yearGanIndexByLiChun = h.yearGanIndexByLiChun, this._yearZhiIndexByLiChun = h.yearZhiIndexByLiChun, this._yearGanIndexExact = h.yearGanIndexExact, this._yearZhiIndexExact = h.yearZhiIndexExact, this._weekIndex = h.weekIndex, this._jieQi = h.jieQi, this._jieQiList = h.jieQiList, this._solar = I;
156
+ constructor(t, e, n, i, r, s, g, d) {
157
+ const a = I._compute(t, i, r, g, d);
158
+ this._year = t, this._month = e, this._day = n, this._hour = i, this._minute = r, this._second = s, this._timeGanIndex = a.timeGanIndex, this._timeZhiIndex = a.timeZhiIndex, this._dayGanIndex = a.dayGanIndex, this._dayZhiIndex = a.dayZhiIndex, this._dayGanIndexExact = a.dayGanIndexExact, this._dayZhiIndexExact = a.dayZhiIndexExact, this._dayGanIndexExact2 = a.dayGanIndexExact2, this._dayZhiIndexExact2 = a.dayZhiIndexExact2, this._monthGanIndex = a.monthGanIndex, this._monthZhiIndex = a.monthZhiIndex, this._monthGanIndexExact = a.monthGanIndexExact, this._monthZhiIndexExact = a.monthZhiIndexExact, this._yearGanIndex = a.yearGanIndex, this._yearZhiIndex = a.yearZhiIndex, this._yearGanIndexByLiChun = a.yearGanIndexByLiChun, this._yearZhiIndexByLiChun = a.yearZhiIndexByLiChun, this._yearGanIndexExact = a.yearGanIndexExact, this._yearZhiIndexExact = a.yearZhiIndexExact, this._weekIndex = a.weekIndex, this._jieQi = a.jieQi, this._jieQiList = a.jieQiList, this._solar = g;
187
159
  }
188
160
  getYear() {
189
161
  return this._year;
@@ -264,22 +236,22 @@ class _ {
264
236
  return this.getYearZhi();
265
237
  }
266
238
  getYearGan() {
267
- return e.GAN[this._yearGanIndex + 1];
239
+ return h.GAN[this._yearGanIndex + 1];
268
240
  }
269
241
  getYearGanByLiChun() {
270
- return e.GAN[this._yearGanIndexByLiChun + 1];
242
+ return h.GAN[this._yearGanIndexByLiChun + 1];
271
243
  }
272
244
  getYearGanExact() {
273
- return e.GAN[this._yearGanIndexExact + 1];
245
+ return h.GAN[this._yearGanIndexExact + 1];
274
246
  }
275
247
  getYearZhi() {
276
- return e.ZHI[this._yearZhiIndex + 1];
248
+ return h.ZHI[this._yearZhiIndex + 1];
277
249
  }
278
250
  getYearZhiByLiChun() {
279
- return e.ZHI[this._yearZhiIndexByLiChun + 1];
251
+ return h.ZHI[this._yearZhiIndexByLiChun + 1];
280
252
  }
281
253
  getYearZhiExact() {
282
- return e.ZHI[this._yearZhiIndexExact + 1];
254
+ return h.ZHI[this._yearZhiIndexExact + 1];
283
255
  }
284
256
  getYearInGanZhi() {
285
257
  return this.getYearGan() + this.getYearZhi();
@@ -291,16 +263,16 @@ class _ {
291
263
  return this.getYearGanExact() + this.getYearZhiExact();
292
264
  }
293
265
  getMonthGan() {
294
- return e.GAN[this._monthGanIndex + 1];
266
+ return h.GAN[this._monthGanIndex + 1];
295
267
  }
296
268
  getMonthGanExact() {
297
- return e.GAN[this._monthGanIndexExact + 1];
269
+ return h.GAN[this._monthGanIndexExact + 1];
298
270
  }
299
271
  getMonthZhi() {
300
- return e.ZHI[this._monthZhiIndex + 1];
272
+ return h.ZHI[this._monthZhiIndex + 1];
301
273
  }
302
274
  getMonthZhiExact() {
303
- return e.ZHI[this._monthZhiIndexExact + 1];
275
+ return h.ZHI[this._monthZhiIndexExact + 1];
304
276
  }
305
277
  getMonthInGanZhi() {
306
278
  return this.getMonthGan() + this.getMonthZhi();
@@ -309,22 +281,22 @@ class _ {
309
281
  return this.getMonthGanExact() + this.getMonthZhiExact();
310
282
  }
311
283
  getDayGan() {
312
- return e.GAN[this._dayGanIndex + 1];
284
+ return h.GAN[this._dayGanIndex + 1];
313
285
  }
314
286
  getDayGanExact() {
315
- return e.GAN[this._dayGanIndexExact + 1];
287
+ return h.GAN[this._dayGanIndexExact + 1];
316
288
  }
317
289
  getDayGanExact2() {
318
- return e.GAN[this._dayGanIndexExact2 + 1];
290
+ return h.GAN[this._dayGanIndexExact2 + 1];
319
291
  }
320
292
  getDayZhi() {
321
- return e.ZHI[this._dayZhiIndex + 1];
293
+ return h.ZHI[this._dayZhiIndex + 1];
322
294
  }
323
295
  getDayZhiExact() {
324
- return e.ZHI[this._dayZhiIndexExact + 1];
296
+ return h.ZHI[this._dayZhiIndexExact + 1];
325
297
  }
326
298
  getDayZhiExact2() {
327
- return e.ZHI[this._dayZhiIndexExact2 + 1];
299
+ return h.ZHI[this._dayZhiIndexExact2 + 1];
328
300
  }
329
301
  getDayInGanZhi() {
330
302
  return this.getDayGan() + this.getDayZhi();
@@ -336,10 +308,10 @@ class _ {
336
308
  return this.getDayGanExact2() + this.getDayZhiExact2();
337
309
  }
338
310
  getTimeGan() {
339
- return e.GAN[this._timeGanIndex + 1];
311
+ return h.GAN[this._timeGanIndex + 1];
340
312
  }
341
313
  getTimeZhi() {
342
- return e.ZHI[this._timeZhiIndex + 1];
314
+ return h.ZHI[this._timeZhiIndex + 1];
343
315
  }
344
316
  getTimeInGanZhi() {
345
317
  return this.getTimeGan() + this.getTimeZhi();
@@ -348,240 +320,41 @@ class _ {
348
320
  return this.getYearShengXiao();
349
321
  }
350
322
  getYearShengXiao() {
351
- return e.SHENGXIAO[this._yearZhiIndex + 1];
323
+ return h.SHENGXIAO[this._yearZhiIndex + 1];
352
324
  }
353
325
  getYearShengXiaoByLiChun() {
354
- return e.SHENGXIAO[this._yearZhiIndexByLiChun + 1];
326
+ return h.SHENGXIAO[this._yearZhiIndexByLiChun + 1];
355
327
  }
356
328
  getYearShengXiaoExact() {
357
- return e.SHENGXIAO[this._yearZhiIndexExact + 1];
329
+ return h.SHENGXIAO[this._yearZhiIndexExact + 1];
358
330
  }
359
331
  getMonthShengXiao() {
360
- return e.SHENGXIAO[this._monthZhiIndex + 1];
332
+ return h.SHENGXIAO[this._monthZhiIndex + 1];
361
333
  }
362
334
  getMonthShengXiaoExact() {
363
- return e.SHENGXIAO[this._monthZhiIndexExact + 1];
335
+ return h.SHENGXIAO[this._monthZhiIndexExact + 1];
364
336
  }
365
337
  getDayShengXiao() {
366
- return e.SHENGXIAO[this._dayZhiIndex + 1];
338
+ return h.SHENGXIAO[this._dayZhiIndex + 1];
367
339
  }
368
340
  getTimeShengXiao() {
369
- return e.SHENGXIAO[this._timeZhiIndex + 1];
341
+ return h.SHENGXIAO[this._timeZhiIndex + 1];
370
342
  }
371
343
  getYearInChinese() {
372
344
  const t = this._year + "";
373
- let n = "";
374
- const i = 48;
375
- for (let a = 0, r = t.length; a < r; a++) {
376
- const g = t.charCodeAt(a);
377
- n += e.NUMBER[g - i];
345
+ let e = "";
346
+ const n = 48;
347
+ for (let i = 0, r = t.length; i < r; i++) {
348
+ const s = t.charCodeAt(i);
349
+ e += h.NUMBER[s - n];
378
350
  }
379
- return n;
351
+ return e;
380
352
  }
381
353
  getMonthInChinese() {
382
- return (this._month < 0 ? "闰" : "") + e.MONTH[Math.abs(this._month)];
354
+ return (this._month < 0 ? "闰" : "") + h.MONTH[Math.abs(this._month)];
383
355
  }
384
356
  getDayInChinese() {
385
- return e.DAY[this._day];
386
- }
387
- getPengZuGan() {
388
- return e.PENGZU_GAN[this._dayGanIndex + 1];
389
- }
390
- getPengZuZhi() {
391
- return e.PENGZU_ZHI[this._dayZhiIndex + 1];
392
- }
393
- getPositionXi() {
394
- return this.getDayPositionXi();
395
- }
396
- getPositionXiDesc() {
397
- return this.getDayPositionXiDesc();
398
- }
399
- getPositionYangGui() {
400
- return this.getDayPositionYangGui();
401
- }
402
- getPositionYangGuiDesc() {
403
- return this.getDayPositionYangGuiDesc();
404
- }
405
- getPositionYinGui() {
406
- return this.getDayPositionYinGui();
407
- }
408
- getPositionYinGuiDesc() {
409
- return this.getDayPositionYinGuiDesc();
410
- }
411
- getPositionFu() {
412
- return this.getDayPositionFu();
413
- }
414
- getPositionFuDesc() {
415
- return this.getDayPositionFuDesc();
416
- }
417
- getPositionCai() {
418
- return this.getDayPositionCai();
419
- }
420
- getPositionCaiDesc() {
421
- return this.getDayPositionCaiDesc();
422
- }
423
- getDayPositionXi() {
424
- return e.POSITION_XI[this._dayGanIndex + 1];
425
- }
426
- getDayPositionXiDesc() {
427
- const t = e.POSITION_DESC[this.getDayPositionXi()];
428
- return t || "";
429
- }
430
- getDayPositionYangGui() {
431
- return e.POSITION_YANG_GUI[this._dayGanIndex + 1];
432
- }
433
- getDayPositionYangGuiDesc() {
434
- const t = e.POSITION_DESC[this.getDayPositionYangGui()];
435
- return t || "";
436
- }
437
- getDayPositionYinGui() {
438
- return e.POSITION_YIN_GUI[this._dayGanIndex + 1];
439
- }
440
- getDayPositionYinGuiDesc() {
441
- const t = e.POSITION_DESC[this.getDayPositionYinGui()];
442
- return t || "";
443
- }
444
- getDayPositionFu(t = 2) {
445
- return (t === 1 ? e.POSITION_FU : e.POSITION_FU_2)[this._dayGanIndex + 1];
446
- }
447
- getDayPositionFuDesc(t = 2) {
448
- const n = e.POSITION_DESC[this.getDayPositionFu(t)];
449
- return n || "";
450
- }
451
- getDayPositionCai() {
452
- return e.POSITION_CAI[this._dayGanIndex + 1];
453
- }
454
- getDayPositionCaiDesc() {
455
- const t = e.POSITION_DESC[this.getDayPositionCai()];
456
- return t || "";
457
- }
458
- getTimePositionXi() {
459
- return e.POSITION_XI[this._timeGanIndex + 1];
460
- }
461
- getTimePositionXiDesc() {
462
- const t = e.POSITION_DESC[this.getTimePositionXi()];
463
- return t || "";
464
- }
465
- getTimePositionYangGui() {
466
- return e.POSITION_YANG_GUI[this._timeGanIndex + 1];
467
- }
468
- getTimePositionYangGuiDesc() {
469
- const t = e.POSITION_DESC[this.getTimePositionYangGui()];
470
- return t || "";
471
- }
472
- getTimePositionYinGui() {
473
- return e.POSITION_YIN_GUI[this._timeGanIndex + 1];
474
- }
475
- getTimePositionYinGuiDesc() {
476
- const t = e.POSITION_DESC[this.getTimePositionYinGui()];
477
- return t || "";
478
- }
479
- getTimePositionFu(t = 2) {
480
- return (t === 1 ? e.POSITION_FU : e.POSITION_FU_2)[this._timeGanIndex + 1];
481
- }
482
- getTimePositionFuDesc(t = 2) {
483
- const n = e.POSITION_DESC[this.getTimePositionFu(t)];
484
- return n || "";
485
- }
486
- getTimePositionCai() {
487
- return e.POSITION_CAI[this._timeGanIndex + 1];
488
- }
489
- getTimePositionCaiDesc() {
490
- const t = e.POSITION_DESC[this.getTimePositionCai()];
491
- return t || "";
492
- }
493
- getYearPositionTaiSui(t = 2) {
494
- let n;
495
- switch (t) {
496
- case 1:
497
- n = this._yearZhiIndex;
498
- break;
499
- case 3:
500
- n = this._yearZhiIndexExact;
501
- break;
502
- default:
503
- n = this._yearZhiIndexByLiChun;
504
- }
505
- return e.POSITION_TAI_SUI_YEAR[n];
506
- }
507
- getYearPositionTaiSuiDesc(t = 2) {
508
- return e.POSITION_DESC[this.getYearPositionTaiSui(t)];
509
- }
510
- getMonthPositionTaiSui(t = 2) {
511
- let n, i;
512
- switch (t) {
513
- case 3:
514
- n = this._monthZhiIndexExact, i = this._monthGanIndexExact;
515
- break;
516
- default:
517
- n = this._monthZhiIndex, i = this._monthGanIndex;
518
- }
519
- let a = n - e.BASE_MONTH_ZHI_INDEX;
520
- return a < 0 && (a += 12), [
521
- s.getMessage("bg.gen"),
522
- e.POSITION_GAN[i],
523
- s.getMessage("bg.kun"),
524
- s.getMessage("bg.xun")
525
- ][a % 4];
526
- }
527
- getMonthPositionTaiSuiDesc(t = 2) {
528
- return e.POSITION_DESC[this.getMonthPositionTaiSui(t)];
529
- }
530
- getDayPositionTaiSui(t = 2) {
531
- let n, i;
532
- switch (t) {
533
- case 1:
534
- n = this.getDayInGanZhi(), i = this._yearZhiIndex;
535
- break;
536
- case 3:
537
- n = this.getDayInGanZhi(), i = this._yearZhiIndexExact;
538
- break;
539
- default:
540
- n = this.getDayInGanZhiExact2(), i = this._yearZhiIndexByLiChun;
541
- }
542
- let a;
543
- return [
544
- s.getMessage("jz.jiaZi"),
545
- s.getMessage("jz.yiChou"),
546
- s.getMessage("jz.bingYin"),
547
- s.getMessage("jz.dingMao"),
548
- s.getMessage("jz.wuChen"),
549
- s.getMessage("jz.jiSi")
550
- ].join(",").indexOf(n) > -1 ? a = s.getMessage("bg.zhen") : [
551
- s.getMessage("jz.bingZi"),
552
- s.getMessage("jz.dingChou"),
553
- s.getMessage("jz.wuYin"),
554
- s.getMessage("jz.jiMao"),
555
- s.getMessage("jz.gengChen"),
556
- s.getMessage("jz.xinSi")
557
- ].join(",").indexOf(n) > -1 ? a = s.getMessage("bg.li") : [
558
- s.getMessage("jz.wuZi"),
559
- s.getMessage("jz.jiChou"),
560
- s.getMessage("jz.gengYin"),
561
- s.getMessage("jz.xinMao"),
562
- s.getMessage("jz.renChen"),
563
- s.getMessage("jz.guiSi")
564
- ].join(",").indexOf(n) > -1 ? a = s.getMessage("ps.center") : [
565
- s.getMessage("jz.gengZi"),
566
- s.getMessage("jz.xinChou"),
567
- s.getMessage("jz.renYin"),
568
- s.getMessage("jz.guiMao"),
569
- s.getMessage("jz.jiaChen"),
570
- s.getMessage("jz.yiSi")
571
- ].join(",").indexOf(n) > -1 ? a = s.getMessage("bg.dui") : [
572
- s.getMessage("jz.renZi"),
573
- s.getMessage("jz.guiChou"),
574
- s.getMessage("jz.jiaYin"),
575
- s.getMessage("jz.yiMao"),
576
- s.getMessage("jz.bingChen"),
577
- s.getMessage("jz.dingSi")
578
- ].join(",").indexOf(n) > -1 ? a = s.getMessage("bg.kan") : a = e.POSITION_TAI_SUI_YEAR[i], a;
579
- }
580
- getDayPositionTaiSuiDesc(t = 2) {
581
- return e.POSITION_DESC[this.getDayPositionTaiSui(t)];
582
- }
583
- getChong() {
584
- return this.getDayChong();
357
+ return h.DAY[this._day];
585
358
  }
586
359
  getChongGan() {
587
360
  return this.getDayChongGan();
@@ -589,227 +362,75 @@ class _ {
589
362
  getChongGanTie() {
590
363
  return this.getDayChongGanTie();
591
364
  }
592
- getChongShengXiao() {
593
- return this.getDayChongShengXiao();
594
- }
595
- getChongDesc() {
596
- return this.getDayChongDesc();
597
- }
598
- getSha() {
599
- return this.getDaySha();
600
- }
601
- getDayChong() {
602
- return e.CHONG[this._dayZhiIndex];
603
- }
604
365
  getDayChongGan() {
605
- return e.CHONG_GAN[this._dayGanIndex];
366
+ return h.CHONG_GAN[this._dayGanIndex];
606
367
  }
607
368
  getDayChongGanTie() {
608
- return e.CHONG_GAN_TIE[this._dayGanIndex];
609
- }
610
- getDayChongShengXiao() {
611
- const t = this.getChong();
612
- for (let n = 0, i = e.ZHI.length; n < i; n++)
613
- if (e.ZHI[n] === t)
614
- return e.SHENGXIAO[n];
615
- return "";
616
- }
617
- getDayChongDesc() {
618
- return "(" + this.getDayChongGan() + this.getDayChong() + ")" + this.getDayChongShengXiao();
619
- }
620
- getDaySha() {
621
- const t = e.SHA[this.getDayZhi()];
622
- return t || "";
623
- }
624
- getTimeChong() {
625
- return e.CHONG[this._timeZhiIndex];
369
+ return h.CHONG_GAN_TIE[this._dayGanIndex];
626
370
  }
627
371
  getTimeChongGan() {
628
- return e.CHONG_GAN[this._timeGanIndex];
372
+ return h.CHONG_GAN[this._timeGanIndex];
629
373
  }
630
374
  getTimeChongGanTie() {
631
- return e.CHONG_GAN_TIE[this._timeGanIndex];
632
- }
633
- getTimeChongShengXiao() {
634
- const t = this.getTimeChong();
635
- for (let n = 0, i = e.ZHI.length; n < i; n++)
636
- if (e.ZHI[n] === t)
637
- return e.SHENGXIAO[n];
638
- return "";
639
- }
640
- getTimeChongDesc() {
641
- return "(" + this.getTimeChongGan() + this.getTimeChong() + ")" + this.getTimeChongShengXiao();
642
- }
643
- getTimeSha() {
644
- const t = e.SHA[this.getTimeZhi()];
645
- return t || "";
646
- }
647
- getYearNaYin() {
648
- const t = e.NAYIN[this.getYearInGanZhi()];
649
- return t || "";
650
- }
651
- getMonthNaYin() {
652
- const t = e.NAYIN[this.getMonthInGanZhi()];
653
- return t || "";
654
- }
655
- getDayNaYin() {
656
- const t = e.NAYIN[this.getDayInGanZhi()];
657
- return t || "";
658
- }
659
- getTimeNaYin() {
660
- const t = e.NAYIN[this.getTimeInGanZhi()];
661
- return t || "";
375
+ return h.CHONG_GAN_TIE[this._timeGanIndex];
662
376
  }
663
377
  getSeason() {
664
- return e.SEASON[Math.abs(this._month)];
378
+ return h.SEASON[Math.abs(this._month)];
665
379
  }
666
380
  static _convertJieQi(t) {
667
- let n = t;
668
- return n === "DONG_ZHI" ? n = s.getMessage("jq.dongZhi") : n === "DA_HAN" ? n = s.getMessage("jq.daHan") : n === "XIAO_HAN" ? n = s.getMessage("jq.xiaoHan") : n === "LI_CHUN" ? n = s.getMessage("jq.liChun") : n === "DA_XUE" ? n = s.getMessage("jq.daXue") : n === "YU_SHUI" ? n = s.getMessage("jq.yuShui") : n === "JING_ZHE" && (n = s.getMessage("jq.jingZhe")), n;
381
+ let e = t;
382
+ return e === "DONG_ZHI" ? e = _.getMessage("jq.dongZhi") : e === "DA_HAN" ? e = _.getMessage("jq.daHan") : e === "XIAO_HAN" ? e = _.getMessage("jq.xiaoHan") : e === "LI_CHUN" ? e = _.getMessage("jq.liChun") : e === "DA_XUE" ? e = _.getMessage("jq.daXue") : e === "YU_SHUI" ? e = _.getMessage("jq.yuShui") : e === "JING_ZHE" && (e = _.getMessage("jq.jingZhe")), e;
669
383
  }
670
384
  getJie() {
671
- for (let t = 0, n = e.JIE_QI_IN_USE.length; t < n; t += 2) {
672
- const i = e.JIE_QI_IN_USE[t], a = this.getJieQiSolar(i);
673
- if (a && a.getYear() === this._solar.getYear() && a.getMonth() === this._solar.getMonth() && a.getDay() === this._solar.getDay())
674
- return _._convertJieQi(i);
385
+ for (let t = 0, e = h.JIE_QI_IN_USE.length; t < e; t += 2) {
386
+ const n = h.JIE_QI_IN_USE[t], i = this.getJieQiSolar(n);
387
+ if (i && i.getYear() === this._solar.getYear() && i.getMonth() === this._solar.getMonth() && i.getDay() === this._solar.getDay())
388
+ return I._convertJieQi(n);
675
389
  }
676
390
  return "";
677
391
  }
678
392
  getQi() {
679
- for (let t = 1, n = e.JIE_QI_IN_USE.length; t < n; t += 2) {
680
- const i = e.JIE_QI_IN_USE[t], a = this.getJieQiSolar(i);
681
- if (a && a.getYear() === this._solar.getYear() && a.getMonth() === this._solar.getMonth() && a.getDay() === this._solar.getDay())
682
- return _._convertJieQi(i);
393
+ for (let t = 1, e = h.JIE_QI_IN_USE.length; t < e; t += 2) {
394
+ const n = h.JIE_QI_IN_USE[t], i = this.getJieQiSolar(n);
395
+ if (i && i.getYear() === this._solar.getYear() && i.getMonth() === this._solar.getMonth() && i.getDay() === this._solar.getDay())
396
+ return I._convertJieQi(n);
683
397
  }
684
398
  return "";
685
399
  }
686
400
  getJieQi() {
687
401
  let t = "";
688
- for (const n in this._jieQi) {
689
- const i = this._jieQi[n];
690
- if (i.getYear() == this._solar.getYear() && i.getMonth() == this._solar.getMonth() && i.getDay() == this._solar.getDay()) {
691
- t = n;
402
+ for (const e in this._jieQi) {
403
+ const n = this._jieQi[e];
404
+ if (n.getYear() == this._solar.getYear() && n.getMonth() == this._solar.getMonth() && n.getDay() == this._solar.getDay()) {
405
+ t = e;
692
406
  break;
693
407
  }
694
408
  }
695
- return _._convertJieQi(t);
409
+ return I._convertJieQi(t);
696
410
  }
697
411
  getWeek() {
698
412
  return this._weekIndex;
699
413
  }
700
414
  getWeekInChinese() {
701
- return S.WEEK[this.getWeek()];
702
- }
703
- getXiu() {
704
- const t = e.XIU[this.getDayZhi() + this.getWeek()];
705
- return t || "";
706
- }
707
- getXiuLuck() {
708
- const t = e.XIU_LUCK[this.getXiu()];
709
- return t || "";
710
- }
711
- getXiuSong() {
712
- const t = e.XIU_SONG[this.getXiu()];
713
- return t || "";
714
- }
715
- getZheng() {
716
- const t = e.ZHENG[this.getXiu()];
717
- return t || "";
718
- }
719
- getAnimal() {
720
- const t = e.ANIMAL[this.getXiu()];
721
- return t || "";
722
- }
723
- getGong() {
724
- const t = e.GONG[this.getXiu()];
725
- return t || "";
726
- }
727
- getShou() {
728
- const t = e.SHOU[this.getGong()];
729
- return t || "";
415
+ return Y.WEEK[this.getWeek()];
730
416
  }
731
417
  getFestivals() {
732
- const t = [], n = e.FESTIVAL[this._month + "-" + this._day];
733
- return n && t.push(n), Math.abs(this._month) == 12 && this._day >= 29 && this._year != this.next(1).getYear() && t.push(s.getMessage("jr.chuXi")), t;
418
+ const t = [], e = h.FESTIVAL[this._month + "-" + this._day];
419
+ return e && t.push(e), Math.abs(this._month) == 12 && this._day >= 29 && this._year != this.next(1).getYear() && t.push(_.getMessage("jr.chuXi")), t;
734
420
  }
735
421
  getOtherFestivals() {
736
- const t = [], n = e.OTHER_FESTIVAL[this._month + "-" + this._day];
737
- n && n.forEach((g) => {
738
- t.push(g);
422
+ const t = [], e = h.OTHER_FESTIVAL[this._month + "-" + this._day];
423
+ e && e.forEach((s) => {
424
+ t.push(s);
739
425
  });
740
- let i = this.getJieQiSolar(s.getMessage("jq.qingMing"));
741
- const a = this._solar.toYmd();
742
- a === i.next(-1).toYmd() && t.push("寒食节"), i = this.getJieQiSolar(s.getMessage("jq.liChun"));
743
- let r = 4 - i.getLunar().getDayGanIndex();
744
- return r < 0 && (r += 10), a === i.next(r + 40).toYmd() && t.push("春社"), i = this.getJieQiSolar(s.getMessage("jq.liQiu")), r = 4 - i.getLunar().getDayGanIndex(), r < 0 && (r += 10), a === i.next(r + 40).toYmd() && t.push("秋社"), t;
745
- }
746
- getZhiXing() {
747
- let t = this._dayZhiIndex - this._monthZhiIndex;
748
- return t < 0 && (t += 12), e.ZHI_XING[t + 1];
749
- }
750
- getDayTianShen() {
751
- const t = this.getMonthZhi(), n = e.ZHI_TIAN_SHEN_OFFSET[t];
752
- return n == null ? "" : e.TIAN_SHEN[(this._dayZhiIndex + n) % 12 + 1];
753
- }
754
- getTimeTianShen() {
755
- const t = this.getDayZhiExact(), n = e.ZHI_TIAN_SHEN_OFFSET[t];
756
- return n == null ? "" : e.TIAN_SHEN[(this._timeZhiIndex + n) % 12 + 1];
757
- }
758
- getDayTianShenType() {
759
- const t = e.TIAN_SHEN_TYPE[this.getDayTianShen()];
760
- return t || "";
761
- }
762
- getTimeTianShenType() {
763
- const t = e.TIAN_SHEN_TYPE[this.getTimeTianShen()];
764
- return t || "";
765
- }
766
- getDayTianShenLuck() {
767
- const t = e.TIAN_SHEN_TYPE_LUCK[this.getDayTianShenType()];
768
- return t || "";
769
- }
770
- getTimeTianShenLuck() {
771
- const t = e.TIAN_SHEN_TYPE_LUCK[this.getTimeTianShenType()];
772
- return t || "";
773
- }
774
- getDayPositionTai() {
775
- return e.POSITION_TAI_DAY[e.getJiaZiIndex(this.getDayInGanZhi())];
776
- }
777
- getMonthPositionTai() {
778
- const t = this._month;
779
- return t < 0 ? "" : e.POSITION_TAI_MONTH[t - 1];
780
- }
781
- getDayYi(t = 1) {
782
- return e.getDayYi(
783
- t == 2 ? this.getMonthInGanZhiExact() : this.getMonthInGanZhi(),
784
- this.getDayInGanZhi()
785
- );
786
- }
787
- getDayJi(t = 1) {
788
- return e.getDayJi(
789
- t == 2 ? this.getMonthInGanZhiExact() : this.getMonthInGanZhi(),
790
- this.getDayInGanZhi()
791
- );
792
- }
793
- getDayJiShen() {
794
- return e.getDayJiShen(this.getMonth(), this.getDayInGanZhi());
795
- }
796
- getDayXiongSha() {
797
- return e.getDayXiongSha(this.getMonth(), this.getDayInGanZhi());
798
- }
799
- getTimeYi() {
800
- return e.getTimeYi(
801
- this.getDayInGanZhiExact(),
802
- this.getTimeInGanZhi()
803
- );
804
- }
805
- getTimeJi() {
806
- return e.getTimeJi(
807
- this.getDayInGanZhiExact(),
808
- this.getTimeInGanZhi()
809
- );
426
+ let n = this.getJieQiSolar(_.getMessage("jq.qingMing"));
427
+ const i = this._solar.toYmd();
428
+ i === n.next(-1).toYmd() && t.push("寒食节"), n = this.getJieQiSolar(_.getMessage("jq.liChun"));
429
+ let r = 4 - n.getLunar().getDayGanIndex();
430
+ return r < 0 && (r += 10), i === n.next(r + 40).toYmd() && t.push("春社"), n = this.getJieQiSolar(_.getMessage("jq.liQiu")), r = 4 - n.getLunar().getDayGanIndex(), r < 0 && (r += 10), i === n.next(r + 40).toYmd() && t.push("秋社"), t;
810
431
  }
811
432
  getYueXiang() {
812
- return e.YUE_XIANG[this._day];
433
+ return h.YUE_XIANG[this._day];
813
434
  }
814
435
  getJieQiSolar(t) {
815
436
  return this._jieQi[t];
@@ -824,28 +445,28 @@ class _ {
824
445
  return this._jieQiList;
825
446
  }
826
447
  getNextJie(t = !1) {
827
- const n = [];
828
- for (let i = 0, a = e.JIE_QI_IN_USE.length / 2; i < a; i++)
829
- n.push(e.JIE_QI_IN_USE[i * 2]);
830
- return this.getNearJieQi(!0, n, t);
448
+ const e = [];
449
+ for (let n = 0, i = h.JIE_QI_IN_USE.length / 2; n < i; n++)
450
+ e.push(h.JIE_QI_IN_USE[n * 2]);
451
+ return this.getNearJieQi(!0, e, t);
831
452
  }
832
453
  getPrevJie(t = !1) {
833
- const n = [];
834
- for (let i = 0, a = e.JIE_QI_IN_USE.length / 2; i < a; i++)
835
- n.push(e.JIE_QI_IN_USE[i * 2]);
836
- return this.getNearJieQi(!1, n, t);
454
+ const e = [];
455
+ for (let n = 0, i = h.JIE_QI_IN_USE.length / 2; n < i; n++)
456
+ e.push(h.JIE_QI_IN_USE[n * 2]);
457
+ return this.getNearJieQi(!1, e, t);
837
458
  }
838
459
  getNextQi(t = !1) {
839
- const n = [];
840
- for (let i = 0, a = e.JIE_QI_IN_USE.length / 2; i < a; i++)
841
- n.push(e.JIE_QI_IN_USE[i * 2 + 1]);
842
- return this.getNearJieQi(!0, n, t);
460
+ const e = [];
461
+ for (let n = 0, i = h.JIE_QI_IN_USE.length / 2; n < i; n++)
462
+ e.push(h.JIE_QI_IN_USE[n * 2 + 1]);
463
+ return this.getNearJieQi(!0, e, t);
843
464
  }
844
465
  getPrevQi(t = !1) {
845
- const n = [];
846
- for (let i = 0, a = e.JIE_QI_IN_USE.length / 2; i < a; i++)
847
- n.push(e.JIE_QI_IN_USE[i * 2 + 1]);
848
- return this.getNearJieQi(!1, n, t);
466
+ const e = [];
467
+ for (let n = 0, i = h.JIE_QI_IN_USE.length / 2; n < i; n++)
468
+ e.push(h.JIE_QI_IN_USE[n * 2 + 1]);
469
+ return this.getNearJieQi(!1, e, t);
849
470
  }
850
471
  getNextJieQi(t = !1) {
851
472
  return this.getNearJieQi(!0, [], t);
@@ -853,158 +474,89 @@ class _ {
853
474
  getPrevJieQi(t = !1) {
854
475
  return this.getNearJieQi(!1, [], t);
855
476
  }
856
- getNearJieQi(t, n, i) {
857
- let a = "", r = null;
858
- const g = {};
859
- let I = !1;
860
- if (n)
861
- for (let h = 0, o = n.length; h < o; h++)
862
- g[n[h]] = !0, I = !0;
863
- const u = i ? this._solar.toYmd() : this._solar.toYmdHms();
864
- for (const h in this._jieQi) {
865
- const o = this._jieQi[h], d = _._convertJieQi(h);
866
- if (I && !g[d])
477
+ getNearJieQi(t, e, n) {
478
+ let i = "", r = null;
479
+ const s = {};
480
+ let g = !1;
481
+ if (e)
482
+ for (let a = 0, o = e.length; a < o; a++)
483
+ s[e[a]] = !0, g = !0;
484
+ const d = n ? this._solar.toYmd() : this._solar.toYmdHms();
485
+ for (const a in this._jieQi) {
486
+ const o = this._jieQi[a], x = I._convertJieQi(a);
487
+ if (g && !s[x])
867
488
  continue;
868
- const x = i ? o.toYmd() : o.toYmdHms();
489
+ const c = n ? o.toYmd() : o.toYmdHms();
869
490
  if (t) {
870
- if (x <= u)
491
+ if (c <= d)
871
492
  continue;
872
493
  if (r == null)
873
- a = d, r = o;
494
+ i = x, r = o;
874
495
  else {
875
- const y = i ? r.toYmd() : r.toYmdHms();
876
- x < y && (a = d, r = o);
496
+ const y = n ? r.toYmd() : r.toYmdHms();
497
+ c < y && (i = x, r = o);
877
498
  }
878
499
  } else {
879
- if (x > u)
500
+ if (c > d)
880
501
  continue;
881
502
  if (r == null)
882
- a = d, r = o;
503
+ i = x, r = o;
883
504
  else {
884
- const y = i ? r.toYmd() : r.toYmdHms();
885
- x > y && (a = d, r = o);
505
+ const y = n ? r.toYmd() : r.toYmdHms();
506
+ c > y && (i = x, r = o);
886
507
  }
887
508
  }
888
509
  }
889
- return new G(a, r);
510
+ return new E(i, r);
890
511
  }
891
512
  getCurrentJieQi() {
892
513
  let t = null;
893
- for (const n in this._jieQi) {
894
- const i = this._jieQi[n];
895
- if (i.getYear() == this._solar.getYear() && i.getMonth() == this._solar.getMonth() && i.getDay() == this._solar.getDay()) {
896
- t = new G(_._convertJieQi(n), i);
514
+ for (const e in this._jieQi) {
515
+ const n = this._jieQi[e];
516
+ if (n.getYear() == this._solar.getYear() && n.getMonth() == this._solar.getMonth() && n.getDay() == this._solar.getDay()) {
517
+ t = new E(I._convertJieQi(e), n);
897
518
  break;
898
519
  }
899
520
  }
900
521
  return t;
901
522
  }
902
523
  getCurrentJie() {
903
- for (let t = 0, n = e.JIE_QI_IN_USE.length; t < n; t += 2) {
904
- const i = e.JIE_QI_IN_USE[t], a = this.getJieQiSolar(i);
905
- if (a && a.getYear() === this._solar.getYear() && a.getMonth() === this._solar.getMonth() && a.getDay() === this._solar.getDay())
906
- return new G(_._convertJieQi(i), a);
524
+ for (let t = 0, e = h.JIE_QI_IN_USE.length; t < e; t += 2) {
525
+ const n = h.JIE_QI_IN_USE[t], i = this.getJieQiSolar(n);
526
+ if (i && i.getYear() === this._solar.getYear() && i.getMonth() === this._solar.getMonth() && i.getDay() === this._solar.getDay())
527
+ return new E(I._convertJieQi(n), i);
907
528
  }
908
529
  return null;
909
530
  }
910
531
  getCurrentQi() {
911
- for (let t = 1, n = e.JIE_QI_IN_USE.length; t < n; t += 2) {
912
- const i = e.JIE_QI_IN_USE[t], a = this.getJieQiSolar(i);
913
- if (a && a.getYear() === this._solar.getYear() && a.getMonth() === this._solar.getMonth() && a.getDay() === this._solar.getDay())
914
- return new G(_._convertJieQi(i), a);
532
+ for (let t = 1, e = h.JIE_QI_IN_USE.length; t < e; t += 2) {
533
+ const n = h.JIE_QI_IN_USE[t], i = this.getJieQiSolar(n);
534
+ if (i && i.getYear() === this._solar.getYear() && i.getMonth() === this._solar.getMonth() && i.getDay() === this._solar.getDay())
535
+ return new E(I._convertJieQi(n), i);
915
536
  }
916
537
  return null;
917
538
  }
918
539
  next(t) {
919
540
  return this._solar.next(t).getLunar();
920
541
  }
921
- getYearXun() {
922
- return e.getXun(this.getYearInGanZhi());
923
- }
924
- getMonthXun() {
925
- return e.getXun(this.getMonthInGanZhi());
926
- }
927
- getDayXun() {
928
- return e.getXun(this.getDayInGanZhi());
929
- }
930
- getTimeXun() {
931
- return e.getXun(this.getTimeInGanZhi());
932
- }
933
- getYearXunByLiChun() {
934
- return e.getXun(this.getYearInGanZhiByLiChun());
935
- }
936
- getYearXunExact() {
937
- return e.getXun(this.getYearInGanZhiExact());
938
- }
939
- getMonthXunExact() {
940
- return e.getXun(this.getMonthInGanZhiExact());
941
- }
942
- getDayXunExact() {
943
- return e.getXun(this.getDayInGanZhiExact());
944
- }
945
- getDayXunExact2() {
946
- return e.getXun(this.getDayInGanZhiExact2());
947
- }
948
- getYearXunKong() {
949
- return e.getXunKong(this.getYearInGanZhi());
950
- }
951
- getMonthXunKong() {
952
- return e.getXunKong(this.getMonthInGanZhi());
953
- }
954
- getDayXunKong() {
955
- return e.getXunKong(this.getDayInGanZhi());
956
- }
957
- getTimeXunKong() {
958
- return e.getXunKong(this.getTimeInGanZhi());
959
- }
960
- getYearXunKongByLiChun() {
961
- return e.getXunKong(this.getYearInGanZhiByLiChun());
962
- }
963
- getYearXunKongExact() {
964
- return e.getXunKong(this.getYearInGanZhiExact());
965
- }
966
- getMonthXunKongExact() {
967
- return e.getXunKong(this.getMonthInGanZhiExact());
968
- }
969
- getDayXunKongExact() {
970
- return e.getXunKong(this.getDayInGanZhiExact());
971
- }
972
- getDayXunKongExact2() {
973
- return e.getXunKong(this.getDayInGanZhiExact2());
974
- }
975
542
  toString() {
976
543
  return this.getYearInChinese() + "年" + this.getMonthInChinese() + "月" + this.getDayInChinese();
977
544
  }
978
545
  toFullString() {
979
- let t = this.toString();
980
- t += " " + this.getYearInGanZhi() + "(" + this.getYearShengXiao() + ")年", t += " " + this.getMonthInGanZhi() + "(" + this.getMonthShengXiao() + ")月", t += " " + this.getDayInGanZhi() + "(" + this.getDayShengXiao() + ")日", t += " " + this.getTimeZhi() + "(" + this.getTimeShengXiao() + ")时", t += " 纳音[" + this.getYearNaYin() + " " + this.getMonthNaYin() + " " + this.getDayNaYin() + " " + this.getTimeNaYin() + "]", t += " 星期" + this.getWeekInChinese(), this.getFestivals().forEach((i) => {
981
- t += " (" + i + ")";
982
- }), this.getOtherFestivals().forEach((i) => {
983
- t += " (" + i + ")";
984
- });
985
- const n = this.getJieQi();
986
- return n.length > 0 && (t += " [" + n + "]"), t += " " + this.getGong() + "方" + this.getShou(), t += " 星宿[" + this.getXiu() + this.getZheng() + this.getAnimal() + "](" + this.getXiuLuck() + ")", t += " 彭祖百忌[" + this.getPengZuGan() + " " + this.getPengZuZhi() + "]", t += " 喜神方位[" + this.getDayPositionXi() + "](" + this.getDayPositionXiDesc() + ")", t += " 阳贵神方位[" + this.getDayPositionYangGui() + "](" + this.getDayPositionYangGuiDesc() + ")", t += " 阴贵神方位[" + this.getDayPositionYinGui() + "](" + this.getDayPositionYinGuiDesc() + ")", t += " 福神方位[" + this.getDayPositionFu() + "](" + this.getDayPositionFuDesc() + ")", t += " 财神方位[" + this.getDayPositionCai() + "](" + this.getDayPositionCaiDesc() + ")", t += " 冲[" + this.getDayChongDesc() + "]", t += " 煞[" + this.getDaySha() + "]", t;
987
- }
988
- getLiuYao() {
989
- return e.LIU_YAO[(Math.abs(this._month) + this._day - 2) % 6];
990
- }
991
- getWuHou() {
992
- const t = this.getPrevJieQi(!0), n = e.find(t.getName(), e.JIE_QI);
993
- let i = Math.floor(this._solar.subtract(t.getSolar()) / 5);
994
- return i > 2 && (i = 2), e.WU_HOU[(n.index * 3 + i) % e.WU_HOU.length];
995
- }
996
- getHou() {
997
- const t = this.getPrevJieQi(!0), n = this._solar.subtract(t.getSolar()), i = e.HOU.length - 1;
998
- let a = Math.floor(n / 5);
999
- return a > i && (a = i), t.getName() + " " + e.HOU[a];
1000
- }
1001
- getDayLu() {
1002
- const t = e.LU[this.getDayGan()], n = e.LU[this.getDayZhi()];
1003
- let i = t + "命互禄";
1004
- return n && (i += " " + n + "命进禄"), i;
546
+ const t = [
547
+ this.toString(),
548
+ `${this.getYearInGanZhi()}(${this.getYearShengXiao()})年`,
549
+ `${this.getMonthInGanZhi()}(${this.getMonthShengXiao()})月`,
550
+ `${this.getDayInGanZhi()}(${this.getDayShengXiao()})日`,
551
+ `${this.getTimeZhi()}(${this.getTimeShengXiao()})时`,
552
+ "星期" + this.getWeekInChinese(),
553
+ ...this.getFestivals().map((n) => `(${n})`),
554
+ ...this.getOtherFestivals().map((n) => `(${n})`)
555
+ ], e = this.getJieQi();
556
+ return e.length > 0 && t.push(`[${e}]`), t.join(" ");
1005
557
  }
1006
558
  getTime() {
1007
- return E.fromYmdHms(
559
+ return l.fromYmdHms(
1008
560
  this._year,
1009
561
  this._month,
1010
562
  this._day,
@@ -1015,14 +567,14 @@ class _ {
1015
567
  }
1016
568
  getTimes() {
1017
569
  const t = [];
1018
- t.push(E.fromYmdHms(this._year, this._month, this._day, 0, 0, 0));
1019
- for (let n = 0; n < 12; n++)
570
+ t.push(l.fromYmdHms(this._year, this._month, this._day, 0, 0, 0));
571
+ for (let e = 0; e < 12; e++)
1020
572
  t.push(
1021
- E.fromYmdHms(
573
+ l.fromYmdHms(
1022
574
  this._year,
1023
575
  this._month,
1024
576
  this._day,
1025
- (n + 1) * 2 - 1,
577
+ (e + 1) * 2 - 1,
1026
578
  0,
1027
579
  0
1028
580
  )
@@ -1031,5 +583,5 @@ class _ {
1031
583
  }
1032
584
  }
1033
585
  export {
1034
- _ as Lunar
586
+ I as Lunar
1035
587
  };