@tempo-kit/plugin-celestial 0.0.0-stage → 2.0.0-rc.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,2 @@
1
+ export * from './index.js';
2
+ export { CelestialPlugin, default } from './index.js';
@@ -0,0 +1 @@
1
+ "use strict";var Magma;((Magma||={}).plugins||={}).celestial=(()=>{var dn=Object.create;var ze=Object.defineProperty;var pn=Object.getOwnPropertyDescriptor;var hn=Object.getOwnPropertyNames;var gn=Object.getPrototypeOf,yn=Object.prototype.hasOwnProperty;var Ft=(e,n)=>()=>{try{return n||e((n={exports:{}}).exports,n),n.exports}catch(t){throw n=0,t}},$t=(e,n)=>{for(var t in n)ze(e,t,{get:n[t],enumerable:!0})},Ue=(e,n,t,o)=>{if(n&&typeof n=="object"||typeof n=="function")for(let r of hn(n))!yn.call(e,r)&&r!==t&&ze(e,r,{get:()=>n[r],enumerable:!(o=pn(n,r))||o.enumerable});return e},Ce=(e,n,t)=>(Ue(e,n,"default"),t&&Ue(t,n,"default")),fe=(e,n,t)=>(t=e!=null?dn(gn(e)):{},Ue(n||!e||!e.__esModule?ze(t,"default",{value:e,enumerable:!0}):t,e)),Tn=e=>Ue(ze({},"__esModule",{value:!0}),e);var dt=Ft((uo,Ht)=>{"use strict";Ht.exports=window.Magma.pluginSdk});var Ae=Ft((Wo,Wt)=>{"use strict";Wt.exports=window.Magma.Tempo});var co={};$t(co,{ASTRO_KEYS:()=>Ne,AstroTerm:()=>He,CelestialPlugin:()=>We,DAY_MS:()=>ie,HALF_DAY_MS:()=>J,LUNAR_PHASE_KEYS:()=>ae,LunarTerm:()=>Nt,SOLAR_PHASE_NAMES:()=>De,SOLAR_PHASE_STATES:()=>q,SolarTerm:()=>Ct,TIDAL_PHASE_STATES:()=>B,TidalTerm:()=>kt,default:()=>ln,getEclipse:()=>ce,getSolarPosition:()=>Ee});var h={};$t(h,{definePlugin:()=>Mn,defineTerm:()=>te});Ce(h,fe(dt()));var Ze=fe(dt()),Mn=e=>(0,Ze.definePlugin)({...e,version:"2.0.0-rc.0"}),te=e=>(0,Ze.defineTerm)({...e,version:"2.0.0-rc.0"});var C=e=>typeof e=="number"&&Number.isFinite(e),Ye=e=>typeof e=="string";var pt=e=>typeof e=="function",ht=e=>e==null,gt=e=>!ht(e);var yt=e=>e instanceof Date&&C(e.getTime());var se=e=>gt(e)&&typeof e=="object"&&!Array.isArray(e);function Sn(e){if(!ht(e)){if(C(e))return e;if(yt(e))return e.getTime();if(se(e)){if(C(e.epoch?.ms))return e.epoch.ms;if(C(e.epochMilliseconds))return e.epochMilliseconds;if(C(e.timestamp))return e.timestamp;if(yt(e.date))return e.date.getTime();if(pt(e.toInstant))try{let n=e.toInstant().epochMilliseconds;if(C(n))return n}catch{}if(pt(e.getTime))try{let n=e.getTime();if(C(n))return n}catch{}}if(Ye(e)){let n=Date.parse(e.trim());if(C(n))return n}}}function k(e,n=0){let t=Sn(e);return gt(t)?t:n}function Y(e=0,n=0){if(C(e))return{lat:e,lng:C(n)?n:0,elevation:0};if(se(e)){let t=e.geo,o=e.latitude??e.lat??t?.latitude??t?.lat??0,r=e.longitude??e.long??e.lng??e.lon??t?.longitude??t?.lng??t?.long??t?.lon??0,s=e.elevation??t?.elevation??0;return{lat:C(o)?o:0,lng:C(r)?r:0,elevation:C(s)?s:0}}return{lat:0,lng:0,elevation:0}}var v=29.53058867,Tt=94718244e4,Mt=9470316e5,Te=27.55455,J=432e5,ie=864e5;function Me(e,n){let t=e+n*24e4,o=new Date(t);return{startOfDayMs:new Date(Date.UTC(o.getUTCFullYear(),o.getUTCMonth(),o.getUTCDate())).getTime(),localDate:o,localMs:t}}function ne(e){let n=(e-946728e6)/315576e7,t=Math.PI/180,o=(218.316+481267.8813*n)%360,r=(134.963+477198.8676*n)%360,s=(357.529+35999.0503*n)%360,i=(297.85+445267.1114*n)%360,a=(93.272+483202.0175*n)%360,u=o+6.289*Math.sin(r*t)+1.274*Math.sin((2*i-r)*t)+.658*Math.sin(2*i*t)+.214*Math.sin(2*r*t)-.186*Math.sin(s*t),l=5.128*Math.sin(a*t)+.28*Math.sin((r+a)*t)+.277*Math.sin((r-a)*t)+.173*Math.sin((2*i-a)*t),c=.9507+.0518*Math.cos(r*t)+.0095*Math.cos((2*i-r)*t)+.0078*Math.cos(2*i*t),m=(23.439-4e-7*((e-946728e6)/864e5))*t,f=u*t,d=l*t,p=Math.sin(d)*Math.cos(m)+Math.cos(d)*Math.sin(m)*Math.sin(f),g=Math.asin(p),y=Math.sin(f)*Math.cos(m)-Math.tan(d)*Math.sin(m),T=Math.cos(f);return{ra:Math.atan2(y,T),dec:g,hp:c}}function Q(e){return(e%360+360)%360}function St(e){let n=2*Math.PI;return(e%n+n)%n}function Le(e){let n=e%(2*Math.PI);return n>Math.PI&&(n-=2*Math.PI),n<-Math.PI&&(n+=2*Math.PI),n}function Ke(e,n){let o=(280.46061837+360.98564736629*((e-946728e6)/864e5))%360;return Q(o+n)*(Math.PI/180)}function K(e,n,t){let o=Ke(e,n),r=t??ne(e).ra;return Le(o-r)}function Se(e){let n=e*(Math.PI/180),t=Math.round(6378.14/Math.sin(n)*10)/10,o=Math.round(2*Math.asin(1737.4/t)*(180/Math.PI)*60*100)/100;return{distanceKm:t,angularDiameterArcmin:o}}function be(e){return((e-Tt)/864e5%v+v)%v}function ke(e){return .7275*e-.5667}function Be(e,n){let t=be(e),o=t/v*360,r=Math.min(Math.abs(o),Math.abs(o-180),Math.abs(o-360)),s=n??Se(ne(e).hp).distanceKm,i=(406700-s)/50300,a=Math.round(Math.max(0,Math.min(1,i))*1e3)/1e3,u=r<=35,l=u&&(s<=362e3||a>=.88),c=u&&(s>=404e3||a<=.12);return{ageDays:t,alignmentDeg:Math.round(o*100)/100,distFromSyzygy:r,perigeeFactor:a,isSupermoon:l,isMicromoon:c}}function de(e){let n=Math.PI/180,t=(e-946728e6)/315576e7,o=(280.46646+36000.76983*t)%360,r=(357.52911+35999.05029*t)%360,s=(1.914602-.004817*t)*Math.sin(r*n)+(.019993-101e-6*t)*Math.sin(2*r*n)+289e-6*Math.sin(3*r*n),i=(o+s)%360*n,a=(23.439291-.0130042*t)*n,u=Math.sin(a)*Math.sin(i),l=Math.asin(u);return{raSun:Math.atan2(Math.cos(a)*Math.sin(i),Math.cos(i)),decSun:l}}function Ge(e,n,t){let o=Ke(e,n),r=t??de(e).raSun;return Le(o-r)}function oe(e,n,t){let o=Math.sin(e)*Math.sin(n)+Math.cos(e)*Math.cos(n)*Math.cos(t);return Math.asin(Math.max(-1,Math.min(1,o)))}function bt(e,n,t){let o=Math.PI/180,r=n*o,{ra:s,dec:i,hp:a}=ne(e),u=K(e,t,s),l=oe(r,i,u),c=ke(a);return{alt:l/o,targetAlt:c}}var ae=Object.freeze(["new-moon","waxing-crescent","first-quarter","waxing-gibbous","full-moon","waning-gibbous","third-quarter","waning-crescent"]);function ve(e,n={}){let t=k(e),o=be(t),r=o/v*2*Math.PI,s=(1-Math.cos(r))/2,i=o<v/2,a=n.sphere,u=!1,l=!1;if(Ye(a)){let g=a.toLowerCase();g==="north"?u=!0:g==="south"&&(l=!0)}let c,m,f,d,p=v/16;return o<p||o>=v-p?(c="new-moon",m="New Moon",f=1,(u||l)&&(d="\u{1F311}")):o<3*p?(c="waxing-crescent",m="Waxing Crescent",f=2,l?d="\u{1F318}":u&&(d="\u{1F312}")):o<5*p?(c="first-quarter",m="First Quarter",f=3,l?d="\u{1F317}":u&&(d="\u{1F313}")):o<7*p?(c="waxing-gibbous",m="Waxing Gibbous",f=4,l?d="\u{1F316}":u&&(d="\u{1F314}")):o<9*p?(c="full-moon",m="Full Moon",f=5,(u||l)&&(d="\u{1F315}")):o<11*p?(c="waning-gibbous",m="Waning Gibbous",f=6,l?d="\u{1F314}":u&&(d="\u{1F316}")):o<13*p?(c="third-quarter",m="Third Quarter",f=7,l?d="\u{1F313}":u&&(d="\u{1F317}")):(c="waning-crescent",m="Waning Crescent",f=8,l?d="\u{1F312}":u&&(d="\u{1F318}")),{key:c,phase:m,index:f,illumination:s,ageDays:o,isWaxing:i,emoji:d,phases:ae}}function Ve(e,n={}){let t=k(e),o=ve(t,n),r=be(t),s=Math.floor((r+v/16)/(v/8)),i=s===0?-v/16:s*(v/8)-v/16,a=i+v/8,u=t-r*864e5,l=Math.round(u+i*864e5),c=Math.round(u+a*864e5);return{startMs:l,endMs:c,phase:o}}function qe(e,n=0,t=0){let o=k(e),{lat:r,lng:s}=Y(n,t),{startOfDayMs:i}=Me(o,s),a=i-s*24e4,u,l,c=bt(a,r,s),m=c.alt-c.targetAlt;for(let f=1;f<=24;f++){let d=a+f*36e5,{alt:p,targetAlt:g}=bt(d,r,s),y=p-g;if(m<0&&y>=0){let T=-m/(y-m);u=Math.round(a+(f-1+T)*36e5)}else if(m>0&&y<=0){let T=m/(m-y);l=Math.round(a+(f-1+T)*36e5)}m=y}return{latitude:r,longitude:s,moonriseMs:u,moonsetMs:l}}function Dt(e,n=0,t=0){let o=k(e),{lng:r}=Y(n,t),{startOfDayMs:s}=Me(o,r),i=s-r*24e4,a=K(i,r);for(let u=1;u<=24;u++){let l=i+u*36e5,c=K(l,r);if(a<0&&c>=0){let m=-a/(c-a),f=Math.round(i+(u-1+m)*36e5),d=K(f,r),p=(c-a)/36e5;return p!==0&&(f=Math.round(f-d/p)),f}a=c}}function Et(e,n=0,t=0){let o=k(e),{lng:r}=Y(n,t),{startOfDayMs:s}=Me(o,r),i=s-r*24e4,a=l=>{let c=K(l,r),m=Q(c*180/Math.PI+180);return m>180&&(m-=360),m*(Math.PI/180)},u=a(i);for(let l=1;l<=24;l++){let c=i+l*36e5,m=a(c);if(u<0&&m>=0){let f=-u/(m-u),d=Math.round(i+(l-1+f)*36e5),p=a(d),g=(m-u)/36e5;return g!==0&&(d=Math.round(d-p/g)),d}u=m}}function Xe(e){let n=k(e),{hp:t}=ne(n),{distanceKm:o,angularDiameterArcmin:r}=Se(t),{perigeeFactor:s,isSupermoon:i,isMicromoon:a}=Be(n,o);return{distanceKm:o,angularDiameterArcmin:r,horizontalParallaxDeg:Math.round(t*1e4)/1e4,perigeeFactor:s,isSupermoon:i,isMicromoon:a}}function Je(e,n=0,t=0){let o=k(e),{lat:r,lng:s}=Y(n,t),i=Math.PI/180,a=r*i,{ra:u,dec:l,hp:c}=ne(o),m=K(o,s,u),f=oe(a,l,m),p=(f-c*i*Math.cos(f))/i,g=-Math.sin(m),y=Math.cos(a)*Math.tan(l)-Math.sin(a)*Math.cos(m),T=Q(Math.atan2(g,y)/i),_=ke(c),b=f/i>=_,{distanceKm:D,angularDiameterArcmin:P}=Se(c),L=Math.round(p*100)/100,M=Math.round((90-L)*100)/100,R=Dt(o,r,s),O=Et(o,r,s);return{latitude:r,longitude:s,altitude:L,azimuth:Math.round(T*100)/100,zenith:M,isAboveHorizon:b,transitMs:R,antiTransitMs:O,rightAscensionDeg:Math.round(Q(u*180/Math.PI)*100)/100,declinationDeg:Math.round(l*180/Math.PI*100)/100,distanceKm:D,angularDiameterArcmin:P}}function Qe(e,n=0,t=0){let o=k(e),{lat:r,lng:s}=Y(n,t),i=Math.PI/180,a=r*i,{ra:u,dec:l}=ne(o),{raSun:c,decSun:m}=de(o),f=Math.cos(m)*Math.sin(c-u),d=Math.sin(m)*Math.cos(l)-Math.cos(m)*Math.sin(l)*Math.cos(c-u),p=Q(Math.atan2(f,d)/i),g=K(o,s,u),y=Math.sin(g),T=Math.tan(a)*Math.cos(l)-Math.sin(l)*Math.cos(g),_=Q(Math.atan2(y,T)/i),b=Q(p-_);return{crescentTiltDeg:Math.round(b*100)/100,brightLimbAngleDeg:Math.round(p*100)/100,parallacticAngleDeg:Math.round(_*100)/100}}var q=Object.freeze(["night","astronomical-twilight","nautical-twilight","civil-twilight","daylight"]),De=Object.freeze({daylight:"Daylight",night:"Night","civil-twilight":"Civil Twilight","nautical-twilight":"Nautical Twilight","astronomical-twilight":"Astronomical Twilight"});function bn(e){let n=(e-2451545)/36525,t=359.9937*n-2.47,o=1+.0334*Math.cos(t*Math.PI/180)+7e-4*Math.cos(2*t*Math.PI/180),r=485*Math.cos((324.96+1934.136*n)*Math.PI/180)+203*Math.cos((337.23+32668.776*n)*Math.PI/180)+199*Math.cos((342.08+8933.04*n)*Math.PI/180)+182*Math.cos((27.85+4183.998*n)*Math.PI/180)+156*Math.cos((73.14+19353.473*n)*Math.PI/180)+136*Math.cos((171.52+7299.049*n)*Math.PI/180)+77*Math.cos((222.54+22812.296*n)*Math.PI/180)+74*Math.cos((296.72+11726.159*n)*Math.PI/180)+70*Math.cos((243.58+11848.293*n)*Math.PI/180)+58*Math.cos((119.81+191.606*n)*Math.PI/180)+52*Math.cos((297.17+4592.518*n)*Math.PI/180)+50*Math.cos((21.02+4578.031*n)*Math.PI/180)+45*Math.cos((247.54+29929.562*n)*Math.PI/180)+44*Math.cos((325.15+31555.956*n)*Math.PI/180)+29*Math.cos((60.93+4443.417*n)*Math.PI/180)+18*Math.cos((155.12+67555.328*n)*Math.PI/180)+17*Math.cos((288.79+4562.452*n)*Math.PI/180)+16*Math.cos((198.04+62894.029*n)*Math.PI/180)+14*Math.cos((199.76+31436.921*n)*Math.PI/180)+12*Math.cos((95.39+14577.848*n)*Math.PI/180)+12*Math.cos((287.11+31931.756*n)*Math.PI/180)+12*Math.cos((320.81+34777.259*n)*Math.PI/180)+9*Math.cos((227.73+1222.114*n)*Math.PI/180)+8*Math.cos((15.45+16859.074*n)*Math.PI/180);return e+1e-5*r/o}function Dn(e){if(e<-500){let t=(e-1820)/100;return-20+32*t*t}if(e<500){let t=e/100,o=t*t,r=o*t,s=r*t,i=s*t,a=i*t;return 10583.6-1014.41*t+33.78311*o-5.952053*r-.1798452*s+.022174192*i+.0090316521*a}if(e<1600){let t=(e-1e3)/100,o=t*t,r=o*t,s=r*t,i=s*t,a=i*t;return 1574.2-556.01*t+71.23472*o+.319781*r-.8503463*s-.005050998*i+.0083572073*a}if(e<1700){let t=e-1600,o=t*t,r=o*t;return 120-.9808*t-.01532*o+r/7129}if(e<1800){let t=e-1700,o=t*t,r=o*t,s=r*t;return 8.83+.1603*t-.0059285*o+13336e-8*r-s/1174e3}if(e<1860){let t=e-1800,o=t*t,r=o*t,s=r*t,i=s*t,a=i*t,u=a*t;return 13.72-.332447*t+.0068612*o+.0041116*r-37436e-8*s+121272e-10*i-1699e-10*a+875e-12*u}if(e<1900){let t=e-1860,o=t*t,r=o*t,s=r*t,i=s*t;return 7.62+.5737*t-.251754*o+.01680668*r-.0004473624*s+i/233174}if(e<1920){let t=e-1900,o=t*t,r=o*t,s=r*t;return-2.79+1.494119*t-.0598939*o+.0061966*r-197e-6*s}if(e<1941){let t=e-1920,o=t*t,r=o*t;return 21.2+.84493*t-.0761*o+.0020936*r}if(e<1961){let t=e-1950,o=t*t,r=o*t;return 29.07+.407*t-o/233+r/2547}if(e<1986){let t=e-1975,o=t*t,r=o*t;return 45.45+1.067*t-o/260-r/718}if(e<2005){let t=e-2e3,o=t*t,r=o*t,s=r*t,i=s*t;return 63.86+.3345*t-.060374*o+.0017275*r+651814e-9*s+2373599e-11*i}if(e<2050){let t=e-2e3,o=t*t;return 62.92+.32217*t+.005589*o}if(e<2150){let t=(e-1820)/100;return-20+32*t*t-.5628*(2150-e)}let n=(e-1820)/100;return-20+32*n*n}function je(e){if(e<-1e3||e>3e3)throw new RangeError(`Year ${e} is outside the supported Meeus calculation range (-1000 to +3000).`);let n,t,o,r;if(e<=1e3){let a=e/1e3,u=a*a,l=u*a,c=l*a;n=172113929189e-5+365242.1374*a+.06791*u-.00234*l-.00111*c,t=172123325401e-5+365241.72562*a-.05323*u+.00907*l+25e-5*c,o=17213257e-1+365242.49558*a-.11677*u-.00297*l+74e-5*c,r=172141439987e-5+365242.88257*a-.00769*u-.00933*l+6e-4*c}else{let a=(e-2e3)/1e3,u=a*a,l=u*a,c=l*a;n=245162380984e-5+365242.37404*a+.05169*u-.00411*l-57e-5*c,t=245171656767e-5+365241.62603*a+.00325*u+.00888*l-3e-4*c,o=245181021715e-5+365242.01767*a-.11575*u+.00337*l+78e-5*c,r=245190005952e-5+365242.74049*a-.06223*u-.00823*l+32e-5*c}let s=Dn(e),i=a=>{let l=bn(a)-s/86400;return Math.trunc((l-24405875e-1)*864e5)};return[{key:"Vernal",event:"Equinox",epochMs:i(n),year:e},{key:"Summer",event:"Solstice",epochMs:i(t),year:e},{key:"Autumnal",event:"Equinox",epochMs:i(o),year:e},{key:"Winter",event:"Solstice",epochMs:i(r),year:e}]}function et(e,n=0,t=0){let o=k(e),{lat:r,lng:s,elevation:i}=Y(n,t),{startOfDayMs:a,localDate:u,localMs:l}=Me(o,s),c=i>0?.0347*Math.sqrt(i):0,m=Math.floor((l-Date.UTC(u.getUTCFullYear(),0,0))/864e5),f=2*Math.PI/365*(m-1),d=229.18*(75e-6+.001868*Math.cos(f)-.032077*Math.sin(f)-.014615*Math.cos(2*f)-.040849*Math.sin(2*f)),p=.006918-.399912*Math.cos(f)+.070257*Math.sin(f)-.006758*Math.cos(2*f)+907e-6*Math.sin(2*f)-.002697*Math.cos(3*f)+.00148*Math.sin(3*f),g=r*(Math.PI/180),y=720-4*s-d,T=a+y*6e4,_=Math.cos((90.833+c)*Math.PI/180)/(Math.cos(g)*Math.cos(p))-Math.tan(g)*Math.tan(p),b=null,D=null,P=!1,L=!1,M=0,R=!1;if(_<=-1)P=!0,R=!0,M=ie;else if(_>=1)L=!0,R=!1,M=0;else{let S=Math.acos(_)*(180/Math.PI)*4;b=a+(y-S)*6e4,D=a+(y+S)*6e4,M=Math.max(0,D-b),R=o>=b&&o<=D}let O=j=>{let S=Math.cos(j*Math.PI/180)/(Math.cos(g)*Math.cos(p))-Math.tan(g)*Math.tan(p);if(S>=1||S<=-1)return{sunriseMs:null,sunsetMs:null};let N=Math.acos(S)*(180/Math.PI);return{sunriseMs:a+(y-N*4)*6e4,sunsetMs:a+(y+N*4)*6e4}},I=O(96),w=O(102),E=O(108),A="night",F=1;R?(A="daylight",F=5):I.sunriseMs!==null&&I.sunsetMs!==null&&(b!==null&&o>=I.sunriseMs&&o<b||D!==null&&o>D&&o<=I.sunsetMs||b===null&&D===null&&o>=I.sunriseMs&&o<=I.sunsetMs)?(A="civil-twilight",F=4):w.sunriseMs!==null&&w.sunsetMs!==null&&(I.sunriseMs!==null&&o>=w.sunriseMs&&o<I.sunriseMs||I.sunsetMs!==null&&o>I.sunsetMs&&o<=w.sunsetMs||I.sunriseMs===null&&I.sunsetMs===null&&o>=w.sunriseMs&&o<=w.sunsetMs)?(A="nautical-twilight",F=3):E.sunriseMs!==null&&E.sunsetMs!==null&&(w.sunriseMs!==null&&o>=E.sunriseMs&&o<w.sunriseMs||w.sunsetMs!==null&&o>w.sunsetMs&&o<=E.sunsetMs||w.sunriseMs===null&&w.sunsetMs===null&&o>=E.sunriseMs&&o<=E.sunsetMs)?(A="astronomical-twilight",F=2):(A="night",F=1);let ge=T+J;return{latitude:r,longitude:s,elevation:i,sunriseMs:b,sunsetMs:D,solarNoonMs:T,solarNadirMs:ge,daylightDurationMs:M,isDaylight:R,isMidnightSun:P,isPolarNight:L,solarPhaseState:A,index:F,civil:I,nautical:w,astronomical:E}}function Ee(e,n=0,t=0){let o=k(e),{lat:r,lng:s}=Y(n,t),i=Math.PI/180,a=r*i,{raSun:u,decSun:l}=de(o),c=Ge(o,s,u),f=oe(a,l,c)*(180/Math.PI);if(f>-1){let M=1.02/Math.tan((f+10.3/(f+5.11))*i)/60;f+=M}let d=Math.round(f*100)/100,p=Math.round((90-d)*100)/100,g=Math.round((90+d)*100)/100,y=-Math.cos(l)*Math.sin(c),T=Math.sin(l)*Math.cos(a)-Math.cos(l)*Math.sin(a)*Math.cos(c),_=Math.atan2(y,T),b=Math.round(Q(_*(180/Math.PI))*100)/100,D=d>=-4&&d<=6,P=d>=-6&&d<-4,L=d>.1?Math.round(1/Math.tan(d*i)*100)/100:null;return{altitude:d,azimuth:b,zenith:p,nadir:g,isGoldenHour:D,isBlueHour:P,shadowRatio:L}}var B=Object.freeze(["spring","neap","normal"]);function tt(e,n=0,t=0){let o=k(e),{alignmentDeg:r,distFromSyzygy:s}=Be(o),i=Math.min(Math.abs(r-90),Math.abs(r-270)),a=s<=35,u=!a&&i<=35,l=a?"spring":u?"neap":"normal",m=((o-Mt)/864e5%Te+Te)%Te,f=Math.round((.5+.5*Math.cos(m/Te*2*Math.PI))*1e3)/1e3,d=a&&f>=.75,p=745.2,g=Math.floor(o/6e4),y=Math.floor((g%p+p)%p),T={state:l,alignmentDeg:r,isSpringTide:a,isNeapTide:u,isKingTide:d,perigeeFactor:f,lunarTideMinute:y,states:B};if(se(n)||C(n)&&(n!==0||t!==0)){let{lat:b,lng:D}=Y(n,t),P=se(n)&&C(n.lunitidalIntervalMin)?n.lunitidalIntervalMin:0,L=se(n)&&n.regime?n.regime:Math.abs(b)>65?"mixed":"semi-diurnal",M=89428200,R=K(o,D),O=St(-R),I=St(Math.PI-R),w=o+O*(M/(2*Math.PI)),E=K(w,D);w-=E*(M/(2*Math.PI));let A=o+I*(M/(2*Math.PI)),F=K(A,D),ge=F>0?F-Math.PI:F+Math.PI;A-=ge*(M/(2*Math.PI));let j=P*6e4,S=Math.round(w+j),N=Math.round(A+j);for(;S<o;)S+=Math.round(M);for(;S-Math.round(M)>=o;)S-=Math.round(M);for(;N<o;)N+=Math.round(M);for(;N-Math.round(M)>=o;)N-=Math.round(M);let ue=Math.min(S,N),ye=Math.round(M/4),V=ue-ye;V<o&&(V=ue+ye),T.nextHighTideMs=ue,T.nextLowTideMs=V,T.lunitidalIntervalMin=P,T.regime=L}return T}function ce(e,n=0,t=0){let o=k(e),{lat:r,lng:s}=Y(n,t),i=Math.PI/180,a=r*i,{ra:u,dec:l,hp:c}=ne(o),{raSun:m,decSun:f}=de(o),d=Ke(o,s),p=Ge(o,s,m),T=oe(a,f,p)/i>=-.833,_=c*i,b=Math.cos(l)*Math.cos(u)-Math.sin(_)*Math.cos(a)*Math.cos(d),D=Math.cos(l)*Math.sin(u)-Math.sin(_)*Math.cos(a)*Math.sin(d),P=Math.sin(l)-Math.sin(_)*Math.sin(a),L=Math.sqrt(b*b+D*D+P*P),M=Math.atan2(D,b),R=Math.asin(Math.max(-1,Math.min(1,P/L))),O=Le(d-M),w=oe(a,R,O)/i,E=Le(d-u),F=oe(a,l,E)/i>=ke(c),{distanceKm:ge,angularDiameterArcmin:j}=Se(c),S=j/2/60,N=.2665,ue=be(o);if(ue<=2.5||ue>=27){let ye=Math.sin(f)*Math.sin(R)+Math.cos(f)*Math.cos(R)*Math.cos(m-M),V=Math.acos(Math.max(-1,Math.min(1,ye)))/i,ft=Math.round(V*60*10)/10;if(V<N+S){let X="partial-solar",ee=0;if(V<=Math.abs(N-S))S>=N?(X="total-solar",ee=1):(X="annular-solar",ee=Math.min(1,(S/N)**2));else{let $=N,H=S,Z=V,me=H*H*Math.acos((Z*Z+H*H-$*$)/(2*Z*H)),un=$*$*Math.acos((Z*Z+$*$-H*H)/(2*Z*$)),mn=.5*Math.sqrt(Math.max(0,(-Z+H+$)*(Z+H-$)*(Z-H+$)*(Z+H+$))),fn=me+un-mn;ee=Math.min(1,Math.max(0,fn/(Math.PI*$*$)))}return{type:X,obscuration:Math.round(ee*1e3)/1e3,isVisible:T&&ee>0,separationArcmin:ft}}}if(Math.abs(ue-14.765)<=2.5){let ye=(m+Math.PI)%(2*Math.PI),V=-f,ft=Math.sin(l)*Math.sin(V)+Math.cos(l)*Math.cos(V)*Math.cos(u-ye),X=Math.acos(Math.max(-1,Math.min(1,ft)))/i,ee=Math.round(X*60*10)/10,$=.0024,H=1.02*(c+$-N),Z=1.02*(c+$+N);if(X<=H-S)return{type:"total-lunar",obscuration:1,isVisible:F,separationArcmin:ee};if(X<=H+S){let me=Math.min(1,Math.max(0,(H+S-X)/(2*S)));return{type:"partial-lunar",obscuration:Math.round(me*1e3)/1e3,isVisible:F&&me>0,separationArcmin:ee}}else if(X<=Z+S){let me=Math.min(1,Math.max(0,(Z+S-X)/(2*S)));return{type:"penumbral-lunar",obscuration:Math.round(me*1e3)/1e3,isVisible:F&&me>0,separationArcmin:ee}}}return{type:null,obscuration:0,isVisible:!1,separationArcmin:0}}var $e=fe(Ae(),1);var ut=fe(Ae(),1);function nt(e,n,t,o,r,s){function i(T){if(T!==void 0&&typeof T!="function")throw new TypeError("Function expected");return T}for(var a=o.kind,u=a==="getter"?"get":a==="setter"?"set":"value",l=!n&&e?o.static?e:e.prototype:null,c=n||(l?Object.getOwnPropertyDescriptor(l,o.name):{}),m,f=!1,d=t.length-1;d>=0;d--){var p={};for(var g in o)p[g]=g==="access"?{}:o[g];for(var g in o.access)p.access[g]=o.access[g];p.addInitializer=function(T){if(f)throw new TypeError("Cannot add initializers after decoration has completed");s.push(i(T||null))};var y=(0,t[d])(a==="accessor"?{get:c.get,set:c.set}:c[u],p);if(a==="accessor"){if(y===void 0)continue;if(y===null||typeof y!="object")throw new TypeError("Object expected");(m=i(y.get))&&(c.get=m),(m=i(y.set))&&(c.set=m),(m=i(y.init))&&r.unshift(m)}else(m=i(y))&&(a==="field"?r.unshift(m):c[u]=m)}l&&Object.defineProperty(l,o.name,c),f=!0}function ot(e,n,t){for(var o=arguments.length>2,r=0;r<n.length;r++)t=o?n[r].call(e,t):n[r].call(e);return o?t:void 0}var En=Symbol.for("$LibraryTarget"),An=Symbol.for("$LibraryDiscover"),wn=Symbol.for("$LibraryExtensible"),Pn=Symbol.for("nodejs.util.inspect.custom"),_n=Symbol.for("$LibraryLogConfig"),In=Symbol.for("$LibraryRegistry"),xn=Symbol.for("$LibraryRegister"),Rn=Symbol.for("$LibrarySerializerRegistry"),On=Symbol.for("$LibraryMutable"),Nn=Symbol.for("$LibraryIdentity"),Cn=Symbol.for("$LibraryUnwrapped"),G={$Target:En,$Discover:An,$Extensible:wn,$Inspect:Pn,$LogConfig:_n,$Registry:In,$Register:xn,$SerializerRegistry:Rn,$Identity:Nn,$Mutable:On,$Unwrapped:Cn};function rt(e){let n=e,t=0,o=50;for(;n;){let r=n[G.$Target];if(!r||t>=o)break;n=r,t++}return n}function we(e,n,...t){if(e===null||typeof e!="object"&&typeof e!="function")return!1;let o=rt(e);if(!Object.hasOwn(o,n))return!1;if(t.length===0)return!0;let r=o[n];return Ut(r,t)}function Pe(e,n,...t){if(e===null||typeof e!="object"&&typeof e!="function")return!1;let o=rt(e);if(!(n in o))return!1;if(t.length===0)return!0;let r=o[n];return Ut(r,t)}function Ut(e,n){for(let t=0;t<n.length;t++){let o=n[t];if(typeof o=="function"){if(o(e))return!0}else if(typeof o=="string"&&Ln(e,o.trim().toLowerCase()))return!0}return!1}function Ln(e,n){switch(n){case"string":case"number":case"boolean":case"function":case"bigint":case"symbol":case"undefined":return typeof e===n;case"array":return Array.isArray(e);case"null":return e===null;case"object":return e!==null&&!Array.isArray(e)&&typeof e=="object";case"any":case"unknown":return!0;default:return!1}}var kn=[],zt=e=>{if(e===null)return"Null";if(e===void 0)return"Undefined";let n=typeof e;if(n==="string")return"String";if(n==="number")return"Number";if(n==="boolean")return"Boolean";if(n==="bigint")return"BigInt";if(n==="symbol")return"Symbol";try{let t=n==="object"?rt(e):e;return Object.prototype.toString.call(t).slice(8,-1)}catch{return n==="function"?"Function":"Object"}},At=e=>{try{let n=e?.[Symbol.toStringTag]??e?.prototype?.[Symbol.toStringTag];if(typeof n=="string")return n}catch{}},Zt=(e,...n)=>{let t=e;try{t=e?.[G.$Target]??e}catch{t=e}let o=zt(t);switch(o){case"Function":try{return Fn(t)?"Class":"Function"}catch{return"Function"}case"Object":{try{if("length"in t&&Object.keys(t).every(s=>s==="length"||Number.isFinite(Number(s))))return"ArrayLike";for(let s of n){let i=s.class?.[G.$Target]??s.class;if(t===i||i&&t instanceof i)return s.type}let r=globalThis[G.$Registry]??[];for(let s of[...kn,...r]){let i=s.class?.[G.$Target]??s.class;if(t===i||i&&t instanceof i)return s.type}}catch{return"Object"}return"Object"}default:return o}};var vn=/^\s*(class\s|\[native code\])/,Fn=e=>{if(typeof e!="function")return!1;let n=e?.[G.$Target]??e;if(!("prototype"in n))return!1;let t=n?.name,o=At(n);if(n?.[G.$Identity]||n?.prototype?.[G.$Identity]||typeof o=="string"&&o.startsWith("Temporal."))return!0;if(typeof o=="string"&&o.endsWith("Function"))return!1;if((globalThis[G.$Registry]??[]).some(s=>(s.class?.[G.$Target]??s.class)===n||t&&s.type===t||o&&s.type===o))return!0;try{let s=Function.prototype.toString.call(n);if(vn.test(s))return!0;let i=Object.getOwnPropertyDescriptor(n,"prototype");if(i&&i.writable===!1&&!Object.isFrozen(n))return!0;let a=n.prototype;if(a&&Object.getOwnPropertyNames(a).length>2)return!0}catch{return!1}return!1};var st=(e,...n)=>n.includes(Zt(e)),Yt=e=>e===null||typeof e!="object"&&typeof e!="function",_e=e=>!Yt(e);var re=e=>typeof e=="string";var W=e=>Number.isFinite(e);var wt=e=>Array.isArray(e);var Pt=e=>st(e,"Object");var Fe=e=>typeof e=="symbol";var Ie=e=>e===null;var xe=e=>e!=null,pe=e=>e===void 0;var _t=e=>st(e,"Function","AsyncFunction","GeneratorFunction","AsyncGeneratorFunction"),it=e=>typeof e=="function";var It=(e,n)=>st(e,"Error")&&(n?e instanceof n:!0);var xt=(e,n)=>{if(!e||typeof e!="object"&&typeof e!="function")return!1;try{return e[n]===!0}catch{return!1}};var Kt=e=>e?e.charAt(0).toUpperCase()+e.slice(1):"";function Hn(e,n){return At(e)??(pe(n)?e.name||void 0:String(n))}function at(e,n){let t=(o,r,s,i)=>{let a=s??(re(r)?r:void 0)??(Fe(r)&&r.description?r.description:void 0)??Hn(o,i),u=a?String(a).replace(/^\$/,""):"Instance",l=re(r)||re(s),c=Fe(r)?r:l?Symbol.for(`Brand.${u}`):Symbol(`Brand.${u}`),m=p=>xt(p,c),f=o.prototype;if(f&&!we(f,c)&&Object.defineProperty(f,c,{value:!0,configurable:!1,writable:!1,enumerable:!1}),f&&!we(f,Symbol.toStringTag)&&Object.defineProperty(f,Symbol.toStringTag,{value:u,configurable:!0,writable:!1,enumerable:!1}),!o.name||o.name!==u)try{Object.defineProperty(o,"name",{value:u,configurable:!0,writable:!1,enumerable:!1})}catch{}let d=`is${Kt(u)}`;if(!we(o,d))try{Object.defineProperty(o,d,{value:m,configurable:!0,writable:!1,enumerable:!1})}catch{}if(!we(o,Symbol.hasInstance))try{Object.defineProperty(o,Symbol.hasInstance,{value:function(p){if(we(this,d)){let g=this[d];if(it(g))return g.call(this,p)}return _e(p)&&_e(this?.prototype)&&Object.prototype.isPrototypeOf.call(this.prototype,p)},configurable:!0,writable:!1,enumerable:!1})}catch{}return o};return it(e)&&n?.kind==="class"?t(e,void 0,void 0,n.name):(o,r)=>{let s=re(e)||Fe(e)?e:void 0,i=re(n)?n:void 0;return t(o,s,i,r?.name)}}var ir=BigInt(Number.MAX_SAFE_INTEGER),ar=BigInt(Number.MIN_SAFE_INTEGER);function Bt(e){if(It(e))return e;let n=new Error(Pe(e,"message",re)?e.message:String(e));return Pt(e)&&(n.name=Pe(e,"name","string")?e.name:"Error",Pe(e,"code","string","number")&&(n.code=e.code),Pe(e,"stack","string")&&(n.stack=e.stack)),n}var ct=new FinalizationRegistry(e=>{try{_t(e)&&e()}catch(n){console.error("Finalizer callback error:",n)}}),Rt=(()=>{let e=[at("Finalizer")],n,t=[],o;return class{static{o=this}static{let r=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;nt(null,n={value:o},e,{kind:"class",name:o.name,metadata:r},null,t),o=n.value,r&&Object.defineProperty(o,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r}),ot(o,t)}#e;constructor(r){this.#e=r}register(r,s,i){let a=i??Object.create(null),u=this.#e;ct.register(r,()=>{u(s)},a)}unregister(r){return ct.unregister(r)}static register(r,s,i){let a=i??Object.create(null);return ct.register(r,s,a),()=>ct.unregister(a)}},o})(),fr=Rt.isFinalizer;if(typeof globalThis.Temporal>"u")throw new Error("Temporal API is not available. Node 20+ with a polyfill (e.g. @js-temporal/polyfill) is highly recommended. Native Temporal is fully reliable only on Node 26+ (while Node 22 may have instabilities).");try{if(typeof Temporal.Now.zonedDateTimeISO=="function"&&typeof Temporal.Now.zonedDateTimeISO().add!="function")throw new Error("Incomplete Temporal implementation")}catch(e){let n=Bt(e);if(console.warn("Tempo: Native Temporal implementation appears incomplete. Consider loading a polyfill.",n),n.message!=="Incomplete Temporal implementation")throw n}var lt=(()=>{let e=[at("WeakCache")],n,t=[],o;return class{static{o=this}static{let r=typeof Symbol=="function"&&Symbol.metadata?Object.create(null):void 0;nt(null,n={value:o},e,{kind:"class",name:o.name,metadata:r},null,t),o=n.value,r&&Object.defineProperty(o,Symbol.metadata,{enumerable:!0,configurable:!0,writable:!0,value:r})}#e=new Map;#t;static isWeakCache=r=>typeof r=="object"&&r!==null&&#e in r;constructor(){this.#t=new Rt(r=>{let s=this.#e.get(r.key);s&&s.token===r.token&&this.#e.delete(r.key)})}set(r,s){this.delete(r);let i=Object.create(null);return this.#e.set(r,{ref:new WeakRef(s),token:i}),this.#t.register(s,{key:r,token:i},i),this}get(r){let s=this.#e.get(r);if(pe(s))return;let i=s.ref.deref();if(pe(i)){this.#t.unregister(s.token),this.#e.delete(r);return}return i}has(r){return xe(this.get(r))}getOrSet(r,s){let i=this.get(r);if(xe(i))return i;let a=s(r);return this.set(r,a),a}delete(r){let s=this.#e.get(r);return xe(s)?(this.#e.delete(r),this.#t.unregister(s.token),!0):!1}clear(){for(let r of this.#e.values())this.#t.unregister(r.token);this.#e.clear()}static{ot(o,t)}},o})(),Sr=lt.isWeakCache;var wr=new lt,Pr=new lt;var Vn=Object.freeze({MO:1,TU:2,WE:3,TH:4,FR:5,SA:6,SU:7,MON:1,TUE:2,WED:3,THU:4,FRI:5,SAT:6,SUN:7}),qn=Object.freeze({JAN:1,FEB:2,MAR:3,APR:4,MAY:5,JUN:6,JUL:7,AUG:8,SEP:9,OCT:10,NOV:11,DEC:12}),Xn=Object.freeze({1:"Monday",2:"Tuesday",3:"Wednesday",4:"Thursday",5:"Friday",6:"Saturday",7:"Sunday"});var Gt=new h.WeakCache;function Jn(e){if(!_e(e)||wt(e))return!1;let n=e.latitude??e.lat,t=e.longitude??e.lng??e.long,o=W(n)&&n>=-90&&n<=90,r=W(t)&&t>=-180&&t<=180;return o&&r}function le(e,n){let t=n??e,o=t instanceof ut.Tempo?t:new ut.Tempo(W(t)?new Date(t):t,e?.config),r=o.geo??o.config?.geo??n?.geo??e?.geo??null,s=Jn(r),i=s?r.latitude??r.lat:void 0,a=s?r.longitude??r.lng??r.long:void 0,u=s?r?.elevation??o.config?.geo?.elevation:void 0,l=o.tz??n?.tz??e?.tz??"UTC",c=o.sphere??n?.sphere??e?.sphere;return s||(0,h.logWarn)("CelestialPlugin: Valid 'geo' coordinates (latitude: -90..90, longitude: -180..180) were not provided; geo-dependent properties evaluate to null.",o.config),{refTempo:o,lat:i,lng:a,elevation:u,hasGeo:s,geo:r,timeZone:l,...c?{sphere:c}:{}}}function he(e){let n=e.toDateTime();return{year:n.year,month:n.month,day:n.day,hour:n.hour,minute:n.minute,second:n.second,millisecond:n.millisecond,microsecond:n.microsecond,nanosecond:n.nanosecond}}function x(e,n,t){return W(e)?new ut.Tempo(e,{timeZone:n,timeStamp:"ms",...t?{sphere:t}:{}}):null}function Vt(e,n){let{refTempo:t,sphere:o}=n??le(e),r=`${t.epoch.ms}:${o??""}`,s=Gt.get(r);return s||(s=ve(t.epoch.ms,{sphere:o}),Gt.set(r,s)),{key:s.key,phase:s.phase,index:s.index,illumination:Math.round(s.illumination*1e4)/1e4,ageDays:Math.round(s.ageDays*100)/100,isWaxing:s.isWaxing,...o&&s.emoji!==void 0?{emoji:s.emoji}:{},phases:s.phases,keys:s.phases}}function Re(e){return{resolve(n){return[e(this,n)]},define(n,t){let o=e(this,t);return n===!0||n===void 0?o.key:o}}}var qt=29.530588*86400*1e3,Xt=new h.WeakCache,Jt=new h.WeakCache,Qt=new h.WeakCache;function Qn(e,n){let t=`${e}:${n??""}`,o=Xt.get(t);return o||(o=Ve(e,{sphere:n}),Xt.set(t,o)),o}function jn(e,n,t){let o=`${e}:${n}:${t}`,r=Jt.get(o);return r||(r=qe(e,n,t),Jt.set(o,r)),r}function eo(e,n,t){let o=`${e}:${n}:${t}`,r=Qt.get(o);return r||(r=Je(e,n,t),Qt.set(o,r)),r}function Ot(e,n){let t=le(e,n),{refTempo:o,lat:r,lng:s,hasGeo:i,geo:a,timeZone:u,sphere:l}=t,c=Vt(e,t),m=i?jn(o.epoch.ms,r,s):null,f=m?x(m.moonriseMs,u,l):null,d=m?x(m.moonsetMs,u,l):null,p=i?eo(o.epoch.ms,r,s):null,g=i?Xe(o.epoch.ms):null,y=i?Qe(o.epoch.ms,r,s):null,T=i?ce(o.epoch.ms,r,s):null,_=p?.transitMs?x(p.transitMs,u,l):null,b=p?.antiTransitMs?x(p.antiTransitMs,u,l):null,D=p?p.altitude:null,P=p?p.azimuth:null,L=p?p.zenith:null,M=p?p.isAboveHorizon:null,R=y?y.crescentTiltDeg:null,O=g?g.distanceKm:null,I=g?g.angularDiameterArcmin:null,w=g?g.isSupermoon:null,E=g?g.isMicromoon:null,A=T?T.type:null,F=T?T.obscuration:null,{startMs:ge,endMs:j}=Qn(o.epoch.ms,l),S=new $e.Tempo(ge,{timeZone:u,timeStamp:"ms",...l?{sphere:l}:{}}),N=new $e.Tempo(j,{timeZone:u,timeStamp:"ms",...l?{sphere:l}:{}});return{...c,group:"lunar",geo:i?a:null,...he(S),moonrise:f,moonset:d,transit:_,nadir:b,altitude:D,azimuth:P,zenith:L,isAboveHorizon:M,crescentTiltDeg:R,distanceKm:O,angularDiameterArcmin:I,isSupermoon:w,isMicromoon:E,eclipse:A,obscuration:F,start:S,end:N}}var Nt=te({key:"moon",aliases:["lunar"],scope:"lunar",description:"Lunar phase cycle and range resolution",phases:ae,keys:ae,...Re(Ot),[h.TermHook.bound](e,n,t){let o=Ot(t);if(e==="start")return o.start;if(e==="end")return o.end.sub({nanoseconds:1});if(e==="mid"){let r=Math.round((o.start.epoch.ms+o.end.epoch.ms)/2);return new $e.Tempo(r,{timeZone:o.start.tz,timeStamp:"ms",...o.start.sphere?{sphere:o.start.sphere}:{}})}},[h.TermHook.step](e,n,t){let o=Math.round(t.epoch.ms+n*qt);return new $e.Tempo(o,{timeZone:t.tz,timeStamp:"ms",...t.sphere?{sphere:t.sphere}:{}})},[h.TermHook.diff](e,n,t){return Math.round((e.epoch.ms-t.epoch.ms)/qt)},[h.TermHook.format](e,n){let t=e.toLowerCase();if(t==="#moon"||t==="#lunar"||t.startsWith("#moon.")||t.startsWith("#lunar.")){let o=Ot(n);if(t==="#moon.emoji"||t==="#lunar.emoji")return o.emoji??"";if(t==="#moon.phase"||t==="#lunar.phase")return o.phase;if(t==="#moon.key"||t==="#lunar.key")return o.key;if(t==="#moon.illumination"||t==="#lunar.illumination")return`${Math.round(o.illumination*100)}%`;if(t==="#moon.age"||t==="#lunar.age")return`${o.ageDays}d`;if(t==="#moon"||t==="#lunar")return o.emoji?`${o.emoji} ${o.phase}`:o.phase}}});var Oe=fe(Ae(),1);var jt=new h.WeakCache,en=new h.WeakCache;function to(e,n){let t=`${e}:${n.latitude}:${n.longitude}:${n.elevation??0}`,o=jt.get(t);return o||(o=et(e,n),jt.set(t,o)),o}function no(e,n){let t=`${e}:${n.latitude}:${n.longitude}:${n.elevation??0}`,o=en.get(t);return o||(o=Ee(e,n),en.set(t,o)),o}function mt(e,n){let{refTempo:t,lat:o,lng:r,hasGeo:s,geo:i,timeZone:a}=le(e,n);if(!s)return{key:null,phase:null,phases:q,keys:q,index:null,group:"solar",geo:null,...he(t),elevation:null,sunrise:null,sunset:null,noon:null,nadir:null,solarTime:null,altitude:null,azimuth:null,zenith:null,isGoldenHour:null,isBlueHour:null,shadowRatio:null,isMidnightSun:null,isPolarNight:null,daylightDurationMs:null,isDaylight:null,civil:{sunrise:null,sunset:null},nautical:{sunrise:null,sunset:null},astronomical:{sunrise:null,sunset:null},eclipse:null,obscuration:null,start:t,end:t};let u=W(i?.elevation)?i.elevation:W(e.config?.geo?.elevation)?(e.config?.geo).elevation:void 0,l=t.epoch.ms,c=to(l,{latitude:o,longitude:r,...u!==void 0?{elevation:u}:{}}),m=no(l,{latitude:o,longitude:r,...u!==void 0?{elevation:u}:{}}),f=x(c.sunriseMs,a),d=x(c.sunsetMs,a),p=x(c.solarNoonMs,a),g=x(c.solarNadirMs,a),y=Date.UTC(new Date(l+r*24e4).getUTCFullYear(),new Date(l+r*24e4).getUTCMonth(),new Date(l+r*24e4).getUTCDate()),T=Math.round(l+(y+J-c.solarNoonMs)),_=x(T,"UTC"),b=x(c.civil.sunriseMs,a),D=x(c.civil.sunsetMs,a),P=x(c.nautical.sunriseMs,a),L=x(c.nautical.sunsetMs,a),M=x(c.astronomical.sunriseMs,a),R=x(c.astronomical.sunsetMs,a),O=ce(l,o,r),I=O.type&&O.type.endsWith("-solar")?O.type:null,w=O.type&&O.type.endsWith("-solar")?O.obscuration:0,E,A;return c.isMidnightSun||c.isPolarNight||!f||!d?(E=new Oe.Tempo(c.solarNoonMs-J,{timeZone:a,timeStamp:"ms"}),A=new Oe.Tempo(c.solarNoonMs+J,{timeZone:a,timeStamp:"ms"})):c.solarPhaseState==="daylight"?(E=f,A=d):c.solarPhaseState==="civil-twilight"?b&&l<c.sunriseMs?(E=b,A=f):(E=d,A=D??d):c.solarPhaseState==="nautical-twilight"?P&&b&&l<c.civil.sunriseMs?(E=P,A=b):(E=D??d,A=L??d):c.solarPhaseState==="astronomical-twilight"?M&&P&&l<c.nautical.sunriseMs?(E=M,A=P):(E=L??d,A=R??d):(E=d,A=new Oe.Tempo(c.sunriseMs+ie,{timeZone:a,timeStamp:"ms"})),{key:c.solarPhaseState,phase:De[c.solarPhaseState],phases:q,keys:q,index:c.index,group:"solar",geo:i,elevation:W(i?.elevation)?i.elevation:W(e.config?.geo?.elevation)?(e.config?.geo).elevation:null,...he(E),sunrise:f,sunset:d,noon:p,nadir:g,solarTime:_,altitude:m.altitude,azimuth:m.azimuth,zenith:m.zenith,isGoldenHour:m.isGoldenHour,isBlueHour:m.isBlueHour,shadowRatio:m.shadowRatio,isMidnightSun:c.isMidnightSun,isPolarNight:c.isPolarNight,daylightDurationMs:c.daylightDurationMs,isDaylight:c.isDaylight,civil:{sunrise:b,sunset:D},nautical:{sunrise:P,sunset:L},astronomical:{sunrise:M,sunset:R},eclipse:I,obscuration:w,start:E,end:A}}var Ct=te({key:"sun",aliases:["solar"],scope:"solar",description:"Local solar day cycle and twilight range resolution",phases:q,keys:q,...Re(mt),[h.TermHook.bound](e,n,t){let o=mt(t);if(e==="start")return o.sunrise??o.start;if(e==="end")return o.sunset??o.end;if(e==="mid")return o.noon??t.set({hour:12,minute:0,second:0,millisecond:0})},[h.TermHook.parse](e,n){let t=e.toLowerCase();if(t.startsWith("#sun.")||t.startsWith("#solar.")){let o=t.split(".");if(o.length!==2)return;let r=o[1],s=n?.anchor,i=n?.geo??n?.config?.geo,a=s?s.geo?s:i?new Oe.Tempo(s,{...s.config,geo:i}):s:new Oe.Tempo(void 0,{...n?.config??{},...i?{geo:i}:{}}),u=le(a,s);if(!u.hasGeo)return;let l=mt(u.refTempo,s);if(r==="sunrise")return l.sunrise??void 0;if(r==="sunset")return l.sunset??void 0;if(r==="noon")return l.noon??void 0;if(r==="nadir")return l.nadir??void 0;if(r==="dawn")return l.civil.sunrise??void 0;if(r==="dusk")return l.civil.sunset??void 0;if(r==="start")return l.sunrise??l.start;if(r==="end")return l.sunset??l.end;if(r==="mid")return l.noon??void 0}},[h.TermHook.format](e,n){let t=e.toLowerCase();if(t==="#sun"||t==="#solar"||t.startsWith("#sun.")||t.startsWith("#solar.")){let o=mt(n);if(t==="#solar.phase"||t==="#sun.phase"||t==="#sun"||t==="#solar")return o.phase??"";if(t==="#solar.key"||t==="#sun.key")return o.key??"";if(t==="#solar.altitude"||t==="#sun.altitude")return Ie(o.altitude)?"":`${Math.round(o.altitude*10)/10}\xB0`;if(t==="#solar.elevation"||t==="#sun.elevation")return Ie(o.elevation)?"":`${o.elevation}m`;if(t==="#solar.azimuth"||t==="#sun.azimuth")return Ie(o.azimuth)?"":`${Math.round(o.azimuth*10)/10}\xB0`;if(t==="#solar.zenith"||t==="#sun.zenith")return Ie(o.zenith)?"":`${Math.round(o.zenith*10)/10}\xB0`}}});var nn=fe(Ae(),1);var tn=new h.WeakCache;function oo(e,n){let t=typeof n=="number"?`${e}:${n}`:`${e}:${n.latitude}:${n.longitude}:${n.lunitidalIntervalMin??0}:${n.regime??""}`,o=tn.get(t);return o||(o=tt(e,n),tn.set(t,o)),o}function Lt(e,n){let{refTempo:t,lat:o,lng:r,hasGeo:s,geo:i,timeZone:a}=le(e,n),u=W(i?.lunitidalIntervalMin)?i.lunitidalIntervalMin:W(e.config?.geo?.lunitidalIntervalMin)?(e.config?.geo).lunitidalIntervalMin:void 0,l=i?.regime??e.config?.geo?.regime,c=oo(t.epoch.ms,s?{latitude:o,longitude:r,...u!==void 0?{lunitidalIntervalMin:u}:{},...l?{regime:l}:{}}:0),m=c.nextHighTideMs?x(c.nextHighTideMs,a):null,f=c.nextLowTideMs?x(c.nextLowTideMs,a):null;return{key:c.state,state:c.state,group:"tide",alignmentDeg:c.alignmentDeg,isSpringTide:c.isSpringTide,isNeapTide:c.isNeapTide,isKingTide:s?c.isKingTide:null,perigeeFactor:c.perigeeFactor,lunarTideMinute:s?c.lunarTideMinute:null,nextHighTide:m,nextLowTide:f,lunitidalIntervalMin:c.lunitidalIntervalMin??null,regime:c.regime??null,states:B,phases:B,keys:B,geo:i,...he(t),start:t,end:t.add({minutes:745})}}var kt=te({key:"tide",aliases:["tides","tidal"],scope:"tides",description:"Astronomical tidal state, alignment, and perigee factor",phases:B,states:B,keys:B,...Re(Lt),[h.TermHook.step](e,n,t){return t.add({minutes:n*745})},[h.TermHook.bound](e,n,t){let o=Lt(t),r=o.nextHighTide??o.start,s=o.nextLowTide;if(s?s.epoch.ms<=r.epoch.ms&&(s=s.add({minutes:745})):s=r.add({minutes:372.5}),e==="start")return r;if(e==="end")return s;if(e==="mid"){let i=Math.round((r.epoch.ms+s.epoch.ms)/2);return new nn.Tempo(i,{timeZone:r.tz,timeStamp:"ms"})}},[h.TermHook.diff](e,n,t){return Math.round((e.epoch.ms-t.epoch.ms)/(745*60*1e3))},[h.TermHook.format](e,n){let t=e.toLowerCase();if(t==="#tide"||t==="#tides"||t.startsWith("#tide.")||t.startsWith("#tides.")){let o=Lt(n);if(t==="#tide.state"||t==="#tides.state"||t==="#tide"||t==="#tides")return o.state;if(t==="#tide.alignment"||t==="#tides.alignment")return`${o.alignmentDeg}\xB0`}}});var U=fe(Ae(),1);var z=h.Enum.from({Vernal:"vernal",Summer:"summer",Autumnal:"autumnal",Winter:"winter"}),Ne=Object.freeze(["Vernal","Summer","Autumnal","Winter"]),{COMPASS:on}=h.enums,ro="astro",so="astronomy",rn=new h.WeakCache;function sn(e){let n=rn.get(e);if(n)return n;let t=je(e);return rn.set(e,t),t}function an(e,n,t){let o=sn(e),r="Vernal";n===z.Summer?r="Summer":n===z.Autumnal?r="Autumnal":n===z.Winter&&(r="Winter");let s=o.find(a=>a.key===r),i=s?s.epochMs:Date.now();return new U.Tempo(i,{timeZone:t,timeStamp:"ms"})}function cn(e,n){if(e instanceof U.Tempo)return e.isValid?e:n instanceof U.Tempo?n:new U.Tempo(n);if(e!=null){if((0,h.isNumber)(e)){let t=new n.constructor(new Date(e),n.config);if(t.isValid)return t}try{let t=new n.constructor(e,n.config);if(t.isValid)return t}catch{}}return n instanceof U.Tempo?n:new U.Tempo(n)}function io(e,n){let t=cn(n,e),o=(0,h.resolveTermSphere)(t.sphere??e.sphere,"AstroTerm",e.config);if(!o||o==="equator")return o==="equator"&&(0,h.logWarn)(`[tempo] AstroTerm requires an explicit hemisphere of 'north' or 'south' (received: "equator").`,e.config),[];let r=o==="south",s=r?on.South:on.North,i=t.yy,a=t.tz??e.tz??"UTC",u=[],l=r?{vernal:"Autumnal",summer:"Winter",autumnal:"Vernal",winter:"Summer"}:{vernal:"Vernal",summer:"Summer",autumnal:"Autumnal",winter:"Winter"},c=r?{vernal:"Autumn",summer:"Winter",autumnal:"Spring",winter:"Summer"}:{vernal:"Spring",summer:"Summer",autumnal:"Autumn",winter:"Winter"};for(let m of[i-1,i,i+1]){let f=(d,p)=>{let y=an(d,p,a).toDateTime();return{year:y.year,month:y.month,day:y.day,hour:y.hour,minute:y.minute,second:y.second,millisecond:y.millisecond,microsecond:y.microsecond,nanosecond:y.nanosecond}};u.push({key:l.vernal,season:c.vernal,sphere:s,...f(m,z.Vernal),event:"Equinox",group:"astronomy"}),u.push({key:l.summer,season:c.summer,sphere:s,...f(m,z.Summer),event:"Solstice",group:"astronomy"}),u.push({key:l.autumnal,season:c.autumnal,sphere:s,...f(m,z.Autumnal),event:"Equinox",group:"astronomy"}),u.push({key:l.winter,season:c.winter,sphere:s,...f(m,z.Winter),event:"Solstice",group:"astronomy"})}return u}function vt(e,n,t){let o=io(e,n);return t?o.filter(r=>r.event===t):o}function ao(e,n,t){return vt(e,n,t).map(r=>({...r,hour:0,minute:0,second:0,millisecond:0,microsecond:0,nanosecond:0}))}var He=te({key:ro,aliases:["equinox","solstice"],scope:so,description:"Astronomical seasons and events",keys:Ne,resolve(e,n){return vt(this,e,n==="equinox"?"Equinox":n==="solstice"?"Solstice":void 0)},define(e,n,t){let o=t==="equinox"?"Equinox":t==="solstice"?"Solstice":void 0,r=cn(n,this),s=vt(this,r,o),i=ao(this,r,o),a=r.toDateTime();if(e===!0||e===void 0)return(0,h.getTermRange)(this,i,!0,r);let u=(0,h.getTermRange)(this,s,!1,r);if(!u)return u;let l=(0,h.getTermRange)(this,i,!1,r);if(!l)return u;let c=l.span?.start?.toDateTime?.().withCalendar("iso8601"),m=c?s.find(p=>p.key===l.key&&p.year===c.year&&p.month===c.month&&p.day===c.day):void 0;if(!m)return{...l,strict:u.key,keys:Ne};let f=a.with({year:m.year,month:m.month,day:m.day,hour:m.hour??0,minute:m.minute??0,second:m.second??0,millisecond:m.millisecond??0,microsecond:m.microsecond??0,nanosecond:m.nanosecond??0}).add({minutes:1}),d=(0,h.getTermRange)(this,s,!1,f);return d?{...d,span:(0,h.defineSpan)(this,d.span.start,d.span.end,a),strict:u.key,keys:Ne}:{...l,strict:u.key,keys:Ne}},[h.TermHook.ordinal](e,n){let t=e.ord?.toLowerCase(),o=(e.term||"").toLowerCase(),r=n?.yy??new U.Tempo().yy,s=sn(r),i=o.includes("equinox")?"Equinox":o.includes("solstice")?"Solstice":void 0,a=i?s.filter(d=>d.event===i):[...s];a.sort((d,p)=>d.epochMs-p.epochMs);let u=U.Tempo.enums.ORDINAL,l=e.value??u?.[t],c=(0,h.isNumber)(l)?l:t==="last"?-1:parseInt(l??t,10)||u?.[t];if(!c)return;let m=c<0?a.length+c+1:c;if(m<1||m>a.length)return;let f=a[m-1];return new U.Tempo(f.epochMs,{timeZone:n?.tz??"UTC",timeStamp:"ms",...n?.sphere?{sphere:n.sphere}:{}})},[h.TermHook.parse](e,n){let t=e.toLowerCase();if(t.startsWith("#astro.")||t.startsWith("#equinox.")||t.startsWith("#solstice.")){let o=t.slice(1).split(".");if(o.length!==2)return;let[r,s]=o,i=s==="vernal"||s==="spring"||s==="autumnal"||s==="autumn",a=s==="summer"||s==="winter";if(r==="equinox"&&!i||r==="solstice"&&!a)return;let u=n?.anchor?.yy??n?.anchor?.year??new U.Tempo().yy,l=n?.anchor?.tz??"UTC",c=(0,h.resolveTermSphere)(n?.anchor?.sphere??n?.config?.sphere,"AstroTerm",n?.config);if(!c||c==="equator")return;let m=c==="south",f;if(i?s==="vernal"||s==="spring"?f=m?z.Autumnal:z.Vernal:f=m?z.Vernal:z.Autumnal:a&&(s==="summer"?f=m?z.Winter:z.Summer:f=m?z.Summer:z.Winter),f){let d=an(u,f,l);return new U.Tempo(d.epoch.ms,{timeZone:l,timeStamp:"ms",sphere:c})}}},[h.TermHook.bound](e,n,t){let o=t instanceof U.Tempo?t:new U.Tempo(t),r=He.define.call(o,!1),s=r?.span?.start,i=r?.span?.end;if(s&&i){if(e==="start")return s;if(e==="end")return i.sub({nanoseconds:1});if(e==="mid"){let a=Math.round((s.epoch.ms+i.epoch.ms)/2);return new U.Tempo(a,{timeZone:s.tz,timeStamp:"ms",...o.sphere?{sphere:o.sphere}:{}})}}},[h.TermHook.format](e,n){let t=e.toLowerCase();if(t==="#astro"||t==="#astronomy"||t==="#equinox"||t==="#solstice"||t==="#astro.season"||t==="#astro.event"||t==="#astro.key"){let o=t==="#equinox"?"equinox":t==="#solstice"?"solstice":void 0,r=He.define.call(n,!1,void 0,o);if(r)return t==="#astro.season"?r.season:t==="#astro.event"?r.event:t==="#astro.key"?r.key:`${r.key} ${r.event}`}}});var We=[Ct,Nt,kt,He],ln=We;(0,h.autoInstall)(We);return Tn(co);})();