UNPKG

@watergis/maplibre-gl-sky

Version:
3 lines (2 loc) 17.5 kB
(function(j,L){typeof exports=="object"&&typeof module<"u"?L(exports,require("maplibre-gl")):typeof define=="function"&&define.amd?define(["exports","maplibre-gl"],L):(j=typeof globalThis<"u"?globalThis:j||self,L(j.MaplibreSkyControl={}))})(this,function(j){"use strict";var wt=Object.defineProperty;var xt=(j,L,et)=>L in j?wt(j,L,{enumerable:!0,configurable:!0,writable:!0,value:et}):j[L]=et;var lt=(j,L,et)=>xt(j,typeof L!="symbol"?L+"":L,et);function L(I){return I&&I.__esModule&&Object.prototype.hasOwnProperty.call(I,"default")?I.default:I}var et={exports:{}},dt;function $t(){return dt||(dt=1,function(I,D){(function(){var M=Math.PI,a=Math.sin,m=Math.cos,z=Math.tan,S=Math.asin,O=Math.atan2,d=Math.acos,h=M/180,C=1e3*60*60*24,p=2440588,A=2451545;function E(t){return t.valueOf()/C-.5+p}function P(t){return new Date((t+.5-p)*C)}function u(t){return E(t)-A}var _=h*23.4397;function R(t,r){return O(a(t)*m(_)-z(r)*a(_),m(t))}function F(t,r){return S(a(r)*m(_)+m(r)*a(_)*a(t))}function Y(t,r,i){return O(a(t),m(t)*a(r)-z(i)*m(r))}function rt(t,r,i){return S(a(r)*a(i)+m(r)*m(i)*m(t))}function J(t,r){return h*(280.16+360.9856235*t)-r}function N(t){return t<0&&(t=0),2967e-7/Math.tan(t+.00312536/(t+.08901179))}function K(t){return h*(357.5291+.98560028*t)}function nt(t){var r=h*(1.9148*a(t)+.02*a(2*t)+3e-4*a(3*t)),i=h*102.9372;return t+r+i+M}function W(t){var r=K(t),i=nt(r);return{dec:F(i,0),ra:R(i,0)}}var b={};b.getPosition=function(t,r,i){var g=h*-i,y=h*r,k=u(t),v=W(k),w=J(k,g)-v.ra;return{azimuth:Y(w,y,v.dec),altitude:rt(w,y,v.dec)}};var $=b.times=[[-.833,"sunrise","sunset"],[-.3,"sunriseEnd","sunsetStart"],[-6,"dawn","dusk"],[-12,"nauticalDawn","nauticalDusk"],[-18,"nightEnd","night"],[6,"goldenHourEnd","goldenHour"]];b.addTime=function(t,r,i){$.push([t,r,i])};var ot=9e-4;function ct(t,r){return Math.round(t-ot-r/(2*M))}function c(t,r,i){return ot+(t+r)/(2*M)+i}function o(t,r,i){return A+t+.0053*a(r)-.0069*a(2*i)}function e(t,r,i){return d((a(t)-a(r)*a(i))/(m(r)*m(i)))}function s(t){return-2.076*Math.sqrt(t)/60}function n(t,r,i,g,y,k,v){var w=e(t,i,g),x=c(w,r,y);return o(x,k,v)}b.getTimes=function(t,r,i,g){g=g||0;var y=h*-i,k=h*r,v=s(g),w=u(t),x=ct(w,y),T=c(0,y,x),H=K(T),U=nt(H),q=F(U,0),V=o(T,H,U),X,it,Q,Z,tt,st,B={solarNoon:P(V),nadir:P(V-.5)};for(X=0,it=$.length;X<it;X+=1)Q=$[X],Z=(Q[0]+v)*h,tt=n(Z,y,k,q,x,H,U),st=V-(tt-V),B[Q[1]]=P(st),B[Q[2]]=P(tt);return B};function l(t){var r=h*(218.316+13.176396*t),i=h*(134.963+13.064993*t),g=h*(93.272+13.22935*t),y=r+h*6.289*a(i),k=h*5.128*a(g),v=385001-20905*m(i);return{ra:R(y,k),dec:F(y,k),dist:v}}b.getMoonPosition=function(t,r,i){var g=h*-i,y=h*r,k=u(t),v=l(k),w=J(k,g)-v.ra,x=rt(w,y,v.dec),T=O(a(w),z(y)*m(v.dec)-a(v.dec)*m(w));return x=x+N(x),{azimuth:Y(w,y,v.dec),altitude:x,distance:v.dist,parallacticAngle:T}},b.getMoonIllumination=function(t){var r=u(t||new Date),i=W(r),g=l(r),y=149598e3,k=d(a(i.dec)*a(g.dec)+m(i.dec)*m(g.dec)*m(i.ra-g.ra)),v=O(y*a(k),g.dist-y*m(k)),w=O(m(i.dec)*a(i.ra-g.ra),a(i.dec)*m(g.dec)-m(i.dec)*a(g.dec)*m(i.ra-g.ra));return{fraction:(1+m(v))/2,phase:.5+.5*v*(w<0?-1:1)/Math.PI,angle:w}};function f(t,r){return new Date(t.valueOf()+r*C/24)}b.getMoonTimes=function(t,r,i,g){var y=new Date(t);g?y.setUTCHours(0,0,0,0):y.setHours(0,0,0,0);for(var k=.133*h,v=b.getMoonPosition(y,r,i).altitude-k,w,x,T,H,U,q,V,X,it,Q,Z,tt,st,B=1;B<=24&&(w=b.getMoonPosition(f(y,B),r,i).altitude-k,x=b.getMoonPosition(f(y,B+1),r,i).altitude-k,U=(v+x)/2-w,q=(x-v)/2,V=-q/(2*U),X=(U*V+q)*V+w,it=q*q-4*U*w,Q=0,it>=0&&(st=Math.sqrt(it)/(Math.abs(U)*2),Z=V-st,tt=V+st,Math.abs(Z)<=1&&Q++,Math.abs(tt)<=1&&Q++,Z<-1&&(Z=tt)),Q===1?v<0?T=B+Z:H=B+Z:Q===2&&(T=B+(X<0?tt:Z),H=B+(X<0?Z:tt)),!(T&&H));B+=2)v=x;var ft={};return T&&(ft.rise=f(y,T)),H&&(ft.set=f(y,H)),!T&&!H&&(ft[X>0?"alwaysUp":"alwaysDown"]=!0),ft},I.exports=b})()}(et)),et.exports}var vt=$t();const pt=L(vt),ht=["sunrise","sunriseEnd","goldenHourEnd","solarNoon","goldenHour","sunsetStart","sunset","dusk","nauticalDusk","night","nadir","nightEnd","nauticalDawn","dawn"],gt={skyOptions:{sunrise:{"sky-color":"#f7dc6f","sky-horizon-blend":.8,"horizon-color":"#f5b041","horizon-fog-blend":.8,"fog-color":"#f7dc6f","fog-ground-blend":.5},sunriseEnd:{"sky-color":"#88C6FC","sky-horizon-blend":.8,"horizon-color":"#ffa700","horizon-fog-blend":.8,"fog-color":"#ffffff","fog-ground-blend":.5},goldenHourEnd:{"sky-color":"#5b2c6f","sky-horizon-blend":.8,"horizon-color":"#e74c3c","horizon-fog-blend":.8,"fog-color":"#f7dc6f","fog-ground-blend":.5},solarNoon:{"sky-color":"#199EF3","sky-horizon-blend":.7,"horizon-color":"#f0f8ff","horizon-fog-blend":.8,"fog-color":"#2c7fb8","fog-ground-blend":.9,"atmosphere-blend":["interpolate",["linear"],["zoom"],0,1,12,0]},goldenHour:{"sky-color":"#ffe90e","sky-horizon-blend":.8,"horizon-color":"#ff6700","horizon-fog-blend":.8,"fog-color":"#ffb400","fog-ground-blend":.5},sunsetStart:{"sky-color":"#88C6FC","sky-horizon-blend":.8,"horizon-color":"#ffe90e","horizon-fog-blend":.8,"fog-color":"#ffb400","fog-ground-blend":.5},sunset:{"sky-color":"#ffe90e","sky-horizon-blend":.8,"horizon-color":"#ff6700","horizon-fog-blend":.8,"fog-color":"#ffb400","fog-ground-blend":.5},dusk:{"sky-color":"#0d0d3e","sky-horizon-blend":.8,"horizon-color":"#4d2149","horizon-fog-blend":.8,"fog-color":"#30016d","fog-ground-blend":.5},nauticalDusk:{"sky-color":"#000000","sky-horizon-blend":.8,"horizon-color":"#0426d0","horizon-fog-blend":.8,"fog-color":"#202b7a","fog-ground-blend":.5},night:{"sky-color":"#1e2b58","sky-horizon-blend":.8,"horizon-color":"#614cbf","horizon-fog-blend":.8,"fog-color":"#D4D6D8","fog-ground-blend":.5},nadir:{"sky-color":"#3b3768","sky-horizon-blend":.8,"horizon-color":"#100d36","horizon-fog-blend":.8,"fog-color":"#282454","fog-ground-blend":.5},nightEnd:{"sky-color":"#1e2b58","sky-horizon-blend":.8,"horizon-color":"#614cbf","horizon-fog-blend":.8,"fog-color":"#D4D6D8","fog-ground-blend":.5},nauticalDawn:{"sky-color":"#2c2b48","sky-horizon-blend":.8,"horizon-color":"#0426d0","horizon-fog-blend":.8,"fog-color":"#202b7a","fog-ground-blend":.5},dawn:{"sky-color":"#311f62","sky-horizon-blend":.8,"horizon-color":"#e8817f","horizon-fog-blend":.8,"fog-color":"#8d5273","fog-ground-blend":.5}},maxPitch:85};var at={exports:{}},bt=at.exports,yt;function Dt(){return yt||(yt=1,function(I,D){(function(M,a){I.exports=a()})(bt,function(){var M=1e3,a=6e4,m=36e5,z="millisecond",S="second",O="minute",d="hour",h="day",C="week",p="month",A="quarter",E="year",P="date",u="Invalid Date",_=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,R=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,F={name:"en",weekdays:"Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"),months:"January_February_March_April_May_June_July_August_September_October_November_December".split("_"),ordinal:function(c){var o=["th","st","nd","rd"],e=c%100;return"["+c+(o[(e-20)%10]||o[e]||o[0])+"]"}},Y=function(c,o,e){var s=String(c);return!s||s.length>=o?c:""+Array(o+1-s.length).join(e)+c},rt={s:Y,z:function(c){var o=-c.utcOffset(),e=Math.abs(o),s=Math.floor(e/60),n=e%60;return(o<=0?"+":"-")+Y(s,2,"0")+":"+Y(n,2,"0")},m:function c(o,e){if(o.date()<e.date())return-c(e,o);var s=12*(e.year()-o.year())+(e.month()-o.month()),n=o.clone().add(s,p),l=e-n<0,f=o.clone().add(s+(l?-1:1),p);return+(-(s+(e-n)/(l?n-f:f-n))||0)},a:function(c){return c<0?Math.ceil(c)||0:Math.floor(c)},p:function(c){return{M:p,y:E,w:C,d:h,D:P,h:d,m:O,s:S,ms:z,Q:A}[c]||String(c||"").toLowerCase().replace(/s$/,"")},u:function(c){return c===void 0}},J="en",N={};N[J]=F;var K="$isDayjsObject",nt=function(c){return c instanceof ot||!(!c||!c[K])},W=function c(o,e,s){var n;if(!o)return J;if(typeof o=="string"){var l=o.toLowerCase();N[l]&&(n=l),e&&(N[l]=e,n=l);var f=o.split("-");if(!n&&f.length>1)return c(f[0])}else{var t=o.name;N[t]=o,n=t}return!s&&n&&(J=n),n||!s&&J},b=function(c,o){if(nt(c))return c.clone();var e=typeof o=="object"?o:{};return e.date=c,e.args=arguments,new ot(e)},$=rt;$.l=W,$.i=nt,$.w=function(c,o){return b(c,{locale:o.$L,utc:o.$u,x:o.$x,$offset:o.$offset})};var ot=function(){function c(e){this.$L=W(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[K]=!0}var o=c.prototype;return o.parse=function(e){this.$d=function(s){var n=s.date,l=s.utc;if(n===null)return new Date(NaN);if($.u(n))return new Date;if(n instanceof Date)return new Date(n);if(typeof n=="string"&&!/Z$/i.test(n)){var f=n.match(_);if(f){var t=f[2]-1||0,r=(f[7]||"0").substring(0,3);return l?new Date(Date.UTC(f[1],t,f[3]||1,f[4]||0,f[5]||0,f[6]||0,r)):new Date(f[1],t,f[3]||1,f[4]||0,f[5]||0,f[6]||0,r)}}return new Date(n)}(e),this.init()},o.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},o.$utils=function(){return $},o.isValid=function(){return this.$d.toString()!==u},o.isSame=function(e,s){var n=b(e);return this.startOf(s)<=n&&n<=this.endOf(s)},o.isAfter=function(e,s){return b(e)<this.startOf(s)},o.isBefore=function(e,s){return this.endOf(s)<b(e)},o.$g=function(e,s,n){return $.u(e)?this[s]:this.set(n,e)},o.unix=function(){return Math.floor(this.valueOf()/1e3)},o.valueOf=function(){return this.$d.getTime()},o.startOf=function(e,s){var n=this,l=!!$.u(s)||s,f=$.p(e),t=function(x,T){var H=$.w(n.$u?Date.UTC(n.$y,T,x):new Date(n.$y,T,x),n);return l?H:H.endOf(h)},r=function(x,T){return $.w(n.toDate()[x].apply(n.toDate("s"),(l?[0,0,0,0]:[23,59,59,999]).slice(T)),n)},i=this.$W,g=this.$M,y=this.$D,k="set"+(this.$u?"UTC":"");switch(f){case E:return l?t(1,0):t(31,11);case p:return l?t(1,g):t(0,g+1);case C:var v=this.$locale().weekStart||0,w=(i<v?i+7:i)-v;return t(l?y-w:y+(6-w),g);case h:case P:return r(k+"Hours",0);case d:return r(k+"Minutes",1);case O:return r(k+"Seconds",2);case S:return r(k+"Milliseconds",3);default:return this.clone()}},o.endOf=function(e){return this.startOf(e,!1)},o.$set=function(e,s){var n,l=$.p(e),f="set"+(this.$u?"UTC":""),t=(n={},n[h]=f+"Date",n[P]=f+"Date",n[p]=f+"Month",n[E]=f+"FullYear",n[d]=f+"Hours",n[O]=f+"Minutes",n[S]=f+"Seconds",n[z]=f+"Milliseconds",n)[l],r=l===h?this.$D+(s-this.$W):s;if(l===p||l===E){var i=this.clone().set(P,1);i.$d[t](r),i.init(),this.$d=i.set(P,Math.min(this.$D,i.daysInMonth())).$d}else t&&this.$d[t](r);return this.init(),this},o.set=function(e,s){return this.clone().$set(e,s)},o.get=function(e){return this[$.p(e)]()},o.add=function(e,s){var n,l=this;e=Number(e);var f=$.p(s),t=function(g){var y=b(l);return $.w(y.date(y.date()+Math.round(g*e)),l)};if(f===p)return this.set(p,this.$M+e);if(f===E)return this.set(E,this.$y+e);if(f===h)return t(1);if(f===C)return t(7);var r=(n={},n[O]=a,n[d]=m,n[S]=M,n)[f]||1,i=this.$d.getTime()+e*r;return $.w(i,this)},o.subtract=function(e,s){return this.add(-1*e,s)},o.format=function(e){var s=this,n=this.$locale();if(!this.isValid())return n.invalidDate||u;var l=e||"YYYY-MM-DDTHH:mm:ssZ",f=$.z(this),t=this.$H,r=this.$m,i=this.$M,g=n.weekdays,y=n.months,k=n.meridiem,v=function(T,H,U,q){return T&&(T[H]||T(s,l))||U[H].slice(0,q)},w=function(T){return $.s(t%12||12,T,"0")},x=k||function(T,H,U){var q=T<12?"AM":"PM";return U?q.toLowerCase():q};return l.replace(R,function(T,H){return H||function(U){switch(U){case"YY":return String(s.$y).slice(-2);case"YYYY":return $.s(s.$y,4,"0");case"M":return i+1;case"MM":return $.s(i+1,2,"0");case"MMM":return v(n.monthsShort,i,y,3);case"MMMM":return v(y,i);case"D":return s.$D;case"DD":return $.s(s.$D,2,"0");case"d":return String(s.$W);case"dd":return v(n.weekdaysMin,s.$W,g,2);case"ddd":return v(n.weekdaysShort,s.$W,g,3);case"dddd":return g[s.$W];case"H":return String(t);case"HH":return $.s(t,2,"0");case"h":return w(1);case"hh":return w(2);case"a":return x(t,r,!0);case"A":return x(t,r,!1);case"m":return String(r);case"mm":return $.s(r,2,"0");case"s":return String(s.$s);case"ss":return $.s(s.$s,2,"0");case"SSS":return $.s(s.$ms,3,"0");case"Z":return f}return null}(T)||f.replace(":","")})},o.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},o.diff=function(e,s,n){var l,f=this,t=$.p(s),r=b(e),i=(r.utcOffset()-this.utcOffset())*a,g=this-r,y=function(){return $.m(f,r)};switch(t){case E:l=y()/12;break;case p:l=y();break;case A:l=y()/3;break;case C:l=(g-i)/6048e5;break;case h:l=(g-i)/864e5;break;case d:l=g/m;break;case O:l=g/a;break;case S:l=g/M;break;default:l=g}return n?l:$.a(l)},o.daysInMonth=function(){return this.endOf(p).$D},o.$locale=function(){return N[this.$L]},o.locale=function(e,s){if(!e)return this.$L;var n=this.clone(),l=W(e,s,!0);return l&&(n.$L=l),n},o.clone=function(){return $.w(this.$d,this)},o.toDate=function(){return new Date(this.valueOf())},o.toJSON=function(){return this.isValid()?this.toISOString():null},o.toISOString=function(){return this.$d.toISOString()},o.toString=function(){return this.$d.toUTCString()},c}(),ct=ot.prototype;return b.prototype=ct,[["$ms",z],["$s",S],["$m",O],["$H",d],["$W",h],["$M",p],["$y",E],["$D",P]].forEach(function(c){ct[c[1]]=function(o){return this.$g(o,c[0],c[1])}}),b.extend=function(c,o){return c.$i||(c(o,ot,b),c.$i=!0),b},b.locale=W,b.isDayjs=nt,b.unix=function(c){return b(1e3*c)},b.en=N[J],b.Ls=N,b.p={},b})}(at)),at.exports}var Mt=Dt();const G=L(Mt);var ut={exports:{}},St=ut.exports,mt;function kt(){return mt||(mt=1,function(I,D){(function(M,a){I.exports=a()})(St,function(){var M="minute",a=/[+-]\d\d(?::?\d\d)?/g,m=/([+-]|\d\d)/g;return function(z,S,O){var d=S.prototype;O.utc=function(u){var _={date:u,utc:!0,args:arguments};return new S(_)},d.utc=function(u){var _=O(this.toDate(),{locale:this.$L,utc:!0});return u?_.add(this.utcOffset(),M):_},d.local=function(){return O(this.toDate(),{locale:this.$L,utc:!1})};var h=d.parse;d.parse=function(u){u.utc&&(this.$u=!0),this.$utils().u(u.$offset)||(this.$offset=u.$offset),h.call(this,u)};var C=d.init;d.init=function(){if(this.$u){var u=this.$d;this.$y=u.getUTCFullYear(),this.$M=u.getUTCMonth(),this.$D=u.getUTCDate(),this.$W=u.getUTCDay(),this.$H=u.getUTCHours(),this.$m=u.getUTCMinutes(),this.$s=u.getUTCSeconds(),this.$ms=u.getUTCMilliseconds()}else C.call(this)};var p=d.utcOffset;d.utcOffset=function(u,_){var R=this.$utils().u;if(R(u))return this.$u?0:R(this.$offset)?p.call(this):this.$offset;if(typeof u=="string"&&(u=function(J){J===void 0&&(J="");var N=J.match(a);if(!N)return null;var K=(""+N[0]).match(m)||["-",0,0],nt=K[0],W=60*+K[1]+ +K[2];return W===0?0:nt==="+"?W:-W}(u),u===null))return this;var F=Math.abs(u)<=16?60*u:u,Y=this;if(_)return Y.$offset=F,Y.$u=u===0,Y;if(u!==0){var rt=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();(Y=this.local().add(F+rt,M)).$offset=F,Y.$x.$localOffset=rt}else Y=this.utc();return Y};var A=d.format;d.format=function(u){var _=u||(this.$u?"YYYY-MM-DDTHH:mm:ss[Z]":"");return A.call(this,_)},d.valueOf=function(){var u=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*u},d.isUTC=function(){return!!this.$u},d.toISOString=function(){return this.toDate().toISOString()},d.toString=function(){return this.toDate().toUTCString()};var E=d.toDate;d.toDate=function(u){return u==="s"&&this.$offset?O(this.format("YYYY-MM-DD HH:mm:ss:SSS")).toDate():E.call(this)};var P=d.diff;d.diff=function(u,_,R){if(u&&this.$u===u.$u)return P.call(this,u,_,R);var F=this.local(),Y=O(u).local();return P.call(F,Y,_,R)}}})}(ut)),ut.exports}var Tt=kt();const zt=L(Tt);G.extend(zt);class Ot{constructor(D){lt(this,"map");lt(this,"options",gt);lt(this,"addToOptions");D&&(this.options=Object.assign(this.options,D))}setOptions(D){this.options=D}addTo(D,M){this.map=D,this.addToOptions=M,this.map.setMaxPitch(this.options.maxPitch),this.map.isStyleLoaded()?this.updateSky():this.map.once("load",()=>{this.updateSky()}),M!=null&&M.location||this.map.on("moveend",()=>{this.updateSky()}),this.map.off("styledata",this.updateSky.bind(this)),this.map.on("styledata",this.updateSky.bind(this))}updateSky(){var M;if(!this.map)return;const D=this.getSky(this.addToOptions);D&&((M=this.map)==null||M.setSky(D))}getSky(D){if(!this.map)return;const M=this.options.skyOptions;if(!M)return;const a=D==null?void 0:D.timeType;if(a){const d=M[a];return d||M.solarNoon}let m=D==null?void 0:D.location;if(!m){const d=this.map.getCenter();m=[d.lng,d.lat]}let z;D!=null&&D.date?z=G(D==null?void 0:D.date).utc():z=G.utc();const S=this.getBestTimeNameByLocation(m[0],m[1],z.toDate());return M[S]}getTimesByLocation(D,M,a,m=!1){const z=pt.getTimes(a,M,D),S=[],O=[],d=[];ht.forEach(C=>{const p=G(z[C]).utc();if(O.push({type:C,date:p.toDate()}),m){const A=p.add(-1,"day");S.push({type:C,date:A.toDate()});const E=p.add(1,"day");d.push({type:C,date:E.toDate()})}});let h=[...S,...O,...d];return h=h.sort((C,p)=>C.date.getTime()-p.date.getTime()),h}getBestTimeNameByLocation(D,M,a){const m=this.getTimesByLocation(D,M,a,!0);let z={},S={};m.forEach(C=>{const p=G(C.date),A=C.type;G(p).isBefore(a)&&(z.type?G(p).isAfter(z.date)&&(z={type:A,date:p}):z={type:A,date:p}),G(p).isAfter(a)&&(S.type?G(p).isBefore(S.date)&&(S={type:A,date:p}):S={type:A,date:p})});const O=z.date?a.getTime()-z.date.toDate().getTime():-1,d=S.date?S.date.toDate().getTime()-a.getTime():-1;let h;return O>-1&&d>-1?d>O?h=S.type:h=z.type:z&&!S?h=z.type:S&&!z?h=S.type:h="solarNoon",h}}j.AvailableTimeTypes=ht,j.SkyControl=Ot,j.defaultSkyOptions=gt,Object.defineProperty(j,Symbol.toStringTag,{value:"Module"})}); //# sourceMappingURL=maplibre-gl-sky.umd.js.map