1
|
import{_ as t,a as n,b as a,c as e,i as r,s as c,d as o,e as i,S as s,f as u,g as l,h as f,j as d,k as p,l as h,m as v,n as m,w as g,o as w,t as _,p as y,q as b,r as E,u as $,v as k,x as D,y as I,z as P,A as O,B as j,C as x,D as R,E as V,F as B,G as T,H as S,I as C,J as M,K as q,L as N,M as z}from"./client.03ab3887.js";function H(t){var e=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 r,c=n(t);if(e){var o=n(this).constructor;r=Reflect.construct(c,arguments,o)}else r=c.apply(this,arguments);return a(this,r)}}function K(t){var n,a,e,r,c,o,i,s,g;return{c:function(){n=u("div"),a=u("div"),e=u("div"),r=u("div"),c=u("div"),o=u("div"),i=u("div"),s=u("div"),g=u("div"),this.h()},l:function(t){n=l(t,"DIV",{class:!0});var u=f(n);a=l(u,"DIV",{class:!0}),f(a).forEach(d),e=l(u,"DIV",{class:!0}),f(e).forEach(d),r=l(u,"DIV",{class:!0}),f(r).forEach(d),c=l(u,"DIV",{class:!0}),f(c).forEach(d),o=l(u,"DIV",{class:!0}),f(o).forEach(d),i=l(u,"DIV",{class:!0}),f(i).forEach(d),s=l(u,"DIV",{class:!0}),f(s).forEach(d),g=l(u,"DIV",{class:!0}),f(g).forEach(d),u.forEach(d),this.h()},h:function(){p(a,"class","svelte-7k6qu0"),p(e,"class","svelte-7k6qu0"),p(r,"class","svelte-7k6qu0"),p(c,"class","svelte-7k6qu0"),p(o,"class","svelte-7k6qu0"),p(i,"class","svelte-7k6qu0"),p(s,"class","svelte-7k6qu0"),p(g,"class","svelte-7k6qu0"),p(n,"class","lds-roller svelte-7k6qu0")},m:function(t,u){h(t,n,u),v(n,a),v(n,e),v(n,r),v(n,c),v(n,o),v(n,i),v(n,s),v(n,g)},p:m,i:m,o:m,d:function(t){t&&d(n)}}}var A=function(n){t(u,s);var a=H(u);function u(t){var n;return e(this,u),n=a.call(this),r(o(n),t,null,K,c,{}),n}return i(u)}();const J={updated:!1,updating:!0},L=g(Object.assign(Object.assign({},J),{available:!1,longitude:null,latitude:null,city:null})),F=g(Object.assign(Object.assign({},J),{available:!1})),U=g(Object.assign({},J));function Z(t,n=!1){let a=n?{}:{updated:new Date};t.update((t=>Object.assign(Object.assign(Object.assign({},t),a),{updating:n})))}function G(t){var e=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 r,c=n(t);if(e){var o=n(this).constructor;r=Reflect.construct(c,arguments,o)}else r=c.apply(this,arguments);return a(this,r)}}function Q(t){var n,a,e,r,c=t[0].city+"";return{c:function(){n=u("i"),a=w(),e=u("h1"),r=_(c),this.h()},l:function(t){n=l(t,"I",{class:!0}),f(n).forEach(d),a=y(t),e=l(t,"H1",{class:!0});var o=f(e);r=b(o,c),o.forEach(d),this.h()},h:function(){p(n,"class","symbol fas fa-map-marker-alt svelte-9kdo4s"),p(e,"class","svelte-9kdo4s")},m:function(t,c){h(t,n,c),h(t,a,c),h(t,e,c),v(e,r)},p:function(t,n){1&n&&c!==(c=t[0].city+"")&&E(r,c)},d:function(t){t&&d(n),t&&d(a),t&&d(e)}}}function W(t){var n,a;function e(t,a){return 6&a&&(n=null),null==n&&(n=!!(Math.abs(t[1].updated-t[2].updated)>6e5)),n?Y:X}var r=e(t,-1),c=r(t);return{c:function(){c.c(),a=$()},l:function(t){c.l(t),a=$()},m:function(t,n){c.m(t,n),h(t,a,n)},p:function(t,n){r===(r=e(t,n))&&c?c.p(t,n):(c.d(1),(c=r(t))&&(c.c(),c.m(a.parentNode,a)))},d:function(t){c.d(t),t&&d(a)}}}function X(t){var n,a,e=t[1].updated.toLocaleString("no-NO",{dateStyle:"medium",timeStyle:"short"})+"";return{c:function(){n=u("p"),a=_(e)},l:function(t){n=l(t,"P",{});var r=f(n);a=b(r,e),r.forEach(d)},m:function(t,e){h(t,n,e),v(n,a)},p:function(t,n){2&n&&e!==(e=t[1].updated.toLocaleString("no-NO",{dateStyle:"medium",timeStyle:"short"})+"")&&E(a,e)},d:function(t){t&&d(n)}}}function Y(t){var n,a;return{c:function(){n=u("p"),a=_("There is more than 10 minutes difference between data updates")},l:function(t){n=l(t,"P",{});var e=f(n);a=b(e,"There is more than 10 minutes difference between data updates"),e.forEach(d)},m:function(t,e){h(t,n,e),v(n,a)},p:m,d:function(t){t&&d(n)}}}function tt(t){var n,a,e,r,c,o,i,s,g,$,k,D,I=t[2].now.kp+"",P=t[2].now.kp_max+"",O=t[2].now.kp_min+"";return{c:function(){n=u("h2"),a=_("KP "),e=_(I),r=w(),c=u("p"),o=u("span"),i=_("↑ KP "),s=_(P),g=w(),$=u("span"),k=_("↓ KP "),D=_(O),this.h()},l:function(t){n=l(t,"H2",{class:!0});var u=f(n);a=b(u,"KP "),e=b(u,I),u.forEach(d),r=y(t),c=l(t,"P",{});var p=f(c);o=l(p,"SPAN",{classname:!0});var h=f(o);i=b(h,"↑ KP "),s=b(h,P),h.forEach(d),g=y(p),$=l(p,"SPAN",{classname:!0});var v=f($);k=b(v,"↓ KP "),D=b(v,O),v.forEach(d),p.forEach(d),this.h()},h:function(){p(n,"class","svelte-9kdo4s"),p(o,"classname","pr-2"),p($,"classname","pl-2")},m:function(t,u){h(t,n,u),v(n,a),v(n,e),h(t,r,u),h(t,c,u),v(c,o),v(o,i),v(o,s),v(c,g),v(c,$),v($,k),v($,D)},p:function(t,n){4&n&&I!==(I=t[2].now.kp+"")&&E(e,I),4&n&&P!==(P=t[2].now.kp_max+"")&&E(s,P),4&n&&O!==(O=t[2].now.kp_min+"")&&E(D,O)},i:m,o:m,d:function(t){t&&d(n),t&&d(r),t&&d(c)}}}function nt(t){var n,a;return n=new A({}),{c:function(){x(n.$$.fragment)},l:function(t){R(n.$$.fragment,t)},m:function(t,e){V(n,t,e),a=!0},p:m,i:function(t){a||(O(n.$$.fragment,t),a=!0)},o:function(t){I(n.$$.fragment,t),a=!1},d:function(t){B(n,t)}}}function at(t){var n,a,e,r,c,o,i,s,m,g,k,D,I,P,O,j=t[2].now.bz+"",x=t[2].now.bt+"",R=t[1].available&&et(t);return{c:function(){n=u("div"),a=u("p"),e=_("BZ"),r=w(),c=u("p"),o=_(j),i=w(),s=u("div"),m=u("p"),g=_("BT"),k=w(),D=u("p"),I=_(x),P=w(),R&&R.c(),O=$(),this.h()},l:function(t){n=l(t,"DIV",{});var u=f(n);a=l(u,"P",{class:!0});var p=f(a);e=b(p,"BZ"),p.forEach(d),r=y(u),c=l(u,"P",{class:!0});var h=f(c);o=b(h,j),h.forEach(d),u.forEach(d),i=y(t),s=l(t,"DIV",{});var v=f(s);m=l(v,"P",{class:!0});var w=f(m);g=b(w,"BT"),w.forEach(d),k=y(v),D=l(v,"P",{class:!0});var _=f(D);I=b(_,x),_.forEach(d),v.forEach(d),P=y(t),R&&R.l(t),O=$(),this.h()},h:function(){p(a,"class","svelte-9kdo4s"),p(c,"class","svelte-9kdo4s"),p(m,"class","svelte-9kdo4s"),p(D,"class","svelte-9kdo4s")},m:function(t,u){h(t,n,u),v(n,a),v(a,e),v(n,r),v(n,c),v(c,o),h(t,i,u),h(t,s,u),v(s,m),v(m,g),v(s,k),v(s,D),v(D,I),h(t,P,u),R&&R.m(t,u),h(t,O,u)},p:function(t,n){4&n&&j!==(j=t[2].now.bz+"")&&E(o,j),4&n&&x!==(x=t[2].now.bt+"")&&E(I,x),t[1].available?R?R.p(t,n):((R=et(t)).c(),R.m(O.parentNode,O)):R&&(R.d(1),R=null)},d:function(t){t&&d(n),t&&d(i),t&&d(s),t&&d(P),R&&R.d(t),t&&d(O)}}}function et(t){var n,a,e,r,c,o,i,s,m,g,$,k,D,I,P,O=t[1].now.temp+"",j=t[1].now.clouds+"";return{c:function(){n=u("div"),a=u("p"),e=_("Temp"),r=w(),c=u("p"),o=_(O),i=_("°C"),s=w(),m=u("div"),g=u("p"),$=_("Clouds"),k=w(),D=u("p"),I=_(j),P=_("%"),this.h()},l:function(t){n=l(t,"DIV",{});var u=f(n);a=l(u,"P",{class:!0});var p=f(a);e=b(p,"Temp"),p.forEach(d),r=y(u),c=l(u,"P",{class:!0});var h=f(c);o=b(h,O),i=b(h,"°C"),h.forEach(d),u.forEach(d),s=y(t),m=l(t,"DIV",{});var v=f(m);g=l(v,"P",{class:!0});var w=f(g);$=b(w,"Clouds"),w.forEach(d),k=y(v),D=l(v,"P",{class:!0});var _=f(D);I=b(_,j),P=b(_,"%"),_.forEach(d),v.forEach(d),this.h()},h:function(){p(a,"class","svelte-9kdo4s"),p(c,"class","svelte-9kdo4s"),p(g,"class","svelte-9kdo4s"),p(D,"class","svelte-9kdo4s")},m:function(t,u){h(t,n,u),v(n,a),v(a,e),v(n,r),v(n,c),v(c,o),v(c,i),h(t,s,u),h(t,m,u),v(m,g),v(g,$),v(m,k),v(m,D),v(D,I),v(D,P)},p:function(t,n){2&n&&O!==(O=t[1].now.temp+"")&&E(o,O),2&n&&j!==(j=t[1].now.clouds+"")&&E(I,j)},d:function(t){t&&d(n),t&&d(s),t&&d(m)}}}function rt(t){var n,a,e,r,c,o,i,s,m,g,_,b,E=!t[0].updating&&t[0].available&&!t[1].updating&&!t[2].updating&&Q(t),$=!t[1].updating&&!t[2].updating&&W(t),j=[nt,tt],x=[];function R(t,n){return t[2].updating||t[1].updating?0:1}s=R(t),m=x[s]=j[s](t);var V=!t[2].updating&&!t[1].updating&&at(t);return{c:function(){n=u("div"),a=u("div"),e=u("div"),E&&E.c(),r=w(),c=u("div"),$&&$.c(),o=w(),i=u("div"),m.c(),g=w(),_=u("div"),V&&V.c(),this.h()},l:function(t){n=l(t,"DIV",{class:!0});var s=f(n);a=l(s,"DIV",{class:!0});var u=f(a);e=l(u,"DIV",{class:!0});var p=f(e);E&&E.l(p),p.forEach(d),r=y(u),c=l(u,"DIV",{class:!0});var h=f(c);$&&$.l(h),h.forEach(d),o=y(u),i=l(u,"DIV",{class:!0});var v=f(i);m.l(v),v.forEach(d),g=y(u),_=l(u,"DIV",{class:!0});var w=f(_);V&&V.l(w),w.forEach(d),u.forEach(d),s.forEach(d),this.h()},h:function(){p(e,"class","weatherCurrent-data-location svelte-9kdo4s"),p(c,"class","weatherCurrent-data-date"),p(i,"class","weatherCurrent-data-kp svelte-9kdo4s"),p(_,"class","current-details svelte-9kdo4s"),p(a,"class","weatherCurrent-data svelte-9kdo4s"),p(n,"class","weatherCurrent-wrapper svelte-9kdo4s")},m:function(t,u){h(t,n,u),v(n,a),v(a,e),E&&E.m(e,null),v(a,r),v(a,c),$&&$.m(c,null),v(a,o),v(a,i),x[s].m(i,null),v(a,g),v(a,_),V&&V.m(_,null),b=!0},p:function(t,n){var a=k(n,1)[0];t[0].updating||!t[0].available||t[1].updating||t[2].updating?E&&(E.d(1),E=null):E?E.p(t,a):((E=Q(t)).c(),E.m(e,null)),t[1].updating||t[2].updating?$&&($.d(1),$=null):$?$.p(t,a):(($=W(t)).c(),$.m(c,null));var r=s;(s=R(t))===r?x[s].p(t,a):(D(),I(x[r],1,1,(function(){x[r]=null})),P(),(m=x[s])?m.p(t,a):(m=x[s]=j[s](t)).c(),O(m,1),m.m(i,null)),t[2].updating||t[1].updating?V&&(V.d(1),V=null):V?V.p(t,a):((V=at(t)).c(),V.m(_,null))},i:function(t){b||(O(m),b=!0)},o:function(t){I(m),b=!1},d:function(t){t&&d(n),E&&E.d(),$&&$.d(),x[s].d(),V&&V.d()}}}function ct(t,n,a){var e,r,c;return j(t,L,(function(t){return a(0,e=t)})),j(t,F,(function(t){return a(1,r=t)})),j(t,U,(function(t){return a(2,c=t)})),[e,r,c]}!async function(){if("undefined"==typeof window)return;let t;Z(L,!0);try{t=await async function(){return new Promise(((t,n)=>{"undefined"!=typeof navigator?navigator.geolocation.getCurrentPosition((n=>{t({longitude:n.coords.longitude,latitude:n.coords.latitude})}),(t=>{n(t)})):n(Error())}))}()}catch(t){return console.log(t),L.update((t=>Object.assign(Object.assign({},t),{available:!1,city:null,longitude:null,latitude:null}))),void Z(L,!1)}let n=await fetch(`https://geocode.xyz/${t.latitude},${t.longitude}?geoit=json`),a=await n.json();L.update((n=>Object.assign(Object.assign(Object.assign({},n),{available:!0,city:a.city}),t))),Z(L,!1)}(),L.subscribe((async function(t=null){if("undefined"==typeof window)return;if(null===t)return;if(t.updating)return;if(!t.available)return F.update((t=>Object.assign(Object.assign({},t),{available:!1}))),void Z(F,!1);Z(F,!0);let n=await fetch(`https://api.met.no/weatherapi/locationforecast/2.0/compact?lat=${t.latitude}&lon=${t.longitude}`),a=await n.json(),e={clouds:null,temp:null};try{e.clouds=a.properties.timeseries[0].data.instant.details.cloud_area_fraction,e.temp=a.properties.timeseries[0].data.instant.details.air_temperature,a.properties.timeseries=a.properties.timeseries.map((t=>Object.assign(Object.assign({},t),{time:new Date(t.time)})))}catch(t){}F.update((t=>Object.assign(Object.assign({},t),{yr_data_raw:a,now:e,available:!0}))),Z(F,!1)})),async function(){if("undefined"==typeof window)return;Z(U,!0);let t=await async function(){let t={now:{bz:"-",bt:"-",kp:"-",kp_min:"-",kp_max:"-"},usnoaa_data_raw:{solar_wind_mag_field:!1,noaa_planetary_k_index_forecast:!1}},n=await fetch("https://services.swpc.noaa.gov/products/summary/solar-wind-mag-field.json");t.usnoaa_data_raw.solar_wind_mag_field=await n.json(),t.usnoaa_data_raw.solar_wind_mag_field.TimeStamp=new Date(t.usnoaa_data_raw.solar_wind_mag_field.TimeStamp+" UTC"),t.now.bz=t.usnoaa_data_raw.solar_wind_mag_field.Bz,t.now.bt=t.usnoaa_data_raw.solar_wind_mag_field.Bt,n=await fetch("https://services.swpc.noaa.gov/products/noaa-planetary-k-index-forecast.json"),t.usnoaa_data_raw.noaa_planetary_k_index_forecast=await n.json(),t.usnoaa_data_raw.noaa_planetary_k_index_forecast.shift();let a=new Date,e=new Date(0,0,0),r=1e3,c=0;return t.usnoaa_data_raw.noaa_planetary_k_index_forecast.forEach(((n,o)=>{n[1]>c&&(c=n[1]),n[1]<r&&(r=n[1]);let i=new Date(n[0]+" UTC");Math.abs(i.getTime()-a.getTime())<Math.abs(e.getTime()-a.getTime())&&(e=i,t.now.kp=n[1]),t.usnoaa_data_raw.noaa_planetary_k_index_forecast[o]={time:i,kp:n[1],observed:n[2]}})),t.now.kp_min=r.toString(),t.now.kp_max=c.toString(),console.log(t),t}();U.update((n=>Object.assign(Object.assign({},n),t))),Z(U,!1)}();var ot=function(n){t(u,s);var a=G(u);function u(t){var n;return e(this,u),n=a.call(this),r(o(n),t,ct,rt,c,{}),n}return i(u)}();function it(t,n,a,e,r,c,o){try{var i=t[c](o),s=i.value}catch(t){return void a(t)}i.done?n(s):Promise.resolve(s).then(e,r)}function st(t){return function(){var n=this,a=arguments;return new Promise((function(e,r){var c=t.apply(n,a);function o(t){it(c,e,r,o,i,"next",t)}function i(t){it(c,e,r,o,i,"throw",t)}o(void 0)}))}}function ut(t){var e=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 r,c=n(t);if(e){var o=n(this).constructor;r=Reflect.construct(c,arguments,o)}else r=c.apply(this,arguments);return a(this,r)}}function lt(t){var n,a,e=t[1].default,r=T(e,t,t[0],null);return{c:function(){n=u("div"),r&&r.c(),this.h()},l:function(t){n=l(t,"DIV",{class:!0});var a=f(n);r&&r.l(a),a.forEach(d),this.h()},h:function(){p(n,"class","chip svelte-6dfxfp")},m:function(t,e){h(t,n,e),r&&r.m(n,null),a=!0},p:function(t,n){var c=k(n,1)[0];r&&r.p&&(!a||1&c)&&S(r,e,t,t[0],a?M(e,t[0],c,null):C(t[0]),null)},i:function(t){a||(O(r,t),a=!0)},o:function(t){I(r,t),a=!1},d:function(t){t&&d(n),r&&r.d(t)}}}function ft(t,n,a){var e=n.$$slots,r=void 0===e?{}:e,c=n.$$scope;return t.$$set=function(t){"$$scope"in t&&a(0,c=t.$$scope)},[c,r]}var dt=function(n){t(u,s);var a=ut(u);function u(t){var n;return e(this,u),n=a.call(this),r(o(n),t,ft,lt,c,{}),n}return i(u)}();function pt(t){var e=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 r,c=n(t);if(e){var o=n(this).constructor;r=Reflect.construct(c,arguments,o)}else r=c.apply(this,arguments);return a(this,r)}}function ht(t){var n,a,e;return a=new dt({props:{$$slots:{default:[vt]},$$scope:{ctx:t}}}),{c:function(){n=u("div"),x(a.$$.fragment),this.h()},l:function(t){n=l(t,"DIV",{class:!0});var e=f(n);R(a.$$.fragment,e),e.forEach(d),this.h()},h:function(){p(n,"class","svelte-ghmp86")},m:function(t,r){h(t,n,r),V(a,n,null),e=!0},p:function(t,n){var e={};257&n&&(e.$$scope={dirty:n,ctx:t}),a.$set(e)},i:function(t){e||(O(a.$$.fragment,t),e=!0)},o:function(t){I(a.$$.fragment,t),e=!1},d:function(t){t&&d(n),B(a)}}}function vt(t){var n,a=t[0].observed+"";return{c:function(){n=_(a)},l:function(t){n=b(t,a)},m:function(t,a){h(t,n,a)},p:function(t,e){1&e&&a!==(a=t[0].observed+"")&&E(n,a)},d:function(t){t&&d(n)}}}function mt(t){var n,a,e,r,c,o,i,s,g,E,$,j,x,R,V="predicted"!=t[0].observed&&ht(t),B=t[6]&&function(t){var n,a,e,r,c,o,i,s,g,E,$,k,D=Math.round(t[4])+"",I=Math.round(t[5])+"";return{c:function(){n=u("div"),a=u("p"),e=u("i"),r=w(),c=_(D),o=_("°C"),i=w(),s=u("p"),g=u("i"),E=w(),$=_(I),k=_("%"),this.h()},l:function(t){n=l(t,"DIV",{class:!0});var u=f(n);a=l(u,"P",{class:!0});var p=f(a);e=l(p,"I",{class:!0}),f(e).forEach(d),r=y(p),c=b(p,D),o=b(p,"°C"),p.forEach(d),i=y(u),s=l(u,"P",{class:!0});var h=f(s);g=l(h,"I",{class:!0}),f(g).forEach(d),E=y(h),$=b(h,I),k=b(h,"%"),h.forEach(d),u.forEach(d),this.h()},h:function(){p(e,"class","fas fa-thermometer-half svelte-ghmp86"),p(a,"class","svelte-ghmp86"),p(g,"class","fas fa-cloud svelte-ghmp86"),p(s,"class","svelte-ghmp86"),p(n,"class","svelte-ghmp86")},m:function(t,u){h(t,n,u),v(n,a),v(a,e),v(a,r),v(a,c),v(a,o),v(n,i),v(n,s),v(s,g),v(s,E),v(s,$),v(s,k)},p:m,d:function(t){t&&d(n)}}}(t);return{c:function(){n=u("div"),a=u("div"),e=u("h3"),r=_(t[3]),c=w(),o=u("p"),i=_(t[2]),s=w(),V&&V.c(),g=w(),E=u("div"),$=u("h2"),j=_(t[1]),x=w(),B&&B.c(),this.h()},l:function(u){n=l(u,"DIV",{class:!0});var p=f(n);a=l(p,"DIV",{class:!0});var h=f(a);e=l(h,"H3",{class:!0});var v=f(e);r=b(v,t[3]),v.forEach(d),c=y(h),o=l(h,"P",{class:!0});var m=f(o);i=b(m,t[2]),m.forEach(d),h.forEach(d),s=y(p),V&&V.l(p),g=y(p),E=l(p,"DIV",{class:!0});var w=f(E);$=l(w,"H2",{class:!0});var _=f($);j=b(_,t[1]),_.forEach(d),x=y(w),B&&B.l(w),w.forEach(d),p.forEach(d),this.h()},h:function(){p(e,"class","svelte-ghmp86"),p(o,"class","svelte-ghmp86"),p(a,"class","svelte-ghmp86"),p($,"class","svelte-ghmp86"),p(E,"class","data svelte-ghmp86"),p(n,"class","prediction-details svelte-ghmp86")},m:function(t,u){h(t,n,u),v(n,a),v(a,e),v(e,r),v(a,c),v(a,o),v(o,i),v(n,s),V&&V.m(n,null),v(n,g),v(n,E),v(E,$),v($,j),v(E,x),B&&B.m(E,null),R=!0},p:function(t,a){var e=k(a,1)[0];"predicted"!=t[0].observed?V?(V.p(t,e),1&e&&O(V,1)):((V=ht(t)).c(),O(V,1),V.m(n,g)):V&&(D(),I(V,1,1,(function(){V=null})),P()),t[6]&&B.p(t,e)},i:function(t){R||(O(V),R=!0)},o:function(t){I(V),R=!1},d:function(t){t&&d(n),V&&V.d(),B&&B.d()}}}function gt(t){for(var n=arguments.length>1&&void 0!==arguments[1]?arguments[1]:2,a=t,e=0;e<n-t.length;e++)a="0"+a;return a}function wt(t,n,a){var e=n.prediction,r=e.kp,c=e.time.getDate()+". "+["January","February","March","April","May","June","July","August","September","October","November","December"][e.time.getMonth()],o=gt(e.time.getHours().toString())+":"+gt(e.time.getMinutes().toString()),i=e.temp,s=e.clouds,u=e.hasNOMETData;return t.$$set=function(t){"prediction"in t&&a(0,e=t.prediction)},[e,r,c,o,i,s,u]}var _t=function(n){t(u,s);var a=pt(u);function u(t){var n;return e(this,u),n=a.call(this),r(o(n),t,wt,mt,c,{prediction:0}),n}return i(u)}();function yt(t){var e=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 r,c=n(t);if(e){var o=n(this).constructor;r=Reflect.construct(c,arguments,o)}else r=c.apply(this,arguments);return a(this,r)}}function bt(t,n,a){var e=t.slice();return e[5]=n[a],e[7]=a,e}function Et(t){var n,a,e,r,c;return{c:function(){n=u("div"),a=u("i"),e=w(),r=u("p"),c=_("No prediction data"),this.h()},l:function(t){n=l(t,"DIV",{class:!0});var o=f(n);a=l(o,"I",{class:!0}),f(a).forEach(d),e=y(o),r=l(o,"P",{});var i=f(r);c=b(i,"No prediction data"),i.forEach(d),o.forEach(d),this.h()},h:function(){p(a,"class","fas fa-7x fa-exclamation-triangle"),p(n,"class","no-data svelte-1romtap")},m:function(t,o){h(t,n,o),v(n,a),v(n,e),v(n,r),v(r,c)},p:m,i:m,o:m,d:function(t){t&&d(n)}}}function $t(t){for(var n,a,e,r,c,o,i=t[0],s=[],m=0;m<i.length;m+=1)s[m]=kt(bt(t,i,m));var g=function(t){return I(s[t],1,1,(function(){s[t]=null}))};return{c:function(){n=u("div"),a=u("h2"),e=_("Predicted"),r=w(),c=u("div");for(var t=0;t<s.length;t+=1)s[t].c();this.h()},l:function(t){n=l(t,"DIV",{classname:!0});var o=f(n);a=l(o,"H2",{class:!0});var i=f(a);e=b(i,"Predicted"),i.forEach(d),o.forEach(d),r=y(t),c=l(t,"DIV",{class:!0});for(var u=f(c),p=0;p<s.length;p+=1)s[p].l(u);u.forEach(d),this.h()},h:function(){p(a,"class","svelte-1romtap"),p(n,"classname","flex flex-row justify-between items-top"),p(c,"class","prediction-table svelte-1romtap")},m:function(t,i){h(t,n,i),v(n,a),v(a,e),h(t,r,i),h(t,c,i);for(var u=0;u<s.length;u+=1)s[u].m(c,null);o=!0},p:function(t,n){if(1&n){var a;for(i=t[0],a=0;a<i.length;a+=1){var e=bt(t,i,a);s[a]?(s[a].p(e,n),O(s[a],1)):(s[a]=kt(e),s[a].c(),O(s[a],1),s[a].m(c,null))}for(D(),a=i.length;a<s.length;a+=1)g(a);P()}},i:function(t){if(!o){for(var n=0;n<i.length;n+=1)O(s[n]);o=!0}},o:function(t){s=s.filter(Boolean);for(var n=0;n<s.length;n+=1)I(s[n]);o=!1},d:function(t){t&&d(n),t&&d(r),t&&d(c),N(s,t)}}}function kt(t){var n,a;return n=new _t({props:{prediction:t[5]}}),{c:function(){x(n.$$.fragment)},l:function(t){R(n.$$.fragment,t)},m:function(t,e){V(n,t,e),a=!0},p:function(t,a){var e={};1&a&&(e.prediction=t[5]),n.$set(e)},i:function(t){a||(O(n.$$.fragment,t),a=!0)},o:function(t){I(n.$$.fragment,t),a=!1},d:function(t){B(n,t)}}}function Dt(t){var n,a,e,r,c=[$t,Et],o=[];function i(t,n){return t[0]?0:1}return a=i(t),e=o[a]=c[a](t),{c:function(){n=u("div"),e.c(),this.h()},l:function(t){n=l(t,"DIV",{class:!0});var a=f(n);e.l(a),a.forEach(d),this.h()},h:function(){p(n,"class","predicted-weather svelte-1romtap")},m:function(t,e){h(t,n,e),o[a].m(n,null),r=!0},p:function(t,r){var s=k(r,1)[0],u=a;(a=i(t))===u?o[a].p(t,s):(D(),I(o[u],1,1,(function(){o[u]=null})),P(),(e=o[a])?e.p(t,s):(e=o[a]=c[a](t)).c(),O(e,1),e.m(n,null))},i:function(t){r||(O(e),r=!0)},o:function(t){I(e),r=!1},d:function(t){t&&d(n),o[a].d()}}}function It(t,n,a){var e,r,c;function o(){return i.apply(this,arguments)}function i(){return(i=st(q.mark((function t(){var n;return q.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(!r.updating&&!e.updating){t.next=3;break}return a(0,c=null),t.abrupt("return");case 3:n=r.usnoaa_data_raw.noaa_planetary_k_index_forecast.filter((function(t){return"observed"!==t.observed})),a(0,c=n.map((function(t){return{time:t.time,kp:t.kp,observed:t.observed,temp:null,clouds:null,hasNOMETData:e.available}}))),e.available&&c.forEach((function(t,n){var r,o,i=new Date(0,0,0);e.yr_data_raw.properties.timeseries.forEach((function(n,a){var e=new Date(n.time);Math.abs(e.getTime()-t.time.getTime())<Math.abs(i.getTime()-t.time.getTime())&&(i=e,r=n.data.instant.details.air_temperature,o=n.data.instant.details.cloud_area_fraction)})),a(0,c[n]=Object.assign(Object.assign({},c[n]),{temp:r,clouds:o}),c)}));case 6:case"end":return t.stop()}}),t)})))).apply(this,arguments)}return j(t,F,(function(t){return a(1,e=t)})),j(t,U,(function(t){return a(2,r=t)})),U.subscribe(o),F.subscribe(o),[c]}var Pt=function(n){t(u,s);var a=yt(u);function u(t){var n;return e(this,u),n=a.call(this),r(o(n),t,It,Dt,c,{}),n}return i(u)}();function Ot(t){var e=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 r,c=n(t);if(e){var o=n(this).constructor;r=Reflect.construct(c,arguments,o)}else r=c.apply(this,arguments);return a(this,r)}}function jt(t){var n,a,e,r,c,o;return e=new ot({}),c=new Pt({}),{c:function(){n=w(),a=u("div"),x(e.$$.fragment),r=w(),x(c.$$.fragment),this.h()},l:function(t){z('[data-svelte="svelte-1q3846k"]',document.head).forEach(d),n=y(t),a=l(t,"DIV",{class:!0});var o=f(a);R(e.$$.fragment,o),r=y(o),R(c.$$.fragment,o),o.forEach(d),this.h()},h:function(){document.title="Aurora data",p(a,"class","homescreen svelte-pf4p6y")},m:function(t,i){h(t,n,i),h(t,a,i),V(e,a,null),v(a,r),V(c,a,null),o=!0},p:m,i:function(t){o||(O(e.$$.fragment,t),O(c.$$.fragment,t),o=!0)},o:function(t){I(e.$$.fragment,t),I(c.$$.fragment,t),o=!1},d:function(t){t&&d(n),t&&d(a),B(e),B(c)}}}var xt=function(n){t(u,s);var a=Ot(u);function u(t){var n;return e(this,u),n=a.call(this),r(o(n),t,null,jt,c,{}),n}return i(u)}();export{xt as default};
|