kinwuzhao 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,692 @@
1
+ 'use strict';
2
+
3
+ var tyme4ts = require('tyme4ts');
4
+
5
+ // src/ganzhi.ts
6
+
7
+ // src/constants.ts
8
+ var TIAN_GAN = ["\u7532", "\u4E59", "\u4E19", "\u4E01", "\u620A", "\u5DF1", "\u5E9A", "\u8F9B", "\u58EC", "\u7678"];
9
+ var DI_ZHI = [
10
+ "\u5B50",
11
+ "\u4E11",
12
+ "\u5BC5",
13
+ "\u536F",
14
+ "\u8FB0",
15
+ "\u5DF3",
16
+ "\u5348",
17
+ "\u672A",
18
+ "\u7533",
19
+ "\u9149",
20
+ "\u620C",
21
+ "\u4EA5"
22
+ ];
23
+ var NUM_TO_ELEMENT = {
24
+ 1: "\u6C34",
25
+ 2: "\u706B",
26
+ 3: "\u6728",
27
+ 4: "\u91D1",
28
+ 5: "\u571F"
29
+ };
30
+ var WU_XING = ["\u6728", "\u706B", "\u571F", "\u91D1", "\u6C34"];
31
+ var BA_GUA = ["\u826E", "\u9707", "\u5DFD", "\u96E2", "\u5764", "\u514C", "\u4E7E", "\u574E"];
32
+ var WANG_XIANG = ["\u738B", "\u76F8", "\u80CE", "\u6C92", "\u6B7B", "\u56DA", "\u5EE2", "\u4F11"];
33
+ var SIX_BEASTS = ["\u9752\u9F8D", "\u6731\u96C0", "\u87A3\u86C7", "\u52FE\u9673", "\u767D\u864E", "\u7384\u6B66"];
34
+ var SIX_BEAST_WEAKNESS = {
35
+ \u9752\u9F8D: ["\u5764", "\u514C"],
36
+ \u6731\u96C0: ["\u574E", "\u5DFD"],
37
+ \u87A3\u86C7: ["\u574E", "\u5DFD"],
38
+ \u52FE\u9673: ["\u5DFD", "\u5DFD"],
39
+ \u767D\u864E: ["\u574E", "\u96E2"],
40
+ \u7384\u6B66: ["\u5DFD", "\u9707"]
41
+ };
42
+ var DAY_GAN_TO_BEAST = {
43
+ \u7532: "\u9752\u9F8D",
44
+ \u4E59: "\u9752\u9F8D",
45
+ \u4E19: "\u6731\u96C0",
46
+ \u4E01: "\u6731\u96C0",
47
+ \u620A: "\u52FE\u9673",
48
+ \u5DF1: "\u52FE\u9673",
49
+ \u5E9A: "\u767D\u864E",
50
+ \u8F9B: "\u767D\u864E",
51
+ \u58EC: "\u7384\u6B66",
52
+ \u7678: "\u7384\u6B66"
53
+ };
54
+ var TWENTY_FOUR_SOLAR_TERMS = [
55
+ "\u7ACB\u6625",
56
+ "\u96E8\u6C34",
57
+ "\u9A5A\u87C4",
58
+ "\u6625\u5206",
59
+ "\u6E05\u660E",
60
+ "\u7A40\u96E8",
61
+ "\u7ACB\u590F",
62
+ "\u5C0F\u6EFF",
63
+ "\u8292\u7A2E",
64
+ "\u590F\u81F3",
65
+ "\u5C0F\u6691",
66
+ "\u5927\u6691",
67
+ "\u7ACB\u79CB",
68
+ "\u8655\u6691",
69
+ "\u767D\u9732",
70
+ "\u79CB\u5206",
71
+ "\u5BD2\u9732",
72
+ "\u971C\u964D",
73
+ "\u7ACB\u51AC",
74
+ "\u5C0F\u96EA",
75
+ "\u5927\u96EA",
76
+ "\u51AC\u81F3",
77
+ "\u5C0F\u5BD2",
78
+ "\u5927\u5BD2"
79
+ ];
80
+ var JIEQI_GROUPS = [
81
+ ["\u7ACB\u6625", "\u96E8\u6C34", "\u9A5A\u87C4"],
82
+ ["\u6625\u5206", "\u6E05\u660E", "\u7A40\u96E8"],
83
+ ["\u7ACB\u590F", "\u5C0F\u6EFF", "\u8292\u7A2E"],
84
+ ["\u590F\u81F3", "\u5C0F\u6691", "\u5927\u6691"],
85
+ ["\u7ACB\u79CB", "\u8655\u6691", "\u767D\u9732"],
86
+ ["\u79CB\u5206", "\u5BD2\u9732", "\u971C\u964D"],
87
+ ["\u7ACB\u51AC", "\u5C0F\u96EA", "\u5927\u96EA"],
88
+ ["\u51AC\u81F3", "\u5C0F\u5BD2", "\u5927\u5BD2"]
89
+ ];
90
+ var ZHI_TO_GUA = {
91
+ \u5B50: "\u574E",
92
+ \u5BC5: "\u9707",
93
+ \u536F: "\u9707",
94
+ \u8FB0: "\u5DFD",
95
+ \u5DF3: "\u5DFD",
96
+ \u5348: "\u96E2",
97
+ \u7533: "\u514C",
98
+ \u9149: "\u514C",
99
+ \u620C: "\u4E7E",
100
+ \u4EA5: "\u4E7E",
101
+ \u4E11: "\u4E2D",
102
+ \u672A: "\u4E2D"
103
+ };
104
+ var GENERAL_MAP = {
105
+ \u5B50: "\u5B50",
106
+ \u4E11: "\u9149",
107
+ \u5BC5: "\u5348",
108
+ \u536F: "\u536F",
109
+ \u8FB0: "\u5B50",
110
+ \u5DF3: "\u9149",
111
+ \u5348: "\u5348",
112
+ \u672A: "\u536F",
113
+ \u7533: "\u5B50",
114
+ \u9149: "\u9149",
115
+ \u620C: "\u5348",
116
+ \u4EA5: "\u536F"
117
+ };
118
+ var YIN_YANG = {
119
+ \u7532: "\u967D",
120
+ \u4E19: "\u967D",
121
+ \u620A: "\u967D",
122
+ \u5E9A: "\u967D",
123
+ \u58EC: "\u967D",
124
+ \u4E59: "\u9670",
125
+ \u4E01: "\u9670",
126
+ \u5DF1: "\u9670",
127
+ \u8F9B: "\u9670",
128
+ \u7678: "\u9670"
129
+ };
130
+ var GU_XU_CONFIG = [
131
+ { \u967D: { \u5B64: "\u620C", \u865B: "\u8FB0" }, \u9670: { \u5B64: "\u4EA5", \u865B: "\u5DF3" } },
132
+ { \u967D: { \u5B64: "\u7533", \u865B: "\u5BC5" }, \u9670: { \u5B64: "\u9149", \u865B: "\u536F" } },
133
+ { \u967D: { \u5B64: "\u5348", \u865B: "\u5B50" }, \u9670: { \u5B64: "\u672A", \u865B: "\u4E11" } },
134
+ { \u967D: { \u5B64: "\u8FB0", \u865B: "\u620C" }, \u9670: { \u5B64: "\u5DF3", \u865B: "\u4EA5" } },
135
+ { \u967D: { \u5B64: "\u5BC5", \u865B: "\u7533" }, \u9670: { \u5B64: "\u536F", \u865B: "\u9149" } },
136
+ { \u967D: { \u5B64: "\u5B50", \u865B: "\u5348" }, \u9670: { \u5B64: "\u4E11", \u865B: "\u672A" } }
137
+ ];
138
+ var WU_XING_RELATION = {
139
+ \u6728\u6728: "\u6BD4\u548C",
140
+ \u6728\u706B: "\u6211\u751F",
141
+ \u6728\u571F: "\u6211\u5C05",
142
+ \u6728\u91D1: "\u5C05\u6211",
143
+ \u6728\u6C34: "\u751F\u6211",
144
+ \u706B\u6728: "\u751F\u6211",
145
+ \u706B\u706B: "\u6BD4\u548C",
146
+ \u706B\u571F: "\u6211\u751F",
147
+ \u706B\u91D1: "\u6211\u5C05",
148
+ \u706B\u6C34: "\u5C05\u6211",
149
+ \u571F\u6728: "\u5C05\u6211",
150
+ \u571F\u706B: "\u751F\u6211",
151
+ \u571F\u571F: "\u6BD4\u548C",
152
+ \u571F\u91D1: "\u6211\u751F",
153
+ \u571F\u6C34: "\u6211\u5C05",
154
+ \u91D1\u6728: "\u6211\u5C05",
155
+ \u91D1\u706B: "\u5C05\u6211",
156
+ \u91D1\u571F: "\u751F\u6211",
157
+ \u91D1\u91D1: "\u6BD4\u548C",
158
+ \u91D1\u6C34: "\u6211\u751F",
159
+ \u6C34\u6728: "\u6211\u751F",
160
+ \u6C34\u706B: "\u5C05\u6211",
161
+ \u6C34\u571F: "\u5C05\u6211",
162
+ \u6C34\u91D1: "\u751F\u6211",
163
+ \u6C34\u6C34: "\u6BD4\u548C"
164
+ };
165
+ var LIU_QIN_MAP = {
166
+ \u5C05\u6211: "\u5B98\u9B3C",
167
+ \u6211\u5C05: "\u59BB\u8CA1",
168
+ \u6BD4\u548C: "\u5144\u5F1F",
169
+ \u751F\u6211: "\u7236\u6BCD",
170
+ \u6211\u751F: "\u5B50\u5B6B"
171
+ };
172
+ var GONG_WEI = ["\u5DFD\u5BAE", "\u9707\u5BAE", "\u96E2\u5BAE", "\u4E2D\u5BAE", "\u514C\u5BAE", "\u574E\u5BAE"];
173
+ var GONG_WEI_LABELS = ["\u5146", "\u6728\u9109", "\u706B\u9109", "\u571F\u9109", "\u91D1\u9109", "\u6C34\u9109"];
174
+
175
+ // src/utils.ts
176
+ function generateJiaZi() {
177
+ const result = [];
178
+ for (let i = 0; i < 60; i++) {
179
+ result.push(TIAN_GAN[i % 10] + DI_ZHI[i % 12]);
180
+ }
181
+ return result;
182
+ }
183
+ var JIAZI = generateJiaZi();
184
+ function rotateArray(arr, shift) {
185
+ const normalizedShift = shift % arr.length;
186
+ return [...arr.slice(normalizedShift), ...arr.slice(0, normalizedShift)];
187
+ }
188
+ function newList(list, element) {
189
+ const index = list.indexOf(element);
190
+ if (index === -1) return list;
191
+ return rotateArray(list, index);
192
+ }
193
+ function multiKeyDictGet(dict, key) {
194
+ if (dict instanceof Map) {
195
+ for (const [keys, value] of dict.entries()) {
196
+ if (keys.includes(key)) {
197
+ return value;
198
+ }
199
+ }
200
+ } else {
201
+ for (const [keysStr, value] of Object.entries(dict)) {
202
+ const keys = keysStr.split(",");
203
+ if (keys.includes(String(key))) {
204
+ return value;
205
+ }
206
+ }
207
+ }
208
+ return void 0;
209
+ }
210
+ function randomSplit(total) {
211
+ if (total <= 1) return 1;
212
+ return Math.floor(Math.random() * (total - 1)) + 1;
213
+ }
214
+ function getLiuJiaXun() {
215
+ const xunMap = /* @__PURE__ */ new Map();
216
+ for (let i = 0; i < 6; i++) {
217
+ const startGanZhi = JIAZI[i * 10];
218
+ const xun = JIAZI.slice(i * 10, i * 10 + 10);
219
+ xunMap.set(xun, startGanZhi);
220
+ }
221
+ return xunMap;
222
+ }
223
+ function findLunarHour(dayGanZhi) {
224
+ const fiveRats = {
225
+ \u7532: "\u7532\u5B50",
226
+ \u5DF1: "\u7532\u5B50",
227
+ \u4E59: "\u4E19\u5B50",
228
+ \u5E9A: "\u4E19\u5B50",
229
+ \u4E19: "\u620A\u5B50",
230
+ \u8F9B: "\u620A\u5B50",
231
+ \u4E01: "\u5E9A\u5B50",
232
+ \u58EC: "\u5E9A\u5B50",
233
+ \u620A: "\u58EC\u5B50",
234
+ \u7678: "\u58EC\u5B50"
235
+ };
236
+ const dayGan = dayGanZhi[0];
237
+ const startGanZhi = fiveRats[dayGan];
238
+ if (!startGanZhi) return {};
239
+ const hourList = newList(JIAZI, startGanZhi).slice(0, 12);
240
+ const result = {};
241
+ DI_ZHI.forEach((zhi, index) => {
242
+ result[zhi] = hourList[index];
243
+ });
244
+ return result;
245
+ }
246
+ function findLunarMonth(yearGanZhi) {
247
+ const fiveTigers = {
248
+ \u7532: "\u4E19\u5BC5",
249
+ \u5DF1: "\u4E19\u5BC5",
250
+ \u4E59: "\u620A\u5BC5",
251
+ \u5E9A: "\u620A\u5BC5",
252
+ \u4E19: "\u5E9A\u5BC5",
253
+ \u8F9B: "\u5E9A\u5BC5",
254
+ \u4E01: "\u58EC\u5BC5",
255
+ \u58EC: "\u58EC\u5BC5",
256
+ \u620A: "\u7532\u5BC5",
257
+ \u7678: "\u7532\u5BC5"
258
+ };
259
+ const yearGan = yearGanZhi[0];
260
+ const startGanZhi = fiveTigers[yearGan];
261
+ if (!startGanZhi) return {};
262
+ const monthList = newList(JIAZI, startGanZhi).slice(0, 12);
263
+ const result = {};
264
+ for (let i = 0; i < 12; i++) {
265
+ result[i + 1] = monthList[i];
266
+ }
267
+ return result;
268
+ }
269
+ function findLunarKe(hourGanZhi) {
270
+ const fiveHorses = {
271
+ \u4E19: "\u7532\u5348",
272
+ \u8F9B: "\u7532\u5348",
273
+ \u4E01: "\u4E19\u5348",
274
+ \u58EC: "\u4E19\u5348",
275
+ \u620A: "\u620A\u5348",
276
+ \u7678: "\u620A\u5348",
277
+ \u7532: "\u5E9A\u5348",
278
+ \u5DF1: "\u5E9A\u5348",
279
+ \u4E59: "\u58EC\u5348",
280
+ \u5E9A: "\u58EC\u5348"
281
+ };
282
+ const hourGan = hourGanZhi[0];
283
+ const startGanZhi = fiveHorses[hourGan];
284
+ if (!startGanZhi) return JIAZI;
285
+ return newList(JIAZI, startGanZhi);
286
+ }
287
+ function getWuXing(ganOrZhi) {
288
+ const wuXingMap = {
289
+ \u7532: "\u6728",
290
+ \u4E59: "\u6728",
291
+ \u5BC5: "\u6728",
292
+ \u536F: "\u6728",
293
+ \u9707: "\u6728",
294
+ \u5DFD: "\u6728",
295
+ \u4E19: "\u706B",
296
+ \u4E01: "\u706B",
297
+ \u5DF3: "\u706B",
298
+ \u5348: "\u706B",
299
+ \u96E2: "\u706B",
300
+ \u58EC: "\u6C34",
301
+ \u7678: "\u6C34",
302
+ \u4EA5: "\u6C34",
303
+ \u5B50: "\u6C34",
304
+ \u574E: "\u6C34",
305
+ \u5E9A: "\u91D1",
306
+ \u8F9B: "\u91D1",
307
+ \u7533: "\u91D1",
308
+ \u9149: "\u91D1",
309
+ \u4E7E: "\u91D1",
310
+ \u514C: "\u91D1",
311
+ \u672A: "\u571F",
312
+ \u4E11: "\u571F",
313
+ \u620A: "\u571F",
314
+ \u5DF1: "\u571F",
315
+ \u8FB0: "\u571F",
316
+ \u620C: "\u571F",
317
+ \u826E: "\u571F",
318
+ \u5764: "\u571F"
319
+ };
320
+ return wuXingMap[ganOrZhi] || "";
321
+ }
322
+ var BiDict = class {
323
+ forward = /* @__PURE__ */ new Map();
324
+ backward = /* @__PURE__ */ new Map();
325
+ set(key, value) {
326
+ this.forward.set(key, value);
327
+ this.backward.set(value, key);
328
+ }
329
+ get(key) {
330
+ return this.forward.get(key);
331
+ }
332
+ getInverse(value) {
333
+ return this.backward.get(value);
334
+ }
335
+ get inverse() {
336
+ return {
337
+ get: (value) => this.getInverse(value)
338
+ };
339
+ }
340
+ };
341
+
342
+ // src/ganzhi.ts
343
+ function ganZhi(year, month, day, hour, minute) {
344
+ let adjustedYear = year;
345
+ let adjustedMonth = month;
346
+ let adjustedDay = day;
347
+ let adjustedHour = hour;
348
+ if (hour === 23) {
349
+ const nextDay = new Date(year, month - 1, day + 1);
350
+ adjustedYear = nextDay.getFullYear();
351
+ adjustedMonth = nextDay.getMonth() + 1;
352
+ adjustedDay = nextDay.getDate();
353
+ adjustedHour = 0;
354
+ }
355
+ const solarTime = tyme4ts.SolarTime.fromYmdHms(adjustedYear, adjustedMonth, adjustedDay, adjustedHour, minute, 0);
356
+ const lunarHour = solarTime.getLunarHour();
357
+ const eightChar = lunarHour.getEightChar();
358
+ const yearGanZhi = eightChar.getYear().getName();
359
+ const monthGanZhi = eightChar.getMonth().getName();
360
+ const dayGanZhi = eightChar.getDay().getName();
361
+ const hourGanZhi = eightChar.getHour().getName();
362
+ const ziSolarTime = tyme4ts.SolarTime.fromYmdHms(adjustedYear, adjustedMonth, adjustedDay, 0, 0, 0);
363
+ const ziLunarHour = ziSolarTime.getLunarHour();
364
+ const ziEightChar = ziLunarHour.getEightChar();
365
+ const ziGanZhi = ziEightChar.getHour().getName();
366
+ const minuteGanZhi = getMinuteGanZhi(ziGanZhi, adjustedHour, minute);
367
+ return {
368
+ year: yearGanZhi,
369
+ month: monthGanZhi,
370
+ day: dayGanZhi,
371
+ hour: hourGanZhi,
372
+ minute: minuteGanZhi
373
+ };
374
+ }
375
+ function getMinuteGanZhi(ziGanZhi, hour, minute) {
376
+ const keList = findLunarKe(ziGanZhi);
377
+ const roundedMinute = Math.floor(minute / 10) * 10;
378
+ const keIndex = (hour * 6 + Math.floor(roundedMinute / 10)) % 60;
379
+ return keList[keIndex];
380
+ }
381
+ function getHourZhi(hour) {
382
+ const zhiMap = [
383
+ "\u5B50",
384
+ "\u4E11",
385
+ "\u4E11",
386
+ "\u5BC5",
387
+ "\u5BC5",
388
+ "\u536F",
389
+ "\u536F",
390
+ "\u8FB0",
391
+ "\u8FB0",
392
+ "\u5DF3",
393
+ "\u5DF3",
394
+ "\u5348",
395
+ "\u5348",
396
+ "\u672A",
397
+ "\u672A",
398
+ "\u7533",
399
+ "\u7533",
400
+ "\u9149",
401
+ "\u9149",
402
+ "\u620C",
403
+ "\u620C",
404
+ "\u4EA5",
405
+ "\u4EA5",
406
+ "\u5B50"
407
+ ];
408
+ return zhiMap[hour] || "\u5B50";
409
+ }
410
+ function findCurrentJieQi(year, month, day, hour, minute) {
411
+ const solarTime = tyme4ts.SolarTime.fromYmdHms(year, month, day, hour, minute, 0);
412
+ const term = solarTime.getTerm();
413
+ return term.getName();
414
+ }
415
+ function findSeason(jieqi) {
416
+ const seasons = {
417
+ \u7ACB\u6625: "\u6625",
418
+ \u96E8\u6C34: "\u6625",
419
+ \u9A5A\u87C4: "\u6625",
420
+ \u6625\u5206: "\u6625",
421
+ \u6E05\u660E: "\u6625",
422
+ \u7A40\u96E8: "\u6625",
423
+ \u7ACB\u590F: "\u590F",
424
+ \u5C0F\u6EFF: "\u590F",
425
+ \u8292\u7A2E: "\u590F",
426
+ \u590F\u81F3: "\u590F",
427
+ \u5C0F\u6691: "\u590F",
428
+ \u5927\u6691: "\u590F",
429
+ \u7ACB\u79CB: "\u79CB",
430
+ \u8655\u6691: "\u79CB",
431
+ \u767D\u9732: "\u79CB",
432
+ \u79CB\u5206: "\u79CB",
433
+ \u5BD2\u9732: "\u79CB",
434
+ \u971C\u964D: "\u79CB",
435
+ \u7ACB\u51AC: "\u51AC",
436
+ \u5C0F\u96EA: "\u51AC",
437
+ \u5927\u96EA: "\u51AC",
438
+ \u51AC\u81F3: "\u51AC",
439
+ \u5C0F\u5BD2: "\u51AC",
440
+ \u5927\u5BD2: "\u51AC"
441
+ };
442
+ return seasons[jieqi] || "";
443
+ }
444
+
445
+ // src/kinwuzhao.ts
446
+ function buildJieQiWangXiang() {
447
+ const result = {};
448
+ JIEQI_GROUPS.forEach((group, index) => {
449
+ const rotated = rotateArray(BA_GUA, index);
450
+ const mapping = {};
451
+ rotated.forEach((gua, i) => {
452
+ mapping[gua] = WANG_XIANG[i];
453
+ });
454
+ group.forEach((jieqi) => {
455
+ result[jieqi] = mapping;
456
+ });
457
+ });
458
+ return result;
459
+ }
460
+ var JIEQI_WANG_XIANG = buildJieQiWangXiang();
461
+ var SOLAR_TERMS_BY_SEASON = [
462
+ { terms: ["\u7ACB\u6625", "\u96E8\u6C34", "\u9A5A\u87C4", "\u6625\u5206", "\u6E05\u660E", "\u7A40\u96E8"], guan: "\u4E11", yue: "\u5DF3" },
463
+ { terms: ["\u7ACB\u590F", "\u5C0F\u6EFF", "\u8292\u7A2E", "\u590F\u81F3", "\u5C0F\u6691", "\u5927\u6691"], guan: "\u8FB0", yue: "\u7533" },
464
+ { terms: ["\u7ACB\u79CB", "\u8655\u6691", "\u767D\u9732", "\u79CB\u5206", "\u5BD2\u9732", "\u971C\u964D"], guan: "\u672A", yue: "\u4EA5" },
465
+ { terms: ["\u7ACB\u51AC", "\u5C0F\u96EA", "\u5927\u96EA", "\u51AC\u81F3", "\u5C0F\u5BD2", "\u5927\u5BD2"], guan: "\u620C", yue: "\u5BC5" }
466
+ ];
467
+ function getGuanYue(jieqi) {
468
+ for (const season of SOLAR_TERMS_BY_SEASON) {
469
+ if (season.terms.includes(jieqi)) {
470
+ return { \u95DC: season.guan, \u7C65: season.yue };
471
+ }
472
+ }
473
+ return null;
474
+ }
475
+ function fiveZhaoPaiPan(num, jq, cm, gz1, gz2, liurenData) {
476
+ const dayGan = gz1[0];
477
+ if (!(dayGan in DAY_GAN_TO_BEAST)) {
478
+ return { \u932F\u8AA4: "\u65E5\u5E72\u4E0D\u6B63\u78BA\uFF0C\u8ACB\u8F38\u5165\uFF1A\u7532\u4E59\u4E19\u4E01\u620A\u5DF1\u5E9A\u8F9B\u58EC\u7678" };
479
+ }
480
+ const base = 36;
481
+ const result = {};
482
+ const beastStart = DAY_GAN_TO_BEAST[dayGan];
483
+ const startIndex = SIX_BEASTS.indexOf(beastStart);
484
+ const beastSeq = Array.from({ length: 6 }, (_, i) => SIX_BEASTS[(startIndex + i) % 6]);
485
+ const sky2earth = new BiDict();
486
+ if (liurenData) {
487
+ Object.entries(liurenData).forEach(([key2, value]) => {
488
+ sky2earth.set(key2, value);
489
+ });
490
+ }
491
+ const guanYue = getGuanYue(jq);
492
+ let lock = "";
493
+ let key = "";
494
+ let general = "";
495
+ if (guanYue && liurenData) {
496
+ const guanZhi = sky2earth.getInverse(guanYue.\u95DC) || guanYue.\u95DC;
497
+ const yueZhi = sky2earth.getInverse(guanYue.\u7C65) || guanYue.\u7C65;
498
+ lock = ZHI_TO_GUA[guanZhi] || "";
499
+ key = ZHI_TO_GUA[yueZhi] || "";
500
+ const generalZhi = GENERAL_MAP[gz2[1]] || gz2[1];
501
+ const generalMapped = sky2earth.getInverse(generalZhi) || generalZhi;
502
+ general = ZHI_TO_GUA[generalMapped] || "";
503
+ }
504
+ const gz2Index = Math.floor(JIAZI.indexOf(gz2) / 10);
505
+ const guxuConfig = GU_XU_CONFIG[gz2Index];
506
+ const yinYang = YIN_YANG[gz2[0]];
507
+ const gu = guxuConfig[yinYang].\u5B64;
508
+ const xu = guxuConfig[yinYang].\u865B;
509
+ const guGua = ZHI_TO_GUA[gu] || "";
510
+ const xuGua = ZHI_TO_GUA[xu] || "";
511
+ const positions = [
512
+ ["\u5DFD\u5BAE", "\u5146"],
513
+ ["\u9707\u5BAE", "\u6728\u9109"],
514
+ ["\u96E2\u5BAE", "\u706B\u9109"],
515
+ ["\u4E2D\u5BAE", "\u571F\u9109"],
516
+ ["\u514C\u5BAE", "\u91D1\u9109"],
517
+ ["\u574E\u5BAE", "\u6C34\u9109"]
518
+ ];
519
+ let remain = base;
520
+ let myElement = "";
521
+ for (let idx = 0; idx < positions.length; idx++) {
522
+ const [gong, label] = positions[idx];
523
+ const left = randomSplit(remain);
524
+ let zhaoNum = left % 5;
525
+ zhaoNum = zhaoNum === 0 ? 5 : zhaoNum;
526
+ const zhaoElement = NUM_TO_ELEMENT[zhaoNum];
527
+ const beast = beastSeq[idx];
528
+ const gongGua = gong[0] === "\u4E2D" ? "\u5764" : gong[0];
529
+ let relation = "";
530
+ if (idx === 0) {
531
+ myElement = zhaoElement;
532
+ } else {
533
+ const relationKey = myElement + zhaoElement;
534
+ const wuxingRelation = WU_XING_RELATION[relationKey] || "";
535
+ relation = LIU_QIN_MAP[wuxingRelation] || "";
536
+ }
537
+ const wangxiang = JIEQI_WANG_XIANG[jq]?.[gongGua] || "";
538
+ const weakness = SIX_BEAST_WEAKNESS[beast];
539
+ const sixBeastDeath = weakness && weakness[0][0] === gongGua ? "\u6B7B" : "";
540
+ const sixBeastHarm = weakness && weakness[1][0] === gongGua ? "\u5BB3" : "";
541
+ result[label] = {
542
+ \u5BAE\u4F4D: label,
543
+ \u5BAE\u4F4D1: gongGua,
544
+ \u65FA\u76F8: wangxiang,
545
+ \u6578\u5B57: zhaoNum,
546
+ \u4E94\u884C: zhaoElement,
547
+ \u516D\u7378: beast,
548
+ \u516D\u7378\u6B7B: sixBeastDeath,
549
+ \u516D\u7378\u5BB3: sixBeastHarm,
550
+ \u516D\u89AA: relation,
551
+ \u5B64: guGua === gongGua ? "\u5B64" : "",
552
+ \u865B: xuGua === gongGua ? "\u865B" : "",
553
+ \u95DC: lock === gongGua ? "\u95DC" : "",
554
+ \u7C65: key === gongGua ? "\u7C65" : "",
555
+ \u5C07\u8ECD: general === gongGua ? "\u5C07\u8ECD" : ""
556
+ };
557
+ remain -= zhaoNum;
558
+ if (remain <= 0) break;
559
+ }
560
+ return result;
561
+ }
562
+ function ganzhiPaiPan(gzList, num, jq, cm, liurenData) {
563
+ const { year, month, day, hour, minute } = gzList;
564
+ const minuteGan = minute[0];
565
+ if (!(minuteGan in DAY_GAN_TO_BEAST)) {
566
+ return { \u932F\u8AA4: "\u65E5\u5E72\u4E0D\u6B63\u78BA\uFF0C\u8ACB\u8F38\u5165\uFF1A\u7532\u4E59\u4E19\u4E01\u620A\u5DF1\u5E9A\u8F9B\u58EC\u7678" };
567
+ }
568
+ const jz2num = {};
569
+ JIAZI.forEach((gz, index) => {
570
+ jz2num[gz] = index + 1;
571
+ });
572
+ const beastStart = DAY_GAN_TO_BEAST[minuteGan];
573
+ const startIndex = SIX_BEASTS.indexOf(beastStart);
574
+ const beastSeq = Array.from({ length: 6 }, (_, i) => SIX_BEASTS[(startIndex + i) % 6]);
575
+ const sky2earth = new BiDict();
576
+ if (liurenData) {
577
+ Object.entries(liurenData).forEach(([key2, value]) => {
578
+ sky2earth.set(key2, value);
579
+ });
580
+ }
581
+ const guanYue = getGuanYue(jq);
582
+ let lock = "";
583
+ let key = "";
584
+ let general = "";
585
+ if (guanYue && liurenData) {
586
+ const guanZhi = sky2earth.getInverse(guanYue.\u95DC) || guanYue.\u95DC;
587
+ const yueZhi = sky2earth.getInverse(guanYue.\u7C65) || guanYue.\u7C65;
588
+ lock = ZHI_TO_GUA[guanZhi] || "";
589
+ key = ZHI_TO_GUA[yueZhi] || "";
590
+ const generalZhi = GENERAL_MAP[minute[1]] || minute[1];
591
+ const generalMapped = sky2earth.getInverse(generalZhi) || generalZhi;
592
+ general = ZHI_TO_GUA[generalMapped] || "";
593
+ }
594
+ const minuteIndex = Math.floor(JIAZI.indexOf(minute) / 10);
595
+ const guxuConfig = GU_XU_CONFIG[minuteIndex];
596
+ const yinYang = YIN_YANG[minute[0]];
597
+ const gu = guxuConfig[yinYang].\u5B64;
598
+ const xu = guxuConfig[yinYang].\u865B;
599
+ const guGua = ZHI_TO_GUA[gu] || "";
600
+ const xuGua = ZHI_TO_GUA[xu] || "";
601
+ const positions = [
602
+ ["\u5DFD\u5BAE", "\u5146", [year, month, day, hour, minute]],
603
+ ["\u9707\u5BAE", "\u6728\u9109", [month, day, hour, minute]],
604
+ ["\u96E2\u5BAE", "\u706B\u9109", [day, hour, minute]],
605
+ ["\u4E2D\u5BAE", "\u571F\u9109", [hour, minute]],
606
+ ["\u514C\u5BAE", "\u91D1\u9109", [minute]],
607
+ ["\u574E\u5BAE", "\u6C34\u9109", []]
608
+ ];
609
+ const result = {};
610
+ let myElement = "";
611
+ for (let idx = 0; idx < positions.length; idx++) {
612
+ const [gong, label, parts] = positions[idx];
613
+ let total = num;
614
+ for (const part of parts) {
615
+ total += jz2num[part] || (typeof part === "number" ? part : 0);
616
+ }
617
+ let zhaoNum = total % 5;
618
+ zhaoNum = zhaoNum === 0 ? 5 : zhaoNum;
619
+ const zhaoElement = NUM_TO_ELEMENT[zhaoNum];
620
+ const beast = beastSeq[idx];
621
+ const gongGua = gong[0] === "\u4E2D" ? "\u5764" : gong[0];
622
+ let relation = "";
623
+ if (idx === 0) {
624
+ myElement = zhaoElement;
625
+ } else {
626
+ const relationKey = myElement + zhaoElement;
627
+ const wuxingRelation = WU_XING_RELATION[relationKey] || "";
628
+ relation = LIU_QIN_MAP[wuxingRelation] || "";
629
+ }
630
+ const wangxiang = JIEQI_WANG_XIANG[jq]?.[gongGua] || "";
631
+ const weakness = SIX_BEAST_WEAKNESS[beast];
632
+ const sixBeastDeath = weakness && weakness[0][0] === gongGua ? "\u6B7B" : "";
633
+ const sixBeastHarm = weakness && weakness[1][0] === gongGua ? "\u5BB3" : "";
634
+ result[label] = {
635
+ \u5BAE\u4F4D: label,
636
+ \u5BAE\u4F4D1: gongGua,
637
+ \u65FA\u76F8: wangxiang,
638
+ \u6578\u5B57: zhaoNum,
639
+ \u4E94\u884C: zhaoElement,
640
+ \u516D\u7378: beast,
641
+ \u516D\u7378\u6B7B: sixBeastDeath,
642
+ \u516D\u7378\u5BB3: sixBeastHarm,
643
+ \u516D\u89AA: relation,
644
+ \u95DC: lock === gongGua ? "\u95DC" : "",
645
+ \u7C65: key === gongGua ? "\u7C65" : "",
646
+ \u5B64: guGua === gongGua ? "\u5B64" : "",
647
+ \u865B: xuGua === gongGua ? "\u865B" : "",
648
+ \u5C07\u8ECD: general === gongGua ? "\u5C07\u8ECD" : ""
649
+ };
650
+ }
651
+ return result;
652
+ }
653
+
654
+ exports.BA_GUA = BA_GUA;
655
+ exports.BiDict = BiDict;
656
+ exports.DAY_GAN_TO_BEAST = DAY_GAN_TO_BEAST;
657
+ exports.DI_ZHI = DI_ZHI;
658
+ exports.GENERAL_MAP = GENERAL_MAP;
659
+ exports.GONG_WEI = GONG_WEI;
660
+ exports.GONG_WEI_LABELS = GONG_WEI_LABELS;
661
+ exports.GU_XU_CONFIG = GU_XU_CONFIG;
662
+ exports.JIAZI = JIAZI;
663
+ exports.JIEQI_GROUPS = JIEQI_GROUPS;
664
+ exports.LIU_QIN_MAP = LIU_QIN_MAP;
665
+ exports.NUM_TO_ELEMENT = NUM_TO_ELEMENT;
666
+ exports.SIX_BEASTS = SIX_BEASTS;
667
+ exports.SIX_BEAST_WEAKNESS = SIX_BEAST_WEAKNESS;
668
+ exports.TIAN_GAN = TIAN_GAN;
669
+ exports.TWENTY_FOUR_SOLAR_TERMS = TWENTY_FOUR_SOLAR_TERMS;
670
+ exports.WANG_XIANG = WANG_XIANG;
671
+ exports.WU_XING = WU_XING;
672
+ exports.WU_XING_RELATION = WU_XING_RELATION;
673
+ exports.YIN_YANG = YIN_YANG;
674
+ exports.ZHI_TO_GUA = ZHI_TO_GUA;
675
+ exports.findCurrentJieQi = findCurrentJieQi;
676
+ exports.findLunarHour = findLunarHour;
677
+ exports.findLunarKe = findLunarKe;
678
+ exports.findLunarMonth = findLunarMonth;
679
+ exports.findSeason = findSeason;
680
+ exports.fiveZhaoPaiPan = fiveZhaoPaiPan;
681
+ exports.ganZhi = ganZhi;
682
+ exports.ganzhiPaiPan = ganzhiPaiPan;
683
+ exports.generateJiaZi = generateJiaZi;
684
+ exports.getHourZhi = getHourZhi;
685
+ exports.getLiuJiaXun = getLiuJiaXun;
686
+ exports.getWuXing = getWuXing;
687
+ exports.multiKeyDictGet = multiKeyDictGet;
688
+ exports.newList = newList;
689
+ exports.randomSplit = randomSplit;
690
+ exports.rotateArray = rotateArray;
691
+ //# sourceMappingURL=index.cjs.map
692
+ //# sourceMappingURL=index.cjs.map