(window.__LOADABLE_LOADED_CHUNKS__=window.__LOADABLE_LOADED_CHUNKS__||[]).push([[6],{
/***/1:
/***/function(t,e){
/* (ignored) */
/***/},
/***/2:
/***/function(t,e){
/* (ignored) */
/***/},
/***/LRir:
/***/function(t,e,r){"use strict";
// UNUSED EXPORTS: Graph
// EXTERNAL MODULE: /Users/paulcowan/projects/cuttingedge/node_modules/react/jsx-runtime.js
var n=r("jg1C"),a=r("ERkP"),o=r("ieBL"),c=r("xpE9"),i=r("jyTu"),u=r("IQD4"),l=r("QMGZ"),s=r("lbg7"),d=r("gPvS"),f=r("Poh/"),v=r("BQ33"),b=r.n(v),h=r("qfda"),O=r("My6G"),p=r("0fDw"),y=r("qF7a"),j=r("IAlb"),x=r("zCf4"),E=r("daAW"),m=r("8e7h"),g="graph__container",R="graph__links",S="graph__active",D="graph__legend",A="graph__chart",w=function(){return(w=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var a in e=arguments[r])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t}).apply(this,arguments)};
// EXTERNAL MODULE: /Users/paulcowan/projects/cuttingedge/node_modules/react/index.js
e.a=function(t){var e=t.result,r=t.yAxisLabel,v=t.labels,C=t.heading,k=t.xTickFormat,T=void 0===k?function(t,e,r){return e%2===0||e===r.length-1?""+b()(t).format("DD/MM"):""}:k,N=t.yTickFormat,_=void 0===N?function(t){return t}:N,B=Object(x.g)(),Y=Object(a.useRef)(null),L=Object(a.useRef)(null),P="undefined"!==typeof window&&window.screen.availWidth>500,I=Object(o.a)(Y,{debounceDelay:50}),M=I.width,U=I.height,q=Object(o.a)(L,{debounceDelay:50}),G=q.width,Q=q.height;return Object(n.jsx)(h.a,w({heading:C,showFooter:!0},{children:Object(n.jsxs)("div",w({className:g},{children:[Object(n.jsx)("ul",w({className:R},{children:[{url:j.d,text:"Daily increase in deaths (Scotland)"},{url:j.h,text:"Daily increase in deaths (World)"}].map((function(t){return B.pathname===t.url?Object(n.jsx)("li",{children:t.text},t.url):Object(n.jsx)("li",{children:Object(n.jsx)(E.b,w({activeClassName:S,to:t.url,exact:!0},{children:t.text}),void 0)},t.url)}))}),void 0),Object(n.jsx)("div",w({className:D,ref:Y},{children:Object(n.jsx)(p.c,w({height:U,width:M},{children:Object(n.jsx)(c.a,{x:0,y:0,height:U,width:M,centerTitle:P,standalone:!1,orientation:"horizontal",itemsPerRow:P?8:4,gutter:20,style:{labels:{fill:y.a},title:{fill:"#fff"}},data:Object.keys(y.b).filter((function(t){return B.pathname!==j.d||["SCO"].includes(t)})).map((function(t){return{name:y.b[t].longName,symbol:{fill:y.b[t].color}}}))},void 0)}),void 0)}),void 0),Object(n.jsx)("div",w({className:A,ref:L},{children:"undefined"===typeof(null===e||void 0===e?void 0:e.data)?Object(n.jsx)(O.d,{busy:!0,darkMode:!0},void 0):Object(n.jsx)(p.c,w({width:G,height:Q},{children:Object(n.jsxs)(i.a,w({width:G,height:Q,standalone:!1,theme:{axis:{style:{axis:{stroke:y.a},tickLabels:{color:y.a,fill:y.a},grid:{stroke:"#fff",strokeOpacity:.2}}}}},{children:[Object(n.jsx)(u.a,{dependentAxis:!0,label:r+" up until "+b()().subtract(1,"day").format("DD/MM/YYYY"),orientation:"left",standalone:!1,style:{axisLabel:{fill:y.a,fillOpacity:.5}},tickFormat:_},void 0),Object(n.jsx)(u.a,{orientation:"bottom",standalone:!1,style:{tickLabels:{angle:P?45:90,verticalAnchor:"middle",textAnchor:"start"}},tickFormat:T},void 0),Object.keys(e.data).map((function(t){var r,a;Object(m.assert)(null===(r=e.data)||void 0===r?void 0:r[t],"No country data "+t);var o=null===(a=e.data)||void 0===a?void 0:a[t];return Object(n.jsxs)(l.a,w({color:null===o||void 0===o?void 0:o.color,standalone:!1,labels:v,labelComponent:Object(n.jsx)(s.a,{style:{fontSize:15,paddingRight:4},renderInPortal:!1,constrainToVisibleArea:!0,flyoutWidth:200},void 0),data:null===o||void 0===o?void 0:o.data},{children:[Object(n.jsx)(d.a,{interpolation:"natural",style:{data:{strokeWidth:["SCO"].includes(t)?7:2}},standalone:!1},void 0),Object(n.jsx)(f.a,{standalone:!1,size:function(){return["SCO"].includes(t)?7:3}},void 0)]}),t)}))]}),void 0)}),void 0)}),void 0)]}),void 0)}),void 0)}},
/***/Zf9A:
/***/function(t,e,r){"use strict";
/* WEBPACK VAR INJECTION */(function(t){/* harmony export (binding) */r.d(e,"a",(function(){return M}));
/* harmony import */var n=r("2h71"),a=r("zygG"),o=r("VtSi"),c=r.n(o),i=r("ERkP"),u=r("eklX"),l=r("zjfJ"),s=r("rpJ/"),d=r("JHJv"),f=r("Czhu"),v=r("HbGN"),b=r("fN3Q"),h=r("HX+Y"),O=r("5xIM"),p=r.n(O),y=r("k4Rf"),j=r("8e7h"),x=r("fGyu"),E=r("9fIP"),m=r("8K1b"),g=r("AqVP"),R=r("+lMt"),S={type:"START"},D={type:"ABORT"},A=function(t){return{type:"ERROR",error:t}},w=function(t){return{type:"RESET",payload:t}},C=function(t){return{type:"SUCCESS",payload:t}},k=function(t){var e,r,n={data:t.initialState,error:void 0};return Object(s.a)({id:"fetchable",initial:"READY",states:(r={},Object(l.a)(r,"READY",{on:{START:"LOADING"}}),Object(l.a)(r,"LOADING",{on:(e={},Object(l.a)(e,"SUCCESS",{target:"SUCCEEDED",actions:function(t,e){t.data=e.payload}}),Object(l.a)(e,"ERROR",{target:["ERROR"],actions:function(t,e){t.error=e.error}}),Object(l.a)(e,"ABORT",{target:["ABORTED"]}),e)}),Object(l.a)(r,"SUCCEEDED",{on:Object(l.a)({},"RESET",{target:"READY"})}),Object(l.a)(r,"ERROR",{on:Object(l.a)({},"RESET",{target:"READY",actions:function(t,e){return n}})}),Object(l.a)(r,"ABORTED",{on:Object(l.a)({},"RESET",{target:"READY",actions:function(t,e){return n}})}),r)})},T=["initialState","onQueryError","onQuerySuccess","contentType","method"],N=["url"],_=function(t){return JSON.stringify(t)};
/* harmony import */function B(t,e){var r,a={jobs:[],addFetchRequest:function(t){var r,n,a=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},o=a.initialState,c=a.onQueryError,i=a.onQuerySuccess,u=a.contentType,l=void 0===u?"json":u,s=a.method,d=void 0===s?"GET":s,h=Object(v.a)(a,T),O=_(t);if(this.jobs.find((function(t){return t.key===O})))return this;if("string"==typeof t)r=t,n={};else{var p=t;r=p.url,n=Object(v.a)(p,N)}return this.jobs.push({uuid:Object(b.v4)(),key:O,state:"READY",fetch:{request:r,init:Object(f.a)(Object(f.a)({signal:e.signal,method:d,headers:{"Content-Type":"application/".concat(l)}},h),n),contentType:l,initialState:o,onQueryError:c,onQuerySuccess:i}}),this}};if(r=t,!1===Array.isArray(r)&&"function"!=typeof r)a.addFetchRequest(t);else if(Array.isArray(t)){var o,c=Object(n.a)(t);try{for(c.s();!(o=c.n()).done;)a.addFetchRequest(o.value)}catch(i){c.e(i)}finally{c.f()}}else"function"==typeof t&&(a=t(a));return a}var Y="undefined"==typeof window?i.useEffect:i.useLayoutEffect;function L(t){return Array.isArray(t)?function(t,e){return[].concat(Object(x.a)(t),[e])}:function(t,e){return e}}var P=function(){},I=function(t){Object(m.a)(r,t);var e=Object(g.a)(r);function r(){var t,n=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"",a=arguments.length>1?arguments[1]:void 0,o=arguments.length>2?arguments[2]:void 0,c=arguments.length>3?arguments[3]:void 0;return Object(E.a)(this,r),(t=e.call(this,n)).body=void 0,t.bodyParseError=void 0,t.status=void 0,t.status=a,t.body=o,t.bodyParseError=null!=c?c:null,t}return r}(Object(R.a)(Error));function M(t){var e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{},r=e.accumulator,o=e.initialState,l=e.onSuccess,s=void 0===l?y.a:l,f=e.onError,v=void 0===f?console.error:f,b=e.onAbort,O=void 0===b?P:b,x=e.onQuerySuccess,E=void 0===x?y.a:x,m=e.onQueryError,g=void 0===m?P:m,R=e.fetchType,T=void 0===R?"fetch":R,N=e.executeOnMount,_=void 0===N||N,M=e.retryAttempts,U=void 0===M?3:M,q=e.retryDelay,G=void 0===q?500:q,Q=e.timeout,F=void 0===Q?18e4:Q,z=Object(u.a)(k({initialState:o})),J=Object(a.a)(z,2),W=J[0],H=J[1],K=Object(i.useRef)(new AbortController),V=Object(i.useRef)(B(t,K.current)),Z=Object(i.useRef)(0),X=Object(i.useRef)(),$=Object(i.useRef)(0),tt=Object(i.useRef)(null!=F?F:void 0),et=Object(i.useRef)(o),rt=null!=r?r:L(o),nt=Object(i.useCallback)((function(t){O(t),H(D)}),[O,H]),at=Object(i.useCallback)((function(){console.log("aborting at ".concat(W.value)),K.current.abort()}),[K.current,W.value]),ot=Object(i.useCallback)((function(){var e;null===(e=X.current)||void 0===e||e.halt(),Z.current=0,K.current=new AbortController,V.current=B(t,K.current),et.current=o,H(w(o))}),[t,o,H]),ct=Object(i.useCallback)((function(){X.current=Object(d.run)(c.a.mark((function t(e){var r,a,o;return c.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:Z.current+=1,H(S),t.prev=2,r=Object(n.a)(V.current.jobs),t.prev=4,o=c.a.mark((function t(){var r,n,o,i,u,l,s,f,v,b,O,x,m,R;return c.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return o=(n=(r=a.value).fetch).request,i=n.init,u=n.contentType,s=void 0===(l=n.onQuerySuccess)?E:l,v=void 0===(f=n.onQueryError)?g:f,tt.current=F||void 0,e.spawn(c.a.mark((function t(){return c.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if("number"==typeof tt.current){t.next=2;break}return t.abrupt("return");case 2:return t.next=4,Object(d.sleep)(tt.current);case 4:console.log("\nRequest ".concat(o," did not complete in ").concat(tt.current,"ms.\ntimeout is currently ").concat(F," and there are ").concat(V.current.jobs.length," jobs")),K.current.abort();case 6:case"end":return t.stop()}}),t)}))),$.current=U,r.state="LOADING",b="fetch"===T?h.fetch:p.a,t.next=9,b(o,i);case 9:O=t.sent;case 10:if(O.ok||!($.current>0)){t.next=21;break}return t.next=13,Object(d.sleep)(G);case 13:return--$.current,console.log("request ".concat(o," failed, ").concat(O.status,": ").concat(O.statusText," -- retrying")),console.log("retry attempts left ".concat($.current)),t.next=18,b(o,i);case 18:O=t.sent,t.next=10;break;case 21:if(O.ok){t.next=26;break}throw r.state="ERROR",x=new I(O.statusText,O.status,null),v(x),x;case 26:return r.state="SUCCEEDED",t.next=29,O[u]();case 29:if(m=t.sent,Object(j.assert)(void 0!==rt,"no accumulator function present"),R=rt(et.current,m,{request:o,fetcher:b}),!Object(y.c)(R)){t.next=38;break}return t.next=35,R;case 35:t.t0=t.sent,t.next=39;break;case 38:t.t0=R;case 39:et.current=t.t0,s(m);case 41:case"end":return t.stop()}}),t)})),r.s();case 7:if((a=r.n()).done){t.next=11;break}return t.delegateYield(o(),"t0",9);case 9:t.next=7;break;case 11:t.next=16;break;case 13:t.prev=13,t.t1=t.catch(4),r.e(t.t1);case 16:return t.prev=16,r.f(),t.finish(16);case 19:H(C(et.current)),s(et.current),t.next=31;break;case 23:if(t.prev=23,t.t2=t.catch(2),"AbortError"!==(null==t.t2?void 0:t.t2.name)){t.next=28;break}return nt(t.t2),t.abrupt("return");case 28:return v(t.t2),H(A(t.t2)),t.abrupt("return");case 31:return t.prev=31,K.current.abort(),t.finish(31);case 34:case"end":return t.stop()}}),t,null,[[2,23,31,34],[4,13,16,19]])})))}),[H,F,s,E,g,U,T,rt,G,v,nt,K]);Y((function(){return _&&void 0!==ct&&"READY"===W.value&&ct(),function(){var t;["SUCCEEDED","ERROR","ABORTED"].includes(W.value)&&(null===(t=X.current)||void 0===t||t.halt())}}),[_,W.value,ct]);var it=Object(i.useMemo)((function(){switch(W.value){case"READY":return{state:"READY",run:ct,reset:ot,abort:at,data:void 0,error:void 0,counter:Z.current};case"LOADING":return{state:"LOADING",run:ct,reset:ot,abort:at,data:void 0,error:void 0,counter:Z.current};case"SUCCEEDED":return{state:"SUCCEEDED",run:ct,reset:ot,abort:at,data:W.context.data,error:void 0,counter:Z.current};case"ERROR":return{state:"ERROR",error:W.context.error,data:void 0,run:ct,reset:ot,abort:at,counter:Z.current};case"ABORTED":return{state:"ABORTED",data:void 0,error:void 0,run:ct,reset:ot,abort:at,counter:Z.current};default:throw new Error("unknown state ".concat(W.value))}}),[W.value,W.context.data,W.context.error,ct,ot,at]);return it}"undefined"==typeof window&&(t.fetch=r("iDU1"),r("tusI"))}).call(this,r("fRV1"))
/***/},
/***/qF7a:
/***/function(t,e,r){"use strict";
/* harmony export (binding) */r.d(e,"b",(function(){return n})),
/* harmony export (binding) */r.d(e,"a",(function(){return a}));var n={
// DEU: {
//   longName: 'Germany',
//   color: '#038D44',
//   population: 83000000,
// },
TUR:{longName:"Turkey",color:"#038D44",population:82e6},
// FRA: {
//   longName: 'France',
//   color: 'pink',
//   population: 67000000,
// },
ITA:{longName:"Italy",color:"#99ccff",population:6e7},
// BRA: {
//   longName: 'Brazil',
//   color: '#FEDF00',
//   population: 210000000,
// },
IND:{longName:"India",color:"#964B00",population:1366e6},USA:{longName:"USA",color:"#BF0A30",population:383e6},SWE:{longName:"Sweden",color:"#FEDF00",population:11e6},SCO:{longName:"Scotland",color:"#2C67B7",population:555e4},
// ESP: {
//   longName: 'Spain',
//   color: '#00FF00',
//   population: 47000000,
// },
GBR:{longName:"UK",color:"#fff",population:67e6}},a="#fff"},
/***/zju2:
/***/function(t,e,r){"use strict";
/* unused harmony export transform */
/* unused harmony export BreakPoint */
/* harmony export (binding) */r.d(e,"a",(function(){return x}));
/* harmony import */var n=r("qF7a"),a=r("Zf9A"),o=r("BQ33"),c=r.n(o),i=r("k4Rf"),u=r("aPkM"),l=r.n(u),s=r("noK1"),d=r.n(s),f=r("8e7h"),v=r.n(f),b=r("ERkP"),h=function(){return(h=Object.assign||function(t){for(var e,r=1,n=arguments.length;r<n;r++)for(var a in e=arguments[r])Object.prototype.hasOwnProperty.call(e,a)&&(t[a]=e[a]);return t}).apply(this,arguments)},O=function(t,e){var r={};for(var n in t)Object.prototype.hasOwnProperty.call(t,n)&&e.indexOf(n)<0&&(r[n]=t[n]);if(null!=t&&"function"===typeof Object.getOwnPropertySymbols){var a=0;for(n=Object.getOwnPropertySymbols(t);a<n.length;a++)e.indexOf(n[a])<0&&Object.prototype.propertyIsEnumerable.call(t,n[a])&&(r[n[a]]=t[n[a]])}return r},p=function(t,e){var r="function"===typeof Symbol&&t[Symbol.iterator];if(!r)return t;var n,a,o=r.call(t),c=[];try{for(;(void 0===e||e-- >0)&&!(n=o.next()).done;)c.push(n.value)}catch(i){a={error:i}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(a)throw a.error}}return c},y=function(t){var e="function"===typeof Symbol&&Symbol.iterator,r=e&&t[e],n=0;if(r)return r.call(t);if(t&&"number"===typeof t.length)return{next:function(){return t&&n>=t.length&&(t=void 0),{value:t&&t[n++],done:!t}}};throw new TypeError(e?"Object is not iterable.":"Symbol.iterator is not defined.")};
/* harmony import */c.a.extend(l.a);// documenter.getpostman.com/view/2568274/SzS8rjbe?version=latest
var j=function(t,e){var r=t.result.map((function(t,r){var n=t.date,a=t.deaths,o=O(t,["date","deaths"]);return h({x:c.a.utc(n).format(),y:a,index:r,country:e,deaths:a},o)}));return r.map((function(t,e){return h(h({},t),{delta:0===e?0:t.confirmed-r[e-1].confirmed,deltaDeaths:0===e?0:t.y-r[e-1].y})}))},x=function(t){var e,r,o,u,l=(void 0===t?{startDate:"2020-03-01"}:t).startDate,s=p(Object(b.useState)(),2),f=s[0],O=s[1],x=Object.keys(n.b).filter((function(t){return"SCO"!==t})).map((function(t){return d()("https://covidapi.info/api/v1/country",t.toUpperCase(),"timeseries",l,c()().format("YYYY-MM-DD"))})),E=Object(a.a)(x,{accumulator:function(t,e,r){var a=r.request;e.result=Object(i.e)(e.result,(function(t){return t.date})),v()("string"===typeof a,"unexpected request in accumulation context "+a);var o=a.split("/")[6],u=n.b[o];return t[o]={data:j(e,u).filter((function(t,e){return c()().diff(c()(t.x),"d")<=10||e%14===0})),color:u.color,name:u.longName},t},initialState:{},executeOnMount:!0}).data,m=Object(a.a)("https://www.opendata.nhs.scot/api/3/action/datastore_search?resource_id=287fc645-4352-4477-9c8c-55bc054b7e76&limit=1000&sort=Date%20desc",{fetchType:"fetchJsonp",executeOnMount:!0,initialState:{},accumulator:function(t,e){var r,a,o=[];try{for(var c=y(e.result.records.reverse()),i=c.next();!i.done;i=c.next()){var u=i.value,l=u.Date.toString(),s=l.substr(0,4)+"-"+l.substr(4,2)+"-"+l.substr(6,2);o.push({date:s,deaths:u.Deaths,recovered:0,confirmed:u.CumulativeCases})}}catch(d){r={error:d}}finally{try{i&&!i.done&&(a=c.return)&&a.call(c)}finally{if(r)throw r.error}}return t.SCO={data:j({result:o},n.b.SCO),color:n.b.SCO.color,name:n.b.SCO.longName},t}}).data;return Object(b.useEffect)((function(){var t,e,r,n,a;if(!f&&(null===(e=null===(t=null===m||void 0===m?void 0:m.SCO)||void 0===t?void 0:t.data)||void 0===e?void 0:e.length)&&(null===(n=null===(r=null===E||void 0===E?void 0:E.GBR)||void 0===r?void 0:r.data)||void 0===n?void 0:n.length)){var o=(null===(a=null===E||void 0===E?void 0:E.GBR)||void 0===a?void 0:a.data.map((function(t){return t.x})))||[];m.SCO.data=m.SCO.data.filter((function(t){return o.includes(t.x)})),O(h(h({},E),m))}}),[null===(r=null===(e=null===E||void 0===E?void 0:E.GBR)||void 0===e?void 0:e.data)||void 0===r?void 0:r.length,null===(u=null===(o=null===m||void 0===m?void 0:m.SCO)||void 0===o?void 0:o.data)||void 0===u?void 0:u.length]),{data:f}}}}]);
//# sourceMappingURL=7c2fe9ca71d2d4c839914525b72b580d6be96835-493df0b3.de5ea30f.chunk.js.map