dsh-metaphysics 0.58.0 → 0.59.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 +1378 -1204
- package/README.md +430 -384
- package/client.almanac.js +58 -54
- package/client.bazi.js +116 -104
- package/client.chenggu.js +58 -54
- package/client.convert.js +57 -53
- package/client.daliuren.js +121 -100
- package/client.fengshui.js +62 -58
- package/client.hepan.js +115 -103
- package/client.js +403 -323
- package/client.liuyao.js +124 -103
- package/client.mbti.js +59 -55
- package/client.name.js +64 -60
- package/client.numerology.js +65 -61
- package/client.qimen.js +124 -103
- package/client.star.js +60 -56
- package/client.tarot.js +120 -99
- package/client.trend.js +113 -101
- package/client.xiaoliuren.js +78 -65
- package/client.zeri.js +59 -55
- package/client.ziwei.js +111 -99
- package/engine/bazi.js +800 -740
- package/engine/citations.js +52 -3
- package/engine/diff.js +3 -0
- package/engine/event-prompt.js +238 -0
- package/engine/geju.js +548 -547
- package/engine/guide.js +53 -0
- package/engine/index.js +1799 -1727
- package/engine/interpret-knowledge.js +17 -6
- package/engine/interpret.js +1907 -1889
- package/engine/limits.js +123 -0
- package/engine/liuyao.js +4 -0
- package/engine/plain-summary.js +604 -0
- package/engine/qimen-prompt.js +303 -0
- package/engine/rectify.js +2 -1
- package/engine/trend.js +3 -0
- package/engine/yingqi.js +208 -0
- package/index.js +5 -0
- package/package.json +128 -116
- package//345/221/275/347/220/206/346/216/222/347/233/230.html +13073 -11267
package/client.fengshui.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
window.__ModuleLoader__.load({id:"dsh-metaphysics",chunk:"client.fengshui.js",factory(
|
|
2
|
-
`);const
|
|
3
|
-
`)}const U=(o,r,c,u,S,M)=>({key:o,title:r,short:c,read:A=>{const oe=A[o]!==void 0?A[o]:A.schools&&A.schools[o];return M[oe]?oe:u},alt:A=>A===S?u:S,label:A=>M[A]||A}),te={bazi:[{key:"lateZi",title:"晚子时:23:00 后是否换日",short:"晚子时",read:o=>o.lateZi!==!1,alt:o=>!o,label:o=>o?"换日":"不换日"},{key:"trueSolar",title:"真太阳时:是否按出生地经度修正",short:"真太阳时",read:o=>o.trueSolar!==!1,alt:o=>!o,label:o=>o?"修正":"不修正"}],ziwei:[{key:"leapMonth",title:"闰月归月:按日切分 / 整月归次月",short:"闰月归月",read:o=>o.leapMonth==="next"||o.leapMonth==="prev"?o.leapMonth:"split",alt:o=>o==="split"?"next":"split",label:o=>({split:"按日切分",next:"整月归次月",prev:"整月归本月"})[o]||o},{key:"trueSolar",title:"真太阳时:是否按出生地经度修正",short:"真太阳时",read:o=>o.trueSolar!==!1,alt:o=>!o,label:o=>o?"修正":"不修正"},U("brightnessSchool","亮度表:默认 / QS 七档","亮度表","default","QS",{default:"默认",QS:"QS(七档)",XD1:"XD1(七档)",ZZ:"ZZ(五档)",XD2:"XD2(五档)"}),U("gengYearSihua","庚干四化:阳武阴同 / 同科阴忌","庚干四化","GYWYT","GYWTY",{GYWYT:"阳武阴同",GYWTY:"同科阴忌",GYWFT:"府科同忌",GYWFX:"府科相忌",GYWTX:"同科相忌"}),U("tianmaSchool","天马:按年支 / 按生月","天马","year-branch","month-branch",{"year-branch":"年支","month-branch":"生月"}),U("tiankongSchool","天空:不排 / 年支顺行","天空","off","normal",{off:"不排",normal:"年支顺行","shun-jia-shi":"加生时"}),U("jiekongSchool","截空旬空:不排 / 正副双星","截空旬空","off","double",{off:"不排",single:"单星",double:"正副双星",zhanyan:"占验派"}),U("kuiyueSchool","魁钺:qs1 / qs2","魁钺","qs1","qs2",{qs1:"qs1",qs2:"qs2","zhong-yiming":"中一鸣",network:"网络"}),U("tianshiTianshang","天伤天使:常规 / 中州互换","天伤天使","normal","zhongzhou",{normal:"常规",zhongzhou:"中州(阴男阳女互换)"}),U("changshengSchool","长生:阴阳顺逆 / 火土起寅","长生","yin-yang-shun-ni","huo-tu",{"yin-yang-shun-ni":"阴阳顺逆","shui-tu":"水二","huo-tu":"火土(土五局起寅)"}),U("lateZishi","晚子时:归当日 / 归次日","晚子时","current-day","next-day",{"current-day":"归当日","next-day":"归次日","all-current":"全归当日","day-cur-time-next":"日归当日·时归次日"}),U("shenzhuSchool","身主:子午皆火星 / 子铃午火","身主","common","verse",{common:"子午皆火星",verse:"子铃午火(安身主诀逐字)"})],qimen:[{key:"juMethod",title:"取局流派:拆补 / 超神接气 / 置闰",short:"取局流派",read:o=>["chaibu","chaoshen","zhirun"].includes(o.juMethod)?o.juMethod:"chaibu",alt:o=>o==="chaibu"?"zhirun":"chaibu",label:o=>({chaibu:"拆补法",chaoshen:"超神接气",zhirun:"置闰法"})[o]||o},{key:"lateZiHourMode",title:"晚子时:23:00 后归当日 / 次日",short:"晚子时归日",read:o=>o.lateZiHourMode==="next-day"?"next-day":"same-day",alt:o=>o==="next-day"?"same-day":"next-day",label:o=>o==="next-day"?"归次日":"归当日"}]},y={bazi:[{path:"pillars.day.ganzhi",label:"日柱"},{path:"pillars.hour.ganzhi",label:"时柱"},{path:"strength.level",label:"旺衰"},{path:"frame.primaryName",label:"格局"},{path:"frame.yongshen.favor",label:"喜用"},{path:"dayun.jiao.at",label:"起运"}],ziwei:[{path:"soul.ganzhi",label:"命宫"},{path:"body.branch",label:"身宫支"},{path:"bureau.name",label:"五行局"},{path:"bodyMaster",label:"身主"},{path:"daxianList.0.ages",label:"起大限"}],qimen:[{path:"siZhu.day",label:"日柱"},{path:"ju",label:"局数"},{path:"zhiFu.star",label:"值符"},{path:"zhiShi.gate",label:"值使"}]};function N(o,r){let c=o;for(const u of String(r).split(".")){if(c==null)return;c=c[u]}return c}function l(o){return o==null?"—":Array.isArray(o)?o.join("、"):typeof o=="object"?"—":String(o)}function f(o,r,c){return(y[o]||[]).map(S=>{const M=l(N(r,S.path)),A=l(N(c,S.path));return{key:S.path,label:S.label,current:M,alt:A,changed:M!==A}})}return{diffObjects:H,labelOf:b,categoryOf:G,rootOf:h,sortDiffs:m,summarize:g,formatValue:p,renderDiff:C,CALIBER_SWITCHES:te,CALIBER_VIEWS:y,viewCell:l,viewRows:f}})(),_.fingerprint=(function(){const R="0123456789ABCDEFGHJKMNPQRSTVWXYZ";function q(T){return JSON.stringify(H(T))}function H(T){if(T===null)return null;const b=typeof T;if(b==="string")return typeof T.normalize=="function"?T.normalize("NFC"):T;if(b==="number")return Number.isFinite(T)?Object.is(T,-0)?0:T:null;if(b==="boolean")return T;if(Array.isArray(T))return T.map(H);if(b==="object"){const G={};for(const h of Object.keys(T).sort()){const m=T[h];m===void 0||typeof m=="function"||typeof m=="symbol"||(G[h]=H(m))}return G}return null}function v(T){const b=String(T);let G=2166136261,h=2654435769;for(let p=0;p<b.length;p+=1){const C=b.charCodeAt(p);for(const U of[C&255,C>>>8])G=Math.imul(G^U,16777619),h=Math.imul(h^U,2246822507)}let m=(G>>>0)*8+(h>>>29),g="";for(let p=0;p<7;p+=1)g=R[m%32]+g,m=Math.floor(m/32);return g}function L(T={}){const b=String(T.system||""),G=String(T.version||"dev"),h=T.seed===void 0||T.seed===null||T.seed===""?null:Number(T.seed),m=T.asOf?String(T.asOf):null,g=T.params&&typeof T.params=="object"?T.params:{},p=q({system:b,params:g,seed:h,asOf:m}),C=q({base:p,version:G});return{id:`LY-${v(C)}`,baseId:`LY-${v(p)}`,version:G,system:b,payload:p}}return{canonicalJson:q,shortHash:v,fingerprintOf:L}})(),_.validate=(function(){const{fail:R}=_.fail||{},q=1600,H=2400;function v(h){return h%4===0&&h%100!==0||h%400===0}function L(h,m){return m===2?v(h)?29:28:[31,28,31,30,31,30,31,31,30,31,30,31][m-1]||0}const T=h=>typeof h=="string"?`「${h}」`:String(h),b="引擎只接受解析好的公历字段 { year, month, day, hour?, minute? };字符串请先交给宿主层的 parseDateTime 解析";function G(h,m=""){const g=m?`${m} 的`:"";if(!h||typeof h!="object"||Array.isArray(h)){const te=h===null?"null":Array.isArray(h)?"数组":typeof h;throw R("E_INPUT",`${g}入参必须是对象(收到 ${te});${b}`)}const p=h.hour===void 0?0:h.hour,C=h.minute===void 0?0:h.minute;for(const[te,y]of[["year",h.year],["month",h.month],["day",h.day],["hour",p],["minute",C]])if(!Number.isInteger(y))throw R("E_INPUT",`${g}${te} 必须是整数(收到 ${T(y)});${b}`);if(h.year<q||h.year>H)throw R("E_INPUT",`${g}year 超出支持范围 ${q}–${H}(收到 ${h.year});更早的年份时区与历法口径不可靠`);if(h.month<1||h.month>12)throw R("E_INPUT",`${g}month 超出范围 1–12(收到 ${h.month})`);const U=L(h.year,h.month);if(h.day<1||h.day>U)throw R("E_INPUT",`${g}日期不存在:${h.year}-${h.month}-${h.day}(${h.year} 年 ${h.month} 月只有 ${U} 天)`);if(p<0||p>23)throw R("E_INPUT",`${g}hour 超出范围 0–23(收到 ${p})`);if(C<0||C>59)throw R("E_INPUT",`${g}minute 超出范围 0–59(收到 ${C})`);return h}return{MIN_YEAR:q,MAX_YEAR:H,isLeapYear:v,daysInMonth:L,assertCivil:G}})(),_.lru=(function(){function R({max:q=64,ttlMs:H=0,name:v="lru",now:L=()=>Date.now()}={}){const T=new Map,b={name:v,hits:0,misses:0,evictions:0,expirations:0},G=h=>H>0&&L()-h.at>H;return{name:v,max:q,ttlMs:H,get(h){const m=T.get(h);if(!m||G(m)){m&&(T.delete(h),b.expirations+=1),b.misses+=1;return}return T.delete(h),T.set(h,m),b.hits+=1,m.value},set(h,m){for(T.has(h)&&T.delete(h),T.set(h,{value:m,at:L()});T.size>q;)T.delete(T.keys().next().value),b.evictions+=1;return m},has(h){const m=T.get(h);return m?G(m)?(T.delete(h),b.expirations+=1,!1):!0:!1},delete(h){return T.delete(h)},clear(){T.clear()},get size(){return T.size},stats(){const h=b.hits+b.misses;return{name:v,size:T.size,max:q,hits:b.hits,misses:b.misses,evictions:b.evictions,expirations:b.expirations,hitRate:h?b.hits/h:0}}}}return{createLru:R}})(),_.nayin=(function(){const R=["海中金","炉中火","大林木","路旁土","剑锋金","山头火","涧下水","城头土","白蜡金","杨柳木","泉中水","屋上土","霹雳火","松柏木","长流水","沙中金","山下火","平地木","壁上土","金箔金","覆灯火","天河水","大驿土","钗钏金","桑柘木","大溪水","沙中土","天上火","石榴木","大海水"];function q(H){const v=(Number(H)%60+60)%60,L=R[Math.floor(v/2)];return{name:L,element:L[2]}}return{NAYIN_NAMES:R,nayinOf:q}})(),_.sanhe=(function(){const R=[{branches:["申","子","辰"],element:"水"},{branches:["亥","卯","未"],element:"木"},{branches:["寅","午","戌"],element:"火"},{branches:["巳","酉","丑"],element:"金"}],q=Object.fromEntries(R.map(L=>[L.branches.join(""),L.element])),H=Object.fromEntries(R.flatMap(L=>L.branches.map(T=>[T,L.element])));function v(L){return R.find(T=>T.branches.includes(L))||null}return{SANHE_GROUPS:R,SANHE:q,SANHE_ELEMENT:H,sanheGroupOf:v}})(),_["vsop-earth"]=(function(){const R=[[1.75347045673,0,0],[.03341656453,4.66925680415,6283.0758499914],[.00034894275,4.62610242189,12566.1516999828],[3417572e-11,2.82886579754,3.523118349],[3497056e-11,2.74411783405,5753.3848848968],[3135899e-11,3.62767041756,77713.7714681205],[2676218e-11,4.41808345438,7860.4193924392],[2342691e-11,6.13516214446,3930.2096962196],[1273165e-11,2.03709657878,529.6909650946],[1324294e-11,.74246341673,11506.7697697936],[901854e-11,2.04505446477,26.2983197998],[1199167e-11,1.10962946234,1577.3435424478],[857223e-11,3.50849152283,398.1490034082],[779786e-11,1.17882681962,5223.6939198022],[99025e-10,5.23268072088,5884.9268465832],[753141e-11,2.53339052847,5507.5532386674],[505267e-11,4.58292599973,18849.2275499742],[492392e-11,4.20505711826,775.522611324],[356672e-11,2.91954114478,.0673103028],[284125e-11,1.89869240932,796.2980068164],[242879e-11,.34481445893,5486.777843175],[317087e-11,5.84901948512,11790.6290886588],[271112e-11,.31486255375,10977.078804699],[206217e-11,4.80646631478,2544.3144198834],[205478e-11,1.86953770281,5573.1428014331],[202318e-11,2.45767790232,6069.7767545534],[126225e-11,1.08295459501,20.7753954924],[155516e-11,.83306084617,213.299095438],[115132e-11,.64544911683,.9803210682],[102851e-11,.63599845579,4694.0029547076],[101724e-11,4.2667980198,7.1135470008],[99206e-11,6.20992926918,2146.1654164752],[132212e-11,3.41118292683,2942.4634232916],[97607e-11,.68101342359,155.4203994342],[85128e-11,1.29870764804,6275.9623029906],[74651e-11,1.755089133,5088.6288397668],[101895e-11,.97569280312,15720.8387848784],[84711e-11,3.67080093031,71430.69561812909],[73547e-11,4.67926633877,801.8209311238],[73874e-11,3.50319414955,3154.6870848956],[78757e-11,3.03697458703,12036.4607348882],[79637e-11,1.80791287082,17260.1546546904],[85803e-11,5.9832263126,161000.6857376741],[56963e-11,2.78430458592,6286.5989683404],[61148e-11,1.81839892984,7084.8967811152],[69627e-11,.83297621398,9437.762934887],[56116e-11,4.38694865354,14143.4952424306],[62449e-11,3.97763912806,8827.3902698748],[51145e-11,.28306832879,5856.4776591154],[55577e-11,3.47006059924,6279.5527316424],[41036e-11,5.36817592855,8429.2412664666],[51605e-11,1.33282739866,1748.016413067],[51992e-11,.18914947184,12139.5535091068],[49e-8,.48735014197,1194.4470102246],[392e-9,6.16833020996,10447.3878396044],[3557e-10,1.775968892,6812.766815086],[3677e-10,6.04133863162,10213.285546211],[36596e-11,2.56957481827,1059.3819301892],[33296e-11,.59310278598,17789.845619785],[35954e-11,1.70875808777,2352.8661537718],[40938e-11,2.39850938714,19651.048481098],[30047e-11,2.73975124088,1349.8674096588],[30412e-11,.44294464169,83996.84731811189],[23663e-11,.48473622521,8031.0922630584],[23574e-11,2.06528133162,3340.6124266998],[21089e-11,4.14825468851,951.7184062506],[24738e-11,.21484762138,3.5904286518],[25352e-11,3.16470891653,4690.4798363586],[22823e-11,5.22195230819,4705.7323075436],[21419e-11,1.42563910473,16730.4636895958],[21891e-11,5.55594302779,553.5694028424],[203e-9,.37133792946,283.8593188652]],q=[[6283.0758499914,0,0],[.00206058863,2.67823455808,6283.0758499914],[4303419e-11,2.63512233481,12566.1516999828],[425264e-11,1.59046982018,3.523118349],[109017e-11,2.96631010675,1577.3435424478],[93479e-11,2.59211109542,18849.2275499742],[119305e-11,5.79555765566,26.2983197998],[72121e-11,1.13840581212,529.6909650946],[67784e-11,1.87453300345,398.1490034082],[6735e-10,4.40932832004,5507.5532386674],[59045e-11,2.88815790631,5223.6939198022],[55976e-11,2.17471740035,155.4203994342],[45411e-11,.39799502896,796.2980068164],[36298e-11,.46875437227,775.522611324],[28962e-11,2.64732254645,7.1135470008],[20844e-11,5.34138275149,.9803210682]],H=[[8721859e-11,1.07253635559,6283.0758499914],[99099e-10,3.14159265359,0],[294833e-11,.43717350256,12566.1516999828],[27338e-11,.05295636147,3.523118349],[16333e-11,5.18820215724,26.2983197998],[15745e-11,3.68504712183,155.4203994342],[9425e-11,.29667114694,18849.2275499742],[8938e-11,2.05706319592,77713.7714681205],[694e-10,.82691541038,775.522611324],[5061e-11,4.6624323168,1577.3435424478]],v=[[289058e-11,5.84173149732,6283.0758499914],[20712e-11,6.0498393902,12566.1516999828],[2962e-11,5.1956057957,155.4203994342],[2527e-11,3.14159265359,0],[1288e-11,4.7219761197,3.523118349]],L=[[7714e-11,4.14117321449,6283.0758499914],[1016e-11,3.27573644241,12566.1516999828]];function T(b){let G=0;for(const[m,g,p]of R)G+=m*Math.cos(g+p*b);let h=1;for(const m of[q,H,v,L]){h*=b;for(const[g,p,C]of m)G+=g*h*Math.cos(p+C*b)}return G}return{earthL:T}})(),_.calendar=(function(){const{earthL:R}=_["vsop-earth"]||{},{createLru:q}=_.lru||{},H=["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"],v=["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"],L=["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"];function T(I){return(285+15*I)%360}function b(I,D,O){const Q=Math.floor((14-D)/12),K=I+4800-Q,re=D+12*Q-3;return O+Math.floor((153*re+2)/5)+365*K+Math.floor(K/4)-Math.floor(K/100)+Math.floor(K/400)-32045}function G(I){const D=I+32044,O=Math.floor((4*D+3)/146097),Q=D-Math.floor(146097*O/4),K=Math.floor((4*Q+3)/1461),re=Q-Math.floor(1461*K/4),he=Math.floor((5*re+2)/153);return{year:100*O+K-4800+Math.floor(he/10),month:he+3-12*Math.floor(he/10),day:re-Math.floor((153*he+2)/5)+1}}function h(I,D){for(let O=0;O<60;O++)if(O%10===I&&O%12===D)return O;return-1}function m(I){const D=(I%60+60)%60;return{index:D,stem:H[D%10],branch:v[D%12],name:H[D%10]+v[D%12]}}function g(I){return((I+49)%60+60)%60}function p(I){const D=I-2451545,O=D/36525,Q=D/365250;let K=R(Q)*180/Math.PI+180;K=(K%360+360)%360;const re=(5029.0966*O+1.11113*O*O-6e-6*O*O*O)/3600;K+=re,K-=.09033/3600;const he=(125.04452-1934.136261*O)*Math.PI/180,pe=(280.4665+36000.7698*O)*Math.PI/180,xe=(218.3165+481267.8813*O)*Math.PI/180,Ze=(-17.2*Math.sin(he)-1.32*Math.sin(2*pe)-.23*Math.sin(2*xe)+.21*Math.sin(2*he))/3600;K+=Ze;const Re=(357.52911+35999.05029*O-1537e-7*O*O)*Math.PI/180,De=.016708634-42037e-9*O-1267e-10*O*O,qe=1.000001018*(1-De*De)/(1+De*Math.cos(Re+(1.914602-.004817*O)*(Math.PI/180)*Math.sin(Re)));return K-=20.4898/3600/(qe||1),(K%360+360)%360}function C(I){const D=[[1900,-2.8],[1920,21.2],[1940,24.3],[1950,29.1],[1960,33.2],[1970,40.2],[1980,50.5],[1990,56.9],[2e3,63.8],[2010,66.1],[2020,69.4],[2030,72],[2050,80],[2100,110]];if(I<=D[0][0])return D[0][1];for(let O=1;O<D.length;O++)if(I<=D[O][0]){const[Q,K]=D[O-1],[re,he]=D[O];return K+(he-K)*(I-Q)/(re-Q)}return D[D.length-1][1]}const U=8/24,te=7.7611/24,y=2425612+4/24;function N(I){return I<y?te:U}const l=q({max:4096,name:"termInstant"}),f=1e-5,o=new Map,r=365.2422;function c(I,D){const O=T(D),Q=b(I,1,5)-.5+D*15.2184,K=o.get(D);let re=K!==void 0?K+r:Q;Math.abs(re-Q)>20&&(re=Q);for(let pe=0;pe<12;pe++){let xe=O-p(re);if(xe=((xe+180)%360+360)%360-180,re+=xe/.98564736,Math.abs(xe)<f)break}o.set(D,re);const he=re-C(I)/86400;return he+N(he)}function u(I,D){const O=I*24+D,Q=l.get(O);if(Q!==void 0)return Q;const K=c(I,D);return l.set(O,K),K}function S(I){const D=Math.floor(I+.5),O=I+.5-D,Q=Math.round(O*1440),{year:K,month:re,day:he}=G(D);return{year:K,month:re,day:he,hour:Math.floor(Q/60)%24,minute:Q%60}}function M({year:I,month:D,day:O,hour:Q=0,minute:K=0}){return b(I,D,O)-.5+(Q*60+K)/1440}function A(I,D,O){const Q=b(I,D,O)-b(I,1,1)+1,K=2*Math.PI*(Q-81)/364;return 9.87*Math.sin(2*K)-7.53*Math.cos(K)-1.5*Math.sin(K)}const oe=q({max:8,name:"termWindow"}),ie=q({max:32,name:"termYear"}),de=Array.from({length:24},(I,D)=>D),$e=de.filter(I=>I%2===0);function Ne(I,D){const O=D?`${I}|jie`:`${I}|all`,Q=ie.get(O);if(Q)return Q;if(D){const re=ie.get(`${I}|all`);if(re){const he=re.filter(pe=>pe.index%2===0);return ie.set(O,he),he}}const K=[];for(const re of D?$e:de)K.push({year:I,index:re,name:L[re],jd:u(I,re)});return K.sort((re,he)=>re.jd-he.jd),ie.set(O,K),K}function ge(I,D={}){const O=D.jieOnly===!0,Q=O?`${I}|jie`:I,K=oe.get(Q);if(K)return K;const re=[...Ne(I-1,O),...Ne(I,O),...Ne(I+1,O)];return re.sort((he,pe)=>he.jd-pe.jd),oe.set(Q,re),re}function we(I){if(typeof I!="string"||I.length<2)return[];const D=H.indexOf(I[0]),O=v.indexOf(I[1]);if(D<0||O<0)return[];const Q=h(D,O);if(Q<0)return[];const K=Math.floor(Q/10)*10;return[v[(K+10)%12],v[(K+11)%12]]}function Me(I,D){let O=null;for(const Q of I)if(Q.index%2===0)if(Q.jd<=D)O=Q;else break;return O}function Pe(I,D){for(const O of I)if(O.index%2===0&&O.jd>D)return O;return null}function _e(I){const D=S(I),O=Q=>String(Q).padStart(2,"0");return`${D.year}-${O(D.month)}-${O(D.day)} ${O(D.hour)}:${O(D.minute)}`}function ze(){return[l.stats(),ie.stats(),oe.stats()]}return{STEMS:H,BRANCHES:v,TERM_NAMES:L,termLongitude:T,toJDN:b,fromJDN:G,sexagenaryIndex:h,ganzhiName:m,dayGanzhiIndex:g,sunLongitude:p,deltaTSeconds:C,OFFSET_MODERN:U,OFFSET_BEIJING_LOCAL:te,CUTOVER_JD:y,localOffsetFor:N,termInstantJd:u,jdToParts:S,partsToJd:M,equationOfTime:A,termWindow:ge,xunKongOf:we,previousJie:Me,nextJie:Pe,formatJd:_e,cacheMetrics:ze}})(),_.lunar=(function(){const{toJDN:R,jdToParts:q,termInstantJd:H,deltaTSeconds:v,localOffsetFor:L,OFFSET_MODERN:T}=_.calendar||{},b=29.530588861,G=245155009766e-5,h=Math.PI/180;function m(N){const l=N/1236.85,f=G+b*N+15437e-8*l*l-15e-8*l*l*l+73e-11*l*l*l*l,o=1-.002516*l-74e-7*l*l,r=(2.5534+29.1053567*N-14e-7*l*l-11e-8*l*l*l)*h,c=(201.5643+385.81693528*N+.0107582*l*l+1238e-8*l*l*l-58e-9*l*l*l*l)*h,u=(160.7108+390.67050284*N-.0016118*l*l-227e-8*l*l*l+11e-9*l*l*l*l)*h,S=(124.7746-1.56375588*N+.0020672*l*l+215e-8*l*l*l)*h,M=-.4072*Math.sin(c)+.17241*o*Math.sin(r)+.01608*Math.sin(2*c)+.01039*Math.sin(2*u)+.00739*o*Math.sin(c-r)-.00514*o*Math.sin(c+r)+.00208*o*o*Math.sin(2*r)-.00111*Math.sin(c-2*u)-57e-5*Math.sin(c+2*u)+56e-5*o*Math.sin(2*c+r)-42e-5*Math.sin(3*c)+42e-5*o*Math.sin(r+2*u)+38e-5*o*Math.sin(r-2*u)-24e-5*o*Math.sin(2*c-r)-17e-5*Math.sin(S)-7e-5*Math.sin(c+2*r)+4e-5*Math.sin(2*c-2*u)+4e-5*Math.sin(3*r)+3e-5*Math.sin(c+r-2*u)+3e-5*Math.sin(2*c+2*u)-3e-5*Math.sin(c+r+2*u)+3e-5*Math.sin(c-r+2*u)-2e-5*Math.sin(c-r-2*u)-2e-5*Math.sin(3*c+r)+2e-5*Math.sin(4*c),A=f+M-v(2e3+l*100)/86400;return A+L(A)}function g(N){return Math.floor(N+.5)}function p(N){const l=N-T;return l+L(l)}function C(N){return Math.round((N+.5-G)/b)}function U(N,l,f){for(let o=N-1;o<=N+1;o++)for(let r=1;r<24;r+=2){const c=p(H(o,r)),u=g(c);if(u>=l&&u<f)return{index:r,jd:c}}return null}function te(N,l,f){const o=R(N,l,f),r=g(p(H(N,23))),c=o<r?N-1:N,u=g(p(H(c,23)));let S=C(u);for(;g(m(S))>u;)S--;for(;g(m(S+1))<=u;)S++;const M=g(p(H(c+1,23)));let A=S;for(;g(m(A+1))<=M;)A++;const oe=A-S;let ie=-1;if(oe===13)for(let ge=1;ge<=oe;ge++){const we=g(m(S+ge-1)),Me=g(m(S+ge));if(!U(c,we,Me)){ie=ge;break}}let de=11,$e=!1,Ne=g(m(S));for(let ge=1;ge<=15;ge++){const we=g(m(S+ge-1)),Me=g(m(S+ge)),Pe=U(c,we,Me),_e=ge===ie;if(o>=we&&o<Me){const ze=q(m(S+ge-1)),I=_e?(de+10)%12+1:de;return{year:c,lunarYear:$e?c+1:c,month:I,day:o-we+1,isLeap:_e,monthStart:`${ze.year}-${String(ze.month).padStart(2,"0")}-${String(ze.day).padStart(2,"0")}`,hasZhongQi:!!Pe}}_e||(de=de%12+1,de===1&&($e=!0)),Ne=Me}throw new Error(`农历换算失败:${N}-${l}-${f}`)}function y(N,l,f){return R(N,l,f)}return{SYNODIC:b,newMoonJd:m,dayNumberOf:g,solarToLunar:te,monthStartJd:y}})(),_.geo=(function(){const R=`
|
|
1
|
+
window.__ModuleLoader__.load({id:"dsh-metaphysics",chunk:"client.fengshui.js",factory(it){const C={};return C.fail=(function(){return{fail:(W,V)=>{const D=new Error(V);return D.code=W,D}}})(),C.diff=(function(){const X=new Set(["summary","interpret","castAt","asOf","precision","disclaimer","note","trueSolarText","civilText","offsetMinutes","input","jd","juMethod","juMethodNote","lateZiHourMode","leapPolicy","schools","bodyMasterSchool","bodyMasterNote","handle","handleError","revision","brief","briefError"]),W=a=>a!==null&&typeof a=="object";function V(a,c,d="",f=[]){if(a===c)return f;if(!W(a)||!W(c))return f.push({path:d||"(root)",from:a,to:c}),f;const N=new Set([...Object.keys(a),...Object.keys(c)]);for(const v of N){if(X.has(v))continue;const I=d?`${d}.${v}`:v,me=a[v],$e=c[v];W(me)&&W($e)?V(me,$e,I,f):JSON.stringify(me)!==JSON.stringify($e)&&f.push({path:I,from:me,to:$e})}return f}const D=[[/^pillars\.year\.ganzhi$/,"年柱"],[/^pillars\.month\.ganzhi$/,"月柱"],[/^pillars\.day\.ganzhi$/,"日柱"],[/^pillars\.hour\.ganzhi$/,"时柱"],[/^pillars\.\w+\.hidden/,"藏干"],[/^pillars\.\w+\.stemTenGod$/,"十神"],[/^pillars\.\w+\.kongwang/,"空亡"],[/^pillars\.\w+\.dishi$|^pillars\.\w+\.zizuo$/,"十二长生"],[/^pillars\.\w+\.nayin$/,"纳音"],[/^dayMaster\./,"日主"],[/^palaces\.(taiyuan|minggong|shengong)\./,"命身宫"],[/^palaces\.\d+\.(palace|branch|stem|ganzhi)$/,"宫位"],[/^palaces\.\d+\.stars\.\d+\.(name|brightness|type)$/,"星曜"],[/^palaces\.\d+\.shensha\./,"神煞"],[/^palaces\.\d+\.(daxian|xiaoxian)\./,"大限"],[/^palaces\.\d+\.sanfang\./,"三方四正"],[/^palaces\.\d+\./,"宫位"],[/^palaces\./,"命身宫"],[/^soul\./,"命宫"],[/^body\./,"身宫"],[/^doujun\./,"流年斗君"],[/^siZhu\.year$/,"年柱"],[/^siZhu\.month$/,"月柱"],[/^siZhu\.day$/,"日柱"],[/^siZhu\.time$/,"时柱"],[/^ju$|^juNumber$/,"局数"],[/^yuan$/,"三元"],[/^dun$/,"阴阳遁"],[/^daxian(List)?\./,"大限"],[/^fly(Chains|Composite)?\./,"飞星"],[/^pattern/,"格局"],[/^schools\./,"流派回显"],[/^dayun\.jiao\./,"起运"],[/^dayun\.toNextJieDays$/,"起运时间"],[/^dayun\.list\.(\d+)\.ganzhi$/,"大运干支"],[/^dayun\.startAge\./,"起运时间"],[/^dayun\./,"大运评分"],[/^liunian\./,"流年"],[/^jieqi\./,"节气边界"],[/^solarTime\./,"真太阳时"],[/^dayGanZhi$/,"日辰"],[/^hourZhi$/,"时支"],[/^yueJiang\./,"月将"],[/^xunKong$/,"旬空"],[/^lines\.(\d+)\./,"爻"],[/^shensha\./,"神煞"],[/^frame\./,"格局用神"],[/^strength\./,"旺衰"],[/^wuxing\./,"五行计数"],[/^relations\./,"干支关系"],[/^input\./,"输入回显"]],L=[[/^pillars\./,"四柱"],[/^shensha\./,"神煞"],[/^dayun\./,"大运"],[/^liunian\./,"流年"],[/^frame\./,"格局用神"],[/^strength\./,"旺衰"],[/^wuxing\./,"五行计数"],[/^dayMaster\./,"日主"],[/^relations\./,"干支关系"],[/^palaces\.(taiyuan|minggong|shengong)\./,"命身宫"],[/^palaces\.\d+\./,"宫位"],[/^palaces\./,"命身宫"],[/^soul\.|^body\.|^doujun\./,"命身宫"],[/^siZhu\./,"四柱"],[/^ju$|^juNumber$|^yuan$|^dun$/,"局数"],[/^daxian/,"大限"],[/^fly/,"飞星"],[/^pattern/,"格局"],[/^jieqi\./,"节气"],[/^solarTime\./,"真太阳时"],[/^input\./,"输入回显"],[/^lines\./,"爻"]],O=[[/^pillars\.(year|month|day|hour)\.ganzhi$/,"柱"],[/^palaces\.(minggong|shengong)\.ganzhi$/,"命身宫"],[/^soul\.ganzhi$/,"命宫"],[/^body\.branch$/,"身宫"],[/^siZhu\.(year|month|day|time)$/,"柱"],[/^dayun\.jiao\.at$/,"起运"],[/^dayGanZhi$/,"日辰"],[/^hourZhi$/,"时支"],[/^ju$|^juNumber$|^juName$/,"局数"],[/^dun$/,"阴阳遁"],[/^lines\.\d+\.(ganzhi|yinYang|name)$/,"爻"],[/^yueJiang\.(name|zhi)$/,"月将"]];function w(a){for(const[c,d]of D)if(c.test(a))return d;return F(a)||a}function F(a){for(const[c,d]of L)if(c.test(a))return d;return""}function y(a){for(const[c,d]of O)if(c.test(a))return d;return""}function $(a){return[...a].sort((c,d)=>c.path.localeCompare(d.path,"zh-Hans-CN",{numeric:!0}))}function S(a){if(!a.length)return"本盘不受此口径影响:所有字段一致。";const c=a.filter(v=>y(v.path)),d=[...new Set(a.map(v=>F(v.path)).filter(Boolean))],f=c.length?`根因 ${c.length} 处:`+c.slice(0,4).map(v=>`${w(v.path)} ${j(v.from)}→${j(v.to)}`).join("、")+(c.length>4?" 等":""):"无单一根因",N=d.length?`;连带影响 ${d.slice(0,6).join("、")}${d.length>6?" 等":""} ${d.length} 类,共 ${a.length} 处`:`;共 ${a.length} 处`;return f+N+"。"}const j=a=>a===void 0?"—":a===null?"null":typeof a=="string"?a:Array.isArray(a)?a.join("")||"[]":typeof a=="object"?JSON.stringify(a):String(a);function G(a,{title:c="",limit:d=12}={}){const f=[];if(c&&f.push(`【${c}】`),f.push(S(a)),!a.length)return f.join(`
|
|
2
|
+
`);const N=$(a.filter(I=>y(I.path))),v=$(a.filter(I=>!y(I.path)));if(N.length){f.push(""),f.push(" 根因(口径直接改动):");for(const I of N)f.push(` ${w(I.path).padEnd(6)} ${j(I.from)} → ${j(I.to)}`)}if(v.length){f.push(""),f.push(` 连带变化(${v.length} 处,展示前 ${Math.min(d,v.length)} 处):`);for(const I of v.slice(0,d))f.push(` ${w(I.path).padEnd(6)} ${j(I.from)} → ${j(I.to)}`);if(v.length>d){const I={};for(const me of v.slice(d)){const $e=F(me.path)||"其他";I[$e]=(I[$e]||0)+1}f.push(" 其余:"+Object.entries(I).map(([me,$e])=>`${me} ${$e} 处`).join("、"))}}return f.join(`
|
|
3
|
+
`)}const _=(a,c,d,f,N,v)=>({key:a,title:c,short:d,read:I=>{const me=I[a]!==void 0?I[a]:I.schools&&I.schools[a];return v[me]?me:f},alt:I=>I===N?f:N,label:I=>v[I]||I}),he={bazi:[{key:"lateZi",title:"晚子时:23:00 后是否换日",short:"晚子时",read:a=>a.lateZi!==!1,alt:a=>!a,label:a=>a?"换日":"不换日"},{key:"trueSolar",title:"真太阳时:是否按出生地经度修正",short:"真太阳时",read:a=>a.trueSolar!==!1,alt:a=>!a,label:a=>a?"修正":"不修正"}],ziwei:[{key:"leapMonth",title:"闰月归月:按日切分 / 整月归次月",short:"闰月归月",read:a=>a.leapMonth==="next"||a.leapMonth==="prev"?a.leapMonth:"split",alt:a=>a==="split"?"next":"split",label:a=>({split:"按日切分",next:"整月归次月",prev:"整月归本月"})[a]||a},{key:"trueSolar",title:"真太阳时:是否按出生地经度修正",short:"真太阳时",read:a=>a.trueSolar!==!1,alt:a=>!a,label:a=>a?"修正":"不修正"},_("brightnessSchool","亮度表:默认 / QS 七档","亮度表","default","QS",{default:"默认",QS:"QS(七档)",XD1:"XD1(七档)",ZZ:"ZZ(五档)",XD2:"XD2(五档)"}),_("gengYearSihua","庚干四化:阳武阴同 / 同科阴忌","庚干四化","GYWYT","GYWTY",{GYWYT:"阳武阴同",GYWTY:"同科阴忌",GYWFT:"府科同忌",GYWFX:"府科相忌",GYWTX:"同科相忌"}),_("tianmaSchool","天马:按年支 / 按生月","天马","year-branch","month-branch",{"year-branch":"年支","month-branch":"生月"}),_("tiankongSchool","天空:不排 / 年支顺行","天空","off","normal",{off:"不排",normal:"年支顺行","shun-jia-shi":"加生时"}),_("jiekongSchool","截空旬空:不排 / 正副双星","截空旬空","off","double",{off:"不排",single:"单星",double:"正副双星",zhanyan:"占验派"}),_("kuiyueSchool","魁钺:qs1 / qs2","魁钺","qs1","qs2",{qs1:"qs1",qs2:"qs2","zhong-yiming":"中一鸣",network:"网络"}),_("tianshiTianshang","天伤天使:常规 / 中州互换","天伤天使","normal","zhongzhou",{normal:"常规",zhongzhou:"中州(阴男阳女互换)"}),_("changshengSchool","长生:阴阳顺逆 / 火土起寅","长生","yin-yang-shun-ni","huo-tu",{"yin-yang-shun-ni":"阴阳顺逆","shui-tu":"水二","huo-tu":"火土(土五局起寅)"}),_("lateZishi","晚子时:归当日 / 归次日","晚子时","current-day","next-day",{"current-day":"归当日","next-day":"归次日","all-current":"全归当日","day-cur-time-next":"日归当日·时归次日"}),_("shenzhuSchool","身主:子午皆火星 / 子铃午火","身主","common","verse",{common:"子午皆火星",verse:"子铃午火(安身主诀逐字)"})],qimen:[{key:"juMethod",title:"取局流派:拆补 / 超神接气 / 置闰",short:"取局流派",read:a=>["chaibu","chaoshen","zhirun"].includes(a.juMethod)?a.juMethod:"chaibu",alt:a=>a==="chaibu"?"zhirun":"chaibu",label:a=>({chaibu:"拆补法",chaoshen:"超神接气",zhirun:"置闰法"})[a]||a},{key:"lateZiHourMode",title:"晚子时:23:00 后归当日 / 次日",short:"晚子时归日",read:a=>a.lateZiHourMode==="next-day"?"next-day":"same-day",alt:a=>a==="next-day"?"same-day":"next-day",label:a=>a==="next-day"?"归次日":"归当日"}]},g={bazi:[{path:"pillars.day.ganzhi",label:"日柱"},{path:"pillars.hour.ganzhi",label:"时柱"},{path:"strength.level",label:"旺衰"},{path:"frame.primaryName",label:"格局"},{path:"frame.yongshen.favor",label:"喜用"},{path:"dayun.jiao.at",label:"起运"}],ziwei:[{path:"soul.ganzhi",label:"命宫"},{path:"body.branch",label:"身宫支"},{path:"bureau.name",label:"五行局"},{path:"bodyMaster",label:"身主"},{path:"daxianList.0.ages",label:"起大限"}],qimen:[{path:"siZhu.day",label:"日柱"},{path:"ju",label:"局数"},{path:"zhiFu.star",label:"值符"},{path:"zhiShi.gate",label:"值使"}]};function E(a,c){let d=a;for(const f of String(c).split(".")){if(d==null)return;d=d[f]}return d}function u(a){return a==null?"—":Array.isArray(a)?a.join("、"):typeof a=="object"?"—":String(a)}function m(a,c,d){return(g[a]||[]).map(N=>{const v=u(E(c,N.path)),I=u(E(d,N.path));return{key:N.path,label:N.label,current:v,alt:I,changed:v!==I}})}return{diffObjects:V,labelOf:w,categoryOf:F,rootOf:y,sortDiffs:$,summarize:S,formatValue:j,renderDiff:G,CALIBER_SWITCHES:he,CALIBER_VIEWS:g,viewCell:u,viewRows:m}})(),C.fingerprint=(function(){const X="0123456789ABCDEFGHJKMNPQRSTVWXYZ";function W(O){return JSON.stringify(V(O))}function V(O){if(O===null)return null;const w=typeof O;if(w==="string")return typeof O.normalize=="function"?O.normalize("NFC"):O;if(w==="number")return Number.isFinite(O)?Object.is(O,-0)?0:O:null;if(w==="boolean")return O;if(Array.isArray(O))return O.map(V);if(w==="object"){const F={};for(const y of Object.keys(O).sort()){const $=O[y];$===void 0||typeof $=="function"||typeof $=="symbol"||(F[y]=V($))}return F}return null}function D(O){const w=String(O);let F=2166136261,y=2654435769;for(let j=0;j<w.length;j+=1){const G=w.charCodeAt(j);for(const _ of[G&255,G>>>8])F=Math.imul(F^_,16777619),y=Math.imul(y^_,2246822507)}let $=(F>>>0)*8+(y>>>29),S="";for(let j=0;j<7;j+=1)S=X[$%32]+S,$=Math.floor($/32);return S}function L(O={}){const w=String(O.system||""),F=String(O.version||"dev"),y=O.seed===void 0||O.seed===null||O.seed===""?null:Number(O.seed),$=O.asOf?String(O.asOf):null,S=O.params&&typeof O.params=="object"?O.params:{},j=W({system:w,params:S,seed:y,asOf:$}),G=W({base:j,version:F});return{id:`LY-${D(G)}`,baseId:`LY-${D(j)}`,version:F,system:w,payload:j}}return{canonicalJson:W,shortHash:D,fingerprintOf:L}})(),C.validate=(function(){const{fail:X}=C.fail||{},W=1600,V=2400;function D(y){return y%4===0&&y%100!==0||y%400===0}function L(y,$){return $===2?D(y)?29:28:[31,28,31,30,31,30,31,31,30,31,30,31][$-1]||0}const O=y=>typeof y=="string"?`「${y}」`:String(y),w="引擎只接受解析好的公历字段 { year, month, day, hour?, minute? };字符串请先交给宿主层的 parseDateTime 解析";function F(y,$=""){const S=$?`${$} 的`:"";if(!y||typeof y!="object"||Array.isArray(y)){const he=y===null?"null":Array.isArray(y)?"数组":typeof y;throw X("E_INPUT",`${S}入参必须是对象(收到 ${he});${w}`)}const j=y.hour===void 0?0:y.hour,G=y.minute===void 0?0:y.minute;for(const[he,g]of[["year",y.year],["month",y.month],["day",y.day],["hour",j],["minute",G]])if(!Number.isInteger(g))throw X("E_INPUT",`${S}${he} 必须是整数(收到 ${O(g)});${w}`);if(y.year<W||y.year>V)throw X("E_INPUT",`${S}year 超出支持范围 ${W}–${V}(收到 ${y.year});更早的年份时区与历法口径不可靠`);if(y.month<1||y.month>12)throw X("E_INPUT",`${S}month 超出范围 1–12(收到 ${y.month})`);const _=L(y.year,y.month);if(y.day<1||y.day>_)throw X("E_INPUT",`${S}日期不存在:${y.year}-${y.month}-${y.day}(${y.year} 年 ${y.month} 月只有 ${_} 天)`);if(j<0||j>23)throw X("E_INPUT",`${S}hour 超出范围 0–23(收到 ${j})`);if(G<0||G>59)throw X("E_INPUT",`${S}minute 超出范围 0–59(收到 ${G})`);return y}return{MIN_YEAR:W,MAX_YEAR:V,isLeapYear:D,daysInMonth:L,assertCivil:F}})(),C.lru=(function(){function X({max:W=64,ttlMs:V=0,name:D="lru",now:L=()=>Date.now()}={}){const O=new Map,w={name:D,hits:0,misses:0,evictions:0,expirations:0},F=y=>V>0&&L()-y.at>V;return{name:D,max:W,ttlMs:V,get(y){const $=O.get(y);if(!$||F($)){$&&(O.delete(y),w.expirations+=1),w.misses+=1;return}return O.delete(y),O.set(y,$),w.hits+=1,$.value},set(y,$){for(O.has(y)&&O.delete(y),O.set(y,{value:$,at:L()});O.size>W;)O.delete(O.keys().next().value),w.evictions+=1;return $},has(y){const $=O.get(y);return $?F($)?(O.delete(y),w.expirations+=1,!1):!0:!1},delete(y){return O.delete(y)},clear(){O.clear()},get size(){return O.size},stats(){const y=w.hits+w.misses;return{name:D,size:O.size,max:W,hits:w.hits,misses:w.misses,evictions:w.evictions,expirations:w.expirations,hitRate:y?w.hits/y:0}}}}return{createLru:X}})(),C.nayin=(function(){const X=["海中金","炉中火","大林木","路旁土","剑锋金","山头火","涧下水","城头土","白蜡金","杨柳木","泉中水","屋上土","霹雳火","松柏木","长流水","沙中金","山下火","平地木","壁上土","金箔金","覆灯火","天河水","大驿土","钗钏金","桑柘木","大溪水","沙中土","天上火","石榴木","大海水"];function W(V){const D=(Number(V)%60+60)%60,L=X[Math.floor(D/2)];return{name:L,element:L[2]}}return{NAYIN_NAMES:X,nayinOf:W}})(),C.sanhe=(function(){const X=[{branches:["申","子","辰"],element:"水"},{branches:["亥","卯","未"],element:"木"},{branches:["寅","午","戌"],element:"火"},{branches:["巳","酉","丑"],element:"金"}],W=Object.fromEntries(X.map(L=>[L.branches.join(""),L.element])),V=Object.fromEntries(X.flatMap(L=>L.branches.map(O=>[O,L.element])));function D(L){return X.find(O=>O.branches.includes(L))||null}return{SANHE_GROUPS:X,SANHE:W,SANHE_ELEMENT:V,sanheGroupOf:D}})(),C["vsop-earth"]=(function(){const X=[[1.75347045673,0,0],[.03341656453,4.66925680415,6283.0758499914],[.00034894275,4.62610242189,12566.1516999828],[3417572e-11,2.82886579754,3.523118349],[3497056e-11,2.74411783405,5753.3848848968],[3135899e-11,3.62767041756,77713.7714681205],[2676218e-11,4.41808345438,7860.4193924392],[2342691e-11,6.13516214446,3930.2096962196],[1273165e-11,2.03709657878,529.6909650946],[1324294e-11,.74246341673,11506.7697697936],[901854e-11,2.04505446477,26.2983197998],[1199167e-11,1.10962946234,1577.3435424478],[857223e-11,3.50849152283,398.1490034082],[779786e-11,1.17882681962,5223.6939198022],[99025e-10,5.23268072088,5884.9268465832],[753141e-11,2.53339052847,5507.5532386674],[505267e-11,4.58292599973,18849.2275499742],[492392e-11,4.20505711826,775.522611324],[356672e-11,2.91954114478,.0673103028],[284125e-11,1.89869240932,796.2980068164],[242879e-11,.34481445893,5486.777843175],[317087e-11,5.84901948512,11790.6290886588],[271112e-11,.31486255375,10977.078804699],[206217e-11,4.80646631478,2544.3144198834],[205478e-11,1.86953770281,5573.1428014331],[202318e-11,2.45767790232,6069.7767545534],[126225e-11,1.08295459501,20.7753954924],[155516e-11,.83306084617,213.299095438],[115132e-11,.64544911683,.9803210682],[102851e-11,.63599845579,4694.0029547076],[101724e-11,4.2667980198,7.1135470008],[99206e-11,6.20992926918,2146.1654164752],[132212e-11,3.41118292683,2942.4634232916],[97607e-11,.68101342359,155.4203994342],[85128e-11,1.29870764804,6275.9623029906],[74651e-11,1.755089133,5088.6288397668],[101895e-11,.97569280312,15720.8387848784],[84711e-11,3.67080093031,71430.69561812909],[73547e-11,4.67926633877,801.8209311238],[73874e-11,3.50319414955,3154.6870848956],[78757e-11,3.03697458703,12036.4607348882],[79637e-11,1.80791287082,17260.1546546904],[85803e-11,5.9832263126,161000.6857376741],[56963e-11,2.78430458592,6286.5989683404],[61148e-11,1.81839892984,7084.8967811152],[69627e-11,.83297621398,9437.762934887],[56116e-11,4.38694865354,14143.4952424306],[62449e-11,3.97763912806,8827.3902698748],[51145e-11,.28306832879,5856.4776591154],[55577e-11,3.47006059924,6279.5527316424],[41036e-11,5.36817592855,8429.2412664666],[51605e-11,1.33282739866,1748.016413067],[51992e-11,.18914947184,12139.5535091068],[49e-8,.48735014197,1194.4470102246],[392e-9,6.16833020996,10447.3878396044],[3557e-10,1.775968892,6812.766815086],[3677e-10,6.04133863162,10213.285546211],[36596e-11,2.56957481827,1059.3819301892],[33296e-11,.59310278598,17789.845619785],[35954e-11,1.70875808777,2352.8661537718],[40938e-11,2.39850938714,19651.048481098],[30047e-11,2.73975124088,1349.8674096588],[30412e-11,.44294464169,83996.84731811189],[23663e-11,.48473622521,8031.0922630584],[23574e-11,2.06528133162,3340.6124266998],[21089e-11,4.14825468851,951.7184062506],[24738e-11,.21484762138,3.5904286518],[25352e-11,3.16470891653,4690.4798363586],[22823e-11,5.22195230819,4705.7323075436],[21419e-11,1.42563910473,16730.4636895958],[21891e-11,5.55594302779,553.5694028424],[203e-9,.37133792946,283.8593188652]],W=[[6283.0758499914,0,0],[.00206058863,2.67823455808,6283.0758499914],[4303419e-11,2.63512233481,12566.1516999828],[425264e-11,1.59046982018,3.523118349],[109017e-11,2.96631010675,1577.3435424478],[93479e-11,2.59211109542,18849.2275499742],[119305e-11,5.79555765566,26.2983197998],[72121e-11,1.13840581212,529.6909650946],[67784e-11,1.87453300345,398.1490034082],[6735e-10,4.40932832004,5507.5532386674],[59045e-11,2.88815790631,5223.6939198022],[55976e-11,2.17471740035,155.4203994342],[45411e-11,.39799502896,796.2980068164],[36298e-11,.46875437227,775.522611324],[28962e-11,2.64732254645,7.1135470008],[20844e-11,5.34138275149,.9803210682]],V=[[8721859e-11,1.07253635559,6283.0758499914],[99099e-10,3.14159265359,0],[294833e-11,.43717350256,12566.1516999828],[27338e-11,.05295636147,3.523118349],[16333e-11,5.18820215724,26.2983197998],[15745e-11,3.68504712183,155.4203994342],[9425e-11,.29667114694,18849.2275499742],[8938e-11,2.05706319592,77713.7714681205],[694e-10,.82691541038,775.522611324],[5061e-11,4.6624323168,1577.3435424478]],D=[[289058e-11,5.84173149732,6283.0758499914],[20712e-11,6.0498393902,12566.1516999828],[2962e-11,5.1956057957,155.4203994342],[2527e-11,3.14159265359,0],[1288e-11,4.7219761197,3.523118349]],L=[[7714e-11,4.14117321449,6283.0758499914],[1016e-11,3.27573644241,12566.1516999828]];function O(w){let F=0;for(const[$,S,j]of X)F+=$*Math.cos(S+j*w);let y=1;for(const $ of[W,V,D,L]){y*=w;for(const[S,j,G]of $)F+=S*y*Math.cos(j+G*w)}return F}return{earthL:O}})(),C.calendar=(function(){const{earthL:X}=C["vsop-earth"]||{},{createLru:W}=C.lru||{},V=["甲","乙","丙","丁","戊","己","庚","辛","壬","癸"],D=["子","丑","寅","卯","辰","巳","午","未","申","酉","戌","亥"],L=["小寒","大寒","立春","雨水","惊蛰","春分","清明","谷雨","立夏","小满","芒种","夏至","小暑","大暑","立秋","处暑","白露","秋分","寒露","霜降","立冬","小雪","大雪","冬至"];function O(b){return(285+15*b)%360}function w(b,A,x){const J=Math.floor((14-A)/12),Z=b+4800-J,se=A+12*J-3;return x+Math.floor((153*se+2)/5)+365*Z+Math.floor(Z/4)-Math.floor(Z/100)+Math.floor(Z/400)-32045}function F(b){const A=b+32044,x=Math.floor((4*A+3)/146097),J=A-Math.floor(146097*x/4),Z=Math.floor((4*J+3)/1461),se=J-Math.floor(1461*Z/4),R=Math.floor((5*se+2)/153);return{year:100*x+Z-4800+Math.floor(R/10),month:R+3-12*Math.floor(R/10),day:se-Math.floor((153*R+2)/5)+1}}function y(b,A){for(let x=0;x<60;x++)if(x%10===b&&x%12===A)return x;return-1}function $(b){const A=(b%60+60)%60;return{index:A,stem:V[A%10],branch:D[A%12],name:V[A%10]+D[A%12]}}function S(b){return((b+49)%60+60)%60}function j(b){const A=b-2451545,x=A/36525,J=A/365250;let Z=X(J)*180/Math.PI+180;Z=(Z%360+360)%360;const se=(5029.0966*x+1.11113*x*x-6e-6*x*x*x)/3600;Z+=se,Z-=.09033/3600;const R=(125.04452-1934.136261*x)*Math.PI/180,re=(280.4665+36000.7698*x)*Math.PI/180,je=(218.3165+481267.8813*x)*Math.PI/180,Ee=(-17.2*Math.sin(R)-1.32*Math.sin(2*re)-.23*Math.sin(2*je)+.21*Math.sin(2*R))/3600;Z+=Ee;const Oe=(357.52911+35999.05029*x-1537e-7*x*x)*Math.PI/180,ee=.016708634-42037e-9*x-1267e-10*x*x,Ae=1.000001018*(1-ee*ee)/(1+ee*Math.cos(Oe+(1.914602-.004817*x)*(Math.PI/180)*Math.sin(Oe)));return Z-=20.4898/3600/(Ae||1),(Z%360+360)%360}function G(b){const A=[[1900,-2.8],[1920,21.2],[1940,24.3],[1950,29.1],[1960,33.2],[1970,40.2],[1980,50.5],[1990,56.9],[2e3,63.8],[2010,66.1],[2020,69.4],[2030,72],[2050,80],[2100,110]];if(b<=A[0][0])return A[0][1];for(let x=1;x<A.length;x++)if(b<=A[x][0]){const[J,Z]=A[x-1],[se,R]=A[x];return Z+(R-Z)*(b-J)/(se-J)}return A[A.length-1][1]}const _=8/24,he=7.7611/24,g=2425612+4/24;function E(b){return b<g?he:_}const u=W({max:4096,name:"termInstant"}),m=1e-5,a=new Map,c=365.2422;function d(b,A){const x=O(A),J=w(b,1,5)-.5+A*15.2184,Z=a.get(A);let se=Z!==void 0?Z+c:J;Math.abs(se-J)>20&&(se=J);for(let re=0;re<12;re++){let je=x-j(se);if(je=((je+180)%360+360)%360-180,se+=je/.98564736,Math.abs(je)<m)break}a.set(A,se);const R=se-G(b)/86400;return R+E(R)}function f(b,A){const x=b*24+A,J=u.get(x);if(J!==void 0)return J;const Z=d(b,A);return u.set(x,Z),Z}function N(b){const A=Math.floor(b+.5),x=b+.5-A,J=Math.round(x*1440),{year:Z,month:se,day:R}=F(A);return{year:Z,month:se,day:R,hour:Math.floor(J/60)%24,minute:J%60}}function v({year:b,month:A,day:x,hour:J=0,minute:Z=0}){return w(b,A,x)-.5+(J*60+Z)/1440}function I(b,A,x){const J=w(b,A,x)-w(b,1,1)+1,Z=2*Math.PI*(J-81)/364;return 9.87*Math.sin(2*Z)-7.53*Math.cos(Z)-1.5*Math.sin(Z)}const me=W({max:8,name:"termWindow"}),$e=W({max:32,name:"termYear"}),Se=Array.from({length:24},(b,A)=>A),Te=Se.filter(b=>b%2===0);function ze(b,A){const x=A?`${b}|jie`:`${b}|all`,J=$e.get(x);if(J)return J;if(A){const se=$e.get(`${b}|all`);if(se){const R=se.filter(re=>re.index%2===0);return $e.set(x,R),R}}const Z=[];for(const se of A?Te:Se)Z.push({year:b,index:se,name:L[se],jd:f(b,se)});return Z.sort((se,R)=>se.jd-R.jd),$e.set(x,Z),Z}function s(b,A={}){const x=A.jieOnly===!0,J=x?`${b}|jie`:b,Z=me.get(J);if(Z)return Z;const se=[...ze(b-1,x),...ze(b,x),...ze(b+1,x)];return se.sort((R,re)=>R.jd-re.jd),me.set(J,se),se}function p(b){if(typeof b!="string"||b.length<2)return[];const A=V.indexOf(b[0]),x=D.indexOf(b[1]);if(A<0||x<0)return[];const J=y(A,x);if(J<0)return[];const Z=Math.floor(J/10)*10;return[D[(Z+10)%12],D[(Z+11)%12]]}function Y(b,A){let x=null;for(const J of b)if(J.index%2===0)if(J.jd<=A)x=J;else break;return x}function K(b,A){for(const x of b)if(x.index%2===0&&x.jd>A)return x;return null}function P(b){const A=N(b),x=J=>String(J).padStart(2,"0");return`${A.year}-${x(A.month)}-${x(A.day)} ${x(A.hour)}:${x(A.minute)}`}function B(){return[u.stats(),$e.stats(),me.stats()]}return{STEMS:V,BRANCHES:D,TERM_NAMES:L,termLongitude:O,toJDN:w,fromJDN:F,sexagenaryIndex:y,ganzhiName:$,dayGanzhiIndex:S,sunLongitude:j,deltaTSeconds:G,OFFSET_MODERN:_,OFFSET_BEIJING_LOCAL:he,CUTOVER_JD:g,localOffsetFor:E,termInstantJd:f,jdToParts:N,partsToJd:v,equationOfTime:I,termWindow:s,xunKongOf:p,previousJie:Y,nextJie:K,formatJd:P,cacheMetrics:B}})(),C.lunar=(function(){const{toJDN:X,jdToParts:W,termInstantJd:V,deltaTSeconds:D,localOffsetFor:L,OFFSET_MODERN:O}=C.calendar||{},w=29.530588861,F=245155009766e-5,y=Math.PI/180;function $(E){const u=E/1236.85,m=F+w*E+15437e-8*u*u-15e-8*u*u*u+73e-11*u*u*u*u,a=1-.002516*u-74e-7*u*u,c=(2.5534+29.1053567*E-14e-7*u*u-11e-8*u*u*u)*y,d=(201.5643+385.81693528*E+.0107582*u*u+1238e-8*u*u*u-58e-9*u*u*u*u)*y,f=(160.7108+390.67050284*E-.0016118*u*u-227e-8*u*u*u+11e-9*u*u*u*u)*y,N=(124.7746-1.56375588*E+.0020672*u*u+215e-8*u*u*u)*y,v=-.4072*Math.sin(d)+.17241*a*Math.sin(c)+.01608*Math.sin(2*d)+.01039*Math.sin(2*f)+.00739*a*Math.sin(d-c)-.00514*a*Math.sin(d+c)+.00208*a*a*Math.sin(2*c)-.00111*Math.sin(d-2*f)-57e-5*Math.sin(d+2*f)+56e-5*a*Math.sin(2*d+c)-42e-5*Math.sin(3*d)+42e-5*a*Math.sin(c+2*f)+38e-5*a*Math.sin(c-2*f)-24e-5*a*Math.sin(2*d-c)-17e-5*Math.sin(N)-7e-5*Math.sin(d+2*c)+4e-5*Math.sin(2*d-2*f)+4e-5*Math.sin(3*c)+3e-5*Math.sin(d+c-2*f)+3e-5*Math.sin(2*d+2*f)-3e-5*Math.sin(d+c+2*f)+3e-5*Math.sin(d-c+2*f)-2e-5*Math.sin(d-c-2*f)-2e-5*Math.sin(3*d+c)+2e-5*Math.sin(4*d),I=m+v-D(2e3+u*100)/86400;return I+L(I)}function S(E){return Math.floor(E+.5)}function j(E){const u=E-O;return u+L(u)}function G(E){return Math.round((E+.5-F)/w)}function _(E,u,m){for(let a=E-1;a<=E+1;a++)for(let c=1;c<24;c+=2){const d=j(V(a,c)),f=S(d);if(f>=u&&f<m)return{index:c,jd:d}}return null}function he(E,u,m){const a=X(E,u,m),c=S(j(V(E,23))),d=a<c?E-1:E,f=S(j(V(d,23)));let N=G(f);for(;S($(N))>f;)N--;for(;S($(N+1))<=f;)N++;const v=S(j(V(d+1,23)));let I=N;for(;S($(I+1))<=v;)I++;const me=I-N;let $e=-1;if(me===13)for(let s=1;s<=me;s++){const p=S($(N+s-1)),Y=S($(N+s));if(!_(d,p,Y)){$e=s;break}}let Se=11,Te=!1,ze=S($(N));for(let s=1;s<=15;s++){const p=S($(N+s-1)),Y=S($(N+s)),K=_(d,p,Y),P=s===$e;if(a>=p&&a<Y){const B=W($(N+s-1)),b=P?(Se+10)%12+1:Se;return{year:d,lunarYear:Te?d+1:d,month:b,day:a-p+1,isLeap:P,monthStart:`${B.year}-${String(B.month).padStart(2,"0")}-${String(B.day).padStart(2,"0")}`,hasZhongQi:!!K}}P||(Se=Se%12+1,Se===1&&(Te=!0)),ze=Y}throw new Error(`农历换算失败:${E}-${u}-${m}`)}function g(E,u,m){return X(E,u,m)}return{SYNODIC:w,newMoonJd:$,dayNumberOf:S,solarToLunar:he,monthStartJd:g}})(),C.geo=(function(){const X=`
|
|
4
4
|
北京 116.41 39.90;上海 121.47 31.23;天津 117.20 39.13;重庆 106.55 29.56
|
|
5
5
|
广州 113.26 23.13;深圳 114.06 22.55;珠海 113.58 22.27;东莞 113.75 23.02;佛山 113.12 23.02
|
|
6
6
|
汕头 116.68 23.35;中山 113.39 22.52;惠州 114.42 23.11;江门 113.08 22.58;湛江 110.36 21.27
|
|
@@ -63,71 +63,75 @@ window.__ModuleLoader__.load({id:"dsh-metaphysics",chunk:"client.fengshui.js",fa
|
|
|
63
63
|
贵港 109.60 23.11;贺州 111.57 24.40;来宾 109.23 23.75;崇左 107.36 22.40
|
|
64
64
|
海口 110.20 20.04;三亚 109.51 18.25;儋州 109.58 19.52;琼海 110.47 19.26
|
|
65
65
|
香港 114.17 22.32;澳门 113.55 22.20;台北 121.52 25.03;高雄 120.31 22.63;台中 120.68 24.14
|
|
66
|
-
`,
|
|
67
|
-
`))for(const C of p.split(";")){const U=C.trim().split(/\s+/);if(U.length!==3)continue;const[te,y,N]=U;g[te]={lon:Number(y),lat:Number(N)}}for(const[p,[C,U]]of Object.entries(H))g[p]||(g[p]={lon:C,lat:U});return g})(),L=/(省|市|地区|盟|自治州|自治县|自治区|特别行政区|县|区|镇|乡|街道|村|小区|社区)/g;function T(g){const p=String(g||"").trim();if(!p)return null;const C=Number(p);if(Number.isFinite(C)&&/^-?\d+(\.\d+)?$/.test(p)&&C>=60&&C<=150)return{lon:C,lat:null,matched:`${C}°E`,level:"经度",note:"按你输入的经度计算"};const U=p.replace(/\s/g,"").replace(L,""),te=Object.keys(v).sort((N,l)=>l.length-N.length);for(const N of te)if(U.includes(N)){const l=v[N];return{lon:l.lon,lat:l.lat,matched:N,level:"地级市",note:`按 ${N} 估算(约 ${l.lon}°E)`}}const y=p.replace(/\s/g,"");for(const[N,l]of Object.entries(q)){const f=y.indexOf(N);if(f<0)continue;const o=y.charAt(f+N.length);if(o==="区"||o==="县")continue;const r=v[l]||{lon:H[l][0],lat:H[l][1]};return{lon:r.lon,lat:r.lat,matched:l,level:"省会",note:`未匹配到具体城市,按 ${N} 省会 ${l} 估算(约 ${r.lon}°E)`}}return{lon:null,lat:null,matched:null,level:"未匹配",note:`没查到「${p}」,可改填经度(如 116.4)`}}const b=/(区|县|镇|乡|村|小区|街道|路|号|巷|弄|组|队)/,G="dsh-metaphysics/0.23.0 (+https://github.com/xuanfu-web/dsh-metaphysics)";async function h(g,{timeoutMs:p=2500}={}){if(typeof fetch!="function")return null;let C=null;try{const U=typeof AbortController=="function"?new AbortController:null;U&&(C=setTimeout(()=>U.abort(),p));const te="https://nominatim.openstreetmap.org/search?format=jsonv2&limit=1&accept-language=zh-CN&countrycodes=cn&q="+encodeURIComponent(g),y=await fetch(te,{signal:U?U.signal:void 0,headers:{"User-Agent":G}});if(!y||!y.ok)return null;const N=await y.json();if(!Array.isArray(N)||N.length===0)return null;const l=N[0],f=Number(l.lon),o=Number(l.lat);return Number.isFinite(f)?{lon:f,lat:o,matched:l.display_name,level:"在线",note:`在线解析:${l.display_name}`}:null}catch{return null}finally{C&&clearTimeout(C)}}async function m(g,p={}){const C=T(g),U=String(g||"").trim();if(!U||!(p.online===!0)||C&&typeof C.lon=="number"&&!b.test(U))return C;const y=await h(U,p);return y?{...y,local:C&&C.lon!=null?C:null}:C&&typeof C.lon=="number"?{...C,onlineFailed:!0,note:`${C.note}(联网解析失败或超时,已退回内置坐标表)`}:{...C,onlineFailed:!0}}return{CITIES:v,PROVINCES:q,resolveAddress:T,geocodeAddress:m}})(),_.random=(function(){function R(v){let L=Number(v)>>>0;return L||(L=2654435769),function(){L=L+1831565813>>>0;let b=L;return b=Math.imul(b^b>>>15,b|1),b^=b+Math.imul(b^b>>>7,b|61),((b^b>>>14)>>>0)/4294967296}}function q(v){if(v==null||v==="")return Math.random;const L=Number(v);return Number.isFinite(L)?R(L):Math.random}function H(v){return v==null||v===""?!0:Number.isFinite(Number(v))}return{mulberry32:R,randomOf:q,isSeed:H}})(),_.dst=(function(){const{daysInMonth:R}=_.validate||{},q={1986:["1986-05-04","1986-09-14"],1987:["1987-04-12","1987-09-13"],1988:["1988-04-10","1988-09-11"],1989:["1989-04-16","1989-09-17"],1990:["1990-04-15","1990-09-16"],1991:["1991-04-14","1991-09-15"]},H=(b,G,h)=>b*1e4+G*100+h;function v(b){const G=q[b.year];if(!G)return!1;const[h,m,g]=G[0].split("-").map(Number),[p,C,U]=G[1].split("-").map(Number),te=H(b.year,b.month,b.day);if(te<H(h,m,g)||te>H(p,C,U))return!1;const y=b.hour*60+(b.minute||0);return!(te===H(h,m,g)&&y<120||te===H(p,C,U)&&y>=120)}function L(b){const G=b.minute||0;if(!v(b))return{year:b.year,month:b.month,day:b.day,hour:b.hour,minute:G,applied:!1,note:null};let{year:h,month:m,day:g,hour:p}=b;return p-=1,p<0&&(p+=24,g-=1,g<1&&(m-=1,m<1&&(m=12,h-=1),g=R(h,m))),{year:h,month:m,day:g,hour:p,minute:G,applied:!0,note:`检出自 ${q[b.year][0]} 至 ${q[b.year][1]} 的中国夏令时:出生钟面时间已减 1 小时校正`}}function T(b,G){const h=Array.isArray(b)?b.slice():[];return G&&G.applied&&G.note&&h.push(G.note),h}return{DST_SPANS:q,inDstSpan:v,applyDst:L,withDstNote:T}})(),_.fengshui=(function(){const{partsToJd:R,termInstantJd:q,toJDN:H,dayGanzhiIndex:v,ganzhiName:L,termWindow:T,previousJie:b,BRANCHES:G}=_.calendar||{},{applyDst:h}=_.dst||{},{fail:m}=_.fail||{},g={1:{name:"一白",color:"白",element:"水",star:"贪狼",lucky:!0},2:{name:"二黑",color:"黑",element:"土",star:"巨门",lucky:!1},3:{name:"三碧",color:"碧",element:"木",star:"禄存",lucky:!1},4:{name:"四绿",color:"绿",element:"木",star:"文曲",lucky:!0},5:{name:"五黄",color:"黄",element:"土",star:"廉贞",lucky:!1},6:{name:"六白",color:"白",element:"金",star:"武曲",lucky:!0},7:{name:"七赤",color:"赤",element:"金",star:"破军",lucky:!1},8:{name:"八白",color:"白",element:"土",star:"左辅",lucky:!0},9:{name:"九紫",color:"紫",element:"火",star:"右弼",lucky:!0}},p={坎:"正北",艮:"东北",震:"正东",巽:"东南",离:"正南",坤:"西南",兑:"正西",乾:"西北"},C=["坎","艮","震","巽","离","坤","兑","乾"],U={乾:["六煞","天医","五鬼","祸害","绝命","延年","生气"],坎:["五鬼","天医","生气","延年","绝命","祸害","六煞"],艮:["六煞","绝命","祸害","生气","延年","天医","五鬼"],震:["延年","生气","祸害","绝命","五鬼","天医","六煞"],巽:["天医","五鬼","六煞","祸害","生气","绝命","延年"],离:["六煞","五鬼","绝命","延年","祸害","生气","天医"],坤:["天医","延年","绝命","生气","祸害","五鬼","六煞"],兑:["生气","祸害","延年","绝命","六煞","五鬼","天医"]},te=["生气","延年","天医","伏位"],y=["绝命","五鬼","六煞","祸害"],N=[{m:"壬",gua:"坎",deg:345},{m:"子",gua:"坎",deg:0},{m:"癸",gua:"坎",deg:15},{m:"丑",gua:"艮",deg:30},{m:"艮",gua:"艮",deg:45},{m:"寅",gua:"艮",deg:60},{m:"甲",gua:"震",deg:75},{m:"卯",gua:"震",deg:90},{m:"乙",gua:"震",deg:105},{m:"辰",gua:"巽",deg:120},{m:"巽",gua:"巽",deg:135},{m:"巳",gua:"巽",deg:150},{m:"丙",gua:"离",deg:165},{m:"午",gua:"离",deg:180},{m:"丁",gua:"离",deg:195},{m:"未",gua:"坤",deg:210},{m:"坤",gua:"坤",deg:225},{m:"申",gua:"坤",deg:240},{m:"庚",gua:"兑",deg:255},{m:"酉",gua:"兑",deg:270},{m:"辛",gua:"兑",deg:285},{m:"戌",gua:"乾",deg:300},{m:"乾",gua:"乾",deg:315},{m:"亥",gua:"乾",deg:330}],l=new Map(N.map((s,k)=>[s.m,k]));function f(s){const k=l.get(s);if(k===void 0)throw m("E_INPUT",`坐向必须是 24 山之一(${N.map(E=>E.m).join("")}),收到「${s}」——请按罗盘 24 山报坐或报向,不要自造方位词。`);return{...N[k],index:k}}function o(s){const E=(f(s).index+12)%24;return{...N[E],index:E}}const r=s=>["坎","离","震","巽"].includes(s)?"东四":"西四",c={生气:"大吉:最宜开门、主卧、灶口朝向",延年:"大吉:宜开门、主卧(利感情与人缘)",天医:"次吉:宜主卧、书房、老人房(利健康)",伏位:"次吉:宜卧室、神位(主平稳)",祸害:"小凶:宜厕所、储物间(宜静不宜动)",六煞:"次凶:宜厕所、储物间",五鬼:"大凶:宜厕所,或以灶坐压之(传统「火烧五鬼」说)",绝命:"最凶:宜灶坐压之、储物,忌门床"},u=["坎","坤","震","巽","中","乾","兑","艮","离"];function S(s,k){const E=(s%100+100)%100,x=s>=2e3?{male:99,female:3}:{male:100,female:4},Y=W=>{const P=(W%9+9)%9;return P===0?9:P};let F=Y(k==="male"?x.male-E:E-x.female);F===5&&(F=k==="male"?2:8);const Z=u[F-1];if(Z==="中")throw new Error("命卦计算异常:落中宫");return{num:F,gua:Z,direction:p[Z]}}function M(s){const k={伏位:{palace:s,direction:p[s]}},E=C.indexOf(s);for(let x=1;x<=7;x++){const Y=C[(E+x)%8];k[U[s][x-1]]={palace:Y,direction:p[Y]}}return k}function A(s,k,E){return R({year:s,month:k,day:E,hour:12,minute:0})<q(s,2)?s-1:s}function oe(s){const k=(1+(2026-s))%9;return k<=0?k+9:k}const ie=["坎","坤","震","巽","中","乾","兑","艮","离"],de=s=>{const k=(s%9+9)%9;return k===0?9:k};function $e(s,k=!0){const E=[];for(const x of ie){const Y=ie.indexOf(x)+1,F=de(Y-5+s),Z=g[F];E.push({palace:x,direction:x==="中"?"中宫":p[x],num:F,name:Z.name,star:Z.star,element:Z.element,lucky:Z.lucky})}return{center:s,centerName:g[s].name,forward:k,fly:k?"顺飞":"逆飞",palaces:E}}function Ne(s){return $e(oe(s),!0)}const ge={立春:1,惊蛰:2,清明:3,立夏:4,芒种:5,小暑:6,立秋:7,白露:8,寒露:9,立冬:10,大雪:11,小寒:12},we={四正:8,四墓:5,四生:2},Me={四正:1,四墓:7,四生:4},Pe={四正:9,四墓:3,四生:6},_e=s=>["子","午","卯","酉"].includes(s)?"四正":["辰","戌","丑","未"].includes(s)?"四墓":"四生",ze=s=>L(((s-4)%60+60)%60).branch;function I(s,k,E){let x=null;for(const Y of s){if(Y.jd>E)break;Y.name===k&&(x=Y)}return x}function D(s,k){const E=I(s,"冬至",k),x=I(s,"夏至",k);if(!!E&&(!x||E.jd>x.jd)){const W=I(s,"谷雨",k),P=I(s,"雨水",k);return W&&E&&W.jd>E.jd?{half:"阳遁",segment:"谷雨–夏至(下元)",offset:3,boundary:"冬至后阳遁,谷雨至上元转下元"}:P&&E&&P.jd>E.jd?{half:"阳遁",segment:"雨水–谷雨(中元)",offset:6,boundary:"冬至后阳遁,雨水至上元转中元"}:{half:"阳遁",segment:"冬至–雨水(上元)",offset:0,boundary:"冬至后阳遁上元"}}const F=I(s,"霜降",k),Z=I(s,"处暑",k);return F&&x&&F.jd>x.jd?{half:"阴遁",segment:"霜降–冬至(下元)",offset:3,boundary:"夏至后阴遁,霜降至上元转下元"}:Z&&x&&Z.jd>x.jd?{half:"阴遁",segment:"处暑–霜降(中元)",offset:6,boundary:"夏至后阴遁,处暑至上元转中元"}:{half:"阴遁",segment:"夏至–处暑(上元)",offset:0,boundary:"夏至后阴遁上元"}}function O(s){const k=Number(s.year),E=Number(s.month),x=Number(s.day),Y=Number.isInteger(s.hour)?s.hour:12,F=Number.isInteger(s.minute)?s.minute:0,Z=R({year:k,month:E,day:x,hour:Y,minute:F}),W=T(k),P=A(k,E,x),se=ze(P),ue=_e(se),fe=b(W,Z),le=ge[fe?fe.name:"立春"]||1,ce=D(W,Z),B=H(k,E,x)+(Y>=23?1:0),Se=v(B),Oe=L(Se).name,ve=L(Se).branch,ke=_e(ve),ye=Math.floor((Y+1)%24/2),Ce=oe(P),Ue=de(we[ue]-(le-1)),ne=de(Se+1+ce.offset),Te=ce.half==="阳遁"?ne:de(10-ne),fn=ce.half==="阳遁"?Me[ke]:Pe[ke],un=de(fn+(ce.half==="阳遁"?ye:-ye));return{year:{...$e(Ce,!0),basis:`${P} 年(立春界)年星 ${g[Ce].name} 入中顺飞`},month:{...$e(Ue,!0),basis:`${se}年(${ue})${fe?fe.name:"立春"}月,${le} 月 ${g[Ue].name} 入中顺飞`},day:{...$e(Te,ce.half==="阳遁"),basis:`${ce.half}·${ce.segment},${Oe}日第 ${Se+1} 位,${g[Te].name} 入中${ce.half==="阳遁"?"顺":"逆"}飞`},hour:{...$e(un,ce.half==="阳遁"),basis:`${ce.half}·${ce.segment},${ke}日 ${G[ye]}时,${g[un].name} 入中${ce.half==="阳遁"?"顺":"逆"}飞`},meta:{guaYear:P,yearBranch:se,yearGroup:ue,monthNum:le,monthJie:fe?fe.name:"立春",dayGanzhi:Oe,daySeq:Se+1,dayGroup:ke,hourBranch:G[ye],half:ce.half,segment:ce.segment,boundary:ce.boundary,note:"月按节气月(寅月为正月);日按公历日、23:00 后归次日;日/时星入中后的顺逆取「冬至顺、夏至逆」。另有「一律顺飞」与「月按农历月」派,本插件不合并,差异见本注。"}}}const Q=s=>String(s).padStart(2,"0");function K(s){const k=Math.floor((s-1864)/20),E=(k%9+9)%9+1,x=1864+20*k;return{period:E,start:x,end:x+19,label:`${E}运(${x}–${x+19})`}}const re=new Set(["乾","巽","艮","坤","甲","庚","壬","丙","寅","申","巳","亥"]),he=["地元","天元","人元"],pe={};N.forEach((s,k)=>{pe[s.m]={...s,yuan:he[k%3],yinYang:re.has(s.m)?"阳":"阴"}});const xe=["中","乾","兑","艮","离","坎","坤","震","巽"],Ze=["坎","坤","震","巽","中","乾","兑","艮","离"],Re={地元:0,天元:1,人元:2},De=s=>N.filter(k=>k.gua===s).map(k=>pe[k.m]);function qe(s,k){const E={};for(let x=0;x<9;x++){const Y=((s-1+(k?x:-x))%9+9)%9+1;E[xe[x]]=Y}return E}function Be(s,k){if(k===5)return{forward:s.yinYang==="阳",basis:`五黄入中,按${s.m}本山${s.yuan}${s.yinYang}论`};const E=Ze[k-1],x=De(E)[Re[s.yuan]];return{forward:x.yinYang==="阳",basis:`${k}${E}宫取${s.yuan}${x.m}(${x.yinYang})`}}const en="《沈氏玄空学》坤壬乙诀(子癸甲申一白、壬卯乙未坤二黑、乾亥辰巽巳戌六白、酉辛丑艮丙七赤、寅午庚丁九紫)",Ge=Object.freeze({子:1,癸:1,甲:1,申:1,壬:2,卯:2,乙:2,未:2,坤:2,乾:6,亥:6,辰:6,巽:6,巳:6,戌:6,酉:7,辛:7,丑:7,艮:7,丙:7,寅:9,午:9,庚:9,丁:9}),Ye=4.5;function Je(s,k=0){const E=Number(k)||0;if(Math.abs(E)<=Ye)return{active:!1,offset:E,threshold:Ye,sitting:s.m,jian:null,kind:null,sameYinYang:null,note:`坐山偏离中心 ${E}°,未超 ${Ye}°,按正向下卦排盘。`};const x=N.findIndex(P=>P.m===s.m),Y=N[(x+(E>0?1:-1)+24)%24],F=pe[s.m],Z=pe[Y.m],W=Y.gua===s.gua;return{active:!0,offset:E,threshold:Ye,sitting:s.m,jian:Y.m,side:E>0?"右":"左",kind:W?"同卦兼":"出卦兼",sameYinYang:Z.yinYang===F.yinYang,note:`坐山偏离中心 ${E}°,兼${Y.m}(${W?"同卦兼":"出卦兼"}${W&&Z.yinYang===F.yinYang?",同阴同阳":""});按沈氏替卦,山星以 ${Ge[s.m]} 入中。`}}const Xe={1:[],2:[["乾","巽"],["亥","巳"],["丑","未"]],3:[["卯","酉"],["乙","辛"],["辰","戌"]],4:[["艮","坤"],["寅","申"],["甲","庚"]],5:[["子","午"],["癸","丁"],["卯","酉"],["乙","辛"],["丑","未"],["辰","戌"]],6:[["艮","坤"],["寅","申"],["甲","庚"]],7:[["卯","酉"],["乙","辛"],["辰","戌"]],8:[["乾","巽"],["亥","巳"],["丑","未"]],9:[]},We=["三元九运(1864 年起一运、每运 20 年,九运 180 年一轮)","玄空下卦挨星(运盘顺飞;山盘/向盘以入中运星本宫同元龙阴阳定顺逆,五黄入中按本山阴阳)","兼向替卦:坐山偏离中心超 4.5° 用《沈氏玄空学》坤壬乙诀替星入中,顺逆按替星本宫同元龙","年月日时紫白(公式派:年逐年退一位;月按年支三组起 8/5/2;日按冬至夏至三段起 1/7/4 与 9/3/6;时按日支三组子时起 1/7/4 与 9/3/6)","二十四山旺山旺向通行表(每项含正反两向;一运、九运无局;只对正向下卦)"],nn="玄空排盘为传统通行口径的本地计算,属民俗参考,不构成现场勘舆结论,仅供娱乐;兼向超 4.5° 按沈氏替卦,年月日时紫白按公式派;各家另有异说,形峦与现场勘舆不在本工具范围内。";function tn(s,k,E,x={}){const Y=pe[k],F=pe[E],Z=Number(x.offset)||0,W=Je(Y,Z),P=qe(s,!0),se=W.active?Ge[Y.m]:P[Y.gua],ue=W.active?Ge[F.m]:P[F.gua],fe=Be(Y,se),le=Be(F,ue),ce=qe(se,fe.forward),B=qe(ue,le.forward),Se=ie.map((ne,Te)=>({palace:ne,direction:ne==="中"?"中宫":p[ne],luoshu:Te+1,yun:P[ne],shan:ce[ne],xiang:B[ne]})),Oe=ne=>ie.filter(Te=>ne[Te]===s),ve=Xe[s],ke=ve.find(([ne,Te])=>Y.m===ne&&F.m===Te||Y.m===Te&&F.m===ne),ye=ce[Y.gua]===s&&B[F.gua]===s,Ce={shan:W.active&&se!==P[Y.gua],xiang:W.active&&ue!==P[F.gua]},Ue=W.active?`替卦盘不套正向旺山旺向表;${ye?"本盘当运山星/向星仍到坐向。":"本盘当运山星/向星未同时到坐向。"}${!Ce.shan&&!Ce.xiang?"山向两替星均「用替而未替」,实际仍按原卦气。":""}`:ye&&ke?"盘面与表法一致:本局到山到向。":ye?"盘面到山到向,但不在通行表法所列之局(表法与盘面口径不同,并列不合并)。":ke?"通行表法列为旺山旺向,但本盘当运山星/向星未同时落坐向(表法与盘面口径不同,并列不合并)。":"本局既未到山到向,也不在表法旺山旺向之列。";return{palaces:Se,sitting:Y,facing:F,yun:P,shan:ce,xiang:B,yunCenter:s,jianXiang:W,shanCenter:{star:se,...fe,mode:W.active?"替卦":"下卦",original:P[Y.gua],replaced:Ce.shan},xiangCenter:{star:ue,...le,mode:W.active?"替卦":"下卦",original:P[F.gua],replaced:Ce.xiang},dangYun:{shan:Oe(ce),xiang:Oe(B)},heshi:{shan:ie.filter(ne=>ce[ne]+P[ne]===10),xiang:ie.filter(ne=>B[ne]+P[ne]===10)},wangShanWangXiang:{byChart:ye,byTable:W.active?null:!!ke,table:ve.map(([ne,Te])=>`${ne}${Te}`),note:Ue}}}function He(s){const k=s.dst===!1?{year:s.year,month:s.month,day:s.day,hour:0,minute:0,applied:!1,note:null}:h({year:s.year,month:s.month,day:s.day,hour:0,minute:0});return{year:k.year,month:k.month,day:k.day,dst:k}}const an=["大游年歌(八宅通行口径)","年家紫白飞星(纯公式:以 2026 丙午一白入中、逐年退一位、九年一轮;按立春换年)","24 山归属与度数(八宅通行口径,每山 15°)"],on="八宅与飞星为传统通行口径的本地计算,属民俗参考,不构成现场勘舆结论,仅供娱乐;实际户型以现场为准。";function sn(s){if(s.action==="advise")return Fe(s);if(s.action==="xuankong")return cn(s);const k=s.gender;if(k!=="male"&&k!=="female")throw m("E_INPUT","风水命卦需要性别:男女命卦算法不同,不可缺省");if(!Number.isInteger(s.year)||!Number.isInteger(s.month)||!Number.isInteger(s.day))throw m("E_INPUT","风水命卦需要完整出生年月日(公历)——只知道年份不够:命卦按立春界划分出生年");const E=He(s),x=A(E.year,E.month,E.day),{num:Y,gua:F,direction:Z}=S(x,k),W=M(F),P=["坎","离","震","巽"].includes(F),se=Number.isInteger(s.fortuneYear)?s.fortuneYear:null;return{system:"fengshui",meta:{birth:`${E.year}-${Q(E.month)}-${Q(E.day)}`,guaYear:x,gender:k==="male"?"男":"女",fortuneYear:se,...E.dst.applied?{dst:E.dst.note}:{},...se===null?{note:"未给流年:未算年紫白飞星(需要时补 fortuneYear)。"}:{},scope:"八宅命卦 + 大游年八星 + 年紫白;玄空飞星见 action=xuankong;不含形峦与现场勘舆。"},mingGua:{num:Y,gua:F,direction:Z,group:P?"东四命":"西四命",compatible:P?"宜东四宅(坐坎离震巽)":"宜西四宅(坐乾坤艮兑)"},luckyDirections:te.map(ue=>({star:ue,...W[ue]})),unluckyDirections:y.map(ue=>({star:ue,...W[ue]})),...se===null?{}:{yearlyFlying:Ne(se)},sources:an,disclaimer:on}}function Ke(s){const k=typeof s.sitting=="string"&&s.sitting.trim()!=="",E=typeof s.facing=="string"&&s.facing.trim()!=="";if(!k&&!E)throw m("E_INPUT","缺少坐向:sitting(坐山)或 facing(向山)至少给一个——按罗盘 24 山报坐或报向,例如「坐北朝南」对应坐子向午");if(k&&E){const F=f(s.sitting.trim()),Z=f(s.facing.trim());if((F.index+12)%24!==Z.index)throw m("E_INPUT",`坐向不自洽:坐${F.m}(${F.deg}°)与向${Z.m}(${Z.deg}°)不是对宫(相差应 180°,实测 ${(Z.deg-F.deg+360)%360}°)——请核对罗盘读数。`)}const x=k?f(s.sitting.trim()):o(s.facing.trim()),Y=N[(x.index+12)%24];return{sitting:x,facing:Y}}function Fe(s){const{sitting:k,facing:E}=Ke(s),x=k.gua,Y=M(x),F=te.map(le=>Y[le]),Z=y.map(le=>Y[le]),W=le=>`${le.direction}(${le.palace}宫)`,P=[...te,...y].map(le=>({star:le,lucky:te.includes(le),...Y[le],role:c[le]})),se={door:`门宜开于吉方:首选生气方 ${W(F[0])},次选延年方 ${W(F[1])}、天医方 ${W(F[2])}。`,stove:`灶宜「坐凶向吉」:灶身压凶方(首选绝命方 ${W(Z[0])}、五鬼方 ${W(Z[1])}),灶口朝吉方。`,bed:`主卧与床头宜安吉方:生气方 ${W(F[0])} 或延年方 ${W(F[1])};床头宜向吉方。`,toilet:`厕所宜压凶方:祸害方 ${W(Z[3])} 或六煞方 ${W(Z[2])}(污去凶气,宜静常闭)。`};let ue=null;const fe=Number.isInteger(s.year)&&Number.isInteger(s.month)&&Number.isInteger(s.day)&&(s.gender==="male"||s.gender==="female");if(fe){const le=He(s),ce=A(le.year,le.month,le.day),B=S(ce,s.gender),Se=r(B.gua),Oe=r(x),ve=Se===Oe,ke=te.map(ye=>`${ye}位${M(B.gua)[ye].direction}`).join("、");ue={birth:`${le.year}-${Q(le.month)}-${Q(le.day)}`,guaYear:ce,gender:s.gender==="male"?"男":"女",mingGua:{gua:B.gua,direction:B.direction,group:`${Se}命`},houseGua:{gua:x,group:`${Oe}宅`},sameGroup:ve,text:ve?`命宅相配(${Se}命住${Oe}宅):以宅之八星盘布局即可,个人吉方与宅吉方大体同向。`:`命宅不配(${Se}命住${Oe}宅):传统调停法——门与床以命卦吉方为先(此命四吉方:${ke}),灶仍按宅卦坐凶向吉,两盘各自取用。`}}return{system:"fengshui",meta:{action:"advise",...fe?{}:{birthNote:"未提供生辰:未做命宅配;如需按个人命卦调停门床,请补充出生年月日与性别。"},sitting:`${k.m}山(罗盘 ${k.deg}°)`,facing:`${E.m}山(罗盘 ${E.deg}°)`,houseGua:x,houseGroup:`${r(x)}宅`,scope:"门主灶厕走向按八宅通行口径给倾向,玄空飞星见 action=xuankong;不含形峦、不是现场勘舆结论。"},houseStars:P,layout:se,...ue?{mingMatch:ue}:{},sources:an,disclaimer:on}}function rn(s,k,E){const x=P=>P!=null&&P!=="",Y=(P,se)=>{if(typeof P!="number"||!Number.isFinite(P))throw m("E_INPUT",`${se} 必须是数字(度),收到「${P}」`);return P},F=(P,se,ue)=>{const fe=Y(P,ue);if(fe<0||fe>360)throw m("E_INPUT",`${ue} 必须在 0–360° 之间(罗盘度数),收到「${fe}」`);const le=(fe-se.deg+540)%360-180;if(Math.abs(le)>7.500000001)throw m("E_INPUT",`${ue} ${fe}° 不在${se.m}山范围内(${se.m}中心 ${se.deg}°,每山 15°),请核对坐向。`);return le},Z=[];if(x(s.sittingOffset)&&Z.push(Y(s.sittingOffset,"sittingOffset")),x(s.sittingDegree)&&Z.push(F(s.sittingDegree,k,"sittingDegree")),x(s.facingOffset)&&Z.push(Y(s.facingOffset,"facingOffset")),x(s.facingDegree)&&Z.push(F(s.facingDegree,E,"facingDegree")),!Z.length)return{offset:0,source:"未报兼向度数,按正向(0°)"};const W=Z[0];if(Z.some(P=>Math.abs(P-W)>1e-9))throw m("E_INPUT",`坐向兼度不一致:${Z.join("° / ")}°——坐与向应同向偏离,请只报一个偏移或核对度数。`);if(Math.abs(W)>7.5+1e-9)throw m("E_INPUT",`兼向偏移必须在 −7.5°–7.5°(相对本山中心),收到「${W}」——超过 7.5° 已进入下一山。`);return{offset:W,source:"按所报兼向度数"}}function ln(s){const k=fe=>fe!=null&&fe!=="";if(!k(s.fortuneDate))return null;if(typeof s.fortuneDate!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(s.fortuneDate))throw m("E_INPUT",`fortuneDate 需为 YYYY-MM-DD,收到「${s.fortuneDate}」`);const[E,x,Y]=s.fortuneDate.split("-").map(Number),F=new Date(Date.UTC(E,x-1,Y));if(F.getUTCFullYear()!==E||F.getUTCMonth()!==x-1||F.getUTCDate()!==Y)throw m("E_INPUT",`fortuneDate 不是有效日期:「${s.fortuneDate}」`);const Z=k(s.fortuneTime)?s.fortuneTime:"12:00";if(typeof Z!="string"||!/^\d{2}:\d{2}$/.test(Z))throw m("E_INPUT",`fortuneTime 需为 HH:MM,收到「${Z}」`);const[W,P]=Z.split(":").map(Number);if(W>23||P>59)throw m("E_INPUT",`fortuneTime 超出范围(HH:MM):「${Z}」`);const se=s.dst===!1?null:h({year:E,month:x,day:Y,hour:W,minute:P});return{at:se?{year:se.year,month:se.month,day:se.day,hour:se.hour,minute:se.minute}:{year:E,month:x,day:Y,hour:W,minute:P},dst:se}}function cn(s){const{sitting:k,facing:E}=Ke(s),x=rn(s,k,E),Y=ln(s);let F,Z=null,W;if(s.period!==void 0&&s.period!==null&&!Number.isInteger(s.period))throw m("E_INPUT",`运必须是 1–9 的整数(三元九运),收到「${s.period}」——一运 1864 起、九运 2024–2043。`);if(Number.isInteger(s.period)){if(s.period<1||s.period>9)throw m("E_INPUT",`运必须是 1–9 的整数(三元九运),收到「${s.period}」——一运 1864 起、九运 2024–2043。`);F=s.period}else Number.isInteger(s.fortuneYear)?(Z=K(s.fortuneYear),F=Z.period):Y?(Z=K(A(Y.at.year,Y.at.month,Y.at.day)),F=Z.period,W=`未显式给运:按飞星日期归入 ${Z.label}。`):(F=9,W="未给运:默认按九运(2024–2043)排盘;可传 period(1–9)或 fortuneYear 指定。");const P=tn(F,k.m,E.m,{offset:x.offset}),se=pe[k.m],ue=pe[E.m],fe=B=>({star:B.star,name:g[B.star].name,fly:B.forward?"顺飞":"逆飞",basis:B.basis,mode:B.mode,original:B.original,replaced:B.replaced}),le=B=>B.map(Se=>Se==="中"?"中宫":`${Se}宫${p[Se]}`).join("、")||"无";let ce=null;if(Y)ce=O(Y.at),Y.dst&&Y.dst.applied&&(ce.meta.dst=Y.dst.note);else if(Number.isInteger(s.fortuneYear)){const B=oe(s.fortuneYear);ce={year:{...$e(B,!0),basis:`${s.fortuneYear} 年紫白 ${g[B].name} 入中顺飞`},month:null,day:null,hour:null,meta:{guaYear:s.fortuneYear,note:"只给年份:已排年紫白;补 fortuneDate(YYYY-MM-DD)与 fortuneTime(HH:MM)可排月、日、时。"}}}return{system:"fengshui",meta:{action:"xuankong",period:F,periodLabel:Z?Z.label:`${F}运`,...Z?{year:s.fortuneYear||Y&&Y.at.year,periodStart:Z.start,periodEnd:Z.end}:{},sitting:`${k.m}山(罗盘 ${k.deg}°)`,facing:`${E.m}山(罗盘 ${E.deg}°)`,sittingGua:k.gua,facingGua:E.gua,sittingYuan:`${se.yuan}${se.yinYang}`,facingYuan:`${ue.yuan}${ue.yinYang}`,sittingOffset:x.offset,jianXiang:P.jianXiang,shanCenter:fe(P.shanCenter),xiangCenter:fe(P.xiangCenter),...W?{note:W}:{},scope:"玄空下卦/替卦:运盘 + 山盘 + 向盘 + 当运星 + 合十 + 表法旺山旺向;兼向超 4.5° 按沈氏替卦;年月日时紫白按公式派;不含形峦与现场勘舆。"},palaces:P.palaces,dangYun:{shan:{palaces:P.dangYun.shan,text:le(P.dangYun.shan)},xiang:{palaces:P.dangYun.xiang,text:le(P.dangYun.xiang)}},heshi:{shan:P.heshi.shan,xiang:P.heshi.xiang},wangShanWangXiang:P.wangShanWangXiang,...ce?{timeFlying:ce}:{},sources:We,disclaimer:nn}}return{NINE_STARS:g,PALACE_DIRECTION:p,DAYOUTIAN:U,LUCKY_STARS:te,UNLUCKY_STARS:y,MOUNTAINS_24:N,mountainInfo:f,sittingFromFacing:o,STAR_LAYOUT_ROLE:c,mingGua:S,eightStars:M,guaYearOf:A,yearZibaiStar:oe,yearlyFlying:Ne,timeFlyingOf:O,periodOfYear:K,MOUNTAIN_META:pe,TIGUA_SOURCE:en,TIGUA_TABLE:Ge,JIAN_XIANG_THRESHOLD:Ye,jianXiangOf:Je,WANG_SHAN_WANG_XIANG:Xe,XUANKONG_SOURCES:We,XUANKONG_DISCLAIMER:nn,xuankongChart:tn,buildFengshui:sn}})(),_.followup=(function(){const{ZIWEI_STARS:R}=_["interpret-data"]||{},q=[{key:"career",label:"事业",words:["事业","工作","跳槽","升职","创业","职业","岗位","离职","加薪","面试","offer"]},{key:"wealth",label:"财富",words:["财","钱","收入","投资","买房","存款","亏","赚","分红"]},{key:"love",label:"感情",words:["感情","婚","恋","对象","分手","复合","姻缘","结婚","桃花"]},{key:"health",label:"健康",words:["健康","病","身体","手术","失眠","体检","医院"]},{key:"study",label:"学业",words:["学业","考试","学习","考研","考公","证书","升学"]},{key:"travel",label:"出行",words:["出行","搬家","旅行","出国","迁","远行"]}],H={career:"官禄",wealth:"财帛",love:"夫妻",health:"疾厄",study:"官禄",travel:"迁移",overall:"命宫"},v=(y,N)=>{const l=String(y).match(/(20\d{2})\s*年?/);if(l)return Number(l[1]);const f=Array.isArray(N.liunian)&&N.liunian[0]?Number(N.liunian[0].year):null;return f?/明年/.test(y)?f+1:/后年/.test(y)?f+2:/去年/.test(y)?f-1:/今年|本年/.test(y)?f:null:null},L=y=>q.find(N=>N.words.some(l=>String(y).includes(l)))||null;function T(y,N){const l=v(N,y),f=L(N),o=Array.isArray(y.liunian)?y.liunian:[],r=Array.isArray(y.dayun?.list)?y.dayun.list:[],c=o.map(u=>u.year);if(l&&!o.some(u=>Number(u.year)===l))return{ok:!1,year:l,topic:f,answer:`这一盘已排的流年范围是 ${c[0]}–${c[c.length-1]},没有 ${l} 年。可以把问题改到范围内,或用 asOf 指定你想看的年份重新排盘。`,evidence:[`已排流年:${c.join("、")}`],confidence:"弱"};if(l){const u=o.find(de=>Number(de.year)===l),S=r.find(de=>Number(de.startAge)<=Number(u.age)&&Number(u.age)<=Number(de.startAge)+9)||null,M=u.luck?.tier||"平",A=(u.luck?.reasons||[]).slice(0,3),oe=(u.relations||[]).join("、"),ie=f?G(y,f.key):"";return{ok:!0,year:l,topic:f,answer:`${l} 年(${u.ganzhi})流年,十神为${u.stemTenGod||"—"},档位「${M}」;所行大运 ${S?`${S.ganzhi}(${S.luck?.tier||"平"})`:"未取到"}。${A.length?`理由:${A.join(",")}。`:""}${oe?`与该年地支相关的原局关系:${oe}。`:""}${ie}`,evidence:[`流年 ${u.year} ${u.ganzhi}·${u.stemTenGod||""}·${M}`,S?`大运 ${S.ganzhi}·${S.luck?.tier||"平"}`:"",oe?`原局关系 ${oe}`:"",f?`问题方向:${f.label}`:""].filter(Boolean),confidence:S&&A.length?"强":"中"}}if(f){const u={wealth:"overall",study:"work",travel:"overall"}[f.key]||f.key,S=(y.interpret?.dimensions||[]).find(M=>M.key===f.key||M.key===u);if(S){const M=y.frame&&y.frame.godStats&&y.frame.godStats.groups||{},A=f.key==="wealth"?` 财星权重 ${Number(M.财||0)}(只作结构参考,不含金额)。`:"";return{ok:!0,year:null,topic:f,answer:`按${f.label}这条线看:${S.text}${A}${S.advice?` 建议:${S.advice}`:""}`,evidence:(S.evidence||[]).slice(0,4),confidence:S.confidence||"中"}}}return{ok:!1,year:null,topic:f,answer:`这个问题里没有识别到具体的年份或方面。可以这样问:「2027 年事业怎么样」「财运如何」「感情在 2028 年」;已排流年是 ${c[0]}–${c[c.length-1]}。`,evidence:[`可问年份:${c.join("、")}`],confidence:"弱"}}function b(y,N){const l=v(N,y),f=L(N),o=Array.isArray(y.liunian)?y.liunian:[];if(l&&!o.some(r=>Number(r.year)===l))return{ok:!1,year:l,topic:f,answer:`这一盘的流年表覆盖 ${o[0]?.year}–${o[o.length-1]?.year},没有 ${l} 年;可以换一个年份,或用 asOf 指定起点重新排盘。`,evidence:[`流年表:${o.map(r=>r.year).join("、")}`],confidence:"弱"};if(l){const r=o.find(u=>Number(u.year)===l),c=r.daxian||{};return{ok:!0,year:l,topic:f,answer:`${l} 年(${r.ganzhi},${r.age} 岁)流年命宫落在「${r.lifePalace?r.lifePalace.palace:"—"}」,四化为 ${(r.mutagen||[]).join("、")||"不明显"};所行大限${c.palace?`在${c.palace}(${c.start}–${c.end} 岁)`:"未取到"}。${f?`与「${f.label}」对应的宫位信号见下条依据。`:""}`,evidence:[`流年命宫 ${r.lifePalace?r.lifePalace.palace:"—"}(${r.lifePalace?r.lifePalace.branch:"—"})`,`四化 ${(r.mutagen||[]).join("、")||"不明显"}`,c.palace?`大限 ${c.palace}·${c.start}–${c.end}岁`:""].filter(Boolean),confidence:(r.mutagen||[]).length>=3?"强":"中"}}if(f){const r=H[f.key]||"命宫",c=(y.palaces||[]).find(u=>u.palace===r);if(c){const u=(c.stars||[]).filter(M=>M.type==="主星").map(M=>M.name),S=u.map(M=>R[M]?.trait).filter(Boolean).slice(0,2).join(";");return{ok:!0,year:null,topic:f,answer:`「${f.label}」看${r}:主星${u.length?u.join("、"):"无正曜(借对宫)"}${S?`——${S}`:""}。宫支${c.branch},${c.stems,""}生年四化与煞星的影响需结合报告里的对应分节一起看。`,evidence:[`${r} ${c.branch}·${u.join("、")||"无正曜"}`,...(c.shensha||[]).slice(0,3)],confidence:u.length?"强":"弱"}}}return{ok:!1,year:null,topic:f,answer:"没有识别到具体年份或方面。可以问「2028 年事业」「感情怎么样」「财运在 2030 年」;也可以直接问某个宫位,如「夫妻宫」。",evidence:[],confidence:"弱"}}function G(y,N){return`这段时间可以重点对照报告里「${{career:"事业",wealth:"财富",love:"感情",health:"健康",study:"学业",travel:"出行"}[N]||"整体"}」一节看。`}function h(y,N){const l=L(N),f=Array.isArray(y.interpret?.sections)?y.interpret.sections:[],o=l?f.find(c=>c.label.includes(l.label)||c.text.includes(l.label)):null;if(o)return{ok:!0,year:null,topic:l,answer:o.text,evidence:[`引用分节:${o.label}`],confidence:"中"};const r=f[0];return{ok:!1,year:null,topic:l,answer:r?`这一盘的追问需要落到具体方面(事业 / 财富 / 感情 / 健康 / 学业 / 出行)。先看「${r.label}」这一节,或把问题说得更具体一点。`:"这一盘暂时没有可追问的分节;先看完整解析,再问具体方面。",evidence:[],confidence:"弱"}}function m(y,N){const l=String(N||"").trim(),f=y&&y.system==="bazi"?T(y,l):y&&y.system==="ziwei"?b(y,l):h(y,l);return{question:l,...f}}const g={bazi:"八字(四柱)",ziwei:"紫微斗数",liuyao:"六爻",meihua:"梅花易数",daliuren:"大六壬",qimen:"奇门遁甲",tarot:"塔罗",hepan:"合盘",chenggu:"称骨",almanac:"黄历",zeri:"择日",star:"星座",numerology:"生命数字",mbti:"十六型人格",trend:"人生 K 线",fengshui:"风水",name:"起名",convert:"公农历互转"},p=Object.freeze({bazi:["基本信息","四柱(日主/十神/藏干)","旺衰·格局·用神","合冲·神煞","起运·大运·流年","古籍依据"],ziwei:["基本信息","命宫/身宫与五行局","十二宫(主星/辅煞/四化)","格局与三方四正","大限/流年","古籍依据"],liuyao:["所问与用神","本卦/变卦(世应/动爻/六亲)","月建日辰(旺衰/空破)","应期线索","卦辞与依据"],meihua:["所问与体用","本卦/互卦/变卦","五行生克","应期与依据"],daliuren:["天地盘(月将/贵人)","四课","三传","课体与神将","依据"],qimen:["四柱与局数","九宫(星门神/天盘干)","用神落宫","门宫·干宫·十干克应","旺衰·击刑入墓","依据"],tarot:["问题与牌阵","逐牌(正逆/元素)","牌间关系","综合倾向","边界"],fengshui:["坐向与元运","运盘/山盘/向盘","旺山旺向","取象与边界"]}),C=Object.freeze(["基本信息","盘面事实","结构与关系","倾向","边界"]);function U(y){return p[y]||C}function te(y,N={}){const l=g[y&&y.system]||y&&y.system||"未知体系",o=String(N&&N.question||"").trim()||"请先用一句白话讲清这张盘的主线,再指出最值得注意的一两处,并说明每处的具体依据。",r=Number.isFinite(N&&N.maxChars)&&N.maxChars>=400?N.maxChars:3e3,c=String(y&&y.summary||"").trim(),u=c.length>r,S=u?`${c.slice(0,r)}…(摘要已截断)`:c,M=N&&typeof N.interpret=="object"&&N.interpret||y&&typeof y.interpret=="object"&&y.interpret||null,A=String(M&&M.answer||"").trim(),oe=String(M&&M.plain||"").trim(),ie=[];A&&ie.push(`直答:${A}`),oe&&ie.push(`说人话:${oe}`);const $e=["【命理追问】下面这张盘是命理插件刚排好的,请就着它回答我的问题;不用重新排盘,盘面字段已经够用。",`体系:${l}`,`所问:${o}`,"",...ie.length?["——开场结论(插件已按同一套规则算好,开场先沿用这句;措辞可改,口径别换)——",...ie,""]:[],"——盘面层次(从上到下读,别跳层)——",`${l}:${U(y&&y.system).join(" → ")}`,"先复述事实,再讲结构与时间;上一层没交代清楚,不要跳到下一层。","","——盘面摘要——",S||"(这张盘没有摘要字段,请先让我重新排一次。)","","——回答要求——","读者不懂命理。按下面的骨架答;任何一句他看不懂,就算没写完:",ie.length?"1) 开头一句结论:先沿用上面的「开场结论」,再用一句不用术语的话说清这张盘的主线——只读这一句也该有收获;":"1) 开头一句结论:不用术语,一句话说清这张盘的主线,只读这一句也该有收获;","2) 第二段只复述盘面骨架:按上面的层次用 2–4 行写事实(如四柱、格局、用神、大运),不掺倾向,让读者知道后面的判断从哪来;","3) 判断最多两条,按重要性排序,每条分四行写:"," 盘面|只引盘面已有的字(具体的柱、宫或爻、字段名),不掺解释;"," 白话|把上一行的术语当场翻成日常话——调候 / 化气 / 通关 / 空亡 / 争合 这类词必须落地,一个词只翻一次,不连续堆三个以上;"," 倾向|说「更可能……」,讲清它在现实里大概意味着什么,用概率语气;"," 边界|这条在什么情况下不成立;盘面没给的,直接写「这盘里看不出来」;","4) 收尾一句「如果只记一件事」:给一条能核对、能动手的观察点,并说明它出自上面哪条盘面依据;","5) 别把传统说法当成已证实的事实:不下绝对断言,也不用「肯定」「绝对」这类词,更不写「格局很好」「运程不顺」这种没有信息的空话。"].join(`
|
|
68
|
-
`);return{text:$e,question:o,system:y&&y.system||"",label:l,chars:$e.length,truncated:u}}return{followup:m,READING_ORDERS:p,READING_ORDER_FALLBACK:C,readingOrderOf:U,askPrompt:te}})(),_.revise=(function(){const R=[{key:"ziwei",label:"紫微",re:/紫微|斗数/},{key:"bazi",label:"八字",re:/八字|四柱/},{key:"liuyao",label:"六爻",re:/六爻|摇卦/},{key:"qimen",label:"奇门",re:/奇门/},{key:"daliuren",label:"大六壬",re:/大六壬|六壬/},{key:"tarot",label:"塔罗",re:/塔罗|抽牌/},{key:"meihua",label:"梅花",re:/梅花/},{key:"hepan",label:"合盘",re:/合盘|合婚/},{key:"almanac",label:"黄历",re:/黄历|老黄历/},{key:"zeri",label:"择日",re:/择日|挑日子/},{key:"fengshui",label:"风水",re:/风水/},{key:"name",label:"起名",re:/起名|取名/},{key:"chenggu",label:"称骨",re:/称骨/},{key:"xiaoliuren",label:"小六壬",re:/小六壬/},{key:"star",label:"星座",re:/星座/},{key:"numerology",label:"生命数字",re:/生命数字|生命灵数/},{key:"mbti",label:"MBTI",re:/mbti|人格测试|十六型/i},{key:"trend",label:"人生 K 线",re:/k\s*线|人生曲线/i},{key:"convert",label:"公农历互转",re:/农历转公历|公历转农历|公农历/}],q=[{key:"love",label:"感情",re:/感情|婚姻|恋爱|对象|夫妻/},{key:"wealth",label:"财运",re:/财运|财富|赚钱|收入|破财/},{key:"career",label:"事业",re:/事业|工作|升职|跳槽/},{key:"health",label:"健康",re:/健康|身体|疾病|病/},{key:"study",label:"学业",re:/学业|考试|考研|升学|读书/},{key:"travel",label:"出行",re:/出行|搬家|迁移|旅行|外地/}],H=/换成|改成|改为|换到|改看|再看|再看一下|换一套|排一?张|用|按|看/,v=h=>String(h||"").replace(/(出生|出生地|所在地|人)$/,"").replace(/[的了].*$/,"").trim();function L(h){const m=String(h??"").trim(),g={},p=[],C=[];if(!m)return{text:"",patch:g,labels:p,ignored:C};if(H.test(m)){for(const y of R)if(y.re.test(m)){g.system=y.key,p.push({key:"system",label:"体系",value:y.key,display:y.label});break}}/女命|女性|换成女|改成女|女盘/.test(m)?(g.gender="female",p.push({key:"gender",label:"性别",value:"female",display:"女"})):/男命|男性|换成男|改成男|男盘/.test(m)&&(g.gender="male",p.push({key:"gender",label:"性别",value:"male",display:"男"})),/晚子时/.test(m)&&(/不换日|不换天|算当日|归当日|按当日|当天/.test(m)?(g.lateZi=!1,p.push({key:"lateZi",label:"晚子时",value:!1,display:"23:00 后仍算当日"})):/换日|算次日|归次日|按次日|第二天|次日/.test(m)&&(g.lateZi=!0,p.push({key:"lateZi",label:"晚子时",value:!0,display:"23:00 后算次日"}))),/真太阳时/.test(m)&&(/不用|不要|关闭|关掉|取消|不算/.test(m)?(g.trueSolar=!1,p.push({key:"trueSolar",label:"真太阳时",value:!1,display:"用东八区平太阳时"})):(g.trueSolar=!0,p.push({key:"trueSolar",label:"真太阳时",value:!0,display:"按出生地经度校正"}))),/夏令时/.test(m)&&(/不用|不要|关闭|关掉|取消|不校正/.test(m)?(g.dst=!1,p.push({key:"dst",label:"夏令时",value:!1,display:"不自动校正 1986–1991 夏令时"})):(g.dst=!0,p.push({key:"dst",label:"夏令时",value:!0,display:"自动校正 1986–1991 夏令时"})));const U=m.match(/出生在\s*([\u4e00-\u9fa5]{2,12})/)||m.match(/出生地(?:改成|改为|换成|换到|是|为)?\s*([\u4e00-\u9fa5]{2,12})/)||m.match(/改到\s*([\u4e00-\u9fa5]{2,12})\s*出生/);if(U){const y=v(U[1]);y.length>=2&&(g.address=y,p.push({key:"address",label:"出生地",value:y,display:y}))}const te=m.match(/(?:看|查|问|到|到了|临近)\s*((?:19|20)\d{2})\s*年/)||m.match(/((?:19|20)\d{2})\s*年(?:的)?(?:运势|怎么样|如何|会怎样|流年)/);if(te){const y=Number(te[1]);g.asOf=`${y}-01-01T00:00`,p.push({key:"asOf",label:"流年基准",value:g.asOf,display:`${y} 年`})}else/(出生|生年)/.test(m)&&/(19|20)\d{2}\s*年/.test(m)&&C.push("出生年份没改:一句话改不出日与时辰,请直接传 datetime(如 1993-04-08T06:20)");for(const y of q)if(y.re.test(m)){g.direction=y.key,p.push({key:"direction",label:"询问方向",value:y.key,display:y.label});break}return/解读|详解|详细说|说人话/.test(m)&&!/不要解读|不用解读|别解读/.test(m)&&(g.withInterpret=!0,p.push({key:"withInterpret",label:"解读",value:!0,display:"附解析与详解"})),{text:m,patch:g,labels:p,ignored:C}}const T=R,b=q;function G(h,m){if(m==null)return null;if(h==="system"){const g=R.find(p=>p.key===m);return g?g.label:String(m)}if(h==="gender")return m==="female"?"女":m==="male"?"男":String(m);if(h==="direction"){const g=q.find(p=>p.key===m);return g?g.label:String(m)}if(typeof m=="boolean")return m?"开":"关";if(h==="asOf"){const g=String(m).match(/^(\d{4})/);return g?`${g[1]} 年`:String(m)}return String(m)}return{parseRevision:L,REVISE_SYSTEMS:T,REVISE_DIRECTIONS:b,displayValue:G}})(),_.handle=(function(){const{fail:R}=_.fail||{},q="mc1.",H=new Set(["handle","trace","shadow","shadowVersion","diff","withInterpret","cross","verifyPast","rectify","events","ask","followup","question","geocode","caliber","revise"]),v=l=>l!==null&&typeof l=="object"&&!Array.isArray(l);function L(l){if(Array.isArray(l))return`[${l.map(o=>L(o===void 0?null:o)).join(",")}]`;if(v(l))return`{${Object.keys(l).filter(r=>l[r]!==void 0).sort().map(r=>`${JSON.stringify(r)}:${L(l[r])}`).join(",")}}`;const f=JSON.stringify(l===void 0?null:l);return f===void 0?"null":f}function T(l){let f=2166136261;for(let o=0;o<l.length;o++)f^=l.charCodeAt(o),f=Math.imul(f,16777619)>>>0;return f.toString(16).padStart(8,"0")}const b="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function G(l){const f=[];for(const o of String(l)){let r=o.codePointAt(0);r<128?f.push(r):r<2048?f.push(192|r>>6,128|r&63):r<65536?f.push(224|r>>12,128|r>>6&63,128|r&63):f.push(240|r>>18,128|r>>12&63,128|r>>6&63,128|r&63)}return f}function h(l){let f="";for(let o=0;o<l.length;){const r=l[o];let c,u;r<128?(c=r,u=1):r<224?(c=r&31,u=2):r<240?(c=r&15,u=3):(c=r&7,u=4);for(let S=1;S<u;S++)c=c<<6|l[o+S]&63;o+=u,f+=String.fromCodePoint(c)}return f}function m(l){const f=G(l);let o="";for(let r=0;r<f.length;r+=3){const c=f[r],u=f[r+1],S=f[r+2];if(o+=b[c>>2],o+=b[(c&3)<<4|(u===void 0?0:u)>>4],u===void 0||(o+=b[(u&15)<<2|(S===void 0?0:S)>>6],S===void 0))break;o+=b[S&63]}return o}function g(l){const f=[];let o=0,r=0;for(const c of l){const u=b.indexOf(c);if(u<0)throw new Error(`不是 base64url 字符:${c}`);o=o<<6|u,r+=6,r>=8&&(r-=8,f.push(o>>r&255))}return h(f)}function p(l={}){const f={};for(const[o,r]of Object.entries(l||{}))H.has(o)||r===void 0||(f[o]=r);return f}function C(l={}){const f=p(l);if(!Object.keys(f).length)return"";const o=m(L(f));return`${q}${o}.${T(o)}`}function U(l){if(typeof l!="string"||!l.trim())throw R("E_HANDLE","handle 必须是非空字符串;没拿到句柄时照常传 system + datetime 等原始参数即可");const f=l.trim();if(!f.startsWith(q))throw R("E_HANDLE",`handle 前缀不对(应以 ${q} 开头):句柄来自旧版本或复制不全,重新排一次盘取新的 handle`);const o=f.slice(q.length),r=o.lastIndexOf(".");if(r<=0)throw R("E_HANDLE","handle 缺少校验位:复制时可能被截断,重新取一次");const c=o.slice(0,r),u=o.slice(r+1);if(T(c)!==u)throw R("E_HANDLE","handle 校验不通过:内容被改动或截断,重新排一次盘取新的 handle");let S;try{S=JSON.parse(g(c))}catch{throw R("E_HANDLE","handle 内容无法解析(不是本插件生成的句柄),重新排一次盘取新的 handle")}if(!v(S))throw R("E_HANDLE","handle 内容不是参数对象,重新排一次盘取新的 handle");return S}function te(l={}){if(!v(l))return l;const{handle:f,...o}=l;if(f==null||f==="")return{...o};const c={...U(f)};for(const[u,S]of Object.entries(o))S!==void 0&&(c[u]=S);return c}return{handlePayload:p,encodeHandle:C,decodeHandle:U,resolveHandle:te,HANDLE_PREFIX:q,handleChecksum:T}})(),_.bridge=(function(){const{encodeHandle:R,decodeHandle:q,HANDLE_PREFIX:H}=_.handle||{},{askPrompt:v}=_.followup||{},L=200,T=60,b={bazi:"八字",ziwei:"紫微",liuyao:"六爻",meihua:"梅花",daliuren:"大六壬",qimen:"奇门",hepan:"合盘",tarot:"塔罗",almanac:"黄历",zeri:"择日",chenggu:"称骨",xiaoliuren:"小六壬",star:"星座",numerology:"生命数字",mbti:"人格",trend:"人生K线",fengshui:"风水",name:"起名",convert:"农历"},G=f=>b[f]||f||"未知体系";function h(f){const o=String(f||""),r=o.indexOf("#");return r<0?o:o.slice(0,r)}function m(f){try{return encodeURIComponent(f)}catch{return""}}function g(f){try{return decodeURIComponent(f)}catch{return String(f||"")}}function p(f={},o={}){const r=o||{},u=String(r.handle||f&&f.handle||"").trim()||R(f||{});if(!u||!u.startsWith(H))return"";const S=String(r.question||"").trim().slice(0,L),M=[`mp=${u}`];return S&&M.push(`q=${m(S)}`),`${h(r.base)}#${M.join("&")}`}function C(f){const o=String(f||"").trim();if(!o)return{ok:!1,code:"E_LINK",message:"没有链接内容:请粘贴带 #mp= 的完整链接"};let r="";const c=o.indexOf("#");if(c>=0&&o.slice(c+1).trim())r=o.slice(c+1).trim();else{const A=o.indexOf("?");A>=0&&o.slice(A+1).trim()?r=o.slice(A+1).trim():/^mp=/.test(o)&&(r=o)}if(!r)return{ok:!1,code:"E_LINK",message:"链接里没有 #mp= 片段:这不是本插件生成的深链"};const u={};for(const A of r.split("&")){if(!A)continue;const oe=A.indexOf("=");if(oe<=0)continue;const ie=A.slice(0,oe),de=A.slice(oe+1);ie==="mp"?u.mp=de:ie==="q"&&(u.q=de)}if(!u.mp)return{ok:!1,code:"E_LINK",message:"链接里没有 mp 参数(只有问题没有盘):无法还原盘面"};let S;try{S=q(u.mp)}catch(A){return{ok:!1,code:A&&A.code||"E_HANDLE",message:A&&A.message||"句柄无法解析"}}const M=u.q?g(u.q).slice(0,L):"";return{ok:!0,handle:u.mp,args:S,question:M,system:S.system||"",label:G(S.system)}}const U=f=>{const o=/^(\d{4}-\d{1,2}-\d{1,2})[T ](\d{1,2}:\d{2})/.exec(String(f||"").trim());if(!o)return{date:"",time:""};const[r,c,u]=o[1].split("-");return{date:`${r}-${String(c).padStart(2,"0")}-${String(u).padStart(2,"0")}`,time:o[2].padStart(5,"0")}},te=["gender","address","trueSolar","lateZi","lines"];function y(f){const o=f&&f.ok?f:null,r=o&&o.args||{},c=U(r.datetime),u={tab:r.system||"",date:c.date,time:c.time,question:o&&o.question||"",restored:[],rest:{}};u.tab&&u.restored.push("system"),c.date&&u.restored.push("datetime");for(const S of te)r[S]===void 0||r[S]===null||(u[S]=r[S],u.restored.push(S));u.question&&u.restored.push("question");for(const[S,M]of Object.entries(r))S==="system"||S==="datetime"||te.includes(S)||(u.rest[S]=M);return u}function N(f){const o=Object.keys(f&&f.rest||{});return o.length?`链接里还有 ${o.length} 项没填回表单(${o.join("、")}):这些只在引擎调用里生效,页面上按默认值显示。`:""}function l(f,o={}){const r=o||{},c=f||{},u=c.system||"",S=G(u),M=String(r.question||"").trim(),A=String(c.handle||"").trim();let oe="";try{const we=v(c,{question:M,interpret:r.interpret});oe=we&&we.text||String(c.summary||"")}catch{oe=String(c.summary||"")}const ie=M?M.length>T?`${M.slice(0,T)}…`:M:"(未填问题:按摘要讲主线)",de=A?`【命理追问】${S}|${A}|问:${ie}`:`【命理追问】${S}|问:${ie}`,$e={};A&&($e.handle=A),u&&($e.system=u),M&&($e.question=M);const Ne=JSON.stringify({tool:"metaphysics",v:1,args:$e},null,2),ge=A?p({handle:A},{question:M,base:r.base}):"";return{system:u,label:S,handle:A,question:M,full:oe,brief:de,structured:Ne,link:ge}}return{LINK_MAX_QUESTION:L,askLink:p,parseAskLink:C,formOf:y,restNote:N,askPackages:l}})(),_.index=(function(){const{buildBazi:R}=_.bazi||{},{buildLiuyao:q,tossLines:H,bodyLabels:v,yongshenOf:L,yongshenStrength:T,fushenAccess:b,hexagramStrength:G,jinTuiPower:h,yingqiWindow:m}=_.liuyao||{},{buildZiwei:g,BRIGHTNESS:p,flowOf:C,asOfParts:U,ZIWEI_SCHOOL_DEFAULTS:te}=_.ziwei||{},{drawTarot:y}=_.tarot||{},{buildMeihua:N}=_.meihua||{},{buildDaliuren:l}=_.daliuren||{},{buildHepan:f,tripleOf:o}=_.hepan||{},{buildZiweiHepan:r}=_["ziwei-hepan"]||{},{buildQimen:c,buildSnapshot:u}=_.qimen||{},{geocodeAddress:S,resolveAddress:M}=_.geo||{},{toJDN:A,ganzhiName:oe,dayGanzhiIndex:ie}=_.calendar||{},{randomOf:de,isSeed:$e}=_.random||{},{encodeHandle:Ne,decodeHandle:ge,resolveHandle:we}=_.handle||{},{askLink:Me,parseAskLink:Pe,formOf:_e,restNote:ze,askPackages:I}=_.bridge||{},{parseRevision:D,displayValue:O}=_.revise||{},{interpret:Q,DIRECTIONS:K,DIRECTION_DEFAULT:re}=_.interpret||{},{followup:he,askPrompt:pe}=_.followup||{},{crossCheck:xe,crossText:Ze,crossSection:Re}=_.crosscheck||{},{pastSignals:De,verifyFit:qe}=_.verify||{},{rectifyBirth:Be}=_.rectify||{},{buildAlmanac:en}=_.almanac||{},{buildZeri:Ge}=_.zeri||{},{buildChenggu:Ye}=_.chenggu||{},{buildXiaoliuren:Je}=_.xiaoliuren||{},{buildStar:Xe}=_.star||{},{buildNumerology:We}=_.numerology||{},{buildMbti:nn,mbtiPaper:tn}=_.mbti||{},{buildConvert:He}=_.convert||{},{classicsFor:an,classicsText:on,suiyunClassicOf:sn,classicOf:Ke,CLASSIC_BOOKS:Fe}=_.classics||{},{diffObjects:rn,summarize:ln,sortDiffs:cn,labelOf:s,rootOf:k,categoryOf:E,formatValue:x,CALIBER_SWITCHES:Y,viewRows:F}=_.diff||{},{canonicalJson:Z,fingerprintOf:W}=_.fingerprint||{},{buildTrend:P}=_.trend||{},{buildFengshui:se}=_.fengshui||{},{buildName:ue}=_.name||{},{buildTrace:fe,traceMarkdown:le,SYSTEM_LABEL:ce}=_.trace||{},{fail:B}=_.fail||{},{assertCivil:Se}=_.validate||{},Oe=e=>String(e).padStart(2,"0"),ve=["male","female"];function ke(e,t){return t===2?e%4===0&&e%100!==0||e%400===0?29:28:[31,28,31,30,31,30,31,31,30,31,30,31][t-1]}function ye(e,t=""){if(ve.includes(e))return e;const a=e==null||e===""?"(未提供)":`「${e}」`;throw B("E_INPUT",`${t?t+"的":""}gender 必须是 male 或 female${a};性别决定大运/大限顺逆,不能靠默认值`)}const Ce=["brightnessSchool","gengYearSihua","tianmaSchool","tiankongSchool","jiekongSchool","kuiyueSchool","tianshiTianshang","changshengSchool","lateZishi","shenzhuSchool"];function Ue(e){const t={};for(const a of Ce)e[a]!==void 0&&(t[a]=e[a]);return e.schools&&typeof e.schools=="object"&&(t.schools=e.schools),t}function ne(e){if(typeof e!="string"||!e.trim())throw B("E_INPUT","缺少 datetime(公历日期时间),例如 1990-05-12T14:30");const t=e.trim().match(/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s](\d{1,2}):(\d{1,2})(?::(\d{1,2}))?)?$/);if(!t)throw B("E_INPUT",`无法解析 datetime:「${e}」,请用 1990-05-12T14:30 这种格式`);const a={year:Number(t[1]),month:Number(t[2]),day:Number(t[3]),hour:Number(t[4]??0),minute:Number(t[5]??0)};if(a.month<1||a.month>12)throw B("E_INPUT",`月份超出范围:${a.month}`);const n=ke(a.year,a.month);if(a.day<1||a.day>n)throw B("E_INPUT",`日期不存在:${a.year}-${a.month}-${a.day}(${a.year} 年 ${a.month} 月只有 ${n} 天)`);if(a.hour>23||a.minute>59)throw B("E_INPUT",`时间超出范围:${a.hour}:${a.minute}`);if(a.year<1600||a.year>2400)throw B("E_RANGE",`年份 ${a.year} 超出可计算范围(1600–2400)`);return(a.year<1900||a.year>2100)&&(a.precision={level:"approx",note:`ΔT 模型仅覆盖 1900–2100,${a.year} 年按端点值外推,节气与朔望时刻可能有分钟级偏差,月柱在交节前后需复核`}),a}function Te(e){const t=e.pillars,a=(ee,be)=>`${ee}:${be.ganzhi} ${be.stemTenGod?`十神 ${be.stemTenGod} `:""}藏干 ${be.hidden.map(Le=>`${Le.stem}(${Le.tenGod})`).join(" ")} 纳音 ${be.nayin} 地势 ${be.dishi} 自坐 ${be.zizuo} 空亡 ${be.kongwang.join("")}`+(be.shensha&&be.shensha.length?` 神煞 ${be.shensha.join("、")}`:""),n=Object.entries(e.wuxing).map(([ee,be])=>`${ee}${be}`).join(" "),i=e.palaces?`【胎元】${e.palaces.taiyuan.ganzhi} 胎息 ${e.palaces.taixi?e.palaces.taixi.ganzhi:"—"} 命宫 ${e.palaces.minggong.ganzhi} 身宫 ${e.palaces.shengong.ganzhi}`:"",d=e.dayun.list.slice(0,8).map(ee=>`${ee.startAge}岁 ${ee.ganzhi}(${ee.stemTenGod})${ee.luck?`·${ee.luck.tier}`:""}${ee.relations&&ee.relations.length?`[${ee.relations.join("")}]`:""}`).join(" "),$=e.dayun.jiao&&e.dayun.jiao.at?`;交运 ${e.dayun.jiao.at}(${e.dayun.jiao.frame},距${e.dayun.jiao.from.name} ${e.dayun.jiao.spanDays} 天,三日折一年)`:"",j=e.jieqi.nearBoundaryMinutes<20?`
|
|
69
|
-
⚠ 出生时刻距「节」仅 ${e.jieqi.nearBoundaryMinutes} 分钟,而节气时刻本身有最多约 14 分钟的偏差,月柱与年柱建议人工复核。`:"",
|
|
70
|
-
`)+
|
|
71
|
-
`)}const un=["旺","相","休","囚","死"];function jn(e){const t=e.states,
|
|
72
|
-
`)}function gn(e){if(!e||!Array.isArray(e.pairs)||!e.pairs.length)return[];const t=["【三方合盘】三对两两并列,不合成「三人总分」",...e.pairs.map(
|
|
73
|
-
`)}const t=n=>`${n.label}:${n.score>=0?"+":""}${n.score} ${n.text}`,
|
|
74
|
-
`)}function kn(e){const t=e.sanChuan,
|
|
75
|
-
`)}function
|
|
76
|
-
`)}function
|
|
77
|
-
`)}function En(e){const t=
|
|
78
|
-
`)},
|
|
79
|
-
`)}function
|
|
66
|
+
`,W={河北:"石家庄",山西:"太原",内蒙古:"呼和浩特",辽宁:"沈阳",吉林:"长春",黑龙江:"哈尔滨",江苏:"南京",浙江:"杭州",安徽:"合肥",福建:"福州",江西:"南昌",山东:"济南",河南:"郑州",湖北:"武汉",湖南:"长沙",广东:"广州",广西:"南宁",海南:"海口",四川:"成都",贵州:"贵阳",云南:"昆明",西藏:"拉萨",陕西:"西安",甘肃:"兰州",青海:"西宁",宁夏:"银川",新疆:"乌鲁木齐",台湾:"台北"},V={石家庄:[114.51,38.04],太原:[112.55,37.87],沈阳:[123.43,41.8],长春:[125.32,43.82],哈尔滨:[126.53,45.8],南京:[118.8,32.06],杭州:[120.15,30.28],合肥:[117.23,31.82],福州:[119.3,26.08],南昌:[115.86,28.68],济南:[117,36.65],郑州:[113.62,34.75],武汉:[114.3,30.59],长沙:[112.94,28.23],广州:[113.26,23.13],南宁:[108.37,22.82],海口:[110.2,20.04],成都:[104.07,30.67],贵阳:[106.63,26.65],昆明:[102.83,24.88],拉萨:[91.13,29.65],西安:[108.94,34.34],兰州:[103.83,36.06],西宁:[101.78,36.62],银川:[106.23,38.49],乌鲁木齐:[87.62,43.82],台北:[121.52,25.03]},D=(()=>{const S={};for(const j of X.trim().split(`
|
|
67
|
+
`))for(const G of j.split(";")){const _=G.trim().split(/\s+/);if(_.length!==3)continue;const[he,g,E]=_;S[he]={lon:Number(g),lat:Number(E)}}for(const[j,[G,_]]of Object.entries(V))S[j]||(S[j]={lon:G,lat:_});return S})(),L=/(省|市|地区|盟|自治州|自治县|自治区|特别行政区|县|区|镇|乡|街道|村|小区|社区)/g;function O(S){const j=String(S||"").trim();if(!j)return null;const G=Number(j);if(Number.isFinite(G)&&/^-?\d+(\.\d+)?$/.test(j)&&G>=60&&G<=150)return{lon:G,lat:null,matched:`${G}°E`,level:"经度",note:"按你输入的经度计算"};const _=j.replace(/\s/g,"").replace(L,""),he=Object.keys(D).sort((E,u)=>u.length-E.length);for(const E of he)if(_.includes(E)){const u=D[E];return{lon:u.lon,lat:u.lat,matched:E,level:"地级市",note:`按 ${E} 估算(约 ${u.lon}°E)`}}const g=j.replace(/\s/g,"");for(const[E,u]of Object.entries(W)){const m=g.indexOf(E);if(m<0)continue;const a=g.charAt(m+E.length);if(a==="区"||a==="县")continue;const c=D[u]||{lon:V[u][0],lat:V[u][1]};return{lon:c.lon,lat:c.lat,matched:u,level:"省会",note:`未匹配到具体城市,按 ${E} 省会 ${u} 估算(约 ${c.lon}°E)`}}return{lon:null,lat:null,matched:null,level:"未匹配",note:`没查到「${j}」,可改填经度(如 116.4)`}}const w=/(区|县|镇|乡|村|小区|街道|路|号|巷|弄|组|队)/,F="dsh-metaphysics/0.23.0 (+https://github.com/xuanfu-web/dsh-metaphysics)";async function y(S,{timeoutMs:j=2500}={}){if(typeof fetch!="function")return null;let G=null;try{const _=typeof AbortController=="function"?new AbortController:null;_&&(G=setTimeout(()=>_.abort(),j));const he="https://nominatim.openstreetmap.org/search?format=jsonv2&limit=1&accept-language=zh-CN&countrycodes=cn&q="+encodeURIComponent(S),g=await fetch(he,{signal:_?_.signal:void 0,headers:{"User-Agent":F}});if(!g||!g.ok)return null;const E=await g.json();if(!Array.isArray(E)||E.length===0)return null;const u=E[0],m=Number(u.lon),a=Number(u.lat);return Number.isFinite(m)?{lon:m,lat:a,matched:u.display_name,level:"在线",note:`在线解析:${u.display_name}`}:null}catch{return null}finally{G&&clearTimeout(G)}}async function $(S,j={}){const G=O(S),_=String(S||"").trim();if(!_||!(j.online===!0)||G&&typeof G.lon=="number"&&!w.test(_))return G;const g=await y(_,j);return g?{...g,local:G&&G.lon!=null?G:null}:G&&typeof G.lon=="number"?{...G,onlineFailed:!0,note:`${G.note}(联网解析失败或超时,已退回内置坐标表)`}:{...G,onlineFailed:!0}}return{CITIES:D,PROVINCES:W,resolveAddress:O,geocodeAddress:$}})(),C.random=(function(){function X(D){let L=Number(D)>>>0;return L||(L=2654435769),function(){L=L+1831565813>>>0;let w=L;return w=Math.imul(w^w>>>15,w|1),w^=w+Math.imul(w^w>>>7,w|61),((w^w>>>14)>>>0)/4294967296}}function W(D){if(D==null||D==="")return Math.random;const L=Number(D);return Number.isFinite(L)?X(L):Math.random}function V(D){return D==null||D===""?!0:Number.isFinite(Number(D))}return{mulberry32:X,randomOf:W,isSeed:V}})(),C.dst=(function(){const{daysInMonth:X}=C.validate||{},W={1986:["1986-05-04","1986-09-14"],1987:["1987-04-12","1987-09-13"],1988:["1988-04-10","1988-09-11"],1989:["1989-04-16","1989-09-17"],1990:["1990-04-15","1990-09-16"],1991:["1991-04-14","1991-09-15"]},V=(w,F,y)=>w*1e4+F*100+y;function D(w){const F=W[w.year];if(!F)return!1;const[y,$,S]=F[0].split("-").map(Number),[j,G,_]=F[1].split("-").map(Number),he=V(w.year,w.month,w.day);if(he<V(y,$,S)||he>V(j,G,_))return!1;const g=w.hour*60+(w.minute||0);return!(he===V(y,$,S)&&g<120||he===V(j,G,_)&&g>=120)}function L(w){const F=w.minute||0;if(!D(w))return{year:w.year,month:w.month,day:w.day,hour:w.hour,minute:F,applied:!1,note:null};let{year:y,month:$,day:S,hour:j}=w;return j-=1,j<0&&(j+=24,S-=1,S<1&&($-=1,$<1&&($=12,y-=1),S=X(y,$))),{year:y,month:$,day:S,hour:j,minute:F,applied:!0,note:`检出自 ${W[w.year][0]} 至 ${W[w.year][1]} 的中国夏令时:出生钟面时间已减 1 小时校正`}}function O(w,F){const y=Array.isArray(w)?w.slice():[];return F&&F.applied&&F.note&&y.push(F.note),y}return{DST_SPANS:W,inDstSpan:D,applyDst:L,withDstNote:O}})(),C.fengshui=(function(){const{partsToJd:X,termInstantJd:W,toJDN:V,dayGanzhiIndex:D,ganzhiName:L,termWindow:O,previousJie:w,BRANCHES:F}=C.calendar||{},{applyDst:y}=C.dst||{},{fail:$}=C.fail||{},S={1:{name:"一白",color:"白",element:"水",star:"贪狼",lucky:!0},2:{name:"二黑",color:"黑",element:"土",star:"巨门",lucky:!1},3:{name:"三碧",color:"碧",element:"木",star:"禄存",lucky:!1},4:{name:"四绿",color:"绿",element:"木",star:"文曲",lucky:!0},5:{name:"五黄",color:"黄",element:"土",star:"廉贞",lucky:!1},6:{name:"六白",color:"白",element:"金",star:"武曲",lucky:!0},7:{name:"七赤",color:"赤",element:"金",star:"破军",lucky:!1},8:{name:"八白",color:"白",element:"土",star:"左辅",lucky:!0},9:{name:"九紫",color:"紫",element:"火",star:"右弼",lucky:!0}},j={坎:"正北",艮:"东北",震:"正东",巽:"东南",离:"正南",坤:"西南",兑:"正西",乾:"西北"},G=["坎","艮","震","巽","离","坤","兑","乾"],_={乾:["六煞","天医","五鬼","祸害","绝命","延年","生气"],坎:["五鬼","天医","生气","延年","绝命","祸害","六煞"],艮:["六煞","绝命","祸害","生气","延年","天医","五鬼"],震:["延年","生气","祸害","绝命","五鬼","天医","六煞"],巽:["天医","五鬼","六煞","祸害","生气","绝命","延年"],离:["六煞","五鬼","绝命","延年","祸害","生气","天医"],坤:["天医","延年","绝命","生气","祸害","五鬼","六煞"],兑:["生气","祸害","延年","绝命","六煞","五鬼","天医"]},he=["生气","延年","天医","伏位"],g=["绝命","五鬼","六煞","祸害"],E=[{m:"壬",gua:"坎",deg:345},{m:"子",gua:"坎",deg:0},{m:"癸",gua:"坎",deg:15},{m:"丑",gua:"艮",deg:30},{m:"艮",gua:"艮",deg:45},{m:"寅",gua:"艮",deg:60},{m:"甲",gua:"震",deg:75},{m:"卯",gua:"震",deg:90},{m:"乙",gua:"震",deg:105},{m:"辰",gua:"巽",deg:120},{m:"巽",gua:"巽",deg:135},{m:"巳",gua:"巽",deg:150},{m:"丙",gua:"离",deg:165},{m:"午",gua:"离",deg:180},{m:"丁",gua:"离",deg:195},{m:"未",gua:"坤",deg:210},{m:"坤",gua:"坤",deg:225},{m:"申",gua:"坤",deg:240},{m:"庚",gua:"兑",deg:255},{m:"酉",gua:"兑",deg:270},{m:"辛",gua:"兑",deg:285},{m:"戌",gua:"乾",deg:300},{m:"乾",gua:"乾",deg:315},{m:"亥",gua:"乾",deg:330}],u=new Map(E.map((l,M)=>[l.m,M]));function m(l){const M=u.get(l);if(M===void 0)throw $("E_INPUT",`坐向必须是 24 山之一(${E.map(z=>z.m).join("")}),收到「${l}」——请按罗盘 24 山报坐或报向,不要自造方位词。`);return{...E[M],index:M}}function a(l){const z=(m(l).index+12)%24;return{...E[z],index:z}}const c=l=>["坎","离","震","巽"].includes(l)?"东四":"西四",d={生气:"大吉:最宜开门、主卧、灶口朝向",延年:"大吉:宜开门、主卧(利感情与人缘)",天医:"次吉:宜主卧、书房、老人房(利健康)",伏位:"次吉:宜卧室、神位(主平稳)",祸害:"小凶:宜厕所、储物间(宜静不宜动)",六煞:"次凶:宜厕所、储物间",五鬼:"大凶:宜厕所,或以灶坐压之(传统「火烧五鬼」说)",绝命:"最凶:宜灶坐压之、储物,忌门床"},f=["坎","坤","震","巽","中","乾","兑","艮","离"];function N(l,M){const z=(l%100+100)%100,q=l>=2e3?{male:99,female:3}:{male:100,female:4},H=le=>{const Q=(le%9+9)%9;return Q===0?9:Q};let te=H(M==="male"?q.male-z:z-q.female);te===5&&(te=M==="male"?2:8);const ne=f[te-1];if(ne==="中")throw new Error("命卦计算异常:落中宫");return{num:te,gua:ne,direction:j[ne]}}function v(l){const M={伏位:{palace:l,direction:j[l]}},z=G.indexOf(l);for(let q=1;q<=7;q++){const H=G[(z+q)%8];M[_[l][q-1]]={palace:H,direction:j[H]}}return M}function I(l,M,z){return X({year:l,month:M,day:z,hour:12,minute:0})<W(l,2)?l-1:l}function me(l){const M=(1+(2026-l))%9;return M<=0?M+9:M}const $e=["坎","坤","震","巽","中","乾","兑","艮","离"],Se=l=>{const M=(l%9+9)%9;return M===0?9:M};function Te(l,M=!0){const z=[];for(const q of $e){const H=$e.indexOf(q)+1,te=Se(H-5+l),ne=S[te];z.push({palace:q,direction:q==="中"?"中宫":j[q],num:te,name:ne.name,star:ne.star,element:ne.element,lucky:ne.lucky})}return{center:l,centerName:S[l].name,forward:M,fly:M?"顺飞":"逆飞",palaces:z}}function ze(l){return Te(me(l),!0)}const s={立春:1,惊蛰:2,清明:3,立夏:4,芒种:5,小暑:6,立秋:7,白露:8,寒露:9,立冬:10,大雪:11,小寒:12},p={四正:8,四墓:5,四生:2},Y={四正:1,四墓:7,四生:4},K={四正:9,四墓:3,四生:6},P=l=>["子","午","卯","酉"].includes(l)?"四正":["辰","戌","丑","未"].includes(l)?"四墓":"四生",B=l=>L(((l-4)%60+60)%60).branch;function b(l,M,z){let q=null;for(const H of l){if(H.jd>z)break;H.name===M&&(q=H)}return q}function A(l,M){const z=b(l,"冬至",M),q=b(l,"夏至",M);if(!!z&&(!q||z.jd>q.jd)){const le=b(l,"谷雨",M),Q=b(l,"雨水",M);return le&&z&&le.jd>z.jd?{half:"阳遁",segment:"谷雨–夏至(下元)",offset:3,boundary:"冬至后阳遁,谷雨至上元转下元"}:Q&&z&&Q.jd>z.jd?{half:"阳遁",segment:"雨水–谷雨(中元)",offset:6,boundary:"冬至后阳遁,雨水至上元转中元"}:{half:"阳遁",segment:"冬至–雨水(上元)",offset:0,boundary:"冬至后阳遁上元"}}const te=b(l,"霜降",M),ne=b(l,"处暑",M);return te&&q&&te.jd>q.jd?{half:"阴遁",segment:"霜降–冬至(下元)",offset:3,boundary:"夏至后阴遁,霜降至上元转下元"}:ne&&q&&ne.jd>q.jd?{half:"阴遁",segment:"处暑–霜降(中元)",offset:6,boundary:"夏至后阴遁,处暑至上元转中元"}:{half:"阴遁",segment:"夏至–处暑(上元)",offset:0,boundary:"夏至后阴遁上元"}}function x(l){const M=Number(l.year),z=Number(l.month),q=Number(l.day),H=Number.isInteger(l.hour)?l.hour:12,te=Number.isInteger(l.minute)?l.minute:0,ne=X({year:M,month:z,day:q,hour:H,minute:te}),le=O(M),Q=I(M,z,q),ye=B(Q),we=P(ye),Ne=w(le,ne),ge=s[Ne?Ne.name:"立春"]||1,be=A(le,ne),oe=V(M,z,q)+(H>=23?1:0),Ie=D(oe),Ze=L(Ie).name,Fe=L(Ie).branch,Ce=P(Fe),xe=Math.floor((H+1)%24/2),Je=me(Q),nn=Se(p[we]-(ge-1)),fe=Se(Ie+1+be.offset),Le=be.half==="阳遁"?fe:Se(10-fe),hn=be.half==="阳遁"?Y[Ce]:K[Ce],un=Se(hn+(be.half==="阳遁"?xe:-xe));return{year:{...Te(Je,!0),basis:`${Q} 年(立春界)年星 ${S[Je].name} 入中顺飞`},month:{...Te(nn,!0),basis:`${ye}年(${we})${Ne?Ne.name:"立春"}月,${ge} 月 ${S[nn].name} 入中顺飞`},day:{...Te(Le,be.half==="阳遁"),basis:`${be.half}·${be.segment},${Ze}日第 ${Ie+1} 位,${S[Le].name} 入中${be.half==="阳遁"?"顺":"逆"}飞`},hour:{...Te(un,be.half==="阳遁"),basis:`${be.half}·${be.segment},${Ce}日 ${F[xe]}时,${S[un].name} 入中${be.half==="阳遁"?"顺":"逆"}飞`},meta:{guaYear:Q,yearBranch:ye,yearGroup:we,monthNum:ge,monthJie:Ne?Ne.name:"立春",dayGanzhi:Ze,daySeq:Ie+1,dayGroup:Ce,hourBranch:F[xe],half:be.half,segment:be.segment,boundary:be.boundary,note:"月按节气月(寅月为正月);日按公历日、23:00 后归次日;日/时星入中后的顺逆取「冬至顺、夏至逆」。另有「一律顺飞」与「月按农历月」派,本插件不合并,差异见本注。"}}}const J=l=>String(l).padStart(2,"0");function Z(l){const M=Math.floor((l-1864)/20),z=(M%9+9)%9+1,q=1864+20*M;return{period:z,start:q,end:q+19,label:`${z}运(${q}–${q+19})`}}const se=new Set(["乾","巽","艮","坤","甲","庚","壬","丙","寅","申","巳","亥"]),R=["地元","天元","人元"],re={};E.forEach((l,M)=>{re[l.m]={...l,yuan:R[M%3],yinYang:se.has(l.m)?"阳":"阴"}});const je=["中","乾","兑","艮","离","坎","坤","震","巽"],Ee=["坎","坤","震","巽","中","乾","兑","艮","离"],Oe={地元:0,天元:1,人元:2},ee=l=>E.filter(M=>M.gua===l).map(M=>re[M.m]);function Ae(l,M){const z={};for(let q=0;q<9;q++){const H=((l-1+(M?q:-q))%9+9)%9+1;z[je[q]]=H}return z}function Qe(l,M){if(M===5)return{forward:l.yinYang==="阳",basis:`五黄入中,按${l.m}本山${l.yuan}${l.yinYang}论`};const z=Ee[M-1],q=ee(z)[Oe[l.yuan]];return{forward:q.yinYang==="阳",basis:`${M}${z}宫取${l.yuan}${q.m}(${q.yinYang})`}}const tn="《沈氏玄空学》坤壬乙诀(子癸甲申一白、壬卯乙未坤二黑、乾亥辰巽巳戌六白、酉辛丑艮丙七赤、寅午庚丁九紫)",Be=Object.freeze({子:1,癸:1,甲:1,申:1,壬:2,卯:2,乙:2,未:2,坤:2,乾:6,亥:6,辰:6,巽:6,巳:6,戌:6,酉:7,辛:7,丑:7,艮:7,丙:7,寅:9,午:9,庚:9,丁:9}),De=4.5;function Xe(l,M=0){const z=Number(M)||0;if(Math.abs(z)<=De)return{active:!1,offset:z,threshold:De,sitting:l.m,jian:null,kind:null,sameYinYang:null,note:`坐山偏离中心 ${z}°,未超 ${De}°,按正向下卦排盘。`};const q=E.findIndex(Q=>Q.m===l.m),H=E[(q+(z>0?1:-1)+24)%24],te=re[l.m],ne=re[H.m],le=H.gua===l.gua;return{active:!0,offset:z,threshold:De,sitting:l.m,jian:H.m,side:z>0?"右":"左",kind:le?"同卦兼":"出卦兼",sameYinYang:ne.yinYang===te.yinYang,note:`坐山偏离中心 ${z}°,兼${H.m}(${le?"同卦兼":"出卦兼"}${le&&ne.yinYang===te.yinYang?",同阴同阳":""});按沈氏替卦,山星以 ${Be[l.m]} 入中。`}}const _e={1:[],2:[["乾","巽"],["亥","巳"],["丑","未"]],3:[["卯","酉"],["乙","辛"],["辰","戌"]],4:[["艮","坤"],["寅","申"],["甲","庚"]],5:[["子","午"],["癸","丁"],["卯","酉"],["乙","辛"],["丑","未"],["辰","戌"]],6:[["艮","坤"],["寅","申"],["甲","庚"]],7:[["卯","酉"],["乙","辛"],["辰","戌"]],8:[["乾","巽"],["亥","巳"],["丑","未"]],9:[]},qe=["三元九运(1864 年起一运、每运 20 年,九运 180 年一轮)","玄空下卦挨星(运盘顺飞;山盘/向盘以入中运星本宫同元龙阴阳定顺逆,五黄入中按本山阴阳)","兼向替卦:坐山偏离中心超 4.5° 用《沈氏玄空学》坤壬乙诀替星入中,顺逆按替星本宫同元龙","年月日时紫白(公式派:年逐年退一位;月按年支三组起 8/5/2;日按冬至夏至三段起 1/7/4 与 9/3/6;时按日支三组子时起 1/7/4 与 9/3/6)","二十四山旺山旺向通行表(每项含正反两向;一运、九运无局;只对正向下卦)"],Ve="玄空排盘为传统通行口径的本地计算,属民俗参考,不构成现场勘舆结论,仅供娱乐;兼向超 4.5° 按沈氏替卦,年月日时紫白按公式派;各家另有异说,形峦与现场勘舆不在本工具范围内。";function Re(l,M,z,q={}){const H=re[M],te=re[z],ne=Number(q.offset)||0,le=Xe(H,ne),Q=Ae(l,!0),ye=le.active?Be[H.m]:Q[H.gua],we=le.active?Be[te.m]:Q[te.gua],Ne=Qe(H,ye),ge=Qe(te,we),be=Ae(ye,Ne.forward),oe=Ae(we,ge.forward),Ie=$e.map((fe,Le)=>({palace:fe,direction:fe==="中"?"中宫":j[fe],luoshu:Le+1,yun:Q[fe],shan:be[fe],xiang:oe[fe]})),Ze=fe=>$e.filter(Le=>fe[Le]===l),Fe=_e[l],Ce=Fe.find(([fe,Le])=>H.m===fe&&te.m===Le||H.m===Le&&te.m===fe),xe=be[H.gua]===l&&oe[te.gua]===l,Je={shan:le.active&&ye!==Q[H.gua],xiang:le.active&&we!==Q[te.gua]},nn=le.active?`替卦盘不套正向旺山旺向表;${xe?"本盘当运山星/向星仍到坐向。":"本盘当运山星/向星未同时到坐向。"}${!Je.shan&&!Je.xiang?"山向两替星均「用替而未替」,实际仍按原卦气。":""}`:xe&&Ce?"盘面与表法一致:本局到山到向。":xe?"盘面到山到向,但不在通行表法所列之局(表法与盘面口径不同,并列不合并)。":Ce?"通行表法列为旺山旺向,但本盘当运山星/向星未同时落坐向(表法与盘面口径不同,并列不合并)。":"本局既未到山到向,也不在表法旺山旺向之列。";return{palaces:Ie,sitting:H,facing:te,yun:Q,shan:be,xiang:oe,yunCenter:l,jianXiang:le,shanCenter:{star:ye,...Ne,mode:le.active?"替卦":"下卦",original:Q[H.gua],replaced:Je.shan},xiangCenter:{star:we,...ge,mode:le.active?"替卦":"下卦",original:Q[te.gua],replaced:Je.xiang},dangYun:{shan:Ze(be),xiang:Ze(oe)},heshi:{shan:$e.filter(fe=>be[fe]+Q[fe]===10),xiang:$e.filter(fe=>oe[fe]+Q[fe]===10)},wangShanWangXiang:{byChart:xe,byTable:le.active?null:!!Ce,table:Fe.map(([fe,Le])=>`${fe}${Le}`),note:nn}}}function Pe(l){const M=l.dst===!1?{year:l.year,month:l.month,day:l.day,hour:0,minute:0,applied:!1,note:null}:y({year:l.year,month:l.month,day:l.day,hour:0,minute:0});return{year:M.year,month:M.month,day:M.day,dst:M}}const pe=["大游年歌(八宅通行口径)","年家紫白飞星(纯公式:以 2026 丙午一白入中、逐年退一位、九年一轮;按立春换年)","24 山归属与度数(八宅通行口径,每山 15°)"],Ue="八宅与飞星为传统通行口径的本地计算,属民俗参考,不构成现场勘舆结论,仅供娱乐;实际户型以现场为准。";function We(l){if(l.action==="advise")return on(l);if(l.action==="xuankong")return cn(l);const M=l.gender;if(M!=="male"&&M!=="female")throw $("E_INPUT","风水命卦需要性别:男女命卦算法不同,不可缺省");if(!Number.isInteger(l.year)||!Number.isInteger(l.month)||!Number.isInteger(l.day))throw $("E_INPUT","风水命卦需要完整出生年月日(公历)——只知道年份不够:命卦按立春界划分出生年");const z=Pe(l),q=I(z.year,z.month,z.day),{num:H,gua:te,direction:ne}=N(q,M),le=v(te),Q=["坎","离","震","巽"].includes(te),ye=Number.isInteger(l.fortuneYear)?l.fortuneYear:null;return{system:"fengshui",meta:{birth:`${z.year}-${J(z.month)}-${J(z.day)}`,guaYear:q,gender:M==="male"?"男":"女",fortuneYear:ye,...z.dst.applied?{dst:z.dst.note}:{},...ye===null?{note:"未给流年:未算年紫白飞星(需要时补 fortuneYear)。"}:{},scope:"八宅命卦 + 大游年八星 + 年紫白;玄空飞星见 action=xuankong;不含形峦与现场勘舆。"},mingGua:{num:H,gua:te,direction:ne,group:Q?"东四命":"西四命",compatible:Q?"宜东四宅(坐坎离震巽)":"宜西四宅(坐乾坤艮兑)"},luckyDirections:he.map(we=>({star:we,...le[we]})),unluckyDirections:g.map(we=>({star:we,...le[we]})),...ye===null?{}:{yearlyFlying:ze(ye)},sources:pe,disclaimer:Ue}}function en(l){const M=typeof l.sitting=="string"&&l.sitting.trim()!=="",z=typeof l.facing=="string"&&l.facing.trim()!=="";if(!M&&!z)throw $("E_INPUT","缺少坐向:sitting(坐山)或 facing(向山)至少给一个——按罗盘 24 山报坐或报向,例如「坐北朝南」对应坐子向午");if(M&&z){const te=m(l.sitting.trim()),ne=m(l.facing.trim());if((te.index+12)%24!==ne.index)throw $("E_INPUT",`坐向不自洽:坐${te.m}(${te.deg}°)与向${ne.m}(${ne.deg}°)不是对宫(相差应 180°,实测 ${(ne.deg-te.deg+360)%360}°)——请核对罗盘读数。`)}const q=M?m(l.sitting.trim()):a(l.facing.trim()),H=E[(q.index+12)%24];return{sitting:q,facing:H}}function on(l){const{sitting:M,facing:z}=en(l),q=M.gua,H=v(q),te=he.map(ge=>H[ge]),ne=g.map(ge=>H[ge]),le=ge=>`${ge.direction}(${ge.palace}宫)`,Q=[...he,...g].map(ge=>({star:ge,lucky:he.includes(ge),...H[ge],role:d[ge]})),ye={door:`门宜开于吉方:首选生气方 ${le(te[0])},次选延年方 ${le(te[1])}、天医方 ${le(te[2])}。`,stove:`灶宜「坐凶向吉」:灶身压凶方(首选绝命方 ${le(ne[0])}、五鬼方 ${le(ne[1])}),灶口朝吉方。`,bed:`主卧与床头宜安吉方:生气方 ${le(te[0])} 或延年方 ${le(te[1])};床头宜向吉方。`,toilet:`厕所宜压凶方:祸害方 ${le(ne[3])} 或六煞方 ${le(ne[2])}(污去凶气,宜静常闭)。`};let we=null;const Ne=Number.isInteger(l.year)&&Number.isInteger(l.month)&&Number.isInteger(l.day)&&(l.gender==="male"||l.gender==="female");if(Ne){const ge=Pe(l),be=I(ge.year,ge.month,ge.day),oe=N(be,l.gender),Ie=c(oe.gua),Ze=c(q),Fe=Ie===Ze,Ce=he.map(xe=>`${xe}位${v(oe.gua)[xe].direction}`).join("、");we={birth:`${ge.year}-${J(ge.month)}-${J(ge.day)}`,guaYear:be,gender:l.gender==="male"?"男":"女",mingGua:{gua:oe.gua,direction:oe.direction,group:`${Ie}命`},houseGua:{gua:q,group:`${Ze}宅`},sameGroup:Fe,text:Fe?`命宅相配(${Ie}命住${Ze}宅):以宅之八星盘布局即可,个人吉方与宅吉方大体同向。`:`命宅不配(${Ie}命住${Ze}宅):传统调停法——门与床以命卦吉方为先(此命四吉方:${Ce}),灶仍按宅卦坐凶向吉,两盘各自取用。`}}return{system:"fengshui",meta:{action:"advise",...Ne?{}:{birthNote:"未提供生辰:未做命宅配;如需按个人命卦调停门床,请补充出生年月日与性别。"},sitting:`${M.m}山(罗盘 ${M.deg}°)`,facing:`${z.m}山(罗盘 ${z.deg}°)`,houseGua:q,houseGroup:`${c(q)}宅`,scope:"门主灶厕走向按八宅通行口径给倾向,玄空飞星见 action=xuankong;不含形峦、不是现场勘舆结论。"},houseStars:Q,layout:ye,...we?{mingMatch:we}:{},sources:pe,disclaimer:Ue}}function rn(l,M,z){const q=Q=>Q!=null&&Q!=="",H=(Q,ye)=>{if(typeof Q!="number"||!Number.isFinite(Q))throw $("E_INPUT",`${ye} 必须是数字(度),收到「${Q}」`);return Q},te=(Q,ye,we)=>{const Ne=H(Q,we);if(Ne<0||Ne>360)throw $("E_INPUT",`${we} 必须在 0–360° 之间(罗盘度数),收到「${Ne}」`);const ge=(Ne-ye.deg+540)%360-180;if(Math.abs(ge)>7.500000001)throw $("E_INPUT",`${we} ${Ne}° 不在${ye.m}山范围内(${ye.m}中心 ${ye.deg}°,每山 15°),请核对坐向。`);return ge},ne=[];if(q(l.sittingOffset)&&ne.push(H(l.sittingOffset,"sittingOffset")),q(l.sittingDegree)&&ne.push(te(l.sittingDegree,M,"sittingDegree")),q(l.facingOffset)&&ne.push(H(l.facingOffset,"facingOffset")),q(l.facingDegree)&&ne.push(te(l.facingDegree,z,"facingDegree")),!ne.length)return{offset:0,source:"未报兼向度数,按正向(0°)"};const le=ne[0];if(ne.some(Q=>Math.abs(Q-le)>1e-9))throw $("E_INPUT",`坐向兼度不一致:${ne.join("° / ")}°——坐与向应同向偏离,请只报一个偏移或核对度数。`);if(Math.abs(le)>7.5+1e-9)throw $("E_INPUT",`兼向偏移必须在 −7.5°–7.5°(相对本山中心),收到「${le}」——超过 7.5° 已进入下一山。`);return{offset:le,source:"按所报兼向度数"}}function ln(l){const M=Ne=>Ne!=null&&Ne!=="";if(!M(l.fortuneDate))return null;if(typeof l.fortuneDate!="string"||!/^\d{4}-\d{2}-\d{2}$/.test(l.fortuneDate))throw $("E_INPUT",`fortuneDate 需为 YYYY-MM-DD,收到「${l.fortuneDate}」`);const[z,q,H]=l.fortuneDate.split("-").map(Number),te=new Date(Date.UTC(z,q-1,H));if(te.getUTCFullYear()!==z||te.getUTCMonth()!==q-1||te.getUTCDate()!==H)throw $("E_INPUT",`fortuneDate 不是有效日期:「${l.fortuneDate}」`);const ne=M(l.fortuneTime)?l.fortuneTime:"12:00";if(typeof ne!="string"||!/^\d{2}:\d{2}$/.test(ne))throw $("E_INPUT",`fortuneTime 需为 HH:MM,收到「${ne}」`);const[le,Q]=ne.split(":").map(Number);if(le>23||Q>59)throw $("E_INPUT",`fortuneTime 超出范围(HH:MM):「${ne}」`);const ye=l.dst===!1?null:y({year:z,month:q,day:H,hour:le,minute:Q});return{at:ye?{year:ye.year,month:ye.month,day:ye.day,hour:ye.hour,minute:ye.minute}:{year:z,month:q,day:H,hour:le,minute:Q},dst:ye}}function cn(l){const{sitting:M,facing:z}=en(l),q=rn(l,M,z),H=ln(l);let te,ne=null,le;if(l.period!==void 0&&l.period!==null&&!Number.isInteger(l.period))throw $("E_INPUT",`运必须是 1–9 的整数(三元九运),收到「${l.period}」——一运 1864 起、九运 2024–2043。`);if(Number.isInteger(l.period)){if(l.period<1||l.period>9)throw $("E_INPUT",`运必须是 1–9 的整数(三元九运),收到「${l.period}」——一运 1864 起、九运 2024–2043。`);te=l.period}else Number.isInteger(l.fortuneYear)?(ne=Z(l.fortuneYear),te=ne.period):H?(ne=Z(I(H.at.year,H.at.month,H.at.day)),te=ne.period,le=`未显式给运:按飞星日期归入 ${ne.label}。`):(te=9,le="未给运:默认按九运(2024–2043)排盘;可传 period(1–9)或 fortuneYear 指定。");const Q=Re(te,M.m,z.m,{offset:q.offset}),ye=re[M.m],we=re[z.m],Ne=oe=>({star:oe.star,name:S[oe.star].name,fly:oe.forward?"顺飞":"逆飞",basis:oe.basis,mode:oe.mode,original:oe.original,replaced:oe.replaced}),ge=oe=>oe.map(Ie=>Ie==="中"?"中宫":`${Ie}宫${j[Ie]}`).join("、")||"无";let be=null;if(H)be=x(H.at),H.dst&&H.dst.applied&&(be.meta.dst=H.dst.note);else if(Number.isInteger(l.fortuneYear)){const oe=me(l.fortuneYear);be={year:{...Te(oe,!0),basis:`${l.fortuneYear} 年紫白 ${S[oe].name} 入中顺飞`},month:null,day:null,hour:null,meta:{guaYear:l.fortuneYear,note:"只给年份:已排年紫白;补 fortuneDate(YYYY-MM-DD)与 fortuneTime(HH:MM)可排月、日、时。"}}}return{system:"fengshui",meta:{action:"xuankong",period:te,periodLabel:ne?ne.label:`${te}运`,...ne?{year:l.fortuneYear||H&&H.at.year,periodStart:ne.start,periodEnd:ne.end}:{},sitting:`${M.m}山(罗盘 ${M.deg}°)`,facing:`${z.m}山(罗盘 ${z.deg}°)`,sittingGua:M.gua,facingGua:z.gua,sittingYuan:`${ye.yuan}${ye.yinYang}`,facingYuan:`${we.yuan}${we.yinYang}`,sittingOffset:q.offset,jianXiang:Q.jianXiang,shanCenter:Ne(Q.shanCenter),xiangCenter:Ne(Q.xiangCenter),...le?{note:le}:{},scope:"玄空下卦/替卦:运盘 + 山盘 + 向盘 + 当运星 + 合十 + 表法旺山旺向;兼向超 4.5° 按沈氏替卦;年月日时紫白按公式派;不含形峦与现场勘舆。"},palaces:Q.palaces,dangYun:{shan:{palaces:Q.dangYun.shan,text:ge(Q.dangYun.shan)},xiang:{palaces:Q.dangYun.xiang,text:ge(Q.dangYun.xiang)}},heshi:{shan:Q.heshi.shan,xiang:Q.heshi.xiang},wangShanWangXiang:Q.wangShanWangXiang,...be?{timeFlying:be}:{},sources:qe,disclaimer:Ve}}return{NINE_STARS:S,PALACE_DIRECTION:j,DAYOUTIAN:_,LUCKY_STARS:he,UNLUCKY_STARS:g,MOUNTAINS_24:E,mountainInfo:m,sittingFromFacing:a,STAR_LAYOUT_ROLE:d,mingGua:N,eightStars:v,guaYearOf:I,yearZibaiStar:me,yearlyFlying:ze,timeFlyingOf:x,periodOfYear:Z,MOUNTAIN_META:re,TIGUA_SOURCE:tn,TIGUA_TABLE:Be,JIAN_XIANG_THRESHOLD:De,jianXiangOf:Xe,WANG_SHAN_WANG_XIANG:_e,XUANKONG_SOURCES:qe,XUANKONG_DISCLAIMER:Ve,xuankongChart:Re,buildFengshui:We}})(),C.followup=(function(){const{ZIWEI_STARS:X}=C["interpret-data"]||{},W=[{key:"career",label:"事业",words:["事业","工作","跳槽","升职","创业","职业","岗位","离职","加薪","面试","offer"]},{key:"wealth",label:"财富",words:["财","钱","收入","投资","买房","存款","亏","赚","分红"]},{key:"love",label:"感情",words:["感情","婚","恋","对象","分手","复合","姻缘","结婚","桃花"]},{key:"health",label:"健康",words:["健康","病","身体","手术","失眠","体检","医院"]},{key:"study",label:"学业",words:["学业","考试","学习","考研","考公","证书","升学"]},{key:"travel",label:"出行",words:["出行","搬家","旅行","出国","迁","远行"]}],V={career:"官禄",wealth:"财帛",love:"夫妻",health:"疾厄",study:"官禄",travel:"迁移",overall:"命宫"},D=(g,E)=>{const u=String(g).match(/(20\d{2})\s*年?/);if(u)return Number(u[1]);const m=Array.isArray(E.liunian)&&E.liunian[0]?Number(E.liunian[0].year):null;return m?/明年/.test(g)?m+1:/后年/.test(g)?m+2:/去年/.test(g)?m-1:/今年|本年/.test(g)?m:null:null},L=g=>W.find(E=>E.words.some(u=>String(g).includes(u)))||null;function O(g,E){const u=D(E,g),m=L(E),a=Array.isArray(g.liunian)?g.liunian:[],c=Array.isArray(g.dayun?.list)?g.dayun.list:[],d=a.map(f=>f.year);if(u&&!a.some(f=>Number(f.year)===u))return{ok:!1,year:u,topic:m,answer:`这一盘已排的流年范围是 ${d[0]}–${d[d.length-1]},没有 ${u} 年。可以把问题改到范围内,或用 asOf 指定你想看的年份重新排盘。`,evidence:[`已排流年:${d.join("、")}`],confidence:"弱"};if(u){const f=a.find(Se=>Number(Se.year)===u),N=c.find(Se=>Number(Se.startAge)<=Number(f.age)&&Number(f.age)<=Number(Se.startAge)+9)||null,v=f.luck?.tier||"平",I=(f.luck?.reasons||[]).slice(0,3),me=(f.relations||[]).join("、"),$e=m?F(g,m.key):"";return{ok:!0,year:u,topic:m,answer:`${u} 年(${f.ganzhi})流年,十神为${f.stemTenGod||"—"},档位「${v}」;所行大运 ${N?`${N.ganzhi}(${N.luck?.tier||"平"})`:"未取到"}。${I.length?`理由:${I.join(",")}。`:""}${me?`与该年地支相关的原局关系:${me}。`:""}${$e}`,evidence:[`流年 ${f.year} ${f.ganzhi}·${f.stemTenGod||""}·${v}`,N?`大运 ${N.ganzhi}·${N.luck?.tier||"平"}`:"",me?`原局关系 ${me}`:"",m?`问题方向:${m.label}`:""].filter(Boolean),confidence:N&&I.length?"强":"中"}}if(m){const f={wealth:"overall",study:"work",travel:"overall"}[m.key]||m.key,N=(g.interpret?.dimensions||[]).find(v=>v.key===m.key||v.key===f);if(N){const v=g.frame&&g.frame.godStats&&g.frame.godStats.groups||{},I=m.key==="wealth"?` 财星权重 ${Number(v.财||0)}(只作结构参考,不含金额)。`:"";return{ok:!0,year:null,topic:m,answer:`按${m.label}这条线看:${N.text}${I}${N.advice?` 建议:${N.advice}`:""}`,evidence:(N.evidence||[]).slice(0,4),confidence:N.confidence||"中"}}}return{ok:!1,year:null,topic:m,answer:`这个问题里没有识别到具体的年份或方面。可以这样问:「2027 年事业怎么样」「财运如何」「感情在 2028 年」;已排流年是 ${d[0]}–${d[d.length-1]}。`,evidence:[`可问年份:${d.join("、")}`],confidence:"弱"}}function w(g,E){const u=D(E,g),m=L(E),a=Array.isArray(g.liunian)?g.liunian:[];if(u&&!a.some(c=>Number(c.year)===u))return{ok:!1,year:u,topic:m,answer:`这一盘的流年表覆盖 ${a[0]?.year}–${a[a.length-1]?.year},没有 ${u} 年;可以换一个年份,或用 asOf 指定起点重新排盘。`,evidence:[`流年表:${a.map(c=>c.year).join("、")}`],confidence:"弱"};if(u){const c=a.find(f=>Number(f.year)===u),d=c.daxian||{};return{ok:!0,year:u,topic:m,answer:`${u} 年(${c.ganzhi},${c.age} 岁)流年命宫落在「${c.lifePalace?c.lifePalace.palace:"—"}」,四化为 ${(c.mutagen||[]).join("、")||"不明显"};所行大限${d.palace?`在${d.palace}(${d.start}–${d.end} 岁)`:"未取到"}。${m?`与「${m.label}」对应的宫位信号见下条依据。`:""}`,evidence:[`流年命宫 ${c.lifePalace?c.lifePalace.palace:"—"}(${c.lifePalace?c.lifePalace.branch:"—"})`,`四化 ${(c.mutagen||[]).join("、")||"不明显"}`,d.palace?`大限 ${d.palace}·${d.start}–${d.end}岁`:""].filter(Boolean),confidence:(c.mutagen||[]).length>=3?"强":"中"}}if(m){const c=V[m.key]||"命宫",d=(g.palaces||[]).find(f=>f.palace===c);if(d){const f=(d.stars||[]).filter(v=>v.type==="主星").map(v=>v.name),N=f.map(v=>X[v]?.trait).filter(Boolean).slice(0,2).join(";");return{ok:!0,year:null,topic:m,answer:`「${m.label}」看${c}:主星${f.length?f.join("、"):"无正曜(借对宫)"}${N?`——${N}`:""}。宫支${d.branch},${d.stems,""}生年四化与煞星的影响需结合报告里的对应分节一起看。`,evidence:[`${c} ${d.branch}·${f.join("、")||"无正曜"}`,...(d.shensha||[]).slice(0,3)],confidence:f.length?"强":"弱"}}}return{ok:!1,year:null,topic:m,answer:"没有识别到具体年份或方面。可以问「2028 年事业」「感情怎么样」「财运在 2030 年」;也可以直接问某个宫位,如「夫妻宫」。",evidence:[],confidence:"弱"}}function F(g,E){return`这段时间可以重点对照报告里「${{career:"事业",wealth:"财富",love:"感情",health:"健康",study:"学业",travel:"出行"}[E]||"整体"}」一节看。`}function y(g,E){const u=L(E),m=Array.isArray(g.interpret?.sections)?g.interpret.sections:[],a=u?m.find(d=>d.label.includes(u.label)||d.text.includes(u.label)):null;if(a)return{ok:!0,year:null,topic:u,answer:a.text,evidence:[`引用分节:${a.label}`],confidence:"中"};const c=m[0];return{ok:!1,year:null,topic:u,answer:c?`这一盘的追问需要落到具体方面(事业 / 财富 / 感情 / 健康 / 学业 / 出行)。先看「${c.label}」这一节,或把问题说得更具体一点。`:"这一盘暂时没有可追问的分节;先看完整解析,再问具体方面。",evidence:[],confidence:"弱"}}function $(g,E){const u=String(E||"").trim(),m=g&&g.system==="bazi"?O(g,u):g&&g.system==="ziwei"?w(g,u):y(g,u);return{question:u,...m}}const S={bazi:"八字(四柱)",ziwei:"紫微斗数",liuyao:"六爻",meihua:"梅花易数",daliuren:"大六壬",qimen:"奇门遁甲",tarot:"塔罗",hepan:"合盘",chenggu:"称骨",almanac:"黄历",zeri:"择日",star:"星座",numerology:"生命数字",mbti:"十六型人格",trend:"人生 K 线",fengshui:"风水",name:"起名",convert:"公农历互转"},j=Object.freeze({bazi:["基本信息","四柱(日主/十神/藏干)","旺衰·格局·用神","合冲·神煞","起运·大运·流年","古籍依据"],ziwei:["基本信息","命宫/身宫与五行局","十二宫(主星/辅煞/四化)","格局与三方四正","大限/流年","古籍依据"],liuyao:["所问与用神","本卦/变卦(世应/动爻/六亲)","月建日辰(旺衰/空破)","应期线索","卦辞与依据"],meihua:["所问与体用","本卦/互卦/变卦","五行生克","应期与依据"],daliuren:["天地盘(月将/贵人)","四课","三传","课体与神将","依据"],qimen:["四柱与局数","九宫(星门神/天盘干)","用神落宫","门宫·干宫·十干克应","旺衰·击刑入墓","依据"],tarot:["问题与牌阵","逐牌(正逆/元素)","牌间关系","综合倾向","边界"],fengshui:["坐向与元运","运盘/山盘/向盘","旺山旺向","取象与边界"]}),G=Object.freeze(["基本信息","盘面事实","结构与关系","倾向","边界"]);function _(g){return j[g]||G}function he(g,E={}){const u=S[g&&g.system]||g&&g.system||"未知体系",a=String(E&&E.question||"").trim()||"请先用一句白话讲清这张盘的主线,再指出最值得注意的一两处,并说明每处的具体依据。",c=Number.isFinite(E&&E.maxChars)&&E.maxChars>=400?E.maxChars:3e3,d=String(g&&g.summary||"").trim(),f=d.length>c,N=f?`${d.slice(0,c)}…(摘要已截断)`:d,v=E&&typeof E.interpret=="object"&&E.interpret||g&&typeof g.interpret=="object"&&g.interpret||null,I=String(v&&v.answer||"").trim(),me=String(v&&v.plain||"").trim(),$e=[];I&&$e.push(`直答:${I}`),me&&$e.push(`说人话:${me}`);const Te=["【命理追问】下面这张盘是命理插件刚排好的,请就着它回答我的问题;不用重新排盘,盘面字段已经够用。",`体系:${u}`,`所问:${a}`,"",...$e.length?["——开场结论(插件已按同一套规则算好,开场先沿用这句;措辞可改,口径别换)——",...$e,""]:[],"——盘面层次(从上到下读,别跳层)——",`${u}:${_(g&&g.system).join(" → ")}`,"先复述事实,再讲结构与时间;上一层没交代清楚,不要跳到下一层。","","——盘面摘要——",N||"(这张盘没有摘要字段,请先让我重新排一次。)","","——回答要求——","读者不懂命理。按下面的骨架答;任何一句他看不懂,就算没写完:",$e.length?"1) 开头一句结论:先沿用上面的「开场结论」,再用一句不用术语的话说清这张盘的主线——只读这一句也该有收获;":"1) 开头一句结论:不用术语,一句话说清这张盘的主线,只读这一句也该有收获;","2) 第二段只复述盘面骨架:按上面的层次用 2–4 行写事实(如四柱、格局、用神、大运),不掺倾向,让读者知道后面的判断从哪来;","3) 判断最多两条,按重要性排序,每条分四行写:"," 盘面|只引盘面已有的字(具体的柱、宫或爻、字段名),不掺解释;"," 白话|把上一行的术语当场翻成日常话——调候 / 化气 / 通关 / 空亡 / 争合 这类词必须落地,一个词只翻一次,不连续堆三个以上;"," 倾向|说「更可能……」,讲清它在现实里大概意味着什么,用概率语气;"," 边界|这条在什么情况下不成立;盘面没给的,直接写「这盘里看不出来」;","4) 收尾一句「如果只记一件事」:给一条能核对、能动手的观察点,并说明它出自上面哪条盘面依据;","5) 别把传统说法当成已证实的事实:不下绝对断言,也不用「肯定」「绝对」这类词,更不写「格局很好」「运程不顺」这种没有信息的空话。"].join(`
|
|
68
|
+
`);return{text:Te,question:a,system:g&&g.system||"",label:u,chars:Te.length,truncated:f}}return{followup:$,READING_ORDERS:j,READING_ORDER_FALLBACK:G,readingOrderOf:_,askPrompt:he}})(),C.revise=(function(){const X=[{key:"ziwei",label:"紫微",re:/紫微|斗数/},{key:"bazi",label:"八字",re:/八字|四柱/},{key:"liuyao",label:"六爻",re:/六爻|摇卦/},{key:"qimen",label:"奇门",re:/奇门/},{key:"daliuren",label:"大六壬",re:/大六壬|六壬/},{key:"tarot",label:"塔罗",re:/塔罗|抽牌/},{key:"meihua",label:"梅花",re:/梅花/},{key:"hepan",label:"合盘",re:/合盘|合婚/},{key:"almanac",label:"黄历",re:/黄历|老黄历/},{key:"zeri",label:"择日",re:/择日|挑日子/},{key:"fengshui",label:"风水",re:/风水/},{key:"name",label:"起名",re:/起名|取名/},{key:"chenggu",label:"称骨",re:/称骨/},{key:"xiaoliuren",label:"小六壬",re:/小六壬/},{key:"star",label:"星座",re:/星座/},{key:"numerology",label:"生命数字",re:/生命数字|生命灵数/},{key:"mbti",label:"MBTI",re:/mbti|人格测试|十六型/i},{key:"trend",label:"人生 K 线",re:/k\s*线|人生曲线/i},{key:"convert",label:"公农历互转",re:/农历转公历|公历转农历|公农历/}],W=[{key:"love",label:"感情",re:/感情|婚姻|恋爱|对象|夫妻/},{key:"wealth",label:"财运",re:/财运|财富|赚钱|收入|破财/},{key:"career",label:"事业",re:/事业|工作|升职|跳槽/},{key:"health",label:"健康",re:/健康|身体|疾病|病/},{key:"study",label:"学业",re:/学业|考试|考研|升学|读书/},{key:"travel",label:"出行",re:/出行|搬家|迁移|旅行|外地/}],V=/换成|改成|改为|换到|改看|再看|再看一下|换一套|排一?张|用|按|看/,D=y=>String(y||"").replace(/(出生|出生地|所在地|人)$/,"").replace(/[的了].*$/,"").trim();function L(y){const $=String(y??"").trim(),S={},j=[],G=[];if(!$)return{text:"",patch:S,labels:j,ignored:G};if(V.test($)){for(const g of X)if(g.re.test($)){S.system=g.key,j.push({key:"system",label:"体系",value:g.key,display:g.label});break}}/女命|女性|换成女|改成女|女盘/.test($)?(S.gender="female",j.push({key:"gender",label:"性别",value:"female",display:"女"})):/男命|男性|换成男|改成男|男盘/.test($)&&(S.gender="male",j.push({key:"gender",label:"性别",value:"male",display:"男"})),/晚子时/.test($)&&(/不换日|不换天|算当日|归当日|按当日|当天/.test($)?(S.lateZi=!1,j.push({key:"lateZi",label:"晚子时",value:!1,display:"23:00 后仍算当日"})):/换日|算次日|归次日|按次日|第二天|次日/.test($)&&(S.lateZi=!0,j.push({key:"lateZi",label:"晚子时",value:!0,display:"23:00 后算次日"}))),/真太阳时/.test($)&&(/不用|不要|关闭|关掉|取消|不算/.test($)?(S.trueSolar=!1,j.push({key:"trueSolar",label:"真太阳时",value:!1,display:"用东八区平太阳时"})):(S.trueSolar=!0,j.push({key:"trueSolar",label:"真太阳时",value:!0,display:"按出生地经度校正"}))),/夏令时/.test($)&&(/不用|不要|关闭|关掉|取消|不校正/.test($)?(S.dst=!1,j.push({key:"dst",label:"夏令时",value:!1,display:"不自动校正 1986–1991 夏令时"})):(S.dst=!0,j.push({key:"dst",label:"夏令时",value:!0,display:"自动校正 1986–1991 夏令时"})));const _=$.match(/出生在\s*([\u4e00-\u9fa5]{2,12})/)||$.match(/出生地(?:改成|改为|换成|换到|是|为)?\s*([\u4e00-\u9fa5]{2,12})/)||$.match(/改到\s*([\u4e00-\u9fa5]{2,12})\s*出生/);if(_){const g=D(_[1]);g.length>=2&&(S.address=g,j.push({key:"address",label:"出生地",value:g,display:g}))}const he=$.match(/(?:看|查|问|到|到了|临近)\s*((?:19|20)\d{2})\s*年/)||$.match(/((?:19|20)\d{2})\s*年(?:的)?(?:运势|怎么样|如何|会怎样|流年)/);if(he){const g=Number(he[1]);S.asOf=`${g}-01-01T00:00`,j.push({key:"asOf",label:"流年基准",value:S.asOf,display:`${g} 年`})}else/(出生|生年)/.test($)&&/(19|20)\d{2}\s*年/.test($)&&G.push("出生年份没改:一句话改不出日与时辰,请直接传 datetime(如 1993-04-08T06:20)");for(const g of W)if(g.re.test($)){S.direction=g.key,j.push({key:"direction",label:"询问方向",value:g.key,display:g.label});break}return/解读|详解|详细说|说人话/.test($)&&!/不要解读|不用解读|别解读/.test($)&&(S.withInterpret=!0,j.push({key:"withInterpret",label:"解读",value:!0,display:"附解析与详解"})),{text:$,patch:S,labels:j,ignored:G}}const O=X,w=W;function F(y,$){if($==null)return null;if(y==="system"){const S=X.find(j=>j.key===$);return S?S.label:String($)}if(y==="gender")return $==="female"?"女":$==="male"?"男":String($);if(y==="direction"){const S=W.find(j=>j.key===$);return S?S.label:String($)}if(typeof $=="boolean")return $?"开":"关";if(y==="asOf"){const S=String($).match(/^(\d{4})/);return S?`${S[1]} 年`:String($)}return String($)}return{parseRevision:L,REVISE_SYSTEMS:O,REVISE_DIRECTIONS:w,displayValue:F}})(),C.handle=(function(){const{fail:X}=C.fail||{},W="mc1.",V=new Set(["handle","trace","shadow","shadowVersion","diff","withInterpret","cross","verifyPast","rectify","events","ask","followup","question","geocode","caliber","revise"]),D=u=>u!==null&&typeof u=="object"&&!Array.isArray(u);function L(u){if(Array.isArray(u))return`[${u.map(a=>L(a===void 0?null:a)).join(",")}]`;if(D(u))return`{${Object.keys(u).filter(c=>u[c]!==void 0).sort().map(c=>`${JSON.stringify(c)}:${L(u[c])}`).join(",")}}`;const m=JSON.stringify(u===void 0?null:u);return m===void 0?"null":m}function O(u){let m=2166136261;for(let a=0;a<u.length;a++)m^=u.charCodeAt(a),m=Math.imul(m,16777619)>>>0;return m.toString(16).padStart(8,"0")}const w="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_";function F(u){const m=[];for(const a of String(u)){let c=a.codePointAt(0);c<128?m.push(c):c<2048?m.push(192|c>>6,128|c&63):c<65536?m.push(224|c>>12,128|c>>6&63,128|c&63):m.push(240|c>>18,128|c>>12&63,128|c>>6&63,128|c&63)}return m}function y(u){let m="";for(let a=0;a<u.length;){const c=u[a];let d,f;c<128?(d=c,f=1):c<224?(d=c&31,f=2):c<240?(d=c&15,f=3):(d=c&7,f=4);for(let N=1;N<f;N++)d=d<<6|u[a+N]&63;a+=f,m+=String.fromCodePoint(d)}return m}function $(u){const m=F(u);let a="";for(let c=0;c<m.length;c+=3){const d=m[c],f=m[c+1],N=m[c+2];if(a+=w[d>>2],a+=w[(d&3)<<4|(f===void 0?0:f)>>4],f===void 0||(a+=w[(f&15)<<2|(N===void 0?0:N)>>6],N===void 0))break;a+=w[N&63]}return a}function S(u){const m=[];let a=0,c=0;for(const d of u){const f=w.indexOf(d);if(f<0)throw new Error(`不是 base64url 字符:${d}`);a=a<<6|f,c+=6,c>=8&&(c-=8,m.push(a>>c&255))}return y(m)}function j(u={}){const m={};for(const[a,c]of Object.entries(u||{}))V.has(a)||c===void 0||(m[a]=c);return m}function G(u={}){const m=j(u);if(!Object.keys(m).length)return"";const a=$(L(m));return`${W}${a}.${O(a)}`}function _(u){if(typeof u!="string"||!u.trim())throw X("E_HANDLE","handle 必须是非空字符串;没拿到句柄时照常传 system + datetime 等原始参数即可");const m=u.trim();if(!m.startsWith(W))throw X("E_HANDLE",`handle 前缀不对(应以 ${W} 开头):句柄来自旧版本或复制不全,重新排一次盘取新的 handle`);const a=m.slice(W.length),c=a.lastIndexOf(".");if(c<=0)throw X("E_HANDLE","handle 缺少校验位:复制时可能被截断,重新取一次");const d=a.slice(0,c),f=a.slice(c+1);if(O(d)!==f)throw X("E_HANDLE","handle 校验不通过:内容被改动或截断,重新排一次盘取新的 handle");let N;try{N=JSON.parse(S(d))}catch{throw X("E_HANDLE","handle 内容无法解析(不是本插件生成的句柄),重新排一次盘取新的 handle")}if(!D(N))throw X("E_HANDLE","handle 内容不是参数对象,重新排一次盘取新的 handle");return N}function he(u={}){if(!D(u))return u;const{handle:m,...a}=u;if(m==null||m==="")return{...a};const d={..._(m)};for(const[f,N]of Object.entries(a))N!==void 0&&(d[f]=N);return d}return{handlePayload:j,encodeHandle:G,decodeHandle:_,resolveHandle:he,HANDLE_PREFIX:W,handleChecksum:O}})(),C.bridge=(function(){const{encodeHandle:X,decodeHandle:W,HANDLE_PREFIX:V}=C.handle||{},{askPrompt:D}=C.followup||{},L=200,O=60,w={bazi:"八字",ziwei:"紫微",liuyao:"六爻",meihua:"梅花",daliuren:"大六壬",qimen:"奇门",hepan:"合盘",tarot:"塔罗",almanac:"黄历",zeri:"择日",chenggu:"称骨",xiaoliuren:"小六壬",star:"星座",numerology:"生命数字",mbti:"人格",trend:"人生K线",fengshui:"风水",name:"起名",convert:"农历"},F=m=>w[m]||m||"未知体系";function y(m){const a=String(m||""),c=a.indexOf("#");return c<0?a:a.slice(0,c)}function $(m){try{return encodeURIComponent(m)}catch{return""}}function S(m){try{return decodeURIComponent(m)}catch{return String(m||"")}}function j(m={},a={}){const c=a||{},f=String(c.handle||m&&m.handle||"").trim()||X(m||{});if(!f||!f.startsWith(V))return"";const N=String(c.question||"").trim().slice(0,L),v=[`mp=${f}`];return N&&v.push(`q=${$(N)}`),`${y(c.base)}#${v.join("&")}`}function G(m){const a=String(m||"").trim();if(!a)return{ok:!1,code:"E_LINK",message:"没有链接内容:请粘贴带 #mp= 的完整链接"};let c="";const d=a.indexOf("#");if(d>=0&&a.slice(d+1).trim())c=a.slice(d+1).trim();else{const I=a.indexOf("?");I>=0&&a.slice(I+1).trim()?c=a.slice(I+1).trim():/^mp=/.test(a)&&(c=a)}if(!c)return{ok:!1,code:"E_LINK",message:"链接里没有 #mp= 片段:这不是本插件生成的深链"};const f={};for(const I of c.split("&")){if(!I)continue;const me=I.indexOf("=");if(me<=0)continue;const $e=I.slice(0,me),Se=I.slice(me+1);$e==="mp"?f.mp=Se:$e==="q"&&(f.q=Se)}if(!f.mp)return{ok:!1,code:"E_LINK",message:"链接里没有 mp 参数(只有问题没有盘):无法还原盘面"};let N;try{N=W(f.mp)}catch(I){return{ok:!1,code:I&&I.code||"E_HANDLE",message:I&&I.message||"句柄无法解析"}}const v=f.q?S(f.q).slice(0,L):"";return{ok:!0,handle:f.mp,args:N,question:v,system:N.system||"",label:F(N.system)}}const _=m=>{const a=/^(\d{4}-\d{1,2}-\d{1,2})[T ](\d{1,2}:\d{2})/.exec(String(m||"").trim());if(!a)return{date:"",time:""};const[c,d,f]=a[1].split("-");return{date:`${c}-${String(d).padStart(2,"0")}-${String(f).padStart(2,"0")}`,time:a[2].padStart(5,"0")}},he=["gender","address","trueSolar","lateZi","lines"];function g(m){const a=m&&m.ok?m:null,c=a&&a.args||{},d=_(c.datetime),f={tab:c.system||"",date:d.date,time:d.time,question:a&&a.question||"",restored:[],rest:{}};f.tab&&f.restored.push("system"),d.date&&f.restored.push("datetime");for(const N of he)c[N]===void 0||c[N]===null||(f[N]=c[N],f.restored.push(N));f.question&&f.restored.push("question");for(const[N,v]of Object.entries(c))N==="system"||N==="datetime"||he.includes(N)||(f.rest[N]=v);return f}function E(m){const a=Object.keys(m&&m.rest||{});return a.length?`链接里还有 ${a.length} 项没填回表单(${a.join("、")}):这些只在引擎调用里生效,页面上按默认值显示。`:""}function u(m,a={}){const c=a||{},d=m||{},f=d.system||"",N=F(f),v=String(c.question||"").trim(),I=String(d.handle||"").trim();let me="";try{const p=D(d,{question:v,interpret:c.interpret});me=p&&p.text||String(d.summary||"")}catch{me=String(d.summary||"")}const $e=v?v.length>O?`${v.slice(0,O)}…`:v:"(未填问题:按摘要讲主线)",Se=I?`【命理追问】${N}|${I}|问:${$e}`:`【命理追问】${N}|问:${$e}`,Te={};I&&(Te.handle=I),f&&(Te.system=f),v&&(Te.question=v);const ze=JSON.stringify({tool:"metaphysics",v:1,args:Te},null,2),s=I?j({handle:I},{question:v,base:c.base}):"";return{system:f,label:N,handle:I,question:v,full:me,brief:Se,structured:ze,link:s}}return{LINK_MAX_QUESTION:L,askLink:j,parseAskLink:G,formOf:g,restNote:E,askPackages:u}})(),C["plain-summary"]=(function(){const{ASK_KINDS:X}=C["event-prompt"]||{},{PALACE_FIELD:W,GATE_MEANING:V}=C["qimen-prompt"]||{},D=X||{},L=W||{},O=V||{},w={wealth:"business",career:"career",love:"love",health:"other",study:"career",travel:"action",general:"other"},F=s=>w[s]||(D[s]?s:"other"),y={木:{color:"青、绿",where:"东边、有树有水的地方",daily:"早上多出门走走"},火:{color:"红、橙、紫",where:"南边、向阳的房间",daily:"白天多晒太阳,别总待在阴冷的屋里"},土:{color:"黄、棕、米色",where:"中原地带、干爽高燥处",daily:"把作息和吃饭时间固定下来"},金:{color:"白、银、浅灰",where:"西边、通风利落的地方",daily:"把该断的事断干净,别拖"},水:{color:"黑、深蓝",where:"北边、临水处",daily:"留出独处和放空的时间"}},$={正印:"靠吸收和消化来获得安全感,习惯先想明白再动",偏印:"想得比说得多,一件事会在心里推演出很多种可能",正官:"对规矩和责任敏感,别人一句交代会变成自己的压力",七杀:"对压力和竞争敏感,遇强则强,也容易被强势的人吸引",正财:"对现实条件敏感,不太会被空话打动",偏财:"对机会敏感,愿意为看得见的回报承担风险",食神:"表达温和,喜欢把日子过得有滋味",伤官:"有自己的标准,看不上粗糙的东西,容易先挑毛病",比肩:"自我边界清楚,不太愿意被安排",劫财:"同辈之间容易较劲,也容易替朋友出头"},S={长生:"刚起步,有生机",沐浴:"不安定,容易被外界牵动",冠带:"在成形,开始要面子",临官:"正当力,能扛事",帝旺:"很足,但也容易过满",衰:"开始收力,做事偏保守",病:"使不上劲,需要借外力",死:"静态,不爱主动",墓:"收着、藏着,不爱外露",绝:"在这里使不上劲,容易觉得被压着",胎:"还在孕育,慢热",养:"在积攒,等时机"},j={紫微:"要主导、在意体面",天机:"脑子转得快,爱盘算",太阳:"愿意给出去,也容易被消耗",武曲:"务实,认结果",天同:"图安稳,怕冲突",廉贞:"要强,情绪起伏大",天府:"稳,能存住东西",太阴:"细腻,心思藏在里面",贪狼:"欲望强、多才多艺",巨门:"爱辨析,也容易生口舌",天相:"会配合,擅长讲和",天梁:"老成,愿意护着别人",七杀:"独断,敢冲",破军:"破旧立新,不安于现状"},G={庙:"得力",旺:"得力",得地:"还算得力",平:"一般",陷:"不太稳"},_=s=>[...new Set(s.filter(Boolean))],he={寅:"初春",卯:"仲春",辰:"暮春",巳:"初夏",午:"盛夏",未:"长夏",申:"初秋",酉:"仲秋",戌:"深秋",亥:"初冬",子:"仲冬",丑:"隆冬"};function g(s,p){const Y={po:[],chong:[],he:[]};for(const K of s&&s.branches||[])!p||!String(K).includes(p)||(/破/.test(K)?Y.po.push(K):/冲/.test(K)?Y.chong.push(K):/合/.test(K)&&Y.he.push(K));return Y}function E(s){const p=s.pillars||{},Y=p.day||{},K=p.month||{},P=s.dayMaster||{},B=s.climate||{},b=s.input&&s.input.gender||"female",A=Object.entries(s.frame&&s.frame.godStats&&s.frame.godStats.groups||{}).filter(([,pe])=>pe>0).sort((pe,Ue)=>Ue[1]-pe[1]),x=s.frame&&s.frame.yongshen&&s.frame.yongshen.favorTenGods||[],J=s.frame&&s.frame.yongshen&&s.frame.yongshen.favor||[],Z=s.frame&&s.frame.yongshen&&s.frame.yongshen.avoid||[],se=he[K.branch]||`${K.branch}月`,R=B.label==="寒湿"?"天寒水旺,木像冬天的藤,不是不强,是冷得伸展不开":B.label==="燥热"?"火土偏燥,像久旱的地,需要水和湿气来松一松":"寒暖相对均衡,没有极端的偏枯",re=B.need&&B.need.element||J[0]||"",je=`${P.stem||""}${P.element||""}日主,生在${se}${K.branch||""}月:${R}。${re?`最需要的是${re}${B.need&&B.need.why?`——${B.need.why}`:""}。`:""}整体${s.strength?s.strength.level:"中和"},不是极旺也不是极弱,所以${s.strength&&s.strength.level==="身弱"?"很多事要靠外部条件配合,硬扛不如借力":"撑得住,关键是别把力气用在错的地方"}。`,Ee=A.slice(0,2).map(([pe])=>pe),Oe=[];for(const pe of Object.values(p))pe&&(pe.stemTenGod&&Oe.push(pe.stemTenGod),pe.hidden&&pe.hidden[0]&&pe.hidden[0].tenGod&&Oe.push(pe.hidden[0].tenGod));const Ae=`${Ee.map(pe=>{const Ue={印:["正印","偏印"],官杀:["正官","七杀"],食伤:["食神","伤官"],财:["正财","偏财"],比劫:["比肩","劫财"]}[pe]||[],We=Ue.find(en=>Oe.includes(en))||Ue[0];return We&&$[We]?`${pe}偏重:${$[We]}。`:""}).filter(Boolean).join("")}${x.length,""}`+(Ee.includes("印")?"想得多是你的默认状态,好处是稳,代价是慢和累。":""),Qe=b==="female"?["正官","七杀"]:["正财","偏财"],tn=b==="female"?"官杀(正官与七杀)":"财星(正财与偏财)",Be={year:"年干",month:"月干",day:"日干",hour:"时干"},De=Object.entries(p).filter(([,pe])=>pe&&Qe.includes(pe.stemTenGod)).map(([pe,Ue])=>`${Be[pe]}${Ue.stemTenGod}`),Xe=Y.hidden&&Y.hidden[0]&&Y.hidden[0].tenGod||"",_e=g(s.relations,Y.branch),qe=[];qe.push(`${b==="female"?"女命":"男命"}看配偶星取${tn}${De.length?`,${De.join("、")}`:",盘中未透干"}${De.length?"——摆在明处,说明这件事在你生活里是绕不开的主题":"——不显在明处,往往要靠后天遇到的人把它带出来"}。`),Xe&&qe.push(`日支(配偶宫)坐${Y.branch}${Xe}${Y.dishi?`,日主在这里是「${Y.dishi}」:${S[Y.dishi]||""}`:""}。`),_e.po.length&&qe.push(`日支与另一支相破(${_e.po.join("、")}):破不是吵架,是那种说不清、解释不明白的暗耗,容易冷处理。`),_e.chong.length&&qe.push(`日支逢冲(${_e.chong.join("、")}):关系里变动感强,聚散、异地、节奏不一致都可能出现。`),_e.he.length&&qe.push(`日支有合(${_e.he.join("、")}):容易被关系拴住,进去了就不太想出来。`),s.hourUnknown&&qe.push("时柱暂缺,所以「子女」这一路的信息读不出,感情结论也就少了三分之一。");const Ve=(s.frame&&s.frame.geju||[]).map(pe=>pe.name),Re=[];_e.po.length&&Re.push("破在日支:最伤人的往往不是大事,是没说开的小事。"),Ve.includes("伤官见官")&&Re.push("盘里有「伤官见官」的组合:既想要稳定,又忍不了对方的毛病,这是同一件事的两面。"),Ee.includes("印")&&!Ee.includes("财")&&Re.push("印重而财轻:想得多、落得少;越焦虑越容易继续想。"),Re.length||Re.push("这一盘没有特别尖锐的冲克,卡点更多在「节奏」上——什么时候该动,什么时候该停。");const Pe=[];if(re&&y[re]){const pe=y[re];Pe.push(`多接触${re}:${pe.color}这类颜色、${pe.where},日常可以${pe.daily}。`)}return Z.length&&Pe.push(`少把自己放在${Z.slice(0,2).join("、")}过重的环境里——不是不能碰,是别长期待在那种氛围中。`),Ee.includes("印")&&Pe.push("给「想」设个时限:一件事想超过十分钟还没结论,就先做一个最小动作,用行动换信息。"),Ve.includes("伤官见官")&&Pe.push("把标准用在事情上,不要用在人身上;对人提要求之前,先说清你需要什么。"),{system:"bazi",title:"先看这一张:这张盘大致在说什么",chips:_([`${P.stem||""}${P.element||""}日主`,`${K.branch||""}月`,B.label||"",s.strength?s.strength.level:"",s.hourUnknown?"时柱暂缺":""]),lead:je,sections:[{h:"你的底色",t:Ae||"结构比较均衡,没有一边倒的偏重。"},{h:"感情这件事",t:qe.join("")},{h:"最容易卡住的地方",t:Re.join("")}],advice:Pe,caveat:s.hourUnknown?"时柱暂缺:以上只据年、月、日六个字,等于全盘信息的七成左右。子女缘分、晚年走势、以及「内心最深处那一层」都读不全,结论只作参考。":"",footer:"以上都是对结构的描述,不是断语;判断好坏要结合你自己的处境。"}}function u(s){const p=s.palaces||[],Y=p[0]||{},K=s.body||{},P=(Y.stars||[]).filter(ee=>ee.type==="主星"),B=p.find(ee=>ee.isBody)||{},b=p.find(ee=>ee.palace==="夫妻")||{},A=P.map(ee=>ee.name).join("、")||"空宫(借对宫)",x=P.map(ee=>G[ee.brightness]||"").filter(Boolean)[0]||"",J=ee=>ee.filter(Ae=>Ae.type==="主星").map(Ae=>`${Ae.name}${j[Ae.name]?`(${j[Ae.name]})`:""}`).join(";"),Z=s.patternSummary||{},se=_(Z.broken||[]),R=_(Z.bad||[]),re=_([...Z.good||[],...Z.neutral||[]]).filter(ee=>!se.includes(ee)),je=b.stars||[],Ee=je.filter(ee=>ee.type==="主星"),Oe=je.filter(ee=>ee.type==="煞星");return{system:"ziwei",title:"先看这一张:这张盘大致在说什么",chips:_([`命宫在${Y.branch||""}`,A,s.bureau?s.bureau.name:"",K.lands?`身宫落${K.lands}`:""]),lead:`命宫在${Y.branch||""},坐${A}${x?`(${x})`:""};身宫落在${K.lands||K.palace||"—"}。${P.length?`底色是${P.map(ee=>j[ee.name]||ee.name).join("、")}。`:"命宫无主星,性格更多由对宫与三方决定,可塑性反而大。"}${re.length?`结构上成的是${re.slice(0,3).join("、")}——格局只说明形状,不是吉凶判词。`:"没有完整成套的格局,这一盘更多看单颗星的性质,少看组合。"}`,sections:[{h:"你的底色",t:`${J(Y.stars||[])||"命宫无主星,靠三方四正补"}。身宫落${K.lands||"—"},说明你这辈子真正花力气的地方在${K.lands||"那一块"}。`},{h:"感情这件事",t:`夫妻宫在${b.branch||"—"},坐${Ee.map(ee=>`${ee.name}${ee.brightness?`(${G[ee.brightness]||ee.brightness})`:""}`).join("、")||"空宫(借对宫)"}。${Oe.length?`同宫还有${Oe.map(ee=>ee.name).join("、")}——关系里容易起摩擦,来得快也去得快。`:"没有明显的煞星同宫,关系相对平顺。"}`},{h:"最容易卡住的地方",t:`${se.length?`被冲破的格局有${se.join("、")}——结构还在,但成色打折;冲不等于毁,说的是它不如完好时那么顶用。`:"主要格局没有明显被冲破。"}${R.length?`另有${R.join("、")}这类忌格,只描述结构,不作吉凶断。`:""}`}],advice:[`命宫主星${P.length?`是${P.map(ee=>ee.name).join("、")},顺它的长处在做事,比硬改性格省力`:"不显,先靠环境和习惯替自己定节奏"}。`,`身宫落${K.lands||"—"}:这块是你真正在意的地方,也是容易耗人的地方,留出余量。`],caveat:"",footer:"以上都是对结构的描述,不是断语;判断好坏要结合你自己的处境。"}}const m={旺:"当令,气最足",相:"有生机,正在起",休:"气在泄,歇着",囚:"被压着,使不上劲",死:"最弱,得靠外援"},a={官鬼:"职位、压力、管你的人和事",妻财:"钱、资源、实际回报",父母:"文书、答复、流程与长辈",子孙:"结果本身、松弛、把事情落地",兄弟:"同辈、分利、竞争"},c={日生:"日辰生它,当天有人托着",日克:"日辰克它,当天被压一头",比和:"与日辰同气,力量相当",日合:"与日辰相合,黏住了",日冲:"与日辰相冲,当天就动"};function d(s){if(!s)return"";const p=[],Y=m[s.monthState]||s.monthSay||"";Y&&p.push(`月令${s.monthState||""}(${Y})`);const K=c[s.dayRelation]||s.daySay||"";return K&&p.push(K),s.kong&&p.push("旬空——抓不实,等冲或填"),s.moving&&p.push("发动,是这件事的动因"),s.monthChong&&p.push("月破,先破后立"),p.join(";")}function f(s){const p=s.hexStrength&&s.hexStrength.lines||[];if(!p.length)return null;const Y=p.find(re=>re.shi)||null,K=p.find(re=>re.ying)||null,P=s.body||{},B=P.ben||{},b=P.bian||{},A=s.cast&&s.cast.movingPositions||[],x=p.filter(re=>re.moving),J=String(s.question||"").trim(),Z=_([...P.labels||[],...s.hexStrength&&s.hexStrength.labels||[]]),se=s.hexStrength&&s.hexStrength.month?s.hexStrength.month.branch:"",R=[B.chong?"六冲卦:事情容易散、节奏快":"",B.he?"六合卦:事情黏住、快不起来":"",P.fuYin&&(P.fuYin.inner||P.fuYin.outer)?"有伏吟:原地打转":"",P.fanYin&&(P.fanYin.inner||P.fanYin.outer)?"有反吟:来回反复":""].filter(Boolean);return{system:"liuyao",title:"先看这一卦:这卦大致在说什么",chips:_([B.name,b.name?`变${b.name}`:"",A.length?`${A.length} 爻动`:"静卦",se?`${se}月`:""]),lead:`${J?`你问的是「${J}」。`:""}本卦「${B.name||"—"}」${b.name?`,${A.length?`第 ${A.join("、")} 爻动`:"六爻安静"},变「${b.name}」`:""}。方向还留在「综合」,所以这一卦没有取用神——先只讲与问题无关的那几样:你(世爻)、事情(应爻)、卦体。`,sections:[{h:"代表你的是",t:Y?`世爻在${Y.name}(${Y.branch}${Y.element}·${Y.liuqin}):${d(Y)||"状态平稳"}。`:"这一卦取不到世爻。"},{h:"代表事情的是",t:K?`应爻在${K.name}(${K.branch}${K.element}·${K.liuqin}):${d(K)||"状态平稳"}。应爻说的是「事情那一头」的状态,不是你努力的程度。`:"这一卦取不到应爻。"},{h:"卦体与动爻",t:`${R.length?`${R.join(";")}。`:"没有六冲、六合、伏吟、反吟这类整体结构。"}${x.length?`动爻在${x.map(re=>`${re.name}(${re.liuqin})`).join("、")}——动的地方,就是这件事会发生变化的那一环。`:"六爻安静:眼下没有明显在动的地方,说明事情的节奏还没起来。"}`}],advice:["先在上面选一个「询问方向」(工作、感情、生意、推进、择日):选完才会取用神,旺衰、应期、成败条件才有落点。",...(D.other&&D.other.reality||[]).slice(0,2)].filter(Boolean),caveat:"未指定所问之事:这一版只读世应、卦体与动爻,不判成败,也不给应期——不是算不出来,是取用神要先知道问什么。",footer:"以上是把盘面符号翻译成话,不是断语;真正的判断要看现实里那几步。"}}function N(s){const p=s.useGod||{};if(!p.liuqin)return f(s);const Y=p.found||[];if(!Y.length&&!p.missing)return null;const K=String(s.question||"").trim(),P=s.useGodStrength&&s.useGodStrength.lines||[],B=ee=>P.find(Ae=>Ae.position===ee)||null,A=(s.hexStrength&&s.hexStrength.lines||[]).find(ee=>ee.shi)||null,x=s.useGodStrength&&s.useGodStrength.month?s.useGodStrength.month.branch:"",J=s.dayGanZhi&&s.dayGanZhi.name||"",Z=Y.map(ee=>ee.name).join("、"),se=`${K?`你问的是「${K}」。`:"你没填具体问题,这里按「综合」取用神,结论会更粗。"}这卦里代表它的是「${p.liuqin}」(${p.ask||""}),`+(Y.length?`落在${Z}${Y.length>1?"——两处都出现了,两个条件要一起看":""}。`:"盘中看不见它(伏藏),要等冲开或引出才有动静。")+`日辰是${J||"—"},月建是${x||"—"}。`,R=[],re=[];for(const ee of Y){const Ae=B(ee.position);Ae&&(/旺|相/.test(Ae.monthState||"")&&!Ae.kong&&!Ae.monthChong&&R.push(ee.name),(/日克|日冲/.test(Ae.dayRelation||"")||Ae.kong||Ae.monthChong)&&re.push(ee.name))}const je=Y.length?R.length>re.length?"条件偏有利":re.length>R.length?"条件偏紧,得有外力或时间":"一半一半,取决于你怎么推":"没有可判的落点",Ee=_([...(p.labels||[]).filter(ee=>/两现|伏藏|六合|六冲/.test(ee)),s.body&&s.body.ben&&s.body.ben.chong?"六冲卦:事情容易散,节奏偏快":"",s.body&&s.body.ben&&s.body.ben.he?"六合卦:事情黏住,快不起来":""]),Oe=_((s.yingqi&&s.yingqi.items||[]).map(ee=>ee.branch)).slice(0,4);return{system:"liuyao",title:"先看这一卦:这卦大致在说什么",chips:_([s.ben&&s.ben.name,`用神 ${p.liuqin||""}`,x?`${x}月`:"",s.yingqi?s.yingqi.tempo:""]),lead:se,sections:[{h:"代表你的是",t:A?`世爻在${A.name}(${A.branch}${A.element}·${A.liuqin}):${d(A)||"状态平稳"}。`:"这一卦的世爻取不到,先看用神那一条。"},{h:"代表这件事的是",t:Y.length?Y.map(ee=>`${ee.name} ${ee.ganzhi}(${ee.liuqin}):${d(B(ee.position))||"没有明显的月日冲克"}。`).join(""):"用神伏藏:盘中看不见它,说明这件事现在还不在明面上,要等一个引子。"},{h:"成不成看哪里",t:`把用神的月令与日辰放在一起,盘面给的是「${je}」。${Ee.length?`另有:${Ee.join(";")}。`:""}`}],advice:[...(D[F(p.direction)]&&D[F(p.direction)].reality||[]).slice(0,2),Oe.length?`应期只看地支:${Oe.join("、")}——地支只是「往哪个方向等」,不是公历日期。`:""].filter(Boolean),caveat:_([Y.length>1?`用神两现(${Z}):本插件不替你二选一,两处条件一起看。`:"",p.missing?"用神伏藏:先看伏神与飞神的关系,再看有没有东西把它冲出来。":"","世应只说明「你」和「事」的相对位置,不直接等于吉凶。"]).join(""),footer:"以上是把盘面符号翻译成话,不是断语;真正的判断要看现实里那几步。"}}function v(s){const p=s.bodyUse;if(!p||!p.body||!p.use)return null;const Y=String(s.question||"").trim();return{system:"meihua",title:"先看这一卦:方向大致在哪",chips:_([s.ben&&s.ben.name,s.bian&&`变${s.bian.name}`,p.relation?`体用 ${p.relation.split("(")[0]}`:""]),lead:`${Y?`你问的是「${Y}」。`:""}本卦「${s.ben&&s.ben.name}」,动在第 ${s.moving} 爻,变卦「${s.bian&&s.bian.name}」。体卦 ${p.body.trigram}(${p.body.element})代表你,用卦 ${p.use.trigram}(${p.use.element})代表这件事:${p.relation}。`,sections:[{h:"过程与结果",t:`过程看互卦「${s.hu&&s.hu.name||"—"}」,结果看变卦「${s.bian&&s.bian.name||"—"}」。梅花给的是方向,不是细节——它不会告诉你几号、多少钱。`},{h:"盘面给的分量",t:`这一卦的体用关系被标成「${p.level}」。注意:这是条件层面的判断,不是结果已经发生;条件好但不动,一样没有结果。`}],advice:["把它当「换个角度看这件事」:体用只分「谁在给、谁在耗」,剩下要你自己补具体动作。","如果要推进,先定一个最小动作(打个电话、发条消息),别等条件齐了再动。"],caveat:"梅花取象的自由度大:同一卦,不同人读出的细节可以不同。本插件只取体用生克这一层。",footer:"以上是把盘面符号翻译成话,不是断语;真正的判断要看现实里那几步。"}}function I(s){const p=s.sanChuan||{};if(!p.chu||!p.zhong||!p.mo)return null;const Y=String(s.question||"").trim(),K=B=>`${B.zhi}(${B.liuQin||""}·${B.jiangFull||""})`,P=B=>a[B.liuQin]?`——${a[B.liuQin]}`:"";return{system:"daliuren",title:"先看这一课:事情怎么走到这一步",chips:_([s.geJu&&s.geJu.name,`${p.chu.zhi}→${p.mo.zhi}`,s.yueJiang&&`月将${s.yueJiang.zhi}`]),lead:`${Y?`你问的是「${Y}」。`:""}三传是 ${p.chu.zhi} → ${p.zhong.zhi} → ${p.mo.zhi};末传落 ${p.mo.zhi}(${p.mo.liuQin||""}·${p.mo.jiangFull||""}),课体是「${s.geJu&&s.geJu.name||"—"}」。`,sections:[{h:"起手(初传)",t:`${K(p.chu)}${P(p.chu)}。这是事情开头的样子。`},{h:"转折(中传)",t:`${K(p.zhong)}${P(p.zhong)}。中间会经过这一段,也是容易改道的地方。`},{h:"落点(末传)",t:`${K(p.mo)}${P(p.mo)}。末传比初传更接近结果——但也只是「照现在这样走下去会到哪」。`}],advice:["先看初传:事情是从哪儿起的?把那个起点找出来,比猜结果有用。","中传若与初传相冲相克,说明中途会变;这时别把计划定死。"],caveat:"三传讲的是传变形态,不给具体日期;同一课不同流派对课体的命名也有差异。",footer:"以上是把盘面符号翻译成话,不是断语;真正的判断要看现实里那几步。"}}function me(s){const p=s.siZhu&&s.siZhu.day?String(s.siZhu.day)[0]:"",Y=s.siZhu&&s.siZhu.time?String(s.siZhu.time)[0]:"",K=s.palaces||[];if(!K.length)return null;const P=R=>K.find(re=>re.tianPan===R)||(s.centerPalace&&s.centerPalace.tianPan===R?s.centerPalace:null),B=P(p),b=P(Y),A=String(s.question||"").trim(),x=R=>{const re=R&&L[R.palace]&&L[R.palace].field;return re?re.split(":")[0]:R?`${R.palace}宫`:"盘中取不到"},J=R=>R&&L[R.palace]&&L[R.palace].dir?`(${L[R.palace].dir})`:"",Z=R=>R?`${x(R)}${J(R)}|${R.gate||"—"}·${R.star||"—"}·${R.god||"—"}`:"盘中取不到",se=R=>!R||!R.gateRelation||!R.gateRelation.type?"门与宫的关系没算到":`${R.gateRelation.type}(${R.gateRelation.note||""})`;return{system:"qimen",title:"先看这一局:条件和位置在哪",chips:_([s.ju,s.zhiFu&&`值符${s.zhiFu.star}`]),lead:`${A?`你问的是「${A}」。`:""}日干 ${p} 落在${Z(B)},时干 ${Y} 落在${Z(b)}——前者代表你,后者代表这件事。你这边门与宫是${se(B)};事情那边是${se(b)}。`,sections:[{h:"你这边的条件",t:B?`你在${L[B.palace]?L[B.palace].field:B.palace+"宫"};门是${B.gate||"—"}——${O[B.gate]||"门名只说明形态"}。`:"日干落在中宫或取不到:中宫无门无神,按寄宫(多寄坤二)取用,读的时候要说清这是寄宫。"},{h:"事情那边的条件",t:b?`事情落在${L[b.palace]?L[b.palace].field:b.palace+"宫"};门是${b.gate||"—"}——${O[b.gate]||"门名只说明形态"}。`:"时干落在中宫或取不到,同样按寄宫看,别当成坤二本宫。"},{h:"门名不是吉凶",t:"开门主启动、生门主生长、休门主等待、伤门主损耗、杜门主隐藏——这些说的是「这件事现在是什么形态」,不是好坏判决。要看它与日干宫、时干宫的生克。"}],advice:["把「我这边」和「事情那边」的宫位对一下:两边相距越远,越需要中间人、流程或时间。","如果门名是伤门、死门,不是叫你别做,而是提醒这件事的代价和收尾要先想清楚。"],caveat:_([s.juMethodNote||"","奇门重方位与时机;本插件不给具体方位建议,只把宫位与门星神摊开。"]).join(""),footer:"以上是把盘面符号翻译成话,不是断语;真正的判断要看现实里那几步。"}}function $e(s){const p=s.cards||[];if(!p.length)return null;const Y=String(s.question||"").trim(),K=p.find(P=>/现在|现况|当下|建议|核心/.test(P.position||""))||p[Math.floor(p.length/2)];return{system:"tarot",title:"先看这几张牌:它们各在说什么",chips:_([s.spread]),lead:`${Y?`你问的是「${Y}」。`:""}${s.spread||""}:`+p.map(P=>`${P.position}「${P.name}」${P.orientation}`).join(",")+"。",sections:p.slice(0,4).map(P=>({h:P.position,t:`「${P.name}」${P.orientation}:${(P.keywords||[]).slice(0,3).join("、")||P.core||""}。${P.positionHint||""}`})),advice:[`最值得先看的是「${K.name}」(${K.position}·${K.orientation})——${(K.keywords||[]).slice(0,3).join("、")||"它所在的位置,就是这件事现在的着力点"}。`,"把牌当镜子:它给的是看事情的角度,不是判决。看完写一句「那我下一步做什么」。"],caveat:s.systemNote||"塔罗为象征系统,牌义与元素对应存在流派差异。",footer:"以上是把盘面符号翻译成话,不是断语;真正的判断要看现实里那几步。"}}function Se(s){const p=s.score;if(!p)return null;const Y=(s.dimensions||[]).filter(b=>b&&b.text),K=b=>{const A=b&&b.dayMaster;return A?typeof A=="string"?A.replace(/日主$/,""):`${A.stem||""}${A.element||""}`:""},P=K(s.a),B=K(s.b);return{system:"hepan",title:"先看这一张:你们大致怎么相处",chips:_([P&&B?`${P} × ${B}`:"",p.level,`${p.total}/100`]),lead:`${P&&B?`你们是 ${P} 与 ${B}。`:""}合盘描述的是「相处方式与互补点」,不判合不合,也不决定关系成败。整体上盘面给的是「${p.level}」(${p.total}/100——分数只是相对刻度,不是及格线)。`,sections:Y.slice(0,3).map(b=>({h:b.label,t:b.text})),advice:["一起看,别一个人看完拿去判断对方:前者是对话,后者是审判。","把上面的分歧当话题清单:哪一条你们真的在意,就聊哪一条。"],caveat:s.notes&&s.notes[0]||"合盘看的是相处方式与互补点,不决定关系成败。",footer:"以上是把盘面符号翻译成话,不是断语;真正的判断要看现实里那几步。"}}function Te(s){const p=s.points||[],Y=s.segments||[];if(!p.length||!Y.length)return null;const K=Number.isInteger(s.meta&&s.meta.nowYear)?s.meta.nowYear:null,P=K&&p.find(je=>je.year===K)||null,B=P&&Y.find(je=>P.age>=je.startAge&&P.age<=je.endAge)||Y[0],b=Y[Y.indexOf(B)+1],A=p.filter(je=>je.age>=B.startAge&&je.age<=B.endAge),x=A.length?A.reduce((je,Ee)=>je+Ee.score,0)/A.length:0,J=p.reduce((je,Ee)=>je+Ee.score,0)/p.length,Z=x>=J+5?"比一生平均更亮":x<=J-5?"比一生平均更闷":"与一生平均差不多",se=s.highlights&&s.highlights.best||[],R=s.highlights&&s.highlights.worst||[],re=P?`你现在 ${P.age} 岁(${K} 年),在「${B.ganZhi}」这一步的第 ${P.age-B.startAge+1} 年(${B.startAge}–${B.endAge} 岁)${b?`,再过 ${B.endAge-P.age+1} 年到 ${b.startAge} 岁换「${b.ganZhi}」`:",已是最后一步"}。`:`没给当前日期(asOf),所以不标「现在在第几步」;先看第一步「${B.ganZhi}」(${B.startAge}–${B.endAge} 岁)起手的样子。`;return{system:"trend",title:"先看这一条线:这些年大致什么走势",chips:_([B.ganZhi,`${B.startAge}–${B.endAge} 岁`,P?`${P.age} 岁`:""]),lead:`这条线按 ${s.meta&&s.meta.toAge||p.length} 岁排到 ${p[p.length-1].year} 年,共 ${Y.length} 步大运。`+re,sections:[{h:"这一步的基调",t:`这一步里各年的平均分是 ${x.toFixed(0)},${Z}(全盘平均 ${J.toFixed(0)})。分数是相对刻度,不是绝对值。`},{h:"这些年里最亮和最闷的",t:`${se.length?`高点:${se.slice(0,2).join("、")}`:"没有特别高的点"};${R.length?`低点:${R.slice(0,2).join("、")}`:"没有特别低的点"}。高点适合推进,低点适合收口。`},{h:"怎么用这条线",t:"它不是命运表,是把「顺/不顺」画成可视的起伏。真正决定走向的,是你在这几步里做了什么。"}],advice:["把下一步换运的年龄记下来:换运前后半年,通常是最容易做决定、也最容易冲动的时候。","低点年别做大额投入,高点年别只观望——这两条比记分数管用。"],caveat:"线按年岁等距绘制,实际每步大运十年;起点与交运按节气推算,出生时刻未知时按日估算。",footer:"以上是把盘面符号翻译成话,不是断语;真正的判断要看现实里那几步。"}}function ze(s){return!s||typeof s!="object"?null:s.system==="bazi"?E(s):s.system==="ziwei"?u(s):s.system==="liuyao"?N(s):s.system==="meihua"?v(s):s.system==="daliuren"?I(s):s.system==="qimen"?me(s):s.system==="tarot"?$e(s):s.system==="hepan"?Se(s):s.system==="trend"?Te(s):null}return{plainSummary:ze}})(),C.index=(function(){const{buildBazi:X}=C.bazi||{},{buildLiuyao:W,tossLines:V,bodyLabels:D,yongshenOf:L,yongshenStrength:O,fushenAccess:w,hexagramStrength:F,jinTuiPower:y,yingqiWindow:$}=C.liuyao||{},{buildZiwei:S,BRIGHTNESS:j,flowOf:G,asOfParts:_,ZIWEI_SCHOOL_DEFAULTS:he}=C.ziwei||{},{drawTarot:g}=C.tarot||{},{buildMeihua:E}=C.meihua||{},{buildDaliuren:u}=C.daliuren||{},{buildHepan:m,tripleOf:a}=C.hepan||{},{buildZiweiHepan:c}=C["ziwei-hepan"]||{},{buildQimen:d,buildSnapshot:f}=C.qimen||{},{geocodeAddress:N,resolveAddress:v}=C.geo||{},{toJDN:I,ganzhiName:me,dayGanzhiIndex:$e}=C.calendar||{},{randomOf:Se,isSeed:Te}=C.random||{},{encodeHandle:ze,decodeHandle:s,resolveHandle:p}=C.handle||{},{askLink:Y,parseAskLink:K,formOf:P,restNote:B,askPackages:b}=C.bridge||{},{parseRevision:A,displayValue:x}=C.revise||{},{interpret:J,DIRECTIONS:Z,DIRECTION_DEFAULT:se}=C.interpret||{},{followup:R,askPrompt:re}=C.followup||{},{crossCheck:je,crossText:Ee,crossSection:Oe}=C.crosscheck||{},{pastSignals:ee,verifyFit:Ae}=C.verify||{},{rectifyBirth:Qe}=C.rectify||{},{buildAlmanac:tn}=C.almanac||{},{buildZeri:Be}=C.zeri||{},{buildChenggu:De}=C.chenggu||{},{buildXiaoliuren:Xe}=C.xiaoliuren||{},{buildStar:_e}=C.star||{},{buildNumerology:qe}=C.numerology||{},{buildMbti:Ve,mbtiPaper:Re}=C.mbti||{},{buildConvert:Pe}=C.convert||{},{classicsFor:pe,classicsText:Ue,suiyunClassicOf:We,classicOf:en,CLASSIC_BOOKS:on}=C.classics||{},{diffObjects:rn,summarize:ln,sortDiffs:cn,labelOf:l,rootOf:M,categoryOf:z,formatValue:q,CALIBER_SWITCHES:H,viewRows:te}=C.diff||{},{canonicalJson:ne,fingerprintOf:le}=C.fingerprint||{},{buildTrend:Q}=C.trend||{},{buildFengshui:ye}=C.fengshui||{},{buildName:we}=C.name||{},{buildTrace:Ne,traceMarkdown:ge,SYSTEM_LABEL:be}=C.trace||{},{fail:oe}=C.fail||{},{assertCivil:Ie}=C.validate||{},Ze=e=>String(e).padStart(2,"0"),Fe=["male","female"];function Ce(e,t){return t===2?e%4===0&&e%100!==0||e%400===0?29:28:[31,28,31,30,31,30,31,31,30,31,30,31][t-1]}function xe(e,t=""){if(Fe.includes(e))return e;const o=e==null||e===""?"(未提供)":`「${e}」`;throw oe("E_INPUT",`${t?t+"的":""}gender 必须是 male 或 female${o};性别决定大运/大限顺逆,不能靠默认值`)}const Je=["brightnessSchool","gengYearSihua","tianmaSchool","tiankongSchool","jiekongSchool","kuiyueSchool","tianshiTianshang","changshengSchool","lateZishi","shenzhuSchool"];function nn(e){const t={};for(const o of Je)e[o]!==void 0&&(t[o]=e[o]);return e.schools&&typeof e.schools=="object"&&(t.schools=e.schools),t}function fe(e){if(typeof e!="string"||!e.trim())throw oe("E_INPUT","缺少 datetime(公历日期时间),例如 1990-05-12T14:30");const t=e.trim().match(/^(\d{4})-(\d{1,2})-(\d{1,2})(?:[T\s](\d{1,2}):(\d{1,2})(?::(\d{1,2}))?)?$/);if(!t)throw oe("E_INPUT",`无法解析 datetime:「${e}」,请用 1990-05-12T14:30 这种格式`);const o={year:Number(t[1]),month:Number(t[2]),day:Number(t[3]),hour:Number(t[4]??0),minute:Number(t[5]??0)};if(o.month<1||o.month>12)throw oe("E_INPUT",`月份超出范围:${o.month}`);const n=Ce(o.year,o.month);if(o.day<1||o.day>n)throw oe("E_INPUT",`日期不存在:${o.year}-${o.month}-${o.day}(${o.year} 年 ${o.month} 月只有 ${n} 天)`);if(o.hour>23||o.minute>59)throw oe("E_INPUT",`时间超出范围:${o.hour}:${o.minute}`);if(o.year<1600||o.year>2400)throw oe("E_RANGE",`年份 ${o.year} 超出可计算范围(1600–2400)`);return(o.year<1900||o.year>2100)&&(o.precision={level:"approx",note:`ΔT 模型仅覆盖 1900–2100,${o.year} 年按端点值外推,节气与朔望时刻可能有分钟级偏差,月柱在交节前后需复核`}),o}function Le(e){const t=e.pillars,o=(de,Me)=>`${de}:${Me.ganzhi} ${Me.stemTenGod?`十神 ${Me.stemTenGod} `:""}藏干 ${Me.hidden.map(Ke=>`${Ke.stem}(${Ke.tenGod})`).join(" ")} 纳音 ${Me.nayin} 地势 ${Me.dishi} 自坐 ${Me.zizuo} 空亡 ${Me.kongwang.join("")}`+(Me.shensha&&Me.shensha.length?` 神煞 ${Me.shensha.join("、")}`:""),n=Object.entries(e.wuxing).map(([de,Me])=>`${de}${Me}`).join(" "),i=e.palaces?`【胎元】${e.palaces.taiyuan.ganzhi} 胎息 ${e.palaces.taixi?e.palaces.taixi.ganzhi:"—"}`+(e.palaces.minggong?` 命宫 ${e.palaces.minggong.ganzhi}`:" 命宫 时柱暂缺,不排")+(e.palaces.shengong?` 身宫 ${e.palaces.shengong.ganzhi}`:" 身宫 时柱暂缺,不排"):"",r=e.dayun.list.slice(0,8).map(de=>`${de.startAge}岁 ${de.ganzhi}(${de.stemTenGod})${de.luck?`·${de.luck.tier}`:""}${de.relations&&de.relations.length?`[${de.relations.join("")}]`:""}`).join(" "),h=e.dayun.jiao&&e.dayun.jiao.at?`;交运 ${e.dayun.jiao.at}(${e.dayun.jiao.frame},距${e.dayun.jiao.from.name} ${e.dayun.jiao.spanDays} 天,三日折一年)`:"",k=e.jieqi.nearBoundaryMinutes<20?`
|
|
69
|
+
⚠ 出生时刻距「节」仅 ${e.jieqi.nearBoundaryMinutes} 分钟,而节气时刻本身有最多约 14 分钟的偏差,月柱与年柱建议人工复核。`:"",ae={year:"年",month:"月",day:"日",hour:"时"},ce=e.shensha&&e.shensha.groups&&e.shensha.groups.length?`神煞(${e.shensha.count} 见):`+e.shensha.groups.map(de=>`${de.cat}|`+de.items.map(Me=>`${Me.name}(${Me.pillars.map(Ke=>ae[Ke]).join("")})`).join("、")).join(";"):"神煞:—",U=e.renyuan,ue=en("smt-renyuan"),T=U?`人元:${U.month}月第${U.day}日,${U.active}${U.activeElement}司权(${U.segments.map(de=>`${de.stem}${de.from}–${de.to}`).join(" ")})${U.beyond?";已过 30 日表,按本气算":""}${ue?`|原文见《${on[ue.book].name}·${ue.chapter}》`:""}`:"",ie=e.frame&&e.frame.yongshen&&e.frame.yongshen.disputed||[],ve=ie.length?` 有争议:${ie.map(de=>`${de.element}(${de.favorRole};${de.climate}盘调候忌${de.element})`).join("、")}`:"",He=new Set(ie.map(de=>de.element)),ke=e.frame&&e.frame.yongshen&&e.frame.yongshen.neutral||[],Ge=ke.length?` 中性偏忌:${ke.map(de=>`${de.element} ${de.weight} 分`).join("、")}(近零,不作实忌)`:"",sn=e.frame?[`格局:${e.frame.primary?`${e.frame.primary.name}(${e.frame.primary.evidence})`:"—"}`,` ${e.frame.geju.map(de=>`${de.name}[${de.kind}${de.status?`·${de.status}`:""}]`).join(" ")}`,`用神:喜${e.frame.yongshen.favor.join("")}(${e.frame.yongshen.favorTenGods.join("、")}) 忌${e.frame.yongshen.avoid.join("")}(${e.frame.yongshen.avoidTenGods.join("、")})${ve}${Ge} ${e.frame.yongshen.method}`,` ${e.frame.yongshen.detail}`,`寒暖:${e.climate?`${e.climate.label}(${(e.climate.evidence||[]).join("、")})${e.climate.need?` 调候取${e.climate.need.stem}${e.climate.need.element} 忌${e.climate.avoidElement}${He.has(e.climate.avoidElement)?"(有争议)":""}`:""}`:"—"}`+(e.frame.yongshen.qt?` 穷通:${e.frame.yongshen.qt.month}${e.frame.yongshen.qt.stem}取${e.frame.yongshen.qt.yong.join("、")}(首取${e.frame.yongshen.qt.primary})`:""),`十神权重:${Object.entries(e.frame.godStats.groups).map(([de,Me])=>`${de}${Me}`).join(" ")}`]:[],ot=e.hourUnknown===!0||!t.hour;return[`【四柱】${t.year.ganzhi} ${t.month.ganzhi} ${t.day.ganzhi}${t.hour?` ${t.hour.ganzhi}`:"(时柱暂缺)"}`,`日主:${e.dayMaster.stem}${e.dayMaster.element}(${e.dayMaster.yinYang}) 空亡:${e.kongwang.join("")}`,o("年柱",t.year),o("月柱",t.month),o("日柱",t.day),...ot?[]:[o("时柱",t.hour)],`五行:${n}`,...i?[i]:[],`日主强弱:${e.strength.level}(${e.strength.score}) ${e.strength.detail}`,...sn,`天干关系:${e.relations&&e.relations.stems.length?e.relations.stems.join(" "):"—"}`,`地支关系:${e.relations&&e.relations.branches.length?e.relations.branches.join(" "):"—"}`,ce,`真太阳时:${e.solarTime.trueSolarText}(${e.input.geo?e.input.geo.note+";":""}${e.solarTime.note}) 晚子时:${e.input.lateZi?"23:00 后算次日":"23:00 后仍算当日"}`,`节气:上一节 ${e.jieqi.previous.name} ${e.jieqi.previous.time} 下一节 ${e.jieqi.next.name} ${e.jieqi.next.time}`,...T?[T]:[],`大运:${e.dayun.rule}(${e.dayun.direction}),${e.dayun.startAge.years}岁${e.dayun.startAge.months}个月起运${h}`,` ${r}`,`流年:${e.liunian.slice(0,10).map(de=>`${de.year}${de.ganzhi}(${de.stemTenGod})${de.luck?`·${de.luck.tier}`:""}`).join(" ")}`,(()=>{const de=e.liunian.filter(Ye=>Ye.suiyun&&Ye.suiyun.signals&&Ye.suiyun.signals.length);if(!de.length)return"岁运提示:近十年无岁运并临、运年反吟或大运/流年伏吟、反吟(只标干支,不判吉凶)";const Me=Ye=>`${Ye.type}${(Ye.type.startsWith("流年")||Ye.type.startsWith("大运"))&&Ye.target?`(${Ye.target})`:""}`,Ke=We(e),at=Ke?`|古籍见《${on[Ke.book].name}·${Ke.chapter}》`:"";return"岁运提示(只标干支变动,不判吉凶):"+de.map(Ye=>`${Ye.year}${Ye.ganzhi} ${Ye.suiyun.signals.map(Me).join("/")}`).join(";")+at})(),"(格局、用神、行运吉凶为扶抑+简化调候的量化提示,非断语。)"].join(`
|
|
70
|
+
`)+k}function hn(e){const t=e.lunar.monthRaw||e.lunar.month,o=`${e.lunar.year}年${e.lunar.isLeap?`闰${t}`:e.lunar.month}月${e.lunar.day}日`+(e.lunar.isLeap&&e.lunar.month!==t?`(按${e.lunar.month}月起盘)`:""),n=(()=>{if(!e.schools)return"";const ie=Object.entries({brightnessSchool:"亮度",gengYearSihua:"庚干四化",tianmaSchool:"天马",tiankongSchool:"天空",jiekongSchool:"截空",kuiyueSchool:"魁钺",tianshiTianshang:"天伤天使",changshengSchool:"长生",lateZishi:"晚子时",shenzhuSchool:"身主"}).filter(([ve])=>e.schools[ve]&&e.schools[ve]!==he[ve]).map(([ve,He])=>`${He} ${e.schools[ve]}`);return ie.length?`【流派】${ie.join(" ")}`:""})(),i=T=>T.length?T.map(ie=>`${ie.name}${ie.mutagen?`化${ie.mutagen}`:""}`).join(" "):"—",r=T=>`神煞:长生(${T.changsheng}) 博士(${T.boshi}) 将前(${T.jiangqian}) 岁前(${T.suiqi})`,h=[];for(const T of e.palaces){const ie=T.isSoul?"【命】":T.isBody?"【身】":" ";h.push(` ${T.palace} ${T.branch} ${T.ganzhi} ${ie} 大限${String(T.daxian.start).padStart(2)}-${T.daxian.end} 小限${String(T.xiaoxian.age).padStart(2)} ${i(T.stars)}`),h.push(` ${r(T.shensha)}`)}const k=(e.liunian??[]).slice(0,6).map(T=>` ${T.year} ${T.ganzhi} ${String(T.age).padStart(2)}岁 命宫${T.lifePalace.branch}(${T.lifePalace.palace}) 流禄${T.liulu} 流羊${T.liuyang} 流陀${T.liutuo} | ${T.mutagen.map(ie=>ie.replace("化","")).join(" ")}`+(T.mutagenHits?` 四化落宫 ${T.mutagenHits.map(ie=>`${ie.star}${ie.type}→${ie.palace||"未上盘"}`).join("、")}`:"")+(T.sanfangMainStars?` 三方主星 ${T.sanfangMainStars.join("")}`:"")),ae=(e.patterns??[]).length?e.patterns.map(T=>`${T.name}(${T.tone==="good"?"吉格":T.tone==="bad"?"忌格":"中"}:${T.evidence})`).join(";"):"无明显格局(按内置规则)",ce=(e.daxianList??[]).slice(0,8).map(T=>` ${T.branch}宫(${T.palace})${T.ages[0]}-${T.ages[1]}岁 ${T.ganzhi} 会${T.mainStars.join("")||"—"} 化 ${T.mutagenHits.map(ie=>`${ie.star}${ie.type}→${ie.palace||"未上盘"}`).join("、")}`),U=(()=>{const T=e.flyChains;if(!T)return"";const ie=He=>{const ke=T[He];return!ke||!ke.steps.length?"":`${He}:${ke.path.join("→")}${ke.closed?"(成环)":""}`},ve=["禄","权","科","忌"].map(ie).filter(Boolean).join(" ");return ve?`【命宫飞星】${ve}`:""})(),ue=(()=>{const T=e.flyComposite;if(!T||!Array.isArray(T.sources)||!T.sources.length)return"";const ie=T.labels.length?T.labels.join(" · "):"无同宫会聚",ve=["禄","权","科","忌"].map(He=>{const ke=(T.byType&&T.byType[He]||[]).filter(sn=>!sn.self),Ge=[...new Set(ke.map(sn=>String(sn.to).replace(/宫$/,"")))];return Ge.length?`${He}→${Ge.join("/")}`:""}).filter(Boolean).join(" ");return`【三方四正飞化】${T.sanfang.join("·")}:${ie}${ve?` ${ve}`:""}`})();return[`【农历】${o}(月首 ${e.lunar.monthStart}) 时支:${e.hourBranch} 年干支:${e.yearGanzhi}`,`【时刻】${e.solarTime?`${e.solarTime.civilText} → 真太阳时 ${e.solarTime.trueSolarText}${e.input.geo?"("+e.input.geo.note+")":""}`:""}`,`【命宫】${e.soul.branch}(${e.soul.ganzhi}·${e.soul.nayin}) 【身宫】${e.body.branch}(落${e.body.lands}) 【五行局】${e.bureau.name}`,`【紫微】${e.ziwei} 【天府】${e.tianfu} 【命主】${e.lifeMaster} 【身主】${e.bodyMaster}${e.bodyMasterNote?`(${e.bodyMasterSchool==="common"?"子午皆火星":"子铃午火"})`:""}`,`【大限】${e.daxian.rule},${e.daxian.startAge}岁起 【小限】${e.xiaoxianRule.direction}`,n,`【昌曲】文昌${e.changqu.wenchang.branch}(${e.changqu.wenchang.palace}${e.changqu.wenchang.mutagen?"·化"+e.changqu.wenchang.mutagen:""}) 文曲${e.changqu.wenqu.branch}(${e.changqu.wenqu.palace}${e.changqu.wenqu.mutagen?"·化"+e.changqu.wenqu.mutagen:""})`,` ${e.changqu.relation} 入命三方:${e.changqu.inSoulSanfang?"是":"否"} 吸收面:${e.changqu.absorb.label}(${e.changqu.absorb.reason})`,U,ue,"十二宫:",...h,"大限(按起运年龄排序,前 8 限,宫干四化落宫):",...ce,"流年(前 6 年,完整 12 年在结构化数据里):",...k,`【格局】${ae}`,e.patternSummary?`【结构统计】吉格 ${e.patternSummary.good.length}、中性 ${e.patternSummary.neutral.length}、忌格 ${e.patternSummary.bad.length}${e.patternSummary.broken.length?`、破格 ${e.patternSummary.broken.length}(${e.patternSummary.broken.join("、")})`:""};${e.patternSummary.note}`:"",e.lunar.note?`注:${e.lunar.note}`:""].filter(Boolean).join(`
|
|
71
|
+
`)}const un=["旺","相","休","囚","死"];function jn(e){const t=e.states,o=e.month;if(!t||!o)return"无月令数据";const n=i=>un.filter(r=>i&&Array.isArray(i[r])&&i[r].length).map(r=>`${r} ${i[r].join("/")}`).join(" ");return`月令 ${o.branch}(${o.element}) 门 ${n(t.gate)||"—"} 星 ${n(t.star)||"—"} 干 ${n(t.stem)||"—"}`}function wn(e){const t=e.palaces,o=n=>`${n.palace}宫 ${n.star||"—"}/${n.gate||"—"}/${n.god||"—"}${n.kong?" 空":""}${n.ma?" 马":""}`;return[`【四柱】${e.siZhu.year} ${e.siZhu.month} ${e.siZhu.day} ${e.siZhu.time}`,`【局数】${e.ju} 节气 ${e.jieqi}(${e.jieqiTime})`,`【值符】${e.zhiFu.star}(${e.zhiFu.gong}宫) 【值使】${e.zhiShi.gate}(${e.zhiShi.gong}宫) 旬首 ${e.xunshou}`,`【空亡】${e.kongWang.join("")||"—"} 驿马 ${e.ma.zhi||"—"}(${e.ma.gong||"—"}宫)`,`【宫位条件】击刑 ${(e.conditions&&e.conditions.jiXing||[]).map(n=>`${n.palace}宫${n.stem}`).join("、")||"无"} 三奇入墓 ${(e.conditions&&e.conditions.ruMu||[]).map(n=>`${n.palace}宫${n.stem}`).join("、")||"无"} 六仪入墓 ${(e.conditions&&e.conditions.liuYiRuMu||[]).map(n=>`${n.palace}宫${n.stem}`).join("、")||"无"}`,`【十干克应】${[...t,e.centerPalace].filter(n=>n&&n.ganYing).map(n=>`${n.palace}宫 ${n.ganYing.tian}加${n.ganYing.di} ${n.ganYing.name}`).join(" ")||"—"}`,`【旺衰】${jn(e)}`,`【九宫】${t.map(o).join(" ")}`,`※ 晚子时:${e.lateZiHourMode==="next-day"?"23:00 后归次日":"23:00 后仍归当日"}(可用 lateZiHourMode / lateZi 指定)`,`※ ${e.rules[e.rules.length-1]}`].join(`
|
|
72
|
+
`)}function gn(e){if(!e||!Array.isArray(e.pairs)||!e.pairs.length)return[];const t=["【三方合盘】三对两两并列,不合成「三人总分」",...e.pairs.map(o=>`· ${o.a}–${o.b}:${o.level||"—"}(${o.total==null?"—":`${o.total}/100`})`)];return e.best&&(e.spread>=3?t.push(` 最顺:${e.best.a}–${e.best.b}(${e.best.total}/100)`+(e.hardest?`;最需磨合:${e.hardest.a}–${e.hardest.b}(${e.hardest.total}/100)`:"")):t.push(` 三对分数接近(最高与最低相差 ${e.spread} 分),不排名`)),e.focus&&e.focus.spread>=3&&t.push(` 差异最大的一维:${e.focus.label}(三对相差 ${e.focus.spread} 分)`),e.note&&t.push(`※ ${e.note}`),t}function Nn(e){if(e.chart==="ziwei"){const n=i=>`${i.label}:${i.score>=0?"+":""}${i.score} ${i.text}`;return[`【紫微合盘】${e.score.level}(${e.score.total}/100)`,`你 命宫 ${e.a.soul.branch}(${e.a.soulStars.join("、")||"无主星"}) 夫妻 ${e.a.spouseStars.join("、")||"无主星"} ${e.a.bureau}`,`对方 命宫 ${e.b.soul.branch}(${e.b.soulStars.join("、")||"无主星"}) 夫妻 ${e.b.spouseStars.join("、")||"无主星"} ${e.b.bureau}`,...e.dimensions.map(n),...e.interactions.map(i=>` · ${i.text}`),...gn(e.triple),...e.notes.map(i=>`※ ${i}`)].join(`
|
|
73
|
+
`)}const t=n=>`${n.label}:${n.score>=0?"+":""}${n.score} ${n.text}`,o=n=>!n||!n.solarNote?"—":`${n.longitude==null?"未含经度修正":`${n.longitude}°E`}(${n.solarNote})`;return[`【合盘】${e.score.level}(${e.score.total}/100)`,`你 ${e.a.pillars.join(" ")} 日主 ${e.a.dayMaster} 日支 ${e.a.dayBranch} ${e.a.strength||""}`,`对方 ${e.b.pillars.join(" ")} 日主 ${e.b.dayMaster} 日支 ${e.b.dayBranch} ${e.b.strength||""}`,`真太阳时:你 ${o(e.a)};对方 ${o(e.b)}`,...e.dimensions.map(t),...e.detail?[`属相:${e.detail.yearRelation.label}——${e.detail.yearRelation.text}`,`日干:${e.detail.stems.text}`,...e.detail.crossBranches&&e.detail.crossBranches.length?[`跨盘地支:${e.detail.crossBranches.map(n=>`${n.name}(${n.a}${n.b})`).join("、")}`]:[],`年命纳音:${e.detail.nayin.a} / ${e.detail.nayin.b}(${e.detail.nayin.label})——${e.detail.nayin.text}`,`吉凶象:吉 ${e.detail.tally.good} / 凶 ${e.detail.tally.bad}(${e.detail.tally.lean};分档只数象,总分以上面三维度为准)`]:[],...gn(e.triple),...e.notes.map(n=>`※ ${n}`)].join(`
|
|
74
|
+
`)}function kn(e){const t=e.sanChuan,o=n=>`${n.zhi}(${n.jiang}${n.liuQin}${n.xunKong?"空":""})`;return[`【日时】${e.dayGanZhi}日 ${e.hourZhi}时(${e.dayNight}贵) 月将 ${e.yueJiang.name}${e.yueJiang.zhi} 节气 ${e.jieqi.name} ${e.lateZi===!1?"晚子时不换日":"晚子时换日"}`,`【三传】初 ${o(t.chu)} → 中 ${o(t.zhong)} → 末 ${o(t.mo)}`,`【四课】${e.siKe.map(n=>`${n.position}课 ${n.shang}上${n.xia}下(${n.relation}·${n.jiang})`).join(" ")}`,`【天地盘】${e.pan.map(n=>`${n.di}:${n.tian}(${n.jiang})`).join(" ")}`,`【格局】${e.geJu.name}·${e.geJu.detail}`,...e.shensha&&e.shensha.length?[`【神煞】${e.shensha.map(n=>`${n.name}${n.branch}`).join(" ")}`]:[]].join(`
|
|
75
|
+
`)}function An(e){const t=[`【起卦】${e.source}`,`【本卦】${e.ben.name}(上${e.ben.upper} 下${e.ben.lower}) 动爻:${e.movingName}`,`【互卦】${e.hu.name} 【变卦】${e.bian.name} 【错卦】${e.cuo.name} 【综卦】${e.zong.name}`,`【体用】体 ${e.bodyUse.body.trigram}${e.bodyUse.body.element} 用 ${e.bodyUse.use.trigram}${e.bodyUse.use.element} ${e.bodyUse.level}`,` ${e.bodyUse.relation}`],o=e.lines.slice().reverse().map(n=>` ${n.name} ${n.yinYang==="阳"?"━━━━━":"━━ ━━"}${n.moving?" ←动":""}`);return[...t,"【爻】",...o].join(`
|
|
76
|
+
`)}function Tn(e){const t=[e.question?`【所问】${e.question}`:"(未填写提问)",`【牌阵】${e.spread}${e.castAt?` 抽牌于 ${e.castAt}`:""}`];for(const o of e.cards)t.push(` ${o.position}:${o.name}(${o.orientation}) ${o.keywords.join("、")}`);if(e.reading&&e.reading.length){t.push("【解读】");for(const o of e.reading)t.push(` ${o}`)}return t.join(`
|
|
77
|
+
`)}function En(e){const t=ae=>{const ce=ae.lines.slice().reverse().map(U=>{const ue=U.position===ae.shi?"世":U.position===ae.ying?"应":" ";return` ${U.name} ${ue} ${U.symbol} ${U.ganzhi}${U.element} ${U.liuqin}/${U.liushen}`});return[`${ae.name}(${ae.palace}·${ae.palaceElement})`,...ce].join(`
|
|
78
|
+
`)},o=[`起卦:${e.cast.notation.join("、")}(自下而上)`,`日辰:${e.dayGanZhi.name}`,e.xunShou?`旬首:${e.xunShou} 旬空:${(e.xunKong||[]).join("")||"—"}`:"",e.question?`所问:${e.question}`:"","本卦:",t(e.ben)];e.bian?o.push(`动爻:第 ${e.cast.movingPositions.join("、")} 爻`,"变卦(六亲以变卦自身宫论):",t(e.bian)):o.push("六爻安静,无变卦。");const n=e.body&&Array.isArray(e.body.labels)?e.body.labels:D(e.body);o.push(`卦体:${n.length?n.join(" · "):"无六冲、六合、伏吟、反吟"}`);const i=e.useGod||L(e,{});if(i&&i.liuqin){const ae=i.found.length?i.found.map(ie=>`${ie.position}爻${ie.ganzhi}${ie.element}${ie.kong?"(空)":""}`).join("、"):i.fushen.length?i.fushen.map(ie=>`伏 ${ie.position}爻${ie.ganzhi}${ie.element}(${ie.relation||"飞伏关系未知"})`).join("、"):"不上卦";o.push(`用神:${i.byShi?"世爻":i.liuqin}(${i.ask})→ ${ae}${i.side?`(${i.side})`:""}`);const ce=i.byShi?"用神 世爻":`用神 ${i.liuqin}`,U=i.labels.filter(ie=>ie!==ce&&!ie.startsWith(ce));U.length&&o.push(`用神联动:${U.join(" · ")}`);const ue=e.useGodStrength;if(ue&&ue.labels.length){const ie=ue.month&&ue.month.branch?`月建 ${ue.month.branch}(${ue.month.element}) `:"";o.push(`用神旺衰:${ie}${ue.labels.join(" · ")}`)}const T=e.fushenAccess;T&&Array.isArray(T.labels)&&T.labels.length&&o.push(`伏神出伏:${T.labels.join(" · ")}`)}else o.push("用神:未取(未指明所问之事;用「询问方向」指定后即按六亲取用)");const r=e.hexStrength;if(r&&Array.isArray(r.labels)&&r.labels.length){const ae=r.month&&r.month.branch?`月建 ${r.month.branch}(${r.month.element}) `:"无月建(未给起卦时间) ";o.push(`全卦旺衰:${ae}${r.labels.join(" · ")}`)}const h=e.jinTuiPower;h&&Array.isArray(h.lines)&&h.lines.length&&o.push(`进退力重:${h.lines.map(ae=>`${ae.position}爻${ae.from}→${ae.to}${ae.type}·${ae.verdict}`).join(" · ")}`);const k=e.yingqi;return k&&Array.isArray(k.triggers)&&k.triggers.length&&o.push(`应期线索:${k.tempo} · ${k.triggers.map(ae=>`${ae.labels.join("/")}${ae.branch}`).join(" · ")}(只列地支,不出日期)`),o.filter(Boolean).join(`
|
|
79
|
+
`)}function xn(e){const t=new WeakSet,o=(n,i)=>{switch((n instanceof Number||n instanceof String||n instanceof Boolean)&&(n=n.valueOf()),n&&typeof n=="object"&&typeof n.toJSON=="function"&&(n=n.toJSON(i)),typeof n){case"string":case"boolean":return n;case"number":return Number.isFinite(n)?Object.is(n,-0)?0:n:null;case"bigint":throw new TypeError("Do not know how to serialize a BigInt");case"object":{if(n===null)return null;if(t.has(n))throw new TypeError("Converting circular structure to JSON");t.add(n);let r;if(Array.isArray(n)){r=new Array(n.length);for(let h=0;h<n.length;h++){const k=o(n[h],String(h));r[h]=k===void 0?null:k}}else{r={};for(const h of Object.keys(n)){const k=o(n[h],h);k!==void 0&&(r[h]=k)}}return t.delete(n),r}default:return}};return o(e,"")}const Mn=new Set(["shadow","shadowVersion","diff","trace","traceError","withInterpret","cross","verifyPast","rectify","events","geocode","ask","followup","caliber","seed","asOf","handle","revise"]),fn=e=>{if(e==null||e==="")return null;const t=Number(e);return Number.isFinite(t)?Number(t.toFixed(6)):null};function mn(e){if(e==null||e==="")return null;try{const t=fe(e);return{y:t.year,m:t.month,d:t.day,h:t.hour,mi:t.minute,precision:t.precision}}catch{return String(e).trim()}}function dn(e={}){const t={};return e.datetime&&(t.datetime=mn(e.datetime)),e.gender&&(t.gender=String(e.gender).toLowerCase()),e.longitude!==void 0?t.longitude=fn(e.longitude):e.address&&(t.address=String(e.address).trim()),e.lateZi!==void 0&&(t.lateZi=e.lateZi!==!1),e.trueSolar!==void 0&&(t.trueSolar=e.trueSolar!==!1),e.dst!==void 0&&(t.dst=e.dst!==!1),t}function On(e){return e.lateZiHourMode==="next-day"||e.lateZi===!0?"next-day":"same-day"}function In(e,t){const o=String(t&&t.system||e.system||""),n=t&&t.input&&typeof t.input=="object"?t.input:null;if(o==="bazi"&&n)return{civil:n.civil,gender:n.gender,longitude:fn(n.longitude),lateZi:n.lateZi!==!1,trueSolar:n.trueSolar!==!1,dst:!!(n.dst&&n.dst.applied)};if(o==="ziwei"&&n)return{civil:{year:n.year,month:n.month,day:n.day,hour:n.hour,minute:n.minute},gender:n.gender,longitude:fn(n.longitude),leapMonth:n.leapMonth||"split",leapAsNext:n.leapAsNext===!0,schools:n.schools||he,trueSolar:n.trueSolar!==!1,dst:!!(n.dst&&n.dst.applied)};if(o==="qimen")return{datetime:mn(e.datetime),juMethod:e.juMethod||"chaibu",lateZiHourMode:On(e)};if(o==="hepan"){const r={chart:e.chart==="ziwei"?"ziwei":"bazi",a:dn({...e,datetime:e.datetime}),b:dn(e.partner||{})};return e.partner2&&(r.c=dn(e.partner2)),r}const i={};for(const[r,h]of Object.entries(e))if(!(Mn.has(r)||h===void 0))if(r==="datetime")i.datetime=mn(h);else if(r==="partner")i.partner=dn(h);else if(r==="gender")i.gender=String(h).toLowerCase();else{if(r==="address")continue;typeof h=="number"?i[r]=Number.isFinite(h)?Object.is(h,-0)?0:h:null:typeof h=="string"?i[r]=h.trim():i[r]=h}return o==="daliuren"&&i.lateZi===void 0&&(i.lateZi=!0),o==="tarot"&&i.count===void 0&&(i.count=3),o==="meihua"&&i.mode===void 0&&(i.mode="time"),o==="xiaoliuren"&&i.mode===void 0&&(i.mode="time"),o==="convert"&&i.mode===void 0&&(i.mode="solar2lunar"),o==="fengshui"&&i.action===void 0&&(i.action="natal"),o==="tarot"&&t&&Array.isArray(t.cards)&&t.cards.length&&(i.cards=t.cards.map(r=>`${r.name||""}|${r.upright?"正":"逆"}`)),o==="liuyao"&&t&&t.cast&&Array.isArray(t.cast.lines)&&(i.cast=t.cast.lines.join("")),i}function vn(e,t){const o=t.seed,n=!(o==null||o==="");return e==="liuyao"&&Array.isArray(t.lines)&&t.lines.length===6?{reproducible:!0}:(e==="tarot"||e==="liuyao")&&!n?{reproducible:!1,reason:"未给 seed:重算会变成另一副牌 / 另一卦"}:e==="bazi"||e==="ziwei"||e==="trend"||e==="fengshui"?{reproducible:!0,asOfPinned:!!t.asOf}:{reproducible:!0}}function pn(e={},t={}){const o=t.result||null,n=String(o&&o.system||e.system||""),i=String(t.version||typeof globalThis<"u"&&globalThis.__MP_VER||"dev");return{...le({system:n,params:In(e,o),seed:e.seed,asOf:e.asOf?String(e.asOf):null,version:i}),...vn(n,e),system:n,version:i}}const zn=new Set(["shadow","trace","traceText","traceError","interpret","summary","classics","suiyunClassic","renyuanClassic","cross","past","rectify","followup","caliber","input","reading","knowledge","outline","sections","answer","plain","tables","glossary","caveats","lead","dimensions","moduleType","technique","disclaimer","ask","followups","knowledgeCount","title","systemLabel","handle","handleError","revision"]);function bn(e){const t={};for(const[o,n]of Object.entries(e||{}))zn.has(o)||(t[o]=n);return t}function _n(e){return!e||!e.shadow||!e.shadow.baseId?null:{snapshot:!0,shadow:e.shadow,data:bn(e)}}function qn(e,t,o={}){const n=e&&e.shadow,i=t&&t.shadow;if(!n||!i)return{sameId:!1,total:0,reason:"缺少影子盘信息"};if(n.baseId&&i.baseId&&n.baseId!==i.baseId)return{sameId:!1,total:0,fromId:n.id,toId:i.id,fromBaseId:n.baseId,toBaseId:i.baseId,reason:"基础指纹不同,不是同一张盘"};const r=T=>T.snapshot===!0&&T.data&&typeof T.data=="object"?T.data:bn(T),h=rn(r(e),r(t)),k=cn(h.filter(T=>M(T.path))).map(T=>({path:T.path,label:l(T.path),from:q(T.from),to:q(T.to)})),ae=new Map;for(const T of h){const ie=z(T.path)||"其他";ae.set(ie,(ae.get(ie)||0)+1)}const ce=[...ae.entries()].map(([T,ie])=>({name:T,count:ie})).sort((T,ie)=>ie.count-T.count||T.name.localeCompare(ie.name,"zh-Hans-CN")),U=o.fromVersion||n.version||"",ue=o.toVersion||i.version||"";return{sameId:!0,versionChanged:U!==ue,fromVersion:U,toVersion:ue,total:h.length,summary:ln(h),roots:k,categories:ce,diffs:h}}function $n(e={}){let t=p(e),o;if(typeof t.revise=="string"&&t.revise.trim()){const i=A(t.revise),r={...t};t={...t,...i.patch},o={text:i.text,applied:i.labels.map(h=>{const k=r[h.key]===void 0?null:r[h.key];return{...h,from:k,fromDisplay:x(h.key,k)}}),ignored:i.ignored}}t.partner2===null&&(t={...t},delete t.partner2);const n=xn(Gn(t));if(n&&!n.question&&typeof t.question=="string"&&t.question.trim()&&["liuyao","meihua","daliuren","qimen","tarot","xiaoliuren"].includes(n.system)&&(n.question=t.question.trim()),n)try{const i=tt(n);i&&(n.brief=i)}catch(i){n.briefError=String(i&&i.message||i)}if(o&&(n.revision=o),n&&n.system==="bazi"){n.classics=pe(n);const i=Ue(n.classics);i&&(n.summary=`${n.summary}
|
|
80
80
|
【古籍】
|
|
81
|
-
${i}`);const
|
|
81
|
+
${i}`);const r=We(n);if(r&&(n.suiyunClassic={...r,bookName:on[r.book].name}),n.renyuan){const h=en("smt-renyuan");h&&(n.renyuanClassic={...h,bookName:on[h.book].name})}}if(n&&n.precision&&n.precision.level==="approx"&&n.summary&&(n.summary=`⚠ ${n.precision.note}
|
|
82
82
|
${n.summary}`),n&&(n.system==="bazi"||n.system==="ziwei")&&n.input&&n.input.longitude==null&&n.summary&&(n.summary=`⚠ 未提供出生地或经度:按东八区平太阳时排盘,时柱可能与本命盘相差一个时辰;海外出生请先把当地时间换算成东八区标准时。
|
|
83
|
-
${n.summary}`),
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
`)}const Dn=["cross","verifyPast","withInterpret","question","direction","ask","geocode","rectify","events","shadow","trace"];function Yn(e={},t={}){const a=t.system||e.system,n=t.switches||Y[a]||[];if(!n.length)return{system:a,switches:[],affected:0,total:0};const i={...e};for(const $ of Dn)delete i[$];const d=n.map($=>{const j=$.read(i),X=$.alt(j);let ae=[],z="",V=null,w=null;try{V=$n({...i,[$.key]:j}),w=$n({...i,[$.key]:X}),ae=rn(V,w)}catch(me){z=me&&me.message||String(me)}const J=cn(ae.filter(me=>k(me.path))).map(me=>({path:me.path,label:s(me.path),from:x(me.from),to:x(me.to)})),je=new Map;for(const me of ae){const Ee=E(me.path)||"其他";je.set(Ee,(je.get(Ee)||0)+1)}const Ie=[...je.entries()].map(([me,Ee])=>({name:me,count:Ee})).sort((me,Ee)=>Ee.count-me.count||me.name.localeCompare(Ee.name,"zh-Hans-CN"));return{key:$.key,title:$.title,short:$.short,current:j,alt:X,currentLabel:$.label(j),altLabel:$.label(X),total:ae.length,summary:z?"":ln(ae),views:z?[]:F(a,V,w),roots:J,categories:Ie,error:z}});return{system:a,switches:d,affected:d.filter($=>!$.error&&$.total>0).length,total:d.reduce(($,j)=>$+j.total,0)}}const Ln=["chaibu","chaoshen","zhirun"],Pn=[1,3,5],Rn=["same-day","next-day"];function Qe(e){if(e==null||e==="")return;const t=U(e);if(!t)throw B("E_ASOF",`无法解析 asOf:「${e}」,请用 2026-10-22T16:00 这种格式`);const{year:a,month:n,day:i}=t;if(!(n>=1&&n<=12)||!(i>=1&&i<=ke(a,n)))throw B("E_ASOF",`asOf 指向的日期不存在:${e}`);return t}function qn(e={}){const t=e.system;if(t==="bazi"){const a=ne(e.datetime),n=Qe(e.asOf),i=R({...a,gender:ye(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:n?n.year:void 0});return{...i,...n?{asOf:n}:{},precision:a.precision,summary:Te(i)}}if(t==="ziwei"){const a=ne(e.datetime),n=Qe(e.asOf),i=g({...a,gender:ye(e.gender),leapMonth:e.leapMonth,leapAsNext:e.leapAsNext===!0,...Ue(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:n});return{...i,precision:a.precision,summary:fn(i)}}if(t==="tarot"){const a=e.count===void 0||e.count===null||e.count===""?3:Number(e.count);if(!Pn.includes(a))throw B("E_COUNT",`塔罗张数只能是 1 / 3 / 5,收到「${e.count}」`);if(!$e(e.seed))throw B("E_INPUT",`seed 必须是数字,收到「${e.seed}」`);const n=Qe(e.asOf),i=y({count:a,question:e.question,at:e.asOf,random:de(e.seed)});return e.seed!==void 0&&e.seed!==null&&e.seed!==""&&(i.seed=Number(e.seed)),{...i,...n?{asOf:n}:{},summary:An(i)}}if(t==="daliuren"){const a=ne(e.datetime),n=e.lateZi!==!1,i=l({...a,lateZi:n});return i.lateZi=n,{...i,precision:a.precision,summary:kn(i)}}if(t==="qimen"){const a=ne(e.datetime);if(e.juMethod!==void 0&&!Ln.includes(e.juMethod))throw B("E_INPUT",`juMethod 只能是 chaibu / chaoshen / zhirun,收到「${e.juMethod}」`);const n=e.lateZiHourMode!==void 0?e.lateZiHourMode:e.lateZi===!0?"next-day":e.lateZi===!1?"same-day":void 0;if(n!==void 0&&!Rn.includes(n))throw B("E_INPUT",`lateZiHourMode 只能是 same-day / next-day,收到「${n}」`);const i=n==="next-day"?"next-day":"same-day",d=c({...a,lateZiHourMode:i,juMethod:e.juMethod});return d.lateZiHourMode=i,{...d,summary:wn(d)}}if(t==="hepan"){const a=e.partner;if(!a||typeof a!="object")throw B("E_PARTNER","合盘需要 partner:{ datetime, gender, address? },其中 partner.datetime 是对方的公历出生时间");if(!a.datetime)throw B("E_PARTNER",'缺少 partner.datetime(对方的公历出生时间),例如 partner: {"datetime":"1992-03-03T10:00","gender":"female"}');const n=e.partner2;if(n!=null){if(typeof n!="object"||Array.isArray(n))throw B("E_PARTNER","partner2 需要 { datetime, gender, address? };不想看三方就整段省略(null 视同未传)");if(!n.datetime)throw B("E_PARTNER",'缺少 partner2.datetime(第三方的公历出生时间),例如 partner2: {"datetime":"1988-09-09T08:00","gender":"male"}')}const i=e.chart==="ziwei"?"ziwei":"bazi",d=(z,V)=>({...ne(z.datetime),gender:ye(z.gender,V),trueSolar:z.trueSolar,lateZi:z.lateZi,dst:z.dst!==!1,address:typeof z.address=="string"?z.address:void 0,longitude:typeof z.longitude=="number"?z.longitude:void 0,geo:z.geo&&typeof z.geo=="object"?z.geo:void 0}),$=d(e,"你(主方)"),j=d(a,"对方"),X=(z,V)=>i==="ziwei"?r({a:z,b:V}):f({a:z,b:V}),ae=X($,j);if(n){const z=d(n,"第三方");ae.triple=o([{key:"a-b",a:"你",b:"对方",result:ae},{key:"a-c",a:"你",b:"第三方",result:X($,z)},{key:"b-c",a:"对方",b:"第三方",result:X(j,z)}])}return{...ae,summary:Nn(ae)}}if(t==="meihua"){let a;try{a=N({mode:e.mode==="number"?"number":"time",datetime:e.datetime,upper:e.upper,lower:e.lower,changing:e.changing})}catch(n){throw B("E_INPUT",`梅花起卦参数不完整:${n&&n.message?n.message:n}`)}return{...a,summary:Tn(a)}}if(t==="liuyao"){if(!$e(e.seed))throw B("E_INPUT",`seed 必须是数字,收到「${e.seed}」`);let a;if(e.lines===void 0||e.lines===null)a=H(de(e.seed));else{if(!Array.isArray(e.lines))throw B("E_LINES","lines 必须是数组:自下而上 6 个爻值(6 老阴 / 7 少阳 / 8 少阴 / 9 老阳)");if(e.lines.length!==6)throw B("E_LINES",`六爻需要正好 6 个爻值(自下而上),收到 ${e.lines.length} 个;留空则由引擎随机摇卦`);a=e.lines.map(Number)}let n,i=null;const d=e.datetime?ne(e.datetime):Qe(e.asOf);if(d){e.datetime||(i=d);const V=oe(ie(A(d.year,d.month,d.day)));n={stem:V.stem,branch:V.branch,name:V.name}}let $;try{$=q({lines:a,question:e.question,dayGanZhi:n})}catch(V){throw B("E_LINES",V&&V.message?V.message:V)}const j=L($,{direction:e.direction,gender:e.gender});j.liuqin&&($.useGod=j);let X=null;if(d)try{X=(u({year:d.year,month:d.month,day:d.day,hour:d.hour,minute:d.minute}).monthGanZhi||"")[1]||null}catch{X=null}const ae=G($,{monthBranch:X,dayBranch:$.dayGanZhi.branch});ae&&($.hexStrength=ae);const z=h($,{monthBranch:X,dayBranch:$.dayGanZhi.branch});if(z&&($.jinTuiPower=z),j.liuqin){const V=T($,j,{monthBranch:X,dayBranch:$.dayGanZhi.branch});V&&($.useGodStrength=V);const w=b($,j,{monthBranch:X,dayBranch:$.dayGanZhi.branch});w&&($.fushenAccess=w);const J=m($,j,{monthBranch:X});J&&($.yingqi=J)}return e.seed!==void 0&&e.seed!==null&&e.seed!==""&&($.seed=Number(e.seed)),{...$,...i?{asOf:i}:{},summary:En($)}}if(t==="almanac"){const a=ne(e.datetime),n=en({year:a.year,month:a.month,day:a.day});return{...n,summary:Gn(n)}}if(t==="zeri"){if(!(e.candidates!==void 0&&e.candidates!==null)&&(typeof e.startDate!="string"||!e.startDate.trim()))throw B("E_INPUT",'择日需要 startDate(公历 YYYY-MM-DD,起算日);可另给 days(1–60,默认 30)与 shengXiao(当事人属相)。只想比几天,改给 candidates: ["2026-12-01","2026-12-08"]');let n;try{n=Ge({task:e.task,startDate:e.startDate,days:e.days,shengXiao:e.shengXiao,candidates:e.candidates})}catch(i){throw B("E_INPUT",i&&i.message||String(i))}return{...n,summary:Un(n)}}if(t==="chenggu"){const a=ne(e.datetime),n=/[T\s]\d{1,2}:\d{1,2}/.test(String(e.datetime)),i=Number.isInteger(e.hour)?e.hour:n?a.hour:null;if(i===null||i<0||i>23)throw B("E_INPUT","称骨必须给时辰:datetime 带时分(如 1990-08-15T10:00),或额外给 hour(0–23)——缺时辰四柱不齐");const d=Ye({year:a.year,month:a.month,day:a.day,hour:i,minute:n?a.minute:0});return{...d,summary:Zn(d)}}if(t==="convert"){const a=e.mode==="lunar2solar"?"lunar2solar":"solar2lunar";let n;if(a==="lunar2solar"){if(e.lunarYear==null||e.lunarMonth==null||e.lunarDay==null)throw B("E_INPUT","农历转公历需要 lunarYear / lunarMonth / lunarDay(闰月另加 isLeapMonth: true)");n=He({mode:a,lunarYear:Number(e.lunarYear),lunarMonth:Number(e.lunarMonth),lunarDay:Number(e.lunarDay),isLeapMonth:e.isLeapMonth===!0})}else{const i=ne(e.datetime);n=He({mode:a,year:i.year,month:i.month,day:i.day})}return{...n,summary:Bn(n)}}if(t==="xiaoliuren"){const a=e.datetime?ne(e.datetime):null,n=Je({mode:e.mode==="number"?"number":"time",date:typeof e.date=="string"&&e.date.trim()?e.date:a?`${a.year}-${a.month}-${a.day}`:void 0,hour:Number.isInteger(e.hour)?e.hour:a&&/[T\s]\d{1,2}:\d{1,2}/.test(String(e.datetime))?a.hour:void 0,num1:e.num1,num2:e.num2,num3:e.num3,question:e.question});return{...n,summary:Hn(n)}}if(t==="star"){const a=ne(e.datetime),n=Xe({year:a.year,month:a.month,day:a.day});return{...n,summary:Fn(n)}}if(t==="numerology"){const a=ne(e.datetime),n=We({year:a.year,month:a.month,day:a.day});return{...n,summary:Jn(n)}}if(t==="mbti"){if(e.answers===void 0||e.answers===null){const n=tn();return{...n,summary:Wn(n)}}const a=nn({answers:e.answers});return{...a,summary:Xn(a)}}if(t==="trend"){const a=ne(e.datetime),n=P({...a,gender:ye(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});return{...n,precision:a.precision,summary:Kn(n)}}if(t==="fengshui"){const a=e.action==="advise"?"advise":e.action==="xuankong"?"xuankong":"natal";if(a==="xuankong"){const d=se({action:a,sitting:e.sitting,facing:e.facing,...e.period!==void 0?{period:e.period}:{},...Number.isInteger(e.fortuneYear)?{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{...d,summary:yn(d)}}if(a==="advise"){const d=se({action:a,sitting:e.sitting,facing:e.facing,...e.datetime?ne(e.datetime):{},...e.gender==="male"||e.gender==="female"?{gender:e.gender}:{},dst:e.dst!==!1});return{...d,summary:yn(d)}}const n=ne(e.datetime),i=se({action:"natal",year:n.year,month:n.month,day:n.day,gender:ye(e.gender),fortuneYear:Number.isInteger(e.fortuneYear)?e.fortuneYear:void 0,dst:e.dst!==!1});return{...i,summary:yn(i)}}if(t==="name"){const a=e.action==="generate"?"generate":"assess",n=e.datetime?ne(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}:{}}:{},i=ue({action:a,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,...n,...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{...i,summary:Qn(i)}}throw t?B("E_SYSTEM",`未知体系「${t}」,可选:bazi(四柱八字)、ziwei(紫微斗数)、liuyao(六爻)、meihua(梅花易数)、daliuren(大六壬)、qimen(奇门遁甲)、hepan(合盘)、tarot(塔罗)、almanac(黄历)、zeri(择日)、chenggu(称骨)、xiaoliuren(小六壬)、star(星座)、numerology(生命数字)、mbti(十六型人格问卷)、trend(人生 K 线)、fengshui(风水)、name(起名)、convert(公农历互转)。`):B("E_INPUT","缺少 system,可选:bazi(四柱八字)、ziwei(紫微斗数)、liuyao(六爻)、meihua(梅花易数)、daliuren(大六壬)、qimen(奇门遁甲)、hepan(合盘)、tarot(塔罗)、almanac(黄历)、zeri(择日)、chenggu(称骨)、xiaoliuren(小六壬)、star(星座)、numerology(生命数字)、mbti(十六型人格问卷)、trend(人生 K 线)、fengshui(风水)、name(起名)、convert(公农历互转)。")}function Gn(e){const t=e.ganzhi,a=e.jieQi&&e.jieQi.next?` 下一节:${e.jieQi.next.name} ${e.jieQi.next.date}`:"",n=e.dayGod?`值日:${e.dayGod.name}(${e.dayGod.type}·${e.dayGod.luck})`:"",i=e.xiu?`二十八宿:${e.xiu.name}宿(${e.xiu.luck}·${e.xiu.zheng}·${e.xiu.animal})`:"",d=e.taiShen?`胎神:${e.taiShen}`:"",$=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:"—"}`:"",j=e.lucky?`吉配生肖:六合${e.lucky.liuhe||"—"} 三合${(e.lucky.sanhe||[]).join("、")||"—"}`:"",X=e.nayin&&e.nayin.day?`日柱纳音:${e.nayin.day.name}`:"",ae=(e.hours||[]).map(z=>`${z.zhi}${z.ganZhi.slice(0,1)}·${z.shen}${z.luck==="吉"?"吉":"凶"}`).join(" ");return[`【黄历】${e.meta.date} ${e.meta.weekday} ${e.lunar.text}`,`干支:${t.year}年 ${t.month}月 ${t.day}日 属${t.shengXiao}`,...e.meta.boundaryNote?[` ${e.meta.boundaryNote}`]:[],`建除:${e.zhiXing}日 冲:${e.chong.text}${e.chong.sha?`(${e.chong.sha})`:""} ${n}`,[i,X,d].filter(Boolean).join(" "),`宜:${e.yi.join("、")}`,`忌:${e.ji.join("、")}`,$,j,ae?`时辰吉凶:${ae}`:"",`节气:上一节 ${e.jieQi.prev?`${e.jieQi.prev.name} ${e.jieQi.prev.date}`:"—"}${a}`,e.dailyHexagram?`每日一卦:${e.dailyHexagram.name} ${e.dailyHexagram.meaning||""}`:"",`口径:${e.meta.scope}`].filter(Boolean).join(`
|
|
88
|
-
`)
|
|
83
|
+
${n.summary}`),n&&n.system==="bazi"&&n.hourUnknown&&n.summary&&(n.summary=`时柱按正午暂算,涉及时柱的结论仅供参考
|
|
84
|
+
${n.summary}`),n&&n.system==="trend"&&n.hourUnknown&&n.summary&&(n.summary=`时柱暂缺:起运与大运按日估算,仅供参考
|
|
85
|
+
${n.summary}`),t.withInterpret&&(n.interpret=J(n,{question:typeof t.question=="string"?t.question:"",direction:typeof t.direction=="string"?t.direction:"general"})),t.cross===!0&&t.hourUnknown===!0&&(n.crossSkipped="HOUR_UNKNOWN"),t.cross===!0&&t.hourUnknown!==!0&&(n.system==="bazi"||n.system==="ziwei")){const r={...fe(t.datetime),gender:xe(t.gender),longitude:typeof t.longitude=="number"?t.longitude:void 0,address:typeof t.address=="string"?t.address:void 0,geo:t.geo&&typeof t.geo=="object"?t.geo:void 0,trueSolar:t.trueSolar!==!1,dst:t.dst!==!1},h=an(t.asOf),k=n.system==="bazi"?S({...r,leapMonth:t.leapMonth,leapAsNext:t.leapAsNext===!0,...nn(t),asOf:h}):X({...r,lateZi:t.lateZi!==!1,nowYear:h?h.year:void 0});n.cross=je(n.system==="bazi"?n:k,n.system==="ziwei"?n:k),n.interpret&&n.interpret.sections.push(Oe(n.cross))}if(Number.isInteger(t.verifyPast)&&t.verifyPast>0&&n.system==="bazi"){const i=Math.min(Math.max(t.verifyPast,1),10),r=Number(n.liunianFrom)-i,h=X({...fe(t.datetime),gender:xe(t.gender),lateZi:t.lateZi!==!1,trueSolar:t.trueSolar!==!1,longitude:typeof t.longitude=="number"?t.longitude:void 0,address:typeof t.address=="string"?t.address:void 0,geo:t.geo&&typeof t.geo=="object"?t.geo:void 0,dst:t.dst!==!1,nowYear:r});n.past={rows:ee(h,Number(n.liunianFrom)-1),years:i,until:Number(n.liunianFrom)-1}}if(t.rectify===!0&&n.system==="bazi"){const i=fe(t.datetime);n.rectify=Qe({base:{year:i.year,month:i.month,day:i.day,minute:i.minute},gender:xe(t.gender),events:Array.isArray(t.events)?t.events:[],hours:Array.isArray(t.rectifyHours)?t.rectifyHours:void 0,lateZi:t.lateZi!==!1,trueSolar:t.trueSolar!==!1,dst:t.dst!==!1,longitude:typeof t.longitude=="number"?t.longitude:void 0,address:typeof t.address=="string"?t.address:void 0,geo:t.geo&&typeof t.geo=="object"?t.geo:void 0})}if(typeof t.ask=="string"&&t.ask.trim()&&(n.followup=R(n,t.ask)),t.trace===!0)try{const i=Ne(n,{direction:t.direction,gender:t.gender});i&&(n.trace=i,n.traceText=ge(i,{system:n.system}))}catch(i){n.traceError=String(i&&i.message||i)}if(t.shadow===!0)try{n.shadow=pn(t,{result:n,version:t.shadowVersion})}catch(i){n.shadow={error:String(i&&i.message||i)}}try{const i=ze(t);i&&(n.handle=i)}catch(i){n.handleError=String(i&&i.message||i)}return n}function Sn(e){if(!e)return"";const t=[`【${e.title||"解析与详解"}】${e.ask&&e.ask.echo?e.ask.echo:""}`];e.answer&&t.push(`▶ ${e.ask&&e.ask.question?"先答所问":"先看结论"}:${e.answer}`),e.plain&&t.push(`▶ 说人话:${e.plain}`),e.lead&&t.push(e.lead),Array.isArray(e.outline)&&e.outline.length&&t.push("一页读懂:"+e.outline.map(o=>`${o.label}·${o.text}`).join(" ")),e.error&&t.push(`⚠ 解析生成失败:${e.error}(上方盘面数据本身可用)`);for(const o of e.dimensions||[]){const n=Array.isArray(o.evidence)&&o.evidence.length?`
|
|
86
|
+
依据:${o.evidence.join(";")}${o.confidence?` 置信度:${o.confidence}`:""}`:"",i=o.plain?`(${o.plain})`:"",r=(o.knowledge||[]).map(h=>`
|
|
87
|
+
规则·${h.gist}〔${h.statusLabel}〕${h.detail} 出处:${h.source}${h.note?` 注:${h.note}`:""}`).join("");t.push(`${o.label}:${i}${o.text}${o.advice?` 建议:${o.advice}`:""}${n}${r}`)}for(const o of e.sections||[])t.push(`${o.label}:${o.text}`);for(const o of e.tables||[])!Array.isArray(o.rows)||!o.rows.length||(t.push(`【${o.title}】`),t.push([o.columns.join(" | "),...o.rows.map(n=>n.join(" | "))].join(`
|
|
88
|
+
`)));return Array.isArray(e.followups)&&e.followups.length&&t.push("还可以这样追问:"+e.followups.map(o=>`「${o}」`).join(" ")),Array.isArray(e.glossary)&&e.glossary.length&&t.push("名词解释:"+e.glossary.map(o=>`${o.term}=${o.plain}`).join(" ")),Array.isArray(e.limits)&&e.limits.length&&t.push("【本插件不回答什么】"+e.limits.map(o=>`${o.title}——${o.text}`).join(`
|
|
89
|
+
`)),e.disclaimer&&t.push(e.disclaimer),t.join(`
|
|
90
|
+
`)}const Cn=["cross","verifyPast","withInterpret","question","direction","ask","geocode","rectify","events","shadow","trace"];function Ln(e={},t={}){const o=t.system||e.system,n=t.switches||H[o]||[];if(!n.length)return{system:o,switches:[],affected:0,total:0};const i={...e};for(const h of Cn)delete i[h];const r=n.map(h=>{const k=h.read(i),ae=h.alt(k);let ce=[],U="",ue=null,T=null;try{ue=$n({...i,[h.key]:k}),T=$n({...i,[h.key]:ae}),ce=rn(ue,T)}catch(ke){U=ke&&ke.message||String(ke)}const ie=cn(ce.filter(ke=>M(ke.path))).map(ke=>({path:ke.path,label:l(ke.path),from:q(ke.from),to:q(ke.to)})),ve=new Map;for(const ke of ce){const Ge=z(ke.path)||"其他";ve.set(Ge,(ve.get(Ge)||0)+1)}const He=[...ve.entries()].map(([ke,Ge])=>({name:ke,count:Ge})).sort((ke,Ge)=>Ge.count-ke.count||ke.name.localeCompare(Ge.name,"zh-Hans-CN"));return{key:h.key,title:h.title,short:h.short,current:k,alt:ae,currentLabel:h.label(k),altLabel:h.label(ae),total:ce.length,summary:U?"":ln(ce),views:U?[]:te(o,ue,T),roots:ie,categories:He,error:U}});return{system:o,switches:r,affected:r.filter(h=>!h.error&&h.total>0).length,total:r.reduce((h,k)=>h+k.total,0)}}const Yn=["chaibu","chaoshen","zhirun"],Dn=[1,3,5],Pn=["same-day","next-day"];function an(e){if(e==null||e==="")return;const t=_(e);if(!t)throw oe("E_ASOF",`无法解析 asOf:「${e}」,请用 2026-10-22T16:00 这种格式`);const{year:o,month:n,day:i}=t;if(!(n>=1&&n<=12)||!(i>=1&&i<=Ce(o,n)))throw oe("E_ASOF",`asOf 指向的日期不存在:${e}`);return t}function Gn(e={}){const t=e.system;if(t==="bazi"){const o=fe(e.datetime),n=an(e.asOf),i=X({...o,gender:xe(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:n?n.year:void 0,hourUnknown:e.hourUnknown===!0});return{...i,...n?{asOf:n}:{},precision:o.precision,summary:Le(i)}}if(t==="ziwei"){if(e.hourUnknown===!0)throw oe("HOUR_UNKNOWN","紫微必须有出生时刻:命宫由生月与生时支定,时支未知则整盘不成立。请补上出生时刻,或改用八字三柱模式只看年/月/日。");const o=fe(e.datetime),n=an(e.asOf),i=S({...o,gender:xe(e.gender),leapMonth:e.leapMonth,leapAsNext:e.leapAsNext===!0,...nn(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:n});return{...i,precision:o.precision,summary:hn(i)}}if(t==="tarot"){const o=e.count===void 0||e.count===null||e.count===""?3:Number(e.count);if(!Dn.includes(o))throw oe("E_COUNT",`塔罗张数只能是 1 / 3 / 5,收到「${e.count}」`);if(!Te(e.seed))throw oe("E_INPUT",`seed 必须是数字,收到「${e.seed}」`);const n=an(e.asOf),i=g({count:o,question:e.question,at:e.asOf,random:Se(e.seed)});return e.seed!==void 0&&e.seed!==null&&e.seed!==""&&(i.seed=Number(e.seed)),{...i,...n?{asOf:n}:{},summary:Tn(i)}}if(t==="daliuren"){const o=fe(e.datetime),n=e.lateZi!==!1,i=u({...o,lateZi:n});return i.lateZi=n,{...i,precision:o.precision,summary:kn(i)}}if(t==="qimen"){const o=fe(e.datetime);if(e.juMethod!==void 0&&!Yn.includes(e.juMethod))throw oe("E_INPUT",`juMethod 只能是 chaibu / chaoshen / zhirun,收到「${e.juMethod}」`);const n=e.lateZiHourMode!==void 0?e.lateZiHourMode:e.lateZi===!0?"next-day":e.lateZi===!1?"same-day":void 0;if(n!==void 0&&!Pn.includes(n))throw oe("E_INPUT",`lateZiHourMode 只能是 same-day / next-day,收到「${n}」`);const i=n==="next-day"?"next-day":"same-day",r=d({...o,lateZiHourMode:i,juMethod:e.juMethod});return r.lateZiHourMode=i,{...r,summary:wn(r)}}if(t==="hepan"){if(e.hourUnknown===!0||e.partner&&e.partner.hourUnknown===!0)throw oe("HOUR_UNKNOWN","合盘需要双方都有出生时刻:夫妻宫与大运都依赖时支。请补齐时刻后再看,或用八字三柱模式各自看年/月/日。");const o=e.partner;if(!o||typeof o!="object")throw oe("E_PARTNER","合盘需要 partner:{ datetime, gender, address? },其中 partner.datetime 是对方的公历出生时间");if(!o.datetime)throw oe("E_PARTNER",'缺少 partner.datetime(对方的公历出生时间),例如 partner: {"datetime":"1992-03-03T10:00","gender":"female"}');const n=e.partner2;if(n!=null){if(typeof n!="object"||Array.isArray(n))throw oe("E_PARTNER","partner2 需要 { datetime, gender, address? };不想看三方就整段省略(null 视同未传)");if(!n.datetime)throw oe("E_PARTNER",'缺少 partner2.datetime(第三方的公历出生时间),例如 partner2: {"datetime":"1988-09-09T08:00","gender":"male"}')}const i=e.chart==="ziwei"?"ziwei":"bazi",r=(U,ue)=>({...fe(U.datetime),gender:xe(U.gender,ue),trueSolar:U.trueSolar,lateZi:U.lateZi,dst:U.dst!==!1,address:typeof U.address=="string"?U.address:void 0,longitude:typeof U.longitude=="number"?U.longitude:void 0,geo:U.geo&&typeof U.geo=="object"?U.geo:void 0}),h=r(e,"你(主方)"),k=r(o,"对方"),ae=(U,ue)=>i==="ziwei"?c({a:U,b:ue}):m({a:U,b:ue}),ce=ae(h,k);if(n){const U=r(n,"第三方");ce.triple=a([{key:"a-b",a:"你",b:"对方",result:ce},{key:"a-c",a:"你",b:"第三方",result:ae(h,U)},{key:"b-c",a:"对方",b:"第三方",result:ae(k,U)}])}return{...ce,summary:Nn(ce)}}if(t==="meihua"){let o;try{o=E({mode:e.mode==="number"?"number":"time",datetime:e.datetime,upper:e.upper,lower:e.lower,changing:e.changing})}catch(n){throw oe("E_INPUT",`梅花起卦参数不完整:${n&&n.message?n.message:n}`)}return{...o,summary:An(o)}}if(t==="liuyao"){if(!Te(e.seed))throw oe("E_INPUT",`seed 必须是数字,收到「${e.seed}」`);let o;if(e.lines===void 0||e.lines===null)o=V(Se(e.seed));else{if(!Array.isArray(e.lines))throw oe("E_LINES","lines 必须是数组:自下而上 6 个爻值(6 老阴 / 7 少阳 / 8 少阴 / 9 老阳)");if(e.lines.length!==6)throw oe("E_LINES",`六爻需要正好 6 个爻值(自下而上),收到 ${e.lines.length} 个;留空则由引擎随机摇卦`);o=e.lines.map(Number)}let n,i=null;const r=e.datetime?fe(e.datetime):an(e.asOf);if(r){e.datetime||(i=r);const ue=me($e(I(r.year,r.month,r.day)));n={stem:ue.stem,branch:ue.branch,name:ue.name}}let h;try{h=W({lines:o,question:e.question,dayGanZhi:n})}catch(ue){throw oe("E_LINES",ue&&ue.message?ue.message:ue)}const k=L(h,{direction:e.direction,gender:e.gender});k.liuqin&&(h.useGod=k);let ae=null;if(r)try{ae=(f({year:r.year,month:r.month,day:r.day,hour:r.hour,minute:r.minute}).monthGanZhi||"")[1]||null}catch{ae=null}const ce=F(h,{monthBranch:ae,dayBranch:h.dayGanZhi.branch});ce&&(h.hexStrength=ce);const U=y(h,{monthBranch:ae,dayBranch:h.dayGanZhi.branch});if(U&&(h.jinTuiPower=U),k.liuqin){const ue=O(h,k,{monthBranch:ae,dayBranch:h.dayGanZhi.branch});ue&&(h.useGodStrength=ue);const T=w(h,k,{monthBranch:ae,dayBranch:h.dayGanZhi.branch});T&&(h.fushenAccess=T);const ie=$(h,k,{monthBranch:ae});ie&&(h.yingqi=ie)}return e.seed!==void 0&&e.seed!==null&&e.seed!==""&&(h.seed=Number(e.seed)),{...h,...i?{asOf:i}:{},summary:En(h)}}if(t==="almanac"){const o=fe(e.datetime),n=tn({year:o.year,month:o.month,day:o.day});return{...n,summary:Rn(n)}}if(t==="zeri"){if(!(e.candidates!==void 0&&e.candidates!==null)&&(typeof e.startDate!="string"||!e.startDate.trim()))throw oe("E_INPUT",'择日需要 startDate(公历 YYYY-MM-DD,起算日);可另给 days(1–60,默认 30)与 shengXiao(当事人属相)。只想比几天,改给 candidates: ["2026-12-01","2026-12-08"]');let n;try{n=Be({task:e.task,startDate:e.startDate,days:e.days,shengXiao:e.shengXiao,candidates:e.candidates})}catch(i){throw oe("E_INPUT",i&&i.message||String(i))}return{...n,summary:Un(n)}}if(t==="chenggu"){const o=fe(e.datetime),n=/[T\s]\d{1,2}:\d{1,2}/.test(String(e.datetime)),i=Number.isInteger(e.hour)?e.hour:n?o.hour:null;if(i===null||i<0||i>23)throw oe("E_INPUT","称骨必须给时辰:datetime 带时分(如 1990-08-15T10:00),或额外给 hour(0–23)——缺时辰四柱不齐");const r=De({year:o.year,month:o.month,day:o.day,hour:i,minute:n?o.minute:0});return{...r,summary:Zn(r)}}if(t==="convert"){const o=e.mode==="lunar2solar"?"lunar2solar":"solar2lunar";let n;if(o==="lunar2solar"){if(e.lunarYear==null||e.lunarMonth==null||e.lunarDay==null)throw oe("E_INPUT","农历转公历需要 lunarYear / lunarMonth / lunarDay(闰月另加 isLeapMonth: true)");n=Pe({mode:o,lunarYear:Number(e.lunarYear),lunarMonth:Number(e.lunarMonth),lunarDay:Number(e.lunarDay),isLeapMonth:e.isLeapMonth===!0})}else{const i=fe(e.datetime);n=Pe({mode:o,year:i.year,month:i.month,day:i.day})}return{...n,summary:Fn(n)}}if(t==="xiaoliuren"){const o=e.datetime?fe(e.datetime):null,n=Xe({mode:e.mode==="number"?"number":"time",date:typeof e.date=="string"&&e.date.trim()?e.date:o?`${o.year}-${o.month}-${o.day}`:void 0,hour:Number.isInteger(e.hour)?e.hour:o&&/[T\s]\d{1,2}:\d{1,2}/.test(String(e.datetime))?o.hour:void 0,num1:e.num1,num2:e.num2,num3:e.num3,question:e.question});return{...n,summary:Hn(n)}}if(t==="star"){const o=fe(e.datetime),n=_e({year:o.year,month:o.month,day:o.day});return{...n,summary:Bn(n)}}if(t==="numerology"){const o=fe(e.datetime),n=qe({year:o.year,month:o.month,day:o.day});return{...n,summary:Jn(n)}}if(t==="mbti"){if(e.answers===void 0||e.answers===null){const n=Re();return{...n,summary:Wn(n)}}const o=Ve({answers:e.answers});return{...o,summary:Xn(o)}}if(t==="trend"){const o=fe(e.datetime),n=e.asOf?an(e.asOf):void 0,i=Q({...o,nowYear:n?n.year:void 0,gender:xe(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{...i,...e.hourUnknown===!0?{hourUnknown:!0,hourPrecision:"day"}:{},precision:o.precision,summary:Kn(i)}}if(t==="fengshui"){const o=e.action==="advise"?"advise":e.action==="xuankong"?"xuankong":"natal";if(o==="xuankong"){const r=ye({action:o,sitting:e.sitting,facing:e.facing,...e.period!==void 0?{period:e.period}:{},...Number.isInteger(e.fortuneYear)?{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{...r,summary:yn(r)}}if(o==="advise"){const r=ye({action:o,sitting:e.sitting,facing:e.facing,...e.datetime?fe(e.datetime):{},...e.gender==="male"||e.gender==="female"?{gender:e.gender}:{},dst:e.dst!==!1});return{...r,summary:yn(r)}}const n=fe(e.datetime),i=ye({action:"natal",year:n.year,month:n.month,day:n.day,gender:xe(e.gender),fortuneYear:Number.isInteger(e.fortuneYear)?e.fortuneYear:void 0,dst:e.dst!==!1});return{...i,summary:yn(i)}}if(t==="name"){const o=e.action==="generate"?"generate":"assess",n=e.datetime?fe(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}:{}}:{},i=we({action:o,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,...n,...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{...i,summary:Qn(i)}}throw t?oe("E_SYSTEM",`未知体系「${t}」,可选:bazi(四柱八字)、ziwei(紫微斗数)、liuyao(六爻)、meihua(梅花易数)、daliuren(大六壬)、qimen(奇门遁甲)、hepan(合盘)、tarot(塔罗)、almanac(黄历)、zeri(择日)、chenggu(称骨)、xiaoliuren(小六壬)、star(星座)、numerology(生命数字)、mbti(十六型人格问卷)、trend(人生 K 线)、fengshui(风水)、name(起名)、convert(公农历互转)。`):oe("E_INPUT","缺少 system,可选:bazi(四柱八字)、ziwei(紫微斗数)、liuyao(六爻)、meihua(梅花易数)、daliuren(大六壬)、qimen(奇门遁甲)、hepan(合盘)、tarot(塔罗)、almanac(黄历)、zeri(择日)、chenggu(称骨)、xiaoliuren(小六壬)、star(星座)、numerology(生命数字)、mbti(十六型人格问卷)、trend(人生 K 线)、fengshui(风水)、name(起名)、convert(公农历互转)。")}function Rn(e){const t=e.ganzhi,o=e.jieQi&&e.jieQi.next?` 下一节:${e.jieQi.next.name} ${e.jieQi.next.date}`:"",n=e.dayGod?`值日:${e.dayGod.name}(${e.dayGod.type}·${e.dayGod.luck})`:"",i=e.xiu?`二十八宿:${e.xiu.name}宿(${e.xiu.luck}·${e.xiu.zheng}·${e.xiu.animal})`:"",r=e.taiShen?`胎神:${e.taiShen}`:"",h=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:"—"}`:"",k=e.lucky?`吉配生肖:六合${e.lucky.liuhe||"—"} 三合${(e.lucky.sanhe||[]).join("、")||"—"}`:"",ae=e.nayin&&e.nayin.day?`日柱纳音:${e.nayin.day.name}`:"",ce=(e.hours||[]).map(U=>`${U.zhi}${U.ganZhi.slice(0,1)}·${U.shen}${U.luck==="吉"?"吉":"凶"}`).join(" ");return[`【黄历】${e.meta.date} ${e.meta.weekday} ${e.lunar.text}`,`干支:${t.year}年 ${t.month}月 ${t.day}日 属${t.shengXiao}`,...e.meta.boundaryNote?[` ${e.meta.boundaryNote}`]:[],`建除:${e.zhiXing}日 冲:${e.chong.text}${e.chong.sha?`(${e.chong.sha})`:""} ${n}`,[i,ae,r].filter(Boolean).join(" "),`宜:${e.yi.join("、")}`,`忌:${e.ji.join("、")}`,h,k,ce?`时辰吉凶:${ce}`:"",`节气:上一节 ${e.jieQi.prev?`${e.jieQi.prev.name} ${e.jieQi.prev.date}`:"—"}${o}`,e.dailyHexagram?`每日一卦:${e.dailyHexagram.name} ${e.dailyHexagram.meaning||""}`:"",`口径:${e.meta.scope}`].filter(Boolean).join(`
|
|
91
|
+
`)}function Un(e){const t=e.compare&&e.compare.mode==="candidates",o=t?`【择日·${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}`:"(未给属相,未做冲煞排除)"}`,n=e.days.slice().sort((r,h)=>h.score-r.score).slice(0,t?12:5).map(r=>`· ${r.date} ${r.weekday} ${r.verdict}(${r.score}分) 宜${r.yi.slice(0,3).join("/")} ${r.reasons.join(";")||"无特别加减分"}`),i=t?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(r=>r!==e.compare.best.date).join("、")}`:""):"这一组都因冲属相被排除,没有可用的日子":`推荐日:${e.best.length?e.best.join("、"):"本期无(都不够推荐分)"}`;return[o,i,`推荐日:${e.best.length?e.best.join("、"):"无"}`,`可用日:${e.usable.length?e.usable.join("、"):"无"}`,`回避日:${e.avoid.length?e.avoid.slice(0,6).join("、"):"无"}`,t?"候选日逐日:":"逐日排序:",...n,...t?[`比较口径:${e.compare.note}`]:[],`口径:${e.meta.scope}`].join(`
|
|
89
92
|
`)}function Zn(e){const t=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}):${t.text||"—"}`,`释义:${t.plain||"—"}`,`分档白话:${e.verdict.text}`,"口径:骨重与歌诀为通行本口径(各版本歌诀有异文),释义为白话自撰,属民俗娱乐参考。"].join(`
|
|
90
93
|
`)}function Hn(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(`
|
|
91
|
-
`)}function
|
|
94
|
+
`)}function Bn(e){return[`【星座】${e.meta.date} ${e.sign.name}(${e.sign.element}·守护星${e.sign.planet})`,`区间:${e.sign.range} 关键词:${e.sign.keywords} 契合:${e.sign.compatible}`,`当日基调:${e.daily.tone}`,e.daily.dims.map(t=>`· ${t.name}:${"★".repeat(t.stars)}${"☆".repeat(5-t.stars)} ${t.text}`).join(`
|
|
92
95
|
`),`幸运色:${e.daily.luckyColor} 幸运数字:${e.daily.luckyNumber}`,"口径:当日基调由日期哈希确定性生成(同日同结果),纯娱乐向。"].join(`
|
|
93
|
-
`)}function
|
|
96
|
+
`)}function Fn(e){const t=e.ganzhi;return[`【公农历转换·${e.meta.mode==="lunar2solar"?"农历 → 公历":"公历 → 农历"}】${e.lunar.text} ⇄ ${e.solar.text} ${e.meta.weekday}`,`干支:${t.year}年 ${t.month}月 ${t.day}日 属${t.shengXiao}${t.springYear&&t.springYear!==t.year?`(春节界为${t.springYear}年)`:""}`,...e.meta.note?[`注:${e.meta.note}`]:[],`口径:${e.meta.scope}`].join(`
|
|
94
97
|
`)}function Jn(e){return[`【生命数字】${e.meta.date}(西方数字学,与八字/紫微不可互证)`,...e.parts.map(t=>`${t.name}:${t.number}(${t.meaning.title}) ${t.meaning.keywords}
|
|
95
98
|
倾向:${t.meaning.tendency}
|
|
96
99
|
课题:${t.meaning.lesson}`)].join(`
|
|
97
|
-
`)}function Xn(e){const t=e.dims.map(i=>{const
|
|
98
|
-
${
|
|
99
|
-
`)}`:"";return[`【十六型人格】${e.type}(${
|
|
100
|
+
`)}function Xn(e){const t=e.dims.map(i=>{const r=i.picked===i.left?i.leftSay:i.rightSay,h=Math.round(i.pct*100);return`${i.left}/${i.right} 取 ${i.picked}(${i.strength} ${h}%,净分 ${i.sum}) ${r}`}),o=e.profile,n=Array.isArray(o.stack)&&o.stack.length?o.stack.map((i,r)=>`${r===0?"主导 ":""}${i.code}`).join(" → ")+`
|
|
101
|
+
${o.stack.map(i=>`${i.code}:${i.say}`).join(`
|
|
102
|
+
`)}`:"";return[`【十六型人格】${e.type}(${o.title})· ${o.keywords} 已答 ${e.answered}/${e.total} 题`,`一句:${o.oneLine}`,"【四维】",...t,`【优势】${o.strengths.join(";")}`,`【留意】${o.blindspots.join(";")}`,`【课题】${o.growth}`,`【认知功能】${n}`,`【工作】${o.work}`,`【关系】${o.love}`,`【学习】${o.study}`,`注:${e.note}`].join(`
|
|
100
103
|
`)}function Wn(e){return[`【十六型人格问卷】${e.total} 题,每题按 1(完全不像我)到 5(很像我)打分`,...e.questions.map(t=>`${t.no}. ${t.text}`),`请把 ${e.total} 个分数按顺序交给 answers(如 [4,2,5,3,…]);可以跳过某些题(填 null),至少答 12 题。`,`注:${e.note}`].join(`
|
|
101
|
-
`)}function Kn(e){const t=e.meta.strength,
|
|
104
|
+
`)}function Kn(e){const t=e.meta.strength,o=e.meta.dayMaster,n=o&&typeof o=="object"?`${o.stem}(${o.element})`:String(o||"");return[`【人生 K 线】${e.meta.birth} ${e.meta.gender} 日主 ${n} 旺衰 ${t.level}(${t.score})`,e.meta.boundaryNote?`※ ${e.meta.boundaryNote}`:"",`【大运分段】${e.segments.map(i=>`${i.ganZhi} ${i.startAge}-${i.endAge}岁`).join(" ")}`,`【走势】${Array.isArray(e.sparkline)?e.sparkline.join(" "):e.sparkline}`,...e.highlights&&e.highlights.best&&e.highlights.best.length?[`【关键年】最佳 ${e.highlights.best.join(";")}${e.highlights.worst&&e.highlights.worst.length?`
|
|
102
105
|
最需留意 ${e.highlights.worst.join(";")}`:""}`]:[],`※ ${e.disclaimer}`].filter(Boolean).join(`
|
|
103
|
-
`)}function yn(e){if(e.meta.action==="xuankong"){const
|
|
104
|
-
`)}if(e.meta.action==="advise"){const
|
|
105
|
-
`)}const t=e.mingGua;return[`【命卦】${t.num}${t.gua}(${t.group}) 方位 ${t.direction}`,`【四吉】${e.luckyDirections.map(
|
|
106
|
-
`)}function Qn(e){if(e.action==="generate")return[`【候选名】姓 ${e.surname}(${e.gender},喜用 ${e.bazi.favorable.join("、")})${e.bazi.basis}`,...e.candidates.map(
|
|
107
|
-
`);const t=
|
|
108
|
-
`)}function Vn(e){const
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
${
|
|
123
|
-
`
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
106
|
+
`)}function yn(e){if(e.meta.action==="xuankong"){const o=e.meta.period,n=ce=>{const U=e.palaces.find(ue=>ue.palace===ce);return`${ce}${U.yun}/${U.shan}/${U.xiang}`},i=ce=>ce.map(n).join(" "),r=e.wangShanWangXiang,h=e.meta.jianXiang,k=e.timeFlying,ae=k?`【年月日时】${[["year","年"],["month","月"],["day","日"],["hour","时"]].filter(([ce])=>k[ce]).map(([ce,U])=>`${U}${k[ce].centerName}${k[ce].fly?`·${k[ce].fly}`:""}`).join(" ")}${k.meta&&k.meta.note?`(${k.meta.note})`:""}`:"";return[`【玄空】${e.meta.periodLabel}${h&&h.active?"·替卦":"·下卦"} 坐 ${e.meta.sitting} 向 ${e.meta.facing}`,...h&&h.active?[`【替卦】${h.note}`]:[],`【入中】山盘 ${e.meta.shanCenter.star}${e.meta.shanCenter.name}(${e.meta.shanCenter.fly},${e.meta.shanCenter.basis}${e.meta.shanCenter.mode==="替卦"?`;原运星 ${e.meta.shanCenter.original}${e.meta.shanCenter.replaced?",已替":",用替而未替"}`:""});向盘 ${e.meta.xiangCenter.star}${e.meta.xiangCenter.name}(${e.meta.xiangCenter.fly},${e.meta.xiangCenter.basis}${e.meta.xiangCenter.mode==="替卦"?`;原运星 ${e.meta.xiangCenter.original}${e.meta.xiangCenter.replaced?",已替":",用替而未替"}`:""})`,`【九宫】${i(["巽","离","坤"])}|${i(["震","中","兑"])}|${i(["艮","坎","乾"])}`,`【当运】山星${o}到${e.dangYun.shan.text};向星${o}到${e.dangYun.xiang.text}`,`【表法】${r.byTable===null?"替卦不套正向表;":""}${r.table.length?r.table.join("、"):"无"};${r.note}`,`【合十】山星合十 ${e.heshi.shan.join("、")||"无"};向星合十 ${e.heshi.xiang.join("、")||"无"}`,...ae?[ae]:[],...e.meta.note?[`※ ${e.meta.note}`]:[],`※ ${e.disclaimer}`].join(`
|
|
107
|
+
`)}if(e.meta.action==="advise"){const o=e.mingMatch?[`【命宅配】${e.mingMatch.text}`]:[`※ ${e.meta.birthNote||"未提供生辰,未做命宅配。"}`];return[`【宅卦】坐 ${e.meta.sitting} 向 ${e.meta.facing} ${e.meta.houseGua}宅(${e.meta.houseGroup})`,`【八星】${e.houseStars.map(n=>`${n.star}·${n.direction}${n.palace?`(${n.palace})`:""}`).join(" ")}`,`【门】${e.layout.door}`,`【灶】${e.layout.stove}`,`【床】${e.layout.bed}`,`【厕】${e.layout.toilet}`,...o,`※ ${e.disclaimer}`].join(`
|
|
108
|
+
`)}const t=e.mingGua;return[`【命卦】${t.num}${t.gua}(${t.group}) 方位 ${t.direction}`,`【四吉】${e.luckyDirections.map(o=>`${o.star}·${o.direction}${o.palace?`(${o.palace})`:""}`).join(" ")}`,`【四凶】${e.unluckyDirections.map(o=>`${o.star}·${o.direction}`).join(" ")}`,...e.yearlyFlying?[`【${e.meta.fortuneYear} 年九宫飞星】中宫 ${e.yearlyFlying.centerName};${e.yearlyFlying.palaces.filter(o=>o.palace!=="中").map(o=>`${o.palace}${o.name}`).join(" ")}`]:[`※ ${e.meta.note||""}`],`※ ${e.disclaimer}`].filter(Boolean).join(`
|
|
109
|
+
`)}function Qn(e){if(e.action==="generate")return[`【候选名】姓 ${e.surname}(${e.gender},喜用 ${e.bazi.favorable.join("、")})${e.bazi.basis}`,...e.candidates.map(k=>{const ae=k.wuge&&k.wuge.available?` 五格 ${k.wuge.summary}`:"",ce=k.phonetics&&k.phonetics.available?` 音韵 ${k.phonetics.level}(${k.phonetics.tonePattern})`:"";return`${k.rank}. ${k.name} ${k.chars.map(U=>`${U.char}(${U.element})${U.meaning}`).join(" ")}${ae}${ce}`}),...e.notes.map(k=>`※ ${k}`)].join(`
|
|
110
|
+
`);const t=k=>k.source==="lib"?"字库":k.source==="user"?"用户指定":"未收录",o=k=>{const ae=k.element==="未收录"?"未收录(不猜五行)":`${k.element}(${t(k)})`,ce=k.favorable===!0?"合喜用":k.favorable===!1?"不合喜用":"不判",U=k.suggest&&k.suggest.length?` 可换:${k.suggest.map(ue=>`${ue.char}(${ue.element})`).join("、")}`:"";return`· ${k.char}:${ae}|${ce}|${k.meaning}${U}`},n=e.wuge,i=n&&n.available?`【五格】${n.strokes.map(k=>`${k.char}${k.strokes}画`).join("+")}|${n.summary}|三才 ${n.sancai.text}`:`【五格】${n?n.reason:"未算"}`,r=e.phonetics,h=r&&r.available?`【音韵】${r.chars.map(k=>`${k.char}${k.py}${k.tone}`).join(" ")}|声调 ${r.tonePattern}|${r.level}${r.issues.length?`:${r.issues.map(k=>k.text).join(";")}`:""}`:`【音韵】${r?r.reason:"未算"}`;return[`【名字评估】${e.fullName}`,...e.chars.map(o),e.bazi?`【八字】日主 ${e.bazi.dayMaster&&e.bazi.dayMaster.stem?`${e.bazi.dayMaster.stem}(${e.bazi.dayMaster.element})`:e.bazi.dayMaster},旺衰 ${e.bazi.strength.level}(${e.bazi.strength.score}),${e.bazi.basis}`:"",i,h,`【结论】${e.verdict}`,...e.notes.map(k=>`※ ${k}`)].filter(Boolean).join(`
|
|
111
|
+
`)}function Vn(e){const t=e.summary??JSON.stringify(e,null,2),o=`
|
|
112
|
+
`,i=[(e.brief?["【先说结论】"+e.brief.lead].concat((e.brief.sections||[]).map(r=>[" ",r.h,":",r.t].join(""))).concat((e.brief.advice||[]).length?[" 可以试着做的:"+e.brief.advice.map(r=>String(r).replace(/。$/,"")).join(";")+"。"]:[]).concat(e.brief.caveat?[" ※ "+e.brief.caveat]:[]).join(o)+o:"")+t];if(e.shadow&&e.shadow.id){const r=e.shadow;i.push(`【影子盘】${r.id}(同参数同 ID;版本 ${r.version})
|
|
113
|
+
基础指纹 ${r.baseId}(不含版本,跨版本可比对)`+(r.reproducible===!1?`
|
|
114
|
+
⚠ 不可复算:${r.reason}`:"")+(r.reproducible===!0&&r.asOfPinned===!1&&(r.system==="bazi"||r.system==="ziwei")?`
|
|
115
|
+
提示:未固定 asOf,流年/流月随「此刻」变化;要比对请传 asOf。`:""))}if(e.revision&&((e.revision.applied||[]).length||(e.revision.ignored||[]).length)){const r=e.revision,h=(r.applied||[]).map(k=>`${k.label}:${k.fromDisplay==null?"(未设)":k.fromDisplay} → ${k.display}`);i.push(`【改参】${r.text}${h.length?`
|
|
116
|
+
${h.join(";")}`:`
|
|
117
|
+
没有识别到可改的参数,仍按原参数排盘`}`+((r.ignored||[]).length?`
|
|
118
|
+
未处理:${r.ignored.join(";")}`:""))}if(typeof e.handle=="string"&&e.handle&&i.push(`【排盘句柄】${e.handle}
|
|
119
|
+
追问同一张盘:传 handle + 增量参数(asOf / direction / question,或换 system 看另一套盘),不必重报出生信息。`),Array.isArray(e.trace)&&e.trace.length&&i.push(`【推导链】${be[e.system]||e.system} · ${e.trace.length} 层
|
|
120
|
+
`+e.trace.map((r,h)=>`${h+1}. ${r.field}|${r.result}
|
|
121
|
+
规则:${r.rule} 出处:${r.source}`).join(`
|
|
122
|
+
`)),e.interpret){const r=Sn(e.interpret);r&&i.push(r)}if(e.cross&&i.push(`【八字 × 紫微 交叉验证】
|
|
123
|
+
${Ee(e.cross)}`),e.caliber&&Array.isArray(e.caliber.switches)&&e.caliber.switches.length){const r=e.caliber;i.push(`【口径对照】同一组输入,只换一个口径(不判哪套更准,也不改盘面)
|
|
124
|
+
`+r.switches.map(h=>{if(h.error)return`· ${h.title}:未能对照(${h.error})`;if(!h.total)return`· ${h.title}:${h.currentLabel} → ${h.altLabel},本盘无变化`;const k=(Array.isArray(h.views)?h.views:[]).filter(ce=>ce.changed),ae=k.length?`
|
|
125
|
+
并排:${k.map(ce=>`${ce.label} ${ce.current} → ${ce.alt}`).join(";")}`:"";return`· ${h.title}:${h.currentLabel} → ${h.altLabel}
|
|
126
|
+
${h.summary}${ae}`}).join(`
|
|
127
|
+
`))}if(e.followup){const r=e.followup;i.push(`【追问】${r.question}
|
|
128
|
+
${r.answer}${r.evidence&&r.evidence.length?`
|
|
129
|
+
依据:${r.evidence.join(";")} 置信度:${r.confidence}`:""}`)}if(e.past&&Array.isArray(e.past.rows)&&e.past.rows.length&&i.push(`【验前事】过去 ${e.past.years} 年的流年信号(只读,不改盘)
|
|
130
|
+
`+e.past.rows.map(r=>`· ${r.year} ${r.ganzhi} · ${r.theme}(${r.tier}${r.tenGod?`,${r.tenGod}`:""})`).join(`
|
|
127
131
|
`)+`
|
|
128
|
-
用法:在面板里勾「准 / 不准 / 不确定」后算贴合度;贴合度低时先核对出生时间、时区与晚子时口径。`),e.rectify&&Array.isArray(e.rectify.candidates)){const
|
|
129
|
-
`+
|
|
132
|
+
用法:在面板里勾「准 / 不准 / 不确定」后算贴合度;贴合度低时先核对出生时间、时区与晚子时口径。`),e.rectify&&Array.isArray(e.rectify.candidates)){const r=e.rectify;i.push(`【生时校正】候选时辰 ${r.candidates.length} 个(固定规则打分,只缩小范围)
|
|
133
|
+
`+r.candidates.slice(0,8).map(h=>`· ${h.label} 时柱 ${h.hourGanzhi} / 日柱 ${h.dayGanzhi} · 命中 ${h.hits}/${h.total}`).join(`
|
|
130
134
|
`)+`
|
|
131
|
-
${
|
|
135
|
+
${r.note}`)}return i.filter(Boolean).join(`
|
|
132
136
|
|
|
133
|
-
`)}return{interpret:
|
|
137
|
+
`)}const{buildEventPrompt:et,ASK_KINDS:nt}=C["event-prompt"]||{},{plainSummary:tt}=C["plain-summary"]||{};return{interpret:J,DIRECTIONS:Z,DIRECTION_DEFAULT:se,BRIGHTNESS:j,flowOf:G,geocodeAddress:N,resolveAddress:v,buildBazi:X,buildLiuyao:W,tossLines:V,followup:R,askPrompt:re,pastSignals:ee,verifyFit:Ae,rectifyBirth:Qe,crossCheck:je,crossText:Ee,crossSection:Oe,buildAlmanac:tn,buildZeri:Be,buildChenggu:De,buildXiaoliuren:Xe,buildStar:_e,buildNumerology:qe,buildConvert:Pe,buildTrend:Q,buildFengshui:ye,buildName:we,buildTrace:Ne,traceMarkdown:ge,encodeHandle:ze,decodeHandle:s,resolveHandle:p,askLink:Y,parseAskLink:K,formOf:P,restNote:B,askPackages:b,buildEventPrompt:et,ASK_KINDS:nt,parseDateTime:fe,chartFingerprint:pn,shadowSnapshot:_n,shadowDiff:qn,compute:$n,interpretText:Sn,caliberCompare:Ln,renderText:Vn}})(),{Engine:C.index}}});
|