summaryrefslogtreecommitdiff
path: root/client/index.4a84583d.js
blob: f63cd2c6b7e42e8203e7a816ae51a9347d667fc0 (plain) (blame)
1
import{S as t,i as e,s as a,e as s,a as r,t as n,c,b as o,d as l,f as i,g as h,h as f,j as u,k as d,l as v,n as p,o as m,m as g,p as y,q as E,r as w,u as $,v as x,w as P,x as b,y as D,z as I,A as V}from"./client.7f720467.js";function z(t){let e,a,m,g,y,E,w,$,x,P,b,D,I,V,z,C,N,j,M,T,_,k,S,H,J,K,B,O,q,F,Z,G,L,Q,R,U,W,X,Y,tt,et,at,st,rt,nt,ct,ot,lt;return{c(){e=s("div"),a=s("div"),m=s("div"),g=s("i"),y=r(),E=s("h1"),w=n(A),$=r(),x=s("div"),P=s("p"),b=n(t[0]),D=r(),I=s("div"),V=s("h2"),z=n("KP "),C=n(t[1]),N=r(),j=s("p"),M=s("span"),T=n("↑ KP "),_=n(t[3]),k=r(),S=s("span"),H=n("↓ KP "),J=n(t[2]),K=r(),B=s("div"),O=s("div"),q=s("p"),F=n("BZ"),Z=r(),G=s("p"),L=n(t[4]),Q=r(),R=s("div"),U=s("p"),W=n("Probability"),X=r(),Y=s("p"),tt=n("10%"),et=r(),at=s("div"),st=s("p"),rt=n("Clouds"),nt=r(),ct=s("p"),ot=n(t[5]),lt=n("%"),this.h()},l(s){e=c(s,"DIV",{class:!0});var r=o(e);a=c(r,"DIV",{class:!0});var n=o(a);m=c(n,"DIV",{class:!0});var f=o(m);g=c(f,"I",{class:!0}),o(g).forEach(l),y=i(f),E=c(f,"H1",{class:!0});var u=o(E);w=h(u,A),u.forEach(l),f.forEach(l),$=i(n),x=c(n,"DIV",{class:!0});var d=o(x);P=c(d,"P",{});var v=o(P);b=h(v,t[0]),v.forEach(l),d.forEach(l),D=i(n),I=c(n,"DIV",{class:!0});var p=o(I);V=c(p,"H2",{class:!0});var it=o(V);z=h(it,"KP "),C=h(it,t[1]),it.forEach(l),N=i(p),j=c(p,"P",{});var ht=o(j);M=c(ht,"SPAN",{className:!0});var ft=o(M);T=h(ft,"↑ KP "),_=h(ft,t[3]),ft.forEach(l),k=i(ht),S=c(ht,"SPAN",{className:!0});var ut=o(S);H=h(ut,"↓ KP "),J=h(ut,t[2]),ut.forEach(l),ht.forEach(l),p.forEach(l),K=i(n),B=c(n,"DIV",{class:!0});var dt=o(B);O=c(dt,"DIV",{});var vt=o(O);q=c(vt,"P",{class:!0});var pt=o(q);F=h(pt,"BZ"),pt.forEach(l),Z=i(vt),G=c(vt,"P",{class:!0});var mt=o(G);L=h(mt,t[4]),mt.forEach(l),vt.forEach(l),Q=i(dt),R=c(dt,"DIV",{});var gt=o(R);U=c(gt,"P",{class:!0});var yt=o(U);W=h(yt,"Probability"),yt.forEach(l),X=i(gt),Y=c(gt,"P",{class:!0});var Et=o(Y);tt=h(Et,"10%"),Et.forEach(l),gt.forEach(l),et=i(dt),at=c(dt,"DIV",{});var wt=o(at);st=c(wt,"P",{class:!0});var $t=o(st);rt=h($t,"Clouds"),$t.forEach(l),nt=i(wt),ct=c(wt,"P",{class:!0});var xt=o(ct);ot=h(xt,t[5]),lt=h(xt,"%"),xt.forEach(l),wt.forEach(l),dt.forEach(l),n.forEach(l),r.forEach(l),this.h()},h(){f(g,"class","symbol fas fa-map-marker-alt svelte-1y77zx4"),f(E,"class","svelte-1y77zx4"),f(m,"class","weatherCurrent-data-location svelte-1y77zx4"),f(x,"class","weatherCurrent-data-date"),f(V,"class","svelte-1y77zx4"),f(M,"classname","pr-2"),f(S,"classname","pl-2"),f(I,"class","weatherCurrent-data-kp svelte-1y77zx4"),f(q,"class","svelte-1y77zx4"),f(G,"class","svelte-1y77zx4"),f(U,"class","svelte-1y77zx4"),f(Y,"class","svelte-1y77zx4"),f(st,"class","svelte-1y77zx4"),f(ct,"class","svelte-1y77zx4"),f(B,"class","current-details svelte-1y77zx4"),f(a,"class","weatherCurrent-data svelte-1y77zx4"),f(e,"class","weatherCurrent-wrapper svelte-1y77zx4")},m(t,s){u(t,e,s),d(e,a),d(a,m),d(m,g),d(m,y),d(m,E),d(E,w),d(a,$),d(a,x),d(x,P),d(P,b),d(a,D),d(a,I),d(I,V),d(V,z),d(V,C),d(I,N),d(I,j),d(j,M),d(M,T),d(M,_),d(j,k),d(j,S),d(S,H),d(S,J),d(a,K),d(a,B),d(B,O),d(O,q),d(q,F),d(O,Z),d(O,G),d(G,L),d(B,Q),d(B,R),d(R,U),d(U,W),d(R,X),d(R,Y),d(Y,tt),d(B,et),d(B,at),d(at,st),d(st,rt),d(at,nt),d(at,ct),d(ct,ot),d(ct,lt)},p(t,[e]){1&e&&v(b,t[0]),2&e&&v(C,t[1]),8&e&&v(_,t[3]),4&e&&v(J,t[2]),16&e&&v(L,t[4]),32&e&&v(ot,t[5])},i:p,o:p,d(t){t&&l(e)}}}let A="The earth";function C(t,e,a){var s=this&&this.__awaiter||function(t,e,a,s){return new(a||(a=Promise))((function(r,n){function c(t){try{l(s.next(t))}catch(t){n(t)}}function o(t){try{l(s.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof a?e:new a((function(t){t(e)}))).then(c,o)}l((s=s.apply(t,e||[])).next())}))};const r=["January","February","March","April","May","June","July","August","September","October","November","December"];Array();let n,c,o="-",l="-",i="-",h="-",f="-",u="-";function d(t){n=t.coords.longitude,c=t.coords.latitude,function(t,e){s(this,void 0,void 0,(function*(){let s=yield fetch(`https://api.met.no/weatherapi/locationforecast/2.0/compact?lat=${e}&lon=${t}`).then((t=>t.json()));a(5,u=s.properties.timeseries[0].data.instant.details.cloud_area_fraction),a(4,f=(yield fetch("https://services.swpc.noaa.gov/products/summary/solar-wind-mag-field.json").then((t=>t.json()))).Bz);let n=yield fetch("https://services.swpc.noaa.gov/products/noaa-planetary-k-index-forecast.json").then((t=>t.json()));n.shift();let c=new Date,d=new Date(0,0,0),v=1e3,p=0;n.forEach(((t,e)=>{t[1]>p&&(p=t[1]),t[1]<v&&(v=t[1]);let s=new Date(t[0]);Math.abs(s.getTime()-c.getTime())<Math.abs(d.getTime()-c.getTime())&&(d=s,a(1,l=t[1]))})),a(2,i=v.toString()),a(3,h=p.toString()),a(0,o=c.getDay()+". "+r[c.getMonth()]+" "+c.getHours()+":"+c.getMinutes())}))}(n,c)}function v(t){p()}function p(){n=28.283333,c=-15.416667}return m((function(){navigator.geolocation?navigator.geolocation.getCurrentPosition(d,v):p()})),[o,l,i,h,f,u]}class N extends t{constructor(t){super(),e(this,t,C,z,a,{})}}function j(t){let e,a,v,m,g,y,E,w,$,x,P,b,D,I,V,z,A,C,N,j,M,T,_,k;return{c(){e=s("div"),a=s("div"),v=s("h3"),m=n(t[2]),g=r(),y=s("p"),E=n(t[1]),w=r(),$=s("div"),x=s("h2"),P=n(t[0]),b=r(),D=s("div"),I=s("p"),V=s("i"),z=r(),A=n(t[3]),C=n("°C"),N=r(),j=s("p"),M=s("i"),T=r(),_=n(t[4]),k=n("%"),this.h()},l(s){e=c(s,"DIV",{class:!0});var r=o(e);a=c(r,"DIV",{});var n=o(a);v=c(n,"H3",{class:!0});var f=o(v);m=h(f,t[2]),f.forEach(l),g=i(n),y=c(n,"P",{});var u=o(y);E=h(u,t[1]),u.forEach(l),n.forEach(l),w=i(r),$=c(r,"DIV",{class:!0});var d=o($);x=c(d,"H2",{class:!0});var p=o(x);P=h(p,t[0]),p.forEach(l),b=i(d),D=c(d,"DIV",{});var S=o(D);I=c(S,"P",{});var H=o(I);V=c(H,"I",{class:!0}),o(V).forEach(l),z=i(H),A=h(H,t[3]),C=h(H,"°C"),H.forEach(l),N=i(S),j=c(S,"P",{});var J=o(j);M=c(J,"I",{class:!0}),o(M).forEach(l),T=i(J),_=h(J,t[4]),k=h(J,"%"),J.forEach(l),S.forEach(l),d.forEach(l),r.forEach(l),this.h()},h(){f(v,"class","svelte-u548p6"),f(x,"class","svelte-u548p6"),f(V,"class","fas fa-thermometer-half"),f(M,"class","fas fa-cloud"),f($,"class","data svelte-u548p6"),f(e,"class","prediction-details svelte-u548p6")},m(t,s){u(t,e,s),d(e,a),d(a,v),d(v,m),d(a,g),d(a,y),d(y,E),d(e,w),d(e,$),d($,x),d(x,P),d($,b),d($,D),d(D,I),d(I,V),d(I,z),d(I,A),d(I,C),d(D,N),d(D,j),d(j,M),d(j,T),d(j,_),d(j,k)},p:p,i:p,o:p,d(t){t&&l(e)}}}function M(t,e,a){let{prediction:s}=e;let r=s.kp,n=s.time.split(" "),c=Number(n[0].split("-")[2])+". "+["January","February","March","April","May","June","July","August","September","October","November","December"][Number(n[0].split("-")[1])],o=n[1].substring(0,5),l=s.temp,i=s.clouds;return t.$$set=t=>{"prediction"in t&&a(5,s=t.prediction)},[r,c,o,l,i,s]}class T extends t{constructor(t){super(),e(this,t,M,j,a,{prediction:5})}}function _(t,e,a){const s=t.slice();return s[18]=e[a],s[20]=a,s}function k(t){let e;return{c(){e=n("Cannot connect to NOAA")},l(t){e=h(t,"Cannot connect to NOAA")},m(t,a){u(t,e,a)},p:p,i:p,o:p,d(t){t&&l(e)}}}function S(t){let e,a,s=t[0],r=[];for(let e=0;e<s.length;e+=1)r[e]=H(_(t,s,e));const n=t=>y(r[t],1,1,(()=>{r[t]=null}));return{c(){for(let t=0;t<r.length;t+=1)r[t].c();e=D()},l(t){for(let e=0;e<r.length;e+=1)r[e].l(t);e=D()},m(t,s){for(let e=0;e<r.length;e+=1)r[e].m(t,s);u(t,e,s),a=!0},p(t,a){if(1&a){let c;for(s=t[0],c=0;c<s.length;c+=1){const n=_(t,s,c);r[c]?(r[c].p(n,a),w(r[c],1)):(r[c]=H(n),r[c].c(),w(r[c],1),r[c].m(e.parentNode,e))}for(g(),c=s.length;c<r.length;c+=1)n(c);E()}},i(t){if(!a){for(let t=0;t<s.length;t+=1)w(r[t]);a=!0}},o(t){r=r.filter(Boolean);for(let t=0;t<r.length;t+=1)y(r[t]);a=!1},d(t){I(r,t),t&&l(e)}}}function H(t){let e,a;return e=new T({props:{prediction:t[18]}}),{c(){$(e.$$.fragment)},l(t){x(e.$$.fragment,t)},m(t,s){P(e,t,s),a=!0},p(t,a){const s={};1&a&&(s.prediction=t[18]),e.$set(s)},i(t){a||(w(e.$$.fragment,t),a=!0)},o(t){y(e.$$.fragment,t),a=!1},d(t){b(e,t)}}}function J(t){let e,a,v,p,m,$,x,P,b;const D=[S,k],I=[];function V(t,e){return t[0]?0:1}return x=V(t),P=I[x]=D[x](t),{c(){e=s("div"),a=s("div"),v=s("h2"),p=n("Predicted"),m=r(),$=s("div"),P.c(),this.h()},l(t){e=c(t,"DIV",{class:!0});var s=o(e);a=c(s,"DIV",{className:!0});var r=o(a);v=c(r,"H2",{class:!0});var n=o(v);p=h(n,"Predicted"),n.forEach(l),r.forEach(l),m=i(s),$=c(s,"DIV",{class:!0});var f=o($);P.l(f),f.forEach(l),s.forEach(l),this.h()},h(){f(v,"class","svelte-mcdoaa"),f(a,"classname","flex flex-row justify-between items-top"),f($,"class","prediction-table svelte-mcdoaa"),f(e,"class","predicted-weather svelte-mcdoaa")},m(t,s){u(t,e,s),d(e,a),d(a,v),d(v,p),d(e,m),d(e,$),I[x].m($,null),b=!0},p(t,[e]){let a=x;x=V(t),x===a?I[x].p(t,e):(g(),y(I[a],1,1,(()=>{I[a]=null})),E(),P=I[x],P||(P=I[x]=D[x](t),P.c()),w(P,1),P.m($,null))},i(t){b||(w(P),b=!0)},o(t){y(P),b=!1},d(t){t&&l(e),I[x].d()}}}function K(t,e,a){var s=this&&this.__awaiter||function(t,e,a,s){return new(a||(a=Promise))((function(r,n){function c(t){try{l(s.next(t))}catch(t){n(t)}}function o(t){try{l(s.throw(t))}catch(t){n(t)}}function l(t){var e;t.done?r(t.value):(e=t.value,e instanceof a?e:new a((function(t){t(e)}))).then(c,o)}l((s=s.apply(t,e||[])).next())}))};let r,n,c;Array();function o(t){n=t.coords.longitude,c=t.coords.latitude,function(t,e){s(this,void 0,void 0,(function*(){let s=yield fetch(`https://api.met.no/weatherapi/locationforecast/2.0/compact?lat=${e}&lon=${t}`).then((t=>t.json())),n=yield fetch("https://services.swpc.noaa.gov/products/noaa-planetary-k-index-forecast.json").then((t=>t.json()));n.shift();let c=[];n.forEach(((t,e)=>{if("observed"!=t[2]){let e,a,r=new Date(t[0]),n=new Date(0,0,0);s.properties.timeseries.forEach(((t,s)=>{let c=new Date(t.time);Math.abs(c.getTime()-r.getTime())<Math.abs(n.getTime()-r.getTime())&&(n=c,e=t.data.instant.details.air_temperature,a=t.data.instant.details.cloud_area_fraction)})),c.push({time:t[0],kp:t[1],temp:e,clouds:a})}})),a(0,r=c)}))}(n,c)}function l(t){i()}function i(){n=28.283333,c=-15.416667}return m((function(){navigator.geolocation?navigator.geolocation.getCurrentPosition(o,l):i()})),[r]}class B extends t{constructor(t){super(),e(this,t,K,J,a,{})}}function O(t){let e,a,n,h,v,m;return n=new N({}),v=new B({}),{c(){e=r(),a=s("div"),$(n.$$.fragment),h=r(),$(v.$$.fragment),this.h()},l(t){V('[data-svelte="svelte-1q3846k"]',document.head).forEach(l),e=i(t),a=c(t,"DIV",{class:!0});var s=o(a);x(n.$$.fragment,s),h=i(s),x(v.$$.fragment,s),s.forEach(l),this.h()},h(){document.title="Aurora data",f(a,"class","homescreen svelte-yqnwm7")},m(t,s){u(t,e,s),u(t,a,s),P(n,a,null),d(a,h),P(v,a,null),m=!0},p:p,i(t){m||(w(n.$$.fragment,t),w(v.$$.fragment,t),m=!0)},o(t){y(n.$$.fragment,t),y(v.$$.fragment,t),m=!1},d(t){t&&l(e),t&&l(a),b(n),b(v)}}}export default class extends t{constructor(t){super(),e(this,t,null,O,a,{})}}