dsh-metaphysics 0.62.0 → 0.62.1
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/CHANGELOG.md +12 -2
- package/client.almanac.js +14 -14
- package/client.bazi.js +36 -36
- package/client.chenggu.js +1 -1
- package/client.convert.js +16 -16
- package/client.daliuren.js +22 -22
- package/client.fengshui.js +26 -26
- package/client.hepan.js +1 -1
- package/client.js +1 -1
- package/client.liuyao.js +36 -36
- package/client.mbti.js +22 -22
- package/client.name.js +35 -35
- package/client.numerology.js +42 -42
- package/client.qimen.js +90 -90
- package/client.star.js +24 -24
- package/client.tarot.js +28 -28
- package/client.trend.js +30 -30
- package/client.xiaoliuren.js +7 -7
- package/client.zeri.js +7 -7
- package/client.ziwei.js +1 -1
- package/engine/fengshui.js +6 -2
- package/engine/index.js +6 -0
- package/engine/mbti.js +1 -0
- package/engine/name.js +3 -0
- package/engine/numerology.js +3 -3
- package/engine/qimen.js +9 -1
- package/engine/star.js +3 -3
- package/engine/trend.js +3 -0
- package/package.json +1 -1
- package//345/221/275/347/220/206/346/216/222/347/233/230.html +37 -12
package/client.ziwei.js
CHANGED
|
@@ -151,7 +151,7 @@ ${i.summary}`);const v=Hn(o.detail);if(o.withInterpret&&(i.interpret=Q(i,{questi
|
|
|
151
151
|
规则·${ie.gist}〔${ie.statusLabel}〕${ie.detail} 出处:${ie.source}${ie.note?` 注:${ie.note}`:""}`).join("");v.push(`${ue.label}:${re}${ue.text}${ue.advice?` 建议:${ue.advice}`:""}${C}${S}`)}const ae=e.sections||[],Fe=r?ae.filter(ue=>String(ue.text||"").length>i):[];for(const ue of ae)r&&String(ue.text||"").length>i||v.push(`${ue.label}:${ue.text}`);Fe.length&&v.push(`(另有 ${Fe.length} 节长论述未展开:${Fe.map(ue=>ue.label).join("、")}。需要原文与出处时传 detail:"full")`);for(const ue of e.tables||[])!Array.isArray(ue.rows)||!ue.rows.length||(v.push(`【${ue.title}】`),v.push([ue.columns.join(" | "),...ue.rows.map(C=>C.join(" | "))].join(`
|
|
152
152
|
`)));return Array.isArray(e.followups)&&e.followups.length&&v.push("还可以这样追问:"+e.followups.map(ue=>`「${ue}」`).join(" ")),Array.isArray(e.glossary)&&e.glossary.length&&v.push("名词解释:"+e.glossary.map(ue=>`${ue.term}=${ue.plain}`).join(" ")),Array.isArray(e.limits)&&e.limits.length&&v.push("【本插件不回答什么】"+e.limits.map(ue=>`${ue.title}——${ue.text}`).join(`
|
|
153
153
|
`)),e.disclaimer&&v.push(e.disclaimer),v.join(`
|
|
154
|
-
`)}const Cn=["cross","verifyPast","withInterpret","detail","question","direction","ask","geocode","rectify","events","shadow","trace"];function Gn(e={},o={}){const r=o.system||e.system,i=o.switches||ot[r]||[];if(!i.length)return{system:r,switches:[],affected:0,total:0};const v={...e};for(const J of Cn)delete v[J];const $=i.map(J=>{const ae=J.read(v),Fe=J.alt(ae);let ue=[],C="",re=null,S=null;try{re=En({...v,[J.key]:ae}),S=En({...v,[J.key]:Fe}),ue=te(re,S)}catch(ln){C=ln&&ln.message||String(ln)}const ie=tn(ue.filter(ln=>Mn(ln.path))).map(ln=>({path:ln.path,label:Ln(ln.path),from:Xn(ln.from),to:Xn(ln.to)})),Ae=new Map;for(const ln of ue){const fn=Vn(ln.path)||"其他";Ae.set(fn,(Ae.get(fn)||0)+1)}const gn=[...Ae.entries()].map(([ln,fn])=>({name:ln,count:fn})).sort((ln,fn)=>fn.count-ln.count||ln.name.localeCompare(fn.name,"zh-Hans-CN"));return{key:J.key,title:J.title,short:J.short,current:ae,alt:Fe,currentLabel:J.label(ae),altLabel:J.label(Fe),total:ue.length,summary:C?"":xe(ue),views:C?[]:Kn(r,re,S),roots:ie,categories:gn,error:C}});return{system:r,switches:$,affected:$.filter(J=>!J.error&&J.total>0).length,total:$.reduce((J,ae)=>J+ae.total,0)}}const Le=["chaibu","chaoshen","zhirun"],sn=[1,3,5],jn=["same-day","next-day"];function Nn(e,o=""){if(e==null||e==="")return;const r=o?`${o}的`:"";let i;if(typeof e=="number")i=e;else if(typeof e=="string"){const v=e.trim();if(!/^[+-]?(\d+(\.\d*)?|\.\d+)$/.test(v))throw L("E_RANGE",`${r}经度不是十进制数字:收到「${e}」。经度写数字即可,例如北京 116.4`);i=Number(v)}else throw L("E_RANGE",`${r}经度必须是数字或数字字符串,收到 ${Array.isArray(e)?"array":typeof e}`);if(!Number.isFinite(i))throw L("E_RANGE",`${r}经度不是有限数值:收到「${e}」。经度写十进制数字即可,例如北京 116.4`);if(i<-180||i>180)throw L("E_RANGE",`${r}经度要在 −180 到 180 之间(东经为正),收到 ${i}`);return i}function Tn(e){const o=Nn(e.longitude,""),r=e.partner&&typeof e.partner=="object"?Nn(e.partner.longitude,"对方"):void 0,i=e.partner2&&typeof e.partner2=="object"?Nn(e.partner2.longitude,"第三方"):void 0;if(!(o!==void 0&&e.longitude!==o||r!==void 0&&e.partner.longitude!==r||i!==void 0&&e.partner2.longitude!==i))return e;const $={...e};return o!==void 0&&($.longitude=o),r!==void 0&&($.partner={...$.partner,longitude:r}),i!==void 0&&($.partner2={...$.partner2,longitude:i}),$}function Hn(e){if(e==null||e===""||e==="full")return"full";if(e==="lean")return"lean";throw L("E_INPUT",`detail 只能是 'full' 或 'lean':收到「${String(e).slice(0,24)}」`)}function Yn(e){if(e==null||typeof e=="string"&&!e.trim())return;const o=y(e);if(!o)throw L("E_ASOF",`无法解析 asOf:「${e}」,请用 2026-10-22T16:00 这种格式`);const{year:r,month:i,day:v,hour:$,minute:J}=o;if(!(i>=1&&i<=12)||!(v>=1&&v<=qe(r,i)))throw L("E_ASOF",`asOf 指向的日期不存在:${e}`);if($!==void 0&&!($>=0&&$<=23))throw L("E_ASOF",`asOf 的小时要在 0–23 之间:${e}`);if(J!==void 0&&!(J>=0&&J<=59))throw L("E_ASOF",`asOf 的分钟要在 0–59 之间:${e}`);return o}function Fn(e={}){const o=e.system;if(e.mode!==void 0&&e.mode!==null&&e.mode!==""){const r={convert:["solar2lunar","lunar2solar"],meihua:["time","number"],xiaoliuren:["time","number"]},i=r[o];if(!i)throw L("E_INPUT",`mode 只用于 ${Object.keys(r).join(" / ")};${o||"当前体系"} 不收 mode`);if(!i.includes(e.mode))throw L("E_INPUT",`${o} 的 mode 只能是 ${i.join(" / ")},收到「${String(e.mode).slice(0,24)}」`)}if(e.fortuneYear!==void 0&&e.fortuneYear!==null&&e.fortuneYear!==""){const r=Number(e.fortuneYear);if(!Number.isInteger(r))throw L("E_INPUT",`fortuneYear 要是整数年份,收到「${e.fortuneYear}」`);e={...e,fortuneYear:r}}if(o==="bazi"){const r=G(e.datetime),i=Yn(e.asOf),v=H({...r,gender:B(e.gender),longitude:typeof e.longitude=="number"?e.longitude:void 0,address:typeof e.address=="string"?e.address:void 0,geo:e.geo&&typeof e.geo=="object"?e.geo:void 0,lateZi:e.lateZi!==!1,trueSolar:e.trueSolar!==!1,dst:e.dst!==!1,nowYear:i?i.year:void 0,hourUnknown:e.hourUnknown===!0});return{...v,...i?{asOf:i}:{},precision:r.precision,summary:Me(v)}}if(o==="ziwei"){if(e.hourUnknown===!0)throw L("HOUR_UNKNOWN","紫微必须有出生时刻:命宫由生月与生时支定,时支未知则整盘不成立。请补上出生时刻,或改用八字三柱模式只看年/月/日。");e.lateZi!==void 0&&e.lateZishi===void 0&&(e={...e,lateZishi:e.lateZi===!1?"current-day":"next-day"});const r=G(e.datetime),i=Yn(e.asOf),v=x({...r,gender:B(e.gender),leapMonth:e.leapMonth,leapAsNext:e.leapAsNext===!0,...U(e),longitude:typeof e.longitude=="number"?e.longitude:void 0,address:typeof e.address=="string"?e.address:void 0,geo:e.geo&&typeof e.geo=="object"?e.geo:void 0,trueSolar:e.trueSolar,dst:e.dst!==!1,asOf:i});return{...v,...i?{asOf:i}:{},precision:r.precision,summary:fe(v)}}if(o==="tarot"){const r=e.count===void 0||e.count===null||e.count===""?3:Number(e.count);if(!sn.includes(r))throw L("E_COUNT",`塔罗张数只能是 1 / 3 / 5,收到「${e.count}」`);if(!Re(e.seed))throw L("E_INPUT",`seed 必须是数字,收到「${e.seed}」`);const i=Yn(e.asOf),v=O({count:r,question:e.question,at:e.asOf,random:pe(e.seed)});return e.seed!==void 0&&e.seed!==null&&e.seed!==""&&(v.seed=Number(e.seed)),{...v,...i?{asOf:i}:{},summary:Pe(v)}}if(o==="daliuren"){const r=G(e.datetime),i=e.lateZi!==!1,v=K({...r,lateZi:i});return v.lateZi=i,{...v,precision:r.precision,summary:hn(v)}}if(o==="qimen"){const r=G(e.datetime);if(e.juMethod!==void 0&&!Le.includes(e.juMethod))throw L("E_INPUT",`juMethod 只能是 chaibu / chaoshen / zhirun,收到「${e.juMethod}」`);const i=e.lateZiHourMode!==void 0?e.lateZiHourMode:e.lateZi===!0?"next-day":e.lateZi===!1?"same-day":void 0;if(i!==void 0&&!jn.includes(i))throw L("E_INPUT",`lateZiHourMode 只能是 same-day / next-day,收到「${i}」`);const v=i==="next-day"?"next-day":"same-day",$=c({...r,lateZiHourMode:v,juMethod:e.juMethod});return $.lateZiHourMode=v,{...$,summary:N($)}}if(o==="hepan"){if(e.hourUnknown===!0||e.partner&&e.partner.hourUnknown===!0)throw L("HOUR_UNKNOWN","合盘需要双方都有出生时刻:夫妻宫与大运都依赖时支。请补齐时刻后再看,或用八字三柱模式各自看年/月/日。");const r=e.partner;if(!r||typeof r!="object")throw L("E_PARTNER","合盘需要 partner:{ datetime, gender, address? },其中 partner.datetime 是对方的公历出生时间");if(!r.datetime)throw L("E_PARTNER",'缺少 partner.datetime(对方的公历出生时间),例如 partner: {"datetime":"1992-03-03T10:00","gender":"female"}');const i=e.partner2;if(i!=null){if(typeof i!="object"||Array.isArray(i))throw L("E_PARTNER","partner2 需要 { datetime, gender, address? };不想看三方就整段省略(null 视同未传)");if(!i.datetime)throw L("E_PARTNER",'缺少 partner2.datetime(第三方的公历出生时间),例如 partner2: {"datetime":"1988-09-09T08:00","gender":"male"}')}const v=e.chart==="ziwei"?"ziwei":"bazi",$=(C,re)=>({...G(C.datetime),gender:B(C.gender,re),trueSolar:C.trueSolar,lateZi:C.lateZi,dst:C.dst!==!1,address:typeof C.address=="string"?C.address:void 0,longitude:typeof C.longitude=="number"?C.longitude:void 0,geo:C.geo&&typeof C.geo=="object"?C.geo:void 0}),J=$(e,"你(主方)"),ae=$(r,"对方"),Fe=(C,re)=>v==="ziwei"?t({a:C,b:re}):l({a:C,b:re}),ue=Fe(J,ae);if(i){const C=$(i,"第三方");ue.triple=s([{key:"a-b",a:"你",b:"对方",result:ue},{key:"a-c",a:"你",b:"第三方",result:Fe(J,C)},{key:"b-c",a:"对方",b:"第三方",result:Fe(ae,C)}])}return{...ue,summary:ge(ue)}}if(o==="meihua"){let r;e.mode!=="number"&&G(e.datetime);try{r=V({mode:e.mode==="number"?"number":"time",datetime:e.datetime,upper:e.upper,lower:e.lower,changing:e.changing,lateZi:e.lateZi})}catch(i){const v=i&&i.message||String(i);throw L(i&&i.code||"E_INPUT",i&&i.code?v:`梅花起卦参数不完整:${v}`)}return{...r,summary:ce(r)}}if(o==="liuyao"){if(!Re(e.seed))throw L("E_INPUT",`seed 必须是数字,收到「${e.seed}」`);let r;if(e.lines===void 0||e.lines===null)r=me(pe(e.seed));else{if(!Array.isArray(e.lines))throw L("E_LINES","lines 必须是数组:自下而上 6 个爻值(6 老阴 / 7 少阳 / 8 少阴 / 9 老阳)");if(e.lines.length!==6)throw L("E_LINES",`六爻需要正好 6 个爻值(自下而上),收到 ${e.lines.length} 个;留空则由引擎随机摇卦`);r=e.lines.map(Number)}let i,v=null;const $=e.datetime?G(e.datetime):Yn(e.asOf);if($){e.datetime||(v=$);const re=b(W(g($.year,$.month,$.day)));i={stem:re.stem,branch:re.branch,name:re.name}}let J;try{J=A({lines:r,question:e.question,dayGanZhi:i})}catch(re){throw L(re&&re.code||"E_LINES",re&&re.message?re.message:re)}const ae=de(J,{direction:e.direction,gender:e.gender});ae.liuqin&&(J.useGod=ae);let Fe=null;if($)try{Fe=(n({year:$.year,month:$.month,day:$.day,hour:$.hour,minute:$.minute}).monthGanZhi||"")[1]||null}catch{Fe=null}const ue=a(J,{monthBranch:Fe,dayBranch:J.dayGanZhi.branch});ue&&(J.hexStrength=ue);const C=E(J,{monthBranch:Fe,dayBranch:J.dayGanZhi.branch});if(C&&(J.jinTuiPower=C),ae.liuqin){const re=Z(J,ae,{monthBranch:Fe,dayBranch:J.dayGanZhi.branch});re&&(J.useGodStrength=re);const S=X(J,ae,{monthBranch:Fe,dayBranch:J.dayGanZhi.branch});S&&(J.fushenAccess=S);const ie=M(J,ae,{monthBranch:Fe});ie&&(J.yingqi=ie)}return e.seed!==void 0&&e.seed!==null&&e.seed!==""&&(J.seed=Number(e.seed)),{...J,...v?{asOf:v}:{},summary:Ve(J)}}if(o==="almanac"){const r=G(e.datetime),i=nn({year:r.year,month:r.month,day:r.day});return{...i,summary:Jn(i)}}if(o==="zeri"){if(!(e.candidates!==void 0&&e.candidates!==null)&&(typeof e.startDate!="string"||!e.startDate.trim()))throw L("E_INPUT",'择日需要 startDate(公历 YYYY-MM-DD,起算日);可另给 days(1–60,默认 30)与 shengXiao(当事人属相)。只想比几天,改给 candidates: ["2026-12-01","2026-12-08"]');let i;try{i=Ge({task:e.task,startDate:e.startDate,days:e.days,shengXiao:e.shengXiao,candidates:e.candidates})}catch(v){throw L(v&&v.code||"E_INPUT",v&&v.message||String(v))}return{...i,summary:Qn(i)}}if(o==="chenggu"){const r=G(e.datetime),i=/[T\s]\d{1,2}:\d{1,2}/.test(String(e.datetime)),v=Number.isInteger(e.hour)?e.hour:i?r.hour:null;if(v===null||v<0||v>23)throw L("E_INPUT","称骨必须给时辰:datetime 带时分(如 1990-08-15T10:00),或额外给 hour(0–23)——缺时辰四柱不齐");const $=Ze({year:r.year,month:r.month,day:r.day,hour:v,minute:i?r.minute:0,lateZi:e.lateZi});return{...$,summary:yn($)}}if(o==="convert"){const r=e.mode==="lunar2solar"?"lunar2solar":"solar2lunar";let i;if(r==="lunar2solar"){if(e.lunarYear==null||e.lunarMonth==null||e.lunarDay==null)throw L("E_INPUT","农历转公历需要 lunarYear / lunarMonth / lunarDay(闰月另加 isLeapMonth: true)");i=he({mode:r,lunarYear:Number(e.lunarYear),lunarMonth:Number(e.lunarMonth),lunarDay:Number(e.lunarDay),isLeapMonth:e.isLeapMonth===!0})}else{const v=G(e.datetime);i=he({mode:r,year:v.year,month:v.month,day:v.day})}return{...i,summary:ve(i)}}if(o==="xiaoliuren"){const r=e.datetime?G(e.datetime):null,i=Qe({mode:e.mode==="number"?"number":"time",date:typeof e.date=="string"&&e.date.trim()?e.date:r?`${r.year}-${r.month}-${r.day}`:void 0,hour:Number.isInteger(e.hour)?e.hour:r&&/[T\s]\d{1,2}:\d{1,2}/.test(String(e.datetime))?r.hour:void 0,num1:e.num1,num2:e.num2,num3:e.num3,question:e.question,lateZi:e.lateZi});return{...i,summary:Wn(i)}}if(o==="star"){const r=G(e.datetime),i=Be({year:r.year,month:r.month,day:r.day});return{...i,summary:ne(i)}}if(o==="numerology"){const r=G(e.datetime),i=He({year:r.year,month:r.month,day:r.day});return{...i,summary:dn(i)}}if(o==="mbti"){if(e.answers===void 0||e.answers===null){const i=Je();return{...i,summary:On(i)}}const r=Ue({answers:e.answers});return{...r,summary:An(r)}}if(o==="trend"){const r=G(e.datetime),i=e.asOf?Yn(e.asOf):void 0,v=st({...r,nowYear:i?i.year:void 0,gender:B(e.gender),toAge:e.toAge,lateZi:e.lateZi!==!1,trueSolar:e.trueSolar!==!1,dst:e.dst!==!1,longitude:typeof e.longitude=="number"?e.longitude:void 0,address:typeof e.address=="string"?e.address:void 0,geo:e.geo&&typeof e.geo=="object"?e.geo:void 0,hourUnknown:e.hourUnknown===!0});return{...v,...e.hourUnknown===!0?{hourUnknown:!0,hourPrecision:"day"}:{},precision:r.precision,summary:wn(v)}}if(o==="fengshui"){const r=e.action==="advise"?"advise":e.action==="xuankong"?"xuankong":"natal";if(r==="xuankong"){const $=et({action:r,sitting:e.sitting,facing:e.facing,...e.period!==void 0?{period:e.period}:{},...e.fortuneYear!==void 0?{fortuneYear:e.fortuneYear}:{},...typeof e.sittingOffset=="number"?{sittingOffset:e.sittingOffset}:{},...typeof e.sittingDegree=="number"?{sittingDegree:e.sittingDegree}:{},...typeof e.facingOffset=="number"?{facingOffset:e.facingOffset}:{},...typeof e.facingDegree=="number"?{facingDegree:e.facingDegree}:{},...typeof e.fortuneDate=="string"?{fortuneDate:e.fortuneDate}:{},...typeof e.fortuneTime=="string"?{fortuneTime:e.fortuneTime}:{},dst:e.dst!==!1});return{...$,summary:Rn($)}}if(r==="advise"){const $=et({action:r,sitting:e.sitting,facing:e.facing,...e.datetime?G(e.datetime):{},...e.gender==="male"||e.gender==="female"?{gender:e.gender}:{},dst:e.dst!==!1});return{...$,summary:Rn($)}}const i=G(e.datetime),v=et({action:"natal",year:i.year,month:i.month,day:i.day,gender:B(e.gender),fortuneYear:e.fortuneYear,dst:e.dst!==!1});return{...v,summary:Rn(v)}}if(o==="name"){const r=e.action==="generate"?"generate":"assess",i=e.datetime?G(e.datetime):Number.isInteger(e.year)&&Number.isInteger(e.month)&&Number.isInteger(e.day)?{year:e.year,month:e.month,day:e.day,...Number.isInteger(e.hour)?{hour:e.hour}:{},...Number.isInteger(e.minute)?{minute:e.minute}:{}}:{},v=it({action:r,surname:e.surname,givenName:e.givenName,limit:e.limit,charElements:e.charElements&&typeof e.charElements=="object"?e.charElements:void 0,strokeOverrides:e.strokeOverrides&&typeof e.strokeOverrides=="object"?e.strokeOverrides:void 0,surnameStrokes:e.surnameStrokes&&typeof e.surnameStrokes=="object"?e.surnameStrokes:void 0,...i,...e.gender==="male"||e.gender==="female"?{gender:e.gender}:{},...e.datetime?{lateZi:e.lateZi!==!1,trueSolar:e.trueSolar!==!1,dst:e.dst!==!1,longitude:typeof e.longitude=="number"?e.longitude:void 0,address:typeof e.address=="string"?e.address:void 0,geo:e.geo&&typeof e.geo=="object"?e.geo:void 0}:{}});return{...v,summary:Pn(v)}}throw o?L("E_SYSTEM",`未知体系「${o}」,可选:bazi(四柱八字)、ziwei(紫微斗数)、liuyao(六爻)、meihua(梅花易数)、daliuren(大六壬)、qimen(奇门遁甲)、hepan(合盘)、tarot(塔罗)、almanac(黄历)、zeri(择日)、chenggu(称骨)、xiaoliuren(小六壬)、star(星座)、numerology(生命数字)、mbti(十六型人格问卷)、trend(人生 K 线)、fengshui(风水)、name(起名)、convert(公农历互转)。`):L("E_INPUT","缺少 system,可选:bazi(四柱八字)、ziwei(紫微斗数)、liuyao(六爻)、meihua(梅花易数)、daliuren(大六壬)、qimen(奇门遁甲)、hepan(合盘)、tarot(塔罗)、almanac(黄历)、zeri(择日)、chenggu(称骨)、xiaoliuren(小六壬)、star(星座)、numerology(生命数字)、mbti(十六型人格问卷)、trend(人生 K 线)、fengshui(风水)、name(起名)、convert(公农历互转)。")}function Jn(e){const o=e.ganzhi,r=e.jieQi&&e.jieQi.next?` 下一节:${e.jieQi.next.name} ${e.jieQi.next.date}`:"",i=e.dayGod?`值日:${e.dayGod.name}(${e.dayGod.type}·${e.dayGod.luck})`:"",v=e.xiu?`二十八宿:${e.xiu.name}宿(${e.xiu.luck}·${e.xiu.zheng}·${e.xiu.animal})`:"",$=e.taiShen?`胎神:${e.taiShen}`:"",J=e.positions?`吉神方位:喜神${e.positions.xiShen||"—"} 财神${e.positions.caiShen||"—"} 福神${e.positions.fuShen?e.positions.fuShen.dir:"—"} 阳贵${e.positions.yangGui?e.positions.yangGui.dir:"—"} 阴贵${e.positions.yinGui?e.positions.yinGui.dir:"—"}`:"",ae=e.lucky?`吉配生肖:六合${e.lucky.liuhe||"—"} 三合${(e.lucky.sanhe||[]).join("、")||"—"}`:"",Fe=e.nayin&&e.nayin.day?`日柱纳音:${e.nayin.day.name}`:"",ue=(e.hours||[]).map(C=>`${C.zhi}${C.ganZhi.slice(0,1)}·${C.shen}${C.luck==="吉"?"吉":"凶"}`).join(" ");return[`【黄历】${e.meta.date} ${e.meta.weekday} ${e.lunar.text}`,`干支:${o.year}年 ${o.month}月 ${o.day}日 属${o.shengXiao}`,...e.meta.boundaryNote?[` ${e.meta.boundaryNote}`]:[],`建除:${e.zhiXing}日 冲:${e.chong.text}${e.chong.sha?`(${e.chong.sha})`:""} ${i}`,[v,Fe,$].filter(Boolean).join(" "),`宜:${e.yi.join("、")}`,`忌:${e.ji.join("、")}`,J,ae,ue?`时辰吉凶:${ue}`:"",`节气:上一节 ${e.jieQi.prev?`${e.jieQi.prev.name} ${e.jieQi.prev.date}`:"—"}${r}`,e.dailyHexagram?`每日一卦:${e.dailyHexagram.name} ${e.dailyHexagram.meaning||""}`:"",`口径:${e.meta.scope}`].filter(Boolean).join(`
|
|
154
|
+
`)}const Cn=["cross","verifyPast","withInterpret","detail","question","direction","ask","geocode","rectify","events","shadow","trace"];function Gn(e={},o={}){const r=o.system||e.system,i=o.switches||ot[r]||[];if(!i.length)return{system:r,switches:[],affected:0,total:0};const v={...e};for(const J of Cn)delete v[J];const $=i.map(J=>{const ae=J.read(v),Fe=J.alt(ae);let ue=[],C="",re=null,S=null;try{re=En({...v,[J.key]:ae}),S=En({...v,[J.key]:Fe}),ue=te(re,S)}catch(ln){C=ln&&ln.message||String(ln)}const ie=tn(ue.filter(ln=>Mn(ln.path))).map(ln=>({path:ln.path,label:Ln(ln.path),from:Xn(ln.from),to:Xn(ln.to)})),Ae=new Map;for(const ln of ue){const fn=Vn(ln.path)||"其他";Ae.set(fn,(Ae.get(fn)||0)+1)}const gn=[...Ae.entries()].map(([ln,fn])=>({name:ln,count:fn})).sort((ln,fn)=>fn.count-ln.count||ln.name.localeCompare(fn.name,"zh-Hans-CN"));return{key:J.key,title:J.title,short:J.short,current:ae,alt:Fe,currentLabel:J.label(ae),altLabel:J.label(Fe),total:ue.length,summary:C?"":xe(ue),views:C?[]:Kn(r,re,S),roots:ie,categories:gn,error:C}});return{system:r,switches:$,affected:$.filter(J=>!J.error&&J.total>0).length,total:$.reduce((J,ae)=>J+ae.total,0)}}const Le=["chaibu","chaoshen","zhirun"],sn=[1,3,5],jn=["same-day","next-day"];function Nn(e,o=""){if(e==null||e==="")return;const r=o?`${o}的`:"";let i;if(typeof e=="number")i=e;else if(typeof e=="string"){const v=e.trim();if(!/^[+-]?(\d+(\.\d*)?|\.\d+)$/.test(v))throw L("E_RANGE",`${r}经度不是十进制数字:收到「${e}」。经度写数字即可,例如北京 116.4`);i=Number(v)}else throw L("E_RANGE",`${r}经度必须是数字或数字字符串,收到 ${Array.isArray(e)?"array":typeof e}`);if(!Number.isFinite(i))throw L("E_RANGE",`${r}经度不是有限数值:收到「${e}」。经度写十进制数字即可,例如北京 116.4`);if(i<-180||i>180)throw L("E_RANGE",`${r}经度要在 −180 到 180 之间(东经为正),收到 ${i}`);return i}function Tn(e){const o=Nn(e.longitude,""),r=e.partner&&typeof e.partner=="object"?Nn(e.partner.longitude,"对方"):void 0,i=e.partner2&&typeof e.partner2=="object"?Nn(e.partner2.longitude,"第三方"):void 0;if(!(o!==void 0&&e.longitude!==o||r!==void 0&&e.partner.longitude!==r||i!==void 0&&e.partner2.longitude!==i))return e;const $={...e};return o!==void 0&&($.longitude=o),r!==void 0&&($.partner={...$.partner,longitude:r}),i!==void 0&&($.partner2={...$.partner2,longitude:i}),$}function Hn(e){if(e==null||e===""||e==="full")return"full";if(e==="lean")return"lean";throw L("E_INPUT",`detail 只能是 'full' 或 'lean':收到「${String(e).slice(0,24)}」`)}function Yn(e){if(e==null||typeof e=="string"&&!e.trim())return;const o=y(e);if(!o)throw L("E_ASOF",`无法解析 asOf:「${e}」,请用 2026-10-22T16:00 这种格式`);const{year:r,month:i,day:v,hour:$,minute:J}=o;if(!(i>=1&&i<=12)||!(v>=1&&v<=qe(r,i)))throw L("E_ASOF",`asOf 指向的日期不存在:${e}`);if($!==void 0&&!($>=0&&$<=23))throw L("E_ASOF",`asOf 的小时要在 0–23 之间:${e}`);if(J!==void 0&&!(J>=0&&J<=59))throw L("E_ASOF",`asOf 的分钟要在 0–59 之间:${e}`);return o}function Fn(e={}){const o=e.system;if(e.mode!==void 0&&e.mode!==null&&e.mode!==""){const r={convert:["solar2lunar","lunar2solar"],meihua:["time","number"],xiaoliuren:["time","number"]},i=r[o];if(!i)throw L("E_INPUT",`mode 只用于 ${Object.keys(r).join(" / ")};${o||"当前体系"} 不收 mode`);if(!i.includes(e.mode))throw L("E_INPUT",`${o} 的 mode 只能是 ${i.join(" / ")},收到「${String(e.mode).slice(0,24)}」`)}if(e.fortuneYear!==void 0&&e.fortuneYear!==null&&e.fortuneYear!==""){const r=Number(e.fortuneYear);if(!Number.isInteger(r))throw L("E_INPUT",`fortuneYear 要是整数年份,收到「${e.fortuneYear}」`);e={...e,fortuneYear:r}}if(o==="bazi"){const r=G(e.datetime),i=Yn(e.asOf),v=H({...r,gender:B(e.gender),longitude:typeof e.longitude=="number"?e.longitude:void 0,address:typeof e.address=="string"?e.address:void 0,geo:e.geo&&typeof e.geo=="object"?e.geo:void 0,lateZi:e.lateZi!==!1,trueSolar:e.trueSolar!==!1,dst:e.dst!==!1,nowYear:i?i.year:void 0,hourUnknown:e.hourUnknown===!0});return{...v,...i?{asOf:i}:{},precision:r.precision,summary:Me(v)}}if(o==="ziwei"){if(e.hourUnknown===!0)throw L("HOUR_UNKNOWN","紫微必须有出生时刻:命宫由生月与生时支定,时支未知则整盘不成立。请补上出生时刻,或改用八字三柱模式只看年/月/日。");e.lateZi!==void 0&&e.lateZishi===void 0&&(e={...e,lateZishi:e.lateZi===!1?"current-day":"next-day"});const r=G(e.datetime),i=Yn(e.asOf),v=x({...r,gender:B(e.gender),leapMonth:e.leapMonth,leapAsNext:e.leapAsNext===!0,...U(e),longitude:typeof e.longitude=="number"?e.longitude:void 0,address:typeof e.address=="string"?e.address:void 0,geo:e.geo&&typeof e.geo=="object"?e.geo:void 0,trueSolar:e.trueSolar,dst:e.dst!==!1,asOf:i});return{...v,...i?{asOf:i}:{},precision:r.precision,summary:fe(v)}}if(o==="tarot"){const r=e.count===void 0||e.count===null||e.count===""?3:Number(e.count);if(!sn.includes(r))throw L("E_COUNT",`塔罗张数只能是 1 / 3 / 5,收到「${e.count}」`);if(!Re(e.seed))throw L("E_INPUT",`seed 必须是数字,收到「${e.seed}」`);const i=Yn(e.asOf),v=O({count:r,question:e.question,at:e.asOf,random:pe(e.seed)});return e.seed!==void 0&&e.seed!==null&&e.seed!==""&&(v.seed=Number(e.seed)),{...v,...i?{asOf:i}:{},summary:Pe(v)}}if(o==="daliuren"){const r=G(e.datetime),i=e.lateZi!==!1,v=K({...r,lateZi:i});return v.lateZi=i,{...v,precision:r.precision,summary:hn(v)}}if(o==="qimen"){const r=G(e.datetime);if(e.juMethod!==void 0&&!Le.includes(e.juMethod))throw L("E_INPUT",`juMethod 只能是 chaibu / chaoshen / zhirun,收到「${e.juMethod}」`);const i=e.lateZiHourMode!==void 0?e.lateZiHourMode:e.lateZi===!0?"next-day":e.lateZi===!1?"same-day":void 0;if(i!==void 0&&!jn.includes(i))throw L("E_INPUT",`lateZiHourMode 只能是 same-day / next-day,收到「${i}」`);const v=i==="next-day"?"next-day":"same-day",$=c({...r,lateZiHourMode:v,juMethod:e.juMethod});return $.lateZiHourMode=v,{...$,summary:N($)}}if(o==="hepan"){if(e.hourUnknown===!0||e.partner&&e.partner.hourUnknown===!0)throw L("HOUR_UNKNOWN","合盘需要双方都有出生时刻:夫妻宫与大运都依赖时支。请补齐时刻后再看,或用八字三柱模式各自看年/月/日。");const r=e.partner;if(!r||typeof r!="object")throw L("E_PARTNER","合盘需要 partner:{ datetime, gender, address? },其中 partner.datetime 是对方的公历出生时间");if(!r.datetime)throw L("E_PARTNER",'缺少 partner.datetime(对方的公历出生时间),例如 partner: {"datetime":"1992-03-03T10:00","gender":"female"}');const i=e.partner2;if(i!=null){if(typeof i!="object"||Array.isArray(i))throw L("E_PARTNER","partner2 需要 { datetime, gender, address? };不想看三方就整段省略(null 视同未传)");if(!i.datetime)throw L("E_PARTNER",'缺少 partner2.datetime(第三方的公历出生时间),例如 partner2: {"datetime":"1988-09-09T08:00","gender":"male"}')}const v=e.chart==="ziwei"?"ziwei":"bazi",$=(C,re)=>({...G(C.datetime),gender:B(C.gender,re),trueSolar:C.trueSolar,lateZi:C.lateZi,dst:C.dst!==!1,address:typeof C.address=="string"?C.address:void 0,longitude:typeof C.longitude=="number"?C.longitude:void 0,geo:C.geo&&typeof C.geo=="object"?C.geo:void 0}),J=$(e,"你(主方)"),ae=$(r,"对方"),Fe=(C,re)=>v==="ziwei"?t({a:C,b:re}):l({a:C,b:re}),ue=Fe(J,ae);if(i){const C=$(i,"第三方");ue.triple=s([{key:"a-b",a:"你",b:"对方",result:ue},{key:"a-c",a:"你",b:"第三方",result:Fe(J,C)},{key:"b-c",a:"对方",b:"第三方",result:Fe(ae,C)}])}return{...ue,summary:ge(ue)}}if(o==="meihua"){let r;e.mode!=="number"&&G(e.datetime);try{r=V({mode:e.mode==="number"?"number":"time",datetime:e.datetime,upper:e.upper,lower:e.lower,changing:e.changing,lateZi:e.lateZi})}catch(i){const v=i&&i.message||String(i);throw L(i&&i.code||"E_INPUT",i&&i.code?v:`梅花起卦参数不完整:${v}`)}return{...r,summary:ce(r)}}if(o==="liuyao"){if(!Re(e.seed))throw L("E_INPUT",`seed 必须是数字,收到「${e.seed}」`);let r;if(e.lines===void 0||e.lines===null)r=me(pe(e.seed));else{if(!Array.isArray(e.lines))throw L("E_LINES","lines 必须是数组:自下而上 6 个爻值(6 老阴 / 7 少阳 / 8 少阴 / 9 老阳)");if(e.lines.length!==6)throw L("E_LINES",`六爻需要正好 6 个爻值(自下而上),收到 ${e.lines.length} 个;留空则由引擎随机摇卦`);r=e.lines.map(Number)}let i,v=null;const $=e.datetime?G(e.datetime):Yn(e.asOf);if($){e.datetime||(v=$);const re=b(W(g($.year,$.month,$.day)));i={stem:re.stem,branch:re.branch,name:re.name}}let J;try{J=A({lines:r,question:e.question,dayGanZhi:i})}catch(re){throw L(re&&re.code||"E_LINES",re&&re.message?re.message:re)}const ae=de(J,{direction:e.direction,gender:e.gender});ae.liuqin&&(J.useGod=ae);let Fe=null;if($)try{Fe=(n({year:$.year,month:$.month,day:$.day,hour:$.hour,minute:$.minute}).monthGanZhi||"")[1]||null}catch{Fe=null}const ue=a(J,{monthBranch:Fe,dayBranch:J.dayGanZhi.branch});ue&&(J.hexStrength=ue);const C=E(J,{monthBranch:Fe,dayBranch:J.dayGanZhi.branch});if(C&&(J.jinTuiPower=C),ae.liuqin){const re=Z(J,ae,{monthBranch:Fe,dayBranch:J.dayGanZhi.branch});re&&(J.useGodStrength=re);const S=X(J,ae,{monthBranch:Fe,dayBranch:J.dayGanZhi.branch});S&&(J.fushenAccess=S);const ie=M(J,ae,{monthBranch:Fe});ie&&(J.yingqi=ie)}return e.seed!==void 0&&e.seed!==null&&e.seed!==""&&(J.seed=Number(e.seed)),{...J,...v?{asOf:v}:{},summary:Ve(J)}}if(o==="almanac"){const r=G(e.datetime),i=nn({year:r.year,month:r.month,day:r.day});return{...i,summary:Jn(i)}}if(o==="zeri"){if(!(e.candidates!==void 0&&e.candidates!==null)&&(typeof e.startDate!="string"||!e.startDate.trim()))throw L("E_INPUT",'择日需要 startDate(公历 YYYY-MM-DD,起算日);可另给 days(1–60,默认 30)与 shengXiao(当事人属相)。只想比几天,改给 candidates: ["2026-12-01","2026-12-08"]');let i;try{i=Ge({task:e.task,startDate:e.startDate,days:e.days,shengXiao:e.shengXiao,candidates:e.candidates})}catch(v){throw L(v&&v.code||"E_INPUT",v&&v.message||String(v))}return{...i,summary:Qn(i)}}if(o==="chenggu"){const r=G(e.datetime),i=/[T\s]\d{1,2}:\d{1,2}/.test(String(e.datetime)),v=Number.isInteger(e.hour)?e.hour:i?r.hour:null;if(v===null||v<0||v>23)throw L("E_INPUT","称骨必须给时辰:datetime 带时分(如 1990-08-15T10:00),或额外给 hour(0–23)——缺时辰四柱不齐");const $=Ze({year:r.year,month:r.month,day:r.day,hour:v,minute:i?r.minute:0,lateZi:e.lateZi});return{...$,summary:yn($)}}if(o==="convert"){const r=e.mode==="lunar2solar"?"lunar2solar":"solar2lunar";let i;if(r==="lunar2solar"){if(e.lunarYear==null||e.lunarMonth==null||e.lunarDay==null)throw L("E_INPUT","农历转公历需要 lunarYear / lunarMonth / lunarDay(闰月另加 isLeapMonth: true)");i=he({mode:r,lunarYear:Number(e.lunarYear),lunarMonth:Number(e.lunarMonth),lunarDay:Number(e.lunarDay),isLeapMonth:e.isLeapMonth===!0})}else{const v=G(e.datetime);i=he({mode:r,year:v.year,month:v.month,day:v.day})}return{...i,summary:ve(i)}}if(o==="xiaoliuren"){const r=e.datetime?G(e.datetime):null,i=Qe({mode:e.mode==="number"?"number":"time",date:typeof e.date=="string"&&e.date.trim()?e.date:r?`${r.year}-${r.month}-${r.day}`:void 0,hour:Number.isInteger(e.hour)?e.hour:r&&/[T\s]\d{1,2}:\d{1,2}/.test(String(e.datetime))?r.hour:void 0,num1:e.num1,num2:e.num2,num3:e.num3,question:e.question,lateZi:e.lateZi});return{...i,summary:Wn(i)}}if(o==="star"){const r=G(e.datetime),i=Be({year:r.year,month:r.month,day:r.day});return{...i,summary:ne(i)}}if(o==="numerology"){const r=G(e.datetime),i=He({year:r.year,month:r.month,day:r.day});return{...i,summary:dn(i)}}if(o==="mbti"){if(e.answers===void 0||e.answers===null){const i=Je();return{...i,summary:On(i)}}const r=Ue({answers:e.answers});return{...r,summary:An(r)}}if(o==="trend"){const r=G(e.datetime),i=e.asOf?Yn(e.asOf):void 0,v=st({...r,nowYear:i?i.year:void 0,gender:B(e.gender),toAge:e.toAge,lateZi:e.lateZi!==!1,trueSolar:e.trueSolar!==!1,dst:e.dst!==!1,longitude:typeof e.longitude=="number"?e.longitude:void 0,address:typeof e.address=="string"?e.address:void 0,geo:e.geo&&typeof e.geo=="object"?e.geo:void 0,hourUnknown:e.hourUnknown===!0});return{...v,...e.hourUnknown===!0?{hourUnknown:!0,hourPrecision:"day"}:{},precision:r.precision,summary:wn(v)}}if(o==="fengshui"){if(e.action!=null&&!["natal","advise","xuankong"].includes(e.action))throw L("E_INPUT",`风水 action 只能是 natal / advise / xuankong,收到「${String(e.action).slice(0,24)}」`);const r=e.action==="advise"?"advise":e.action==="xuankong"?"xuankong":"natal";if(r==="xuankong"){const $=et({action:r,sitting:e.sitting,facing:e.facing,...e.period!==void 0?{period:e.period}:{},...e.fortuneYear!==void 0?{fortuneYear:e.fortuneYear}:{},...typeof e.sittingOffset=="number"?{sittingOffset:e.sittingOffset}:{},...typeof e.sittingDegree=="number"?{sittingDegree:e.sittingDegree}:{},...typeof e.facingOffset=="number"?{facingOffset:e.facingOffset}:{},...typeof e.facingDegree=="number"?{facingDegree:e.facingDegree}:{},...typeof e.fortuneDate=="string"?{fortuneDate:e.fortuneDate}:{},...typeof e.fortuneTime=="string"?{fortuneTime:e.fortuneTime}:{},dst:e.dst!==!1});return{...$,summary:Rn($)}}if(r==="advise"){const $=et({action:r,sitting:e.sitting,facing:e.facing,...e.datetime?G(e.datetime):{},...e.gender==="male"||e.gender==="female"?{gender:e.gender}:{},dst:e.dst!==!1});return{...$,summary:Rn($)}}const i=G(e.datetime),v=et({action:"natal",year:i.year,month:i.month,day:i.day,gender:B(e.gender),fortuneYear:e.fortuneYear,dst:e.dst!==!1});return{...v,summary:Rn(v)}}if(o==="name"){if(e.action!=null&&!["assess","generate"].includes(e.action))throw L("E_INPUT",`起名 action 只能是 assess / generate,收到「${String(e.action).slice(0,24)}」`);const r=e.action==="generate"?"generate":"assess",i=e.datetime?G(e.datetime):Number.isInteger(e.year)&&Number.isInteger(e.month)&&Number.isInteger(e.day)?{year:e.year,month:e.month,day:e.day,...Number.isInteger(e.hour)?{hour:e.hour}:{},...Number.isInteger(e.minute)?{minute:e.minute}:{}}:{},v=it({action:r,surname:e.surname,givenName:e.givenName,limit:e.limit,charElements:e.charElements&&typeof e.charElements=="object"?e.charElements:void 0,strokeOverrides:e.strokeOverrides&&typeof e.strokeOverrides=="object"?e.strokeOverrides:void 0,surnameStrokes:e.surnameStrokes&&typeof e.surnameStrokes=="object"?e.surnameStrokes:void 0,...i,...e.gender==="male"||e.gender==="female"?{gender:e.gender}:{},...e.datetime?{lateZi:e.lateZi!==!1,trueSolar:e.trueSolar!==!1,dst:e.dst!==!1,longitude:typeof e.longitude=="number"?e.longitude:void 0,address:typeof e.address=="string"?e.address:void 0,geo:e.geo&&typeof e.geo=="object"?e.geo:void 0}:{}});return{...v,summary:Pn(v)}}throw o?L("E_SYSTEM",`未知体系「${o}」,可选:bazi(四柱八字)、ziwei(紫微斗数)、liuyao(六爻)、meihua(梅花易数)、daliuren(大六壬)、qimen(奇门遁甲)、hepan(合盘)、tarot(塔罗)、almanac(黄历)、zeri(择日)、chenggu(称骨)、xiaoliuren(小六壬)、star(星座)、numerology(生命数字)、mbti(十六型人格问卷)、trend(人生 K 线)、fengshui(风水)、name(起名)、convert(公农历互转)。`):L("E_INPUT","缺少 system,可选:bazi(四柱八字)、ziwei(紫微斗数)、liuyao(六爻)、meihua(梅花易数)、daliuren(大六壬)、qimen(奇门遁甲)、hepan(合盘)、tarot(塔罗)、almanac(黄历)、zeri(择日)、chenggu(称骨)、xiaoliuren(小六壬)、star(星座)、numerology(生命数字)、mbti(十六型人格问卷)、trend(人生 K 线)、fengshui(风水)、name(起名)、convert(公农历互转)。")}function Jn(e){const o=e.ganzhi,r=e.jieQi&&e.jieQi.next?` 下一节:${e.jieQi.next.name} ${e.jieQi.next.date}`:"",i=e.dayGod?`值日:${e.dayGod.name}(${e.dayGod.type}·${e.dayGod.luck})`:"",v=e.xiu?`二十八宿:${e.xiu.name}宿(${e.xiu.luck}·${e.xiu.zheng}·${e.xiu.animal})`:"",$=e.taiShen?`胎神:${e.taiShen}`:"",J=e.positions?`吉神方位:喜神${e.positions.xiShen||"—"} 财神${e.positions.caiShen||"—"} 福神${e.positions.fuShen?e.positions.fuShen.dir:"—"} 阳贵${e.positions.yangGui?e.positions.yangGui.dir:"—"} 阴贵${e.positions.yinGui?e.positions.yinGui.dir:"—"}`:"",ae=e.lucky?`吉配生肖:六合${e.lucky.liuhe||"—"} 三合${(e.lucky.sanhe||[]).join("、")||"—"}`:"",Fe=e.nayin&&e.nayin.day?`日柱纳音:${e.nayin.day.name}`:"",ue=(e.hours||[]).map(C=>`${C.zhi}${C.ganZhi.slice(0,1)}·${C.shen}${C.luck==="吉"?"吉":"凶"}`).join(" ");return[`【黄历】${e.meta.date} ${e.meta.weekday} ${e.lunar.text}`,`干支:${o.year}年 ${o.month}月 ${o.day}日 属${o.shengXiao}`,...e.meta.boundaryNote?[` ${e.meta.boundaryNote}`]:[],`建除:${e.zhiXing}日 冲:${e.chong.text}${e.chong.sha?`(${e.chong.sha})`:""} ${i}`,[v,Fe,$].filter(Boolean).join(" "),`宜:${e.yi.join("、")}`,`忌:${e.ji.join("、")}`,J,ae,ue?`时辰吉凶:${ue}`:"",`节气:上一节 ${e.jieQi.prev?`${e.jieQi.prev.name} ${e.jieQi.prev.date}`:"—"}${r}`,e.dailyHexagram?`每日一卦:${e.dailyHexagram.name} ${e.dailyHexagram.meaning||""}`:"",`口径:${e.meta.scope}`].filter(Boolean).join(`
|
|
155
155
|
`)}function Qn(e){const o=e.compare&&e.compare.mode==="candidates",r=o?`【择日·${e.meta.task}】候选 ${e.meta.days} 天:${e.meta.candidates.join("、")}${e.meta.shengXiao?` 当事人属${e.meta.shengXiao}`:"(未给属相,未做冲煞排除)"}`:`【择日·${e.meta.task}】${e.meta.startDate} 起 ${e.meta.days} 天${e.meta.shengXiao?` 当事人属${e.meta.shengXiao}`:"(未给属相,未做冲煞排除)"}`,i=e.days.slice().sort(($,J)=>J.score-$.score).slice(0,o?12:5).map($=>{const J=$.grade?`,卷十${$.grade.label}·${$.grade.decision}`:"";return`· ${$.date} ${$.weekday} ${$.verdict}(${$.score}分${J}) 宜${$.yi.slice(0,3).join("/")} ${$.reasons.join(";")||"无特别加减分"}`}),v=o?e.compare.best?`这一组里最优:${e.compare.best.date}(${e.compare.best.score}分,${e.compare.best.verdict})`+(e.compare.best.ties.length>1?`;同分:${e.compare.best.ties.filter($=>$!==e.compare.best.date).join("、")}`:""):"这一组都因冲属相被排除,没有可用的日子":`推荐日:${e.best.length?e.best.join("、"):"本期无(都不够推荐分)"}`;return[r,v,`推荐日:${e.best.length?e.best.join("、"):"无"}`,`可用日:${e.usable.length?e.usable.join("、"):"无"}`,`回避日:${e.avoid.length?e.avoid.slice(0,6).join("、"):"无"}`,o?"候选日逐日:":"逐日排序:",...i,...o?[`比较口径:${e.compare.note}`]:[],`神煞依据:${e.shenshaRef.text};起法 ${e.shenshaRef.volumes.join("、")}。未实现起法:${e.shenshaRef.unsupported.join("、")}(不计分,逐日 shensha.unsupported 列出)。`,...e.shenshaRef.juan10?[`卷十依据:${e.shenshaRef.juan10.text}(${e.shenshaRef.juan10.corpusLines});${e.shenshaRef.juan10.thresholdsNote}`]:[],`口径:${e.meta.scope}`].join(`
|
|
156
156
|
`)}function yn(e){const o=e.song||{};return[`【称骨】${e.input.solar} ${e.lunar.text}`,`四项:${e.weights.year.label} ${e.weights.month.label} ${e.weights.day.label} ${e.weights.hour.label}`,`合计:${e.total.label}(${e.verdict.band})`,`歌诀(${e.total.label}):${o.text||"—"}`,`释义:${o.plain||"—"}`,`分档白话:${e.verdict.text}`,"口径:骨重与歌诀为通行本口径(各版本歌诀有异文),释义为白话自撰,属民俗娱乐参考。"].join(`
|
|
157
157
|
`)}function Wn(e){return[`【小六壬·${e.meta.mode}】${e.meta.question?`所问:${e.meta.question}`:""}`,e.meta.originText,`落宫:${e.steps.join(" → ")}`,`断语:${e.result.palace}(${e.result.luck}) ${e.result.text}`].join(`
|
package/engine/fengshui.js
CHANGED
|
@@ -473,8 +473,12 @@ export function buildFengshui(input) {
|
|
|
473
473
|
if (!Number.isInteger(fy)) throw fail('E_INPUT', `fortuneYear 必须是整数年份,收到「${input.fortuneYear}」`);
|
|
474
474
|
input = { ...input, fortuneYear: fy };
|
|
475
475
|
}
|
|
476
|
-
|
|
477
|
-
if (
|
|
476
|
+
const action = input.action;
|
|
477
|
+
if (action !== undefined && action !== null && action !== 'natal' && action !== 'advise' && action !== 'xuankong') {
|
|
478
|
+
throw fail('E_INPUT', `风水 action 只能是 natal / advise / xuankong,收到「${String(action).slice(0, 24)}」`);
|
|
479
|
+
}
|
|
480
|
+
if (action === 'advise') return buildAdvise(input);
|
|
481
|
+
if (action === 'xuankong') return buildXuankong(input);
|
|
478
482
|
const gender = input.gender;
|
|
479
483
|
if (gender !== 'male' && gender !== 'female') {
|
|
480
484
|
throw fail('E_INPUT', '风水命卦需要性别:男女命卦算法不同,不可缺省');
|
package/engine/index.js
CHANGED
|
@@ -1496,6 +1496,9 @@ function computeRaw(args = {}) {
|
|
|
1496
1496
|
};
|
|
1497
1497
|
}
|
|
1498
1498
|
if (system === 'fengshui') {
|
|
1499
|
+
if (args.action != null && !['natal', 'advise', 'xuankong'].includes(args.action)) {
|
|
1500
|
+
throw fail('E_INPUT', `风水 action 只能是 natal / advise / xuankong,收到「${String(args.action).slice(0, 24)}」`);
|
|
1501
|
+
}
|
|
1499
1502
|
const action = args.action === 'advise' ? 'advise' : args.action === 'xuankong' ? 'xuankong' : 'natal';
|
|
1500
1503
|
if (action === 'xuankong') {
|
|
1501
1504
|
const result = buildFengshui({
|
|
@@ -1536,6 +1539,9 @@ function computeRaw(args = {}) {
|
|
|
1536
1539
|
return { ...result, summary: fengshuiText(result) };
|
|
1537
1540
|
}
|
|
1538
1541
|
if (system === 'name') {
|
|
1542
|
+
if (args.action != null && !['assess', 'generate'].includes(args.action)) {
|
|
1543
|
+
throw fail('E_INPUT', `起名 action 只能是 assess / generate,收到「${String(args.action).slice(0, 24)}」`);
|
|
1544
|
+
}
|
|
1539
1545
|
const action = args.action === 'generate' ? 'generate' : 'assess';
|
|
1540
1546
|
const birth = args.datetime
|
|
1541
1547
|
? parseDateTime(args.datetime)
|
package/engine/mbti.js
CHANGED
|
@@ -352,6 +352,7 @@ function strengthOf(pct, answered) {
|
|
|
352
352
|
* 维度净分 > 0 取左字母,< 0 取右字母,= 0 按维度表的 tie 取(并标「临界」)。
|
|
353
353
|
*/
|
|
354
354
|
export function buildMbti(input = {}) {
|
|
355
|
+
input = input && typeof input === 'object' ? input : {};
|
|
355
356
|
const answers = normalizeAnswers(input.answers);
|
|
356
357
|
const answeredAll = answers.filter((v) => v !== null).length;
|
|
357
358
|
if (answeredAll < 12) {
|
package/engine/name.js
CHANGED
|
@@ -726,6 +726,9 @@ export function buildName(input) {
|
|
|
726
726
|
if (!input || typeof input !== 'object') {
|
|
727
727
|
throw fail('E_INPUT', '起名参数不能为空:评名要 surname / givenName,起名要 surname 与性别/生日');
|
|
728
728
|
}
|
|
729
|
+
if (input.action != null && input.action !== 'assess' && input.action !== 'generate') {
|
|
730
|
+
throw fail('E_INPUT', `起名 action 只能是 assess / generate,收到「${String(input.action).slice(0, 24)}」`);
|
|
731
|
+
}
|
|
729
732
|
if (input.action === 'generate') return generateNames(input);
|
|
730
733
|
return assessName(input);
|
|
731
734
|
}
|
package/engine/numerology.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// 生命数字(西方数字学):生命路径数 / 生日数 / 态度数,11、22、33 主数保留。
|
|
2
2
|
// 纯本地确定性;与八字/紫微是两套不可互证的体系,输出里明确提示。
|
|
3
|
-
import { daysInMonth } from './validate.js';
|
|
3
|
+
import { MAX_YEAR, MIN_YEAR, daysInMonth } from './validate.js';
|
|
4
4
|
import { fail } from './fail.js';
|
|
5
5
|
|
|
6
6
|
/** 1–9 与主数 11/22/33 的数义(白话提炼)。 */
|
|
@@ -38,8 +38,8 @@ const digitSum = (n) => String(Math.abs(Math.trunc(n))).split('').reduce((s, c)
|
|
|
38
38
|
export function buildNumerology(input) {
|
|
39
39
|
const { year, month, day } = input || {};
|
|
40
40
|
if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(day)
|
|
41
|
-
|| year <
|
|
42
|
-
throw fail('E_INPUT',
|
|
41
|
+
|| year < MIN_YEAR || year > MAX_YEAR || month < 1 || month > 12 || day < 1 || day > daysInMonth(year, month)) {
|
|
42
|
+
throw fail('E_INPUT', `生命数字需要真实存在的公历出生日期(year ${MIN_YEAR}–${MAX_YEAR}、month、day)——请向用户询问,勿猜`);
|
|
43
43
|
}
|
|
44
44
|
const lifePath = reduceNumber(digitSum(year) + digitSum(month) + digitSum(day));
|
|
45
45
|
const birthday = reduceNumber(day);
|
package/engine/qimen.js
CHANGED
|
@@ -5,6 +5,7 @@
|
|
|
5
5
|
import { termInstantJd, termWindow, jdToParts, partsToJd, formatJd, ganzhiName, sexagenaryIndex, STEMS, BRANCHES } from './calendar.js';
|
|
6
6
|
import { solarToLunar } from './lunar.js';
|
|
7
7
|
import { assertCivil, assertShifted } from './validate.js';
|
|
8
|
+
import { fail } from './fail.js';
|
|
8
9
|
import { ganyingOf, LIUYI_RU_MU } from './qimen-ganying.js';
|
|
9
10
|
|
|
10
11
|
const TIAN_GAN = ['甲', '乙', '丙', '丁', '戊', '己', '庚', '辛', '壬', '癸'];
|
|
@@ -44,7 +45,11 @@ const indexOfGz = (gz) => {
|
|
|
44
45
|
};
|
|
45
46
|
|
|
46
47
|
/** 由公历时刻构建快照(本地民用时间轴) */
|
|
47
|
-
export function buildSnapshot(
|
|
48
|
+
export function buildSnapshot(input) {
|
|
49
|
+
if (!input || typeof input !== 'object') {
|
|
50
|
+
throw fail('E_INPUT', '奇门排盘参数不能为空:至少给 year / month / day / hour');
|
|
51
|
+
}
|
|
52
|
+
const { year, month, day, hour, minute, lateZiHourMode = 'same-day' } = input;
|
|
48
53
|
assertCivil({ year, month, day, hour, minute });
|
|
49
54
|
const jd = partsToJd({ year, month, day, hour, minute });
|
|
50
55
|
|
|
@@ -450,6 +455,9 @@ const findGong = (obj, val) =>
|
|
|
450
455
|
|
|
451
456
|
/** 排盘主函数 */
|
|
452
457
|
export function buildQimen(input) {
|
|
458
|
+
if (!input || typeof input !== 'object') {
|
|
459
|
+
throw fail('E_INPUT', '奇门排盘参数不能为空:至少给 year / month / day / hour');
|
|
460
|
+
}
|
|
453
461
|
// snapshot 是内部快照路径(已由 buildSnapshot 校验过),不必重复校验
|
|
454
462
|
if (!input.snapshot) assertCivil(input);
|
|
455
463
|
const snapshot = input.snapshot || buildSnapshot(input);
|
package/engine/star.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
// 星座档案 + 当日娱乐向基调:纯本地确定性(同一天同一星座结果永远一致)。
|
|
2
2
|
// 星座按太阳过宫的通行日期区间(公历);当日基调由日期哈希生成,不是随机数。
|
|
3
|
-
import { daysInMonth } from './validate.js';
|
|
3
|
+
import { MAX_YEAR, MIN_YEAR, daysInMonth } from './validate.js';
|
|
4
4
|
import { fail } from './fail.js';
|
|
5
5
|
|
|
6
6
|
/** 12 星座(区间含起止日;摩羯跨年由两端分别匹配)。 */
|
|
@@ -51,8 +51,8 @@ const TONE_TEXT = {
|
|
|
51
51
|
export function buildStar(input) {
|
|
52
52
|
const { year, month, day } = input || {};
|
|
53
53
|
if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(day)
|
|
54
|
-
|| year <
|
|
55
|
-
throw fail('E_INPUT',
|
|
54
|
+
|| year < MIN_YEAR || year > MAX_YEAR || month < 1 || month > 12 || day < 1 || day > daysInMonth(year, month)) {
|
|
55
|
+
throw fail('E_INPUT', `星座需要真实存在的公历日期(year ${MIN_YEAR}–${MAX_YEAR}、month、day)——请向用户询问`);
|
|
56
56
|
}
|
|
57
57
|
const sign = signOfDate(month, day);
|
|
58
58
|
if (!sign) throw fail('E_INPUT', `无法识别星座:${year}-${month}-${day}`);
|
package/engine/trend.js
CHANGED
|
@@ -85,6 +85,9 @@ function buildSegments(list, direction, birthYear, toAge) {
|
|
|
85
85
|
* address?:string,longitude?:number,geo?:object}} input
|
|
86
86
|
*/
|
|
87
87
|
export function buildTrend(input) {
|
|
88
|
+
if (!input || typeof input !== 'object') {
|
|
89
|
+
throw fail('E_INPUT', '人生 K 线需要参数对象:至少给 datetime 与 gender(大运顺逆由性别决定)');
|
|
90
|
+
}
|
|
88
91
|
const gender = input.gender;
|
|
89
92
|
if (gender !== 'male' && gender !== 'female') {
|
|
90
93
|
throw fail('E_INPUT', '人生 K 线需要性别:大运顺逆由性别决定,不可缺省');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-metaphysics",
|
|
3
|
-
"version": "0.62.
|
|
3
|
+
"version": "0.62.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "命理排盘(玄学 xuanxue)for DeepSeek Harness: nineteen systems and eleven quick references (almanac, solar–lunar conversion, …), with climate adjustment (tiaohou), the 120 Qiongtong Baojian entries, 1,062-char name library with per-character pinyin, Kangxi stroke counts, five-grid (五格/三才) analysis and mechanical phonetics checks, a 78-card tarot library on the Rider-Waite-Smith base (per-card English name, image description, core meaning and astrological correspondence, cross-checked against three published sources; court cards carry no zodiac by design and the chart says so), classical quotes (Ziping Zhenquan / Di Tian Sui / San Ming Tong Hui), hexagram body relations (六冲/六合/伏吟/反吟/化进神/化退神) plus yongshen placement (用神落位) with month/day strength (月建日辰旺衰) and whole-hexagram per-line strength (全卦逐爻旺衰) and response-time clues (应期线索:逢值/逢冲/逢合 + 月建五态快慢) for liuyao, plus an MBTI-style 16-type questionnaire and exact dayun handover dates (交运日) with annual suiyun hints (岁运并临/伏吟反吟), palace conditions (击刑/入墓), month states (旺相休囚死) and stem–palace relations (天盘干与宫生克) for qimen, flying four-transformations with chained flights (四化飞星串连), three-way-four-corner composite flights (三方四正复合飞化), switchable leap-month policy (闰月按日切分/整月归次月/整月归本月) eleven school switches (亮度/庚干四化/天马/天空/截空旬空/魁钺/天伤天使/长生/晚子时/身主/杂曜全表) for ziwei, the last one opting in to a 61-star minor-star (杂曜) table where each of the twelve extra stars carries its placement verse and the palace it landed in (verses accepted only when at least two independent published editions give the same table, homonymous stars never merged), caliber diffs for bazi/ziwei/qimen (same inputs, one switch, root-field changes), shadow-chart IDs (same normalized params → same ID; version bumps auto-diff chart fields), step-by-step deduction traces (liuyao najia→liuqin→shiying→fushen→strength; bazi strength score and pattern/yongshen; ziwei pattern conditions), and a bundled offline single-file page (命理排盘.html), a panel-to-chat handoff that asks the Harness about a finished chart, per-tab lazy engine chunks so the first-screen client bundle stays under 100KB gzip, and a public verification report (128 classical hexagram cases, 312 Zi Wei charts × 34 patterns, 12 dayun handover cases) generated from the same source that gates CI.",
|
|
6
6
|
"keywords": [
|
|
@@ -362,7 +362,7 @@ h3::after{content:"";flex:1;height:1px;background:linear-gradient(90deg,var(--li
|
|
|
362
362
|
<div class="wrap">
|
|
363
363
|
<header>
|
|
364
364
|
<div class="brand-row">
|
|
365
|
-
<div class="brand"><span class="seal" aria-hidden="true">命</span><span class="brand-txt">命理排盘<span class="ver">v0.62.
|
|
365
|
+
<div class="brand"><span class="seal" aria-hidden="true">命</span><span class="brand-txt">命理排盘<span class="ver">v0.62.1</span><small>八字 · 紫微 · 六爻 · 梅花 · 六壬 · 奇门 · 合盘 · 塔罗 全部在本机计算</small></span></div>
|
|
366
366
|
<div class="view-switch">
|
|
367
367
|
<span class="hint">熟练了可以换回平铺</span>
|
|
368
368
|
<span class="seg" role="group" aria-label="首屏样式">
|
|
@@ -653,7 +653,7 @@ h3::after{content:"";flex:1;height:1px;background:linear-gradient(90deg,var(--li
|
|
|
653
653
|
<h3>对拍:把典籍当期望值</h3>
|
|
654
654
|
<ul><li>六爻:京房八宫卦序与世应,64 卦全表;旬空六旬表</li><li>六壬:日干寄宫、中气换将;紫微:纳音定五行局、紫微天府相照</li><li>卦例:《增删卜易》9 条 +《卜筮正宗》128 条(93 成对 + 35 静卦),核本变卦 / 动爻数 / 卦宫 / 缺爻 / 旬空</li><li>奇门:20 个时辰 × 9 宫,核四柱 / 局数 / 值符 / 值使 / 星门神 / 天盘干</li></ul>
|
|
655
655
|
<h3>工程验证</h3>
|
|
656
|
-
<ul><li>测试:154 个测试文件 /
|
|
656
|
+
<ul><li>测试:154 个测试文件 / 7894 条断言;七道闸(回归 · 断言基线 · 测试可失败自检 · HTML 注入面 · 工程约定 · 产物宿主形态 · 随机扫射)</li><li>可复现:seed / asOf 显式;同一输入同一输出</li><li>口径:晚子时、真太阳时、奇门三流派、闰月归月都可切换,并有字段级差异对照</li></ul>
|
|
657
657
|
|
|
658
658
|
<h3>已知边界(不猜)</h3>
|
|
659
659
|
<ul><li>六爻应期(具体哪天应验)不做;卦例只录动爻个数,不录爻位</li><li>财富/健康只给结构判断与档位,不给金额区间、不作诊断</li><li>紫微飞星已做「单一支化逐宫追到成环」与「三方四正 16 条按落宫归堆」,但都未叠大限流年四化、不折吉凶;八字交运日已能算到日/时,但未与第三方排盘案例批量对拍</li></ul>
|
|
@@ -11509,6 +11509,9 @@ function buildSegments(list, direction, birthYear, toAge) {
|
|
|
11509
11509
|
* address?:string,longitude?:number,geo?:object}} input
|
|
11510
11510
|
*/
|
|
11511
11511
|
function buildTrend(input) {
|
|
11512
|
+
if (!input || typeof input !== 'object') {
|
|
11513
|
+
throw fail('E_INPUT', '人生 K 线需要参数对象:至少给 datetime 与 gender(大运顺逆由性别决定)');
|
|
11514
|
+
}
|
|
11512
11515
|
const gender = input.gender;
|
|
11513
11516
|
if (gender !== 'male' && gender !== 'female') {
|
|
11514
11517
|
throw fail('E_INPUT', '人生 K 线需要性别:大运顺逆由性别决定,不可缺省');
|
|
@@ -12114,8 +12117,12 @@ function buildFengshui(input) {
|
|
|
12114
12117
|
if (!Number.isInteger(fy)) throw fail('E_INPUT', `fortuneYear 必须是整数年份,收到「${input.fortuneYear}」`);
|
|
12115
12118
|
input = { ...input, fortuneYear: fy };
|
|
12116
12119
|
}
|
|
12117
|
-
|
|
12118
|
-
if (
|
|
12120
|
+
const action = input.action;
|
|
12121
|
+
if (action !== undefined && action !== null && action !== 'natal' && action !== 'advise' && action !== 'xuankong') {
|
|
12122
|
+
throw fail('E_INPUT', `风水 action 只能是 natal / advise / xuankong,收到「${String(action).slice(0, 24)}」`);
|
|
12123
|
+
}
|
|
12124
|
+
if (action === 'advise') return buildAdvise(input);
|
|
12125
|
+
if (action === 'xuankong') return buildXuankong(input);
|
|
12119
12126
|
const gender = input.gender;
|
|
12120
12127
|
if (gender !== 'male' && gender !== 'female') {
|
|
12121
12128
|
throw fail('E_INPUT', '风水命卦需要性别:男女命卦算法不同,不可缺省');
|
|
@@ -13954,6 +13961,9 @@ function buildName(input) {
|
|
|
13954
13961
|
if (!input || typeof input !== 'object') {
|
|
13955
13962
|
throw fail('E_INPUT', '起名参数不能为空:评名要 surname / givenName,起名要 surname 与性别/生日');
|
|
13956
13963
|
}
|
|
13964
|
+
if (input.action != null && input.action !== 'assess' && input.action !== 'generate') {
|
|
13965
|
+
throw fail('E_INPUT', `起名 action 只能是 assess / generate,收到「${String(input.action).slice(0, 24)}」`);
|
|
13966
|
+
}
|
|
13957
13967
|
if (input.action === 'generate') return generateNames(input);
|
|
13958
13968
|
return assessName(input);
|
|
13959
13969
|
}
|
|
@@ -14238,6 +14248,7 @@ __mods.qimen = (function () {
|
|
|
14238
14248
|
const { termInstantJd, termWindow, jdToParts, partsToJd, formatJd, ganzhiName, sexagenaryIndex, STEMS, BRANCHES } = (__mods.calendar || {});
|
|
14239
14249
|
const { solarToLunar } = (__mods.lunar || {});
|
|
14240
14250
|
const { assertCivil, assertShifted } = (__mods.validate || {});
|
|
14251
|
+
const { fail } = (__mods.fail || {});
|
|
14241
14252
|
const { ganyingOf, LIUYI_RU_MU } = (__mods['qimen-ganying'] || {});
|
|
14242
14253
|
|
|
14243
14254
|
const TIAN_GAN = ['甲', '乙', '丙', '丁', '戊', '己', '庚', '辛', '壬', '癸'];
|
|
@@ -14277,7 +14288,11 @@ const indexOfGz = (gz) => {
|
|
|
14277
14288
|
};
|
|
14278
14289
|
|
|
14279
14290
|
/** 由公历时刻构建快照(本地民用时间轴) */
|
|
14280
|
-
function buildSnapshot(
|
|
14291
|
+
function buildSnapshot(input) {
|
|
14292
|
+
if (!input || typeof input !== 'object') {
|
|
14293
|
+
throw fail('E_INPUT', '奇门排盘参数不能为空:至少给 year / month / day / hour');
|
|
14294
|
+
}
|
|
14295
|
+
const { year, month, day, hour, minute, lateZiHourMode = 'same-day' } = input;
|
|
14281
14296
|
assertCivil({ year, month, day, hour, minute });
|
|
14282
14297
|
const jd = partsToJd({ year, month, day, hour, minute });
|
|
14283
14298
|
|
|
@@ -14683,6 +14698,9 @@ const findGong = (obj, val) =>
|
|
|
14683
14698
|
|
|
14684
14699
|
/** 排盘主函数 */
|
|
14685
14700
|
function buildQimen(input) {
|
|
14701
|
+
if (!input || typeof input !== 'object') {
|
|
14702
|
+
throw fail('E_INPUT', '奇门排盘参数不能为空:至少给 year / month / day / hour');
|
|
14703
|
+
}
|
|
14686
14704
|
// snapshot 是内部快照路径(已由 buildSnapshot 校验过),不必重复校验
|
|
14687
14705
|
if (!input.snapshot) assertCivil(input);
|
|
14688
14706
|
const snapshot = input.snapshot || buildSnapshot(input);
|
|
@@ -15712,7 +15730,7 @@ return { ZHIXING, ZHIXING_YI, ZHIXING_JI, SHENGXIAO, hourToBranch, zhixingOf, lu
|
|
|
15712
15730
|
__mods.star = (function () {
|
|
15713
15731
|
// 星座档案 + 当日娱乐向基调:纯本地确定性(同一天同一星座结果永远一致)。
|
|
15714
15732
|
// 星座按太阳过宫的通行日期区间(公历);当日基调由日期哈希生成,不是随机数。
|
|
15715
|
-
const { daysInMonth } = (__mods.validate || {});
|
|
15733
|
+
const { MAX_YEAR, MIN_YEAR, daysInMonth } = (__mods.validate || {});
|
|
15716
15734
|
const { fail } = (__mods.fail || {});
|
|
15717
15735
|
|
|
15718
15736
|
/** 12 星座(区间含起止日;摩羯跨年由两端分别匹配)。 */
|
|
@@ -15763,8 +15781,8 @@ const TONE_TEXT = {
|
|
|
15763
15781
|
function buildStar(input) {
|
|
15764
15782
|
const { year, month, day } = input || {};
|
|
15765
15783
|
if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(day)
|
|
15766
|
-
|| year <
|
|
15767
|
-
throw fail('E_INPUT',
|
|
15784
|
+
|| year < MIN_YEAR || year > MAX_YEAR || month < 1 || month > 12 || day < 1 || day > daysInMonth(year, month)) {
|
|
15785
|
+
throw fail('E_INPUT', `星座需要真实存在的公历日期(year ${MIN_YEAR}–${MAX_YEAR}、month、day)——请向用户询问`);
|
|
15768
15786
|
}
|
|
15769
15787
|
const sign = signOfDate(month, day);
|
|
15770
15788
|
if (!sign) throw fail('E_INPUT', `无法识别星座:${year}-${month}-${day}`);
|
|
@@ -15800,7 +15818,7 @@ return { SIGNS, signOfDate, buildStar };
|
|
|
15800
15818
|
__mods.numerology = (function () {
|
|
15801
15819
|
// 生命数字(西方数字学):生命路径数 / 生日数 / 态度数,11、22、33 主数保留。
|
|
15802
15820
|
// 纯本地确定性;与八字/紫微是两套不可互证的体系,输出里明确提示。
|
|
15803
|
-
const { daysInMonth } = (__mods.validate || {});
|
|
15821
|
+
const { MAX_YEAR, MIN_YEAR, daysInMonth } = (__mods.validate || {});
|
|
15804
15822
|
const { fail } = (__mods.fail || {});
|
|
15805
15823
|
|
|
15806
15824
|
/** 1–9 与主数 11/22/33 的数义(白话提炼)。 */
|
|
@@ -15838,8 +15856,8 @@ const digitSum = (n) => String(Math.abs(Math.trunc(n))).split('').reduce((s, c)
|
|
|
15838
15856
|
function buildNumerology(input) {
|
|
15839
15857
|
const { year, month, day } = input || {};
|
|
15840
15858
|
if (!Number.isInteger(year) || !Number.isInteger(month) || !Number.isInteger(day)
|
|
15841
|
-
|| year <
|
|
15842
|
-
throw fail('E_INPUT',
|
|
15859
|
+
|| year < MIN_YEAR || year > MAX_YEAR || month < 1 || month > 12 || day < 1 || day > daysInMonth(year, month)) {
|
|
15860
|
+
throw fail('E_INPUT', `生命数字需要真实存在的公历出生日期(year ${MIN_YEAR}–${MAX_YEAR}、month、day)——请向用户询问,勿猜`);
|
|
15843
15861
|
}
|
|
15844
15862
|
const lifePath = reduceNumber(digitSum(year) + digitSum(month) + digitSum(day));
|
|
15845
15863
|
const birthday = reduceNumber(day);
|
|
@@ -16218,6 +16236,7 @@ function strengthOf(pct, answered) {
|
|
|
16218
16236
|
* 维度净分 > 0 取左字母,< 0 取右字母,= 0 按维度表的 tie 取(并标「临界」)。
|
|
16219
16237
|
*/
|
|
16220
16238
|
function buildMbti(input = {}) {
|
|
16239
|
+
input = input && typeof input === 'object' ? input : {};
|
|
16221
16240
|
const answers = normalizeAnswers(input.answers);
|
|
16222
16241
|
const answeredAll = answers.filter((v) => v !== null).length;
|
|
16223
16242
|
if (answeredAll < 12) {
|
|
@@ -26483,6 +26502,9 @@ function computeRaw(args = {}) {
|
|
|
26483
26502
|
};
|
|
26484
26503
|
}
|
|
26485
26504
|
if (system === 'fengshui') {
|
|
26505
|
+
if (args.action != null && !['natal', 'advise', 'xuankong'].includes(args.action)) {
|
|
26506
|
+
throw fail('E_INPUT', `风水 action 只能是 natal / advise / xuankong,收到「${String(args.action).slice(0, 24)}」`);
|
|
26507
|
+
}
|
|
26486
26508
|
const action = args.action === 'advise' ? 'advise' : args.action === 'xuankong' ? 'xuankong' : 'natal';
|
|
26487
26509
|
if (action === 'xuankong') {
|
|
26488
26510
|
const result = buildFengshui({
|
|
@@ -26523,6 +26545,9 @@ function computeRaw(args = {}) {
|
|
|
26523
26545
|
return { ...result, summary: fengshuiText(result) };
|
|
26524
26546
|
}
|
|
26525
26547
|
if (system === 'name') {
|
|
26548
|
+
if (args.action != null && !['assess', 'generate'].includes(args.action)) {
|
|
26549
|
+
throw fail('E_INPUT', `起名 action 只能是 assess / generate,收到「${String(args.action).slice(0, 24)}」`);
|
|
26550
|
+
}
|
|
26526
26551
|
const action = args.action === 'generate' ? 'generate' : 'assess';
|
|
26527
26552
|
const birth = args.datetime
|
|
26528
26553
|
? parseDateTime(args.datetime)
|
|
@@ -26937,7 +26962,7 @@ return { interpret, DIRECTIONS, DIRECTION_DEFAULT, BRIGHTNESS, flowOf, parseDate
|
|
|
26937
26962
|
})();
|
|
26938
26963
|
|
|
26939
26964
|
window.Engine = __mods.index;
|
|
26940
|
-
window.__MP_VER = "0.62.
|
|
26965
|
+
window.__MP_VER = "0.62.1";
|
|
26941
26966
|
</script>
|
|
26942
26967
|
<script>
|
|
26943
26968
|
// 两个 UI 共用的表单规则:宿主面板(src/app.js)与独立页(src/web-ui.js)。
|