aboutsummaryrefslogtreecommitdiff
path: root/client/legacy/index.8f5d05d4.js
blob: 430a2b5aedab67afc5346d20cfce4f4a0533275c (plain) (blame)
1
import{_ as t,a as n,b as e,c as r,i as a,s as c,d as o,e as i,S as u,f as s,g as f,h as l,j as p,k as d,l as h,m as v,n as m,o as g,w as y,r as b,p as _,q as w,t as k,u as $,v as E,x as D,y as x,z as R,A as I,B as P,C as O,D as V,E as S,F as T,G as j,H as q,I as M,J as B,K as N,L as A,M as C,N as F,O as J,P as H,Q as K,R as z,T as Z,U as L,V as W,W as G}from"./client.b2e3ee4d.js";function Q(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,c=n(t);if(r){var o=n(this).constructor;a=Reflect.construct(c,arguments,o)}else a=c.apply(this,arguments);return e(this,a)}}function U(t){var n,e,r,a,c,o,i,u,g;return{c:function(){n=s("div"),e=s("div"),r=s("div"),a=s("div"),c=s("div"),o=s("div"),i=s("div"),u=s("div"),g=s("div"),this.h()},l:function(t){n=f(t,"DIV",{class:!0});var s=l(n);e=f(s,"DIV",{class:!0}),l(e).forEach(p),r=f(s,"DIV",{class:!0}),l(r).forEach(p),a=f(s,"DIV",{class:!0}),l(a).forEach(p),c=f(s,"DIV",{class:!0}),l(c).forEach(p),o=f(s,"DIV",{class:!0}),l(o).forEach(p),i=f(s,"DIV",{class:!0}),l(i).forEach(p),u=f(s,"DIV",{class:!0}),l(u).forEach(p),g=f(s,"DIV",{class:!0}),l(g).forEach(p),s.forEach(p),this.h()},h:function(){d(e,"class","svelte-7k6qu0"),d(r,"class","svelte-7k6qu0"),d(a,"class","svelte-7k6qu0"),d(c,"class","svelte-7k6qu0"),d(o,"class","svelte-7k6qu0"),d(i,"class","svelte-7k6qu0"),d(u,"class","svelte-7k6qu0"),d(g,"class","svelte-7k6qu0"),d(n,"class","lds-roller svelte-7k6qu0")},m:function(t,s){h(t,n,s),v(n,e),v(n,r),v(n,a),v(n,c),v(n,o),v(n,i),v(n,u),v(n,g)},p:m,i:m,o:m,d:function(t){t&&p(n)}}}var X=function(n){t(s,u);var e=Q(s);function s(t){var n;return r(this,s),n=e.call(this),a(o(n),t,null,U,c,{}),n}return i(s)}();function Y(t,n,e,r,a,c,o){try{var i=t[c](o),u=i.value}catch(t){return void e(t)}i.done?n(u):Promise.resolve(u).then(r,a)}function tt(t){return function(){var n=this,e=arguments;return new Promise((function(r,a){var c=t.apply(n,e);function o(t){Y(c,r,a,o,i,"next",t)}function i(t){Y(c,r,a,o,i,"throw",t)}o(void 0)}))}}var nt=["jan","feb","mar","apr","may","jun","jul","aug","sep","oct","nov","dec"];function et(t){if(/^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$/.test(t))return t;if(/^\d{4}\s[a-z,A-Z]+\s\d{2}$/.test(t)){var n=t.split(" ");return t="".concat(n[0],"-").concat(function(t){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,e=t.toString();n-e.length>0;)e="0"+e;return e}(function(t){if("string"!=typeof t)throw new Error("Cannot get month number of ".concat(g(t),"..."));if(t.length<3)throw new Error('Cannot get month number string "'.concat(t,'" of length ').concat(t.length,"..."));t=t.substring(0,3).toLowerCase();var n=nt.indexOf(t)+1;if(-1===n)throw new Error("Could not find the month ".concat(t,"."));return n}(n[1])),"-").concat(n[2],"T00:00:00Z"),t}return/^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}/.test(t)?t.replace(" ","T")+"Z":/^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}.\d{4}/.test(t)?t.replace(" ","T").split(".")[0]+"Z":(console.warn(t),t)}function rt(t){return t=et(t),new Date(t)}function at(){at=function(t,n){return new r(t,void 0,n)};var n=RegExp.prototype,e=new WeakMap;function r(t,n,a){var c=new RegExp(t,n);return e.set(c,a||e.get(t)),k(c,r.prototype)}function a(t,n){var r=e.get(n);return Object.keys(r).reduce((function(n,e){return n[e]=t[r[e]],n}),Object.create(null))}return t(r,RegExp),r.prototype.exec=function(t){var e=n.exec.call(this,t);return e&&(e.groups=a(e,this)),e},r.prototype[Symbol.replace]=function(t,r){if("string"==typeof r){var c=e.get(this);return n[Symbol.replace].call(this,t,r.replace(/\$<([^>]+)>/g,(function(t,n){return"$"+c[n]})))}if("function"==typeof r){var o=this;return n[Symbol.replace].call(this,t,(function(){var t=arguments;return"object"!=g(t[t.length-1])&&(t=[].slice.call(t)).push(a(t,o)),r.apply(this,t)}))}return n[Symbol.replace].call(this,t,r)},at.apply(this,arguments)}function ct(t,n){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var r=Object.getOwnPropertySymbols(t);n&&(r=r.filter((function(n){return Object.getOwnPropertyDescriptor(t,n).enumerable}))),e.push.apply(e,r)}return e}function ot(t){for(var n=1;n<arguments.length;n++){var e=null!=arguments[n]?arguments[n]:{};n%2?ct(Object(e),!0).forEach((function(n){$(t,n,e[n])})):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):ct(Object(e)).forEach((function(n){Object.defineProperty(t,n,Object.getOwnPropertyDescriptor(e,n))}))}return t}var it={updated:new Date(0,0,0),updating:!0},ut=vt("navigator_location"),st=vt("earth_weather"),ft=vt("space_weather"),lt=y(mt("navigator_location")?function(t){return t.updated=new Date(t.updated),t}(ut):ot(ot({},it),{},{available:!1,longitude:null,latitude:null,city:null})),pt=y(mt("earth_weather")?function(t){var n=t;return n.updated=new Date(n.updated),n.yr_data_raw.properties.meta.updated_at=new Date(n.yr_data_raw.properties.meta.updated_at),n.yr_data_raw.properties.timeseries=n.yr_data_raw.properties.timeseries.map((function(t){return ot(ot({},t),{},{time:new Date(t.time)})})),n}(st):ot(ot({},it),{},{available:!1})),dt=y(mt("space_weather")?function(t){var n=t;return n.updated=new Date(n.updated),n.usnoaa_data_raw.geospace_pred_est_kp_1_hour=n.usnoaa_data_raw.geospace_pred_est_kp_1_hour.map((function(t){return ot(ot({},t),{},{model_prediction_time:new Date(t.model_prediction_time)})})),n.usnoaa_data_raw.noaa_planetary_k_index_forecast=n.usnoaa_data_raw.noaa_planetary_k_index_forecast.map((function(t){return ot(ot({},t),{},{time:new Date(t.time)})})),n.usnoaa_data_raw.outlook_27_day=n.usnoaa_data_raw.outlook_27_day.map((function(t){return ot(ot({},t),{},{time:new Date(t.time)})})),n.usnoaa_data_raw.solar_wind_mag_field.TimeStamp=new Date(n.usnoaa_data_raw.solar_wind_mag_field.TimeStamp),n}(ft):ot({},it));function ht(t,n){"undefined"!=typeof window&&localStorage.setItem(t,JSON.stringify(n))}function vt(t){if("undefined"!=typeof window)return JSON.parse(localStorage.getItem(t))}function mt(t){return"undefined"!=typeof window&&localStorage.hasOwnProperty(t)}function gt(){return yt.apply(this,arguments)}function yt(){return(yt=tt(b.mark((function t(){var n,e,r;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("undefined"!=typeof window){t.next=2;break}return t.abrupt("return");case 2:return xt(lt,!0),console.debug("Attempting to get browser geolocation."),t.prev=4,t.next=7,bt();case 7:n=t.sent,t.next=18;break;case 10:if(t.prev=10,t.t0=t.catch(4),0!=_(lt).available){t.next=14;break}return t.abrupt("return");case 14:return console.warn("Could not get browser geolocation (".concat(t.t0,").")),lt.update((function(t){return ot(ot({},t),{},{available:!1,city:null,longitude:null,latitude:null})})),xt(lt,!1),t.abrupt("return");case 18:if(console.debug("Got geolocation from browser."),!(_(lt).available&&Date.now()-_(lt).updated<3e5)){t.next=23;break}return console.debug("Not fetching city name, as the location a short time ago."),xt(lt,!1,!1),t.abrupt("return");case 23:return console.debug("Attempting to get city name from geolocation."),e={city:void 0},t.prev=25,t.next=28,fetch("https://geocode.xyz/".concat(n.latitude,",").concat(n.longitude,"?geoit=json"));case 28:return r=t.sent,t.next=31,r.json();case 31:e=t.sent,t.next=37;break;case 34:t.prev=34,t.t1=t.catch(25),console.error("Could not get city name (".concat(t.t1,")"));case 37:console.debug("Got city name from browser."),lt.update((function(t){return ot(ot({},t),{},{available:!0,city:e.city},n)})),xt(lt,!1);case 40:case"end":return t.stop()}}),t,null,[[4,10],[25,34]])})))).apply(this,arguments)}function bt(){return _t.apply(this,arguments)}function _t(){return(_t=tt(b.mark((function t(){return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return t.abrupt("return",new Promise((function(t,n){"undefined"!=typeof navigator?navigator.geolocation.getCurrentPosition((function(n){t({longitude:n.coords.longitude,latitude:n.coords.latitude})}),(function(t){n(t)})):n(Error())})));case 1:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function wt(){return wt=tt(b.mark((function t(){var n,e,r,a,c=arguments;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=c.length>0&&void 0!==c[0]?c[0]:null,"undefined"!=typeof window){t.next=3;break}return t.abrupt("return");case 3:if(null!==n){t.next=5;break}return t.abrupt("return");case 5:if(!n.updating){t.next=7;break}return t.abrupt("return");case 7:if(n.available){t.next=11;break}return pt.update((function(t){return ot(ot({},t),{},{available:!1})})),xt(pt,!1),t.abrupt("return");case 11:if(!(_(pt).available&&Date.now()-_(pt).updated<3e5)){t.next=14;break}return console.debug("Skipping fetch of earth weather as the data was fetched very recently."),t.abrupt("return");case 14:return xt(pt,!0),console.debug("Attempting to fetch earth weather data from api-met."),t.next=18,fetch("https://api.met.no/weatherapi/locationforecast/2.0/compact?lat=".concat(n.latitude,"&lon=").concat(n.longitude));case 18:return e=t.sent,t.next=21,e.json();case 21:r=t.sent,a={clouds:null,temp:null},t.prev=23,a.clouds=r.properties.timeseries[0].data.instant.details.cloud_area_fraction,a.temp=r.properties.timeseries[0].data.instant.details.air_temperature,r.properties.timeseries=r.properties.timeseries.map((function(t){return ot(ot({},t),{},{time:rt(t.time)})})),t.next=34;break;case 29:return t.prev=29,t.t0=t.catch(23),console.errpr("Could not get earth weather data (".concat(t.t0,")")),xt(pt,!1,!1),t.abrupt("return");case 34:console.debug("Fetched earth weather successfully."),pt.update((function(t){return ot(ot({},t),{},{yr_data_raw:r,now:a,available:!0})})),xt(pt,!1);case 37:case"end":return t.stop()}}),t,null,[[23,29]])}))),wt.apply(this,arguments)}function kt(){return $t.apply(this,arguments)}function $t(){return($t=tt(b.mark((function t(){var n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("undefined"!=typeof window){t.next=2;break}return t.abrupt("return");case 2:if(!(Date.now()-_(dt).updated<3e5)){t.next=5;break}return console.debug("Skipping fetch of space weather as the data was fetched very recently."),t.abrupt("return");case 5:return xt(dt,!0),console.debug("Attempting to fetch space weather data."),t.prev=7,t.next=10,Et();case 10:n=t.sent,t.next=18;break;case 13:return t.prev=13,t.t0=t.catch(7),console.error(t.t0),xt(dt,!1,!1),t.abrupt("return");case 18:dt.update((function(t){return ot(ot({},t),n)})),xt(dt,!1);case 20:case"end":return t.stop()}}),t,null,[[7,13]])})))).apply(this,arguments)}function Et(){return Dt.apply(this,arguments)}function Dt(){return(Dt=tt(b.mark((function t(){var n,e,r,a,c,o,i;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return n={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."),t.next=4,fetch("https://services.swpc.noaa.gov/products/summary/solar-wind-mag-field.json");case 4:return r=t.sent,t.next=7,r.json();case 7:return(e=t.sent).TimeStamp=rt(e.TimeStamp),n.usnoaa_data_raw.solar_wind_mag_field=e,n.now.bz=n.usnoaa_data_raw.solar_wind_mag_field.Bz,n.now.bt=n.usnoaa_data_raw.solar_wind_mag_field.Bt,console.debug(e),console.debug("Fetch 1-hour kp predictions from SWPC-NOAA."),t.next=16,fetch("https://services.swpc.noaa.gov/json/geospace/geospace_pred_est_kp_1_hour.json");case 16:return r=t.sent,t.next=19,r.json();case 19:return e=(e=t.sent).map((function(t){return ot(ot({},t),{},{model_prediction_time:rt(t.model_prediction_time)})})),n.usnoaa_data_raw.geospace_pred_est_kp_1_hour=e,console.debug(e),console.debug("Fetch 27-day outlook from SWPC-NOAA."),t.next=26,fetch("https://services.swpc.noaa.gov/text/27-day-outlook.txt");case 26:return r=t.sent,t.next=29,r.text();case 29:return e=t.sent,console.debug(e),e=w(e.matchAll(at(/^(\d{4}\s.{3}\s\d{2})\s+(\d+)\s+(\d+)\s+(\d+)$/gm,{time:1,flux107:2,aindex:3,kindex:4}))),console.debug(e),e=e.map((function(t){return ot(ot({},t.groups),{},{time:rt(t.groups.time)})})),n.usnoaa_data_raw.outlook_27_day=e,console.debug(e),console.debug("Fetch planetary k-index forecast from SWPC-NOAA."),t.next=39,fetch("https://services.swpc.noaa.gov/products/noaa-planetary-k-index-forecast.json");case 39:return r=t.sent,t.next=42,r.json();case 42:return(e=t.sent).shift(),n.usnoaa_data_raw.noaa_planetary_k_index_forecast=e,console.debug(e),a=new Date,c=new Date(0,0,0),o=1e3,i=0,n.usnoaa_data_raw.noaa_planetary_k_index_forecast.forEach((function(t,e){t[1]>i&&(i=t[1]),t[1]<o&&(o=t[1]);var r=rt(t[0]);Math.abs(r.getTime()-a.getTime())<Math.abs(c.getTime()-a.getTime())&&(c=r,n.now.kp=t[1]),n.usnoaa_data_raw.noaa_planetary_k_index_forecast[e]={time:r,kp:t[1],observed:t[2]}})),n.now.kp_min=o.toString(),n.now.kp_max=i.toString(),console.debug("Fetched Space weather"),console.log(n),t.abrupt("return",n);case 56:case"end":return t.stop()}}),t)})))).apply(this,arguments)}function xt(t){var n=arguments.length>1&&void 0!==arguments[1]&&arguments[1],e=!(arguments.length>2&&void 0!==arguments[2])||arguments[2],r={};e&&!n&&(r={updated:new Date}),t.update((function(t){return ot(ot(ot({},t),r),{},{updating:n})}))}function Rt(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,c=n(t);if(r){var o=n(this).constructor;a=Reflect.construct(c,arguments,o)}else a=c.apply(this,arguments);return e(this,a)}}function It(t){var n,e,r;function a(t,n){return void 0!==t[2].city?Ot:Pt}var c=a(t),o=c(t);return{c:function(){n=s("i"),e=E(),o.c(),r=D(),this.h()},l:function(t){n=f(t,"I",{class:!0}),l(n).forEach(p),e=x(t),o.l(t),r=D(),this.h()},h:function(){d(n,"class","symbol fas fa-map-marker-alt svelte-9kdo4s")},m:function(t,a){h(t,n,a),h(t,e,a),o.m(t,a),h(t,r,a)},p:function(t,n){c===(c=a(t))&&o?o.p(t,n):(o.d(1),(o=c(t))&&(o.c(),o.m(r.parentNode,r)))},d:function(t){t&&p(n),t&&p(e),o.d(t),t&&p(r)}}}function Pt(t){var n,e,r,a,c,o,i=t[2].longitude+"",u=t[2].latitude+"";return{c:function(){n=s("h1"),e=R("long: "),r=R(i),a=s("br"),c=R("lat: "),o=R(u),this.h()},l:function(t){n=f(t,"H1",{class:!0});var s=l(n);e=I(s,"long: "),r=I(s,i),a=f(s,"BR",{}),c=I(s,"lat: "),o=I(s,u),s.forEach(p),this.h()},h:function(){d(n,"class","svelte-9kdo4s")},m:function(t,i){h(t,n,i),v(n,e),v(n,r),v(n,a),v(n,c),v(n,o)},p:function(t,n){4&n&&i!==(i=t[2].longitude+"")&&O(r,i),4&n&&u!==(u=t[2].latitude+"")&&O(o,u)},d:function(t){t&&p(n)}}}function Ot(t){var n,e,r=t[2].city+"";return{c:function(){n=s("h1"),e=R(r),this.h()},l:function(t){n=f(t,"H1",{class:!0});var a=l(n);e=I(a,r),a.forEach(p),this.h()},h:function(){d(n,"class","svelte-9kdo4s")},m:function(t,r){h(t,n,r),v(n,e)},p:function(t,n){4&n&&r!==(r=t[2].city+"")&&O(e,r)},d:function(t){t&&p(n)}}}function Vt(t){var n,e,r;function a(t,e){return 24&e&&(n=null),null==n&&(n=!!(Math.abs(t[3].updated-t[4].updated)>6e5)),n?Tt:St}var c=a(t,-1),o=c(t),i=t[1]>=3e5&&jt(t);return{c:function(){o.c(),e=E(),i&&i.c(),r=D()},l:function(t){o.l(t),e=x(t),i&&i.l(t),r=D()},m:function(t,n){o.m(t,n),h(t,e,n),i&&i.m(t,n),h(t,r,n)},p:function(t,n){c===(c=a(t,n))&&o?o.p(t,n):(o.d(1),(o=c(t))&&(o.c(),o.m(e.parentNode,e))),t[1]>=3e5?i?i.p(t,n):((i=jt(t)).c(),i.m(r.parentNode,r)):i&&(i.d(1),i=null)},d:function(t){o.d(t),t&&p(e),i&&i.d(t),t&&p(r)}}}function St(t){var n,e,r=t[0].toLocaleString("no-NO",{dateStyle:"medium",timeStyle:"short"})+"";return{c:function(){n=s("p"),e=R(r)},l:function(t){n=f(t,"P",{});var a=l(n);e=I(a,r),a.forEach(p)},m:function(t,r){h(t,n,r),v(n,e)},p:function(t,n){1&n&&r!==(r=t[0].toLocaleString("no-NO",{dateStyle:"medium",timeStyle:"short"})+"")&&O(e,r)},d:function(t){t&&p(n)}}}function Tt(t){var n,e;return{c:function(){n=s("p"),e=R("There is more than 10 minutes difference between data updates")},l:function(t){n=f(t,"P",{});var r=l(n);e=I(r,"There is more than 10 minutes difference between data updates"),r.forEach(p)},m:function(t,r){h(t,n,r),v(n,e)},p:m,d:function(t){t&&p(n)}}}function jt(t){var n,e,r,a,c,o=Math.round(t[1]/60/1e3)+"";return{c:function(){n=s("span"),e=s("i"),r=R(" Data is "),a=R(o),c=R(" minutes old!"),this.h()},l:function(t){n=f(t,"SPAN",{style:!0});var i=l(n);e=f(i,"I",{class:!0}),l(e).forEach(p),r=I(i," Data is "),a=I(i,o),c=I(i," minutes old!"),i.forEach(p),this.h()},h:function(){d(e,"class","symbol fas fa-exclamation-circle"),P(n,"color","red")},m:function(t,o){h(t,n,o),v(n,e),v(n,r),v(n,a),v(n,c)},p:function(t,n){2&n&&o!==(o=Math.round(t[1]/60/1e3)+"")&&O(a,o)},d:function(t){t&&p(n)}}}function qt(t){var n,e,r,a,c,o,i,u,g,y,b,_,w=t[4].now.kp+"",k=t[4].now.kp_max+"",$=t[4].now.kp_min+"";return{c:function(){n=s("h2"),e=R("KP "),r=R(w),a=E(),c=s("p"),o=s("span"),i=R("↑ KP "),u=R(k),g=E(),y=s("span"),b=R("↓ KP "),_=R($),this.h()},l:function(t){n=f(t,"H2",{class:!0});var s=l(n);e=I(s,"KP "),r=I(s,w),s.forEach(p),a=x(t),c=f(t,"P",{});var d=l(c);o=f(d,"SPAN",{classname:!0});var h=l(o);i=I(h,"↑ KP "),u=I(h,k),h.forEach(p),g=x(d),y=f(d,"SPAN",{classname:!0});var v=l(y);b=I(v,"↓ KP "),_=I(v,$),v.forEach(p),d.forEach(p),this.h()},h:function(){d(n,"class","svelte-9kdo4s"),d(o,"classname","pr-2"),d(y,"classname","pl-2")},m:function(t,s){h(t,n,s),v(n,e),v(n,r),h(t,a,s),h(t,c,s),v(c,o),v(o,i),v(o,u),v(c,g),v(c,y),v(y,b),v(y,_)},p:function(t,n){16&n&&w!==(w=t[4].now.kp+"")&&O(r,w),16&n&&k!==(k=t[4].now.kp_max+"")&&O(u,k),16&n&&$!==($=t[4].now.kp_min+"")&&O(_,$)},i:m,o:m,d:function(t){t&&p(n),t&&p(a),t&&p(c)}}}function Mt(t){var n,e;return n=new X({}),{c:function(){B(n.$$.fragment)},l:function(t){N(n.$$.fragment,t)},m:function(t,r){A(n,t,r),e=!0},p:m,i:function(t){e||(q(n.$$.fragment,t),e=!0)},o:function(t){T(n.$$.fragment,t),e=!1},d:function(t){C(n,t)}}}function Bt(t){var n,e,r,a,c,o,i,u,m,g,y,b,_,w,k,$=t[4].now.bz+"",P=t[4].now.bt+"",V=t[3].available&&Nt(t);return{c:function(){n=s("div"),e=s("p"),r=R("BZ"),a=E(),c=s("p"),o=R($),i=E(),u=s("div"),m=s("p"),g=R("BT"),y=E(),b=s("p"),_=R(P),w=E(),V&&V.c(),k=D(),this.h()},l:function(t){n=f(t,"DIV",{});var s=l(n);e=f(s,"P",{class:!0});var d=l(e);r=I(d,"BZ"),d.forEach(p),a=x(s),c=f(s,"P",{class:!0});var h=l(c);o=I(h,$),h.forEach(p),s.forEach(p),i=x(t),u=f(t,"DIV",{});var v=l(u);m=f(v,"P",{class:!0});var E=l(m);g=I(E,"BT"),E.forEach(p),y=x(v),b=f(v,"P",{class:!0});var R=l(b);_=I(R,P),R.forEach(p),v.forEach(p),w=x(t),V&&V.l(t),k=D(),this.h()},h:function(){d(e,"class","svelte-9kdo4s"),d(c,"class","svelte-9kdo4s"),d(m,"class","svelte-9kdo4s"),d(b,"class","svelte-9kdo4s")},m:function(t,s){h(t,n,s),v(n,e),v(e,r),v(n,a),v(n,c),v(c,o),h(t,i,s),h(t,u,s),v(u,m),v(m,g),v(u,y),v(u,b),v(b,_),h(t,w,s),V&&V.m(t,s),h(t,k,s)},p:function(t,n){16&n&&$!==($=t[4].now.bz+"")&&O(o,$),16&n&&P!==(P=t[4].now.bt+"")&&O(_,P),t[3].available?V?V.p(t,n):((V=Nt(t)).c(),V.m(k.parentNode,k)):V&&(V.d(1),V=null)},d:function(t){t&&p(n),t&&p(i),t&&p(u),t&&p(w),V&&V.d(t),t&&p(k)}}}function Nt(t){var n,e,r,a,c,o,i,u,m,g,y,b,_,w,k,$=t[3].now.temp+"",D=t[3].now.clouds+"";return{c:function(){n=s("div"),e=s("p"),r=R("Temp"),a=E(),c=s("p"),o=R($),i=R("°C"),u=E(),m=s("div"),g=s("p"),y=R("Clouds"),b=E(),_=s("p"),w=R(D),k=R("%"),this.h()},l:function(t){n=f(t,"DIV",{});var s=l(n);e=f(s,"P",{class:!0});var d=l(e);r=I(d,"Temp"),d.forEach(p),a=x(s),c=f(s,"P",{class:!0});var h=l(c);o=I(h,$),i=I(h,"°C"),h.forEach(p),s.forEach(p),u=x(t),m=f(t,"DIV",{});var v=l(m);g=f(v,"P",{class:!0});var E=l(g);y=I(E,"Clouds"),E.forEach(p),b=x(v),_=f(v,"P",{class:!0});var R=l(_);w=I(R,D),k=I(R,"%"),R.forEach(p),v.forEach(p),this.h()},h:function(){d(e,"class","svelte-9kdo4s"),d(c,"class","svelte-9kdo4s"),d(g,"class","svelte-9kdo4s"),d(_,"class","svelte-9kdo4s")},m:function(t,s){h(t,n,s),v(n,e),v(e,r),v(n,a),v(n,c),v(c,o),v(c,i),h(t,u,s),h(t,m,s),v(m,g),v(g,y),v(m,b),v(m,_),v(_,w),v(_,k)},p:function(t,n){8&n&&$!==($=t[3].now.temp+"")&&O(o,$),8&n&&D!==(D=t[3].now.clouds+"")&&O(w,D)},d:function(t){t&&p(n),t&&p(u),t&&p(m)}}}function At(t){var n,e,r,a,c,o,i,u,m,g,y,b,_=!t[2].updating&&t[2].available&&!t[3].updating&&!t[4].updating&&It(t),w=!t[3].updating&&!t[4].updating&&Vt(t),k=[Mt,qt],$=[];function D(t,n){return t[4].updating||t[3].updating?0:1}u=D(t),m=$[u]=k[u](t);var R=!t[4].updating&&!t[3].updating&&Bt(t);return{c:function(){n=s("div"),e=s("div"),r=s("div"),_&&_.c(),a=E(),c=s("div"),w&&w.c(),o=E(),i=s("div"),m.c(),g=E(),y=s("div"),R&&R.c(),this.h()},l:function(t){n=f(t,"DIV",{class:!0});var u=l(n);e=f(u,"DIV",{class:!0});var s=l(e);r=f(s,"DIV",{class:!0});var d=l(r);_&&_.l(d),d.forEach(p),a=x(s),c=f(s,"DIV",{class:!0});var h=l(c);w&&w.l(h),h.forEach(p),o=x(s),i=f(s,"DIV",{class:!0});var v=l(i);m.l(v),v.forEach(p),g=x(s),y=f(s,"DIV",{class:!0});var b=l(y);R&&R.l(b),b.forEach(p),s.forEach(p),u.forEach(p),this.h()},h:function(){d(r,"class","weatherCurrent-data-location svelte-9kdo4s"),d(c,"class","weatherCurrent-data-date"),d(i,"class","weatherCurrent-data-kp svelte-9kdo4s"),d(y,"class","current-details svelte-9kdo4s"),d(e,"class","weatherCurrent-data svelte-9kdo4s"),d(n,"class","weatherCurrent-wrapper svelte-9kdo4s")},m:function(t,s){h(t,n,s),v(n,e),v(e,r),_&&_.m(r,null),v(e,a),v(e,c),w&&w.m(c,null),v(e,o),v(e,i),$[u].m(i,null),v(e,g),v(e,y),R&&R.m(y,null),b=!0},p:function(t,n){var e=V(n,1)[0];t[2].updating||!t[2].available||t[3].updating||t[4].updating?_&&(_.d(1),_=null):_?_.p(t,e):((_=It(t)).c(),_.m(r,null)),t[3].updating||t[4].updating?w&&(w.d(1),w=null):w?w.p(t,e):((w=Vt(t)).c(),w.m(c,null));var a=u;(u=D(t))===a?$[u].p(t,e):(S(),T($[a],1,1,(function(){$[a]=null})),j(),(m=$[u])?m.p(t,e):(m=$[u]=k[u](t)).c(),q(m,1),m.m(i,null)),t[4].updating||t[3].updating?R&&(R.d(1),R=null):R?R.p(t,e):((R=Bt(t)).c(),R.m(y,null))},i:function(t){b||(q(m),b=!0)},o:function(t){T(m),b=!1},d:function(t){t&&p(n),_&&_.d(),w&&w.d(),$[u].d(),R&&R.d()}}}function Ct(t,n,e){var r,a,c;M(t,lt,(function(t){return e(2,r=t)})),M(t,pt,(function(t){return e(3,a=t)})),M(t,dt,(function(t){return e(4,c=t)}));var o=new Date(0,0,0),i=0;return setInterval((function(){var t=_(pt).updated,n=_(dt).updated,r=new Date;r-n>r-t?(e(0,o=n),e(1,i=r-n)):(e(0,o=t),e(1,i=r-t))}),500),[o,i,r,a,c]}gt(),lt.subscribe((function(){return wt.apply(this,arguments)})),kt(),setInterval(gt,15e4),setInterval(kt,15e4),lt.subscribe((function(t){return ht("navigator_location",t)})),pt.subscribe((function(t){return ht("earth_weather",t)})),dt.subscribe((function(t){return ht("space_weather",t)}));var Ft=function(n){t(s,u);var e=Rt(s);function s(t){var n;return r(this,s),n=e.call(this),a(o(n),t,Ct,At,c,{}),n}return i(s)}();function Jt(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,c=n(t);if(r){var o=n(this).constructor;a=Reflect.construct(c,arguments,o)}else a=c.apply(this,arguments);return e(this,a)}}function Ht(t){var n,e,r=t[1].default,a=F(r,t,t[0],null);return{c:function(){n=s("div"),a&&a.c(),this.h()},l:function(t){n=f(t,"DIV",{class:!0});var e=l(n);a&&a.l(e),e.forEach(p),this.h()},h:function(){d(n,"class","chip svelte-1jb0ny7")},m:function(t,r){h(t,n,r),a&&a.m(n,null),e=!0},p:function(t,n){var c=V(n,1)[0];a&&a.p&&(!e||1&c)&&J(a,r,t,t[0],e?K(r,t[0],c,null):H(t[0]),null)},i:function(t){e||(q(a,t),e=!0)},o:function(t){T(a,t),e=!1},d:function(t){t&&p(n),a&&a.d(t)}}}function Kt(t,n,e){var r=n.$$slots,a=void 0===r?{}:r,c=n.$$scope;return t.$$set=function(t){"$$scope"in t&&e(0,c=t.$$scope)},[c,a]}var zt=function(n){t(s,u);var e=Jt(s);function s(t){var n;return r(this,s),n=e.call(this),a(o(n),t,Kt,Ht,c,{}),n}return i(s)}();function Zt(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,c=n(t);if(r){var o=n(this).constructor;a=Reflect.construct(c,arguments,o)}else a=c.apply(this,arguments);return e(this,a)}}function Lt(t){var n,e,r,a,c,o;return{c:function(){n=s("div"),e=s("div"),r=s("div"),a=E(),c=s("span"),o=R(t[1]),this.h()},l:function(i){n=f(i,"DIV",{class:!0,style:!0});var u=l(n);e=f(u,"DIV",{class:!0});var s=l(e);r=f(s,"DIV",{class:!0}),l(r).forEach(p),s.forEach(p),a=x(u),c=f(u,"SPAN",{class:!0});var d=l(c);o=I(d,t[1]),d.forEach(p),u.forEach(p),this.h()},h:function(){d(r,"class","bar svelte-1mo8cjf"),d(e,"class","bar-wrapper svelte-1mo8cjf"),d(c,"class","value svelte-1mo8cjf"),d(n,"class","wrapper svelte-1mo8cjf"),P(n,"--progress",100*t[0]+"%")},m:function(t,i){h(t,n,i),v(n,e),v(e,r),v(n,a),v(n,c),v(c,o)},p:function(t,e){var r=V(e,1)[0];2&r&&O(o,t[1]),1&r&&P(n,"--progress",100*t[0]+"%")},i:m,o:m,d:function(t){t&&p(n)}}}function Wt(t,n,e){var r=n.percentage,a=n.value;return t.$$set=function(t){"percentage"in t&&e(0,r=t.percentage),"value"in t&&e(1,a=t.value)},[r,a]}var Gt=function(n){t(s,u);var e=Zt(s);function s(t){var n;return r(this,s),n=e.call(this),a(o(n),t,Wt,Lt,c,{percentage:0,value:1}),n}return i(s)}();function Qt(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,c=n(t);if(r){var o=n(this).constructor;a=Reflect.construct(c,arguments,o)}else a=c.apply(this,arguments);return e(this,a)}}function Ut(t){var n,e,r,a,c,o,i,u,g,y,b,_,w;y=new Gt({props:{percentage:t[0]/9,value:t[0]}});var k=t[5]&&function(t){var n,e,r,a,c,o,i,u,g,y,b,_,w=Math.round(t[3])+"",k=Math.round(t[4])+"";return{c:function(){n=s("div"),e=s("p"),r=s("i"),a=E(),c=R(w),o=R("°C"),i=E(),u=s("p"),g=s("i"),y=E(),b=R(k),_=R("%"),this.h()},l:function(t){n=f(t,"DIV",{class:!0});var s=l(n);e=f(s,"P",{class:!0});var d=l(e);r=f(d,"I",{class:!0}),l(r).forEach(p),a=x(d),c=I(d,w),o=I(d,"°C"),d.forEach(p),i=x(s),u=f(s,"P",{class:!0});var h=l(u);g=f(h,"I",{class:!0}),l(g).forEach(p),y=x(h),b=I(h,k),_=I(h,"%"),h.forEach(p),s.forEach(p),this.h()},h:function(){d(r,"class","fas fa-thermometer-half svelte-m9qkku"),d(e,"class","svelte-m9qkku"),d(g,"class","fas fa-cloud svelte-m9qkku"),d(u,"class","svelte-m9qkku"),d(n,"class","svelte-m9qkku")},m:function(t,s){h(t,n,s),v(n,e),v(e,r),v(e,a),v(e,c),v(e,o),v(n,i),v(n,u),v(u,g),v(u,y),v(u,b),v(u,_)},p:m,d:function(t){t&&p(n)}}}(t);return{c:function(){n=s("div"),e=s("div"),r=s("h3"),a=R(t[2]),c=E(),o=s("p"),i=R(t[1]),u=E(),g=s("div"),B(y.$$.fragment),b=E(),_=s("div"),k&&k.c(),this.h()},l:function(s){n=f(s,"DIV",{class:!0});var d=l(n);e=f(d,"DIV",{class:!0});var h=l(e);r=f(h,"H3",{class:!0});var v=l(r);a=I(v,t[2]),v.forEach(p),c=x(h),o=f(h,"P",{class:!0});var m=l(o);i=I(m,t[1]),m.forEach(p),h.forEach(p),u=x(d),g=f(d,"DIV",{class:!0});var w=l(g);N(y.$$.fragment,w),w.forEach(p),b=x(d),_=f(d,"DIV",{class:!0});var $=l(_);k&&k.l($),$.forEach(p),d.forEach(p),this.h()},h:function(){d(r,"class","svelte-m9qkku"),d(o,"class","svelte-m9qkku"),d(e,"class","svelte-m9qkku"),d(g,"class","KP svelte-m9qkku"),d(_,"class","data svelte-m9qkku"),d(n,"class","prediction-details svelte-m9qkku")},m:function(t,s){h(t,n,s),v(n,e),v(e,r),v(r,a),v(e,c),v(e,o),v(o,i),v(n,u),v(n,g),A(y,g,null),v(n,b),v(n,_),k&&k.m(_,null),w=!0},p:function(t,n){var e=V(n,1)[0];t[5]&&k.p(t,e)},i:function(t){w||(q(y.$$.fragment,t),w=!0)},o:function(t){T(y.$$.fragment,t),w=!1},d:function(t){t&&p(n),C(y),k&&k.d()}}}function Xt(t){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,e=t,r=0;r<n-t.length;r++)e="0"+e;return e}function Yt(t,n,e){var r=n.prediction,a=r.kp,c=r.time.getDate()+". "+["January","February","March","April","May","June","July","August","September","October","November","December"][r.time.getMonth()],o=Xt(r.time.getHours().toString())+":"+Xt(r.time.getMinutes().toString()),i=r.temp,u=r.clouds,s=r.hasNOMETData;return t.$$set=function(t){"prediction"in t&&e(6,r=t.prediction)},[a,c,o,i,u,s,r]}var tn=function(n){t(s,u);var e=Qt(s);function s(t){var n;return r(this,s),n=e.call(this),a(o(n),t,Yt,Ut,c,{prediction:6}),n}return i(s)}();function nn(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,c=n(t);if(r){var o=n(this).constructor;a=Reflect.construct(c,arguments,o)}else a=c.apply(this,arguments);return e(this,a)}}function en(t,n,e){var r=t.slice();return r[5]=n[e],r[7]=e,r}function rn(t){var n,e;return n=new tn({props:{prediction:t[5]}}),{c:function(){B(n.$$.fragment)},l:function(t){N(n.$$.fragment,t)},m:function(t,r){A(n,t,r),e=!0},p:function(t,e){var r={};1&e&&(r.prediction=t[5]),n.$set(r)},i:function(t){e||(q(n.$$.fragment,t),e=!0)},o:function(t){T(n.$$.fragment,t),e=!1},d:function(t){C(n,t)}}}function an(t){for(var n,e,r=t[0],a=[],c=0;c<r.length;c+=1)a[c]=rn(en(t,r,c));var o=function(t){return T(a[t],1,1,(function(){a[t]=null}))};return{c:function(){n=s("div");for(var t=0;t<a.length;t+=1)a[t].c();this.h()},l:function(t){n=f(t,"DIV",{class:!0});for(var e=l(n),r=0;r<a.length;r+=1)a[r].l(e);e.forEach(p),this.h()},h:function(){d(n,"class","prediction-table svelte-1uc0m3l")},m:function(t,r){h(t,n,r);for(var c=0;c<a.length;c+=1)a[c].m(n,null);e=!0},p:function(t,e){var c=V(e,1)[0];if(1&c){var i;for(r=t[0],i=0;i<r.length;i+=1){var u=en(t,r,i);a[i]?(a[i].p(u,c),q(a[i],1)):(a[i]=rn(u),a[i].c(),q(a[i],1),a[i].m(n,null))}for(S(),i=r.length;i<a.length;i+=1)o(i);j()}},i:function(t){if(!e){for(var n=0;n<r.length;n+=1)q(a[n]);e=!0}},o:function(t){a=a.filter(Boolean);for(var n=0;n<a.length;n+=1)T(a[n]);e=!1},d:function(t){t&&p(n),z(a,t)}}}function cn(t,n,e){var r,a,c;function o(){return i.apply(this,arguments)}function i(){return(i=tt(b.mark((function t(){var n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!a.updating&&!r.updating){t.next=3;break}return e(0,c=null),t.abrupt("return");case 3:n=a.usnoaa_data_raw.geospace_pred_est_kp_1_hour.filter((function(t){return t.model_prediction_time>=new Date})),e(0,c=n.map((function(t){return{time:t.model_prediction_time,kp:Math.round(t.k),temp:null,clouds:null,hasNOMETData:r.available}}))),r.available&&c.forEach((function(t,n){var a,o,i=new Date(0,0,0),u=!0;r.yr_data_raw.properties.timeseries.forEach((function(n,e){var r=new Date(n.time);if(Math.abs(r.getTime()-t.time.getTime())<Math.abs(i.getTime()-t.time.getTime())){if(Math.abs(r.getTime()-t.time.getTime())>18e6)return void(u=!1);i=r,a=n.data.instant.details.air_temperature,o=n.data.instant.details.cloud_area_fraction}})),e(0,c[n]=Object.assign(Object.assign({},c[n]),{temp:a,clouds:o,hasNOMETData:u}),c)}));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return M(t,pt,(function(t){return e(1,r=t)})),M(t,dt,(function(t){return e(2,a=t)})),dt.subscribe(o),pt.subscribe(o),[c]}var on=function(n){t(s,u);var e=nn(s);function s(t){var n;return r(this,s),n=e.call(this),a(o(n),t,cn,an,c,{}),n}return i(s)}();function un(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,c=n(t);if(r){var o=n(this).constructor;a=Reflect.construct(c,arguments,o)}else a=c.apply(this,arguments);return e(this,a)}}function sn(t){var n,e,r;return e=new zt({props:{$$slots:{default:[fn]},$$scope:{ctx:t}}}),{c:function(){n=s("div"),B(e.$$.fragment),this.h()},l:function(t){n=f(t,"DIV",{class:!0});var r=l(n);N(e.$$.fragment,r),r.forEach(p),this.h()},h:function(){d(n,"class","svelte-m9qkku")},m:function(t,a){h(t,n,a),A(e,n,null),r=!0},p:function(t,n){var r={};257&n&&(r.$$scope={dirty:n,ctx:t}),e.$set(r)},i:function(t){r||(q(e.$$.fragment,t),r=!0)},o:function(t){T(e.$$.fragment,t),r=!1},d:function(t){t&&p(n),C(e)}}}function fn(t){var n,e=t[0].observed+"";return{c:function(){n=R(e)},l:function(t){n=I(t,e)},m:function(t,e){h(t,n,e)},p:function(t,r){1&r&&e!==(e=t[0].observed+"")&&O(n,e)},d:function(t){t&&p(n)}}}function ln(t){var n,e,r,a,c,o,i,u,g,y,b,_,w,k,$="predicted"!=t[0].observed&&sn(t);b=new Gt({props:{percentage:t[1]/9,value:t[1]}});var D=t[6]&&function(t){var n,e,r,a,c,o,i,u,g,y,b,_,w=Math.round(t[4])+"",k=Math.round(t[5])+"";return{c:function(){n=s("div"),e=s("p"),r=s("i"),a=E(),c=R(w),o=R("°C"),i=E(),u=s("p"),g=s("i"),y=E(),b=R(k),_=R("%"),this.h()},l:function(t){n=f(t,"DIV",{class:!0});var s=l(n);e=f(s,"P",{class:!0});var d=l(e);r=f(d,"I",{class:!0}),l(r).forEach(p),a=x(d),c=I(d,w),o=I(d,"°C"),d.forEach(p),i=x(s),u=f(s,"P",{class:!0});var h=l(u);g=f(h,"I",{class:!0}),l(g).forEach(p),y=x(h),b=I(h,k),_=I(h,"%"),h.forEach(p),s.forEach(p),this.h()},h:function(){d(r,"class","fas fa-thermometer-half svelte-m9qkku"),d(e,"class","svelte-m9qkku"),d(g,"class","fas fa-cloud svelte-m9qkku"),d(u,"class","svelte-m9qkku"),d(n,"class","svelte-m9qkku")},m:function(t,s){h(t,n,s),v(n,e),v(e,r),v(e,a),v(e,c),v(e,o),v(n,i),v(n,u),v(u,g),v(u,y),v(u,b),v(u,_)},p:m,d:function(t){t&&p(n)}}}(t);return{c:function(){n=s("div"),e=s("div"),r=s("h3"),a=R(t[3]),c=E(),o=s("p"),i=R(t[2]),u=E(),$&&$.c(),g=E(),y=s("div"),B(b.$$.fragment),_=E(),w=s("div"),D&&D.c(),this.h()},l:function(s){n=f(s,"DIV",{class:!0});var d=l(n);e=f(d,"DIV",{class:!0});var h=l(e);r=f(h,"H3",{class:!0});var v=l(r);a=I(v,t[3]),v.forEach(p),c=x(h),o=f(h,"P",{class:!0});var m=l(o);i=I(m,t[2]),m.forEach(p),h.forEach(p),u=x(d),$&&$.l(d),g=x(d),y=f(d,"DIV",{class:!0});var k=l(y);N(b.$$.fragment,k),k.forEach(p),_=x(d),w=f(d,"DIV",{class:!0});var E=l(w);D&&D.l(E),E.forEach(p),d.forEach(p),this.h()},h:function(){d(r,"class","svelte-m9qkku"),d(o,"class","svelte-m9qkku"),d(e,"class","svelte-m9qkku"),d(y,"class","KP svelte-m9qkku"),d(w,"class","data svelte-m9qkku"),d(n,"class","prediction-details svelte-m9qkku")},m:function(t,s){h(t,n,s),v(n,e),v(e,r),v(r,a),v(e,c),v(e,o),v(o,i),v(n,u),$&&$.m(n,null),v(n,g),v(n,y),A(b,y,null),v(n,_),v(n,w),D&&D.m(w,null),k=!0},p:function(t,e){var r=V(e,1)[0];"predicted"!=t[0].observed?$?($.p(t,r),1&r&&q($,1)):(($=sn(t)).c(),q($,1),$.m(n,g)):$&&(S(),T($,1,1,(function(){$=null})),j()),t[6]&&D.p(t,r)},i:function(t){k||(q($),q(b.$$.fragment,t),k=!0)},o:function(t){T($),T(b.$$.fragment,t),k=!1},d:function(t){t&&p(n),$&&$.d(),C(b),D&&D.d()}}}function pn(t){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,e=t,r=0;r<n-t.length;r++)e="0"+e;return e}function dn(t,n,e){var r=n.prediction,a=r.kp,c=r.time.getDate()+". "+["January","February","March","April","May","June","July","August","September","October","November","December"][r.time.getMonth()],o=pn(r.time.getHours().toString())+":"+pn(r.time.getMinutes().toString()),i=r.temp,u=r.clouds,s=r.hasNOMETData;return t.$$set=function(t){"prediction"in t&&e(0,r=t.prediction)},[r,a,c,o,i,u,s]}var hn=function(n){t(s,u);var e=un(s);function s(t){var n;return r(this,s),n=e.call(this),a(o(n),t,dn,ln,c,{prediction:0}),n}return i(s)}();function vn(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,c=n(t);if(r){var o=n(this).constructor;a=Reflect.construct(c,arguments,o)}else a=c.apply(this,arguments);return e(this,a)}}function mn(t,n,e){var r=t.slice();return r[5]=n[e],r[7]=e,r}function gn(t){var n,e;return n=new hn({props:{prediction:t[5]}}),{c:function(){B(n.$$.fragment)},l:function(t){N(n.$$.fragment,t)},m:function(t,r){A(n,t,r),e=!0},p:function(t,e){var r={};1&e&&(r.prediction=t[5]),n.$set(r)},i:function(t){e||(q(n.$$.fragment,t),e=!0)},o:function(t){T(n.$$.fragment,t),e=!1},d:function(t){C(n,t)}}}function yn(t){for(var n,e,r=t[0],a=[],c=0;c<r.length;c+=1)a[c]=gn(mn(t,r,c));var o=function(t){return T(a[t],1,1,(function(){a[t]=null}))};return{c:function(){n=s("div");for(var t=0;t<a.length;t+=1)a[t].c();this.h()},l:function(t){n=f(t,"DIV",{class:!0});for(var e=l(n),r=0;r<a.length;r+=1)a[r].l(e);e.forEach(p),this.h()},h:function(){d(n,"class","prediction-table svelte-1uc0m3l")},m:function(t,r){h(t,n,r);for(var c=0;c<a.length;c+=1)a[c].m(n,null);e=!0},p:function(t,e){var c=V(e,1)[0];if(1&c){var i;for(r=t[0],i=0;i<r.length;i+=1){var u=mn(t,r,i);a[i]?(a[i].p(u,c),q(a[i],1)):(a[i]=gn(u),a[i].c(),q(a[i],1),a[i].m(n,null))}for(S(),i=r.length;i<a.length;i+=1)o(i);j()}},i:function(t){if(!e){for(var n=0;n<r.length;n+=1)q(a[n]);e=!0}},o:function(t){a=a.filter(Boolean);for(var n=0;n<a.length;n+=1)T(a[n]);e=!1},d:function(t){t&&p(n),z(a,t)}}}function bn(t,n,e){var r,a,c;function o(){return i.apply(this,arguments)}function i(){return(i=tt(b.mark((function t(){var n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!a.updating&&!r.updating){t.next=3;break}return e(0,c=null),t.abrupt("return");case 3:n=a.usnoaa_data_raw.noaa_planetary_k_index_forecast.filter((function(t){return"observed"!==t.observed})),e(0,c=n.map((function(t){return{time:t.time,kp:t.kp,observed:t.observed,temp:null,clouds:null,hasNOMETData:r.available}}))),r.available&&c.forEach((function(t,n){var a,o,i=new Date(0,0,0);r.yr_data_raw.properties.timeseries.forEach((function(n,e){var r=new Date(n.time);Math.abs(r.getTime()-t.time.getTime())<Math.abs(i.getTime()-t.time.getTime())&&(i=r,a=n.data.instant.details.air_temperature,o=n.data.instant.details.cloud_area_fraction)})),e(0,c[n]=Object.assign(Object.assign({},c[n]),{temp:a,clouds:o}),c)}));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return M(t,pt,(function(t){return e(1,r=t)})),M(t,dt,(function(t){return e(2,a=t)})),dt.subscribe(o),pt.subscribe(o),[c]}var _n=function(n){t(s,u);var e=vn(s);function s(t){var n;return r(this,s),n=e.call(this),a(o(n),t,bn,yn,c,{}),n}return i(s)}();function wn(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,c=n(t);if(r){var o=n(this).constructor;a=Reflect.construct(c,arguments,o)}else a=c.apply(this,arguments);return e(this,a)}}function kn(t){var n,e,r,a,c,o,i,u,m,g;return i=new Gt({props:{percentage:t[0]/9,value:t[0]}}),{c:function(){n=s("div"),e=s("div"),r=s("h3"),a=R(t[1]),c=E(),o=s("div"),B(i.$$.fragment),u=E(),m=s("div"),this.h()},l:function(s){n=f(s,"DIV",{class:!0});var d=l(n);e=f(d,"DIV",{class:!0});var h=l(e);r=f(h,"H3",{class:!0});var v=l(r);a=I(v,t[1]),v.forEach(p),h.forEach(p),c=x(d),o=f(d,"DIV",{class:!0});var g=l(o);N(i.$$.fragment,g),g.forEach(p),u=x(d),m=f(d,"DIV",{class:!0}),l(m).forEach(p),d.forEach(p),this.h()},h:function(){d(r,"class","svelte-m9qkku"),d(e,"class","svelte-m9qkku"),d(o,"class","KP svelte-m9qkku"),d(m,"class","data svelte-m9qkku"),d(n,"class","prediction-details svelte-m9qkku")},m:function(t,s){h(t,n,s),v(n,e),v(e,r),v(r,a),v(n,c),v(n,o),A(i,o,null),v(n,u),v(n,m),g=!0},p:function(t,n){V(n,1)[0]},i:function(t){g||(q(i.$$.fragment,t),g=!0)},o:function(t){T(i.$$.fragment,t),g=!1},d:function(t){t&&p(n),C(i)}}}function $n(t){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,e=t,r=0;r<n-t.length;r++)e="0"+e;return e}function En(t,n,e){var r=n.prediction,a=r.kp,c=r.time.getDate()+". "+["January","February","March","April","May","June","July","August","September","October","November","December"][r.time.getMonth()];$n(r.time.getHours().toString()),$n(r.time.getMinutes().toString());var o=r.temp,i=r.clouds;return t.$$set=function(t){"prediction"in t&&e(4,r=t.prediction)},[a,c,o,i,r]}var Dn=function(n){t(s,u);var e=wn(s);function s(t){var n;return r(this,s),n=e.call(this),a(o(n),t,En,kn,c,{prediction:4}),n}return i(s)}();function xn(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,c=n(t);if(r){var o=n(this).constructor;a=Reflect.construct(c,arguments,o)}else a=c.apply(this,arguments);return e(this,a)}}function Rn(t,n,e){var r=t.slice();return r[5]=n[e],r[7]=e,r}function In(t){var n,e;return n=new Dn({props:{prediction:t[5]}}),{c:function(){B(n.$$.fragment)},l:function(t){N(n.$$.fragment,t)},m:function(t,r){A(n,t,r),e=!0},p:function(t,e){var r={};1&e&&(r.prediction=t[5]),n.$set(r)},i:function(t){e||(q(n.$$.fragment,t),e=!0)},o:function(t){T(n.$$.fragment,t),e=!1},d:function(t){C(n,t)}}}function Pn(t){for(var n,e,r=t[0],a=[],c=0;c<r.length;c+=1)a[c]=In(Rn(t,r,c));var o=function(t){return T(a[t],1,1,(function(){a[t]=null}))};return{c:function(){n=s("div");for(var t=0;t<a.length;t+=1)a[t].c();this.h()},l:function(t){n=f(t,"DIV",{class:!0});for(var e=l(n),r=0;r<a.length;r+=1)a[r].l(e);e.forEach(p),this.h()},h:function(){d(n,"class","prediction-table svelte-1uc0m3l")},m:function(t,r){h(t,n,r);for(var c=0;c<a.length;c+=1)a[c].m(n,null);e=!0},p:function(t,e){var c=V(e,1)[0];if(1&c){var i;for(r=t[0],i=0;i<r.length;i+=1){var u=Rn(t,r,i);a[i]?(a[i].p(u,c),q(a[i],1)):(a[i]=In(u),a[i].c(),q(a[i],1),a[i].m(n,null))}for(S(),i=r.length;i<a.length;i+=1)o(i);j()}},i:function(t){if(!e){for(var n=0;n<r.length;n+=1)q(a[n]);e=!0}},o:function(t){a=a.filter(Boolean);for(var n=0;n<a.length;n+=1)T(a[n]);e=!1},d:function(t){t&&p(n),z(a,t)}}}function On(t,n,e){var r,a,c;function o(){return i.apply(this,arguments)}function i(){return(i=tt(b.mark((function t(){var n;return b.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!a.updating&&!r.updating){t.next=3;break}return e(0,c=null),t.abrupt("return");case 3:n=a.usnoaa_data_raw.outlook_27_day.filter((function(t){return t.time>=new Date})),e(0,c=n.map((function(t){return{time:t.time,kp:t.kindex,temp:null,clouds:null,hasNOMETData:r.available}}))),r.available&&c.forEach((function(t,n){var a,o,i=new Date(0,0,0),u=!0;r.yr_data_raw.properties.timeseries.forEach((function(n,e){var r=new Date(n.time);if(Math.abs(r.getTime()-t.time.getTime())<Math.abs(i.getTime()-t.time.getTime())){if(Math.abs(r.getTime()-t.time.getTime())>864e5)return void(u=!1);i=r,a=n.data.instant.details.air_temperature,o=n.data.instant.details.cloud_area_fraction}})),e(0,c[n]=Object.assign(Object.assign({},c[n]),{temp:a,clouds:o,hasNOMETData:u}),c)}));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return M(t,pt,(function(t){return e(1,r=t)})),M(t,dt,(function(t){return e(2,a=t)})),dt.subscribe(o),pt.subscribe(o),[c]}var Vn=function(n){t(s,u);var e=xn(s);function s(t){var n;return r(this,s),n=e.call(this),a(o(n),t,On,Pn,c,{}),n}return i(s)}();function Sn(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,c=n(t);if(r){var o=n(this).constructor;a=Reflect.construct(c,arguments,o)}else a=c.apply(this,arguments);return e(this,a)}}function Tn(t){var n,e,r,a,c;return{c:function(){n=s("div"),e=s("i"),r=E(),a=s("p"),c=R("No prediction data"),this.h()},l:function(t){n=f(t,"DIV",{class:!0});var o=l(n);e=f(o,"I",{class:!0}),l(e).forEach(p),r=x(o),a=f(o,"P",{});var i=l(a);c=I(i,"No prediction data"),i.forEach(p),o.forEach(p),this.h()},h:function(){d(e,"class","fas fa-7x fa-exclamation-triangle"),d(n,"class","no-data svelte-1soiua")},m:function(t,o){h(t,n,o),v(n,e),v(n,r),v(n,a),v(a,c)},p:m,i:m,o:m,d:function(t){t&&p(n)}}}function jn(t){var n,e,r,a,c,o,i,u,m,g,y,b,_,w,k,$,P,O,V,M=t[0];return M&&(k=new M({})),{c:function(){n=s("div"),e=s("h2"),r=R("Forecast"),a=E(),c=s("div"),o=s("div"),i=R("hour"),u=E(),m=s("div"),g=R("3 day"),y=E(),b=s("div"),_=R("Longterm"),w=E(),k&&B(k.$$.fragment),$=D(),this.h()},l:function(t){n=f(t,"DIV",{class:!0});var s=l(n);e=f(s,"H2",{class:!0});var d=l(e);r=I(d,"Forecast"),d.forEach(p),a=x(s),c=f(s,"DIV",{class:!0});var h=l(c);o=f(h,"DIV",{class:!0});var v=l(o);i=I(v,"hour"),v.forEach(p),u=x(h),m=f(h,"DIV",{class:!0});var E=l(m);g=I(E,"3 day"),E.forEach(p),y=x(h),b=f(h,"DIV",{class:!0});var R=l(b);_=I(R,"Longterm"),R.forEach(p),h.forEach(p),s.forEach(p),w=x(t),k&&N(k.$$.fragment,t),$=D(),this.h()},h:function(){d(e,"class","svelte-1soiua"),d(o,"class","svelte-1soiua"),Z(o,"selected",t[0]==on),d(m,"class","svelte-1soiua"),Z(m,"selected",t[0]==_n),d(b,"class","svelte-1soiua"),Z(b,"selected",t[0]==Vn),d(c,"class","version-picker svelte-1soiua"),d(n,"class","header svelte-1soiua")},m:function(s,f){h(s,n,f),v(n,e),v(e,r),v(n,a),v(n,c),v(c,o),v(o,i),v(c,u),v(c,m),v(m,g),v(c,y),v(c,b),v(b,_),h(s,w,f),k&&A(k,s,f),h(s,$,f),P=!0,O||(V=[L(o,"click",t[3]),L(m,"click",t[4]),L(b,"click",t[5])],O=!0)},p:function(t,n){if(1&n&&Z(o,"selected",t[0]==on),1&n&&Z(m,"selected",t[0]==_n),1&n&&Z(b,"selected",t[0]==Vn),M!==(M=t[0])){if(k){S();var e=k;T(e.$$.fragment,1,0,(function(){C(e,1)})),j()}M?(k=new M({}),B(k.$$.fragment),q(k.$$.fragment,1),A(k,$.parentNode,$)):k=null}},i:function(t){P||(k&&q(k.$$.fragment,t),P=!0)},o:function(t){k&&T(k.$$.fragment,t),P=!1},d:function(t){t&&p(n),t&&p(w),t&&p($),k&&C(k,t),O=!1,W(V)}}}function qn(t){var n,e,r,a,c=[jn,Tn],o=[];function i(t,n){return t[1].updating||t[2].updating?1:0}return e=i(t),r=o[e]=c[e](t),{c:function(){n=s("div"),r.c(),this.h()},l:function(t){n=f(t,"DIV",{class:!0});var e=l(n);r.l(e),e.forEach(p),this.h()},h:function(){d(n,"class","drawer svelte-1soiua")},m:function(t,r){h(t,n,r),o[e].m(n,null),a=!0},p:function(t,a){var u=V(a,1)[0],s=e;(e=i(t))===s?o[e].p(t,u):(S(),T(o[s],1,1,(function(){o[s]=null})),j(),(r=o[e])?r.p(t,u):(r=o[e]=c[e](t)).c(),q(r,1),r.m(n,null))},i:function(t){a||(q(r),a=!0)},o:function(t){T(r),a=!1},d:function(t){t&&p(n),o[e].d()}}}function Mn(t,n,e){var r,a;M(t,pt,(function(t){return e(1,r=t)})),M(t,dt,(function(t){return e(2,a=t)}));var c=_n;return[c,r,a,function(){return e(0,c=on)},function(){return e(0,c=_n)},function(){return e(0,c=Vn)}]}var Bn=function(n){t(s,u);var e=Sn(s);function s(t){var n;return r(this,s),n=e.call(this),a(o(n),t,Mn,qn,c,{}),n}return i(s)}();function Nn(t){var r=function(){if("undefined"==typeof Reflect||!Reflect.construct)return!1;if(Reflect.construct.sham)return!1;if("function"==typeof Proxy)return!0;try{return Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],(function(){}))),!0}catch(t){return!1}}();return function(){var a,c=n(t);if(r){var o=n(this).constructor;a=Reflect.construct(c,arguments,o)}else a=c.apply(this,arguments);return e(this,a)}}function An(t){var n,e,r,a,c,o;return r=new Ft({}),c=new Bn({}),{c:function(){n=E(),e=s("div"),B(r.$$.fragment),a=E(),B(c.$$.fragment),this.h()},l:function(t){G('[data-svelte="svelte-1q3846k"]',document.head).forEach(p),n=x(t),e=f(t,"DIV",{class:!0});var o=l(e);N(r.$$.fragment,o),a=x(o),N(c.$$.fragment,o),o.forEach(p),this.h()},h:function(){document.title="Aurora data",d(e,"class","homescreen svelte-pf4p6y")},m:function(t,i){h(t,n,i),h(t,e,i),A(r,e,null),v(e,a),A(c,e,null),o=!0},p:m,i:function(t){o||(q(r.$$.fragment,t),q(c.$$.fragment,t),o=!0)},o:function(t){T(r.$$.fragment,t),T(c.$$.fragment,t),o=!1},d:function(t){t&&p(n),t&&p(e),C(r),C(c)}}}var Cn=function(n){t(s,u);var e=Nn(s);function s(t){var n;return r(this,s),n=e.call(this),a(o(n),t,null,An,c,{}),n}return i(s)}();export{Cn as default};