From 74e78f01293e3f0836de38502d4c84aff961f396 Mon Sep 17 00:00:00 2001 From: jakobst1n Date: Sat, 21 May 2022 13:37:59 +0200 Subject: Updates --- client/index.bde7dba7.js | 1 + 1 file changed, 1 insertion(+) create mode 100644 client/index.bde7dba7.js (limited to 'client/index.bde7dba7.js') diff --git a/client/index.bde7dba7.js b/client/index.bde7dba7.js new file mode 100644 index 0000000..320a981 --- /dev/null +++ b/client/index.bde7dba7.js @@ -0,0 +1 @@ +import{S as e,i as t,s as a,e as s,c as r,a as n,d as l,b as o,f as i,g as c,n as d,w as u,h,j as p,k as f,l as m,t as v,m as g,o as _,p as w,q as $,r as k,u as b,v as E,x as y,y as D,z as I,A as V,B as x,C as T,D as q,E as S,F as P,G as M,H as N,I as j,J as A,K as C}from"./client.4b77ae53.js";function O(e){let t,a,u,h,p,f,m,v,g;return{c(){t=s("div"),a=s("div"),u=s("div"),h=s("div"),p=s("div"),f=s("div"),m=s("div"),v=s("div"),g=s("div"),this.h()},l(e){t=r(e,"DIV",{class:!0});var s=n(t);a=r(s,"DIV",{class:!0}),n(a).forEach(l),u=r(s,"DIV",{class:!0}),n(u).forEach(l),h=r(s,"DIV",{class:!0}),n(h).forEach(l),p=r(s,"DIV",{class:!0}),n(p).forEach(l),f=r(s,"DIV",{class:!0}),n(f).forEach(l),m=r(s,"DIV",{class:!0}),n(m).forEach(l),v=r(s,"DIV",{class:!0}),n(v).forEach(l),g=r(s,"DIV",{class:!0}),n(g).forEach(l),s.forEach(l),this.h()},h(){o(a,"class","svelte-7k6qu0"),o(u,"class","svelte-7k6qu0"),o(h,"class","svelte-7k6qu0"),o(p,"class","svelte-7k6qu0"),o(f,"class","svelte-7k6qu0"),o(m,"class","svelte-7k6qu0"),o(v,"class","svelte-7k6qu0"),o(g,"class","svelte-7k6qu0"),o(t,"class","lds-roller svelte-7k6qu0")},m(e,s){i(e,t,s),c(t,a),c(t,u),c(t,h),c(t,p),c(t,f),c(t,m),c(t,v),c(t,g)},p:d,i:d,o:d,d(e){e&&l(t)}}}class F extends e{constructor(e){super(),t(this,e,null,O,a,{})}}const J=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"];function B(e){if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(e))return e;if(/^\d{4}\s[a-z,A-Z]+\s\d{2}$/.test(e)){let t=e.split(" ");return e=`${t[0]}-${function(e,t=2){let a=e.toString();for(;t-a.length>0;)a="0"+a;return a}(function(e){if("string"!=typeof e)throw new Error(`Cannot get month number of ${typeof e}...`);if(e.length<3)throw new Error(`Cannot get month number string "${e}" of length ${e.length}...`);e=e.substring(0,3).toLowerCase();let t=J.indexOf(e)+1;if(-1===t)throw new Error(`Could not find the month ${e}.`);return t}(t[1]))}-${t[2]}T00:00:00Z`}return/^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}/.test(e)?e.replace(" ","T")+"Z":/^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}.\d{4}/.test(e)?e.replace(" ","T").split(".")[0]+"Z":(console.warn(e),e)}function H(e){return e=B(e),new Date(e)}const K={updated:new Date(0,0,0),updating:!0};let z=U("navigator_location"),Z=U("earth_weather"),L=U("space_weather");const W=u(X("navigator_location")?function(e){return e.updated=new Date(e.updated),e}(z):{...K,available:!1,longitude:null,latitude:null,city:null}),G=u(X("earth_weather")?function(e){let t=e;return t.updated=new Date(t.updated),t.yr_data_raw.properties.meta.updated_at=new Date(t.yr_data_raw.properties.meta.updated_at),t.yr_data_raw.properties.timeseries=t.yr_data_raw.properties.timeseries.map((e=>({...e,time:new Date(e.time)}))),t}(Z):{...K,available:!1}),R=u(X("space_weather")?function(e){let t=e;return t.updated=new Date(t.updated),t.usnoaa_data_raw.geospace_pred_est_kp_1_hour=t.usnoaa_data_raw.geospace_pred_est_kp_1_hour.map((e=>({...e,model_prediction_time:new Date(e.model_prediction_time)}))),t.usnoaa_data_raw.noaa_planetary_k_index_forecast=t.usnoaa_data_raw.noaa_planetary_k_index_forecast.map((e=>({...e,time:new Date(e.time)}))),t.usnoaa_data_raw.outlook_27_day=t.usnoaa_data_raw.outlook_27_day.map((e=>({...e,time:new Date(e.time)}))),t.usnoaa_data_raw.solar_wind_mag_field.TimeStamp=new Date(t.usnoaa_data_raw.solar_wind_mag_field.TimeStamp),t}(L):{...K});function Q(e,t){"undefined"!=typeof window&&localStorage.setItem(e,JSON.stringify(t))}function U(e){if("undefined"!=typeof window)return JSON.parse(localStorage.getItem(e))}function X(e){return"undefined"!=typeof window&&localStorage.hasOwnProperty(e)}async function Y(){if("undefined"==typeof window)return;let e;te(W,!0),console.debug("Attempting to get browser geolocation.");try{e=await async function(){return new Promise(((e,t)=>{"undefined"!=typeof navigator?navigator.geolocation.getCurrentPosition((t=>{e({longitude:t.coords.longitude,latitude:t.coords.latitude})}),(e=>{t(e)})):t(Error())}))}()}catch(e){if(0==h(W).available)return;return console.warn(`Could not get browser geolocation (${e}).`),W.update((e=>({...e,available:!1,city:null,longitude:null,latitude:null}))),void te(W,!1)}if(console.debug("Got geolocation from browser."),h(W).available&&Date.now()-h(W).updated<3e5)return console.debug("Not fetching city name, as the location a short time ago."),void te(W,!1,!1);console.debug("Attempting to get city name from geolocation.");let t={city:void 0};try{let a=await fetch(`https://geocode.xyz/${e.latitude},${e.longitude}?geoit=json`);t=await a.json()}catch(e){console.error(`Could not get city name (${e})`)}console.debug("Got city name from browser."),W.update((a=>({...a,available:!0,city:t.city,...e}))),te(W,!1)}async function ee(){if("undefined"==typeof window)return;if(Date.now()-h(R).updated<3e5)return void console.debug("Skipping fetch of space weather as the data was fetched very recently.");let e;te(R,!0),console.debug("Attempting to fetch space weather data.");try{e=await async function(){let e,t={now:{bz:"-",bt:"-",kp:"-",kp_min:"-",kp_max:"-"},usnoaa_data_raw:{solar_wind_mag_field:!1,noaa_planetary_k_index_forecast:!1,geospace_pred_est_kp_1_hour:!1,outlook_27_day:!1}};console.debug("Fetch solar-wind-mag-field data from SWPC-NOAA.");let a=await fetch("https://services.swpc.noaa.gov/products/summary/solar-wind-mag-field.json");e=await a.json(),e.TimeStamp=H(e.TimeStamp),t.usnoaa_data_raw.solar_wind_mag_field=e,t.now.bz=t.usnoaa_data_raw.solar_wind_mag_field.Bz,t.now.bt=t.usnoaa_data_raw.solar_wind_mag_field.Bt,console.debug(e),console.debug("Fetch 1-hour kp predictions from SWPC-NOAA."),a=await fetch("https://services.swpc.noaa.gov/json/geospace/geospace_pred_est_kp_1_hour.json"),e=await a.json(),e=e.map((e=>({...e,model_prediction_time:H(e.model_prediction_time)}))),t.usnoaa_data_raw.geospace_pred_est_kp_1_hour=e,console.debug(e),console.debug("Fetch 27-day outlook from SWPC-NOAA."),a=await fetch("https://services.swpc.noaa.gov/text/27-day-outlook.txt"),e=await a.text(),console.debug(e),e=[...e.matchAll(/^(?