diff --git a/ss_huge_refactor_pt1/assets/About-1496adf6.js b/ss_huge_refactor_pt1/assets/About-a465dc1b.js similarity index 98% rename from ss_huge_refactor_pt1/assets/About-1496adf6.js rename to ss_huge_refactor_pt1/assets/About-a465dc1b.js index e0e59a77..c0b701fc 100644 --- a/ss_huge_refactor_pt1/assets/About-1496adf6.js +++ b/ss_huge_refactor_pt1/assets/About-a465dc1b.js @@ -1,4 +1,4 @@ -import{S as Me,i as We,s as Le,O as je,P as z,e as h,Q as Se,k as _,x as Be,T as De,U as Re,V as Ue,W as Ye,t as m,o as g,p as d,X as Ce,Y as qe,aQ as Ee,b as Ge,c as Oe,h as b,m as k,n as Qe,q as w,b0 as x,v as o,f as A,j as Ie,l as a}from"./index-4a1c3090.js";function Xe(s){let e,t,l,$;const c=s[2].default,r=je(c,s,s[1],null);let i=[{type:"button"},{class:"govuk-button"},{"data-module":"govuk-button"},s[0]],v={};for(let f=0;f{t(0,e=z(z({},e),Ce(r))),"$$scope"in r&&t(1,$=r.$$scope)},e=Ce(e),[e,$,l,c]}class ft extends Me{constructor(e){super(),We(this,e,ze,Xe,Le,{})}}function He(s){let e;return{c(){e=o("open source project")},m(t,l){_(t,e,l)},d(t){t&&d(e)}}}function Je(s){let e;return{c(){e=o(`Dustin Carlino +import{S as Me,i as We,s as Le,O as je,P as z,e as h,Q as Se,k as _,x as Be,T as De,U as Re,V as Ue,W as Ye,t as m,o as g,p as d,X as Ce,Y as qe,aQ as Ee,b as Ge,c as Oe,h as b,m as k,n as Qe,q as w,b0 as x,v as o,f as A,j as Ie,l as a}from"./index-a43921db.js";function Xe(s){let e,t,l,$;const c=s[2].default,r=je(c,s,s[1],null);let i=[{type:"button"},{class:"govuk-button"},{"data-module":"govuk-button"},s[0]],v={};for(let f=0;f{t(0,e=z(z({},e),Ce(r))),"$$scope"in r&&t(1,$=r.$$scope)},e=Ce(e),[e,$,l,c]}class ft extends Me{constructor(e){super(),We(this,e,ze,Xe,Le,{})}}function He(s){let e;return{c(){e=o("open source project")},m(t,l){_(t,e,l)},d(t){t&&d(e)}}}function Je(s){let e;return{c(){e=o(`Dustin Carlino `)},m(t,l){_(t,e,l)},d(t){t&&d(e)}}}function Ve(s){let e;return{c(){e=o("Peter York")},m(t,l){_(t,e,l)},d(t){t&&d(e)}}}function Fe(s){let e;return{c(){e=o("Madison Wang")},m(t,l){_(t,e,l)},d(t){t&&d(e)}}}function Ke(s){let e;return{c(){e=o(`Stuart Lynn `)},m(t,l){_(t,e,l)},d(t){t&&d(e)}}}function Ne(s){let e;return{c(){e=o("Ben Ritter")},m(t,l){_(t,e,l)},d(t){t&&d(e)}}}function Ze(s){let e;return{c(){e=o("OpenStreetMap")},m(t,l){_(t,e,l)},d(t){t&&d(e)}}}function ye(s){let e;return{c(){e=o("MapLibre")},m(t,l){_(t,e,l)},d(t){t&&d(e)}}}function et(s){let e;return{c(){e=o(`svelte-maplibre `)},m(t,l){_(t,e,l)},d(t){t&&d(e)}}}function tt(s){let e;return{c(){e=o("GeoRust")},m(t,l){_(t,e,l)},d(t){t&&d(e)}}}function nt(s){let e;return{c(){e=o(`osm2streets diff --git a/ss_huge_refactor_pt1/assets/Popup-0181ae79.js b/ss_huge_refactor_pt1/assets/Popup-8f6f85cd.js similarity index 94% rename from ss_huge_refactor_pt1/assets/Popup-0181ae79.js rename to ss_huge_refactor_pt1/assets/Popup-8f6f85cd.js index 541624f4..39ee0be0 100644 --- a/ss_huge_refactor_pt1/assets/Popup-0181ae79.js +++ b/ss_huge_refactor_pt1/assets/Popup-8f6f85cd.js @@ -1 +1 @@ -import{S as i,i as _,s as c,aE as m,h as g,m as d,t as r,o as f,q as C,O,e as h,j as $,k as v,T as P,U as k,V as q,p as S}from"./index-4a1c3090.js";const T=n=>({props:n&16}),l=n=>({props:w(n[4])});function b(n){let o,a;const e=n[2].default,t=O(e,n,n[3],l);return{c(){o=h("div"),t&&t.c(),$(o,"class","govuk-prose")},m(s,p){v(s,o,p),t&&t.m(o,null),a=!0},p(s,p){t&&t.p&&(!a||p&24)&&P(t,e,s,s[3],a?q(e,s[3],p,T):k(s[3]),l)},i(s){a||(r(t,s),a=!0)},o(s){f(t,s),a=!1},d(s){s&&S(o),t&&t.d(s)}}}function j(n){let o,a;return o=new m({props:{openOn:n[0],popupClass:n[1],openIfTopMost:!0,$$slots:{default:[b,({features:e})=>({4:e}),({features:e})=>e?16:0]},$$scope:{ctx:n}}}),{c(){g(o.$$.fragment)},m(e,t){d(o,e,t),a=!0},p(e,[t]){const s={};t&1&&(s.openOn=e[0]),t&2&&(s.popupClass=e[1]),t&24&&(s.$$scope={dirty:t,ctx:e}),o.$set(s)},i(e){a||(r(o.$$.fragment,e),a=!0)},o(e){f(o.$$.fragment,e),a=!1},d(e){C(o,e)}}}function w(n){return n?n[0].properties??{}:{}}function E(n,o,a){let{$$slots:e={},$$scope:t}=o,{openOn:s="hover"}=o,{popupClass:p=void 0}=o;return n.$$set=u=>{"openOn"in u&&a(0,s=u.openOn),"popupClass"in u&&a(1,p=u.popupClass),"$$scope"in u&&a(3,t=u.$$scope)},[s,p,e,t]}class M extends i{constructor(o){super(),_(this,o,E,j,c,{openOn:0,popupClass:1})}}export{M as P}; +import{S as i,i as _,s as c,aE as m,h as g,m as d,t as r,o as f,q as C,O,e as h,j as $,k as v,T as P,U as k,V as q,p as S}from"./index-a43921db.js";const T=n=>({props:n&16}),l=n=>({props:w(n[4])});function b(n){let o,a;const e=n[2].default,t=O(e,n,n[3],l);return{c(){o=h("div"),t&&t.c(),$(o,"class","govuk-prose")},m(s,p){v(s,o,p),t&&t.m(o,null),a=!0},p(s,p){t&&t.p&&(!a||p&24)&&P(t,e,s,s[3],a?q(e,s[3],p,T):k(s[3]),l)},i(s){a||(r(t,s),a=!0)},o(s){f(t,s),a=!1},d(s){s&&S(o),t&&t.d(s)}}}function j(n){let o,a;return o=new m({props:{openOn:n[0],popupClass:n[1],openIfTopMost:!0,$$slots:{default:[b,({features:e})=>({4:e}),({features:e})=>e?16:0]},$$scope:{ctx:n}}}),{c(){g(o.$$.fragment)},m(e,t){d(o,e,t),a=!0},p(e,[t]){const s={};t&1&&(s.openOn=e[0]),t&2&&(s.popupClass=e[1]),t&24&&(s.$$scope={dirty:t,ctx:e}),o.$set(s)},i(e){a||(r(o.$$.fragment,e),a=!0)},o(e){f(o.$$.fragment,e),a=!1},d(e){C(o,e)}}}function w(n){return n?n[0].properties??{}:{}}function E(n,o,a){let{$$slots:e={},$$scope:t}=o,{openOn:s="hover"}=o,{popupClass:p=void 0}=o;return n.$$set=u=>{"openOn"in u&&a(0,s=u.openOn),"popupClass"in u&&a(1,p=u.popupClass),"$$scope"in u&&a(3,t=u.$$scope)},[s,p,e,t]}class M extends i{constructor(o){super(),_(this,o,E,j,c,{openOn:0,popupClass:1})}}export{M as P}; diff --git a/ss_huge_refactor_pt1/assets/ZoomOutMap-2095bbd6.js b/ss_huge_refactor_pt1/assets/ZoomOutMap-cd8a62cd.js similarity index 56% rename from ss_huge_refactor_pt1/assets/ZoomOutMap-2095bbd6.js rename to ss_huge_refactor_pt1/assets/ZoomOutMap-cd8a62cd.js index edef844c..a68333a9 100644 --- a/ss_huge_refactor_pt1/assets/ZoomOutMap-2095bbd6.js +++ b/ss_huge_refactor_pt1/assets/ZoomOutMap-cd8a62cd.js @@ -1,3 +1,3 @@ -import{S as K,i as Q,s as J,O as ye,e as T,j as c,k as B,T as be,U as ve,V as ke,t as S,o as F,p as I,l as P,f as j,av as st,x as W,N as Oe,bb as Mn,K as Nt,Y as le,v as de,J as Pe,F as Pn,h as x,m as $,q as ee,E as Cn,ai as Ke,a5 as Ue,bc as Sn,bd as vt,as as Tn,be as zn,w as Ze,a2 as En,aR as Rn,bf as Bn,bg as In,b as Je,c as ut,n as ft,r as Me,aS as kt,bh as _e,a4 as H,bi as Le,a3 as ne,b1 as Qe,bj as Fn,a6 as Te,a7 as ze,ag as ct,aa as dt,bk as On,aj as Gn,ak as An,a$ as qt,u as Zn,bl as Un,b3 as Wt,au as wt,am as Nn,a as mt,R as qn,aF as pt,aG as He,aI as Wn,aL as Lt,aN as Fe,aO as Vt,aK as Ie,b2 as Dt,a8 as Ht,af as Vn,bm as Mt,bn as ot,bo as Dn,bp as Hn,ac as Pt}from"./index-4a1c3090.js";function Kn(n){let e,t;const r=n[1].default,i=ye(r,n,n[0],null);return{c(){e=T("div"),i&&i.c(),c(e,"class","govuk-button-group")},m(l,o){B(l,e,o),i&&i.m(e,null),t=!0},p(l,[o]){i&&i.p&&(!t||o&1)&&be(i,r,l,l[0],t?ke(r,l[0],o,null):ve(l[0]),null)},i(l){t||(S(i,l),t=!0)},o(l){F(i,l),t=!1},d(l){l&&I(e),i&&i.d(l)}}}function Qn(n,e,t){let{$$slots:r={},$$scope:i}=e;return n.$$set=l=>{"$$scope"in l&&t(0,i=l.$$scope)},[i,r]}class Vi extends K{constructor(e){super(),Q(this,e,Qn,Kn,J,{})}}function Jn(n){let e,t,r;const i=n[3].default,l=ye(i,n,n[2],null);return{c(){e=T("fieldset"),t=T("div"),l&&l.c(),c(t,"class",n[0]),c(t,"data-module","govuk-checkboxes"),c(e,"class","govuk-fieldset")},m(o,s){B(o,e,s),P(e,t),l&&l.m(t,null),r=!0},p(o,[s]){l&&l.p&&(!r||s&4)&&be(l,i,o,o[2],r?ke(i,o[2],s,null):ve(o[2]),null)},i(o){r||(S(l,o),r=!0)},o(o){F(l,o),r=!1},d(o){o&&I(e),l&&l.d(o)}}}function Yn(n,e,t){let{$$slots:r={},$$scope:i}=e,{small:l=!1}=e,o=l?"govuk-checkboxes--small":"govuk-checkboxes";return n.$$set=s=>{"small"in s&&t(1,l=s.small),"$$scope"in s&&t(2,i=s.$$scope)},[o,l,i,r]}class Di extends K{constructor(e){super(),Q(this,e,Yn,Jn,J,{small:1})}}const Xn=n=>({}),Ct=n=>({});function jn(n){let e,t,r,i,l,o,s,a,f;const u=n[5].default,g=ye(u,n,n[4],null),_=n[5].right,m=ye(_,n,n[4],Ct);return{c(){e=T("div"),t=T("input"),r=j(),i=T("label"),g&&g.c(),l=j(),o=T("span"),m&&m.c(),c(t,"type","checkbox"),c(t,"class","govuk-checkboxes__input"),c(t,"id",n[3]),c(i,"class","govuk-label govuk-checkboxes__label"),c(i,"for",n[3]),c(i,"title",n[1]),st(o,"float","right"),c(e,"class","govuk-checkboxes__item"),c(e,"style",n[2])},m(y,L){B(y,e,L),P(e,t),t.checked=n[0],P(e,r),P(e,i),g&&g.m(i,null),P(e,l),P(e,o),m&&m.m(o,null),s=!0,a||(f=[W(t,"change",n[7]),W(t,"change",n[6])],a=!0)},p(y,[L]){L&1&&(t.checked=y[0]),g&&g.p&&(!s||L&16)&&be(g,u,y,y[4],s?ke(u,y[4],L,null):ve(y[4]),null),(!s||L&2)&&c(i,"title",y[1]),m&&m.p&&(!s||L&16)&&be(m,_,y,y[4],s?ke(_,y[4],L,Xn):ve(y[4]),Ct)},i(y){s||(S(g,y),S(m,y),s=!0)},o(y){F(g,y),F(m,y),s=!1},d(y){y&&I(e),g&&g.d(y),m&&m.d(y),a=!1,Oe(f)}}}function xn(n,e,t){let{$$slots:r={},$$scope:i}=e;const l=Mn(r);let{checked:o}=e,{hint:s=null}=e,f=l.right!==void 0?"float: none":"",u=Nt();function g(m){le.call(this,n,m)}function _(){o=this.checked,t(0,o)}return n.$$set=m=>{"checked"in m&&t(0,o=m.checked),"hint"in m&&t(1,s=m.hint),"$$scope"in m&&t(4,i=m.$$scope)},[o,s,f,u,i,r,g,_]}class Hi extends K{constructor(e){super(),Q(this,e,xn,jn,J,{checked:0,hint:1})}}function $n(n){let e,t,r,i,l,o,s;const a=n[3].default,f=ye(a,n,n[2],null);return{c(){e=T("details"),t=T("summary"),r=T("span"),i=de(n[0]),l=j(),o=T("div"),f&&f.c(),c(r,"class","govuk-details__summary-text"),c(t,"class","govuk-details__summary"),c(o,"class","govuk-details__text"),e.open=n[1],c(e,"class","govuk-details"),c(e,"data-module","govuk-details")},m(u,g){B(u,e,g),P(e,t),P(t,r),P(r,i),P(e,l),P(e,o),f&&f.m(o,null),s=!0},p(u,[g]){(!s||g&1)&&Pe(i,u[0]),f&&f.p&&(!s||g&4)&&be(f,a,u,u[2],s?ke(a,u[2],g,null):ve(u[2]),null),(!s||g&2)&&(e.open=u[1])},i(u){s||(S(f,u),s=!0)},o(u){F(f,u),s=!1},d(u){u&&I(e),f&&f.d(u)}}}function er(n,e,t){let{$$slots:r={},$$scope:i}=e,{label:l}=e,{open:o=!1}=e;return n.$$set=s=>{"label"in s&&t(0,l=s.label),"open"in s&&t(1,o=s.open),"$$scope"in s&&t(2,i=s.$$scope)},[l,o,i,r]}class tr extends K{constructor(e){super(),Q(this,e,er,$n,J,{label:0,open:1})}}function St(n,e,t){const r=n.slice();return r[10]=e[t][0],r[11]=e[t][1],r}function Tt(n){let e,t;return{c(){e=T("div"),t=de(n[2]),c(e,"class","govuk-hint")},m(r,i){B(r,e,i),P(e,t)},p(r,i){i&4&&Pe(t,r[2])},d(r){r&&I(e)}}}function zt(n){let e;return{c(){e=T("option"),e.__value="",Ze(e,e.__value)},m(t,r){B(t,e,r)},d(t){t&&I(e)}}}function Et(n){let e,t=n[11]+"",r,i;return{c(){e=T("option"),r=de(t),e.__value=i=n[10],Ze(e,e.__value)},m(l,o){B(l,e,o),P(e,r)},p(l,o){o&8&&t!==(t=l[11]+"")&&Pe(r,t),o&8&&i!==(i=l[10])&&(e.__value=i,Ze(e,e.__value))},d(l){l&&I(e)}}}function nr(n){let e,t,r,i,l,o,s,a;e=new Cn({props:{errorMessage:n[6]}});let f=n[2]&&Tt(n),u=n[4]&&zt(),g=Ke(n[3]),_=[];for(let m=0;mn[9].call(i))},m(m,y){$(e,m,y),B(m,t,y),f&&f.m(m,y),B(m,r,y),B(m,i,y),u&&u.m(i,null),P(i,l);for(let L=0;L<_.length;L+=1)_[L]&&_[L].m(i,null);vt(i,n[0],!0),o=!0,s||(a=[W(i,"change",n[9]),W(i,"change",n[8])],s=!0)},p(m,y){const L={};if(y&64&&(L.errorMessage=m[6]),e.$set(L),m[2]?f?f.p(m,y):(f=Tt(m),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null),m[4]?u||(u=zt(),u.c(),u.m(i,l)):u&&(u.d(1),u=null),y&8){g=Ke(m[3]);let b;for(b=0;b{"label"in m&&t(1,r=m.label),"hint"in m&&t(2,i=m.hint),"choices"in m&&t(3,l=m.choices),"emptyOption"in m&&t(4,o=m.emptyOption),"disabled"in m&&t(5,s=m.disabled),"errorMessage"in m&&t(6,a=m.errorMessage),"value"in m&&t(0,f=m.value)},[f,r,i,l,o,s,a,u,g,_]}class lr extends K{constructor(e){super(),Q(this,e,ir,rr,J,{label:1,hint:2,choices:3,emptyOption:4,disabled:5,errorMessage:6,value:0})}}function Ki(n,e){let t=new Set(n.getStyle().layers.filter(r=>r.type=="line").map(r=>r.id));if(e=="dataviz")return["Road network","Path"].filter(r=>t.has(r));if(e=="hybrid")return["Path","Road","Tunnel"].filter(r=>t.has(r));if(e=="streets"){let r=[];for(let i of["road","bridge","tunnel"])for(let l of["link","minor","minor_construction","motorway","motorway_construction","motorway_link","path_pedestrian","secondary_tertiary","secondary_tertiary_construction","service_track","service_track_construction","street","trunk_primary","trunk_primary_construction","trunk_primary_link"])r.push(`${i}_${l}`);return r.filter(i=>t.has(i))}return e=="uk-openzoomstack-light"?n.getStyle().layers.filter(r=>r["source-layer"]=="roads"&&r.type=="line").map(r=>r.id):[]}let E=n=>n,te=n=>n,or=n=>n,sr=n=>n,ar=n=>n,ur=n=>n,fr=n=>n,cr=[fr("raster-basemap"),E("parliamentary_constituencies"),E("parliamentary_constituencies-outline"),E("wards"),E("wards-outline"),E("combined_authorities"),E("combined_authorities-outline"),E("local_authority_districts"),E("local_authority_districts-outline"),E("local_planning_authorities"),E("local_planning_authorities-outline"),E("census_output_areas"),E("census_output_areas-outline"),E("imd"),E("imd-outline"),E("pollution"),E("road_noise"),E("mrn"),E("srn"),E("bus_routes"),E("trams"),E("national_cycle_network"),E("cycle_paths"),E("pct_commute"),E("pct_school"),E("road_widths"),E("road_speeds"),E("pavement_widths"),E("gradient"),E("gradient_arrows"),E("education"),E("hospitals"),E("sports_spaces"),E("railway_stations"),E("cycle_parking"),E("crossings"),E("vehicle_counts"),E("stats19"),E("bus_stops"),te("interventions-coverage-polygons-outlines"),te(E("interventions-polygons")),te(E("interventions-polygons-outlines")),te("hover-polygons"),te("hover-lines"),te(E("interventions-lines")),te(E("interventions-lines-endpoints")),te("hover-points"),te(E("interventions-points")),E("problems"),te("edit-polygon-fill"),te("edit-polygon-lines"),te("edit-polygon-vertices"),te("draw-split-route"),te("route-points"),te("route-lines"),te("route-polygons"),or("road_label"),ur(sr(ar("Road labels"))),te("boundary"),E("measurement-line"),te("georeferenced-image"),E("cover-interactive-layers")],dr=En(null);function mr(n,e){return{id:e,beforeId:gr(n,e)}}function gr(n,e){let t=Rn(dr);if(!t){console.warn(`getBeforeId(${e}) called before map is ready. Z-ordering may be incorrect.`);return}let r,i=!1;for(let l=n.layerZorder.length-1;l>=0;l--){let o=n.layerZorder[l];if(o==e){i=!0;break}t.getLayer(o)&&(r=o)}if(!i)throw new Error(`Layer ID ${e} not defined in layerZorder`);return r}const Qi=["==",["geometry-type"],"Polygon"],Ji=["==",["geometry-type"],"LineString"],Yi=["==",["geometry-type"],"Point"];function Xi(){return{type:"FeatureCollection",features:[]}}function ji(n,e,t){let r=["match",n];for(let[i,l]of Object.entries(e))r.push(i),r.push(l);return r.push(t),r}function hr(n){return Bn(n)}function xi(n){var t,r;let e={type:"FeatureCollection",features:[]};for(let i of n.features)if(e.features.push(i),i.geometry.type=="LineString"&&!((t=i.properties)!=null&&t.hide_while_editing))for(let l of[i.geometry.coordinates[0],i.geometry.coordinates[i.geometry.coordinates.length-1]])e.features.push({type:"Feature",properties:{endpoint:!0,scheme_reference:(r=i.properties)==null?void 0:r.scheme_reference},geometry:{type:"Point",coordinates:l}});return e}function $i(n,e,t){let r=["step",n];for(let i=1;iut(e,"value",i)),{c(){x(e.$$.fragment)},m(o,s){$(e,o,s),r=!0},p(o,[s]){const a={};s&1&&(a.disabled=o[0]),!t&&s&2&&(t=!0,a.value=o[1],ft(()=>t=!1)),e.$set(a)},i(o){r||(S(e.$$.fragment,o),r=!0)},o(o){F(e.$$.fragment,o),r=!1},d(o){ee(e,o)}}}function yr(n,e,t){let r;Me(n,kt,o=>t(1,r=o));let{disabled:i=!1}=e;function l(o){r=o,kt.set(r)}return n.$$set=o=>{"disabled"in o&&t(0,i=o.disabled)},[i,r,l]}class nl extends K{constructor(e){super(),Q(this,e,yr,_r,J,{disabled:0})}}function br(n){let e,t;return{c(){e=_e("svg"),t=_e("path"),c(t,"d","M13.12.706a.982.982 0 0 0-1.391 0L6.907 5.517 2.087.696a.982.982 0 1 0-1.391 1.39l4.821 4.821L.696 11.73a.982.982 0 1 0 1.39 1.39l4.821-4.821 4.822 4.821a.982.982 0 1 0 1.39-1.39L8.298 6.908l4.821-4.822a.988.988 0 0 0 0-1.38Z"),c(e,"viewBox","0 0 14 14"),c(e,"width","13"),c(e,"height","13"),c(e,"class","svelte-en2qvf")},m(r,i){B(r,e,i),P(e,t)},p:H,i:H,o:H,d(r){r&&I(e)}}}class Kt extends K{constructor(e){super(),Q(this,e,null,br,J,{})}}function vr(n){let e,t;return{c(){e=_e("svg"),t=_e("path"),c(t,"d","M15 0C6.705 0 0 6.705 0 15C0 23.295 6.705 30 15 30C23.295 30 30 23.295 30 15C30 6.705 23.295 0 15 0ZM22.5 20.385L20.385 22.5L15 17.115L9.615 22.5L7.5 20.385L12.885 15L7.5 9.615L9.615 7.5L15 12.885L20.385 7.5L22.5 9.615L17.115 15L22.5 20.385Z"),c(e,"viewBox","0 0 30 30"),c(e,"fill","none"),c(e,"xmlns","http://www.w3.org/2000/svg"),c(e,"class","svelte-d2loi5")},m(r,i){B(r,e,i),P(e,t)},p:H,i:H,o:H,d(r){r&&I(e)}}}class Qt extends K{constructor(e){super(),Q(this,e,null,vr,J,{})}}function kr(n){let e,t;return{c(){e=T("img"),ne(e.src,t=n[3]+"area.svg")||c(e,"src",t),c(e,"alt",n[6]),c(e,"class","svelte-ltkwvy")},m(r,i){B(r,e,i)},p(r,i){i&8&&!ne(e.src,t=r[3]+"area.svg")&&c(e,"src",t),i&64&&c(e,"alt",r[6])},d(r){r&&I(e)}}}function wr(n){let e,t;return{c(){e=T("img"),ne(e.src,t=n[3]+"reverse.svg")||c(e,"src",t),c(e,"alt",n[6]),c(e,"class","svelte-ltkwvy")},m(r,i){B(r,e,i)},p(r,i){i&8&&!ne(e.src,t=r[3]+"reverse.svg")&&c(e,"src",t),i&64&&c(e,"alt",r[6])},d(r){r&&I(e)}}}function pr(n){let e,t;return{c(){e=T("img"),ne(e.src,t=n[3]+"poi.svg")||c(e,"src",t),c(e,"alt",n[6]),c(e,"class","svelte-ltkwvy")},m(r,i){B(r,e,i)},p(r,i){i&8&&!ne(e.src,t=r[3]+"poi.svg")&&c(e,"src",t),i&64&&c(e,"alt",r[6])},d(r){r&&I(e)}}}function Lr(n){let e,t;return{c(){e=T("img"),ne(e.src,t=n[3]+"postal_code.svg")||c(e,"src",t),c(e,"alt",n[6]),c(e,"class","svelte-ltkwvy")},m(r,i){B(r,e,i)},p(r,i){i&8&&!ne(e.src,t=r[3]+"postal_code.svg")&&c(e,"src",t),i&64&&c(e,"alt",r[6])},d(r){r&&I(e)}}}function Mr(n){let e,t;return{c(){e=T("img"),ne(e.src,t=n[3]+"street.svg")||c(e,"src",t),c(e,"alt",n[6]),c(e,"class","svelte-ltkwvy")},m(r,i){B(r,e,i)},p(r,i){i&8&&!ne(e.src,t=r[3]+"street.svg")&&c(e,"src",t),i&64&&c(e,"alt",r[6])},d(r){r&&I(e)}}}function Pr(n){let e,t;return{c(){e=T("img"),ne(e.src,t=n[3]+"road.svg")||c(e,"src",t),c(e,"alt",n[6]),c(e,"class","svelte-ltkwvy")},m(r,i){B(r,e,i)},p(r,i){i&8&&!ne(e.src,t=r[3]+"road.svg")&&c(e,"src",t),i&64&&c(e,"alt",r[6])},d(r){r&&I(e)}}}function Cr(n){let e,t;return{c(){e=T("img"),ne(e.src,t=n[3]+"housenumber.svg")||c(e,"src",t),c(e,"alt",n[6]),c(e,"class","svelte-ltkwvy")},m(r,i){B(r,e,i)},p(r,i){i&8&&!ne(e.src,t=r[3]+"housenumber.svg")&&c(e,"src",t),i&64&&c(e,"alt",r[6])},d(r){r&&I(e)}}}function Sr(n){let e,t,r,i;return{c(){e=T("img"),ne(e.src,t=n[5])||c(e,"src",t),c(e,"alt",n[4]),c(e,"class","svelte-ltkwvy")},m(l,o){B(l,e,o),r||(i=W(e,"error",n[14]),r=!0)},p(l,o){o&32&&!ne(e.src,t=l[5])&&c(e,"src",t),o&16&&c(e,"alt",l[4])},d(l){l&&I(e),r=!1,i()}}}function Rt(n){let e,t;return{c(){e=T("span"),t=de(n[6]),c(e,"class","secondary svelte-ltkwvy")},m(r,i){B(r,e,i),P(e,t)},p(r,i){i&64&&Pe(t,r[6])},d(r){r&&I(e)}}}function Tr(n){var N,q;let e,t,r,i,l,o,s,a,f=(n[7]?n[0].place_name:n[0].place_name.replace(/,.*/,""))+"",u,g,_=n[2]==="always"||n[2]&&!n[0].address&&((N=n[0].properties)==null?void 0:N.kind)!=="road"&&((q=n[0].properties)==null?void 0:q.kind)!=="road_relation"&&!n[0].id.startsWith("address.")&&!n[0].id.startsWith("postal_code.")&&(!n[0].id.startsWith("poi.")||!n[5])&&!n[7],m,y,L=(n[7]?"":n[0].place_name.replace(/[^,]*,?\s*/,""))+"",b,p,Z;function v(C,M){var oe,h;return M&1&&(t=null),M&1&&(r=null),M&1&&(i=null),C[5]?Sr:C[0].address?Cr:((oe=C[0].properties)==null?void 0:oe.kind)==="road"||((h=C[0].properties)==null?void 0:h.kind)==="road_relation"?Pr:(t==null&&(t=!!C[0].id.startsWith("address.")),t?Mr:(r==null&&(r=!!C[0].id.startsWith("postal_code.")),r?Lr:(i==null&&(i=!!C[0].id.startsWith("poi.")),i?pr:C[7]?wr:kr)))}let R=v(n,-1),k=R(n),U=_&&Rt(n);return{c(){e=T("li"),k.c(),l=j(),o=T("span"),s=T("span"),a=T("span"),u=de(f),g=j(),U&&U.c(),m=j(),y=T("span"),b=de(L),c(a,"class","primary svelte-ltkwvy"),c(s,"class","svelte-ltkwvy"),c(y,"class","line2 svelte-ltkwvy"),c(o,"class","texts svelte-ltkwvy"),c(e,"tabindex","0"),c(e,"data-selected",n[1]),c(e,"class","svelte-ltkwvy"),Le(e,"selected",n[1])},m(C,M){B(C,e,M),k.m(e,null),P(e,l),P(e,o),P(o,s),P(s,a),P(a,u),P(s,g),U&&U.m(s,null),P(o,m),P(o,y),P(y,b),p||(Z=[W(e,"mouseenter",n[12]),W(e,"focus",n[13])],p=!0)},p(C,[M]){var oe,h;R===(R=v(C,M))&&k?k.p(C,M):(k.d(1),k=R(C),k&&(k.c(),k.m(e,l))),M&1&&f!==(f=(C[7]?C[0].place_name:C[0].place_name.replace(/,.*/,""))+"")&&Pe(u,f),M&37&&(_=C[2]==="always"||C[2]&&!C[0].address&&((oe=C[0].properties)==null?void 0:oe.kind)!=="road"&&((h=C[0].properties)==null?void 0:h.kind)!=="road_relation"&&!C[0].id.startsWith("address.")&&!C[0].id.startsWith("postal_code.")&&(!C[0].id.startsWith("poi.")||!C[5])&&!C[7]),_?U?U.p(C,M):(U=Rt(C),U.c(),U.m(s,null)):U&&(U.d(1),U=null),M&1&&L!==(L=(C[7]?"":C[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&Pe(b,L),M&2&&c(e,"data-selected",C[1]),M&2&&Le(e,"selected",C[1])},i:H,o:H,d(C){C&&I(e),k.d(),U&&U.d(),p=!1,Oe(Z)}}}function zr(n,e,t){var v;let r,i,{feature:l}=e,{selected:o=!1}=e,{showPlaceType:s}=e,{missingIconsCache:a}=e,{iconsBaseUrl:f}=e;const u=(v=l.properties)==null?void 0:v.categories;let g,_,m=0,y=l.place_type[0]==="reverse";function L(){_&&a.add(_),t(10,m++,m)}function b(R){le.call(this,n,R)}function p(R){le.call(this,n,R)}const Z=()=>L();return n.$$set=R=>{"feature"in R&&t(0,l=R.feature),"selected"in R&&t(1,o=R.selected),"showPlaceType"in R&&t(2,s=R.showPlaceType),"missingIconsCache"in R&&t(9,a=R.missingIconsCache),"iconsBaseUrl"in R&&t(3,f=R.iconsBaseUrl)},n.$$.update=()=>{var R,k,U,N;if(n.$$.dirty&3640)do t(11,r--,r),t(4,g=u==null?void 0:u[r]),t(5,_=g?f+g.replace(/ /g,"_")+".svg":void 0);while(r>-1&&(!_||a.has(_)));n.$$.dirty&1&&t(6,i=l.id.startsWith("poi.")?(k=(R=l.properties)==null?void 0:R.categories)==null?void 0:k.join(", "):((N=(U=l.properties)==null?void 0:U.place_type_name)==null?void 0:N[0])??l.place_type[0])},t(11,r=(u==null?void 0:u.length)??0),[l,o,s,f,g,_,i,y,L,a,m,r,b,p,Z]}class Er extends K{constructor(e){super(),Q(this,e,zr,Tr,J,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function Rr(n){let e;return{c(){e=T("div"),e.innerHTML='',c(e,"class","svelte-7cmwmc")},m(t,r){B(t,e,r)},p:H,i:H,o:H,d(t){t&&I(e)}}}class Br extends K{constructor(e){super(),Q(this,e,null,Rr,J,{})}}function Ir(n){let e,t;return{c(){e=_e("svg"),t=_e("path"),c(t,"d","M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"),c(e,"viewBox","0 0 60.006 21.412"),c(e,"width","14"),c(e,"height","20"),c(e,"class","svelte-en2qvf")},m(r,i){B(r,e,i),P(e,t)},p:H,i:H,o:H,d(r){r&&I(e)}}}class Fr extends K{constructor(e){super(),Q(this,e,null,Ir,J,{})}}function Or(n){let e,t,r;return{c(){e=_e("svg"),t=_e("circle"),r=_e("path"),c(t,"cx","4.789"),c(t,"cy","4.787"),c(t,"r","3.85"),c(t,"class","svelte-1aq105l"),c(r,"d","M12.063 12.063 7.635 7.635"),c(r,"class","svelte-1aq105l"),c(e,"xmlns","http://www.w3.org/2000/svg"),c(e,"width","13"),c(e,"height","13"),c(e,"viewBox","0 0 13 13"),c(e,"class","svelte-1aq105l")},m(i,l){B(i,e,l),P(e,t),P(e,r)},p:H,i:H,o:H,d(i){i&&I(e)}}}class Gr extends K{constructor(e){super(),Q(this,e,null,Or,J,{})}}function Ar(n,e,t){const r=e[1],i=e[0],l=r-i;return n===r&&t?n:((n-i)%l+l)%l+i}function Bt(n){const e=[...n];return e[2]r[0]||i.maxZoom!=null&&i.maxZoomDate.now()){if(!Ae.coords)break e;return Ae.coords}let l;try{return l=await new Promise((o,s)=>{t.signal.addEventListener("abort",()=>{s(Error("aborted"))}),navigator.geolocation.getCurrentPosition(a=>{o([a.coords.longitude,a.coords.latitude].map(f=>f.toFixed(6)).join(","))},a=>{s(a)},i)}),l}catch{}finally{i.cachedLocationExpiry&&(Ae={time:Date.now(),coords:l})}if(t.signal.aborted)return}if(i.type==="server-geolocation")return"ip";if(r&&i.type==="map-center")return r[1].toFixed(6)+","+r[2].toFixed(6)}}function It(n,e,t){const r=n.slice();return r[81]=e[t],r[83]=t,r}function Ft(n){let e,t;return e=new Br({}),{c(){x(e.$$.fragment)},m(r,i){$(e,r,i),t=!0},i(r){t||(S(e.$$.fragment,r),t=!0)},o(r){F(e.$$.fragment,r),t=!1},d(r){ee(e,r)}}}function Ot(n){let e,t,r,i,l;return t=new Fr({}),{c(){e=T("button"),x(t.$$.fragment),c(e,"type","button"),c(e,"title",n[9]),c(e,"class","svelte-zh3kmv"),Le(e,"active",n[0])},m(o,s){B(o,e,s),$(t,e,null),r=!0,i||(l=W(e,"click",n[67]),i=!0)},p(o,s){(!r||s[0]&512)&&c(e,"title",o[9]),(!r||s[0]&1)&&Le(e,"active",o[0])},i(o){r||(S(t.$$.fragment,o),r=!0)},o(o){F(t.$$.fragment,o),r=!1},d(o){o&&I(e),ee(t),i=!1,l()}}}function Ur(n){let e,t=[],r=new Map,i,l,o,s=Ke(n[14]);const a=f=>f[81].id+(f[81].address?","+f[81].address:"");for(let f=0;f{N=null}),ze()),(!v||V[0]&2)&&Le(f,"displayable",z[1]!==""),z[5]===!0?q?(q.p(z,V),V[0]&32&&S(q,1)):(q=Ot(z),q.c(),S(q,1),q.m(r,y)):q&&(Te(),F(q,1,1,()=>{q=null}),ze()),M&&M.p&&(!v||V[1]&134217728)&&be(M,C,z,z[58],v?ke(C,z[58],V,null):ve(z[58]),null);let ie=b;b=we(z),b===ie?~b&&h[b].p(z,V):(p&&(Te(),F(h[ie],1,1,()=>{h[ie]=null}),ze()),~b?(p=h[b],p?p.p(z,V):(p=h[b]=oe[b](z),p.c()),S(p,1),p.m(t,null)):p=null),(!v||V[0]&4&&Z!==(Z=Qe(z[2])+" svelte-zh3kmv"))&&c(t,"class",Z),(!v||V[0]&22)&&Le(t,"can-collapse",z[4]&&z[1]==="")},i(z){v||(S(U),S(l.$$.fragment,z),S(g.$$.fragment,z),S(N),S(q),S(M,z),S(p),v=!0)},o(z){F(U),F(l.$$.fragment,z),F(g.$$.fragment,z),F(N),F(q),F(M,z),F(p),v=!1},d(z){z&&(I(e),I(t)),ee(l),n[61](null),ee(g),N&&N.d(),q&&q.d(),M&&M.d(z),~b&&h[b].d(),R=!1,Oe(k)}}}function Dr(n,e,t){let r,{$$slots:i={},$$scope:l}=e,{class:o=void 0}=e,{apiKey:s}=e,{bbox:a=void 0}=e,{clearButtonTitle:f="clear"}=e,{clearOnBlur:u=!1}=e,{collapsed:g=!1}=e,{country:_=void 0}=e,{debounceSearch:m=200}=e,{enableReverse:y=!1}=e,{errorMessage:L="Something went wrong…"}=e,{filter:b=()=>!0}=e,{flyTo:p=!0}=e,{fuzzyMatch:Z=!0}=e,{language:v=void 0}=e,{limit:R=void 0}=e,{mapController:k=void 0}=e,{minLength:U=2}=e,{noResultsMessage:N="Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"}=e,{placeholder:q="Search"}=e,{proximity:C=[{type:"server-geolocation"}]}=e,{reverseActive:M=y==="always"}=e,{reverseButtonTitle:oe="toggle reverse geocoding"}=e,{searchValue:h=""}=e,{showFullGeometry:we=!0}=e,{showPlaceType:z="ifNeeded"}=e,{showResultsWhileTyping:V=!0}=e,{selectFirst:ie=!0}=e,{flyToSelected:w=!1}=e,{markerOnSelected:ce=!0}=e,{types:se=void 0}=e,{excludeTypes:me=!1}=e,{zoom:Ge=16}=e,{maxZoom:Ee=18}=e,{apiUrl:Xe="https://api.maptiler.com/geocoding"}=e,{fetchParameters:je={}}=e,{iconsBaseUrl:ht="https://cdn.maptiler.com/maptiler-geocoding-control/v1.3.1/icons/"}=e,{adjustUrlQuery:xe=()=>{}}=e;function nn(){ge.focus()}function rn(){ge.blur()}function _t(d,X=!0,ae=!1){t(1,h=d),X?(t(15,D=-1),bt()):(nt(!ae,ae),setTimeout(()=>{ge.focus(),ge.select()}))}function ln(){t(14,G=void 0),t(55,O=void 0),t(15,D=-1)}function on(){t(54,Y=[]),t(55,O=void 0)}let Re=!1,G,Y,O,yt="",ge,D=-1,he,qe=[],Se,Be,We,$e;const sn=new Set,pe=ct();dt(()=>{k&&(k.setEventHandler(void 0),k.indicateReverse(!1),k.setSelectedMarker(-1),k.setMarkers(void 0,void 0))});function bt(d){if(Be&&(clearTimeout(Be),Be=void 0),D>-1&&G)t(55,O=G[D]),t(1,h=O.place_type[0]==="reverse"?O.place_name:O.place_name.replace(/,.*/,"")),t(18,he=void 0),t(54,Y=void 0),t(15,D=-1);else if(h){const X=d||!et(h);tt(h,{exact:!0}).then(()=>{t(54,Y=G),t(55,O=void 0),X&&an()}).catch(ae=>t(18,he=ae))}}function et(d){try{return On(d,6)}catch{return!1}}async function tt(d,{byId:X=!1,exact:ae=!1}={}){t(18,he=void 0),Se==null||Se.abort();const ue=new AbortController;t(19,Se=ue);try{const A=et(d),fe=new URLSearchParams;if(v!==void 0&&fe.set("language",Array.isArray(v)?v.join(","):v??""),se&&fe.set("types",se.join(",")),me&&fe.set("excludeTypes",String(me)),a&&fe.set("bbox",a.map(De=>De.toFixed(6)).join(",")),_&&fe.set("country",Array.isArray(_)?_.join(","):_),!X&&!A){const De=await Zr(k,C,ue);De&&fe.set("proximity",De),(ae||!V)&&fe.set("autocomplete","false"),fe.set("fuzzyMatch",String(Z))}R!==void 0&&(!A||(se==null?void 0:se.length)===1)&&fe.set("limit",String(R)),fe.set("key",s),xe(fe);const Ve=Xe+"/"+encodeURIComponent(A?A.decimalLongitude+","+A.decimalLatitude:d)+".json?"+fe.toString();if(Ve===yt){X?(t(14,G=void 0),t(55,O=qe[0])):t(14,G=qe);return}yt=Ve;const it=await fetch(Ve,{signal:ue.signal,...je});if(!it.ok)throw new Error(await it.text());const lt=await it.json();pe("response",{url:Ve,featureCollection:lt}),X?(t(14,G=void 0),t(55,O=lt.features[0]),qe=[O]):(t(14,G=lt.features.filter(b)),A&&G.unshift({type:"Feature",properties:{},id:"reverse_"+A.decimalLongitude+"_"+A.decimalLatitude,text:A.decimalLatitude+", "+A.decimalLongitude,place_name:A.decimalLatitude+", "+A.decimalLongitude,place_type:["reverse"],center:[A.decimalLongitude,A.decimalLatitude],bbox:[A.decimalLongitude,A.decimalLatitude,A.decimalLongitude,A.decimalLatitude],geometry:{type:"Point",coordinates:[A.decimalLongitude,A.decimalLatitude]}}),qe=G,A&&ge.focus())}catch(A){if(A&&typeof A=="object"&&"name"in A&&A.name==="AbortError")return;throw A}finally{ue===Se&&t(19,Se=void 0)}}function an(){var ae;if(!(Y!=null&&Y.length)||!p)return;const d=[180,90,-180,-90],X=!Y.some(ue=>!ue.matching_text);for(const ue of Y)if(X||!ue.matching_text)for(const A of[0,1,2,3])d[A]=Math[A<2?"min":"max"](d[A],((ae=ue.bbox)==null?void 0:ae[A])??ue.center[A%2]);k&&Y.length>0&&(O&&d[0]===d[2]&&d[1]===d[3]?k.flyTo(O.center,Ge):k.fitBounds(Bt(d),50,Ee))}function un(d){t(0,M=y==="always"),t(14,G=void 0),t(55,O=void 0),t(15,D=-1),_t(d[1].toFixed(6)+", "+Ar(d[0],[-180,180],!0).toFixed(6),!1,!0)}function fn(d){if(!G)return;let X=d.key==="ArrowDown"?1:d.key==="ArrowUp"?-1:0;X&&(D===(ie?0:-1)&&X===-1&&t(15,D=G.length),t(15,D+=X),D>=G.length&&t(15,D=-1),D<0&&ie&&t(15,D=0),d.preventDefault())}function nt(d=!0,X=!1){if(t(18,he=void 0),V||X){if(Be&&clearTimeout(Be),h.length{tt(ae).catch(ue=>t(18,he=ue))},d?m:0)}else t(14,G=void 0),t(18,he=void 0)}function rt(d){t(55,O=d),t(1,h=d.place_name),t(15,D=-1)}const cn=()=>ge.focus();function dn(d){Je[d?"unshift":"push"](()=>{ge=d,t(17,ge)})}function mn(){h=this.value,t(1,h),t(13,Re),t(27,u)}const gn=()=>t(13,Re=!0),hn=()=>t(13,Re=!1),_n=()=>nt(),yn=()=>{t(1,h=""),ge.focus()},bn=()=>t(0,M=!M),vn=()=>t(18,he=void 0),kn=d=>t(15,D=d),wn=d=>rt(d),pn=()=>{ie||t(15,D=-1)},Ln=()=>{};return n.$$set=d=>{"class"in d&&t(2,o=d.class),"apiKey"in d&&t(25,s=d.apiKey),"bbox"in d&&t(26,a=d.bbox),"clearButtonTitle"in d&&t(3,f=d.clearButtonTitle),"clearOnBlur"in d&&t(27,u=d.clearOnBlur),"collapsed"in d&&t(4,g=d.collapsed),"country"in d&&t(28,_=d.country),"debounceSearch"in d&&t(29,m=d.debounceSearch),"enableReverse"in d&&t(5,y=d.enableReverse),"errorMessage"in d&&t(6,L=d.errorMessage),"filter"in d&&t(30,b=d.filter),"flyTo"in d&&t(31,p=d.flyTo),"fuzzyMatch"in d&&t(32,Z=d.fuzzyMatch),"language"in d&&t(33,v=d.language),"limit"in d&&t(34,R=d.limit),"mapController"in d&&t(35,k=d.mapController),"minLength"in d&&t(36,U=d.minLength),"noResultsMessage"in d&&t(7,N=d.noResultsMessage),"placeholder"in d&&t(8,q=d.placeholder),"proximity"in d&&t(37,C=d.proximity),"reverseActive"in d&&t(0,M=d.reverseActive),"reverseButtonTitle"in d&&t(9,oe=d.reverseButtonTitle),"searchValue"in d&&t(1,h=d.searchValue),"showFullGeometry"in d&&t(38,we=d.showFullGeometry),"showPlaceType"in d&&t(10,z=d.showPlaceType),"showResultsWhileTyping"in d&&t(39,V=d.showResultsWhileTyping),"selectFirst"in d&&t(11,ie=d.selectFirst),"flyToSelected"in d&&t(40,w=d.flyToSelected),"markerOnSelected"in d&&t(41,ce=d.markerOnSelected),"types"in d&&t(42,se=d.types),"excludeTypes"in d&&t(43,me=d.excludeTypes),"zoom"in d&&t(44,Ge=d.zoom),"maxZoom"in d&&t(45,Ee=d.maxZoom),"apiUrl"in d&&t(46,Xe=d.apiUrl),"fetchParameters"in d&&t(47,je=d.fetchParameters),"iconsBaseUrl"in d&&t(12,ht=d.iconsBaseUrl),"adjustUrlQuery"in d&&t(48,xe=d.adjustUrlQuery),"$$scope"in d&&t(58,l=d.$$scope)},n.$$.update=()=>{if(n.$$.dirty[0]&32&&t(0,M=y==="always"),n.$$.dirty[0]&134225920&&setTimeout(()=>{t(16,We=Re),u&&!Re&&t(1,h="")}),n.$$.dirty[0]&16386|n.$$.dirty[1]&32&&h.lengtht(18,he=d)),n.$$.dirty[1]&50356241&&(k&&O&&O.id!==$e&&p&&(!O.bbox||O.bbox[0]===O.bbox[2]&&O.bbox[1]===O.bbox[3]?k.flyTo(O.center,O.id.startsWith("poi.")||O.id.startsWith("address.")?Ee:Ge):k.fitBounds(Bt(O.bbox),50,Ee),t(14,G=void 0),t(54,Y=void 0),t(15,D=-1)),t(56,$e=O==null?void 0:O.id)),n.$$.dirty[0]&18432&&ie&&G!=null&&G.length&&t(15,D=0),n.$$.dirty[0]&2050&&(ie||t(15,D=-1)),n.$$.dirty[0]&16384|n.$$.dirty[1]&8388608&&Y!==G&&t(54,Y=void 0),n.$$.dirty[0]&81921|n.$$.dirty[1]&8388624&&k&&k.setEventHandler(d=>{switch(d.type){case"mapClick":M&&un(d.coordinates);break;case"markerClick":{const X=G==null?void 0:G.find(ae=>ae.id===d.id);X&&rt(X)}break;case"markerMouseEnter":Y&&t(15,D=We?(G==null?void 0:G.findIndex(X=>X.id===d.id))??-1:-1);break;case"markerMouseLeave":Y&&t(15,D=-1);break}}),n.$$.dirty[0]&49152&&t(57,r=G==null?void 0:G[D]),n.$$.dirty[1]&67133969&&k&&r&&p&&w&&k.flyTo(r.center,r.id.startsWith("poi.")||r.id.startsWith("address.")?Ee:Ge),n.$$.dirty[1]&1040&&(ce||k==null||k.setMarkers(void 0,void 0)),n.$$.dirty[1]&75498512&&k&&ce&&!Y&&(k.setMarkers(r?[r]:void 0,void 0),k.setSelectedMarker(r?0:-1)),n.$$.dirty[1]&25165840&&k&&k.setMarkers(Y,O),n.$$.dirty[0]&32768|n.$$.dirty[1]&8388624&&Y&&k&&k.setSelectedMarker(D),n.$$.dirty[0]&2|n.$$.dirty[1]&16&&k){const d=et(h);k.setReverseMarker(d?[d.decimalLongitude,d.decimalLatitude]:void 0)}n.$$.dirty[1]&67108864&&pe("select",r),n.$$.dirty[1]&16777216&&pe("pick",O),n.$$.dirty[0]&81920&&pe("optionsVisibilityChange",We&&!!G),n.$$.dirty[0]&16384&&pe("featuresListed",G),n.$$.dirty[1]&8388608&&pe("featuresMarked",Y),n.$$.dirty[0]&1&&pe("reverseToggle",M),n.$$.dirty[0]&2&&pe("queryChange",h),n.$$.dirty[0]&1|n.$$.dirty[1]&16&&k&&k.indicateReverse(M)},[M,h,o,f,g,y,L,N,q,oe,z,ie,ht,Re,G,D,We,ge,he,Se,sn,bt,fn,nt,rt,s,a,u,_,m,b,p,Z,v,R,k,U,C,we,V,w,ce,se,me,Ge,Ee,Xe,je,xe,nn,rn,_t,ln,on,Y,O,$e,r,l,i,cn,dn,mn,gn,hn,_n,yn,bn,vn,kn,wn,pn,Ln]}class Hr extends K{constructor(e){super(),Q(this,e,Dr,Vr,J,{class:2,apiKey:25,bbox:26,clearButtonTitle:3,clearOnBlur:27,collapsed:4,country:28,debounceSearch:29,enableReverse:5,errorMessage:6,filter:30,flyTo:31,fuzzyMatch:32,language:33,limit:34,mapController:35,minLength:36,noResultsMessage:7,placeholder:8,proximity:37,reverseActive:0,reverseButtonTitle:9,searchValue:1,showFullGeometry:38,showPlaceType:10,showResultsWhileTyping:39,selectFirst:11,flyToSelected:40,markerOnSelected:41,types:42,excludeTypes:43,zoom:44,maxZoom:45,apiUrl:46,fetchParameters:47,iconsBaseUrl:12,adjustUrlQuery:48,focus:49,blur:50,setQuery:51,clearList:52,clearMap:53},null,[-1,-1,-1])}get focus(){return this.$$.ctx[49]}get blur(){return this.$$.ctx[50]}get setQuery(){return this.$$.ctx[51]}get clearList(){return this.$$.ctx[52]}get clearMap(){return this.$$.ctx[53]}}function At(n){let e,t,r,i;return t=new Hr({props:{mapController:n[1],apiKey:"MZEJTanw3WpxRvt7qDfo",country:"gb"}}),{c(){e=T("div"),x(t.$$.fragment),c(e,"class",r=Qe(n[0])+" svelte-189syb7")},m(l,o){B(l,e,o),$(t,e,null),i=!0},p(l,o){const s={};o&2&&(s.mapController=l[1]),t.$set(s),(!i||o&1&&r!==(r=Qe(l[0])+" svelte-189syb7"))&&c(e,"class",r)},i(l){i||(S(t.$$.fragment,l),i=!0)},o(l){F(t.$$.fragment,l),i=!1},d(l){l&&I(e),ee(t)}}}function Kr(n){let e,t,r=n[1]&&At(n);return{c(){r&&r.c(),e=Ue()},m(i,l){r&&r.m(i,l),B(i,e,l),t=!0},p(i,[l]){i[1]?r?(r.p(i,l),l&2&&S(r,1)):(r=At(i),r.c(),S(r,1),r.m(e.parentNode,e)):r&&(Te(),F(r,1,1,()=>{r=null}),ze())},i(i){t||(S(r),t=!0)},o(i){F(r),t=!1},d(i){i&&I(e),r&&r.d(i)}}}function Qr(n,e,t){let r;Me(n,qt,o=>t(2,r=o));let{position:i="top-left"}=e,l;return Zn(()=>{t(1,l=Un(r,Wt))}),n.$$set=o=>{"position"in o&&t(0,i=o.position)},[i,l]}class rl extends K{constructor(e){super(),Q(this,e,Qr,Kr,J,{position:0})}}function Jr(n){let e;return{c(){e=T("ul"),e.innerHTML=`
  • Click +import{S as K,i as Q,s as J,O as ye,e as T,j as c,k as B,T as be,U as ve,V as ke,t as S,o as F,p as I,l as P,f as j,av as st,x as W,N as Oe,bb as Mn,K as Nt,Y as ie,v as de,J as Pe,F as Pn,h as x,m as $,q as ee,E as Cn,aj as Ke,a5 as Ue,bc as Sn,bd as vt,as as Tn,be as zn,w as Ze,a2 as En,aR as Rn,bf as Bn,bg as In,b as Je,c as ut,n as ft,r as Me,aS as kt,bh as _e,a4 as H,bi as Le,a3 as ne,b1 as Qe,bj as Fn,a6 as Te,a7 as ze,ag as ct,aa as dt,bk as On,ak as Gn,al as An,a$ as qt,u as Zn,bl as Un,b3 as Wt,au as wt,am as Nn,a as mt,R as qn,aF as pt,aG as He,aI as Wn,aL as Lt,aN as Fe,aO as Vt,aK as Ie,b2 as Dt,a8 as Ht,af as Vn,bm as Mt,bn as ot,bo as Dn,bp as Hn,ac as Pt}from"./index-a43921db.js";function Kn(n){let e,t;const r=n[1].default,l=ye(r,n,n[0],null);return{c(){e=T("div"),l&&l.c(),c(e,"class","govuk-button-group")},m(i,o){B(i,e,o),l&&l.m(e,null),t=!0},p(i,[o]){l&&l.p&&(!t||o&1)&&be(l,r,i,i[0],t?ke(r,i[0],o,null):ve(i[0]),null)},i(i){t||(S(l,i),t=!0)},o(i){F(l,i),t=!1},d(i){i&&I(e),l&&l.d(i)}}}function Qn(n,e,t){let{$$slots:r={},$$scope:l}=e;return n.$$set=i=>{"$$scope"in i&&t(0,l=i.$$scope)},[l,r]}class Vl extends K{constructor(e){super(),Q(this,e,Qn,Kn,J,{})}}function Jn(n){let e,t,r;const l=n[3].default,i=ye(l,n,n[2],null);return{c(){e=T("fieldset"),t=T("div"),i&&i.c(),c(t,"class",n[0]),c(t,"data-module","govuk-checkboxes"),c(e,"class","govuk-fieldset")},m(o,s){B(o,e,s),P(e,t),i&&i.m(t,null),r=!0},p(o,[s]){i&&i.p&&(!r||s&4)&&be(i,l,o,o[2],r?ke(l,o[2],s,null):ve(o[2]),null)},i(o){r||(S(i,o),r=!0)},o(o){F(i,o),r=!1},d(o){o&&I(e),i&&i.d(o)}}}function Yn(n,e,t){let{$$slots:r={},$$scope:l}=e,{small:i=!1}=e,o=i?"govuk-checkboxes--small":"govuk-checkboxes";return n.$$set=s=>{"small"in s&&t(1,i=s.small),"$$scope"in s&&t(2,l=s.$$scope)},[o,i,l,r]}class Dl extends K{constructor(e){super(),Q(this,e,Yn,Jn,J,{small:1})}}const Xn=n=>({}),Ct=n=>({});function jn(n){let e,t,r,l,i,o,s,a,f;const u=n[5].default,g=ye(u,n,n[4],null),_=n[5].right,m=ye(_,n,n[4],Ct);return{c(){e=T("div"),t=T("input"),r=j(),l=T("label"),g&&g.c(),i=j(),o=T("span"),m&&m.c(),c(t,"type","checkbox"),c(t,"class","govuk-checkboxes__input"),c(t,"id",n[3]),c(l,"class","govuk-label govuk-checkboxes__label"),c(l,"for",n[3]),c(l,"title",n[1]),st(o,"float","right"),c(e,"class","govuk-checkboxes__item"),c(e,"style",n[2])},m(y,L){B(y,e,L),P(e,t),t.checked=n[0],P(e,r),P(e,l),g&&g.m(l,null),P(e,i),P(e,o),m&&m.m(o,null),s=!0,a||(f=[W(t,"change",n[7]),W(t,"change",n[6])],a=!0)},p(y,[L]){L&1&&(t.checked=y[0]),g&&g.p&&(!s||L&16)&&be(g,u,y,y[4],s?ke(u,y[4],L,null):ve(y[4]),null),(!s||L&2)&&c(l,"title",y[1]),m&&m.p&&(!s||L&16)&&be(m,_,y,y[4],s?ke(_,y[4],L,Xn):ve(y[4]),Ct)},i(y){s||(S(g,y),S(m,y),s=!0)},o(y){F(g,y),F(m,y),s=!1},d(y){y&&I(e),g&&g.d(y),m&&m.d(y),a=!1,Oe(f)}}}function xn(n,e,t){let{$$slots:r={},$$scope:l}=e;const i=Mn(r);let{checked:o}=e,{hint:s=null}=e,f=i.right!==void 0?"float: none":"",u=Nt();function g(m){ie.call(this,n,m)}function _(){o=this.checked,t(0,o)}return n.$$set=m=>{"checked"in m&&t(0,o=m.checked),"hint"in m&&t(1,s=m.hint),"$$scope"in m&&t(4,l=m.$$scope)},[o,s,f,u,l,r,g,_]}class Hl extends K{constructor(e){super(),Q(this,e,xn,jn,J,{checked:0,hint:1})}}function $n(n){let e,t,r,l,i,o,s;const a=n[3].default,f=ye(a,n,n[2],null);return{c(){e=T("details"),t=T("summary"),r=T("span"),l=de(n[0]),i=j(),o=T("div"),f&&f.c(),c(r,"class","govuk-details__summary-text"),c(t,"class","govuk-details__summary"),c(o,"class","govuk-details__text"),e.open=n[1],c(e,"class","govuk-details"),c(e,"data-module","govuk-details")},m(u,g){B(u,e,g),P(e,t),P(t,r),P(r,l),P(e,i),P(e,o),f&&f.m(o,null),s=!0},p(u,[g]){(!s||g&1)&&Pe(l,u[0]),f&&f.p&&(!s||g&4)&&be(f,a,u,u[2],s?ke(a,u[2],g,null):ve(u[2]),null),(!s||g&2)&&(e.open=u[1])},i(u){s||(S(f,u),s=!0)},o(u){F(f,u),s=!1},d(u){u&&I(e),f&&f.d(u)}}}function er(n,e,t){let{$$slots:r={},$$scope:l}=e,{label:i}=e,{open:o=!1}=e;return n.$$set=s=>{"label"in s&&t(0,i=s.label),"open"in s&&t(1,o=s.open),"$$scope"in s&&t(2,l=s.$$scope)},[i,o,l,r]}class tr extends K{constructor(e){super(),Q(this,e,er,$n,J,{label:0,open:1})}}function St(n,e,t){const r=n.slice();return r[10]=e[t][0],r[11]=e[t][1],r}function Tt(n){let e,t;return{c(){e=T("div"),t=de(n[2]),c(e,"class","govuk-hint")},m(r,l){B(r,e,l),P(e,t)},p(r,l){l&4&&Pe(t,r[2])},d(r){r&&I(e)}}}function zt(n){let e;return{c(){e=T("option"),e.__value="",Ze(e,e.__value)},m(t,r){B(t,e,r)},d(t){t&&I(e)}}}function Et(n){let e,t=n[11]+"",r,l;return{c(){e=T("option"),r=de(t),e.__value=l=n[10],Ze(e,e.__value)},m(i,o){B(i,e,o),P(e,r)},p(i,o){o&8&&t!==(t=i[11]+"")&&Pe(r,t),o&8&&l!==(l=i[10])&&(e.__value=l,Ze(e,e.__value))},d(i){i&&I(e)}}}function nr(n){let e,t,r,l,i,o,s,a;e=new Cn({props:{errorMessage:n[6]}});let f=n[2]&&Tt(n),u=n[4]&&zt(),g=Ke(n[3]),_=[];for(let m=0;mn[9].call(l))},m(m,y){$(e,m,y),B(m,t,y),f&&f.m(m,y),B(m,r,y),B(m,l,y),u&&u.m(l,null),P(l,i);for(let L=0;L<_.length;L+=1)_[L]&&_[L].m(l,null);vt(l,n[0],!0),o=!0,s||(a=[W(l,"change",n[9]),W(l,"change",n[8])],s=!0)},p(m,y){const L={};if(y&64&&(L.errorMessage=m[6]),e.$set(L),m[2]?f?f.p(m,y):(f=Tt(m),f.c(),f.m(r.parentNode,r)):f&&(f.d(1),f=null),m[4]?u||(u=zt(),u.c(),u.m(l,i)):u&&(u.d(1),u=null),y&8){g=Ke(m[3]);let b;for(b=0;b{"label"in m&&t(1,r=m.label),"hint"in m&&t(2,l=m.hint),"choices"in m&&t(3,i=m.choices),"emptyOption"in m&&t(4,o=m.emptyOption),"disabled"in m&&t(5,s=m.disabled),"errorMessage"in m&&t(6,a=m.errorMessage),"value"in m&&t(0,f=m.value)},[f,r,l,i,o,s,a,u,g,_]}class ir extends K{constructor(e){super(),Q(this,e,lr,rr,J,{label:1,hint:2,choices:3,emptyOption:4,disabled:5,errorMessage:6,value:0})}}function Kl(n,e){let t=new Set(n.getStyle().layers.filter(r=>r.type=="line").map(r=>r.id));if(e=="dataviz")return["Road network","Path"].filter(r=>t.has(r));if(e=="hybrid")return["Path","Road","Tunnel"].filter(r=>t.has(r));if(e=="streets"){let r=[];for(let l of["road","bridge","tunnel"])for(let i of["link","minor","minor_construction","motorway","motorway_construction","motorway_link","path_pedestrian","secondary_tertiary","secondary_tertiary_construction","service_track","service_track_construction","street","trunk_primary","trunk_primary_construction","trunk_primary_link"])r.push(`${l}_${i}`);return r.filter(l=>t.has(l))}return e=="uk-openzoomstack-light"?n.getStyle().layers.filter(r=>r["source-layer"]=="roads"&&r.type=="line").map(r=>r.id):[]}let E=n=>n,te=n=>n,or=n=>n,sr=n=>n,ar=n=>n,ur=n=>n,fr=n=>n,cr=[fr("raster-basemap"),E("parliamentary_constituencies"),E("parliamentary_constituencies-outline"),E("wards"),E("wards-outline"),E("combined_authorities"),E("combined_authorities-outline"),E("local_authority_districts"),E("local_authority_districts-outline"),E("local_planning_authorities"),E("local_planning_authorities-outline"),E("census_output_areas"),E("census_output_areas-outline"),E("imd"),E("imd-outline"),E("pollution"),E("road_noise"),E("mrn"),E("srn"),E("bus_routes"),E("trams"),E("national_cycle_network"),E("cycle_paths"),E("pct_commute"),E("pct_school"),E("road_widths"),E("road_speeds"),E("pavement_widths"),E("gradient"),E("gradient_arrows"),E("education"),E("hospitals"),E("sports_spaces"),E("railway_stations"),E("cycle_parking"),E("crossings"),E("vehicle_counts"),E("stats19"),E("bus_stops"),te("interventions-coverage-polygons-outlines"),te(E("interventions-polygons")),te(E("interventions-polygons-outlines")),te("hover-polygons"),te("hover-lines"),te(E("interventions-lines")),te(E("interventions-lines-endpoints")),te("hover-points"),te(E("interventions-points")),E("problems"),te("edit-polygon-fill"),te("edit-polygon-lines"),te("edit-polygon-vertices"),te("draw-split-route"),te("route-points"),te("route-lines"),te("route-polygons"),or("road_label"),ur(sr(ar("Road labels"))),te("boundary"),E("measurement-line"),te("georeferenced-image"),E("cover-interactive-layers")],dr=En(null);function mr(n,e){return{id:e,beforeId:gr(n,e)}}function gr(n,e){let t=Rn(dr);if(!t){console.warn(`getBeforeId(${e}) called before map is ready. Z-ordering may be incorrect.`);return}let r,l=!1;for(let i=n.layerZorder.length-1;i>=0;i--){let o=n.layerZorder[i];if(o==e){l=!0;break}t.getLayer(o)&&(r=o)}if(!l)throw new Error(`Layer ID ${e} not defined in layerZorder`);return r}const Ql=["==",["geometry-type"],"Polygon"],Jl=["==",["geometry-type"],"LineString"],Yl=["==",["geometry-type"],"Point"];function Xl(){return{type:"FeatureCollection",features:[]}}function jl(n,e,t){let r=["match",n];for(let[l,i]of Object.entries(e))r.push(l),r.push(i);return r.push(t),r}function hr(n){return Bn(n)}function xl(n){var t,r;let e={type:"FeatureCollection",features:[]};for(let l of n.features)if(e.features.push(l),l.geometry.type=="LineString"&&!((t=l.properties)!=null&&t.hide_while_editing))for(let i of[l.geometry.coordinates[0],l.geometry.coordinates[l.geometry.coordinates.length-1]])e.features.push({type:"Feature",properties:{endpoint:!0,scheme_reference:(r=l.properties)==null?void 0:r.scheme_reference},geometry:{type:"Point",coordinates:i}});return e}function $l(n,e,t){let r=["step",n];for(let l=1;lut(e,"value",l)),{c(){x(e.$$.fragment)},m(o,s){$(e,o,s),r=!0},p(o,[s]){const a={};s&1&&(a.disabled=o[0]),!t&&s&2&&(t=!0,a.value=o[1],ft(()=>t=!1)),e.$set(a)},i(o){r||(S(e.$$.fragment,o),r=!0)},o(o){F(e.$$.fragment,o),r=!1},d(o){ee(e,o)}}}function yr(n,e,t){let r;Me(n,kt,o=>t(1,r=o));let{disabled:l=!1}=e;function i(o){r=o,kt.set(r)}return n.$$set=o=>{"disabled"in o&&t(0,l=o.disabled)},[l,r,i]}class ni extends K{constructor(e){super(),Q(this,e,yr,_r,J,{disabled:0})}}function br(n){let e,t;return{c(){e=_e("svg"),t=_e("path"),c(t,"d","M13.12.706a.982.982 0 0 0-1.391 0L6.907 5.517 2.087.696a.982.982 0 1 0-1.391 1.39l4.821 4.821L.696 11.73a.982.982 0 1 0 1.39 1.39l4.821-4.821 4.822 4.821a.982.982 0 1 0 1.39-1.39L8.298 6.908l4.821-4.822a.988.988 0 0 0 0-1.38Z"),c(e,"viewBox","0 0 14 14"),c(e,"width","13"),c(e,"height","13"),c(e,"class","svelte-en2qvf")},m(r,l){B(r,e,l),P(e,t)},p:H,i:H,o:H,d(r){r&&I(e)}}}class Kt extends K{constructor(e){super(),Q(this,e,null,br,J,{})}}function vr(n){let e,t;return{c(){e=_e("svg"),t=_e("path"),c(t,"d","M15 0C6.705 0 0 6.705 0 15C0 23.295 6.705 30 15 30C23.295 30 30 23.295 30 15C30 6.705 23.295 0 15 0ZM22.5 20.385L20.385 22.5L15 17.115L9.615 22.5L7.5 20.385L12.885 15L7.5 9.615L9.615 7.5L15 12.885L20.385 7.5L22.5 9.615L17.115 15L22.5 20.385Z"),c(e,"viewBox","0 0 30 30"),c(e,"fill","none"),c(e,"xmlns","http://www.w3.org/2000/svg"),c(e,"class","svelte-d2loi5")},m(r,l){B(r,e,l),P(e,t)},p:H,i:H,o:H,d(r){r&&I(e)}}}class Qt extends K{constructor(e){super(),Q(this,e,null,vr,J,{})}}function kr(n){let e,t;return{c(){e=T("img"),ne(e.src,t=n[3]+"area.svg")||c(e,"src",t),c(e,"alt",n[6]),c(e,"class","svelte-ltkwvy")},m(r,l){B(r,e,l)},p(r,l){l&8&&!ne(e.src,t=r[3]+"area.svg")&&c(e,"src",t),l&64&&c(e,"alt",r[6])},d(r){r&&I(e)}}}function wr(n){let e,t;return{c(){e=T("img"),ne(e.src,t=n[3]+"reverse.svg")||c(e,"src",t),c(e,"alt",n[6]),c(e,"class","svelte-ltkwvy")},m(r,l){B(r,e,l)},p(r,l){l&8&&!ne(e.src,t=r[3]+"reverse.svg")&&c(e,"src",t),l&64&&c(e,"alt",r[6])},d(r){r&&I(e)}}}function pr(n){let e,t;return{c(){e=T("img"),ne(e.src,t=n[3]+"poi.svg")||c(e,"src",t),c(e,"alt",n[6]),c(e,"class","svelte-ltkwvy")},m(r,l){B(r,e,l)},p(r,l){l&8&&!ne(e.src,t=r[3]+"poi.svg")&&c(e,"src",t),l&64&&c(e,"alt",r[6])},d(r){r&&I(e)}}}function Lr(n){let e,t;return{c(){e=T("img"),ne(e.src,t=n[3]+"postal_code.svg")||c(e,"src",t),c(e,"alt",n[6]),c(e,"class","svelte-ltkwvy")},m(r,l){B(r,e,l)},p(r,l){l&8&&!ne(e.src,t=r[3]+"postal_code.svg")&&c(e,"src",t),l&64&&c(e,"alt",r[6])},d(r){r&&I(e)}}}function Mr(n){let e,t;return{c(){e=T("img"),ne(e.src,t=n[3]+"street.svg")||c(e,"src",t),c(e,"alt",n[6]),c(e,"class","svelte-ltkwvy")},m(r,l){B(r,e,l)},p(r,l){l&8&&!ne(e.src,t=r[3]+"street.svg")&&c(e,"src",t),l&64&&c(e,"alt",r[6])},d(r){r&&I(e)}}}function Pr(n){let e,t;return{c(){e=T("img"),ne(e.src,t=n[3]+"road.svg")||c(e,"src",t),c(e,"alt",n[6]),c(e,"class","svelte-ltkwvy")},m(r,l){B(r,e,l)},p(r,l){l&8&&!ne(e.src,t=r[3]+"road.svg")&&c(e,"src",t),l&64&&c(e,"alt",r[6])},d(r){r&&I(e)}}}function Cr(n){let e,t;return{c(){e=T("img"),ne(e.src,t=n[3]+"housenumber.svg")||c(e,"src",t),c(e,"alt",n[6]),c(e,"class","svelte-ltkwvy")},m(r,l){B(r,e,l)},p(r,l){l&8&&!ne(e.src,t=r[3]+"housenumber.svg")&&c(e,"src",t),l&64&&c(e,"alt",r[6])},d(r){r&&I(e)}}}function Sr(n){let e,t,r,l;return{c(){e=T("img"),ne(e.src,t=n[5])||c(e,"src",t),c(e,"alt",n[4]),c(e,"class","svelte-ltkwvy")},m(i,o){B(i,e,o),r||(l=W(e,"error",n[14]),r=!0)},p(i,o){o&32&&!ne(e.src,t=i[5])&&c(e,"src",t),o&16&&c(e,"alt",i[4])},d(i){i&&I(e),r=!1,l()}}}function Rt(n){let e,t;return{c(){e=T("span"),t=de(n[6]),c(e,"class","secondary svelte-ltkwvy")},m(r,l){B(r,e,l),P(e,t)},p(r,l){l&64&&Pe(t,r[6])},d(r){r&&I(e)}}}function Tr(n){var N,q;let e,t,r,l,i,o,s,a,f=(n[7]?n[0].place_name:n[0].place_name.replace(/,.*/,""))+"",u,g,_=n[2]==="always"||n[2]&&!n[0].address&&((N=n[0].properties)==null?void 0:N.kind)!=="road"&&((q=n[0].properties)==null?void 0:q.kind)!=="road_relation"&&!n[0].id.startsWith("address.")&&!n[0].id.startsWith("postal_code.")&&(!n[0].id.startsWith("poi.")||!n[5])&&!n[7],m,y,L=(n[7]?"":n[0].place_name.replace(/[^,]*,?\s*/,""))+"",b,p,Z;function v(C,M){var oe,h;return M&1&&(t=null),M&1&&(r=null),M&1&&(l=null),C[5]?Sr:C[0].address?Cr:((oe=C[0].properties)==null?void 0:oe.kind)==="road"||((h=C[0].properties)==null?void 0:h.kind)==="road_relation"?Pr:(t==null&&(t=!!C[0].id.startsWith("address.")),t?Mr:(r==null&&(r=!!C[0].id.startsWith("postal_code.")),r?Lr:(l==null&&(l=!!C[0].id.startsWith("poi.")),l?pr:C[7]?wr:kr)))}let R=v(n,-1),k=R(n),U=_&&Rt(n);return{c(){e=T("li"),k.c(),i=j(),o=T("span"),s=T("span"),a=T("span"),u=de(f),g=j(),U&&U.c(),m=j(),y=T("span"),b=de(L),c(a,"class","primary svelte-ltkwvy"),c(s,"class","svelte-ltkwvy"),c(y,"class","line2 svelte-ltkwvy"),c(o,"class","texts svelte-ltkwvy"),c(e,"tabindex","0"),c(e,"data-selected",n[1]),c(e,"class","svelte-ltkwvy"),Le(e,"selected",n[1])},m(C,M){B(C,e,M),k.m(e,null),P(e,i),P(e,o),P(o,s),P(s,a),P(a,u),P(s,g),U&&U.m(s,null),P(o,m),P(o,y),P(y,b),p||(Z=[W(e,"mouseenter",n[12]),W(e,"focus",n[13])],p=!0)},p(C,[M]){var oe,h;R===(R=v(C,M))&&k?k.p(C,M):(k.d(1),k=R(C),k&&(k.c(),k.m(e,i))),M&1&&f!==(f=(C[7]?C[0].place_name:C[0].place_name.replace(/,.*/,""))+"")&&Pe(u,f),M&37&&(_=C[2]==="always"||C[2]&&!C[0].address&&((oe=C[0].properties)==null?void 0:oe.kind)!=="road"&&((h=C[0].properties)==null?void 0:h.kind)!=="road_relation"&&!C[0].id.startsWith("address.")&&!C[0].id.startsWith("postal_code.")&&(!C[0].id.startsWith("poi.")||!C[5])&&!C[7]),_?U?U.p(C,M):(U=Rt(C),U.c(),U.m(s,null)):U&&(U.d(1),U=null),M&1&&L!==(L=(C[7]?"":C[0].place_name.replace(/[^,]*,?\s*/,""))+"")&&Pe(b,L),M&2&&c(e,"data-selected",C[1]),M&2&&Le(e,"selected",C[1])},i:H,o:H,d(C){C&&I(e),k.d(),U&&U.d(),p=!1,Oe(Z)}}}function zr(n,e,t){var v;let r,l,{feature:i}=e,{selected:o=!1}=e,{showPlaceType:s}=e,{missingIconsCache:a}=e,{iconsBaseUrl:f}=e;const u=(v=i.properties)==null?void 0:v.categories;let g,_,m=0,y=i.place_type[0]==="reverse";function L(){_&&a.add(_),t(10,m++,m)}function b(R){ie.call(this,n,R)}function p(R){ie.call(this,n,R)}const Z=()=>L();return n.$$set=R=>{"feature"in R&&t(0,i=R.feature),"selected"in R&&t(1,o=R.selected),"showPlaceType"in R&&t(2,s=R.showPlaceType),"missingIconsCache"in R&&t(9,a=R.missingIconsCache),"iconsBaseUrl"in R&&t(3,f=R.iconsBaseUrl)},n.$$.update=()=>{var R,k,U,N;if(n.$$.dirty&3640)do t(11,r--,r),t(4,g=u==null?void 0:u[r]),t(5,_=g?f+g.replace(/ /g,"_")+".svg":void 0);while(r>-1&&(!_||a.has(_)));n.$$.dirty&1&&t(6,l=i.id.startsWith("poi.")?(k=(R=i.properties)==null?void 0:R.categories)==null?void 0:k.join(", "):((N=(U=i.properties)==null?void 0:U.place_type_name)==null?void 0:N[0])??i.place_type[0])},t(11,r=(u==null?void 0:u.length)??0),[i,o,s,f,g,_,l,y,L,a,m,r,b,p,Z]}class Er extends K{constructor(e){super(),Q(this,e,zr,Tr,J,{feature:0,selected:1,showPlaceType:2,missingIconsCache:9,iconsBaseUrl:3})}}function Rr(n){let e;return{c(){e=T("div"),e.innerHTML='',c(e,"class","svelte-7cmwmc")},m(t,r){B(t,e,r)},p:H,i:H,o:H,d(t){t&&I(e)}}}class Br extends K{constructor(e){super(),Q(this,e,null,Rr,J,{})}}function Ir(n){let e,t;return{c(){e=_e("svg"),t=_e("path"),c(t,"d","M30.003-26.765C13.46-26.765 0-14.158 0 1.337c0 23.286 24.535 42.952 28.39 46.04.24.192.402.316.471.376.323.282.732.424 1.142.424.41 0 .82-.142 1.142-.424.068-.06.231-.183.471-.376 3.856-3.09 28.39-22.754 28.39-46.04 0-15.495-13.46-28.102-30.003-28.102Zm1.757 12.469c4.38 0 7.858 1.052 10.431 3.158 2.595 2.105 3.89 4.913 3.89 8.422 0 2.34-.53 4.362-1.593 6.063-1.063 1.702-3.086 3.616-6.063 5.742-2.042 1.51-3.337 2.659-3.89 3.446-.532.787-.8 1.82-.8 3.096v1.914h-8.449V15.18c0-2.041.434-3.815 1.306-5.325.872-1.51 2.467-3.118 4.785-4.82 2.233-1.594 3.7-2.89 4.402-3.889a5.582 5.582 0 0 0 1.087-3.35c0-1.382-.51-2.435-1.531-3.158-1.02-.723-2.45-1.087-4.28-1.087-3.19 0-6.826 1.047-10.91 3.131l-3.472-6.986c4.742-2.659 9.77-3.992 15.087-3.992Zm-1.88 37.324c1.765 0 3.124.472 4.08 1.408.98.936 1.47 2.276 1.47 4.02 0 1.68-.49 3.007-1.47 3.985-.977.957-2.336 1.435-4.08 1.435-1.787 0-3.171-.465-4.15-1.4-.978-.958-1.47-2.298-1.47-4.02 0-1.787.48-3.14 1.436-4.054.957-.915 2.355-1.374 4.184-1.374Z"),c(e,"viewBox","0 0 60.006 21.412"),c(e,"width","14"),c(e,"height","20"),c(e,"class","svelte-en2qvf")},m(r,l){B(r,e,l),P(e,t)},p:H,i:H,o:H,d(r){r&&I(e)}}}class Fr extends K{constructor(e){super(),Q(this,e,null,Ir,J,{})}}function Or(n){let e,t,r;return{c(){e=_e("svg"),t=_e("circle"),r=_e("path"),c(t,"cx","4.789"),c(t,"cy","4.787"),c(t,"r","3.85"),c(t,"class","svelte-1aq105l"),c(r,"d","M12.063 12.063 7.635 7.635"),c(r,"class","svelte-1aq105l"),c(e,"xmlns","http://www.w3.org/2000/svg"),c(e,"width","13"),c(e,"height","13"),c(e,"viewBox","0 0 13 13"),c(e,"class","svelte-1aq105l")},m(l,i){B(l,e,i),P(e,t),P(e,r)},p:H,i:H,o:H,d(l){l&&I(e)}}}class Gr extends K{constructor(e){super(),Q(this,e,null,Or,J,{})}}function Ar(n,e,t){const r=e[1],l=e[0],i=r-l;return n===r&&t?n:((n-l)%i+i)%i+l}function Bt(n){const e=[...n];return e[2]r[0]||l.maxZoom!=null&&l.maxZoomDate.now()){if(!Ae.coords)break e;return Ae.coords}let i;try{return i=await new Promise((o,s)=>{t.signal.addEventListener("abort",()=>{s(Error("aborted"))}),navigator.geolocation.getCurrentPosition(a=>{o([a.coords.longitude,a.coords.latitude].map(f=>f.toFixed(6)).join(","))},a=>{s(a)},l)}),i}catch{}finally{l.cachedLocationExpiry&&(Ae={time:Date.now(),coords:i})}if(t.signal.aborted)return}if(l.type==="server-geolocation")return"ip";if(r&&l.type==="map-center")return r[1].toFixed(6)+","+r[2].toFixed(6)}}function It(n,e,t){const r=n.slice();return r[81]=e[t],r[83]=t,r}function Ft(n){let e,t;return e=new Br({}),{c(){x(e.$$.fragment)},m(r,l){$(e,r,l),t=!0},i(r){t||(S(e.$$.fragment,r),t=!0)},o(r){F(e.$$.fragment,r),t=!1},d(r){ee(e,r)}}}function Ot(n){let e,t,r,l,i;return t=new Fr({}),{c(){e=T("button"),x(t.$$.fragment),c(e,"type","button"),c(e,"title",n[9]),c(e,"class","svelte-zh3kmv"),Le(e,"active",n[0])},m(o,s){B(o,e,s),$(t,e,null),r=!0,l||(i=W(e,"click",n[67]),l=!0)},p(o,s){(!r||s[0]&512)&&c(e,"title",o[9]),(!r||s[0]&1)&&Le(e,"active",o[0])},i(o){r||(S(t.$$.fragment,o),r=!0)},o(o){F(t.$$.fragment,o),r=!1},d(o){o&&I(e),ee(t),l=!1,i()}}}function Ur(n){let e,t=[],r=new Map,l,i,o,s=Ke(n[14]);const a=f=>f[81].id+(f[81].address?","+f[81].address:"");for(let f=0;f{N=null}),ze()),(!v||V[0]&2)&&Le(f,"displayable",z[1]!==""),z[5]===!0?q?(q.p(z,V),V[0]&32&&S(q,1)):(q=Ot(z),q.c(),S(q,1),q.m(r,y)):q&&(Te(),F(q,1,1,()=>{q=null}),ze()),M&&M.p&&(!v||V[1]&134217728)&&be(M,C,z,z[58],v?ke(C,z[58],V,null):ve(z[58]),null);let le=b;b=we(z),b===le?~b&&h[b].p(z,V):(p&&(Te(),F(h[le],1,1,()=>{h[le]=null}),ze()),~b?(p=h[b],p?p.p(z,V):(p=h[b]=oe[b](z),p.c()),S(p,1),p.m(t,null)):p=null),(!v||V[0]&4&&Z!==(Z=Qe(z[2])+" svelte-zh3kmv"))&&c(t,"class",Z),(!v||V[0]&22)&&Le(t,"can-collapse",z[4]&&z[1]==="")},i(z){v||(S(U),S(i.$$.fragment,z),S(g.$$.fragment,z),S(N),S(q),S(M,z),S(p),v=!0)},o(z){F(U),F(i.$$.fragment,z),F(g.$$.fragment,z),F(N),F(q),F(M,z),F(p),v=!1},d(z){z&&(I(e),I(t)),ee(i),n[61](null),ee(g),N&&N.d(),q&&q.d(),M&&M.d(z),~b&&h[b].d(),R=!1,Oe(k)}}}function Dr(n,e,t){let r,{$$slots:l={},$$scope:i}=e,{class:o=void 0}=e,{apiKey:s}=e,{bbox:a=void 0}=e,{clearButtonTitle:f="clear"}=e,{clearOnBlur:u=!1}=e,{collapsed:g=!1}=e,{country:_=void 0}=e,{debounceSearch:m=200}=e,{enableReverse:y=!1}=e,{errorMessage:L="Something went wrong…"}=e,{filter:b=()=>!0}=e,{flyTo:p=!0}=e,{fuzzyMatch:Z=!0}=e,{language:v=void 0}=e,{limit:R=void 0}=e,{mapController:k=void 0}=e,{minLength:U=2}=e,{noResultsMessage:N="Oops! Looks like you're trying to predict something that's not quite right. We can't seem to find what you're looking for. Maybe try double-checking your spelling or try a different search term. Keep on typing - we'll do our best to get you where you need to go!"}=e,{placeholder:q="Search"}=e,{proximity:C=[{type:"server-geolocation"}]}=e,{reverseActive:M=y==="always"}=e,{reverseButtonTitle:oe="toggle reverse geocoding"}=e,{searchValue:h=""}=e,{showFullGeometry:we=!0}=e,{showPlaceType:z="ifNeeded"}=e,{showResultsWhileTyping:V=!0}=e,{selectFirst:le=!0}=e,{flyToSelected:w=!1}=e,{markerOnSelected:ce=!0}=e,{types:se=void 0}=e,{excludeTypes:me=!1}=e,{zoom:Ge=16}=e,{maxZoom:Ee=18}=e,{apiUrl:Xe="https://api.maptiler.com/geocoding"}=e,{fetchParameters:je={}}=e,{iconsBaseUrl:ht="https://cdn.maptiler.com/maptiler-geocoding-control/v1.3.1/icons/"}=e,{adjustUrlQuery:xe=()=>{}}=e;function nn(){ge.focus()}function rn(){ge.blur()}function _t(d,X=!0,ae=!1){t(1,h=d),X?(t(15,D=-1),bt()):(nt(!ae,ae),setTimeout(()=>{ge.focus(),ge.select()}))}function ln(){t(14,G=void 0),t(55,O=void 0),t(15,D=-1)}function on(){t(54,Y=[]),t(55,O=void 0)}let Re=!1,G,Y,O,yt="",ge,D=-1,he,qe=[],Se,Be,We,$e;const sn=new Set,pe=ct();dt(()=>{k&&(k.setEventHandler(void 0),k.indicateReverse(!1),k.setSelectedMarker(-1),k.setMarkers(void 0,void 0))});function bt(d){if(Be&&(clearTimeout(Be),Be=void 0),D>-1&&G)t(55,O=G[D]),t(1,h=O.place_type[0]==="reverse"?O.place_name:O.place_name.replace(/,.*/,"")),t(18,he=void 0),t(54,Y=void 0),t(15,D=-1);else if(h){const X=d||!et(h);tt(h,{exact:!0}).then(()=>{t(54,Y=G),t(55,O=void 0),X&&an()}).catch(ae=>t(18,he=ae))}}function et(d){try{return On(d,6)}catch{return!1}}async function tt(d,{byId:X=!1,exact:ae=!1}={}){t(18,he=void 0),Se==null||Se.abort();const ue=new AbortController;t(19,Se=ue);try{const A=et(d),fe=new URLSearchParams;if(v!==void 0&&fe.set("language",Array.isArray(v)?v.join(","):v??""),se&&fe.set("types",se.join(",")),me&&fe.set("excludeTypes",String(me)),a&&fe.set("bbox",a.map(De=>De.toFixed(6)).join(",")),_&&fe.set("country",Array.isArray(_)?_.join(","):_),!X&&!A){const De=await Zr(k,C,ue);De&&fe.set("proximity",De),(ae||!V)&&fe.set("autocomplete","false"),fe.set("fuzzyMatch",String(Z))}R!==void 0&&(!A||(se==null?void 0:se.length)===1)&&fe.set("limit",String(R)),fe.set("key",s),xe(fe);const Ve=Xe+"/"+encodeURIComponent(A?A.decimalLongitude+","+A.decimalLatitude:d)+".json?"+fe.toString();if(Ve===yt){X?(t(14,G=void 0),t(55,O=qe[0])):t(14,G=qe);return}yt=Ve;const lt=await fetch(Ve,{signal:ue.signal,...je});if(!lt.ok)throw new Error(await lt.text());const it=await lt.json();pe("response",{url:Ve,featureCollection:it}),X?(t(14,G=void 0),t(55,O=it.features[0]),qe=[O]):(t(14,G=it.features.filter(b)),A&&G.unshift({type:"Feature",properties:{},id:"reverse_"+A.decimalLongitude+"_"+A.decimalLatitude,text:A.decimalLatitude+", "+A.decimalLongitude,place_name:A.decimalLatitude+", "+A.decimalLongitude,place_type:["reverse"],center:[A.decimalLongitude,A.decimalLatitude],bbox:[A.decimalLongitude,A.decimalLatitude,A.decimalLongitude,A.decimalLatitude],geometry:{type:"Point",coordinates:[A.decimalLongitude,A.decimalLatitude]}}),qe=G,A&&ge.focus())}catch(A){if(A&&typeof A=="object"&&"name"in A&&A.name==="AbortError")return;throw A}finally{ue===Se&&t(19,Se=void 0)}}function an(){var ae;if(!(Y!=null&&Y.length)||!p)return;const d=[180,90,-180,-90],X=!Y.some(ue=>!ue.matching_text);for(const ue of Y)if(X||!ue.matching_text)for(const A of[0,1,2,3])d[A]=Math[A<2?"min":"max"](d[A],((ae=ue.bbox)==null?void 0:ae[A])??ue.center[A%2]);k&&Y.length>0&&(O&&d[0]===d[2]&&d[1]===d[3]?k.flyTo(O.center,Ge):k.fitBounds(Bt(d),50,Ee))}function un(d){t(0,M=y==="always"),t(14,G=void 0),t(55,O=void 0),t(15,D=-1),_t(d[1].toFixed(6)+", "+Ar(d[0],[-180,180],!0).toFixed(6),!1,!0)}function fn(d){if(!G)return;let X=d.key==="ArrowDown"?1:d.key==="ArrowUp"?-1:0;X&&(D===(le?0:-1)&&X===-1&&t(15,D=G.length),t(15,D+=X),D>=G.length&&t(15,D=-1),D<0&&le&&t(15,D=0),d.preventDefault())}function nt(d=!0,X=!1){if(t(18,he=void 0),V||X){if(Be&&clearTimeout(Be),h.length{tt(ae).catch(ue=>t(18,he=ue))},d?m:0)}else t(14,G=void 0),t(18,he=void 0)}function rt(d){t(55,O=d),t(1,h=d.place_name),t(15,D=-1)}const cn=()=>ge.focus();function dn(d){Je[d?"unshift":"push"](()=>{ge=d,t(17,ge)})}function mn(){h=this.value,t(1,h),t(13,Re),t(27,u)}const gn=()=>t(13,Re=!0),hn=()=>t(13,Re=!1),_n=()=>nt(),yn=()=>{t(1,h=""),ge.focus()},bn=()=>t(0,M=!M),vn=()=>t(18,he=void 0),kn=d=>t(15,D=d),wn=d=>rt(d),pn=()=>{le||t(15,D=-1)},Ln=()=>{};return n.$$set=d=>{"class"in d&&t(2,o=d.class),"apiKey"in d&&t(25,s=d.apiKey),"bbox"in d&&t(26,a=d.bbox),"clearButtonTitle"in d&&t(3,f=d.clearButtonTitle),"clearOnBlur"in d&&t(27,u=d.clearOnBlur),"collapsed"in d&&t(4,g=d.collapsed),"country"in d&&t(28,_=d.country),"debounceSearch"in d&&t(29,m=d.debounceSearch),"enableReverse"in d&&t(5,y=d.enableReverse),"errorMessage"in d&&t(6,L=d.errorMessage),"filter"in d&&t(30,b=d.filter),"flyTo"in d&&t(31,p=d.flyTo),"fuzzyMatch"in d&&t(32,Z=d.fuzzyMatch),"language"in d&&t(33,v=d.language),"limit"in d&&t(34,R=d.limit),"mapController"in d&&t(35,k=d.mapController),"minLength"in d&&t(36,U=d.minLength),"noResultsMessage"in d&&t(7,N=d.noResultsMessage),"placeholder"in d&&t(8,q=d.placeholder),"proximity"in d&&t(37,C=d.proximity),"reverseActive"in d&&t(0,M=d.reverseActive),"reverseButtonTitle"in d&&t(9,oe=d.reverseButtonTitle),"searchValue"in d&&t(1,h=d.searchValue),"showFullGeometry"in d&&t(38,we=d.showFullGeometry),"showPlaceType"in d&&t(10,z=d.showPlaceType),"showResultsWhileTyping"in d&&t(39,V=d.showResultsWhileTyping),"selectFirst"in d&&t(11,le=d.selectFirst),"flyToSelected"in d&&t(40,w=d.flyToSelected),"markerOnSelected"in d&&t(41,ce=d.markerOnSelected),"types"in d&&t(42,se=d.types),"excludeTypes"in d&&t(43,me=d.excludeTypes),"zoom"in d&&t(44,Ge=d.zoom),"maxZoom"in d&&t(45,Ee=d.maxZoom),"apiUrl"in d&&t(46,Xe=d.apiUrl),"fetchParameters"in d&&t(47,je=d.fetchParameters),"iconsBaseUrl"in d&&t(12,ht=d.iconsBaseUrl),"adjustUrlQuery"in d&&t(48,xe=d.adjustUrlQuery),"$$scope"in d&&t(58,i=d.$$scope)},n.$$.update=()=>{if(n.$$.dirty[0]&32&&t(0,M=y==="always"),n.$$.dirty[0]&134225920&&setTimeout(()=>{t(16,We=Re),u&&!Re&&t(1,h="")}),n.$$.dirty[0]&16386|n.$$.dirty[1]&32&&h.lengtht(18,he=d)),n.$$.dirty[1]&50356241&&(k&&O&&O.id!==$e&&p&&(!O.bbox||O.bbox[0]===O.bbox[2]&&O.bbox[1]===O.bbox[3]?k.flyTo(O.center,O.id.startsWith("poi.")||O.id.startsWith("address.")?Ee:Ge):k.fitBounds(Bt(O.bbox),50,Ee),t(14,G=void 0),t(54,Y=void 0),t(15,D=-1)),t(56,$e=O==null?void 0:O.id)),n.$$.dirty[0]&18432&&le&&G!=null&&G.length&&t(15,D=0),n.$$.dirty[0]&2050&&(le||t(15,D=-1)),n.$$.dirty[0]&16384|n.$$.dirty[1]&8388608&&Y!==G&&t(54,Y=void 0),n.$$.dirty[0]&81921|n.$$.dirty[1]&8388624&&k&&k.setEventHandler(d=>{switch(d.type){case"mapClick":M&&un(d.coordinates);break;case"markerClick":{const X=G==null?void 0:G.find(ae=>ae.id===d.id);X&&rt(X)}break;case"markerMouseEnter":Y&&t(15,D=We?(G==null?void 0:G.findIndex(X=>X.id===d.id))??-1:-1);break;case"markerMouseLeave":Y&&t(15,D=-1);break}}),n.$$.dirty[0]&49152&&t(57,r=G==null?void 0:G[D]),n.$$.dirty[1]&67133969&&k&&r&&p&&w&&k.flyTo(r.center,r.id.startsWith("poi.")||r.id.startsWith("address.")?Ee:Ge),n.$$.dirty[1]&1040&&(ce||k==null||k.setMarkers(void 0,void 0)),n.$$.dirty[1]&75498512&&k&&ce&&!Y&&(k.setMarkers(r?[r]:void 0,void 0),k.setSelectedMarker(r?0:-1)),n.$$.dirty[1]&25165840&&k&&k.setMarkers(Y,O),n.$$.dirty[0]&32768|n.$$.dirty[1]&8388624&&Y&&k&&k.setSelectedMarker(D),n.$$.dirty[0]&2|n.$$.dirty[1]&16&&k){const d=et(h);k.setReverseMarker(d?[d.decimalLongitude,d.decimalLatitude]:void 0)}n.$$.dirty[1]&67108864&&pe("select",r),n.$$.dirty[1]&16777216&&pe("pick",O),n.$$.dirty[0]&81920&&pe("optionsVisibilityChange",We&&!!G),n.$$.dirty[0]&16384&&pe("featuresListed",G),n.$$.dirty[1]&8388608&&pe("featuresMarked",Y),n.$$.dirty[0]&1&&pe("reverseToggle",M),n.$$.dirty[0]&2&&pe("queryChange",h),n.$$.dirty[0]&1|n.$$.dirty[1]&16&&k&&k.indicateReverse(M)},[M,h,o,f,g,y,L,N,q,oe,z,le,ht,Re,G,D,We,ge,he,Se,sn,bt,fn,nt,rt,s,a,u,_,m,b,p,Z,v,R,k,U,C,we,V,w,ce,se,me,Ge,Ee,Xe,je,xe,nn,rn,_t,ln,on,Y,O,$e,r,i,l,cn,dn,mn,gn,hn,_n,yn,bn,vn,kn,wn,pn,Ln]}class Hr extends K{constructor(e){super(),Q(this,e,Dr,Vr,J,{class:2,apiKey:25,bbox:26,clearButtonTitle:3,clearOnBlur:27,collapsed:4,country:28,debounceSearch:29,enableReverse:5,errorMessage:6,filter:30,flyTo:31,fuzzyMatch:32,language:33,limit:34,mapController:35,minLength:36,noResultsMessage:7,placeholder:8,proximity:37,reverseActive:0,reverseButtonTitle:9,searchValue:1,showFullGeometry:38,showPlaceType:10,showResultsWhileTyping:39,selectFirst:11,flyToSelected:40,markerOnSelected:41,types:42,excludeTypes:43,zoom:44,maxZoom:45,apiUrl:46,fetchParameters:47,iconsBaseUrl:12,adjustUrlQuery:48,focus:49,blur:50,setQuery:51,clearList:52,clearMap:53},null,[-1,-1,-1])}get focus(){return this.$$.ctx[49]}get blur(){return this.$$.ctx[50]}get setQuery(){return this.$$.ctx[51]}get clearList(){return this.$$.ctx[52]}get clearMap(){return this.$$.ctx[53]}}function At(n){let e,t,r,l;return t=new Hr({props:{mapController:n[1],apiKey:"MZEJTanw3WpxRvt7qDfo",country:"gb"}}),{c(){e=T("div"),x(t.$$.fragment),c(e,"class",r=Qe(n[0])+" svelte-189syb7")},m(i,o){B(i,e,o),$(t,e,null),l=!0},p(i,o){const s={};o&2&&(s.mapController=i[1]),t.$set(s),(!l||o&1&&r!==(r=Qe(i[0])+" svelte-189syb7"))&&c(e,"class",r)},i(i){l||(S(t.$$.fragment,i),l=!0)},o(i){F(t.$$.fragment,i),l=!1},d(i){i&&I(e),ee(t)}}}function Kr(n){let e,t,r=n[1]&&At(n);return{c(){r&&r.c(),e=Ue()},m(l,i){r&&r.m(l,i),B(l,e,i),t=!0},p(l,[i]){l[1]?r?(r.p(l,i),i&2&&S(r,1)):(r=At(l),r.c(),S(r,1),r.m(e.parentNode,e)):r&&(Te(),F(r,1,1,()=>{r=null}),ze())},i(l){t||(S(r),t=!0)},o(l){F(r),t=!1},d(l){l&&I(e),r&&r.d(l)}}}function Qr(n,e,t){let r;Me(n,qt,o=>t(2,r=o));let{position:l="top-left"}=e,i;return Zn(()=>{t(1,i=Un(r,Wt))}),n.$$set=o=>{"position"in o&&t(0,l=o.position)},[l,i]}class ri extends K{constructor(e){super(),Q(this,e,Qr,Kr,J,{position:0})}}function Jr(n){let e;return{c(){e=T("ul"),e.innerHTML=`
  • Click on the map to open a new tab with a 3rd-party imagery provider
  • Press Escape - to exit this mode
  • Cursor by Luc Chaissac
  • `},m(t,r){B(t,e,r)},p:H,i:H,o:H,d(t){t&&I(e)}}}class Yr extends K{constructor(e){super(),Q(this,e,null,Jr,J,{})}}const Xr="/atip/ss_huge_refactor_pt1/assets/camera_cursor-824d29b6.svg",{window:jr}=Nn;function Zt(n){let e,t,r,i;const l=[$r,xr],o=[];function s(a,f){return a[0]?0:1}return e=s(n),t=o[e]=l[e](n),{c(){t.c(),r=Ue()},m(a,f){o[e].m(a,f),B(a,r,f),i=!0},p(a,f){let u=e;e=s(a),e===u?o[e].p(a,f):(Te(),F(o[u],1,1,()=>{o[u]=null}),ze(),t=o[e],t?t.p(a,f):(t=o[e]=l[e](a),t.c()),S(t,1),t.m(r.parentNode,r))},i(a){i||(S(t),i=!0)},o(a){F(t),i=!1},d(a){a&&I(r),o[e].d(a)}}}function xr(n){let e,t;return e=new mt({props:{$$slots:{default:[ei]},$$scope:{ctx:n}}}),e.$on("click",n[8]),{c(){x(e.$$.fragment)},m(r,i){$(e,r,i),t=!0},p(r,i){const l={};i&8192&&(l.$$scope={dirty:i,ctx:r}),e.$set(l)},i(r){t||(S(e.$$.fragment,r),t=!0)},o(r){F(e.$$.fragment,r),t=!1},d(r){ee(e,r)}}}function $r(n){let e,t,r,i,l,o,s;e=new mt({props:{$$slots:{default:[ti]},$$scope:{ctx:n}}}),e.$on("click",n[6]);function a(u){n[7](u)}let f={legend:"Source",choices:[["google","Google Street View"],["bing","Bing Streetside"]]};return n[2].streetViewImagery!==void 0&&(f.value=n[2].streetViewImagery),r=new qn({props:f}),Je.push(()=>ut(r,"value",a)),o=new tr({props:{label:"Help",$$slots:{default:[ni]},$$scope:{ctx:n}}}),{c(){x(e.$$.fragment),t=j(),x(r.$$.fragment),l=j(),x(o.$$.fragment)},m(u,g){$(e,u,g),B(u,t,g),$(r,u,g),B(u,l,g),$(o,u,g),s=!0},p(u,g){const _={};g&8192&&(_.$$scope={dirty:g,ctx:u}),e.$set(_);const m={};!i&&g&4&&(i=!0,m.value=u[2].streetViewImagery,ft(()=>i=!1)),r.$set(m);const y={};g&8192&&(y.$$scope={dirty:g,ctx:u}),o.$set(y)},i(u){s||(S(e.$$.fragment,u),S(r.$$.fragment,u),S(o.$$.fragment,u),s=!0)},o(u){F(e.$$.fragment,u),F(r.$$.fragment,u),F(o.$$.fragment,u),s=!1},d(u){u&&(I(t),I(l)),ee(e,u),ee(r,u),ee(o,u)}}}function ei(n){let e;return{c(){e=de("Enable Street View")},m(t,r){B(t,e,r)},d(t){t&&I(e)}}}function ti(n){let e;return{c(){e=de("Disable Street View")},m(t,r){B(t,e,r)},d(t){t&&I(e)}}}function ni(n){let e,t;return e=new Yr({}),{c(){x(e.$$.fragment)},m(r,i){$(e,r,i),t=!0},i(r){t||(S(e.$$.fragment,r),t=!0)},o(r){F(e.$$.fragment,r),t=!1},d(r){ee(e,r)}}}function ri(n){let e,t,r,i,l=n[1]&&Zt(n);return{c(){l&&l.c(),e=Ue()},m(o,s){l&&l.m(o,s),B(o,e,s),t=!0,r||(i=W(jr,"keydown",n[3]),r=!0)},p(o,[s]){o[1]?l?(l.p(o,s),s&2&&S(l,1)):(l=Zt(o),l.c(),S(l,1),l.m(e.parentNode,e)):l&&(Te(),F(l,1,1,()=>{l=null}),ze())},i(o){t||(S(l),t=!0)},o(o){F(l),t=!1},d(o){o&&I(e),l&&l.d(o),r=!1,i()}}}function ii(n,e,t){let r;Me(n,wt,b=>t(2,r=b));let{cfg:i}=e,{map:l}=e,{enabled:o}=e,{showControls:s=!0}=e,a=[];function f(){if(l){l.on("click",g),l.getCanvas().style.cursor=`url(${Xr}), auto`;for(let b of i.getStreetViewRoadLayerNames(l))a.push([b,l.getPaintProperty(b,"line-color")]),l.setPaintProperty(b,"line-color","cyan")}}function u(){if(l){l.off("click",g),l.getCanvas().style.cursor="inherit";for(let[b,p]of a)l.setPaintProperty(b,"line-color",p);a=[]}}dt(u);function g(b){if(!o)return;let p=b.lngLat.lng,Z=b.lngLat.lat;r.streetViewImagery=="google"?window.open(`http://maps.google.com/maps?q=&layer=c&cbll=${Z},${p}&cbp=11,0,0,0,0`,"_blank"):r.streetViewImagery=="bing"&&window.open(`https://www.bing.com/maps?cp=${Z}~${p}&style=x`,"_blank")}function _(b){o&&b.key=="Escape"&&(b.stopPropagation(),t(0,o=!1))}const m=()=>t(0,o=!1);function y(b){n.$$.not_equal(r.streetViewImagery,b)&&(r.streetViewImagery=b,wt.set(r))}const L=()=>t(0,o=!0);return n.$$set=b=>{"cfg"in b&&t(4,i=b.cfg),"map"in b&&t(5,l=b.map),"enabled"in b&&t(0,o=b.enabled),"showControls"in b&&t(1,s=b.showControls)},n.$$.update=()=>{n.$$.dirty&1&&(o?f():u())},[o,s,r,_,i,l,m,y,L]}class il extends K{constructor(e){super(),Q(this,e,ii,ri,J,{cfg:4,map:5,enabled:0,showControls:1})}}var li=Object.defineProperty,Ce=(n,e)=>li(n,"name",{value:e,configurable:!0});function at(n){if(!n)throw new Error("coord is required");if(!Array.isArray(n)){if(n.type==="Feature"&&n.geometry!==null&&n.geometry.type==="Point")return[...n.geometry.coordinates];if(n.type==="Point")return[...n.coordinates]}if(Array.isArray(n)&&n.length>=2&&!Array.isArray(n[0])&&!Array.isArray(n[1]))return[...n];throw new Error("coord must be GeoJSON Point or an Array of numbers")}Ce(at,"getCoord");function oi(n){if(Array.isArray(n))return n;if(n.type==="Feature"){if(n.geometry!==null)return n.geometry.coordinates}else if(n.coordinates)return n.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}Ce(oi,"getCoords");function Jt(n){if(n.length>1&&pt(n[0])&&pt(n[1]))return!0;if(Array.isArray(n[0])&&n[0].length)return Jt(n[0]);throw new Error("coordinates must only contain numbers")}Ce(Jt,"containsNumber");function si(n,e,t){if(!e||!t)throw new Error("type and name required");if(!n||n.type!==e)throw new Error("Invalid input to "+t+": must be a "+e+", given "+n.type)}Ce(si,"geojsonType");function ai(n,e,t){if(!n)throw new Error("No feature passed");if(!t)throw new Error(".featureOf() requires a name");if(!n||n.type!=="Feature"||!n.geometry)throw new Error("Invalid input to "+t+", Feature with geometry required");if(!n.geometry||n.geometry.type!==e)throw new Error("Invalid input to "+t+": must be a "+e+", given "+n.geometry.type)}Ce(ai,"featureOf");function ui(n,e,t){if(!n)throw new Error("No featureCollection passed");if(!t)throw new Error(".collectionOf() requires a name");if(!n||n.type!=="FeatureCollection")throw new Error("Invalid input to "+t+", FeatureCollection required");for(const r of n.features){if(!r||r.type!=="Feature"||!r.geometry)throw new Error("Invalid input to "+t+", Feature with geometry required");if(!r.geometry||r.geometry.type!==e)throw new Error("Invalid input to "+t+": must be a "+e+", given "+r.geometry.type)}}Ce(ui,"collectionOf");function fi(n){return n.type==="Feature"?n.geometry:n}Ce(fi,"getGeom");function ci(n,e){return n.type==="FeatureCollection"?"FeatureCollection":n.type==="GeometryCollection"?"GeometryCollection":n.type==="Feature"&&n.geometry!==null?n.geometry.type:n.type}Ce(ci,"getType");var di=Object.defineProperty,mi=(n,e)=>di(n,"name",{value:e,configurable:!0});function Yt(n,e,t={}){var r=at(n),i=at(e),l=He(i[1]-r[1]),o=He(i[0]-r[0]),s=He(r[1]),a=He(i[1]),f=Math.pow(Math.sin(l/2),2)+Math.pow(Math.sin(o/2),2)*Math.cos(s)*Math.cos(a);return Wn(2*Math.atan2(Math.sqrt(f),Math.sqrt(1-f)),t.units)}mi(Yt,"distance");var gi=Object.defineProperty,re=(n,e)=>gi(n,"name",{value:e,configurable:!0});function Ne(n,e,t){if(n!==null)for(var r,i,l,o,s,a,f,u=0,g=0,_,m=n.type,y=m==="FeatureCollection",L=m==="Feature",b=y?n.features.length:1,p=0;pa||y>f||L>u){s=g,a=r,f=y,u=L,l=0;return}var b=Fe([s,g],t.properties);if(e(b,r,i,L,l)===!1)return!1;l++,s=g})===!1)return!1}}})}re(xt,"segmentEach");function $t(n,e,t){var r=t,i=!1;return xt(n,function(l,o,s,a,f){i===!1&&t===void 0?r=l:r=e(r,l,o,s,a,f),i=!0}),r}re($t,"segmentReduce");function en(n,e){if(!n)throw new Error("geojson is required");Ye(n,function(t,r,i){if(t.geometry!==null){var l=t.geometry.type,o=t.geometry.coordinates;switch(l){case"LineString":if(e(t,r,i,0,0)===!1)return!1;break;case"Polygon":for(var s=0;sMi(n,"name",{value:e,configurable:!0});function tn(n,e={}){return $t(n,(t,r)=>{const i=r.geometry.coordinates;return t+Yt(i[0],i[1],e)},0)}Pi(tn,"length");var ll=tn;const ol={area:"#D94324",route:"#555F5E",crossing:"#4daf4a",other:"#984ea3",hovering:"black",lineEndpointColor:"black",streetview:"blue",measuringLine:"cyan"},sl=10,al=10;function ul(){return Ci(["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"])}function Ci(n){return n[Math.floor(Math.random()*n.length)]}function Si(n){let e;const t=n[16].default,r=ye(t,n,n[24],null);return{c(){r&&r.c()},m(i,l){r&&r.m(i,l),e=!0},p(i,l){r&&r.p&&(!e||l&16777216)&&be(r,t,i,i[24],e?ke(t,i[24],l,null):ve(i[24]),null)},i(i){e||(S(r,i),e=!0)},o(i){F(r,i),e=!1},d(i){r&&r.d(i)}}}function Ti(n){let e,t,r;function i(o){n[17](o)}let l={id:n[1],type:"circle",source:n[2],sourceLayer:n[3],beforeId:n[4],beforeLayerType:n[5],paint:n[6],layout:n[7],filter:n[8],applyToClusters:n[9],minzoom:n[10],maxzoom:n[11],hoverCursor:n[12],manageHoverState:n[13],eventsIfTopMost:n[14],interactive:n[15],$$slots:{default:[Si]},$$scope:{ctx:n}};return n[0]!==void 0&&(l.hovered=n[0]),e=new Dt({props:l}),Je.push(()=>ut(e,"hovered",i)),e.$on("click",n[18]),e.$on("dblclick",n[19]),e.$on("contextmenu",n[20]),e.$on("mouseenter",n[21]),e.$on("mousemove",n[22]),e.$on("mouseleave",n[23]),{c(){x(e.$$.fragment)},m(o,s){$(e,o,s),r=!0},p(o,[s]){const a={};s&2&&(a.id=o[1]),s&4&&(a.source=o[2]),s&8&&(a.sourceLayer=o[3]),s&16&&(a.beforeId=o[4]),s&32&&(a.beforeLayerType=o[5]),s&64&&(a.paint=o[6]),s&128&&(a.layout=o[7]),s&256&&(a.filter=o[8]),s&512&&(a.applyToClusters=o[9]),s&1024&&(a.minzoom=o[10]),s&2048&&(a.maxzoom=o[11]),s&4096&&(a.hoverCursor=o[12]),s&8192&&(a.manageHoverState=o[13]),s&16384&&(a.eventsIfTopMost=o[14]),s&32768&&(a.interactive=o[15]),s&16777216&&(a.$$scope={dirty:s,ctx:o}),!t&&s&1&&(t=!0,a.hovered=o[0],ft(()=>t=!1)),e.$set(a)},i(o){r||(S(e.$$.fragment,o),r=!0)},o(o){F(e.$$.fragment,o),r=!1},d(o){ee(e,o)}}}function zi(n,e,t){let{$$slots:r={},$$scope:i}=e,{id:l=Ht("circle")}=e,{source:o=void 0}=e,{sourceLayer:s=void 0}=e,{beforeId:a=void 0}=e,{beforeLayerType:f=void 0}=e,{paint:u}=e,{layout:g=void 0}=e,{filter:_=void 0}=e,{applyToClusters:m=void 0}=e,{minzoom:y=void 0}=e,{maxzoom:L=void 0}=e,{hoverCursor:b=void 0}=e,{manageHoverState:p=!1}=e,{hovered:Z=null}=e,{eventsIfTopMost:v=!1}=e,{interactive:R=!0}=e;function k(h){Z=h,t(0,Z)}function U(h){le.call(this,n,h)}function N(h){le.call(this,n,h)}function q(h){le.call(this,n,h)}function C(h){le.call(this,n,h)}function M(h){le.call(this,n,h)}function oe(h){le.call(this,n,h)}return n.$$set=h=>{"id"in h&&t(1,l=h.id),"source"in h&&t(2,o=h.source),"sourceLayer"in h&&t(3,s=h.sourceLayer),"beforeId"in h&&t(4,a=h.beforeId),"beforeLayerType"in h&&t(5,f=h.beforeLayerType),"paint"in h&&t(6,u=h.paint),"layout"in h&&t(7,g=h.layout),"filter"in h&&t(8,_=h.filter),"applyToClusters"in h&&t(9,m=h.applyToClusters),"minzoom"in h&&t(10,y=h.minzoom),"maxzoom"in h&&t(11,L=h.maxzoom),"hoverCursor"in h&&t(12,b=h.hoverCursor),"manageHoverState"in h&&t(13,p=h.manageHoverState),"hovered"in h&&t(0,Z=h.hovered),"eventsIfTopMost"in h&&t(14,v=h.eventsIfTopMost),"interactive"in h&&t(15,R=h.interactive),"$$scope"in h&&t(24,i=h.$$scope)},[Z,l,o,s,a,f,u,g,_,m,y,L,b,p,v,R,r,k,U,N,q,C,M,oe,i]}class fl extends K{constructor(e){super(),Q(this,e,zi,Ti,J,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}function Ei(n,e,t){let r;const i=ct();let{layer:l=void 0}=e;const{map:o}=Vn();Me(n,o,u=>t(2,r=u));function s(u){i(u.type,{...u,map:o})}const a=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","contextmenu","mouseover","mouseout"],f=["click","dblclick","contextmenu","mousemove","movestart","moveend","zoomstart","zoom","zoomend"];return dt(()=>{if(r)if(l)for(const u of a)r.off(u,l,s);else for(const u of f)r.off(u,s)}),n.$$set=u=>{"layer"in u&&t(1,l=u.layer)},n.$$.update=()=>{if(n.$$.dirty&6&&r)if(l)for(const u of a)r.on(u,l,s);else for(const u of f)r.on(u,s)},[o,l,r]}class cl extends K{constructor(e){super(),Q(this,e,Ei,null,J,{layer:1})}}const Ri=n=>({marker:n&8}),Ut=n=>({marker:n[3]});function Bi(n){let e,t,r,i,l,o,s;const a=n[19].default,f=ye(a,n,n[18],Ut);return{c(){e=T("div"),f&&f.c(),c(e,"tabindex",t=n[1]?0:void 0),c(e,"role",r=n[1]?"button":void 0),st(e,"z-index",n[2])},m(u,g){B(u,e,g),f&&f.m(e,null),l=!0,o||(s=[Mt(n[7].call(null,e)),Mt(i=Ii.call(null,e,n[0])),W(e,"click",ot(n[20])),W(e,"dblclick",ot(n[21])),W(e,"contextmenu",ot(n[22])),W(e,"mouseenter",n[23]),W(e,"mouseleave",n[24]),W(e,"mousemove",n[25]),W(e,"keydown",n[8])],o=!0)},p(u,[g]){f&&f.p&&(!l||g&262152)&&be(f,a,u,u[18],l?ke(a,u[18],g,Ri):ve(u[18]),Ut),(!l||g&2&&t!==(t=u[1]?0:void 0))&&c(e,"tabindex",t),(!l||g&2&&r!==(r=u[1]?"button":void 0))&&c(e,"role",r),i&&Dn(i.update)&&g&1&&i.update.call(null,u[0]),g&4&&st(e,"z-index",u[2])},i(u){l||(S(f,u),l=!0)},o(u){F(f,u),l=!1},d(u){u&&I(e),f&&f.d(u),o=!1,Oe(s)}}}function Ii(n,e){const t=n.className;function r(i){i?n.className=`${t} ${i}`:n.className=t}return r(e),{update:r}}function Fi(n,e,t){let r,i,l,{$$slots:o={},$$scope:s}=e,{marker:a=void 0}=e,{lngLat:f}=e,{class:u=void 0}=e,{interactive:g=!0}=e,{asButton:_=!1}=e,{draggable:m=!1}=e,{feature:y=null}=e,{offset:L=void 0}=e,{zIndex:b=void 0}=e,{rotation:p=0}=e,{opacity:Z=1}=e;const v=ct(),{map:R,layerEvent:k,self:U}=Hn();Me(n,R,w=>t(27,l=w)),Me(n,k,w=>t(26,r=w)),Me(n,U,w=>t(3,i=w));function N(w){Pt(U,i=new Wt.Marker({element:w,rotation:p,draggable:m,offset:L,opacity:Z.toString()}).setLngLat(f).addTo(l),i),t(11,a=i);const ce=()=>M("dragstart"),se=()=>{q(),M("drag")},me=()=>{q(),M("dragend")};return m&&(i.on("dragstart",ce),i.on("drag",se),i.on("dragend",me)),{destroy(){m&&(i==null||i.off("dragstart",ce),i==null||i.off("drag",se),i==null||i.off("dragend",me)),t(11,a=void 0),i==null||i.remove()}}}function q(){let w=i==null?void 0:i.getLngLat();w&&(Array.isArray(f)?t(10,f=[w.lng,w.lat]):f&&"lon"in f?t(10,f={lon:w.lng,lat:w.lat}):t(10,f=w))}function C(w){w.key===" "&&(w.preventDefault(),w.stopPropagation(),M("click"))}function M(w){if(!g)return;let ce=i==null?void 0:i.getLngLat();if(!ce)return;const se=[ce.lng,ce.lat];let me={map:l,marker:i,lngLat:se,features:[{type:"Feature",properties:(y==null?void 0:y.properties)??{},geometry:{type:"Point",coordinates:se}}]};Pt(k,r={...me,layerType:"marker",type:w},r),v(w,me)}const oe=()=>M("click"),h=()=>M("dblclick"),we=()=>M("contextmenu"),z=w=>{M("mouseenter")},V=()=>{M("mouseleave")},ie=()=>M("mousemove");return n.$$set=w=>{"marker"in w&&t(11,a=w.marker),"lngLat"in w&&t(10,f=w.lngLat),"class"in w&&t(0,u=w.class),"interactive"in w&&t(12,g=w.interactive),"asButton"in w&&t(1,_=w.asButton),"draggable"in w&&t(13,m=w.draggable),"feature"in w&&t(14,y=w.feature),"offset"in w&&t(15,L=w.offset),"zIndex"in w&&t(2,b=w.zIndex),"rotation"in w&&t(16,p=w.rotation),"opacity"in w&&t(17,Z=w.opacity),"$$scope"in w&&t(18,s=w.$$scope)},n.$$.update=()=>{n.$$.dirty&1032&&(i==null||i.setLngLat(f)),n.$$.dirty&32776&&(i==null||i.setOffset(L??[0,0])),n.$$.dirty&65544&&(i==null||i.setRotation(p)),n.$$.dirty&131080&&(i==null||i.setOpacity(Z.toString()))},[u,_,b,i,R,k,U,N,C,M,f,a,g,m,y,L,p,Z,s,o,oe,h,we,z,V,ie]}class dl extends K{constructor(e){super(),Q(this,e,Fi,Bi,J,{marker:11,lngLat:10,class:0,interactive:12,asButton:1,draggable:13,feature:14,offset:15,zIndex:2,rotation:16,opacity:17})}}function Oi(n){let e;const t=n[8].default,r=ye(t,n,n[15],null);return{c(){r&&r.c()},m(i,l){r&&r.m(i,l),e=!0},p(i,l){r&&r.p&&(!e||l&32768)&&be(r,t,i,i[15],e?ke(t,i[15],l,null):ve(i[15]),null)},i(i){e||(S(r,i),e=!0)},o(i){F(r,i),e=!1},d(i){r&&r.d(i)}}}function Gi(n){let e,t;return e=new Dt({props:{id:n[0],type:"raster",source:n[1],beforeId:n[2],beforeLayerType:n[3],paint:n[4],layout:n[5],minzoom:n[6],maxzoom:n[7],$$slots:{default:[Oi]},$$scope:{ctx:n}}}),e.$on("click",n[9]),e.$on("dblclick",n[10]),e.$on("contextmenu",n[11]),e.$on("mouseenter",n[12]),e.$on("mousemove",n[13]),e.$on("mouseleave",n[14]),{c(){x(e.$$.fragment)},m(r,i){$(e,r,i),t=!0},p(r,[i]){const l={};i&1&&(l.id=r[0]),i&2&&(l.source=r[1]),i&4&&(l.beforeId=r[2]),i&8&&(l.beforeLayerType=r[3]),i&16&&(l.paint=r[4]),i&32&&(l.layout=r[5]),i&64&&(l.minzoom=r[6]),i&128&&(l.maxzoom=r[7]),i&32768&&(l.$$scope={dirty:i,ctx:r}),e.$set(l)},i(r){t||(S(e.$$.fragment,r),t=!0)},o(r){F(e.$$.fragment,r),t=!1},d(r){ee(e,r)}}}function Ai(n,e,t){let{$$slots:r={},$$scope:i}=e,{id:l=Ht("raster-layer")}=e,{source:o=void 0}=e,{beforeId:s=void 0}=e,{beforeLayerType:a=void 0}=e,{paint:f}=e,{layout:u=void 0}=e,{minzoom:g=void 0}=e,{maxzoom:_=void 0}=e;function m(v){le.call(this,n,v)}function y(v){le.call(this,n,v)}function L(v){le.call(this,n,v)}function b(v){le.call(this,n,v)}function p(v){le.call(this,n,v)}function Z(v){le.call(this,n,v)}return n.$$set=v=>{"id"in v&&t(0,l=v.id),"source"in v&&t(1,o=v.source),"beforeId"in v&&t(2,s=v.beforeId),"beforeLayerType"in v&&t(3,a=v.beforeLayerType),"paint"in v&&t(4,f=v.paint),"layout"in v&&t(5,u=v.layout),"minzoom"in v&&t(6,g=v.minzoom),"maxzoom"in v&&t(7,_=v.maxzoom),"$$scope"in v&&t(15,i=v.$$scope)},[l,o,s,a,f,u,g,_,r,m,y,L,b,p,Z,i]}class ml extends K{constructor(e){super(),Q(this,e,Ai,Gi,J,{id:0,source:1,beforeId:2,beforeLayerType:3,paint:4,layout:5,minzoom:6,maxzoom:7})}}const Zi="/atip/ss_huge_refactor_pt1/assets/zoom_out_map-b2e1091a.svg";function Ui(n){let e,t;return{c(){e=T("img"),ne(e.src,t=Zi)||c(e,"src",t),c(e,"alt","Zoom to show entire boundary")},m(r,i){B(r,e,i)},p:H,d(r){r&&I(e)}}}function Ni(n){let e,t;return e=new mt({props:{title:"Zoom to show entire boundary",$$slots:{default:[Ui]},$$scope:{ctx:n}}}),e.$on("click",n[0]),{c(){x(e.$$.fragment)},m(r,i){$(e,r,i),t=!0},p(r,[i]){const l={};i&8&&(l.$$scope={dirty:i,ctx:r}),e.$set(l)},i(r){t||(S(e.$$.fragment,r),t=!0)},o(r){F(e.$$.fragment,r),t=!1},d(r){ee(e,r)}}}function qi(n,e,t){let r;Me(n,qt,o=>t(2,r=o));let{boundaryGeojson:i}=e;function l(){let o=hr(i);Number.isFinite(o[0])&&r.fitBounds(o,{padding:20,animate:!0,duration:500})}return n.$$set=o=>{"boundaryGeojson"in o&&t(1,i=o.boundaryGeojson)},[l,i]}class gl extends K{constructor(e){super(),Q(this,e,qi,Ni,J,{boundaryGeojson:1})}}export{Vi as B,Di as C,rl as G,dl as M,ml as R,il as S,gl as Z,Hi as a,hr as b,Ji as c,Yi as d,Xi as e,fl as f,xi as g,ji as h,Qi as i,cl as j,Yr as k,mr as l,dr as m,lr as n,Ki as o,el as p,cr as q,ul as r,tr as s,ll as t,nl as u,tl as v,ol as w,$i as x,sl as y,al as z}; + to exit this mode
  • Cursor by Luc Chaissac
  • `},m(t,r){B(t,e,r)},p:H,i:H,o:H,d(t){t&&I(e)}}}class Yr extends K{constructor(e){super(),Q(this,e,null,Jr,J,{})}}const Xr="/atip/ss_huge_refactor_pt1/assets/camera_cursor-824d29b6.svg",{window:jr}=Nn;function Zt(n){let e,t,r,l;const i=[$r,xr],o=[];function s(a,f){return a[0]?0:1}return e=s(n),t=o[e]=i[e](n),{c(){t.c(),r=Ue()},m(a,f){o[e].m(a,f),B(a,r,f),l=!0},p(a,f){let u=e;e=s(a),e===u?o[e].p(a,f):(Te(),F(o[u],1,1,()=>{o[u]=null}),ze(),t=o[e],t?t.p(a,f):(t=o[e]=i[e](a),t.c()),S(t,1),t.m(r.parentNode,r))},i(a){l||(S(t),l=!0)},o(a){F(t),l=!1},d(a){a&&I(r),o[e].d(a)}}}function xr(n){let e,t;return e=new mt({props:{$$slots:{default:[el]},$$scope:{ctx:n}}}),e.$on("click",n[8]),{c(){x(e.$$.fragment)},m(r,l){$(e,r,l),t=!0},p(r,l){const i={};l&8192&&(i.$$scope={dirty:l,ctx:r}),e.$set(i)},i(r){t||(S(e.$$.fragment,r),t=!0)},o(r){F(e.$$.fragment,r),t=!1},d(r){ee(e,r)}}}function $r(n){let e,t,r,l,i,o,s;e=new mt({props:{$$slots:{default:[tl]},$$scope:{ctx:n}}}),e.$on("click",n[6]);function a(u){n[7](u)}let f={legend:"Source",choices:[["google","Google Street View"],["bing","Bing Streetside"]]};return n[2].streetViewImagery!==void 0&&(f.value=n[2].streetViewImagery),r=new qn({props:f}),Je.push(()=>ut(r,"value",a)),o=new tr({props:{label:"Help",$$slots:{default:[nl]},$$scope:{ctx:n}}}),{c(){x(e.$$.fragment),t=j(),x(r.$$.fragment),i=j(),x(o.$$.fragment)},m(u,g){$(e,u,g),B(u,t,g),$(r,u,g),B(u,i,g),$(o,u,g),s=!0},p(u,g){const _={};g&8192&&(_.$$scope={dirty:g,ctx:u}),e.$set(_);const m={};!l&&g&4&&(l=!0,m.value=u[2].streetViewImagery,ft(()=>l=!1)),r.$set(m);const y={};g&8192&&(y.$$scope={dirty:g,ctx:u}),o.$set(y)},i(u){s||(S(e.$$.fragment,u),S(r.$$.fragment,u),S(o.$$.fragment,u),s=!0)},o(u){F(e.$$.fragment,u),F(r.$$.fragment,u),F(o.$$.fragment,u),s=!1},d(u){u&&(I(t),I(i)),ee(e,u),ee(r,u),ee(o,u)}}}function el(n){let e;return{c(){e=de("Enable Street View")},m(t,r){B(t,e,r)},d(t){t&&I(e)}}}function tl(n){let e;return{c(){e=de("Disable Street View")},m(t,r){B(t,e,r)},d(t){t&&I(e)}}}function nl(n){let e,t;return e=new Yr({}),{c(){x(e.$$.fragment)},m(r,l){$(e,r,l),t=!0},i(r){t||(S(e.$$.fragment,r),t=!0)},o(r){F(e.$$.fragment,r),t=!1},d(r){ee(e,r)}}}function rl(n){let e,t,r,l,i=n[1]&&Zt(n);return{c(){i&&i.c(),e=Ue()},m(o,s){i&&i.m(o,s),B(o,e,s),t=!0,r||(l=W(jr,"keydown",n[3]),r=!0)},p(o,[s]){o[1]?i?(i.p(o,s),s&2&&S(i,1)):(i=Zt(o),i.c(),S(i,1),i.m(e.parentNode,e)):i&&(Te(),F(i,1,1,()=>{i=null}),ze())},i(o){t||(S(i),t=!0)},o(o){F(i),t=!1},d(o){o&&I(e),i&&i.d(o),r=!1,l()}}}function ll(n,e,t){let r;Me(n,wt,b=>t(2,r=b));let{cfg:l}=e,{map:i}=e,{enabled:o}=e,{showControls:s=!0}=e,a=[];function f(){if(i){i.on("click",g),i.getCanvas().style.cursor=`url(${Xr}), auto`;for(let b of l.getStreetViewRoadLayerNames(i))a.push([b,i.getPaintProperty(b,"line-color")]),i.setPaintProperty(b,"line-color","cyan")}}function u(){if(i){i.off("click",g),i.getCanvas().style.cursor="inherit";for(let[b,p]of a)i.setPaintProperty(b,"line-color",p);a=[]}}dt(u);function g(b){if(!o)return;let p=b.lngLat.lng,Z=b.lngLat.lat;r.streetViewImagery=="google"?window.open(`http://maps.google.com/maps?q=&layer=c&cbll=${Z},${p}&cbp=11,0,0,0,0`,"_blank"):r.streetViewImagery=="bing"&&window.open(`https://www.bing.com/maps?cp=${Z}~${p}&style=x`,"_blank")}function _(b){o&&b.key=="Escape"&&(b.stopPropagation(),t(0,o=!1))}const m=()=>t(0,o=!1);function y(b){n.$$.not_equal(r.streetViewImagery,b)&&(r.streetViewImagery=b,wt.set(r))}const L=()=>t(0,o=!0);return n.$$set=b=>{"cfg"in b&&t(4,l=b.cfg),"map"in b&&t(5,i=b.map),"enabled"in b&&t(0,o=b.enabled),"showControls"in b&&t(1,s=b.showControls)},n.$$.update=()=>{n.$$.dirty&1&&(o?f():u())},[o,s,r,_,l,i,m,y,L]}class li extends K{constructor(e){super(),Q(this,e,ll,rl,J,{cfg:4,map:5,enabled:0,showControls:1})}}var il=Object.defineProperty,Ce=(n,e)=>il(n,"name",{value:e,configurable:!0});function at(n){if(!n)throw new Error("coord is required");if(!Array.isArray(n)){if(n.type==="Feature"&&n.geometry!==null&&n.geometry.type==="Point")return[...n.geometry.coordinates];if(n.type==="Point")return[...n.coordinates]}if(Array.isArray(n)&&n.length>=2&&!Array.isArray(n[0])&&!Array.isArray(n[1]))return[...n];throw new Error("coord must be GeoJSON Point or an Array of numbers")}Ce(at,"getCoord");function ol(n){if(Array.isArray(n))return n;if(n.type==="Feature"){if(n.geometry!==null)return n.geometry.coordinates}else if(n.coordinates)return n.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}Ce(ol,"getCoords");function Jt(n){if(n.length>1&&pt(n[0])&&pt(n[1]))return!0;if(Array.isArray(n[0])&&n[0].length)return Jt(n[0]);throw new Error("coordinates must only contain numbers")}Ce(Jt,"containsNumber");function sl(n,e,t){if(!e||!t)throw new Error("type and name required");if(!n||n.type!==e)throw new Error("Invalid input to "+t+": must be a "+e+", given "+n.type)}Ce(sl,"geojsonType");function al(n,e,t){if(!n)throw new Error("No feature passed");if(!t)throw new Error(".featureOf() requires a name");if(!n||n.type!=="Feature"||!n.geometry)throw new Error("Invalid input to "+t+", Feature with geometry required");if(!n.geometry||n.geometry.type!==e)throw new Error("Invalid input to "+t+": must be a "+e+", given "+n.geometry.type)}Ce(al,"featureOf");function ul(n,e,t){if(!n)throw new Error("No featureCollection passed");if(!t)throw new Error(".collectionOf() requires a name");if(!n||n.type!=="FeatureCollection")throw new Error("Invalid input to "+t+", FeatureCollection required");for(const r of n.features){if(!r||r.type!=="Feature"||!r.geometry)throw new Error("Invalid input to "+t+", Feature with geometry required");if(!r.geometry||r.geometry.type!==e)throw new Error("Invalid input to "+t+": must be a "+e+", given "+r.geometry.type)}}Ce(ul,"collectionOf");function fl(n){return n.type==="Feature"?n.geometry:n}Ce(fl,"getGeom");function cl(n,e){return n.type==="FeatureCollection"?"FeatureCollection":n.type==="GeometryCollection"?"GeometryCollection":n.type==="Feature"&&n.geometry!==null?n.geometry.type:n.type}Ce(cl,"getType");var dl=Object.defineProperty,ml=(n,e)=>dl(n,"name",{value:e,configurable:!0});function Yt(n,e,t={}){var r=at(n),l=at(e),i=He(l[1]-r[1]),o=He(l[0]-r[0]),s=He(r[1]),a=He(l[1]),f=Math.pow(Math.sin(i/2),2)+Math.pow(Math.sin(o/2),2)*Math.cos(s)*Math.cos(a);return Wn(2*Math.atan2(Math.sqrt(f),Math.sqrt(1-f)),t.units)}ml(Yt,"distance");var gl=Object.defineProperty,re=(n,e)=>gl(n,"name",{value:e,configurable:!0});function Ne(n,e,t){if(n!==null)for(var r,l,i,o,s,a,f,u=0,g=0,_,m=n.type,y=m==="FeatureCollection",L=m==="Feature",b=y?n.features.length:1,p=0;pa||y>f||L>u){s=g,a=r,f=y,u=L,i=0;return}var b=Fe([s,g],t.properties);if(e(b,r,l,L,i)===!1)return!1;i++,s=g})===!1)return!1}}})}re(xt,"segmentEach");function $t(n,e,t){var r=t,l=!1;return xt(n,function(i,o,s,a,f){l===!1&&t===void 0?r=i:r=e(r,i,o,s,a,f),l=!0}),r}re($t,"segmentReduce");function en(n,e){if(!n)throw new Error("geojson is required");Ye(n,function(t,r,l){if(t.geometry!==null){var i=t.geometry.type,o=t.geometry.coordinates;switch(i){case"LineString":if(e(t,r,l,0,0)===!1)return!1;break;case"Polygon":for(var s=0;sMl(n,"name",{value:e,configurable:!0});function tn(n,e={}){return $t(n,(t,r)=>{const l=r.geometry.coordinates;return t+Yt(l[0],l[1],e)},0)}Pl(tn,"length");var ii=tn;const oi={area:"#D94324",route:"#555F5E",crossing:"#4daf4a",other:"#984ea3",hovering:"black",lineEndpointColor:"black",streetview:"blue",measuringLine:"cyan"},si=10,ai=10;function ui(){return Cl(["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"])}function Cl(n){return n[Math.floor(Math.random()*n.length)]}function Sl(n){let e;const t=n[16].default,r=ye(t,n,n[24],null);return{c(){r&&r.c()},m(l,i){r&&r.m(l,i),e=!0},p(l,i){r&&r.p&&(!e||i&16777216)&&be(r,t,l,l[24],e?ke(t,l[24],i,null):ve(l[24]),null)},i(l){e||(S(r,l),e=!0)},o(l){F(r,l),e=!1},d(l){r&&r.d(l)}}}function Tl(n){let e,t,r;function l(o){n[17](o)}let i={id:n[1],type:"circle",source:n[2],sourceLayer:n[3],beforeId:n[4],beforeLayerType:n[5],paint:n[6],layout:n[7],filter:n[8],applyToClusters:n[9],minzoom:n[10],maxzoom:n[11],hoverCursor:n[12],manageHoverState:n[13],eventsIfTopMost:n[14],interactive:n[15],$$slots:{default:[Sl]},$$scope:{ctx:n}};return n[0]!==void 0&&(i.hovered=n[0]),e=new Dt({props:i}),Je.push(()=>ut(e,"hovered",l)),e.$on("click",n[18]),e.$on("dblclick",n[19]),e.$on("contextmenu",n[20]),e.$on("mouseenter",n[21]),e.$on("mousemove",n[22]),e.$on("mouseleave",n[23]),{c(){x(e.$$.fragment)},m(o,s){$(e,o,s),r=!0},p(o,[s]){const a={};s&2&&(a.id=o[1]),s&4&&(a.source=o[2]),s&8&&(a.sourceLayer=o[3]),s&16&&(a.beforeId=o[4]),s&32&&(a.beforeLayerType=o[5]),s&64&&(a.paint=o[6]),s&128&&(a.layout=o[7]),s&256&&(a.filter=o[8]),s&512&&(a.applyToClusters=o[9]),s&1024&&(a.minzoom=o[10]),s&2048&&(a.maxzoom=o[11]),s&4096&&(a.hoverCursor=o[12]),s&8192&&(a.manageHoverState=o[13]),s&16384&&(a.eventsIfTopMost=o[14]),s&32768&&(a.interactive=o[15]),s&16777216&&(a.$$scope={dirty:s,ctx:o}),!t&&s&1&&(t=!0,a.hovered=o[0],ft(()=>t=!1)),e.$set(a)},i(o){r||(S(e.$$.fragment,o),r=!0)},o(o){F(e.$$.fragment,o),r=!1},d(o){ee(e,o)}}}function zl(n,e,t){let{$$slots:r={},$$scope:l}=e,{id:i=Ht("circle")}=e,{source:o=void 0}=e,{sourceLayer:s=void 0}=e,{beforeId:a=void 0}=e,{beforeLayerType:f=void 0}=e,{paint:u}=e,{layout:g=void 0}=e,{filter:_=void 0}=e,{applyToClusters:m=void 0}=e,{minzoom:y=void 0}=e,{maxzoom:L=void 0}=e,{hoverCursor:b=void 0}=e,{manageHoverState:p=!1}=e,{hovered:Z=null}=e,{eventsIfTopMost:v=!1}=e,{interactive:R=!0}=e;function k(h){Z=h,t(0,Z)}function U(h){ie.call(this,n,h)}function N(h){ie.call(this,n,h)}function q(h){ie.call(this,n,h)}function C(h){ie.call(this,n,h)}function M(h){ie.call(this,n,h)}function oe(h){ie.call(this,n,h)}return n.$$set=h=>{"id"in h&&t(1,i=h.id),"source"in h&&t(2,o=h.source),"sourceLayer"in h&&t(3,s=h.sourceLayer),"beforeId"in h&&t(4,a=h.beforeId),"beforeLayerType"in h&&t(5,f=h.beforeLayerType),"paint"in h&&t(6,u=h.paint),"layout"in h&&t(7,g=h.layout),"filter"in h&&t(8,_=h.filter),"applyToClusters"in h&&t(9,m=h.applyToClusters),"minzoom"in h&&t(10,y=h.minzoom),"maxzoom"in h&&t(11,L=h.maxzoom),"hoverCursor"in h&&t(12,b=h.hoverCursor),"manageHoverState"in h&&t(13,p=h.manageHoverState),"hovered"in h&&t(0,Z=h.hovered),"eventsIfTopMost"in h&&t(14,v=h.eventsIfTopMost),"interactive"in h&&t(15,R=h.interactive),"$$scope"in h&&t(24,l=h.$$scope)},[Z,i,o,s,a,f,u,g,_,m,y,L,b,p,v,R,r,k,U,N,q,C,M,oe,l]}class fi extends K{constructor(e){super(),Q(this,e,zl,Tl,J,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}function El(n,e,t){let r;const l=ct();let{layer:i=void 0}=e;const{map:o}=Vn();Me(n,o,u=>t(2,r=u));function s(u){l(u.type,{...u,map:o})}const a=["click","dblclick","mousedown","mouseup","mousemove","mouseenter","mouseleave","contextmenu","mouseover","mouseout"],f=["click","dblclick","contextmenu","mousemove","movestart","moveend","zoomstart","zoom","zoomend"];return dt(()=>{if(r)if(i)for(const u of a)r.off(u,i,s);else for(const u of f)r.off(u,s)}),n.$$set=u=>{"layer"in u&&t(1,i=u.layer)},n.$$.update=()=>{if(n.$$.dirty&6&&r)if(i)for(const u of a)r.on(u,i,s);else for(const u of f)r.on(u,s)},[o,i,r]}class ci extends K{constructor(e){super(),Q(this,e,El,null,J,{layer:1})}}const Rl=n=>({marker:n&8}),Ut=n=>({marker:n[3]});function Bl(n){let e,t,r,l,i,o,s;const a=n[19].default,f=ye(a,n,n[18],Ut);return{c(){e=T("div"),f&&f.c(),c(e,"tabindex",t=n[1]?0:void 0),c(e,"role",r=n[1]?"button":void 0),st(e,"z-index",n[2])},m(u,g){B(u,e,g),f&&f.m(e,null),i=!0,o||(s=[Mt(n[7].call(null,e)),Mt(l=Il.call(null,e,n[0])),W(e,"click",ot(n[20])),W(e,"dblclick",ot(n[21])),W(e,"contextmenu",ot(n[22])),W(e,"mouseenter",n[23]),W(e,"mouseleave",n[24]),W(e,"mousemove",n[25]),W(e,"keydown",n[8])],o=!0)},p(u,[g]){f&&f.p&&(!i||g&262152)&&be(f,a,u,u[18],i?ke(a,u[18],g,Rl):ve(u[18]),Ut),(!i||g&2&&t!==(t=u[1]?0:void 0))&&c(e,"tabindex",t),(!i||g&2&&r!==(r=u[1]?"button":void 0))&&c(e,"role",r),l&&Dn(l.update)&&g&1&&l.update.call(null,u[0]),g&4&&st(e,"z-index",u[2])},i(u){i||(S(f,u),i=!0)},o(u){F(f,u),i=!1},d(u){u&&I(e),f&&f.d(u),o=!1,Oe(s)}}}function Il(n,e){const t=n.className;function r(l){l?n.className=`${t} ${l}`:n.className=t}return r(e),{update:r}}function Fl(n,e,t){let r,l,i,{$$slots:o={},$$scope:s}=e,{marker:a=void 0}=e,{lngLat:f}=e,{class:u=void 0}=e,{interactive:g=!0}=e,{asButton:_=!1}=e,{draggable:m=!1}=e,{feature:y=null}=e,{offset:L=void 0}=e,{zIndex:b=void 0}=e,{rotation:p=0}=e,{opacity:Z=1}=e;const v=ct(),{map:R,layerEvent:k,self:U}=Hn();Me(n,R,w=>t(27,i=w)),Me(n,k,w=>t(26,r=w)),Me(n,U,w=>t(3,l=w));function N(w){Pt(U,l=new Wt.Marker({element:w,rotation:p,draggable:m,offset:L,opacity:Z.toString()}).setLngLat(f).addTo(i),l),t(11,a=l);const ce=()=>M("dragstart"),se=()=>{q(),M("drag")},me=()=>{q(),M("dragend")};return m&&(l.on("dragstart",ce),l.on("drag",se),l.on("dragend",me)),{destroy(){m&&(l==null||l.off("dragstart",ce),l==null||l.off("drag",se),l==null||l.off("dragend",me)),t(11,a=void 0),l==null||l.remove()}}}function q(){let w=l==null?void 0:l.getLngLat();w&&(Array.isArray(f)?t(10,f=[w.lng,w.lat]):f&&"lon"in f?t(10,f={lon:w.lng,lat:w.lat}):t(10,f=w))}function C(w){w.key===" "&&(w.preventDefault(),w.stopPropagation(),M("click"))}function M(w){if(!g)return;let ce=l==null?void 0:l.getLngLat();if(!ce)return;const se=[ce.lng,ce.lat];let me={map:i,marker:l,lngLat:se,features:[{type:"Feature",properties:(y==null?void 0:y.properties)??{},geometry:{type:"Point",coordinates:se}}]};Pt(k,r={...me,layerType:"marker",type:w},r),v(w,me)}const oe=()=>M("click"),h=()=>M("dblclick"),we=()=>M("contextmenu"),z=w=>{M("mouseenter")},V=()=>{M("mouseleave")},le=()=>M("mousemove");return n.$$set=w=>{"marker"in w&&t(11,a=w.marker),"lngLat"in w&&t(10,f=w.lngLat),"class"in w&&t(0,u=w.class),"interactive"in w&&t(12,g=w.interactive),"asButton"in w&&t(1,_=w.asButton),"draggable"in w&&t(13,m=w.draggable),"feature"in w&&t(14,y=w.feature),"offset"in w&&t(15,L=w.offset),"zIndex"in w&&t(2,b=w.zIndex),"rotation"in w&&t(16,p=w.rotation),"opacity"in w&&t(17,Z=w.opacity),"$$scope"in w&&t(18,s=w.$$scope)},n.$$.update=()=>{n.$$.dirty&1032&&(l==null||l.setLngLat(f)),n.$$.dirty&32776&&(l==null||l.setOffset(L??[0,0])),n.$$.dirty&65544&&(l==null||l.setRotation(p)),n.$$.dirty&131080&&(l==null||l.setOpacity(Z.toString()))},[u,_,b,l,R,k,U,N,C,M,f,a,g,m,y,L,p,Z,s,o,oe,h,we,z,V,le]}class di extends K{constructor(e){super(),Q(this,e,Fl,Bl,J,{marker:11,lngLat:10,class:0,interactive:12,asButton:1,draggable:13,feature:14,offset:15,zIndex:2,rotation:16,opacity:17})}}function Ol(n){let e;const t=n[8].default,r=ye(t,n,n[15],null);return{c(){r&&r.c()},m(l,i){r&&r.m(l,i),e=!0},p(l,i){r&&r.p&&(!e||i&32768)&&be(r,t,l,l[15],e?ke(t,l[15],i,null):ve(l[15]),null)},i(l){e||(S(r,l),e=!0)},o(l){F(r,l),e=!1},d(l){r&&r.d(l)}}}function Gl(n){let e,t;return e=new Dt({props:{id:n[0],type:"raster",source:n[1],beforeId:n[2],beforeLayerType:n[3],paint:n[4],layout:n[5],minzoom:n[6],maxzoom:n[7],$$slots:{default:[Ol]},$$scope:{ctx:n}}}),e.$on("click",n[9]),e.$on("dblclick",n[10]),e.$on("contextmenu",n[11]),e.$on("mouseenter",n[12]),e.$on("mousemove",n[13]),e.$on("mouseleave",n[14]),{c(){x(e.$$.fragment)},m(r,l){$(e,r,l),t=!0},p(r,[l]){const i={};l&1&&(i.id=r[0]),l&2&&(i.source=r[1]),l&4&&(i.beforeId=r[2]),l&8&&(i.beforeLayerType=r[3]),l&16&&(i.paint=r[4]),l&32&&(i.layout=r[5]),l&64&&(i.minzoom=r[6]),l&128&&(i.maxzoom=r[7]),l&32768&&(i.$$scope={dirty:l,ctx:r}),e.$set(i)},i(r){t||(S(e.$$.fragment,r),t=!0)},o(r){F(e.$$.fragment,r),t=!1},d(r){ee(e,r)}}}function Al(n,e,t){let{$$slots:r={},$$scope:l}=e,{id:i=Ht("raster-layer")}=e,{source:o=void 0}=e,{beforeId:s=void 0}=e,{beforeLayerType:a=void 0}=e,{paint:f}=e,{layout:u=void 0}=e,{minzoom:g=void 0}=e,{maxzoom:_=void 0}=e;function m(v){ie.call(this,n,v)}function y(v){ie.call(this,n,v)}function L(v){ie.call(this,n,v)}function b(v){ie.call(this,n,v)}function p(v){ie.call(this,n,v)}function Z(v){ie.call(this,n,v)}return n.$$set=v=>{"id"in v&&t(0,i=v.id),"source"in v&&t(1,o=v.source),"beforeId"in v&&t(2,s=v.beforeId),"beforeLayerType"in v&&t(3,a=v.beforeLayerType),"paint"in v&&t(4,f=v.paint),"layout"in v&&t(5,u=v.layout),"minzoom"in v&&t(6,g=v.minzoom),"maxzoom"in v&&t(7,_=v.maxzoom),"$$scope"in v&&t(15,l=v.$$scope)},[i,o,s,a,f,u,g,_,r,m,y,L,b,p,Z,l]}class mi extends K{constructor(e){super(),Q(this,e,Al,Gl,J,{id:0,source:1,beforeId:2,beforeLayerType:3,paint:4,layout:5,minzoom:6,maxzoom:7})}}const Zl="/atip/ss_huge_refactor_pt1/assets/zoom_out_map-b2e1091a.svg";function Ul(n){let e,t;return{c(){e=T("img"),ne(e.src,t=Zl)||c(e,"src",t),c(e,"alt","Zoom to show entire boundary")},m(r,l){B(r,e,l)},p:H,d(r){r&&I(e)}}}function Nl(n){let e,t;return e=new mt({props:{title:"Zoom to show entire boundary",$$slots:{default:[Ul]},$$scope:{ctx:n}}}),e.$on("click",n[0]),{c(){x(e.$$.fragment)},m(r,l){$(e,r,l),t=!0},p(r,[l]){const i={};l&8&&(i.$$scope={dirty:l,ctx:r}),e.$set(i)},i(r){t||(S(e.$$.fragment,r),t=!0)},o(r){F(e.$$.fragment,r),t=!1},d(r){ee(e,r)}}}function ql(n,e,t){let r;Me(n,qt,o=>t(2,r=o));let{boundaryGeojson:l}=e;function i(){let o=hr(l);Number.isFinite(o[0])&&r.fitBounds(o,{padding:20,animate:!0,duration:500})}return n.$$set=o=>{"boundaryGeojson"in o&&t(1,l=o.boundaryGeojson)},[i,l]}class gi extends K{constructor(e){super(),Q(this,e,ql,Nl,J,{boundaryGeojson:1})}}export{Vl as B,Dl as C,ri as G,di as M,mi as R,li as S,gi as Z,Hl as a,hr as b,Jl as c,Yl as d,Xl as e,fi as f,xl as g,jl as h,Ql as i,ci as j,Yr as k,mr as l,dr as m,ir as n,Kl as o,ei as p,cr as q,ui as r,tr as s,ii as t,ni as u,ti as v,oi as w,$l as x,si as y,ai as z}; diff --git a/ss_huge_refactor_pt1/assets/index-4a1c3090.js b/ss_huge_refactor_pt1/assets/index-a43921db.js similarity index 99% rename from ss_huge_refactor_pt1/assets/index-4a1c3090.js rename to ss_huge_refactor_pt1/assets/index-a43921db.js index df87974f..81b9895e 100644 --- a/ss_huge_refactor_pt1/assets/index-4a1c3090.js +++ b/ss_huge_refactor_pt1/assets/index-a43921db.js @@ -676,4 +676,4 @@ In order to be iterable, non-array objects must have a [Symbol.iterator]() metho `}[s]}}]),w}(),Wr=function(){function w(){r(this,w)}return p(w,null,[{key:"log10",value:function(s){var u=Math.log(s);return ut.isInfinite(u)||ut.isNaN(u)?u:u/w.LOG_10}},{key:"min",value:function(s,u,h,y){var I=s;return uh?h:s}if(Number.isInteger(arguments[2])&&Number.isInteger(arguments[0])&&Number.isInteger(arguments[1])){var y=arguments[0],I=arguments[1],O=arguments[2];return yO?O:y}}},{key:"wrap",value:function(s,u){return s<0?u- -s%u:s%u}},{key:"max",value:function(){if(arguments.length===3){var s=arguments[0],u=arguments[1],h=arguments[2],y=s;return u>y&&(y=u),h>y&&(y=h),y}if(arguments.length===4){var I=arguments[0],O=arguments[1],U=arguments[2],H=arguments[3],te=I;return O>te&&(te=O),U>te&&(te=U),H>te&&(te=H),te}}},{key:"average",value:function(s,u){return(s+u)/2}}]),w}();Wr.LOG_10=Math.log(10);var An=function(){function w(){r(this,w)}return p(w,null,[{key:"segmentToSegment",value:function(s,u,h,y){if(s.equals(u))return w.pointToSegment(s,h,y);if(h.equals(y))return w.pointToSegment(y,s,u);var I=!1;if($t.intersects(s,u,h,y)){var O=(u.x-s.x)*(y.y-h.y)-(u.y-s.y)*(y.x-h.x);if(O===0)I=!0;else{var U=(s.y-h.y)*(y.x-h.x)-(s.x-h.x)*(y.y-h.y),H=((s.y-h.y)*(u.x-s.x)-(s.x-h.x)*(u.y-s.y))/O,te=U/O;(te<0||te>1||H<0||H>1)&&(I=!0)}}else I=!0;return I?Wr.min(w.pointToSegment(s,h,y),w.pointToSegment(u,h,y),w.pointToSegment(h,s,u),w.pointToSegment(y,s,u)):0}},{key:"pointToSegment",value:function(s,u,h){if(u.x===h.x&&u.y===h.y)return s.distance(u);var y=(h.x-u.x)*(h.x-u.x)+(h.y-u.y)*(h.y-u.y),I=((s.x-u.x)*(h.x-u.x)+(s.y-u.y)*(h.y-u.y))/y;if(I<=0)return s.distance(u);if(I>=1)return s.distance(h);var O=((u.y-s.y)*(h.x-u.x)-(u.x-s.x)*(h.y-u.y))/y;return Math.abs(O)*Math.sqrt(y)}},{key:"pointToLinePerpendicular",value:function(s,u,h){var y=(h.x-u.x)*(h.x-u.x)+(h.y-u.y)*(h.y-u.y),I=((u.y-s.y)*(h.x-u.x)-(u.x-s.x)*(h.y-u.y))/y;return Math.abs(I)*Math.sqrt(y)}},{key:"pointToSegmentString",value:function(s,u){if(u.length===0)throw new Re("Line array must contain at least one vertex");for(var h=s.distance(u[0]),y=0;y0)&&(O=H,I=U)}return I}}},{key:"extend",value:function(s,u,h){var y=s.create(h,u.getDimension()),I=u.size();if(w.copy(u,0,y,0,I),I>0)for(var O=I;O0)&&(u=y)}return u}}]),w}(),oe=function(){function w(){r(this,w)}return p(w,null,[{key:"toDimensionSymbol",value:function(s){switch(s){case w.FALSE:return w.SYM_FALSE;case w.TRUE:return w.SYM_TRUE;case w.DONTCARE:return w.SYM_DONTCARE;case w.P:return w.SYM_P;case w.L:return w.SYM_L;case w.A:return w.SYM_A}throw new Re("Unknown dimension value: "+s)}},{key:"toDimensionValue",value:function(s){switch(ws.toUpperCase(s)){case w.SYM_FALSE:return w.FALSE;case w.SYM_TRUE:return w.TRUE;case w.SYM_DONTCARE:return w.DONTCARE;case w.SYM_P:return w.P;case w.SYM_L:return w.L;case w.SYM_A:return w.A}throw new Re("Unknown dimension symbol: "+s)}}]),w}();oe.P=0,oe.L=1,oe.A=2,oe.FALSE=-1,oe.TRUE=-2,oe.DONTCARE=-3,oe.SYM_FALSE="F",oe.SYM_TRUE="T",oe.SYM_DONTCARE="*",oe.SYM_P="0",oe.SYM_L="1",oe.SYM_A="2";var be=function(){function w(){r(this,w)}return p(w,[{key:"filter",value:function(s){}}]),w}(),Te=function(){function w(){r(this,w)}return p(w,[{key:"filter",value:function(s,u){}},{key:"isDone",value:function(){}},{key:"isGeometryChanged",value:function(){}}]),w}(),ge=function(w){g(u,w);var s=Y(u);function u(){var h;return r(this,u),h=s.call(this),u.constructor_.apply(M(h),arguments),h}return p(u,[{key:"computeEnvelopeInternal",value:function(){return this.isEmpty()?new $t:this._points.expandEnvelope(new $t)}},{key:"isRing",value:function(){return this.isClosed()&&this.isSimple()}},{key:"getCoordinates",value:function(){return this._points.toCoordinateArray()}},{key:"copyInternal",value:function(){return new u(this._points.copy(),this._factory)}},{key:"equalsExact",value:function(){if(arguments.length===2&&typeof arguments[1]=="number"&&arguments[0]instanceof bt){var h=arguments[0],y=arguments[1];if(!this.isEquivalentClass(h))return!1;var I=h;if(this._points.size()!==I._points.size())return!1;for(var O=0;O0){var I=this._points.copy();re.reverse(I),this._points=I}return null}}}},{key:"getCoordinate",value:function(){return this.isEmpty()?null:this._points.getCoordinate(0)}},{key:"getBoundaryDimension",value:function(){return this.isClosed()?oe.FALSE:0}},{key:"isClosed",value:function(){return!this.isEmpty()&&this.getCoordinateN(0).equals2D(this.getCoordinateN(this.getNumPoints()-1))}},{key:"reverseInternal",value:function(){var h=this._points.copy();return re.reverse(h),this.getFactory().createLineString(h)}},{key:"getEndPoint",value:function(){return this.isEmpty()?null:this.getPointN(this.getNumPoints()-1)}},{key:"getTypeCode",value:function(){return bt.TYPECODE_LINESTRING}},{key:"getDimension",value:function(){return 1}},{key:"getLength",value:function(){return $.ofLine(this._points)}},{key:"getNumPoints",value:function(){return this._points.size()}},{key:"compareToSameClass",value:function(){if(arguments.length===1){for(var h=arguments[0],y=h,I=0,O=0;I= 2)");this._points=h}},{key:"isCoordinate",value:function(h){for(var y=0;y=1&&this.getCoordinateSequence().size()= 4)")}},{key:"getGeometryType",value:function(){return bt.TYPENAME_LINEARRING}}],[{key:"constructor_",value:function(){var h=arguments[0],y=arguments[1];ge.constructor_.call(this,h,y),this.validateConstruction()}}]),u}(ge);Wn.MINIMUM_VALID_SIZE=4;var Wt=function(w){g(u,w);var s=Y(u);function u(){var h;return r(this,u),h=s.call(this),u.constructor_.apply(M(h),arguments),h}return p(u,[{key:"setOrdinate",value:function(h,y){switch(h){case u.X:this.x=y;break;case u.Y:this.y=y;break;default:throw new Re("Invalid ordinate index: "+h)}}},{key:"getZ",value:function(){return Ae.NULL_ORDINATE}},{key:"getOrdinate",value:function(h){switch(h){case u.X:return this.x;case u.Y:return this.y}throw new Re("Invalid ordinate index: "+h)}},{key:"setZ",value:function(h){throw new Re("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new u(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+")"}},{key:"setCoordinate",value:function(h){this.x=h.x,this.y=h.y,this.z=h.getZ()}}],[{key:"constructor_",value:function(){if(arguments.length===0)Ae.constructor_.call(this);else if(arguments.length===1){if(arguments[0]instanceof u){var h=arguments[0];Ae.constructor_.call(this,h.x,h.y)}else if(arguments[0]instanceof Ae){var y=arguments[0];Ae.constructor_.call(this,y.x,y.y)}}else if(arguments.length===2){var I=arguments[0],O=arguments[1];Ae.constructor_.call(this,I,O,Ae.NULL_ORDINATE)}}}]),u}(Ae);Wt.X=0,Wt.Y=1,Wt.Z=-1,Wt.M=-1;var Tn=function(w){g(u,w);var s=Y(u);function u(){var h;return r(this,u),h=s.call(this),u.constructor_.apply(M(h),arguments),h}return p(u,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(h,y){switch(h){case u.X:this.x=y;break;case u.Y:this.y=y;break;case u.M:this._m=y;break;default:throw new Re("Invalid ordinate index: "+h)}}},{key:"setM",value:function(h){this._m=h}},{key:"getZ",value:function(){return Ae.NULL_ORDINATE}},{key:"getOrdinate",value:function(h){switch(h){case u.X:return this.x;case u.Y:return this.y;case u.M:return this._m}throw new Re("Invalid ordinate index: "+h)}},{key:"setZ",value:function(h){throw new Re("CoordinateXY dimension 2 does not support z-ordinate")}},{key:"copy",value:function(){return new u(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(h){this.x=h.x,this.y=h.y,this.z=h.getZ(),this._m=h.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)Ae.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof u){var h=arguments[0];Ae.constructor_.call(this,h.x,h.y),this._m=h._m}else if(arguments[0]instanceof Ae){var y=arguments[0];Ae.constructor_.call(this,y.x,y.y),this._m=this.getM()}}else if(arguments.length===3){var I=arguments[0],O=arguments[1],U=arguments[2];Ae.constructor_.call(this,I,O,Ae.NULL_ORDINATE),this._m=U}}}]),u}(Ae);Tn.X=0,Tn.Y=1,Tn.Z=-1,Tn.M=2;var ti=function(w){g(u,w);var s=Y(u);function u(){var h;return r(this,u),h=s.call(this),u.constructor_.apply(M(h),arguments),h}return p(u,[{key:"getM",value:function(){return this._m}},{key:"setOrdinate",value:function(h,y){switch(h){case Ae.X:this.x=y;break;case Ae.Y:this.y=y;break;case Ae.Z:this.z=y;break;case Ae.M:this._m=y;break;default:throw new Re("Invalid ordinate index: "+h)}}},{key:"setM",value:function(h){this._m=h}},{key:"getOrdinate",value:function(h){switch(h){case Ae.X:return this.x;case Ae.Y:return this.y;case Ae.Z:return this.getZ();case Ae.M:return this.getM()}throw new Re("Invalid ordinate index: "+h)}},{key:"copy",value:function(){return new u(this)}},{key:"toString",value:function(){return"("+this.x+", "+this.y+", "+this.getZ()+" m="+this.getM()+")"}},{key:"setCoordinate",value:function(h){this.x=h.x,this.y=h.y,this.z=h.getZ(),this._m=h.getM()}}],[{key:"constructor_",value:function(){if(this._m=null,arguments.length===0)Ae.constructor_.call(this),this._m=0;else if(arguments.length===1){if(arguments[0]instanceof u){var h=arguments[0];Ae.constructor_.call(this,h),this._m=h._m}else if(arguments[0]instanceof Ae){var y=arguments[0];Ae.constructor_.call(this,y),this._m=this.getM()}}else if(arguments.length===4){var I=arguments[0],O=arguments[1],U=arguments[2],H=arguments[3];Ae.constructor_.call(this,I,O,U),this._m=H}}}]),u}(Ae),vi=function(){function w(){r(this,w)}return p(w,null,[{key:"measures",value:function(s){return s instanceof Wt?0:s instanceof Tn||s instanceof ti?1:0}},{key:"dimension",value:function(s){return s instanceof Wt?2:s instanceof Tn?3:s instanceof ti?4:3}},{key:"create",value:function(){if(arguments.length===1){var s=arguments[0];return w.create(s,0)}if(arguments.length===2){var u=arguments[0],h=arguments[1];return u===2?new Wt:u===3&&h===0?new Ae:u===3&&h===1?new Tn:u===4&&h===1?new ti:new Ae}}}]),w}(),xi=function(w){g(u,w);var s=Y(u);function u(){var h;return r(this,u),h=s.call(this),u.constructor_.apply(M(h),arguments),h}return p(u,[{key:"getCoordinate",value:function(h){return this.get(h)}},{key:"addAll",value:function(){if(arguments.length===2&&typeof arguments[1]=="boolean"&&Kt(arguments[0],Se)){for(var h=arguments[0],y=arguments[1],I=!1,O=h.iterator();O.hasNext();)this.add(O.next(),y),I=!0;return I}return W(x(u.prototype),"addAll",this).apply(this,arguments)}},{key:"clone",value:function(){for(var h=W(x(u.prototype),"clone",this).call(this),y=0;y=1){var H=this.get(this.size()-1);if(H.equals2D(O))return null}W(x(u.prototype),"add",this).call(this,O)}else if(arguments[0]instanceof Object&&typeof arguments[1]=="boolean"){var te=arguments[0],ye=arguments[1];return this.add(te,ye),!0}}else if(arguments.length===3){if(typeof arguments[2]=="boolean"&&arguments[0]instanceof Array&&typeof arguments[1]=="boolean"){var ke=arguments[0],Ze=arguments[1],nt=arguments[2];if(nt)for(var et=0;et=0;Bt--)this.add(ke[Bt],Ze);return!0}if(typeof arguments[2]=="boolean"&&Number.isInteger(arguments[0])&&arguments[1]instanceof Ae){var Rt=arguments[0],Yt=arguments[1],kn=arguments[2];if(!kn){var Kn=this.size();if(Kn>0){if(Rt>0){var ui=this.get(Rt-1);if(ui.equals2D(Yt))return null}if(RtJo&&(lo=-1);for(var uo=pt;uo!==Jo;uo+=lo)this.add(Ii[uo],Ti);return!0}}},{key:"closeRing",value:function(){if(this.size()>0){var h=this.get(0).copy();this.add(h,!1)}}}],[{key:"constructor_",value:function(){if(arguments.length!==0){if(arguments.length===1){var h=arguments[0];this.ensureCapacity(h.length),this.add(h,!0)}else if(arguments.length===2){var y=arguments[0],I=arguments[1];this.ensureCapacity(y.length),this.add(y,I)}}}}]),u}(st);xi.coordArrayType=new Array(0).fill(null);var mn=function(){function w(){r(this,w)}return p(w,null,[{key:"isRing",value:function(s){return!(s.length<4)&&!!s[0].equals2D(s[s.length-1])}},{key:"ptNotInList",value:function(s,u){for(var h=0;h=s?u:[]}},{key:"indexOf",value:function(s,u){for(var h=0;h0)&&(u=s[h]);return u}},{key:"extract",value:function(s,u,h){u=Wr.clamp(u,0,s.length);var y=(h=Wr.clamp(h,-1,s.length))-u+1;h<0&&(y=0),u>=s.length&&(y=0),hy.length)return 1;if(h.length===0)return 0;var I=mn.compare(h,y);return mn.isEqualReversed(h,y)?0:I}},{key:"OLDcompare",value:function(s,u){var h=s,y=u;if(h.lengthy.length)return 1;if(h.length===0)return 0;for(var I=mn.increasingDirection(h),O=mn.increasingDirection(y),U=I>0?0:h.length-1,H=O>0?0:h.length-1,te=0;te0){var s=new Ta(17*this._coordinates.length);s.append("("),s.append(this._coordinates[0]);for(var u=1;u3&&(y=3),y<2&&(y=2),new vn(h,y)}if(arguments.length===3){var I=arguments[0],O=arguments[1],U=arguments[2],H=O-U;return U>1&&(U=1),H>3&&(H=3),H<2&&(H=2),new vn(I,H+U,U)}}}},{key:"interfaces_",get:function(){return[le,Ge]}}],[{key:"instance",value:function(){return w.instanceObject}}]),w}();$s.instanceObject=new $s;var Ks=function(w){g(u,w);var s=Y(u);function u(){var h;return r(this,u),h=s.call(this),u.constructor_.apply(M(h),arguments),h}return p(u,[{key:"copyInternal",value:function(){for(var h=new Array(this._geometries.length).fill(null),y=0;y=0?s:u}}]),w}(),Si=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"readResolve",value:function(){return w.nameToTypeMap.get(this._name)}},{key:"toString",value:function(){return this._name}},{key:"interfaces_",get:function(){return[Ge]}}],[{key:"constructor_",value:function(){this._name=null;var s=arguments[0];this._name=s,w.nameToTypeMap.put(s,this)}}]),w}();Si.nameToTypeMap=new ir,Yi.Type=Si,Yi.FIXED=new Si("FIXED"),Yi.FLOATING=new Si("FLOATING"),Yi.FLOATING_SINGLE=new Si("FLOATING SINGLE"),Yi.maximumPreciseValue=9007199254740992;var rr=function(w){g(u,w);var s=Y(u);function u(){var h;return r(this,u),h=s.call(this),u.constructor_.apply(M(h),arguments),h}return p(u,[{key:"copyInternal",value:function(){for(var h=new Array(this._geometries.length).fill(null),y=0;y1){if(H instanceof Mt)return this.createMultiPolygon(w.toPolygonArray(s));if(H instanceof ge)return this.createMultiLineString(w.toLineStringArray(s));if(H instanceof Xe)return this.createMultiPoint(w.toPointArray(s));Et.shouldNeverReachHere("Unhandled geometry type: "+H.getGeometryType())}return H}},{key:"createMultiPointFromCoords",value:function(s){return this.createMultiPoint(s!==null?this.getCoordinateSequenceFactory().create(s):null)}},{key:"createPoint",value:function(){if(arguments.length===0)return this.createPoint(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Ae){var s=arguments[0];return this.createPoint(s!==null?this.getCoordinateSequenceFactory().create([s]):null)}if(Kt(arguments[0],rn)){var u=arguments[0];return new Xe(u,this)}}}},{key:"getCoordinateSequenceFactory",value:function(){return this._coordinateSequenceFactory}},{key:"createPolygon",value:function(){if(arguments.length===0)return this.createPolygon(null,null);if(arguments.length===1){if(Kt(arguments[0],rn)){var s=arguments[0];return this.createPolygon(this.createLinearRing(s))}if(arguments[0]instanceof Array){var u=arguments[0];return this.createPolygon(this.createLinearRing(u))}if(arguments[0]instanceof Wn){var h=arguments[0];return this.createPolygon(h,null)}}else if(arguments.length===2){var y=arguments[0],I=arguments[1];return new Mt(y,I,this)}}},{key:"getSRID",value:function(){return this._SRID}},{key:"createGeometryCollection",value:function(){if(arguments.length===0)return new sn(null,this);if(arguments.length===1){var s=arguments[0];return new sn(s,this)}}},{key:"getPrecisionModel",value:function(){return this._precisionModel}},{key:"createLinearRing",value:function(){if(arguments.length===0)return this.createLinearRing(this.getCoordinateSequenceFactory().create([]));if(arguments.length===1){if(arguments[0]instanceof Array){var s=arguments[0];return this.createLinearRing(s!==null?this.getCoordinateSequenceFactory().create(s):null)}if(Kt(arguments[0],rn)){var u=arguments[0];return new Wn(u,this)}}}},{key:"createMultiPolygon",value:function(){if(arguments.length===0)return new Ks(null,this);if(arguments.length===1){var s=arguments[0];return new Ks(s,this)}}},{key:"createMultiPoint",value:function(){if(arguments.length===0)return new On(null,this);if(arguments.length===1){if(arguments[0]instanceof Array){var s=arguments[0];return new On(s,this)}if(Kt(arguments[0],rn)){var u=arguments[0];if(u===null)return this.createMultiPoint(new Array(0).fill(null));for(var h=new Array(u.size()).fill(null),y=0;y="a"&&s<="z"||s>="A"&&s<="Z"}},{key:"isNumeric_",value:function(s,u){return s>="0"&&s<="9"||s=="."&&!(u!==void 0&&u)}},{key:"isWhiteSpace_",value:function(s){return s==" "||s==" "||s=="\r"||s==` `}},{key:"nextChar_",value:function(){return this.wkt.charAt(++this.index_)}},{key:"nextToken",value:function(){var s,u=this.nextChar_(),h=this.index_,y=u;if(u=="(")s=Pr;else if(u==",")s=yn;else if(u==")")s=ki;else if(this.isNumeric_(u)||u=="-")s=ks,y=this.readNumber_();else if(this.isAlpha_(u))s=Ui,y=this.readText_();else{if(this.isWhiteSpace_(u))return this.nextToken();if(u!=="")throw new Error("Unexpected character: "+u);s=Ca}return{position:h,value:y,type:s}}},{key:"readNumber_",value:function(){var s,u=this.index_,h=!1,y=!1;do s=="."?h=!0:s!="e"&&s!="E"||(y=!0),s=this.nextChar_();while(this.isNumeric_(s,h)||!y&&(s=="e"||s=="E")||y&&(s=="-"||s=="+"));return parseFloat(this.wkt.substring(u,this.index_--))}},{key:"readText_",value:function(){var s,u=this.index_;do s=this.nextChar_();while(this.isAlpha_(s));return this.wkt.substring(u,this.index_--).toUpperCase()}}]),w}(),Aa=function(){function w(s,u){r(this,w),this.lexer_=s,this.token_,this.layout_=Ss,this.factory=u}return p(w,[{key:"consume_",value:function(){this.token_=this.lexer_.nextToken()}},{key:"isTokenType",value:function(s){return this.token_.type==s}},{key:"match",value:function(s){var u=this.isTokenType(s);return u&&this.consume_(),u}},{key:"parse",value:function(){return this.consume_(),this.parseGeometry_()}},{key:"parseGeometryLayout_",value:function(){var s=Ss,u=this.token_;if(this.isTokenType(Ui)){var h=u.value;h==="Z"?s=li:h==="M"?s=Js:h==="ZM"&&(s=Io),s!==Ss&&this.consume_()}return s}},{key:"parseGeometryCollectionText_",value:function(){if(this.match(Pr)){var s=[];do s.push(this.parseGeometry_());while(this.match(yn));if(this.match(ki))return s}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePointText_",value:function(){if(this.match(Pr)){var s=this.parsePoint_();if(this.match(ki))return s}else if(this.isEmptyGeometry_())return null;throw new Error(this.formatErrorMessage_())}},{key:"parseLineStringText_",value:function(){if(this.match(Pr)){var s=this.parsePointList_();if(this.match(ki))return s}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePolygonText_",value:function(){if(this.match(Pr)){var s=this.parseLineStringTextList_();if(this.match(ki))return s}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPointText_",value:function(){var s;if(this.match(Pr)){if(s=this.token_.type==Pr?this.parsePointTextList_():this.parsePointList_(),this.match(ki))return s}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiLineStringText_",value:function(){if(this.match(Pr)){var s=this.parseLineStringTextList_();if(this.match(ki))return s}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parseMultiPolygonText_",value:function(){if(this.match(Pr)){var s=this.parsePolygonTextList_();if(this.match(ki))return s}else if(this.isEmptyGeometry_())return[];throw new Error(this.formatErrorMessage_())}},{key:"parsePoint_",value:function(){for(var s=[],u=this.layout_.length,h=0;h1?s.createPolygon(Yt[0],Yt.slice(1)):s.createPolygon(Yt[0])},y=this.token_;if(this.match(Ui)){var I=y.value;if(this.layout_=this.parseGeometryLayout_(),I=="GEOMETRYCOLLECTION"){var O=this.parseGeometryCollectionText_();return s.createGeometryCollection(O)}switch(I){case"POINT":var U=this.parsePointText_();return U?s.createPoint(R(Ae,pe(U))):s.createPoint();case"LINESTRING":var H=this.parseLineStringText_().map(u);return s.createLineString(H);case"LINEARRING":var te=this.parseLineStringText_().map(u);return s.createLinearRing(te);case"POLYGON":var ye=this.parsePolygonText_();return ye&&ye.length!==0?h(ye):s.createPolygon();case"MULTIPOINT":var ke=this.parseMultiPointText_();if(!ke||ke.length===0)return s.createMultiPoint();var Ze=ke.map(u).map(function(Rt){return s.createPoint(Rt)});return s.createMultiPoint(Ze);case"MULTILINESTRING":var nt=this.parseMultiLineStringText_().map(function(Rt){return s.createLineString(Rt.map(u))});return s.createMultiLineString(nt);case"MULTIPOLYGON":var et=this.parseMultiPolygonText_();if(!et||et.length===0)return s.createMultiPolygon();var Bt=et.map(h);return s.createMultiPolygon(Bt);default:throw new Error("Invalid geometry type: "+I)}}throw new Error(this.formatErrorMessage_())}}]),w}();function Is(w){if(w.isEmpty())return"";var s=w.getCoordinate(),u=[s.x,s.y];return s.z===void 0||Number.isNaN(s.z)||u.push(s.z),s.m===void 0||Number.isNaN(s.m)||u.push(s.m),u.join(" ")}function ea(w){for(var s=w.getCoordinates().map(function(I){var O=[I.x,I.y];return I.z===void 0||Number.isNaN(I.z)||O.push(I.z),I.m===void 0||Number.isNaN(I.m)||O.push(I.m),O}),u=[],h=0,y=s.length;h0&&(s+=" "+h),w.isEmpty()?s+" "+Qs:s+" ("+u(w)+")"}var du=function(){function w(s){r(this,w),this.geometryFactory=s||new Zr,this.precisionModel=this.geometryFactory.getPrecisionModel()}return p(w,[{key:"read",value:function(s){var u=new To(s);return new Aa(u,this.geometryFactory).parse()}},{key:"write",value:function(s){return fu(s)}}]),w}(),El=function(){function w(s){r(this,w),this.parser=new du(s)}return p(w,[{key:"write",value:function(s){return this.parser.write(s)}}],[{key:"toLineString",value:function(s,u){if(arguments.length!==2)throw new Error("Not implemented");return"LINESTRING ( "+s.x+" "+s.y+", "+u.x+" "+u.y+" )"}}]),w}(),jn=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"getIndexAlongSegment",value:function(s,u){return this.computeIntLineIndex(),this._intLineIndex[s][u]}},{key:"getTopologySummary",value:function(){var s=new Ta;return this.isEndPoint()&&s.append(" endpoint"),this._isProper&&s.append(" proper"),this.isCollinear()&&s.append(" collinear"),s.toString()}},{key:"computeIntersection",value:function(s,u,h,y){this._inputLines[0][0]=s,this._inputLines[0][1]=u,this._inputLines[1][0]=h,this._inputLines[1][1]=y,this._result=this.computeIntersect(s,u,h,y)}},{key:"getIntersectionNum",value:function(){return this._result}},{key:"computeIntLineIndex",value:function(){if(arguments.length===0)this._intLineIndex===null&&(this._intLineIndex=Array(2).fill().map(function(){return Array(2)}),this.computeIntLineIndex(0),this.computeIntLineIndex(1));else if(arguments.length===1){var s=arguments[0],u=this.getEdgeDistance(s,0),h=this.getEdgeDistance(s,1);u>h?(this._intLineIndex[s][0]=0,this._intLineIndex[s][1]=1):(this._intLineIndex[s][0]=1,this._intLineIndex[s][1]=0)}}},{key:"isProper",value:function(){return this.hasIntersection()&&this._isProper}},{key:"setPrecisionModel",value:function(s){this._precisionModel=s}},{key:"isInteriorIntersection",value:function(){if(arguments.length===0)return!!this.isInteriorIntersection(0)||!!this.isInteriorIntersection(1);if(arguments.length===1){for(var s=arguments[0],u=0;uI?y:I;else{var U=Math.abs(s.x-u.x),H=Math.abs(s.y-u.y);(O=y>I?U:H)!==0||s.equals(u)||(O=Math.max(U,H))}return Et.isTrue(!(O===0&&!s.equals(u)),"Bad distance calculation"),O}},{key:"nonRobustComputeEdgeDistance",value:function(s,u,h){var y=s.x-u.x,I=s.y-u.y,O=Math.sqrt(y*y+I*I);return Et.isTrue(!(O===0&&!s.equals(u)),"Invalid distance calculation"),O}}]),w}();jn.DONT_INTERSECT=0,jn.DO_INTERSECT=1,jn.COLLINEAR=2,jn.NO_INTERSECTION=0,jn.POINT_INTERSECTION=1,jn.COLLINEAR_INTERSECTION=2;var Co=function(w){g(u,w);var s=Y(u);function u(){return r(this,u),s.call(this)}return p(u,[{key:"isInSegmentEnvelopes",value:function(h){var y=new $t(this._inputLines[0][0],this._inputLines[0][1]),I=new $t(this._inputLines[1][0],this._inputLines[1][1]);return y.contains(h)&&I.contains(h)}},{key:"computeIntersection",value:function(){if(arguments.length!==3)return W(x(u.prototype),"computeIntersection",this).apply(this,arguments);var h=arguments[0],y=arguments[1],I=arguments[2];if(this._isProper=!1,$t.intersects(y,I,h)&&zt.index(y,I,h)===0&&zt.index(I,y,h)===0)return this._isProper=!0,(h.equals(y)||h.equals(I))&&(this._isProper=!1),this._result=jn.POINT_INTERSECTION,null;this._result=jn.NO_INTERSECTION}},{key:"intersection",value:function(h,y,I,O){var U=this.intersectionSafe(h,y,I,O);return this.isInSegmentEnvelopes(U)||(U=new Ae(u.nearestEndpoint(h,y,I,O))),this._precisionModel!==null&&this._precisionModel.makePrecise(U),U}},{key:"checkDD",value:function(h,y,I,O,U){var H=it.intersection(h,y,I,O),te=this.isInSegmentEnvelopes(H);Ft.out.println("DD in env = "+te+" --------------------- "+H),U.distance(H)>1e-4&&Ft.out.println("Distance = "+U.distance(H))}},{key:"intersectionSafe",value:function(h,y,I,O){var U=Lr.intersection(h,y,I,O);return U===null&&(U=u.nearestEndpoint(h,y,I,O)),U}},{key:"computeCollinearIntersection",value:function(h,y,I,O){var U=$t.intersects(h,y,I),H=$t.intersects(h,y,O),te=$t.intersects(I,O,h),ye=$t.intersects(I,O,y);return U&&H?(this._intPt[0]=I,this._intPt[1]=O,jn.COLLINEAR_INTERSECTION):te&&ye?(this._intPt[0]=h,this._intPt[1]=y,jn.COLLINEAR_INTERSECTION):U&&te?(this._intPt[0]=I,this._intPt[1]=h,!I.equals(h)||H||ye?jn.COLLINEAR_INTERSECTION:jn.POINT_INTERSECTION):U&&ye?(this._intPt[0]=I,this._intPt[1]=y,!I.equals(y)||H||te?jn.COLLINEAR_INTERSECTION:jn.POINT_INTERSECTION):H&&te?(this._intPt[0]=O,this._intPt[1]=h,!O.equals(h)||U||ye?jn.COLLINEAR_INTERSECTION:jn.POINT_INTERSECTION):H&&ye?(this._intPt[0]=O,this._intPt[1]=y,!O.equals(y)||U||te?jn.COLLINEAR_INTERSECTION:jn.POINT_INTERSECTION):jn.NO_INTERSECTION}},{key:"computeIntersect",value:function(h,y,I,O){if(this._isProper=!1,!$t.intersects(h,y,I,O))return jn.NO_INTERSECTION;var U=zt.index(h,y,I),H=zt.index(h,y,O);if(U>0&&H>0||U<0&&H<0)return jn.NO_INTERSECTION;var te=zt.index(I,O,h),ye=zt.index(I,O,y);return te>0&&ye>0||te<0&&ye<0?jn.NO_INTERSECTION:U===0&&H===0&&te===0&&ye===0?this.computeCollinearIntersection(h,y,I,O):(U===0||H===0||te===0||ye===0?(this._isProper=!1,h.equals2D(I)||h.equals2D(O)?this._intPt[0]=h:y.equals2D(I)||y.equals2D(O)?this._intPt[0]=y:U===0?this._intPt[0]=new Ae(I):H===0?this._intPt[0]=new Ae(O):te===0?this._intPt[0]=new Ae(h):ye===0&&(this._intPt[0]=new Ae(y))):(this._isProper=!0,this._intPt[0]=this.intersection(h,y,I,O)),jn.POINT_INTERSECTION)}}],[{key:"nearestEndpoint",value:function(h,y,I,O){var U=h,H=An.pointToSegment(h,I,O),te=An.pointToSegment(y,I,O);return tey&&(h=u.x,y=s.x),this._p.x>=h&&this._p.x<=y&&(this._isPointOnSegment=!0),null}if(s.y>this._p.y&&u.y<=this._p.y||u.y>this._p.y&&s.y<=this._p.y){var I=zt.index(s,u,this._p);if(I===zt.COLLINEAR)return this._isPointOnSegment=!0,null;u.ythis.location.length){var u=new Array(3).fill(null);u[ot.ON]=this.location[ot.ON],u[ot.LEFT]=fe.NONE,u[ot.RIGHT]=fe.NONE,this.location=u}for(var h=0;h1&&s.append(fe.toLocationSymbol(this.location[ot.LEFT])),s.append(fe.toLocationSymbol(this.location[ot.ON])),this.location.length>1&&s.append(fe.toLocationSymbol(this.location[ot.RIGHT])),s.toString()}},{key:"setLocations",value:function(s,u,h){this.location[ot.ON]=s,this.location[ot.LEFT]=u,this.location[ot.RIGHT]=h}},{key:"get",value:function(s){return s1}},{key:"isAnyNull",value:function(){for(var s=0;sthis._maxNodeDegree&&(this._maxNodeDegree=u),s=this.getNext(s)}while(s!==this._startDe);this._maxNodeDegree*=2}},{key:"addPoints",value:function(s,u,h){var y=s.getCoordinates();if(u){var I=1;h&&(I=0);for(var O=I;O=0;H--)this._pts.add(y[H])}}},{key:"isHole",value:function(){return this._isHole}},{key:"setInResult",value:function(){var s=this._startDe;do s.getEdge().setInResult(!0),s=s.getNext();while(s!==this._startDe)}},{key:"containsPoint",value:function(s){var u=this.getLinearRing();if(!u.getEnvelopeInternal().contains(s)||!Ma.isInRing(s,u.getCoordinates()))return!1;for(var h=this._holes.iterator();h.hasNext();)if(h.next().containsPoint(s))return!1;return!0}},{key:"addHole",value:function(s){this._holes.add(s)}},{key:"isShell",value:function(){return this._shell===null}},{key:"getLabel",value:function(){return this._label}},{key:"getEdges",value:function(){return this._edges}},{key:"getMaxNodeDegree",value:function(){return this._maxNodeDegree<0&&this.computeMaxNodeDegree(),this._maxNodeDegree}},{key:"getShell",value:function(){return this._shell}},{key:"mergeLabel",value:function(){if(arguments.length===1){var s=arguments[0];this.mergeLabel(s,0),this.mergeLabel(s,1)}else if(arguments.length===2){var u=arguments[0],h=arguments[1],y=u.getLocation(h,ot.RIGHT);if(y===fe.NONE)return null;if(this._label.getLocation(h)===fe.NONE)return this._label.setLocation(h,y),null}}},{key:"setShell",value:function(s){this._shell=s,s!==null&&s.addHole(this)}},{key:"toPolygon",value:function(s){for(var u=new Array(this._holes.size()).fill(null),h=0;h=2,"found partial label"),this.computeIM(s)}},{key:"isInResult",value:function(){return this._isInResult}},{key:"isVisited",value:function(){return this._isVisited}}],[{key:"constructor_",value:function(){if(this._label=null,this._isInResult=!1,this._isCovered=!1,this._isCoveredSet=!1,this._isVisited=!1,arguments.length!==0&&arguments.length===1){var s=arguments[0];this._label=s}}}]),w}(),Ao=function(w){g(u,w);var s=Y(u);function u(){var h;return r(this,u),h=s.call(this),u.constructor_.apply(M(h),arguments),h}return p(u,[{key:"isIncidentEdgeInResult",value:function(){for(var h=this.getEdges().getEdges().iterator();h.hasNext();)if(h.next().getEdge().isInResult())return!0;return!1}},{key:"isIsolated",value:function(){return this._label.getGeometryCount()===1}},{key:"getCoordinate",value:function(){return this._coord}},{key:"print",value:function(h){h.println("node "+this._coord+" lbl: "+this._label)}},{key:"computeIM",value:function(h){}},{key:"computeMergedLocation",value:function(h,y){var I=fe.NONE;if(I=this._label.getLocation(y),!h.isNull(y)){var O=h.getLocation(y);I!==fe.BOUNDARY&&(I=O)}return I}},{key:"setLabel",value:function(){if(arguments.length!==2||!Number.isInteger(arguments[1])||!Number.isInteger(arguments[0]))return W(x(u.prototype),"setLabel",this).apply(this,arguments);var h=arguments[0],y=arguments[1];this._label===null?this._label=new Xi(h,y):this._label.setLocation(h,y)}},{key:"getEdges",value:function(){return this._edges}},{key:"mergeLabel",value:function(){if(arguments[0]instanceof u){var h=arguments[0];this.mergeLabel(h._label)}else if(arguments[0]instanceof Xi)for(var y=arguments[0],I=0;I<2;I++){var O=this.computeMergedLocation(y,I),U=this._label.getLocation(I);U===fe.NONE&&this._label.setLocation(I,O)}}},{key:"add",value:function(h){this._edges.insert(h),h.setNode(this)}},{key:"setLabelBoundary",value:function(h){if(this._label===null)return null;var y=fe.NONE;this._label!==null&&(y=this._label.getLocation(h));var I=null;switch(y){case fe.BOUNDARY:I=fe.INTERIOR;break;case fe.INTERIOR:default:I=fe.BOUNDARY}this._label.setLocation(h,I)}}],[{key:"constructor_",value:function(){this._coord=null,this._edges=null;var h=arguments[0],y=arguments[1];this._coord=h,this._edges=y,this._label=new Xi(0,fe.NONE)}}]),u}(or),Oa=function(w){g(u,w);var s=Y(u);function u(){return r(this,u),s.apply(this,arguments)}return u}(nr);function Ts(w){return w==null?0:w.color}function _n(w){return w==null?null:w.parent}function sr(w,s){w!==null&&(w.color=s)}function Zo(w){return w==null?null:w.left}function pu(w){return w==null?null:w.right}var na=function(w){g(u,w);var s=Y(u);function u(){var h;return r(this,u),(h=s.call(this)).root_=null,h.size_=0,h}return p(u,[{key:"get",value:function(h){for(var y=this.root_;y!==null;){var I=h.compareTo(y.key);if(I<0)y=y.left;else{if(!(I>0))return y.value;y=y.right}}return null}},{key:"put",value:function(h,y){if(this.root_===null)return this.root_={key:h,value:y,left:null,right:null,parent:null,color:0,getValue:function(){return this.value},getKey:function(){return this.key}},this.size_=1,null;var I,O,U=this.root_;do if(I=U,(O=h.compareTo(U.key))<0)U=U.left;else{if(!(O>0)){var H=U.value;return U.value=y,H}U=U.right}while(U!==null);var te={key:h,left:null,right:null,value:y,parent:I,color:0,getValue:function(){return this.value},getKey:function(){return this.key}};return O<0?I.left=te:I.right=te,this.fixAfterInsertion(te),this.size_++,null}},{key:"fixAfterInsertion",value:function(h){var y;for(h.color=1;h!=null&&h!==this.root_&&h.parent.color===1;)_n(h)===Zo(_n(_n(h)))?Ts(y=pu(_n(_n(h))))===1?(sr(_n(h),0),sr(y,0),sr(_n(_n(h)),1),h=_n(_n(h))):(h===pu(_n(h))&&(h=_n(h),this.rotateLeft(h)),sr(_n(h),0),sr(_n(_n(h)),1),this.rotateRight(_n(_n(h)))):Ts(y=Zo(_n(_n(h))))===1?(sr(_n(h),0),sr(y,0),sr(_n(_n(h)),1),h=_n(_n(h))):(h===Zo(_n(h))&&(h=_n(h),this.rotateRight(h)),sr(_n(h),0),sr(_n(_n(h)),1),this.rotateLeft(_n(_n(h))));this.root_.color=0}},{key:"values",value:function(){var h=new st,y=this.getFirstEntry();if(y!==null)for(h.add(y.value);(y=u.successor(y))!==null;)h.add(y.value);return h}},{key:"entrySet",value:function(){var h=new je,y=this.getFirstEntry();if(y!==null)for(h.add(y);(y=u.successor(y))!==null;)h.add(y);return h}},{key:"rotateLeft",value:function(h){if(h!=null){var y=h.right;h.right=y.left,y.left!=null&&(y.left.parent=h),y.parent=h.parent,h.parent==null?this.root_=y:h.parent.left===h?h.parent.left=y:h.parent.right=y,y.left=h,h.parent=y}}},{key:"rotateRight",value:function(h){if(h!=null){var y=h.left;h.left=y.right,y.right!=null&&(y.right.parent=h),y.parent=h.parent,h.parent==null?this.root_=y:h.parent.right===h?h.parent.right=y:h.parent.left=y,y.right=h,h.parent=y}}},{key:"getFirstEntry",value:function(){var h=this.root_;if(h!=null)for(;h.left!=null;)h=h.left;return h}},{key:"size",value:function(){return this.size_}},{key:"containsKey",value:function(h){for(var y=this.root_;y!==null;){var I=h.compareTo(y.key);if(I<0)y=y.left;else{if(!(I>0))return!0;y=y.right}}return!1}}],[{key:"successor",value:function(h){var y;if(h===null)return null;if(h.right!==null){for(y=h.right;y.left!==null;)y=y.left;return y}y=h.parent;for(var I=h;y!==null&&I===y.right;)I=y,y=y.parent;return y}}]),u}(Oa),Il=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"find",value:function(s){return this.nodeMap.get(s)}},{key:"addNode",value:function(){if(arguments[0]instanceof Ae){var s=arguments[0],u=this.nodeMap.get(s);return u===null&&(u=this.nodeFact.createNode(s),this.nodeMap.put(s,u)),u}if(arguments[0]instanceof Ao){var h=arguments[0],y=this.nodeMap.get(h.getCoordinate());return y===null?(this.nodeMap.put(h.getCoordinate(),h),h):(y.mergeLabel(h),y)}}},{key:"print",value:function(s){for(var u=this.iterator();u.hasNext();)u.next().print(s)}},{key:"iterator",value:function(){return this.nodeMap.values().iterator()}},{key:"values",value:function(){return this.nodeMap.values()}},{key:"getBoundaryNodes",value:function(s){for(var u=new st,h=this.iterator();h.hasNext();){var y=h.next();y.getLabel().getLocation(s)===fe.BOUNDARY&&u.add(y)}return u}},{key:"add",value:function(s){var u=s.getCoordinate();this.addNode(u).add(s)}}],[{key:"constructor_",value:function(){this.nodeMap=new na,this.nodeFact=null;var s=arguments[0];this.nodeFact=s}}]),w}(),$i=function(){function w(){r(this,w)}return p(w,null,[{key:"isNorthern",value:function(s){return s===w.NE||s===w.NW}},{key:"isOpposite",value:function(s,u){return s!==u&&(s-u+4)%4===2}},{key:"commonHalfPlane",value:function(s,u){if(s===u)return s;if((s-u+4)%4===2)return-1;var h=su?s:u)===3?3:h}},{key:"isInHalfPlane",value:function(s,u){return u===w.SE?s===w.SE||s===w.SW:s===u||s===u+1}},{key:"quadrant",value:function(){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var s=arguments[0],u=arguments[1];if(s===0&&u===0)throw new Re("Cannot compute the quadrant for point ( "+s+", "+u+" )");return s>=0?u>=0?w.NE:w.SE:u>=0?w.NW:w.SW}if(arguments[0]instanceof Ae&&arguments[1]instanceof Ae){var h=arguments[0],y=arguments[1];if(y.x===h.x&&y.y===h.y)throw new Re("Cannot compute the quadrant for two identical points "+h);return y.x>=h.x?y.y>=h.y?w.NE:w.SE:y.y>=h.y?w.NW:w.SW}}}]),w}();$i.NE=0,$i.NW=1,$i.SW=2,$i.SE=3;var Lo=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"compareDirection",value:function(s){return this._dx===s._dx&&this._dy===s._dy?0:this._quadrant>s._quadrant?1:this._quadrant2){O.linkDirectedEdgesForMinimalEdgeRings();var U=O.buildMinimalRings(),H=this.findShell(U);H!==null?(this.placePolygonHoles(H,U),u.add(H)):h.addAll(U)}else y.add(O)}return y}},{key:"buildMaximalEdgeRings",value:function(s){for(var u=new st,h=s.iterator();h.hasNext();){var y=h.next();if(y.isInResult()&&y.getLabel().isArea()&&y.getEdgeRing()===null){var I=new Ra(y,this._geometryFactory);u.add(I),I.setInResult()}}return u}},{key:"placePolygonHoles",value:function(s,u){for(var h=u.iterator();h.hasNext();){var y=h.next();y.isHole()&&y.setShell(s)}}},{key:"getPolygons",value:function(){return this.computePolygons(this._shellList)}},{key:"findShell",value:function(s){for(var u=0,h=null,y=s.iterator();y.hasNext();){var I=y.next();I.isHole()||(h=I,u++)}return Et.isTrue(u<=1,"found two shells in MinimalEdgeRing list"),h}},{key:"add",value:function(){if(arguments.length===1){var s=arguments[0];this.add(s.getEdgeEnds(),s.getNodes())}else if(arguments.length===2){var u=arguments[0],h=arguments[1];Ei.linkResultDirectedEdges(h);var y=this.buildMaximalEdgeRings(u),I=new st,O=this.buildMinimalEdgeRings(y,this._shellList,I);this.sortShellsAndHoles(O,this._shellList,I),this.placeFreeHoles(this._shellList,I)}}}],[{key:"constructor_",value:function(){this._geometryFactory=null,this._shellList=new st;var s=arguments[0];this._geometryFactory=s}},{key:"findEdgeRingContaining",value:function(s,u){for(var h=s.getLinearRing(),y=h.getEnvelopeInternal(),I=h.getCoordinateN(0),O=null,U=null,H=u.iterator();H.hasNext();){var te=H.next(),ye=te.getLinearRing(),ke=ye.getEnvelopeInternal();if(!ke.equals(y)&&ke.contains(y)){I=mn.ptNotInList(h.getCoordinates(),ye.getCoordinates());var Ze=!1;Ma.isInRing(I,ye.getCoordinates())&&(Ze=!0),Ze&&(O===null||U.contains(ke))&&(U=(O=te).getLinearRing().getEnvelopeInternal())}}return O}}]),w}(),ia=function(){function w(){r(this,w)}return p(w,[{key:"getBounds",value:function(){}}]),w}(),Mr=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"getItem",value:function(){return this._item}},{key:"getBounds",value:function(){return this._bounds}},{key:"interfaces_",get:function(){return[ia,Ge]}}],[{key:"constructor_",value:function(){this._bounds=null,this._item=null;var s=arguments[0],u=arguments[1];this._bounds=s,this._item=u}}]),w}(),As=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"poll",value:function(){if(this.isEmpty())return null;var s=this._items.get(1);return this._items.set(1,this._items.get(this._size)),this._size-=1,this.reorder(1),s}},{key:"size",value:function(){return this._size}},{key:"reorder",value:function(s){for(var u=null,h=this._items.get(s);2*s<=this._size&&((u=2*s)!==this._size&&this._items.get(u+1).compareTo(this._items.get(u))<0&&u++,this._items.get(u).compareTo(h)<0);s=u)this._items.set(s,this._items.get(u));this._items.set(s,h)}},{key:"clear",value:function(){this._size=0,this._items.clear()}},{key:"peek",value:function(){return this.isEmpty()?null:this._items.get(1)}},{key:"isEmpty",value:function(){return this._size===0}},{key:"add",value:function(s){this._items.add(null),this._size+=1;var u=this._size;for(this._items.set(0,s);s.compareTo(this._items.get(Math.trunc(u/2)))<0;u/=2)this._items.set(u,this._items.get(Math.trunc(u/2)));this._items.set(u,s)}}],[{key:"constructor_",value:function(){this._size=null,this._items=null,this._size=0,this._items=new st,this._items.add(null)}}]),w}(),Tl=function(){function w(){r(this,w)}return p(w,[{key:"insert",value:function(s,u){}},{key:"remove",value:function(s,u){}},{key:"query",value:function(){}}]),w}(),Ki=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"getLevel",value:function(){return this._level}},{key:"size",value:function(){return this._childBoundables.size()}},{key:"getChildBoundables",value:function(){return this._childBoundables}},{key:"addChildBoundable",value:function(s){Et.isTrue(this._bounds===null),this._childBoundables.add(s)}},{key:"isEmpty",value:function(){return this._childBoundables.isEmpty()}},{key:"getBounds",value:function(){return this._bounds===null&&(this._bounds=this.computeBounds()),this._bounds}},{key:"interfaces_",get:function(){return[ia,Ge]}}],[{key:"constructor_",value:function(){if(this._childBoundables=new st,this._bounds=null,this._level=null,arguments.length!==0&&arguments.length===1){var s=arguments[0];this._level=s}}}]),w}(),Po={reverseOrder:function(){return{compare:function(w,s){return s.compareTo(w)}}},min:function(w){return Po.sort(w),w.get(0)},sort:function(w,s){var u=w.toArray();s?qe.sort(u,s):qe.sort(u);for(var h=w.iterator(),y=0,I=u.length;yw.area(this._boundable2)?(this.expand(this._boundable1,this._boundable2,!1,s,u),null):(this.expand(this._boundable2,this._boundable1,!0,s,u),null);if(h)return this.expand(this._boundable1,this._boundable2,!1,s,u),null;if(y)return this.expand(this._boundable2,this._boundable1,!0,s,u),null;throw new Re("neither boundable is composite")}},{key:"isLeaves",value:function(){return!(w.isComposite(this._boundable1)||w.isComposite(this._boundable2))}},{key:"compareTo",value:function(s){var u=s;return this._distanceu._distance?1:0}},{key:"expand",value:function(s,u,h,y,I){for(var O=s.getChildBoundables().iterator();O.hasNext();){var U=O.next(),H=null;(H=h?new w(u,U,this._itemDistance):new w(U,u,this._itemDistance)).getDistance()-2),y.getLevel()===h)return I.add(y),null;for(var O=y.getChildBoundables().iterator();O.hasNext();){var U=O.next();U instanceof Ki?this.boundablesAtLevel(h,U,I):(Et.isTrue(U instanceof Mr),h===-1&&I.add(U))}return null}}},{key:"query",value:function(){if(arguments.length===1){var s=arguments[0];this.build();var u=new st;return this.isEmpty()||this.getIntersectsOp().intersects(this._root.getBounds(),s)&&this.queryInternal(s,this._root,u),u}if(arguments.length===2){var h=arguments[0],y=arguments[1];if(this.build(),this.isEmpty())return null;this.getIntersectsOp().intersects(this._root.getBounds(),h)&&this.queryInternal(h,this._root,y)}}},{key:"build",value:function(){if(this._built)return null;this._root=this._itemBoundables.isEmpty()?this.createNode(0):this.createHigherLevels(this._itemBoundables,-1),this._itemBoundables=null,this._built=!0}},{key:"getRoot",value:function(){return this.build(),this._root}},{key:"remove",value:function(){if(arguments.length===2){var s=arguments[0],u=arguments[1];return this.build(),!!this.getIntersectsOp().intersects(this._root.getBounds(),s)&&this.remove(s,this._root,u)}if(arguments.length===3){var h=arguments[0],y=arguments[1],I=arguments[2],O=this.removeItem(y,I);if(O)return!0;for(var U=null,H=y.getChildBoundables().iterator();H.hasNext();){var te=H.next();if(this.getIntersectsOp().intersects(te.getBounds(),h)&&te instanceof Ki&&(O=this.remove(h,te,I))){U=te;break}}return U!==null&&U.getChildBoundables().isEmpty()&&y.getChildBoundables().remove(U),O}}},{key:"createHigherLevels",value:function(s,u){Et.isTrue(!s.isEmpty());var h=this.createParentBoundables(s,u+1);return h.size()===1?h.get(0):this.createHigherLevels(h,u+1)}},{key:"depth",value:function(){if(arguments.length===0)return this.isEmpty()?0:(this.build(),this.depth(this._root));if(arguments.length===1){for(var s=arguments[0],u=0,h=s.getChildBoundables().iterator();h.hasNext();){var y=h.next();if(y instanceof Ki){var I=this.depth(y);I>u&&(u=I)}}return u+1}}},{key:"createParentBoundables",value:function(s,u){Et.isTrue(!s.isEmpty());var h=new st;h.add(this.createNode(u));var y=new st(s);Po.sort(y,this.getComparator());for(var I=y.iterator();I.hasNext();){var O=I.next();this.lastNode(h).getChildBoundables().size()===this.getNodeCapacity()&&h.add(this.createNode(u)),this.lastNode(h).addChildBoundable(O)}return h}},{key:"isEmpty",value:function(){return this._built?this._root.isEmpty():this._itemBoundables.isEmpty()}},{key:"interfaces_",get:function(){return[Ge]}}],[{key:"constructor_",value:function(){if(this._root=null,this._built=!1,this._itemBoundables=new st,this._nodeCapacity=null,arguments.length===0)w.constructor_.call(this,w.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var s=arguments[0];Et.isTrue(s>1,"Node capacity must be greater than 1"),this._nodeCapacity=s}}},{key:"compareDoubles",value:function(s,u){return s>u?1:s0);for(var I=new st,O=0;O=0;){var ke=te.poll(),Ze=ke.getDistance();if(Ze>=H)break;if(ke.isLeaves())if(ye.size()Ze&&(ye.poll(),ye.add(ke));var et=ye.peek();H=et.getDistance()}else ke.expandToQueue(te,H)}return u.getItems(ye)}}},{key:"createNode",value:function(h){return new mu(h)}},{key:"size",value:function(){return arguments.length===0?W(x(u.prototype),"size",this).call(this):W(x(u.prototype),"size",this).apply(this,arguments)}},{key:"insert",value:function(){if(!(arguments.length===2&&arguments[1]instanceof Object&&arguments[0]instanceof $t))return W(x(u.prototype),"insert",this).apply(this,arguments);var h=arguments[0],y=arguments[1];if(h.isNull())return null;W(x(u.prototype),"insert",this).call(this,h,y)}},{key:"getIntersectsOp",value:function(){return u.intersectsOp}},{key:"verticalSlices",value:function(h,y){for(var I=Math.trunc(Math.ceil(h.size()/y)),O=new Array(y).fill(null),U=h.iterator(),H=0;H0;){var te=H.poll(),ye=te.getDistance();if(ye>=O)break;te.isLeaves()?(O=ye,U=te):te.expandToQueue(H,O)}return U===null?null:[U.getBoundable(0).getItem(),U.getBoundable(1).getItem()]}}else{if(arguments.length===2){var ke=arguments[0],Ze=arguments[1];if(this.isEmpty()||ke.isEmpty())return null;var nt=new mo(this.getRoot(),ke.getRoot(),Ze);return this.nearestNeighbour(nt)}if(arguments.length===3){var et=arguments[0],Bt=arguments[1],Rt=arguments[2],Yt=new Mr(et,Bt),kn=new mo(this.getRoot(),Yt,Rt);return this.nearestNeighbour(kn)[0]}if(arguments.length===4){var Kn=arguments[0],ui=arguments[1],ar=arguments[2],Ii=arguments[3],Ti=new Mr(Kn,ui),pt=new mo(this.getRoot(),Ti,ar);return this.nearestNeighbourK(pt,Ii)}}}},{key:"isWithinDistance",value:function(){if(arguments.length===2){var h=arguments[0],y=arguments[1],I=ut.POSITIVE_INFINITY,O=new As;for(O.add(h);!O.isEmpty();){var U=O.poll(),H=U.getDistance();if(H>y)return!1;if(U.maximumDistance()<=y)return!0;if(U.isLeaves()){if((I=H)<=y)return!0}else U.expandToQueue(O,I)}return!1}if(arguments.length===3){var te=arguments[0],ye=arguments[1],ke=arguments[2],Ze=new mo(this.getRoot(),te.getRoot(),ye);return this.isWithinDistance(Ze,ke)}}},{key:"interfaces_",get:function(){return[Tl,Ge]}}],[{key:"constructor_",value:function(){if(arguments.length===0)u.constructor_.call(this,u.DEFAULT_NODE_CAPACITY);else if(arguments.length===1){var h=arguments[0];Yo.constructor_.call(this,h)}}},{key:"centreX",value:function(h){return u.avg(h.getMinX(),h.getMaxX())}},{key:"avg",value:function(h,y){return(h+y)/2}},{key:"getItems",value:function(h){for(var y=new Array(h.size()).fill(null),I=0;!h.isEmpty();){var O=h.poll();y[I]=O.getBoundable(0).getItem(),I++}return y}},{key:"centreY",value:function(h){return u.avg(h.getMinY(),h.getMaxY())}}]),u}(Yo),mu=function(w){g(u,w);var s=Y(u);function u(){var h;return r(this,u),h=s.call(this),u.constructor_.apply(M(h),arguments),h}return p(u,[{key:"computeBounds",value:function(){for(var h=null,y=this.getChildBoundables().iterator();y.hasNext();){var I=y.next();h===null?h=new $t(I.getBounds()):h.expandToInclude(I.getBounds())}return h}}],[{key:"constructor_",value:function(){var h=arguments[0];Ki.constructor_.call(this,h)}}]),u}(Ki);ao.STRtreeNode=mu,ao.xComparator=new(function(){function w(){r(this,w)}return p(w,[{key:"interfaces_",get:function(){return[tn]}},{key:"compare",value:function(s,u){return Yo.compareDoubles(ao.centreX(s.getBounds()),ao.centreX(u.getBounds()))}}]),w}()),ao.yComparator=new(function(){function w(){r(this,w)}return p(w,[{key:"interfaces_",get:function(){return[tn]}},{key:"compare",value:function(s,u){return Yo.compareDoubles(ao.centreY(s.getBounds()),ao.centreY(u.getBounds()))}}]),w}()),ao.intersectsOp=new(function(){function w(){r(this,w)}return p(w,[{key:"interfaces_",get:function(){return[IntersectsOp]}},{key:"intersects",value:function(s,u){return s.intersects(u)}}]),w}()),ao.DEFAULT_NODE_CAPACITY=10;var Mc=function(){function w(){r(this,w)}return p(w,null,[{key:"relativeSign",value:function(s,u){return su?1:0}},{key:"compare",value:function(s,u,h){if(u.equals2D(h))return 0;var y=w.relativeSign(u.x,h.x),I=w.relativeSign(u.y,h.y);switch(s){case 0:return w.compareValue(y,I);case 1:return w.compareValue(I,y);case 2:return w.compareValue(I,-y);case 3:return w.compareValue(-y,I);case 4:return w.compareValue(-y,-I);case 5:return w.compareValue(-I,-y);case 6:return w.compareValue(-I,y);case 7:return w.compareValue(y,-I)}return Et.shouldNeverReachHere("invalid octant value"),0}},{key:"compareValue",value:function(s,u){return s<0?-1:s>0?1:u<0?-1:u>0?1:0}}]),w}(),Rc=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"getCoordinate",value:function(){return this.coord}},{key:"print",value:function(s){s.print(this.coord),s.print(" seg # = "+this.segmentIndex)}},{key:"compareTo",value:function(s){var u=s;return this.segmentIndexu.segmentIndex?1:this.coord.equals2D(u.coord)?0:this._isInterior?u._isInterior?Mc.compare(this._segmentOctant,this.coord,u.coord):1:-1}},{key:"isEndPoint",value:function(s){return this.segmentIndex===0&&!this._isInterior||this.segmentIndex===s}},{key:"toString",value:function(){return this.segmentIndex+":"+this.coord.toString()}},{key:"isInterior",value:function(){return this._isInterior}},{key:"interfaces_",get:function(){return[Fe]}}],[{key:"constructor_",value:function(){this._segString=null,this.coord=null,this.segmentIndex=null,this._segmentOctant=null,this._isInterior=null;var s=arguments[0],u=arguments[1],h=arguments[2],y=arguments[3];this._segString=s,this.coord=new Ae(u),this.segmentIndex=h,this._segmentOctant=y,this._isInterior=!u.equals2D(s.getCoordinate(h))}}]),w}(),Oc=function(){function w(){r(this,w)}return p(w,[{key:"hasNext",value:function(){}},{key:"next",value:function(){}},{key:"remove",value:function(){}}]),w}(),Dc=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"getSplitCoordinates",value:function(){var s=new xi;this.addEndpoints();for(var u=this.iterator(),h=u.next();u.hasNext();){var y=u.next();this.addEdgeCoordinates(h,y,s),h=y}return s.toCoordinateArray()}},{key:"addCollapsedNodes",value:function(){var s=new st;this.findCollapsesFromInsertedNodes(s),this.findCollapsesFromExistingVertices(s);for(var u=s.iterator();u.hasNext();){var h=u.next().intValue();this.add(this._edge.getCoordinate(h),h)}}},{key:"createSplitEdgePts",value:function(s,u){var h=u.segmentIndex-s.segmentIndex+2;if(h===2)return[new Ae(s.coord),new Ae(u.coord)];var y=this._edge.getCoordinate(u.segmentIndex),I=u.isInterior()||!u.coord.equals2D(y);I||h--;var O=new Array(h).fill(null),U=0;O[U++]=new Ae(s.coord);for(var H=s.segmentIndex+1;H<=u.segmentIndex;H++)O[U++]=this._edge.getCoordinate(H);return I&&(O[U]=new Ae(u.coord)),O}},{key:"print",value:function(s){s.println("Intersections:");for(var u=this.iterator();u.hasNext();)u.next().print(s)}},{key:"findCollapsesFromExistingVertices",value:function(s){for(var u=0;u=0?u>=0?h>=y?0:1:h>=y?7:6:u>=0?h>=y?3:2:h>=y?4:5}if(arguments[0]instanceof Ae&&arguments[1]instanceof Ae){var I=arguments[0],O=arguments[1],U=O.x-I.x,H=O.y-I.y;if(U===0&&H===0)throw new Re("Cannot compute the octant for two identical points "+I);return w.octant(U,H)}}}]),w}(),Da=function(){function w(){r(this,w)}return p(w,[{key:"getCoordinates",value:function(){}},{key:"size",value:function(){}},{key:"getCoordinate",value:function(s){}},{key:"isClosed",value:function(){}},{key:"setData",value:function(s){}},{key:"getData",value:function(){}}]),w}(),Pl=function(){function w(){r(this,w)}return p(w,[{key:"addIntersection",value:function(s,u){}},{key:"interfaces_",get:function(){return[Da]}}]),w}(),go=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"getCoordinates",value:function(){return this._pts}},{key:"size",value:function(){return this._pts.length}},{key:"getCoordinate",value:function(s){return this._pts[s]}},{key:"isClosed",value:function(){return this._pts[0].equals(this._pts[this._pts.length-1])}},{key:"getSegmentOctant",value:function(s){return s===this._pts.length-1?-1:this.safeOctant(this.getCoordinate(s),this.getCoordinate(s+1))}},{key:"setData",value:function(s){this._data=s}},{key:"safeOctant",value:function(s,u){return s.equals2D(u)?0:Ll.octant(s,u)}},{key:"getData",value:function(){return this._data}},{key:"addIntersection",value:function(){if(arguments.length===2){var s=arguments[0],u=arguments[1];this.addIntersectionNode(s,u)}else if(arguments.length===4){var h=arguments[0],y=arguments[1],I=arguments[3],O=new Ae(h.getIntersection(I));this.addIntersection(O,y)}}},{key:"toString",value:function(){return El.toLineString(new vn(this._pts))}},{key:"getNodeList",value:function(){return this._nodeList}},{key:"addIntersectionNode",value:function(s,u){var h=u,y=h+1;if(y=0&&h>=0||u<=0&&h<=0?Math.max(u,h):0}if(arguments[0]instanceof Ae){var y=arguments[0];return zt.index(this.p0,this.p1,y)}}},{key:"toGeometry",value:function(s){return s.createLineString([this.p0,this.p1])}},{key:"isVertical",value:function(){return this.p0.x===this.p1.x}},{key:"equals",value:function(s){if(!(s instanceof w))return!1;var u=s;return this.p0.equals(u.p0)&&this.p1.equals(u.p1)}},{key:"intersection",value:function(s){var u=new Co;return u.computeIntersection(this.p0,this.p1,s.p0,s.p1),u.hasIntersection()?u.getIntersection(0):null}},{key:"project",value:function(){if(arguments[0]instanceof Ae){var s=arguments[0];if(s.equals(this.p0)||s.equals(this.p1))return new Ae(s);var u=this.projectionFactor(s),h=new Ae;return h.x=this.p0.x+u*(this.p1.x-this.p0.x),h.y=this.p0.y+u*(this.p1.y-this.p0.y),h}if(arguments[0]instanceof w){var y=arguments[0],I=this.projectionFactor(y.p0),O=this.projectionFactor(y.p1);if(I>=1&&O>=1||I<=0&&O<=0)return null;var U=this.project(y.p0);I<0&&(U=this.p0),I>1&&(U=this.p1);var H=this.project(y.p1);return O<0&&(H=this.p0),O>1&&(H=this.p1),new w(U,H)}}},{key:"normalize",value:function(){this.p1.compareTo(this.p0)<0&&this.reverse()}},{key:"angle",value:function(){return Math.atan2(this.p1.y-this.p0.y,this.p1.x-this.p0.x)}},{key:"getCoordinate",value:function(s){return s===0?this.p0:this.p1}},{key:"distancePerpendicular",value:function(s){return An.pointToLinePerpendicular(s,this.p0,this.p1)}},{key:"minY",value:function(){return Math.min(this.p0.y,this.p1.y)}},{key:"midPoint",value:function(){return w.midPoint(this.p0,this.p1)}},{key:"projectionFactor",value:function(s){if(s.equals(this.p0))return 0;if(s.equals(this.p1))return 1;var u=this.p1.x-this.p0.x,h=this.p1.y-this.p0.y,y=u*u+h*h;return y<=0?ut.NaN:((s.x-this.p0.x)*u+(s.y-this.p0.y)*h)/y}},{key:"closestPoints",value:function(s){var u=this.intersection(s);if(u!==null)return[u,u];var h=new Array(2).fill(null),y=ut.MAX_VALUE,I=null,O=this.closestPoint(s.p0);y=O.distance(s.p0),h[0]=O,h[1]=s.p0;var U=this.closestPoint(s.p1);(I=U.distance(s.p1))0&&u<1?this.project(s):this.p0.distance(s)1||ut.isNaN(u))&&(u=1),u}},{key:"toString",value:function(){return"LINESTRING( "+this.p0.x+" "+this.p0.y+", "+this.p1.x+" "+this.p1.y+")"}},{key:"isHorizontal",value:function(){return this.p0.y===this.p1.y}},{key:"reflect",value:function(s){var u=this.p1.getY()-this.p0.getY(),h=this.p0.getX()-this.p1.getX(),y=this.p0.getY()*(this.p1.getX()-this.p0.getX())-this.p0.getX()*(this.p1.getY()-this.p0.getY()),I=u*u+h*h,O=u*u-h*h,U=s.getX(),H=s.getY();return new Ae((-O*U-2*u*h*H-2*u*y)/I,(O*H-2*u*h*U-2*h*y)/I)}},{key:"distance",value:function(){if(arguments[0]instanceof w){var s=arguments[0];return An.segmentToSegment(this.p0,this.p1,s.p0,s.p1)}if(arguments[0]instanceof Ae){var u=arguments[0];return An.pointToSegment(u,this.p0,this.p1)}}},{key:"pointAlong",value:function(s){var u=new Ae;return u.x=this.p0.x+s*(this.p1.x-this.p0.x),u.y=this.p0.y+s*(this.p1.y-this.p0.y),u}},{key:"hashCode",value:function(){var s=ut.doubleToLongBits(this.p0.x);s^=31*ut.doubleToLongBits(this.p0.y);var u=Math.trunc(s)^Math.trunc(s>>32),h=ut.doubleToLongBits(this.p1.x);return h^=31*ut.doubleToLongBits(this.p1.y),u^(Math.trunc(h)^Math.trunc(h>>32))}},{key:"interfaces_",get:function(){return[Fe,Ge]}}],[{key:"constructor_",value:function(){if(this.p0=null,this.p1=null,arguments.length===0)w.constructor_.call(this,new Ae,new Ae);else if(arguments.length===1){var s=arguments[0];w.constructor_.call(this,s.p0,s.p1)}else if(arguments.length===2){var u=arguments[0],h=arguments[1];this.p0=u,this.p1=h}else if(arguments.length===4){var y=arguments[0],I=arguments[1],O=arguments[2],U=arguments[3];w.constructor_.call(this,new Ae(y,I),new Ae(O,U))}}},{key:"midPoint",value:function(s,u){return new Ae((s.x+u.x)/2,(s.y+u.y)/2)}}]),w}(),gu=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"overlap",value:function(){if(arguments.length!==2&&arguments.length===4){var s=arguments[0],u=arguments[1],h=arguments[2],y=arguments[3];s.getLineSegment(u,this._overlapSeg1),h.getLineSegment(y,this._overlapSeg2),this.overlap(this._overlapSeg1,this._overlapSeg2)}}}],[{key:"constructor_",value:function(){this._overlapSeg1=new bi,this._overlapSeg2=new bi}}]),w}(),Ml=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"getLineSegment",value:function(s,u){u.p0=this._pts[s],u.p1=this._pts[s+1]}},{key:"computeSelect",value:function(s,u,h,y){var I=this._pts[u],O=this._pts[h];if(h-u==1)return y.select(this,u),null;if(!s.intersects(I,O))return null;var U=Math.trunc((u+h)/2);u=s.length-1)return s.length-1;for(var y=$i.quadrant(s[h],s[h+1]),I=u+1;II.getId()&&(I.computeOverlaps(U,h),this._nOverlaps++),this._segInt.isDone())return null}}}],[{key:"constructor_",value:function(){if(this._monoChains=new st,this._index=new ao,this._idCounter=0,this._nodedSegStrings=null,this._nOverlaps=0,arguments.length!==0&&arguments.length===1){var h=arguments[0];Ol.constructor_.call(this,h)}}}]),u}(Ol),Xo=function(w){g(u,w);var s=Y(u);function u(){var h;return r(this,u),h=s.call(this),u.constructor_.apply(M(h),arguments),h}return p(u,[{key:"overlap",value:function(){if(arguments.length!==4)return W(x(u.prototype),"overlap",this).apply(this,arguments);var h=arguments[0],y=arguments[1],I=arguments[2],O=arguments[3],U=h.getContext(),H=I.getContext();this._si.processIntersections(U,y,H,O)}}],[{key:"constructor_",value:function(){this._si=null;var h=arguments[0];this._si=h}}]),u}(gu);Mo.SegmentOverlapAction=Xo;var Rr=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"isDeletable",value:function(s,u,h,y){var I=this._inputLine[s],O=this._inputLine[u],U=this._inputLine[h];return!!this.isConcave(I,O,U)&&!!this.isShallow(I,O,U,y)&&this.isShallowSampled(I,O,s,h,y)}},{key:"deleteShallowConcavities",value:function(){for(var s=1,u=this.findNextNonDeletedIndex(s),h=this.findNextNonDeletedIndex(u),y=!1;h=0;y--)this.addPt(s[y])}},{key:"isRedundant",value:function(s){if(this._ptList.size()<1)return!1;var u=this._ptList.get(this._ptList.size()-1);return s.distance(u)Math.PI;)s-=w.PI_TIMES_2;for(;s<=-Math.PI;)s+=w.PI_TIMES_2;return s}},{key:"angle",value:function(){if(arguments.length===1){var s=arguments[0];return Math.atan2(s.y,s.x)}if(arguments.length===2){var u=arguments[0],h=arguments[1],y=h.x-u.x,I=h.y-u.y;return Math.atan2(I,y)}}},{key:"isAcute",value:function(s,u,h){var y=s.x-u.x,I=s.y-u.y;return y*(h.x-u.x)+I*(h.y-u.y)>0}},{key:"isObtuse",value:function(s,u,h){var y=s.x-u.x,I=s.y-u.y;return y*(h.x-u.x)+I*(h.y-u.y)<0}},{key:"interiorAngle",value:function(s,u,h){var y=w.angle(u,s),I=w.angle(u,h);return Math.abs(I-y)}},{key:"normalizePositive",value:function(s){if(s<0){for(;s<0;)s+=w.PI_TIMES_2;s>=w.PI_TIMES_2&&(s=0)}else{for(;s>=w.PI_TIMES_2;)s-=w.PI_TIMES_2;s<0&&(s=0)}return s}},{key:"angleBetween",value:function(s,u,h){var y=w.angle(u,s),I=w.angle(u,h);return w.diff(y,I)}},{key:"diff",value:function(s,u){var h=null;return(h=sMath.PI&&(h=2*Math.PI-h),h}},{key:"toRadians",value:function(s){return s*Math.PI/180}},{key:"getTurn",value:function(s,u){var h=Math.sin(u-s);return h>0?w.COUNTERCLOCKWISE:h<0?w.CLOCKWISE:w.NONE}},{key:"angleBetweenOriented",value:function(s,u,h){var y=w.angle(u,s),I=w.angle(u,h)-y;return I<=-Math.PI?I+w.PI_TIMES_2:I>Math.PI?I-w.PI_TIMES_2:I}}]),w}();Xt.PI_TIMES_2=2*Math.PI,Xt.PI_OVER_2=Math.PI/2,Xt.PI_OVER_4=Math.PI/4,Xt.COUNTERCLOCKWISE=zt.COUNTERCLOCKWISE,Xt.CLOCKWISE=zt.CLOCKWISE,Xt.NONE=zt.COLLINEAR;var Ro=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"addNextSegment",value:function(s,u){if(this._s0=this._s1,this._s1=this._s2,this._s2=s,this._seg0.setCoordinates(this._s0,this._s1),this.computeOffsetSegment(this._seg0,this._side,this._distance,this._offset0),this._seg1.setCoordinates(this._s1,this._s2),this.computeOffsetSegment(this._seg1,this._side,this._distance,this._offset1),this._s1.equals(this._s2))return null;var h=zt.index(this._s0,this._s1,this._s2),y=h===zt.CLOCKWISE&&this._side===ot.LEFT||h===zt.COUNTERCLOCKWISE&&this._side===ot.RIGHT;h===0?this.addCollinear(u):y?this.addOutsideTurn(h,u):this.addInsideTurn(h,u)}},{key:"addLineEndCap",value:function(s,u){var h=new bi(s,u),y=new bi;this.computeOffsetSegment(h,ot.LEFT,this._distance,y);var I=new bi;this.computeOffsetSegment(h,ot.RIGHT,this._distance,I);var O=u.x-s.x,U=u.y-s.y,H=Math.atan2(U,O);switch(this._bufParams.getEndCapStyle()){case Ie.CAP_ROUND:this._segList.addPt(y.p1),this.addDirectedFillet(u,H+Math.PI/2,H-Math.PI/2,zt.CLOCKWISE,this._distance),this._segList.addPt(I.p1);break;case Ie.CAP_FLAT:this._segList.addPt(y.p1),this._segList.addPt(I.p1);break;case Ie.CAP_SQUARE:var te=new Ae;te.x=Math.abs(this._distance)*Math.cos(H),te.y=Math.abs(this._distance)*Math.sin(H);var ye=new Ae(y.p1.x+te.x,y.p1.y+te.y),ke=new Ae(I.p1.x+te.x,I.p1.y+te.y);this._segList.addPt(ye),this._segList.addPt(ke)}}},{key:"getCoordinates",value:function(){return this._segList.getCoordinates()}},{key:"addMitreJoin",value:function(s,u,h,y){var I=Lr.intersection(u.p0,u.p1,h.p0,h.p1);if(I!==null&&(y<=0?1:I.distance(s)/Math.abs(y))<=this._bufParams.getMitreLimit())return this._segList.addPt(I),null;this.addLimitedMitreJoin(u,h,y,this._bufParams.getMitreLimit())}},{key:"addOutsideTurn",value:function(s,u){if(this._offset0.p1.distance(this._offset1.p0)=ke&&(H-=2*Math.PI),this._segList.addPt(u),this.addDirectedFillet(s,H,ke,y,I),this._segList.addPt(h)}},{key:"addLastSegment",value:function(){this._segList.addPt(this._offset1.p1)}},{key:"initSideSegments",value:function(s,u,h){this._s1=s,this._s2=u,this._side=h,this._seg1.setCoordinates(s,u),this.computeOffsetSegment(this._seg1,h,this._distance,this._offset1)}},{key:"addLimitedMitreJoin",value:function(s,u,h,y){var I=this._seg0.p1,O=Xt.angle(I,this._seg0.p0),U=Xt.angleBetweenOriented(this._seg0.p0,I,this._seg1.p1)/2,H=Xt.normalize(O+U),te=Xt.normalize(H+Math.PI),ye=y*h,ke=h-ye*Math.abs(Math.sin(U)),Ze=I.x+ye*Math.cos(te),nt=I.y+ye*Math.sin(te),et=new Ae(Ze,nt),Bt=new bi(I,et),Rt=Bt.pointAlongOffset(1,ke),Yt=Bt.pointAlongOffset(1,-ke);this._side===ot.LEFT?(this._segList.addPt(Rt),this._segList.addPt(Yt)):(this._segList.addPt(Yt),this._segList.addPt(Rt))}},{key:"addDirectedFillet",value:function(s,u,h,y,I){var O=y===zt.CLOCKWISE?-1:1,U=Math.abs(u-h),H=Math.trunc(U/this._filletAngleQuantum+.5);if(H<1)return null;for(var te=U/H,ye=new Ae,ke=0;ke0){var h=new Ae((this._closingSegLengthFactor*this._offset0.p1.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset0.p1.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(h);var y=new Ae((this._closingSegLengthFactor*this._offset1.p0.x+this._s1.x)/(this._closingSegLengthFactor+1),(this._closingSegLengthFactor*this._offset1.p0.y+this._s1.y)/(this._closingSegLengthFactor+1));this._segList.addPt(y)}else this._segList.addPt(this._s1);this._segList.addPt(this._offset1.p0)}}},{key:"createCircle",value:function(s){var u=new Ae(s.x+this._distance,s.y);this._segList.addPt(u),this.addDirectedFillet(s,0,2*Math.PI,-1,this._distance),this._segList.closeRing()}},{key:"addBevelJoin",value:function(s,u){this._segList.addPt(s.p1),this._segList.addPt(u.p0)}},{key:"init",value:function(s){this._distance=s,this._maxCurveSegmentError=s*(1-Math.cos(this._filletAngleQuantum/2)),this._segList=new Na,this._segList.setPrecisionModel(this._precisionModel),this._segList.setMinimumVertexDistance(s*w.CURVE_VERTEX_SNAP_DISTANCE_FACTOR)}},{key:"addCollinear",value:function(s){this._li.computeIntersection(this._s0,this._s1,this._s1,this._s2),this._li.getIntersectionNum()>=2&&(this._bufParams.getJoinStyle()===Ie.JOIN_BEVEL||this._bufParams.getJoinStyle()===Ie.JOIN_MITRE?(s&&this._segList.addPt(this._offset0.p1),this._segList.addPt(this._offset1.p0)):this.addCornerFillet(this._s1,this._offset0.p1,this._offset1.p0,zt.CLOCKWISE,this._distance))}},{key:"closeRing",value:function(){this._segList.closeRing()}},{key:"hasNarrowConcaveAngle",value:function(){return this._hasNarrowConcaveAngle}}],[{key:"constructor_",value:function(){this._maxCurveSegmentError=0,this._filletAngleQuantum=null,this._closingSegLengthFactor=1,this._segList=null,this._distance=0,this._precisionModel=null,this._bufParams=null,this._li=null,this._s0=null,this._s1=null,this._s2=null,this._seg0=new bi,this._seg1=new bi,this._offset0=new bi,this._offset1=new bi,this._side=0,this._hasNarrowConcaveAngle=!1;var s=arguments[0],u=arguments[1],h=arguments[2];this._precisionModel=s,this._bufParams=u,this._li=new Co,this._filletAngleQuantum=Math.PI/2/u.getQuadrantSegments(),u.getQuadrantSegments()>=8&&u.getJoinStyle()===Ie.JOIN_ROUND&&(this._closingSegLengthFactor=w.MAX_CLOSING_SEG_LEN_FACTOR),this.init(h)}}]),w}();Ro.OFFSET_SEGMENT_SEPARATION_FACTOR=.001,Ro.INSIDE_TURN_VERTEX_SNAP_DISTANCE_FACTOR=.001,Ro.CURVE_VERTEX_SNAP_DISTANCE_FACTOR=1e-6,Ro.MAX_CLOSING_SEG_LEN_FACTOR=80;var Nc=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"getOffsetCurve",value:function(s,u){if(this._distance=u,u===0)return null;var h=u<0,y=Math.abs(u),I=this.getSegGen(y);s.length<=1?this.computePointCurve(s[0],I):this.computeOffsetCurve(s,h,I);var O=I.getCoordinates();return h&&mn.reverse(O),O}},{key:"computeSingleSidedBufferCurve",value:function(s,u,h){var y=this.simplifyTolerance(this._distance);if(u){h.addSegments(s,!0);var I=Rr.simplify(s,-y),O=I.length-1;h.initSideSegments(I[O],I[O-1],ot.LEFT),h.addFirstSegment();for(var U=O-2;U>=0;U--)h.addNextSegment(I[U],!0)}else{h.addSegments(s,!1);var H=Rr.simplify(s,y),te=H.length-1;h.initSideSegments(H[0],H[1],ot.LEFT),h.addFirstSegment();for(var ye=2;ye<=te;ye++)h.addNextSegment(H[ye],!0)}h.addLastSegment(),h.closeRing()}},{key:"computeRingBufferCurve",value:function(s,u,h){var y=this.simplifyTolerance(this._distance);u===ot.RIGHT&&(y=-y);var I=Rr.simplify(s,y),O=I.length-1;h.initSideSegments(I[O-1],I[0],u);for(var U=1;U<=O;U++){var H=U!==1;h.addNextSegment(I[U],H)}h.closeRing()}},{key:"computeLineBufferCurve",value:function(s,u){var h=this.simplifyTolerance(this._distance),y=Rr.simplify(s,h),I=y.length-1;u.initSideSegments(y[0],y[1],ot.LEFT);for(var O=2;O<=I;O++)u.addNextSegment(y[O],!0);u.addLastSegment(),u.addLineEndCap(y[I-1],y[I]);var U=Rr.simplify(s,-h),H=U.length-1;u.initSideSegments(U[H],U[H-1],ot.LEFT);for(var te=H-2;te>=0;te--)u.addNextSegment(U[te],!0);u.addLastSegment(),u.addLineEndCap(U[1],U[0]),u.closeRing()}},{key:"computePointCurve",value:function(s,u){switch(this._bufParams.getEndCapStyle()){case Ie.CAP_ROUND:u.createCircle(s);break;case Ie.CAP_SQUARE:u.createSquare(s)}}},{key:"getLineCurve",value:function(s,u){if(this._distance=u,this.isLineOffsetEmpty(u))return null;var h=Math.abs(u),y=this.getSegGen(h);if(s.length<=1)this.computePointCurve(s[0],y);else if(this._bufParams.isSingleSided()){var I=u<0;this.computeSingleSidedBufferCurve(s,I,y)}else this.computeLineBufferCurve(s,y);return y.getCoordinates()}},{key:"getBufferParameters",value:function(){return this._bufParams}},{key:"simplifyTolerance",value:function(s){return s*this._bufParams.getSimplifyFactor()}},{key:"getRingCurve",value:function(s,u,h){if(this._distance=h,s.length<=2)return this.getLineCurve(s,h);if(h===0)return w.copyCoordinates(s);var y=this.getSegGen(h);return this.computeRingBufferCurve(s,u,y),y.getCoordinates()}},{key:"computeOffsetCurve",value:function(s,u,h){var y=this.simplifyTolerance(this._distance);if(u){var I=Rr.simplify(s,-y),O=I.length-1;h.initSideSegments(I[O],I[O-1],ot.LEFT),h.addFirstSegment();for(var U=O-2;U>=0;U--)h.addNextSegment(I[U],!0)}else{var H=Rr.simplify(s,y),te=H.length-1;h.initSideSegments(H[0],H[1],ot.LEFT),h.addFirstSegment();for(var ye=2;ye<=te;ye++)h.addNextSegment(H[ye],!0)}h.addLastSegment()}},{key:"isLineOffsetEmpty",value:function(s){return s===0||s<0&&!this._bufParams.isSingleSided()}},{key:"getSegGen",value:function(s){return new Ro(this._precisionModel,this._bufParams,s)}}],[{key:"constructor_",value:function(){this._distance=0,this._precisionModel=null,this._bufParams=null;var s=arguments[0],u=arguments[1];this._precisionModel=s,this._bufParams=u}},{key:"copyCoordinates",value:function(s){for(var u=new Array(s.length).fill(null),h=0;hI.getMaxY()||this.findStabbedSegments(s,y.getDirectedEdges(),u)}return u}if(arguments.length===3){if(Kt(arguments[2],Bi)&&arguments[0]instanceof Ae&&arguments[1]instanceof Cs)for(var O=arguments[0],U=arguments[1],H=arguments[2],te=U.getEdge().getCoordinates(),ye=0;yethis._seg.p1.y&&this._seg.reverse();var ke=Math.max(this._seg.p0.x,this._seg.p1.x);if(!(kethis._seg.p1.y||zt.index(this._seg.p0,this._seg.p1,O)===zt.RIGHT)){var Ze=U.getDepth(ot.LEFT);this._seg.p0.equals(te[ye])||(Ze=U.getDepth(ot.RIGHT));var nt=new Ps(this._seg,Ze);H.add(nt)}}else if(Kt(arguments[2],Bi)&&arguments[0]instanceof Ae&&Kt(arguments[1],Bi))for(var et=arguments[0],Bt=arguments[1],Rt=arguments[2],Yt=Bt.iterator();Yt.hasNext();){var kn=Yt.next();kn.isForward()&&this.findStabbedSegments(et,kn,Rt)}}}},{key:"getDepth",value:function(s){var u=this.findStabbedSegments(s);return u.size()===0?0:Po.min(u)._leftDepth}}],[{key:"constructor_",value:function(){this._subgraphs=null,this._seg=new bi;var s=arguments[0];this._subgraphs=s}}]),w}(),Ps=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"compareTo",value:function(s){var u=s;if(this._upwardSeg.minX()>=u._upwardSeg.maxX())return 1;if(this._upwardSeg.maxX()<=u._upwardSeg.minX())return-1;var h=this._upwardSeg.orientationIndex(u._upwardSeg);return h!==0||(h=-1*u._upwardSeg.orientationIndex(this._upwardSeg))!==0?h:this._upwardSeg.compareTo(u._upwardSeg)}},{key:"compareX",value:function(s,u){var h=s.p0.compareTo(u.p0);return h!==0?h:s.p1.compareTo(u.p1)}},{key:"toString",value:function(){return this._upwardSeg.toString()}},{key:"interfaces_",get:function(){return[Fe]}}],[{key:"constructor_",value:function(){this._upwardSeg=null,this._leftDepth=null;var s=arguments[0],u=arguments[1];this._upwardSeg=new bi(s),this._leftDepth=u}}]),w}();Dl.DepthSegment=Ps;var Qn=function(w){g(u,w);var s=Y(u);function u(){var h;return r(this,u),h=s.call(this),u.constructor_.apply(M(h),arguments),h}return p(u,null,[{key:"constructor_",value:function(){Pe.constructor_.call(this,"Projective point not representable on the Cartesian plane.")}}]),u}(Pe),Nl=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"getY",value:function(){var s=this.y/this.w;if(ut.isNaN(s)||ut.isInfinite(s))throw new Qn;return s}},{key:"getX",value:function(){var s=this.x/this.w;if(ut.isNaN(s)||ut.isInfinite(s))throw new Qn;return s}},{key:"getCoordinate",value:function(){var s=new Ae;return s.x=this.getX(),s.y=this.getY(),s}}],[{key:"constructor_",value:function(){if(this.x=null,this.y=null,this.w=null,arguments.length===0)this.x=0,this.y=0,this.w=1;else if(arguments.length===1){var s=arguments[0];this.x=s.x,this.y=s.y,this.w=1}else if(arguments.length===2){if(typeof arguments[0]=="number"&&typeof arguments[1]=="number"){var u=arguments[0],h=arguments[1];this.x=u,this.y=h,this.w=1}else if(arguments[0]instanceof w&&arguments[1]instanceof w){var y=arguments[0],I=arguments[1];this.x=y.y*I.w-I.y*y.w,this.y=I.x*y.w-y.x*I.w,this.w=y.x*I.y-I.x*y.y}else if(arguments[0]instanceof Ae&&arguments[1]instanceof Ae){var O=arguments[0],U=arguments[1];this.x=O.y-U.y,this.y=U.x-O.x,this.w=O.x*U.y-U.x*O.y}}else if(arguments.length===3){var H=arguments[0],te=arguments[1],ye=arguments[2];this.x=H,this.y=te,this.w=ye}else if(arguments.length===4){var ke=arguments[0],Ze=arguments[1],nt=arguments[2],et=arguments[3],Bt=ke.y-Ze.y,Rt=Ze.x-ke.x,Yt=ke.x*Ze.y-Ze.x*ke.y,kn=nt.y-et.y,Kn=et.x-nt.x,ui=nt.x*et.y-et.x*nt.y;this.x=Rt*ui-Kn*Yt,this.y=kn*Yt-Bt*ui,this.w=Bt*Kn-kn*Rt}}}]),w}(),dn=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"area",value:function(){return w.area(this.p0,this.p1,this.p2)}},{key:"signedArea",value:function(){return w.signedArea(this.p0,this.p1,this.p2)}},{key:"interpolateZ",value:function(s){if(s===null)throw new Re("Supplied point is null.");return w.interpolateZ(s,this.p0,this.p1,this.p2)}},{key:"longestSideLength",value:function(){return w.longestSideLength(this.p0,this.p1,this.p2)}},{key:"isAcute",value:function(){return w.isAcute(this.p0,this.p1,this.p2)}},{key:"circumcentre",value:function(){return w.circumcentre(this.p0,this.p1,this.p2)}},{key:"area3D",value:function(){return w.area3D(this.p0,this.p1,this.p2)}},{key:"centroid",value:function(){return w.centroid(this.p0,this.p1,this.p2)}},{key:"inCentre",value:function(){return w.inCentre(this.p0,this.p1,this.p2)}}],[{key:"constructor_",value:function(){this.p0=null,this.p1=null,this.p2=null;var s=arguments[0],u=arguments[1],h=arguments[2];this.p0=s,this.p1=u,this.p2=h}},{key:"area",value:function(s,u,h){return Math.abs(((h.x-s.x)*(u.y-s.y)-(u.x-s.x)*(h.y-s.y))/2)}},{key:"signedArea",value:function(s,u,h){return((h.x-s.x)*(u.y-s.y)-(u.x-s.x)*(h.y-s.y))/2}},{key:"det",value:function(s,u,h,y){return s*y-u*h}},{key:"interpolateZ",value:function(s,u,h,y){var I=u.x,O=u.y,U=h.x-I,H=y.x-I,te=h.y-O,ye=y.y-O,ke=U*ye-H*te,Ze=s.x-I,nt=s.y-O,et=(ye*Ze-H*nt)/ke,Bt=(-te*Ze+U*nt)/ke;return u.getZ()+et*(h.getZ()-u.getZ())+Bt*(y.getZ()-u.getZ())}},{key:"longestSideLength",value:function(s,u,h){var y=s.distance(u),I=u.distance(h),O=h.distance(s),U=y;return I>U&&(U=I),O>U&&(U=O),U}},{key:"circumcentreDD",value:function(s,u,h){var y=Ht.valueOf(s.x).subtract(h.x),I=Ht.valueOf(s.y).subtract(h.y),O=Ht.valueOf(u.x).subtract(h.x),U=Ht.valueOf(u.y).subtract(h.y),H=Ht.determinant(y,I,O,U).multiply(2),te=y.sqr().add(I.sqr()),ye=O.sqr().add(U.sqr()),ke=Ht.determinant(I,te,U,ye),Ze=Ht.determinant(y,te,O,ye),nt=Ht.valueOf(h.x).subtract(ke.divide(H)).doubleValue(),et=Ht.valueOf(h.y).add(Ze.divide(H)).doubleValue();return new Ae(nt,et)}},{key:"isAcute",value:function(s,u,h){return!!Xt.isAcute(s,u,h)&&!!Xt.isAcute(u,h,s)&&!!Xt.isAcute(h,s,u)}},{key:"circumcentre",value:function(s,u,h){var y=h.x,I=h.y,O=s.x-y,U=s.y-I,H=u.x-y,te=u.y-I,ye=2*w.det(O,U,H,te),ke=w.det(U,O*O+U*U,te,H*H+te*te),Ze=w.det(O,O*O+U*U,H,H*H+te*te);return new Ae(y-ke/ye,I+Ze/ye)}},{key:"perpendicularBisector",value:function(s,u){var h=u.x-s.x,y=u.y-s.y,I=new Nl(s.x+h/2,s.y+y/2,1),O=new Nl(s.x-y+h/2,s.y+h+y/2,1);return new Nl(I,O)}},{key:"angleBisector",value:function(s,u,h){var y=u.distance(s),I=y/(y+u.distance(h)),O=h.x-s.x,U=h.y-s.y;return new Ae(s.x+I*O,s.y+I*U)}},{key:"area3D",value:function(s,u,h){var y=u.x-s.x,I=u.y-s.y,O=u.getZ()-s.getZ(),U=h.x-s.x,H=h.y-s.y,te=h.getZ()-s.getZ(),ye=I*te-O*H,ke=O*U-y*te,Ze=y*H-I*U,nt=ye*ye+ke*ke+Ze*Ze,et=Math.sqrt(nt)/2;return et}},{key:"centroid",value:function(s,u,h){var y=(s.x+u.x+h.x)/3,I=(s.y+u.y+h.y)/3;return new Ae(y,I)}},{key:"inCentre",value:function(s,u,h){var y=u.distance(h),I=s.distance(h),O=s.distance(u),U=y+I+O,H=(y*s.x+I*u.x+O*h.x)/U,te=(y*s.y+I*u.y+O*h.y)/U;return new Ae(H,te)}}]),w}(),zl=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"addRingSide",value:function(s,u,h,y,I){if(u===0&&s.length=Wn.MINIMUM_VALID_SIZE&&zt.isCCW(s)&&(O=I,U=y,h=ot.opposite(h));var H=this._curveBuilder.getRingCurve(s,h,u);this.addCurve(H,O,U)}},{key:"addRingBothSides",value:function(s,u){this.addRingSide(s,u,ot.LEFT,fe.EXTERIOR,fe.INTERIOR),this.addRingSide(s,u,ot.RIGHT,fe.INTERIOR,fe.EXTERIOR)}},{key:"addPoint",value:function(s){if(this._distance<=0)return null;var u=s.getCoordinates(),h=this._curveBuilder.getLineCurve(u,this._distance);this.addCurve(h,fe.EXTERIOR,fe.INTERIOR)}},{key:"addPolygon",value:function(s){var u=this._distance,h=ot.LEFT;this._distance<0&&(u=-this._distance,h=ot.RIGHT);var y=s.getExteriorRing(),I=mn.removeRepeatedPoints(y.getCoordinates());if(this._distance<0&&this.isErodedCompletely(y,this._distance)||this._distance<=0&&I.length<3)return null;this.addRingSide(I,u,h,fe.EXTERIOR,fe.INTERIOR);for(var O=0;O0&&this.isErodedCompletely(U,-this._distance)||this.addRingSide(H,u,ot.opposite(h),fe.INTERIOR,fe.EXTERIOR)}}},{key:"isTriangleErodedCompletely",value:function(s,u){var h=new dn(s[0],s[1],s[2]),y=h.inCentre();return An.pointToSegment(y,h.p0,h.p1)I}},{key:"addCollection",value:function(s){for(var u=0;u=this._max)throw new Ue;var s=this._parent.getGeometryN(this._index++);return s instanceof sn?(this._subcollectionIterator=new w(s),this._subcollectionIterator.next()):s}},{key:"remove",value:function(){throw new Ot(this.getClass().getName())}},{key:"hasNext",value:function(){if(this._atStart)return!0;if(this._subcollectionIterator!==null){if(this._subcollectionIterator.hasNext())return!0;this._subcollectionIterator=null}return!(this._index>=this._max)}},{key:"interfaces_",get:function(){return[Oc]}}],[{key:"constructor_",value:function(){this._parent=null,this._atStart=null,this._max=null,this._index=null,this._subcollectionIterator=null;var s=arguments[0];this._parent=s,this._atStart=!0,this._index=0,this._max=s.getNumGeometries()}},{key:"isAtomic",value:function(s){return!(s instanceof sn)}}]),w}(),$o=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"locate",value:function(s){return w.locate(s,this._geom)}},{key:"interfaces_",get:function(){return[Bn]}}],[{key:"constructor_",value:function(){this._geom=null;var s=arguments[0];this._geom=s}},{key:"locatePointInPolygon",value:function(s,u){if(u.isEmpty())return fe.EXTERIOR;var h=u.getExteriorRing(),y=w.locatePointInRing(s,h);if(y!==fe.INTERIOR)return y;for(var I=0;I=0;I--){var O=this._edgeList.get(I),U=O.getSym();y===null&&(y=U),h!==null&&U.setNext(h),h=O}y.setNext(h)}},{key:"computeDepths",value:function(){if(arguments.length===1){var h=arguments[0],y=this.findIndex(h),I=h.getDepth(ot.LEFT),O=h.getDepth(ot.RIGHT),U=this.computeDepths(y+1,this._edgeList.size(),I),H=this.computeDepths(0,y,U);if(H!==O)throw new Hn("depth mismatch at "+h.getCoordinate())}else if(arguments.length===3){for(var te=arguments[0],ye=arguments[1],ke=arguments[2],Ze=ke,nt=te;nt=0;U--){var H=this._resultAreaEdgeList.get(U),te=H.getSym();switch(y===null&&H.getEdgeRing()===h&&(y=H),O){case this._SCANNING_FOR_INCOMING:if(te.getEdgeRing()!==h)continue;I=te,O=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(H.getEdgeRing()!==h)continue;I.setNextMin(H),O=this._SCANNING_FOR_INCOMING}}O===this._LINKING_TO_OUTGOING&&(Et.isTrue(y!==null,"found null for first outgoing dirEdge"),Et.isTrue(y.getEdgeRing()===h,"unable to link last incoming dirEdge"),I.setNextMin(y))}},{key:"getOutgoingDegree",value:function(){if(arguments.length===0){for(var h=0,y=this.iterator();y.hasNext();){var I=y.next();I.isInResult()&&h++}return h}if(arguments.length===1){for(var O=arguments[0],U=0,H=this.iterator();H.hasNext();){var te=H.next();te.getEdgeRing()===O&&U++}return U}}},{key:"getLabel",value:function(){return this._label}},{key:"findCoveredLineEdges",value:function(){for(var h=fe.NONE,y=this.iterator();y.hasNext();){var I=y.next(),O=I.getSym();if(!I.isLineEdge()){if(I.isInResult()){h=fe.INTERIOR;break}if(O.isInResult()){h=fe.EXTERIOR;break}}}if(h===fe.NONE)return null;for(var U=h,H=this.iterator();H.hasNext();){var te=H.next(),ye=te.getSym();te.isLineEdge()?te.getEdge().setCovered(U===fe.INTERIOR):(te.isInResult()&&(U=fe.EXTERIOR),ye.isInResult()&&(U=fe.INTERIOR))}}},{key:"computeLabelling",value:function(h){W(x(u.prototype),"computeLabelling",this).call(this,h),this._label=new Xi(fe.NONE);for(var y=this.iterator();y.hasNext();)for(var I=y.next().getEdge().getLabel(),O=0;O<2;O++){var U=I.getLocation(O);U!==fe.INTERIOR&&U!==fe.BOUNDARY||this._label.setLocation(O,fe.INTERIOR)}}}],[{key:"constructor_",value:function(){this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}}]),u}(za),yu=function(w){g(u,w);var s=Y(u);function u(){return r(this,u),s.call(this)}return p(u,[{key:"createNode",value:function(h){return new Ao(h,new Fl)}}]),u}(ji),ra=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"compareTo",value:function(s){var u=s;return w.compareOriented(this._pts,this._orientation,u._pts,u._orientation)}},{key:"interfaces_",get:function(){return[Fe]}}],[{key:"constructor_",value:function(){this._pts=null,this._orientation=null;var s=arguments[0];this._pts=s,this._orientation=w.orientation(s)}},{key:"orientation",value:function(s){return mn.increasingDirection(s)===1}},{key:"compareOriented",value:function(s,u,h,y){for(var I=u?1:-1,O=y?1:-1,U=u?s.length:-1,H=y?h.length:-1,te=u?0:s.length-1,ye=y?0:h.length-1;;){var ke=s[te].compareTo(h[ye]);if(ke!==0)return ke;var Ze=(te+=I)===U,nt=(ye+=O)===H;if(Ze&&!nt)return-1;if(!Ze&&nt)return 1;if(Ze&&nt)return 0}}}]),w}(),Fa=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"print",value:function(s){s.print("MULTILINESTRING ( ");for(var u=0;u0&&s.print(","),s.print("(");for(var y=h.getCoordinates(),I=0;I0&&s.print(","),s.print(y[I].x+" "+y[I].y);s.println(")")}s.print(") ")}},{key:"addAll",value:function(s){for(var u=s.iterator();u.hasNext();)this.add(u.next())}},{key:"findEdgeIndex",value:function(s){for(var u=0;us?1:this.distu?1:0}},{key:"interfaces_",get:function(){return[Fe]}}],[{key:"constructor_",value:function(){this.coord=null,this.segmentIndex=null,this.dist=null;var s=arguments[0],u=arguments[1],h=arguments[2];this.coord=new Ae(s),this.segmentIndex=u,this.dist=h}}]),w}(),vu=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"print",value:function(s){s.println("Intersections:");for(var u=this.iterator();u.hasNext();)u.next().print(s)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(s){this.addEndpoints();for(var u=this.iterator(),h=u.next();u.hasNext();){var y=u.next(),I=this.createSplitEdge(h,y);s.add(I),h=y}}},{key:"addEndpoints",value:function(){var s=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[s],s,0)}},{key:"createSplitEdge",value:function(s,u){var h=u.segmentIndex-s.segmentIndex+2,y=this.edge.pts[u.segmentIndex],I=u.dist>0||!u.coord.equals2D(y);I||h--;var O=new Array(h).fill(null),U=0;O[U++]=new Ae(s.coord);for(var H=s.segmentIndex+1;H<=u.segmentIndex;H++)O[U++]=this.edge.pts[H];return I&&(O[U]=u.coord),new sa(O,new Xi(this.edge._label))}},{key:"add",value:function(s,u,h){var y=new Ba(s,u,h),I=this._nodeMap.get(y);return I!==null?I:(this._nodeMap.put(y,y),y)}},{key:"isIntersection",value:function(s){for(var u=this.iterator();u.hasNext();)if(u.next().coord.equals(s))return!0;return!1}}],[{key:"constructor_",value:function(){this._nodeMap=new na,this.edge=null;var s=arguments[0];this.edge=s}}]),w}(),Ua=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"isIntersects",value:function(){return!this.isDisjoint()}},{key:"isCovers",value:function(){return(w.isTrue(this._matrix[fe.INTERIOR][fe.INTERIOR])||w.isTrue(this._matrix[fe.INTERIOR][fe.BOUNDARY])||w.isTrue(this._matrix[fe.BOUNDARY][fe.INTERIOR])||w.isTrue(this._matrix[fe.BOUNDARY][fe.BOUNDARY]))&&this._matrix[fe.EXTERIOR][fe.INTERIOR]===oe.FALSE&&this._matrix[fe.EXTERIOR][fe.BOUNDARY]===oe.FALSE}},{key:"isCoveredBy",value:function(){return(w.isTrue(this._matrix[fe.INTERIOR][fe.INTERIOR])||w.isTrue(this._matrix[fe.INTERIOR][fe.BOUNDARY])||w.isTrue(this._matrix[fe.BOUNDARY][fe.INTERIOR])||w.isTrue(this._matrix[fe.BOUNDARY][fe.BOUNDARY]))&&this._matrix[fe.INTERIOR][fe.EXTERIOR]===oe.FALSE&&this._matrix[fe.BOUNDARY][fe.EXTERIOR]===oe.FALSE}},{key:"set",value:function(){if(arguments.length===1)for(var s=arguments[0],u=0;u=0&&u>=0&&this.setAtLeast(s,u,h)}},{key:"isWithin",value:function(){return w.isTrue(this._matrix[fe.INTERIOR][fe.INTERIOR])&&this._matrix[fe.INTERIOR][fe.EXTERIOR]===oe.FALSE&&this._matrix[fe.BOUNDARY][fe.EXTERIOR]===oe.FALSE}},{key:"isTouches",value:function(s,u){return s>u?this.isTouches(u,s):(s===oe.A&&u===oe.A||s===oe.L&&u===oe.L||s===oe.L&&u===oe.A||s===oe.P&&u===oe.A||s===oe.P&&u===oe.L)&&this._matrix[fe.INTERIOR][fe.INTERIOR]===oe.FALSE&&(w.isTrue(this._matrix[fe.INTERIOR][fe.BOUNDARY])||w.isTrue(this._matrix[fe.BOUNDARY][fe.INTERIOR])||w.isTrue(this._matrix[fe.BOUNDARY][fe.BOUNDARY]))}},{key:"isOverlaps",value:function(s,u){return s===oe.P&&u===oe.P||s===oe.A&&u===oe.A?w.isTrue(this._matrix[fe.INTERIOR][fe.INTERIOR])&&w.isTrue(this._matrix[fe.INTERIOR][fe.EXTERIOR])&&w.isTrue(this._matrix[fe.EXTERIOR][fe.INTERIOR]):s===oe.L&&u===oe.L&&this._matrix[fe.INTERIOR][fe.INTERIOR]===1&&w.isTrue(this._matrix[fe.INTERIOR][fe.EXTERIOR])&&w.isTrue(this._matrix[fe.EXTERIOR][fe.INTERIOR])}},{key:"isEquals",value:function(s,u){return s===u&&w.isTrue(this._matrix[fe.INTERIOR][fe.INTERIOR])&&this._matrix[fe.INTERIOR][fe.EXTERIOR]===oe.FALSE&&this._matrix[fe.BOUNDARY][fe.EXTERIOR]===oe.FALSE&&this._matrix[fe.EXTERIOR][fe.INTERIOR]===oe.FALSE&&this._matrix[fe.EXTERIOR][fe.BOUNDARY]===oe.FALSE}},{key:"toString",value:function(){for(var s=new Ta("123456789"),u=0;u<3;u++)for(var h=0;h<3;h++)s.setCharAt(3*u+h,oe.toDimensionSymbol(this._matrix[u][h]));return s.toString()}},{key:"setAll",value:function(s){for(var u=0;u<3;u++)for(var h=0;h<3;h++)this._matrix[u][h]=s}},{key:"get",value:function(s,u){return this._matrix[s][u]}},{key:"transpose",value:function(){var s=this._matrix[1][0];return this._matrix[1][0]=this._matrix[0][1],this._matrix[0][1]=s,s=this._matrix[2][0],this._matrix[2][0]=this._matrix[0][2],this._matrix[0][2]=s,s=this._matrix[2][1],this._matrix[2][1]=this._matrix[1][2],this._matrix[1][2]=s,this}},{key:"matches",value:function(s){if(s.length!==9)throw new Re("Should be length 9: "+s);for(var u=0;u<3;u++)for(var h=0;h<3;h++)if(!w.matches(this._matrix[u][h],s.charAt(3*u+h)))return!1;return!0}},{key:"add",value:function(s){for(var u=0;u<3;u++)for(var h=0;h<3;h++)this.setAtLeast(u,h,s.get(u,h))}},{key:"isDisjoint",value:function(){return this._matrix[fe.INTERIOR][fe.INTERIOR]===oe.FALSE&&this._matrix[fe.INTERIOR][fe.BOUNDARY]===oe.FALSE&&this._matrix[fe.BOUNDARY][fe.INTERIOR]===oe.FALSE&&this._matrix[fe.BOUNDARY][fe.BOUNDARY]===oe.FALSE}},{key:"isCrosses",value:function(s,u){return s===oe.P&&u===oe.L||s===oe.P&&u===oe.A||s===oe.L&&u===oe.A?w.isTrue(this._matrix[fe.INTERIOR][fe.INTERIOR])&&w.isTrue(this._matrix[fe.INTERIOR][fe.EXTERIOR]):s===oe.L&&u===oe.P||s===oe.A&&u===oe.P||s===oe.A&&u===oe.L?w.isTrue(this._matrix[fe.INTERIOR][fe.INTERIOR])&&w.isTrue(this._matrix[fe.EXTERIOR][fe.INTERIOR]):s===oe.L&&u===oe.L&&this._matrix[fe.INTERIOR][fe.INTERIOR]===0}},{key:"interfaces_",get:function(){return[ze]}}],[{key:"constructor_",value:function(){if(this._matrix=null,arguments.length===0)this._matrix=Array(3).fill().map(function(){return Array(3)}),this.setAll(oe.FALSE);else if(arguments.length===1){if(typeof arguments[0]=="string"){var s=arguments[0];w.constructor_.call(this),this.set(s)}else if(arguments[0]instanceof w){var u=arguments[0];w.constructor_.call(this),this._matrix[fe.INTERIOR][fe.INTERIOR]=u._matrix[fe.INTERIOR][fe.INTERIOR],this._matrix[fe.INTERIOR][fe.BOUNDARY]=u._matrix[fe.INTERIOR][fe.BOUNDARY],this._matrix[fe.INTERIOR][fe.EXTERIOR]=u._matrix[fe.INTERIOR][fe.EXTERIOR],this._matrix[fe.BOUNDARY][fe.INTERIOR]=u._matrix[fe.BOUNDARY][fe.INTERIOR],this._matrix[fe.BOUNDARY][fe.BOUNDARY]=u._matrix[fe.BOUNDARY][fe.BOUNDARY],this._matrix[fe.BOUNDARY][fe.EXTERIOR]=u._matrix[fe.BOUNDARY][fe.EXTERIOR],this._matrix[fe.EXTERIOR][fe.INTERIOR]=u._matrix[fe.EXTERIOR][fe.INTERIOR],this._matrix[fe.EXTERIOR][fe.BOUNDARY]=u._matrix[fe.EXTERIOR][fe.BOUNDARY],this._matrix[fe.EXTERIOR][fe.EXTERIOR]=u._matrix[fe.EXTERIOR][fe.EXTERIOR]}}}},{key:"matches",value:function(){if(Number.isInteger(arguments[0])&&typeof arguments[1]=="string"){var s=arguments[0],u=arguments[1];return u===oe.SYM_DONTCARE||u===oe.SYM_TRUE&&(s>=0||s===oe.TRUE)||u===oe.SYM_FALSE&&s===oe.FALSE||u===oe.SYM_P&&s===oe.P||u===oe.SYM_L&&s===oe.L||u===oe.SYM_A&&s===oe.A}if(typeof arguments[0]=="string"&&typeof arguments[1]=="string"){var h=arguments[0],y=arguments[1],I=new w(h);return I.matches(y)}}},{key:"isTrue",value:function(s){return s>=0||s===oe.TRUE}}]),w}(),ja=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"size",value:function(){return this._size}},{key:"addAll",value:function(s){return s===null||s.length===0?null:(this.ensureCapacity(this._size+s.length),Ft.arraycopy(s,0,this._data,this._size,s.length),void(this._size+=s.length))}},{key:"ensureCapacity",value:function(s){if(s<=this._data.length)return null;var u=Math.max(s,2*this._data.length);this._data=qe.copyOf(this._data,u)}},{key:"toArray",value:function(){var s=new Array(this._size).fill(null);return Ft.arraycopy(this._data,0,s,0,this._size),s}},{key:"add",value:function(s){this.ensureCapacity(this._size+1),this._data[this._size]=s,++this._size}}],[{key:"constructor_",value:function(){if(this._data=null,this._size=0,arguments.length===0)w.constructor_.call(this,10);else if(arguments.length===1){var s=arguments[0];this._data=new Array(s).fill(null)}}}]),w}(),Bl=function(){function w(){r(this,w)}return p(w,[{key:"getChainStartIndices",value:function(s){var u=0,h=new ja(Math.trunc(s.length/2));h.add(u);do{var y=this.findChainEnd(s,u);h.add(y),u=y}while(uh?u:h}},{key:"getMinX",value:function(s){var u=this.pts[this.startIndex[s]].x,h=this.pts[this.startIndex[s+1]].x;return uu&&(y=1),this._depth[s][h]=y}}}},{key:"getDelta",value:function(s){return this._depth[s][ot.RIGHT]-this._depth[s][ot.LEFT]}},{key:"getLocation",value:function(s,u){return this._depth[s][u]<=0?fe.EXTERIOR:fe.INTERIOR}},{key:"toString",value:function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]}},{key:"add",value:function(){if(arguments.length===1)for(var s=arguments[0],u=0;u<2;u++)for(var h=1;h<3;h++){var y=s.getLocation(u,h);y!==fe.EXTERIOR&&y!==fe.INTERIOR||(this.isNull(u,h)?this._depth[u][h]=w.depthAtLocation(y):this._depth[u][h]+=w.depthAtLocation(y))}else if(arguments.length===3){var I=arguments[0],O=arguments[1],U=arguments[2];U===fe.INTERIOR&&this._depth[I][O]++}}}],[{key:"constructor_",value:function(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var s=0;s<2;s++)for(var u=0;u<3;u++)this._depth[s][u]=w.NULL_VALUE}},{key:"depthAtLocation",value:function(s){return s===fe.EXTERIOR?0:s===fe.INTERIOR?1:w.NULL_VALUE}}]),w}();Ul.NULL_VALUE=-1;var sa=function(w){g(u,w);var s=Y(u);function u(){var h;return r(this,u),h=s.call(this),u.constructor_.apply(M(h),arguments),h}return p(u,[{key:"getDepth",value:function(){return this._depth}},{key:"getCollapsedEdge",value:function(){var h=new Array(2).fill(null);return h[0]=this.pts[0],h[1]=this.pts[1],new u(h,Xi.toLineLabel(this._label))}},{key:"isIsolated",value:function(){return this._isIsolated}},{key:"getCoordinates",value:function(){return this.pts}},{key:"setIsolated",value:function(h){this._isIsolated=h}},{key:"setName",value:function(h){this._name=h}},{key:"equals",value:function(h){if(!(h instanceof u))return!1;var y=h;if(this.pts.length!==y.pts.length)return!1;for(var I=!0,O=!0,U=this.pts.length,H=0;H0?this.pts[0]:null;if(arguments.length===1){var h=arguments[0];return this.pts[h]}}},{key:"print",value:function(h){h.print("edge "+this._name+": "),h.print("LINESTRING (");for(var y=0;y0&&h.print(","),h.print(this.pts[y].x+" "+this.pts[y].y);h.print(") "+this._label+" "+this._depthDelta)}},{key:"computeIM",value:function(h){u.updateIM(this._label,h)}},{key:"isCollapsed",value:function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])}},{key:"isClosed",value:function(){return this.pts[0].equals(this.pts[this.pts.length-1])}},{key:"getMaximumSegmentIndex",value:function(){return this.pts.length-1}},{key:"getDepthDelta",value:function(){return this._depthDelta}},{key:"getNumPoints",value:function(){return this.pts.length}},{key:"printReverse",value:function(h){h.print("edge "+this._name+": ");for(var y=this.pts.length-1;y>=0;y--)h.print(this.pts[y]+" ");h.println("")}},{key:"getMonotoneChainEdge",value:function(){return this._mce===null&&(this._mce=new xu(this)),this._mce}},{key:"getEnvelope",value:function(){if(this._env===null){this._env=new $t;for(var h=0;h0&&h.append(","),h.append(this.pts[y].x+" "+this.pts[y].y);return h.append(") "+this._label+" "+this._depthDelta),h.toString()}},{key:"isPointwiseEqual",value:function(h){if(this.pts.length!==h.pts.length)return!1;for(var y=0;yy||this._maxyO;if(U)return!1;var H=this.intersectsToleranceSquare(s,u);return Et.isTrue(!(U&&H),"Found bad envelope test"),H}},{key:"initCorners",value:function(s){var u=.5;this._minx=s.x-u,this._maxx=s.x+u,this._miny=s.y-u,this._maxy=s.y+u,this._corner[0]=new Ae(this._maxx,this._maxy),this._corner[1]=new Ae(this._minx,this._maxy),this._corner[2]=new Ae(this._minx,this._miny),this._corner[3]=new Ae(this._maxx,this._miny)}},{key:"intersects",value:function(s,u){return this._scaleFactor===1?this.intersectsScaled(s,u):(this.copyScaled(s,this._p0Scaled),this.copyScaled(u,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))}},{key:"scale",value:function(s){return Math.round(s*this._scaleFactor)}},{key:"getCoordinate",value:function(){return this._originalPt}},{key:"copyScaled",value:function(s,u){u.x=this.scale(s.x),u.y=this.scale(s.y)}},{key:"getSafeEnvelope",value:function(){if(this._safeEnv===null){var s=w.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new $t(this._originalPt.x-s,this._originalPt.x+s,this._originalPt.y-s,this._originalPt.y+s)}return this._safeEnv}},{key:"intersectsPixelClosure",value:function(s,u){return this._li.computeIntersection(s,u,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(s,u,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(s,u,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(s,u,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))}},{key:"intersectsToleranceSquare",value:function(s,u){var h=!1,y=!1;return this._li.computeIntersection(s,u,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(s,u,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(h=!0),this._li.computeIntersection(s,u,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(y=!0),this._li.computeIntersection(s,u,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!h||!y)||!!s.equals(this._pt)||!!u.equals(this._pt))))}},{key:"addSnappedNode",value:function(s,u){var h=s.getCoordinate(u),y=s.getCoordinate(u+1);return!!this.intersects(h,y)&&(s.addIntersection(this.getCoordinate(),u),!0)}}],[{key:"constructor_",value:function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var s=arguments[0],u=arguments[1],h=arguments[2];if(this._originalPt=s,this._pt=s,this._scaleFactor=u,this._li=h,u<=0)throw new Re("Scale factor must be non-zero");u!==1&&(this._pt=new Ae(this.scale(s.x),this.scale(s.y)),this._p0Scaled=new Ae,this._p1Scaled=new Ae),this.initCorners(this._pt)}}]),w}();Vn.SAFE_ENV_EXPANSION_FACTOR=.75;var Oo=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"select",value:function(){if(arguments.length!==1&&arguments.length===2){var s=arguments[0],u=arguments[1];s.getLineSegment(u,this.selectedSegment),this.select(this.selectedSegment)}}}],[{key:"constructor_",value:function(){this.selectedSegment=new bi}}]),w}(),Vi=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"snap",value:function(){if(arguments.length===1){var s=arguments[0];return this.snap(s,null,-1)}if(arguments.length===3){var u=arguments[0],h=arguments[1],y=arguments[2],I=u.getSafeEnvelope(),O=new qa(u,h,y);return this._index.query(I,new(function(){function U(){r(this,U)}return p(U,[{key:"interfaces_",get:function(){return[Al]}},{key:"visitItem",value:function(H){H.select(I,O)}}]),U}())),O.isNodeAdded()}}}],[{key:"constructor_",value:function(){this._index=null;var s=arguments[0];this._index=s}}]),w}(),qa=function(w){g(u,w);var s=Y(u);function u(){var h;return r(this,u),h=s.call(this),u.constructor_.apply(M(h),arguments),h}return p(u,[{key:"isNodeAdded",value:function(){return this._isNodeAdded}},{key:"select",value:function(){if(!(arguments.length===2&&Number.isInteger(arguments[1])&&arguments[0]instanceof Ml))return W(x(u.prototype),"select",this).apply(this,arguments);var h=arguments[0],y=arguments[1],I=h.getContext();if(this._parentEdge===I&&(y===this._hotPixelVertexIndex||y+1===this._hotPixelVertexIndex))return null;this._isNodeAdded|=this._hotPixel.addSnappedNode(I,y)}}],[{key:"constructor_",value:function(){this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var h=arguments[0],y=arguments[1],I=arguments[2];this._hotPixel=h,this._parentEdge=y,this._hotPixelVertexIndex=I}}]),u}(Oo);Vi.HotPixelSnapAction=qa;var Ga=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"processIntersections",value:function(s,u,h,y){if(s===h&&u===y)return null;var I=s.getCoordinates()[u],O=s.getCoordinates()[u+1],U=h.getCoordinates()[y],H=h.getCoordinates()[y+1];if(this._li.computeIntersection(I,O,U,H),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var te=0;te=0;s--){try{this.bufferReducedPrecision(s)}catch(I){if(!(I instanceof Hn))throw I;this._saveException=I}if(this._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var u=arguments[0],h=w.precisionScaleFactor(this._argGeom,this._distance,u),y=new Yi(h);this.bufferFixedPrecision(y)}}},{key:"computeGeometry",value:function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var s=this._argGeom.getFactory().getPrecisionModel();s.getType()===Yi.FIXED?this.bufferFixedPrecision(s):this.bufferReducedPrecision()}},{key:"setQuadrantSegments",value:function(s){this._bufParams.setQuadrantSegments(s)}},{key:"bufferOriginalPrecision",value:function(){try{var s=new Va(this._bufParams);this._resultGeometry=s.buffer(this._argGeom,this._distance)}catch(u){if(!(u instanceof Nt))throw u;this._saveException=u}}},{key:"getResultGeometry",value:function(s){return this._distance=s,this.computeGeometry(),this._resultGeometry}},{key:"setEndCapStyle",value:function(s){this._bufParams.setEndCapStyle(s)}}],[{key:"constructor_",value:function(){if(this._argGeom=null,this._distance=null,this._bufParams=new Ie,this._resultGeometry=null,this._saveException=null,arguments.length===1){var s=arguments[0];this._argGeom=s}else if(arguments.length===2){var u=arguments[0],h=arguments[1];this._argGeom=u,this._bufParams=h}}},{key:"bufferOp",value:function(){if(arguments.length===2){var s=arguments[0],u=arguments[1],h=new w(s),y=h.getResultGeometry(u);return y}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof bt&&typeof arguments[1]=="number"){var I=arguments[0],O=arguments[1],U=arguments[2],H=new w(I);H.setQuadrantSegments(U);var te=H.getResultGeometry(O);return te}if(arguments[2]instanceof Ie&&arguments[0]instanceof bt&&typeof arguments[1]=="number"){var ye=arguments[0],ke=arguments[1],Ze=arguments[2],nt=new w(ye,Ze),et=nt.getResultGeometry(ke);return et}}else if(arguments.length===4){var Bt=arguments[0],Rt=arguments[1],Yt=arguments[2],kn=arguments[3],Kn=new w(Bt);Kn.setQuadrantSegments(Yt),Kn.setEndCapStyle(kn);var ui=Kn.getResultGeometry(Rt);return ui}}},{key:"precisionScaleFactor",value:function(s,u,h){var y=s.getEnvelopeInternal(),I=Wr.max(Math.abs(y.getMaxX()),Math.abs(y.getMaxY()),Math.abs(y.getMinX()),Math.abs(y.getMinY()))+2*(u>0?u:0),O=h-Math.trunc(Math.log(I)/Math.log(10)+1);return Math.pow(10,O)}}]),w}();yr.CAP_ROUND=Ie.CAP_ROUND,yr.CAP_BUTT=Ie.CAP_FLAT,yr.CAP_FLAT=Ie.CAP_FLAT,yr.CAP_SQUARE=Ie.CAP_SQUARE,yr.MAX_PRECISION_DIGITS=12;var Do=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Ko=function(){function w(s){r(this,w),this.geometryFactory=s||new Zr}return p(w,[{key:"read",value:function(s){var u,h=(u=typeof s=="string"?JSON.parse(s):s).type;if(!Ji[h])throw new Error("Unknown GeoJSON type: "+u.type);return Do.indexOf(h)!==-1?Ji[h].call(this,u.coordinates):h==="GeometryCollection"?Ji[h].call(this,u.geometries):Ji[h].call(this,u)}},{key:"write",value:function(s){var u=s.getGeometryType();if(!Or[u])throw new Error("Geometry is not supported");return Or[u].call(this,s)}}]),w}(),Ji={Feature:function(w){var s={};for(var u in w)s[u]=w[u];if(w.geometry){var h=w.geometry.type;if(!Ji[h])throw new Error("Unknown GeoJSON type: "+w.type);s.geometry=this.read(w.geometry)}return w.bbox&&(s.bbox=Ji.bbox.call(this,w.bbox)),s},FeatureCollection:function(w){var s={};if(w.features){s.features=[];for(var u=0;u1?0:t<-1?Pn:Math.acos(t)}function ou(t){return t>1?js:t<-1?-js:Math.asin(t)}function Lh(){}function sp(t,e){t&&bb.hasOwnProperty(t.type)&&bb[t.type](t,e)}var xb={Feature:function(t,e){sp(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,l=-1,p=r.length;++lPn?t-qs:t<-Pn?t+qs:t,e]}fy.invert=fy;function L5(t,e,r){return(t%=qs)?e||r?Lk(kb(t),Eb(e,r)):kb(t):e||r?Eb(e,r):fy}function Sb(t){return function(e,r){return e+=t,[e>Pn?e-qs:e<-Pn?e+qs:e,r]}}function kb(t){var e=Sb(t);return e.invert=Sb(-t),e}function Eb(t,e){var r=mi(t),l=gi(t),p=mi(e),g=gi(e);function x(f,C){var R=mi(C),z=mi(f)*R,M=gi(f)*R,F=gi(C),Y=F*r+z*l;return[gc(M*p-Y*g,z*r-F*l),ou(Y*p+M*g)]}return x.invert=function(f,C){var R=mi(C),z=mi(f)*R,M=gi(f)*R,F=gi(C),Y=F*p-M*g;return[gc(M*p+F*g,z*r+Y*l),ou(Y*r-z*l)]},x}function P5(t,e,r,l,p,g){if(r){var x=mi(e),f=gi(e),C=l*r;p==null?(p=e+l*qs,g=e-C/2):(p=Ib(x,p),g=Ib(x,g),(l>0?pg)&&(p+=l*qs));for(var R,z=p;l>0?z>g:z1&&t.push(t.pop().concat(t.shift()))},result:function(){var r=t;return t=[],e=null,r}}}function M5(t,e,r,l,p,g){var x=t[0],f=t[1],C=e[0],R=e[1],z=0,M=1,F=C-x,Y=R-f,W;if(W=r-x,!(!F&&W>0)){if(W/=F,F<0){if(W0){if(W>M)return;W>z&&(z=W)}if(W=p-x,!(!F&&W<0)){if(W/=F,F<0){if(W>M)return;W>z&&(z=W)}else if(F>0){if(W0)){if(W/=Y,Y<0){if(W0){if(W>M)return;W>z&&(z=W)}if(W=g-f,!(!Y&&W<0)){if(W/=Y,Y<0){if(W>M)return;W>z&&(z=W)}else if(Y>0){if(W0&&(t[0]=x+z*F,t[1]=f+z*Y),M<1&&(e[0]=x+M*F,e[1]=f+M*Y),!0}}}}}function bd(t,e){return mr(t[0]-e[0])=0;--f)p.point((M=z[f])[0],M[1]);else l(F.x,F.p.x,-1,p);F=F.p}F=F.o,z=F.z,Y=!Y}while(!F.v);p.lineEnd()}}}function Tb(t){if(e=t.length){for(var e,r=0,l=t[0],p;++re?1:t>=e?0:NaN}function R5(t){return t.length===1&&(t=O5(t)),{left:function(e,r,l,p){for(l==null&&(l=0),p==null&&(p=e.length);l>>1;t(e[g],r)<0?l=g+1:p=g}return l},right:function(e,r,l,p){for(l==null&&(l=0),p==null&&(p=e.length);l>>1;t(e[g],r)>0?p=g:l=g+1}return l}}}function O5(t){return function(e,r){return Rk(t(e),r)}}R5(Rk);function Ok(t){for(var e=t.length,r,l=-1,p=0,g,x;++l=0;)for(x=t[e],r=x.length;--r>=0;)g[--p]=x[r];return g}var Ph=1e9,Qf=-Ph;function D5(t,e,r,l){function p(R,z){return t<=R&&R<=r&&e<=z&&z<=l}function g(R,z,M,F){var Y=0,W=0;if(R==null||(Y=x(R,M))!==(W=x(z,M))||C(R,z)<0^M>0)do F.point(Y===0||Y===3?t:r,Y>1?l:e);while((Y=(Y+M+4)%4)!==W);else F.point(z[0],z[1])}function x(R,z){return mr(R[0]-t)0?0:3:mr(R[0]-r)0?2:1:mr(R[1]-e)0?1:0:z>0?3:2}function f(R,z){return C(R.x,z.x)}function C(R,z){var M=x(R,1),F=x(z,1);return M!==F?M-F:M===0?z[1]-R[1]:M===1?R[0]-z[0]:M===2?R[1]-z[1]:z[0]-R[0]}return function(R){var z=R,M=Pk(),F,Y,W,pe,me,ve,we,Ie,Pe,Re,Ve,Fe={point:ze,lineStart:mt,lineEnd:xt,polygonStart:yt,polygonEnd:De};function ze(St,Ct){p(St,Ct)&&z.point(St,Ct)}function Ge(){for(var St=0,Ct=0,vt=Y.length;Ctl&&(Et-Nt)*(l-on)>(gn-on)*(t-Nt)&&++St:gn<=l&&(Et-Nt)*(l-on)<(gn-on)*(t-Nt)&&--St;return St}function yt(){z=M,F=[],Y=[],Ve=!0}function De(){var St=Ge(),Ct=Ve&&St,vt=(F=Ok(F)).length;(Ct||vt)&&(R.polygonStart(),Ct&&(R.lineStart(),g(null,null,1,R),R.lineEnd()),vt&&Mk(F,f,St,g,R),R.polygonEnd()),z=R,F=Y=W=null}function mt(){Fe.point=Je,Y&&Y.push(W=[]),Re=!0,Pe=!1,we=Ie=NaN}function xt(){F&&(Je(pe,me),ve&&Pe&&M.rejoin(),F.push(M.result())),Fe.point=ze,Pe&&z.lineEnd()}function Je(St,Ct){var vt=p(St,Ct);if(Y&&W.push([St,Ct]),Re)pe=St,me=Ct,ve=vt,Re=!1,vt&&(z.lineStart(),z.point(St,Ct));else if(vt&&Pe)z.point(St,Ct);else{var Gt=[we=Math.max(Qf,Math.min(Ph,we)),Ie=Math.max(Qf,Math.min(Ph,Ie))],an=[St=Math.max(Qf,Math.min(Ph,St)),Ct=Math.max(Qf,Math.min(Ph,Ct))];M5(Gt,an,t,e,r,l)?(Pe||(z.lineStart(),z.point(Gt[0],Gt[1])),z.point(an[0],an[1]),vt||z.lineEnd(),Ve=!1):vt&&(z.lineStart(),z.point(St,Ct),Ve=!1)}we=St,Ie=Ct,Pe=vt}return Fe}}var og=Sl();function N5(t,e){var r=e[0],l=e[1],p=[gi(r),-mi(r),0],g=0,x=0;og.reset();for(var f=0,C=t.length;f=0?1:-1,ze=Fe*Ve,Ge=ze>Pn,yt=W*Pe;if(og.add(gc(yt*Fe*gi(ze),pe*Re+yt*mi(ze))),g+=Ge?Ve+Fe*qs:Ve,Ge^F>=r^we>=r){var De=ap(yc(M),yc(ve));hy(De);var mt=ap(p,De);hy(mt);var xt=(Ge^Ve>=0?-1:1)*ou(mt[2]);(l>xt||l===xt&&(De[0]||De[1]))&&(x+=Ge^Ve>=0?1:-1)}}return(g<-ei||gXh&&(Xh=t),eup&&(up=e)}Sl();function Dk(t,e,r,l){return function(p,g){var x=e(g),f=p.invert(l[0],l[1]),C=Pk(),R=e(C),z=!1,M,F,Y,W={point:pe,lineStart:ve,lineEnd:we,polygonStart:function(){W.point=Ie,W.lineStart=Pe,W.lineEnd=Re,F=[],M=[]},polygonEnd:function(){W.point=pe,W.lineStart=ve,W.lineEnd=we,F=Ok(F);var Ve=N5(M,f);F.length?(z||(g.polygonStart(),z=!0),Mk(F,B5,Ve,r,g)):Ve&&(z||(g.polygonStart(),z=!0),g.lineStart(),r(null,null,1,g),g.lineEnd()),z&&(g.polygonEnd(),z=!1),F=M=null},sphere:function(){g.polygonStart(),g.lineStart(),r(null,null,1,g),g.lineEnd(),g.polygonEnd()}};function pe(Ve,Fe){var ze=p(Ve,Fe);t(Ve=ze[0],Fe=ze[1])&&g.point(Ve,Fe)}function me(Ve,Fe){var ze=p(Ve,Fe);x.point(ze[0],ze[1])}function ve(){W.point=me,x.lineStart()}function we(){W.point=pe,x.lineEnd()}function Ie(Ve,Fe){Y.push([Ve,Fe]);var ze=p(Ve,Fe);R.point(ze[0],ze[1])}function Pe(){R.lineStart(),Y=[]}function Re(){Ie(Y[0][0],Y[0][1]),R.lineEnd();var Ve=R.clean(),Fe=C.result(),ze,Ge=Fe.length,yt,De,mt;if(Y.pop(),M.push(Y),Y=null,!!Ge){if(Ve&1){if(De=Fe[0],(yt=De.length-1)>0){for(z||(g.polygonStart(),z=!0),g.lineStart(),ze=0;ze1&&Ve&2&&Fe.push(Fe.pop().concat(Fe.shift())),F.push(Fe.filter(F5))}}return W}}function F5(t){return t.length>1}function B5(t,e){return((t=t.x)[0]<0?t[1]-js-ei:js-t[1])-((e=e.x)[0]<0?e[1]-js-ei:js-e[1])}const Lb=Dk(function(){return!0},U5,V5,[-Pn,-js]);function U5(t){var e=NaN,r=NaN,l=NaN,p;return{lineStart:function(){t.lineStart(),p=1},point:function(g,x){var f=g>0?Pn:-Pn,C=mr(g-e);mr(C-Pn)0?js:-js),t.point(l,r),t.lineEnd(),t.lineStart(),t.point(f,r),t.point(g,r),p=0):l!==f&&C>=Pn&&(mr(e-l)ei?C5((gi(e)*(g=mi(l))*gi(r)-gi(l)*(p=mi(e))*gi(t))/(p*g*x)):(e+l)/2}function V5(t,e,r,l){var p;if(t==null)p=r*js,l.point(-Pn,p),l.point(0,p),l.point(Pn,p),l.point(Pn,0),l.point(Pn,-p),l.point(0,-p),l.point(-Pn,-p),l.point(-Pn,0),l.point(-Pn,p);else if(mr(t[0]-e[0])>ei){var g=t[0]0,p=mr(r)>ei;function g(z,M,F,Y){P5(Y,t,e,F,z,M)}function x(z,M){return mi(z)*mi(M)>r}function f(z){var M,F,Y,W,pe;return{lineStart:function(){W=Y=!1,pe=1},point:function(me,ve){var we=[me,ve],Ie,Pe=x(me,ve),Re=l?Pe?0:R(me,ve):Pe?R(me+(me<0?Pn:-Pn),ve):0;if(!M&&(W=Y=Pe)&&z.lineStart(),Pe!==Y&&(Ie=C(M,we),(!Ie||bd(M,Ie)||bd(we,Ie))&&(we[0]+=ei,we[1]+=ei,Pe=x(we[0],we[1]))),Pe!==Y)pe=0,Pe?(z.lineStart(),Ie=C(we,M),z.point(Ie[0],Ie[1])):(Ie=C(M,we),z.point(Ie[0],Ie[1]),z.lineEnd()),M=Ie;else if(p&&M&&l^Pe){var Ve;!(Re&F)&&(Ve=C(we,M,!0))&&(pe=0,l?(z.lineStart(),z.point(Ve[0][0],Ve[0][1]),z.point(Ve[1][0],Ve[1][1]),z.lineEnd()):(z.point(Ve[1][0],Ve[1][1]),z.lineEnd(),z.lineStart(),z.point(Ve[0][0],Ve[0][1])))}Pe&&(!M||!bd(M,we))&&z.point(we[0],we[1]),M=we,Y=Pe,F=Re},lineEnd:function(){Y&&z.lineEnd(),M=null},clean:function(){return pe|(W&&Y)<<1}}}function C(z,M,F){var Y=yc(z),W=yc(M),pe=[1,0,0],me=ap(Y,W),ve=$f(me,me),we=me[0],Ie=ve-we*we;if(!Ie)return!F&&z;var Pe=r*ve/Ie,Re=-r*we/Ie,Ve=ap(pe,me),Fe=Kf(pe,Pe),ze=Kf(me,Re);rg(Fe,ze);var Ge=Ve,yt=$f(Fe,Ge),De=$f(Ge,Ge),mt=yt*yt-De*($f(Fe,Fe)-1);if(!(mt<0)){var xt=Ac(mt),Je=Kf(Ge,(-yt-xt)/De);if(rg(Je,Fe),Je=cy(Je),!F)return Je;var St=z[0],Ct=M[0],vt=z[1],Gt=M[1],an;Ct0^Je[1]<(mr(Je[0]-St)Pn^(St<=Je[0]&&Je[0]<=Ct)){var on=Kf(Ge,(-yt+xt)/De);return rg(on,Fe),[Je,cy(on)]}}}function R(z,M){var F=l?t:Pn-t,Y=0;return z<-F?Y|=1:z>F&&(Y|=2),M<-F?Y|=4:M>F&&(Y|=8),Y}return Dk(x,f,g,l?[0,-t]:[-Pn,t-Pn])}function Nk(t){return function(e){var r=new dy;for(var l in t)r[l]=t[l];return r.stream=e,r}}function dy(){}dy.prototype={constructor:dy,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function zk(t,e,r){var l=e[1][0]-e[0][0],p=e[1][1]-e[0][1],g=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),g!=null&&t.clipExtent(null),A5(r,t.stream(Ab));var x=Ab.result(),f=Math.min(l/(x[1][0]-x[0][0]),p/(x[1][1]-x[0][1])),C=+e[0][0]+(l-f*(x[1][0]+x[0][0]))/2,R=+e[0][1]+(p-f*(x[1][1]+x[0][1]))/2;return g!=null&&t.clipExtent(g),t.scale(f*150).translate([C,R])}function G5(t,e,r){return zk(t,[[0,0],e],r)}var Pb=16,H5=mi(30*Bo);function Mb(t,e){return+e?Z5(t,e):W5(t)}function W5(t){return Nk({point:function(e,r){e=t(e,r),this.stream.point(e[0],e[1])}})}function Z5(t,e){function r(l,p,g,x,f,C,R,z,M,F,Y,W,pe,me){var ve=R-l,we=z-p,Ie=ve*ve+we*we;if(Ie>4*e&&pe--){var Pe=x+F,Re=f+Y,Ve=C+W,Fe=Ac(Pe*Pe+Re*Re+Ve*Ve),ze=ou(Ve/=Fe),Ge=mr(mr(Ve)-1)e||mr((ve*xt+we*Je)/Ie-.5)>.3||x*F+f*Y+C*W2?Je[2]%360*Bo:0,mt()):[R*rl,z*rl,M*rl]},Ge.precision=function(Je){return arguments.length?(Ve=Mb(De,Re=Je*Je),xt()):Ac(Re)},Ge.fitExtent=function(Je,St){return zk(Ge,Je,St)},Ge.fitSize=function(Je,St){return G5(Ge,Je,St)};function mt(){Y=Lk(F=L5(R,z,M),e);var Je=e(f,C);return g=l-Je[0]*r,x=p+Je[1]*r,xt()}function xt(){return Fe=ze=null,Ge}return function(){return e=t.apply(this,arguments),Ge.invert=e.invert&&yt,mt()}}function Fk(t){return function(e,r){var l=mi(e),p=mi(r),g=t(l*p);return[g*p*gi(e),g*gi(r)]}}function Bk(t){return function(e,r){var l=Ac(e*e+r*r),p=t(l),g=gi(p),x=mi(p);return[gc(e*g,l*x),ou(l&&r*g/l)]}}var K5=Fk(function(t){return Ac(2/(1+t))});K5.invert=Bk(function(t){return 2*ou(t/2)});var Uk=Fk(function(t){return(t=Ak(t))&&t/gi(t)});Uk.invert=Bk(function(t){return t});function J5(){return X5(Uk).scale(79.4188).clipAngle(180-.001)}function Rb(t,e){return[t,e]}Rb.invert=Rb;var Q5=Object.defineProperty,Lc=(t,e)=>Q5(t,"name",{value:e,configurable:!0}),{BufferOp:eF,GeoJSONReader:tF,GeoJSONWriter:nF}=T5;function jk(t,e,r){r=r||{};var l=r.units||"kilometers",p=r.steps||8;if(!t)throw new Error("geojson is required");if(typeof r!="object")throw new Error("options must be an object");if(typeof p!="number")throw new Error("steps must be an number");if(e===void 0)throw new Error("radius is required");if(p<=0)throw new Error("steps must be greater than 0");var g=[];switch(t.type){case"GeometryCollection":return cu(t,function(x){var f=Uh(x,e,l,p);f&&g.push(f)}),ds(g);case"FeatureCollection":return rp(t,function(x){var f=Uh(x,e,l,p);f&&rp(f,function(C){C&&g.push(C)})}),ds(g)}return Uh(t,e,l,p)}Lc(jk,"buffer");function Uh(t,e,r,l){var p=t.properties||{},g=t.type==="Feature"?t.geometry:t;if(g.type==="GeometryCollection"){var x=[];return cu(t,function(pe){var me=Uh(pe,e,r,l);me&&x.push(me)}),ds(x)}var f=Vk(g),C={type:g.type,coordinates:d_(g.coordinates,f)},R=new tF,z=R.read(C),M=u_(Sp(e,r),"meters"),F=eF.bufferOp(z,M,l),Y=new nF;if(F=Y.write(F),!f_(F.coordinates)){var W={type:F.type,coordinates:p_(F.coordinates,f)};return Vo(W,p)}}Lc(Uh,"bufferFeature");function f_(t){return Array.isArray(t[0])?f_(t[0]):isNaN(t[0])}Lc(f_,"coordsIsNaN");function d_(t,e){return typeof t[0]!="object"?e(t):t.map(function(r){return d_(r,e)})}Lc(d_,"projectCoords");function p_(t,e){return typeof t[0]!="object"?e.invert(t):t.map(function(r){return p_(r,e)})}Lc(p_,"unprojectCoords");function Vk(t){var e=Tk(t).geometry.coordinates,r=[-e[0],-e[1]];return J5().rotate(r).scale(fo)}Lc(Vk,"defineProjection");var iF=jk,rF=Object.defineProperty,oF=(t,e)=>rF(t,"name",{value:e,configurable:!0});function qk(t){const e=[];if(cu(t,p=>{e.push(p.coordinates)}),e.length<2)throw new Error("Must have at least two features");const r=t.features[0].properties||{},l=bk.difference(e[0],...e.slice(1));return l.length===0?null:l.length===1?Tc(l[0],r):wp(l,r)}oF(qk,"difference");var sF=qk;function Ob(t){let e;for(const r of t)e&&r[0]-e[0]>=180?r[0]-=360:e&&r[0]-e[0]<-180&&(r[0]+=360),e=r}function Db(t,e){const r=sF(ds([Tc([[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]),t]));if(!r)return;r.properties={isMask:"y"};const l=iF(t,0);if(l){if(l.geometry.type==="Polygon")for(const p of l.geometry.coordinates)Ob(p);else for(const p of l.geometry.coordinates)for(const g of p)Ob(g);e(ds([l,r]))}}const Nb=ds([]);function q6(t,e,r=!0,l=!0,p={},g={},x={fill:{paint:{"fill-color":"#000","fill-opacity":.1},filter:["all",["==",["geometry-type"],"Polygon"],["has","isMask"]]},line:{layout:{"line-cap":"square"},paint:{"line-width":["case",["==",["geometry-type"],"Polygon"],2,3],"line-dasharray":[1,1],"line-color":"#3170fe"},filter:["!",["has","isMask"]]}}){let f;const C=[];let R,z,M;function F(){!t.getSource("full-geom")&&(x!=null&&x.fill||x!=null&&x.line)&&t.addSource("full-geom",{type:"geojson",data:Nb}),!t.getLayer("full-geom-fill")&&x!=null&&x.fill&&t.addLayer({...x==null?void 0:x.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),!t.getLayer("full-geom-line")&&x!=null&&x.line&&t.addLayer({...x==null?void 0:x.line,id:"full-geom-line",type:"line",source:"full-geom"}),M&&pe(M)}t.loaded()?F():t.once("load",()=>{F()}),t.on("styledata",()=>{F()});const Y=me=>{f==null||f({type:"mapClick",coordinates:[me.lngLat.lng,me.lngLat.lat]})};function W(me=!1){if(!e)throw new Error;const ve=document.createElement("div");return me&&ve.classList.add("marker-interactive"),new xO({props:{displayIn:"maplibre"},target:ve}),new e.Marker({element:ve,offset:[1,-13]})}function pe(me){var ve;M=me,(ve=t.getSource("full-geom"))==null||ve.setData(me)}return{setEventHandler(me){me?(f=me,t.on("click",Y)):(f=void 0,t.off("click",Y))},flyTo(me,ve){t.flyTo({center:me,zoom:ve,...p})},fitBounds(me,ve,we){t.fitBounds([[me[0],me[1]],[me[2],me[3]]],{padding:ve,maxZoom:we,...g})},indicateReverse(me){t.getCanvasContainer().style.cursor=me?"crosshair":""},setReverseMarker(me){!e||!r||(z?me?z.setLngLat(me):(z.remove(),z=void 0):me&&(z=(typeof r=="object"?new e.Marker(r):W()).setLngLat(me).addTo(t),z.getElement().classList.add("marker-reverse")))},setMarkers(me,ve){if(r){for(const we of C)we.remove();if(C.length=0,pe(Nb),!!e){if(ve){let we=!1;if(ve.geometry.type==="GeometryCollection"){const Ie=ve.geometry.geometries.filter(Pe=>Pe.type==="Polygon"||Pe.type==="MultiPolygon");e:if(Ie.length>0){const Pe=b5(ds(Ie.map(Re=>Vo(Re))));if(!Pe)break e;Db({...ve,geometry:Pe.geometry},pe),we=!0}else{const Pe=ve.geometry.geometries.filter(Re=>Re.type==="LineString"||Re.type==="MultiLineString");Pe.length>0&&(pe({...ve,geometry:{type:"GeometryCollection",geometries:Pe}}),we=!0)}}if(!we){if(ve.geometry.type==="Polygon"||ve.geometry.type==="MultiPolygon")Db(ve,pe);else if(ve.geometry.type==="LineString"||ve.geometry.type==="MultiLineString"){pe(ve);return}}r&&C.push((typeof r=="object"?new e.Marker(r):W()).setLngLat(ve.center).addTo(t))}if(l)for(const we of me??[]){if(we===ve)continue;const Ie=(typeof l=="object"?new e.Marker(l):W(!0)).setLngLat(we.center).setPopup(new e.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(we.place_type[0]==="reverse"?we.place_name:we.place_name.replace(/,.*/,""))).addTo(t),Pe=Ie.getElement();Pe.addEventListener("click",Re=>{Re.stopPropagation(),f==null||f({type:"markerClick",id:we.id})}),Pe.addEventListener("mouseenter",()=>{f==null||f({type:"markerMouseEnter",id:we.id}),Ie.togglePopup()}),Pe.addEventListener("mouseleave",()=>{f==null||f({type:"markerMouseLeave",id:we.id}),Ie.togglePopup()}),C.push(Ie)}}}},setSelectedMarker(me){R&&R.getElement().classList.toggle("marker-selected",!1),R=me>-1?C[me]:void 0,R==null||R.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const me=t.getCenter();return[t.getZoom(),me.lng,me.lat]}}}const aF=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([6-9][0-9])\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([6-9][0-9])\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*(EAST|WEST|[EW])?$/i,zb=/^([+-]?[0-8]?[0-9])\s+([0-5]?[0-9]\.\d{3,})[\s,]{1,}([+-]?[0-1]?[0-9]?[0-9])\s+([0-5]?[0-9]\.\d{3,})$/,Fb=/^(NORTH|SOUTH|[NS])?[\s]*([+-]?[0-8]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(NORTH|SOUTH|[NS])?[\s]*[,/;]?[\s]*(EAST|WEST|[EW])?[\s]*([+-]?[0-1]?[0-9]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(EAST|WEST|[EW])?$/i,Bb=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(EAST|WEST|[EW])?$/i,Ub=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)\s*(EAST|WEST|[EW])?$/i,jb=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|’’|´´|["″”\.])?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|´´|’’|["″”\.])?\s*(EAST|WEST|[EW])?$/i;function lF(t){if(!["DMS","DM","DD"].includes(t))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){const e=this.decimalCoordinates.split(",").map(Y=>Number(Y.trim())),r=Number(e[0]),l=Number(e[1]),p=Math.abs(r),g=Math.abs(l),x=r>0?"N":"S",f=l>0?"E":"W";let C;t=="DD"&&(C=`${p}° ${x}, ${g}° ${f}`);const R=Math.floor(p),z=Math.floor(g),M=(p-R)*60,F=(g-z)*60;if(t=="DM"){let Y=Vb(M,3).toFixed(3).padStart(6,"0"),W=Vb(F,3).toFixed(3).padStart(6,"0");Y.endsWith(".000")&&W.endsWith(".000")&&(Y=Y.replace(/\.000$/,""),W=W.replace(/\.000$/,"")),C=`${R}° ${Y}' ${x}, ${z}° ${W}' ${f}`}if(t=="DMS"){const Y=Math.floor(M),W=Math.floor(F);let pe=((M-Y)*60).toFixed(1).padStart(4,"0"),me=((F-W)*60).toFixed(1).padStart(4,"0");const ve=Y.toString().padStart(2,"0"),we=W.toString().padStart(2,"0");pe.endsWith(".0")&&me.endsWith(".0")&&(pe=pe.replace(/\.0$/,""),me=me.replace(/\.0$/,"")),C=`${R}° ${ve}' ${pe}" ${x}, ${z}° ${we}' ${me}" ${f}`}return C}else throw new Error("no decimal coordinates to convert")}function Vb(t,e){const r=Math.pow(10,e);return Math.round((t+Number.EPSILON)*r)/r}function m_(t,e){e||(e=5),t=t.replace(/\s+/g," ").trim();let r=null,l=null,p="",g="",x=null,f=[],C=!1;if(aF.test(t))throw new Error("invalid coordinate value");if(zb.test(t))if(f=zb.exec(t),C=Eh(f),C)r=Math.abs(f[1])+f[2]/60,Number(f[1])<0&&(r*=-1),l=Math.abs(f[3])+f[4]/60,Number(f[3])<0&&(l*=-1),x="DM";else throw new Error("invalid coordinate format");else if(Fb.test(t))if(f=Fb.exec(t),C=Eh(f),C){if(r=f[2],l=f[6],r.includes(",")&&(r=r.replace(",",".")),l.includes(",")&&(l=l.replace(",",".")),x="DD",Number(Math.round(r))==Number(r))throw new Error("integer only coordinate provided");if(Number(Math.round(l))==Number(l))throw new Error("integer only coordinate provided");f[1]?(p=f[1],g=f[5]):f[4]&&(p=f[4],g=f[8])}else throw new Error("invalid decimal coordinate format");else if(Bb.test(t))if(f=Bb.exec(t),C=Eh(f),C)r=Math.abs(parseInt(f[2])),f[4]&&(r+=f[4]/60,x="DM"),f[6]&&(r+=f[6].replace(",",".")/3600,x="DMS"),parseInt(f[2])<0&&(r=-1*r),l=Math.abs(parseInt(f[9])),f[11]&&(l+=f[11]/60),f[13]&&(l+=f[13].replace(",",".")/3600),parseInt(f[9])<0&&(l=-1*l),f[1]?(p=f[1],g=f[8]):f[7]&&(p=f[7],g=f[14]);else throw new Error("invalid DMS coordinates format");else if(Ub.test(t))if(f=Ub.exec(t),C=Eh(f),C)r=Math.abs(parseInt(f[2])),f[4]&&(r+=f[4]/60,x="DM"),f[6]&&(r+=f[6]/3600,x="DMS"),parseInt(f[2])<0&&(r=-1*r),l=Math.abs(parseInt(f[10])),f[12]&&(l+=f[12]/60),f[14]&&(l+=f[14]/3600),parseInt(f[10])<0&&(l=-1*l),f[1]?(p=f[1],g=f[9]):f[8]&&(p=f[8],g=f[16]);else throw new Error("invalid DMS coordinates format");else if(jb.test(t)){if(f=jb.exec(t),C=Eh(f),f.filter(R=>R).length<=5)throw new Error("invalid coordinates format");if(C)r=Math.abs(parseInt(f[2])),f[4]&&(r+=f[4].replace(",",".")/60,x="DM"),f[6]&&(r+=f[6].replace(",",".")/3600,x="DMS"),parseInt(f[2])<0&&(r=-1*r),l=Math.abs(parseInt(f[10])),f[12]&&(l+=f[12].replace(",",".")/60),f[14]&&(l+=f[14].replace(",",".")/3600),parseInt(f[10])<0&&(l=-1*l),f[1]?(p=f[1],g=f[9]):f[8]&&(p=f[8],g=f[16]);else throw new Error("invalid coordinates format")}if(C){if(Math.abs(l)>=180)throw new Error("invalid longitude value");if(Math.abs(r)>=90)throw new Error("invalid latitude value");if(p&&!g||!p&&g)throw new Error("invalid coordinates value");if(p&&p==g)throw new Error("invalid coordinates format");r.toString().includes(",")&&(r=r.replace(",",".")),l.toString().includes(",")&&(l=l.replace(",","."));let R=/S|SOUTH/i;R.test(p)&&r>0&&(r=-1*r),R=/W|WEST/i,R.test(g)&&l>0&&(l=-1*l);const z=f[0].trim();let M,F;const Y=/[,/;\u0020]/g,W=z.match(Y);if(W==null){const ve=Math.floor(t.length/2);M=z.substring(0,ve).trim(),F=z.substring(ve).trim()}else{let ve;W.length%2==1?ve=Math.floor(W.length/2):ve=W.length/2-1;let we=0;if(ve==0)we=z.indexOf(W[0]),M=z.substring(0,we).trim(),F=z.substring(we+1).trim();else{let Ie=0,Pe=0;for(;Ie<=ve;)we=z.indexOf(W[Ie],Pe),Pe=we+1,Ie++;M=z.substring(0,we).trim(),F=z.substring(we+1).trim()}}const pe=M.split(".");if(pe.length==2&&pe[1]==0&&pe[1].length!=2)throw new Error("invalid coordinates format");const me=F.split(".");if(me.length==2&&me[1]==0&&me[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(M)||/^\d+$/.test(F))throw new Error("degree only coordinate/s provided");return r=Number(Number(r).toFixed(e)),l=Number(Number(l).toFixed(e)),Object.freeze({verbatimCoordinates:z,verbatimLatitude:M,verbatimLongitude:F,decimalLatitude:r,decimalLongitude:l,decimalCoordinates:`${r},${l}`,originalFormat:x,closeEnough:uF,toCoordinateFormat:lF})}else throw new Error("coordinates pattern match failed")}function Eh(t){if(!isNaN(t[0]))return!1;const e=[...t];if(e.shift(),e.length%2>0)return!1;const r=/^[-+]?\d+([\.,]\d+)?$/,l=/[eastsouthnorthwest]+/i,p=e.length/2;for(let g=0;g{e.decimalLatitude?t.push(e):t.push({...e,...fF})}),[...t,...dF,...pF]}const gF=mF();m_.formats=gF.map(t=>t.verbatimCoordinates);const G6=m_;function Gb(t){let e,r;return e=new qT({props:{$$slots:{default:[yF]},$$scope:{ctx:t}}}),e.$on("click",t[5]),{c(){po(e.$$.fragment)},m(l,p){to(e,l,p),r=!0},p(l,p){const g={};p&128&&(g.$$scope={dirty:p,ctx:l}),e.$set(g)},i(l){r||(Vt(e.$$.fragment,l),r=!0)},o(l){en(e.$$.fragment,l),r=!1},d(l){no(e,l)}}}function yF(t){let e;return{c(){e=Ia("X")},m(r,l){Fn(r,e,l)},d(r){r&&Mn(e)}}}function _F(t){let e,r,l,p,g,x,f,C,R,z,M=t[2]&&Gb(t);const F=t[4].default,Y=ps(F,t,t[7],null);return{c(){e=si("div"),r=si("div"),l=si("div"),p=si("h1"),g=Ia(t[1]),x=qr(),M&&M.c(),f=qr(),Y&&Y.c(),bn(p,"class","govuk-heading-l"),e0(l,"display","flex"),e0(l,"justify-content","space-between"),bn(r,"class","content centered-fullscreen svelte-1st8ub0"),bn(e,"class","background svelte-1st8ub0"),Us(e,"open",t[0]),Us(e,"closed",!t[0])},m(W,pe){Fn(W,e,pe),oi(e,r),oi(r,l),oi(l,p),oi(p,g),oi(l,x),M&&M.m(l,null),oi(r,f),Y&&Y.m(r,null),C=!0,R||(z=[wa(r,"click",lT(vF)),wa(e,"click",t[6])],R=!0)},p(W,[pe]){(!C||pe&2)&&vc(g,W[1]),W[2]?M?(M.p(W,pe),pe&4&&Vt(M,1)):(M=Gb(W),M.c(),Vt(M,1),M.m(l,null)):M&&(_s(),en(M,1,1,()=>{M=null}),vs()),Y&&Y.p&&(!C||pe&128)&&gs(Y,F,W,W[7],C?ms(F,W[7],pe,null):ys(W[7]),null),(!C||pe&1)&&Us(e,"open",W[0]),(!C||pe&1)&&Us(e,"closed",!W[0])},i(W){C||(Vt(M),Vt(Y,W),C=!0)},o(W){en(M),en(Y,W),C=!1},d(W){W&&Mn(e),M&&M.d(),Y&&Y.d(W),R=!1,Gs(z)}}}const vF=()=>null;function xF(t,e,r){let{$$slots:l={},$$scope:p}=e,{title:g}=e,{open:x=!1}=e,{displayEscapeButton:f=!0}=e,{canCloseByClickingBackground:C=!0}=e;const R=()=>r(0,x=!1),z=()=>{C&&r(0,x=!1)};return t.$$set=M=>{"title"in M&&r(1,g=M.title),"open"in M&&r(0,x=M.open),"displayEscapeButton"in M&&r(2,f=M.displayEscapeButton),"canCloseByClickingBackground"in M&&r(3,C=M.canCloseByClickingBackground),"$$scope"in M&&r(7,p=M.$$scope)},[x,g,f,C,l,R,z,p]}class H6 extends Zi{constructor(e){super(),Wi(this,e,xF,_F,yi,{title:1,open:0,displayEscapeButton:2,canCloseByClickingBackground:3})}}var cp=bF;function bF(t){var e,r,l;if(t){if(Array.isArray(t)){for(e=[],r=t.length,l=0;lnew Promise((l,p)=>{var g=C=>{try{f(r.next(C))}catch(R){p(R)}},x=C=>{try{f(r.throw(C))}catch(R){p(R)}},f=C=>C.done?l(C.value):Promise.resolve(C.value).then(g,x);f((r=r.apply(t,e)).next())}),Eo=Uint8Array,ic=Uint16Array,kF=Int32Array,Gk=new Eo([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Hk=new Eo([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),EF=new Eo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Wk=function(t,e){for(var r=new ic(31),l=0;l<31;++l)r[l]=e+=1<>1|(zn&21845)<<1,xa=(xa&52428)>>2|(xa&13107)<<2,xa=(xa&61680)>>4|(xa&3855)<<4,py[zn]=((xa&65280)>>8|(xa&255)<<8)>>1;var xa,zn,jh=function(t,e,r){for(var l=t.length,p=0,g=new ic(e);p>C]=R}else for(f=new ic(l),p=0;p>15-t[p]);return f},uf=new Eo(288);for(zn=0;zn<144;++zn)uf[zn]=8;var zn;for(zn=144;zn<256;++zn)uf[zn]=9;var zn;for(zn=256;zn<280;++zn)uf[zn]=7;var zn;for(zn=280;zn<288;++zn)uf[zn]=8;var zn,Xk=new Eo(32);for(zn=0;zn<32;++zn)Xk[zn]=5;var zn,AF=jh(uf,9,1),LF=jh(Xk,5,1),sg=function(t){for(var e=t[0],r=1;re&&(e=t[r]);return e},as=function(t,e,r){var l=e/8|0;return(t[l]|t[l+1]<<8)>>(e&7)&r},ag=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(e&7)},PF=function(t){return(t+7)/8|0},MF=function(t,e,r){(e==null||e<0)&&(e=0),(r==null||r>t.length)&&(r=t.length);var l=new Eo(r-e);return l.set(t.subarray(e,r)),l},RF=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ko=function(t,e,r){var l=new Error(e||RF[t]);if(l.code=t,Error.captureStackTrace&&Error.captureStackTrace(l,ko),!r)throw l;return l},y_=function(t,e,r,l){var p=t.length,g=l?l.length:0;if(!p||e.f&&!e.l)return r||new Eo(0);var x=!r||e.i!=2,f=e.i;r||(r=new Eo(p*3));var C=function($t){var bt=r.length;if($t>bt){var fe=new Eo(Math.max(bt*2,$t));fe.set(r),r=fe}},R=e.f||0,z=e.p||0,M=e.b||0,F=e.l,Y=e.d,W=e.m,pe=e.n,me=p*8;do{if(!F){R=as(t,z,1);var ve=as(t,z+1,3);if(z+=3,ve)if(ve==1)F=AF,Y=LF,W=9,pe=5;else if(ve==2){var Re=as(t,z,31)+257,Ve=as(t,z+10,15)+4,Fe=Re+as(t,z+5,31)+1;z+=14;for(var ze=new Eo(Fe),Ge=new Eo(19),yt=0;yt>4;if(we<16)ze[yt++]=we;else{var St=0,Ct=0;for(we==16?(Ct=3+as(t,z,3),z+=2,St=ze[yt-1]):we==17?(Ct=3+as(t,z,7),z+=3):we==18&&(Ct=11+as(t,z,127),z+=7);Ct--;)ze[yt++]=St}}var vt=ze.subarray(0,Re),Gt=ze.subarray(Re);W=sg(vt),pe=sg(Gt),F=jh(vt,W,1),Y=jh(Gt,pe,1)}else ko(1);else{var we=PF(z)+4,Ie=t[we-4]|t[we-3]<<8,Pe=we+Ie;if(Pe>p){f&&ko(0);break}x&&C(M+Ie),r.set(t.subarray(we,Pe),M),e.b=M+=Ie,e.p=z=Pe*8,e.f=R;continue}if(z>me){f&&ko(0);break}}x&&C(M+131072);for(var an=(1<>4;if(z+=St&15,z>me){f&&ko(0);break}if(St||ko(2),Nt<256)r[M++]=Nt;else if(Nt==256){tn=z,F=null;break}else{var on=Nt-254;if(Nt>264){var yt=Nt-257,Et=Gk[yt];on=as(t,z,(1<>4;gn||ko(3),z+=gn&15;var Gt=CF[wn];if(wn>3){var Et=Hk[wn];Gt+=ag(t,z)&(1<me){f&&ko(0);break}x&&C(M+131072);var In=M+on;if(M>3&1)+(e>>4&1);l>0;l-=!t[r++]);return r+(e&2)},NF=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},zF=function(t,e){return((t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31)&&ko(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&ko(6,"invalid zlib data: "+(t[1]&32?"need":"unexpected")+" dictionary"),(t[1]>>3&4)+2};function FF(t,e){return y_(t,{i:2},e&&e.out,e&&e.dictionary)}function BF(t,e){var r=DF(t);return r+8>t.length&&ko(6,"invalid gzip data"),y_(t.subarray(r,-8),{i:2},e&&e.out||new Eo(NF(t)),e&&e.dictionary)}function UF(t,e){return y_(t.subarray(zF(t,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}function my(t,e){return t[0]==31&&t[1]==139&&t[2]==8?BF(t,e):(t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31?FF(t,e):UF(t,e)}var jF=typeof TextDecoder<"u"&&new TextDecoder,VF=0;try{jF.decode(OF,{stream:!0}),VF=1}catch{}var $k=(t,e)=>t*lc(2,e),Ih=(t,e)=>Math.floor(t/lc(2,e)),hp=(t,e)=>$k(t.getUint16(e+1,!0),8)+t.getUint8(e),Kk=(t,e)=>$k(t.getUint32(e+2,!0),16)+t.getUint16(e,!0),qF=(t,e,r,l,p)=>{if(t!==l.getUint8(p))return t-l.getUint8(p);const g=hp(l,p+1);if(e!==g)return e-g;const x=hp(l,p+4);return r!==x?r-x:0},GF=(t,e,r,l)=>{const p=Jk(t,e|128,r,l);return p?{z:e,x:r,y:l,offset:p[0],length:p[1],isDir:!0}:null},Wb=(t,e,r,l)=>{const p=Jk(t,e,r,l);return p?{z:e,x:r,y:l,offset:p[0],length:p[1],isDir:!1}:null},Jk=(t,e,r,l)=>{let p=0,g=t.byteLength/17-1;for(;p<=g;){const x=g+p>>1,f=qF(e,r,l,t,x*17);if(f>0)p=x+1;else if(f<0)g=x-1;else return[Kk(t,x*17+7),t.getUint32(x*17+13,!0)]}return null},HF=(t,e)=>t.isDir&&!e.isDir?1:!t.isDir&&e.isDir?-1:t.z!==e.z?t.z-e.z:t.x!==e.x?t.x-e.x:t.y-e.y,Qk=(t,e)=>{const r=t.getUint8(e*17);return{z:r&127,x:hp(t,e*17+1),y:hp(t,e*17+4),offset:Kk(t,e*17+7),length:t.getUint32(e*17+13,!0),isDir:r>>7===1}},Zb=t=>{const e=[],r=new DataView(t);for(let l=0;l{t.sort(HF);const e=new ArrayBuffer(17*t.length),r=new Uint8Array(e);for(let l=0;l>8&255,r[l*17+3]=p.x>>16&255,r[l*17+4]=p.y&255,r[l*17+5]=p.y>>8&255,r[l*17+6]=p.y>>16&255,r[l*17+7]=p.offset&255,r[l*17+8]=Ih(p.offset,8)&255,r[l*17+9]=Ih(p.offset,16)&255,r[l*17+10]=Ih(p.offset,24)&255,r[l*17+11]=Ih(p.offset,32)&255,r[l*17+12]=Ih(p.offset,48)&255,r[l*17+13]=p.length&255,r[l*17+14]=p.length>>8&255,r[l*17+15]=p.length>>16&255,r[l*17+16]=p.length>>24&255}return e},ZF=(t,e)=>{if(t.byteLength<17)return null;const r=t.byteLength/17,l=Qk(t,r-1);if(l.isDir){const p=l.z,g=e.z-p,x=Math.trunc(e.x/(1<(e,r)=>{if(r instanceof AbortController)return t(e,r);const l=new AbortController;return t(e,l).then(p=>r(void 0,p.data,p.cacheControl||"",p.expires||""),p=>r(p)).catch(p=>r(p)),{cancel:()=>l.abort()}},W6=class{constructor(){this.tilev4=(t,e)=>Vr(this,null,function*(){if(t.type==="json"){const M=t.url.substr(10);let F=this.tiles.get(M);F||(F=new Yb(M),this.tiles.set(M,F));const Y=yield F.getHeader();return{data:{tiles:[`${t.url}/{z}/{x}/{y}`],minzoom:Y.minZoom,maxzoom:Y.maxZoom,bounds:[Y.minLon,Y.minLat,Y.maxLon,Y.maxLat]}}}const r=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),l=t.url.match(r);if(!l)throw new Error("Invalid PMTiles protocol URL");const p=l[1];let g=this.tiles.get(p);g||(g=new Yb(p),this.tiles.set(p,g));const x=l[2],f=l[3],C=l[4],R=yield g.getHeader(),z=yield g==null?void 0:g.getZxy(+x,+f,+C,e.signal);return z?{data:new Uint8Array(z.data),cacheControl:z.cacheControl,expires:z.expires}:R.tileType===1?{data:new Uint8Array}:{data:null}}),this.tile=$F(this.tilev4),this.tiles=new Map}add(t){this.tiles.set(t.source.getKey(),t)}get(t){return this.tiles.get(t)}};function $u(t,e){return(e>>>0)*4294967296+(t>>>0)}function KF(t,e){const r=e.buf;let l=r[e.pos++],p=(l&112)>>4;if(l<128||(l=r[e.pos++],p|=(l&127)<<3,l<128)||(l=r[e.pos++],p|=(l&127)<<10,l<128)||(l=r[e.pos++],p|=(l&127)<<17,l<128)||(l=r[e.pos++],p|=(l&127)<<24,l<128)||(l=r[e.pos++],p|=(l&1)<<31,l<128))return $u(t,p);throw new Error("Expected varint not more than 10 bytes")}function Th(t){const e=t.buf;let r=e[t.pos++],l=r&127;return r<128||(r=e[t.pos++],l|=(r&127)<<7,r<128)||(r=e[t.pos++],l|=(r&127)<<14,r<128)||(r=e[t.pos++],l|=(r&127)<<21,r<128)?l:(r=e[t.pos],l|=(r&15)<<28,KF(l,t))}function JF(t,e,r,l){if(l===0){r===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);const p=e[0];e[0]=e[1],e[1]=p}}var QF=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function eB(t,e,r){if(t>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(e>lc(2,t)-1||r>lc(2,t)-1)throw Error("tile x/y outside zoom level bounds");const l=QF[t],p=lc(2,t);let g=0,x=0,f=0;const C=[e,r];let R=p/2;for(;R>0;)g=(C[0]&R)>0?1:0,x=(C[1]&R)>0?1:0,f+=R*R*(3*g^x),JF(R,C,g,x),R=R/2;return l+f}function tE(t,e){return Vr(this,null,function*(){if(e===1||e===0)return t;if(e===2){if(typeof globalThis.DecompressionStream>"u")return my(new Uint8Array(t));const r=new Response(t).body;if(!r)throw Error("Failed to read response stream");const l=r.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(l).arrayBuffer()}throw Error("Compression method not supported")})}var tB=127;function nB(t,e){let r=0,l=t.length-1;for(;r<=l;){const p=l+r>>1,g=e-t[p].tileId;if(g>0)r=p+1;else if(g<0)l=p-1;else return t[p]}return l>=0&&(t[l].runLength===0||e-t[l].tileId=300)throw Error(`Bad response code: ${C.status}`);const z=C.headers.get("Content-Length");if(C.status===200&&(!z||+z>e))throw p&&p.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield C.arrayBuffer(),etag:R||void 0,cacheControl:C.headers.get("Cache-Control")||void 0,expires:C.headers.get("Expires")||void 0}})}};function ls(t,e){const r=t.getUint32(e+4,!0),l=t.getUint32(e+0,!0);return r*lc(2,32)+l}function rB(t,e){const r=new DataView(t),l=r.getUint8(7);if(l>3)throw Error(`Archive is spec version ${l} but this library supports up to spec version 3`);return{specVersion:l,rootDirectoryOffset:ls(r,8),rootDirectoryLength:ls(r,16),jsonMetadataOffset:ls(r,24),jsonMetadataLength:ls(r,32),leafDirectoryOffset:ls(r,40),leafDirectoryLength:ls(r,48),tileDataOffset:ls(r,56),tileDataLength:ls(r,64),numAddressedTiles:ls(r,72),numTileEntries:ls(r,80),numTileContents:ls(r,88),clustered:r.getUint8(96)===1,internalCompression:r.getUint8(97),tileCompression:r.getUint8(98),tileType:r.getUint8(99),minZoom:r.getUint8(100),maxZoom:r.getUint8(101),minLon:r.getInt32(102,!0)/1e7,minLat:r.getInt32(106,!0)/1e7,maxLon:r.getInt32(110,!0)/1e7,maxLat:r.getInt32(114,!0)/1e7,centerZoom:r.getUint8(118),centerLon:r.getInt32(119,!0)/1e7,centerLat:r.getInt32(123,!0)/1e7,etag:e}}function nE(t){const e={buf:new Uint8Array(t),pos:0},r=Th(e),l=[];let p=0;for(let g=0;g0?l[g].offset=l[g-1].offset+l[g-1].length:l[g].offset=x-1}return l}function oB(t){const e=new DataView(t);return e.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):e.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var gy=class extends Error{};function sB(t,e){return Vr(this,null,function*(){const r=yield t.getBytes(0,16384);if(new DataView(r.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(oB(r.data)<3)return[yield eE.getHeader(t)];const p=r.data.slice(0,tB),g=rB(p,r.etag),x=r.data.slice(g.rootDirectoryOffset,g.rootDirectoryOffset+g.rootDirectoryLength),f=`${t.getKey()}|${g.etag||""}|${g.rootDirectoryOffset}|${g.rootDirectoryLength}`,C=nE(yield e(x,g.internalCompression));return[g,[f,C.length,C]]})}function aB(t,e,r,l,p){return Vr(this,null,function*(){const g=yield t.getBytes(r,l,void 0,p.etag),x=yield e(g.data,p.internalCompression),f=nE(x);if(f.length===0)throw new Error("Empty directory is invalid");return f})}var lB=class{constructor(t=100,e=!0,r=tE){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=t,this.counter=1,this.decompress=r}getHeader(t){return Vr(this,null,function*(){const e=t.getKey(),r=this.cache.get(e);if(r)return r.lastUsed=this.counter++,yield r.data;const l=new Promise((p,g)=>{sB(t,this.decompress).then(x=>{x[1]&&this.cache.set(x[1][0],{lastUsed:this.counter++,data:Promise.resolve(x[1][2])}),p(x[0]),this.prune()}).catch(x=>{g(x)})});return this.cache.set(e,{lastUsed:this.counter++,data:l}),l})}getDirectory(t,e,r,l){return Vr(this,null,function*(){const p=`${t.getKey()}|${l.etag||""}|${e}|${r}`,g=this.cache.get(p);if(g)return g.lastUsed=this.counter++,yield g.data;const x=new Promise((f,C)=>{aB(t,this.decompress,e,r,l).then(R=>{f(R),this.prune()}).catch(R=>{C(R)})});return this.cache.set(p,{lastUsed:this.counter++,data:x}),x})}getArrayBuffer(t,e,r,l){return Vr(this,null,function*(){const p=`${t.getKey()}|${l.etag||""}|${e}|${r}`,g=this.cache.get(p);if(g)return g.lastUsed=this.counter++,yield g.data;const x=new Promise((f,C)=>{t.getBytes(e,r,void 0,l.etag).then(R=>{f(R.data),this.cache.has(p),this.prune()}).catch(R=>{C(R)})});return this.cache.set(p,{lastUsed:this.counter++,data:x}),x})}prune(){if(this.cache.size>=this.maxCacheEntries){let t=1/0,e;this.cache.forEach((r,l)=>{r.lastUsed{this.getHeader(t).then(g=>{l(),this.invalidations.delete(e)}).catch(g=>{p(g)})});this.invalidations.set(e,r)})}},Yb=class{constructor(t,e,r){typeof t=="string"?this.source=new iB(t):this.source=t,r?this.decompress=r:this.decompress=tE,e?this.cache=e:this.cache=new lB}getHeader(){return Vr(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(t,e,r,l){return Vr(this,null,function*(){const p=eB(t,e,r),g=yield this.cache.getHeader(this.source);if(g.specVersion<3)return eE.getZxy(g,this.source,this.cache,t,e,r,l);if(tg.maxZoom)return;let x=g.rootDirectoryOffset,f=g.rootDirectoryLength;for(let C=0;C<=3;C++){const R=yield this.cache.getDirectory(this.source,x,f,g),z=nB(R,p);if(z){if(z.runLength>0){const M=yield this.source.getBytes(g.tileDataOffset+z.offset,z.length,l,g.etag);return{data:yield this.decompress(M.data,g.tileCompression),cacheControl:M.cacheControl,expires:M.expires}}x=g.leafDirectoryOffset+z.offset,f=z.length}else return}throw Error("Maximum directory depth exceeded")})}getZxy(t,e,r,l){return Vr(this,null,function*(){try{return yield this.getZxyAttempt(t,e,r,l)}catch(p){if(p instanceof gy)return this.cache.invalidate(this.source),yield this.getZxyAttempt(t,e,r,l);throw p}})}getMetadataAttempt(){return Vr(this,null,function*(){const t=yield this.cache.getHeader(this.source),e=yield this.source.getBytes(t.jsonMetadataOffset,t.jsonMetadataLength,void 0,t.etag),r=yield this.decompress(e.data,t.internalCompression),l=new TextDecoder("utf-8");return JSON.parse(l.decode(r))})}getMetadata(){return Vr(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(t){if(t instanceof gy)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw t}})}};function uB(t){return t=="google"||t=="bing"}var Ir=[];for(var lg=0;lg<256;++lg)Ir.push((lg+256).toString(16).slice(1));function cB(t,e=0){return(Ir[t[e+0]]+Ir[t[e+1]]+Ir[t[e+2]]+Ir[t[e+3]]+"-"+Ir[t[e+4]]+Ir[t[e+5]]+"-"+Ir[t[e+6]]+Ir[t[e+7]]+"-"+Ir[t[e+8]]+Ir[t[e+9]]+"-"+Ir[t[e+10]]+Ir[t[e+11]]+Ir[t[e+12]]+Ir[t[e+13]]+Ir[t[e+14]]+Ir[t[e+15]]).toLowerCase()}var ed,hB=new Uint8Array(16);function fB(){if(!ed&&(ed=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ed))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ed(hB)}var dB=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Xb={randomUUID:dB};function pB(t,e,r){if(Xb.randomUUID&&!e&&!t)return Xb.randomUUID();t=t||{};var l=t.random||(t.rng||fB)();if(l[6]=l[6]&15|64,l[8]=l[8]&63|128,e){r=r||0;for(var p=0;p<16;++p)e[r+p]=l[p];return e}return cB(l)}const Z6={hovering:"black",lineEndpointColor:"black"},Y6=10,X6=10;function mB(){return gB(["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"])}function gB(t){return t[Math.floor(Math.random()*t.length)]}const $6=Hi(null),K6=Hi(null),J6=Hi(null),Q6=Hi(new Set),yB=Hi(null),_B=Hi({mode:"list"});function e8(t){let e=new Set;for(let l of t.features)e.add(l.id);let r=e.size+1;for(;e.has(r);)r++;return r}function t8(t,e){console.log(`Deleting intervention ${e}`),t.update(r=>(r.features=r.features.filter(l=>l.id!=e),r)),yB.set(null),_B.set({mode:"list"})}function n8(t){return Object.values(t.schemes)[0].scheme_reference}function i8(t){return[Math.round(t[0]*1e7)/1e7,Math.round(t[1]*1e7)/1e7]}const vB=Hi(xB());vB.subscribe(t=>window.localStorage.setItem("userSettings",JSON.stringify(t)));function xB(){let t={streetViewImagery:"google",avoidDoublingBack:!1};try{let e=JSON.parse(window.localStorage.getItem("userSettings")||"{}");uB(e.streetViewImagery)&&(t.streetViewImagery=e.streetViewImagery),typeof e.avoidDoublingBack=="boolean"&&(t.avoidDoublingBack=e.avoidDoublingBack)}catch(e){console.log(`Couldn't parse userSettings from local storage: ${e}`)}return t}function r8(t){let e={type:"FeatureCollection",features:[],schemes:{}};return bB(t,e),e}function bB(t,e){let r=pB(),l=t.initializeEmptyScheme({scheme_reference:r,color:mB()});e.schemes[r]=l}let wB=Date.now();function Ep(t){return`${t}-${wB++}`}const __=Symbol.for("svelte-maplibre");function Pc(){return dT(__)}function SB(t){let e=new WeakMap;return r=>{var x;let l=e.get(r.originalEvent);if(l!==void 0)return l;let g=(x=r.target.queryRenderedFeatures(r.point).find(f=>{var C;return(C=t.get(f.layer.id))==null?void 0:C.interactive}))==null?void 0:x.layer.id;return e.set(r.originalEvent,g),g}}function kB(){let t=new Map;return xy(__,{map:Hi(null),source:Nm(null),layer:Nm(null),popupTarget:Nm(null),cluster:Hi(),loadedImages:Hi(new Set),minzoom:Hi(0),maxzoom:Hi(24),layerEvent:Hi(null),layerInfo:t,eventTopMost:SB(t)})}function $b(t){return{subscribe:t.subscribe}}function v_({key:t,setPopupTarget:e=!1,setCluster:r=!1,setMouseEvent:l=!1}){let p=Pc(),g=Hi(null),x=$b(g),f={...p,[t]:$b(g)};if(e&&(f.popupTarget=x),l){let C=Hi(null);f.layerEvent=C,p.layerEvent=C}return r&&(f.cluster=Hi()),xy(__,f),{...p,self:g}}function EB(){return v_({key:"source",setCluster:!0})}function IB(t=!0){return v_({key:"layer",setPopupTarget:t,setMouseEvent:t})}function o8(){return v_({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function TB(t){return"layerType"in t&&t.layerType==="deckgl"}function Kb(t){let e;return r=>{if(r)for(let l in r){let p=e==null?void 0:e[l],g=r[l];p!==g&&t(l,g,p)}else if(e)for(let l in e)t(l,void 0,e[l]);e=r}}function CB(t,...e){let r=[t];for(let l of e)if(l)Array.isArray(l)&&l[0]===t?r.push(...l.slice(1)):r.push(l);else continue;if(r.length!==1)return r.length===2?r[1]:r}function AB(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function s8(t,e){return["case",["boolean",["feature-state","hover"],!1],e,t]}function Jb(t){let e=t[0],r,l,p=Qb(t);return{c(){p.c(),r=ml()},m(g,x){p.m(g,x),Fn(g,r,x),l=!0},p(g,x){x[0]&1&&yi(e,e=g[0])?(_s(),en(p,1,1,tr),vs(),p=Qb(g),p.c(),Vt(p,1),p.m(r.parentNode,r)):p.p(g,x)},i(g){l||(Vt(p),l=!0)},o(g){en(p),l=!1},d(g){g&&Mn(r),p.d(g)}}}function Qb(t){let e;const r=t[36].default,l=ps(r,t,t[35],null);return{c(){l&&l.c()},m(p,g){l&&l.m(p,g),e=!0},p(p,g){l&&l.p&&(!e||g[1]&16)&&gs(l,r,p,p[35],e?ms(r,p[35],g,null):ys(p[35]),null)},i(p){e||(Vt(l,p),e=!0)},o(p){en(l,p),e=!1},d(p){l&&l.d(p)}}}function LB(t){let e,r,l=t[0]&&Jb(t);return{c(){l&&l.c(),e=ml()},m(p,g){l&&l.m(p,g),Fn(p,e,g),r=!0},p(p,g){p[0]?l?(l.p(p,g),g[0]&1&&Vt(l,1)):(l=Jb(p),l.c(),Vt(l,1),l.m(e.parentNode,e)):l&&(_s(),en(l,1,1,()=>{l=null}),vs())},i(p){r||(Vt(l),r=!0)},o(p){en(l),r=!1},d(p){p&&Mn(e),l&&l.d(p)}}}function PB(t,e,r){let l,p,g,x,f,C,R,z,M,F,Y,W,{$$slots:pe={},$$scope:me}=e,{id:ve=Ep("layer")}=e,{source:we=void 0}=e,{sourceLayer:Ie=void 0}=e,{beforeId:Pe=void 0}=e,{beforeLayerType:Re=void 0}=e,{type:Ve}=e,{paint:Fe=void 0}=e,{layout:ze=void 0}=e,{filter:Ge=void 0}=e,{applyToClusters:yt=void 0}=e,{minzoom:De=void 0}=e,{maxzoom:mt=void 0}=e,{manageHoverState:xt=!1}=e,{hovered:Je=null}=e,{interactive:St=!0}=e,{hoverCursor:Ct=void 0}=e,{eventsIfTopMost:vt=!1}=e;const Gt=vy(),{map:an,source:ut,self:tn,minzoom:Nt,maxzoom:on,eventTopMost:Et,layerInfo:gn}=IB();er(t,an,Se=>r(31,M=Se)),er(t,ut,Se=>r(32,F=Se)),er(t,tn,Se=>r(0,z=Se)),er(t,Nt,Se=>r(34,W=Se)),er(t,on,Se=>r(33,Y=Se)),dl(()=>{z&&M&&(gn.delete(z),M==null||M.removeLayer(z))});let wn;function In(Se){var je,Fi;if(!St||!z||!M||vt&&Et(Se)!==z)return;let Ue=Se.features??[],Ot=(Fi=(je=Ue[0])==null?void 0:je.properties)==null?void 0:Fi.cluster_id,Rn={event:Se,map:M,clusterId:Ot,layer:z,source:f,features:Ue};Gt(Se.type,Rn)}function Ae(Se){var je,Fi;if(!St||!z||!M||vt&&Et(Se)!==z)return;Ct&&(M.getCanvas().style.cursor=Ct);let Ue=Se.features??[];r(6,Je=Ue[0]??null);let Ot=(Fi=(je=Ue[0])==null?void 0:je.properties)==null?void 0:Fi.cluster_id;Gt("mouseenter",{event:Se,map:M,clusterId:Ot,layer:z,source:f,features:Ue})}function zi(Se){var je,Fi,ot;if(!St||!M)return;if(vt&&Et(Se)!==z){r(6,Je=null),xt&&wn!==void 0&&(M==null||M.setFeatureState({source:f,sourceLayer:Ie,id:wn},{hover:!1}),wn=void 0);return}M.getCanvas().style.cursor=Ct;let Ue=Se.features??[],Ot=(Fi=(je=Ue[0])==null?void 0:je.properties)==null?void 0:Fi.cluster_id,Rn=(ot=Ue[0])==null?void 0:ot.id;Rn!==wn&&(xt&&(wn!==void 0&&(M==null||M.setFeatureState({source:f,id:wn,sourceLayer:Ie},{hover:!1})),M==null||M.setFeatureState({source:f,id:Rn,sourceLayer:Ie},{hover:!0})),wn=Rn,r(6,Je=Ue[0]??null)),Gt("mousemove",{event:Se,map:M,clusterId:Ot,layer:z,source:f,features:Ue})}function $t(Se){if(!(!St||!z||!M)){if(Ct&&(M.getCanvas().style.cursor=""),r(6,Je=null),xt&&wn!==void 0){const Ue={source:f,id:wn,sourceLayer:Ie};M==null||M.setFeatureState(Ue,{hover:!1}),wn=void 0}Gt("mouseleave",{map:M,layer:z,source:f})}}let bt=!0;function fe(Se){M&&(M.off("click",Se,In),M.off("dblclick",Se,In),M.off("contextmenu",Se,In),M.off("mouseenter",Se,Ae),M.off("mousemove",Se,zi),M.off("mouseleave",Se,$t))}return dl(()=>{M&&z&&fe(z)}),t.$$set=Se=>{"id"in Se&&r(7,ve=Se.id),"source"in Se&&r(8,we=Se.source),"sourceLayer"in Se&&r(9,Ie=Se.sourceLayer),"beforeId"in Se&&r(10,Pe=Se.beforeId),"beforeLayerType"in Se&&r(11,Re=Se.beforeLayerType),"type"in Se&&r(12,Ve=Se.type),"paint"in Se&&r(13,Fe=Se.paint),"layout"in Se&&r(14,ze=Se.layout),"filter"in Se&&r(15,Ge=Se.filter),"applyToClusters"in Se&&r(16,yt=Se.applyToClusters),"minzoom"in Se&&r(17,De=Se.minzoom),"maxzoom"in Se&&r(18,mt=Se.maxzoom),"manageHoverState"in Se&&r(19,xt=Se.manageHoverState),"hovered"in Se&&r(6,Je=Se.hovered),"interactive"in Se&&r(20,St=Se.interactive),"hoverCursor"in Se&&r(21,Ct=Se.hoverCursor),"eventsIfTopMost"in Se&&r(22,vt=Se.eventsIfTopMost),"$$scope"in Se&&r(35,me=Se.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&r(30,l=AB(yt)),t.$$.dirty[0]&1073774592&&r(24,p=CB("all",l,Ge)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&r(26,g=De??W),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&r(25,x=mt??Y),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&r(29,f=we||F),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&M&&z!==ve&&f){z&&(fe(z),gn.delete(z));let Se=Pe;if(!Pe&&Re){let Ue=M.getStyle().layers,Ot=typeof Re=="function"?Re:je=>je.type===Re,Rn=Ue==null?void 0:Ue.find(Ot);Rn&&(Se=Rn.id)}hl(tn,z=ve,z),M.addLayer(cp({id:z,type:Ve,source:f,"source-layer":Ie,filter:p,paint:Fe,layout:ze,minzoom:g,maxzoom:x}),Se),r(23,bt=!0),M.on("click",z,In),M.on("dblclick",z,In),M.on("contextmenu",z,In),M.on("mouseenter",z,Ae),M.on("mousemove",z,zi),M.on("mouseleave",z,$t)}t.$$.dirty[0]&1048577&&z&&gn.set(z,{interactive:St}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&r(28,C=z?Kb((Se,Ue)=>M==null?void 0:M.setPaintProperty(z,Se,Ue)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&r(27,R=z?Kb((Se,Ue)=>M==null?void 0:M.setLayoutProperty(z,Se,Ue)):void 0),t.$$.dirty[0]&268443648&&(C==null||C(Fe)),t.$$.dirty[0]&134234112&&(R==null||R(ze)),t.$$.dirty[0]&100663297|t.$$.dirty[1]&1&&z&&(M==null||M.setLayerZoomRange(z,g,x)),t.$$.dirty[0]&25165825|t.$$.dirty[1]&1&&z&&(bt?r(23,bt=!1):M==null||M.setFilter(z,p))},[z,an,ut,tn,Nt,on,Je,ve,we,Ie,Pe,Re,Ve,Fe,ze,Ge,yt,De,mt,xt,St,Ct,vt,bt,p,x,g,R,C,f,l,M,F,Y,W,me,pe]}class iE extends Zi{constructor(e){super(),Wi(this,e,PB,LB,yi,{id:7,source:8,sourceLayer:9,beforeId:10,beforeLayerType:11,type:12,paint:13,layout:14,filter:15,applyToClusters:16,minzoom:17,maxzoom:18,manageHoverState:19,hovered:6,interactive:20,hoverCursor:21,eventsIfTopMost:22},null,[-1,-1])}}function MB(t){let e;const r=t[15].default,l=ps(r,t,t[23],null);return{c(){l&&l.c()},m(p,g){l&&l.m(p,g),e=!0},p(p,g){l&&l.p&&(!e||g&8388608)&&gs(l,r,p,p[23],e?ms(r,p[23],g,null):ys(p[23]),null)},i(p){e||(Vt(l,p),e=!0)},o(p){en(l,p),e=!1},d(p){l&&l.d(p)}}}function RB(t){let e,r,l;function p(x){t[16](x)}let g={id:t[1],type:"fill",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[MB]},$$scope:{ctx:t}};return t[0]!==void 0&&(g.hovered=t[0]),e=new iE({props:g}),Ea.push(()=>kd(e,"hovered",p)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){po(e.$$.fragment)},m(x,f){to(e,x,f),l=!0},p(x,[f]){const C={};f&2&&(C.id=x[1]),f&4&&(C.source=x[2]),f&8&&(C.sourceLayer=x[3]),f&16&&(C.beforeId=x[4]),f&32&&(C.beforeLayerType=x[5]),f&64&&(C.paint=x[6]),f&128&&(C.layout=x[7]),f&256&&(C.filter=x[8]),f&512&&(C.minzoom=x[9]),f&1024&&(C.maxzoom=x[10]),f&2048&&(C.hoverCursor=x[11]),f&4096&&(C.manageHoverState=x[12]),f&8192&&(C.eventsIfTopMost=x[13]),f&16384&&(C.interactive=x[14]),f&8388608&&(C.$$scope={dirty:f,ctx:x}),!r&&f&1&&(r=!0,C.hovered=x[0],Sd(()=>r=!1)),e.$set(C)},i(x){l||(Vt(e.$$.fragment,x),l=!0)},o(x){en(e.$$.fragment,x),l=!1},d(x){no(e,x)}}}function OB(t,e,r){let{$$slots:l={},$$scope:p}=e,{id:g=Ep("fill")}=e,{source:x=void 0}=e,{sourceLayer:f=void 0}=e,{beforeId:C=void 0}=e,{beforeLayerType:R=void 0}=e,{paint:z}=e,{layout:M=void 0}=e,{filter:F=void 0}=e,{minzoom:Y=void 0}=e,{maxzoom:W=void 0}=e,{hoverCursor:pe=void 0}=e,{manageHoverState:me=!1}=e,{hovered:ve=null}=e,{eventsIfTopMost:we=!1}=e,{interactive:Ie=!0}=e;function Pe(De){ve=De,r(0,ve)}function Re(De){jr.call(this,t,De)}function Ve(De){jr.call(this,t,De)}function Fe(De){jr.call(this,t,De)}function ze(De){jr.call(this,t,De)}function Ge(De){jr.call(this,t,De)}function yt(De){jr.call(this,t,De)}return t.$$set=De=>{"id"in De&&r(1,g=De.id),"source"in De&&r(2,x=De.source),"sourceLayer"in De&&r(3,f=De.sourceLayer),"beforeId"in De&&r(4,C=De.beforeId),"beforeLayerType"in De&&r(5,R=De.beforeLayerType),"paint"in De&&r(6,z=De.paint),"layout"in De&&r(7,M=De.layout),"filter"in De&&r(8,F=De.filter),"minzoom"in De&&r(9,Y=De.minzoom),"maxzoom"in De&&r(10,W=De.maxzoom),"hoverCursor"in De&&r(11,pe=De.hoverCursor),"manageHoverState"in De&&r(12,me=De.manageHoverState),"hovered"in De&&r(0,ve=De.hovered),"eventsIfTopMost"in De&&r(13,we=De.eventsIfTopMost),"interactive"in De&&r(14,Ie=De.interactive),"$$scope"in De&&r(23,p=De.$$scope)},[ve,g,x,f,C,R,z,M,F,Y,W,pe,me,we,Ie,l,Pe,Re,Ve,Fe,ze,Ge,yt,p]}class a8 extends Zi{constructor(e){super(),Wi(this,e,OB,RB,yi,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function DB(t,e,r){let l;const{map:p}=Pc();er(t,p,C=>r(4,l=C));let{position:g="top-left"}=e,{container:x=void 0}=e,f=null;return dl(()=>{l!=null&&l.loaded()&&f&&l.removeControl(f)}),t.$$set=C=>{"position"in C&&r(1,g=C.position),"container"in C&&r(2,x=C.container)},t.$$.update=()=>{if(t.$$.dirty&30&&l&&!f){let C;typeof x=="string"?C=document.querySelector(x)??void 0:C=x,r(3,f=new us.FullscreenControl({container:C})),l.addControl(f,g)}},[p,g,x,f,l]}class NB extends Zi{constructor(e){super(),Wi(this,e,DB,null,yi,{position:1,container:2})}}function zB(t,e,r,l,p){let g=!1;t.getSource(e)&&(g=!0,t.removeSource(e));const x=()=>{l(e)&&(t.addSource(e,r),p())};if(g){const f=()=>{e&&(t.getSource(e)?setTimeout(f,1):x())};f()}else x()}function FB(t,e,r){pT().then(()=>{let l=nT(t);if(!l)return;l.getSource(e)===r&&l.removeSource(e)})}function ew(t){let e=t[0],r,l,p=tw(t);return{c(){p.c(),r=ml()},m(g,x){p.m(g,x),Fn(g,r,x),l=!0},p(g,x){x&1&&yi(e,e=g[0])?(_s(),en(p,1,1,tr),vs(),p=tw(g),p.c(),Vt(p,1),p.m(r.parentNode,r)):p.p(g,x)},i(g){l||(Vt(p),l=!0)},o(g){en(p),l=!1},d(g){g&&Mn(r),p.d(g)}}}function tw(t){let e;const r=t[19].default,l=ps(r,t,t[18],null);return{c(){l&&l.c()},m(p,g){l&&l.m(p,g),e=!0},p(p,g){l&&l.p&&(!e||g&262144)&&gs(l,r,p,p[18],e?ms(r,p[18],g,null):ys(p[18]),null)},i(p){e||(Vt(l,p),e=!0)},o(p){en(l,p),e=!1},d(p){l&&l.d(p)}}}function BB(t){let e,r,l=t[0]&&ew(t);return{c(){l&&l.c(),e=ml()},m(p,g){l&&l.m(p,g),Fn(p,e,g),r=!0},p(p,[g]){p[0]?l?(l.p(p,g),g&1&&Vt(l,1)):(l=ew(p),l.c(),Vt(l,1),l.m(e.parentNode,e)):l&&(_s(),en(l,1,1,()=>{l=null}),vs())},i(p){r||(Vt(l),r=!0)},o(p){en(l),r=!1},d(p){p&&Mn(e),l&&l.d(p)}}}function UB(t,e,r){let l,p,g,{$$slots:x={},$$scope:f}=e,{id:C=Ep("geojson")}=e,{data:R}=e,{generateId:z=!1}=e,{promoteId:M=void 0}=e,{filter:F=void 0}=e,{lineMetrics:Y=void 0}=e,{cluster:W=void 0}=e,{maxzoom:pe=void 0}=e,{attribution:me=void 0}=e,{buffer:ve=void 0}=e,{tolerance:we=void 0}=e;const{map:Ie,cluster:Pe,self:Re}=EB();er(t,Ie,ze=>r(17,p=ze)),er(t,Pe,ze=>r(20,g=ze)),er(t,Re,ze=>r(0,l=ze));let Ve,Fe=!0;return dl(()=>{l&&Ve&&p&&(FB(Ie,l,Ve),hl(Re,l=null,l),r(15,Ve=void 0))}),t.$$set=ze=>{"id"in ze&&r(4,C=ze.id),"data"in ze&&r(5,R=ze.data),"generateId"in ze&&r(6,z=ze.generateId),"promoteId"in ze&&r(7,M=ze.promoteId),"filter"in ze&&r(8,F=ze.filter),"lineMetrics"in ze&&r(9,Y=ze.lineMetrics),"cluster"in ze&&r(10,W=ze.cluster),"maxzoom"in ze&&r(11,pe=ze.maxzoom),"attribution"in ze&&r(12,me=ze.attribution),"buffer"in ze&&r(13,ve=ze.buffer),"tolerance"in ze&&r(14,we=ze.tolerance),"$$scope"in ze&&r(18,f=ze.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&hl(Pe,g=W,g),t.$$.dirty&196593&&p&&l!==C&&(hl(Re,l=C,l),zB(p,l,cp({type:"geojson",data:R,filter:F,lineMetrics:Y,generateId:z,promoteId:M,cluster:!!W,clusterMinPoints:W==null?void 0:W.minPoints,clusterMaxZoom:W==null?void 0:W.maxZoom,clusterRadius:W==null?void 0:W.radius,clusterProperties:W==null?void 0:W.properties,maxzoom:pe,attribution:me,buffer:ve,tolerance:we}),ze=>p&&ze===l,()=>{l&&(r(15,Ve=p==null?void 0:p.getSource(l)),r(16,Fe=!0))})),t.$$.dirty&131088&&(p==null||p.on("style.load",()=>{r(15,Ve=p==null?void 0:p.getSource(C))})),t.$$.dirty&98336&&Ve&&(Fe?r(16,Fe=!1):Ve.setData(R)),t.$$.dirty&33792&&(Ve==null||Ve.setClusterOptions(cp({cluster:!!W,clusterMaxZoom:W==null?void 0:W.maxZoom,clusterRadius:W==null?void 0:W.radius})))},[l,Ie,Pe,Re,C,R,z,M,F,Y,W,pe,me,ve,we,Ve,Fe,p,f,x]}class l8 extends Zi{constructor(e){super(),Wi(this,e,UB,BB,yi,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10,maxzoom:11,attribution:12,buffer:13,tolerance:14})}}function jB(t,e,r){let l;const{map:p}=Pc();er(t,p,F=>r(8,l=F));let{position:g="top-left"}=e,{positionOptions:x=void 0}=e,{fitBoundsOptions:f=void 0}=e,{trackUserLocation:C=!1}=e,{showAccuracyCircle:R=!0}=e,{showUserLocation:z=!0}=e,{control:M=null}=e;return dl(()=>{l!=null&&l.loaded()&&M&&l.removeControl(M)}),t.$$set=F=>{"position"in F&&r(2,g=F.position),"positionOptions"in F&&r(3,x=F.positionOptions),"fitBoundsOptions"in F&&r(4,f=F.fitBoundsOptions),"trackUserLocation"in F&&r(5,C=F.trackUserLocation),"showAccuracyCircle"in F&&r(6,R=F.showAccuracyCircle),"showUserLocation"in F&&r(7,z=F.showUserLocation),"control"in F&&r(1,M=F.control)},t.$$.update=()=>{t.$$.dirty&510&&l&&!M&&(r(1,M=new us.GeolocateControl({positionOptions:x,fitBoundsOptions:f,trackUserLocation:C,showAccuracyCircle:R,showUserLocation:z})),l.addControl(M,g))},[p,M,g,x,f,C,R,z,l]}class VB extends Zi{constructor(e){super(),Wi(this,e,jB,null,yi,{position:2,positionOptions:3,fitBoundsOptions:4,trackUserLocation:5,showAccuracyCircle:6,showUserLocation:7,control:1})}}function qB(t){let e;const r=t[15].default,l=ps(r,t,t[23],null);return{c(){l&&l.c()},m(p,g){l&&l.m(p,g),e=!0},p(p,g){l&&l.p&&(!e||g&8388608)&&gs(l,r,p,p[23],e?ms(r,p[23],g,null):ys(p[23]),null)},i(p){e||(Vt(l,p),e=!0)},o(p){en(l,p),e=!1},d(p){l&&l.d(p)}}}function GB(t){let e,r,l;function p(x){t[16](x)}let g={id:t[1],type:"line",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[qB]},$$scope:{ctx:t}};return t[0]!==void 0&&(g.hovered=t[0]),e=new iE({props:g}),Ea.push(()=>kd(e,"hovered",p)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){po(e.$$.fragment)},m(x,f){to(e,x,f),l=!0},p(x,[f]){const C={};f&2&&(C.id=x[1]),f&4&&(C.source=x[2]),f&8&&(C.sourceLayer=x[3]),f&16&&(C.beforeId=x[4]),f&32&&(C.beforeLayerType=x[5]),f&64&&(C.paint=x[6]),f&128&&(C.layout=x[7]),f&256&&(C.filter=x[8]),f&512&&(C.minzoom=x[9]),f&1024&&(C.maxzoom=x[10]),f&2048&&(C.hoverCursor=x[11]),f&4096&&(C.manageHoverState=x[12]),f&8192&&(C.eventsIfTopMost=x[13]),f&16384&&(C.interactive=x[14]),f&8388608&&(C.$$scope={dirty:f,ctx:x}),!r&&f&1&&(r=!0,C.hovered=x[0],Sd(()=>r=!1)),e.$set(C)},i(x){l||(Vt(e.$$.fragment,x),l=!0)},o(x){en(e.$$.fragment,x),l=!1},d(x){no(e,x)}}}function HB(t,e,r){let{$$slots:l={},$$scope:p}=e,{id:g=Ep("line")}=e,{source:x=void 0}=e,{sourceLayer:f=void 0}=e,{beforeId:C=void 0}=e,{beforeLayerType:R=void 0}=e,{paint:z}=e,{layout:M=void 0}=e,{filter:F=void 0}=e,{minzoom:Y=void 0}=e,{maxzoom:W=void 0}=e,{hoverCursor:pe=void 0}=e,{manageHoverState:me=!1}=e,{hovered:ve=null}=e,{eventsIfTopMost:we=!1}=e,{interactive:Ie=!0}=e;function Pe(De){ve=De,r(0,ve)}function Re(De){jr.call(this,t,De)}function Ve(De){jr.call(this,t,De)}function Fe(De){jr.call(this,t,De)}function ze(De){jr.call(this,t,De)}function Ge(De){jr.call(this,t,De)}function yt(De){jr.call(this,t,De)}return t.$$set=De=>{"id"in De&&r(1,g=De.id),"source"in De&&r(2,x=De.source),"sourceLayer"in De&&r(3,f=De.sourceLayer),"beforeId"in De&&r(4,C=De.beforeId),"beforeLayerType"in De&&r(5,R=De.beforeLayerType),"paint"in De&&r(6,z=De.paint),"layout"in De&&r(7,M=De.layout),"filter"in De&&r(8,F=De.filter),"minzoom"in De&&r(9,Y=De.minzoom),"maxzoom"in De&&r(10,W=De.maxzoom),"hoverCursor"in De&&r(11,pe=De.hoverCursor),"manageHoverState"in De&&r(12,me=De.manageHoverState),"hovered"in De&&r(0,ve=De.hovered),"eventsIfTopMost"in De&&r(13,we=De.eventsIfTopMost),"interactive"in De&&r(14,Ie=De.interactive),"$$scope"in De&&r(23,p=De.$$scope)},[ve,g,x,f,C,R,z,M,F,Y,W,pe,me,we,Ie,l,Pe,Re,Ve,Fe,ze,Ge,yt,p]}class u8 extends Zi{constructor(e){super(),Wi(this,e,HB,GB,yi,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function WB(t){let e=t.getCenter(),r=Math.round(t.getZoom()*100)/100,l=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,l),g=Math.round(e.lat*p)/p,x=Math.round(e.lng*p)/p,f=`${r}/${g}/${x}`,C=t.getBearing(),R=t.getPitch();return(C||R)&&(f+=`/${Math.round(C*10)/10}`),R&&(f+=`/${Math.round(R)}`),`#${f}`}function ZB(t){return t.replace("#","").split("/").map(parseFloat)}function YB(t,e,r){let l;const{map:p}=Pc();er(t,p,z=>r(6,l=z));let{position:g="top-left"}=e,{showCompass:x=!0}=e,{showZoom:f=!0}=e,{visualizePitch:C=!1}=e,R=null;return dl(()=>{l!=null&&l.loaded()&&R&&l.removeControl(R)}),t.$$set=z=>{"position"in z&&r(1,g=z.position),"showCompass"in z&&r(2,x=z.showCompass),"showZoom"in z&&r(3,f=z.showZoom),"visualizePitch"in z&&r(4,C=z.visualizePitch)},t.$$.update=()=>{t.$$.dirty&126&&l&&!R&&(r(5,R=new us.NavigationControl({showCompass:x,showZoom:f,visualizePitch:C})),l.addControl(R,g))},[p,g,x,f,C,R,l]}class rE extends Zi{constructor(e){super(),Wi(this,e,YB,null,yi,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function XB(t,e,r){let l;const{map:p}=Pc();er(t,p,R=>r(5,l=R));let{position:g="bottom-left"}=e,{maxWidth:x=void 0}=e,{unit:f="metric"}=e,C=null;return dl(()=>{l!=null&&l.loaded()&&C&&l.removeControl(C)}),t.$$set=R=>{"position"in R&&r(1,g=R.position),"maxWidth"in R&&r(2,x=R.maxWidth),"unit"in R&&r(3,f=R.unit)},t.$$.update=()=>{t.$$.dirty&62&&l&&!C&&(r(4,C=new us.ScaleControl({maxWidth:x,unit:f})),l.addControl(C,g))},[p,g,x,f,C,l]}class oE extends Zi{constructor(e){super(),Wi(this,e,XB,null,yi,{position:1,maxWidth:2,unit:3})}}const{window:$B}=oT,KB=t=>({map:t[0]&16,loadedImages:t[0]&32,allImagesLoaded:t[0]&64}),nw=t=>({map:t[4],loadedImages:t[5],allImagesLoaded:t[6]});function iw(t){let e,r,l=t[3]&&rw(t);const p=t[40].default,g=ps(p,t,t[39],nw);return{c(){l&&l.c(),e=qr(),g&&g.c()},m(x,f){l&&l.m(x,f),Fn(x,e,f),g&&g.m(x,f),r=!0},p(x,f){x[3]?l?(l.p(x,f),f[0]&8&&Vt(l,1)):(l=rw(x),l.c(),Vt(l,1),l.m(e.parentNode,e)):l&&(_s(),en(l,1,1,()=>{l=null}),vs()),g&&g.p&&(!r||f[0]&112|f[1]&256)&&gs(g,p,x,x[39],r?ms(p,x[39],f,KB):ys(x[39]),nw)},i(x){r||(Vt(l),Vt(g,x),r=!0)},o(x){en(l),en(g,x),r=!1},d(x){x&&Mn(e),l&&l.d(x),g&&g.d(x)}}}function rw(t){let e,r,l,p,g,x,f,C;return e=new rE({props:{position:t[7]}}),l=new VB({props:{position:t[7],fitBoundsOptions:{maxZoom:12}}}),g=new NB({props:{position:t[7]}}),f=new oE({props:{position:t[7]}}),{c(){po(e.$$.fragment),r=qr(),po(l.$$.fragment),p=qr(),po(g.$$.fragment),x=qr(),po(f.$$.fragment)},m(R,z){to(e,R,z),Fn(R,r,z),to(l,R,z),Fn(R,p,z),to(g,R,z),Fn(R,x,z),to(f,R,z),C=!0},p(R,z){const M={};z[0]&128&&(M.position=R[7]),e.$set(M);const F={};z[0]&128&&(F.position=R[7]),l.$set(F);const Y={};z[0]&128&&(Y.position=R[7]),g.$set(Y);const W={};z[0]&128&&(W.position=R[7]),f.$set(W)},i(R){C||(Vt(e.$$.fragment,R),Vt(l.$$.fragment,R),Vt(g.$$.fragment,R),Vt(f.$$.fragment,R),C=!0)},o(R){en(e.$$.fragment,R),en(l.$$.fragment,R),en(g.$$.fragment,R),en(f.$$.fragment,R),C=!1},d(R){R&&(Mn(r),Mn(p),Mn(x)),no(e,R),no(l,R),no(g,R),no(f,R)}}}function JB(t){let e,r,l,p,g,x=t[4]&&t[0]&&iw(t);return{c(){e=si("div"),x&&x.c(),bn(e,"class",r=Kv(t[2])+" svelte-p00lfq"),bn(e,"data-testid","map-container"),Us(e,"expand-map",!t[2])},m(f,C){Fn(f,e,C),x&&x.m(e,null),t[41](e),l=!0,p||(g=[wa($B,"hashchange",t[11]),rT(t[10].call(null,e))],p=!0)},p(f,C){f[4]&&f[0]?x?(x.p(f,C),C[0]&17&&Vt(x,1)):(x=iw(f),x.c(),Vt(x,1),x.m(e,null)):x&&(_s(),en(x,1,1,()=>{x=null}),vs()),(!l||C[0]&4&&r!==(r=Kv(f[2])+" svelte-p00lfq"))&&bn(e,"class",r),(!l||C[0]&4)&&Us(e,"expand-map",!f[2])},i(f){l||(Vt(x),l=!0)},o(f){en(x),l=!1},d(f){f&&Mn(e),x&&x.d(),t[41](null),p=!1,Gs(g)}}}function QB(t,e,r){let l,p,g,x,{$$slots:f={},$$scope:C}=e,{map:R=null}=e,{mapContainer:z=void 0}=e,{class:M=void 0}=e,{style:F}=e,{diffStyleUpdates:Y=!1}=e,{center:W=void 0}=e,{zoom:pe=void 0}=e,{pitch:me=0}=e,{bearing:ve=0}=e,{bounds:we=void 0}=e,{hash:Ie=!1}=e,{updateHash:Pe=Se=>{window.history.replaceState(window.history.state,"",Se)}}=e,{loaded:Re=!1}=e,{minZoom:Ve=0}=e,{maxZoom:Fe=22}=e,{antialias:ze=void 0}=e,{zoomOnDoubleClick:Ge=!0}=e,{locale:yt=void 0}=e,{interactive:De=!0}=e,{attributionControl:mt=!0}=e,{cooperativeGestures:xt=!1}=e,{preserveDrawingBuffer:Je=!1}=e,{maxBounds:St=void 0}=e,{images:Ct=[]}=e,{standardControls:vt=!1}=e,{filterLayers:Gt=void 0}=e,{transformRequest:an=void 0}=e;const ut=vy(),{map:tn,loadedImages:Nt}=kB();er(t,tn,Se=>r(4,g=Se)),er(t,Nt,Se=>r(5,x=Se));let on=new Set;async function Et(Se,Ue=!1){if(g&&!(!g.loaded()&&!Ue))if("url"in Se){on.add(Se.id);try{let Ot=await g.loadImage(Se.url);g==null||g.addImage(Se.id,Ot.data,Se.options),x.add(Se.id),Nt.set(x)}catch(Ot){ut("error",Ot)}finally{on.delete(Se.id)}}else g.addImage(Se.id,Se.data,Se.options),x.add(Se.id),Nt.set(x)}let gn,wn,In,Ae;function zi(Se){return bt(),hl(tn,g=new us.Map(cp({container:Se,style:F,locale:yt,center:W,zoom:pe,pitch:me,bearing:ve,minZoom:Ve,maxZoom:Fe,antialias:ze,interactive:De,preserveDrawingBuffer:Je,maxBounds:St,bounds:we,attributionControl:mt,transformRequest:an,cooperativeGestures:xt})),g),g.on("load",Ue=>{Ue.target.getContainer().setAttribute("data-testid","map"),Ue.target.getCanvas().setAttribute("data-testid","map-canvas"),r(0,Re=!0),ut("load",g)}),g.on("error",Ue=>ut("error",{...Ue,map:g})),g.on("movestart",Ue=>ut("movestart",{...Ue,map:g})),g.on("moveend",Ue=>{if(r(12,W=Ue.target.getCenter()),r(13,pe=Ue.target.getZoom()),r(14,me=Ue.target.getPitch()),r(15,ve=Ue.target.getBearing()),r(16,we=Ue.target.getBounds()),ut("moveend",{...Ue,map:g}),Ie){let Ot=new URL(window.location.href.replace(/(#.+)?$/,WB(g)));Pe(Ot)}}),g.on("click",Ue=>ut("click",{...Ue,map:g})),g.on("dblclick",Ue=>ut("dblclick",{...Ue,map:g})),g.on("contextmenu",Ue=>ut("contextmenu",{...Ue,map:g})),g.on("zoomstart",Ue=>ut("zoomstart",{...Ue,map:g})),g.on("zoom",Ue=>{ut("zoom",{...Ue,map:g})}),g.on("zoomend",Ue=>{ut("zoomend",{...Ue,map:g})}),g.on("style.load",()=>{if(g){const Ue=g.getStyle();if(r(36,gn=Ue.layers.map(Ot=>Ot.id)),r(37,wn=Object.keys(Ue.sources)),Ae)for(const[Ot,Rn]of Object.entries(Ae))g.addSource(Ot,Rn);if(In)for(const Ot of In)g.addLayer(Ot);for(const Ot of Ct)Et(Ot,!0)}}),g.on("styledata",Ue=>{if(g&&Gt){const Ot=g.getStyle().layers;if(Ot)for(let Rn of Ot)Gt(Rn)||g.setLayoutProperty(Rn.id,"visibility","none")}ut("styledata",{...Ue,map:g})}),{destroy(){r(0,Re=!1),g==null||g.remove(),hl(tn,g=null,g)}}}let $t=F;function bt(){if(Ie){let Se=ZB(window.location.hash);Se.length>=3&&(r(13,pe=Se[0]),r(12,W=[Se[2],Se[1]])),Se.length==5&&(r(15,ve=Se[3]),r(14,me=Se[4]))}}function fe(Se){Ea[Se?"unshift":"push"](()=>{z=Se,r(1,z)})}return t.$$set=Se=>{"map"in Se&&r(17,R=Se.map),"mapContainer"in Se&&r(1,z=Se.mapContainer),"class"in Se&&r(2,M=Se.class),"style"in Se&&r(18,F=Se.style),"diffStyleUpdates"in Se&&r(19,Y=Se.diffStyleUpdates),"center"in Se&&r(12,W=Se.center),"zoom"in Se&&r(13,pe=Se.zoom),"pitch"in Se&&r(14,me=Se.pitch),"bearing"in Se&&r(15,ve=Se.bearing),"bounds"in Se&&r(16,we=Se.bounds),"hash"in Se&&r(20,Ie=Se.hash),"updateHash"in Se&&r(21,Pe=Se.updateHash),"loaded"in Se&&r(0,Re=Se.loaded),"minZoom"in Se&&r(22,Ve=Se.minZoom),"maxZoom"in Se&&r(23,Fe=Se.maxZoom),"antialias"in Se&&r(24,ze=Se.antialias),"zoomOnDoubleClick"in Se&&r(25,Ge=Se.zoomOnDoubleClick),"locale"in Se&&r(26,yt=Se.locale),"interactive"in Se&&r(27,De=Se.interactive),"attributionControl"in Se&&r(28,mt=Se.attributionControl),"cooperativeGestures"in Se&&r(29,xt=Se.cooperativeGestures),"preserveDrawingBuffer"in Se&&r(30,Je=Se.preserveDrawingBuffer),"maxBounds"in Se&&r(31,St=Se.maxBounds),"images"in Se&&r(32,Ct=Se.images),"standardControls"in Se&&r(3,vt=Se.standardControls),"filterLayers"in Se&&r(33,Gt=Se.filterLayers),"transformRequest"in Se&&r(34,an=Se.transformRequest),"$$scope"in Se&&r(39,C=Se.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&8&&r(7,l=typeof vt=="boolean"?void 0:vt),t.$$.dirty[0]&16&&r(17,R=g),t.$$.dirty[0]&786448|t.$$.dirty[1]&224&&g&&!Xu(F,$t)){const Se=g.getStyle();if(gn&&(In=Se.layers.filter(Ue=>!gn.includes(Ue.id))),wn){const Ue=Object.keys(Se.sources).filter(Ot=>!wn.includes(Ot));Ae={};for(const Ot of Ue)Ae[Ot]=Se.sources[Ot]}r(38,$t=F),g.setStyle(F,{diff:Y}),hl(Nt,x=new Set,x),r(35,on=new Set)}if(t.$$.dirty[0]&49|t.$$.dirty[1]&18&&Re&&g!=null&&g.loaded())for(let Se of Ct)!x.has(Se.id)&&!on.has(Se.id)&&!g.hasImage(Se.id)&&Et(Se);if(t.$$.dirty[0]&32|t.$$.dirty[1]&2&&r(6,p=Ct.every(Se=>x.has(Se.id))),t.$$.dirty[0]&61456&&g){let Se={};W!=null&&!Xu(W,g==null?void 0:g.getCenter())&&(Se.center=W),pe!=null&&!Xu(pe,g==null?void 0:g.getZoom())&&(Se.zoom=pe),ve!=null&&!Xu(ve,g==null?void 0:g.getBearing())&&(Se.bearing=ve),me!=null&&!Xu(me,g==null?void 0:g.getPitch())&&(Se.pitch=me),Object.keys(Se).length&&g.easeTo(Se)}t.$$.dirty[0]&65552&&we&&!Xu(we,g==null?void 0:g.getBounds())&&(g==null||g.fitBounds(we)),t.$$.dirty[0]&33554448&&(Ge?g==null||g.doubleClickZoom.enable():g==null||g.doubleClickZoom.disable())},[Re,z,M,vt,g,x,p,l,tn,Nt,zi,bt,W,pe,me,ve,we,R,F,Y,Ie,Pe,Ve,Fe,ze,Ge,yt,De,mt,xt,Je,St,Ct,Gt,an,on,gn,wn,$t,C,f,fe]}class e6 extends Zi{constructor(e){super(),Wi(this,e,QB,JB,yi,{map:17,mapContainer:1,class:2,style:18,diffStyleUpdates:19,center:12,zoom:13,pitch:14,bearing:15,bounds:16,hash:20,updateHash:21,loaded:0,minZoom:22,maxZoom:23,antialias:24,zoomOnDoubleClick:25,locale:26,interactive:27,attributionControl:28,cooperativeGestures:29,preserveDrawingBuffer:30,maxBounds:31,images:32,standardControls:3,filterLayers:33,transformRequest:34},null,[-1,-1])}}const t6=t=>({features:t[0]&16,data:t[0]&16,map:t[0]&4,close:t[0]&1}),ow=t=>{var e;return{features:t[4],data:(e=t[4])==null?void 0:e[0],map:t[2],close:t[31]}};function sw(t){let e,r,l=(t[4]||t[3]instanceof us.Marker)&&aw(t);return{c(){e=si("div"),l&&l.c()},m(p,g){Fn(p,e,g),l&&l.m(e,null),t[32](e),r=!0},p(p,g){p[4]||p[3]instanceof us.Marker?l?(l.p(p,g),g[0]&24&&Vt(l,1)):(l=aw(p),l.c(),Vt(l,1),l.m(e,null)):l&&(_s(),en(l,1,1,()=>{l=null}),vs())},i(p){r||(Vt(l),r=!0)},o(p){en(l),r=!1},d(p){p&&Mn(e),l&&l.d(),t[32](null)}}}function aw(t){let e;const r=t[30].default,l=ps(r,t,t[29],ow);return{c(){l&&l.c()},m(p,g){l&&l.m(p,g),e=!0},p(p,g){l&&l.p&&(!e||g[0]&536870933)&&gs(l,r,p,p[29],e?ms(r,p[29],g,t6):ys(p[29]),ow)},i(p){e||(Vt(l,p),e=!0)},o(p){en(l,p),e=!1},d(p){l&&l.d(p)}}}function n6(t){let e,r,l=t[9].default&&sw(t);return{c(){l&&l.c(),e=ml()},m(p,g){l&&l.m(p,g),Fn(p,e,g),r=!0},p(p,g){p[9].default?l?(l.p(p,g),g[0]&512&&Vt(l,1)):(l=sw(p),l.c(),Vt(l,1),l.m(e.parentNode,e)):l&&(_s(),en(l,1,1,()=>{l=null}),vs())},i(p){r||(Vt(l),r=!0)},o(p){en(l),r=!1},d(p){p&&Mn(e),l&&l.d(p)}}}function i6(t,e,r){let l,p,g,x,f,C,{$$slots:R={},$$scope:z}=e;const M=iT(R);let{closeButton:F=void 0}=e,{closeOnClickOutside:Y=!0}=e,{closeOnClickInside:W=!1}=e,{closeOnMove:pe=!1}=e,{openOn:me="click"}=e,{openIfTopMost:ve=!0}=e,{focusAfterOpen:we=!0}=e,{anchor:Ie=void 0}=e,{offset:Pe=void 0}=e,{popupClass:Re=void 0}=e,{maxWidth:Ve=void 0}=e,{lngLat:Fe=void 0}=e,{html:ze=void 0}=e,{open:Ge=!1}=e;const yt=vy(),{map:De,popupTarget:mt,layerEvent:xt,layer:Je,eventTopMost:St}=Pc();er(t,De,Ue=>r(2,g=Ue)),er(t,mt,Ue=>r(3,f=Ue)),er(t,xt,Ue=>r(28,x=Ue)),er(t,Je,Ue=>r(35,C=Ue));const Ct=["click","dblclick","contextmenu"];let vt,Gt=!1,an;function ut(){if(!vt)return;let Ue=vt.getElement();!Ue||Ue===an||(an=Ue,me==="hover"&&(an.style.pointerEvents="none"),an.addEventListener("mouseenter",()=>{r(24,Gt=!0)},{passive:!0}),an.addEventListener("mouseleave",()=>{r(24,Gt=!1)},{passive:!0}),an.addEventListener("click",()=>{W&&r(0,Ge=!1)},{passive:!0}))}dw(()=>{if(g)return g.on("click",$t),g.on("contextmenu",$t),typeof f=="string"&&(g.on("click",f,Et),g.on("dblclick",f,Et),g.on("contextmenu",f,Et),g.on("mousemove",f,zi),g.on("mouseleave",f,Ae),g.on("touchstart",f,wn),g.on("touchend",f,In)),()=>{g!=null&&g.loaded()&&(vt==null||vt.remove(),g.off("click",$t),g.off("contextmenu",$t),f instanceof us.Marker?f.getPopup()===vt&&f.setPopup(void 0):typeof f=="string"&&(g.off("click",f,Et),g.off("dblclick",f,Et),g.off("contextmenu",f,Et),g.off("mousemove",f,zi),g.off("mouseleave",f,Ae),g.off("touchstart",f,wn),g.off("touchend",f,In)))}});function tn(Ue){return ve?!("marker"in Ue)&&!TB(Ue)&&St(Ue)!==C:!1}let Nt=null,on="normal";function Et(Ue){Ue.type===me&&(tn(Ue)||("layerType"in Ue?Ue.layerType==="deckgl"?(r(10,Fe=Ue.coordinate),r(4,Nt=Ue.object?[Ue.object]:null)):(r(10,Fe=Ue.lngLat),r(4,Nt=Ue.features??[])):(r(10,Fe=Ue.lngLat),r(4,Nt=Ue.features??[])),setTimeout(()=>r(0,Ge=!0))))}let gn=null;function wn(Ue){gn=Ue.point}function In(Ue){if(!gn||me!=="hover")return;let Ot=gn.dist(Ue.point);gn=null,Ot<3&&(r(10,Fe=Ue.lngLat),r(4,Nt=Ue.features??[]),vt.isOpen()?r(25,on="justOpened"):(r(25,on="opening"),r(0,Ge=!0)))}function Ae(Ue){me!=="hover"||gn||on!=="normal"||(r(0,Ge=!1),r(4,Nt=null))}function zi(Ue){if(!(me!=="hover"||gn||on!=="normal")){if(tn(Ue)){r(0,Ge=!1),r(4,Nt=null);return}r(0,Ge=!0),r(4,Nt=Ue.features??[]),r(10,Fe=Ue.lngLat)}}function $t(Ue){if(on==="justOpened"){r(25,on="normal");return}if(!Y)return;let Ot=[an,f instanceof us.Marker?f==null?void 0:f.getElement():null];Ge&&vt.isOpen()&&!Ot.some(Rn=>Rn==null?void 0:Rn.contains(Ue.originalEvent.target))&&(Ue.type==="contextmenu"&&me==="contextmenu"||Ue.type!=="contextmenu")&&r(0,Ge=!1)}dl(()=>{g&&(vt!=null&&vt.isOpen())&&vt.remove()});let bt;const fe=()=>r(0,Ge=!1);function Se(Ue){Ea[Ue?"unshift":"push"](()=>{bt=Ue,r(1,bt)})}return t.$$set=Ue=>{"closeButton"in Ue&&r(11,F=Ue.closeButton),"closeOnClickOutside"in Ue&&r(12,Y=Ue.closeOnClickOutside),"closeOnClickInside"in Ue&&r(13,W=Ue.closeOnClickInside),"closeOnMove"in Ue&&r(14,pe=Ue.closeOnMove),"openOn"in Ue&&r(15,me=Ue.openOn),"openIfTopMost"in Ue&&r(16,ve=Ue.openIfTopMost),"focusAfterOpen"in Ue&&r(17,we=Ue.focusAfterOpen),"anchor"in Ue&&r(18,Ie=Ue.anchor),"offset"in Ue&&r(19,Pe=Ue.offset),"popupClass"in Ue&&r(20,Re=Ue.popupClass),"maxWidth"in Ue&&r(21,Ve=Ue.maxWidth),"lngLat"in Ue&&r(10,Fe=Ue.lngLat),"html"in Ue&&r(22,ze=Ue.html),"open"in Ue&&r(0,Ge=Ue.open),"$$scope"in Ue&&r(29,z=Ue.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&14336&&r(27,l=F??(!Y&&!W)),t.$$.dirty[0]&146685952&&(vt||(r(23,vt=new us.Popup({closeButton:l,closeOnClick:!1,closeOnMove:pe,focusAfterOpen:we,maxWidth:Ve,className:Re,anchor:Ie,offset:Pe})),an=vt.getElement(),vt.on("open",()=>{r(0,Ge=!0),ut(),yt("open",vt)}),vt.on("close",()=>{r(0,Ge=!1),yt("close",vt)}),vt.on("hover",()=>{yt("hover",vt)}))),t.$$.dirty[0]&8421384&&vt&&f instanceof us.Marker&&(me==="click"?f.setPopup(vt):f.getPopup()===vt&&f.setPopup(void 0)),t.$$.dirty[0]&268468224&&Ct.includes(me)&&(x==null?void 0:x.type)===me&&(Et(x),hl(xt,x=null,x)),t.$$.dirty[0]&268468224&&r(26,p=me==="hover"&&((x==null?void 0:x.type)==="mousemove"||(x==null?void 0:x.type)==="mouseenter")),t.$$.dirty[0]&352354304&&me==="hover"&&xt&&(p&&x&&(x.layerType==="deckgl"?(r(10,Fe=x.coordinate),r(4,Nt=x.object?[x.object]:null)):(r(10,Fe=x.lngLat),r(4,Nt=x.features??[]))),r(0,Ge=(p||Gt)??!1)),t.$$.dirty[0]&12582914&&(bt?vt.setDOMContent(bt):ze&&vt.setHTML(ze)),t.$$.dirty[0]&8389632&&Fe&&vt.setLngLat(Fe),t.$$.dirty[0]&41943045&&g){let Ue=vt.isOpen();Ge&&!Ue?(vt.addTo(g),on==="opening"&&r(25,on="justOpened")):!Ge&&Ue&&vt.remove()}},[Ge,bt,g,f,Nt,De,mt,xt,Je,M,Fe,F,Y,W,pe,me,ve,we,Ie,Pe,Re,Ve,ze,vt,Gt,on,p,l,x,z,R,fe,Se]}class c8 extends Zi{constructor(e){super(),Wi(this,e,i6,n6,yi,{closeButton:11,closeOnClickOutside:12,closeOnClickInside:13,closeOnMove:14,openOn:15,openIfTopMost:16,focusAfterOpen:17,anchor:18,offset:19,popupClass:20,maxWidth:21,lngLat:10,html:22,open:0},null,[-1,-1])}}/*! js-cookie v3.0.5 | MIT */function td(t){for(var e=1;e"u")){x=td({},e,x),typeof x.expires=="number"&&(x.expires=new Date(Date.now()+x.expires*864e5)),x.expires&&(x.expires=x.expires.toUTCString()),p=encodeURIComponent(p).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var f="";for(var C in x)x[C]&&(f+="; "+C,x[C]!==!0&&(f+="="+x[C].split(";")[0]));return document.cookie=p+"="+t.write(g,p)+f}}function l(p){if(!(typeof document>"u"||arguments.length&&!p)){for(var g=document.cookie?document.cookie.split("; "):[],x={},f=0;fkd(e,"loaded",g)),Ea.push(()=>kd(e,"map",x)),e.$on("error",g6),{c(){po(e.$$.fragment)},m(C,R){to(e,C,R),p=!0},p(C,R){const z={};R&8&&(z.style=C[3]),R&1&&(z.bounds=C[0]),R&528&&(z.$$scope={dirty:R,ctx:C}),!r&&R&4&&(r=!0,z.loaded=C[2],Sd(()=>r=!1)),!l&&R&2&&(l=!0,z.map=C[1],Sd(()=>l=!1)),e.$set(z)},i(C){p||(Vt(e.$$.fragment,C),p=!0)},o(C){en(e.$$.fragment,C),p=!1},d(C){no(e,C)}}}function uw(t){let e,r,l,p,g;e=new oE({}),l=new rE({props:{position:"bottom-right",visualizePitch:!0}});const x=t[6].default,f=ps(x,t,t[9],null);return{c(){po(e.$$.fragment),r=qr(),po(l.$$.fragment),p=qr(),f&&f.c()},m(C,R){to(e,C,R),Fn(C,r,R),to(l,C,R),Fn(C,p,R),f&&f.m(C,R),g=!0},p(C,R){f&&f.p&&(!g||R&512)&&gs(f,x,C,C[9],g?ms(x,C[9],R,null):ys(C[9]),null)},i(C){g||(Vt(e.$$.fragment,C),Vt(l.$$.fragment,C),Vt(f,C),g=!0)},o(C){en(e.$$.fragment,C),en(l.$$.fragment,C),en(f,C),g=!1},d(C){C&&(Mn(r),Mn(p)),no(e,C),no(l,C),f&&f.d(C)}}}function p6(t){let e,r,l=t[4]&&uw(t);return{c(){l&&l.c(),e=ml()},m(p,g){l&&l.m(p,g),Fn(p,e,g),r=!0},p(p,g){p[4]?l?(l.p(p,g),g&16&&Vt(l,1)):(l=uw(p),l.c(),Vt(l,1),l.m(e.parentNode,e)):l&&(_s(),en(l,1,1,()=>{l=null}),vs())},i(p){r||(Vt(l),r=!0)},o(p){en(l),r=!1},d(p){p&&Mn(e),l&&l.d(p)}}}function m6(t){let e,r,l=t[3]&&lw(t);return{c(){e=si("div"),l&&l.c(),bn(e,"class","map svelte-12dpf1u")},m(p,g){Fn(p,e,g),l&&l.m(e,null),r=!0},p(p,[g]){p[3]?l?(l.p(p,g),g&8&&Vt(l,1)):(l=lw(p),l.c(),Vt(l,1),l.m(e,null)):l&&(_s(),en(l,1,1,()=>{l=null}),vs())},i(p){r||(Vt(l),r=!0)},o(p){en(l),r=!1},d(p){p&&Mn(e),l&&l.d()}}}function g6(t){console.error(`MapLibre error: ${t.detail.error}`)}function y6(t,e,r){let l;er(t,M1,W=>r(4,l=W));let{$$slots:p={},$$scope:g}=e,{style:x}=e,{startBounds:f=void 0}=e,C=null,R,z=!1;xy("setCamera",!window.location.hash),window.location.hash&&(f=void 0),dw(async()=>{r(3,C=await P1(x))});async function M(W){r(3,C=await P1(x));let pe=new URL(window.location.href);pe.searchParams.set("style",W),window.history.replaceState(null,"",pe.toString())}function F(W){z=W,r(2,z)}function Y(W){R=W,r(1,R)}return t.$$set=W=>{"style"in W&&r(5,x=W.style),"startBounds"in W&&r(0,f=W.startBounds),"$$scope"in W&&r(9,g=W.$$scope)},t.$$.update=()=>{t.$$.dirty&6&&z&&M1.set(R),t.$$.dirty&32&&M(x)},[f,R,z,C,l,x,p,F,Y,g]}class f8 extends Zi{constructor(e){super(),Wi(this,e,y6,m6,yi,{style:5,startBounds:0})}}const _6="Unable to save because the local storage quota has been exceeded: you may need to clear out your web browser's local storage for this app, or run in private mode before you can save again. Specific error here: ";function v6(){return{isQuotaError:!1,message:"",storedStrings:[]}}function d8(t,e){try{return window.localStorage.setItem(t,e),v6()}catch(r){return{isQuotaError:!0,message:_6+r,storedStrings:sE()}}}function sE(){let t=[];for(let e=0;er.storageUsedInMB-e.storageUsedInMB),t}function x6(t){return t.length/(1024*1024)}function p8(){window.localStorage.clear()}function m8(t){return window.localStorage.removeItem(t),sE()}async function g8(){let e=await(await fetch(WR)).json();return GR(e)}function aE(){if(window.location.hostname=="localhost")return"Local development";if(window.location.hostname=="acteng.github.io"){let t=window.location.pathname.split("/");if(t.length==3&&t[0]==""&&t[1]=="atip")return"Public (development)";if(t.length==4&&t[0]==""&&t[1]=="atip")return`Public (dev branch: ${t[2]})`}else if(window.location.hostname.endsWith(".appspot.com"))return"Private (development)";return"Unknown"}async function y8(t,e){let r=await fetch(t),l=r.body.getReader(),p=r.headers.get("Content-Length");if(!p)throw new Error(`No Content-Length header from ${t}`);let g=parseInt(p),x=0,f=[];for(;;){let{done:z,value:M}=await l.read();if(z)break;M&&(f.push(M),x+=M.length,e(100*x/g))}let C=new Uint8Array(x),R=0;for(let z of f)C.set(z,R),R+=z.length;return C}function _8(){return"https://atip.uk/layers"}function b6(){return"https://atip.uk/private_layers"}export{GT as $,F6 as A,d8 as B,a8 as C,s8 as D,Iw as E,FT as F,l8 as G,u8 as H,U6 as I,vc as J,Ew as K,h8 as L,f8 as M,Gs as N,ps as O,wd as P,Jv as Q,D6 as R,Zi as S,gs as T,ys as U,ms as V,yT as W,$v as X,jr as Y,i8 as Z,qh as _,qT as a,M1 as a$,z6 as a0,Tw as a1,Hi as a2,S6 as a3,tr as a4,ml as a5,_s as a6,vs as a7,Ep as a8,EB as a9,X6 as aA,Y6 as aB,hw as aC,Q6 as aD,c8 as aE,Vs as aF,GM as aG,M2 as aH,P2 as aI,jy as aJ,eo as aK,jo as aL,pp as aM,io as aN,rf as aO,e8 as aP,H6 as aQ,nT as aR,j6 as aS,m8 as aT,p8 as aU,r8 as aV,A6 as aW,t8 as aX,bB as aY,E6 as aZ,n8 as a_,dl as aa,FB as ab,hl as ac,zB as ad,cp as ae,Pc as af,vy as ag,CB as ah,t0 as ai,P6 as aj,L6 as ak,AB as al,oT as am,L2 as an,Uy as ao,dT as ap,M6 as aq,K6 as ar,sT as as,J6 as at,vB as au,e0 as av,$6 as aw,_B as ax,yB as ay,Z6 as az,Ea as b,V6 as b0,Kv as b1,iE as b2,us as b3,W6 as b4,_8 as b5,b6,C6 as b7,h6 as b8,d6 as b9,y8 as ba,iT as bb,hg as bc,I6 as bd,T6 as be,xR as bf,B6 as bg,aT as bh,Us as bi,k6 as bj,G6 as bk,q6 as bl,rT as bm,lT as bn,_y as bo,o8 as bp,kd as c,O6 as d,si as e,qr as f,aE as g,po as h,Wi as i,bn as j,Fn as k,oi as l,to as m,Sd as n,en as o,Mn as p,no as q,er as r,yi as s,Vt as t,dw as u,Ia as v,Qv as w,wa as x,R6 as y,g8 as z}; +`)}return s.toString()}},{key:"computeEdgeEndLabels",value:function(s){for(var u=this.iterator();u.hasNext();)u.next().computeLabel(s)}},{key:"computeLabelling",value:function(s){this.computeEdgeEndLabels(s[0].getBoundaryNodeRule()),this.propagateSideLabels(0),this.propagateSideLabels(1);for(var u=[!1,!1],h=this.iterator();h.hasNext();)for(var y=h.next().getLabel(),I=0;I<2;I++)y.isLine(I)&&y.getLocation(I)===fe.BOUNDARY&&(u[I]=!0);for(var O=this.iterator();O.hasNext();)for(var U=O.next(),H=U.getLabel(),te=0;te<2;te++)if(H.isAnyNull(te)){var ye=fe.NONE;if(u[te])ye=fe.EXTERIOR;else{var ke=U.getCoordinate();ye=this.getLocation(te,ke,s)}H.setAllLocationsIfNull(te,ye)}}},{key:"getDegree",value:function(){return this._edgeMap.size()}},{key:"insertEdgeEnd",value:function(s,u){this._edgeMap.put(s,u),this._edgeList=null}}],[{key:"constructor_",value:function(){this._edgeMap=new na,this._edgeList=null,this._ptInAreaLocation=[fe.NONE,fe.NONE]}}]),w}(),Fl=function(w){g(u,w);var s=Y(u);function u(){var h;return r(this,u),h=s.call(this),u.constructor_.apply(M(h),arguments),h}return p(u,[{key:"linkResultDirectedEdges",value:function(){this.getResultAreaEdges();for(var h=null,y=null,I=this._SCANNING_FOR_INCOMING,O=0;O=0;I--){var O=this._edgeList.get(I),U=O.getSym();y===null&&(y=U),h!==null&&U.setNext(h),h=O}y.setNext(h)}},{key:"computeDepths",value:function(){if(arguments.length===1){var h=arguments[0],y=this.findIndex(h),I=h.getDepth(ot.LEFT),O=h.getDepth(ot.RIGHT),U=this.computeDepths(y+1,this._edgeList.size(),I),H=this.computeDepths(0,y,U);if(H!==O)throw new Hn("depth mismatch at "+h.getCoordinate())}else if(arguments.length===3){for(var te=arguments[0],ye=arguments[1],ke=arguments[2],Ze=ke,nt=te;nt=0;U--){var H=this._resultAreaEdgeList.get(U),te=H.getSym();switch(y===null&&H.getEdgeRing()===h&&(y=H),O){case this._SCANNING_FOR_INCOMING:if(te.getEdgeRing()!==h)continue;I=te,O=this._LINKING_TO_OUTGOING;break;case this._LINKING_TO_OUTGOING:if(H.getEdgeRing()!==h)continue;I.setNextMin(H),O=this._SCANNING_FOR_INCOMING}}O===this._LINKING_TO_OUTGOING&&(Et.isTrue(y!==null,"found null for first outgoing dirEdge"),Et.isTrue(y.getEdgeRing()===h,"unable to link last incoming dirEdge"),I.setNextMin(y))}},{key:"getOutgoingDegree",value:function(){if(arguments.length===0){for(var h=0,y=this.iterator();y.hasNext();){var I=y.next();I.isInResult()&&h++}return h}if(arguments.length===1){for(var O=arguments[0],U=0,H=this.iterator();H.hasNext();){var te=H.next();te.getEdgeRing()===O&&U++}return U}}},{key:"getLabel",value:function(){return this._label}},{key:"findCoveredLineEdges",value:function(){for(var h=fe.NONE,y=this.iterator();y.hasNext();){var I=y.next(),O=I.getSym();if(!I.isLineEdge()){if(I.isInResult()){h=fe.INTERIOR;break}if(O.isInResult()){h=fe.EXTERIOR;break}}}if(h===fe.NONE)return null;for(var U=h,H=this.iterator();H.hasNext();){var te=H.next(),ye=te.getSym();te.isLineEdge()?te.getEdge().setCovered(U===fe.INTERIOR):(te.isInResult()&&(U=fe.EXTERIOR),ye.isInResult()&&(U=fe.INTERIOR))}}},{key:"computeLabelling",value:function(h){W(x(u.prototype),"computeLabelling",this).call(this,h),this._label=new Xi(fe.NONE);for(var y=this.iterator();y.hasNext();)for(var I=y.next().getEdge().getLabel(),O=0;O<2;O++){var U=I.getLocation(O);U!==fe.INTERIOR&&U!==fe.BOUNDARY||this._label.setLocation(O,fe.INTERIOR)}}}],[{key:"constructor_",value:function(){this._resultAreaEdgeList=null,this._label=null,this._SCANNING_FOR_INCOMING=1,this._LINKING_TO_OUTGOING=2}}]),u}(za),yu=function(w){g(u,w);var s=Y(u);function u(){return r(this,u),s.call(this)}return p(u,[{key:"createNode",value:function(h){return new Ao(h,new Fl)}}]),u}(ji),ra=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"compareTo",value:function(s){var u=s;return w.compareOriented(this._pts,this._orientation,u._pts,u._orientation)}},{key:"interfaces_",get:function(){return[Fe]}}],[{key:"constructor_",value:function(){this._pts=null,this._orientation=null;var s=arguments[0];this._pts=s,this._orientation=w.orientation(s)}},{key:"orientation",value:function(s){return mn.increasingDirection(s)===1}},{key:"compareOriented",value:function(s,u,h,y){for(var I=u?1:-1,O=y?1:-1,U=u?s.length:-1,H=y?h.length:-1,te=u?0:s.length-1,ye=y?0:h.length-1;;){var ke=s[te].compareTo(h[ye]);if(ke!==0)return ke;var Ze=(te+=I)===U,nt=(ye+=O)===H;if(Ze&&!nt)return-1;if(!Ze&&nt)return 1;if(Ze&&nt)return 0}}}]),w}(),Fa=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"print",value:function(s){s.print("MULTILINESTRING ( ");for(var u=0;u0&&s.print(","),s.print("(");for(var y=h.getCoordinates(),I=0;I0&&s.print(","),s.print(y[I].x+" "+y[I].y);s.println(")")}s.print(") ")}},{key:"addAll",value:function(s){for(var u=s.iterator();u.hasNext();)this.add(u.next())}},{key:"findEdgeIndex",value:function(s){for(var u=0;us?1:this.distu?1:0}},{key:"interfaces_",get:function(){return[Fe]}}],[{key:"constructor_",value:function(){this.coord=null,this.segmentIndex=null,this.dist=null;var s=arguments[0],u=arguments[1],h=arguments[2];this.coord=new Ae(s),this.segmentIndex=u,this.dist=h}}]),w}(),vu=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"print",value:function(s){s.println("Intersections:");for(var u=this.iterator();u.hasNext();)u.next().print(s)}},{key:"iterator",value:function(){return this._nodeMap.values().iterator()}},{key:"addSplitEdges",value:function(s){this.addEndpoints();for(var u=this.iterator(),h=u.next();u.hasNext();){var y=u.next(),I=this.createSplitEdge(h,y);s.add(I),h=y}}},{key:"addEndpoints",value:function(){var s=this.edge.pts.length-1;this.add(this.edge.pts[0],0,0),this.add(this.edge.pts[s],s,0)}},{key:"createSplitEdge",value:function(s,u){var h=u.segmentIndex-s.segmentIndex+2,y=this.edge.pts[u.segmentIndex],I=u.dist>0||!u.coord.equals2D(y);I||h--;var O=new Array(h).fill(null),U=0;O[U++]=new Ae(s.coord);for(var H=s.segmentIndex+1;H<=u.segmentIndex;H++)O[U++]=this.edge.pts[H];return I&&(O[U]=u.coord),new sa(O,new Xi(this.edge._label))}},{key:"add",value:function(s,u,h){var y=new Ba(s,u,h),I=this._nodeMap.get(y);return I!==null?I:(this._nodeMap.put(y,y),y)}},{key:"isIntersection",value:function(s){for(var u=this.iterator();u.hasNext();)if(u.next().coord.equals(s))return!0;return!1}}],[{key:"constructor_",value:function(){this._nodeMap=new na,this.edge=null;var s=arguments[0];this.edge=s}}]),w}(),Ua=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"isIntersects",value:function(){return!this.isDisjoint()}},{key:"isCovers",value:function(){return(w.isTrue(this._matrix[fe.INTERIOR][fe.INTERIOR])||w.isTrue(this._matrix[fe.INTERIOR][fe.BOUNDARY])||w.isTrue(this._matrix[fe.BOUNDARY][fe.INTERIOR])||w.isTrue(this._matrix[fe.BOUNDARY][fe.BOUNDARY]))&&this._matrix[fe.EXTERIOR][fe.INTERIOR]===oe.FALSE&&this._matrix[fe.EXTERIOR][fe.BOUNDARY]===oe.FALSE}},{key:"isCoveredBy",value:function(){return(w.isTrue(this._matrix[fe.INTERIOR][fe.INTERIOR])||w.isTrue(this._matrix[fe.INTERIOR][fe.BOUNDARY])||w.isTrue(this._matrix[fe.BOUNDARY][fe.INTERIOR])||w.isTrue(this._matrix[fe.BOUNDARY][fe.BOUNDARY]))&&this._matrix[fe.INTERIOR][fe.EXTERIOR]===oe.FALSE&&this._matrix[fe.BOUNDARY][fe.EXTERIOR]===oe.FALSE}},{key:"set",value:function(){if(arguments.length===1)for(var s=arguments[0],u=0;u=0&&u>=0&&this.setAtLeast(s,u,h)}},{key:"isWithin",value:function(){return w.isTrue(this._matrix[fe.INTERIOR][fe.INTERIOR])&&this._matrix[fe.INTERIOR][fe.EXTERIOR]===oe.FALSE&&this._matrix[fe.BOUNDARY][fe.EXTERIOR]===oe.FALSE}},{key:"isTouches",value:function(s,u){return s>u?this.isTouches(u,s):(s===oe.A&&u===oe.A||s===oe.L&&u===oe.L||s===oe.L&&u===oe.A||s===oe.P&&u===oe.A||s===oe.P&&u===oe.L)&&this._matrix[fe.INTERIOR][fe.INTERIOR]===oe.FALSE&&(w.isTrue(this._matrix[fe.INTERIOR][fe.BOUNDARY])||w.isTrue(this._matrix[fe.BOUNDARY][fe.INTERIOR])||w.isTrue(this._matrix[fe.BOUNDARY][fe.BOUNDARY]))}},{key:"isOverlaps",value:function(s,u){return s===oe.P&&u===oe.P||s===oe.A&&u===oe.A?w.isTrue(this._matrix[fe.INTERIOR][fe.INTERIOR])&&w.isTrue(this._matrix[fe.INTERIOR][fe.EXTERIOR])&&w.isTrue(this._matrix[fe.EXTERIOR][fe.INTERIOR]):s===oe.L&&u===oe.L&&this._matrix[fe.INTERIOR][fe.INTERIOR]===1&&w.isTrue(this._matrix[fe.INTERIOR][fe.EXTERIOR])&&w.isTrue(this._matrix[fe.EXTERIOR][fe.INTERIOR])}},{key:"isEquals",value:function(s,u){return s===u&&w.isTrue(this._matrix[fe.INTERIOR][fe.INTERIOR])&&this._matrix[fe.INTERIOR][fe.EXTERIOR]===oe.FALSE&&this._matrix[fe.BOUNDARY][fe.EXTERIOR]===oe.FALSE&&this._matrix[fe.EXTERIOR][fe.INTERIOR]===oe.FALSE&&this._matrix[fe.EXTERIOR][fe.BOUNDARY]===oe.FALSE}},{key:"toString",value:function(){for(var s=new Ta("123456789"),u=0;u<3;u++)for(var h=0;h<3;h++)s.setCharAt(3*u+h,oe.toDimensionSymbol(this._matrix[u][h]));return s.toString()}},{key:"setAll",value:function(s){for(var u=0;u<3;u++)for(var h=0;h<3;h++)this._matrix[u][h]=s}},{key:"get",value:function(s,u){return this._matrix[s][u]}},{key:"transpose",value:function(){var s=this._matrix[1][0];return this._matrix[1][0]=this._matrix[0][1],this._matrix[0][1]=s,s=this._matrix[2][0],this._matrix[2][0]=this._matrix[0][2],this._matrix[0][2]=s,s=this._matrix[2][1],this._matrix[2][1]=this._matrix[1][2],this._matrix[1][2]=s,this}},{key:"matches",value:function(s){if(s.length!==9)throw new Re("Should be length 9: "+s);for(var u=0;u<3;u++)for(var h=0;h<3;h++)if(!w.matches(this._matrix[u][h],s.charAt(3*u+h)))return!1;return!0}},{key:"add",value:function(s){for(var u=0;u<3;u++)for(var h=0;h<3;h++)this.setAtLeast(u,h,s.get(u,h))}},{key:"isDisjoint",value:function(){return this._matrix[fe.INTERIOR][fe.INTERIOR]===oe.FALSE&&this._matrix[fe.INTERIOR][fe.BOUNDARY]===oe.FALSE&&this._matrix[fe.BOUNDARY][fe.INTERIOR]===oe.FALSE&&this._matrix[fe.BOUNDARY][fe.BOUNDARY]===oe.FALSE}},{key:"isCrosses",value:function(s,u){return s===oe.P&&u===oe.L||s===oe.P&&u===oe.A||s===oe.L&&u===oe.A?w.isTrue(this._matrix[fe.INTERIOR][fe.INTERIOR])&&w.isTrue(this._matrix[fe.INTERIOR][fe.EXTERIOR]):s===oe.L&&u===oe.P||s===oe.A&&u===oe.P||s===oe.A&&u===oe.L?w.isTrue(this._matrix[fe.INTERIOR][fe.INTERIOR])&&w.isTrue(this._matrix[fe.EXTERIOR][fe.INTERIOR]):s===oe.L&&u===oe.L&&this._matrix[fe.INTERIOR][fe.INTERIOR]===0}},{key:"interfaces_",get:function(){return[ze]}}],[{key:"constructor_",value:function(){if(this._matrix=null,arguments.length===0)this._matrix=Array(3).fill().map(function(){return Array(3)}),this.setAll(oe.FALSE);else if(arguments.length===1){if(typeof arguments[0]=="string"){var s=arguments[0];w.constructor_.call(this),this.set(s)}else if(arguments[0]instanceof w){var u=arguments[0];w.constructor_.call(this),this._matrix[fe.INTERIOR][fe.INTERIOR]=u._matrix[fe.INTERIOR][fe.INTERIOR],this._matrix[fe.INTERIOR][fe.BOUNDARY]=u._matrix[fe.INTERIOR][fe.BOUNDARY],this._matrix[fe.INTERIOR][fe.EXTERIOR]=u._matrix[fe.INTERIOR][fe.EXTERIOR],this._matrix[fe.BOUNDARY][fe.INTERIOR]=u._matrix[fe.BOUNDARY][fe.INTERIOR],this._matrix[fe.BOUNDARY][fe.BOUNDARY]=u._matrix[fe.BOUNDARY][fe.BOUNDARY],this._matrix[fe.BOUNDARY][fe.EXTERIOR]=u._matrix[fe.BOUNDARY][fe.EXTERIOR],this._matrix[fe.EXTERIOR][fe.INTERIOR]=u._matrix[fe.EXTERIOR][fe.INTERIOR],this._matrix[fe.EXTERIOR][fe.BOUNDARY]=u._matrix[fe.EXTERIOR][fe.BOUNDARY],this._matrix[fe.EXTERIOR][fe.EXTERIOR]=u._matrix[fe.EXTERIOR][fe.EXTERIOR]}}}},{key:"matches",value:function(){if(Number.isInteger(arguments[0])&&typeof arguments[1]=="string"){var s=arguments[0],u=arguments[1];return u===oe.SYM_DONTCARE||u===oe.SYM_TRUE&&(s>=0||s===oe.TRUE)||u===oe.SYM_FALSE&&s===oe.FALSE||u===oe.SYM_P&&s===oe.P||u===oe.SYM_L&&s===oe.L||u===oe.SYM_A&&s===oe.A}if(typeof arguments[0]=="string"&&typeof arguments[1]=="string"){var h=arguments[0],y=arguments[1],I=new w(h);return I.matches(y)}}},{key:"isTrue",value:function(s){return s>=0||s===oe.TRUE}}]),w}(),ja=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"size",value:function(){return this._size}},{key:"addAll",value:function(s){return s===null||s.length===0?null:(this.ensureCapacity(this._size+s.length),Ft.arraycopy(s,0,this._data,this._size,s.length),void(this._size+=s.length))}},{key:"ensureCapacity",value:function(s){if(s<=this._data.length)return null;var u=Math.max(s,2*this._data.length);this._data=qe.copyOf(this._data,u)}},{key:"toArray",value:function(){var s=new Array(this._size).fill(null);return Ft.arraycopy(this._data,0,s,0,this._size),s}},{key:"add",value:function(s){this.ensureCapacity(this._size+1),this._data[this._size]=s,++this._size}}],[{key:"constructor_",value:function(){if(this._data=null,this._size=0,arguments.length===0)w.constructor_.call(this,10);else if(arguments.length===1){var s=arguments[0];this._data=new Array(s).fill(null)}}}]),w}(),Bl=function(){function w(){r(this,w)}return p(w,[{key:"getChainStartIndices",value:function(s){var u=0,h=new ja(Math.trunc(s.length/2));h.add(u);do{var y=this.findChainEnd(s,u);h.add(y),u=y}while(uh?u:h}},{key:"getMinX",value:function(s){var u=this.pts[this.startIndex[s]].x,h=this.pts[this.startIndex[s+1]].x;return uu&&(y=1),this._depth[s][h]=y}}}},{key:"getDelta",value:function(s){return this._depth[s][ot.RIGHT]-this._depth[s][ot.LEFT]}},{key:"getLocation",value:function(s,u){return this._depth[s][u]<=0?fe.EXTERIOR:fe.INTERIOR}},{key:"toString",value:function(){return"A: "+this._depth[0][1]+","+this._depth[0][2]+" B: "+this._depth[1][1]+","+this._depth[1][2]}},{key:"add",value:function(){if(arguments.length===1)for(var s=arguments[0],u=0;u<2;u++)for(var h=1;h<3;h++){var y=s.getLocation(u,h);y!==fe.EXTERIOR&&y!==fe.INTERIOR||(this.isNull(u,h)?this._depth[u][h]=w.depthAtLocation(y):this._depth[u][h]+=w.depthAtLocation(y))}else if(arguments.length===3){var I=arguments[0],O=arguments[1],U=arguments[2];U===fe.INTERIOR&&this._depth[I][O]++}}}],[{key:"constructor_",value:function(){this._depth=Array(2).fill().map(function(){return Array(3)});for(var s=0;s<2;s++)for(var u=0;u<3;u++)this._depth[s][u]=w.NULL_VALUE}},{key:"depthAtLocation",value:function(s){return s===fe.EXTERIOR?0:s===fe.INTERIOR?1:w.NULL_VALUE}}]),w}();Ul.NULL_VALUE=-1;var sa=function(w){g(u,w);var s=Y(u);function u(){var h;return r(this,u),h=s.call(this),u.constructor_.apply(M(h),arguments),h}return p(u,[{key:"getDepth",value:function(){return this._depth}},{key:"getCollapsedEdge",value:function(){var h=new Array(2).fill(null);return h[0]=this.pts[0],h[1]=this.pts[1],new u(h,Xi.toLineLabel(this._label))}},{key:"isIsolated",value:function(){return this._isIsolated}},{key:"getCoordinates",value:function(){return this.pts}},{key:"setIsolated",value:function(h){this._isIsolated=h}},{key:"setName",value:function(h){this._name=h}},{key:"equals",value:function(h){if(!(h instanceof u))return!1;var y=h;if(this.pts.length!==y.pts.length)return!1;for(var I=!0,O=!0,U=this.pts.length,H=0;H0?this.pts[0]:null;if(arguments.length===1){var h=arguments[0];return this.pts[h]}}},{key:"print",value:function(h){h.print("edge "+this._name+": "),h.print("LINESTRING (");for(var y=0;y0&&h.print(","),h.print(this.pts[y].x+" "+this.pts[y].y);h.print(") "+this._label+" "+this._depthDelta)}},{key:"computeIM",value:function(h){u.updateIM(this._label,h)}},{key:"isCollapsed",value:function(){return!!this._label.isArea()&&this.pts.length===3&&!!this.pts[0].equals(this.pts[2])}},{key:"isClosed",value:function(){return this.pts[0].equals(this.pts[this.pts.length-1])}},{key:"getMaximumSegmentIndex",value:function(){return this.pts.length-1}},{key:"getDepthDelta",value:function(){return this._depthDelta}},{key:"getNumPoints",value:function(){return this.pts.length}},{key:"printReverse",value:function(h){h.print("edge "+this._name+": ");for(var y=this.pts.length-1;y>=0;y--)h.print(this.pts[y]+" ");h.println("")}},{key:"getMonotoneChainEdge",value:function(){return this._mce===null&&(this._mce=new xu(this)),this._mce}},{key:"getEnvelope",value:function(){if(this._env===null){this._env=new $t;for(var h=0;h0&&h.append(","),h.append(this.pts[y].x+" "+this.pts[y].y);return h.append(") "+this._label+" "+this._depthDelta),h.toString()}},{key:"isPointwiseEqual",value:function(h){if(this.pts.length!==h.pts.length)return!1;for(var y=0;yy||this._maxyO;if(U)return!1;var H=this.intersectsToleranceSquare(s,u);return Et.isTrue(!(U&&H),"Found bad envelope test"),H}},{key:"initCorners",value:function(s){var u=.5;this._minx=s.x-u,this._maxx=s.x+u,this._miny=s.y-u,this._maxy=s.y+u,this._corner[0]=new Ae(this._maxx,this._maxy),this._corner[1]=new Ae(this._minx,this._maxy),this._corner[2]=new Ae(this._minx,this._miny),this._corner[3]=new Ae(this._maxx,this._miny)}},{key:"intersects",value:function(s,u){return this._scaleFactor===1?this.intersectsScaled(s,u):(this.copyScaled(s,this._p0Scaled),this.copyScaled(u,this._p1Scaled),this.intersectsScaled(this._p0Scaled,this._p1Scaled))}},{key:"scale",value:function(s){return Math.round(s*this._scaleFactor)}},{key:"getCoordinate",value:function(){return this._originalPt}},{key:"copyScaled",value:function(s,u){u.x=this.scale(s.x),u.y=this.scale(s.y)}},{key:"getSafeEnvelope",value:function(){if(this._safeEnv===null){var s=w.SAFE_ENV_EXPANSION_FACTOR/this._scaleFactor;this._safeEnv=new $t(this._originalPt.x-s,this._originalPt.x+s,this._originalPt.y-s,this._originalPt.y+s)}return this._safeEnv}},{key:"intersectsPixelClosure",value:function(s,u){return this._li.computeIntersection(s,u,this._corner[0],this._corner[1]),!!this._li.hasIntersection()||(this._li.computeIntersection(s,u,this._corner[1],this._corner[2]),!!this._li.hasIntersection()||(this._li.computeIntersection(s,u,this._corner[2],this._corner[3]),!!this._li.hasIntersection()||(this._li.computeIntersection(s,u,this._corner[3],this._corner[0]),!!this._li.hasIntersection())))}},{key:"intersectsToleranceSquare",value:function(s,u){var h=!1,y=!1;return this._li.computeIntersection(s,u,this._corner[0],this._corner[1]),!!this._li.isProper()||(this._li.computeIntersection(s,u,this._corner[1],this._corner[2]),!!this._li.isProper()||(this._li.hasIntersection()&&(h=!0),this._li.computeIntersection(s,u,this._corner[2],this._corner[3]),!!this._li.isProper()||(this._li.hasIntersection()&&(y=!0),this._li.computeIntersection(s,u,this._corner[3],this._corner[0]),!!this._li.isProper()||!(!h||!y)||!!s.equals(this._pt)||!!u.equals(this._pt))))}},{key:"addSnappedNode",value:function(s,u){var h=s.getCoordinate(u),y=s.getCoordinate(u+1);return!!this.intersects(h,y)&&(s.addIntersection(this.getCoordinate(),u),!0)}}],[{key:"constructor_",value:function(){this._li=null,this._pt=null,this._originalPt=null,this._ptScaled=null,this._p0Scaled=null,this._p1Scaled=null,this._scaleFactor=null,this._minx=null,this._maxx=null,this._miny=null,this._maxy=null,this._corner=new Array(4).fill(null),this._safeEnv=null;var s=arguments[0],u=arguments[1],h=arguments[2];if(this._originalPt=s,this._pt=s,this._scaleFactor=u,this._li=h,u<=0)throw new Re("Scale factor must be non-zero");u!==1&&(this._pt=new Ae(this.scale(s.x),this.scale(s.y)),this._p0Scaled=new Ae,this._p1Scaled=new Ae),this.initCorners(this._pt)}}]),w}();Vn.SAFE_ENV_EXPANSION_FACTOR=.75;var Oo=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"select",value:function(){if(arguments.length!==1&&arguments.length===2){var s=arguments[0],u=arguments[1];s.getLineSegment(u,this.selectedSegment),this.select(this.selectedSegment)}}}],[{key:"constructor_",value:function(){this.selectedSegment=new bi}}]),w}(),Vi=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"snap",value:function(){if(arguments.length===1){var s=arguments[0];return this.snap(s,null,-1)}if(arguments.length===3){var u=arguments[0],h=arguments[1],y=arguments[2],I=u.getSafeEnvelope(),O=new qa(u,h,y);return this._index.query(I,new(function(){function U(){r(this,U)}return p(U,[{key:"interfaces_",get:function(){return[Al]}},{key:"visitItem",value:function(H){H.select(I,O)}}]),U}())),O.isNodeAdded()}}}],[{key:"constructor_",value:function(){this._index=null;var s=arguments[0];this._index=s}}]),w}(),qa=function(w){g(u,w);var s=Y(u);function u(){var h;return r(this,u),h=s.call(this),u.constructor_.apply(M(h),arguments),h}return p(u,[{key:"isNodeAdded",value:function(){return this._isNodeAdded}},{key:"select",value:function(){if(!(arguments.length===2&&Number.isInteger(arguments[1])&&arguments[0]instanceof Ml))return W(x(u.prototype),"select",this).apply(this,arguments);var h=arguments[0],y=arguments[1],I=h.getContext();if(this._parentEdge===I&&(y===this._hotPixelVertexIndex||y+1===this._hotPixelVertexIndex))return null;this._isNodeAdded|=this._hotPixel.addSnappedNode(I,y)}}],[{key:"constructor_",value:function(){this._hotPixel=null,this._parentEdge=null,this._hotPixelVertexIndex=null,this._isNodeAdded=!1;var h=arguments[0],y=arguments[1],I=arguments[2];this._hotPixel=h,this._parentEdge=y,this._hotPixelVertexIndex=I}}]),u}(Oo);Vi.HotPixelSnapAction=qa;var Ga=function(){function w(){r(this,w),w.constructor_.apply(this,arguments)}return p(w,[{key:"processIntersections",value:function(s,u,h,y){if(s===h&&u===y)return null;var I=s.getCoordinates()[u],O=s.getCoordinates()[u+1],U=h.getCoordinates()[y],H=h.getCoordinates()[y+1];if(this._li.computeIntersection(I,O,U,H),this._li.hasIntersection()&&this._li.isInteriorIntersection()){for(var te=0;te=0;s--){try{this.bufferReducedPrecision(s)}catch(I){if(!(I instanceof Hn))throw I;this._saveException=I}if(this._resultGeometry!==null)return null}throw this._saveException}if(arguments.length===1){var u=arguments[0],h=w.precisionScaleFactor(this._argGeom,this._distance,u),y=new Yi(h);this.bufferFixedPrecision(y)}}},{key:"computeGeometry",value:function(){if(this.bufferOriginalPrecision(),this._resultGeometry!==null)return null;var s=this._argGeom.getFactory().getPrecisionModel();s.getType()===Yi.FIXED?this.bufferFixedPrecision(s):this.bufferReducedPrecision()}},{key:"setQuadrantSegments",value:function(s){this._bufParams.setQuadrantSegments(s)}},{key:"bufferOriginalPrecision",value:function(){try{var s=new Va(this._bufParams);this._resultGeometry=s.buffer(this._argGeom,this._distance)}catch(u){if(!(u instanceof Nt))throw u;this._saveException=u}}},{key:"getResultGeometry",value:function(s){return this._distance=s,this.computeGeometry(),this._resultGeometry}},{key:"setEndCapStyle",value:function(s){this._bufParams.setEndCapStyle(s)}}],[{key:"constructor_",value:function(){if(this._argGeom=null,this._distance=null,this._bufParams=new Ie,this._resultGeometry=null,this._saveException=null,arguments.length===1){var s=arguments[0];this._argGeom=s}else if(arguments.length===2){var u=arguments[0],h=arguments[1];this._argGeom=u,this._bufParams=h}}},{key:"bufferOp",value:function(){if(arguments.length===2){var s=arguments[0],u=arguments[1],h=new w(s),y=h.getResultGeometry(u);return y}if(arguments.length===3){if(Number.isInteger(arguments[2])&&arguments[0]instanceof bt&&typeof arguments[1]=="number"){var I=arguments[0],O=arguments[1],U=arguments[2],H=new w(I);H.setQuadrantSegments(U);var te=H.getResultGeometry(O);return te}if(arguments[2]instanceof Ie&&arguments[0]instanceof bt&&typeof arguments[1]=="number"){var ye=arguments[0],ke=arguments[1],Ze=arguments[2],nt=new w(ye,Ze),et=nt.getResultGeometry(ke);return et}}else if(arguments.length===4){var Bt=arguments[0],Rt=arguments[1],Yt=arguments[2],kn=arguments[3],Kn=new w(Bt);Kn.setQuadrantSegments(Yt),Kn.setEndCapStyle(kn);var ui=Kn.getResultGeometry(Rt);return ui}}},{key:"precisionScaleFactor",value:function(s,u,h){var y=s.getEnvelopeInternal(),I=Wr.max(Math.abs(y.getMaxX()),Math.abs(y.getMaxY()),Math.abs(y.getMinX()),Math.abs(y.getMinY()))+2*(u>0?u:0),O=h-Math.trunc(Math.log(I)/Math.log(10)+1);return Math.pow(10,O)}}]),w}();yr.CAP_ROUND=Ie.CAP_ROUND,yr.CAP_BUTT=Ie.CAP_FLAT,yr.CAP_FLAT=Ie.CAP_FLAT,yr.CAP_SQUARE=Ie.CAP_SQUARE,yr.MAX_PRECISION_DIGITS=12;var Do=["Point","MultiPoint","LineString","MultiLineString","Polygon","MultiPolygon"],Ko=function(){function w(s){r(this,w),this.geometryFactory=s||new Zr}return p(w,[{key:"read",value:function(s){var u,h=(u=typeof s=="string"?JSON.parse(s):s).type;if(!Ji[h])throw new Error("Unknown GeoJSON type: "+u.type);return Do.indexOf(h)!==-1?Ji[h].call(this,u.coordinates):h==="GeometryCollection"?Ji[h].call(this,u.geometries):Ji[h].call(this,u)}},{key:"write",value:function(s){var u=s.getGeometryType();if(!Or[u])throw new Error("Geometry is not supported");return Or[u].call(this,s)}}]),w}(),Ji={Feature:function(w){var s={};for(var u in w)s[u]=w[u];if(w.geometry){var h=w.geometry.type;if(!Ji[h])throw new Error("Unknown GeoJSON type: "+w.type);s.geometry=this.read(w.geometry)}return w.bbox&&(s.bbox=Ji.bbox.call(this,w.bbox)),s},FeatureCollection:function(w){var s={};if(w.features){s.features=[];for(var u=0;u1?0:t<-1?Pn:Math.acos(t)}function ou(t){return t>1?js:t<-1?-js:Math.asin(t)}function Lh(){}function sp(t,e){t&&bb.hasOwnProperty(t.type)&&bb[t.type](t,e)}var xb={Feature:function(t,e){sp(t.geometry,e)},FeatureCollection:function(t,e){for(var r=t.features,l=-1,p=r.length;++lPn?t-qs:t<-Pn?t+qs:t,e]}fy.invert=fy;function L5(t,e,r){return(t%=qs)?e||r?Lk(kb(t),Eb(e,r)):kb(t):e||r?Eb(e,r):fy}function Sb(t){return function(e,r){return e+=t,[e>Pn?e-qs:e<-Pn?e+qs:e,r]}}function kb(t){var e=Sb(t);return e.invert=Sb(-t),e}function Eb(t,e){var r=mi(t),l=gi(t),p=mi(e),g=gi(e);function x(f,C){var R=mi(C),z=mi(f)*R,M=gi(f)*R,F=gi(C),Y=F*r+z*l;return[gc(M*p-Y*g,z*r-F*l),ou(Y*p+M*g)]}return x.invert=function(f,C){var R=mi(C),z=mi(f)*R,M=gi(f)*R,F=gi(C),Y=F*p-M*g;return[gc(M*p+F*g,z*r+Y*l),ou(Y*r-z*l)]},x}function P5(t,e,r,l,p,g){if(r){var x=mi(e),f=gi(e),C=l*r;p==null?(p=e+l*qs,g=e-C/2):(p=Ib(x,p),g=Ib(x,g),(l>0?pg)&&(p+=l*qs));for(var R,z=p;l>0?z>g:z1&&t.push(t.pop().concat(t.shift()))},result:function(){var r=t;return t=[],e=null,r}}}function M5(t,e,r,l,p,g){var x=t[0],f=t[1],C=e[0],R=e[1],z=0,M=1,F=C-x,Y=R-f,W;if(W=r-x,!(!F&&W>0)){if(W/=F,F<0){if(W0){if(W>M)return;W>z&&(z=W)}if(W=p-x,!(!F&&W<0)){if(W/=F,F<0){if(W>M)return;W>z&&(z=W)}else if(F>0){if(W0)){if(W/=Y,Y<0){if(W0){if(W>M)return;W>z&&(z=W)}if(W=g-f,!(!Y&&W<0)){if(W/=Y,Y<0){if(W>M)return;W>z&&(z=W)}else if(Y>0){if(W0&&(t[0]=x+z*F,t[1]=f+z*Y),M<1&&(e[0]=x+M*F,e[1]=f+M*Y),!0}}}}}function bd(t,e){return mr(t[0]-e[0])=0;--f)p.point((M=z[f])[0],M[1]);else l(F.x,F.p.x,-1,p);F=F.p}F=F.o,z=F.z,Y=!Y}while(!F.v);p.lineEnd()}}}function Tb(t){if(e=t.length){for(var e,r=0,l=t[0],p;++re?1:t>=e?0:NaN}function R5(t){return t.length===1&&(t=O5(t)),{left:function(e,r,l,p){for(l==null&&(l=0),p==null&&(p=e.length);l>>1;t(e[g],r)<0?l=g+1:p=g}return l},right:function(e,r,l,p){for(l==null&&(l=0),p==null&&(p=e.length);l>>1;t(e[g],r)>0?p=g:l=g+1}return l}}}function O5(t){return function(e,r){return Rk(t(e),r)}}R5(Rk);function Ok(t){for(var e=t.length,r,l=-1,p=0,g,x;++l=0;)for(x=t[e],r=x.length;--r>=0;)g[--p]=x[r];return g}var Ph=1e9,Qf=-Ph;function D5(t,e,r,l){function p(R,z){return t<=R&&R<=r&&e<=z&&z<=l}function g(R,z,M,F){var Y=0,W=0;if(R==null||(Y=x(R,M))!==(W=x(z,M))||C(R,z)<0^M>0)do F.point(Y===0||Y===3?t:r,Y>1?l:e);while((Y=(Y+M+4)%4)!==W);else F.point(z[0],z[1])}function x(R,z){return mr(R[0]-t)0?0:3:mr(R[0]-r)0?2:1:mr(R[1]-e)0?1:0:z>0?3:2}function f(R,z){return C(R.x,z.x)}function C(R,z){var M=x(R,1),F=x(z,1);return M!==F?M-F:M===0?z[1]-R[1]:M===1?R[0]-z[0]:M===2?R[1]-z[1]:z[0]-R[0]}return function(R){var z=R,M=Pk(),F,Y,W,pe,me,ve,we,Ie,Pe,Re,Ve,Fe={point:ze,lineStart:mt,lineEnd:xt,polygonStart:yt,polygonEnd:De};function ze(St,Ct){p(St,Ct)&&z.point(St,Ct)}function Ge(){for(var St=0,Ct=0,vt=Y.length;Ctl&&(Et-Nt)*(l-on)>(gn-on)*(t-Nt)&&++St:gn<=l&&(Et-Nt)*(l-on)<(gn-on)*(t-Nt)&&--St;return St}function yt(){z=M,F=[],Y=[],Ve=!0}function De(){var St=Ge(),Ct=Ve&&St,vt=(F=Ok(F)).length;(Ct||vt)&&(R.polygonStart(),Ct&&(R.lineStart(),g(null,null,1,R),R.lineEnd()),vt&&Mk(F,f,St,g,R),R.polygonEnd()),z=R,F=Y=W=null}function mt(){Fe.point=Je,Y&&Y.push(W=[]),Re=!0,Pe=!1,we=Ie=NaN}function xt(){F&&(Je(pe,me),ve&&Pe&&M.rejoin(),F.push(M.result())),Fe.point=ze,Pe&&z.lineEnd()}function Je(St,Ct){var vt=p(St,Ct);if(Y&&W.push([St,Ct]),Re)pe=St,me=Ct,ve=vt,Re=!1,vt&&(z.lineStart(),z.point(St,Ct));else if(vt&&Pe)z.point(St,Ct);else{var Gt=[we=Math.max(Qf,Math.min(Ph,we)),Ie=Math.max(Qf,Math.min(Ph,Ie))],an=[St=Math.max(Qf,Math.min(Ph,St)),Ct=Math.max(Qf,Math.min(Ph,Ct))];M5(Gt,an,t,e,r,l)?(Pe||(z.lineStart(),z.point(Gt[0],Gt[1])),z.point(an[0],an[1]),vt||z.lineEnd(),Ve=!1):vt&&(z.lineStart(),z.point(St,Ct),Ve=!1)}we=St,Ie=Ct,Pe=vt}return Fe}}var og=Sl();function N5(t,e){var r=e[0],l=e[1],p=[gi(r),-mi(r),0],g=0,x=0;og.reset();for(var f=0,C=t.length;f=0?1:-1,ze=Fe*Ve,Ge=ze>Pn,yt=W*Pe;if(og.add(gc(yt*Fe*gi(ze),pe*Re+yt*mi(ze))),g+=Ge?Ve+Fe*qs:Ve,Ge^F>=r^we>=r){var De=ap(yc(M),yc(ve));hy(De);var mt=ap(p,De);hy(mt);var xt=(Ge^Ve>=0?-1:1)*ou(mt[2]);(l>xt||l===xt&&(De[0]||De[1]))&&(x+=Ge^Ve>=0?1:-1)}}return(g<-ei||gXh&&(Xh=t),eup&&(up=e)}Sl();function Dk(t,e,r,l){return function(p,g){var x=e(g),f=p.invert(l[0],l[1]),C=Pk(),R=e(C),z=!1,M,F,Y,W={point:pe,lineStart:ve,lineEnd:we,polygonStart:function(){W.point=Ie,W.lineStart=Pe,W.lineEnd=Re,F=[],M=[]},polygonEnd:function(){W.point=pe,W.lineStart=ve,W.lineEnd=we,F=Ok(F);var Ve=N5(M,f);F.length?(z||(g.polygonStart(),z=!0),Mk(F,B5,Ve,r,g)):Ve&&(z||(g.polygonStart(),z=!0),g.lineStart(),r(null,null,1,g),g.lineEnd()),z&&(g.polygonEnd(),z=!1),F=M=null},sphere:function(){g.polygonStart(),g.lineStart(),r(null,null,1,g),g.lineEnd(),g.polygonEnd()}};function pe(Ve,Fe){var ze=p(Ve,Fe);t(Ve=ze[0],Fe=ze[1])&&g.point(Ve,Fe)}function me(Ve,Fe){var ze=p(Ve,Fe);x.point(ze[0],ze[1])}function ve(){W.point=me,x.lineStart()}function we(){W.point=pe,x.lineEnd()}function Ie(Ve,Fe){Y.push([Ve,Fe]);var ze=p(Ve,Fe);R.point(ze[0],ze[1])}function Pe(){R.lineStart(),Y=[]}function Re(){Ie(Y[0][0],Y[0][1]),R.lineEnd();var Ve=R.clean(),Fe=C.result(),ze,Ge=Fe.length,yt,De,mt;if(Y.pop(),M.push(Y),Y=null,!!Ge){if(Ve&1){if(De=Fe[0],(yt=De.length-1)>0){for(z||(g.polygonStart(),z=!0),g.lineStart(),ze=0;ze1&&Ve&2&&Fe.push(Fe.pop().concat(Fe.shift())),F.push(Fe.filter(F5))}}return W}}function F5(t){return t.length>1}function B5(t,e){return((t=t.x)[0]<0?t[1]-js-ei:js-t[1])-((e=e.x)[0]<0?e[1]-js-ei:js-e[1])}const Lb=Dk(function(){return!0},U5,V5,[-Pn,-js]);function U5(t){var e=NaN,r=NaN,l=NaN,p;return{lineStart:function(){t.lineStart(),p=1},point:function(g,x){var f=g>0?Pn:-Pn,C=mr(g-e);mr(C-Pn)0?js:-js),t.point(l,r),t.lineEnd(),t.lineStart(),t.point(f,r),t.point(g,r),p=0):l!==f&&C>=Pn&&(mr(e-l)ei?C5((gi(e)*(g=mi(l))*gi(r)-gi(l)*(p=mi(e))*gi(t))/(p*g*x)):(e+l)/2}function V5(t,e,r,l){var p;if(t==null)p=r*js,l.point(-Pn,p),l.point(0,p),l.point(Pn,p),l.point(Pn,0),l.point(Pn,-p),l.point(0,-p),l.point(-Pn,-p),l.point(-Pn,0),l.point(-Pn,p);else if(mr(t[0]-e[0])>ei){var g=t[0]0,p=mr(r)>ei;function g(z,M,F,Y){P5(Y,t,e,F,z,M)}function x(z,M){return mi(z)*mi(M)>r}function f(z){var M,F,Y,W,pe;return{lineStart:function(){W=Y=!1,pe=1},point:function(me,ve){var we=[me,ve],Ie,Pe=x(me,ve),Re=l?Pe?0:R(me,ve):Pe?R(me+(me<0?Pn:-Pn),ve):0;if(!M&&(W=Y=Pe)&&z.lineStart(),Pe!==Y&&(Ie=C(M,we),(!Ie||bd(M,Ie)||bd(we,Ie))&&(we[0]+=ei,we[1]+=ei,Pe=x(we[0],we[1]))),Pe!==Y)pe=0,Pe?(z.lineStart(),Ie=C(we,M),z.point(Ie[0],Ie[1])):(Ie=C(M,we),z.point(Ie[0],Ie[1]),z.lineEnd()),M=Ie;else if(p&&M&&l^Pe){var Ve;!(Re&F)&&(Ve=C(we,M,!0))&&(pe=0,l?(z.lineStart(),z.point(Ve[0][0],Ve[0][1]),z.point(Ve[1][0],Ve[1][1]),z.lineEnd()):(z.point(Ve[1][0],Ve[1][1]),z.lineEnd(),z.lineStart(),z.point(Ve[0][0],Ve[0][1])))}Pe&&(!M||!bd(M,we))&&z.point(we[0],we[1]),M=we,Y=Pe,F=Re},lineEnd:function(){Y&&z.lineEnd(),M=null},clean:function(){return pe|(W&&Y)<<1}}}function C(z,M,F){var Y=yc(z),W=yc(M),pe=[1,0,0],me=ap(Y,W),ve=$f(me,me),we=me[0],Ie=ve-we*we;if(!Ie)return!F&&z;var Pe=r*ve/Ie,Re=-r*we/Ie,Ve=ap(pe,me),Fe=Kf(pe,Pe),ze=Kf(me,Re);rg(Fe,ze);var Ge=Ve,yt=$f(Fe,Ge),De=$f(Ge,Ge),mt=yt*yt-De*($f(Fe,Fe)-1);if(!(mt<0)){var xt=Ac(mt),Je=Kf(Ge,(-yt-xt)/De);if(rg(Je,Fe),Je=cy(Je),!F)return Je;var St=z[0],Ct=M[0],vt=z[1],Gt=M[1],an;Ct0^Je[1]<(mr(Je[0]-St)Pn^(St<=Je[0]&&Je[0]<=Ct)){var on=Kf(Ge,(-yt+xt)/De);return rg(on,Fe),[Je,cy(on)]}}}function R(z,M){var F=l?t:Pn-t,Y=0;return z<-F?Y|=1:z>F&&(Y|=2),M<-F?Y|=4:M>F&&(Y|=8),Y}return Dk(x,f,g,l?[0,-t]:[-Pn,t-Pn])}function Nk(t){return function(e){var r=new dy;for(var l in t)r[l]=t[l];return r.stream=e,r}}function dy(){}dy.prototype={constructor:dy,point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}};function zk(t,e,r){var l=e[1][0]-e[0][0],p=e[1][1]-e[0][1],g=t.clipExtent&&t.clipExtent();t.scale(150).translate([0,0]),g!=null&&t.clipExtent(null),A5(r,t.stream(Ab));var x=Ab.result(),f=Math.min(l/(x[1][0]-x[0][0]),p/(x[1][1]-x[0][1])),C=+e[0][0]+(l-f*(x[1][0]+x[0][0]))/2,R=+e[0][1]+(p-f*(x[1][1]+x[0][1]))/2;return g!=null&&t.clipExtent(g),t.scale(f*150).translate([C,R])}function G5(t,e,r){return zk(t,[[0,0],e],r)}var Pb=16,H5=mi(30*Bo);function Mb(t,e){return+e?Z5(t,e):W5(t)}function W5(t){return Nk({point:function(e,r){e=t(e,r),this.stream.point(e[0],e[1])}})}function Z5(t,e){function r(l,p,g,x,f,C,R,z,M,F,Y,W,pe,me){var ve=R-l,we=z-p,Ie=ve*ve+we*we;if(Ie>4*e&&pe--){var Pe=x+F,Re=f+Y,Ve=C+W,Fe=Ac(Pe*Pe+Re*Re+Ve*Ve),ze=ou(Ve/=Fe),Ge=mr(mr(Ve)-1)e||mr((ve*xt+we*Je)/Ie-.5)>.3||x*F+f*Y+C*W2?Je[2]%360*Bo:0,mt()):[R*rl,z*rl,M*rl]},Ge.precision=function(Je){return arguments.length?(Ve=Mb(De,Re=Je*Je),xt()):Ac(Re)},Ge.fitExtent=function(Je,St){return zk(Ge,Je,St)},Ge.fitSize=function(Je,St){return G5(Ge,Je,St)};function mt(){Y=Lk(F=L5(R,z,M),e);var Je=e(f,C);return g=l-Je[0]*r,x=p+Je[1]*r,xt()}function xt(){return Fe=ze=null,Ge}return function(){return e=t.apply(this,arguments),Ge.invert=e.invert&&yt,mt()}}function Fk(t){return function(e,r){var l=mi(e),p=mi(r),g=t(l*p);return[g*p*gi(e),g*gi(r)]}}function Bk(t){return function(e,r){var l=Ac(e*e+r*r),p=t(l),g=gi(p),x=mi(p);return[gc(e*g,l*x),ou(l&&r*g/l)]}}var K5=Fk(function(t){return Ac(2/(1+t))});K5.invert=Bk(function(t){return 2*ou(t/2)});var Uk=Fk(function(t){return(t=Ak(t))&&t/gi(t)});Uk.invert=Bk(function(t){return t});function J5(){return X5(Uk).scale(79.4188).clipAngle(180-.001)}function Rb(t,e){return[t,e]}Rb.invert=Rb;var Q5=Object.defineProperty,Lc=(t,e)=>Q5(t,"name",{value:e,configurable:!0}),{BufferOp:eF,GeoJSONReader:tF,GeoJSONWriter:nF}=T5;function jk(t,e,r){r=r||{};var l=r.units||"kilometers",p=r.steps||8;if(!t)throw new Error("geojson is required");if(typeof r!="object")throw new Error("options must be an object");if(typeof p!="number")throw new Error("steps must be an number");if(e===void 0)throw new Error("radius is required");if(p<=0)throw new Error("steps must be greater than 0");var g=[];switch(t.type){case"GeometryCollection":return cu(t,function(x){var f=Uh(x,e,l,p);f&&g.push(f)}),ds(g);case"FeatureCollection":return rp(t,function(x){var f=Uh(x,e,l,p);f&&rp(f,function(C){C&&g.push(C)})}),ds(g)}return Uh(t,e,l,p)}Lc(jk,"buffer");function Uh(t,e,r,l){var p=t.properties||{},g=t.type==="Feature"?t.geometry:t;if(g.type==="GeometryCollection"){var x=[];return cu(t,function(pe){var me=Uh(pe,e,r,l);me&&x.push(me)}),ds(x)}var f=Vk(g),C={type:g.type,coordinates:d_(g.coordinates,f)},R=new tF,z=R.read(C),M=u_(Sp(e,r),"meters"),F=eF.bufferOp(z,M,l),Y=new nF;if(F=Y.write(F),!f_(F.coordinates)){var W={type:F.type,coordinates:p_(F.coordinates,f)};return Vo(W,p)}}Lc(Uh,"bufferFeature");function f_(t){return Array.isArray(t[0])?f_(t[0]):isNaN(t[0])}Lc(f_,"coordsIsNaN");function d_(t,e){return typeof t[0]!="object"?e(t):t.map(function(r){return d_(r,e)})}Lc(d_,"projectCoords");function p_(t,e){return typeof t[0]!="object"?e.invert(t):t.map(function(r){return p_(r,e)})}Lc(p_,"unprojectCoords");function Vk(t){var e=Tk(t).geometry.coordinates,r=[-e[0],-e[1]];return J5().rotate(r).scale(fo)}Lc(Vk,"defineProjection");var iF=jk,rF=Object.defineProperty,oF=(t,e)=>rF(t,"name",{value:e,configurable:!0});function qk(t){const e=[];if(cu(t,p=>{e.push(p.coordinates)}),e.length<2)throw new Error("Must have at least two features");const r=t.features[0].properties||{},l=bk.difference(e[0],...e.slice(1));return l.length===0?null:l.length===1?Tc(l[0],r):wp(l,r)}oF(qk,"difference");var sF=qk;function Ob(t){let e;for(const r of t)e&&r[0]-e[0]>=180?r[0]-=360:e&&r[0]-e[0]<-180&&(r[0]+=360),e=r}function Db(t,e){const r=sF(ds([Tc([[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]),t]));if(!r)return;r.properties={isMask:"y"};const l=iF(t,0);if(l){if(l.geometry.type==="Polygon")for(const p of l.geometry.coordinates)Ob(p);else for(const p of l.geometry.coordinates)for(const g of p)Ob(g);e(ds([l,r]))}}const Nb=ds([]);function q6(t,e,r=!0,l=!0,p={},g={},x={fill:{paint:{"fill-color":"#000","fill-opacity":.1},filter:["all",["==",["geometry-type"],"Polygon"],["has","isMask"]]},line:{layout:{"line-cap":"square"},paint:{"line-width":["case",["==",["geometry-type"],"Polygon"],2,3],"line-dasharray":[1,1],"line-color":"#3170fe"},filter:["!",["has","isMask"]]}}){let f;const C=[];let R,z,M;function F(){!t.getSource("full-geom")&&(x!=null&&x.fill||x!=null&&x.line)&&t.addSource("full-geom",{type:"geojson",data:Nb}),!t.getLayer("full-geom-fill")&&x!=null&&x.fill&&t.addLayer({...x==null?void 0:x.fill,id:"full-geom-fill",type:"fill",source:"full-geom"}),!t.getLayer("full-geom-line")&&x!=null&&x.line&&t.addLayer({...x==null?void 0:x.line,id:"full-geom-line",type:"line",source:"full-geom"}),M&&pe(M)}t.loaded()?F():t.once("load",()=>{F()}),t.on("styledata",()=>{F()});const Y=me=>{f==null||f({type:"mapClick",coordinates:[me.lngLat.lng,me.lngLat.lat]})};function W(me=!1){if(!e)throw new Error;const ve=document.createElement("div");return me&&ve.classList.add("marker-interactive"),new xO({props:{displayIn:"maplibre"},target:ve}),new e.Marker({element:ve,offset:[1,-13]})}function pe(me){var ve;M=me,(ve=t.getSource("full-geom"))==null||ve.setData(me)}return{setEventHandler(me){me?(f=me,t.on("click",Y)):(f=void 0,t.off("click",Y))},flyTo(me,ve){t.flyTo({center:me,zoom:ve,...p})},fitBounds(me,ve,we){t.fitBounds([[me[0],me[1]],[me[2],me[3]]],{padding:ve,maxZoom:we,...g})},indicateReverse(me){t.getCanvasContainer().style.cursor=me?"crosshair":""},setReverseMarker(me){!e||!r||(z?me?z.setLngLat(me):(z.remove(),z=void 0):me&&(z=(typeof r=="object"?new e.Marker(r):W()).setLngLat(me).addTo(t),z.getElement().classList.add("marker-reverse")))},setMarkers(me,ve){if(r){for(const we of C)we.remove();if(C.length=0,pe(Nb),!!e){if(ve){let we=!1;if(ve.geometry.type==="GeometryCollection"){const Ie=ve.geometry.geometries.filter(Pe=>Pe.type==="Polygon"||Pe.type==="MultiPolygon");e:if(Ie.length>0){const Pe=b5(ds(Ie.map(Re=>Vo(Re))));if(!Pe)break e;Db({...ve,geometry:Pe.geometry},pe),we=!0}else{const Pe=ve.geometry.geometries.filter(Re=>Re.type==="LineString"||Re.type==="MultiLineString");Pe.length>0&&(pe({...ve,geometry:{type:"GeometryCollection",geometries:Pe}}),we=!0)}}if(!we){if(ve.geometry.type==="Polygon"||ve.geometry.type==="MultiPolygon")Db(ve,pe);else if(ve.geometry.type==="LineString"||ve.geometry.type==="MultiLineString"){pe(ve);return}}r&&C.push((typeof r=="object"?new e.Marker(r):W()).setLngLat(ve.center).addTo(t))}if(l)for(const we of me??[]){if(we===ve)continue;const Ie=(typeof l=="object"?new e.Marker(l):W(!0)).setLngLat(we.center).setPopup(new e.Popup({offset:[1,-27],closeButton:!1,closeOnMove:!0,className:"maptiler-gc-popup"}).setText(we.place_type[0]==="reverse"?we.place_name:we.place_name.replace(/,.*/,""))).addTo(t),Pe=Ie.getElement();Pe.addEventListener("click",Re=>{Re.stopPropagation(),f==null||f({type:"markerClick",id:we.id})}),Pe.addEventListener("mouseenter",()=>{f==null||f({type:"markerMouseEnter",id:we.id}),Ie.togglePopup()}),Pe.addEventListener("mouseleave",()=>{f==null||f({type:"markerMouseLeave",id:we.id}),Ie.togglePopup()}),C.push(Ie)}}}},setSelectedMarker(me){R&&R.getElement().classList.toggle("marker-selected",!1),R=me>-1?C[me]:void 0,R==null||R.getElement().classList.toggle("marker-selected",!0)},getCenterAndZoom(){const me=t.getCenter();return[t.getZoom(),me.lng,me.lat]}}}const aF=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([6-9][0-9])\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([6-9][0-9])\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*(EAST|WEST|[EW])?$/i,zb=/^([+-]?[0-8]?[0-9])\s+([0-5]?[0-9]\.\d{3,})[\s,]{1,}([+-]?[0-1]?[0-9]?[0-9])\s+([0-5]?[0-9]\.\d{3,})$/,Fb=/^(NORTH|SOUTH|[NS])?[\s]*([+-]?[0-8]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(NORTH|SOUTH|[NS])?[\s]*[,/;]?[\s]*(EAST|WEST|[EW])?[\s]*([+-]?[0-1]?[0-9]?[0-9](?:[\.,]\d{3,}))[\s]*([•º°]?)[\s]*(EAST|WEST|[EW])?$/i,Bb=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(\.)\s*([0-5]?[0-9])\s*(\.)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(EAST|WEST|[EW])?$/i,Ub=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*(D(?:EG)?(?:REES)?)\s*([0-5]?[0-9])\s*(M(?:IN)?(?:UTES)?)\s*((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(S(?:EC)?(?:ONDS)?)\s*(EAST|WEST|[EW])?$/i,jb=/^(NORTH|SOUTH|[NS])?\s*([+-]?[0-8]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|’’|´´|["″”\.])?\s*(NORTH|SOUTH|[NS])?(?:\s*[,/;]\s*|\s*)(EAST|WEST|[EW])?\s*([+-]?[0-1]?[0-9]?[0-9])\s*([•º°\.:]|D(?:EG)?(?:REES)?)?\s*,?([0-5]?[0-9](?:[\.,]\d{1,})?)?\s*(['′´’\.:]|M(?:IN)?(?:UTES)?)?\s*,?((?:[0-5]?[0-9])(?:[\.,]\d{1,3})?)?\s*(''|′′|´´|’’|["″”\.])?\s*(EAST|WEST|[EW])?$/i;function lF(t){if(!["DMS","DM","DD"].includes(t))throw new Error("invalid format specified");if(this.decimalCoordinates&&this.decimalCoordinates.trim()){const e=this.decimalCoordinates.split(",").map(Y=>Number(Y.trim())),r=Number(e[0]),l=Number(e[1]),p=Math.abs(r),g=Math.abs(l),x=r>0?"N":"S",f=l>0?"E":"W";let C;t=="DD"&&(C=`${p}° ${x}, ${g}° ${f}`);const R=Math.floor(p),z=Math.floor(g),M=(p-R)*60,F=(g-z)*60;if(t=="DM"){let Y=Vb(M,3).toFixed(3).padStart(6,"0"),W=Vb(F,3).toFixed(3).padStart(6,"0");Y.endsWith(".000")&&W.endsWith(".000")&&(Y=Y.replace(/\.000$/,""),W=W.replace(/\.000$/,"")),C=`${R}° ${Y}' ${x}, ${z}° ${W}' ${f}`}if(t=="DMS"){const Y=Math.floor(M),W=Math.floor(F);let pe=((M-Y)*60).toFixed(1).padStart(4,"0"),me=((F-W)*60).toFixed(1).padStart(4,"0");const ve=Y.toString().padStart(2,"0"),we=W.toString().padStart(2,"0");pe.endsWith(".0")&&me.endsWith(".0")&&(pe=pe.replace(/\.0$/,""),me=me.replace(/\.0$/,"")),C=`${R}° ${ve}' ${pe}" ${x}, ${z}° ${we}' ${me}" ${f}`}return C}else throw new Error("no decimal coordinates to convert")}function Vb(t,e){const r=Math.pow(10,e);return Math.round((t+Number.EPSILON)*r)/r}function m_(t,e){e||(e=5),t=t.replace(/\s+/g," ").trim();let r=null,l=null,p="",g="",x=null,f=[],C=!1;if(aF.test(t))throw new Error("invalid coordinate value");if(zb.test(t))if(f=zb.exec(t),C=Eh(f),C)r=Math.abs(f[1])+f[2]/60,Number(f[1])<0&&(r*=-1),l=Math.abs(f[3])+f[4]/60,Number(f[3])<0&&(l*=-1),x="DM";else throw new Error("invalid coordinate format");else if(Fb.test(t))if(f=Fb.exec(t),C=Eh(f),C){if(r=f[2],l=f[6],r.includes(",")&&(r=r.replace(",",".")),l.includes(",")&&(l=l.replace(",",".")),x="DD",Number(Math.round(r))==Number(r))throw new Error("integer only coordinate provided");if(Number(Math.round(l))==Number(l))throw new Error("integer only coordinate provided");f[1]?(p=f[1],g=f[5]):f[4]&&(p=f[4],g=f[8])}else throw new Error("invalid decimal coordinate format");else if(Bb.test(t))if(f=Bb.exec(t),C=Eh(f),C)r=Math.abs(parseInt(f[2])),f[4]&&(r+=f[4]/60,x="DM"),f[6]&&(r+=f[6].replace(",",".")/3600,x="DMS"),parseInt(f[2])<0&&(r=-1*r),l=Math.abs(parseInt(f[9])),f[11]&&(l+=f[11]/60),f[13]&&(l+=f[13].replace(",",".")/3600),parseInt(f[9])<0&&(l=-1*l),f[1]?(p=f[1],g=f[8]):f[7]&&(p=f[7],g=f[14]);else throw new Error("invalid DMS coordinates format");else if(Ub.test(t))if(f=Ub.exec(t),C=Eh(f),C)r=Math.abs(parseInt(f[2])),f[4]&&(r+=f[4]/60,x="DM"),f[6]&&(r+=f[6]/3600,x="DMS"),parseInt(f[2])<0&&(r=-1*r),l=Math.abs(parseInt(f[10])),f[12]&&(l+=f[12]/60),f[14]&&(l+=f[14]/3600),parseInt(f[10])<0&&(l=-1*l),f[1]?(p=f[1],g=f[9]):f[8]&&(p=f[8],g=f[16]);else throw new Error("invalid DMS coordinates format");else if(jb.test(t)){if(f=jb.exec(t),C=Eh(f),f.filter(R=>R).length<=5)throw new Error("invalid coordinates format");if(C)r=Math.abs(parseInt(f[2])),f[4]&&(r+=f[4].replace(",",".")/60,x="DM"),f[6]&&(r+=f[6].replace(",",".")/3600,x="DMS"),parseInt(f[2])<0&&(r=-1*r),l=Math.abs(parseInt(f[10])),f[12]&&(l+=f[12].replace(",",".")/60),f[14]&&(l+=f[14].replace(",",".")/3600),parseInt(f[10])<0&&(l=-1*l),f[1]?(p=f[1],g=f[9]):f[8]&&(p=f[8],g=f[16]);else throw new Error("invalid coordinates format")}if(C){if(Math.abs(l)>=180)throw new Error("invalid longitude value");if(Math.abs(r)>=90)throw new Error("invalid latitude value");if(p&&!g||!p&&g)throw new Error("invalid coordinates value");if(p&&p==g)throw new Error("invalid coordinates format");r.toString().includes(",")&&(r=r.replace(",",".")),l.toString().includes(",")&&(l=l.replace(",","."));let R=/S|SOUTH/i;R.test(p)&&r>0&&(r=-1*r),R=/W|WEST/i,R.test(g)&&l>0&&(l=-1*l);const z=f[0].trim();let M,F;const Y=/[,/;\u0020]/g,W=z.match(Y);if(W==null){const ve=Math.floor(t.length/2);M=z.substring(0,ve).trim(),F=z.substring(ve).trim()}else{let ve;W.length%2==1?ve=Math.floor(W.length/2):ve=W.length/2-1;let we=0;if(ve==0)we=z.indexOf(W[0]),M=z.substring(0,we).trim(),F=z.substring(we+1).trim();else{let Ie=0,Pe=0;for(;Ie<=ve;)we=z.indexOf(W[Ie],Pe),Pe=we+1,Ie++;M=z.substring(0,we).trim(),F=z.substring(we+1).trim()}}const pe=M.split(".");if(pe.length==2&&pe[1]==0&&pe[1].length!=2)throw new Error("invalid coordinates format");const me=F.split(".");if(me.length==2&&me[1]==0&&me[1].length!=2)throw new Error("invalid coordinates format");if(/^\d+$/.test(M)||/^\d+$/.test(F))throw new Error("degree only coordinate/s provided");return r=Number(Number(r).toFixed(e)),l=Number(Number(l).toFixed(e)),Object.freeze({verbatimCoordinates:z,verbatimLatitude:M,verbatimLongitude:F,decimalLatitude:r,decimalLongitude:l,decimalCoordinates:`${r},${l}`,originalFormat:x,closeEnough:uF,toCoordinateFormat:lF})}else throw new Error("coordinates pattern match failed")}function Eh(t){if(!isNaN(t[0]))return!1;const e=[...t];if(e.shift(),e.length%2>0)return!1;const r=/^[-+]?\d+([\.,]\d+)?$/,l=/[eastsouthnorthwest]+/i,p=e.length/2;for(let g=0;g{e.decimalLatitude?t.push(e):t.push({...e,...fF})}),[...t,...dF,...pF]}const gF=mF();m_.formats=gF.map(t=>t.verbatimCoordinates);const G6=m_;function Gb(t){let e,r;return e=new qT({props:{$$slots:{default:[yF]},$$scope:{ctx:t}}}),e.$on("click",t[5]),{c(){po(e.$$.fragment)},m(l,p){to(e,l,p),r=!0},p(l,p){const g={};p&128&&(g.$$scope={dirty:p,ctx:l}),e.$set(g)},i(l){r||(Vt(e.$$.fragment,l),r=!0)},o(l){en(e.$$.fragment,l),r=!1},d(l){no(e,l)}}}function yF(t){let e;return{c(){e=Ia("X")},m(r,l){Fn(r,e,l)},d(r){r&&Mn(e)}}}function _F(t){let e,r,l,p,g,x,f,C,R,z,M=t[2]&&Gb(t);const F=t[4].default,Y=ps(F,t,t[7],null);return{c(){e=si("div"),r=si("div"),l=si("div"),p=si("h1"),g=Ia(t[1]),x=qr(),M&&M.c(),f=qr(),Y&&Y.c(),bn(p,"class","govuk-heading-l"),e0(l,"display","flex"),e0(l,"justify-content","space-between"),bn(r,"class","content centered-fullscreen svelte-1st8ub0"),bn(e,"class","background svelte-1st8ub0"),Us(e,"open",t[0]),Us(e,"closed",!t[0])},m(W,pe){Fn(W,e,pe),oi(e,r),oi(r,l),oi(l,p),oi(p,g),oi(l,x),M&&M.m(l,null),oi(r,f),Y&&Y.m(r,null),C=!0,R||(z=[wa(r,"click",lT(vF)),wa(e,"click",t[6])],R=!0)},p(W,[pe]){(!C||pe&2)&&vc(g,W[1]),W[2]?M?(M.p(W,pe),pe&4&&Vt(M,1)):(M=Gb(W),M.c(),Vt(M,1),M.m(l,null)):M&&(_s(),en(M,1,1,()=>{M=null}),vs()),Y&&Y.p&&(!C||pe&128)&&gs(Y,F,W,W[7],C?ms(F,W[7],pe,null):ys(W[7]),null),(!C||pe&1)&&Us(e,"open",W[0]),(!C||pe&1)&&Us(e,"closed",!W[0])},i(W){C||(Vt(M),Vt(Y,W),C=!0)},o(W){en(M),en(Y,W),C=!1},d(W){W&&Mn(e),M&&M.d(),Y&&Y.d(W),R=!1,Gs(z)}}}const vF=()=>null;function xF(t,e,r){let{$$slots:l={},$$scope:p}=e,{title:g}=e,{open:x=!1}=e,{displayEscapeButton:f=!0}=e,{canCloseByClickingBackground:C=!0}=e;const R=()=>r(0,x=!1),z=()=>{C&&r(0,x=!1)};return t.$$set=M=>{"title"in M&&r(1,g=M.title),"open"in M&&r(0,x=M.open),"displayEscapeButton"in M&&r(2,f=M.displayEscapeButton),"canCloseByClickingBackground"in M&&r(3,C=M.canCloseByClickingBackground),"$$scope"in M&&r(7,p=M.$$scope)},[x,g,f,C,l,R,z,p]}class H6 extends Zi{constructor(e){super(),Wi(this,e,xF,_F,yi,{title:1,open:0,displayEscapeButton:2,canCloseByClickingBackground:3})}}var cp=bF;function bF(t){var e,r,l;if(t){if(Array.isArray(t)){for(e=[],r=t.length,l=0;lnew Promise((l,p)=>{var g=C=>{try{f(r.next(C))}catch(R){p(R)}},x=C=>{try{f(r.throw(C))}catch(R){p(R)}},f=C=>C.done?l(C.value):Promise.resolve(C.value).then(g,x);f((r=r.apply(t,e)).next())}),Eo=Uint8Array,ic=Uint16Array,kF=Int32Array,Gk=new Eo([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Hk=new Eo([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13,0,0]),EF=new Eo([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Wk=function(t,e){for(var r=new ic(31),l=0;l<31;++l)r[l]=e+=1<>1|(zn&21845)<<1,xa=(xa&52428)>>2|(xa&13107)<<2,xa=(xa&61680)>>4|(xa&3855)<<4,py[zn]=((xa&65280)>>8|(xa&255)<<8)>>1;var xa,zn,jh=function(t,e,r){for(var l=t.length,p=0,g=new ic(e);p>C]=R}else for(f=new ic(l),p=0;p>15-t[p]);return f},uf=new Eo(288);for(zn=0;zn<144;++zn)uf[zn]=8;var zn;for(zn=144;zn<256;++zn)uf[zn]=9;var zn;for(zn=256;zn<280;++zn)uf[zn]=7;var zn;for(zn=280;zn<288;++zn)uf[zn]=8;var zn,Xk=new Eo(32);for(zn=0;zn<32;++zn)Xk[zn]=5;var zn,AF=jh(uf,9,1),LF=jh(Xk,5,1),sg=function(t){for(var e=t[0],r=1;re&&(e=t[r]);return e},as=function(t,e,r){var l=e/8|0;return(t[l]|t[l+1]<<8)>>(e&7)&r},ag=function(t,e){var r=e/8|0;return(t[r]|t[r+1]<<8|t[r+2]<<16)>>(e&7)},PF=function(t){return(t+7)/8|0},MF=function(t,e,r){(e==null||e<0)&&(e=0),(r==null||r>t.length)&&(r=t.length);var l=new Eo(r-e);return l.set(t.subarray(e,r)),l},RF=["unexpected EOF","invalid block type","invalid length/literal","invalid distance","stream finished","no stream handler",,"no callback","invalid UTF-8 data","extra field too long","date not in range 1980-2099","filename too long","stream finishing","invalid zip data"],ko=function(t,e,r){var l=new Error(e||RF[t]);if(l.code=t,Error.captureStackTrace&&Error.captureStackTrace(l,ko),!r)throw l;return l},y_=function(t,e,r,l){var p=t.length,g=l?l.length:0;if(!p||e.f&&!e.l)return r||new Eo(0);var x=!r||e.i!=2,f=e.i;r||(r=new Eo(p*3));var C=function($t){var bt=r.length;if($t>bt){var fe=new Eo(Math.max(bt*2,$t));fe.set(r),r=fe}},R=e.f||0,z=e.p||0,M=e.b||0,F=e.l,Y=e.d,W=e.m,pe=e.n,me=p*8;do{if(!F){R=as(t,z,1);var ve=as(t,z+1,3);if(z+=3,ve)if(ve==1)F=AF,Y=LF,W=9,pe=5;else if(ve==2){var Re=as(t,z,31)+257,Ve=as(t,z+10,15)+4,Fe=Re+as(t,z+5,31)+1;z+=14;for(var ze=new Eo(Fe),Ge=new Eo(19),yt=0;yt>4;if(we<16)ze[yt++]=we;else{var St=0,Ct=0;for(we==16?(Ct=3+as(t,z,3),z+=2,St=ze[yt-1]):we==17?(Ct=3+as(t,z,7),z+=3):we==18&&(Ct=11+as(t,z,127),z+=7);Ct--;)ze[yt++]=St}}var vt=ze.subarray(0,Re),Gt=ze.subarray(Re);W=sg(vt),pe=sg(Gt),F=jh(vt,W,1),Y=jh(Gt,pe,1)}else ko(1);else{var we=PF(z)+4,Ie=t[we-4]|t[we-3]<<8,Pe=we+Ie;if(Pe>p){f&&ko(0);break}x&&C(M+Ie),r.set(t.subarray(we,Pe),M),e.b=M+=Ie,e.p=z=Pe*8,e.f=R;continue}if(z>me){f&&ko(0);break}}x&&C(M+131072);for(var an=(1<>4;if(z+=St&15,z>me){f&&ko(0);break}if(St||ko(2),Nt<256)r[M++]=Nt;else if(Nt==256){tn=z,F=null;break}else{var on=Nt-254;if(Nt>264){var yt=Nt-257,Et=Gk[yt];on=as(t,z,(1<>4;gn||ko(3),z+=gn&15;var Gt=CF[wn];if(wn>3){var Et=Hk[wn];Gt+=ag(t,z)&(1<me){f&&ko(0);break}x&&C(M+131072);var In=M+on;if(M>3&1)+(e>>4&1);l>0;l-=!t[r++]);return r+(e&2)},NF=function(t){var e=t.length;return(t[e-4]|t[e-3]<<8|t[e-2]<<16|t[e-1]<<24)>>>0},zF=function(t,e){return((t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31)&&ko(6,"invalid zlib data"),(t[1]>>5&1)==+!e&&ko(6,"invalid zlib data: "+(t[1]&32?"need":"unexpected")+" dictionary"),(t[1]>>3&4)+2};function FF(t,e){return y_(t,{i:2},e&&e.out,e&&e.dictionary)}function BF(t,e){var r=DF(t);return r+8>t.length&&ko(6,"invalid gzip data"),y_(t.subarray(r,-8),{i:2},e&&e.out||new Eo(NF(t)),e&&e.dictionary)}function UF(t,e){return y_(t.subarray(zF(t,e&&e.dictionary),-4),{i:2},e&&e.out,e&&e.dictionary)}function my(t,e){return t[0]==31&&t[1]==139&&t[2]==8?BF(t,e):(t[0]&15)!=8||t[0]>>4>7||(t[0]<<8|t[1])%31?FF(t,e):UF(t,e)}var jF=typeof TextDecoder<"u"&&new TextDecoder,VF=0;try{jF.decode(OF,{stream:!0}),VF=1}catch{}var $k=(t,e)=>t*lc(2,e),Ih=(t,e)=>Math.floor(t/lc(2,e)),hp=(t,e)=>$k(t.getUint16(e+1,!0),8)+t.getUint8(e),Kk=(t,e)=>$k(t.getUint32(e+2,!0),16)+t.getUint16(e,!0),qF=(t,e,r,l,p)=>{if(t!==l.getUint8(p))return t-l.getUint8(p);const g=hp(l,p+1);if(e!==g)return e-g;const x=hp(l,p+4);return r!==x?r-x:0},GF=(t,e,r,l)=>{const p=Jk(t,e|128,r,l);return p?{z:e,x:r,y:l,offset:p[0],length:p[1],isDir:!0}:null},Wb=(t,e,r,l)=>{const p=Jk(t,e,r,l);return p?{z:e,x:r,y:l,offset:p[0],length:p[1],isDir:!1}:null},Jk=(t,e,r,l)=>{let p=0,g=t.byteLength/17-1;for(;p<=g;){const x=g+p>>1,f=qF(e,r,l,t,x*17);if(f>0)p=x+1;else if(f<0)g=x-1;else return[Kk(t,x*17+7),t.getUint32(x*17+13,!0)]}return null},HF=(t,e)=>t.isDir&&!e.isDir?1:!t.isDir&&e.isDir?-1:t.z!==e.z?t.z-e.z:t.x!==e.x?t.x-e.x:t.y-e.y,Qk=(t,e)=>{const r=t.getUint8(e*17);return{z:r&127,x:hp(t,e*17+1),y:hp(t,e*17+4),offset:Kk(t,e*17+7),length:t.getUint32(e*17+13,!0),isDir:r>>7===1}},Zb=t=>{const e=[],r=new DataView(t);for(let l=0;l{t.sort(HF);const e=new ArrayBuffer(17*t.length),r=new Uint8Array(e);for(let l=0;l>8&255,r[l*17+3]=p.x>>16&255,r[l*17+4]=p.y&255,r[l*17+5]=p.y>>8&255,r[l*17+6]=p.y>>16&255,r[l*17+7]=p.offset&255,r[l*17+8]=Ih(p.offset,8)&255,r[l*17+9]=Ih(p.offset,16)&255,r[l*17+10]=Ih(p.offset,24)&255,r[l*17+11]=Ih(p.offset,32)&255,r[l*17+12]=Ih(p.offset,48)&255,r[l*17+13]=p.length&255,r[l*17+14]=p.length>>8&255,r[l*17+15]=p.length>>16&255,r[l*17+16]=p.length>>24&255}return e},ZF=(t,e)=>{if(t.byteLength<17)return null;const r=t.byteLength/17,l=Qk(t,r-1);if(l.isDir){const p=l.z,g=e.z-p,x=Math.trunc(e.x/(1<(e,r)=>{if(r instanceof AbortController)return t(e,r);const l=new AbortController;return t(e,l).then(p=>r(void 0,p.data,p.cacheControl||"",p.expires||""),p=>r(p)).catch(p=>r(p)),{cancel:()=>l.abort()}},W6=class{constructor(){this.tilev4=(t,e)=>Vr(this,null,function*(){if(t.type==="json"){const M=t.url.substr(10);let F=this.tiles.get(M);F||(F=new Yb(M),this.tiles.set(M,F));const Y=yield F.getHeader();return{data:{tiles:[`${t.url}/{z}/{x}/{y}`],minzoom:Y.minZoom,maxzoom:Y.maxZoom,bounds:[Y.minLon,Y.minLat,Y.maxLon,Y.maxLat]}}}const r=new RegExp(/pmtiles:\/\/(.+)\/(\d+)\/(\d+)\/(\d+)/),l=t.url.match(r);if(!l)throw new Error("Invalid PMTiles protocol URL");const p=l[1];let g=this.tiles.get(p);g||(g=new Yb(p),this.tiles.set(p,g));const x=l[2],f=l[3],C=l[4],R=yield g.getHeader(),z=yield g==null?void 0:g.getZxy(+x,+f,+C,e.signal);return z?{data:new Uint8Array(z.data),cacheControl:z.cacheControl,expires:z.expires}:R.tileType===1?{data:new Uint8Array}:{data:null}}),this.tile=$F(this.tilev4),this.tiles=new Map}add(t){this.tiles.set(t.source.getKey(),t)}get(t){return this.tiles.get(t)}};function $u(t,e){return(e>>>0)*4294967296+(t>>>0)}function KF(t,e){const r=e.buf;let l=r[e.pos++],p=(l&112)>>4;if(l<128||(l=r[e.pos++],p|=(l&127)<<3,l<128)||(l=r[e.pos++],p|=(l&127)<<10,l<128)||(l=r[e.pos++],p|=(l&127)<<17,l<128)||(l=r[e.pos++],p|=(l&127)<<24,l<128)||(l=r[e.pos++],p|=(l&1)<<31,l<128))return $u(t,p);throw new Error("Expected varint not more than 10 bytes")}function Th(t){const e=t.buf;let r=e[t.pos++],l=r&127;return r<128||(r=e[t.pos++],l|=(r&127)<<7,r<128)||(r=e[t.pos++],l|=(r&127)<<14,r<128)||(r=e[t.pos++],l|=(r&127)<<21,r<128)?l:(r=e[t.pos],l|=(r&15)<<28,KF(l,t))}function JF(t,e,r,l){if(l===0){r===1&&(e[0]=t-1-e[0],e[1]=t-1-e[1]);const p=e[0];e[0]=e[1],e[1]=p}}var QF=[0,1,5,21,85,341,1365,5461,21845,87381,349525,1398101,5592405,22369621,89478485,357913941,1431655765,5726623061,22906492245,91625968981,366503875925,1466015503701,5864062014805,23456248059221,93824992236885,375299968947541,0x5555555555555];function eB(t,e,r){if(t>26)throw Error("Tile zoom level exceeds max safe number limit (26)");if(e>lc(2,t)-1||r>lc(2,t)-1)throw Error("tile x/y outside zoom level bounds");const l=QF[t],p=lc(2,t);let g=0,x=0,f=0;const C=[e,r];let R=p/2;for(;R>0;)g=(C[0]&R)>0?1:0,x=(C[1]&R)>0?1:0,f+=R*R*(3*g^x),JF(R,C,g,x),R=R/2;return l+f}function tE(t,e){return Vr(this,null,function*(){if(e===1||e===0)return t;if(e===2){if(typeof globalThis.DecompressionStream>"u")return my(new Uint8Array(t));const r=new Response(t).body;if(!r)throw Error("Failed to read response stream");const l=r.pipeThrough(new globalThis.DecompressionStream("gzip"));return new Response(l).arrayBuffer()}throw Error("Compression method not supported")})}var tB=127;function nB(t,e){let r=0,l=t.length-1;for(;r<=l;){const p=l+r>>1,g=e-t[p].tileId;if(g>0)r=p+1;else if(g<0)l=p-1;else return t[p]}return l>=0&&(t[l].runLength===0||e-t[l].tileId=300)throw Error(`Bad response code: ${C.status}`);const z=C.headers.get("Content-Length");if(C.status===200&&(!z||+z>e))throw p&&p.abort(),Error("Server returned no content-length header or content-length exceeding request. Check that your storage backend supports HTTP Byte Serving.");return{data:yield C.arrayBuffer(),etag:R||void 0,cacheControl:C.headers.get("Cache-Control")||void 0,expires:C.headers.get("Expires")||void 0}})}};function ls(t,e){const r=t.getUint32(e+4,!0),l=t.getUint32(e+0,!0);return r*lc(2,32)+l}function rB(t,e){const r=new DataView(t),l=r.getUint8(7);if(l>3)throw Error(`Archive is spec version ${l} but this library supports up to spec version 3`);return{specVersion:l,rootDirectoryOffset:ls(r,8),rootDirectoryLength:ls(r,16),jsonMetadataOffset:ls(r,24),jsonMetadataLength:ls(r,32),leafDirectoryOffset:ls(r,40),leafDirectoryLength:ls(r,48),tileDataOffset:ls(r,56),tileDataLength:ls(r,64),numAddressedTiles:ls(r,72),numTileEntries:ls(r,80),numTileContents:ls(r,88),clustered:r.getUint8(96)===1,internalCompression:r.getUint8(97),tileCompression:r.getUint8(98),tileType:r.getUint8(99),minZoom:r.getUint8(100),maxZoom:r.getUint8(101),minLon:r.getInt32(102,!0)/1e7,minLat:r.getInt32(106,!0)/1e7,maxLon:r.getInt32(110,!0)/1e7,maxLat:r.getInt32(114,!0)/1e7,centerZoom:r.getUint8(118),centerLon:r.getInt32(119,!0)/1e7,centerLat:r.getInt32(123,!0)/1e7,etag:e}}function nE(t){const e={buf:new Uint8Array(t),pos:0},r=Th(e),l=[];let p=0;for(let g=0;g0?l[g].offset=l[g-1].offset+l[g-1].length:l[g].offset=x-1}return l}function oB(t){const e=new DataView(t);return e.getUint16(2,!0)===2?(console.warn("PMTiles spec version 2 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),2):e.getUint16(2,!0)===1?(console.warn("PMTiles spec version 1 has been deprecated; please see github.com/protomaps/PMTiles for tools to upgrade"),1):3}var gy=class extends Error{};function sB(t,e){return Vr(this,null,function*(){const r=yield t.getBytes(0,16384);if(new DataView(r.data).getUint16(0,!0)!==19792)throw new Error("Wrong magic number for PMTiles archive");if(oB(r.data)<3)return[yield eE.getHeader(t)];const p=r.data.slice(0,tB),g=rB(p,r.etag),x=r.data.slice(g.rootDirectoryOffset,g.rootDirectoryOffset+g.rootDirectoryLength),f=`${t.getKey()}|${g.etag||""}|${g.rootDirectoryOffset}|${g.rootDirectoryLength}`,C=nE(yield e(x,g.internalCompression));return[g,[f,C.length,C]]})}function aB(t,e,r,l,p){return Vr(this,null,function*(){const g=yield t.getBytes(r,l,void 0,p.etag),x=yield e(g.data,p.internalCompression),f=nE(x);if(f.length===0)throw new Error("Empty directory is invalid");return f})}var lB=class{constructor(t=100,e=!0,r=tE){this.cache=new Map,this.invalidations=new Map,this.maxCacheEntries=t,this.counter=1,this.decompress=r}getHeader(t){return Vr(this,null,function*(){const e=t.getKey(),r=this.cache.get(e);if(r)return r.lastUsed=this.counter++,yield r.data;const l=new Promise((p,g)=>{sB(t,this.decompress).then(x=>{x[1]&&this.cache.set(x[1][0],{lastUsed:this.counter++,data:Promise.resolve(x[1][2])}),p(x[0]),this.prune()}).catch(x=>{g(x)})});return this.cache.set(e,{lastUsed:this.counter++,data:l}),l})}getDirectory(t,e,r,l){return Vr(this,null,function*(){const p=`${t.getKey()}|${l.etag||""}|${e}|${r}`,g=this.cache.get(p);if(g)return g.lastUsed=this.counter++,yield g.data;const x=new Promise((f,C)=>{aB(t,this.decompress,e,r,l).then(R=>{f(R),this.prune()}).catch(R=>{C(R)})});return this.cache.set(p,{lastUsed:this.counter++,data:x}),x})}getArrayBuffer(t,e,r,l){return Vr(this,null,function*(){const p=`${t.getKey()}|${l.etag||""}|${e}|${r}`,g=this.cache.get(p);if(g)return g.lastUsed=this.counter++,yield g.data;const x=new Promise((f,C)=>{t.getBytes(e,r,void 0,l.etag).then(R=>{f(R.data),this.cache.has(p),this.prune()}).catch(R=>{C(R)})});return this.cache.set(p,{lastUsed:this.counter++,data:x}),x})}prune(){if(this.cache.size>=this.maxCacheEntries){let t=1/0,e;this.cache.forEach((r,l)=>{r.lastUsed{this.getHeader(t).then(g=>{l(),this.invalidations.delete(e)}).catch(g=>{p(g)})});this.invalidations.set(e,r)})}},Yb=class{constructor(t,e,r){typeof t=="string"?this.source=new iB(t):this.source=t,r?this.decompress=r:this.decompress=tE,e?this.cache=e:this.cache=new lB}getHeader(){return Vr(this,null,function*(){return yield this.cache.getHeader(this.source)})}getZxyAttempt(t,e,r,l){return Vr(this,null,function*(){const p=eB(t,e,r),g=yield this.cache.getHeader(this.source);if(g.specVersion<3)return eE.getZxy(g,this.source,this.cache,t,e,r,l);if(tg.maxZoom)return;let x=g.rootDirectoryOffset,f=g.rootDirectoryLength;for(let C=0;C<=3;C++){const R=yield this.cache.getDirectory(this.source,x,f,g),z=nB(R,p);if(z){if(z.runLength>0){const M=yield this.source.getBytes(g.tileDataOffset+z.offset,z.length,l,g.etag);return{data:yield this.decompress(M.data,g.tileCompression),cacheControl:M.cacheControl,expires:M.expires}}x=g.leafDirectoryOffset+z.offset,f=z.length}else return}throw Error("Maximum directory depth exceeded")})}getZxy(t,e,r,l){return Vr(this,null,function*(){try{return yield this.getZxyAttempt(t,e,r,l)}catch(p){if(p instanceof gy)return this.cache.invalidate(this.source),yield this.getZxyAttempt(t,e,r,l);throw p}})}getMetadataAttempt(){return Vr(this,null,function*(){const t=yield this.cache.getHeader(this.source),e=yield this.source.getBytes(t.jsonMetadataOffset,t.jsonMetadataLength,void 0,t.etag),r=yield this.decompress(e.data,t.internalCompression),l=new TextDecoder("utf-8");return JSON.parse(l.decode(r))})}getMetadata(){return Vr(this,null,function*(){try{return yield this.getMetadataAttempt()}catch(t){if(t instanceof gy)return this.cache.invalidate(this.source),yield this.getMetadataAttempt();throw t}})}};function uB(t){return t=="google"||t=="bing"}var Ir=[];for(var lg=0;lg<256;++lg)Ir.push((lg+256).toString(16).slice(1));function cB(t,e=0){return(Ir[t[e+0]]+Ir[t[e+1]]+Ir[t[e+2]]+Ir[t[e+3]]+"-"+Ir[t[e+4]]+Ir[t[e+5]]+"-"+Ir[t[e+6]]+Ir[t[e+7]]+"-"+Ir[t[e+8]]+Ir[t[e+9]]+"-"+Ir[t[e+10]]+Ir[t[e+11]]+Ir[t[e+12]]+Ir[t[e+13]]+Ir[t[e+14]]+Ir[t[e+15]]).toLowerCase()}var ed,hB=new Uint8Array(16);function fB(){if(!ed&&(ed=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ed))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ed(hB)}var dB=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Xb={randomUUID:dB};function pB(t,e,r){if(Xb.randomUUID&&!e&&!t)return Xb.randomUUID();t=t||{};var l=t.random||(t.rng||fB)();if(l[6]=l[6]&15|64,l[8]=l[8]&63|128,e){r=r||0;for(var p=0;p<16;++p)e[r+p]=l[p];return e}return cB(l)}const Z6={hovering:"black",lineEndpointColor:"black"},Y6=10,X6=10;function mB(){return gB(["#e41a1c","#377eb8","#4daf4a","#984ea3","#ff7f00"])}function gB(t){return t[Math.floor(Math.random()*t.length)]}const $6=Hi(null),K6=Hi(null),J6=Hi(null),Q6=Hi(new Set),yB=Hi(null),_B=Hi({mode:"list"});function e8(t){let e=new Set;for(let l of t.features)e.add(l.id);let r=e.size+1;for(;e.has(r);)r++;return r}function t8(t,e){console.log(`Deleting intervention ${e}`),t.update(r=>(r.features=r.features.filter(l=>l.id!=e),r)),yB.set(null),_B.set({mode:"list"})}function n8(t){return Object.values(t.schemes)[0].scheme_reference}function i8(t){return[Math.round(t[0]*1e7)/1e7,Math.round(t[1]*1e7)/1e7]}const vB=Hi(xB());vB.subscribe(t=>window.localStorage.setItem("userSettings",JSON.stringify(t)));function xB(){let t={streetViewImagery:"google",avoidDoublingBack:!1};try{let e=JSON.parse(window.localStorage.getItem("userSettings")||"{}");uB(e.streetViewImagery)&&(t.streetViewImagery=e.streetViewImagery),typeof e.avoidDoublingBack=="boolean"&&(t.avoidDoublingBack=e.avoidDoublingBack)}catch(e){console.log(`Couldn't parse userSettings from local storage: ${e}`)}return t}function r8(t){let e={type:"FeatureCollection",features:[],schemes:{}};return bB(t,e),e}function bB(t,e){let r=pB(),l=t.initializeEmptyScheme({scheme_reference:r,color:mB()});e.schemes[r]=l}let wB=Date.now();function Ep(t){return`${t}-${wB++}`}const __=Symbol.for("svelte-maplibre");function Pc(){return dT(__)}function SB(t){let e=new WeakMap;return r=>{var x;let l=e.get(r.originalEvent);if(l!==void 0)return l;let g=(x=r.target.queryRenderedFeatures(r.point).find(f=>{var C;return(C=t.get(f.layer.id))==null?void 0:C.interactive}))==null?void 0:x.layer.id;return e.set(r.originalEvent,g),g}}function kB(){let t=new Map;return xy(__,{map:Hi(null),source:Nm(null),layer:Nm(null),popupTarget:Nm(null),cluster:Hi(),loadedImages:Hi(new Set),minzoom:Hi(0),maxzoom:Hi(24),layerEvent:Hi(null),layerInfo:t,eventTopMost:SB(t)})}function $b(t){return{subscribe:t.subscribe}}function v_({key:t,setPopupTarget:e=!1,setCluster:r=!1,setMouseEvent:l=!1}){let p=Pc(),g=Hi(null),x=$b(g),f={...p,[t]:$b(g)};if(e&&(f.popupTarget=x),l){let C=Hi(null);f.layerEvent=C,p.layerEvent=C}return r&&(f.cluster=Hi()),xy(__,f),{...p,self:g}}function EB(){return v_({key:"source",setCluster:!0})}function IB(t=!0){return v_({key:"layer",setPopupTarget:t,setMouseEvent:t})}function o8(){return v_({key:"popupTarget",setPopupTarget:!0,setMouseEvent:!0})}function TB(t){return"layerType"in t&&t.layerType==="deckgl"}function Kb(t){let e;return r=>{if(r)for(let l in r){let p=e==null?void 0:e[l],g=r[l];p!==g&&t(l,g,p)}else if(e)for(let l in e)t(l,void 0,e[l]);e=r}}function CB(t,...e){let r=[t];for(let l of e)if(l)Array.isArray(l)&&l[0]===t?r.push(...l.slice(1)):r.push(l);else continue;if(r.length!==1)return r.length===2?r[1]:r}function AB(t){return t===!0?["has","point_count"]:t===!1?["!",["has","point_count"]]:void 0}function s8(t,e){return["case",["boolean",["feature-state","hover"],!1],e,t]}function Jb(t){let e=t[0],r,l,p=Qb(t);return{c(){p.c(),r=ml()},m(g,x){p.m(g,x),Fn(g,r,x),l=!0},p(g,x){x[0]&1&&yi(e,e=g[0])?(_s(),en(p,1,1,tr),vs(),p=Qb(g),p.c(),Vt(p,1),p.m(r.parentNode,r)):p.p(g,x)},i(g){l||(Vt(p),l=!0)},o(g){en(p),l=!1},d(g){g&&Mn(r),p.d(g)}}}function Qb(t){let e;const r=t[36].default,l=ps(r,t,t[35],null);return{c(){l&&l.c()},m(p,g){l&&l.m(p,g),e=!0},p(p,g){l&&l.p&&(!e||g[1]&16)&&gs(l,r,p,p[35],e?ms(r,p[35],g,null):ys(p[35]),null)},i(p){e||(Vt(l,p),e=!0)},o(p){en(l,p),e=!1},d(p){l&&l.d(p)}}}function LB(t){let e,r,l=t[0]&&Jb(t);return{c(){l&&l.c(),e=ml()},m(p,g){l&&l.m(p,g),Fn(p,e,g),r=!0},p(p,g){p[0]?l?(l.p(p,g),g[0]&1&&Vt(l,1)):(l=Jb(p),l.c(),Vt(l,1),l.m(e.parentNode,e)):l&&(_s(),en(l,1,1,()=>{l=null}),vs())},i(p){r||(Vt(l),r=!0)},o(p){en(l),r=!1},d(p){p&&Mn(e),l&&l.d(p)}}}function PB(t,e,r){let l,p,g,x,f,C,R,z,M,F,Y,W,{$$slots:pe={},$$scope:me}=e,{id:ve=Ep("layer")}=e,{source:we=void 0}=e,{sourceLayer:Ie=void 0}=e,{beforeId:Pe=void 0}=e,{beforeLayerType:Re=void 0}=e,{type:Ve}=e,{paint:Fe=void 0}=e,{layout:ze=void 0}=e,{filter:Ge=void 0}=e,{applyToClusters:yt=void 0}=e,{minzoom:De=void 0}=e,{maxzoom:mt=void 0}=e,{manageHoverState:xt=!1}=e,{hovered:Je=null}=e,{interactive:St=!0}=e,{hoverCursor:Ct=void 0}=e,{eventsIfTopMost:vt=!1}=e;const Gt=vy(),{map:an,source:ut,self:tn,minzoom:Nt,maxzoom:on,eventTopMost:Et,layerInfo:gn}=IB();er(t,an,Se=>r(31,M=Se)),er(t,ut,Se=>r(32,F=Se)),er(t,tn,Se=>r(0,z=Se)),er(t,Nt,Se=>r(34,W=Se)),er(t,on,Se=>r(33,Y=Se)),dl(()=>{z&&M&&(gn.delete(z),M==null||M.removeLayer(z))});let wn;function In(Se){var je,Fi;if(!St||!z||!M||vt&&Et(Se)!==z)return;let Ue=Se.features??[],Ot=(Fi=(je=Ue[0])==null?void 0:je.properties)==null?void 0:Fi.cluster_id,Rn={event:Se,map:M,clusterId:Ot,layer:z,source:f,features:Ue};Gt(Se.type,Rn)}function Ae(Se){var je,Fi;if(!St||!z||!M||vt&&Et(Se)!==z)return;Ct&&(M.getCanvas().style.cursor=Ct);let Ue=Se.features??[];r(6,Je=Ue[0]??null);let Ot=(Fi=(je=Ue[0])==null?void 0:je.properties)==null?void 0:Fi.cluster_id;Gt("mouseenter",{event:Se,map:M,clusterId:Ot,layer:z,source:f,features:Ue})}function zi(Se){var je,Fi,ot;if(!St||!M)return;if(vt&&Et(Se)!==z){r(6,Je=null),xt&&wn!==void 0&&(M==null||M.setFeatureState({source:f,sourceLayer:Ie,id:wn},{hover:!1}),wn=void 0);return}M.getCanvas().style.cursor=Ct;let Ue=Se.features??[],Ot=(Fi=(je=Ue[0])==null?void 0:je.properties)==null?void 0:Fi.cluster_id,Rn=(ot=Ue[0])==null?void 0:ot.id;Rn!==wn&&(xt&&(wn!==void 0&&(M==null||M.setFeatureState({source:f,id:wn,sourceLayer:Ie},{hover:!1})),M==null||M.setFeatureState({source:f,id:Rn,sourceLayer:Ie},{hover:!0})),wn=Rn,r(6,Je=Ue[0]??null)),Gt("mousemove",{event:Se,map:M,clusterId:Ot,layer:z,source:f,features:Ue})}function $t(Se){if(!(!St||!z||!M)){if(Ct&&(M.getCanvas().style.cursor=""),r(6,Je=null),xt&&wn!==void 0){const Ue={source:f,id:wn,sourceLayer:Ie};M==null||M.setFeatureState(Ue,{hover:!1}),wn=void 0}Gt("mouseleave",{map:M,layer:z,source:f})}}let bt=!0;function fe(Se){M&&(M.off("click",Se,In),M.off("dblclick",Se,In),M.off("contextmenu",Se,In),M.off("mouseenter",Se,Ae),M.off("mousemove",Se,zi),M.off("mouseleave",Se,$t))}return dl(()=>{M&&z&&fe(z)}),t.$$set=Se=>{"id"in Se&&r(7,ve=Se.id),"source"in Se&&r(8,we=Se.source),"sourceLayer"in Se&&r(9,Ie=Se.sourceLayer),"beforeId"in Se&&r(10,Pe=Se.beforeId),"beforeLayerType"in Se&&r(11,Re=Se.beforeLayerType),"type"in Se&&r(12,Ve=Se.type),"paint"in Se&&r(13,Fe=Se.paint),"layout"in Se&&r(14,ze=Se.layout),"filter"in Se&&r(15,Ge=Se.filter),"applyToClusters"in Se&&r(16,yt=Se.applyToClusters),"minzoom"in Se&&r(17,De=Se.minzoom),"maxzoom"in Se&&r(18,mt=Se.maxzoom),"manageHoverState"in Se&&r(19,xt=Se.manageHoverState),"hovered"in Se&&r(6,Je=Se.hovered),"interactive"in Se&&r(20,St=Se.interactive),"hoverCursor"in Se&&r(21,Ct=Se.hoverCursor),"eventsIfTopMost"in Se&&r(22,vt=Se.eventsIfTopMost),"$$scope"in Se&&r(35,me=Se.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&65536&&r(30,l=AB(yt)),t.$$.dirty[0]&1073774592&&r(24,p=CB("all",l,Ge)),t.$$.dirty[0]&131072|t.$$.dirty[1]&8&&r(26,g=De??W),t.$$.dirty[0]&262144|t.$$.dirty[1]&4&&r(25,x=mt??Y),t.$$.dirty[0]&256|t.$$.dirty[1]&2&&r(29,f=we||F),t.$$.dirty[0]&654343809|t.$$.dirty[1]&1&&M&&z!==ve&&f){z&&(fe(z),gn.delete(z));let Se=Pe;if(!Pe&&Re){let Ue=M.getStyle().layers,Ot=typeof Re=="function"?Re:je=>je.type===Re,Rn=Ue==null?void 0:Ue.find(Ot);Rn&&(Se=Rn.id)}hl(tn,z=ve,z),M.addLayer(cp({id:z,type:Ve,source:f,"source-layer":Ie,filter:p,paint:Fe,layout:ze,minzoom:g,maxzoom:x}),Se),r(23,bt=!0),M.on("click",z,In),M.on("dblclick",z,In),M.on("contextmenu",z,In),M.on("mouseenter",z,Ae),M.on("mousemove",z,zi),M.on("mouseleave",z,$t)}t.$$.dirty[0]&1048577&&z&&gn.set(z,{interactive:St}),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&r(28,C=z?Kb((Se,Ue)=>M==null?void 0:M.setPaintProperty(z,Se,Ue)):void 0),t.$$.dirty[0]&1|t.$$.dirty[1]&1&&r(27,R=z?Kb((Se,Ue)=>M==null?void 0:M.setLayoutProperty(z,Se,Ue)):void 0),t.$$.dirty[0]&268443648&&(C==null||C(Fe)),t.$$.dirty[0]&134234112&&(R==null||R(ze)),t.$$.dirty[0]&100663297|t.$$.dirty[1]&1&&z&&(M==null||M.setLayerZoomRange(z,g,x)),t.$$.dirty[0]&25165825|t.$$.dirty[1]&1&&z&&(bt?r(23,bt=!1):M==null||M.setFilter(z,p))},[z,an,ut,tn,Nt,on,Je,ve,we,Ie,Pe,Re,Ve,Fe,ze,Ge,yt,De,mt,xt,St,Ct,vt,bt,p,x,g,R,C,f,l,M,F,Y,W,me,pe]}class iE extends Zi{constructor(e){super(),Wi(this,e,PB,LB,yi,{id:7,source:8,sourceLayer:9,beforeId:10,beforeLayerType:11,type:12,paint:13,layout:14,filter:15,applyToClusters:16,minzoom:17,maxzoom:18,manageHoverState:19,hovered:6,interactive:20,hoverCursor:21,eventsIfTopMost:22},null,[-1,-1])}}function MB(t){let e;const r=t[15].default,l=ps(r,t,t[23],null);return{c(){l&&l.c()},m(p,g){l&&l.m(p,g),e=!0},p(p,g){l&&l.p&&(!e||g&8388608)&&gs(l,r,p,p[23],e?ms(r,p[23],g,null):ys(p[23]),null)},i(p){e||(Vt(l,p),e=!0)},o(p){en(l,p),e=!1},d(p){l&&l.d(p)}}}function RB(t){let e,r,l;function p(x){t[16](x)}let g={id:t[1],type:"fill",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[MB]},$$scope:{ctx:t}};return t[0]!==void 0&&(g.hovered=t[0]),e=new iE({props:g}),Ea.push(()=>kd(e,"hovered",p)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){po(e.$$.fragment)},m(x,f){to(e,x,f),l=!0},p(x,[f]){const C={};f&2&&(C.id=x[1]),f&4&&(C.source=x[2]),f&8&&(C.sourceLayer=x[3]),f&16&&(C.beforeId=x[4]),f&32&&(C.beforeLayerType=x[5]),f&64&&(C.paint=x[6]),f&128&&(C.layout=x[7]),f&256&&(C.filter=x[8]),f&512&&(C.minzoom=x[9]),f&1024&&(C.maxzoom=x[10]),f&2048&&(C.hoverCursor=x[11]),f&4096&&(C.manageHoverState=x[12]),f&8192&&(C.eventsIfTopMost=x[13]),f&16384&&(C.interactive=x[14]),f&8388608&&(C.$$scope={dirty:f,ctx:x}),!r&&f&1&&(r=!0,C.hovered=x[0],Sd(()=>r=!1)),e.$set(C)},i(x){l||(Vt(e.$$.fragment,x),l=!0)},o(x){en(e.$$.fragment,x),l=!1},d(x){no(e,x)}}}function OB(t,e,r){let{$$slots:l={},$$scope:p}=e,{id:g=Ep("fill")}=e,{source:x=void 0}=e,{sourceLayer:f=void 0}=e,{beforeId:C=void 0}=e,{beforeLayerType:R=void 0}=e,{paint:z}=e,{layout:M=void 0}=e,{filter:F=void 0}=e,{minzoom:Y=void 0}=e,{maxzoom:W=void 0}=e,{hoverCursor:pe=void 0}=e,{manageHoverState:me=!1}=e,{hovered:ve=null}=e,{eventsIfTopMost:we=!1}=e,{interactive:Ie=!0}=e;function Pe(De){ve=De,r(0,ve)}function Re(De){jr.call(this,t,De)}function Ve(De){jr.call(this,t,De)}function Fe(De){jr.call(this,t,De)}function ze(De){jr.call(this,t,De)}function Ge(De){jr.call(this,t,De)}function yt(De){jr.call(this,t,De)}return t.$$set=De=>{"id"in De&&r(1,g=De.id),"source"in De&&r(2,x=De.source),"sourceLayer"in De&&r(3,f=De.sourceLayer),"beforeId"in De&&r(4,C=De.beforeId),"beforeLayerType"in De&&r(5,R=De.beforeLayerType),"paint"in De&&r(6,z=De.paint),"layout"in De&&r(7,M=De.layout),"filter"in De&&r(8,F=De.filter),"minzoom"in De&&r(9,Y=De.minzoom),"maxzoom"in De&&r(10,W=De.maxzoom),"hoverCursor"in De&&r(11,pe=De.hoverCursor),"manageHoverState"in De&&r(12,me=De.manageHoverState),"hovered"in De&&r(0,ve=De.hovered),"eventsIfTopMost"in De&&r(13,we=De.eventsIfTopMost),"interactive"in De&&r(14,Ie=De.interactive),"$$scope"in De&&r(23,p=De.$$scope)},[ve,g,x,f,C,R,z,M,F,Y,W,pe,me,we,Ie,l,Pe,Re,Ve,Fe,ze,Ge,yt,p]}class a8 extends Zi{constructor(e){super(),Wi(this,e,OB,RB,yi,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function DB(t,e,r){let l;const{map:p}=Pc();er(t,p,C=>r(4,l=C));let{position:g="top-left"}=e,{container:x=void 0}=e,f=null;return dl(()=>{l!=null&&l.loaded()&&f&&l.removeControl(f)}),t.$$set=C=>{"position"in C&&r(1,g=C.position),"container"in C&&r(2,x=C.container)},t.$$.update=()=>{if(t.$$.dirty&30&&l&&!f){let C;typeof x=="string"?C=document.querySelector(x)??void 0:C=x,r(3,f=new us.FullscreenControl({container:C})),l.addControl(f,g)}},[p,g,x,f,l]}class NB extends Zi{constructor(e){super(),Wi(this,e,DB,null,yi,{position:1,container:2})}}function zB(t,e,r,l,p){let g=!1;t.getSource(e)&&(g=!0,t.removeSource(e));const x=()=>{l(e)&&(t.addSource(e,r),p())};if(g){const f=()=>{e&&(t.getSource(e)?setTimeout(f,1):x())};f()}else x()}function FB(t,e,r){pT().then(()=>{let l=nT(t);if(!l)return;l.getSource(e)===r&&l.removeSource(e)})}function ew(t){let e=t[0],r,l,p=tw(t);return{c(){p.c(),r=ml()},m(g,x){p.m(g,x),Fn(g,r,x),l=!0},p(g,x){x&1&&yi(e,e=g[0])?(_s(),en(p,1,1,tr),vs(),p=tw(g),p.c(),Vt(p,1),p.m(r.parentNode,r)):p.p(g,x)},i(g){l||(Vt(p),l=!0)},o(g){en(p),l=!1},d(g){g&&Mn(r),p.d(g)}}}function tw(t){let e;const r=t[19].default,l=ps(r,t,t[18],null);return{c(){l&&l.c()},m(p,g){l&&l.m(p,g),e=!0},p(p,g){l&&l.p&&(!e||g&262144)&&gs(l,r,p,p[18],e?ms(r,p[18],g,null):ys(p[18]),null)},i(p){e||(Vt(l,p),e=!0)},o(p){en(l,p),e=!1},d(p){l&&l.d(p)}}}function BB(t){let e,r,l=t[0]&&ew(t);return{c(){l&&l.c(),e=ml()},m(p,g){l&&l.m(p,g),Fn(p,e,g),r=!0},p(p,[g]){p[0]?l?(l.p(p,g),g&1&&Vt(l,1)):(l=ew(p),l.c(),Vt(l,1),l.m(e.parentNode,e)):l&&(_s(),en(l,1,1,()=>{l=null}),vs())},i(p){r||(Vt(l),r=!0)},o(p){en(l),r=!1},d(p){p&&Mn(e),l&&l.d(p)}}}function UB(t,e,r){let l,p,g,{$$slots:x={},$$scope:f}=e,{id:C=Ep("geojson")}=e,{data:R}=e,{generateId:z=!1}=e,{promoteId:M=void 0}=e,{filter:F=void 0}=e,{lineMetrics:Y=void 0}=e,{cluster:W=void 0}=e,{maxzoom:pe=void 0}=e,{attribution:me=void 0}=e,{buffer:ve=void 0}=e,{tolerance:we=void 0}=e;const{map:Ie,cluster:Pe,self:Re}=EB();er(t,Ie,ze=>r(17,p=ze)),er(t,Pe,ze=>r(20,g=ze)),er(t,Re,ze=>r(0,l=ze));let Ve,Fe=!0;return dl(()=>{l&&Ve&&p&&(FB(Ie,l,Ve),hl(Re,l=null,l),r(15,Ve=void 0))}),t.$$set=ze=>{"id"in ze&&r(4,C=ze.id),"data"in ze&&r(5,R=ze.data),"generateId"in ze&&r(6,z=ze.generateId),"promoteId"in ze&&r(7,M=ze.promoteId),"filter"in ze&&r(8,F=ze.filter),"lineMetrics"in ze&&r(9,Y=ze.lineMetrics),"cluster"in ze&&r(10,W=ze.cluster),"maxzoom"in ze&&r(11,pe=ze.maxzoom),"attribution"in ze&&r(12,me=ze.attribution),"buffer"in ze&&r(13,ve=ze.buffer),"tolerance"in ze&&r(14,we=ze.tolerance),"$$scope"in ze&&r(18,f=ze.$$scope)},t.$$.update=()=>{t.$$.dirty&1024&&hl(Pe,g=W,g),t.$$.dirty&196593&&p&&l!==C&&(hl(Re,l=C,l),zB(p,l,cp({type:"geojson",data:R,filter:F,lineMetrics:Y,generateId:z,promoteId:M,cluster:!!W,clusterMinPoints:W==null?void 0:W.minPoints,clusterMaxZoom:W==null?void 0:W.maxZoom,clusterRadius:W==null?void 0:W.radius,clusterProperties:W==null?void 0:W.properties,maxzoom:pe,attribution:me,buffer:ve,tolerance:we}),ze=>p&&ze===l,()=>{l&&(r(15,Ve=p==null?void 0:p.getSource(l)),r(16,Fe=!0))})),t.$$.dirty&131088&&(p==null||p.on("style.load",()=>{r(15,Ve=p==null?void 0:p.getSource(C))})),t.$$.dirty&98336&&Ve&&(Fe?r(16,Fe=!1):Ve.setData(R)),t.$$.dirty&33792&&(Ve==null||Ve.setClusterOptions(cp({cluster:!!W,clusterMaxZoom:W==null?void 0:W.maxZoom,clusterRadius:W==null?void 0:W.radius})))},[l,Ie,Pe,Re,C,R,z,M,F,Y,W,pe,me,ve,we,Ve,Fe,p,f,x]}class l8 extends Zi{constructor(e){super(),Wi(this,e,UB,BB,yi,{id:4,data:5,generateId:6,promoteId:7,filter:8,lineMetrics:9,cluster:10,maxzoom:11,attribution:12,buffer:13,tolerance:14})}}function jB(t,e,r){let l;const{map:p}=Pc();er(t,p,F=>r(8,l=F));let{position:g="top-left"}=e,{positionOptions:x=void 0}=e,{fitBoundsOptions:f=void 0}=e,{trackUserLocation:C=!1}=e,{showAccuracyCircle:R=!0}=e,{showUserLocation:z=!0}=e,{control:M=null}=e;return dl(()=>{l!=null&&l.loaded()&&M&&l.removeControl(M)}),t.$$set=F=>{"position"in F&&r(2,g=F.position),"positionOptions"in F&&r(3,x=F.positionOptions),"fitBoundsOptions"in F&&r(4,f=F.fitBoundsOptions),"trackUserLocation"in F&&r(5,C=F.trackUserLocation),"showAccuracyCircle"in F&&r(6,R=F.showAccuracyCircle),"showUserLocation"in F&&r(7,z=F.showUserLocation),"control"in F&&r(1,M=F.control)},t.$$.update=()=>{t.$$.dirty&510&&l&&!M&&(r(1,M=new us.GeolocateControl({positionOptions:x,fitBoundsOptions:f,trackUserLocation:C,showAccuracyCircle:R,showUserLocation:z})),l.addControl(M,g))},[p,M,g,x,f,C,R,z,l]}class VB extends Zi{constructor(e){super(),Wi(this,e,jB,null,yi,{position:2,positionOptions:3,fitBoundsOptions:4,trackUserLocation:5,showAccuracyCircle:6,showUserLocation:7,control:1})}}function qB(t){let e;const r=t[15].default,l=ps(r,t,t[23],null);return{c(){l&&l.c()},m(p,g){l&&l.m(p,g),e=!0},p(p,g){l&&l.p&&(!e||g&8388608)&&gs(l,r,p,p[23],e?ms(r,p[23],g,null):ys(p[23]),null)},i(p){e||(Vt(l,p),e=!0)},o(p){en(l,p),e=!1},d(p){l&&l.d(p)}}}function GB(t){let e,r,l;function p(x){t[16](x)}let g={id:t[1],type:"line",source:t[2],sourceLayer:t[3],beforeId:t[4],beforeLayerType:t[5],paint:t[6],layout:t[7],filter:t[8],minzoom:t[9],maxzoom:t[10],hoverCursor:t[11],manageHoverState:t[12],eventsIfTopMost:t[13],interactive:t[14],$$slots:{default:[qB]},$$scope:{ctx:t}};return t[0]!==void 0&&(g.hovered=t[0]),e=new iE({props:g}),Ea.push(()=>kd(e,"hovered",p)),e.$on("click",t[17]),e.$on("dblclick",t[18]),e.$on("contextmenu",t[19]),e.$on("mouseenter",t[20]),e.$on("mousemove",t[21]),e.$on("mouseleave",t[22]),{c(){po(e.$$.fragment)},m(x,f){to(e,x,f),l=!0},p(x,[f]){const C={};f&2&&(C.id=x[1]),f&4&&(C.source=x[2]),f&8&&(C.sourceLayer=x[3]),f&16&&(C.beforeId=x[4]),f&32&&(C.beforeLayerType=x[5]),f&64&&(C.paint=x[6]),f&128&&(C.layout=x[7]),f&256&&(C.filter=x[8]),f&512&&(C.minzoom=x[9]),f&1024&&(C.maxzoom=x[10]),f&2048&&(C.hoverCursor=x[11]),f&4096&&(C.manageHoverState=x[12]),f&8192&&(C.eventsIfTopMost=x[13]),f&16384&&(C.interactive=x[14]),f&8388608&&(C.$$scope={dirty:f,ctx:x}),!r&&f&1&&(r=!0,C.hovered=x[0],Sd(()=>r=!1)),e.$set(C)},i(x){l||(Vt(e.$$.fragment,x),l=!0)},o(x){en(e.$$.fragment,x),l=!1},d(x){no(e,x)}}}function HB(t,e,r){let{$$slots:l={},$$scope:p}=e,{id:g=Ep("line")}=e,{source:x=void 0}=e,{sourceLayer:f=void 0}=e,{beforeId:C=void 0}=e,{beforeLayerType:R=void 0}=e,{paint:z}=e,{layout:M=void 0}=e,{filter:F=void 0}=e,{minzoom:Y=void 0}=e,{maxzoom:W=void 0}=e,{hoverCursor:pe=void 0}=e,{manageHoverState:me=!1}=e,{hovered:ve=null}=e,{eventsIfTopMost:we=!1}=e,{interactive:Ie=!0}=e;function Pe(De){ve=De,r(0,ve)}function Re(De){jr.call(this,t,De)}function Ve(De){jr.call(this,t,De)}function Fe(De){jr.call(this,t,De)}function ze(De){jr.call(this,t,De)}function Ge(De){jr.call(this,t,De)}function yt(De){jr.call(this,t,De)}return t.$$set=De=>{"id"in De&&r(1,g=De.id),"source"in De&&r(2,x=De.source),"sourceLayer"in De&&r(3,f=De.sourceLayer),"beforeId"in De&&r(4,C=De.beforeId),"beforeLayerType"in De&&r(5,R=De.beforeLayerType),"paint"in De&&r(6,z=De.paint),"layout"in De&&r(7,M=De.layout),"filter"in De&&r(8,F=De.filter),"minzoom"in De&&r(9,Y=De.minzoom),"maxzoom"in De&&r(10,W=De.maxzoom),"hoverCursor"in De&&r(11,pe=De.hoverCursor),"manageHoverState"in De&&r(12,me=De.manageHoverState),"hovered"in De&&r(0,ve=De.hovered),"eventsIfTopMost"in De&&r(13,we=De.eventsIfTopMost),"interactive"in De&&r(14,Ie=De.interactive),"$$scope"in De&&r(23,p=De.$$scope)},[ve,g,x,f,C,R,z,M,F,Y,W,pe,me,we,Ie,l,Pe,Re,Ve,Fe,ze,Ge,yt,p]}class u8 extends Zi{constructor(e){super(),Wi(this,e,HB,GB,yi,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,minzoom:9,maxzoom:10,hoverCursor:11,manageHoverState:12,hovered:0,eventsIfTopMost:13,interactive:14})}}function WB(t){let e=t.getCenter(),r=Math.round(t.getZoom()*100)/100,l=Math.ceil((r*Math.LN2+Math.log(512/360/.5))/Math.LN10),p=Math.pow(10,l),g=Math.round(e.lat*p)/p,x=Math.round(e.lng*p)/p,f=`${r}/${g}/${x}`,C=t.getBearing(),R=t.getPitch();return(C||R)&&(f+=`/${Math.round(C*10)/10}`),R&&(f+=`/${Math.round(R)}`),`#${f}`}function ZB(t){return t.replace("#","").split("/").map(parseFloat)}function YB(t,e,r){let l;const{map:p}=Pc();er(t,p,z=>r(6,l=z));let{position:g="top-left"}=e,{showCompass:x=!0}=e,{showZoom:f=!0}=e,{visualizePitch:C=!1}=e,R=null;return dl(()=>{l!=null&&l.loaded()&&R&&l.removeControl(R)}),t.$$set=z=>{"position"in z&&r(1,g=z.position),"showCompass"in z&&r(2,x=z.showCompass),"showZoom"in z&&r(3,f=z.showZoom),"visualizePitch"in z&&r(4,C=z.visualizePitch)},t.$$.update=()=>{t.$$.dirty&126&&l&&!R&&(r(5,R=new us.NavigationControl({showCompass:x,showZoom:f,visualizePitch:C})),l.addControl(R,g))},[p,g,x,f,C,R,l]}class rE extends Zi{constructor(e){super(),Wi(this,e,YB,null,yi,{position:1,showCompass:2,showZoom:3,visualizePitch:4})}}function XB(t,e,r){let l;const{map:p}=Pc();er(t,p,R=>r(5,l=R));let{position:g="bottom-left"}=e,{maxWidth:x=void 0}=e,{unit:f="metric"}=e,C=null;return dl(()=>{l!=null&&l.loaded()&&C&&l.removeControl(C)}),t.$$set=R=>{"position"in R&&r(1,g=R.position),"maxWidth"in R&&r(2,x=R.maxWidth),"unit"in R&&r(3,f=R.unit)},t.$$.update=()=>{t.$$.dirty&62&&l&&!C&&(r(4,C=new us.ScaleControl({maxWidth:x,unit:f})),l.addControl(C,g))},[p,g,x,f,C,l]}class oE extends Zi{constructor(e){super(),Wi(this,e,XB,null,yi,{position:1,maxWidth:2,unit:3})}}const{window:$B}=oT,KB=t=>({map:t[0]&16,loadedImages:t[0]&32,allImagesLoaded:t[0]&64}),nw=t=>({map:t[4],loadedImages:t[5],allImagesLoaded:t[6]});function iw(t){let e,r,l=t[3]&&rw(t);const p=t[40].default,g=ps(p,t,t[39],nw);return{c(){l&&l.c(),e=qr(),g&&g.c()},m(x,f){l&&l.m(x,f),Fn(x,e,f),g&&g.m(x,f),r=!0},p(x,f){x[3]?l?(l.p(x,f),f[0]&8&&Vt(l,1)):(l=rw(x),l.c(),Vt(l,1),l.m(e.parentNode,e)):l&&(_s(),en(l,1,1,()=>{l=null}),vs()),g&&g.p&&(!r||f[0]&112|f[1]&256)&&gs(g,p,x,x[39],r?ms(p,x[39],f,KB):ys(x[39]),nw)},i(x){r||(Vt(l),Vt(g,x),r=!0)},o(x){en(l),en(g,x),r=!1},d(x){x&&Mn(e),l&&l.d(x),g&&g.d(x)}}}function rw(t){let e,r,l,p,g,x,f,C;return e=new rE({props:{position:t[7]}}),l=new VB({props:{position:t[7],fitBoundsOptions:{maxZoom:12}}}),g=new NB({props:{position:t[7]}}),f=new oE({props:{position:t[7]}}),{c(){po(e.$$.fragment),r=qr(),po(l.$$.fragment),p=qr(),po(g.$$.fragment),x=qr(),po(f.$$.fragment)},m(R,z){to(e,R,z),Fn(R,r,z),to(l,R,z),Fn(R,p,z),to(g,R,z),Fn(R,x,z),to(f,R,z),C=!0},p(R,z){const M={};z[0]&128&&(M.position=R[7]),e.$set(M);const F={};z[0]&128&&(F.position=R[7]),l.$set(F);const Y={};z[0]&128&&(Y.position=R[7]),g.$set(Y);const W={};z[0]&128&&(W.position=R[7]),f.$set(W)},i(R){C||(Vt(e.$$.fragment,R),Vt(l.$$.fragment,R),Vt(g.$$.fragment,R),Vt(f.$$.fragment,R),C=!0)},o(R){en(e.$$.fragment,R),en(l.$$.fragment,R),en(g.$$.fragment,R),en(f.$$.fragment,R),C=!1},d(R){R&&(Mn(r),Mn(p),Mn(x)),no(e,R),no(l,R),no(g,R),no(f,R)}}}function JB(t){let e,r,l,p,g,x=t[4]&&t[0]&&iw(t);return{c(){e=si("div"),x&&x.c(),bn(e,"class",r=Kv(t[2])+" svelte-p00lfq"),bn(e,"data-testid","map-container"),Us(e,"expand-map",!t[2])},m(f,C){Fn(f,e,C),x&&x.m(e,null),t[41](e),l=!0,p||(g=[wa($B,"hashchange",t[11]),rT(t[10].call(null,e))],p=!0)},p(f,C){f[4]&&f[0]?x?(x.p(f,C),C[0]&17&&Vt(x,1)):(x=iw(f),x.c(),Vt(x,1),x.m(e,null)):x&&(_s(),en(x,1,1,()=>{x=null}),vs()),(!l||C[0]&4&&r!==(r=Kv(f[2])+" svelte-p00lfq"))&&bn(e,"class",r),(!l||C[0]&4)&&Us(e,"expand-map",!f[2])},i(f){l||(Vt(x),l=!0)},o(f){en(x),l=!1},d(f){f&&Mn(e),x&&x.d(),t[41](null),p=!1,Gs(g)}}}function QB(t,e,r){let l,p,g,x,{$$slots:f={},$$scope:C}=e,{map:R=null}=e,{mapContainer:z=void 0}=e,{class:M=void 0}=e,{style:F}=e,{diffStyleUpdates:Y=!1}=e,{center:W=void 0}=e,{zoom:pe=void 0}=e,{pitch:me=0}=e,{bearing:ve=0}=e,{bounds:we=void 0}=e,{hash:Ie=!1}=e,{updateHash:Pe=Se=>{window.history.replaceState(window.history.state,"",Se)}}=e,{loaded:Re=!1}=e,{minZoom:Ve=0}=e,{maxZoom:Fe=22}=e,{antialias:ze=void 0}=e,{zoomOnDoubleClick:Ge=!0}=e,{locale:yt=void 0}=e,{interactive:De=!0}=e,{attributionControl:mt=!0}=e,{cooperativeGestures:xt=!1}=e,{preserveDrawingBuffer:Je=!1}=e,{maxBounds:St=void 0}=e,{images:Ct=[]}=e,{standardControls:vt=!1}=e,{filterLayers:Gt=void 0}=e,{transformRequest:an=void 0}=e;const ut=vy(),{map:tn,loadedImages:Nt}=kB();er(t,tn,Se=>r(4,g=Se)),er(t,Nt,Se=>r(5,x=Se));let on=new Set;async function Et(Se,Ue=!1){if(g&&!(!g.loaded()&&!Ue))if("url"in Se){on.add(Se.id);try{let Ot=await g.loadImage(Se.url);g==null||g.addImage(Se.id,Ot.data,Se.options),x.add(Se.id),Nt.set(x)}catch(Ot){ut("error",Ot)}finally{on.delete(Se.id)}}else g.addImage(Se.id,Se.data,Se.options),x.add(Se.id),Nt.set(x)}let gn,wn,In,Ae;function zi(Se){return bt(),hl(tn,g=new us.Map(cp({container:Se,style:F,locale:yt,center:W,zoom:pe,pitch:me,bearing:ve,minZoom:Ve,maxZoom:Fe,antialias:ze,interactive:De,preserveDrawingBuffer:Je,maxBounds:St,bounds:we,attributionControl:mt,transformRequest:an,cooperativeGestures:xt})),g),g.on("load",Ue=>{Ue.target.getContainer().setAttribute("data-testid","map"),Ue.target.getCanvas().setAttribute("data-testid","map-canvas"),r(0,Re=!0),ut("load",g)}),g.on("error",Ue=>ut("error",{...Ue,map:g})),g.on("movestart",Ue=>ut("movestart",{...Ue,map:g})),g.on("moveend",Ue=>{if(r(12,W=Ue.target.getCenter()),r(13,pe=Ue.target.getZoom()),r(14,me=Ue.target.getPitch()),r(15,ve=Ue.target.getBearing()),r(16,we=Ue.target.getBounds()),ut("moveend",{...Ue,map:g}),Ie){let Ot=new URL(window.location.href.replace(/(#.+)?$/,WB(g)));Pe(Ot)}}),g.on("click",Ue=>ut("click",{...Ue,map:g})),g.on("dblclick",Ue=>ut("dblclick",{...Ue,map:g})),g.on("contextmenu",Ue=>ut("contextmenu",{...Ue,map:g})),g.on("zoomstart",Ue=>ut("zoomstart",{...Ue,map:g})),g.on("zoom",Ue=>{ut("zoom",{...Ue,map:g})}),g.on("zoomend",Ue=>{ut("zoomend",{...Ue,map:g})}),g.on("style.load",()=>{if(g){const Ue=g.getStyle();if(r(36,gn=Ue.layers.map(Ot=>Ot.id)),r(37,wn=Object.keys(Ue.sources)),Ae)for(const[Ot,Rn]of Object.entries(Ae))g.addSource(Ot,Rn);if(In)for(const Ot of In)g.addLayer(Ot);for(const Ot of Ct)Et(Ot,!0)}}),g.on("styledata",Ue=>{if(g&&Gt){const Ot=g.getStyle().layers;if(Ot)for(let Rn of Ot)Gt(Rn)||g.setLayoutProperty(Rn.id,"visibility","none")}ut("styledata",{...Ue,map:g})}),{destroy(){r(0,Re=!1),g==null||g.remove(),hl(tn,g=null,g)}}}let $t=F;function bt(){if(Ie){let Se=ZB(window.location.hash);Se.length>=3&&(r(13,pe=Se[0]),r(12,W=[Se[2],Se[1]])),Se.length==5&&(r(15,ve=Se[3]),r(14,me=Se[4]))}}function fe(Se){Ea[Se?"unshift":"push"](()=>{z=Se,r(1,z)})}return t.$$set=Se=>{"map"in Se&&r(17,R=Se.map),"mapContainer"in Se&&r(1,z=Se.mapContainer),"class"in Se&&r(2,M=Se.class),"style"in Se&&r(18,F=Se.style),"diffStyleUpdates"in Se&&r(19,Y=Se.diffStyleUpdates),"center"in Se&&r(12,W=Se.center),"zoom"in Se&&r(13,pe=Se.zoom),"pitch"in Se&&r(14,me=Se.pitch),"bearing"in Se&&r(15,ve=Se.bearing),"bounds"in Se&&r(16,we=Se.bounds),"hash"in Se&&r(20,Ie=Se.hash),"updateHash"in Se&&r(21,Pe=Se.updateHash),"loaded"in Se&&r(0,Re=Se.loaded),"minZoom"in Se&&r(22,Ve=Se.minZoom),"maxZoom"in Se&&r(23,Fe=Se.maxZoom),"antialias"in Se&&r(24,ze=Se.antialias),"zoomOnDoubleClick"in Se&&r(25,Ge=Se.zoomOnDoubleClick),"locale"in Se&&r(26,yt=Se.locale),"interactive"in Se&&r(27,De=Se.interactive),"attributionControl"in Se&&r(28,mt=Se.attributionControl),"cooperativeGestures"in Se&&r(29,xt=Se.cooperativeGestures),"preserveDrawingBuffer"in Se&&r(30,Je=Se.preserveDrawingBuffer),"maxBounds"in Se&&r(31,St=Se.maxBounds),"images"in Se&&r(32,Ct=Se.images),"standardControls"in Se&&r(3,vt=Se.standardControls),"filterLayers"in Se&&r(33,Gt=Se.filterLayers),"transformRequest"in Se&&r(34,an=Se.transformRequest),"$$scope"in Se&&r(39,C=Se.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&8&&r(7,l=typeof vt=="boolean"?void 0:vt),t.$$.dirty[0]&16&&r(17,R=g),t.$$.dirty[0]&786448|t.$$.dirty[1]&224&&g&&!Xu(F,$t)){const Se=g.getStyle();if(gn&&(In=Se.layers.filter(Ue=>!gn.includes(Ue.id))),wn){const Ue=Object.keys(Se.sources).filter(Ot=>!wn.includes(Ot));Ae={};for(const Ot of Ue)Ae[Ot]=Se.sources[Ot]}r(38,$t=F),g.setStyle(F,{diff:Y}),hl(Nt,x=new Set,x),r(35,on=new Set)}if(t.$$.dirty[0]&49|t.$$.dirty[1]&18&&Re&&g!=null&&g.loaded())for(let Se of Ct)!x.has(Se.id)&&!on.has(Se.id)&&!g.hasImage(Se.id)&&Et(Se);if(t.$$.dirty[0]&32|t.$$.dirty[1]&2&&r(6,p=Ct.every(Se=>x.has(Se.id))),t.$$.dirty[0]&61456&&g){let Se={};W!=null&&!Xu(W,g==null?void 0:g.getCenter())&&(Se.center=W),pe!=null&&!Xu(pe,g==null?void 0:g.getZoom())&&(Se.zoom=pe),ve!=null&&!Xu(ve,g==null?void 0:g.getBearing())&&(Se.bearing=ve),me!=null&&!Xu(me,g==null?void 0:g.getPitch())&&(Se.pitch=me),Object.keys(Se).length&&g.easeTo(Se)}t.$$.dirty[0]&65552&&we&&!Xu(we,g==null?void 0:g.getBounds())&&(g==null||g.fitBounds(we)),t.$$.dirty[0]&33554448&&(Ge?g==null||g.doubleClickZoom.enable():g==null||g.doubleClickZoom.disable())},[Re,z,M,vt,g,x,p,l,tn,Nt,zi,bt,W,pe,me,ve,we,R,F,Y,Ie,Pe,Ve,Fe,ze,Ge,yt,De,mt,xt,Je,St,Ct,Gt,an,on,gn,wn,$t,C,f,fe]}class e6 extends Zi{constructor(e){super(),Wi(this,e,QB,JB,yi,{map:17,mapContainer:1,class:2,style:18,diffStyleUpdates:19,center:12,zoom:13,pitch:14,bearing:15,bounds:16,hash:20,updateHash:21,loaded:0,minZoom:22,maxZoom:23,antialias:24,zoomOnDoubleClick:25,locale:26,interactive:27,attributionControl:28,cooperativeGestures:29,preserveDrawingBuffer:30,maxBounds:31,images:32,standardControls:3,filterLayers:33,transformRequest:34},null,[-1,-1])}}const t6=t=>({features:t[0]&16,data:t[0]&16,map:t[0]&4,close:t[0]&1}),ow=t=>{var e;return{features:t[4],data:(e=t[4])==null?void 0:e[0],map:t[2],close:t[31]}};function sw(t){let e,r,l=(t[4]||t[3]instanceof us.Marker)&&aw(t);return{c(){e=si("div"),l&&l.c()},m(p,g){Fn(p,e,g),l&&l.m(e,null),t[32](e),r=!0},p(p,g){p[4]||p[3]instanceof us.Marker?l?(l.p(p,g),g[0]&24&&Vt(l,1)):(l=aw(p),l.c(),Vt(l,1),l.m(e,null)):l&&(_s(),en(l,1,1,()=>{l=null}),vs())},i(p){r||(Vt(l),r=!0)},o(p){en(l),r=!1},d(p){p&&Mn(e),l&&l.d(),t[32](null)}}}function aw(t){let e;const r=t[30].default,l=ps(r,t,t[29],ow);return{c(){l&&l.c()},m(p,g){l&&l.m(p,g),e=!0},p(p,g){l&&l.p&&(!e||g[0]&536870933)&&gs(l,r,p,p[29],e?ms(r,p[29],g,t6):ys(p[29]),ow)},i(p){e||(Vt(l,p),e=!0)},o(p){en(l,p),e=!1},d(p){l&&l.d(p)}}}function n6(t){let e,r,l=t[9].default&&sw(t);return{c(){l&&l.c(),e=ml()},m(p,g){l&&l.m(p,g),Fn(p,e,g),r=!0},p(p,g){p[9].default?l?(l.p(p,g),g[0]&512&&Vt(l,1)):(l=sw(p),l.c(),Vt(l,1),l.m(e.parentNode,e)):l&&(_s(),en(l,1,1,()=>{l=null}),vs())},i(p){r||(Vt(l),r=!0)},o(p){en(l),r=!1},d(p){p&&Mn(e),l&&l.d(p)}}}function i6(t,e,r){let l,p,g,x,f,C,{$$slots:R={},$$scope:z}=e;const M=iT(R);let{closeButton:F=void 0}=e,{closeOnClickOutside:Y=!0}=e,{closeOnClickInside:W=!1}=e,{closeOnMove:pe=!1}=e,{openOn:me="click"}=e,{openIfTopMost:ve=!0}=e,{focusAfterOpen:we=!0}=e,{anchor:Ie=void 0}=e,{offset:Pe=void 0}=e,{popupClass:Re=void 0}=e,{maxWidth:Ve=void 0}=e,{lngLat:Fe=void 0}=e,{html:ze=void 0}=e,{open:Ge=!1}=e;const yt=vy(),{map:De,popupTarget:mt,layerEvent:xt,layer:Je,eventTopMost:St}=Pc();er(t,De,Ue=>r(2,g=Ue)),er(t,mt,Ue=>r(3,f=Ue)),er(t,xt,Ue=>r(28,x=Ue)),er(t,Je,Ue=>r(35,C=Ue));const Ct=["click","dblclick","contextmenu"];let vt,Gt=!1,an;function ut(){if(!vt)return;let Ue=vt.getElement();!Ue||Ue===an||(an=Ue,me==="hover"&&(an.style.pointerEvents="none"),an.addEventListener("mouseenter",()=>{r(24,Gt=!0)},{passive:!0}),an.addEventListener("mouseleave",()=>{r(24,Gt=!1)},{passive:!0}),an.addEventListener("click",()=>{W&&r(0,Ge=!1)},{passive:!0}))}dw(()=>{if(g)return g.on("click",$t),g.on("contextmenu",$t),typeof f=="string"&&(g.on("click",f,Et),g.on("dblclick",f,Et),g.on("contextmenu",f,Et),g.on("mousemove",f,zi),g.on("mouseleave",f,Ae),g.on("touchstart",f,wn),g.on("touchend",f,In)),()=>{g!=null&&g.loaded()&&(vt==null||vt.remove(),g.off("click",$t),g.off("contextmenu",$t),f instanceof us.Marker?f.getPopup()===vt&&f.setPopup(void 0):typeof f=="string"&&(g.off("click",f,Et),g.off("dblclick",f,Et),g.off("contextmenu",f,Et),g.off("mousemove",f,zi),g.off("mouseleave",f,Ae),g.off("touchstart",f,wn),g.off("touchend",f,In)))}});function tn(Ue){return ve?!("marker"in Ue)&&!TB(Ue)&&St(Ue)!==C:!1}let Nt=null,on="normal";function Et(Ue){Ue.type===me&&(tn(Ue)||("layerType"in Ue?Ue.layerType==="deckgl"?(r(10,Fe=Ue.coordinate),r(4,Nt=Ue.object?[Ue.object]:null)):(r(10,Fe=Ue.lngLat),r(4,Nt=Ue.features??[])):(r(10,Fe=Ue.lngLat),r(4,Nt=Ue.features??[])),setTimeout(()=>r(0,Ge=!0))))}let gn=null;function wn(Ue){gn=Ue.point}function In(Ue){if(!gn||me!=="hover")return;let Ot=gn.dist(Ue.point);gn=null,Ot<3&&(r(10,Fe=Ue.lngLat),r(4,Nt=Ue.features??[]),vt.isOpen()?r(25,on="justOpened"):(r(25,on="opening"),r(0,Ge=!0)))}function Ae(Ue){me!=="hover"||gn||on!=="normal"||(r(0,Ge=!1),r(4,Nt=null))}function zi(Ue){if(!(me!=="hover"||gn||on!=="normal")){if(tn(Ue)){r(0,Ge=!1),r(4,Nt=null);return}r(0,Ge=!0),r(4,Nt=Ue.features??[]),r(10,Fe=Ue.lngLat)}}function $t(Ue){if(on==="justOpened"){r(25,on="normal");return}if(!Y)return;let Ot=[an,f instanceof us.Marker?f==null?void 0:f.getElement():null];Ge&&vt.isOpen()&&!Ot.some(Rn=>Rn==null?void 0:Rn.contains(Ue.originalEvent.target))&&(Ue.type==="contextmenu"&&me==="contextmenu"||Ue.type!=="contextmenu")&&r(0,Ge=!1)}dl(()=>{g&&(vt!=null&&vt.isOpen())&&vt.remove()});let bt;const fe=()=>r(0,Ge=!1);function Se(Ue){Ea[Ue?"unshift":"push"](()=>{bt=Ue,r(1,bt)})}return t.$$set=Ue=>{"closeButton"in Ue&&r(11,F=Ue.closeButton),"closeOnClickOutside"in Ue&&r(12,Y=Ue.closeOnClickOutside),"closeOnClickInside"in Ue&&r(13,W=Ue.closeOnClickInside),"closeOnMove"in Ue&&r(14,pe=Ue.closeOnMove),"openOn"in Ue&&r(15,me=Ue.openOn),"openIfTopMost"in Ue&&r(16,ve=Ue.openIfTopMost),"focusAfterOpen"in Ue&&r(17,we=Ue.focusAfterOpen),"anchor"in Ue&&r(18,Ie=Ue.anchor),"offset"in Ue&&r(19,Pe=Ue.offset),"popupClass"in Ue&&r(20,Re=Ue.popupClass),"maxWidth"in Ue&&r(21,Ve=Ue.maxWidth),"lngLat"in Ue&&r(10,Fe=Ue.lngLat),"html"in Ue&&r(22,ze=Ue.html),"open"in Ue&&r(0,Ge=Ue.open),"$$scope"in Ue&&r(29,z=Ue.$$scope)},t.$$.update=()=>{if(t.$$.dirty[0]&14336&&r(27,l=F??(!Y&&!W)),t.$$.dirty[0]&146685952&&(vt||(r(23,vt=new us.Popup({closeButton:l,closeOnClick:!1,closeOnMove:pe,focusAfterOpen:we,maxWidth:Ve,className:Re,anchor:Ie,offset:Pe})),an=vt.getElement(),vt.on("open",()=>{r(0,Ge=!0),ut(),yt("open",vt)}),vt.on("close",()=>{r(0,Ge=!1),yt("close",vt)}),vt.on("hover",()=>{yt("hover",vt)}))),t.$$.dirty[0]&8421384&&vt&&f instanceof us.Marker&&(me==="click"?f.setPopup(vt):f.getPopup()===vt&&f.setPopup(void 0)),t.$$.dirty[0]&268468224&&Ct.includes(me)&&(x==null?void 0:x.type)===me&&(Et(x),hl(xt,x=null,x)),t.$$.dirty[0]&268468224&&r(26,p=me==="hover"&&((x==null?void 0:x.type)==="mousemove"||(x==null?void 0:x.type)==="mouseenter")),t.$$.dirty[0]&352354304&&me==="hover"&&xt&&(p&&x&&(x.layerType==="deckgl"?(r(10,Fe=x.coordinate),r(4,Nt=x.object?[x.object]:null)):(r(10,Fe=x.lngLat),r(4,Nt=x.features??[]))),r(0,Ge=(p||Gt)??!1)),t.$$.dirty[0]&12582914&&(bt?vt.setDOMContent(bt):ze&&vt.setHTML(ze)),t.$$.dirty[0]&8389632&&Fe&&vt.setLngLat(Fe),t.$$.dirty[0]&41943045&&g){let Ue=vt.isOpen();Ge&&!Ue?(vt.addTo(g),on==="opening"&&r(25,on="justOpened")):!Ge&&Ue&&vt.remove()}},[Ge,bt,g,f,Nt,De,mt,xt,Je,M,Fe,F,Y,W,pe,me,ve,we,Ie,Pe,Re,Ve,ze,vt,Gt,on,p,l,x,z,R,fe,Se]}class c8 extends Zi{constructor(e){super(),Wi(this,e,i6,n6,yi,{closeButton:11,closeOnClickOutside:12,closeOnClickInside:13,closeOnMove:14,openOn:15,openIfTopMost:16,focusAfterOpen:17,anchor:18,offset:19,popupClass:20,maxWidth:21,lngLat:10,html:22,open:0},null,[-1,-1])}}/*! js-cookie v3.0.5 | MIT */function td(t){for(var e=1;e"u")){x=td({},e,x),typeof x.expires=="number"&&(x.expires=new Date(Date.now()+x.expires*864e5)),x.expires&&(x.expires=x.expires.toUTCString()),p=encodeURIComponent(p).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape);var f="";for(var C in x)x[C]&&(f+="; "+C,x[C]!==!0&&(f+="="+x[C].split(";")[0]));return document.cookie=p+"="+t.write(g,p)+f}}function l(p){if(!(typeof document>"u"||arguments.length&&!p)){for(var g=document.cookie?document.cookie.split("; "):[],x={},f=0;fkd(e,"loaded",g)),Ea.push(()=>kd(e,"map",x)),e.$on("error",g6),{c(){po(e.$$.fragment)},m(C,R){to(e,C,R),p=!0},p(C,R){const z={};R&8&&(z.style=C[3]),R&1&&(z.bounds=C[0]),R&528&&(z.$$scope={dirty:R,ctx:C}),!r&&R&4&&(r=!0,z.loaded=C[2],Sd(()=>r=!1)),!l&&R&2&&(l=!0,z.map=C[1],Sd(()=>l=!1)),e.$set(z)},i(C){p||(Vt(e.$$.fragment,C),p=!0)},o(C){en(e.$$.fragment,C),p=!1},d(C){no(e,C)}}}function uw(t){let e,r,l,p,g;e=new oE({}),l=new rE({props:{position:"bottom-right",visualizePitch:!0}});const x=t[6].default,f=ps(x,t,t[9],null);return{c(){po(e.$$.fragment),r=qr(),po(l.$$.fragment),p=qr(),f&&f.c()},m(C,R){to(e,C,R),Fn(C,r,R),to(l,C,R),Fn(C,p,R),f&&f.m(C,R),g=!0},p(C,R){f&&f.p&&(!g||R&512)&&gs(f,x,C,C[9],g?ms(x,C[9],R,null):ys(C[9]),null)},i(C){g||(Vt(e.$$.fragment,C),Vt(l.$$.fragment,C),Vt(f,C),g=!0)},o(C){en(e.$$.fragment,C),en(l.$$.fragment,C),en(f,C),g=!1},d(C){C&&(Mn(r),Mn(p)),no(e,C),no(l,C),f&&f.d(C)}}}function p6(t){let e,r,l=t[4]&&uw(t);return{c(){l&&l.c(),e=ml()},m(p,g){l&&l.m(p,g),Fn(p,e,g),r=!0},p(p,g){p[4]?l?(l.p(p,g),g&16&&Vt(l,1)):(l=uw(p),l.c(),Vt(l,1),l.m(e.parentNode,e)):l&&(_s(),en(l,1,1,()=>{l=null}),vs())},i(p){r||(Vt(l),r=!0)},o(p){en(l),r=!1},d(p){p&&Mn(e),l&&l.d(p)}}}function m6(t){let e,r,l=t[3]&&lw(t);return{c(){e=si("div"),l&&l.c(),bn(e,"class","map svelte-12dpf1u")},m(p,g){Fn(p,e,g),l&&l.m(e,null),r=!0},p(p,[g]){p[3]?l?(l.p(p,g),g&8&&Vt(l,1)):(l=lw(p),l.c(),Vt(l,1),l.m(e,null)):l&&(_s(),en(l,1,1,()=>{l=null}),vs())},i(p){r||(Vt(l),r=!0)},o(p){en(l),r=!1},d(p){p&&Mn(e),l&&l.d()}}}function g6(t){console.error(`MapLibre error: ${t.detail.error}`)}function y6(t,e,r){let l;er(t,M1,W=>r(4,l=W));let{$$slots:p={},$$scope:g}=e,{style:x}=e,{startBounds:f=void 0}=e,C=null,R,z=!1;xy("setCamera",!window.location.hash),window.location.hash&&(f=void 0),dw(async()=>{r(3,C=await P1(x))});async function M(W){r(3,C=await P1(x));let pe=new URL(window.location.href);pe.searchParams.set("style",W),window.history.replaceState(null,"",pe.toString())}function F(W){z=W,r(2,z)}function Y(W){R=W,r(1,R)}return t.$$set=W=>{"style"in W&&r(5,x=W.style),"startBounds"in W&&r(0,f=W.startBounds),"$$scope"in W&&r(9,g=W.$$scope)},t.$$.update=()=>{t.$$.dirty&6&&z&&M1.set(R),t.$$.dirty&32&&M(x)},[f,R,z,C,l,x,p,F,Y,g]}class f8 extends Zi{constructor(e){super(),Wi(this,e,y6,m6,yi,{style:5,startBounds:0})}}const _6="Unable to save because the local storage quota has been exceeded: you may need to clear out your web browser's local storage for this app, or run in private mode before you can save again. Specific error here: ";function v6(){return{isQuotaError:!1,message:"",storedStrings:[]}}function d8(t,e){try{return window.localStorage.setItem(t,e),v6()}catch(r){return{isQuotaError:!0,message:_6+r,storedStrings:sE()}}}function sE(){let t=[];for(let e=0;er.storageUsedInMB-e.storageUsedInMB),t}function x6(t){return t.length/(1024*1024)}function p8(){window.localStorage.clear()}function m8(t){return window.localStorage.removeItem(t),sE()}async function g8(){let e=await(await fetch(WR)).json();return GR(e)}function aE(){if(window.location.hostname=="localhost")return"Local development";if(window.location.hostname=="acteng.github.io"){let t=window.location.pathname.split("/");if(t.length==3&&t[0]==""&&t[1]=="atip")return"Public (development)";if(t.length==4&&t[0]==""&&t[1]=="atip")return`Public (dev branch: ${t[2]})`}else if(window.location.hostname.endsWith(".appspot.com"))return"Private (development)";return"Unknown"}async function y8(t,e){let r=await fetch(t),l=r.body.getReader(),p=r.headers.get("Content-Length");if(!p)throw new Error(`No Content-Length header from ${t}`);let g=parseInt(p),x=0,f=[];for(;;){let{done:z,value:M}=await l.read();if(z)break;M&&(f.push(M),x+=M.length,e(100*x/g))}let C=new Uint8Array(x),R=0;for(let z of f)C.set(z,R),R+=z.length;return C}function _8(){return"https://atip.uk/layers"}function b6(){return"https://atip.uk/private_layers"}export{GT as $,F6 as A,d8 as B,a8 as C,s8 as D,Iw as E,FT as F,l8 as G,u8 as H,U6 as I,vc as J,Ew as K,h8 as L,f8 as M,Gs as N,ps as O,wd as P,Jv as Q,D6 as R,Zi as S,gs as T,ys as U,ms as V,yT as W,$v as X,jr as Y,i8 as Z,qh as _,qT as a,M1 as a$,z6 as a0,Tw as a1,Hi as a2,S6 as a3,tr as a4,ml as a5,_s as a6,vs as a7,Ep as a8,EB as a9,X6 as aA,Y6 as aB,hw as aC,Q6 as aD,c8 as aE,Vs as aF,GM as aG,M2 as aH,P2 as aI,jy as aJ,eo as aK,jo as aL,pp as aM,io as aN,rf as aO,e8 as aP,H6 as aQ,nT as aR,j6 as aS,m8 as aT,p8 as aU,r8 as aV,A6 as aW,t8 as aX,bB as aY,E6 as aZ,n8 as a_,dl as aa,FB as ab,hl as ac,zB as ad,cp as ae,Pc as af,vy as ag,CB as ah,AB as ai,t0 as aj,P6 as ak,L6 as al,oT as am,L2 as an,Uy as ao,dT as ap,M6 as aq,K6 as ar,sT as as,J6 as at,vB as au,e0 as av,$6 as aw,_B as ax,yB as ay,Z6 as az,Ea as b,V6 as b0,Kv as b1,iE as b2,us as b3,W6 as b4,_8 as b5,b6,C6 as b7,h6 as b8,d6 as b9,y8 as ba,iT as bb,hg as bc,I6 as bd,T6 as be,xR as bf,B6 as bg,aT as bh,Us as bi,k6 as bj,G6 as bk,q6 as bl,rT as bm,lT as bn,_y as bo,o8 as bp,kd as c,O6 as d,si as e,qr as f,aE as g,po as h,Wi as i,bn as j,Fn as k,oi as l,to as m,Sd as n,en as o,Mn as p,no as q,er as r,yi as s,Vt as t,dw as u,Ia as v,Qv as w,wa as x,R6 as y,g8 as z}; diff --git a/ss_huge_refactor_pt1/assets/main-5ac0e52d.js b/ss_huge_refactor_pt1/assets/main-ab7a749a.js similarity index 98% rename from ss_huge_refactor_pt1/assets/main-5ac0e52d.js rename to ss_huge_refactor_pt1/assets/main-ab7a749a.js index 85011858..d0c1947b 100644 --- a/ss_huge_refactor_pt1/assets/main-5ac0e52d.js +++ b/ss_huge_refactor_pt1/assets/main-ab7a749a.js @@ -1 +1 @@ -import{S as $e,i as me,s as ce,L as ge,a as de,E as re,F as he,R as _e,b as X,c as oe,d as ve,M as be,e as y,f as g,g as we,h as d,j as S,k as E,l as i,m as h,n as le,t as _,o as v,p as I,q as b,r as ye,u as Se,v as O,w as ie,x as Ae,G as ke,y as Le,z as Ce,A as Me,B as Ee,C as Ie,D as Fe,H as Te,I as Be,J as ue}from"./index-4a1c3090.js";import{D as De,A as Je}from"./About-1496adf6.js";import{P as Oe}from"./Popup-0181ae79.js";function je(r){let t;return{c(){t=O("About")},m(e,n){E(e,t,n)},d(e){e&&I(t)}}}function Ge(r){let t,e,n,o,a;return{c(){t=y("input"),e=g(),n=y("datalist"),S(t,"class","govuk-input govuk-input--width-20"),S(t,"id","inputValue"),S(t,"data-testid","transport-authority"),S(t,"list","authorities-list"),S(n,"id","authorities-list")},m(l,f){E(l,t,f),ie(t,r[0]),E(l,e,f),E(l,n,f),r[12](n),o||(a=Ae(t,"input",r[11]),o=!0)},p(l,f){f&1&&t.value!==l[0]&&ie(t,l[0])},d(l){l&&(I(t),I(e),I(n)),r[12](null),o=!1,a()}}}function Ne(r){let t;return{c(){t=O("Start")},m(e,n){E(e,t,n)},d(e){e&&I(t)}}}function Pe(r){let t,e=r[19].name+"",n,o,a=r[19].level+"",l,f;return{c(){t=y("p"),n=O(e),o=O(" ("),l=O(a),f=O(")")},m(c,p){E(c,t,p),i(t,n),i(t,o),i(t,l),i(t,f)},p(c,p){p&524288&&e!==(e=c[19].name+"")&&ue(n,e),p&524288&&a!==(a=c[19].level+"")&&ue(l,a)},d(c){c&&I(t)}}}function He(r){let t,e;return t=new Oe({props:{$$slots:{default:[Pe,({props:n})=>({19:n}),({props:n})=>n?524288:0]},$$scope:{ctx:r}}}),{c(){d(t.$$.fragment)},m(n,o){h(t,n,o),e=!0},p(n,o){const a={};o&1572864&&(a.$$scope={dirty:o,ctx:n}),t.$set(a)},i(n){e||(_(t.$$.fragment,n),e=!0)},o(n){v(t.$$.fragment,n),e=!1},d(n){b(t,n)}}}function Ve(r){let t,e,n,o;return t=new Ie({props:{id:"boundaries",filter:["==",["get","level"],r[5]],paint:{"fill-color":"rgb(200, 100, 240)","fill-outline-color":"rgb(200, 100, 240)","fill-opacity":Fe(0,.5)},manageHoverState:!0,hoverCursor:"pointer",$$slots:{default:[He]},$$scope:{ctx:r}}}),t.$on("click",r[8]),n=new Te({props:{id:"boundaries-outline",filter:["==",["get","level"],r[5]],paint:{"line-color":"rgb(200, 100, 240)","line-width":2.5},manageHoverState:!0}}),{c(){d(t.$$.fragment),e=g(),d(n.$$.fragment)},m(a,l){h(t,a,l),E(a,e,l),h(n,a,l),o=!0},p(a,l){const f={};l&32&&(f.filter=["==",["get","level"],a[5]]),l&1048576&&(f.$$scope={dirty:l,ctx:a}),t.$set(f);const c={};l&32&&(c.filter=["==",["get","level"],a[5]]),n.$set(c)},i(a){o||(_(t.$$.fragment,a),_(n.$$.fragment,a),o=!0)},o(a){v(t.$$.fragment,a),v(n.$$.fragment,a),o=!1},d(a){a&&I(e),b(t,a),b(n,a)}}}function Re(r){let t,e;return t=new ke({props:{data:r[1],generateId:!0,$$slots:{default:[Ve]},$$scope:{ctx:r}}}),{c(){d(t.$$.fragment)},m(n,o){h(t,n,o),e=!0},p(n,o){const a={};o&2&&(a.data=n[1]),o&1048608&&(a.$$scope={dirty:o,ctx:n}),t.$set(a)},i(n){e||(_(t.$$.fragment,n),e=!0)},o(n){v(t.$$.fragment,n),e=!1},d(n){b(t,n)}}}function qe(r){let t,e,n,o,a,l,f,c,p,T,A,D,C,P,k,H,V,R,L,j,q,u,w,$,G,M,J,z,N,B,W,F,K,U;f=new ge({}),p=new de({props:{$$slots:{default:[je]},$$scope:{ctx:r}}}),p.$on("click",r[10]),A=new re({props:{errorMessage:r[3]}}),C=new he({props:{label:"Select Transport Authority or Local Authority District",id:"inputValue",$$slots:{default:[Ge]},$$scope:{ctx:r}}}),k=new De({props:{disabled:!r[6],$$slots:{default:[Ne]},$$scope:{ctx:r}}}),k.$on("click",r[9]);function fe(s){r[13](s)}let Y={legend:"Or pick from the map",choices:[["TA","Transport Authorities"],["LAD","Local Authority Districts"]],inlineSmall:!0};r[5]!==void 0&&(Y.value=r[5]),L=new _e({props:Y}),X.push(()=>oe(L,"value",fe)),$=new re({props:{errorMessage:ze}}),M=new ve({props:{label:"Or upload an ATIP GeoJSON file",onLoad:r[7]}}),B=new be({props:{style:"streets",startBounds:[-5.96,49.89,2.31,55.94],$$slots:{default:[Re]},$$scope:{ctx:r}}});function pe(s){r[14](s)}let Z={};return r[2]!==void 0&&(Z.open=r[2]),F=new Je({props:Z}),X.push(()=>oe(F,"open",pe)),{c(){t=y("div"),e=y("div"),n=y("h1"),n.textContent="Welcome to ATIP Scheme Sketcher v2",o=g(),a=y("p"),a.textContent=`App version: ${we()}`,l=g(),d(f.$$.fragment),c=g(),d(p.$$.fragment),T=g(),d(A.$$.fragment),D=g(),d(C.$$.fragment),P=g(),d(k.$$.fragment),H=g(),V=y("hr"),R=g(),d(L.$$.fragment),q=g(),u=y("hr"),w=g(),d($.$$.fragment),G=g(),d(M.$$.fragment),J=g(),z=y("div"),N=y("div"),d(B.$$.fragment),W=g(),d(F.$$.fragment),S(n,"class","govuk-heading-l"),S(e,"class","govuk-grid-column-one-half left svelte-lyn11h"),S(N,"id","map"),S(N,"class","svelte-lyn11h"),S(z,"class","govuk-grid-column-one-half"),S(t,"class","govuk-grid-row")},m(s,m){E(s,t,m),i(t,e),i(e,n),i(e,o),i(e,a),i(e,l),h(f,e,null),i(e,c),h(p,e,null),i(e,T),h(A,e,null),i(e,D),h(C,e,null),i(e,P),h(k,e,null),i(e,H),i(e,V),i(e,R),h(L,e,null),i(e,q),i(e,u),i(e,w),h($,e,null),i(e,G),h(M,e,null),i(t,J),i(t,z),i(z,N),h(B,N,null),E(s,W,m),h(F,s,m),U=!0},p(s,[m]){const x={};m&1048576&&(x.$$scope={dirty:m,ctx:s}),p.$set(x);const ee={};m&8&&(ee.errorMessage=s[3]),A.$set(ee);const te={};m&1048593&&(te.$$scope={dirty:m,ctx:s}),C.$set(te);const Q={};m&64&&(Q.disabled=!s[6]),m&1048576&&(Q.$$scope={dirty:m,ctx:s}),k.$set(Q);const ne={};!j&&m&32&&(j=!0,ne.value=s[5],le(()=>j=!1)),L.$set(ne);const ae={};m&1048610&&(ae.$$scope={dirty:m,ctx:s}),B.$set(ae);const se={};!K&&m&4&&(K=!0,se.open=s[2],le(()=>K=!1)),F.$set(se)},i(s){U||(_(f.$$.fragment,s),_(p.$$.fragment,s),_(A.$$.fragment,s),_(C.$$.fragment,s),_(k.$$.fragment,s),_(L.$$.fragment,s),_($.$$.fragment,s),_(M.$$.fragment,s),_(B.$$.fragment,s),_(F.$$.fragment,s),U=!0)},o(s){v(f.$$.fragment,s),v(p.$$.fragment,s),v(A.$$.fragment,s),v(C.$$.fragment,s),v(k.$$.fragment,s),v(L.$$.fragment,s),v($.$$.fragment,s),v(M.$$.fragment,s),v(B.$$.fragment,s),v(F.$$.fragment,s),U=!1},d(s){s&&(I(t),I(W)),b(f),b(p),b(A),b(C),b(k),b(L),b($),b(M),b(B),b(F,s)}}}let ze="";function Ue(r,t,e){let n,o;ye(r,Be,u=>e(15,o=u));let a={type:"FeatureCollection",features:[]},l=!1,c=new URLSearchParams(window.location.search).get("error")||"",p,T,A=new Set,D="TA";Se(async()=>{Le(),e(1,a=await Ce());for(let u of a.features){let w=document.createElement("option");w.value=u.properties.full_name,w.label=`${u.properties.name} (${u.properties.level})`,T.appendChild(w),A.add(u.properties.full_name)}});function C(u,w){try{let $=JSON.parse(w),G=Me($.features,a);if(!G)throw new Error("Can't figure out the authority boundary that fully contains this scheme");$.authority=G;let M=$.authority,J=P($);J!="v1"&&(M+=`_${J}`),Ee(M,JSON.stringify($)),window.location.href=`scheme.html?authority=${$.authority}&schema=${J}`}catch($){e(3,c=`Couldn't load scheme from a file: ${$}`)}}function P(u){if(u.features.length>0){let w=u.features[0].properties;for(let $ of["pipeline"])if(w&&$ in w)return $}return o}function k(u){window.location.href=`scheme.html?authority=${u.detail.features[0].properties.full_name}&schema=${o}`}function H(){window.location.href=`scheme.html?authority=${p}&schema=${o}`}const V=()=>e(2,l=!l);function R(){p=this.value,e(0,p)}function L(u){X[u?"unshift":"push"](()=>{T=u,e(4,T)})}function j(u){D=u,e(5,D)}function q(u){l=u,e(2,l)}return r.$$.update=()=>{r.$$.dirty&1&&e(6,n=A.has(p))},[p,a,l,c,T,D,n,C,k,H,V,R,L,j,q]}class We extends $e{constructor(t){super(),me(this,t,Ue,qe,ce,{})}}document.body.className+=" js-enabled"+("noModule"in HTMLScriptElement.prototype?" govuk-frontend-supported":"");new We({target:document.getElementById("app")}); +import{S as $e,i as me,s as ce,L as ge,a as de,E as re,F as he,R as _e,b as X,c as oe,d as ve,M as be,e as y,f as g,g as we,h as d,j as S,k as E,l as i,m as h,n as le,t as _,o as v,p as I,q as b,r as ye,u as Se,v as O,w as ie,x as Ae,G as ke,y as Le,z as Ce,A as Me,B as Ee,C as Ie,D as Fe,H as Te,I as Be,J as ue}from"./index-a43921db.js";import{D as De,A as Je}from"./About-a465dc1b.js";import{P as Oe}from"./Popup-8f6f85cd.js";function je(r){let t;return{c(){t=O("About")},m(e,n){E(e,t,n)},d(e){e&&I(t)}}}function Ge(r){let t,e,n,o,a;return{c(){t=y("input"),e=g(),n=y("datalist"),S(t,"class","govuk-input govuk-input--width-20"),S(t,"id","inputValue"),S(t,"data-testid","transport-authority"),S(t,"list","authorities-list"),S(n,"id","authorities-list")},m(l,f){E(l,t,f),ie(t,r[0]),E(l,e,f),E(l,n,f),r[12](n),o||(a=Ae(t,"input",r[11]),o=!0)},p(l,f){f&1&&t.value!==l[0]&&ie(t,l[0])},d(l){l&&(I(t),I(e),I(n)),r[12](null),o=!1,a()}}}function Ne(r){let t;return{c(){t=O("Start")},m(e,n){E(e,t,n)},d(e){e&&I(t)}}}function Pe(r){let t,e=r[19].name+"",n,o,a=r[19].level+"",l,f;return{c(){t=y("p"),n=O(e),o=O(" ("),l=O(a),f=O(")")},m(c,p){E(c,t,p),i(t,n),i(t,o),i(t,l),i(t,f)},p(c,p){p&524288&&e!==(e=c[19].name+"")&&ue(n,e),p&524288&&a!==(a=c[19].level+"")&&ue(l,a)},d(c){c&&I(t)}}}function He(r){let t,e;return t=new Oe({props:{$$slots:{default:[Pe,({props:n})=>({19:n}),({props:n})=>n?524288:0]},$$scope:{ctx:r}}}),{c(){d(t.$$.fragment)},m(n,o){h(t,n,o),e=!0},p(n,o){const a={};o&1572864&&(a.$$scope={dirty:o,ctx:n}),t.$set(a)},i(n){e||(_(t.$$.fragment,n),e=!0)},o(n){v(t.$$.fragment,n),e=!1},d(n){b(t,n)}}}function Ve(r){let t,e,n,o;return t=new Ie({props:{id:"boundaries",filter:["==",["get","level"],r[5]],paint:{"fill-color":"rgb(200, 100, 240)","fill-outline-color":"rgb(200, 100, 240)","fill-opacity":Fe(0,.5)},manageHoverState:!0,hoverCursor:"pointer",$$slots:{default:[He]},$$scope:{ctx:r}}}),t.$on("click",r[8]),n=new Te({props:{id:"boundaries-outline",filter:["==",["get","level"],r[5]],paint:{"line-color":"rgb(200, 100, 240)","line-width":2.5},manageHoverState:!0}}),{c(){d(t.$$.fragment),e=g(),d(n.$$.fragment)},m(a,l){h(t,a,l),E(a,e,l),h(n,a,l),o=!0},p(a,l){const f={};l&32&&(f.filter=["==",["get","level"],a[5]]),l&1048576&&(f.$$scope={dirty:l,ctx:a}),t.$set(f);const c={};l&32&&(c.filter=["==",["get","level"],a[5]]),n.$set(c)},i(a){o||(_(t.$$.fragment,a),_(n.$$.fragment,a),o=!0)},o(a){v(t.$$.fragment,a),v(n.$$.fragment,a),o=!1},d(a){a&&I(e),b(t,a),b(n,a)}}}function Re(r){let t,e;return t=new ke({props:{data:r[1],generateId:!0,$$slots:{default:[Ve]},$$scope:{ctx:r}}}),{c(){d(t.$$.fragment)},m(n,o){h(t,n,o),e=!0},p(n,o){const a={};o&2&&(a.data=n[1]),o&1048608&&(a.$$scope={dirty:o,ctx:n}),t.$set(a)},i(n){e||(_(t.$$.fragment,n),e=!0)},o(n){v(t.$$.fragment,n),e=!1},d(n){b(t,n)}}}function qe(r){let t,e,n,o,a,l,f,c,p,T,A,D,C,P,k,H,V,R,L,j,q,u,w,$,G,M,J,z,N,B,W,F,K,U;f=new ge({}),p=new de({props:{$$slots:{default:[je]},$$scope:{ctx:r}}}),p.$on("click",r[10]),A=new re({props:{errorMessage:r[3]}}),C=new he({props:{label:"Select Transport Authority or Local Authority District",id:"inputValue",$$slots:{default:[Ge]},$$scope:{ctx:r}}}),k=new De({props:{disabled:!r[6],$$slots:{default:[Ne]},$$scope:{ctx:r}}}),k.$on("click",r[9]);function fe(s){r[13](s)}let Y={legend:"Or pick from the map",choices:[["TA","Transport Authorities"],["LAD","Local Authority Districts"]],inlineSmall:!0};r[5]!==void 0&&(Y.value=r[5]),L=new _e({props:Y}),X.push(()=>oe(L,"value",fe)),$=new re({props:{errorMessage:ze}}),M=new ve({props:{label:"Or upload an ATIP GeoJSON file",onLoad:r[7]}}),B=new be({props:{style:"streets",startBounds:[-5.96,49.89,2.31,55.94],$$slots:{default:[Re]},$$scope:{ctx:r}}});function pe(s){r[14](s)}let Z={};return r[2]!==void 0&&(Z.open=r[2]),F=new Je({props:Z}),X.push(()=>oe(F,"open",pe)),{c(){t=y("div"),e=y("div"),n=y("h1"),n.textContent="Welcome to ATIP Scheme Sketcher v2",o=g(),a=y("p"),a.textContent=`App version: ${we()}`,l=g(),d(f.$$.fragment),c=g(),d(p.$$.fragment),T=g(),d(A.$$.fragment),D=g(),d(C.$$.fragment),P=g(),d(k.$$.fragment),H=g(),V=y("hr"),R=g(),d(L.$$.fragment),q=g(),u=y("hr"),w=g(),d($.$$.fragment),G=g(),d(M.$$.fragment),J=g(),z=y("div"),N=y("div"),d(B.$$.fragment),W=g(),d(F.$$.fragment),S(n,"class","govuk-heading-l"),S(e,"class","govuk-grid-column-one-half left svelte-lyn11h"),S(N,"id","map"),S(N,"class","svelte-lyn11h"),S(z,"class","govuk-grid-column-one-half"),S(t,"class","govuk-grid-row")},m(s,m){E(s,t,m),i(t,e),i(e,n),i(e,o),i(e,a),i(e,l),h(f,e,null),i(e,c),h(p,e,null),i(e,T),h(A,e,null),i(e,D),h(C,e,null),i(e,P),h(k,e,null),i(e,H),i(e,V),i(e,R),h(L,e,null),i(e,q),i(e,u),i(e,w),h($,e,null),i(e,G),h(M,e,null),i(t,J),i(t,z),i(z,N),h(B,N,null),E(s,W,m),h(F,s,m),U=!0},p(s,[m]){const x={};m&1048576&&(x.$$scope={dirty:m,ctx:s}),p.$set(x);const ee={};m&8&&(ee.errorMessage=s[3]),A.$set(ee);const te={};m&1048593&&(te.$$scope={dirty:m,ctx:s}),C.$set(te);const Q={};m&64&&(Q.disabled=!s[6]),m&1048576&&(Q.$$scope={dirty:m,ctx:s}),k.$set(Q);const ne={};!j&&m&32&&(j=!0,ne.value=s[5],le(()=>j=!1)),L.$set(ne);const ae={};m&1048610&&(ae.$$scope={dirty:m,ctx:s}),B.$set(ae);const se={};!K&&m&4&&(K=!0,se.open=s[2],le(()=>K=!1)),F.$set(se)},i(s){U||(_(f.$$.fragment,s),_(p.$$.fragment,s),_(A.$$.fragment,s),_(C.$$.fragment,s),_(k.$$.fragment,s),_(L.$$.fragment,s),_($.$$.fragment,s),_(M.$$.fragment,s),_(B.$$.fragment,s),_(F.$$.fragment,s),U=!0)},o(s){v(f.$$.fragment,s),v(p.$$.fragment,s),v(A.$$.fragment,s),v(C.$$.fragment,s),v(k.$$.fragment,s),v(L.$$.fragment,s),v($.$$.fragment,s),v(M.$$.fragment,s),v(B.$$.fragment,s),v(F.$$.fragment,s),U=!1},d(s){s&&(I(t),I(W)),b(f),b(p),b(A),b(C),b(k),b(L),b($),b(M),b(B),b(F,s)}}}let ze="";function Ue(r,t,e){let n,o;ye(r,Be,u=>e(15,o=u));let a={type:"FeatureCollection",features:[]},l=!1,c=new URLSearchParams(window.location.search).get("error")||"",p,T,A=new Set,D="TA";Se(async()=>{Le(),e(1,a=await Ce());for(let u of a.features){let w=document.createElement("option");w.value=u.properties.full_name,w.label=`${u.properties.name} (${u.properties.level})`,T.appendChild(w),A.add(u.properties.full_name)}});function C(u,w){try{let $=JSON.parse(w),G=Me($.features,a);if(!G)throw new Error("Can't figure out the authority boundary that fully contains this scheme");$.authority=G;let M=$.authority,J=P($);J!="v1"&&(M+=`_${J}`),Ee(M,JSON.stringify($)),window.location.href=`scheme.html?authority=${$.authority}&schema=${J}`}catch($){e(3,c=`Couldn't load scheme from a file: ${$}`)}}function P(u){if(u.features.length>0){let w=u.features[0].properties;for(let $ of["pipeline"])if(w&&$ in w)return $}return o}function k(u){window.location.href=`scheme.html?authority=${u.detail.features[0].properties.full_name}&schema=${o}`}function H(){window.location.href=`scheme.html?authority=${p}&schema=${o}`}const V=()=>e(2,l=!l);function R(){p=this.value,e(0,p)}function L(u){X[u?"unshift":"push"](()=>{T=u,e(4,T)})}function j(u){D=u,e(5,D)}function q(u){l=u,e(2,l)}return r.$$.update=()=>{r.$$.dirty&1&&e(6,n=A.has(p))},[p,a,l,c,T,D,n,C,k,H,V,R,L,j,q]}class We extends $e{constructor(t){super(),me(this,t,Ue,qe,ce,{})}}document.body.className+=" js-enabled"+("noModule"in HTMLScriptElement.prototype?" govuk-frontend-supported":"");new We({target:document.getElementById("app")}); diff --git a/ss_huge_refactor_pt1/assets/nested-b0626c07.js b/ss_huge_refactor_pt1/assets/nested-be934bca.js similarity index 62% rename from ss_huge_refactor_pt1/assets/nested-b0626c07.js rename to ss_huge_refactor_pt1/assets/nested-be934bca.js index ce2a5c65..a1717d15 100644 --- a/ss_huge_refactor_pt1/assets/nested-b0626c07.js +++ b/ss_huge_refactor_pt1/assets/nested-be934bca.js @@ -1,5 +1,5 @@ -var Ys=Object.defineProperty;var Xs=(r,e,n)=>e in r?Ys(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n;var me=(r,e,n)=>(Xs(r,typeof e!="symbol"?e+"":e,n),n);import{S as te,i as ne,s as x,F as Mt,h as P,m as L,t as w,o as k,q as C,K as Pt,E as ze,a as ae,f as F,e as G,j as T,k as $,w as Le,x as he,p as y,v as q,l as z,J as ge,N as Rr,O as Wn,P as be,Q as Kr,T as Hn,U as Zn,V as Kn,W as we,X as Vr,Y as Ws,Z as Oo,_ as Hs,$ as jo,a0 as Zs,a1 as Ks,a2 as at,a3 as Je,a4 as ee,a5 as fe,a6 as se,a7 as le,a8 as Io,a9 as Vs,r as Y,aa as Ye,ab as Qs,ac as Be,ad as xs,ae as el,C as ln,af as tl,ag as nl,ah as rl,ai as je,aj as Or,ak as jr,al as il,am as ol,an as sl,ao as ll,G as Et,ap as ul,aq as ke,ar as It,b as K,c as V,n as Q,as as Vn,at as Xe,au as Pn,av as Pe,aw as nn,u as ot,ax as oe,ay as Zt,az as Kt,aA as wt,H as Bt,aB as Ln,aC as We,aD as Vt,aE as Ir,aF as Qr,aG as Te,aH as cr,aI as al,aJ as fl,aK as Ge,aL as Cn,aM as xr,aN as pt,aO as Bo,aP as un,R as qt,aQ as Lt,I as tt,aR as St,aS as pr,aT as cl,aU as pl,B as ml,d as qo,aV as Br,aW as Nn,aX as ei,aY as dl,aZ as gl,a_ as Qn,M as hl,L as _l,g as bl,y as vl,z as $l,a$ as yl}from"./index-4a1c3090.js";import{M as mr,m as He,b as Go,l as ue,e as Gt,C as To,a as ht,B as Ze,R as wl,i as kt,c as rn,d as on,f as Tt,g as kl,h as Jt,j as Sl,S as El,k as Ml,n as xn,p as Fn,o as Pl,q as Ll,t as Cl,r as ti,s as Nl,u as Fl,Z as Al,G as Rl}from"./ZoomOutMap-2095bbd6.js";import{D as st,A as Ol}from"./About-1496adf6.js";function ni(r){let e,n,t=An(r[0])+"",o;return{c(){e=G("div"),n=q("ÂŁ"),o=q(t),T(e,"class","govuk-hint")},m(i,s){$(i,e,s),z(e,n),z(e,o)},p(i,s){s&1&&t!==(t=An(i[0])+"")&&ge(o,t)},d(i){i&&y(e)}}}function jl(r){let e;return{c(){e=q("multiply by 1 million")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Il(r){let e,n,t,o,i,s,l,u,a;e=new ze({props:{errorMessage:ri(r[2])}});let f=r[0]!=null&&ni(r);return s=new ae({props:{disabled:r[0]==null||r[0]>1e3,$$slots:{default:[jl]},$$scope:{ctx:r}}}),s.$on("click",r[4]),{c(){P(e.$$.fragment),n=F(),f&&f.c(),t=F(),o=G("input"),i=F(),P(s.$$.fragment),T(o,"type","text"),T(o,"inputmode","numeric"),T(o,"class","govuk-input govuk-input--width-10"),T(o,"id",r[3])},m(c,p){L(e,c,p),$(c,n,p),f&&f.m(c,p),$(c,t,p),$(c,o,p),Le(o,r[2]),$(c,i,p),L(s,c,p),l=!0,u||(a=he(o,"input",r[5]),u=!0)},p(c,p){const m={};p&4&&(m.errorMessage=ri(c[2])),e.$set(m),c[0]!=null?f?f.p(c,p):(f=ni(c),f.c(),f.m(t.parentNode,t)):f&&(f.d(1),f=null),p&4&&o.value!==c[2]&&Le(o,c[2]);const h={};p&1&&(h.disabled=c[0]==null||c[0]>1e3),p&128&&(h.$$scope={dirty:p,ctx:c}),s.$set(h)},i(c){l||(w(e.$$.fragment,c),w(s.$$.fragment,c),l=!0)},o(c){k(e.$$.fragment,c),k(s.$$.fragment,c),l=!1},d(c){c&&(y(n),y(t),y(o),y(i)),C(e,c),f&&f.d(c),C(s,c),u=!1,a()}}}function Bl(r){let e,n;return e=new Mt({props:{label:r[1],id:r[3],$$slots:{default:[Il]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,[o]){const i={};o&2&&(i.label=t[1]),o&133&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Do(r){if(r!="")return parseFloat(r.replaceAll(",",""))}function ri(r){let e=Do(r);return e==null?"":isNaN(e)?"Please enter a valid number":e<0?"Please enter a positive number":""}function An(r){return r.toLocaleString()}function ql(r,e,n){let{label:t}=e,{value:o}=e,i=Pt(),s=o==null?"":An(o);function l(f){n(0,o=Do(f))}function u(){n(2,s=An(o*1e6))}function a(){s=this.value,n(2,s)}return r.$$set=f=>{"label"in f&&n(1,t=f.label),"value"in f&&n(0,o=f.value)},r.$$.update=()=>{r.$$.dirty&4&&l(s)},[o,t,s,i,u,a]}class Gl extends te{constructor(e){super(),ne(this,e,ql,Bl,x,{label:1,value:0})}}function Tl(r){let e,n,t,o,i,s,l;return e=new ze({props:{errorMessage:r[5](r[2])}}),{c(){P(e.$$.fragment),n=F(),t=G("input"),T(t,"type","text"),T(t,"inputmode","numeric"),T(t,"class",o=`govuk-input govuk-input--width-${r[1]}`),T(t,"id",r[3])},m(u,a){L(e,u,a),$(u,n,a),$(u,t,a),Le(t,r[2]),i=!0,s||(l=[he(t,"input",r[9]),he(t,"change",r[4])],s=!0)},p(u,a){const f={};a&4&&(f.errorMessage=u[5](u[2])),e.$set(f),(!i||a&2&&o!==(o=`govuk-input govuk-input--width-${u[1]}`))&&T(t,"class",o),a&4&&t.value!==u[2]&&Le(t,u[2])},i(u){i||(w(e.$$.fragment,u),i=!0)},o(u){k(e.$$.fragment,u),i=!1},d(u){u&&(y(n),y(t)),C(e,u),s=!1,Rr(l)}}}function Dl(r){let e,n;return e=new Mt({props:{label:r[0],id:r[3],$$slots:{default:[Tl]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,[o]){const i={};o&1&&(i.label=t[0]),o&1030&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Ul(r,e,n){let{label:t}=e,{value:o}=e,{width:i}=e,{min:s=void 0}=e,{max:l=void 0}=e,u=o==null?void 0:o.toString(),a=Pt();function f(){n(6,o=u==null?void 0:parseInt(u,10))}function c(m){if(m==""||m==null)return"";if(m.includes("."))return"Please enter a number without decimals";let h=Number(m);return isNaN(h)?"Please enter a valid number":s!=null&&hl?`Please enter a number that's at most ${l};`:""}function p(){u=this.value,n(2,u)}return r.$$set=m=>{"label"in m&&n(0,t=m.label),"value"in m&&n(6,o=m.value),"width"in m&&n(1,i=m.width),"min"in m&&n(7,s=m.min),"max"in m&&n(8,l=m.max)},[t,i,u,a,f,c,o,s,l,p]}class nr extends te{constructor(e){super(),ne(this,e,Ul,Dl,x,{label:0,value:6,width:1,min:7,max:8})}}function ii(r){let e,n;return{c(){e=G("div"),n=q(r[2]),T(e,"class","govuk-hint")},m(t,o){$(t,e,o),z(e,n)},p(t,o){o&4&&ge(n,t[2])},d(t){t&&y(e)}}}function zl(r){let e,n,t,o,i,s,l;e=new ze({props:{errorMessage:r[4]}});let u=r[2]&&ii(r);return{c(){P(e.$$.fragment),n=F(),u&&u.c(),t=F(),o=G("textarea"),T(o,"class","govuk-textarea"),T(o,"id",r[5]),T(o,"rows",r[3])},m(a,f){L(e,a,f),$(a,n,f),u&&u.m(a,f),$(a,t,f),$(a,o,f),Le(o,r[0]),i=!0,s||(l=he(o,"input",r[6]),s=!0)},p(a,f){const c={};f&16&&(c.errorMessage=a[4]),e.$set(c),a[2]?u?u.p(a,f):(u=ii(a),u.c(),u.m(t.parentNode,t)):u&&(u.d(1),u=null),(!i||f&8)&&T(o,"rows",a[3]),f&1&&Le(o,a[0])},i(a){i||(w(e.$$.fragment,a),i=!0)},o(a){k(e.$$.fragment,a),i=!1},d(a){a&&(y(n),y(t),y(o)),C(e,a),u&&u.d(a),s=!1,l()}}}function Jl(r){let e,n;return e=new Mt({props:{label:r[1],id:r[5],$$slots:{default:[zl]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,[o]){const i={};o&2&&(i.label=t[1]),o&157&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Yl(r,e,n){let{label:t}=e,{hint:o=""}=e,{value:i}=e,{rows:s=5}=e,{errorMessage:l=""}=e,u=Pt();function a(){i=this.value,n(0,i)}return r.$$set=f=>{"label"in f&&n(1,t=f.label),"hint"in f&&n(2,o=f.hint),"value"in f&&n(0,i=f.value),"rows"in f&&n(3,s=f.rows),"errorMessage"in f&&n(4,l=f.errorMessage)},[i,t,o,s,l,u,a]}class qr extends te{constructor(e){super(),ne(this,e,Yl,Jl,x,{label:1,hint:2,value:0,rows:3,errorMessage:4})}}function Xl(r){let e,n,t,o,i,s;return e=new ze({props:{errorMessage:r[2]}}),{c(){P(e.$$.fragment),n=F(),t=G("input"),T(t,"type","text"),T(t,"class","govuk-input"),T(t,"id",r[3])},m(l,u){L(e,l,u),$(l,n,u),$(l,t,u),Le(t,r[0]),o=!0,i||(s=he(t,"input",r[5]),i=!0)},p(l,u){const a={};u&4&&(a.errorMessage=l[2]),e.$set(a),u&1&&t.value!==l[0]&&Le(t,l[0])},i(l){o||(w(e.$$.fragment,l),o=!0)},o(l){k(e.$$.fragment,l),o=!1},d(l){l&&(y(n),y(t)),C(e,l),i=!1,s()}}}function Wl(r){let e,n;return e=new Mt({props:{label:r[1],id:r[3],$$slots:{default:[Xl]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,[o]){const i={};o&2&&(i.label=t[1]),o&69&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Hl(r,e,n){let t,{label:o}=e,{value:i}=e,{required:s=!1}=e,l=Pt();function u(){i=this.value,n(0,i)}return r.$$set=a=>{"label"in a&&n(1,o=a.label),"value"in a&&n(0,i=a.value),"required"in a&&n(4,s=a.required)},r.$$.update=()=>{r.$$.dirty&17&&n(2,t=s&&(i==null||i=="")?"Required":"")},[i,o,t,l,s,u]}class er extends te{constructor(e){super(),ne(this,e,Hl,Wl,x,{label:1,value:0,required:4})}}function Zl(r){let e,n,t,o;const i=r[2].default,s=Wn(i,r,r[1],null);let l=[{type:"button"},{class:"govuk-button govuk-button--warning"},{"data-module":"govuk-button"},r[0]],u={};for(let a=0;a{n(0,e=be(be({},e),Vr(s))),"$$scope"in s&&n(1,o=s.$$scope)},e=Vr(e),[e,o,t,i]}class bt extends te{constructor(e){super(),ne(this,e,Kl,Zl,x,{})}}class Vl{constructor(e){me(this,"map");me(this,"active");me(this,"eventListenersSuccess");me(this,"eventListenersFailure");me(this,"cursor");me(this,"onMouseMove",e=>{this.active&&(this.cursor={type:"Feature",properties:{},geometry:{type:"Point",coordinates:Oo(e.lngLat.toArray())}})});me(this,"onClick",()=>{if(this.active&&this.cursor){for(let e of this.eventListenersSuccess)e(this.cursor);this.stop()}});me(this,"onKeyDown",e=>{this.active&&e.key=="Escape"&&(e.stopPropagation(),this.cancel())});this.map=e,this.active=!1,this.eventListenersSuccess=[],this.eventListenersFailure=[],this.cursor=null,this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),document.removeEventListener("keydown",this.onKeyDown)}cancel(){for(let e of this.eventListenersFailure)e();this.stop()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersFailure=[]}start(){this.map.getCanvas().style.cursor="crosshair",this.active=!0}stop(){this.map.getCanvas().style.cursor="inherit",this.cursor=null,this.active=!1}}function Ql(r){var e=r%(2*Math.PI);return e*180/Math.PI}function mn(r){var e=r%360;return e*Math.PI/180}function gt(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return r.geometry.coordinates;if(r.type==="Point")return r.coordinates}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return r;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function et(r){if(Array.isArray(r))return r;if(r.type==="Feature"){if(r.geometry!==null)return r.geometry.coordinates}else if(r.coordinates)return r.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function dr(r,e){return r.type==="FeatureCollection"?"FeatureCollection":r.type==="GeometryCollection"?"GeometryCollection":r.type==="Feature"&&r.geometry!==null?r.geometry.type:r.type}function Uo(r,e,n){if(n===void 0&&(n={}),n.final===!0)return xl(r,e);var t=gt(r),o=gt(e),i=mn(t[0]),s=mn(o[0]),l=mn(t[1]),u=mn(o[1]),a=Math.sin(s-i)*Math.cos(u),f=Math.cos(l)*Math.sin(u)-Math.sin(l)*Math.cos(u)*Math.cos(s-i);return Ql(Math.atan2(a,f))}function xl(r,e){var n=Uo(e,r);return n=(n+180)%360,n}var Re=63710088e-1,eu={centimeters:Re*100,centimetres:Re*100,degrees:Re/111325,feet:Re*3.28084,inches:Re*39.37,kilometers:Re/1e3,kilometres:Re/1e3,meters:Re,metres:Re,miles:Re/1609.344,millimeters:Re*1e3,millimetres:Re*1e3,nauticalmiles:Re/1852,radians:1,yards:Re*1.0936};function tu(r,e){e===void 0&&(e="kilometers");var n=eu[e];if(!n)throw new Error(e+" units is invalid");return r*n}function dn(r){var e=r%360;return e*Math.PI/180}function ft(r,e,n){n===void 0&&(n={});var t=gt(r),o=gt(e),i=dn(o[1]-t[1]),s=dn(o[0]-t[0]),l=dn(t[1]),u=dn(o[1]),a=Math.pow(Math.sin(i/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(l)*Math.cos(u);return tu(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)),n.units)}var Oe=63710088e-1,nu={centimeters:Oe*100,centimetres:Oe*100,degrees:Oe/111325,feet:Oe*3.28084,inches:Oe*39.37,kilometers:Oe/1e3,kilometres:Oe/1e3,meters:Oe,metres:Oe,miles:Oe/1609.344,millimeters:Oe*1e3,millimetres:Oe*1e3,nauticalmiles:Oe/1852,radians:1,yards:Oe*1.0936};function ru(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function iu(r,e,n){if(n===void 0&&(n={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!si(r[0])||!si(r[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:r};return ru(t,e,n)}function ou(r,e){e===void 0&&(e="kilometers");var n=nu[e];if(!n)throw new Error(e+" units is invalid");return r/n}function oi(r){var e=r%(2*Math.PI);return e*180/Math.PI}function rr(r){var e=r%360;return e*Math.PI/180}function si(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function li(r,e,n,t){t===void 0&&(t={});var o=gt(r),i=rr(o[0]),s=rr(o[1]),l=rr(n),u=ou(e,t.units),a=Math.asin(Math.sin(s)*Math.cos(u)+Math.cos(s)*Math.sin(u)*Math.cos(l)),f=i+Math.atan2(Math.sin(l)*Math.sin(u)*Math.cos(s),Math.cos(u)-Math.sin(s)*Math.sin(a)),c=oi(f),p=oi(a);return iu([c,p],t.properties)}function gr(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function su(r,e,n){if(n===void 0&&(n={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!ai(r[0])||!ai(r[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:r};return gr(t,e,n)}function ui(r,e){e===void 0&&(e={});var n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=r,n}function ai(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function lu(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function uu(r,e,n){if(n===void 0&&(n={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var t={type:"LineString",coordinates:r};return lu(t,e,n)}function au(r,e){e===void 0&&(e={});var n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=r,n}function Rn(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function At(r,e,n){if(n===void 0&&(n={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!fi(r[0])||!fi(r[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:r};return Rn(t,e,n)}function jt(r,e,n){if(n===void 0&&(n={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var t={type:"LineString",coordinates:r};return Rn(t,e,n)}function fi(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function zo(r){return!!r&&r.constructor===Object}function Ct(r,e,n){if(r!==null)for(var t,o,i,s,l,u,a,f=0,c=0,p,m=r.type,h=m==="FeatureCollection",b=m==="Feature",v=h?r.features.length:1,E=0;Eu||h>a||b>f){l=c,u=t,a=h,f=b,i=0;return}var v=jt([l,c],n.properties);if(e(v,t,o,b,i)===!1)return!1;i++,l=c})===!1)return!1}}})}function Wo(r,e,n){var t=n,o=!1;return Xo(r,function(i,s,l,u,a){o===!1&&n===void 0?t=i:t=e(t,i,s,l,u,a),o=!0}),t}function Ho(r,e){if(!r)throw new Error("geojson is required");Nt(r,function(n,t,o){if(n.geometry!==null){var i=n.geometry.type,s=n.geometry.coordinates;switch(i){case"LineString":if(e(n,t,o,0,0)===!1)return!1;break;case"Polygon":for(var l=0;lo?n:o,a=t>i?t:i;return[s,l,u,a]}var Tr={exports:{}},Zo={exports:{}};(function(r,e){(function(n,t){r.exports=t()})(Hs,function(){function n(d,g,S,_,M){(function O(B,D,I,A,R){for(;A>I;){if(A-I>600){var N=A-I+1,j=D-I+1,H=Math.log(N),ie=.5*Math.exp(2*H/3),ce=.5*Math.sqrt(H*ie*(N-ie)/N)*(j-N/2<0?-1:1),U=Math.max(I,Math.floor(D-j*ie/N+ce)),de=Math.min(A,Math.floor(D+(N-j)*ie/N+ce));O(B,D,U,de,R)}var _e=B[D],Ee=I,$e=A;for(t(B,I,D),R(B[A],_e)>0&&t(B,I,A);Ee<$e;){for(t(B,Ee,$e),Ee++,$e--;R(B[Ee],_e)<0;)Ee++;for(;R(B[$e],_e)>0;)$e--}R(B[I],_e)===0?t(B,I,$e):t(B,++$e,A),$e<=D&&(I=$e+1),D<=$e&&(A=$e-1)}})(d,g,S||0,_||d.length-1,M||o)}function t(d,g,S){var _=d[g];d[g]=d[S],d[S]=_}function o(d,g){return dg?1:0}var i=function(d){d===void 0&&(d=9),this._maxEntries=Math.max(4,d),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function s(d,g,S){if(!S)return g.indexOf(d);for(var _=0;_=d.minX&&g.maxY>=d.minY}function v(d){return{children:d,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function E(d,g,S,_,M){for(var O=[g,S];O.length;)if(!((S=O.pop())-(g=O.pop())<=_)){var B=g+Math.ceil((S-g)/_/2)*_;n(d,B,g,S,M),O.push(g,B,B,S)}}return i.prototype.all=function(){return this._all(this.data,[])},i.prototype.search=function(d){var g=this.data,S=[];if(!b(d,g))return S;for(var _=this.toBBox,M=[];g;){for(var O=0;O=0&&M[g].children.length>this._maxEntries;)this._split(M,g),g--;this._adjustParentBBoxes(_,M,g)},i.prototype._split=function(d,g){var S=d[g],_=S.children.length,M=this._minEntries;this._chooseSplitAxis(S,M,_);var O=this._chooseSplitIndex(S,M,_),B=v(S.children.splice(O,S.children.length-O));B.height=S.height,B.leaf=S.leaf,l(S,this.toBBox),l(B,this.toBBox),g?d[g-1].children.push(B):this._splitRoot(S,B)},i.prototype._splitRoot=function(d,g){this.data=v([d,g]),this.data.height=d.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},i.prototype._chooseSplitIndex=function(d,g,S){for(var _,M,O,B,D,I,A,R=1/0,N=1/0,j=g;j<=S-g;j++){var H=u(d,0,j,this.toBBox),ie=u(d,j,S,this.toBBox),ce=(M=H,O=ie,B=void 0,D=void 0,I=void 0,A=void 0,B=Math.max(M.minX,O.minX),D=Math.max(M.minY,O.minY),I=Math.min(M.maxX,O.maxX),A=Math.min(M.maxY,O.maxY),Math.max(0,I-B)*Math.max(0,A-D)),U=p(H)+p(ie);ce=g;R--){var N=d.children[R];a(B,d.leaf?M(N):N),D+=m(B)}return D},i.prototype._adjustParentBBoxes=function(d,g,S){for(var _=S;_>=0;_--)a(g[_],d)},i.prototype._condense=function(d){for(var g=d.length-1,S=void 0;g>=0;g--)d[g].children.length===0?g>0?(S=d[g-1].children).splice(S.indexOf(d[g]),1):this.clear():l(d[g],this.toBBox)},i})})(Zo);var wu=Zo.exports,Ko={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.earthRadius=63710088e-1,r.factors={centimeters:r.earthRadius*100,centimetres:r.earthRadius*100,degrees:r.earthRadius/111325,feet:r.earthRadius*3.28084,inches:r.earthRadius*39.37,kilometers:r.earthRadius/1e3,kilometres:r.earthRadius/1e3,meters:r.earthRadius,metres:r.earthRadius,miles:r.earthRadius/1609.344,millimeters:r.earthRadius*1e3,millimetres:r.earthRadius*1e3,nauticalmiles:r.earthRadius/1852,radians:1,yards:r.earthRadius*1.0936},r.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/r.earthRadius,yards:1.0936133},r.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function e(A,R,N){N===void 0&&(N={});var j={type:"Feature"};return(N.id===0||N.id)&&(j.id=N.id),N.bbox&&(j.bbox=N.bbox),j.properties=R||{},j.geometry=A,j}r.feature=e;function n(A,R,N){switch(A){case"Point":return t(R).geometry;case"LineString":return l(R).geometry;case"Polygon":return i(R).geometry;case"MultiPoint":return c(R).geometry;case"MultiLineString":return f(R).geometry;case"MultiPolygon":return p(R).geometry;default:throw new Error(A+" is invalid")}}r.geometry=n;function t(A,R,N){if(N===void 0&&(N={}),!A)throw new Error("coordinates is required");if(!Array.isArray(A))throw new Error("coordinates must be an Array");if(A.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!O(A[0])||!O(A[1]))throw new Error("coordinates must contain numbers");var j={type:"Point",coordinates:A};return e(j,R,N)}r.point=t;function o(A,R,N){return N===void 0&&(N={}),a(A.map(function(j){return t(j,R)}),N)}r.points=o;function i(A,R,N){N===void 0&&(N={});for(var j=0,H=A;j=0))throw new Error("precision must be a positive number");var N=Math.pow(10,R||0);return Math.round(A*N)/N}r.round=h;function b(A,R){R===void 0&&(R="kilometers");var N=r.factors[R];if(!N)throw new Error(R+" units is invalid");return A*N}r.radiansToLength=b;function v(A,R){R===void 0&&(R="kilometers");var N=r.factors[R];if(!N)throw new Error(R+" units is invalid");return A/N}r.lengthToRadians=v;function E(A,R){return g(v(A,R))}r.lengthToDegrees=E;function d(A){var R=A%360;return R<0&&(R+=360),R}r.bearingToAzimuth=d;function g(A){var R=A%(2*Math.PI);return R*180/Math.PI}r.radiansToDegrees=g;function S(A){var R=A%360;return R*Math.PI/180}r.degreesToRadians=S;function _(A,R,N){if(R===void 0&&(R="kilometers"),N===void 0&&(N="kilometers"),!(A>=0))throw new Error("length must be a positive number");return b(v(A,R),N)}r.convertLength=_;function M(A,R,N){if(R===void 0&&(R="meters"),N===void 0&&(N="kilometers"),!(A>=0))throw new Error("area must be a positive number");var j=r.areaFactors[R];if(!j)throw new Error("invalid original units");var H=r.areaFactors[N];if(!H)throw new Error("invalid final units");return A/j*H}r.convertArea=M;function O(A){return!isNaN(A)&&A!==null&&!Array.isArray(A)}r.isNumber=O;function B(A){return!!A&&A.constructor===Object}r.isObject=B;function D(A){if(!A)throw new Error("bbox is required");if(!Array.isArray(A))throw new Error("bbox must be an Array");if(A.length!==4&&A.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");A.forEach(function(R){if(!O(R))throw new Error("bbox must only contain numbers")})}r.validateBBox=D;function I(A){if(!A)throw new Error("id is required");if(["string","number"].indexOf(typeof A)===-1)throw new Error("id must be a number or a string")}r.validateId=I})(Ko);const ku=jo(bu),Su=jo(Zs);var Ke=wu,Vo=Ko,Qo=ku,Rt=Su.default,Eu=Qo.featureEach;Qo.coordEach;Vo.polygon;var ci=Vo.featureCollection;function xo(r){var e=new Ke(r);return e.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Rt(n),Ke.prototype.insert.call(this,n)},e.load=function(n){var t=[];return Array.isArray(n)?n.forEach(function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:Rt(o),t.push(o)}):Eu(n,function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:Rt(o),t.push(o)}),Ke.prototype.load.call(this,t)},e.remove=function(n,t){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Rt(n),Ke.prototype.remove.call(this,n,t)},e.clear=function(){return Ke.prototype.clear.call(this)},e.search=function(n){var t=Ke.prototype.search.call(this,this.toBBox(n));return ci(t)},e.collides=function(n){return Ke.prototype.collides.call(this,this.toBBox(n))},e.all=function(){var n=Ke.prototype.all.call(this);return ci(n)},e.toJSON=function(){return Ke.prototype.toJSON.call(this)},e.fromJSON=function(n){return Ke.prototype.fromJSON.call(this,n)},e.toBBox=function(n){var t;if(n.bbox)t=n.bbox;else if(Array.isArray(n)&&n.length===4)t=n;else if(Array.isArray(n)&&n.length===6)t=[n[0],n[1],n[3],n[4]];else if(n.type==="Feature")t=Rt(n);else if(n.type==="FeatureCollection")t=Rt(n);else throw new Error("invalid geojson");return{minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]}},e}Tr.exports=xo;Tr.exports.default=xo;var Mu=Tr.exports;const Dr=Ks(Mu);function es(r,e){var n={},t=[];if(r.type==="LineString"&&(r=gr(r)),e.type==="LineString"&&(e=gr(e)),r.type==="Feature"&&e.type==="Feature"&&r.geometry!==null&&e.geometry!==null&&r.geometry.type==="LineString"&&e.geometry.type==="LineString"&&r.geometry.coordinates.length===2&&e.geometry.coordinates.length===2){var o=pi(r,e);return o&&t.push(o),ui(t)}var i=Dr();return i.load(hr(e)),Dt(hr(r),function(s){Dt(i.search(s),function(l){var u=pi(s,l);if(u){var a=et(u).join(",");n[a]||(n[a]=!0,t.push(u))}})}),ui(t)}function pi(r,e){var n=et(r),t=et(e);if(n.length!==2)throw new Error(" line1 must only contain 2 coordinates");if(t.length!==2)throw new Error(" line2 must only contain 2 coordinates");var o=n[0][0],i=n[0][1],s=n[1][0],l=n[1][1],u=t[0][0],a=t[0][1],f=t[1][0],c=t[1][1],p=(c-a)*(s-o)-(f-u)*(l-i),m=(f-u)*(i-a)-(c-a)*(o-u),h=(s-o)*(i-a)-(l-i)*(o-u);if(p===0)return null;var b=m/p,v=h/p;if(b>=0&&b<=1&&v>=0&&v<=1){var E=o+b*(s-o),d=i+b*(l-i);return su([E,d])}return null}function ts(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function ir(r,e,n){if(n===void 0&&(n={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!di(r[0])||!di(r[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:r};return ts(t,e,n)}function mi(r,e,n){if(n===void 0&&(n={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var t={type:"LineString",coordinates:r};return ts(t,e,n)}function di(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function On(r,e,n){n===void 0&&(n={});var t=ir([1/0,1/0],{dist:1/0}),o=0;return Nt(r,function(i){for(var s=et(i),l=0;l0&&(v=b.features[0],v.properties.dist=ft(e,v,n),v.properties.location=o+ft(u,v,n)),u.properties.dist{if(this.active&&!this.dragFrom)this.recalculateHovering(e);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let n=this.dragFrom[0]-e.lngLat.lng,t=this.dragFrom[1]-e.lngLat.lat;for(let o of this.points)o[0]-=n,o[1]-=t}else this.points[this.hover]=e.lngLat.toArray();this.dragFrom=e.lngLat.toArray(),this.redraw()}});me(this,"onClick",e=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(gi(this.points).forEach((t,o)=>{n.push([o+1,On(t,this.cursor).properties.dist])}),n.sort((t,o)=>t[1]-o[1]),n.length>0){let t=n[0][0];this.points.splice(t,0,this.cursor.geometry.coordinates),this.hover=t}else this.points.push(this.cursor.geometry.coordinates),this.hover=this.points.length-1;this.redraw(),this.pointsUpdated()}else this.active&&typeof this.hover=="number"&&(this.points.splice(this.hover,1),this.hover=null,this.redraw(),this.pointsUpdated(),this.recalculateHovering(e))});me(this,"onDoubleClick",e=>{this.active&&(e.preventDefault(),this.cursor=or(e.lngLat.toArray()),this.onClick(e),this.finish())});me(this,"onMouseDown",e=>{this.active&&!this.dragFrom&&this.hover!=null&&(e.preventDefault(),this.cursor=null,this.dragFrom=e.lngLat.toArray(),this.beforeUpdate(),this.redraw())});me(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});me(this,"onKeypress",e=>{this.active&&(e.key=="Enter"?(e.stopPropagation(),this.finish()):e.key=="z"&&e.ctrlKey&&this.undo())});me(this,"onKeyDown",e=>{this.active&&e.key=="Escape"&&(e.stopPropagation(),this.cancel())});this.map=e,this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.points=[],this.cursor=null,this.hover=null,this.dragFrom=null,this.previousStates=[],this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("mousedown",this.onMouseDown),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keypress",this.onKeypress),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("mousedown",this.onMouseDown),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keypress",this.onKeypress),document.removeEventListener("keydown",this.onKeyDown)}finish(){let e=this.polygonFeature();if(e)for(let n of this.eventListenersSuccess)n(e);else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){for(let e of this.eventListenersFailure)e();this.stop()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerUpdated(e){this.eventListenersUpdated.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(e){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(e.geometry.coordinates[0])),this.points.pop(),this.redraw()}stop(){this.map.doubleClickZoom.enable(),this.points=[],this.cursor=null,this.active=!1,this.hover=null,this.dragFrom=null,this.previousStates=[],this.redraw(),this.map.getCanvas().style.cursor="inherit"}undo(){this.dragFrom!=null||this.previousStates.length==0||(this.points=this.previousStates.pop(),this.hover=null,this.redraw())}redraw(){let e=ns();this.points.forEach((o,i)=>{let s=or(o);s.properties.hover=this.hover==i,s.properties.idx=i,e.features.push(s)}),e.features=e.features.concat(gi(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",e.features.push(n)),is.set(e);let t="crosshair";this.hover!=null&&(t=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=t,os.set(this.previousStates.length)}pointsUpdated(){let e=this.polygonFeature();if(e)for(let n of this.eventListenersUpdated)n(e)}recalculateHovering(e){this.cursor=null,this.hover=null;for(let n of this.map.queryRenderedFeatures(e.point,{layers:["edit-polygon-fill","edit-polygon-vertices"]}))if(n.geometry.type=="Polygon"){this.hover="polygon";break}else if(n.geometry.type=="Point"&&Object.hasOwn(n.properties,"idx")){this.hover=n.properties.idx;break}this.hover==null&&(this.cursor=or(e.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let e=this.points.map(rs),n=[JSON.parse(JSON.stringify(e))];return n[0].push(JSON.parse(JSON.stringify(n[0][0]))),{type:"Feature",geometry:{type:"Polygon",coordinates:n},properties:{}}}beforeUpdate(){this.previousStates.push(JSON.parse(JSON.stringify(this.points))),this.previousStates.length>Pu&&this.previousStates.shift()}}function gi(r){let e=[];for(let n=0;n=3&&e.push({type:"Feature",geometry:{type:"LineString",coordinates:[r[r.length-1],r[0]]},properties:{}}),e}class sr{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){const n=this._partials;let t=0;for(let o=0;o0){for(s=e[--n];n>0&&(t=s,o=e[--n],s=t+o,i=o-(s-t),!i););n>0&&(i<0&&e[n-1]<0||i>0&&e[n-1]>0)&&(o=i*2,t=s+o,o==t-s&&(s=t))}return s}}var Cu=1e-6,hi=1e-12,Ur=Math.PI,_i=Ur/2,bi=180/Ur,nt=Ur/180,ss=Math.atan2,rt=Math.cos,_r=Math.hypot,it=Math.sin,Nu=Math.sqrt;function ls(r){return r>1?_i:r<-1?-_i:Math.asin(r)}function Fu(){}function jn(r,e){r&&$i.hasOwnProperty(r.type)&&$i[r.type](r,e)}var vi={Feature:function(r,e){jn(r.geometry,e)},FeatureCollection:function(r,e){for(var n=r.features,t=-1,o=n.length;++t{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&cs.decode();let Xt=null;function Qt(){return(Xt===null||Xt.byteLength===0)&&(Xt=new Uint8Array(W.memory.buffer)),Xt}function Qe(r,e){return r=r>>>0,cs.decode(Qt().subarray(r,r+e))}const ut=new Array(128).fill(void 0);ut.push(void 0,null,!0,!1);let xt=ut.length;function ve(r){xt===ut.length&&ut.push(ut.length+1);const e=xt;return xt=ut[e],ut[e]=r,e}function re(r){return ut[r]}function Gu(r){r<132||(ut[r]=xt,xt=r)}function $n(r){const e=re(r);return Gu(r),e}function lr(r){return r==null}let Wt=null;function Tu(){return(Wt===null||Wt.byteLength===0)&&(Wt=new Float64Array(W.memory.buffer)),Wt}let Ht=null;function pe(){return(Ht===null||Ht.byteLength===0)&&(Ht=new Int32Array(W.memory.buffer)),Ht}let mt=0;const yn=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},Du=typeof yn.encodeInto=="function"?function(r,e){return yn.encodeInto(r,e)}:function(r,e){const n=yn.encode(r);return e.set(n),{read:r.length,written:n.length}};function gn(r,e,n){if(n===void 0){const l=yn.encode(r),u=e(l.length,1)>>>0;return Qt().subarray(u,u+l.length).set(l),mt=l.length,u}let t=r.length,o=e(t,1)>>>0;const i=Qt();let s=0;for(;s127)break;i[o+s]=l}if(s!==t){s!==0&&(r=r.slice(s)),o=n(o,t,t=s+r.length*3,1)>>>0;const l=Qt().subarray(o+s,o+t),u=Du(r,l);s+=u.written}return mt=s,o}function wr(r){const e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){const o=r.description;return o==null?"Symbol":`Symbol(${o})`}if(e=="function"){const o=r.name;return typeof o=="string"&&o.length>0?`Function(${o})`:"Function"}if(Array.isArray(r)){const o=r.length;let i="[";o>0&&(i+=wr(r[0]));for(let s=1;s1)t=n[1];else return toString.call(r);if(t=="Object")try{return"Object("+JSON.stringify(r)+")"}catch{return"Object"}return r instanceof Error?`${r.name}: ${r.message} -${r.stack}`:t}function Uu(r,e){const n=e(r.length*1,1)>>>0;return Qt().set(r,n/1),mt=r.length,n}function ur(r,e){try{return r.apply(this,e)}catch(n){W.__wbindgen_exn_store(ve(n))}}class zn{static __wrap(e){e=e>>>0;const n=Object.create(zn.prototype);return n.__wbg_ptr=e,n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,e}free(){const e=this.__destroy_into_raw();W.__wbg_jsroutesnapper_free(e)}constructor(e){try{const i=W.__wbindgen_add_to_stack_pointer(-16),s=Uu(e,W.__wbindgen_malloc),l=mt;W.jsroutesnapper_new(i,s,l);var n=pe()[i/4+0],t=pe()[i/4+1],o=pe()[i/4+2];if(o)throw $n(t);return zn.__wrap(n)}finally{W.__wbindgen_add_to_stack_pointer(16)}}setRouteConfig(e){W.jsroutesnapper_setRouteConfig(this.__wbg_ptr,ve(e))}setAreaMode(){W.jsroutesnapper_setAreaMode(this.__wbg_ptr)}getConfig(){let e,n;try{const i=W.__wbindgen_add_to_stack_pointer(-16);W.jsroutesnapper_getConfig(i,this.__wbg_ptr);var t=pe()[i/4+0],o=pe()[i/4+1];return e=t,n=o,Qe(t,o)}finally{W.__wbindgen_add_to_stack_pointer(16),W.__wbindgen_free(e,n,1)}}toFinalFeature(){try{const t=W.__wbindgen_add_to_stack_pointer(-16);W.jsroutesnapper_toFinalFeature(t,this.__wbg_ptr);var e=pe()[t/4+0],n=pe()[t/4+1];let o;return e!==0&&(o=Qe(e,n).slice(),W.__wbindgen_free(e,n*1)),o}finally{W.__wbindgen_add_to_stack_pointer(16)}}renderGeojson(){let e,n;try{const i=W.__wbindgen_add_to_stack_pointer(-16);W.jsroutesnapper_renderGeojson(i,this.__wbg_ptr);var t=pe()[i/4+0],o=pe()[i/4+1];return e=t,n=o,Qe(t,o)}finally{W.__wbindgen_add_to_stack_pointer(16),W.__wbindgen_free(e,n,1)}}toggleSnapMode(){W.jsroutesnapper_toggleSnapMode(this.__wbg_ptr)}onMouseMove(e,n,t){return W.jsroutesnapper_onMouseMove(this.__wbg_ptr,e,n,t)!==0}onClick(){W.jsroutesnapper_onClick(this.__wbg_ptr)}onDragStart(){return W.jsroutesnapper_onDragStart(this.__wbg_ptr)!==0}onMouseUp(){return W.jsroutesnapper_onMouseUp(this.__wbg_ptr)!==0}clearState(){W.jsroutesnapper_clearState(this.__wbg_ptr)}editExisting(e){try{const o=W.__wbindgen_add_to_stack_pointer(-16);W.jsroutesnapper_editExisting(o,this.__wbg_ptr,ve(e));var n=pe()[o/4+0],t=pe()[o/4+1];if(t)throw $n(n)}finally{W.__wbindgen_add_to_stack_pointer(16)}}debugRenderGraph(){let e,n;try{const i=W.__wbindgen_add_to_stack_pointer(-16);W.jsroutesnapper_debugRenderGraph(i,this.__wbg_ptr);var t=pe()[i/4+0],o=pe()[i/4+1];return e=t,n=o,Qe(t,o)}finally{W.__wbindgen_add_to_stack_pointer(16),W.__wbindgen_free(e,n,1)}}debugSnappableNodes(){let e,n;try{const i=W.__wbindgen_add_to_stack_pointer(-16);W.jsroutesnapper_debugSnappableNodes(i,this.__wbg_ptr);var t=pe()[i/4+0],o=pe()[i/4+1];return e=t,n=o,Qe(t,o)}finally{W.__wbindgen_add_to_stack_pointer(16),W.__wbindgen_free(e,n,1)}}routeNameForWaypoints(e){let n,t;try{const f=W.__wbindgen_add_to_stack_pointer(-16);W.jsroutesnapper_routeNameForWaypoints(f,this.__wbg_ptr,ve(e));var o=pe()[f/4+0],i=pe()[f/4+1],s=pe()[f/4+2],l=pe()[f/4+3],u=o,a=i;if(l)throw u=0,a=0,$n(s);return n=u,t=a,Qe(u,a)}finally{W.__wbindgen_add_to_stack_pointer(16),W.__wbindgen_free(n,t,1)}}addSnappedWaypoint(e,n){W.jsroutesnapper_addSnappedWaypoint(this.__wbg_ptr,e,n)}undo(){W.jsroutesnapper_undo(this.__wbg_ptr)}}async function zu(r,e){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(r,e)}catch(t){if(r.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t);else throw t}const n=await r.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(r,e);return n instanceof WebAssembly.Instance?{instance:n,module:r}:n}}function Ju(){const r={};return r.wbg={},r.wbg.__wbindgen_string_new=function(e,n){const t=Qe(e,n);return ve(t)},r.wbg.__wbindgen_object_drop_ref=function(e){$n(e)},r.wbg.__wbindgen_error_new=function(e,n){const t=new Error(Qe(e,n));return ve(t)},r.wbg.__wbindgen_is_object=function(e){const n=re(e);return typeof n=="object"&&n!==null},r.wbg.__wbindgen_is_undefined=function(e){return re(e)===void 0},r.wbg.__wbindgen_in=function(e,n){return re(e)in re(n)},r.wbg.__wbindgen_number_get=function(e,n){const t=re(n),o=typeof t=="number"?t:void 0;Tu()[e/8+1]=lr(o)?0:o,pe()[e/4+0]=!lr(o)},r.wbg.__wbindgen_boolean_get=function(e){const n=re(e);return typeof n=="boolean"?n?1:0:2},r.wbg.__wbindgen_jsval_loose_eq=function(e,n){return re(e)==re(n)},r.wbg.__wbindgen_string_get=function(e,n){const t=re(n),o=typeof t=="string"?t:void 0;var i=lr(o)?0:gn(o,W.__wbindgen_malloc,W.__wbindgen_realloc),s=mt;pe()[e/4+1]=s,pe()[e/4+0]=i},r.wbg.__wbg_getwithrefkey_d1f0d12f1f1b63ea=function(e,n){const t=re(e)[re(n)];return ve(t)},r.wbg.__wbindgen_object_clone_ref=function(e){const n=re(e);return ve(n)},r.wbg.__wbg_String_4370c5505c674d30=function(e,n){const t=String(re(n)),o=gn(t,W.__wbindgen_malloc,W.__wbindgen_realloc),i=mt;pe()[e/4+1]=i,pe()[e/4+0]=o},r.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return ve(e)},r.wbg.__wbg_stack_658279fe44541cf6=function(e,n){const t=re(n).stack,o=gn(t,W.__wbindgen_malloc,W.__wbindgen_realloc),i=mt;pe()[e/4+1]=i,pe()[e/4+0]=o},r.wbg.__wbg_error_f851667af71bcfc6=function(e,n){let t,o;try{t=e,o=n,console.error(Qe(e,n))}finally{W.__wbindgen_free(t,o,1)}},r.wbg.__wbg_debug_9a6b3243fbbebb61=function(e){console.debug(re(e))},r.wbg.__wbg_error_788ae33f81d3b84b=function(e){console.error(re(e))},r.wbg.__wbg_info_2e30e8204b29d91d=function(e){console.info(re(e))},r.wbg.__wbg_log_1d3ae0273d8f4f8a=function(e){console.log(re(e))},r.wbg.__wbg_warn_d60e832f9882c1b2=function(e){console.warn(re(e))},r.wbg.__wbg_get_44be0491f933a435=function(e,n){const t=re(e)[n>>>0];return ve(t)},r.wbg.__wbg_length_fff51ee6522a1a18=function(e){return re(e).length},r.wbg.__wbindgen_is_function=function(e){return typeof re(e)=="function"},r.wbg.__wbg_next_526fc47e980da008=function(e){const n=re(e).next;return ve(n)},r.wbg.__wbg_next_ddb3312ca1c4e32a=function(){return ur(function(e){const n=re(e).next();return ve(n)},arguments)},r.wbg.__wbg_done_5c1f01fb660d73b5=function(e){return re(e).done},r.wbg.__wbg_value_1695675138684bd5=function(e){const n=re(e).value;return ve(n)},r.wbg.__wbg_iterator_97f0c81209c6c35a=function(){return ve(Symbol.iterator)},r.wbg.__wbg_get_97b561fb56f034b5=function(){return ur(function(e,n){const t=Reflect.get(re(e),re(n));return ve(t)},arguments)},r.wbg.__wbg_call_cb65541d95d71282=function(){return ur(function(e,n){const t=re(e).call(re(n));return ve(t)},arguments)},r.wbg.__wbg_isArray_4c24b343cb13cfb1=function(e){return Array.isArray(re(e))},r.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb=function(e){let n;try{n=re(e)instanceof ArrayBuffer}catch{n=!1}return n},r.wbg.__wbg_buffer_085ec1f694018c4f=function(e){const n=re(e).buffer;return ve(n)},r.wbg.__wbg_new_8125e318e6245eed=function(e){const n=new Uint8Array(re(e));return ve(n)},r.wbg.__wbg_set_5cf90238115182c3=function(e,n,t){re(e).set(re(n),t>>>0)},r.wbg.__wbg_length_72e2208bbc0efc61=function(e){return re(e).length},r.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4=function(e){let n;try{n=re(e)instanceof Uint8Array}catch{n=!1}return n},r.wbg.__wbindgen_debug_string=function(e,n){const t=wr(re(n)),o=gn(t,W.__wbindgen_malloc,W.__wbindgen_realloc),i=mt;pe()[e/4+1]=i,pe()[e/4+0]=o},r.wbg.__wbindgen_throw=function(e,n){throw new Error(Qe(e,n))},r.wbg.__wbindgen_memory=function(){const e=W.memory;return ve(e)},r}function Yu(r,e){return W=r.exports,ps.__wbindgen_wasm_module=e,Wt=null,Ht=null,Xt=null,W}async function ps(r){if(W!==void 0)return W;typeof r>"u"&&(r=new URL("/atip/ss_huge_refactor_pt1/assets/route_snapper_bg-a52abfbb.wasm",self.location));const e=Ju();(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));const{instance:n,module:t}=await zu(await r,e);return Yu(n,t)}function Xu(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function Wu(r,e,n){if(n===void 0&&(n={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Si(r[0])||!Si(r[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:r};return Xu(t,e,n)}function Si(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function kr(r,e){return e===void 0&&(e={}),Wo(r,function(n,t){var o=t.geometry.coordinates;return n+ft(o[0],o[1],e)},0)}function Hu(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function Zu(r,e,n){if(n===void 0&&(n={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var t={type:"LineString",coordinates:r};return Hu(t,e,n)}function Ku(r,e,n){var t=et(n);if(dr(n)!=="LineString")throw new Error("line must be a LineString");var o=On(n,r),i=On(n,e),s;o.properties.index<=i.properties.index?s=[o,i]:s=[i,o];for(var l=[s[0].geometry.coordinates],u=s[0].properties.index+1;u=s){var l=(n+o)/2;return[e,l-(t-e)/2,t,l+(t-e)/2]}else{var u=(e+t)/2;return[u-(o-n)/2,n,u+(o-n)/2,o]}}function Sr(r){var e=[1/0,1/0,-1/0,-1/0];return Ct(r,function(n){e[0]>n[0]&&(e[0]=n[0]),e[1]>n[1]&&(e[1]=n[1]),e[2] is required");if(typeof n!="number")throw new Error(" must be a number");if(typeof t!="number")throw new Error(" must be a number");(o===!1||o===void 0)&&(r=JSON.parse(JSON.stringify(r)));var i=Math.pow(10,n);return Ct(r,function(s){xu(s,i,t)}),r}function xu(r,e,n){r.length>n&&r.splice(n,r.length);for(var t=0;t1&&n.push(Ei(f)),en(n)}function ms(r,e){if(!e.features.length)throw new Error("lines must contain features");if(e.features.length===1)return e.features[0];var n,t=1/0;return Dt(e,function(o){var i=On(o,r),s=i.properties.dist;s{if(!this.active)return;const l=[s.point.x-ia,s.point.y],u=this.map.unproject(s.point).distanceTo(this.map.unproject(l));this.inner.onMouseMove(s.lngLat.lng,s.lngLat.lat,u)&&(this.redraw(),this.dataUpdated())},this.onClick=()=>{this.active&&(this.inner.onClick(),this.redraw(),this.dataUpdated())},this.onDoubleClick=s=>{this.active&&(s.preventDefault(),this.inner.onClick(),this.finish())},this.onDragStart=()=>{this.active&&this.inner.onDragStart()&&this.map.dragPan.disable()},this.onMouseUp=()=>{this.active&&this.inner.onMouseUp()&&this.map.dragPan.enable()},this.onKeyDown=s=>{this.active&&s.key=="Escape"&&(s.stopPropagation(),this.cancel())},this.onKeyPress=s=>{this.active&&s.target.tagName!="INPUT"&&(s.key=="Enter"?(s.stopPropagation(),this.finish()):s.key=="s"||s.key=="S"?(s.stopPropagation(),this.inner.toggleSnapMode(),this.redraw()):s.key=="z"&&s.ctrlKey&&this.undo())},this.map=e,console.time("Deserialize and setup JsRouteSnapper"),this.inner=new zn(n),console.timeEnd("Deserialize and setup JsRouteSnapper"),this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.routeToolGj=t,this.snapMode=o,this.undoLength=i,this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("dragstart",this.onDragStart),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keypress",this.onKeyPress)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("dragstart",this.onDragStart),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keypress",this.onKeyPress)}startRoute(){this.active||(this.active=!0,this.map.boxZoom.disable(),this.map.doubleClickZoom.disable())}startArea(){this.active||(this.inner.setAreaMode(),this.active=!0,this.map.boxZoom.disable(),this.map.doubleClickZoom.disable())}stop(){this.active=!1,this.inner.clearState(),this.redraw(),this.map.boxZoom.enable(),this.map.doubleClickZoom.enable()}editExistingRoute(e){this.active&&window.alert("Bug: editExistingRoute called when tool is already active"),e.properties.waypoints||(e.properties.waypoints=[{lon:e.geometry.coordinates[0][0],lat:e.geometry.coordinates[0][1],snapped:!0},{lon:e.geometry.coordinates[e.geometry.coordinates.length-1][0],lat:e.geometry.coordinates[e.geometry.coordinates.length-1][1],snapped:!0}]),this.startRoute(),this.inner.editExisting(e.properties.waypoints),this.redraw()}editExistingArea(e){this.active&&window.alert("Bug: editExistingArea called when tool is already active"),e.properties.waypoints||window.alert("Bug: editExistingArea called for a polygon not produced by the route-snapper"),this.startArea(),this.inner.editExisting(e.properties.waypoints),this.redraw()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerUpdated(e){this.eventListenersUpdated.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}isActive(){return this.active}finish(){let e=this.inner.toFinalFeature();if(e)for(let n of this.eventListenersSuccess)n(JSON.parse(e));else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){this.inner.clearState(),this.finish()}setRouteConfig(e){this.inner.setRouteConfig(e),this.redraw()}addSnappedWaypoint(e){this.inner.addSnappedWaypoint(e[0],e[1]),this.redraw()}undo(){this.inner.undo(),this.redraw()}toggleSnapMode(){this.inner.toggleSnapMode(),this.redraw()}redraw(){let e=JSON.parse(this.inner.renderGeojson());this.routeToolGj.set(e),this.map.getCanvas().style.cursor=e.cursor,this.snapMode.set(e.snap_mode),this.undoLength.set(e.undo_length)}dataUpdated(){let e=this.inner.toFinalFeature();if(e)for(let n of this.eventListenersUpdated)n(JSON.parse(e))}}const sa="/atip/ss_huge_refactor_pt1/assets/warning-81bba3f6.svg";function la(r){let e,n;return{c(){e=G("img"),Je(e.src,n=sa)||T(e,"src",n),T(e,"title",r[0]),T(e,"alt",r[0])},m(t,o){$(t,e,o)},p(t,[o]){o&1&&T(e,"title",t[0]),o&1&&T(e,"alt",t[0])},i:ee,o:ee,d(t){t&&y(e)}}}function ua(r,e,n){let{text:t}=e;return r.$$set=o=>{"text"in o&&n(0,t=o.text)},[t]}class ds extends te{constructor(e){super(),ne(this,e,ua,la,x,{text:0})}}async function aa(r,e){let n=await fetch(r),t=n.body.getReader(),o=n.headers.get("Content-Length");if(!o)throw new Error(`No Content-Length header from ${r}`);let i=parseInt(o),s=0,l=[];for(;;){let{done:f,value:c}=await t.read();if(f)break;c&&(l.push(c),s+=c.length,e(100*s/i))}let u=new Uint8Array(s),a=0;for(let f of l)u.set(f,a),a+=f.length;return u}function Ci(r){let e=r[0],n,t,o=Ni(r);return{c(){o.c(),n=fe()},m(i,s){o.m(i,s),$(i,n,s),t=!0},p(i,s){s&1&&x(e,e=i[0])?(se(),k(o,1,1,ee),le(),o=Ni(i),o.c(),w(o,1),o.m(n.parentNode,n)):o.p(i,s)},i(i){t||(w(o),t=!0)},o(i){k(o),t=!1},d(i){i&&y(n),o.d(i)}}}function Ni(r){let e;const n=r[10].default,t=Wn(n,r,r[9],null);return{c(){t&&t.c()},m(o,i){t&&t.m(o,i),e=!0},p(o,i){t&&t.p&&(!e||i&512)&&Hn(t,n,o,o[9],e?Kn(n,o[9],i,null):Zn(o[9]),null)},i(o){e||(w(t,o),e=!0)},o(o){k(t,o),e=!1},d(o){t&&t.d(o)}}}function fa(r){let e,n,t=r[0]&&Ci(r);return{c(){t&&t.c(),e=fe()},m(o,i){t&&t.m(o,i),$(o,e,i),n=!0},p(o,[i]){o[0]?t?(t.p(o,i),i&1&&w(t,1)):(t=Ci(o),t.c(),w(t,1),t.m(e.parentNode,e)):t&&(se(),k(t,1,1,()=>{t=null}),le())},i(o){n||(w(t),n=!0)},o(o){k(t),n=!1},d(o){o&&y(e),t&&t.d(o)}}}function ca(r,e,n){let t,o,{$$slots:i={},$$scope:s}=e,{id:l=Io("image")}=e,{url:u}=e,{coordinates:a}=e;const{map:f,self:c}=Vs();Y(r,f,h=>n(8,o=h)),Y(r,c,h=>n(0,t=h));let p,m=!0;return Ye(()=>{t&&o&&(Qs(f,t,p),Be(c,t=null,t),n(6,p=void 0))}),r.$$set=h=>{"id"in h&&n(3,l=h.id),"url"in h&&n(4,u=h.url),"coordinates"in h&&n(5,a=h.coordinates),"$$scope"in h&&n(9,s=h.$$scope)},r.$$.update=()=>{r.$$.dirty&313&&o&&t!==l&&(Be(c,t=l,t),xs(o,t,el({type:"image",url:u,coordinates:a}),h=>o&&h===t,()=>{t&&(n(6,p=o==null?void 0:o.getSource(t)),n(7,m=!0))})),r.$$.dirty&264&&(o==null||o.on("style.load",()=>{n(6,p=o==null?void 0:o.getSource(l))})),r.$$.dirty&224&&p&&(m?n(7,m=!1):p.setCoordinates(a))},[t,f,c,l,u,a,p,m,o,s,i]}class pa extends te{constructor(e){super(),ne(this,e,ca,fa,x,{id:3,url:4,coordinates:5})}}const{Map:ma}=ol;function Fi(r,e,n){const t=r.slice();t[40]=e[n];const o=t[1](t[40]);t[41]=o;const i=typeof t[7]=="function"?t[7](t[40]):t[7];return t[42]=i,t}const da=r=>({feature:r[0]&1024,position:r[0]&1026}),Ai=r=>({feature:r[40],position:r[41]});function Ri(r){let e=[],n=new ma,t,o,i=je(r[10]);const s=l=>l[40].id;for(let l=0;l=r[13]&&r[11]<=r[12]&&Ri(r);return{c(){P(e.$$.fragment),n=F(),i&&i.c(),t=fe()},m(s,l){L(e,s,l),$(s,n,l),i&&i.m(s,l),$(s,t,l),o=!0},p(s,l){const u={};l[0]&32&&(u.minzoom=s[5]),l[0]&64&&(u.maxzoom=s[6]),e.$set(u),s[11]>=s[13]&&s[11]<=s[12]?i?(i.p(s,l),l[0]&14336&&w(i,1)):(i=Ri(s),i.c(),w(i,1),i.m(t.parentNode,t)):i&&(se(),k(i,1,1,()=>{i=null}),le())},i(s){o||(w(e.$$.fragment,s),w(i),o=!0)},o(s){k(e.$$.fragment,s),k(i),o=!1},d(s){s&&(y(n),y(t)),C(e,s),i&&i.d(s)}}}function _a(r,e,n){let t,o,i,s,l,u,a,{$$slots:f={},$$scope:c}=e;const{map:p,source:m,minzoom:h,maxzoom:b}=tl();Y(r,p,X=>n(21,s=X)),Y(r,m,X=>n(9,l=X)),Y(r,h,X=>n(23,a=X)),Y(r,b,X=>n(22,u=X));const v=nl();let{applyToClusters:E=void 0}=e,{filter:d=void 0}=e,{markerLngLat:g=qu}=e,{interactive:S=!0}=e,{asButton:_=!1}=e,{draggable:M=!1}=e,{minzoom:O=void 0}=e,{maxzoom:B=void 0}=e,{hovered:D=null}=e,{zIndex:I=void 0}=e,{class:A=void 0}=e,R=!1;function N(){s&&(R=!0,s.on("zoom",U),s.on("move",ie),s.on("moveend",ie),s.loaded()?s.once("load",ie):ie())}function j(X){X.sourceId===l&&X.isSourceLoaded&&(R?ie():N())}Ye(()=>{s&&(s.off("zoom",U),s.off("move",ie),s.off("moveend",ie),s.off("sourcedata",j))});let H=[];function ie(){var Ft;if(!s||!l)return;let X=s.querySourceFeatures(l,{filter:i}),ye=new Map;for(let Me of X)Me.id||((Ft=Me.properties)!=null&&Ft.cluster_id?Me.id="autocluster_"+Me.properties.cluster_id:Me.id=Io("autofeat")),ye.set(Me.id,Me);n(10,H=[...ye.values()].sort((Me,Js)=>Me.id.toString().localeCompare(Js.id.toString())))}let ce=(s==null?void 0:s.getZoom())??0;function U(X){n(11,ce=s.getZoom()),ie()}const de=X=>{n(0,D=X)},_e=X=>{(D==null?void 0:D.id)===X.id&&n(0,D=null)},Ee=(X,ye)=>v("dragstart",{...ye.detail,source:l,feature:X}),$e=(X,ye)=>v("drag",{...ye.detail,source:l,feature:X}),pn=(X,ye)=>v("dragend",{...ye.detail,source:l,feature:X}),J=(X,ye)=>v("click",{...ye.detail,source:l,feature:X}),Z=(X,ye)=>v("dblclick",{...ye.detail,source:l,feature:X}),Ie=(X,ye)=>v("contextmenu",{...ye.detail,source:l,feature:X});return r.$$set=X=>{"applyToClusters"in X&&n(19,E=X.applyToClusters),"filter"in X&&n(20,d=X.filter),"markerLngLat"in X&&n(1,g=X.markerLngLat),"interactive"in X&&n(2,S=X.interactive),"asButton"in X&&n(3,_=X.asButton),"draggable"in X&&n(4,M=X.draggable),"minzoom"in X&&n(5,O=X.minzoom),"maxzoom"in X&&n(6,B=X.maxzoom),"hovered"in X&&n(0,D=X.hovered),"zIndex"in X&&n(7,I=X.zIndex),"class"in X&&n(8,A=X.class),"$$scope"in X&&n(33,c=X.$$scope)},r.$$.update=()=>{if(r.$$.dirty[0]&8388640&&n(13,t=O??a),r.$$.dirty[0]&4194368&&n(12,o=B??u),r.$$.dirty[0]&1572864&&(i=rl("all",il(E),d)),r.$$.dirty[0]&2097664&&s&&l){let X=s.getSource(l);X!=null&&X.loaded()?N():s.on("sourcedata",j)}},[D,g,S,_,M,O,B,I,A,l,H,ce,o,t,p,m,h,b,v,E,d,s,u,a,f,de,_e,Ee,$e,pn,J,Z,Ie,c]}class ba extends te{constructor(e){super(),ne(this,e,_a,ha,x,{applyToClusters:19,filter:20,markerLngLat:1,interactive:2,asButton:3,draggable:4,minzoom:5,maxzoom:6,hovered:0,zIndex:7,class:8},null,[-1,-1])}}/** +var Xs=Object.defineProperty;var Ws=(r,e,n)=>e in r?Xs(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n;var me=(r,e,n)=>(Ws(r,typeof e!="symbol"?e+"":e,n),n);import{S as te,i as ne,s as x,F as Mt,h as P,m as L,t as w,o as k,q as C,K as Pt,E as Je,a as ae,f as F,e as G,j as T,k as $,w as Le,x as he,p as y,v as q,l as z,J as ge,N as Rr,O as Wn,P as be,Q as Kr,T as Hn,U as Zn,V as Kn,W as we,X as Vr,Y as Hs,Z as jo,_ as Zs,$ as Io,a0 as Ks,a1 as Vs,a2 as at,a3 as Ye,a4 as ee,a5 as fe,a6 as se,a7 as le,a8 as Bo,a9 as Qs,r as Y,aa as Xe,ab as xs,ac as Be,ad as el,ae as tl,C as ln,af as nl,ag as rl,ah as il,ai as ol,aj as je,ak as Or,al as jr,am as sl,an as ll,ao as ul,G as Et,ap as al,aq as ke,ar as It,b as K,c as V,n as Q,as as Vn,at as We,au as Pn,av as Pe,aw as nn,u as ot,ax as oe,ay as Zt,az as Kt,aA as wt,H as Bt,aB as Ln,aC as He,aD as Vt,aE as Ir,aF as Qr,aG as De,aH as cr,aI as fl,aJ as cl,aK as Te,aL as Cn,aM as xr,aN as pt,aO as qo,aP as un,R as qt,aQ as Lt,I as tt,aR as St,aS as pr,aT as pl,aU as ml,B as dl,d as Go,aV as Br,aW as Nn,aX as ei,aY as gl,aZ as hl,a_ as Qn,M as _l,L as bl,g as vl,y as $l,z as yl,a$ as wl}from"./index-a43921db.js";import{M as mr,m as qe,b as To,l as ue,e as Gt,C as Do,a as ht,B as Ze,R as kl,i as kt,c as rn,d as on,f as Tt,g as Sl,h as Jt,j as El,S as Ml,k as Pl,n as xn,p as Fn,o as Ll,q as Cl,t as Nl,r as ti,s as Fl,u as Al,Z as Rl,G as Ol}from"./ZoomOutMap-cd8a62cd.js";import{D as st,A as jl}from"./About-a465dc1b.js";function ni(r){let e,n,t=An(r[0])+"",o;return{c(){e=G("div"),n=q("ÂŁ"),o=q(t),T(e,"class","govuk-hint")},m(i,s){$(i,e,s),z(e,n),z(e,o)},p(i,s){s&1&&t!==(t=An(i[0])+"")&&ge(o,t)},d(i){i&&y(e)}}}function Il(r){let e;return{c(){e=q("multiply by 1 million")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Bl(r){let e,n,t,o,i,s,l,u,a;e=new Je({props:{errorMessage:ri(r[2])}});let f=r[0]!=null&&ni(r);return s=new ae({props:{disabled:r[0]==null||r[0]>1e3,$$slots:{default:[Il]},$$scope:{ctx:r}}}),s.$on("click",r[4]),{c(){P(e.$$.fragment),n=F(),f&&f.c(),t=F(),o=G("input"),i=F(),P(s.$$.fragment),T(o,"type","text"),T(o,"inputmode","numeric"),T(o,"class","govuk-input govuk-input--width-10"),T(o,"id",r[3])},m(c,p){L(e,c,p),$(c,n,p),f&&f.m(c,p),$(c,t,p),$(c,o,p),Le(o,r[2]),$(c,i,p),L(s,c,p),l=!0,u||(a=he(o,"input",r[5]),u=!0)},p(c,p){const m={};p&4&&(m.errorMessage=ri(c[2])),e.$set(m),c[0]!=null?f?f.p(c,p):(f=ni(c),f.c(),f.m(t.parentNode,t)):f&&(f.d(1),f=null),p&4&&o.value!==c[2]&&Le(o,c[2]);const g={};p&1&&(g.disabled=c[0]==null||c[0]>1e3),p&128&&(g.$$scope={dirty:p,ctx:c}),s.$set(g)},i(c){l||(w(e.$$.fragment,c),w(s.$$.fragment,c),l=!0)},o(c){k(e.$$.fragment,c),k(s.$$.fragment,c),l=!1},d(c){c&&(y(n),y(t),y(o),y(i)),C(e,c),f&&f.d(c),C(s,c),u=!1,a()}}}function ql(r){let e,n;return e=new Mt({props:{label:r[1],id:r[3],$$slots:{default:[Bl]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,[o]){const i={};o&2&&(i.label=t[1]),o&133&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Uo(r){if(r!="")return parseFloat(r.replaceAll(",",""))}function ri(r){let e=Uo(r);return e==null?"":isNaN(e)?"Please enter a valid number":e<0?"Please enter a positive number":""}function An(r){return r.toLocaleString()}function Gl(r,e,n){let{label:t}=e,{value:o}=e,i=Pt(),s=o==null?"":An(o);function l(f){n(0,o=Uo(f))}function u(){n(2,s=An(o*1e6))}function a(){s=this.value,n(2,s)}return r.$$set=f=>{"label"in f&&n(1,t=f.label),"value"in f&&n(0,o=f.value)},r.$$.update=()=>{r.$$.dirty&4&&l(s)},[o,t,s,i,u,a]}class Tl extends te{constructor(e){super(),ne(this,e,Gl,ql,x,{label:1,value:0})}}function Dl(r){let e,n,t,o,i,s,l;return e=new Je({props:{errorMessage:r[5](r[2])}}),{c(){P(e.$$.fragment),n=F(),t=G("input"),T(t,"type","text"),T(t,"inputmode","numeric"),T(t,"class",o=`govuk-input govuk-input--width-${r[1]}`),T(t,"id",r[3])},m(u,a){L(e,u,a),$(u,n,a),$(u,t,a),Le(t,r[2]),i=!0,s||(l=[he(t,"input",r[9]),he(t,"change",r[4])],s=!0)},p(u,a){const f={};a&4&&(f.errorMessage=u[5](u[2])),e.$set(f),(!i||a&2&&o!==(o=`govuk-input govuk-input--width-${u[1]}`))&&T(t,"class",o),a&4&&t.value!==u[2]&&Le(t,u[2])},i(u){i||(w(e.$$.fragment,u),i=!0)},o(u){k(e.$$.fragment,u),i=!1},d(u){u&&(y(n),y(t)),C(e,u),s=!1,Rr(l)}}}function Ul(r){let e,n;return e=new Mt({props:{label:r[0],id:r[3],$$slots:{default:[Dl]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,[o]){const i={};o&1&&(i.label=t[0]),o&1030&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function zl(r,e,n){let{label:t}=e,{value:o}=e,{width:i}=e,{min:s=void 0}=e,{max:l=void 0}=e,u=o==null?void 0:o.toString(),a=Pt();function f(){n(6,o=u==null?void 0:parseInt(u,10))}function c(m){if(m==""||m==null)return"";if(m.includes("."))return"Please enter a number without decimals";let g=Number(m);return isNaN(g)?"Please enter a valid number":s!=null&&gl?`Please enter a number that's at most ${l};`:""}function p(){u=this.value,n(2,u)}return r.$$set=m=>{"label"in m&&n(0,t=m.label),"value"in m&&n(6,o=m.value),"width"in m&&n(1,i=m.width),"min"in m&&n(7,s=m.min),"max"in m&&n(8,l=m.max)},[t,i,u,a,f,c,o,s,l,p]}class nr extends te{constructor(e){super(),ne(this,e,zl,Ul,x,{label:0,value:6,width:1,min:7,max:8})}}function ii(r){let e,n;return{c(){e=G("div"),n=q(r[2]),T(e,"class","govuk-hint")},m(t,o){$(t,e,o),z(e,n)},p(t,o){o&4&&ge(n,t[2])},d(t){t&&y(e)}}}function Jl(r){let e,n,t,o,i,s,l;e=new Je({props:{errorMessage:r[4]}});let u=r[2]&&ii(r);return{c(){P(e.$$.fragment),n=F(),u&&u.c(),t=F(),o=G("textarea"),T(o,"class","govuk-textarea"),T(o,"id",r[5]),T(o,"rows",r[3])},m(a,f){L(e,a,f),$(a,n,f),u&&u.m(a,f),$(a,t,f),$(a,o,f),Le(o,r[0]),i=!0,s||(l=he(o,"input",r[6]),s=!0)},p(a,f){const c={};f&16&&(c.errorMessage=a[4]),e.$set(c),a[2]?u?u.p(a,f):(u=ii(a),u.c(),u.m(t.parentNode,t)):u&&(u.d(1),u=null),(!i||f&8)&&T(o,"rows",a[3]),f&1&&Le(o,a[0])},i(a){i||(w(e.$$.fragment,a),i=!0)},o(a){k(e.$$.fragment,a),i=!1},d(a){a&&(y(n),y(t),y(o)),C(e,a),u&&u.d(a),s=!1,l()}}}function Yl(r){let e,n;return e=new Mt({props:{label:r[1],id:r[5],$$slots:{default:[Jl]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,[o]){const i={};o&2&&(i.label=t[1]),o&157&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Xl(r,e,n){let{label:t}=e,{hint:o=""}=e,{value:i}=e,{rows:s=5}=e,{errorMessage:l=""}=e,u=Pt();function a(){i=this.value,n(0,i)}return r.$$set=f=>{"label"in f&&n(1,t=f.label),"hint"in f&&n(2,o=f.hint),"value"in f&&n(0,i=f.value),"rows"in f&&n(3,s=f.rows),"errorMessage"in f&&n(4,l=f.errorMessage)},[i,t,o,s,l,u,a]}class qr extends te{constructor(e){super(),ne(this,e,Xl,Yl,x,{label:1,hint:2,value:0,rows:3,errorMessage:4})}}function Wl(r){let e,n,t,o,i,s;return e=new Je({props:{errorMessage:r[2]}}),{c(){P(e.$$.fragment),n=F(),t=G("input"),T(t,"type","text"),T(t,"class","govuk-input"),T(t,"id",r[3])},m(l,u){L(e,l,u),$(l,n,u),$(l,t,u),Le(t,r[0]),o=!0,i||(s=he(t,"input",r[5]),i=!0)},p(l,u){const a={};u&4&&(a.errorMessage=l[2]),e.$set(a),u&1&&t.value!==l[0]&&Le(t,l[0])},i(l){o||(w(e.$$.fragment,l),o=!0)},o(l){k(e.$$.fragment,l),o=!1},d(l){l&&(y(n),y(t)),C(e,l),i=!1,s()}}}function Hl(r){let e,n;return e=new Mt({props:{label:r[1],id:r[3],$$slots:{default:[Wl]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,[o]){const i={};o&2&&(i.label=t[1]),o&69&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Zl(r,e,n){let t,{label:o}=e,{value:i}=e,{required:s=!1}=e,l=Pt();function u(){i=this.value,n(0,i)}return r.$$set=a=>{"label"in a&&n(1,o=a.label),"value"in a&&n(0,i=a.value),"required"in a&&n(4,s=a.required)},r.$$.update=()=>{r.$$.dirty&17&&n(2,t=s&&(i==null||i=="")?"Required":"")},[i,o,t,l,s,u]}class er extends te{constructor(e){super(),ne(this,e,Zl,Hl,x,{label:1,value:0,required:4})}}function Kl(r){let e,n,t,o;const i=r[2].default,s=Wn(i,r,r[1],null);let l=[{type:"button"},{class:"govuk-button govuk-button--warning"},{"data-module":"govuk-button"},r[0]],u={};for(let a=0;a{n(0,e=be(be({},e),Vr(s))),"$$scope"in s&&n(1,o=s.$$scope)},e=Vr(e),[e,o,t,i]}class bt extends te{constructor(e){super(),ne(this,e,Vl,Kl,x,{})}}class Ql{constructor(e){me(this,"map");me(this,"active");me(this,"eventListenersSuccess");me(this,"eventListenersFailure");me(this,"cursor");me(this,"onMouseMove",e=>{this.active&&(this.cursor={type:"Feature",properties:{},geometry:{type:"Point",coordinates:jo(e.lngLat.toArray())}})});me(this,"onClick",()=>{if(this.active&&this.cursor){for(let e of this.eventListenersSuccess)e(this.cursor);this.stop()}});me(this,"onKeyDown",e=>{this.active&&e.key=="Escape"&&(e.stopPropagation(),this.cancel())});this.map=e,this.active=!1,this.eventListenersSuccess=[],this.eventListenersFailure=[],this.cursor=null,this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),document.removeEventListener("keydown",this.onKeyDown)}cancel(){for(let e of this.eventListenersFailure)e();this.stop()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersFailure=[]}start(){this.map.getCanvas().style.cursor="crosshair",this.active=!0}stop(){this.map.getCanvas().style.cursor="inherit",this.cursor=null,this.active=!1}}function xl(r){var e=r%(2*Math.PI);return e*180/Math.PI}function mn(r){var e=r%360;return e*Math.PI/180}function gt(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return r.geometry.coordinates;if(r.type==="Point")return r.coordinates}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return r;throw new Error("coord must be GeoJSON Point or an Array of numbers")}function et(r){if(Array.isArray(r))return r;if(r.type==="Feature"){if(r.geometry!==null)return r.geometry.coordinates}else if(r.coordinates)return r.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}function dr(r,e){return r.type==="FeatureCollection"?"FeatureCollection":r.type==="GeometryCollection"?"GeometryCollection":r.type==="Feature"&&r.geometry!==null?r.geometry.type:r.type}function zo(r,e,n){if(n===void 0&&(n={}),n.final===!0)return eu(r,e);var t=gt(r),o=gt(e),i=mn(t[0]),s=mn(o[0]),l=mn(t[1]),u=mn(o[1]),a=Math.sin(s-i)*Math.cos(u),f=Math.cos(l)*Math.sin(u)-Math.sin(l)*Math.cos(u)*Math.cos(s-i);return xl(Math.atan2(a,f))}function eu(r,e){var n=zo(e,r);return n=(n+180)%360,n}var Re=63710088e-1,tu={centimeters:Re*100,centimetres:Re*100,degrees:Re/111325,feet:Re*3.28084,inches:Re*39.37,kilometers:Re/1e3,kilometres:Re/1e3,meters:Re,metres:Re,miles:Re/1609.344,millimeters:Re*1e3,millimetres:Re*1e3,nauticalmiles:Re/1852,radians:1,yards:Re*1.0936};function nu(r,e){e===void 0&&(e="kilometers");var n=tu[e];if(!n)throw new Error(e+" units is invalid");return r*n}function dn(r){var e=r%360;return e*Math.PI/180}function ft(r,e,n){n===void 0&&(n={});var t=gt(r),o=gt(e),i=dn(o[1]-t[1]),s=dn(o[0]-t[0]),l=dn(t[1]),u=dn(o[1]),a=Math.pow(Math.sin(i/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(l)*Math.cos(u);return nu(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)),n.units)}var Oe=63710088e-1,ru={centimeters:Oe*100,centimetres:Oe*100,degrees:Oe/111325,feet:Oe*3.28084,inches:Oe*39.37,kilometers:Oe/1e3,kilometres:Oe/1e3,meters:Oe,metres:Oe,miles:Oe/1609.344,millimeters:Oe*1e3,millimetres:Oe*1e3,nauticalmiles:Oe/1852,radians:1,yards:Oe*1.0936};function iu(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function ou(r,e,n){if(n===void 0&&(n={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!si(r[0])||!si(r[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:r};return iu(t,e,n)}function su(r,e){e===void 0&&(e="kilometers");var n=ru[e];if(!n)throw new Error(e+" units is invalid");return r/n}function oi(r){var e=r%(2*Math.PI);return e*180/Math.PI}function rr(r){var e=r%360;return e*Math.PI/180}function si(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function li(r,e,n,t){t===void 0&&(t={});var o=gt(r),i=rr(o[0]),s=rr(o[1]),l=rr(n),u=su(e,t.units),a=Math.asin(Math.sin(s)*Math.cos(u)+Math.cos(s)*Math.sin(u)*Math.cos(l)),f=i+Math.atan2(Math.sin(l)*Math.sin(u)*Math.cos(s),Math.cos(u)-Math.sin(s)*Math.sin(a)),c=oi(f),p=oi(a);return ou([c,p],t.properties)}function gr(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function lu(r,e,n){if(n===void 0&&(n={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!ai(r[0])||!ai(r[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:r};return gr(t,e,n)}function ui(r,e){e===void 0&&(e={});var n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=r,n}function ai(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function uu(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function au(r,e,n){if(n===void 0&&(n={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var t={type:"LineString",coordinates:r};return uu(t,e,n)}function fu(r,e){e===void 0&&(e={});var n={type:"FeatureCollection"};return e.id&&(n.id=e.id),e.bbox&&(n.bbox=e.bbox),n.features=r,n}function Rn(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function At(r,e,n){if(n===void 0&&(n={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!fi(r[0])||!fi(r[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:r};return Rn(t,e,n)}function jt(r,e,n){if(n===void 0&&(n={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var t={type:"LineString",coordinates:r};return Rn(t,e,n)}function fi(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function Jo(r){return!!r&&r.constructor===Object}function Ct(r,e,n){if(r!==null)for(var t,o,i,s,l,u,a,f=0,c=0,p,m=r.type,g=m==="FeatureCollection",b=m==="Feature",v=g?r.features.length:1,S=0;Su||g>a||b>f){l=c,u=t,a=g,f=b,i=0;return}var v=jt([l,c],n.properties);if(e(v,t,o,b,i)===!1)return!1;i++,l=c})===!1)return!1}}})}function Ho(r,e,n){var t=n,o=!1;return Wo(r,function(i,s,l,u,a){o===!1&&n===void 0?t=i:t=e(t,i,s,l,u,a),o=!0}),t}function Zo(r,e){if(!r)throw new Error("geojson is required");Nt(r,function(n,t,o){if(n.geometry!==null){var i=n.geometry.type,s=n.geometry.coordinates;switch(i){case"LineString":if(e(n,t,o,0,0)===!1)return!1;break;case"Polygon":for(var l=0;lo?n:o,a=t>i?t:i;return[s,l,u,a]}var Tr={exports:{}},Ko={exports:{}};(function(r,e){(function(n,t){r.exports=t()})(Zs,function(){function n(d,_,E,h,M){(function O(B,D,I,A,R){for(;A>I;){if(A-I>600){var N=A-I+1,j=D-I+1,H=Math.log(N),ie=.5*Math.exp(2*H/3),ce=.5*Math.sqrt(H*ie*(N-ie)/N)*(j-N/2<0?-1:1),U=Math.max(I,Math.floor(D-j*ie/N+ce)),de=Math.min(A,Math.floor(D+(N-j)*ie/N+ce));O(B,D,U,de,R)}var _e=B[D],Ee=I,$e=A;for(t(B,I,D),R(B[A],_e)>0&&t(B,I,A);Ee<$e;){for(t(B,Ee,$e),Ee++,$e--;R(B[Ee],_e)<0;)Ee++;for(;R(B[$e],_e)>0;)$e--}R(B[I],_e)===0?t(B,I,$e):t(B,++$e,A),$e<=D&&(I=$e+1),D<=$e&&(A=$e-1)}})(d,_,E||0,h||d.length-1,M||o)}function t(d,_,E){var h=d[_];d[_]=d[E],d[E]=h}function o(d,_){return d<_?-1:d>_?1:0}var i=function(d){d===void 0&&(d=9),this._maxEntries=Math.max(4,d),this._minEntries=Math.max(2,Math.ceil(.4*this._maxEntries)),this.clear()};function s(d,_,E){if(!E)return _.indexOf(d);for(var h=0;h<_.length;h++)if(E(d,_[h]))return h;return-1}function l(d,_){u(d,0,d.children.length,_,d)}function u(d,_,E,h,M){M||(M=v(null)),M.minX=1/0,M.minY=1/0,M.maxX=-1/0,M.maxY=-1/0;for(var O=_;O=d.minX&&_.maxY>=d.minY}function v(d){return{children:d,height:1,leaf:!0,minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0}}function S(d,_,E,h,M){for(var O=[_,E];O.length;)if(!((E=O.pop())-(_=O.pop())<=h)){var B=_+Math.ceil((E-_)/h/2)*h;n(d,B,_,E,M),O.push(_,B,B,E)}}return i.prototype.all=function(){return this._all(this.data,[])},i.prototype.search=function(d){var _=this.data,E=[];if(!b(d,_))return E;for(var h=this.toBBox,M=[];_;){for(var O=0;O<_.children.length;O++){var B=_.children[O],D=_.leaf?h(B):B;b(d,D)&&(_.leaf?E.push(B):g(d,D)?this._all(B,E):M.push(B))}_=M.pop()}return E},i.prototype.collides=function(d){var _=this.data;if(!b(d,_))return!1;for(var E=[];_;){for(var h=0;h<_.children.length;h++){var M=_.children[h],O=_.leaf?this.toBBox(M):M;if(b(d,O)){if(_.leaf||g(d,O))return!0;E.push(M)}}_=E.pop()}return!1},i.prototype.load=function(d){if(!d||!d.length)return this;if(d.length=0&&M[_].children.length>this._maxEntries;)this._split(M,_),_--;this._adjustParentBBoxes(h,M,_)},i.prototype._split=function(d,_){var E=d[_],h=E.children.length,M=this._minEntries;this._chooseSplitAxis(E,M,h);var O=this._chooseSplitIndex(E,M,h),B=v(E.children.splice(O,E.children.length-O));B.height=E.height,B.leaf=E.leaf,l(E,this.toBBox),l(B,this.toBBox),_?d[_-1].children.push(B):this._splitRoot(E,B)},i.prototype._splitRoot=function(d,_){this.data=v([d,_]),this.data.height=d.height+1,this.data.leaf=!1,l(this.data,this.toBBox)},i.prototype._chooseSplitIndex=function(d,_,E){for(var h,M,O,B,D,I,A,R=1/0,N=1/0,j=_;j<=E-_;j++){var H=u(d,0,j,this.toBBox),ie=u(d,j,E,this.toBBox),ce=(M=H,O=ie,B=void 0,D=void 0,I=void 0,A=void 0,B=Math.max(M.minX,O.minX),D=Math.max(M.minY,O.minY),I=Math.min(M.maxX,O.maxX),A=Math.min(M.maxY,O.maxY),Math.max(0,I-B)*Math.max(0,A-D)),U=p(H)+p(ie);ce=_;R--){var N=d.children[R];a(B,d.leaf?M(N):N),D+=m(B)}return D},i.prototype._adjustParentBBoxes=function(d,_,E){for(var h=E;h>=0;h--)a(_[h],d)},i.prototype._condense=function(d){for(var _=d.length-1,E=void 0;_>=0;_--)d[_].children.length===0?_>0?(E=d[_-1].children).splice(E.indexOf(d[_]),1):this.clear():l(d[_],this.toBBox)},i})})(Ko);var ku=Ko.exports,Vo={};(function(r){Object.defineProperty(r,"__esModule",{value:!0}),r.earthRadius=63710088e-1,r.factors={centimeters:r.earthRadius*100,centimetres:r.earthRadius*100,degrees:r.earthRadius/111325,feet:r.earthRadius*3.28084,inches:r.earthRadius*39.37,kilometers:r.earthRadius/1e3,kilometres:r.earthRadius/1e3,meters:r.earthRadius,metres:r.earthRadius,miles:r.earthRadius/1609.344,millimeters:r.earthRadius*1e3,millimetres:r.earthRadius*1e3,nauticalmiles:r.earthRadius/1852,radians:1,yards:r.earthRadius*1.0936},r.unitsFactors={centimeters:100,centimetres:100,degrees:1/111325,feet:3.28084,inches:39.37,kilometers:1/1e3,kilometres:1/1e3,meters:1,metres:1,miles:1/1609.344,millimeters:1e3,millimetres:1e3,nauticalmiles:1/1852,radians:1/r.earthRadius,yards:1.0936133},r.areaFactors={acres:247105e-9,centimeters:1e4,centimetres:1e4,feet:10.763910417,hectares:1e-4,inches:1550.003100006,kilometers:1e-6,kilometres:1e-6,meters:1,metres:1,miles:386e-9,millimeters:1e6,millimetres:1e6,yards:1.195990046};function e(A,R,N){N===void 0&&(N={});var j={type:"Feature"};return(N.id===0||N.id)&&(j.id=N.id),N.bbox&&(j.bbox=N.bbox),j.properties=R||{},j.geometry=A,j}r.feature=e;function n(A,R,N){switch(A){case"Point":return t(R).geometry;case"LineString":return l(R).geometry;case"Polygon":return i(R).geometry;case"MultiPoint":return c(R).geometry;case"MultiLineString":return f(R).geometry;case"MultiPolygon":return p(R).geometry;default:throw new Error(A+" is invalid")}}r.geometry=n;function t(A,R,N){if(N===void 0&&(N={}),!A)throw new Error("coordinates is required");if(!Array.isArray(A))throw new Error("coordinates must be an Array");if(A.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!O(A[0])||!O(A[1]))throw new Error("coordinates must contain numbers");var j={type:"Point",coordinates:A};return e(j,R,N)}r.point=t;function o(A,R,N){return N===void 0&&(N={}),a(A.map(function(j){return t(j,R)}),N)}r.points=o;function i(A,R,N){N===void 0&&(N={});for(var j=0,H=A;j=0))throw new Error("precision must be a positive number");var N=Math.pow(10,R||0);return Math.round(A*N)/N}r.round=g;function b(A,R){R===void 0&&(R="kilometers");var N=r.factors[R];if(!N)throw new Error(R+" units is invalid");return A*N}r.radiansToLength=b;function v(A,R){R===void 0&&(R="kilometers");var N=r.factors[R];if(!N)throw new Error(R+" units is invalid");return A/N}r.lengthToRadians=v;function S(A,R){return _(v(A,R))}r.lengthToDegrees=S;function d(A){var R=A%360;return R<0&&(R+=360),R}r.bearingToAzimuth=d;function _(A){var R=A%(2*Math.PI);return R*180/Math.PI}r.radiansToDegrees=_;function E(A){var R=A%360;return R*Math.PI/180}r.degreesToRadians=E;function h(A,R,N){if(R===void 0&&(R="kilometers"),N===void 0&&(N="kilometers"),!(A>=0))throw new Error("length must be a positive number");return b(v(A,R),N)}r.convertLength=h;function M(A,R,N){if(R===void 0&&(R="meters"),N===void 0&&(N="kilometers"),!(A>=0))throw new Error("area must be a positive number");var j=r.areaFactors[R];if(!j)throw new Error("invalid original units");var H=r.areaFactors[N];if(!H)throw new Error("invalid final units");return A/j*H}r.convertArea=M;function O(A){return!isNaN(A)&&A!==null&&!Array.isArray(A)}r.isNumber=O;function B(A){return!!A&&A.constructor===Object}r.isObject=B;function D(A){if(!A)throw new Error("bbox is required");if(!Array.isArray(A))throw new Error("bbox must be an Array");if(A.length!==4&&A.length!==6)throw new Error("bbox must be an Array of 4 or 6 numbers");A.forEach(function(R){if(!O(R))throw new Error("bbox must only contain numbers")})}r.validateBBox=D;function I(A){if(!A)throw new Error("id is required");if(["string","number"].indexOf(typeof A)===-1)throw new Error("id must be a number or a string")}r.validateId=I})(Vo);const Su=Io(vu),Eu=Io(Ks);var Ke=ku,Qo=Vo,xo=Su,Rt=Eu.default,Mu=xo.featureEach;xo.coordEach;Qo.polygon;var ci=Qo.featureCollection;function es(r){var e=new Ke(r);return e.insert=function(n){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Rt(n),Ke.prototype.insert.call(this,n)},e.load=function(n){var t=[];return Array.isArray(n)?n.forEach(function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:Rt(o),t.push(o)}):Mu(n,function(o){if(o.type!=="Feature")throw new Error("invalid features");o.bbox=o.bbox?o.bbox:Rt(o),t.push(o)}),Ke.prototype.load.call(this,t)},e.remove=function(n,t){if(n.type!=="Feature")throw new Error("invalid feature");return n.bbox=n.bbox?n.bbox:Rt(n),Ke.prototype.remove.call(this,n,t)},e.clear=function(){return Ke.prototype.clear.call(this)},e.search=function(n){var t=Ke.prototype.search.call(this,this.toBBox(n));return ci(t)},e.collides=function(n){return Ke.prototype.collides.call(this,this.toBBox(n))},e.all=function(){var n=Ke.prototype.all.call(this);return ci(n)},e.toJSON=function(){return Ke.prototype.toJSON.call(this)},e.fromJSON=function(n){return Ke.prototype.fromJSON.call(this,n)},e.toBBox=function(n){var t;if(n.bbox)t=n.bbox;else if(Array.isArray(n)&&n.length===4)t=n;else if(Array.isArray(n)&&n.length===6)t=[n[0],n[1],n[3],n[4]];else if(n.type==="Feature")t=Rt(n);else if(n.type==="FeatureCollection")t=Rt(n);else throw new Error("invalid geojson");return{minX:t[0],minY:t[1],maxX:t[2],maxY:t[3]}},e}Tr.exports=es;Tr.exports.default=es;var Pu=Tr.exports;const Dr=Vs(Pu);function ts(r,e){var n={},t=[];if(r.type==="LineString"&&(r=gr(r)),e.type==="LineString"&&(e=gr(e)),r.type==="Feature"&&e.type==="Feature"&&r.geometry!==null&&e.geometry!==null&&r.geometry.type==="LineString"&&e.geometry.type==="LineString"&&r.geometry.coordinates.length===2&&e.geometry.coordinates.length===2){var o=pi(r,e);return o&&t.push(o),ui(t)}var i=Dr();return i.load(hr(e)),Dt(hr(r),function(s){Dt(i.search(s),function(l){var u=pi(s,l);if(u){var a=et(u).join(",");n[a]||(n[a]=!0,t.push(u))}})}),ui(t)}function pi(r,e){var n=et(r),t=et(e);if(n.length!==2)throw new Error(" line1 must only contain 2 coordinates");if(t.length!==2)throw new Error(" line2 must only contain 2 coordinates");var o=n[0][0],i=n[0][1],s=n[1][0],l=n[1][1],u=t[0][0],a=t[0][1],f=t[1][0],c=t[1][1],p=(c-a)*(s-o)-(f-u)*(l-i),m=(f-u)*(i-a)-(c-a)*(o-u),g=(s-o)*(i-a)-(l-i)*(o-u);if(p===0)return null;var b=m/p,v=g/p;if(b>=0&&b<=1&&v>=0&&v<=1){var S=o+b*(s-o),d=i+b*(l-i);return lu([S,d])}return null}function ns(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function ir(r,e,n){if(n===void 0&&(n={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!di(r[0])||!di(r[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:r};return ns(t,e,n)}function mi(r,e,n){if(n===void 0&&(n={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var t={type:"LineString",coordinates:r};return ns(t,e,n)}function di(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function On(r,e,n){n===void 0&&(n={});var t=ir([1/0,1/0],{dist:1/0}),o=0;return Nt(r,function(i){for(var s=et(i),l=0;l0&&(v=b.features[0],v.properties.dist=ft(e,v,n),v.properties.location=o+ft(u,v,n)),u.properties.dist{if(this.active&&!this.dragFrom)this.recalculateHovering(e);else if(this.active&&this.dragFrom){if(this.hover=="polygon"){let n=this.dragFrom[0]-e.lngLat.lng,t=this.dragFrom[1]-e.lngLat.lat;for(let o of this.points)o[0]-=n,o[1]-=t}else this.points[this.hover]=e.lngLat.toArray();this.dragFrom=e.lngLat.toArray(),this.redraw()}});me(this,"onClick",e=>{if(this.beforeUpdate(),this.active&&this.cursor){let n=[];if(gi(this.points).forEach((t,o)=>{n.push([o+1,On(t,this.cursor).properties.dist])}),n.sort((t,o)=>t[1]-o[1]),n.length>0){let t=n[0][0];this.points.splice(t,0,this.cursor.geometry.coordinates),this.hover=t}else this.points.push(this.cursor.geometry.coordinates),this.hover=this.points.length-1;this.redraw(),this.pointsUpdated()}else this.active&&typeof this.hover=="number"&&(this.points.splice(this.hover,1),this.hover=null,this.redraw(),this.pointsUpdated(),this.recalculateHovering(e))});me(this,"onDoubleClick",e=>{this.active&&(e.preventDefault(),this.cursor=or(e.lngLat.toArray()),this.onClick(e),this.finish())});me(this,"onMouseDown",e=>{this.active&&!this.dragFrom&&this.hover!=null&&(e.preventDefault(),this.cursor=null,this.dragFrom=e.lngLat.toArray(),this.beforeUpdate(),this.redraw())});me(this,"onMouseUp",()=>{this.active&&this.dragFrom&&(this.dragFrom=null,this.redraw(),this.pointsUpdated())});me(this,"onKeypress",e=>{this.active&&(e.key=="Enter"?(e.stopPropagation(),this.finish()):e.key=="z"&&e.ctrlKey&&this.undo())});me(this,"onKeyDown",e=>{this.active&&e.key=="Escape"&&(e.stopPropagation(),this.cancel())});this.map=e,this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.points=[],this.cursor=null,this.hover=null,this.dragFrom=null,this.previousStates=[],this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("mousedown",this.onMouseDown),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keypress",this.onKeypress),document.addEventListener("keydown",this.onKeyDown)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("mousedown",this.onMouseDown),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keypress",this.onKeypress),document.removeEventListener("keydown",this.onKeyDown)}finish(){let e=this.polygonFeature();if(e)for(let n of this.eventListenersSuccess)n(e);else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){for(let e of this.eventListenersFailure)e();this.stop()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerUpdated(e){this.eventListenersUpdated.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}startNew(){this.active=!0,this.map.doubleClickZoom.disable()}editExisting(e){this.active=!0,this.map.doubleClickZoom.disable(),this.points=JSON.parse(JSON.stringify(e.geometry.coordinates[0])),this.points.pop(),this.redraw()}stop(){this.map.doubleClickZoom.enable(),this.points=[],this.cursor=null,this.active=!1,this.hover=null,this.dragFrom=null,this.previousStates=[],this.redraw(),this.map.getCanvas().style.cursor="inherit"}undo(){this.dragFrom!=null||this.previousStates.length==0||(this.points=this.previousStates.pop(),this.hover=null,this.redraw())}redraw(){let e=rs();this.points.forEach((o,i)=>{let s=or(o);s.properties.hover=this.hover==i,s.properties.idx=i,e.features.push(s)}),e.features=e.features.concat(gi(this.points));let n=this.polygonFeature();n&&(n.properties.hover=this.hover=="polygon",e.features.push(n)),os.set(e);let t="crosshair";this.hover!=null&&(t=this.dragFrom?"grabbing":"pointer"),this.map.getCanvas().style.cursor=t,ss.set(this.previousStates.length)}pointsUpdated(){let e=this.polygonFeature();if(e)for(let n of this.eventListenersUpdated)n(e)}recalculateHovering(e){this.cursor=null,this.hover=null;for(let n of this.map.queryRenderedFeatures(e.point,{layers:["edit-polygon-fill","edit-polygon-vertices"]}))if(n.geometry.type=="Polygon"){this.hover="polygon";break}else if(n.geometry.type=="Point"&&Object.hasOwn(n.properties,"idx")){this.hover=n.properties.idx;break}this.hover==null&&(this.cursor=or(e.lngLat.toArray())),this.redraw()}polygonFeature(){if(this.points.length<3)return null;let e=this.points.map(is),n=[JSON.parse(JSON.stringify(e))];return n[0].push(JSON.parse(JSON.stringify(n[0][0]))),{type:"Feature",geometry:{type:"Polygon",coordinates:n},properties:{}}}beforeUpdate(){this.previousStates.push(JSON.parse(JSON.stringify(this.points))),this.previousStates.length>Lu&&this.previousStates.shift()}}function gi(r){let e=[];for(let n=0;n=3&&e.push({type:"Feature",geometry:{type:"LineString",coordinates:[r[r.length-1],r[0]]},properties:{}}),e}class sr{constructor(){this._partials=new Float64Array(32),this._n=0}add(e){const n=this._partials;let t=0;for(let o=0;o0){for(s=e[--n];n>0&&(t=s,o=e[--n],s=t+o,i=o-(s-t),!i););n>0&&(i<0&&e[n-1]<0||i>0&&e[n-1]>0)&&(o=i*2,t=s+o,o==t-s&&(s=t))}return s}}var Nu=1e-6,hi=1e-12,Ur=Math.PI,_i=Ur/2,bi=180/Ur,nt=Ur/180,ls=Math.atan2,rt=Math.cos,_r=Math.hypot,it=Math.sin,Fu=Math.sqrt;function us(r){return r>1?_i:r<-1?-_i:Math.asin(r)}function Au(){}function jn(r,e){r&&$i.hasOwnProperty(r.type)&&$i[r.type](r,e)}var vi={Feature:function(r,e){jn(r.geometry,e)},FeatureCollection:function(r,e){for(var n=r.features,t=-1,o=n.length;++t{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&ps.decode();let Xt=null;function Qt(){return(Xt===null||Xt.byteLength===0)&&(Xt=new Uint8Array(W.memory.buffer)),Xt}function Qe(r,e){return r=r>>>0,ps.decode(Qt().subarray(r,r+e))}const ut=new Array(128).fill(void 0);ut.push(void 0,null,!0,!1);let xt=ut.length;function ve(r){xt===ut.length&&ut.push(ut.length+1);const e=xt;return xt=ut[e],ut[e]=r,e}function re(r){return ut[r]}function Tu(r){r<132||(ut[r]=xt,xt=r)}function $n(r){const e=re(r);return Tu(r),e}function lr(r){return r==null}let Wt=null;function Du(){return(Wt===null||Wt.byteLength===0)&&(Wt=new Float64Array(W.memory.buffer)),Wt}let Ht=null;function pe(){return(Ht===null||Ht.byteLength===0)&&(Ht=new Int32Array(W.memory.buffer)),Ht}let mt=0;const yn=typeof TextEncoder<"u"?new TextEncoder("utf-8"):{encode:()=>{throw Error("TextEncoder not available")}},Uu=typeof yn.encodeInto=="function"?function(r,e){return yn.encodeInto(r,e)}:function(r,e){const n=yn.encode(r);return e.set(n),{read:r.length,written:n.length}};function gn(r,e,n){if(n===void 0){const l=yn.encode(r),u=e(l.length,1)>>>0;return Qt().subarray(u,u+l.length).set(l),mt=l.length,u}let t=r.length,o=e(t,1)>>>0;const i=Qt();let s=0;for(;s127)break;i[o+s]=l}if(s!==t){s!==0&&(r=r.slice(s)),o=n(o,t,t=s+r.length*3,1)>>>0;const l=Qt().subarray(o+s,o+t),u=Uu(r,l);s+=u.written}return mt=s,o}function wr(r){const e=typeof r;if(e=="number"||e=="boolean"||r==null)return`${r}`;if(e=="string")return`"${r}"`;if(e=="symbol"){const o=r.description;return o==null?"Symbol":`Symbol(${o})`}if(e=="function"){const o=r.name;return typeof o=="string"&&o.length>0?`Function(${o})`:"Function"}if(Array.isArray(r)){const o=r.length;let i="[";o>0&&(i+=wr(r[0]));for(let s=1;s1)t=n[1];else return toString.call(r);if(t=="Object")try{return"Object("+JSON.stringify(r)+")"}catch{return"Object"}return r instanceof Error?`${r.name}: ${r.message} +${r.stack}`:t}function zu(r,e){const n=e(r.length*1,1)>>>0;return Qt().set(r,n/1),mt=r.length,n}function ur(r,e){try{return r.apply(this,e)}catch(n){W.__wbindgen_exn_store(ve(n))}}class zn{static __wrap(e){e=e>>>0;const n=Object.create(zn.prototype);return n.__wbg_ptr=e,n}__destroy_into_raw(){const e=this.__wbg_ptr;return this.__wbg_ptr=0,e}free(){const e=this.__destroy_into_raw();W.__wbg_jsroutesnapper_free(e)}constructor(e){try{const i=W.__wbindgen_add_to_stack_pointer(-16),s=zu(e,W.__wbindgen_malloc),l=mt;W.jsroutesnapper_new(i,s,l);var n=pe()[i/4+0],t=pe()[i/4+1],o=pe()[i/4+2];if(o)throw $n(t);return zn.__wrap(n)}finally{W.__wbindgen_add_to_stack_pointer(16)}}setRouteConfig(e){W.jsroutesnapper_setRouteConfig(this.__wbg_ptr,ve(e))}setAreaMode(){W.jsroutesnapper_setAreaMode(this.__wbg_ptr)}getConfig(){let e,n;try{const i=W.__wbindgen_add_to_stack_pointer(-16);W.jsroutesnapper_getConfig(i,this.__wbg_ptr);var t=pe()[i/4+0],o=pe()[i/4+1];return e=t,n=o,Qe(t,o)}finally{W.__wbindgen_add_to_stack_pointer(16),W.__wbindgen_free(e,n,1)}}toFinalFeature(){try{const t=W.__wbindgen_add_to_stack_pointer(-16);W.jsroutesnapper_toFinalFeature(t,this.__wbg_ptr);var e=pe()[t/4+0],n=pe()[t/4+1];let o;return e!==0&&(o=Qe(e,n).slice(),W.__wbindgen_free(e,n*1)),o}finally{W.__wbindgen_add_to_stack_pointer(16)}}renderGeojson(){let e,n;try{const i=W.__wbindgen_add_to_stack_pointer(-16);W.jsroutesnapper_renderGeojson(i,this.__wbg_ptr);var t=pe()[i/4+0],o=pe()[i/4+1];return e=t,n=o,Qe(t,o)}finally{W.__wbindgen_add_to_stack_pointer(16),W.__wbindgen_free(e,n,1)}}toggleSnapMode(){W.jsroutesnapper_toggleSnapMode(this.__wbg_ptr)}onMouseMove(e,n,t){return W.jsroutesnapper_onMouseMove(this.__wbg_ptr,e,n,t)!==0}onClick(){W.jsroutesnapper_onClick(this.__wbg_ptr)}onDragStart(){return W.jsroutesnapper_onDragStart(this.__wbg_ptr)!==0}onMouseUp(){return W.jsroutesnapper_onMouseUp(this.__wbg_ptr)!==0}clearState(){W.jsroutesnapper_clearState(this.__wbg_ptr)}editExisting(e){try{const o=W.__wbindgen_add_to_stack_pointer(-16);W.jsroutesnapper_editExisting(o,this.__wbg_ptr,ve(e));var n=pe()[o/4+0],t=pe()[o/4+1];if(t)throw $n(n)}finally{W.__wbindgen_add_to_stack_pointer(16)}}debugRenderGraph(){let e,n;try{const i=W.__wbindgen_add_to_stack_pointer(-16);W.jsroutesnapper_debugRenderGraph(i,this.__wbg_ptr);var t=pe()[i/4+0],o=pe()[i/4+1];return e=t,n=o,Qe(t,o)}finally{W.__wbindgen_add_to_stack_pointer(16),W.__wbindgen_free(e,n,1)}}debugSnappableNodes(){let e,n;try{const i=W.__wbindgen_add_to_stack_pointer(-16);W.jsroutesnapper_debugSnappableNodes(i,this.__wbg_ptr);var t=pe()[i/4+0],o=pe()[i/4+1];return e=t,n=o,Qe(t,o)}finally{W.__wbindgen_add_to_stack_pointer(16),W.__wbindgen_free(e,n,1)}}routeNameForWaypoints(e){let n,t;try{const f=W.__wbindgen_add_to_stack_pointer(-16);W.jsroutesnapper_routeNameForWaypoints(f,this.__wbg_ptr,ve(e));var o=pe()[f/4+0],i=pe()[f/4+1],s=pe()[f/4+2],l=pe()[f/4+3],u=o,a=i;if(l)throw u=0,a=0,$n(s);return n=u,t=a,Qe(u,a)}finally{W.__wbindgen_add_to_stack_pointer(16),W.__wbindgen_free(n,t,1)}}addSnappedWaypoint(e,n){W.jsroutesnapper_addSnappedWaypoint(this.__wbg_ptr,e,n)}undo(){W.jsroutesnapper_undo(this.__wbg_ptr)}}async function Ju(r,e){if(typeof Response=="function"&&r instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(r,e)}catch(t){if(r.headers.get("Content-Type")!="application/wasm")console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n",t);else throw t}const n=await r.arrayBuffer();return await WebAssembly.instantiate(n,e)}else{const n=await WebAssembly.instantiate(r,e);return n instanceof WebAssembly.Instance?{instance:n,module:r}:n}}function Yu(){const r={};return r.wbg={},r.wbg.__wbindgen_string_new=function(e,n){const t=Qe(e,n);return ve(t)},r.wbg.__wbindgen_object_drop_ref=function(e){$n(e)},r.wbg.__wbindgen_error_new=function(e,n){const t=new Error(Qe(e,n));return ve(t)},r.wbg.__wbindgen_is_object=function(e){const n=re(e);return typeof n=="object"&&n!==null},r.wbg.__wbindgen_is_undefined=function(e){return re(e)===void 0},r.wbg.__wbindgen_in=function(e,n){return re(e)in re(n)},r.wbg.__wbindgen_number_get=function(e,n){const t=re(n),o=typeof t=="number"?t:void 0;Du()[e/8+1]=lr(o)?0:o,pe()[e/4+0]=!lr(o)},r.wbg.__wbindgen_boolean_get=function(e){const n=re(e);return typeof n=="boolean"?n?1:0:2},r.wbg.__wbindgen_jsval_loose_eq=function(e,n){return re(e)==re(n)},r.wbg.__wbindgen_string_get=function(e,n){const t=re(n),o=typeof t=="string"?t:void 0;var i=lr(o)?0:gn(o,W.__wbindgen_malloc,W.__wbindgen_realloc),s=mt;pe()[e/4+1]=s,pe()[e/4+0]=i},r.wbg.__wbg_getwithrefkey_d1f0d12f1f1b63ea=function(e,n){const t=re(e)[re(n)];return ve(t)},r.wbg.__wbindgen_object_clone_ref=function(e){const n=re(e);return ve(n)},r.wbg.__wbg_String_4370c5505c674d30=function(e,n){const t=String(re(n)),o=gn(t,W.__wbindgen_malloc,W.__wbindgen_realloc),i=mt;pe()[e/4+1]=i,pe()[e/4+0]=o},r.wbg.__wbg_new_abda76e883ba8a5f=function(){const e=new Error;return ve(e)},r.wbg.__wbg_stack_658279fe44541cf6=function(e,n){const t=re(n).stack,o=gn(t,W.__wbindgen_malloc,W.__wbindgen_realloc),i=mt;pe()[e/4+1]=i,pe()[e/4+0]=o},r.wbg.__wbg_error_f851667af71bcfc6=function(e,n){let t,o;try{t=e,o=n,console.error(Qe(e,n))}finally{W.__wbindgen_free(t,o,1)}},r.wbg.__wbg_debug_9a6b3243fbbebb61=function(e){console.debug(re(e))},r.wbg.__wbg_error_788ae33f81d3b84b=function(e){console.error(re(e))},r.wbg.__wbg_info_2e30e8204b29d91d=function(e){console.info(re(e))},r.wbg.__wbg_log_1d3ae0273d8f4f8a=function(e){console.log(re(e))},r.wbg.__wbg_warn_d60e832f9882c1b2=function(e){console.warn(re(e))},r.wbg.__wbg_get_44be0491f933a435=function(e,n){const t=re(e)[n>>>0];return ve(t)},r.wbg.__wbg_length_fff51ee6522a1a18=function(e){return re(e).length},r.wbg.__wbindgen_is_function=function(e){return typeof re(e)=="function"},r.wbg.__wbg_next_526fc47e980da008=function(e){const n=re(e).next;return ve(n)},r.wbg.__wbg_next_ddb3312ca1c4e32a=function(){return ur(function(e){const n=re(e).next();return ve(n)},arguments)},r.wbg.__wbg_done_5c1f01fb660d73b5=function(e){return re(e).done},r.wbg.__wbg_value_1695675138684bd5=function(e){const n=re(e).value;return ve(n)},r.wbg.__wbg_iterator_97f0c81209c6c35a=function(){return ve(Symbol.iterator)},r.wbg.__wbg_get_97b561fb56f034b5=function(){return ur(function(e,n){const t=Reflect.get(re(e),re(n));return ve(t)},arguments)},r.wbg.__wbg_call_cb65541d95d71282=function(){return ur(function(e,n){const t=re(e).call(re(n));return ve(t)},arguments)},r.wbg.__wbg_isArray_4c24b343cb13cfb1=function(e){return Array.isArray(re(e))},r.wbg.__wbg_instanceof_ArrayBuffer_39ac22089b74fddb=function(e){let n;try{n=re(e)instanceof ArrayBuffer}catch{n=!1}return n},r.wbg.__wbg_buffer_085ec1f694018c4f=function(e){const n=re(e).buffer;return ve(n)},r.wbg.__wbg_new_8125e318e6245eed=function(e){const n=new Uint8Array(re(e));return ve(n)},r.wbg.__wbg_set_5cf90238115182c3=function(e,n,t){re(e).set(re(n),t>>>0)},r.wbg.__wbg_length_72e2208bbc0efc61=function(e){return re(e).length},r.wbg.__wbg_instanceof_Uint8Array_d8d9cb2b8e8ac1d4=function(e){let n;try{n=re(e)instanceof Uint8Array}catch{n=!1}return n},r.wbg.__wbindgen_debug_string=function(e,n){const t=wr(re(n)),o=gn(t,W.__wbindgen_malloc,W.__wbindgen_realloc),i=mt;pe()[e/4+1]=i,pe()[e/4+0]=o},r.wbg.__wbindgen_throw=function(e,n){throw new Error(Qe(e,n))},r.wbg.__wbindgen_memory=function(){const e=W.memory;return ve(e)},r}function Xu(r,e){return W=r.exports,ms.__wbindgen_wasm_module=e,Wt=null,Ht=null,Xt=null,W}async function ms(r){if(W!==void 0)return W;typeof r>"u"&&(r=new URL("/atip/ss_huge_refactor_pt1/assets/route_snapper_bg-a52abfbb.wasm",self.location));const e=Yu();(typeof r=="string"||typeof Request=="function"&&r instanceof Request||typeof URL=="function"&&r instanceof URL)&&(r=fetch(r));const{instance:n,module:t}=await Ju(await r,e);return Xu(n,t)}function Wu(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function Hu(r,e,n){if(n===void 0&&(n={}),!r)throw new Error("coordinates is required");if(!Array.isArray(r))throw new Error("coordinates must be an Array");if(r.length<2)throw new Error("coordinates must be at least 2 numbers long");if(!Si(r[0])||!Si(r[1]))throw new Error("coordinates must contain numbers");var t={type:"Point",coordinates:r};return Wu(t,e,n)}function Si(r){return!isNaN(r)&&r!==null&&!Array.isArray(r)}function kr(r,e){return e===void 0&&(e={}),Ho(r,function(n,t){var o=t.geometry.coordinates;return n+ft(o[0],o[1],e)},0)}function Zu(r,e,n){n===void 0&&(n={});var t={type:"Feature"};return(n.id===0||n.id)&&(t.id=n.id),n.bbox&&(t.bbox=n.bbox),t.properties=e||{},t.geometry=r,t}function Ku(r,e,n){if(n===void 0&&(n={}),r.length<2)throw new Error("coordinates must be an array of two or more positions");var t={type:"LineString",coordinates:r};return Zu(t,e,n)}function Vu(r,e,n){var t=et(n);if(dr(n)!=="LineString")throw new Error("line must be a LineString");var o=On(n,r),i=On(n,e),s;o.properties.index<=i.properties.index?s=[o,i]:s=[i,o];for(var l=[s[0].geometry.coordinates],u=s[0].properties.index+1;u=s){var l=(n+o)/2;return[e,l-(t-e)/2,t,l+(t-e)/2]}else{var u=(e+t)/2;return[u-(o-n)/2,n,u+(o-n)/2,o]}}function Sr(r){var e=[1/0,1/0,-1/0,-1/0];return Ct(r,function(n){e[0]>n[0]&&(e[0]=n[0]),e[1]>n[1]&&(e[1]=n[1]),e[2] is required");if(typeof n!="number")throw new Error(" must be a number");if(typeof t!="number")throw new Error(" must be a number");(o===!1||o===void 0)&&(r=JSON.parse(JSON.stringify(r)));var i=Math.pow(10,n);return Ct(r,function(s){ea(s,i,t)}),r}function ea(r,e,n){r.length>n&&r.splice(n,r.length);for(var t=0;t1&&n.push(Ei(f)),en(n)}function ds(r,e){if(!e.features.length)throw new Error("lines must contain features");if(e.features.length===1)return e.features[0];var n,t=1/0;return Dt(e,function(o){var i=On(o,r),s=i.properties.dist;s{if(!this.active)return;const l=[s.point.x-oa,s.point.y],u=this.map.unproject(s.point).distanceTo(this.map.unproject(l));this.inner.onMouseMove(s.lngLat.lng,s.lngLat.lat,u)&&(this.redraw(),this.dataUpdated())},this.onClick=()=>{this.active&&(this.inner.onClick(),this.redraw(),this.dataUpdated())},this.onDoubleClick=s=>{this.active&&(s.preventDefault(),this.inner.onClick(),this.finish())},this.onDragStart=()=>{this.active&&this.inner.onDragStart()&&this.map.dragPan.disable()},this.onMouseUp=()=>{this.active&&this.inner.onMouseUp()&&this.map.dragPan.enable()},this.onKeyDown=s=>{this.active&&s.key=="Escape"&&(s.stopPropagation(),this.cancel())},this.onKeyPress=s=>{this.active&&s.target.tagName!="INPUT"&&(s.key=="Enter"?(s.stopPropagation(),this.finish()):s.key=="s"||s.key=="S"?(s.stopPropagation(),this.inner.toggleSnapMode(),this.redraw()):s.key=="z"&&s.ctrlKey&&this.undo())},this.map=e,console.time("Deserialize and setup JsRouteSnapper"),this.inner=new zn(n),console.timeEnd("Deserialize and setup JsRouteSnapper"),this.active=!1,this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[],this.routeToolGj=t,this.snapMode=o,this.undoLength=i,this.map.on("mousemove",this.onMouseMove),this.map.on("click",this.onClick),this.map.on("dblclick",this.onDoubleClick),this.map.on("dragstart",this.onDragStart),this.map.on("mouseup",this.onMouseUp),document.addEventListener("keydown",this.onKeyDown),document.addEventListener("keypress",this.onKeyPress)}tearDown(){this.map.off("mousemove",this.onMouseMove),this.map.off("click",this.onClick),this.map.off("dblclick",this.onDoubleClick),this.map.off("dragstart",this.onDragStart),this.map.off("mouseup",this.onMouseUp),document.removeEventListener("keydown",this.onKeyDown),document.removeEventListener("keypress",this.onKeyPress)}startRoute(){this.active||(this.active=!0,this.map.boxZoom.disable(),this.map.doubleClickZoom.disable())}startArea(){this.active||(this.inner.setAreaMode(),this.active=!0,this.map.boxZoom.disable(),this.map.doubleClickZoom.disable())}stop(){this.active=!1,this.inner.clearState(),this.redraw(),this.map.boxZoom.enable(),this.map.doubleClickZoom.enable()}editExistingRoute(e){this.active&&window.alert("Bug: editExistingRoute called when tool is already active"),e.properties.waypoints||(e.properties.waypoints=[{lon:e.geometry.coordinates[0][0],lat:e.geometry.coordinates[0][1],snapped:!0},{lon:e.geometry.coordinates[e.geometry.coordinates.length-1][0],lat:e.geometry.coordinates[e.geometry.coordinates.length-1][1],snapped:!0}]),this.startRoute(),this.inner.editExisting(e.properties.waypoints),this.redraw()}editExistingArea(e){this.active&&window.alert("Bug: editExistingArea called when tool is already active"),e.properties.waypoints||window.alert("Bug: editExistingArea called for a polygon not produced by the route-snapper"),this.startArea(),this.inner.editExisting(e.properties.waypoints),this.redraw()}addEventListenerSuccess(e){this.eventListenersSuccess.push(e)}addEventListenerUpdated(e){this.eventListenersUpdated.push(e)}addEventListenerFailure(e){this.eventListenersFailure.push(e)}clearEventListeners(){this.eventListenersSuccess=[],this.eventListenersUpdated=[],this.eventListenersFailure=[]}isActive(){return this.active}finish(){let e=this.inner.toFinalFeature();if(e)for(let n of this.eventListenersSuccess)n(JSON.parse(e));else for(let n of this.eventListenersFailure)n();this.stop()}cancel(){this.inner.clearState(),this.finish()}setRouteConfig(e){this.inner.setRouteConfig(e),this.redraw()}addSnappedWaypoint(e){this.inner.addSnappedWaypoint(e[0],e[1]),this.redraw()}undo(){this.inner.undo(),this.redraw()}toggleSnapMode(){this.inner.toggleSnapMode(),this.redraw()}redraw(){let e=JSON.parse(this.inner.renderGeojson());this.routeToolGj.set(e),this.map.getCanvas().style.cursor=e.cursor,this.snapMode.set(e.snap_mode),this.undoLength.set(e.undo_length)}dataUpdated(){let e=this.inner.toFinalFeature();if(e)for(let n of this.eventListenersUpdated)n(JSON.parse(e))}}const la="/atip/ss_huge_refactor_pt1/assets/warning-81bba3f6.svg";function ua(r){let e,n;return{c(){e=G("img"),Ye(e.src,n=la)||T(e,"src",n),T(e,"title",r[0]),T(e,"alt",r[0])},m(t,o){$(t,e,o)},p(t,[o]){o&1&&T(e,"title",t[0]),o&1&&T(e,"alt",t[0])},i:ee,o:ee,d(t){t&&y(e)}}}function aa(r,e,n){let{text:t}=e;return r.$$set=o=>{"text"in o&&n(0,t=o.text)},[t]}class gs extends te{constructor(e){super(),ne(this,e,aa,ua,x,{text:0})}}async function fa(r,e){let n=await fetch(r),t=n.body.getReader(),o=n.headers.get("Content-Length");if(!o)throw new Error(`No Content-Length header from ${r}`);let i=parseInt(o),s=0,l=[];for(;;){let{done:f,value:c}=await t.read();if(f)break;c&&(l.push(c),s+=c.length,e(100*s/i))}let u=new Uint8Array(s),a=0;for(let f of l)u.set(f,a),a+=f.length;return u}function Ci(r){let e=r[0],n,t,o=Ni(r);return{c(){o.c(),n=fe()},m(i,s){o.m(i,s),$(i,n,s),t=!0},p(i,s){s&1&&x(e,e=i[0])?(se(),k(o,1,1,ee),le(),o=Ni(i),o.c(),w(o,1),o.m(n.parentNode,n)):o.p(i,s)},i(i){t||(w(o),t=!0)},o(i){k(o),t=!1},d(i){i&&y(n),o.d(i)}}}function Ni(r){let e;const n=r[10].default,t=Wn(n,r,r[9],null);return{c(){t&&t.c()},m(o,i){t&&t.m(o,i),e=!0},p(o,i){t&&t.p&&(!e||i&512)&&Hn(t,n,o,o[9],e?Kn(n,o[9],i,null):Zn(o[9]),null)},i(o){e||(w(t,o),e=!0)},o(o){k(t,o),e=!1},d(o){t&&t.d(o)}}}function ca(r){let e,n,t=r[0]&&Ci(r);return{c(){t&&t.c(),e=fe()},m(o,i){t&&t.m(o,i),$(o,e,i),n=!0},p(o,[i]){o[0]?t?(t.p(o,i),i&1&&w(t,1)):(t=Ci(o),t.c(),w(t,1),t.m(e.parentNode,e)):t&&(se(),k(t,1,1,()=>{t=null}),le())},i(o){n||(w(t),n=!0)},o(o){k(t),n=!1},d(o){o&&y(e),t&&t.d(o)}}}function pa(r,e,n){let t,o,{$$slots:i={},$$scope:s}=e,{id:l=Bo("image")}=e,{url:u}=e,{coordinates:a}=e;const{map:f,self:c}=Qs();Y(r,f,g=>n(8,o=g)),Y(r,c,g=>n(0,t=g));let p,m=!0;return Xe(()=>{t&&o&&(xs(f,t,p),Be(c,t=null,t),n(6,p=void 0))}),r.$$set=g=>{"id"in g&&n(3,l=g.id),"url"in g&&n(4,u=g.url),"coordinates"in g&&n(5,a=g.coordinates),"$$scope"in g&&n(9,s=g.$$scope)},r.$$.update=()=>{r.$$.dirty&313&&o&&t!==l&&(Be(c,t=l,t),el(o,t,tl({type:"image",url:u,coordinates:a}),g=>o&&g===t,()=>{t&&(n(6,p=o==null?void 0:o.getSource(t)),n(7,m=!0))})),r.$$.dirty&264&&(o==null||o.on("style.load",()=>{n(6,p=o==null?void 0:o.getSource(l))})),r.$$.dirty&224&&p&&(m?n(7,m=!1):p.setCoordinates(a))},[t,f,c,l,u,a,p,m,o,s,i]}class ma extends te{constructor(e){super(),ne(this,e,pa,ca,x,{id:3,url:4,coordinates:5})}}const{Map:da}=sl;function Fi(r,e,n){const t=r.slice();t[40]=e[n];const o=t[1](t[40]);t[41]=o;const i=typeof t[7]=="function"?t[7](t[40]):t[7];return t[42]=i,t}const ga=r=>({feature:r[0]&1024,position:r[0]&1026}),Ai=r=>({feature:r[40],position:r[41]});function Ri(r){let e=[],n=new da,t,o,i=je(r[10]);const s=l=>l[40].id;for(let l=0;l=r[13]&&r[11]<=r[12]&&Ri(r);return{c(){P(e.$$.fragment),n=F(),i&&i.c(),t=fe()},m(s,l){L(e,s,l),$(s,n,l),i&&i.m(s,l),$(s,t,l),o=!0},p(s,l){const u={};l[0]&32&&(u.minzoom=s[5]),l[0]&64&&(u.maxzoom=s[6]),e.$set(u),s[11]>=s[13]&&s[11]<=s[12]?i?(i.p(s,l),l[0]&14336&&w(i,1)):(i=Ri(s),i.c(),w(i,1),i.m(t.parentNode,t)):i&&(se(),k(i,1,1,()=>{i=null}),le())},i(s){o||(w(e.$$.fragment,s),w(i),o=!0)},o(s){k(e.$$.fragment,s),k(i),o=!1},d(s){s&&(y(n),y(t)),C(e,s),i&&i.d(s)}}}function ba(r,e,n){let t,o,i,s,l,u,a,{$$slots:f={},$$scope:c}=e;const{map:p,source:m,minzoom:g,maxzoom:b}=nl();Y(r,p,X=>n(21,s=X)),Y(r,m,X=>n(9,l=X)),Y(r,g,X=>n(23,a=X)),Y(r,b,X=>n(22,u=X));const v=rl();let{applyToClusters:S=void 0}=e,{filter:d=void 0}=e,{markerLngLat:_=Gu}=e,{interactive:E=!0}=e,{asButton:h=!1}=e,{draggable:M=!1}=e,{minzoom:O=void 0}=e,{maxzoom:B=void 0}=e,{hovered:D=null}=e,{zIndex:I=void 0}=e,{class:A=void 0}=e,R=!1;function N(){s&&(R=!0,s.on("zoom",U),s.on("move",ie),s.on("moveend",ie),s.loaded()?s.once("load",ie):ie())}function j(X){X.sourceId===l&&X.isSourceLoaded&&(R?ie():N())}Xe(()=>{s&&(s.off("zoom",U),s.off("move",ie),s.off("moveend",ie),s.off("sourcedata",j))});let H=[];function ie(){var Ft;if(!s||!l)return;let X=s.querySourceFeatures(l,{filter:i}),ye=new Map;for(let Me of X)Me.id||((Ft=Me.properties)!=null&&Ft.cluster_id?Me.id="autocluster_"+Me.properties.cluster_id:Me.id=Bo("autofeat")),ye.set(Me.id,Me);n(10,H=[...ye.values()].sort((Me,Ys)=>Me.id.toString().localeCompare(Ys.id.toString())))}let ce=(s==null?void 0:s.getZoom())??0;function U(X){n(11,ce=s.getZoom()),ie()}const de=X=>{n(0,D=X)},_e=X=>{(D==null?void 0:D.id)===X.id&&n(0,D=null)},Ee=(X,ye)=>v("dragstart",{...ye.detail,source:l,feature:X}),$e=(X,ye)=>v("drag",{...ye.detail,source:l,feature:X}),pn=(X,ye)=>v("dragend",{...ye.detail,source:l,feature:X}),J=(X,ye)=>v("click",{...ye.detail,source:l,feature:X}),Z=(X,ye)=>v("dblclick",{...ye.detail,source:l,feature:X}),Ie=(X,ye)=>v("contextmenu",{...ye.detail,source:l,feature:X});return r.$$set=X=>{"applyToClusters"in X&&n(19,S=X.applyToClusters),"filter"in X&&n(20,d=X.filter),"markerLngLat"in X&&n(1,_=X.markerLngLat),"interactive"in X&&n(2,E=X.interactive),"asButton"in X&&n(3,h=X.asButton),"draggable"in X&&n(4,M=X.draggable),"minzoom"in X&&n(5,O=X.minzoom),"maxzoom"in X&&n(6,B=X.maxzoom),"hovered"in X&&n(0,D=X.hovered),"zIndex"in X&&n(7,I=X.zIndex),"class"in X&&n(8,A=X.class),"$$scope"in X&&n(33,c=X.$$scope)},r.$$.update=()=>{if(r.$$.dirty[0]&8388640&&n(13,t=O??a),r.$$.dirty[0]&4194368&&n(12,o=B??u),r.$$.dirty[0]&1572864&&(i=il("all",ol(S),d)),r.$$.dirty[0]&2097664&&s&&l){let X=s.getSource(l);X!=null&&X.loaded()?N():s.on("sourcedata",j)}},[D,_,E,h,M,O,B,I,A,l,H,ce,o,t,p,m,g,b,v,S,d,s,u,a,f,de,_e,Ee,$e,pn,J,Z,Ie,c]}class va extends te{constructor(e){super(),ne(this,e,ba,_a,x,{applyToClusters:19,filter:20,markerLngLat:1,interactive:2,asButton:3,draggable:4,minzoom:5,maxzoom:6,hovered:0,zIndex:7,class:8},null,[-1,-1])}}/** * splaytree v3.1.1 * Fast Splay tree for Node and browser * @@ -19,9 +19,9 @@ MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. -***************************************************************************** */function va(r,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,i,s;return s={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(a){return function(f){return u([a,f])}}function u(a){if(t)throw new TypeError("Generator is already executing.");for(;n;)try{if(t=1,o&&(i=a[0]&2?o.return:a[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;switch(o=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,o=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]e?1:r0){if(e.right===null)break;if(n(r,e.right.key)>0){var l=e.right;if(e.right=l.left,l.left=e,e=l,e.right===null)break}o.right=e,o=e,e=e.right}else break}return o.right=e.left,i.left=e.right,e.left=t.right,e.right=t.left,e}function fr(r,e,n,t){var o=new _t(r,e);if(n===null)return o.left=o.right=null,o;n=ct(r,n,t);var i=t(r,n.key);return i<0?(o.left=n.left,o.right=n,n.left=null):i>=0&&(o.right=n.right,o.left=n,n.right=null),o}function ji(r,e,n){var t=null,o=null;if(e){e=ct(r,e,n);var i=n(e.key,r);i===0?(t=e.left,o=e.right):i<0?(o=e.right,e.right=null,t=e):(t=e.left,e.left=null,o=e)}return{left:t,right:o}}function ya(r,e,n){return e===null?r:(r===null||(e=ct(r.key,e,n),e.left=r),e)}function Mr(r,e,n,t,o){if(r){t(""+e+(n?"└── ":"├── ")+o(r)+` -`);var i=e+(n?" ":"│ ");r.left&&Mr(r.left,i,!1,t,o),r.right&&Mr(r.right,i,!0,t,o)}}var Jr=function(){function r(e){e===void 0&&(e=$a),this._root=null,this._size=0,this._comparator=e}return r.prototype.insert=function(e,n){return this._size++,this._root=fr(e,n,this._root,this._comparator)},r.prototype.add=function(e,n){var t=new _t(e,n);this._root===null&&(t.left=t.right=null,this._size++,this._root=t);var o=this._comparator,i=ct(e,this._root,o),s=o(e,i.key);return s===0?this._root=i:(s<0?(t.left=i.left,t.right=i,i.left=null):s>0&&(t.right=i.right,t.left=i,i.right=null),this._size++,this._root=t),this._root},r.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)},r.prototype._remove=function(e,n,t){var o;if(n===null)return null;n=ct(e,n,t);var i=t(e,n.key);return i===0?(n.left===null?o=n.right:(o=ct(e,n.left,t),o.right=n.right),this._size--,o):n},r.prototype.pop=function(){var e=this._root;if(e){for(;e.left;)e=e.left;return this._root=ct(e.key,this._root,this._comparator),this._root=this._remove(e.key,this._root,this._comparator),{key:e.key,data:e.data}}return null},r.prototype.findStatic=function(e){for(var n=this._root,t=this._comparator;n;){var o=t(e,n.key);if(o===0)return n;o<0?n=n.left:n=n.right}return null},r.prototype.find=function(e){return this._root&&(this._root=ct(e,this._root,this._comparator),this._comparator(e,this._root.key)!==0)?null:this._root},r.prototype.contains=function(e){for(var n=this._root,t=this._comparator;n;){var o=t(e,n.key);if(o===0)return!0;o<0?n=n.left:n=n.right}return!1},r.prototype.forEach=function(e,n){for(var t=this._root,o=[],i=!1;!i;)t!==null?(o.push(t),t=t.left):o.length!==0?(t=o.pop(),e.call(n,t),t=t.right):i=!0;return this},r.prototype.range=function(e,n,t,o){for(var i=[],s=this._comparator,l=this._root,u;i.length!==0||l;)if(l)i.push(l),l=l.left;else{if(l=i.pop(),u=s(l.key,n),u>0)break;if(s(l.key,e)>=0&&t.call(o,l))return this;l=l.right}return this},r.prototype.keys=function(){var e=[];return this.forEach(function(n){var t=n.key;return e.push(t)}),e},r.prototype.values=function(){var e=[];return this.forEach(function(n){var t=n.data;return e.push(t)}),e},r.prototype.min=function(){return this._root?this.minNode(this._root).key:null},r.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},r.prototype.minNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.left;)e=e.left;return e},r.prototype.maxNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.right;)e=e.right;return e},r.prototype.at=function(e){for(var n=this._root,t=!1,o=0,i=[];!t;)if(n)i.push(n),n=n.left;else if(i.length>0){if(n=i.pop(),o===e)return n;o++,n=n.right}else t=!0;return null},r.prototype.next=function(e){var n=this._root,t=null;if(e.right){for(t=e.right;t.left;)t=t.left;return t}for(var o=this._comparator;n;){var i=o(e.key,n.key);if(i===0)break;i<0?(t=n,n=n.left):n=n.right}return t},r.prototype.prev=function(e){var n=this._root,t=null;if(e.left!==null){for(t=e.left;t.right;)t=t.right;return t}for(var o=this._comparator;n;){var i=o(e.key,n.key);if(i===0)break;i<0?n=n.left:(t=n,n=n.right)}return t},r.prototype.clear=function(){return this._root=null,this._size=0,this},r.prototype.toList=function(){return ka(this._root)},r.prototype.load=function(e,n,t){n===void 0&&(n=[]),t===void 0&&(t=!1);var o=e.length,i=this._comparator;if(t&&Cr(e,n,0,o-1,i),this._root===null)this._root=Pr(e,n,0,o),this._size=o;else{var s=Sa(this.toList(),wa(e,n),i);o=this._size+o,this._root=Lr({head:s},0,o)}return this},r.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(r.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),r.prototype.toString=function(e){e===void 0&&(e=function(t){return String(t.key)});var n=[];return Mr(this._root,"",!0,function(t){return n.push(t)},e),n.join("")},r.prototype.update=function(e,n,t){var o=this._comparator,i=ji(e,this._root,o),s=i.left,l=i.right;o(e,n)<0?l=fr(n,t,l,o):s=fr(n,t,s,o),this._root=ya(s,l,o)},r.prototype.split=function(e){return ji(e,this._root,this._comparator)},r.prototype[Symbol.iterator]=function(){var e;return va(this,function(n){switch(n.label){case 0:e=this.minNode(),n.label=1;case 1:return e?[4,e]:[3,3];case 2:return n.sent(),e=this.next(e),[3,1];case 3:return[2]}})},r}();function Pr(r,e,n,t){var o=t-n;if(o>0){var i=n+Math.floor(o/2),s=r[i],l=e[i],u=new _t(s,l);return u.left=Pr(r,e,n,i),u.right=Pr(r,e,i+1,t),u}return null}function wa(r,e){for(var n=new _t(null,null),t=n,o=0;o0?(e=i=i.next=n.pop(),e=e.right):t=!0;return i.next=null,o.next}function Lr(r,e,n){var t=n-e;if(t>0){var o=e+Math.floor(t/2),i=Lr(r,e,o),s=r.head;return s.left=i,r.head=r.head.next,s.right=Lr(r,o+1,n),s}return null}function Sa(r,e,n){for(var t=new _t(null,null),o=t,i=r,s=e;i!==null&&s!==null;)n(i.key,s.key)<0?(o.next=i,i=i.next):(o.next=s,s=s.next),o=o.next;return i!==null?o.next=i:s!==null&&(o.next=s),t.next}function Cr(r,e,n,t,o){if(!(n>=t)){for(var i=r[n+t>>1],s=n-1,l=t+1;;){do s++;while(o(r[s],i)<0);do l--;while(o(r[l],i)>0);if(s>=l)break;var u=r[s];r[s]=r[l],r[l]=u,u=e[s],e[s]=e[l],e[l]=u}Cr(r,e,n,l,o),Cr(r,e,l+1,t,o)}}function qe(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Ii(r,e){for(var n=0;nt.x?1:n.yt.y?1:0}}]);function r(e,n){qe(this,r),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}return Ae(r,[{key:"link",value:function(n){if(n.point===this.point)throw new Error("Tried to link already linked events");for(var t=n.point.events,o=0,i=t.length;o=0&&p>=0?fm?-1:0:a<0&&p<0?fm?1:0:pa?1:0}}}]),r}(),Na=0,Yn=function(){Ae(r,null,[{key:"compare",value:function(n,t){var o=n.leftSE.point.x,i=t.leftSE.point.x,s=n.rightSE.point.x,l=t.rightSE.point.x;if(lu&&a>f)return-1;var p=n.comparePoint(t.leftSE.point);if(p<0)return 1;if(p>0)return-1;var m=t.comparePoint(n.rightSE.point);return m!==0?m:-1}if(o>i){if(ua&&u>c)return 1;var h=t.comparePoint(n.leftSE.point);if(h!==0)return h;var b=n.comparePoint(t.rightSE.point);return b<0?1:b>0?-1:1}if(ua)return 1;if(sl){var E=n.comparePoint(t.rightSE.point);if(E<0)return 1;if(E>0)return-1}if(s!==l){var d=f-u,g=s-o,S=c-a,_=l-i;if(d>g&&S<_)return 1;if(d_)return-1}return s>l?1:sc?1:n.idt.id?1:0}}]);function r(e,n,t,o){qe(this,r),this.id=++Na,this.leftSE=e,e.segment=this,e.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=e,this.rings=t,this.windings=o}return Ae(r,[{key:"replaceRightSE",value:function(n){this.rightSE=n,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var n=this.leftSE.point.y,t=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:nt?n:t}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(n){return n.x===this.leftSE.point.x&&n.y===this.leftSE.point.y||n.x===this.rightSE.point.x&&n.y===this.rightSE.point.y}},{key:"comparePoint",value:function(n){if(this.isAnEndpoint(n))return 0;var t=this.leftSE.point,o=this.rightSE.point,i=this.vector();if(t.x===o.x)return n.x===t.x?0:n.x0&&u.swapEvents(),Ve.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),o&&(i.checkForConsuming(),s.checkForConsuming()),t}},{key:"swapEvents",value:function(){var n=this.rightSE;this.rightSE=this.leftSE,this.leftSE=n,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var t=0,o=this.windings.length;t0){var s=t;t=o,o=s}if(t.prev===o){var l=t;t=o,o=l}for(var u=0,a=o.rings.length;u0)i=t,s=n,l=-1;else throw new Error("Tried to create degenerate segment at [".concat(n.x,", ").concat(n.y,"]"));var a=new Ve(i,!0),f=new Ve(s,!1);return new r(a,f,[o],[l])}}]),r}(),Di=function(){function r(e,n,t){if(qe(this,r),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=t,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var o=sn.round(e[0][0],e[0][1]);this.bbox={ll:{x:o.x,y:o.y},ur:{x:o.x,y:o.y}};for(var i=o,s=1,l=e.length;sthis.bbox.ur.x&&(this.bbox.ur.x=u.x),u.y>this.bbox.ur.y&&(this.bbox.ur.y=u.y),i=u)}(o.x!==i.x||o.y!==i.y)&&this.segments.push(Yn.fromRing(i,o,this))}return Ae(r,[{key:"getSweepEvents",value:function(){for(var n=[],t=0,o=this.segments.length;tthis.bbox.ur.x&&(this.bbox.ur.x=i.bbox.ur.x),i.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=i.bbox.ur.y),this.interiorRings.push(i)}this.multiPoly=n}return Ae(r,[{key:"getSweepEvents",value:function(){for(var n=this.exteriorRing.getSweepEvents(),t=0,o=this.interiorRings.length;tthis.bbox.ur.x&&(this.bbox.ur.x=i.bbox.ur.x),i.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=i.bbox.ur.y),this.polys.push(i)}this.isSubject=n}return Ae(r,[{key:"getSweepEvents",value:function(){for(var n=[],t=0,o=this.polys.length;t0&&(n=i)}for(var s=n.segment.prevInResult(),l=s?s.prevInResult():null;;){if(!s)return null;if(!l)return s.ringOut;if(l.ringOut!==s.ringOut)return l.ringOut.enclosingRing()!==s.ringOut?s.ringOut:s.ringOut.enclosingRing();s=l.prevInResult(),l=s?s.prevInResult():null}}}]),r}(),zi=function(){function r(e){qe(this,r),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return Ae(r,[{key:"addInterior",value:function(n){this.interiorRings.push(n),n.poly=this}},{key:"getGeom",value:function(){var n=[this.exteriorRing.getGeom()];if(n[0]===null)return null;for(var t=0,o=this.interiorRings.length;t1&&arguments[1]!==void 0?arguments[1]:Yn.compare;qe(this,r),this.queue=e,this.tree=new Jr(n),this.segments=[]}return Ae(r,[{key:"process",value:function(n){var t=n.segment,o=[];if(n.consumedBy)return n.isLeft?this.queue.remove(n.otherSE):this.tree.remove(t),o;var i=n.isLeft?this.tree.insert(t):this.tree.find(t);if(!i)throw new Error("Unable to find segment #".concat(t.id," ")+"[".concat(t.leftSE.point.x,", ").concat(t.leftSE.point.y,"] -> ")+"[".concat(t.rightSE.point.x,", ").concat(t.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var s=i,l=i,u=void 0,a=void 0;u===void 0;)s=this.tree.prev(s),s===null?u=null:s.key.consumedBy===void 0&&(u=s.key);for(;a===void 0;)l=this.tree.next(l),l===null?a=null:l.key.consumedBy===void 0&&(a=l.key);if(n.isLeft){var f=null;if(u){var c=u.getIntersection(t);if(c!==null&&(t.isAnEndpoint(c)||(f=c),!u.isAnEndpoint(c)))for(var p=this._splitSafely(u,c),m=0,h=p.length;m0?(this.tree.remove(t),o.push(n)):(this.segments.push(t),t.prev=u)}else{if(u&&a){var D=u.getIntersection(a);if(D!==null){if(!u.isAnEndpoint(D))for(var I=this._splitSafely(u,D),A=0,R=I.length;AJi)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var _=new Oa(b),M=b.size,O=b.pop();O;){var B=O.key;if(b.size===M){var D=B.segment;throw new Error("Unable to pop() ".concat(B.isLeft?"left":"right"," SweepEvent ")+"[".concat(B.point.x,", ").concat(B.point.y,"] from segment #").concat(D.id," ")+"[".concat(D.leftSE.point.x,", ").concat(D.leftSE.point.y,"] -> ")+"[".concat(D.rightSE.point.x,", ").concat(D.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(b.size>Ji)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(_.segments.length>ja)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var I=_.process(B),A=0,R=I.length;A1?n-1:0),o=1;o1?n-1:0),o=1;o1?n-1:0),o=1;o1?n-1:0),o=1;oDa(r,"name",{value:e,configurable:!0});function hs(r,e){var n=bs(e),t=null;return r.type==="FeatureCollection"?t=_s(r):t=Yr(wn.union(r.geometry.coordinates)),t.geometry.coordinates.forEach(function(o){n.geometry.coordinates.push(o[0])}),n}tr(hs,"mask");function _s(r){var e=r.features.length===2?wn.union(r.features[0].geometry.coordinates,r.features[1].geometry.coordinates):wn.union.apply(wn,r.features.map(function(n){return n.geometry.coordinates}));return Yr(e)}tr(_s,"unionFc");function Yr(r){return sl(r)}tr(Yr,"createGeomFromPolygonClippingOutput");function bs(r){var e=[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]],n=r&&r.geometry.coordinates||e;return ll(n)}tr(bs,"createMask");var Yi=hs;function Ua(r){let e,n;const t=[ue(r[0],"boundary"),{paint:{"fill-color":"black","fill-opacity":.5}}];let o={};for(let i=0;in(3,t=l));let{cfg:o}=e,{boundaryGeojson:i}=e,{fitBoundsAtStart:s=!1}=e;return(ul("setCamera")||s)&&(t==null||t.fitBounds(Go(i),{padding:20,animate:!1})),r.$$set=l=>{"cfg"in l&&n(0,o=l.cfg),"boundaryGeojson"in l&&n(1,i=l.boundaryGeojson),"fitBoundsAtStart"in l&&n(2,s=l.fitBoundsAtStart)},[o,i,s]}class Ya extends te{constructor(e){super(),ne(this,e,Ja,za,x,{cfg:0,boundaryGeojson:1,fitBoundsAtStart:2})}}function Xa(r){let e;return{c(){e=G("li"),e.textContent="Click to add a new point"},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Wa(r){let e;return{c(){e=G("li"),e.textContent="Click to move the point here"},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Ha(r){let e,n,t;function o(l,u){return l[0]?Wa:Xa}let i=o(r),s=i(r);return{c(){e=G("ul"),s.c(),n=F(),t=G("li"),t.innerHTML=`Press Escape - to cancel`},m(l,u){$(l,e,u),s.m(e,null),z(e,n),z(e,t)},p(l,[u]){i!==(i=o(l))&&(s.d(1),s=i(l),s&&(s.c(),s.m(e,n)))},i:ee,o:ee,d(l){l&&y(e),s.d()}}}function Za(r,e,n){let{editingExisting:t}=e;return r.$$set=o=>{"editingExisting"in o&&n(0,t=o.editingExisting)},[t]}class vs extends te{constructor(e){super(),ne(this,e,Za,Ha,x,{editingExisting:0})}}function Ka(r){let e,n,t;return{c(){e=q("Undo ("),n=q(r[0]),t=q(")")},m(o,i){$(o,e,i),$(o,n,i),$(o,t,i)},p(o,i){i&1&&ge(n,o[0])},d(o){o&&(y(e),y(n),y(t))}}}function Va(r){let e;return{c(){e=q("Undo")},m(n,t){$(n,e,t)},p:ee,d(n){n&&y(e)}}}function Qa(r){let e;function n(i,s){return i[0]==0?Va:Ka}let t=n(r),o=t(r);return{c(){o.c(),e=fe()},m(i,s){o.m(i,s),$(i,e,s)},p(i,s){t===(t=n(i))&&o?o.p(i,s):(o.d(1),o=t(i),o&&(o.c(),o.m(e.parentNode,e)))},d(i){i&&y(e),o.d(i)}}}function xa(r){let e,n,t,o;return e=new ae({props:{disabled:r[0]==0,$$slots:{default:[Qa]},$$scope:{ctx:r}}}),e.$on("click",r[1]),{c(){P(e.$$.fragment),n=F(),t=G("ul"),t.innerHTML=`
  • Click +***************************************************************************** */function $a(r,e){var n={label:0,sent:function(){if(i[0]&1)throw i[1];return i[1]},trys:[],ops:[]},t,o,i,s;return s={next:l(0),throw:l(1),return:l(2)},typeof Symbol=="function"&&(s[Symbol.iterator]=function(){return this}),s;function l(a){return function(f){return u([a,f])}}function u(a){if(t)throw new TypeError("Generator is already executing.");for(;n;)try{if(t=1,o&&(i=a[0]&2?o.return:a[0]?o.throw||((i=o.return)&&i.call(o),0):o.next)&&!(i=i.call(o,a[1])).done)return i;switch(o=0,i&&(a=[a[0]&2,i.value]),a[0]){case 0:case 1:i=a;break;case 4:return n.label++,{value:a[1],done:!1};case 5:n.label++,o=a[1],a=[0];continue;case 7:a=n.ops.pop(),n.trys.pop();continue;default:if(i=n.trys,!(i=i.length>0&&i[i.length-1])&&(a[0]===6||a[0]===2)){n=0;continue}if(a[0]===3&&(!i||a[1]>i[0]&&a[1]e?1:r0){if(e.right===null)break;if(n(r,e.right.key)>0){var l=e.right;if(e.right=l.left,l.left=e,e=l,e.right===null)break}o.right=e,o=e,e=e.right}else break}return o.right=e.left,i.left=e.right,e.left=t.right,e.right=t.left,e}function fr(r,e,n,t){var o=new _t(r,e);if(n===null)return o.left=o.right=null,o;n=ct(r,n,t);var i=t(r,n.key);return i<0?(o.left=n.left,o.right=n,n.left=null):i>=0&&(o.right=n.right,o.left=n,n.right=null),o}function ji(r,e,n){var t=null,o=null;if(e){e=ct(r,e,n);var i=n(e.key,r);i===0?(t=e.left,o=e.right):i<0?(o=e.right,e.right=null,t=e):(t=e.left,e.left=null,o=e)}return{left:t,right:o}}function wa(r,e,n){return e===null?r:(r===null||(e=ct(r.key,e,n),e.left=r),e)}function Mr(r,e,n,t,o){if(r){t(""+e+(n?"└── ":"├── ")+o(r)+` +`);var i=e+(n?" ":"│ ");r.left&&Mr(r.left,i,!1,t,o),r.right&&Mr(r.right,i,!0,t,o)}}var Jr=function(){function r(e){e===void 0&&(e=ya),this._root=null,this._size=0,this._comparator=e}return r.prototype.insert=function(e,n){return this._size++,this._root=fr(e,n,this._root,this._comparator)},r.prototype.add=function(e,n){var t=new _t(e,n);this._root===null&&(t.left=t.right=null,this._size++,this._root=t);var o=this._comparator,i=ct(e,this._root,o),s=o(e,i.key);return s===0?this._root=i:(s<0?(t.left=i.left,t.right=i,i.left=null):s>0&&(t.right=i.right,t.left=i,i.right=null),this._size++,this._root=t),this._root},r.prototype.remove=function(e){this._root=this._remove(e,this._root,this._comparator)},r.prototype._remove=function(e,n,t){var o;if(n===null)return null;n=ct(e,n,t);var i=t(e,n.key);return i===0?(n.left===null?o=n.right:(o=ct(e,n.left,t),o.right=n.right),this._size--,o):n},r.prototype.pop=function(){var e=this._root;if(e){for(;e.left;)e=e.left;return this._root=ct(e.key,this._root,this._comparator),this._root=this._remove(e.key,this._root,this._comparator),{key:e.key,data:e.data}}return null},r.prototype.findStatic=function(e){for(var n=this._root,t=this._comparator;n;){var o=t(e,n.key);if(o===0)return n;o<0?n=n.left:n=n.right}return null},r.prototype.find=function(e){return this._root&&(this._root=ct(e,this._root,this._comparator),this._comparator(e,this._root.key)!==0)?null:this._root},r.prototype.contains=function(e){for(var n=this._root,t=this._comparator;n;){var o=t(e,n.key);if(o===0)return!0;o<0?n=n.left:n=n.right}return!1},r.prototype.forEach=function(e,n){for(var t=this._root,o=[],i=!1;!i;)t!==null?(o.push(t),t=t.left):o.length!==0?(t=o.pop(),e.call(n,t),t=t.right):i=!0;return this},r.prototype.range=function(e,n,t,o){for(var i=[],s=this._comparator,l=this._root,u;i.length!==0||l;)if(l)i.push(l),l=l.left;else{if(l=i.pop(),u=s(l.key,n),u>0)break;if(s(l.key,e)>=0&&t.call(o,l))return this;l=l.right}return this},r.prototype.keys=function(){var e=[];return this.forEach(function(n){var t=n.key;return e.push(t)}),e},r.prototype.values=function(){var e=[];return this.forEach(function(n){var t=n.data;return e.push(t)}),e},r.prototype.min=function(){return this._root?this.minNode(this._root).key:null},r.prototype.max=function(){return this._root?this.maxNode(this._root).key:null},r.prototype.minNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.left;)e=e.left;return e},r.prototype.maxNode=function(e){if(e===void 0&&(e=this._root),e)for(;e.right;)e=e.right;return e},r.prototype.at=function(e){for(var n=this._root,t=!1,o=0,i=[];!t;)if(n)i.push(n),n=n.left;else if(i.length>0){if(n=i.pop(),o===e)return n;o++,n=n.right}else t=!0;return null},r.prototype.next=function(e){var n=this._root,t=null;if(e.right){for(t=e.right;t.left;)t=t.left;return t}for(var o=this._comparator;n;){var i=o(e.key,n.key);if(i===0)break;i<0?(t=n,n=n.left):n=n.right}return t},r.prototype.prev=function(e){var n=this._root,t=null;if(e.left!==null){for(t=e.left;t.right;)t=t.right;return t}for(var o=this._comparator;n;){var i=o(e.key,n.key);if(i===0)break;i<0?n=n.left:(t=n,n=n.right)}return t},r.prototype.clear=function(){return this._root=null,this._size=0,this},r.prototype.toList=function(){return Sa(this._root)},r.prototype.load=function(e,n,t){n===void 0&&(n=[]),t===void 0&&(t=!1);var o=e.length,i=this._comparator;if(t&&Cr(e,n,0,o-1,i),this._root===null)this._root=Pr(e,n,0,o),this._size=o;else{var s=Ea(this.toList(),ka(e,n),i);o=this._size+o,this._root=Lr({head:s},0,o)}return this},r.prototype.isEmpty=function(){return this._root===null},Object.defineProperty(r.prototype,"size",{get:function(){return this._size},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"root",{get:function(){return this._root},enumerable:!0,configurable:!0}),r.prototype.toString=function(e){e===void 0&&(e=function(t){return String(t.key)});var n=[];return Mr(this._root,"",!0,function(t){return n.push(t)},e),n.join("")},r.prototype.update=function(e,n,t){var o=this._comparator,i=ji(e,this._root,o),s=i.left,l=i.right;o(e,n)<0?l=fr(n,t,l,o):s=fr(n,t,s,o),this._root=wa(s,l,o)},r.prototype.split=function(e){return ji(e,this._root,this._comparator)},r.prototype[Symbol.iterator]=function(){var e;return $a(this,function(n){switch(n.label){case 0:e=this.minNode(),n.label=1;case 1:return e?[4,e]:[3,3];case 2:return n.sent(),e=this.next(e),[3,1];case 3:return[2]}})},r}();function Pr(r,e,n,t){var o=t-n;if(o>0){var i=n+Math.floor(o/2),s=r[i],l=e[i],u=new _t(s,l);return u.left=Pr(r,e,n,i),u.right=Pr(r,e,i+1,t),u}return null}function ka(r,e){for(var n=new _t(null,null),t=n,o=0;o0?(e=i=i.next=n.pop(),e=e.right):t=!0;return i.next=null,o.next}function Lr(r,e,n){var t=n-e;if(t>0){var o=e+Math.floor(t/2),i=Lr(r,e,o),s=r.head;return s.left=i,r.head=r.head.next,s.right=Lr(r,o+1,n),s}return null}function Ea(r,e,n){for(var t=new _t(null,null),o=t,i=r,s=e;i!==null&&s!==null;)n(i.key,s.key)<0?(o.next=i,i=i.next):(o.next=s,s=s.next),o=o.next;return i!==null?o.next=i:s!==null&&(o.next=s),t.next}function Cr(r,e,n,t,o){if(!(n>=t)){for(var i=r[n+t>>1],s=n-1,l=t+1;;){do s++;while(o(r[s],i)<0);do l--;while(o(r[l],i)>0);if(s>=l)break;var u=r[s];r[s]=r[l],r[l]=u,u=e[s],e[s]=e[l],e[l]=u}Cr(r,e,n,l,o),Cr(r,e,l+1,t,o)}}function Ge(r,e){if(!(r instanceof e))throw new TypeError("Cannot call a class as a function")}function Ii(r,e){for(var n=0;nt.x?1:n.yt.y?1:0}}]);function r(e,n){Ge(this,r),e.events===void 0?e.events=[this]:e.events.push(this),this.point=e,this.isLeft=n}return Ae(r,[{key:"link",value:function(n){if(n.point===this.point)throw new Error("Tried to link already linked events");for(var t=n.point.events,o=0,i=t.length;o=0&&p>=0?fm?-1:0:a<0&&p<0?fm?1:0:pa?1:0}}}]),r}(),Fa=0,Yn=function(){Ae(r,null,[{key:"compare",value:function(n,t){var o=n.leftSE.point.x,i=t.leftSE.point.x,s=n.rightSE.point.x,l=t.rightSE.point.x;if(lu&&a>f)return-1;var p=n.comparePoint(t.leftSE.point);if(p<0)return 1;if(p>0)return-1;var m=t.comparePoint(n.rightSE.point);return m!==0?m:-1}if(o>i){if(ua&&u>c)return 1;var g=t.comparePoint(n.leftSE.point);if(g!==0)return g;var b=n.comparePoint(t.rightSE.point);return b<0?1:b>0?-1:1}if(ua)return 1;if(sl){var S=n.comparePoint(t.rightSE.point);if(S<0)return 1;if(S>0)return-1}if(s!==l){var d=f-u,_=s-o,E=c-a,h=l-i;if(d>_&&Eh)return-1}return s>l?1:sc?1:n.idt.id?1:0}}]);function r(e,n,t,o){Ge(this,r),this.id=++Fa,this.leftSE=e,e.segment=this,e.otherSE=n,this.rightSE=n,n.segment=this,n.otherSE=e,this.rings=t,this.windings=o}return Ae(r,[{key:"replaceRightSE",value:function(n){this.rightSE=n,this.rightSE.segment=this,this.rightSE.otherSE=this.leftSE,this.leftSE.otherSE=this.rightSE}},{key:"bbox",value:function(){var n=this.leftSE.point.y,t=this.rightSE.point.y;return{ll:{x:this.leftSE.point.x,y:nt?n:t}}}},{key:"vector",value:function(){return{x:this.rightSE.point.x-this.leftSE.point.x,y:this.rightSE.point.y-this.leftSE.point.y}}},{key:"isAnEndpoint",value:function(n){return n.x===this.leftSE.point.x&&n.y===this.leftSE.point.y||n.x===this.rightSE.point.x&&n.y===this.rightSE.point.y}},{key:"comparePoint",value:function(n){if(this.isAnEndpoint(n))return 0;var t=this.leftSE.point,o=this.rightSE.point,i=this.vector();if(t.x===o.x)return n.x===t.x?0:n.x0&&u.swapEvents(),Ve.comparePoints(this.leftSE.point,this.rightSE.point)>0&&this.swapEvents(),o&&(i.checkForConsuming(),s.checkForConsuming()),t}},{key:"swapEvents",value:function(){var n=this.rightSE;this.rightSE=this.leftSE,this.leftSE=n,this.leftSE.isLeft=!0,this.rightSE.isLeft=!1;for(var t=0,o=this.windings.length;t0){var s=t;t=o,o=s}if(t.prev===o){var l=t;t=o,o=l}for(var u=0,a=o.rings.length;u0)i=t,s=n,l=-1;else throw new Error("Tried to create degenerate segment at [".concat(n.x,", ").concat(n.y,"]"));var a=new Ve(i,!0),f=new Ve(s,!1);return new r(a,f,[o],[l])}}]),r}(),Di=function(){function r(e,n,t){if(Ge(this,r),!Array.isArray(e)||e.length===0)throw new Error("Input geometry is not a valid Polygon or MultiPolygon");if(this.poly=n,this.isExterior=t,this.segments=[],typeof e[0][0]!="number"||typeof e[0][1]!="number")throw new Error("Input geometry is not a valid Polygon or MultiPolygon");var o=sn.round(e[0][0],e[0][1]);this.bbox={ll:{x:o.x,y:o.y},ur:{x:o.x,y:o.y}};for(var i=o,s=1,l=e.length;sthis.bbox.ur.x&&(this.bbox.ur.x=u.x),u.y>this.bbox.ur.y&&(this.bbox.ur.y=u.y),i=u)}(o.x!==i.x||o.y!==i.y)&&this.segments.push(Yn.fromRing(i,o,this))}return Ae(r,[{key:"getSweepEvents",value:function(){for(var n=[],t=0,o=this.segments.length;tthis.bbox.ur.x&&(this.bbox.ur.x=i.bbox.ur.x),i.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=i.bbox.ur.y),this.interiorRings.push(i)}this.multiPoly=n}return Ae(r,[{key:"getSweepEvents",value:function(){for(var n=this.exteriorRing.getSweepEvents(),t=0,o=this.interiorRings.length;tthis.bbox.ur.x&&(this.bbox.ur.x=i.bbox.ur.x),i.bbox.ur.y>this.bbox.ur.y&&(this.bbox.ur.y=i.bbox.ur.y),this.polys.push(i)}this.isSubject=n}return Ae(r,[{key:"getSweepEvents",value:function(){for(var n=[],t=0,o=this.polys.length;t0&&(n=i)}for(var s=n.segment.prevInResult(),l=s?s.prevInResult():null;;){if(!s)return null;if(!l)return s.ringOut;if(l.ringOut!==s.ringOut)return l.ringOut.enclosingRing()!==s.ringOut?s.ringOut:s.ringOut.enclosingRing();s=l.prevInResult(),l=s?s.prevInResult():null}}}]),r}(),zi=function(){function r(e){Ge(this,r),this.exteriorRing=e,e.poly=this,this.interiorRings=[]}return Ae(r,[{key:"addInterior",value:function(n){this.interiorRings.push(n),n.poly=this}},{key:"getGeom",value:function(){var n=[this.exteriorRing.getGeom()];if(n[0]===null)return null;for(var t=0,o=this.interiorRings.length;t1&&arguments[1]!==void 0?arguments[1]:Yn.compare;Ge(this,r),this.queue=e,this.tree=new Jr(n),this.segments=[]}return Ae(r,[{key:"process",value:function(n){var t=n.segment,o=[];if(n.consumedBy)return n.isLeft?this.queue.remove(n.otherSE):this.tree.remove(t),o;var i=n.isLeft?this.tree.insert(t):this.tree.find(t);if(!i)throw new Error("Unable to find segment #".concat(t.id," ")+"[".concat(t.leftSE.point.x,", ").concat(t.leftSE.point.y,"] -> ")+"[".concat(t.rightSE.point.x,", ").concat(t.rightSE.point.y,"] ")+"in SweepLine tree. Please submit a bug report.");for(var s=i,l=i,u=void 0,a=void 0;u===void 0;)s=this.tree.prev(s),s===null?u=null:s.key.consumedBy===void 0&&(u=s.key);for(;a===void 0;)l=this.tree.next(l),l===null?a=null:l.key.consumedBy===void 0&&(a=l.key);if(n.isLeft){var f=null;if(u){var c=u.getIntersection(t);if(c!==null&&(t.isAnEndpoint(c)||(f=c),!u.isAnEndpoint(c)))for(var p=this._splitSafely(u,c),m=0,g=p.length;m0?(this.tree.remove(t),o.push(n)):(this.segments.push(t),t.prev=u)}else{if(u&&a){var D=u.getIntersection(a);if(D!==null){if(!u.isAnEndpoint(D))for(var I=this._splitSafely(u,D),A=0,R=I.length;AJi)throw new Error("Infinite loop when putting segment endpoints in a priority queue (queue size too big). Please file a bug report.");for(var h=new ja(b),M=b.size,O=b.pop();O;){var B=O.key;if(b.size===M){var D=B.segment;throw new Error("Unable to pop() ".concat(B.isLeft?"left":"right"," SweepEvent ")+"[".concat(B.point.x,", ").concat(B.point.y,"] from segment #").concat(D.id," ")+"[".concat(D.leftSE.point.x,", ").concat(D.leftSE.point.y,"] -> ")+"[".concat(D.rightSE.point.x,", ").concat(D.rightSE.point.y,"] from queue. ")+"Please file a bug report.")}if(b.size>Ji)throw new Error("Infinite loop when passing sweep line over endpoints (queue size too big). Please file a bug report.");if(h.segments.length>Ia)throw new Error("Infinite loop when passing sweep line over endpoints (too many sweep line segments). Please file a bug report.");for(var I=h.process(B),A=0,R=I.length;A1?n-1:0),o=1;o1?n-1:0),o=1;o1?n-1:0),o=1;o1?n-1:0),o=1;oUa(r,"name",{value:e,configurable:!0});function _s(r,e){var n=vs(e),t=null;return r.type==="FeatureCollection"?t=bs(r):t=Yr(wn.union(r.geometry.coordinates)),t.geometry.coordinates.forEach(function(o){n.geometry.coordinates.push(o[0])}),n}tr(_s,"mask");function bs(r){var e=r.features.length===2?wn.union(r.features[0].geometry.coordinates,r.features[1].geometry.coordinates):wn.union.apply(wn,r.features.map(function(n){return n.geometry.coordinates}));return Yr(e)}tr(bs,"unionFc");function Yr(r){return ll(r)}tr(Yr,"createGeomFromPolygonClippingOutput");function vs(r){var e=[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]],n=r&&r.geometry.coordinates||e;return ul(n)}tr(vs,"createMask");var Yi=_s;function za(r){let e,n;const t=[ue(r[0],"boundary"),{paint:{"fill-color":"black","fill-opacity":.5}}];let o={};for(let i=0;in(3,t=l));let{cfg:o}=e,{boundaryGeojson:i}=e,{fitBoundsAtStart:s=!1}=e;return(al("setCamera")||s)&&(t==null||t.fitBounds(To(i),{padding:20,animate:!1})),r.$$set=l=>{"cfg"in l&&n(0,o=l.cfg),"boundaryGeojson"in l&&n(1,i=l.boundaryGeojson),"fitBoundsAtStart"in l&&n(2,s=l.fitBoundsAtStart)},[o,i,s]}class Xa extends te{constructor(e){super(),ne(this,e,Ya,Ja,x,{cfg:0,boundaryGeojson:1,fitBoundsAtStart:2})}}function Wa(r){let e;return{c(){e=G("li"),e.textContent="Click to add a new point"},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Ha(r){let e;return{c(){e=G("li"),e.textContent="Click to move the point here"},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Za(r){let e,n,t;function o(l,u){return l[0]?Ha:Wa}let i=o(r),s=i(r);return{c(){e=G("ul"),s.c(),n=F(),t=G("li"),t.innerHTML=`Press Escape + to cancel`},m(l,u){$(l,e,u),s.m(e,null),z(e,n),z(e,t)},p(l,[u]){i!==(i=o(l))&&(s.d(1),s=i(l),s&&(s.c(),s.m(e,n)))},i:ee,o:ee,d(l){l&&y(e),s.d()}}}function Ka(r,e,n){let{editingExisting:t}=e;return r.$$set=o=>{"editingExisting"in o&&n(0,t=o.editingExisting)},[t]}class $s extends te{constructor(e){super(),ne(this,e,Ka,Za,x,{editingExisting:0})}}function Va(r){let e,n,t;return{c(){e=q("Undo ("),n=q(r[0]),t=q(")")},m(o,i){$(o,e,i),$(o,n,i),$(o,t,i)},p(o,i){i&1&&ge(n,o[0])},d(o){o&&(y(e),y(n),y(t))}}}function Qa(r){let e;return{c(){e=q("Undo")},m(n,t){$(n,e,t)},p:ee,d(n){n&&y(e)}}}function xa(r){let e;function n(i,s){return i[0]==0?Qa:Va}let t=n(r),o=t(r);return{c(){o.c(),e=fe()},m(i,s){o.m(i,s),$(i,e,s)},p(i,s){t===(t=n(i))&&o?o.p(i,s):(o.d(1),o=t(i),o&&(o.c(),o.m(e.parentNode,e)))},d(i){i&&y(e),o.d(i)}}}function ef(r){let e,n,t,o;return e=new ae({props:{disabled:r[0]==0,$$slots:{default:[xa]},$$scope:{ctx:r}}}),e.$on("click",r[1]),{c(){P(e.$$.fragment),n=F(),t=G("ul"),t.innerHTML=`
  • Click the map to add a vertex
  • Click a vertex to delete it
  • Drag a vertex or the polygon to move it
  • Press Control+Z @@ -29,9 +29,9 @@ and limitations under the License. or double click to finish
  • Press Escape - to cancel
  • `},m(i,s){L(e,i,s),$(i,n,s),$(i,t,s),o=!0},p(i,[s]){const l={};s&1&&(l.disabled=i[0]==0),s&9&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){o||(w(e.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),o=!1},d(i){i&&(y(n),y(t)),C(e,i)}}}function ef(r,e,n){let t,o;Y(r,It,s=>n(2,t=s)),Y(r,os,s=>n(0,o=s));function i(){t.undo()}return[o,i]}class $s extends te{constructor(e){super(),ne(this,e,ef,xa,x,{})}}const ys=at(Gt()),kn=at(Gt()),ws=at(!0),Xr=at(0);function Xi(r,e,n){const t=r.slice();return t[9]=e[n],t}function Wi(r){let e,n,t=r[9].place_name+"",o,i,s;function l(...u){return r[5](r[9],...u)}return{c(){e=G("li"),n=G("a"),o=q(t),T(n,"href","#")},m(u,a){$(u,e,a),z(e,n),z(n,o),i||(s=he(n,"click",l),i=!0)},p(u,a){r=u,a&2&&t!==(t=r[9].place_name+"")&&ge(o,t)},d(u){u&&y(e),i=!1,s()}}}function tf(r){let e,n,t,o,i;function s(f){r[4](f)}let l={label:"Add waypoint by search"};r[0]!==void 0&&(l.value=r[0]),e=new er({props:l}),K.push(()=>V(e,"value",s));let u=je(r[1].features),a=[];for(let f=0;fn=!1)),e.$set(p),c&6){u=je(f[1].features);let m;for(m=0;mn(6,t=p)),Y(r,kn,p=>n(1,o=p)),Y(r,He,p=>n(7,i=p));let{cfg:s}=e,l="";async function u(p){if(!p){Be(kn,o=Gt(),o);return}let m=new URLSearchParams({country:"gb",proximity:i.getCenter().toArray().join(","),fuzzyMatch:"true",key:s.maptilerApiKey}).toString(),h=`https://api.maptiler.com/geocoding/${p}.json?${m}`,v=await(await fetch(h)).json(),E=1;for(let d of v.features)d.properties.number=E++;Be(kn,o=v,o)}function a(p,m){p.preventDefault(),t.addSnappedWaypoint(m),n(0,l="")}function f(p){l=p,n(0,l)}const c=(p,m)=>a(m,p.center);return r.$$set=p=>{"cfg"in p&&n(3,s=p.cfg)},r.$$.update=()=>{r.$$.dirty&1&&u(l)},[l,o,a,s,f,c]}class rf extends te{constructor(e){super(),ne(this,e,nf,tf,x,{cfg:3})}}function of(r){let e,n,t;return{c(){e=q("Undo ("),n=q(r[3]),t=q(")")},m(o,i){$(o,e,i),$(o,n,i),$(o,t,i)},p(o,i){i&8&&ge(n,o[3])},d(o){o&&(y(e),y(n),y(t))}}}function sf(r){let e;return{c(){e=q("Undo")},m(n,t){$(n,e,t)},p:ee,d(n){n&&y(e)}}}function lf(r){let e;function n(i,s){return i[3]==0?sf:of}let t=n(r),o=t(r);return{c(){o.c(),e=fe()},m(i,s){o.m(i,s),$(i,e,s)},p(i,s){t===(t=n(i))&&o?o.p(i,s):(o.d(1),o=t(i),o&&(o.c(),o.m(e.parentNode,e)))},d(i){i&&y(e),o.d(i)}}}function uf(r){let e,n,t,o;return t=new ae({props:{$$slots:{default:[ff]},$$scope:{ctx:r}}}),t.$on("click",r[6]),{c(){e=G("p"),e.innerHTML=`Drawing points anywhere. Press s - or click below to snap to roads`,n=F(),P(t.$$.fragment),Pe(e,"background","blue"),Pe(e,"color","white"),Pe(e,"padding","8px")},m(i,s){$(i,e,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&1024&&(l.$$scope={dirty:s,ctx:i}),t.$set(l)},i(i){o||(w(t.$$.fragment,i),o=!0)},o(i){k(t.$$.fragment,i),o=!1},d(i){i&&(y(e),y(n)),C(t,i)}}}function af(r){let e,n,t,o;return t=new ae({props:{$$slots:{default:[cf]},$$scope:{ctx:r}}}),t.$on("click",r[6]),{c(){e=G("p"),e.innerHTML=`Snapping to existing roads. Press s - or click below to draw anywhere`,n=F(),P(t.$$.fragment),Pe(e,"background","red"),Pe(e,"color","white"),Pe(e,"padding","8px")},m(i,s){$(i,e,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&1024&&(l.$$scope={dirty:s,ctx:i}),t.$set(l)},i(i){o||(w(t.$$.fragment,i),o=!0)},o(i){k(t.$$.fragment,i),o=!1},d(i){i&&(y(e),y(n)),C(t,i)}}}function ff(r){let e;return{c(){e=q("Snap to roads")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function cf(r){let e;return{c(){e=q("Draw anywhere")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function pf(r){let e;return{c(){e=q("Add points to end")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function mf(r){let e;return{c(){e=q("Avoid doubling back")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function df(r){let e,n,t,o,i,s;function l(c){r[8](c)}let u={hint:"Keep clicking to add more points to the end of the route",$$slots:{default:[pf]},$$scope:{ctx:r}};r[0]!==void 0&&(u.checked=r[0]),e=new ht({props:u}),K.push(()=>V(e,"checked",l));function a(c){r[9](c)}let f={hint:"Try to make the route avoid using the same streets with multiple waypoints",$$slots:{default:[mf]},$$scope:{ctx:r}};return r[2].avoidDoublingBack!==void 0&&(f.checked=r[2].avoidDoublingBack),o=new ht({props:f}),K.push(()=>V(o,"checked",a)),{c(){P(e.$$.fragment),t=F(),P(o.$$.fragment)},m(c,p){L(e,c,p),$(c,t,p),L(o,c,p),s=!0},p(c,p){const m={};p&1024&&(m.$$scope={dirty:p,ctx:c}),!n&&p&1&&(n=!0,m.checked=c[0],Q(()=>n=!1)),e.$set(m);const h={};p&1024&&(h.$$scope={dirty:p,ctx:c}),!i&&p&4&&(i=!0,h.checked=c[2].avoidDoublingBack,Q(()=>i=!1)),o.$set(h)},i(c){s||(w(e.$$.fragment,c),w(o.$$.fragment,c),s=!0)},o(c){k(e.$$.fragment,c),k(o.$$.fragment,c),s=!1},d(c){c&&y(t),C(e,c),C(o,c)}}}function Hi(r){let e,n;return e=new rf({props:{cfg:r[1]}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&2&&(i.cfg=t[1]),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function gf(r){let e,n,t,o,i,s,l,u,a,f,c;e=new ae({props:{disabled:r[3]==0,$$slots:{default:[lf]},$$scope:{ctx:r}}}),e.$on("click",r[5]);const p=[af,uf],m=[];function h(v,E){return v[4]?0:1}t=h(r),o=m[t]=p[t](r),u=new To({props:{small:!0,$$slots:{default:[df]},$$scope:{ctx:r}}});let b=r[1].maptilerApiKey&&Hi(r);return{c(){P(e.$$.fragment),n=F(),o.c(),i=F(),s=G("ul"),s.innerHTML=`
  • Click + to cancel
  • `},m(i,s){L(e,i,s),$(i,n,s),$(i,t,s),o=!0},p(i,[s]){const l={};s&1&&(l.disabled=i[0]==0),s&9&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){o||(w(e.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),o=!1},d(i){i&&(y(n),y(t)),C(e,i)}}}function tf(r,e,n){let t,o;Y(r,It,s=>n(2,t=s)),Y(r,ss,s=>n(0,o=s));function i(){t.undo()}return[o,i]}class ys extends te{constructor(e){super(),ne(this,e,tf,ef,x,{})}}const ws=at(Gt()),kn=at(Gt()),ks=at(!0),Xr=at(0);function Xi(r,e,n){const t=r.slice();return t[9]=e[n],t}function Wi(r){let e,n,t=r[9].place_name+"",o,i,s;function l(...u){return r[5](r[9],...u)}return{c(){e=G("li"),n=G("a"),o=q(t),T(n,"href","#")},m(u,a){$(u,e,a),z(e,n),z(n,o),i||(s=he(n,"click",l),i=!0)},p(u,a){r=u,a&2&&t!==(t=r[9].place_name+"")&&ge(o,t)},d(u){u&&y(e),i=!1,s()}}}function nf(r){let e,n,t,o,i;function s(f){r[4](f)}let l={label:"Add waypoint by search"};r[0]!==void 0&&(l.value=r[0]),e=new er({props:l}),K.push(()=>V(e,"value",s));let u=je(r[1].features),a=[];for(let f=0;fn=!1)),e.$set(p),c&6){u=je(f[1].features);let m;for(m=0;mn(6,t=p)),Y(r,kn,p=>n(1,o=p)),Y(r,qe,p=>n(7,i=p));let{cfg:s}=e,l="";async function u(p){if(!p){Be(kn,o=Gt(),o);return}let m=new URLSearchParams({country:"gb",proximity:i.getCenter().toArray().join(","),fuzzyMatch:"true",key:s.maptilerApiKey}).toString(),g=`https://api.maptiler.com/geocoding/${p}.json?${m}`,v=await(await fetch(g)).json(),S=1;for(let d of v.features)d.properties.number=S++;Be(kn,o=v,o)}function a(p,m){p.preventDefault(),t.addSnappedWaypoint(m),n(0,l="")}function f(p){l=p,n(0,l)}const c=(p,m)=>a(m,p.center);return r.$$set=p=>{"cfg"in p&&n(3,s=p.cfg)},r.$$.update=()=>{r.$$.dirty&1&&u(l)},[l,o,a,s,f,c]}class of extends te{constructor(e){super(),ne(this,e,rf,nf,x,{cfg:3})}}function sf(r){let e,n,t;return{c(){e=q("Undo ("),n=q(r[3]),t=q(")")},m(o,i){$(o,e,i),$(o,n,i),$(o,t,i)},p(o,i){i&8&&ge(n,o[3])},d(o){o&&(y(e),y(n),y(t))}}}function lf(r){let e;return{c(){e=q("Undo")},m(n,t){$(n,e,t)},p:ee,d(n){n&&y(e)}}}function uf(r){let e;function n(i,s){return i[3]==0?lf:sf}let t=n(r),o=t(r);return{c(){o.c(),e=fe()},m(i,s){o.m(i,s),$(i,e,s)},p(i,s){t===(t=n(i))&&o?o.p(i,s):(o.d(1),o=t(i),o&&(o.c(),o.m(e.parentNode,e)))},d(i){i&&y(e),o.d(i)}}}function af(r){let e,n,t,o;return t=new ae({props:{$$slots:{default:[cf]},$$scope:{ctx:r}}}),t.$on("click",r[6]),{c(){e=G("p"),e.innerHTML=`Drawing points anywhere. Press s + or click below to snap to roads`,n=F(),P(t.$$.fragment),Pe(e,"background","blue"),Pe(e,"color","white"),Pe(e,"padding","8px")},m(i,s){$(i,e,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&1024&&(l.$$scope={dirty:s,ctx:i}),t.$set(l)},i(i){o||(w(t.$$.fragment,i),o=!0)},o(i){k(t.$$.fragment,i),o=!1},d(i){i&&(y(e),y(n)),C(t,i)}}}function ff(r){let e,n,t,o;return t=new ae({props:{$$slots:{default:[pf]},$$scope:{ctx:r}}}),t.$on("click",r[6]),{c(){e=G("p"),e.innerHTML=`Snapping to existing roads. Press s + or click below to draw anywhere`,n=F(),P(t.$$.fragment),Pe(e,"background","red"),Pe(e,"color","white"),Pe(e,"padding","8px")},m(i,s){$(i,e,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&1024&&(l.$$scope={dirty:s,ctx:i}),t.$set(l)},i(i){o||(w(t.$$.fragment,i),o=!0)},o(i){k(t.$$.fragment,i),o=!1},d(i){i&&(y(e),y(n)),C(t,i)}}}function cf(r){let e;return{c(){e=q("Snap to roads")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function pf(r){let e;return{c(){e=q("Draw anywhere")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function mf(r){let e;return{c(){e=q("Add points to end")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function df(r){let e;return{c(){e=q("Avoid doubling back")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function gf(r){let e,n,t,o,i,s;function l(c){r[8](c)}let u={hint:"Keep clicking to add more points to the end of the route",$$slots:{default:[mf]},$$scope:{ctx:r}};r[0]!==void 0&&(u.checked=r[0]),e=new ht({props:u}),K.push(()=>V(e,"checked",l));function a(c){r[9](c)}let f={hint:"Try to make the route avoid using the same streets with multiple waypoints",$$slots:{default:[df]},$$scope:{ctx:r}};return r[2].avoidDoublingBack!==void 0&&(f.checked=r[2].avoidDoublingBack),o=new ht({props:f}),K.push(()=>V(o,"checked",a)),{c(){P(e.$$.fragment),t=F(),P(o.$$.fragment)},m(c,p){L(e,c,p),$(c,t,p),L(o,c,p),s=!0},p(c,p){const m={};p&1024&&(m.$$scope={dirty:p,ctx:c}),!n&&p&1&&(n=!0,m.checked=c[0],Q(()=>n=!1)),e.$set(m);const g={};p&1024&&(g.$$scope={dirty:p,ctx:c}),!i&&p&4&&(i=!0,g.checked=c[2].avoidDoublingBack,Q(()=>i=!1)),o.$set(g)},i(c){s||(w(e.$$.fragment,c),w(o.$$.fragment,c),s=!0)},o(c){k(e.$$.fragment,c),k(o.$$.fragment,c),s=!1},d(c){c&&y(t),C(e,c),C(o,c)}}}function Hi(r){let e,n;return e=new of({props:{cfg:r[1]}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&2&&(i.cfg=t[1]),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function hf(r){let e,n,t,o,i,s,l,u,a,f,c;e=new ae({props:{disabled:r[3]==0,$$slots:{default:[uf]},$$scope:{ctx:r}}}),e.$on("click",r[5]);const p=[ff,af],m=[];function g(v,S){return v[4]?0:1}t=g(r),o=m[t]=p[t](r),u=new Do({props:{small:!0,$$slots:{default:[gf]},$$scope:{ctx:r}}});let b=r[1].maptilerApiKey&&Hi(r);return{c(){P(e.$$.fragment),n=F(),o.c(),i=F(),s=G("ul"),s.innerHTML=`
  • Click the map to add points
  • Press s to switch between snapping points to existing roads and drawing anywhere
  • Click and drag any point to move it
  • Click @@ -40,7 +40,7 @@ and limitations under the License. or double click to finish
  • Press Escape - to cancel
  • `,l=F(),P(u.$$.fragment),a=F(),b&&b.c(),f=fe()},m(v,E){L(e,v,E),$(v,n,E),m[t].m(v,E),$(v,i,E),$(v,s,E),$(v,l,E),L(u,v,E),$(v,a,E),b&&b.m(v,E),$(v,f,E),c=!0},p(v,[E]){const d={};E&8&&(d.disabled=v[3]==0),E&1032&&(d.$$scope={dirty:E,ctx:v}),e.$set(d);let g=t;t=h(v),t===g?m[t].p(v,E):(se(),k(m[g],1,1,()=>{m[g]=null}),le(),o=m[t],o?o.p(v,E):(o=m[t]=p[t](v),o.c()),w(o,1),o.m(i.parentNode,i));const S={};E&1029&&(S.$$scope={dirty:E,ctx:v}),u.$set(S),v[1].maptilerApiKey?b?(b.p(v,E),E&2&&w(b,1)):(b=Hi(v),b.c(),w(b,1),b.m(f.parentNode,f)):b&&(se(),k(b,1,1,()=>{b=null}),le())},i(v){c||(w(e.$$.fragment,v),w(o),w(u.$$.fragment,v),w(b),c=!0)},o(v){k(e.$$.fragment,v),k(o),k(u.$$.fragment,v),k(b),c=!1},d(v){v&&(y(n),y(i),y(s),y(l),y(a),y(f)),C(e,v),m[t].d(v),C(u,v),b&&b.d(v)}}}function hf(r,e,n){let t,o,i,s;Y(r,Xe,m=>n(7,t=m)),Y(r,Pn,m=>n(2,o=m)),Y(r,Xr,m=>n(3,i=m)),Y(r,ws,m=>n(4,s=m));let{cfg:l}=e,{extendRoute:u}=e;function a(){t.undo()}function f(){t.toggleSnapMode()}function c(m){u=m,n(0,u)}function p(m){r.$$.not_equal(o.avoidDoublingBack,m)&&(o.avoidDoublingBack=m,Pn.set(o))}return r.$$set=m=>{"cfg"in m&&n(1,l=m.cfg),"extendRoute"in m&&n(0,u=m.extendRoute)},r.$$.update=()=>{r.$$.dirty&133&&t.setRouteConfig({avoid_doubling_back:o.avoidDoublingBack,extend_route:u})},[u,l,o,i,s,a,f,t,c,p]}class ks extends te{constructor(e){super(),ne(this,e,hf,gf,x,{cfg:1,extendRoute:0})}}function _f(r){let e,n,t;return{c(){e=q("Undo ("),n=q(r[0]),t=q(")")},m(o,i){$(o,e,i),$(o,n,i),$(o,t,i)},p(o,i){i&1&&ge(n,o[0])},d(o){o&&(y(e),y(n),y(t))}}}function bf(r){let e;return{c(){e=q("Undo")},m(n,t){$(n,e,t)},p:ee,d(n){n&&y(e)}}}function vf(r){let e;function n(i,s){return i[0]==0?bf:_f}let t=n(r),o=t(r);return{c(){o.c(),e=fe()},m(i,s){o.m(i,s),$(i,e,s)},p(i,s){t===(t=n(i))&&o?o.p(i,s):(o.d(1),o=t(i),o&&(o.c(),o.m(e.parentNode,e)))},d(i){i&&y(e),o.d(i)}}}function $f(r){let e,n,t,o;return e=new ae({props:{disabled:r[0]==0,$$slots:{default:[vf]},$$scope:{ctx:r}}}),e.$on("click",r[1]),{c(){P(e.$$.fragment),n=F(),t=G("ul"),t.innerHTML=`
  • Click + to cancel
  • `,l=F(),P(u.$$.fragment),a=F(),b&&b.c(),f=fe()},m(v,S){L(e,v,S),$(v,n,S),m[t].m(v,S),$(v,i,S),$(v,s,S),$(v,l,S),L(u,v,S),$(v,a,S),b&&b.m(v,S),$(v,f,S),c=!0},p(v,[S]){const d={};S&8&&(d.disabled=v[3]==0),S&1032&&(d.$$scope={dirty:S,ctx:v}),e.$set(d);let _=t;t=g(v),t===_?m[t].p(v,S):(se(),k(m[_],1,1,()=>{m[_]=null}),le(),o=m[t],o?o.p(v,S):(o=m[t]=p[t](v),o.c()),w(o,1),o.m(i.parentNode,i));const E={};S&1029&&(E.$$scope={dirty:S,ctx:v}),u.$set(E),v[1].maptilerApiKey?b?(b.p(v,S),S&2&&w(b,1)):(b=Hi(v),b.c(),w(b,1),b.m(f.parentNode,f)):b&&(se(),k(b,1,1,()=>{b=null}),le())},i(v){c||(w(e.$$.fragment,v),w(o),w(u.$$.fragment,v),w(b),c=!0)},o(v){k(e.$$.fragment,v),k(o),k(u.$$.fragment,v),k(b),c=!1},d(v){v&&(y(n),y(i),y(s),y(l),y(a),y(f)),C(e,v),m[t].d(v),C(u,v),b&&b.d(v)}}}function _f(r,e,n){let t,o,i,s;Y(r,We,m=>n(7,t=m)),Y(r,Pn,m=>n(2,o=m)),Y(r,Xr,m=>n(3,i=m)),Y(r,ks,m=>n(4,s=m));let{cfg:l}=e,{extendRoute:u}=e;function a(){t.undo()}function f(){t.toggleSnapMode()}function c(m){u=m,n(0,u)}function p(m){r.$$.not_equal(o.avoidDoublingBack,m)&&(o.avoidDoublingBack=m,Pn.set(o))}return r.$$set=m=>{"cfg"in m&&n(1,l=m.cfg),"extendRoute"in m&&n(0,u=m.extendRoute)},r.$$.update=()=>{r.$$.dirty&133&&t.setRouteConfig({avoid_doubling_back:o.avoidDoublingBack,extend_route:u})},[u,l,o,i,s,a,f,t,c,p]}class Ss extends te{constructor(e){super(),ne(this,e,_f,hf,x,{cfg:1,extendRoute:0})}}function bf(r){let e,n,t;return{c(){e=q("Undo ("),n=q(r[0]),t=q(")")},m(o,i){$(o,e,i),$(o,n,i),$(o,t,i)},p(o,i){i&1&&ge(n,o[0])},d(o){o&&(y(e),y(n),y(t))}}}function vf(r){let e;return{c(){e=q("Undo")},m(n,t){$(n,e,t)},p:ee,d(n){n&&y(e)}}}function $f(r){let e;function n(i,s){return i[0]==0?vf:bf}let t=n(r),o=t(r);return{c(){o.c(),e=fe()},m(i,s){o.m(i,s),$(i,e,s)},p(i,s){t===(t=n(i))&&o?o.p(i,s):(o.d(1),o=t(i),o&&(o.c(),o.m(e.parentNode,e)))},d(i){i&&y(e),o.d(i)}}}function yf(r){let e,n,t,o;return e=new ae({props:{disabled:r[0]==0,$$slots:{default:[$f]},$$scope:{ctx:r}}}),e.$on("click",r[1]),{c(){P(e.$$.fragment),n=F(),t=G("ul"),t.innerHTML=`
  • Click the map to add points
  • Click and drag any point to move it
  • Click a waypoint to delete it
  • Press Control+Z @@ -48,23 +48,23 @@ and limitations under the License. or double click to finish
  • Press Escape - to cancel
  • `},m(i,s){L(e,i,s),$(i,n,s),$(i,t,s),o=!0},p(i,[s]){const l={};s&1&&(l.disabled=i[0]==0),s&9&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){o||(w(e.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),o=!1},d(i){i&&(y(n),y(t)),C(e,i)}}}function yf(r,e,n){let t,o;Y(r,Xe,s=>n(2,t=s)),Y(r,Xr,s=>n(0,o=s));function i(){t.undo()}return[o,i]}class Ss extends te{constructor(e){super(),ne(this,e,yf,$f,x,{})}}function wf(r){let e;return{c(){e=q("Finish")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function kf(r){let e;return{c(){e=q("Cancel")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Sf(r){let e,n,t,o;return e=new st({props:{$$slots:{default:[wf]},$$scope:{ctx:r}}}),e.$on("click",r[3]),t=new ae({props:{$$slots:{default:[kf]},$$scope:{ctx:r}}}),t.$on("click",r[4]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&32768&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&32768&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function Ef(r){let e,n;return e=new Ss({}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p:ee,i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Mf(r){let e,n;return e=new $s({}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p:ee,i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Pf(r){let e,n;return e=new ks({props:{cfg:r[0],extendRoute:!1}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&1&&(i.cfg=t[0]),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Lf(r){let e,n;return e=new vs({props:{editingExisting:!0}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p:ee,i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Cf(r){let e,n,t,o,i,s,l,u,a,f;i=new Ze({props:{$$slots:{default:[Sf]},$$scope:{ctx:r}}});const c=[Lf,Pf,Mf,Ef],p=[];function m(h,b){return h[2]=="point"?0:h[2]=="route"?1:h[2]=="freehand-polygon"?2:h[2]=="snapped-polygon"?3:-1}return~(l=m(r))&&(u=p[l]=c[l](r)),{c(){e=G("h2"),n=q("Editing "),t=q(r[1]),o=F(),P(i.$$.fragment),s=F(),u&&u.c(),a=fe()},m(h,b){$(h,e,b),z(e,n),z(e,t),$(h,o,b),L(i,h,b),$(h,s,b),~l&&p[l].m(h,b),$(h,a,b),f=!0},p(h,[b]){(!f||b&2)&&ge(t,h[1]);const v={};b&32768&&(v.$$scope={dirty:b,ctx:h}),i.$set(v);let E=l;l=m(h),l===E?~l&&p[l].p(h,b):(u&&(se(),k(p[E],1,1,()=>{p[E]=null}),le()),~l?(u=p[l],u?u.p(h,b):(u=p[l]=c[l](h),u.c()),w(u,1),u.m(a.parentNode,a)):u=null)},i(h){f||(w(i.$$.fragment,h),w(u),f=!0)},o(h){k(i.$$.fragment,h),k(u),f=!1},d(h){h&&(y(e),y(o),y(s),y(a)),C(i,h),~l&&p[l].d(h)}}}function Nf(r,e,n){let t,o,i;Y(r,It,d=>n(8,t=d)),Y(r,Xe,d=>n(9,o=d)),Y(r,nn,d=>n(10,i=d));let{cfg:s}=e,{gjSchemes:l}=e,{id:u}=e,a="",f="",c=null;ot(()=>{let d=null;l.update(S=>(d=S.features.find(_=>_.id==u),d.properties.hide_while_editing=!0,S));let g=d;n(1,a=s.interventionName(g)),g.geometry.type=="LineString"?(o==null||o.editExistingRoute(g),o==null||o.addEventListenerSuccess(p),o==null||o.addEventListenerUpdated(m),o==null||o.addEventListenerFailure(h),n(2,f="route")):g.geometry.type=="Polygon"?g.properties.waypoints?(o==null||o.editExistingArea(g),o==null||o.addEventListenerSuccess(p),o==null||o.addEventListenerUpdated(m),o==null||o.addEventListenerFailure(h),n(2,f="snapped-polygon")):(t==null||t.editExisting(g),t==null||t.addEventListenerSuccess(p),t==null||t.addEventListenerUpdated(m),t==null||t.addEventListenerFailure(h),n(2,f="freehand-polygon")):g.geometry.type=="Point"&&(i==null||i.start(),i==null||i.addEventListenerSuccess(p),i==null||i.addEventListenerFailure(h),n(2,f="point"))}),Ye(()=>{i==null||i.stop(),i==null||i.clearEventListeners(),o==null||o.stop(),o==null||o.clearEventListeners(),t==null||t.stop(),t==null||t.clearEventListeners(),l.update(d=>{let g=d.features.find(S=>S.id==u);return delete g.properties.hide_while_editing,c&&b(g,c),d})});function p(d){d.properties??(d.properties={}),c=d,oe.set({mode:"edit-form",id:u})}function m(d){c=d}function h(){c=null,oe.set({mode:"edit-form",id:u})}function b(d,g){d.geometry=g.geometry,g.properties.length_meters&&(d.properties.length_meters=g.properties.length_meters),g.properties.waypoints&&(d.properties.waypoints=g.properties.waypoints),s.updateFeature(d,g)}function v(){oe.set({mode:"edit-form",id:u})}function E(){c=null,oe.set({mode:"edit-form",id:u})}return r.$$set=d=>{"cfg"in d&&n(0,s=d.cfg),"gjSchemes"in d&&n(5,l=d.gjSchemes),"id"in d&&n(6,u=d.id)},[s,a,f,v,E,l,u]}class Ff extends te{constructor(e){super(),ne(this,e,Nf,Cf,x,{cfg:0,gjSchemes:5,id:6})}}const Sn=at(null),En=at(100);function Zi(r){let e,n;return e=new pa({props:{url:r[3],coordinates:[[r[1].lng,r[1].lat],[r[4].lng,r[1].lat],[r[4].lng,r[4].lat],[r[1].lng,r[4].lat]],$$slots:{default:[Af]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&8&&(i.url=t[3]),o&18&&(i.coordinates=[[t[1].lng,t[1].lat],[t[4].lng,t[1].lat],[t[4].lng,t[4].lat],[t[1].lng,t[4].lat]]),o&545&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Af(r){let e,n;const t=[ue(r[0],"georeferenced-image"),{paint:{"raster-fade-duration":0,"raster-opacity":r[5]/100}}];let o={};for(let i=0;iV(e,"lngLat",l));function a(c){r[8](c)}let f={draggable:!0,$$slots:{default:[Of]},$$scope:{ctx:r}};return r[4]!==void 0&&(f.lngLat=r[4]),o=new mr({props:f}),K.push(()=>V(o,"lngLat",a)),{c(){P(e.$$.fragment),t=F(),P(o.$$.fragment)},m(c,p){L(e,c,p),$(c,t,p),L(o,c,p),s=!0},p(c,p){const m={};p&512&&(m.$$scope={dirty:p,ctx:c}),!n&&p&2&&(n=!0,m.lngLat=c[1],Q(()=>n=!1)),e.$set(m);const h={};p&512&&(h.$$scope={dirty:p,ctx:c}),!i&&p&16&&(i=!0,h.lngLat=c[4],Q(()=>i=!1)),o.$set(h)},i(c){s||(w(e.$$.fragment,c),w(o.$$.fragment,c),s=!0)},o(c){k(e.$$.fragment,c),k(o.$$.fragment,c),s=!1},d(c){c&&y(t),C(e,c),C(o,c)}}}function Rf(r){let e;return{c(){e=G("span"),T(e,"class","dot svelte-1tmbx1c"),Pe(e,"background-color","red")},m(n,t){$(n,e,t)},p:ee,d(n){n&&y(e)}}}function Of(r){let e;return{c(){e=G("span"),T(e,"class","dot svelte-1tmbx1c"),Pe(e,"background-color","blue")},m(n,t){$(n,e,t)},p:ee,d(n){n&&y(e)}}}function jf(r){let e,n,t,o=r[3]&&Zi(r),i=r[3]&&r[2].mode=="set-image"&&Ki(r);return{c(){o&&o.c(),e=F(),i&&i.c(),n=fe()},m(s,l){o&&o.m(s,l),$(s,e,l),i&&i.m(s,l),$(s,n,l),t=!0},p(s,[l]){s[3]?o?(o.p(s,l),l&8&&w(o,1)):(o=Zi(s),o.c(),w(o,1),o.m(e.parentNode,e)):o&&(se(),k(o,1,1,()=>{o=null}),le()),s[3]&&s[2].mode=="set-image"?i?(i.p(s,l),l&12&&w(i,1)):(i=Ki(s),i.c(),w(i,1),i.m(n.parentNode,n)):i&&(se(),k(i,1,1,()=>{i=null}),le())},i(s){t||(w(o),w(i),t=!0)},o(s){k(o),k(i),t=!1},d(s){s&&(y(e),y(n)),o&&o.d(s),i&&i.d(s)}}}function If(r,e,n){let t,o,i,s;Y(r,He,p=>n(6,t=p)),Y(r,oe,p=>n(2,o=p)),Y(r,Sn,p=>n(3,i=p)),Y(r,En,p=>n(5,s=p));let{cfg:l}=e,u={lng:0,lat:0},a={lng:0,lat:0};function f(p){u=p,n(1,u),n(6,t),n(3,i),n(2,o)}function c(p){a=p,n(4,a),n(6,t),n(3,i),n(2,o),n(1,u)}return r.$$set=p=>{"cfg"in p&&n(0,l=p.cfg)},r.$$.update=()=>{if(r.$$.dirty&78&&t&&i&&o.mode=="set-image"&&u.lng==0&&u.lat==0){let p=t.getBounds();n(1,u.lng=p.getWest()+.4*(p.getEast()-p.getWest()),u),n(4,a.lng=p.getWest()+.6*(p.getEast()-p.getWest()),a),n(1,u.lat=p.getNorth()+.4*(p.getSouth()-p.getNorth()),u),n(4,a.lat=p.getNorth()+.6*(p.getSouth()-p.getNorth()),a)}},[l,u,o,i,a,s,t,f,c]}class Bf extends te{constructor(e){super(),ne(this,e,If,jf,x,{cfg:0})}}function qf(r){let e,n,t,o,i,s;const l=[ue(r[0],"hover-polygons"),{filter:kt},{paint:{"line-color":Kt.hovering,"line-width":.5*wt}}];let u={};for(let m=0;m(s(),s=We(a,f=>n(4,i=f)),a);Y(r,Zt,f=>n(3,o=f)),r.$$.on_destroy.push(()=>s());let{cfg:u}=e,{gjSchemes:a}=e;return l(),r.$$set=f=>{"cfg"in f&&n(0,u=f.cfg),"gjSchemes"in f&&l(n(1,a=f.gjSchemes))},r.$$.update=()=>{r.$$.dirty&24&&n(2,t=o==null?Gt():i.features.find(f=>f.id==o))},[u,a,t,o,i]}class Df extends te{constructor(e){super(),ne(this,e,Tf,Gf,x,{cfg:0,gjSchemes:1})}}function Vi(r){let e,n;return e=new Ir({props:{openOn:"hover",openIfTopMost:!0,$$slots:{default:[Uf,({features:t})=>({16:t}),({features:t})=>t?65536:0]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&196608&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Uf(r){let e,n,t=r[9](r[16])+"",o;return{c(){e=G("div"),n=G("p"),o=q(t),T(e,"class","govuk-prose")},m(i,s){$(i,e,s),z(e,n),z(n,o)},p(i,s){s&65536&&t!==(t=i[9](i[16])+"")&&ge(o,t)},d(i){i&&y(e)}}}function zf(r){let e,n,t=r[4]&&Vi(r);return{c(){t&&t.c(),e=fe()},m(o,i){t&&t.m(o,i),$(o,e,i),n=!0},p(o,i){o[4]?t?(t.p(o,i),i&16&&w(t,1)):(t=Vi(o),t.c(),w(t,1),t.m(e.parentNode,e)):t&&(se(),k(t,1,1,()=>{t=null}),le())},i(o){n||(w(t),n=!0)},o(o){k(t),n=!1},d(o){o&&y(e),t&&t.d(o)}}}function Qi(r){let e,n;return e=new Ir({props:{openOn:"hover",openIfTopMost:!0,$$slots:{default:[Jf,({features:t})=>({16:t}),({features:t})=>t?65536:0]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&196608&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Jf(r){let e,n,t=r[9](r[16])+"",o;return{c(){e=G("div"),n=G("p"),o=q(t),T(e,"class","govuk-prose")},m(i,s){$(i,e,s),z(e,n),z(n,o)},p(i,s){s&65536&&t!==(t=i[9](i[16])+"")&&ge(o,t)},d(i){i&&y(e)}}}function Yf(r){let e,n,t=r[4]&&Qi(r);return{c(){t&&t.c(),e=fe()},m(o,i){t&&t.m(o,i),$(o,e,i),n=!0},p(o,i){o[4]?t?(t.p(o,i),i&16&&w(t,1)):(t=Qi(o),t.c(),w(t,1),t.m(e.parentNode,e)):t&&(se(),k(t,1,1,()=>{t=null}),le())},i(o){n||(w(t),n=!0)},o(o){k(t),n=!1},d(o){o&&y(e),t&&t.d(o)}}}function xi(r){let e,n;return e=new Ir({props:{openOn:"hover",openIfTopMost:!0,$$slots:{default:[Xf,({features:t})=>({16:t}),({features:t})=>t?65536:0]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&196608&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Xf(r){let e,n,t=r[9](r[16])+"",o;return{c(){e=G("div"),n=G("p"),o=q(t),T(e,"class","govuk-prose")},m(i,s){$(i,e,s),z(e,n),z(n,o)},p(i,s){s&65536&&t!==(t=i[9](i[16])+"")&&ge(o,t)},d(i){i&&y(e)}}}function Wf(r){let e,n,t=r[4]&&xi(r);return{c(){t&&t.c(),e=fe()},m(o,i){t&&t.m(o,i),$(o,e,i),n=!0},p(o,i){o[4]?t?(t.p(o,i),i&16&&w(t,1)):(t=xi(o),t.c(),w(t,1),t.m(e.parentNode,e)):t&&(se(),k(t,1,1,()=>{t=null}),le())},i(o){n||(w(t),n=!0)},o(o){k(t),n=!1},d(o){o&&y(e),t&&t.d(o)}}}function Hf(r){let e,n,t,o,i,s,l,u,a,f;const c=[ue(r[0],"interventions-points"),{filter:["all",on,r[6],r[7],r[3]]},{paint:{"circle-color":r[2],"circle-radius":Ln}},{hoverCursor:r[4]?"pointer":void 0},{manageHoverState:r[4]}];let p={$$slots:{default:[zf]},$$scope:{ctx:r}};for(let _=0;_(u(),u=We(h,_=>n(11,l=_)),h),f,c,p;Y(r,He,_=>n(14,f=_)),Y(r,oe,_=>n(12,c=_)),Y(r,Vt,_=>n(13,p=_)),r.$$.on_destroy.push(()=>u());let{cfg:m}=e,{gjSchemes:h}=e;a();const b=["!=",["get","hide_while_editing"],!0],v=["!=",["get","endpoint"],!0];let E;function d(_){return Jt(["get","scheme_reference"],Object.fromEntries(Object.values(_.schemes).map(M=>[M.scheme_reference,M.color])),"black")}function g(_){c.mode!="list"||!f||_.detail.features[0]&&(f.getCanvas().style.cursor="inherit",oe.set({mode:"edit-form",id:_.detail.features[0].id}))}function S(_){if(_){let M=_[0],O=m.interventionName(M),B=m.schemeName(l.schemes[M.properties.scheme_reference]);return`${O} (${B})`}return"Tooltip bug"}return r.$$set=_=>{"cfg"in _&&n(0,m=_.cfg),"gjSchemes"in _&&a(n(1,h=_.gjSchemes))},r.$$.update=()=>{if(r.$$.dirty&2048&&n(5,t=kl(l)),r.$$.dirty&4096&&n(4,o=c.mode=="list"),r.$$.dirty&8192&&n(3,i=Kf(p)),r.$$.dirty&2048&&n(10,s=d(l)),r.$$.dirty&5120){let _="grey";c.mode=="edit-form"?n(2,E=["case",["==",["id"],c.id],s,_]):c.mode=="list"?n(2,E=s):c.mode=="split-route"?n(2,E=["case",["==","intervention_type","route"],s,_]):n(2,E=_)}},[m,h,E,i,o,t,b,v,g,S,s,l,c,p]}class Qf extends te{constructor(e){super(),ne(this,e,Vf,Zf,x,{cfg:0,gjSchemes:1})}}function xf(r){let e,n,t,o,i,s;const l=[ue(r[0],"edit-polygon-fill"),{filter:kt},{paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}];let u={};for(let m=0;mn(1,t=i));let{cfg:o}=e;return r.$$set=i=>{"cfg"in i&&n(0,o=i.cfg)},[o,t]}class nc extends te{constructor(e){super(),ne(this,e,tc,ec,x,{cfg:0})}}function rc(r){let e,n,t,o,i,s;const l=[ue(r[0],"route-points"),{filter:on},{paint:{"circle-color":Jt(["get","type"],{"snapped-waypoint":"red","free-waypoint":"blue"},"black"),"circle-opacity":["case",["has","hovered"],.5,1],"circle-radius":Jt(["get","type"],{node:hn/2},hn)}}];let u={};for(let m=0;m({3:t}),({feature:t})=>t?8:0]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&24&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function sc(r){let e,n,t,o;return e=new Et({props:{data:r[1],$$slots:{default:[rc]},$$scope:{ctx:r}}}),t=new Et({props:{data:r[2],$$slots:{default:[oc]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,[s]){const l={};s&2&&(l.data=i[1]),s&17&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&4&&(u.data=i[2]),s&16&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}const hn=10;function eo(r){var e;return(e=r.properties)==null?void 0:e.number}function lc(r,e,n){let t,o;Y(r,ys,s=>n(1,t=s)),Y(r,kn,s=>n(2,o=s));let{cfg:i}=e;return r.$$set=s=>{"cfg"in s&&n(0,i=s.cfg)},[i,t,o]}class uc extends te{constructor(e){super(),ne(this,e,lc,sc,x,{cfg:0})}}var ac=Object.defineProperty,vt=(r,e)=>ac(r,"name",{value:e,configurable:!0});function Ut(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return[...r.geometry.coordinates];if(r.type==="Point")return[...r.coordinates]}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return[...r];throw new Error("coord must be GeoJSON Point or an Array of numbers")}vt(Ut,"getCoord");function Es(r){if(Array.isArray(r))return r;if(r.type==="Feature"){if(r.geometry!==null)return r.geometry.coordinates}else if(r.coordinates)return r.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}vt(Es,"getCoords");function Ms(r){if(r.length>1&&Qr(r[0])&&Qr(r[1]))return!0;if(Array.isArray(r[0])&&r[0].length)return Ms(r[0]);throw new Error("coordinates must only contain numbers")}vt(Ms,"containsNumber");function fc(r,e,n){if(!e||!n)throw new Error("type and name required");if(!r||r.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+r.type)}vt(fc,"geojsonType");function cc(r,e,n){if(!r)throw new Error("No feature passed");if(!n)throw new Error(".featureOf() requires a name");if(!r||r.type!=="Feature"||!r.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!r.geometry||r.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+r.geometry.type)}vt(cc,"featureOf");function pc(r,e,n){if(!r)throw new Error("No featureCollection passed");if(!n)throw new Error(".collectionOf() requires a name");if(!r||r.type!=="FeatureCollection")throw new Error("Invalid input to "+n+", FeatureCollection required");for(const t of r.features){if(!t||t.type!=="Feature"||!t.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.geometry.type)}}vt(pc,"collectionOf");function mc(r){return r.type==="Feature"?r.geometry:r}vt(mc,"getGeom");function dc(r,e){return r.type==="FeatureCollection"?"FeatureCollection":r.type==="GeometryCollection"?"GeometryCollection":r.type==="Feature"&&r.geometry!==null?r.geometry.type:r.type}vt(dc,"getType");var gc=Object.defineProperty,Ps=(r,e)=>gc(r,"name",{value:e,configurable:!0});function Wr(r,e,n={}){if(n.final===!0)return Ls(r,e);const t=Ut(r),o=Ut(e),i=Te(t[0]),s=Te(o[0]),l=Te(t[1]),u=Te(o[1]),a=Math.sin(s-i)*Math.cos(u),f=Math.cos(l)*Math.sin(u)-Math.sin(l)*Math.cos(u)*Math.cos(s-i);return cr(Math.atan2(a,f))}Ps(Wr,"bearing");function Ls(r,e){let n=Wr(e,r);return n=(n+180)%360,n}Ps(Ls,"calculateFinalBearing");var hc=Object.defineProperty,_c=(r,e)=>hc(r,"name",{value:e,configurable:!0});function Ot(r,e,n={}){var t=Ut(r),o=Ut(e),i=Te(o[1]-t[1]),s=Te(o[0]-t[0]),l=Te(t[1]),u=Te(o[1]),a=Math.pow(Math.sin(i/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(l)*Math.cos(u);return al(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)),n.units)}_c(Ot,"distance");var bc=Object.defineProperty,vc=(r,e)=>bc(r,"name",{value:e,configurable:!0});function Ar(r,e,n,t={}){const o=Ut(r),i=Te(o[0]),s=Te(o[1]),l=Te(n),u=fl(e,t.units),a=Math.asin(Math.sin(s)*Math.cos(u)+Math.cos(s)*Math.sin(u)*Math.cos(l)),f=i+Math.atan2(Math.sin(l)*Math.sin(u)*Math.cos(s),Math.cos(u)-Math.sin(s)*Math.sin(a)),c=cr(f),p=cr(a);return Ge([c,p],t.properties)}vc(Ar,"destination");class Cs{constructor(e=[],n=$c){if(this.data=e,this.length=this.data.length,this.compare=n,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:n,compare:t}=this,o=n[e];for(;e>0;){const i=e-1>>1,s=n[i];if(t(o,s)>=0)break;n[e]=s,e=i}n[e]=o}_down(e){const{data:n,compare:t}=this,o=this.length>>1,i=n[e];for(;e=0)break;n[e]=l,e=s}n[e]=i}}function $c(r,e){return re?1:0}function Ns(r,e){return r.p.x>e.p.x?1:r.p.xe.p.y?1:-1:1}function yc(r,e){return r.rightSweepEvent.p.x>e.rightSweepEvent.p.x?1:r.rightSweepEvent.p.x0?(f.isLeftEndpoint=!0,a.isLeftEndpoint=!1):(a.isLeftEndpoint=!0,f.isLeftEndpoint=!1),e.push(a),e.push(f),s=l,vn=vn+1}}_n=_n+1}class kc{constructor(e){this.leftSweepEvent=e,this.rightSweepEvent=e.otherEvent}}function Sc(r,e){if(r===null||e===null||r.leftSweepEvent.ringId===e.leftSweepEvent.ringId&&(r.rightSweepEvent.isSamePoint(e.leftSweepEvent)||r.rightSweepEvent.isSamePoint(e.leftSweepEvent)||r.rightSweepEvent.isSamePoint(e.rightSweepEvent)||r.leftSweepEvent.isSamePoint(e.leftSweepEvent)||r.leftSweepEvent.isSamePoint(e.rightSweepEvent)))return!1;const n=r.leftSweepEvent.p.x,t=r.leftSweepEvent.p.y,o=r.rightSweepEvent.p.x,i=r.rightSweepEvent.p.y,s=e.leftSweepEvent.p.x,l=e.leftSweepEvent.p.y,u=e.rightSweepEvent.p.x,a=e.rightSweepEvent.p.y,f=(a-l)*(o-n)-(u-s)*(i-t),c=(u-s)*(t-l)-(a-l)*(n-s),p=(o-n)*(t-l)-(i-t)*(n-s);if(f===0)return!1;const m=c/f,h=p/f;if(m>=0&&m<=1&&h>=0&&h<=1){const b=n+m*(o-n),v=t+m*(i-t);return[b,v]}return!1}function Ec(r,e){e=e||!1;const n=[],t=new Cs([],yc);for(;r.length;){const o=r.pop();if(o.isLeftEndpoint){const i=new kc(o);for(let s=0;sPc(r,"name",{value:e,configurable:!0}),Cc=Mc;function Fs(r,e,n={}){const{removeDuplicates:t=!0,ignoreSelfIntersections:o=!1}=n;let i=[];r.type==="FeatureCollection"?i=i.concat(r.features):r.type==="Feature"?i.push(r):(r.type==="LineString"||r.type==="Polygon"||r.type==="MultiLineString"||r.type==="MultiPolygon")&&i.push(Cn(r)),e.type==="FeatureCollection"?i=i.concat(e.features):e.type==="Feature"?i.push(e):(e.type==="LineString"||e.type==="Polygon"||e.type==="MultiLineString"||e.type==="MultiPolygon")&&i.push(Cn(e));const s=Cc(xr(i),o);let l=[];if(t){const u={};s.forEach(a=>{const f=a.join(",");u[f]||(u[f]=!0,l.push(a))})}else l=s;return xr(l.map(u=>Ge(u)))}Lc(Fs,"lineIntersect");var Nc=Object.defineProperty,Se=(r,e)=>Nc(r,"name",{value:e,configurable:!0});function fn(r,e,n){if(r!==null)for(var t,o,i,s,l,u,a,f=0,c=0,p,m=r.type,h=m==="FeatureCollection",b=m==="Feature",v=h?r.features.length:1,E=0;Eu||h>a||b>f){l=c,u=t,a=h,f=b,i=0;return}var v=pt([l,c],n.properties);if(e(v,t,o,b,i)===!1)return!1;i++,l=c})===!1)return!1}}})}Se(Os,"segmentEach");function Bc(r,e,n){var t=n,o=!1;return Os(r,function(i,s,l,u,a){o===!1&&n===void 0?t=i:t=e(t,i,s,l,u,a),o=!0}),t}Se(Bc,"segmentReduce");function js(r,e){if(!r)throw new Error("geojson is required");cn(r,function(n,t,o){if(n.geometry!==null){var i=n.geometry.type,s=n.geometry.coordinates;switch(i){case"LineString":if(e(n,t,o,0,0)===!1)return!1;break;case"Polygon":for(var l=0;le in r?Is(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n,$t=(r,e)=>{for(var n in e||(e={}))zc.call(e,n)&&io(r,n,e[n]);if(ro)for(var n of ro(e))Jc.call(e,n)&&io(r,n,e[n]);return r},yt=(r,e)=>Dc(r,Uc(e)),Yc=(r,e)=>Is(r,"name",{value:e,configurable:!0});function Bs(r,e,n={}){if(!r||!e)throw new Error("lines and pt are required arguments");let t=Ge([1/0,1/0],{dist:1/0,index:-1,location:-1}),o=0;return cn(r,function(i){const s=Es(i);for(let l=0;l0&&b.features[0]&&(v=yt($t({},b.features[0]),{properties:{dist:Ot(e,b.features[0],n),location:o+Ot(u,b.features[0],n)}})),u.properties.dist(o(),o=We(u,v=>n(8,t=v)),u),s;Y(r,He,v=>n(9,s=v)),r.$$.on_destroy.push(()=>o());let{cfg:l}=e,{gjSchemes:u}=e;i(),ot(()=>{s&&(s.getCanvas().style.cursor=`url(${qs}), crosshair`)}),Ye(()=>{s&&(s.getCanvas().style.cursor="inherit")});let a=null,f=null,c=Gt();function p(v){if(!s)return;n(6,a=null),f=null;let E=b(v.detail.lngLat.toArray());const d=[v.detail.point.x-Zc,v.detail.point.y],g=s.unproject(v.detail.point).distanceTo(s.unproject(d))/1e3;let S=[];for(let[_,M]of t.features.entries())if(M.geometry.type=="LineString"){let O=Xc(M.geometry,E,{units:"kilometers"});O.properties.dist!=null&&O.properties.dist<=g&&S.push([_,O.geometry.coordinates,O.properties.dist])}S.sort((_,M)=>_[2]-M[2]),S.length>0&&(n(6,a=b(S[0][1])),f=S[0][0])}function m(){if(f==null){oe.set({mode:"list"});return}let v=na(t.features[f],a);if(v!=null){let[E,d]=v;u.update(g=>(E.id=g.features[f].id,d.id=un(g),g.features.splice(f,1,E,d),g))}n(6,a=null),f=null}function h(v){v.key=="Escape"&&(v.stopPropagation(),oe.set({mode:"list"}))}function b(v){return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:Oo(v)}}}return r.$$set=v=>{"cfg"in v&&n(0,l=v.cfg),"gjSchemes"in v&&i(n(1,u=v.gjSchemes))},r.$$.update=()=>{if(r.$$.dirty&64){let v=Gt();a&&v.features.push(a),n(2,c=v)}},[l,u,c,p,m,h,a]}class Vc extends te{constructor(e){super(),ne(this,e,Kc,Hc,x,{cfg:0,gjSchemes:1})}}function Qc(r){let e;return{c(){e=q("Finish")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function xc(r){let e,n,t,o,i,s,l,u,a,f;function c(b){r[4](b)}let p={cfg:r[0],map:r[2],showControls:!1};r[1]!==void 0&&(p.enabled=r[1]),e=new El({props:p}),K.push(()=>V(e,"enabled",c)),o=new st({props:{$$slots:{default:[Qc]},$$scope:{ctx:r}}}),o.$on("click",r[5]);function m(b){r[6](b)}let h={legend:"Source",choices:[["google","Google Street View"],["bing","Bing Streetside"]],inlineSmall:!0};return r[3].streetViewImagery!==void 0&&(h.value=r[3].streetViewImagery),s=new qt({props:h}),K.push(()=>V(s,"value",m)),a=new Ml({}),{c(){P(e.$$.fragment),t=F(),P(o.$$.fragment),i=F(),P(s.$$.fragment),u=F(),P(a.$$.fragment)},m(b,v){L(e,b,v),$(b,t,v),L(o,b,v),$(b,i,v),L(s,b,v),$(b,u,v),L(a,b,v),f=!0},p(b,[v]){const E={};v&1&&(E.cfg=b[0]),v&4&&(E.map=b[2]),!n&&v&2&&(n=!0,E.enabled=b[1],Q(()=>n=!1)),e.$set(E);const d={};v&128&&(d.$$scope={dirty:v,ctx:b}),o.$set(d);const g={};!l&&v&8&&(l=!0,g.value=b[3].streetViewImagery,Q(()=>l=!1)),s.$set(g)},i(b){f||(w(e.$$.fragment,b),w(o.$$.fragment,b),w(s.$$.fragment,b),w(a.$$.fragment,b),f=!0)},o(b){k(e.$$.fragment,b),k(o.$$.fragment,b),k(s.$$.fragment,b),k(a.$$.fragment,b),f=!1},d(b){b&&(y(t),y(i),y(u)),C(e,b),C(o,b),C(s,b),C(a,b)}}}function ep(r,e,n){let t,o;Y(r,He,f=>n(2,t=f)),Y(r,Pn,f=>n(3,o=f));let{cfg:i}=e,s=!0;function l(f){s=f,n(1,s)}const u=()=>n(1,s=!1);function a(f){r.$$.not_equal(o.streetViewImagery,f)&&(o.streetViewImagery=f,Pn.set(o))}return r.$$set=f=>{"cfg"in f&&n(0,i=f.cfg)},r.$$.update=()=>{r.$$.dirty&2&&(s||oe.set({mode:"list"}))},[i,s,t,o,l,u,a]}class tp extends te{constructor(e){super(),ne(this,e,ep,xc,x,{cfg:0})}}const np="/atip/ss_huge_refactor_pt1/assets/image-3e3a13e8.svg",rp="/atip/ss_huge_refactor_pt1/assets/point-276f4055.svg",ip="/atip/ss_huge_refactor_pt1/assets/polygon_freehand-cf965967.svg",op="/atip/ss_huge_refactor_pt1/assets/polygon_snapped-18efbbea.svg",sp="/atip/ss_huge_refactor_pt1/assets/route-d3c0ebad.svg",lp="/atip/ss_huge_refactor_pt1/assets/street_view-48580b6a.svg";function up(r){let e,n,t;return{c(){e=G("img"),t=q(` - New point`),Je(e.src,n=rp)||T(e,"src",n),T(e,"alt","New point")},m(o,i){$(o,e,i),$(o,t,i)},p:ee,d(o){o&&(y(e),y(t))}}}function ap(r){let e,n,t;return{c(){e=G("img"),t=q(` - New route`),Je(e.src,n=sp)||T(e,"src",n),T(e,"alt","New route")},m(o,i){$(o,e,i),$(o,t,i)},p:ee,d(o){o&&(y(e),y(t))}}}function fp(r){let e,n,t;return{c(){e=G("img"),t=q(` - New polygon (freehand)`),Je(e.src,n=ip)||T(e,"src",n),T(e,"alt","New polygon (freehand)")},m(o,i){$(o,e,i),$(o,t,i)},p:ee,d(o){o&&(y(e),y(t))}}}function cp(r){let e,n,t;return{c(){e=G("img"),t=q(` - New polygon (snapped)`),Je(e.src,n=op)||T(e,"src",n),T(e,"alt","New polygon (snapped)")},m(o,i){$(o,e,i),$(o,t,i)},p:ee,d(o){o&&(y(e),y(t))}}}function pp(r){let e,n,t;return{c(){e=G("img"),t=q(` - Split route`),Je(e.src,n=qs)||T(e,"src",n),T(e,"alt","Split route")},m(o,i){$(o,e,i),$(o,t,i)},p:ee,d(o){o&&(y(e),y(t))}}}function mp(r){let e,n,t;return{c(){e=G("img"),t=q(` - Georeference image`),Je(e.src,n=np)||T(e,"src",n),T(e,"alt","Georeference image")},m(o,i){$(o,e,i),$(o,t,i)},p:ee,d(o){o&&(y(e),y(t))}}}function dp(r){let e,n,t;return{c(){e=G("img"),t=q(` - StreetView`),Je(e.src,n=lp)||T(e,"src",n),T(e,"alt","StreetView")},m(o,i){$(o,e,i),$(o,t,i)},p:ee,d(o){o&&(y(e),y(t))}}}function gp(r){let e,n,t,o,i,s,l,u,a,f,c,p,m,h,b,v,E;return e=new Df({props:{cfg:r[0],gjSchemes:r[1]}}),o=new ae({props:{disabled:!r[2],$$slots:{default:[up]},$$scope:{ctx:r}}}),o.$on("click",r[5]),s=new ae({props:{disabled:!r[3],$$slots:{default:[ap]},$$scope:{ctx:r}}}),s.$on("click",r[6]),u=new ae({props:{disabled:!r[4],$$slots:{default:[fp]},$$scope:{ctx:r}}}),u.$on("click",r[7]),f=new ae({props:{disabled:!r[3],$$slots:{default:[cp]},$$scope:{ctx:r}}}),f.$on("click",r[8]),p=new ae({props:{$$slots:{default:[pp]},$$scope:{ctx:r}}}),p.$on("click",r[9]),h=new ae({props:{$$slots:{default:[mp]},$$scope:{ctx:r}}}),h.$on("click",r[10]),v=new ae({props:{$$slots:{default:[dp]},$$scope:{ctx:r}}}),v.$on("click",r[11]),{c(){P(e.$$.fragment),n=F(),t=G("div"),P(o.$$.fragment),i=F(),P(s.$$.fragment),l=F(),P(u.$$.fragment),a=F(),P(f.$$.fragment),c=F(),P(p.$$.fragment),m=F(),P(h.$$.fragment),b=F(),P(v.$$.fragment),T(t,"class","top govuk-prose svelte-1kai3ke")},m(d,g){L(e,d,g),$(d,n,g),$(d,t,g),L(o,t,null),z(t,i),L(s,t,null),z(t,l),L(u,t,null),z(t,a),L(f,t,null),z(t,c),L(p,t,null),z(t,m),L(h,t,null),z(t,b),L(v,t,null),E=!0},p(d,[g]){const S={};g&1&&(S.cfg=d[0]),g&2&&(S.gjSchemes=d[1]),e.$set(S);const _={};g&4&&(_.disabled=!d[2]),g&4096&&(_.$$scope={dirty:g,ctx:d}),o.$set(_);const M={};g&8&&(M.disabled=!d[3]),g&4096&&(M.$$scope={dirty:g,ctx:d}),s.$set(M);const O={};g&16&&(O.disabled=!d[4]),g&4096&&(O.$$scope={dirty:g,ctx:d}),u.$set(O);const B={};g&8&&(B.disabled=!d[3]),g&4096&&(B.$$scope={dirty:g,ctx:d}),f.$set(B);const D={};g&4096&&(D.$$scope={dirty:g,ctx:d}),p.$set(D);const I={};g&4096&&(I.$$scope={dirty:g,ctx:d}),h.$set(I);const A={};g&4096&&(A.$$scope={dirty:g,ctx:d}),v.$set(A)},i(d){E||(w(e.$$.fragment,d),w(o.$$.fragment,d),w(s.$$.fragment,d),w(u.$$.fragment,d),w(f.$$.fragment,d),w(p.$$.fragment,d),w(h.$$.fragment,d),w(v.$$.fragment,d),E=!0)},o(d){k(e.$$.fragment,d),k(o.$$.fragment,d),k(s.$$.fragment,d),k(u.$$.fragment,d),k(f.$$.fragment,d),k(p.$$.fragment,d),k(h.$$.fragment,d),k(v.$$.fragment,d),E=!1},d(d){d&&(y(n),y(t)),C(e,d),C(o),C(s),C(u),C(f),C(p),C(h),C(v)}}}function hp(r,e,n){let t,o,i;Y(r,nn,b=>n(2,t=b)),Y(r,Xe,b=>n(3,o=b)),Y(r,It,b=>n(4,i=b));let{cfg:s}=e,{gjSchemes:l}=e;const u=()=>oe.set({mode:"new-point"}),a=()=>oe.set({mode:"new-route"}),f=()=>oe.set({mode:"new-freehand-polygon"}),c=()=>oe.set({mode:"new-snapped-polygon"}),p=()=>oe.set({mode:"split-route"}),m=()=>oe.set({mode:"set-image"}),h=()=>oe.set({mode:"streetview"});return r.$$set=b=>{"cfg"in b&&n(0,s=b.cfg),"gjSchemes"in b&&n(1,l=b.gjSchemes)},[s,l,t,o,i,u,a,f,c,p,m,h]}class _p extends te{constructor(e){super(),ne(this,e,hp,gp,x,{cfg:0,gjSchemes:1})}}const bp="/atip/ss_huge_refactor_pt1/assets/delete-3c023172.svg",vp="/atip/ss_huge_refactor_pt1/assets/save-74d8f3c2.svg";function so(r){let e,n;return e=new ae({props:{disabled:!r[2],$$slots:{default:[$p]},$$scope:{ctx:r}}}),e.$on("click",r[7]),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&4&&(i.disabled=!t[2]),o&4096&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function $p(r){let e;return{c(){e=q("Auto-fill")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function yp(r){let e,n,t,o,i,s,l=r[0].length_meters&&so(r);return{c(){e=G("input"),n=F(),l&&l.c(),t=fe(),T(e,"type","text"),T(e,"class","govuk-input"),T(e,"id",r[5])},m(u,a){$(u,e,a),Le(e,r[0].name),$(u,n,a),l&&l.m(u,a),$(u,t,a),o=!0,i||(s=he(e,"input",r[6]),i=!0)},p(u,a){a&1&&e.value!==u[0].name&&Le(e,u[0].name),u[0].length_meters?l?(l.p(u,a),a&1&&w(l,1)):(l=so(u),l.c(),w(l,1),l.m(t.parentNode,t)):l&&(se(),k(l,1,1,()=>{l=null}),le())},i(u){o||(w(l),o=!0)},o(u){k(l),o=!1},d(u){u&&(y(e),y(n),y(t)),l&&l.d(u),i=!1,s()}}}function lo(r){let e,n,t=Fn(r[0].length_meters)+"",o;return{c(){e=G("p"),n=q("Length: "),o=q(t)},m(i,s){$(i,e,s),z(e,n),z(e,o)},p(i,s){s&1&&t!==(t=Fn(i[0].length_meters)+"")&&ge(o,t)},d(i){i&&y(e)}}}function wp(r){let e,n,t,o,i,s,l,u,a,f,c,p,m;e=new Mt({props:{label:"Name",id:r[5],$$slots:{default:[yp]},$$scope:{ctx:r}}});function h(_){r[9](_)}let b={label:"Scheme",choices:Object.values(r[3].schemes).map(r[8])};r[0].scheme_reference!==void 0&&(b.value=r[0].scheme_reference),t=new xn({props:b}),K.push(()=>V(t,"value",h));function v(_){r[10](_)}let E={legend:"Type",choices:[["area","Area"],["route","Route"],["crossing","Crossing"],["other","Other"]],inlineSmall:!0,required:!0};r[0].intervention_type!==void 0&&(E.value=r[0].intervention_type),s=new qt({props:E}),K.push(()=>V(s,"value",v));function d(_){r[11](_)}let g={label:"Description"};r[0].description!==void 0&&(g.value=r[0].description),a=new qr({props:g}),K.push(()=>V(a,"value",d));let S=r[0].length_meters&&lo(r);return{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment),i=F(),P(s.$$.fragment),u=F(),P(a.$$.fragment),c=F(),S&&S.c(),p=fe()},m(_,M){L(e,_,M),$(_,n,M),L(t,_,M),$(_,i,M),L(s,_,M),$(_,u,M),L(a,_,M),$(_,c,M),S&&S.m(_,M),$(_,p,M),m=!0},p(_,[M]){const O={};M&4101&&(O.$$scope={dirty:M,ctx:_}),e.$set(O);const B={};M&8&&(B.choices=Object.values(_[3].schemes).map(_[8])),!o&&M&1&&(o=!0,B.value=_[0].scheme_reference,Q(()=>o=!1)),t.$set(B);const D={};!l&&M&1&&(l=!0,D.value=_[0].intervention_type,Q(()=>l=!1)),s.$set(D);const I={};!f&&M&1&&(f=!0,I.value=_[0].description,Q(()=>f=!1)),a.$set(I),_[0].length_meters?S?S.p(_,M):(S=lo(_),S.c(),S.m(p.parentNode,p)):S&&(S.d(1),S=null)},i(_){m||(w(e.$$.fragment,_),w(t.$$.fragment,_),w(s.$$.fragment,_),w(a.$$.fragment,_),m=!0)},o(_){k(e.$$.fragment,_),k(t.$$.fragment,_),k(s.$$.fragment,_),k(a.$$.fragment,_),m=!1},d(_){_&&(y(n),y(i),y(u),y(c),y(p)),C(e,_),C(t,_),C(s,_),C(a,_),S&&S.d(_)}}}function kp(r,e,n){let t,o,i=ee,s=()=>(i(),i=We(l,E=>n(3,o=E)),l);Y(r,Xe,E=>n(2,t=E)),r.$$.on_destroy.push(()=>i());let{gjSchemes:l}=e;s();let{props:u}=e;function a(){try{n(0,u.name=t.inner.routeNameForWaypoints(u.waypoints),u)}catch(E){window.alert(`Couldn't auto-name route: ${E}`)}}let f=Pt();function c(){u.name=this.value,n(0,u)}const p=()=>a(),m=E=>[E.scheme_reference,Zr(E)];function h(E){r.$$.not_equal(u.scheme_reference,E)&&(u.scheme_reference=E,n(0,u))}function b(E){r.$$.not_equal(u.intervention_type,E)&&(u.intervention_type=E,n(0,u))}function v(E){r.$$.not_equal(u.description,E)&&(u.description=E,n(0,u))}return r.$$set=E=>{"gjSchemes"in E&&s(n(1,l=E.gjSchemes)),"props"in E&&n(0,u=E.props)},[u,l,t,o,a,f,c,p,m,h,b,v]}class Sp extends te{constructor(e){super(),ne(this,e,kp,wp,x,{gjSchemes:1,props:0})}}function Ep(r){let e,n,t;function o(s){r[2](s)}let i={label:r[1],choices:[lt("New segregated cycling facility"),lt("New junction treatment"),lt("New permanent footway"),["New shared use facilities","New shared use (walking and cycling) facilities"],["Improvements to existing route","Improvements to make an existing walking/cycle route safer"],["Area-wide traffic management","Area-wide traffic management (including by TROs - both permanent and experimental)"],["Bus priority measures","Bus priority measures that also enable active travel (for example, bus gates)"],["Secure cycle parking","Provision of secure cycle parking facilities"],lt("New road crossings"),lt("Restriction or reduction of car parking availability"),lt("School streets"),lt("Quiet mixed traffic streets"),lt("Traffic free routes"),lt("Not specified in LCWIP")],emptyOption:!0};return r[0]!==void 0&&(i.value=r[0]),e=new xn({props:i}),K.push(()=>V(e,"value",o)),{c(){P(e.$$.fragment)},m(s,l){L(e,s,l),t=!0},p(s,[l]){const u={};l&2&&(u.label=s[1]),!n&&l&1&&(n=!0,u.value=s[0],Q(()=>n=!1)),e.$set(u)},i(s){t||(w(e.$$.fragment,s),t=!0)},o(s){k(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function lt(r){return[r,r]}function Mp(r,e,n){let{label:t}=e,{value:o}=e;function i(s){o=s,n(0,o)}return r.$$set=s=>{"label"in s&&n(1,t=s.label),"value"in s&&n(0,o=s.value)},[o,t,i]}class Gs extends te{constructor(e){super(),ne(this,e,Mp,Ep,x,{label:1,value:0})}}function Pp(r){let e,n,t,o,i,s,l,u,a,f,c,p,m,h,b,v,E,d;function g(N){r[3](N)}let S={legend:"Status",choices:[["","Unknown"],["aspiration","Aspiration"],["planned","Planned"],["in development","In development"],["in construction","In construction"],["completed","Completed"]],inlineSmall:!0,required:r[1]};r[0].status!==void 0&&(S.value=r[0].status),o=new qt({props:S}),K.push(()=>V(o,"value",g));function _(N){r[4](N)}let M={legend:"Timescale",choices:[["","Unknown"],["short","Short (1-3 years)"],["medium","Medium (3-6 years)"],["long","Long (6-10 years)"]],inlineSmall:!0,required:r[1]};r[0].timescale!==void 0&&(M.value=r[0].timescale),l=new qt({props:M}),K.push(()=>V(l,"value",_));function O(N){r[5](N)}let B={label:"Estimated completion year (if known)",width:4,min:2010,max:2100};r[0].timescale_year!==void 0&&(B.value=r[0].timescale_year),f=new nr({props:B}),K.push(()=>V(f,"value",O));function D(N){r[6](N)}let I={label:"What year was this scheme most recently published?",width:4,min:2010,max:2100};r[0].year_published!==void 0&&(I.value=r[0].year_published),m=new nr({props:I}),K.push(()=>V(m,"value",D));function A(N){r[7](N)}let R={label:"What year was this scheme most recently consulted on?",width:4,min:2010,max:2100};return r[0].year_consulted!==void 0&&(R.value=r[0].year_consulted),v=new nr({props:R}),K.push(()=>V(v,"value",A)),{c(){e=G("fieldset"),n=G("legend"),n.textContent="Timing and status",t=F(),P(o.$$.fragment),s=F(),P(l.$$.fragment),a=F(),P(f.$$.fragment),p=F(),P(m.$$.fragment),b=F(),P(v.$$.fragment),T(n,"class","govuk-fieldset__legend"),T(e,"class","govuk-fieldset svelte-1bxyfcq")},m(N,j){$(N,e,j),z(e,n),z(e,t),L(o,e,null),z(e,s),L(l,e,null),z(e,a),L(f,e,null),z(e,p),L(m,e,null),z(e,b),L(v,e,null),d=!0},p(N,[j]){const H={};j&2&&(H.required=N[1]),!i&&j&1&&(i=!0,H.value=N[0].status,Q(()=>i=!1)),o.$set(H);const ie={};j&2&&(ie.required=N[1]),!u&&j&1&&(u=!0,ie.value=N[0].timescale,Q(()=>u=!1)),l.$set(ie);const ce={};!c&&j&1&&(c=!0,ce.value=N[0].timescale_year,Q(()=>c=!1)),f.$set(ce);const U={};!h&&j&1&&(h=!0,U.value=N[0].year_published,Q(()=>h=!1)),m.$set(U);const de={};!E&&j&1&&(E=!0,de.value=N[0].year_consulted,Q(()=>E=!1)),v.$set(de)},i(N){d||(w(o.$$.fragment,N),w(l.$$.fragment,N),w(f.$$.fragment,N),w(m.$$.fragment,N),w(v.$$.fragment,N),d=!0)},o(N){k(o.$$.fragment,N),k(l.$$.fragment,N),k(f.$$.fragment,N),k(m.$$.fragment,N),k(v.$$.fragment,N),d=!1},d(N){N&&y(e),C(o),C(l),C(f),C(m),C(v)}}}function Lp(r,e,n){let{data:t}=e,{required:o}=e,{onUpdate:i}=e;function s(p){i()}function l(p){r.$$.not_equal(t.status,p)&&(t.status=p,n(0,t))}function u(p){r.$$.not_equal(t.timescale,p)&&(t.timescale=p,n(0,t))}function a(p){r.$$.not_equal(t.timescale_year,p)&&(t.timescale_year=p,n(0,t))}function f(p){r.$$.not_equal(t.year_published,p)&&(t.year_published=p,n(0,t))}function c(p){r.$$.not_equal(t.year_consulted,p)&&(t.year_consulted=p,n(0,t))}return r.$$set=p=>{"data"in p&&n(0,t=p.data),"required"in p&&n(1,o=p.required),"onUpdate"in p&&n(2,i=p.onUpdate)},r.$$.update=()=>{r.$$.dirty&1&&s()},[t,o,i,l,u,a,f,c]}class Ts extends te{constructor(e){super(),ne(this,e,Lp,Pp,x,{data:0,required:1,onUpdate:2})}}function uo(r,e,n){const t=r.slice();return t[9]=e[n],t[10]=e,t[11]=n,t}function Cp(r){let e;return{c(){e=q("Is the development fully funded?")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Np(r){let e;return{c(){e=q("Is the construction fully funded?")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Fp(r){let e,n,t;function o(s){r[6](s,r[9])}let i={$$slots:{default:[Ap]},$$scope:{ctx:r}};return r[0].funding_sources[r[9]]!==void 0&&(i.checked=r[0].funding_sources[r[9]]),e=new ht({props:i}),K.push(()=>V(e,"checked",o)),{c(){P(e.$$.fragment)},m(s,l){L(e,s,l),t=!0},p(s,l){r=s;const u={};l&4096&&(u.$$scope={dirty:l,ctx:r}),!n&&l&3&&(n=!0,u.checked=r[0].funding_sources[r[9]],Q(()=>n=!1)),e.$set(u)},i(s){t||(w(e.$$.fragment,s),t=!0)},o(s){k(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function Ap(r){let e=r[9].toUpperCase()+"",n,t;return{c(){n=q(e),t=F()},m(o,i){$(o,n,i),$(o,t,i)},p:ee,d(o){o&&(y(n),y(t))}}}function ao(r){let e,n,t=r[9]!="other"&&Fp(r);return{c(){t&&t.c(),e=fe()},m(o,i){t&&t.m(o,i),$(o,e,i),n=!0},p(o,i){o[9]!="other"&&t.p(o,i)},i(o){n||(w(t),n=!0)},o(o){k(t),n=!1},d(o){o&&y(e),t&&t.d(o)}}}function Rp(r){let e,n,t=je(r[1]),o=[];for(let s=0;sk(o[s],1,1,()=>{o[s]=null});return{c(){for(let s=0;sV(o,"value",S));function M(R){r[4](R)}let O={$$slots:{default:[Cp]},$$scope:{ctx:r}};r[0].development_funded!==void 0&&(O.checked=r[0].development_funded),l=new ht({props:O}),K.push(()=>V(l,"checked",M));function B(R){r[5](R)}let D={$$slots:{default:[Np]},$$scope:{ctx:r}};r[0].construction_funded!==void 0&&(D.checked=r[0].construction_funded),f=new ht({props:D}),K.push(()=>V(f,"checked",B)),b=new To({props:{$$slots:{default:[Rp]},$$scope:{ctx:r}}});function I(R){r[7](R)}let A={label:"Other funding sources"};return r[0].funding_sources.other!==void 0&&(A.value=r[0].funding_sources.other),E=new er({props:A}),K.push(()=>V(E,"value",I)),{c(){e=G("fieldset"),n=G("legend"),n.textContent="Budget",t=F(),P(o.$$.fragment),s=F(),P(l.$$.fragment),a=F(),P(f.$$.fragment),p=F(),m=G("p"),m.textContent="Funding sources",h=F(),P(b.$$.fragment),v=F(),P(E.$$.fragment),T(n,"class","govuk-fieldset__legend"),T(e,"class","govuk-fieldset svelte-1bxyfcq")},m(R,N){$(R,e,N),z(e,n),z(e,t),L(o,e,null),z(e,s),L(l,e,null),z(e,a),L(f,e,null),z(e,p),z(e,m),z(e,h),L(b,e,null),z(e,v),L(E,e,null),g=!0},p(R,[N]){const j={};!i&&N&1&&(i=!0,j.value=R[0].budget,Q(()=>i=!1)),o.$set(j);const H={};N&4096&&(H.$$scope={dirty:N,ctx:R}),!u&&N&1&&(u=!0,H.checked=R[0].development_funded,Q(()=>u=!1)),l.$set(H);const ie={};N&4096&&(ie.$$scope={dirty:N,ctx:R}),!c&&N&1&&(c=!0,ie.checked=R[0].construction_funded,Q(()=>c=!1)),f.$set(ie);const ce={};N&4097&&(ce.$$scope={dirty:N,ctx:R}),b.$set(ce);const U={};!d&&N&1&&(d=!0,U.value=R[0].funding_sources.other,Q(()=>d=!1)),E.$set(U)},i(R){g||(w(o.$$.fragment,R),w(l.$$.fragment,R),w(f.$$.fragment,R),w(b.$$.fragment,R),w(E.$$.fragment,R),g=!0)},o(R){k(o.$$.fragment,R),k(l.$$.fragment,R),k(f.$$.fragment,R),k(b.$$.fragment,R),k(E.$$.fragment,R),g=!1},d(R){R&&y(e),C(o),C(l),C(f),C(b),C(E)}}}function jp(r,e,n){let{data:t}=e,{onUpdate:o}=e;function i(p){o()}let s=["atf2","atf3","atf4","atf4e","crsts","luf"];function l(p){r.$$.not_equal(t.budget,p)&&(t.budget=p,n(0,t))}function u(p){r.$$.not_equal(t.development_funded,p)&&(t.development_funded=p,n(0,t))}function a(p){r.$$.not_equal(t.construction_funded,p)&&(t.construction_funded=p,n(0,t))}function f(p,m){r.$$.not_equal(t.funding_sources[m],p)&&(t.funding_sources[m]=p,n(0,t))}function c(p){r.$$.not_equal(t.funding_sources.other,p)&&(t.funding_sources.other=p,n(0,t))}return r.$$set=p=>{"data"in p&&n(0,t=p.data),"onUpdate"in p&&n(2,o=p.onUpdate)},r.$$.update=()=>{r.$$.dirty&1&&i()},[t,s,o,l,u,a,f,c]}class Ds extends te{constructor(e){super(),ne(this,e,jp,Op,x,{data:0,onUpdate:2})}}function fo(r){let e,n;return e=new ae({props:{disabled:!r[2],$$slots:{default:[Ip]},$$scope:{ctx:r}}}),e.$on("click",r[8]),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&4&&(i.disabled=!t[2]),o&65536&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Ip(r){let e;return{c(){e=q("Auto-fill with street names")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Bp(r){let e,n,t,o,i,s,l,u,a=r[0].length_meters&&fo(r);return{c(){e=G("div"),e.textContent="Use the name from the LCWIP if possible",n=F(),t=G("input"),o=F(),a&&a.c(),i=fe(),T(e,"class","govuk-hint"),T(t,"type","text"),T(t,"class","govuk-input"),T(t,"id",r[6])},m(f,c){$(f,e,c),$(f,n,c),$(f,t,c),Le(t,r[0].name),$(f,o,c),a&&a.m(f,c),$(f,i,c),s=!0,l||(u=he(t,"input",r[7]),l=!0)},p(f,c){c&1&&t.value!==f[0].name&&Le(t,f[0].name),f[0].length_meters?a?(a.p(f,c),c&1&&w(a,1)):(a=fo(f),a.c(),w(a,1),a.m(i.parentNode,i)):a&&(se(),k(a,1,1,()=>{a=null}),le())},i(f){s||(w(a),s=!0)},o(f){k(a),s=!1},d(f){f&&(y(e),y(n),y(t),y(o),y(i)),a&&a.d(f),l=!1,u()}}}function co(r){let e,n,t=Fn(r[0].length_meters)+"",o;return{c(){e=G("p"),n=q("Length: "),o=q(t)},m(i,s){$(i,e,s),z(e,n),z(e,o)},p(i,s){s&1&&t!==(t=Fn(i[0].length_meters)+"")&&ge(o,t)},d(i){i&&y(e)}}}function po(r){let e,n,t,o,i,s,l,u,a,f,c,p,m,h;function b(M){r[12](M)}let v={label:"Type"};r[0].pipeline.atf4_type!==void 0&&(v.value=r[0].pipeline.atf4_type),e=new Gs({props:v}),K.push(()=>V(e,"value",b));function E(M){r[13](M)}let d={legend:"Accuracy of mapped data",choices:[["high","High"],["medium","Medium"],["low","Low"]],required:!0,inlineSmall:!0};r[0].pipeline.accuracy!==void 0&&(d.value=r[0].pipeline.accuracy),o=new qt({props:d}),K.push(()=>V(o,"value",E));function g(M){r[14](M)}let S={$$slots:{default:[qp]},$$scope:{ctx:r}};r[0].pipeline.is_alternative!==void 0&&(S.checked=r[0].pipeline.is_alternative),l=new ht({props:S}),K.push(()=>V(l,"checked",g));let _=r[4]&&r[0].is_coverage_polygon!==void 0&&mo(r);return c=new Ts({props:{data:r[0].pipeline,required:!1,onUpdate:Dp}}),m=new Ds({props:{data:r[0].pipeline,onUpdate:Up}}),{c(){P(e.$$.fragment),t=F(),P(o.$$.fragment),s=F(),P(l.$$.fragment),a=F(),_&&_.c(),f=F(),P(c.$$.fragment),p=F(),P(m.$$.fragment)},m(M,O){L(e,M,O),$(M,t,O),L(o,M,O),$(M,s,O),L(l,M,O),$(M,a,O),_&&_.m(M,O),$(M,f,O),L(c,M,O),$(M,p,O),L(m,M,O),h=!0},p(M,O){const B={};!n&&O&1&&(n=!0,B.value=M[0].pipeline.atf4_type,Q(()=>n=!1)),e.$set(B);const D={};!i&&O&1&&(i=!0,D.value=M[0].pipeline.accuracy,Q(()=>i=!1)),o.$set(D);const I={};O&65536&&(I.$$scope={dirty:O,ctx:M}),!u&&O&1&&(u=!0,I.checked=M[0].pipeline.is_alternative,Q(()=>u=!1)),l.$set(I),M[4]&&M[0].is_coverage_polygon!==void 0?_?(_.p(M,O),O&1&&w(_,1)):(_=mo(M),_.c(),w(_,1),_.m(f.parentNode,f)):_&&(se(),k(_,1,1,()=>{_=null}),le());const A={};O&1&&(A.data=M[0].pipeline),c.$set(A);const R={};O&1&&(R.data=M[0].pipeline),m.$set(R)},i(M){h||(w(e.$$.fragment,M),w(o.$$.fragment,M),w(l.$$.fragment,M),w(_),w(c.$$.fragment,M),w(m.$$.fragment,M),h=!0)},o(M){k(e.$$.fragment,M),k(o.$$.fragment,M),k(l.$$.fragment,M),k(_),k(c.$$.fragment,M),k(m.$$.fragment,M),h=!1},d(M){M&&(y(t),y(s),y(a),y(f),y(p)),C(e,M),C(o,M),C(l,M),_&&_.d(M),C(c,M),C(m,M)}}}function qp(r){let e;return{c(){e=q("Is this an alternative route and not the default option?")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function mo(r){let e,n,t;function o(s){r[15](s)}let i={$$slots:{default:[Gp]},$$scope:{ctx:r}};return r[0].is_coverage_polygon!==void 0&&(i.checked=r[0].is_coverage_polygon),e=new ht({props:i}),K.push(()=>V(e,"checked",o)),{c(){P(e.$$.fragment)},m(s,l){L(e,s,l),t=!0},p(s,l){const u={};l&65536&&(u.$$scope={dirty:l,ctx:s}),!n&&l&1&&(n=!0,u.checked=s[0].is_coverage_polygon,Q(()=>n=!1)),e.$set(u)},i(s){t||(w(e.$$.fragment,s),t=!0)},o(s){k(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function Gp(r){let e;return{c(){e=q(`Does this polygon show the coverage of the scheme? (All area considered - while making the scheme)`)},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Tp(r){let e,n,t,o,i,s,l,u,a,f,c;e=new Mt({props:{label:"Name",id:r[6],$$slots:{default:[Bp]},$$scope:{ctx:r}}});function p(d){r[10](d)}let m={label:"Scheme",choices:Object.values(r[3].schemes).map(r[9])};r[0].scheme_reference!==void 0&&(m.value=r[0].scheme_reference),t=new xn({props:m}),K.push(()=>V(t,"value",p));function h(d){r[11](d)}let b={label:"Description"};r[0].description!==void 0&&(b.value=r[0].description),s=new qr({props:b}),K.push(()=>V(s,"value",h));let v=r[0].length_meters&&co(r),E=r[0].pipeline&&po(r);return{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment),i=F(),P(s.$$.fragment),u=F(),v&&v.c(),a=F(),E&&E.c(),f=fe()},m(d,g){L(e,d,g),$(d,n,g),L(t,d,g),$(d,i,g),L(s,d,g),$(d,u,g),v&&v.m(d,g),$(d,a,g),E&&E.m(d,g),$(d,f,g),c=!0},p(d,[g]){const S={};g&65541&&(S.$$scope={dirty:g,ctx:d}),e.$set(S);const _={};g&8&&(_.choices=Object.values(d[3].schemes).map(d[9])),!o&&g&1&&(o=!0,_.value=d[0].scheme_reference,Q(()=>o=!1)),t.$set(_);const M={};!l&&g&1&&(l=!0,M.value=d[0].description,Q(()=>l=!1)),s.$set(M),d[0].length_meters?v?v.p(d,g):(v=co(d),v.c(),v.m(a.parentNode,a)):v&&(v.d(1),v=null),d[0].pipeline?E?(E.p(d,g),g&1&&w(E,1)):(E=po(d),E.c(),w(E,1),E.m(f.parentNode,f)):E&&(se(),k(E,1,1,()=>{E=null}),le())},i(d){c||(w(e.$$.fragment,d),w(t.$$.fragment,d),w(s.$$.fragment,d),w(E),c=!0)},o(d){k(e.$$.fragment,d),k(t.$$.fragment,d),k(s.$$.fragment,d),k(E),c=!1},d(d){d&&(y(n),y(i),y(u),y(a),y(f)),C(e,d),C(t,d),C(s,d),v&&v.d(d),E&&E.d(d)}}}const Dp=()=>{},Up=()=>{};function zp(r,e,n){let t,o,i=ee,s=()=>(i(),i=We(l,_=>n(3,o=_)),l);Y(r,Xe,_=>n(2,t=_)),r.$$.on_destroy.push(()=>i());let{gjSchemes:l}=e;s();let{props:u}=e;u.pipeline||(u.pipeline={atf4_type:"",accuracy:"",is_alternative:!1,development_funded:!1,construction_funded:!1,funding_sources:Xn(),status:"",timescale:""}),u.is_coverage_polygon||(u.is_coverage_polygon=!1);const a=(o.features.filter(_=>_.properties.is_coverage_polygon).length==0||u.is_coverage_polygon===!0)&&u.intervention_type==="area";function f(){try{n(0,u.name=t.inner.routeNameForWaypoints(u.waypoints),u)}catch(_){window.alert(`Couldn't auto-name route: ${_}`)}}let c=Pt();function p(){u.name=this.value,n(0,u)}const m=()=>f(),h=_=>[_.scheme_reference,Zr(_)];function b(_){r.$$.not_equal(u.scheme_reference,_)&&(u.scheme_reference=_,n(0,u))}function v(_){r.$$.not_equal(u.description,_)&&(u.description=_,n(0,u))}function E(_){r.$$.not_equal(u.pipeline.atf4_type,_)&&(u.pipeline.atf4_type=_,n(0,u))}function d(_){r.$$.not_equal(u.pipeline.accuracy,_)&&(u.pipeline.accuracy=_,n(0,u))}function g(_){r.$$.not_equal(u.pipeline.is_alternative,_)&&(u.pipeline.is_alternative=_,n(0,u))}function S(_){r.$$.not_equal(u.is_coverage_polygon,_)&&(u.is_coverage_polygon=_,n(0,u))}return r.$$set=_=>{"gjSchemes"in _&&s(n(1,l=_.gjSchemes)),"props"in _&&n(0,u=_.props)},[u,l,t,o,a,f,c,p,m,h,b,v,E,d,g,S]}class Jp extends te{constructor(e){super(),ne(this,e,zp,Tp,x,{gjSchemes:1,props:0})}}function go(r,e,n){const t=r.slice();return t[9]=e[n][0],t[10]=e[n][1],t}function ho(r){let e,n;return e=new ae({props:{$$slots:{default:[Yp]},$$scope:{ctx:r}}}),e.$on("click",r[6]),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&8192&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Yp(r){let e;return{c(){e=q("Handle extra GeoJSON properties")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function _o(r){let e,n,t=r[9]+"",o,i,s=JSON.stringify(r[10])+"",l,u;return{c(){e=G("li"),n=G("b"),o=q(t),i=q(` - = `),l=q(s),u=F()},m(a,f){$(a,e,f),z(e,n),z(n,o),z(e,i),z(e,l),z(e,u)},p(a,f){f&2&&t!==(t=a[9]+"")&&ge(o,t),f&2&&s!==(s=JSON.stringify(a[10])+"")&&ge(l,s)},d(a){a&&y(e)}}}function Xp(r){let e;return{c(){e=q("Remove these properties")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Wp(r){let e;return{c(){e=q("Cancel")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Hp(r){let e,n,t,o;return e=new bt({props:{$$slots:{default:[Xp]},$$scope:{ctx:r}}}),e.$on("click",r[2]),t=new ae({props:{$$slots:{default:[Wp]},$$scope:{ctx:r}}}),t.$on("click",r[7]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&8192&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&8192&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function Zp(r){let e,n,t,o,i,s,l=je(Object.entries(r[1])),u=[];for(let a=0;a0,n,t,o,i,s=e&&ho(r);function l(a){r[8](a)}let u={title:"This imported GeoJSON feature has unexpected properties",$$slots:{default:[Zp]},$$scope:{ctx:r}};return r[0]!==void 0&&(u.open=r[0]),t=new Lt({props:u}),K.push(()=>V(t,"open",l)),{c(){s&&s.c(),n=F(),P(t.$$.fragment)},m(a,f){s&&s.m(a,f),$(a,n,f),L(t,a,f),i=!0},p(a,[f]){f&2&&(e=Object.entries(a[1]).length>0),e?s?(s.p(a,f),f&2&&w(s,1)):(s=ho(a),s.c(),w(s,1),s.m(n.parentNode,n)):s&&(se(),k(s,1,1,()=>{s=null}),le());const c={};f&8195&&(c.$$scope={dirty:f,ctx:a}),!o&&f&1&&(o=!0,c.open=a[0],Q(()=>o=!1)),t.$set(c)},i(a){i||(w(s),w(t.$$.fragment,a),i=!0)},o(a){k(s),k(t.$$.fragment,a),i=!1},d(a){a&&y(n),s&&s.d(a),C(t,a)}}}function Vp(r,e,n){let t,{gjSchemes:o}=e,{id:i}=e,{props:s}=e,l=!1;function u(){n(0,l=!1),o.update(p=>{let m=p.features.find(h=>h.id==i);for(let h of Object.keys(t))delete m.properties[h];return p})}const a=()=>n(0,l=!0),f=()=>n(0,l=!1);function c(p){l=p,n(0,l)}return r.$$set=p=>{"gjSchemes"in p&&n(3,o=p.gjSchemes),"id"in p&&n(4,i=p.id),"props"in p&&n(5,s=p.props)},r.$$.update=()=>{r.$$.dirty&32&&n(1,t=zs(s))},[l,t,u,o,i,s,a,f,c]}class Qp extends te{constructor(e){super(),ne(this,e,Vp,Kp,x,{gjSchemes:3,id:4,props:5})}}function xp(r){let e,n,t;function o(s){r[6](s)}let i={gjSchemes:r[1]};return r[0]!==void 0&&(i.props=r[0]),e=new Jp({props:i}),K.push(()=>V(e,"props",o)),{c(){P(e.$$.fragment)},m(s,l){L(e,s,l),t=!0},p(s,l){const u={};l&2&&(u.gjSchemes=s[1]),!n&&l&1&&(n=!0,u.props=s[0],Q(()=>n=!1)),e.$set(u)},i(s){t||(w(e.$$.fragment,s),t=!0)},o(s){k(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function em(r){let e,n,t;function o(s){r[5](s)}let i={gjSchemes:r[1]};return r[0]!==void 0&&(i.props=r[0]),e=new Sp({props:i}),K.push(()=>V(e,"props",o)),{c(){P(e.$$.fragment)},m(s,l){L(e,s,l),t=!0},p(s,l){const u={};l&2&&(u.gjSchemes=s[1]),!n&&l&1&&(n=!0,u.props=s[0],Q(()=>n=!1)),e.$set(u)},i(s){t||(w(e.$$.fragment,s),t=!0)},o(s){k(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function tm(r){let e,n,t,o,i,s;e=new Qp({props:{gjSchemes:r[1],id:r[2],props:r[0]}});const l=[em,xp],u=[];function a(f,c){return f[3]=="v1"?0:f[3]=="pipeline"?1:-1}return~(t=a(r))&&(o=u[t]=l[t](r)),{c(){P(e.$$.fragment),n=F(),o&&o.c(),i=fe()},m(f,c){L(e,f,c),$(f,n,c),~t&&u[t].m(f,c),$(f,i,c),s=!0},p(f,[c]){const p={};c&2&&(p.gjSchemes=f[1]),c&4&&(p.id=f[2]),c&1&&(p.props=f[0]),e.$set(p);let m=t;t=a(f),t===m?~t&&u[t].p(f,c):(o&&(se(),k(u[m],1,1,()=>{u[m]=null}),le()),~t?(o=u[t],o?o.p(f,c):(o=u[t]=l[t](f),o.c()),w(o,1),o.m(i.parentNode,i)):o=null)},i(f){s||(w(e.$$.fragment,f),w(o),s=!0)},o(f){k(e.$$.fragment,f),k(o),s=!1},d(f){f&&(y(n),y(i)),C(e,f),~t&&u[t].d(f)}}}function nm(r,e,n){let t;Y(r,tt,f=>n(3,t=f));let{cfg:o}=e,{gjSchemes:i}=e,{id:s}=e,{props:l}=e;function u(f){l=f,n(0,l)}function a(f){l=f,n(0,l)}return r.$$set=f=>{"cfg"in f&&n(4,o=f.cfg),"gjSchemes"in f&&n(1,i=f.gjSchemes),"id"in f&&n(2,s=f.id),"props"in f&&n(0,l=f.props)},[l,i,s,t,o,u,a]}class rm extends te{constructor(e){super(),ne(this,e,nm,tm,x,{cfg:4,gjSchemes:1,id:2,props:0})}}function im(r){let e;return{c(){e=q("Scheme details")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function om(r){let e;return{c(){e=q("Save")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function sm(r){let e,n,t,o,i;function s(u){r[6](u)}let l={label:"Scheme name",required:!0};return r[3].schemes[r[1]].scheme_name!==void 0&&(l.value=r[3].schemes[r[1]].scheme_name),e=new er({props:l}),K.push(()=>V(e,"value",s)),o=new st({props:{$$slots:{default:[om]},$$scope:{ctx:r}}}),o.$on("click",r[7]),{c(){P(e.$$.fragment),t=F(),P(o.$$.fragment)},m(u,a){L(e,u,a),$(u,t,a),L(o,u,a),i=!0},p(u,a){const f={};!n&&a&10&&(n=!0,f.value=u[3].schemes[u[1]].scheme_name,Q(()=>n=!1)),e.$set(f);const c={};a&512&&(c.$$scope={dirty:a,ctx:u}),o.$set(c)},i(u){i||(w(e.$$.fragment,u),w(o.$$.fragment,u),i=!0)},o(u){k(e.$$.fragment,u),k(o.$$.fragment,u),i=!1},d(u){u&&y(t),C(e,u),C(o,u)}}}function lm(r){let e,n,t,o,i,s,l;e=new ae({props:{$$slots:{default:[im]},$$scope:{ctx:r}}}),e.$on("click",r[5]);function u(f){r[8](f)}let a={title:"Scheme details",$$slots:{default:[sm]},$$scope:{ctx:r}};return r[2]!==void 0&&(a.open=r[2]),t=new Lt({props:a}),K.push(()=>V(t,"open",u)),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(f,c){L(e,f,c),$(f,n,c),L(t,f,c),i=!0,s||(l=he(window,"keydown",r[4]),s=!0)},p(f,[c]){const p={};c&512&&(p.$$scope={dirty:c,ctx:f}),e.$set(p);const m={};c&526&&(m.$$scope={dirty:c,ctx:f}),!o&&c&4&&(o=!0,m.open=f[2],Q(()=>o=!1)),t.$set(m)},i(f){i||(w(e.$$.fragment,f),w(t.$$.fragment,f),i=!0)},o(f){k(e.$$.fragment,f),k(t.$$.fragment,f),i=!1},d(f){f&&y(n),C(e,f),C(t,f),s=!1,l()}}}function um(r,e,n){let t,o=ee,i=()=>(o(),o=We(s,h=>n(3,t=h)),s);r.$$.on_destroy.push(()=>o());let{gjSchemes:s}=e;i();let{scheme_reference:l}=e,u=!1;function a(h){u&&h.key=="Escape"&&(h.stopPropagation(),n(2,u=!1))}const f=()=>n(2,u=!0);function c(h){r.$$.not_equal(t.schemes[l].scheme_name,h)&&(t.schemes[l].scheme_name=h,s.set(t))}const p=()=>n(2,u=!1);function m(h){u=h,n(2,u)}return r.$$set=h=>{"gjSchemes"in h&&i(n(0,s=h.gjSchemes)),"scheme_reference"in h&&n(1,l=h.scheme_reference)},[s,l,u,t,a,f,c,p,m]}class am extends te{constructor(e){super(),ne(this,e,um,lm,x,{gjSchemes:0,scheme_reference:1})}}function fm(r){let e;return{c(){e=q("Scheme details")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function cm(r){let e;return{c(){e=q("Save")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function pm(r){let e,n,t,o,i,s,l,u,a,f,c,p,m,h,b,v,E,d,g,S,_;function M(j){r[9](j)}let O={label:"Scheme name",required:!0};r[6].schemes[r[1]].scheme_name!==void 0&&(O.value=r[6].schemes[r[1]].scheme_name),e=new er({props:O}),K.push(()=>V(e,"value",M));function B(j){r[10](j)}let D={legend:"Scheme type",choices:[["cycling route","Cycling route"],["walking route","Walking route"],["shared-use route","Shared-use route"],["cycling and walking route","Cycling and walking route, not shared use"],["area-based scheme","Area-based scheme"],["intersection","Intersection/junction scheme"]],inlineSmall:!0,required:!0};r[3].scheme_type!==void 0&&(D.value=r[3].scheme_type),l=new qt({props:D}),K.push(()=>V(l,"value",B));function I(j){r[11](j)}let A={label:"Type of the main intervention"};r[3].atf4_lead_type!==void 0&&(A.value=r[3].atf4_lead_type),f=new Gs({props:A}),K.push(()=>V(f,"value",I));function R(j){r[12](j)}let N={label:"Scheme description (150 words max)"};return r[3].scheme_description!==void 0&&(N.value=r[3].scheme_description),m=new qr({props:N}),K.push(()=>V(m,"value",R)),v=new Ts({props:{data:r[3],required:!0,onUpdate:r[13]}}),d=new Ds({props:{data:r[3],onUpdate:r[14]}}),S=new st({props:{$$slots:{default:[cm]},$$scope:{ctx:r}}}),S.$on("click",r[15]),{c(){P(e.$$.fragment),t=F(),o=G("fieldset"),i=G("legend"),i.textContent="Basic information",s=F(),P(l.$$.fragment),a=F(),P(f.$$.fragment),p=F(),P(m.$$.fragment),b=F(),P(v.$$.fragment),E=F(),P(d.$$.fragment),g=F(),P(S.$$.fragment),T(i,"class","govuk-fieldset__legend"),T(o,"class","govuk-fieldset svelte-1bxyfcq")},m(j,H){L(e,j,H),$(j,t,H),$(j,o,H),z(o,i),z(o,s),L(l,o,null),z(o,a),L(f,o,null),z(o,p),L(m,o,null),$(j,b,H),L(v,j,H),$(j,E,H),L(d,j,H),$(j,g,H),L(S,j,H),_=!0},p(j,H){const ie={};!n&&H&66&&(n=!0,ie.value=j[6].schemes[j[1]].scheme_name,Q(()=>n=!1)),e.$set(ie);const ce={};!u&&H&8&&(u=!0,ce.value=j[3].scheme_type,Q(()=>u=!1)),l.$set(ce);const U={};!c&&H&8&&(c=!0,U.value=j[3].atf4_lead_type,Q(()=>c=!1)),f.$set(U);const de={};!h&&H&8&&(h=!0,de.value=j[3].scheme_description,Q(()=>h=!1)),m.$set(de);const _e={};H&8&&(_e.data=j[3]),H&16&&(_e.onUpdate=j[13]),v.$set(_e);const Ee={};H&8&&(Ee.data=j[3]),H&16&&(Ee.onUpdate=j[14]),d.$set(Ee);const $e={};H&524288&&($e.$$scope={dirty:H,ctx:j}),S.$set($e)},i(j){_||(w(e.$$.fragment,j),w(l.$$.fragment,j),w(f.$$.fragment,j),w(m.$$.fragment,j),w(v.$$.fragment,j),w(d.$$.fragment,j),w(S.$$.fragment,j),_=!0)},o(j){k(e.$$.fragment,j),k(l.$$.fragment,j),k(f.$$.fragment,j),k(m.$$.fragment,j),k(v.$$.fragment,j),k(d.$$.fragment,j),k(S.$$.fragment,j),_=!1},d(j){j&&(y(t),y(o),y(b),y(E),y(g)),C(e,j),C(l),C(f),C(m),C(v,j),C(d,j),C(S,j)}}}function mm(r){let e,n,t,o,i,s,l,u,a;e=new ze({props:{errorMessage:r[5]}}),t=new ae({props:{$$slots:{default:[fm]},$$scope:{ctx:r}}}),t.$on("click",r[8]);function f(p){r[16](p)}let c={title:"Scheme details",$$slots:{default:[pm]},$$scope:{ctx:r}};return r[2]!==void 0&&(c.open=r[2]),i=new Lt({props:c}),K.push(()=>V(i,"open",f)),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment),o=F(),P(i.$$.fragment)},m(p,m){L(e,p,m),$(p,n,m),L(t,p,m),$(p,o,m),L(i,p,m),l=!0,u||(a=he(window,"keydown",r[7]),u=!0)},p(p,[m]){const h={};m&32&&(h.errorMessage=p[5]),e.$set(h);const b={};m&524288&&(b.$$scope={dirty:m,ctx:p}),t.$set(b);const v={};m&524382&&(v.$$scope={dirty:m,ctx:p}),!s&&m&4&&(s=!0,v.open=p[2],Q(()=>s=!1)),i.$set(v)},i(p){l||(w(e.$$.fragment,p),w(t.$$.fragment,p),w(i.$$.fragment,p),l=!0)},o(p){k(e.$$.fragment,p),k(t.$$.fragment,p),k(i.$$.fragment,p),l=!1},d(p){p&&(y(n),y(o)),C(e,p),C(t,p),C(i,p),u=!1,a()}}}function dm(r,e,n){let t,o,i=ee,s=()=>(i(),i=We(l,B=>n(6,o=B)),l);r.$$.on_destroy.push(()=>i());let{gjSchemes:l}=e;s();let{scheme_reference:u}=e,a=!1,f=o.schemes[u].pipeline,c=0;function p(B,D){return f.scheme_type&&f.status&&f.timescale?"":"Missing some required data"}function m(B){a&&B.key=="Escape"&&(B.stopPropagation(),n(2,a=!1))}function h(){Be(l,o.schemes[u].pipeline=f,o),l.set(o)}const b=()=>n(2,a=!0);function v(B){r.$$.not_equal(o.schemes[u].scheme_name,B)&&(o.schemes[u].scheme_name=B,l.set(o))}function E(B){r.$$.not_equal(f.scheme_type,B)&&(f.scheme_type=B,n(3,f))}function d(B){r.$$.not_equal(f.atf4_lead_type,B)&&(f.atf4_lead_type=B,n(3,f))}function g(B){r.$$.not_equal(f.scheme_description,B)&&(f.scheme_description=B,n(3,f))}const S=()=>n(4,c++,c),_=()=>n(4,c++,c),M=()=>n(2,a=!1);function O(B){a=B,n(2,a)}return r.$$set=B=>{"gjSchemes"in B&&s(n(0,l=B.gjSchemes)),"scheme_reference"in B&&n(1,u=B.scheme_reference)},r.$$.update=()=>{r.$$.dirty&24&&n(5,t=p()),r.$$.dirty&4&&(a||h())},[l,u,a,f,c,t,o,m,b,v,E,d,g,S,_,M,O]}class gm extends te{constructor(e){super(),ne(this,e,dm,mm,x,{gjSchemes:0,scheme_reference:1})}}function hm(r){let e,n;return e=new am({props:{gjSchemes:r[0],scheme_reference:r[1]}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&1&&(i.gjSchemes=t[0]),o&2&&(i.scheme_reference=t[1]),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function _m(r){let e,n;return e=new gm({props:{gjSchemes:r[0],scheme_reference:r[1]}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&1&&(i.gjSchemes=t[0]),o&2&&(i.scheme_reference=t[1]),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function bm(r){let e,n,t,o;const i=[_m,hm],s=[];function l(u,a){return u[2]=="pipeline"?0:1}return e=l(r),n=s[e]=i[e](r),{c(){n.c(),t=fe()},m(u,a){s[e].m(u,a),$(u,t,a),o=!0},p(u,[a]){let f=e;e=l(u),e===f?s[e].p(u,a):(se(),k(s[f],1,1,()=>{s[f]=null}),le(),n=s[e],n?n.p(u,a):(n=s[e]=i[e](u),n.c()),w(n,1),n.m(t.parentNode,t))},i(u){o||(w(n),o=!0)},o(u){k(n),o=!1},d(u){u&&y(t),s[e].d(u)}}}function vm(r,e,n){let t;Y(r,tt,s=>n(2,t=s));let{gjSchemes:o}=e,{scheme_reference:i}=e;return r.$$set=s=>{"gjSchemes"in s&&n(0,o=s.gjSchemes),"scheme_reference"in s&&n(1,i=s.scheme_reference)},[o,i,t]}class $m extends te{constructor(e){super(),ne(this,e,vm,bm,x,{gjSchemes:0,scheme_reference:1})}}let xe={interventionName:wm,schemeName:Zr,backfill:Mn,initializeEmptyScheme:ym,interventionWarning:km,editFeatureForm:rm,editSchemeForm:$m,newPointFeature:r=>{r.properties.intervention_type="other"},newPolygonFeature:r=>{r.properties.intervention_type="area",r.properties.is_coverage_polygon=!1},newLineStringFeature:r=>{r.properties.intervention_type="route",r.properties.route_name&&(St(tt)!="pipeline"&&(r.properties.name=r.properties.route_name),delete r.properties.route_name)},updateFeature:(r,e)=>{e.properties.route_name&&!r.properties.name&&St(tt)!="pipeline"&&(r.properties.name=e.properties.route_name)},maptilerApiKey:"MZEJTanw3WpxRvt7qDfo",getStreetViewRoadLayerNames:r=>Pl(r,St(pr)),layerZorder:Ll};function Mn(r){var t,o,i,s,l,u,a,f;let e=St(tt),n=1;for(let c of r.features)c.properties||(c.properties={name:"",scheme_reference:"",description:"",intervention_type:"other",is_coverage_polygon:!1}),e=="pipeline"&&!c.properties.intervention_type&&(c.properties.intervention_type=new Map([["LineString","route"],["Polygon","area"]]).get(c.geometry.type)??"other"),c.geometry.type=="LineString"&&!c.properties.length_meters&&(c.properties.length_meters=Cl(c,{units:"kilometers"})*1e3),c.id=n++;if(!r.schemes){let c=Pt();r.schemes={},r.schemes[c]={scheme_reference:c,color:ti()},r.scheme_name&&(r.schemes[c].scheme_name=r.scheme_name,delete r.scheme_name),r.pipeline&&(r.schemes[c].pipeline=r.pipeline,delete r.pipeline);for(let p of r.features)p.properties.scheme_reference=c}for(let c of Object.values(r.schemes)){let p=c;if(p.color??(p.color=ti()),e=="pipeline"){p.pipeline??(p.pipeline=Us()),(t=p.pipeline).development_funded??(t.development_funded=!1),(o=p.pipeline).construction_funded??(o.construction_funded=!1),(i=p.pipeline).funding_sources??(i.funding_sources=Xn()),delete p.pipeline.budget_funded,delete p.pipeline.budget_unfunded,delete p.pipeline.funding_source,delete p.pipeline.funded;for(let m of r.features)m.properties.pipeline&&((s=m.properties.pipeline).development_funded??(s.development_funded=!1),(l=m.properties.pipeline).construction_funded??(l.construction_funded=!1),(u=m.properties.pipeline).funding_sources??(u.funding_sources=Xn()),(a=m.properties.pipeline).status??(a.status=""),(f=m.properties.pipeline).timescale??(f.timescale=""))}}return r}function ym(r){let e=r;return St(tt)=="pipeline"&&(e.pipeline=Us()),e}function Us(){return{scheme_type:"",atf4_lead_type:"",scheme_description:"",status:"",timescale:"",development_funded:!1,construction_funded:!1,funding_sources:Xn()}}function Xn(){return{atf2:!1,atf3:!1,atf4:!1,atf4e:!1,crsts:!1,luf:!1,other:""}}function wm(r){if(r.properties.name)return r.properties.name;var e=r.properties.intervention_type;return e=="other"&&(r.geometry.type=="Point"?e="point":r.geometry.type=="LineString"?e="line":e="polygon"),`Untitled ${e}`}function Zr(r){return r.scheme_name??"Untitled scheme"}function km(r){var t;let e=St(tt);if(!r.properties.name)return"No name";if(!new Set(["route","area","crossing","other"]).has(r.properties.intervention_type))return"No intervention type";if(e=="pipeline"&&!((t=r.properties.pipeline)!=null&&t.accuracy))return"Accuracy not specified";let n=zs(r.properties);return Object.entries(n).length>0?`Extra GeoJSON properties: ${Object.keys(n).join(", ")}`:null}function zs(r){let e=St(tt),n=JSON.parse(JSON.stringify(r));for(let t of["name","description","intervention_type","length_meters","waypoints","hide_while_editing","is_coverage_polygon","scheme_reference"])delete n[t];if(e=="pipeline"&&n.pipeline){for(let t of["atf4_type","accuracy","is_alternative","budget","development_funded","construction_funded","funding_sources","status","timescale","timescale_year","year_published","year_consulted"])delete n.pipeline[t];Object.entries(n.pipeline).length==0&&delete n.pipeline}return n}function bo(r,e,n){const t=r.slice();return t[8]=e[n],t}function Sm(r){let e;return{c(){e=q("Delete all sketch data from browser")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function vo(r){let e,n,t,o,i=je(r[1].storedStrings),s=[];for(let u=0;uk(s[u],1,1,()=>{s[u]=null});return{c(){e=G("p"),e.textContent=`Otherwise here is a breakdown of what is currently stored locally. You can - delete individual items (normally storage quota is 5MB or 10MB):`,n=F();for(let u=0;u{o=null}),le());const u={};l&2050&&(u.$$scope={dirty:l,ctx:r}),n.$set(u)},i(s){t||(w(o),w(n.$$.fragment,s),t=!0)},o(s){k(o),k(n.$$.fragment,s),t=!1},d(s){s&&y(e),o&&o.d(s),C(n,s)}}}function Mm(r){var p;let e,n=((p=r[1])==null?void 0:p.message)+"",t,o,i,s,l,u,a,f;l=new bt({props:{$$slots:{default:[Sm]},$$scope:{ctx:r}}}),l.$on("click",r[4]);let c=r[1]&&vo(r);return{c(){e=G("p"),t=q(n),o=F(),i=G("p"),i.textContent=`If you have saved your work locally to a geojson file recently, you can + to cancel`},m(i,s){L(e,i,s),$(i,n,s),$(i,t,s),o=!0},p(i,[s]){const l={};s&1&&(l.disabled=i[0]==0),s&9&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){o||(w(e.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),o=!1},d(i){i&&(y(n),y(t)),C(e,i)}}}function wf(r,e,n){let t,o;Y(r,We,s=>n(2,t=s)),Y(r,Xr,s=>n(0,o=s));function i(){t.undo()}return[o,i]}class Es extends te{constructor(e){super(),ne(this,e,wf,yf,x,{})}}function kf(r){let e;return{c(){e=q("Finish")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Sf(r){let e;return{c(){e=q("Cancel")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Ef(r){let e,n,t,o;return e=new st({props:{$$slots:{default:[kf]},$$scope:{ctx:r}}}),e.$on("click",r[3]),t=new ae({props:{$$slots:{default:[Sf]},$$scope:{ctx:r}}}),t.$on("click",r[4]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&32768&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&32768&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function Mf(r){let e,n;return e=new Es({}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p:ee,i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Pf(r){let e,n;return e=new ys({}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p:ee,i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Lf(r){let e,n;return e=new Ss({props:{cfg:r[0],extendRoute:!1}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&1&&(i.cfg=t[0]),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Cf(r){let e,n;return e=new $s({props:{editingExisting:!0}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p:ee,i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Nf(r){let e,n,t,o,i,s,l,u,a,f;i=new Ze({props:{$$slots:{default:[Ef]},$$scope:{ctx:r}}});const c=[Cf,Lf,Pf,Mf],p=[];function m(g,b){return g[2]=="point"?0:g[2]=="route"?1:g[2]=="freehand-polygon"?2:g[2]=="snapped-polygon"?3:-1}return~(l=m(r))&&(u=p[l]=c[l](r)),{c(){e=G("h2"),n=q("Editing "),t=q(r[1]),o=F(),P(i.$$.fragment),s=F(),u&&u.c(),a=fe()},m(g,b){$(g,e,b),z(e,n),z(e,t),$(g,o,b),L(i,g,b),$(g,s,b),~l&&p[l].m(g,b),$(g,a,b),f=!0},p(g,[b]){(!f||b&2)&&ge(t,g[1]);const v={};b&32768&&(v.$$scope={dirty:b,ctx:g}),i.$set(v);let S=l;l=m(g),l===S?~l&&p[l].p(g,b):(u&&(se(),k(p[S],1,1,()=>{p[S]=null}),le()),~l?(u=p[l],u?u.p(g,b):(u=p[l]=c[l](g),u.c()),w(u,1),u.m(a.parentNode,a)):u=null)},i(g){f||(w(i.$$.fragment,g),w(u),f=!0)},o(g){k(i.$$.fragment,g),k(u),f=!1},d(g){g&&(y(e),y(o),y(s),y(a)),C(i,g),~l&&p[l].d(g)}}}function Ff(r,e,n){let t,o,i;Y(r,It,d=>n(8,t=d)),Y(r,We,d=>n(9,o=d)),Y(r,nn,d=>n(10,i=d));let{cfg:s}=e,{gjSchemes:l}=e,{id:u}=e,a="",f="",c=null;ot(()=>{let d=null;l.update(E=>(d=E.features.find(h=>h.id==u),d.properties.hide_while_editing=!0,E));let _=d;n(1,a=s.interventionName(_)),_.geometry.type=="LineString"?(o==null||o.editExistingRoute(_),o==null||o.addEventListenerSuccess(p),o==null||o.addEventListenerUpdated(m),o==null||o.addEventListenerFailure(g),n(2,f="route")):_.geometry.type=="Polygon"?_.properties.waypoints?(o==null||o.editExistingArea(_),o==null||o.addEventListenerSuccess(p),o==null||o.addEventListenerUpdated(m),o==null||o.addEventListenerFailure(g),n(2,f="snapped-polygon")):(t==null||t.editExisting(_),t==null||t.addEventListenerSuccess(p),t==null||t.addEventListenerUpdated(m),t==null||t.addEventListenerFailure(g),n(2,f="freehand-polygon")):_.geometry.type=="Point"&&(i==null||i.start(),i==null||i.addEventListenerSuccess(p),i==null||i.addEventListenerFailure(g),n(2,f="point"))}),Xe(()=>{i==null||i.stop(),i==null||i.clearEventListeners(),o==null||o.stop(),o==null||o.clearEventListeners(),t==null||t.stop(),t==null||t.clearEventListeners(),l.update(d=>{let _=d.features.find(E=>E.id==u);return delete _.properties.hide_while_editing,c&&b(_,c),d})});function p(d){d.properties??(d.properties={}),c=d,oe.set({mode:"edit-form",id:u})}function m(d){c=d}function g(){c=null,oe.set({mode:"edit-form",id:u})}function b(d,_){d.geometry=_.geometry,_.properties.length_meters&&(d.properties.length_meters=_.properties.length_meters),_.properties.waypoints&&(d.properties.waypoints=_.properties.waypoints),s.updateFeature(d,_)}function v(){oe.set({mode:"edit-form",id:u})}function S(){c=null,oe.set({mode:"edit-form",id:u})}return r.$$set=d=>{"cfg"in d&&n(0,s=d.cfg),"gjSchemes"in d&&n(5,l=d.gjSchemes),"id"in d&&n(6,u=d.id)},[s,a,f,v,S,l,u]}class Af extends te{constructor(e){super(),ne(this,e,Ff,Nf,x,{cfg:0,gjSchemes:5,id:6})}}const Sn=at(null),En=at(100);function Zi(r){let e,n;return e=new ma({props:{url:r[3],coordinates:[[r[1].lng,r[1].lat],[r[4].lng,r[1].lat],[r[4].lng,r[4].lat],[r[1].lng,r[4].lat]],$$slots:{default:[Rf]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&8&&(i.url=t[3]),o&18&&(i.coordinates=[[t[1].lng,t[1].lat],[t[4].lng,t[1].lat],[t[4].lng,t[4].lat],[t[1].lng,t[4].lat]]),o&545&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Rf(r){let e,n;const t=[ue(r[0],"georeferenced-image"),{paint:{"raster-fade-duration":0,"raster-opacity":r[5]/100}}];let o={};for(let i=0;iV(e,"lngLat",l));function a(c){r[8](c)}let f={draggable:!0,$$slots:{default:[jf]},$$scope:{ctx:r}};return r[4]!==void 0&&(f.lngLat=r[4]),o=new mr({props:f}),K.push(()=>V(o,"lngLat",a)),{c(){P(e.$$.fragment),t=F(),P(o.$$.fragment)},m(c,p){L(e,c,p),$(c,t,p),L(o,c,p),s=!0},p(c,p){const m={};p&512&&(m.$$scope={dirty:p,ctx:c}),!n&&p&2&&(n=!0,m.lngLat=c[1],Q(()=>n=!1)),e.$set(m);const g={};p&512&&(g.$$scope={dirty:p,ctx:c}),!i&&p&16&&(i=!0,g.lngLat=c[4],Q(()=>i=!1)),o.$set(g)},i(c){s||(w(e.$$.fragment,c),w(o.$$.fragment,c),s=!0)},o(c){k(e.$$.fragment,c),k(o.$$.fragment,c),s=!1},d(c){c&&y(t),C(e,c),C(o,c)}}}function Of(r){let e;return{c(){e=G("span"),T(e,"class","dot svelte-1tmbx1c"),Pe(e,"background-color","red")},m(n,t){$(n,e,t)},p:ee,d(n){n&&y(e)}}}function jf(r){let e;return{c(){e=G("span"),T(e,"class","dot svelte-1tmbx1c"),Pe(e,"background-color","blue")},m(n,t){$(n,e,t)},p:ee,d(n){n&&y(e)}}}function If(r){let e,n,t,o=r[3]&&Zi(r),i=r[3]&&r[2].mode=="set-image"&&Ki(r);return{c(){o&&o.c(),e=F(),i&&i.c(),n=fe()},m(s,l){o&&o.m(s,l),$(s,e,l),i&&i.m(s,l),$(s,n,l),t=!0},p(s,[l]){s[3]?o?(o.p(s,l),l&8&&w(o,1)):(o=Zi(s),o.c(),w(o,1),o.m(e.parentNode,e)):o&&(se(),k(o,1,1,()=>{o=null}),le()),s[3]&&s[2].mode=="set-image"?i?(i.p(s,l),l&12&&w(i,1)):(i=Ki(s),i.c(),w(i,1),i.m(n.parentNode,n)):i&&(se(),k(i,1,1,()=>{i=null}),le())},i(s){t||(w(o),w(i),t=!0)},o(s){k(o),k(i),t=!1},d(s){s&&(y(e),y(n)),o&&o.d(s),i&&i.d(s)}}}function Bf(r,e,n){let t,o,i,s;Y(r,qe,p=>n(6,t=p)),Y(r,oe,p=>n(2,o=p)),Y(r,Sn,p=>n(3,i=p)),Y(r,En,p=>n(5,s=p));let{cfg:l}=e,u={lng:0,lat:0},a={lng:0,lat:0};function f(p){u=p,n(1,u),n(6,t),n(3,i),n(2,o)}function c(p){a=p,n(4,a),n(6,t),n(3,i),n(2,o),n(1,u)}return r.$$set=p=>{"cfg"in p&&n(0,l=p.cfg)},r.$$.update=()=>{if(r.$$.dirty&78&&t&&i&&o.mode=="set-image"&&u.lng==0&&u.lat==0){let p=t.getBounds();n(1,u.lng=p.getWest()+.4*(p.getEast()-p.getWest()),u),n(4,a.lng=p.getWest()+.6*(p.getEast()-p.getWest()),a),n(1,u.lat=p.getNorth()+.4*(p.getSouth()-p.getNorth()),u),n(4,a.lat=p.getNorth()+.6*(p.getSouth()-p.getNorth()),a)}},[l,u,o,i,a,s,t,f,c]}class qf extends te{constructor(e){super(),ne(this,e,Bf,If,x,{cfg:0})}}function Gf(r){let e,n,t,o,i,s;const l=[ue(r[0],"hover-polygons"),{filter:kt},{paint:{"line-color":Kt.hovering,"line-width":.5*wt}}];let u={};for(let m=0;m(s(),s=He(a,f=>n(4,i=f)),a);Y(r,Zt,f=>n(3,o=f)),r.$$.on_destroy.push(()=>s());let{cfg:u}=e,{gjSchemes:a}=e;return l(),r.$$set=f=>{"cfg"in f&&n(0,u=f.cfg),"gjSchemes"in f&&l(n(1,a=f.gjSchemes))},r.$$.update=()=>{r.$$.dirty&24&&n(2,t=o==null?Gt():i.features.find(f=>f.id==o))},[u,a,t,o,i]}class Uf extends te{constructor(e){super(),ne(this,e,Df,Tf,x,{cfg:0,gjSchemes:1})}}function Vi(r){let e,n;return e=new Ir({props:{openOn:"hover",openIfTopMost:!0,$$slots:{default:[zf,({features:t})=>({16:t}),({features:t})=>t?65536:0]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&196608&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function zf(r){let e,n,t=r[9](r[16])+"",o;return{c(){e=G("div"),n=G("p"),o=q(t),T(e,"class","govuk-prose")},m(i,s){$(i,e,s),z(e,n),z(n,o)},p(i,s){s&65536&&t!==(t=i[9](i[16])+"")&&ge(o,t)},d(i){i&&y(e)}}}function Jf(r){let e,n,t=r[4]&&Vi(r);return{c(){t&&t.c(),e=fe()},m(o,i){t&&t.m(o,i),$(o,e,i),n=!0},p(o,i){o[4]?t?(t.p(o,i),i&16&&w(t,1)):(t=Vi(o),t.c(),w(t,1),t.m(e.parentNode,e)):t&&(se(),k(t,1,1,()=>{t=null}),le())},i(o){n||(w(t),n=!0)},o(o){k(t),n=!1},d(o){o&&y(e),t&&t.d(o)}}}function Qi(r){let e,n;return e=new Ir({props:{openOn:"hover",openIfTopMost:!0,$$slots:{default:[Yf,({features:t})=>({16:t}),({features:t})=>t?65536:0]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&196608&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Yf(r){let e,n,t=r[9](r[16])+"",o;return{c(){e=G("div"),n=G("p"),o=q(t),T(e,"class","govuk-prose")},m(i,s){$(i,e,s),z(e,n),z(n,o)},p(i,s){s&65536&&t!==(t=i[9](i[16])+"")&&ge(o,t)},d(i){i&&y(e)}}}function Xf(r){let e,n,t=r[4]&&Qi(r);return{c(){t&&t.c(),e=fe()},m(o,i){t&&t.m(o,i),$(o,e,i),n=!0},p(o,i){o[4]?t?(t.p(o,i),i&16&&w(t,1)):(t=Qi(o),t.c(),w(t,1),t.m(e.parentNode,e)):t&&(se(),k(t,1,1,()=>{t=null}),le())},i(o){n||(w(t),n=!0)},o(o){k(t),n=!1},d(o){o&&y(e),t&&t.d(o)}}}function xi(r){let e,n;return e=new Ir({props:{openOn:"hover",openIfTopMost:!0,$$slots:{default:[Wf,({features:t})=>({16:t}),({features:t})=>t?65536:0]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&196608&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Wf(r){let e,n,t=r[9](r[16])+"",o;return{c(){e=G("div"),n=G("p"),o=q(t),T(e,"class","govuk-prose")},m(i,s){$(i,e,s),z(e,n),z(n,o)},p(i,s){s&65536&&t!==(t=i[9](i[16])+"")&&ge(o,t)},d(i){i&&y(e)}}}function Hf(r){let e,n,t=r[4]&&xi(r);return{c(){t&&t.c(),e=fe()},m(o,i){t&&t.m(o,i),$(o,e,i),n=!0},p(o,i){o[4]?t?(t.p(o,i),i&16&&w(t,1)):(t=xi(o),t.c(),w(t,1),t.m(e.parentNode,e)):t&&(se(),k(t,1,1,()=>{t=null}),le())},i(o){n||(w(t),n=!0)},o(o){k(t),n=!1},d(o){o&&y(e),t&&t.d(o)}}}function Zf(r){let e,n,t,o,i,s,l,u,a,f;const c=[ue(r[0],"interventions-points"),{filter:["all",on,r[6],r[7],r[3]]},{paint:{"circle-color":r[2],"circle-radius":Ln}},{hoverCursor:r[4]?"pointer":void 0},{manageHoverState:r[4]}];let p={$$slots:{default:[Jf]},$$scope:{ctx:r}};for(let h=0;h(u(),u=He(g,h=>n(11,l=h)),g),f,c,p;Y(r,qe,h=>n(14,f=h)),Y(r,oe,h=>n(12,c=h)),Y(r,Vt,h=>n(13,p=h)),r.$$.on_destroy.push(()=>u());let{cfg:m}=e,{gjSchemes:g}=e;a();const b=["!=",["get","hide_while_editing"],!0],v=["!=",["get","endpoint"],!0];let S;function d(h){return Jt(["get","scheme_reference"],Object.fromEntries(Object.values(h.schemes).map(M=>[M.scheme_reference,M.color])),"black")}function _(h){c.mode!="list"||!f||h.detail.features[0]&&(f.getCanvas().style.cursor="inherit",oe.set({mode:"edit-form",id:h.detail.features[0].id}))}function E(h){if(h){let M=h[0],O=m.interventionName(M),B=m.schemeName(l.schemes[M.properties.scheme_reference]);return`${O} (${B})`}return"Tooltip bug"}return r.$$set=h=>{"cfg"in h&&n(0,m=h.cfg),"gjSchemes"in h&&a(n(1,g=h.gjSchemes))},r.$$.update=()=>{if(r.$$.dirty&2048&&n(5,t=Sl(l)),r.$$.dirty&4096&&n(4,o=c.mode=="list"),r.$$.dirty&8192&&n(3,i=Vf(p)),r.$$.dirty&2048&&n(10,s=d(l)),r.$$.dirty&5120){let h="grey";c.mode=="edit-form"?n(2,S=["case",["==",["id"],c.id],s,h]):c.mode=="list"?n(2,S=s):c.mode=="split-route"?n(2,S=["case",["==","intervention_type","route"],s,h]):n(2,S=h)}},[m,g,S,i,o,t,b,v,_,E,s,l,c,p]}class xf extends te{constructor(e){super(),ne(this,e,Qf,Kf,x,{cfg:0,gjSchemes:1})}}function ec(r){let e,n,t,o,i,s;const l=[ue(r[0],"edit-polygon-fill"),{filter:kt},{paint:{"fill-color":"red","fill-opacity":["case",["boolean",["get","hover"],"false"],1,.5]}}];let u={};for(let m=0;mn(1,t=i));let{cfg:o}=e;return r.$$set=i=>{"cfg"in i&&n(0,o=i.cfg)},[o,t]}class rc extends te{constructor(e){super(),ne(this,e,nc,tc,x,{cfg:0})}}function ic(r){let e,n,t,o,i,s;const l=[ue(r[0],"route-points"),{filter:on},{paint:{"circle-color":Jt(["get","type"],{"snapped-waypoint":"red","free-waypoint":"blue"},"black"),"circle-opacity":["case",["has","hovered"],.5,1],"circle-radius":Jt(["get","type"],{node:hn/2},hn)}}];let u={};for(let m=0;m({3:t}),({feature:t})=>t?8:0]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&24&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function lc(r){let e,n,t,o;return e=new Et({props:{data:r[1],$$slots:{default:[ic]},$$scope:{ctx:r}}}),t=new Et({props:{data:r[2],$$slots:{default:[sc]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,[s]){const l={};s&2&&(l.data=i[1]),s&17&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&4&&(u.data=i[2]),s&16&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}const hn=10;function eo(r){var e;return(e=r.properties)==null?void 0:e.number}function uc(r,e,n){let t,o;Y(r,ws,s=>n(1,t=s)),Y(r,kn,s=>n(2,o=s));let{cfg:i}=e;return r.$$set=s=>{"cfg"in s&&n(0,i=s.cfg)},[i,t,o]}class ac extends te{constructor(e){super(),ne(this,e,uc,lc,x,{cfg:0})}}var fc=Object.defineProperty,vt=(r,e)=>fc(r,"name",{value:e,configurable:!0});function Ut(r){if(!r)throw new Error("coord is required");if(!Array.isArray(r)){if(r.type==="Feature"&&r.geometry!==null&&r.geometry.type==="Point")return[...r.geometry.coordinates];if(r.type==="Point")return[...r.coordinates]}if(Array.isArray(r)&&r.length>=2&&!Array.isArray(r[0])&&!Array.isArray(r[1]))return[...r];throw new Error("coord must be GeoJSON Point or an Array of numbers")}vt(Ut,"getCoord");function Ms(r){if(Array.isArray(r))return r;if(r.type==="Feature"){if(r.geometry!==null)return r.geometry.coordinates}else if(r.coordinates)return r.coordinates;throw new Error("coords must be GeoJSON Feature, Geometry Object or an Array")}vt(Ms,"getCoords");function Ps(r){if(r.length>1&&Qr(r[0])&&Qr(r[1]))return!0;if(Array.isArray(r[0])&&r[0].length)return Ps(r[0]);throw new Error("coordinates must only contain numbers")}vt(Ps,"containsNumber");function cc(r,e,n){if(!e||!n)throw new Error("type and name required");if(!r||r.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+r.type)}vt(cc,"geojsonType");function pc(r,e,n){if(!r)throw new Error("No feature passed");if(!n)throw new Error(".featureOf() requires a name");if(!r||r.type!=="Feature"||!r.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!r.geometry||r.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+r.geometry.type)}vt(pc,"featureOf");function mc(r,e,n){if(!r)throw new Error("No featureCollection passed");if(!n)throw new Error(".collectionOf() requires a name");if(!r||r.type!=="FeatureCollection")throw new Error("Invalid input to "+n+", FeatureCollection required");for(const t of r.features){if(!t||t.type!=="Feature"||!t.geometry)throw new Error("Invalid input to "+n+", Feature with geometry required");if(!t.geometry||t.geometry.type!==e)throw new Error("Invalid input to "+n+": must be a "+e+", given "+t.geometry.type)}}vt(mc,"collectionOf");function dc(r){return r.type==="Feature"?r.geometry:r}vt(dc,"getGeom");function gc(r,e){return r.type==="FeatureCollection"?"FeatureCollection":r.type==="GeometryCollection"?"GeometryCollection":r.type==="Feature"&&r.geometry!==null?r.geometry.type:r.type}vt(gc,"getType");var hc=Object.defineProperty,Ls=(r,e)=>hc(r,"name",{value:e,configurable:!0});function Wr(r,e,n={}){if(n.final===!0)return Cs(r,e);const t=Ut(r),o=Ut(e),i=De(t[0]),s=De(o[0]),l=De(t[1]),u=De(o[1]),a=Math.sin(s-i)*Math.cos(u),f=Math.cos(l)*Math.sin(u)-Math.sin(l)*Math.cos(u)*Math.cos(s-i);return cr(Math.atan2(a,f))}Ls(Wr,"bearing");function Cs(r,e){let n=Wr(e,r);return n=(n+180)%360,n}Ls(Cs,"calculateFinalBearing");var _c=Object.defineProperty,bc=(r,e)=>_c(r,"name",{value:e,configurable:!0});function Ot(r,e,n={}){var t=Ut(r),o=Ut(e),i=De(o[1]-t[1]),s=De(o[0]-t[0]),l=De(t[1]),u=De(o[1]),a=Math.pow(Math.sin(i/2),2)+Math.pow(Math.sin(s/2),2)*Math.cos(l)*Math.cos(u);return fl(2*Math.atan2(Math.sqrt(a),Math.sqrt(1-a)),n.units)}bc(Ot,"distance");var vc=Object.defineProperty,$c=(r,e)=>vc(r,"name",{value:e,configurable:!0});function Ar(r,e,n,t={}){const o=Ut(r),i=De(o[0]),s=De(o[1]),l=De(n),u=cl(e,t.units),a=Math.asin(Math.sin(s)*Math.cos(u)+Math.cos(s)*Math.sin(u)*Math.cos(l)),f=i+Math.atan2(Math.sin(l)*Math.sin(u)*Math.cos(s),Math.cos(u)-Math.sin(s)*Math.sin(a)),c=cr(f),p=cr(a);return Te([c,p],t.properties)}$c(Ar,"destination");class Ns{constructor(e=[],n=yc){if(this.data=e,this.length=this.data.length,this.compare=n,this.length>0)for(let t=(this.length>>1)-1;t>=0;t--)this._down(t)}push(e){this.data.push(e),this.length++,this._up(this.length-1)}pop(){if(this.length===0)return;const e=this.data[0],n=this.data.pop();return this.length--,this.length>0&&(this.data[0]=n,this._down(0)),e}peek(){return this.data[0]}_up(e){const{data:n,compare:t}=this,o=n[e];for(;e>0;){const i=e-1>>1,s=n[i];if(t(o,s)>=0)break;n[e]=s,e=i}n[e]=o}_down(e){const{data:n,compare:t}=this,o=this.length>>1,i=n[e];for(;e=0)break;n[e]=l,e=s}n[e]=i}}function yc(r,e){return re?1:0}function Fs(r,e){return r.p.x>e.p.x?1:r.p.xe.p.y?1:-1:1}function wc(r,e){return r.rightSweepEvent.p.x>e.rightSweepEvent.p.x?1:r.rightSweepEvent.p.x0?(f.isLeftEndpoint=!0,a.isLeftEndpoint=!1):(a.isLeftEndpoint=!0,f.isLeftEndpoint=!1),e.push(a),e.push(f),s=l,vn=vn+1}}_n=_n+1}class Sc{constructor(e){this.leftSweepEvent=e,this.rightSweepEvent=e.otherEvent}}function Ec(r,e){if(r===null||e===null||r.leftSweepEvent.ringId===e.leftSweepEvent.ringId&&(r.rightSweepEvent.isSamePoint(e.leftSweepEvent)||r.rightSweepEvent.isSamePoint(e.leftSweepEvent)||r.rightSweepEvent.isSamePoint(e.rightSweepEvent)||r.leftSweepEvent.isSamePoint(e.leftSweepEvent)||r.leftSweepEvent.isSamePoint(e.rightSweepEvent)))return!1;const n=r.leftSweepEvent.p.x,t=r.leftSweepEvent.p.y,o=r.rightSweepEvent.p.x,i=r.rightSweepEvent.p.y,s=e.leftSweepEvent.p.x,l=e.leftSweepEvent.p.y,u=e.rightSweepEvent.p.x,a=e.rightSweepEvent.p.y,f=(a-l)*(o-n)-(u-s)*(i-t),c=(u-s)*(t-l)-(a-l)*(n-s),p=(o-n)*(t-l)-(i-t)*(n-s);if(f===0)return!1;const m=c/f,g=p/f;if(m>=0&&m<=1&&g>=0&&g<=1){const b=n+m*(o-n),v=t+m*(i-t);return[b,v]}return!1}function Mc(r,e){e=e||!1;const n=[],t=new Ns([],wc);for(;r.length;){const o=r.pop();if(o.isLeftEndpoint){const i=new Sc(o);for(let s=0;sLc(r,"name",{value:e,configurable:!0}),Nc=Pc;function As(r,e,n={}){const{removeDuplicates:t=!0,ignoreSelfIntersections:o=!1}=n;let i=[];r.type==="FeatureCollection"?i=i.concat(r.features):r.type==="Feature"?i.push(r):(r.type==="LineString"||r.type==="Polygon"||r.type==="MultiLineString"||r.type==="MultiPolygon")&&i.push(Cn(r)),e.type==="FeatureCollection"?i=i.concat(e.features):e.type==="Feature"?i.push(e):(e.type==="LineString"||e.type==="Polygon"||e.type==="MultiLineString"||e.type==="MultiPolygon")&&i.push(Cn(e));const s=Nc(xr(i),o);let l=[];if(t){const u={};s.forEach(a=>{const f=a.join(",");u[f]||(u[f]=!0,l.push(a))})}else l=s;return xr(l.map(u=>Te(u)))}Cc(As,"lineIntersect");var Fc=Object.defineProperty,Se=(r,e)=>Fc(r,"name",{value:e,configurable:!0});function fn(r,e,n){if(r!==null)for(var t,o,i,s,l,u,a,f=0,c=0,p,m=r.type,g=m==="FeatureCollection",b=m==="Feature",v=g?r.features.length:1,S=0;Su||g>a||b>f){l=c,u=t,a=g,f=b,i=0;return}var v=pt([l,c],n.properties);if(e(v,t,o,b,i)===!1)return!1;i++,l=c})===!1)return!1}}})}Se(js,"segmentEach");function qc(r,e,n){var t=n,o=!1;return js(r,function(i,s,l,u,a){o===!1&&n===void 0?t=i:t=e(t,i,s,l,u,a),o=!0}),t}Se(qc,"segmentReduce");function Is(r,e){if(!r)throw new Error("geojson is required");cn(r,function(n,t,o){if(n.geometry!==null){var i=n.geometry.type,s=n.geometry.coordinates;switch(i){case"LineString":if(e(n,t,o,0,0)===!1)return!1;break;case"Polygon":for(var l=0;le in r?Bs(r,e,{enumerable:!0,configurable:!0,writable:!0,value:n}):r[e]=n,$t=(r,e)=>{for(var n in e||(e={}))Jc.call(e,n)&&io(r,n,e[n]);if(ro)for(var n of ro(e))Yc.call(e,n)&&io(r,n,e[n]);return r},yt=(r,e)=>Uc(r,zc(e)),Xc=(r,e)=>Bs(r,"name",{value:e,configurable:!0});function qs(r,e,n={}){if(!r||!e)throw new Error("lines and pt are required arguments");let t=Te([1/0,1/0],{dist:1/0,index:-1,location:-1}),o=0;return cn(r,function(i){const s=Ms(i);for(let l=0;l0&&b.features[0]&&(v=yt($t({},b.features[0]),{properties:{dist:Ot(e,b.features[0],n),location:o+Ot(u,b.features[0],n)}})),u.properties.dist(o(),o=He(u,v=>n(8,t=v)),u),s;Y(r,qe,v=>n(9,s=v)),r.$$.on_destroy.push(()=>o());let{cfg:l}=e,{gjSchemes:u}=e;i(),ot(()=>{s&&(s.getCanvas().style.cursor=`url(${Gs}), crosshair`)}),Xe(()=>{s&&(s.getCanvas().style.cursor="inherit")});let a=null,f=null,c=Gt();function p(v){if(!s)return;n(6,a=null),f=null;let S=b(v.detail.lngLat.toArray());const d=[v.detail.point.x-Kc,v.detail.point.y],_=s.unproject(v.detail.point).distanceTo(s.unproject(d))/1e3;let E=[];for(let[h,M]of t.features.entries())if(M.geometry.type=="LineString"){let O=Wc(M.geometry,S,{units:"kilometers"});O.properties.dist!=null&&O.properties.dist<=_&&E.push([h,O.geometry.coordinates,O.properties.dist])}E.sort((h,M)=>h[2]-M[2]),E.length>0&&(n(6,a=b(E[0][1])),f=E[0][0])}function m(){if(f==null){oe.set({mode:"list"});return}let v=ra(t.features[f],a);if(v!=null){let[S,d]=v;u.update(_=>(S.id=_.features[f].id,d.id=un(_),_.features.splice(f,1,S,d),_))}n(6,a=null),f=null}function g(v){v.key=="Escape"&&(v.stopPropagation(),oe.set({mode:"list"}))}function b(v){return{type:"Feature",properties:{},geometry:{type:"Point",coordinates:jo(v)}}}return r.$$set=v=>{"cfg"in v&&n(0,l=v.cfg),"gjSchemes"in v&&i(n(1,u=v.gjSchemes))},r.$$.update=()=>{if(r.$$.dirty&64){let v=Gt();a&&v.features.push(a),n(2,c=v)}},[l,u,c,p,m,g,a]}class Qc extends te{constructor(e){super(),ne(this,e,Vc,Zc,x,{cfg:0,gjSchemes:1})}}function xc(r){let e;return{c(){e=q("Finish")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function ep(r){let e,n,t,o,i,s,l,u,a,f;function c(b){r[4](b)}let p={cfg:r[0],map:r[2],showControls:!1};r[1]!==void 0&&(p.enabled=r[1]),e=new Ml({props:p}),K.push(()=>V(e,"enabled",c)),o=new st({props:{$$slots:{default:[xc]},$$scope:{ctx:r}}}),o.$on("click",r[5]);function m(b){r[6](b)}let g={legend:"Source",choices:[["google","Google Street View"],["bing","Bing Streetside"]],inlineSmall:!0};return r[3].streetViewImagery!==void 0&&(g.value=r[3].streetViewImagery),s=new qt({props:g}),K.push(()=>V(s,"value",m)),a=new Pl({}),{c(){P(e.$$.fragment),t=F(),P(o.$$.fragment),i=F(),P(s.$$.fragment),u=F(),P(a.$$.fragment)},m(b,v){L(e,b,v),$(b,t,v),L(o,b,v),$(b,i,v),L(s,b,v),$(b,u,v),L(a,b,v),f=!0},p(b,[v]){const S={};v&1&&(S.cfg=b[0]),v&4&&(S.map=b[2]),!n&&v&2&&(n=!0,S.enabled=b[1],Q(()=>n=!1)),e.$set(S);const d={};v&128&&(d.$$scope={dirty:v,ctx:b}),o.$set(d);const _={};!l&&v&8&&(l=!0,_.value=b[3].streetViewImagery,Q(()=>l=!1)),s.$set(_)},i(b){f||(w(e.$$.fragment,b),w(o.$$.fragment,b),w(s.$$.fragment,b),w(a.$$.fragment,b),f=!0)},o(b){k(e.$$.fragment,b),k(o.$$.fragment,b),k(s.$$.fragment,b),k(a.$$.fragment,b),f=!1},d(b){b&&(y(t),y(i),y(u)),C(e,b),C(o,b),C(s,b),C(a,b)}}}function tp(r,e,n){let t,o;Y(r,qe,f=>n(2,t=f)),Y(r,Pn,f=>n(3,o=f));let{cfg:i}=e,s=!0;function l(f){s=f,n(1,s)}const u=()=>n(1,s=!1);function a(f){r.$$.not_equal(o.streetViewImagery,f)&&(o.streetViewImagery=f,Pn.set(o))}return r.$$set=f=>{"cfg"in f&&n(0,i=f.cfg)},r.$$.update=()=>{r.$$.dirty&2&&(s||oe.set({mode:"list"}))},[i,s,t,o,l,u,a]}class np extends te{constructor(e){super(),ne(this,e,tp,ep,x,{cfg:0})}}const rp="/atip/ss_huge_refactor_pt1/assets/image-3e3a13e8.svg",ip="/atip/ss_huge_refactor_pt1/assets/point-276f4055.svg",op="/atip/ss_huge_refactor_pt1/assets/polygon_freehand-cf965967.svg",sp="/atip/ss_huge_refactor_pt1/assets/polygon_snapped-18efbbea.svg",lp="/atip/ss_huge_refactor_pt1/assets/route-d3c0ebad.svg",up="/atip/ss_huge_refactor_pt1/assets/street_view-48580b6a.svg";function ap(r){let e,n,t;return{c(){e=G("img"),t=q(` + New point`),Ye(e.src,n=ip)||T(e,"src",n),T(e,"alt","New point")},m(o,i){$(o,e,i),$(o,t,i)},p:ee,d(o){o&&(y(e),y(t))}}}function fp(r){let e,n,t;return{c(){e=G("img"),t=q(` + New route`),Ye(e.src,n=lp)||T(e,"src",n),T(e,"alt","New route")},m(o,i){$(o,e,i),$(o,t,i)},p:ee,d(o){o&&(y(e),y(t))}}}function cp(r){let e,n,t;return{c(){e=G("img"),t=q(` + New polygon (freehand)`),Ye(e.src,n=op)||T(e,"src",n),T(e,"alt","New polygon (freehand)")},m(o,i){$(o,e,i),$(o,t,i)},p:ee,d(o){o&&(y(e),y(t))}}}function pp(r){let e,n,t;return{c(){e=G("img"),t=q(` + New polygon (snapped)`),Ye(e.src,n=sp)||T(e,"src",n),T(e,"alt","New polygon (snapped)")},m(o,i){$(o,e,i),$(o,t,i)},p:ee,d(o){o&&(y(e),y(t))}}}function mp(r){let e,n,t;return{c(){e=G("img"),t=q(` + Split route`),Ye(e.src,n=Gs)||T(e,"src",n),T(e,"alt","Split route")},m(o,i){$(o,e,i),$(o,t,i)},p:ee,d(o){o&&(y(e),y(t))}}}function dp(r){let e,n,t;return{c(){e=G("img"),t=q(` + Georeference image`),Ye(e.src,n=rp)||T(e,"src",n),T(e,"alt","Georeference image")},m(o,i){$(o,e,i),$(o,t,i)},p:ee,d(o){o&&(y(e),y(t))}}}function gp(r){let e,n,t;return{c(){e=G("img"),t=q(` + StreetView`),Ye(e.src,n=up)||T(e,"src",n),T(e,"alt","StreetView")},m(o,i){$(o,e,i),$(o,t,i)},p:ee,d(o){o&&(y(e),y(t))}}}function hp(r){let e,n,t,o,i,s,l,u,a,f,c,p,m,g,b,v,S;return e=new Uf({props:{cfg:r[0],gjSchemes:r[1]}}),o=new ae({props:{disabled:!r[2],$$slots:{default:[ap]},$$scope:{ctx:r}}}),o.$on("click",r[5]),s=new ae({props:{disabled:!r[3],$$slots:{default:[fp]},$$scope:{ctx:r}}}),s.$on("click",r[6]),u=new ae({props:{disabled:!r[4],$$slots:{default:[cp]},$$scope:{ctx:r}}}),u.$on("click",r[7]),f=new ae({props:{disabled:!r[3],$$slots:{default:[pp]},$$scope:{ctx:r}}}),f.$on("click",r[8]),p=new ae({props:{$$slots:{default:[mp]},$$scope:{ctx:r}}}),p.$on("click",r[9]),g=new ae({props:{$$slots:{default:[dp]},$$scope:{ctx:r}}}),g.$on("click",r[10]),v=new ae({props:{$$slots:{default:[gp]},$$scope:{ctx:r}}}),v.$on("click",r[11]),{c(){P(e.$$.fragment),n=F(),t=G("div"),P(o.$$.fragment),i=F(),P(s.$$.fragment),l=F(),P(u.$$.fragment),a=F(),P(f.$$.fragment),c=F(),P(p.$$.fragment),m=F(),P(g.$$.fragment),b=F(),P(v.$$.fragment),T(t,"class","top govuk-prose svelte-1kai3ke")},m(d,_){L(e,d,_),$(d,n,_),$(d,t,_),L(o,t,null),z(t,i),L(s,t,null),z(t,l),L(u,t,null),z(t,a),L(f,t,null),z(t,c),L(p,t,null),z(t,m),L(g,t,null),z(t,b),L(v,t,null),S=!0},p(d,[_]){const E={};_&1&&(E.cfg=d[0]),_&2&&(E.gjSchemes=d[1]),e.$set(E);const h={};_&4&&(h.disabled=!d[2]),_&4096&&(h.$$scope={dirty:_,ctx:d}),o.$set(h);const M={};_&8&&(M.disabled=!d[3]),_&4096&&(M.$$scope={dirty:_,ctx:d}),s.$set(M);const O={};_&16&&(O.disabled=!d[4]),_&4096&&(O.$$scope={dirty:_,ctx:d}),u.$set(O);const B={};_&8&&(B.disabled=!d[3]),_&4096&&(B.$$scope={dirty:_,ctx:d}),f.$set(B);const D={};_&4096&&(D.$$scope={dirty:_,ctx:d}),p.$set(D);const I={};_&4096&&(I.$$scope={dirty:_,ctx:d}),g.$set(I);const A={};_&4096&&(A.$$scope={dirty:_,ctx:d}),v.$set(A)},i(d){S||(w(e.$$.fragment,d),w(o.$$.fragment,d),w(s.$$.fragment,d),w(u.$$.fragment,d),w(f.$$.fragment,d),w(p.$$.fragment,d),w(g.$$.fragment,d),w(v.$$.fragment,d),S=!0)},o(d){k(e.$$.fragment,d),k(o.$$.fragment,d),k(s.$$.fragment,d),k(u.$$.fragment,d),k(f.$$.fragment,d),k(p.$$.fragment,d),k(g.$$.fragment,d),k(v.$$.fragment,d),S=!1},d(d){d&&(y(n),y(t)),C(e,d),C(o),C(s),C(u),C(f),C(p),C(g),C(v)}}}function _p(r,e,n){let t,o,i;Y(r,nn,b=>n(2,t=b)),Y(r,We,b=>n(3,o=b)),Y(r,It,b=>n(4,i=b));let{cfg:s}=e,{gjSchemes:l}=e;const u=()=>oe.set({mode:"new-point"}),a=()=>oe.set({mode:"new-route"}),f=()=>oe.set({mode:"new-freehand-polygon"}),c=()=>oe.set({mode:"new-snapped-polygon"}),p=()=>oe.set({mode:"split-route"}),m=()=>oe.set({mode:"set-image"}),g=()=>oe.set({mode:"streetview"});return r.$$set=b=>{"cfg"in b&&n(0,s=b.cfg),"gjSchemes"in b&&n(1,l=b.gjSchemes)},[s,l,t,o,i,u,a,f,c,p,m,g]}class bp extends te{constructor(e){super(),ne(this,e,_p,hp,x,{cfg:0,gjSchemes:1})}}const vp="/atip/ss_huge_refactor_pt1/assets/delete-3c023172.svg",$p="/atip/ss_huge_refactor_pt1/assets/save-74d8f3c2.svg";function so(r){let e,n;return e=new ae({props:{disabled:!r[2],$$slots:{default:[yp]},$$scope:{ctx:r}}}),e.$on("click",r[7]),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&4&&(i.disabled=!t[2]),o&4096&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function yp(r){let e;return{c(){e=q("Auto-fill")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function wp(r){let e,n,t,o,i,s,l=r[0].length_meters&&so(r);return{c(){e=G("input"),n=F(),l&&l.c(),t=fe(),T(e,"type","text"),T(e,"class","govuk-input"),T(e,"id",r[5])},m(u,a){$(u,e,a),Le(e,r[0].name),$(u,n,a),l&&l.m(u,a),$(u,t,a),o=!0,i||(s=he(e,"input",r[6]),i=!0)},p(u,a){a&1&&e.value!==u[0].name&&Le(e,u[0].name),u[0].length_meters?l?(l.p(u,a),a&1&&w(l,1)):(l=so(u),l.c(),w(l,1),l.m(t.parentNode,t)):l&&(se(),k(l,1,1,()=>{l=null}),le())},i(u){o||(w(l),o=!0)},o(u){k(l),o=!1},d(u){u&&(y(e),y(n),y(t)),l&&l.d(u),i=!1,s()}}}function lo(r){let e,n,t=Fn(r[0].length_meters)+"",o;return{c(){e=G("p"),n=q("Length: "),o=q(t)},m(i,s){$(i,e,s),z(e,n),z(e,o)},p(i,s){s&1&&t!==(t=Fn(i[0].length_meters)+"")&&ge(o,t)},d(i){i&&y(e)}}}function kp(r){let e,n,t,o,i,s,l,u,a,f,c,p,m;e=new Mt({props:{label:"Name",id:r[5],$$slots:{default:[wp]},$$scope:{ctx:r}}});function g(h){r[9](h)}let b={label:"Scheme",choices:Object.values(r[3].schemes).map(r[8])};r[0].scheme_reference!==void 0&&(b.value=r[0].scheme_reference),t=new xn({props:b}),K.push(()=>V(t,"value",g));function v(h){r[10](h)}let S={legend:"Type",choices:[["area","Area"],["route","Route"],["crossing","Crossing"],["other","Other"]],inlineSmall:!0,required:!0};r[0].intervention_type!==void 0&&(S.value=r[0].intervention_type),s=new qt({props:S}),K.push(()=>V(s,"value",v));function d(h){r[11](h)}let _={label:"Description"};r[0].description!==void 0&&(_.value=r[0].description),a=new qr({props:_}),K.push(()=>V(a,"value",d));let E=r[0].length_meters&&lo(r);return{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment),i=F(),P(s.$$.fragment),u=F(),P(a.$$.fragment),c=F(),E&&E.c(),p=fe()},m(h,M){L(e,h,M),$(h,n,M),L(t,h,M),$(h,i,M),L(s,h,M),$(h,u,M),L(a,h,M),$(h,c,M),E&&E.m(h,M),$(h,p,M),m=!0},p(h,[M]){const O={};M&4101&&(O.$$scope={dirty:M,ctx:h}),e.$set(O);const B={};M&8&&(B.choices=Object.values(h[3].schemes).map(h[8])),!o&&M&1&&(o=!0,B.value=h[0].scheme_reference,Q(()=>o=!1)),t.$set(B);const D={};!l&&M&1&&(l=!0,D.value=h[0].intervention_type,Q(()=>l=!1)),s.$set(D);const I={};!f&&M&1&&(f=!0,I.value=h[0].description,Q(()=>f=!1)),a.$set(I),h[0].length_meters?E?E.p(h,M):(E=lo(h),E.c(),E.m(p.parentNode,p)):E&&(E.d(1),E=null)},i(h){m||(w(e.$$.fragment,h),w(t.$$.fragment,h),w(s.$$.fragment,h),w(a.$$.fragment,h),m=!0)},o(h){k(e.$$.fragment,h),k(t.$$.fragment,h),k(s.$$.fragment,h),k(a.$$.fragment,h),m=!1},d(h){h&&(y(n),y(i),y(u),y(c),y(p)),C(e,h),C(t,h),C(s,h),C(a,h),E&&E.d(h)}}}function Sp(r,e,n){let t,o,i=ee,s=()=>(i(),i=He(l,S=>n(3,o=S)),l);Y(r,We,S=>n(2,t=S)),r.$$.on_destroy.push(()=>i());let{gjSchemes:l}=e;s();let{props:u}=e;function a(){try{n(0,u.name=t.inner.routeNameForWaypoints(u.waypoints),u)}catch(S){window.alert(`Couldn't auto-name route: ${S}`)}}let f=Pt();function c(){u.name=this.value,n(0,u)}const p=()=>a(),m=S=>[S.scheme_reference,Zr(S)];function g(S){r.$$.not_equal(u.scheme_reference,S)&&(u.scheme_reference=S,n(0,u))}function b(S){r.$$.not_equal(u.intervention_type,S)&&(u.intervention_type=S,n(0,u))}function v(S){r.$$.not_equal(u.description,S)&&(u.description=S,n(0,u))}return r.$$set=S=>{"gjSchemes"in S&&s(n(1,l=S.gjSchemes)),"props"in S&&n(0,u=S.props)},[u,l,t,o,a,f,c,p,m,g,b,v]}class Ep extends te{constructor(e){super(),ne(this,e,Sp,kp,x,{gjSchemes:1,props:0})}}function Mp(r){let e,n,t;function o(s){r[2](s)}let i={label:r[1],choices:[lt("New segregated cycling facility"),lt("New junction treatment"),lt("New permanent footway"),["New shared use facilities","New shared use (walking and cycling) facilities"],["Improvements to existing route","Improvements to make an existing walking/cycle route safer"],["Area-wide traffic management","Area-wide traffic management (including by TROs - both permanent and experimental)"],["Bus priority measures","Bus priority measures that also enable active travel (for example, bus gates)"],["Secure cycle parking","Provision of secure cycle parking facilities"],lt("New road crossings"),lt("Restriction or reduction of car parking availability"),lt("School streets"),lt("Quiet mixed traffic streets"),lt("Traffic free routes"),lt("Not specified in LCWIP")],emptyOption:!0};return r[0]!==void 0&&(i.value=r[0]),e=new xn({props:i}),K.push(()=>V(e,"value",o)),{c(){P(e.$$.fragment)},m(s,l){L(e,s,l),t=!0},p(s,[l]){const u={};l&2&&(u.label=s[1]),!n&&l&1&&(n=!0,u.value=s[0],Q(()=>n=!1)),e.$set(u)},i(s){t||(w(e.$$.fragment,s),t=!0)},o(s){k(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function lt(r){return[r,r]}function Pp(r,e,n){let{label:t}=e,{value:o}=e;function i(s){o=s,n(0,o)}return r.$$set=s=>{"label"in s&&n(1,t=s.label),"value"in s&&n(0,o=s.value)},[o,t,i]}class Ts extends te{constructor(e){super(),ne(this,e,Pp,Mp,x,{label:1,value:0})}}function Lp(r){let e,n,t,o,i,s,l,u,a,f,c,p,m,g,b,v,S,d;function _(N){r[3](N)}let E={legend:"Status",choices:[["","Unknown"],["aspiration","Aspiration"],["planned","Planned"],["in development","In development"],["in construction","In construction"],["completed","Completed"]],inlineSmall:!0,required:r[1]};r[0].status!==void 0&&(E.value=r[0].status),o=new qt({props:E}),K.push(()=>V(o,"value",_));function h(N){r[4](N)}let M={legend:"Timescale",choices:[["","Unknown"],["short","Short (1-3 years)"],["medium","Medium (3-6 years)"],["long","Long (6-10 years)"]],inlineSmall:!0,required:r[1]};r[0].timescale!==void 0&&(M.value=r[0].timescale),l=new qt({props:M}),K.push(()=>V(l,"value",h));function O(N){r[5](N)}let B={label:"Estimated completion year (if known)",width:4,min:2010,max:2100};r[0].timescale_year!==void 0&&(B.value=r[0].timescale_year),f=new nr({props:B}),K.push(()=>V(f,"value",O));function D(N){r[6](N)}let I={label:"What year was this scheme most recently published?",width:4,min:2010,max:2100};r[0].year_published!==void 0&&(I.value=r[0].year_published),m=new nr({props:I}),K.push(()=>V(m,"value",D));function A(N){r[7](N)}let R={label:"What year was this scheme most recently consulted on?",width:4,min:2010,max:2100};return r[0].year_consulted!==void 0&&(R.value=r[0].year_consulted),v=new nr({props:R}),K.push(()=>V(v,"value",A)),{c(){e=G("fieldset"),n=G("legend"),n.textContent="Timing and status",t=F(),P(o.$$.fragment),s=F(),P(l.$$.fragment),a=F(),P(f.$$.fragment),p=F(),P(m.$$.fragment),b=F(),P(v.$$.fragment),T(n,"class","govuk-fieldset__legend"),T(e,"class","govuk-fieldset svelte-1bxyfcq")},m(N,j){$(N,e,j),z(e,n),z(e,t),L(o,e,null),z(e,s),L(l,e,null),z(e,a),L(f,e,null),z(e,p),L(m,e,null),z(e,b),L(v,e,null),d=!0},p(N,[j]){const H={};j&2&&(H.required=N[1]),!i&&j&1&&(i=!0,H.value=N[0].status,Q(()=>i=!1)),o.$set(H);const ie={};j&2&&(ie.required=N[1]),!u&&j&1&&(u=!0,ie.value=N[0].timescale,Q(()=>u=!1)),l.$set(ie);const ce={};!c&&j&1&&(c=!0,ce.value=N[0].timescale_year,Q(()=>c=!1)),f.$set(ce);const U={};!g&&j&1&&(g=!0,U.value=N[0].year_published,Q(()=>g=!1)),m.$set(U);const de={};!S&&j&1&&(S=!0,de.value=N[0].year_consulted,Q(()=>S=!1)),v.$set(de)},i(N){d||(w(o.$$.fragment,N),w(l.$$.fragment,N),w(f.$$.fragment,N),w(m.$$.fragment,N),w(v.$$.fragment,N),d=!0)},o(N){k(o.$$.fragment,N),k(l.$$.fragment,N),k(f.$$.fragment,N),k(m.$$.fragment,N),k(v.$$.fragment,N),d=!1},d(N){N&&y(e),C(o),C(l),C(f),C(m),C(v)}}}function Cp(r,e,n){let{data:t}=e,{required:o}=e,{onUpdate:i}=e;function s(p){i()}function l(p){r.$$.not_equal(t.status,p)&&(t.status=p,n(0,t))}function u(p){r.$$.not_equal(t.timescale,p)&&(t.timescale=p,n(0,t))}function a(p){r.$$.not_equal(t.timescale_year,p)&&(t.timescale_year=p,n(0,t))}function f(p){r.$$.not_equal(t.year_published,p)&&(t.year_published=p,n(0,t))}function c(p){r.$$.not_equal(t.year_consulted,p)&&(t.year_consulted=p,n(0,t))}return r.$$set=p=>{"data"in p&&n(0,t=p.data),"required"in p&&n(1,o=p.required),"onUpdate"in p&&n(2,i=p.onUpdate)},r.$$.update=()=>{r.$$.dirty&1&&s()},[t,o,i,l,u,a,f,c]}class Ds extends te{constructor(e){super(),ne(this,e,Cp,Lp,x,{data:0,required:1,onUpdate:2})}}function uo(r,e,n){const t=r.slice();return t[9]=e[n],t[10]=e,t[11]=n,t}function Np(r){let e;return{c(){e=q("Is the development fully funded?")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Fp(r){let e;return{c(){e=q("Is the construction fully funded?")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Ap(r){let e,n,t;function o(s){r[6](s,r[9])}let i={$$slots:{default:[Rp]},$$scope:{ctx:r}};return r[0].funding_sources[r[9]]!==void 0&&(i.checked=r[0].funding_sources[r[9]]),e=new ht({props:i}),K.push(()=>V(e,"checked",o)),{c(){P(e.$$.fragment)},m(s,l){L(e,s,l),t=!0},p(s,l){r=s;const u={};l&4096&&(u.$$scope={dirty:l,ctx:r}),!n&&l&3&&(n=!0,u.checked=r[0].funding_sources[r[9]],Q(()=>n=!1)),e.$set(u)},i(s){t||(w(e.$$.fragment,s),t=!0)},o(s){k(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function Rp(r){let e=r[9].toUpperCase()+"",n,t;return{c(){n=q(e),t=F()},m(o,i){$(o,n,i),$(o,t,i)},p:ee,d(o){o&&(y(n),y(t))}}}function ao(r){let e,n,t=r[9]!="other"&&Ap(r);return{c(){t&&t.c(),e=fe()},m(o,i){t&&t.m(o,i),$(o,e,i),n=!0},p(o,i){o[9]!="other"&&t.p(o,i)},i(o){n||(w(t),n=!0)},o(o){k(t),n=!1},d(o){o&&y(e),t&&t.d(o)}}}function Op(r){let e,n,t=je(r[1]),o=[];for(let s=0;sk(o[s],1,1,()=>{o[s]=null});return{c(){for(let s=0;sV(o,"value",E));function M(R){r[4](R)}let O={$$slots:{default:[Np]},$$scope:{ctx:r}};r[0].development_funded!==void 0&&(O.checked=r[0].development_funded),l=new ht({props:O}),K.push(()=>V(l,"checked",M));function B(R){r[5](R)}let D={$$slots:{default:[Fp]},$$scope:{ctx:r}};r[0].construction_funded!==void 0&&(D.checked=r[0].construction_funded),f=new ht({props:D}),K.push(()=>V(f,"checked",B)),b=new Do({props:{$$slots:{default:[Op]},$$scope:{ctx:r}}});function I(R){r[7](R)}let A={label:"Other funding sources"};return r[0].funding_sources.other!==void 0&&(A.value=r[0].funding_sources.other),S=new er({props:A}),K.push(()=>V(S,"value",I)),{c(){e=G("fieldset"),n=G("legend"),n.textContent="Budget",t=F(),P(o.$$.fragment),s=F(),P(l.$$.fragment),a=F(),P(f.$$.fragment),p=F(),m=G("p"),m.textContent="Funding sources",g=F(),P(b.$$.fragment),v=F(),P(S.$$.fragment),T(n,"class","govuk-fieldset__legend"),T(e,"class","govuk-fieldset svelte-1bxyfcq")},m(R,N){$(R,e,N),z(e,n),z(e,t),L(o,e,null),z(e,s),L(l,e,null),z(e,a),L(f,e,null),z(e,p),z(e,m),z(e,g),L(b,e,null),z(e,v),L(S,e,null),_=!0},p(R,[N]){const j={};!i&&N&1&&(i=!0,j.value=R[0].budget,Q(()=>i=!1)),o.$set(j);const H={};N&4096&&(H.$$scope={dirty:N,ctx:R}),!u&&N&1&&(u=!0,H.checked=R[0].development_funded,Q(()=>u=!1)),l.$set(H);const ie={};N&4096&&(ie.$$scope={dirty:N,ctx:R}),!c&&N&1&&(c=!0,ie.checked=R[0].construction_funded,Q(()=>c=!1)),f.$set(ie);const ce={};N&4097&&(ce.$$scope={dirty:N,ctx:R}),b.$set(ce);const U={};!d&&N&1&&(d=!0,U.value=R[0].funding_sources.other,Q(()=>d=!1)),S.$set(U)},i(R){_||(w(o.$$.fragment,R),w(l.$$.fragment,R),w(f.$$.fragment,R),w(b.$$.fragment,R),w(S.$$.fragment,R),_=!0)},o(R){k(o.$$.fragment,R),k(l.$$.fragment,R),k(f.$$.fragment,R),k(b.$$.fragment,R),k(S.$$.fragment,R),_=!1},d(R){R&&y(e),C(o),C(l),C(f),C(b),C(S)}}}function Ip(r,e,n){let{data:t}=e,{onUpdate:o}=e;function i(p){o()}let s=["atf2","atf3","atf4","atf4e","crsts","luf"];function l(p){r.$$.not_equal(t.budget,p)&&(t.budget=p,n(0,t))}function u(p){r.$$.not_equal(t.development_funded,p)&&(t.development_funded=p,n(0,t))}function a(p){r.$$.not_equal(t.construction_funded,p)&&(t.construction_funded=p,n(0,t))}function f(p,m){r.$$.not_equal(t.funding_sources[m],p)&&(t.funding_sources[m]=p,n(0,t))}function c(p){r.$$.not_equal(t.funding_sources.other,p)&&(t.funding_sources.other=p,n(0,t))}return r.$$set=p=>{"data"in p&&n(0,t=p.data),"onUpdate"in p&&n(2,o=p.onUpdate)},r.$$.update=()=>{r.$$.dirty&1&&i()},[t,s,o,l,u,a,f,c]}class Us extends te{constructor(e){super(),ne(this,e,Ip,jp,x,{data:0,onUpdate:2})}}function fo(r){let e,n;return e=new ae({props:{disabled:!r[2],$$slots:{default:[Bp]},$$scope:{ctx:r}}}),e.$on("click",r[8]),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&4&&(i.disabled=!t[2]),o&65536&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Bp(r){let e;return{c(){e=q("Auto-fill with street names")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function qp(r){let e,n,t,o,i,s,l,u,a=r[0].length_meters&&fo(r);return{c(){e=G("div"),e.textContent="Use the name from the LCWIP if possible",n=F(),t=G("input"),o=F(),a&&a.c(),i=fe(),T(e,"class","govuk-hint"),T(t,"type","text"),T(t,"class","govuk-input"),T(t,"id",r[6])},m(f,c){$(f,e,c),$(f,n,c),$(f,t,c),Le(t,r[0].name),$(f,o,c),a&&a.m(f,c),$(f,i,c),s=!0,l||(u=he(t,"input",r[7]),l=!0)},p(f,c){c&1&&t.value!==f[0].name&&Le(t,f[0].name),f[0].length_meters?a?(a.p(f,c),c&1&&w(a,1)):(a=fo(f),a.c(),w(a,1),a.m(i.parentNode,i)):a&&(se(),k(a,1,1,()=>{a=null}),le())},i(f){s||(w(a),s=!0)},o(f){k(a),s=!1},d(f){f&&(y(e),y(n),y(t),y(o),y(i)),a&&a.d(f),l=!1,u()}}}function co(r){let e,n,t=Fn(r[0].length_meters)+"",o;return{c(){e=G("p"),n=q("Length: "),o=q(t)},m(i,s){$(i,e,s),z(e,n),z(e,o)},p(i,s){s&1&&t!==(t=Fn(i[0].length_meters)+"")&&ge(o,t)},d(i){i&&y(e)}}}function po(r){let e,n,t,o,i,s,l,u,a,f,c,p,m,g;function b(M){r[12](M)}let v={label:"Type"};r[0].pipeline.atf4_type!==void 0&&(v.value=r[0].pipeline.atf4_type),e=new Ts({props:v}),K.push(()=>V(e,"value",b));function S(M){r[13](M)}let d={legend:"Accuracy of mapped data",choices:[["high","High"],["medium","Medium"],["low","Low"]],required:!0,inlineSmall:!0};r[0].pipeline.accuracy!==void 0&&(d.value=r[0].pipeline.accuracy),o=new qt({props:d}),K.push(()=>V(o,"value",S));function _(M){r[14](M)}let E={$$slots:{default:[Gp]},$$scope:{ctx:r}};r[0].pipeline.is_alternative!==void 0&&(E.checked=r[0].pipeline.is_alternative),l=new ht({props:E}),K.push(()=>V(l,"checked",_));let h=r[4]&&r[0].is_coverage_polygon!==void 0&&mo(r);return c=new Ds({props:{data:r[0].pipeline,required:!1,onUpdate:Up}}),m=new Us({props:{data:r[0].pipeline,onUpdate:zp}}),{c(){P(e.$$.fragment),t=F(),P(o.$$.fragment),s=F(),P(l.$$.fragment),a=F(),h&&h.c(),f=F(),P(c.$$.fragment),p=F(),P(m.$$.fragment)},m(M,O){L(e,M,O),$(M,t,O),L(o,M,O),$(M,s,O),L(l,M,O),$(M,a,O),h&&h.m(M,O),$(M,f,O),L(c,M,O),$(M,p,O),L(m,M,O),g=!0},p(M,O){const B={};!n&&O&1&&(n=!0,B.value=M[0].pipeline.atf4_type,Q(()=>n=!1)),e.$set(B);const D={};!i&&O&1&&(i=!0,D.value=M[0].pipeline.accuracy,Q(()=>i=!1)),o.$set(D);const I={};O&65536&&(I.$$scope={dirty:O,ctx:M}),!u&&O&1&&(u=!0,I.checked=M[0].pipeline.is_alternative,Q(()=>u=!1)),l.$set(I),M[4]&&M[0].is_coverage_polygon!==void 0?h?(h.p(M,O),O&1&&w(h,1)):(h=mo(M),h.c(),w(h,1),h.m(f.parentNode,f)):h&&(se(),k(h,1,1,()=>{h=null}),le());const A={};O&1&&(A.data=M[0].pipeline),c.$set(A);const R={};O&1&&(R.data=M[0].pipeline),m.$set(R)},i(M){g||(w(e.$$.fragment,M),w(o.$$.fragment,M),w(l.$$.fragment,M),w(h),w(c.$$.fragment,M),w(m.$$.fragment,M),g=!0)},o(M){k(e.$$.fragment,M),k(o.$$.fragment,M),k(l.$$.fragment,M),k(h),k(c.$$.fragment,M),k(m.$$.fragment,M),g=!1},d(M){M&&(y(t),y(s),y(a),y(f),y(p)),C(e,M),C(o,M),C(l,M),h&&h.d(M),C(c,M),C(m,M)}}}function Gp(r){let e;return{c(){e=q("Is this an alternative route and not the default option?")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function mo(r){let e,n,t;function o(s){r[15](s)}let i={$$slots:{default:[Tp]},$$scope:{ctx:r}};return r[0].is_coverage_polygon!==void 0&&(i.checked=r[0].is_coverage_polygon),e=new ht({props:i}),K.push(()=>V(e,"checked",o)),{c(){P(e.$$.fragment)},m(s,l){L(e,s,l),t=!0},p(s,l){const u={};l&65536&&(u.$$scope={dirty:l,ctx:s}),!n&&l&1&&(n=!0,u.checked=s[0].is_coverage_polygon,Q(()=>n=!1)),e.$set(u)},i(s){t||(w(e.$$.fragment,s),t=!0)},o(s){k(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function Tp(r){let e;return{c(){e=q(`Does this polygon show the coverage of the scheme? (All area considered + while making the scheme)`)},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Dp(r){let e,n,t,o,i,s,l,u,a,f,c;e=new Mt({props:{label:"Name",id:r[6],$$slots:{default:[qp]},$$scope:{ctx:r}}});function p(d){r[10](d)}let m={label:"Scheme",choices:Object.values(r[3].schemes).map(r[9])};r[0].scheme_reference!==void 0&&(m.value=r[0].scheme_reference),t=new xn({props:m}),K.push(()=>V(t,"value",p));function g(d){r[11](d)}let b={label:"Description"};r[0].description!==void 0&&(b.value=r[0].description),s=new qr({props:b}),K.push(()=>V(s,"value",g));let v=r[0].length_meters&&co(r),S=r[0].pipeline&&po(r);return{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment),i=F(),P(s.$$.fragment),u=F(),v&&v.c(),a=F(),S&&S.c(),f=fe()},m(d,_){L(e,d,_),$(d,n,_),L(t,d,_),$(d,i,_),L(s,d,_),$(d,u,_),v&&v.m(d,_),$(d,a,_),S&&S.m(d,_),$(d,f,_),c=!0},p(d,[_]){const E={};_&65541&&(E.$$scope={dirty:_,ctx:d}),e.$set(E);const h={};_&8&&(h.choices=Object.values(d[3].schemes).map(d[9])),!o&&_&1&&(o=!0,h.value=d[0].scheme_reference,Q(()=>o=!1)),t.$set(h);const M={};!l&&_&1&&(l=!0,M.value=d[0].description,Q(()=>l=!1)),s.$set(M),d[0].length_meters?v?v.p(d,_):(v=co(d),v.c(),v.m(a.parentNode,a)):v&&(v.d(1),v=null),d[0].pipeline?S?(S.p(d,_),_&1&&w(S,1)):(S=po(d),S.c(),w(S,1),S.m(f.parentNode,f)):S&&(se(),k(S,1,1,()=>{S=null}),le())},i(d){c||(w(e.$$.fragment,d),w(t.$$.fragment,d),w(s.$$.fragment,d),w(S),c=!0)},o(d){k(e.$$.fragment,d),k(t.$$.fragment,d),k(s.$$.fragment,d),k(S),c=!1},d(d){d&&(y(n),y(i),y(u),y(a),y(f)),C(e,d),C(t,d),C(s,d),v&&v.d(d),S&&S.d(d)}}}const Up=()=>{},zp=()=>{};function Jp(r,e,n){let t,o,i=ee,s=()=>(i(),i=He(l,h=>n(3,o=h)),l);Y(r,We,h=>n(2,t=h)),r.$$.on_destroy.push(()=>i());let{gjSchemes:l}=e;s();let{props:u}=e;u.pipeline||(u.pipeline={atf4_type:"",accuracy:"",is_alternative:!1,development_funded:!1,construction_funded:!1,funding_sources:Xn(),status:"",timescale:""}),u.is_coverage_polygon||(u.is_coverage_polygon=!1);const a=(o.features.filter(h=>h.properties.is_coverage_polygon).length==0||u.is_coverage_polygon===!0)&&u.intervention_type==="area";function f(){try{n(0,u.name=t.inner.routeNameForWaypoints(u.waypoints),u)}catch(h){window.alert(`Couldn't auto-name route: ${h}`)}}let c=Pt();function p(){u.name=this.value,n(0,u)}const m=()=>f(),g=h=>[h.scheme_reference,Zr(h)];function b(h){r.$$.not_equal(u.scheme_reference,h)&&(u.scheme_reference=h,n(0,u))}function v(h){r.$$.not_equal(u.description,h)&&(u.description=h,n(0,u))}function S(h){r.$$.not_equal(u.pipeline.atf4_type,h)&&(u.pipeline.atf4_type=h,n(0,u))}function d(h){r.$$.not_equal(u.pipeline.accuracy,h)&&(u.pipeline.accuracy=h,n(0,u))}function _(h){r.$$.not_equal(u.pipeline.is_alternative,h)&&(u.pipeline.is_alternative=h,n(0,u))}function E(h){r.$$.not_equal(u.is_coverage_polygon,h)&&(u.is_coverage_polygon=h,n(0,u))}return r.$$set=h=>{"gjSchemes"in h&&s(n(1,l=h.gjSchemes)),"props"in h&&n(0,u=h.props)},[u,l,t,o,a,f,c,p,m,g,b,v,S,d,_,E]}class Yp extends te{constructor(e){super(),ne(this,e,Jp,Dp,x,{gjSchemes:1,props:0})}}function go(r,e,n){const t=r.slice();return t[9]=e[n][0],t[10]=e[n][1],t}function ho(r){let e,n;return e=new ae({props:{$$slots:{default:[Xp]},$$scope:{ctx:r}}}),e.$on("click",r[6]),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&8192&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Xp(r){let e;return{c(){e=q("Handle extra GeoJSON properties")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function _o(r){let e,n,t=r[9]+"",o,i,s=JSON.stringify(r[10])+"",l,u;return{c(){e=G("li"),n=G("b"),o=q(t),i=q(` + = `),l=q(s),u=F()},m(a,f){$(a,e,f),z(e,n),z(n,o),z(e,i),z(e,l),z(e,u)},p(a,f){f&2&&t!==(t=a[9]+"")&&ge(o,t),f&2&&s!==(s=JSON.stringify(a[10])+"")&&ge(l,s)},d(a){a&&y(e)}}}function Wp(r){let e;return{c(){e=q("Remove these properties")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Hp(r){let e;return{c(){e=q("Cancel")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Zp(r){let e,n,t,o;return e=new bt({props:{$$slots:{default:[Wp]},$$scope:{ctx:r}}}),e.$on("click",r[2]),t=new ae({props:{$$slots:{default:[Hp]},$$scope:{ctx:r}}}),t.$on("click",r[7]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&8192&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&8192&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function Kp(r){let e,n,t,o,i,s,l=je(Object.entries(r[1])),u=[];for(let a=0;a0,n,t,o,i,s=e&&ho(r);function l(a){r[8](a)}let u={title:"This imported GeoJSON feature has unexpected properties",$$slots:{default:[Kp]},$$scope:{ctx:r}};return r[0]!==void 0&&(u.open=r[0]),t=new Lt({props:u}),K.push(()=>V(t,"open",l)),{c(){s&&s.c(),n=F(),P(t.$$.fragment)},m(a,f){s&&s.m(a,f),$(a,n,f),L(t,a,f),i=!0},p(a,[f]){f&2&&(e=Object.entries(a[1]).length>0),e?s?(s.p(a,f),f&2&&w(s,1)):(s=ho(a),s.c(),w(s,1),s.m(n.parentNode,n)):s&&(se(),k(s,1,1,()=>{s=null}),le());const c={};f&8195&&(c.$$scope={dirty:f,ctx:a}),!o&&f&1&&(o=!0,c.open=a[0],Q(()=>o=!1)),t.$set(c)},i(a){i||(w(s),w(t.$$.fragment,a),i=!0)},o(a){k(s),k(t.$$.fragment,a),i=!1},d(a){a&&y(n),s&&s.d(a),C(t,a)}}}function Qp(r,e,n){let t,{gjSchemes:o}=e,{id:i}=e,{props:s}=e,l=!1;function u(){n(0,l=!1),o.update(p=>{let m=p.features.find(g=>g.id==i);for(let g of Object.keys(t))delete m.properties[g];return p})}const a=()=>n(0,l=!0),f=()=>n(0,l=!1);function c(p){l=p,n(0,l)}return r.$$set=p=>{"gjSchemes"in p&&n(3,o=p.gjSchemes),"id"in p&&n(4,i=p.id),"props"in p&&n(5,s=p.props)},r.$$.update=()=>{r.$$.dirty&32&&n(1,t=Js(s))},[l,t,u,o,i,s,a,f,c]}class xp extends te{constructor(e){super(),ne(this,e,Qp,Vp,x,{gjSchemes:3,id:4,props:5})}}function em(r){let e,n,t;function o(s){r[6](s)}let i={gjSchemes:r[1]};return r[0]!==void 0&&(i.props=r[0]),e=new Yp({props:i}),K.push(()=>V(e,"props",o)),{c(){P(e.$$.fragment)},m(s,l){L(e,s,l),t=!0},p(s,l){const u={};l&2&&(u.gjSchemes=s[1]),!n&&l&1&&(n=!0,u.props=s[0],Q(()=>n=!1)),e.$set(u)},i(s){t||(w(e.$$.fragment,s),t=!0)},o(s){k(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function tm(r){let e,n,t;function o(s){r[5](s)}let i={gjSchemes:r[1]};return r[0]!==void 0&&(i.props=r[0]),e=new Ep({props:i}),K.push(()=>V(e,"props",o)),{c(){P(e.$$.fragment)},m(s,l){L(e,s,l),t=!0},p(s,l){const u={};l&2&&(u.gjSchemes=s[1]),!n&&l&1&&(n=!0,u.props=s[0],Q(()=>n=!1)),e.$set(u)},i(s){t||(w(e.$$.fragment,s),t=!0)},o(s){k(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function nm(r){let e,n,t,o,i,s;e=new xp({props:{gjSchemes:r[1],id:r[2],props:r[0]}});const l=[tm,em],u=[];function a(f,c){return f[3]=="v1"?0:f[3]=="pipeline"?1:-1}return~(t=a(r))&&(o=u[t]=l[t](r)),{c(){P(e.$$.fragment),n=F(),o&&o.c(),i=fe()},m(f,c){L(e,f,c),$(f,n,c),~t&&u[t].m(f,c),$(f,i,c),s=!0},p(f,[c]){const p={};c&2&&(p.gjSchemes=f[1]),c&4&&(p.id=f[2]),c&1&&(p.props=f[0]),e.$set(p);let m=t;t=a(f),t===m?~t&&u[t].p(f,c):(o&&(se(),k(u[m],1,1,()=>{u[m]=null}),le()),~t?(o=u[t],o?o.p(f,c):(o=u[t]=l[t](f),o.c()),w(o,1),o.m(i.parentNode,i)):o=null)},i(f){s||(w(e.$$.fragment,f),w(o),s=!0)},o(f){k(e.$$.fragment,f),k(o),s=!1},d(f){f&&(y(n),y(i)),C(e,f),~t&&u[t].d(f)}}}function rm(r,e,n){let t;Y(r,tt,f=>n(3,t=f));let{cfg:o}=e,{gjSchemes:i}=e,{id:s}=e,{props:l}=e;function u(f){l=f,n(0,l)}function a(f){l=f,n(0,l)}return r.$$set=f=>{"cfg"in f&&n(4,o=f.cfg),"gjSchemes"in f&&n(1,i=f.gjSchemes),"id"in f&&n(2,s=f.id),"props"in f&&n(0,l=f.props)},[l,i,s,t,o,u,a]}class im extends te{constructor(e){super(),ne(this,e,rm,nm,x,{cfg:4,gjSchemes:1,id:2,props:0})}}function om(r){let e;return{c(){e=q("Scheme details")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function sm(r){let e;return{c(){e=q("Save")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function lm(r){let e,n,t,o,i;function s(u){r[6](u)}let l={label:"Scheme name",required:!0};return r[3].schemes[r[1]].scheme_name!==void 0&&(l.value=r[3].schemes[r[1]].scheme_name),e=new er({props:l}),K.push(()=>V(e,"value",s)),o=new st({props:{$$slots:{default:[sm]},$$scope:{ctx:r}}}),o.$on("click",r[7]),{c(){P(e.$$.fragment),t=F(),P(o.$$.fragment)},m(u,a){L(e,u,a),$(u,t,a),L(o,u,a),i=!0},p(u,a){const f={};!n&&a&10&&(n=!0,f.value=u[3].schemes[u[1]].scheme_name,Q(()=>n=!1)),e.$set(f);const c={};a&512&&(c.$$scope={dirty:a,ctx:u}),o.$set(c)},i(u){i||(w(e.$$.fragment,u),w(o.$$.fragment,u),i=!0)},o(u){k(e.$$.fragment,u),k(o.$$.fragment,u),i=!1},d(u){u&&y(t),C(e,u),C(o,u)}}}function um(r){let e,n,t,o,i,s,l;e=new ae({props:{$$slots:{default:[om]},$$scope:{ctx:r}}}),e.$on("click",r[5]);function u(f){r[8](f)}let a={title:"Scheme details",$$slots:{default:[lm]},$$scope:{ctx:r}};return r[2]!==void 0&&(a.open=r[2]),t=new Lt({props:a}),K.push(()=>V(t,"open",u)),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(f,c){L(e,f,c),$(f,n,c),L(t,f,c),i=!0,s||(l=he(window,"keydown",r[4]),s=!0)},p(f,[c]){const p={};c&512&&(p.$$scope={dirty:c,ctx:f}),e.$set(p);const m={};c&526&&(m.$$scope={dirty:c,ctx:f}),!o&&c&4&&(o=!0,m.open=f[2],Q(()=>o=!1)),t.$set(m)},i(f){i||(w(e.$$.fragment,f),w(t.$$.fragment,f),i=!0)},o(f){k(e.$$.fragment,f),k(t.$$.fragment,f),i=!1},d(f){f&&y(n),C(e,f),C(t,f),s=!1,l()}}}function am(r,e,n){let t,o=ee,i=()=>(o(),o=He(s,g=>n(3,t=g)),s);r.$$.on_destroy.push(()=>o());let{gjSchemes:s}=e;i();let{scheme_reference:l}=e,u=!1;function a(g){u&&g.key=="Escape"&&(g.stopPropagation(),n(2,u=!1))}const f=()=>n(2,u=!0);function c(g){r.$$.not_equal(t.schemes[l].scheme_name,g)&&(t.schemes[l].scheme_name=g,s.set(t))}const p=()=>n(2,u=!1);function m(g){u=g,n(2,u)}return r.$$set=g=>{"gjSchemes"in g&&i(n(0,s=g.gjSchemes)),"scheme_reference"in g&&n(1,l=g.scheme_reference)},[s,l,u,t,a,f,c,p,m]}class fm extends te{constructor(e){super(),ne(this,e,am,um,x,{gjSchemes:0,scheme_reference:1})}}function cm(r){let e;return{c(){e=q("Scheme details")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function pm(r){let e;return{c(){e=q("Save")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function mm(r){let e,n,t,o,i,s,l,u,a,f,c,p,m,g,b,v,S,d,_,E,h;function M(j){r[9](j)}let O={label:"Scheme name",required:!0};r[6].schemes[r[1]].scheme_name!==void 0&&(O.value=r[6].schemes[r[1]].scheme_name),e=new er({props:O}),K.push(()=>V(e,"value",M));function B(j){r[10](j)}let D={legend:"Scheme type",choices:[["cycling route","Cycling route"],["walking route","Walking route"],["shared-use route","Shared-use route"],["cycling and walking route","Cycling and walking route, not shared use"],["area-based scheme","Area-based scheme"],["intersection","Intersection/junction scheme"]],inlineSmall:!0,required:!0};r[3].scheme_type!==void 0&&(D.value=r[3].scheme_type),l=new qt({props:D}),K.push(()=>V(l,"value",B));function I(j){r[11](j)}let A={label:"Type of the main intervention"};r[3].atf4_lead_type!==void 0&&(A.value=r[3].atf4_lead_type),f=new Ts({props:A}),K.push(()=>V(f,"value",I));function R(j){r[12](j)}let N={label:"Scheme description (150 words max)"};return r[3].scheme_description!==void 0&&(N.value=r[3].scheme_description),m=new qr({props:N}),K.push(()=>V(m,"value",R)),v=new Ds({props:{data:r[3],required:!0,onUpdate:r[13]}}),d=new Us({props:{data:r[3],onUpdate:r[14]}}),E=new st({props:{$$slots:{default:[pm]},$$scope:{ctx:r}}}),E.$on("click",r[15]),{c(){P(e.$$.fragment),t=F(),o=G("fieldset"),i=G("legend"),i.textContent="Basic information",s=F(),P(l.$$.fragment),a=F(),P(f.$$.fragment),p=F(),P(m.$$.fragment),b=F(),P(v.$$.fragment),S=F(),P(d.$$.fragment),_=F(),P(E.$$.fragment),T(i,"class","govuk-fieldset__legend"),T(o,"class","govuk-fieldset svelte-1bxyfcq")},m(j,H){L(e,j,H),$(j,t,H),$(j,o,H),z(o,i),z(o,s),L(l,o,null),z(o,a),L(f,o,null),z(o,p),L(m,o,null),$(j,b,H),L(v,j,H),$(j,S,H),L(d,j,H),$(j,_,H),L(E,j,H),h=!0},p(j,H){const ie={};!n&&H&66&&(n=!0,ie.value=j[6].schemes[j[1]].scheme_name,Q(()=>n=!1)),e.$set(ie);const ce={};!u&&H&8&&(u=!0,ce.value=j[3].scheme_type,Q(()=>u=!1)),l.$set(ce);const U={};!c&&H&8&&(c=!0,U.value=j[3].atf4_lead_type,Q(()=>c=!1)),f.$set(U);const de={};!g&&H&8&&(g=!0,de.value=j[3].scheme_description,Q(()=>g=!1)),m.$set(de);const _e={};H&8&&(_e.data=j[3]),H&16&&(_e.onUpdate=j[13]),v.$set(_e);const Ee={};H&8&&(Ee.data=j[3]),H&16&&(Ee.onUpdate=j[14]),d.$set(Ee);const $e={};H&524288&&($e.$$scope={dirty:H,ctx:j}),E.$set($e)},i(j){h||(w(e.$$.fragment,j),w(l.$$.fragment,j),w(f.$$.fragment,j),w(m.$$.fragment,j),w(v.$$.fragment,j),w(d.$$.fragment,j),w(E.$$.fragment,j),h=!0)},o(j){k(e.$$.fragment,j),k(l.$$.fragment,j),k(f.$$.fragment,j),k(m.$$.fragment,j),k(v.$$.fragment,j),k(d.$$.fragment,j),k(E.$$.fragment,j),h=!1},d(j){j&&(y(t),y(o),y(b),y(S),y(_)),C(e,j),C(l),C(f),C(m),C(v,j),C(d,j),C(E,j)}}}function dm(r){let e,n,t,o,i,s,l,u,a;e=new Je({props:{errorMessage:r[5]}}),t=new ae({props:{$$slots:{default:[cm]},$$scope:{ctx:r}}}),t.$on("click",r[8]);function f(p){r[16](p)}let c={title:"Scheme details",$$slots:{default:[mm]},$$scope:{ctx:r}};return r[2]!==void 0&&(c.open=r[2]),i=new Lt({props:c}),K.push(()=>V(i,"open",f)),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment),o=F(),P(i.$$.fragment)},m(p,m){L(e,p,m),$(p,n,m),L(t,p,m),$(p,o,m),L(i,p,m),l=!0,u||(a=he(window,"keydown",r[7]),u=!0)},p(p,[m]){const g={};m&32&&(g.errorMessage=p[5]),e.$set(g);const b={};m&524288&&(b.$$scope={dirty:m,ctx:p}),t.$set(b);const v={};m&524382&&(v.$$scope={dirty:m,ctx:p}),!s&&m&4&&(s=!0,v.open=p[2],Q(()=>s=!1)),i.$set(v)},i(p){l||(w(e.$$.fragment,p),w(t.$$.fragment,p),w(i.$$.fragment,p),l=!0)},o(p){k(e.$$.fragment,p),k(t.$$.fragment,p),k(i.$$.fragment,p),l=!1},d(p){p&&(y(n),y(o)),C(e,p),C(t,p),C(i,p),u=!1,a()}}}function gm(r,e,n){let t,o,i=ee,s=()=>(i(),i=He(l,B=>n(6,o=B)),l);r.$$.on_destroy.push(()=>i());let{gjSchemes:l}=e;s();let{scheme_reference:u}=e,a=!1,f=o.schemes[u].pipeline,c=0;function p(B,D){return f.scheme_type&&f.status&&f.timescale?"":"Missing some required data"}function m(B){a&&B.key=="Escape"&&(B.stopPropagation(),n(2,a=!1))}function g(){Be(l,o.schemes[u].pipeline=f,o),l.set(o)}const b=()=>n(2,a=!0);function v(B){r.$$.not_equal(o.schemes[u].scheme_name,B)&&(o.schemes[u].scheme_name=B,l.set(o))}function S(B){r.$$.not_equal(f.scheme_type,B)&&(f.scheme_type=B,n(3,f))}function d(B){r.$$.not_equal(f.atf4_lead_type,B)&&(f.atf4_lead_type=B,n(3,f))}function _(B){r.$$.not_equal(f.scheme_description,B)&&(f.scheme_description=B,n(3,f))}const E=()=>n(4,c++,c),h=()=>n(4,c++,c),M=()=>n(2,a=!1);function O(B){a=B,n(2,a)}return r.$$set=B=>{"gjSchemes"in B&&s(n(0,l=B.gjSchemes)),"scheme_reference"in B&&n(1,u=B.scheme_reference)},r.$$.update=()=>{r.$$.dirty&24&&n(5,t=p()),r.$$.dirty&4&&(a||g())},[l,u,a,f,c,t,o,m,b,v,S,d,_,E,h,M,O]}class hm extends te{constructor(e){super(),ne(this,e,gm,dm,x,{gjSchemes:0,scheme_reference:1})}}function _m(r){let e,n;return e=new fm({props:{gjSchemes:r[0],scheme_reference:r[1]}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&1&&(i.gjSchemes=t[0]),o&2&&(i.scheme_reference=t[1]),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function bm(r){let e,n;return e=new hm({props:{gjSchemes:r[0],scheme_reference:r[1]}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&1&&(i.gjSchemes=t[0]),o&2&&(i.scheme_reference=t[1]),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function vm(r){let e,n,t,o;const i=[bm,_m],s=[];function l(u,a){return u[2]=="pipeline"?0:1}return e=l(r),n=s[e]=i[e](r),{c(){n.c(),t=fe()},m(u,a){s[e].m(u,a),$(u,t,a),o=!0},p(u,[a]){let f=e;e=l(u),e===f?s[e].p(u,a):(se(),k(s[f],1,1,()=>{s[f]=null}),le(),n=s[e],n?n.p(u,a):(n=s[e]=i[e](u),n.c()),w(n,1),n.m(t.parentNode,t))},i(u){o||(w(n),o=!0)},o(u){k(n),o=!1},d(u){u&&y(t),s[e].d(u)}}}function $m(r,e,n){let t;Y(r,tt,s=>n(2,t=s));let{gjSchemes:o}=e,{scheme_reference:i}=e;return r.$$set=s=>{"gjSchemes"in s&&n(0,o=s.gjSchemes),"scheme_reference"in s&&n(1,i=s.scheme_reference)},[o,i,t]}class ym extends te{constructor(e){super(),ne(this,e,$m,vm,x,{gjSchemes:0,scheme_reference:1})}}let xe={interventionName:km,schemeName:Zr,backfill:Mn,initializeEmptyScheme:wm,interventionWarning:Sm,editFeatureForm:im,editSchemeForm:ym,newPointFeature:r=>{r.properties.intervention_type="other"},newPolygonFeature:r=>{r.properties.intervention_type="area",r.properties.is_coverage_polygon=!1},newLineStringFeature:r=>{r.properties.intervention_type="route",r.properties.route_name&&(St(tt)!="pipeline"&&(r.properties.name=r.properties.route_name),delete r.properties.route_name)},updateFeature:(r,e)=>{e.properties.route_name&&!r.properties.name&&St(tt)!="pipeline"&&(r.properties.name=e.properties.route_name)},maptilerApiKey:"MZEJTanw3WpxRvt7qDfo",getStreetViewRoadLayerNames:r=>Ll(r,St(pr)),layerZorder:Cl};function Mn(r){var t,o,i,s,l,u,a,f;let e=St(tt),n=1;for(let c of r.features)c.properties||(c.properties={name:"",scheme_reference:"",description:"",intervention_type:"other",is_coverage_polygon:!1}),e=="pipeline"&&!c.properties.intervention_type&&(c.properties.intervention_type=new Map([["LineString","route"],["Polygon","area"]]).get(c.geometry.type)??"other"),c.geometry.type=="LineString"&&!c.properties.length_meters&&(c.properties.length_meters=Nl(c,{units:"kilometers"})*1e3),c.id=n++;if(!r.schemes){let c=Pt();r.schemes={},r.schemes[c]={scheme_reference:c,color:ti()},r.scheme_name&&(r.schemes[c].scheme_name=r.scheme_name,delete r.scheme_name),r.pipeline&&(r.schemes[c].pipeline=r.pipeline,delete r.pipeline);for(let p of r.features)p.properties.scheme_reference=c}for(let c of Object.values(r.schemes)){let p=c;if(p.color??(p.color=ti()),e=="pipeline"){p.pipeline??(p.pipeline=zs()),(t=p.pipeline).development_funded??(t.development_funded=!1),(o=p.pipeline).construction_funded??(o.construction_funded=!1),(i=p.pipeline).funding_sources??(i.funding_sources=Xn()),delete p.pipeline.budget_funded,delete p.pipeline.budget_unfunded,delete p.pipeline.funding_source,delete p.pipeline.funded;for(let m of r.features)m.properties.pipeline&&((s=m.properties.pipeline).development_funded??(s.development_funded=!1),(l=m.properties.pipeline).construction_funded??(l.construction_funded=!1),(u=m.properties.pipeline).funding_sources??(u.funding_sources=Xn()),(a=m.properties.pipeline).status??(a.status=""),(f=m.properties.pipeline).timescale??(f.timescale=""))}}return r}function wm(r){let e=r;return St(tt)=="pipeline"&&(e.pipeline=zs()),e}function zs(){return{scheme_type:"",atf4_lead_type:"",scheme_description:"",status:"",timescale:"",development_funded:!1,construction_funded:!1,funding_sources:Xn()}}function Xn(){return{atf2:!1,atf3:!1,atf4:!1,atf4e:!1,crsts:!1,luf:!1,other:""}}function km(r){if(r.properties.name)return r.properties.name;var e=r.properties.intervention_type;return e=="other"&&(r.geometry.type=="Point"?e="point":r.geometry.type=="LineString"?e="line":e="polygon"),`Untitled ${e}`}function Zr(r){return r.scheme_name??"Untitled scheme"}function Sm(r){var t;let e=St(tt);if(!r.properties.name)return"No name";if(!new Set(["route","area","crossing","other"]).has(r.properties.intervention_type))return"No intervention type";if(e=="pipeline"&&!((t=r.properties.pipeline)!=null&&t.accuracy))return"Accuracy not specified";let n=Js(r.properties);return Object.entries(n).length>0?`Extra GeoJSON properties: ${Object.keys(n).join(", ")}`:null}function Js(r){let e=St(tt),n=JSON.parse(JSON.stringify(r));for(let t of["name","description","intervention_type","length_meters","waypoints","hide_while_editing","is_coverage_polygon","scheme_reference"])delete n[t];if(e=="pipeline"&&n.pipeline){for(let t of["atf4_type","accuracy","is_alternative","budget","development_funded","construction_funded","funding_sources","status","timescale","timescale_year","year_published","year_consulted"])delete n.pipeline[t];Object.entries(n.pipeline).length==0&&delete n.pipeline}return n}function bo(r,e,n){const t=r.slice();return t[8]=e[n],t}function Em(r){let e;return{c(){e=q("Delete all sketch data from browser")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function vo(r){let e,n,t,o,i=je(r[1].storedStrings),s=[];for(let u=0;uk(s[u],1,1,()=>{s[u]=null});return{c(){e=G("p"),e.textContent=`Otherwise here is a breakdown of what is currently stored locally. You can + delete individual items (normally storage quota is 5MB or 10MB):`,n=F();for(let u=0;u{o=null}),le());const u={};l&2050&&(u.$$scope={dirty:l,ctx:r}),n.$set(u)},i(s){t||(w(o),w(n.$$.fragment,s),t=!0)},o(s){k(o),k(n.$$.fragment,s),t=!1},d(s){s&&y(e),o&&o.d(s),C(n,s)}}}function Pm(r){var p;let e,n=((p=r[1])==null?void 0:p.message)+"",t,o,i,s,l,u,a,f;l=new bt({props:{$$slots:{default:[Em]},$$scope:{ctx:r}}}),l.$on("click",r[4]);let c=r[1]&&vo(r);return{c(){e=G("p"),t=q(n),o=F(),i=G("p"),i.textContent=`If you have saved your work locally to a geojson file recently, you can delete all files stored in the browser for all authorities to free up space. - Be sure that you're not losing anything important before doing this!`,s=F(),P(l.$$.fragment),u=F(),c&&c.c(),a=fe()},m(m,h){$(m,e,h),z(e,t),$(m,o,h),$(m,i,h),$(m,s,h),L(l,m,h),$(m,u,h),c&&c.m(m,h),$(m,a,h),f=!0},p(m,h){var v;(!f||h&2)&&n!==(n=((v=m[1])==null?void 0:v.message)+"")&&ge(t,n);const b={};h&2048&&(b.$$scope={dirty:h,ctx:m}),l.$set(b),m[1]?c?(c.p(m,h),h&2&&w(c,1)):(c=vo(m),c.c(),w(c,1),c.m(a.parentNode,a)):c&&(se(),k(c,1,1,()=>{c=null}),le())},i(m){f||(w(l.$$.fragment,m),w(c),f=!0)},o(m){k(l.$$.fragment,m),k(c),f=!1},d(m){m&&(y(e),y(o),y(i),y(s),y(u),y(a)),C(l,m),c&&c.d(m)}}}function Pm(r){let e,n,t;function o(s){r[7](s)}let i={title:"Local Storage Quota Exceeded",$$slots:{default:[Mm]},$$scope:{ctx:r}};return r[0]!==void 0&&(i.open=r[0]),e=new Lt({props:i}),K.push(()=>V(e,"open",o)),{c(){P(e.$$.fragment)},m(s,l){L(e,s,l),t=!0},p(s,[l]){const u={};l&2054&&(u.$$scope={dirty:l,ctx:s}),!n&&l&1&&(n=!0,u.open=s[0],Q(()=>n=!1)),e.$set(u)},i(s){t||(w(e.$$.fragment,s),t=!0)},o(s){k(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function Lm(r,e,n){let{show:t}=e,{setStorageError:o}=e,{clearCurrentSketch:i}=e,{currentAuthority:s}=e;function l(c){let p=cl(c);o&&n(1,o.storedStrings=p,o),c===s&&i()}function u(){i(),pl(),n(0,t=!1),n(1,o=void 0)}const a=c=>l(c.key);function f(c){t=c,n(0,t)}return r.$$set=c=>{"show"in c&&n(0,t=c.show),"setStorageError"in c&&n(1,o=c.setStorageError),"clearCurrentSketch"in c&&n(5,i=c.clearCurrentSketch),"currentAuthority"in c&&n(2,s=c.currentAuthority)},[t,o,s,l,u,i,a,f]}class Cm extends te{constructor(e){super(),ne(this,e,Lm,Pm,x,{show:0,setStorageError:1,clearCurrentSketch:5,currentAuthority:2})}}function wo(r){let e,n;return e=new Nl({props:{label:"Manage files",$$slots:{default:[Bm]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&2097164&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Nm(r){let e,n,t;return{c(){e=G("img"),t=q(` - Save`),Je(e.src,n=vp)||T(e,"src",n),T(e,"alt","Save as GeoJSON file")},m(o,i){$(o,e,i),$(o,t,i)},p:ee,d(o){o&&(y(e),y(t))}}}function Fm(r){let e,n,t;return{c(){e=G("img"),t=q(` - Clear all`),Je(e.src,n=bp)||T(e,"src",n),T(e,"alt","Clear all")},m(o,i){$(o,e,i),$(o,t,i)},p:ee,d(o){o&&(y(e),y(t))}}}function Am(r){let e,n,t,o;return e=new ae({props:{$$slots:{default:[Nm]},$$scope:{ctx:r}}}),e.$on("click",r[8]),t=new bt({props:{$$slots:{default:[Fm]},$$scope:{ctx:r}}}),t.$on("click",r[14]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&2097152&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&2097152&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function Rm(r){let e;return{c(){e=q("Clear all work")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Om(r){let e;return{c(){e=q("Cancel")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function jm(r){let e,n,t,o;return e=new bt({props:{$$slots:{default:[Rm]},$$scope:{ctx:r}}}),e.$on("click",r[7]),t=new ae({props:{$$slots:{default:[Om]},$$scope:{ctx:r}}}),t.$on("click",r[15]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&2097152&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&2097152&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function Im(r){let e,n,t,o;return t=new Ze({props:{$$slots:{default:[jm]},$$scope:{ctx:r}}}),{c(){e=G("p"),e.textContent="This will delete everything for all schemes.",n=F(),P(t.$$.fragment)},m(i,s){$(i,e,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&2097160&&(l.$$scope={dirty:s,ctx:i}),t.$set(l)},i(i){o||(w(t.$$.fragment,i),o=!0)},o(i){k(t.$$.fragment,i),o=!1},d(i){i&&(y(e),y(n)),C(t,i)}}}function Bm(r){let e,n,t,o,i,s,l,u,a;e=new qo({props:{label:"Load GeoJSON file",onLoad:r[9]}}),t=new Ze({props:{$$slots:{default:[Am]},$$scope:{ctx:r}}}),i=new ze({props:{errorMessage:r[2]}});function f(p){r[16](p)}let c={title:"Would you like to clear your work?",displayEscapeButton:!1,$$slots:{default:[Im]},$$scope:{ctx:r}};return r[3]!==void 0&&(c.open=r[3]),l=new Lt({props:c}),K.push(()=>V(l,"open",f)),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment),o=F(),P(i.$$.fragment),s=F(),P(l.$$.fragment)},m(p,m){L(e,p,m),$(p,n,m),L(t,p,m),$(p,o,m),L(i,p,m),$(p,s,m),L(l,p,m),a=!0},p(p,m){const h={};m&2097160&&(h.$$scope={dirty:m,ctx:p}),t.$set(h);const b={};m&4&&(b.errorMessage=p[2]),i.$set(b);const v={};m&2097160&&(v.$$scope={dirty:m,ctx:p}),!u&&m&8&&(u=!0,v.open=p[3],Q(()=>u=!1)),l.$set(v)},i(p){a||(w(e.$$.fragment,p),w(t.$$.fragment,p),w(i.$$.fragment,p),w(l.$$.fragment,p),a=!0)},o(p){k(e.$$.fragment,p),k(t.$$.fragment,p),k(i.$$.fragment,p),k(l.$$.fragment,p),a=!1},d(p){p&&(y(n),y(o),y(s)),C(e,p),C(t,p),C(i,p),C(l,p)}}}function qm(r){let e,n,t,o,i,s=r[6].mode=="list"&&wo(r);function l(f){r[17](f)}function u(f){r[18](f)}let a={clearCurrentSketch:r[7],currentAuthority:r[1]};return r[4]!==void 0&&(a.show=r[4]),r[5]!==void 0&&(a.setStorageError=r[5]),n=new Cm({props:a}),K.push(()=>V(n,"show",l)),K.push(()=>V(n,"setStorageError",u)),{c(){s&&s.c(),e=F(),P(n.$$.fragment)},m(f,c){s&&s.m(f,c),$(f,e,c),L(n,f,c),i=!0},p(f,[c]){f[6].mode=="list"?s?(s.p(f,c),c&64&&w(s,1)):(s=wo(f),s.c(),w(s,1),s.m(e.parentNode,e)):s&&(se(),k(s,1,1,()=>{s=null}),le());const p={};c&2&&(p.currentAuthority=f[1]),!t&&c&16&&(t=!0,p.show=f[4],Q(()=>t=!1)),!o&&c&32&&(o=!0,p.setStorageError=f[5],Q(()=>o=!1)),n.$set(p)},i(f){i||(w(s),w(n.$$.fragment,f),i=!0)},o(f){k(s),k(n.$$.fragment,f),i=!1},d(f){f&&y(e),s&&s.d(f),C(n,f)}}}function Gm(r,e){var n=document.createElement("a");n.setAttribute("href","data:text/plain;charset=utf-8, "+encodeURIComponent(e)),n.setAttribute("download",r),document.body.appendChild(n),n.click(),document.body.removeChild(n)}function Tm(r,e,n){let t,o=ee,i=()=>(o(),o=We(a,I=>n(13,t=I)),a),s,l;Y(r,oe,I=>n(6,s=I)),Y(r,tt,I=>n(19,l=I)),r.$$.on_destroy.push(()=>o());let{cfg:u}=e,{gjSchemes:a}=e;i();let{authorityName:f}=e,c="",p=f;l!="v1"&&(p+=`_${l}`);let m=!1,h=!1;ot(async()=>{let A=new URLSearchParams(window.location.search).get("geojsonUrl"),R=window.localStorage.getItem(p);if(A){console.log(`Loading GeoJSON from ${A}`);try{let j=await(await fetch(A)).text();a.set(Mn(JSON.parse(j)))}catch(N){console.log(`Failed to load from URL: ${N}`)}}else if(R)try{a.set(Mn(JSON.parse(R)))}catch(N){console.log(`Failed to load from local storage: ${N}`)}n(12,m=!0)});let b=!1,v;function E(){n(3,h=!1),a.update(I=>{let A=Br(u);return A.origin=I.origin,A.authority=I.authority,A}),Zt.set(null),Vt.set(new Set),Be(oe,s.mode="list",s)}function d(){const I=JSON.parse(JSON.stringify(t));for(let A of I.features)delete A.properties.hide_while_editing;return I}function g(){let I=d();I.authority=f,I.origin="atip-v2",Gm(`${p}.geojson`,JSON.stringify(I,null," "))}function S(I,A){try{a.set(Mn(JSON.parse(A))),n(2,c="")}catch(R){n(2,c=`Couldn't load scheme from a file: ${R}`)}}const _=()=>n(3,h=!0),M=()=>n(3,h=!1);function O(I){h=I,n(3,h)}function B(I){b=I,n(4,b),n(12,m),n(13,t),n(11,p)}function D(I){v=I,n(5,v),n(12,m),n(13,t),n(11,p)}return r.$$set=I=>{"cfg"in I&&n(10,u=I.cfg),"gjSchemes"in I&&i(n(0,a=I.gjSchemes)),"authorityName"in I&&n(1,f=I.authorityName)},r.$$.update=()=>{if(r.$$.dirty&14336&&m&&t){console.log("GJ changed, saving to local storage");const I=ml(p,JSON.stringify(d()));I.isQuotaError&&(n(4,b=!0),n(5,v=I))}},[a,f,c,h,b,v,s,E,g,S,u,p,m,t,_,M,O,B,D]}class Dm extends te{constructor(e){super(),ne(this,e,Tm,qm,x,{cfg:10,gjSchemes:0,authorityName:1})}}function Um(r){let e;return{c(){e=G("div"),e.innerHTML=`

    Saving files

    ATIP does not send any data over the network or store your data in the + Be sure that you're not losing anything important before doing this!`,s=F(),P(l.$$.fragment),u=F(),c&&c.c(),a=fe()},m(m,g){$(m,e,g),z(e,t),$(m,o,g),$(m,i,g),$(m,s,g),L(l,m,g),$(m,u,g),c&&c.m(m,g),$(m,a,g),f=!0},p(m,g){var v;(!f||g&2)&&n!==(n=((v=m[1])==null?void 0:v.message)+"")&&ge(t,n);const b={};g&2048&&(b.$$scope={dirty:g,ctx:m}),l.$set(b),m[1]?c?(c.p(m,g),g&2&&w(c,1)):(c=vo(m),c.c(),w(c,1),c.m(a.parentNode,a)):c&&(se(),k(c,1,1,()=>{c=null}),le())},i(m){f||(w(l.$$.fragment,m),w(c),f=!0)},o(m){k(l.$$.fragment,m),k(c),f=!1},d(m){m&&(y(e),y(o),y(i),y(s),y(u),y(a)),C(l,m),c&&c.d(m)}}}function Lm(r){let e,n,t;function o(s){r[7](s)}let i={title:"Local Storage Quota Exceeded",$$slots:{default:[Pm]},$$scope:{ctx:r}};return r[0]!==void 0&&(i.open=r[0]),e=new Lt({props:i}),K.push(()=>V(e,"open",o)),{c(){P(e.$$.fragment)},m(s,l){L(e,s,l),t=!0},p(s,[l]){const u={};l&2054&&(u.$$scope={dirty:l,ctx:s}),!n&&l&1&&(n=!0,u.open=s[0],Q(()=>n=!1)),e.$set(u)},i(s){t||(w(e.$$.fragment,s),t=!0)},o(s){k(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function Cm(r,e,n){let{show:t}=e,{setStorageError:o}=e,{clearCurrentSketch:i}=e,{currentAuthority:s}=e;function l(c){let p=pl(c);o&&n(1,o.storedStrings=p,o),c===s&&i()}function u(){i(),ml(),n(0,t=!1),n(1,o=void 0)}const a=c=>l(c.key);function f(c){t=c,n(0,t)}return r.$$set=c=>{"show"in c&&n(0,t=c.show),"setStorageError"in c&&n(1,o=c.setStorageError),"clearCurrentSketch"in c&&n(5,i=c.clearCurrentSketch),"currentAuthority"in c&&n(2,s=c.currentAuthority)},[t,o,s,l,u,i,a,f]}class Nm extends te{constructor(e){super(),ne(this,e,Cm,Lm,x,{show:0,setStorageError:1,clearCurrentSketch:5,currentAuthority:2})}}function wo(r){let e,n;return e=new Fl({props:{label:"Manage files",$$slots:{default:[qm]},$$scope:{ctx:r}}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&2097164&&(i.$$scope={dirty:o,ctx:t}),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Fm(r){let e,n,t;return{c(){e=G("img"),t=q(` + Save`),Ye(e.src,n=$p)||T(e,"src",n),T(e,"alt","Save as GeoJSON file")},m(o,i){$(o,e,i),$(o,t,i)},p:ee,d(o){o&&(y(e),y(t))}}}function Am(r){let e,n,t;return{c(){e=G("img"),t=q(` + Clear all`),Ye(e.src,n=vp)||T(e,"src",n),T(e,"alt","Clear all")},m(o,i){$(o,e,i),$(o,t,i)},p:ee,d(o){o&&(y(e),y(t))}}}function Rm(r){let e,n,t,o;return e=new ae({props:{$$slots:{default:[Fm]},$$scope:{ctx:r}}}),e.$on("click",r[8]),t=new bt({props:{$$slots:{default:[Am]},$$scope:{ctx:r}}}),t.$on("click",r[14]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&2097152&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&2097152&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function Om(r){let e;return{c(){e=q("Clear all work")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function jm(r){let e;return{c(){e=q("Cancel")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Im(r){let e,n,t,o;return e=new bt({props:{$$slots:{default:[Om]},$$scope:{ctx:r}}}),e.$on("click",r[7]),t=new ae({props:{$$slots:{default:[jm]},$$scope:{ctx:r}}}),t.$on("click",r[15]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&2097152&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&2097152&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function Bm(r){let e,n,t,o;return t=new Ze({props:{$$slots:{default:[Im]},$$scope:{ctx:r}}}),{c(){e=G("p"),e.textContent="This will delete everything for all schemes.",n=F(),P(t.$$.fragment)},m(i,s){$(i,e,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&2097160&&(l.$$scope={dirty:s,ctx:i}),t.$set(l)},i(i){o||(w(t.$$.fragment,i),o=!0)},o(i){k(t.$$.fragment,i),o=!1},d(i){i&&(y(e),y(n)),C(t,i)}}}function qm(r){let e,n,t,o,i,s,l,u,a;e=new Go({props:{label:"Load GeoJSON file",onLoad:r[9]}}),t=new Ze({props:{$$slots:{default:[Rm]},$$scope:{ctx:r}}}),i=new Je({props:{errorMessage:r[2]}});function f(p){r[16](p)}let c={title:"Would you like to clear your work?",displayEscapeButton:!1,$$slots:{default:[Bm]},$$scope:{ctx:r}};return r[3]!==void 0&&(c.open=r[3]),l=new Lt({props:c}),K.push(()=>V(l,"open",f)),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment),o=F(),P(i.$$.fragment),s=F(),P(l.$$.fragment)},m(p,m){L(e,p,m),$(p,n,m),L(t,p,m),$(p,o,m),L(i,p,m),$(p,s,m),L(l,p,m),a=!0},p(p,m){const g={};m&2097160&&(g.$$scope={dirty:m,ctx:p}),t.$set(g);const b={};m&4&&(b.errorMessage=p[2]),i.$set(b);const v={};m&2097160&&(v.$$scope={dirty:m,ctx:p}),!u&&m&8&&(u=!0,v.open=p[3],Q(()=>u=!1)),l.$set(v)},i(p){a||(w(e.$$.fragment,p),w(t.$$.fragment,p),w(i.$$.fragment,p),w(l.$$.fragment,p),a=!0)},o(p){k(e.$$.fragment,p),k(t.$$.fragment,p),k(i.$$.fragment,p),k(l.$$.fragment,p),a=!1},d(p){p&&(y(n),y(o),y(s)),C(e,p),C(t,p),C(i,p),C(l,p)}}}function Gm(r){let e,n,t,o,i,s=r[6].mode=="list"&&wo(r);function l(f){r[17](f)}function u(f){r[18](f)}let a={clearCurrentSketch:r[7],currentAuthority:r[1]};return r[4]!==void 0&&(a.show=r[4]),r[5]!==void 0&&(a.setStorageError=r[5]),n=new Nm({props:a}),K.push(()=>V(n,"show",l)),K.push(()=>V(n,"setStorageError",u)),{c(){s&&s.c(),e=F(),P(n.$$.fragment)},m(f,c){s&&s.m(f,c),$(f,e,c),L(n,f,c),i=!0},p(f,[c]){f[6].mode=="list"?s?(s.p(f,c),c&64&&w(s,1)):(s=wo(f),s.c(),w(s,1),s.m(e.parentNode,e)):s&&(se(),k(s,1,1,()=>{s=null}),le());const p={};c&2&&(p.currentAuthority=f[1]),!t&&c&16&&(t=!0,p.show=f[4],Q(()=>t=!1)),!o&&c&32&&(o=!0,p.setStorageError=f[5],Q(()=>o=!1)),n.$set(p)},i(f){i||(w(s),w(n.$$.fragment,f),i=!0)},o(f){k(s),k(n.$$.fragment,f),i=!1},d(f){f&&y(e),s&&s.d(f),C(n,f)}}}function Tm(r,e){var n=document.createElement("a");n.setAttribute("href","data:text/plain;charset=utf-8, "+encodeURIComponent(e)),n.setAttribute("download",r),document.body.appendChild(n),n.click(),document.body.removeChild(n)}function Dm(r,e,n){let t,o=ee,i=()=>(o(),o=He(a,I=>n(13,t=I)),a),s,l;Y(r,oe,I=>n(6,s=I)),Y(r,tt,I=>n(19,l=I)),r.$$.on_destroy.push(()=>o());let{cfg:u}=e,{gjSchemes:a}=e;i();let{authorityName:f}=e,c="",p=f;l!="v1"&&(p+=`_${l}`);let m=!1,g=!1;ot(async()=>{let A=new URLSearchParams(window.location.search).get("geojsonUrl"),R=window.localStorage.getItem(p);if(A){console.log(`Loading GeoJSON from ${A}`);try{let j=await(await fetch(A)).text();a.set(Mn(JSON.parse(j)))}catch(N){console.log(`Failed to load from URL: ${N}`)}}else if(R)try{a.set(Mn(JSON.parse(R)))}catch(N){console.log(`Failed to load from local storage: ${N}`)}n(12,m=!0)});let b=!1,v;function S(){n(3,g=!1),a.update(I=>{let A=Br(u);return A.origin=I.origin,A.authority=I.authority,A}),Zt.set(null),Vt.set(new Set),Be(oe,s.mode="list",s)}function d(){const I=JSON.parse(JSON.stringify(t));for(let A of I.features)delete A.properties.hide_while_editing;return I}function _(){let I=d();I.authority=f,I.origin="atip-v2",Tm(`${p}.geojson`,JSON.stringify(I,null," "))}function E(I,A){try{a.set(Mn(JSON.parse(A))),n(2,c="")}catch(R){n(2,c=`Couldn't load scheme from a file: ${R}`)}}const h=()=>n(3,g=!0),M=()=>n(3,g=!1);function O(I){g=I,n(3,g)}function B(I){b=I,n(4,b),n(12,m),n(13,t),n(11,p)}function D(I){v=I,n(5,v),n(12,m),n(13,t),n(11,p)}return r.$$set=I=>{"cfg"in I&&n(10,u=I.cfg),"gjSchemes"in I&&i(n(0,a=I.gjSchemes)),"authorityName"in I&&n(1,f=I.authorityName)},r.$$.update=()=>{if(r.$$.dirty&14336&&m&&t){console.log("GJ changed, saving to local storage");const I=dl(p,JSON.stringify(d()));I.isQuotaError&&(n(4,b=!0),n(5,v=I))}},[a,f,c,g,b,v,s,S,_,E,u,p,m,t,h,M,O,B,D]}class Um extends te{constructor(e){super(),ne(this,e,Dm,Gm,x,{cfg:10,gjSchemes:0,authorityName:1})}}function zm(r){let e;return{c(){e=G("div"),e.innerHTML=`

    Saving files

    ATIP does not send any data over the network or store your data in the cloud. The current file you're editing will be saved in your browser's local storage and automatically resume when you return to the page. Click Edit scheme , then @@ -72,11 +72,11 @@ and limitations under the License. or Load from GeoJSON to save or load a file to your computer. You can share these files with others - to collaborate on designs.

    `,T(e,"class","govuk-prose")},m(n,t){$(n,e,t)},p:ee,d(n){n&&y(e)}}}function zm(r){let e,n,t;function o(s){r[1](s)}let i={title:"Instructions",$$slots:{default:[Um]},$$scope:{ctx:r}};return r[0]!==void 0&&(i.open=r[0]),e=new Lt({props:i}),K.push(()=>V(e,"open",o)),{c(){P(e.$$.fragment)},m(s,l){L(e,s,l),t=!0},p(s,[l]){const u={};l&4&&(u.$$scope={dirty:l,ctx:s}),!n&&l&1&&(n=!0,u.open=s[0],Q(()=>n=!1)),e.$set(u)},i(s){t||(w(e.$$.fragment,s),t=!0)},o(s){k(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function Jm(r,e,n){let{open:t}=e;function o(i){t=i,n(0,t)}return r.$$set=i=>{"open"in i&&n(0,t=i.open)},[t,o]}class Ym extends te{constructor(e){super(),ne(this,e,Jm,zm,x,{open:0})}}function Xm(r){let e;return{c(){e=q("Save")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Wm(r){let e;return{c(){e=q("Edit geometry")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Hm(r){let e;return{c(){e=q("Delete")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Zm(r){let e,n,t,o,i,s;return e=new st({props:{$$slots:{default:[Xm]},$$scope:{ctx:r}}}),e.$on("click",r[5]),t=new ae({props:{$$slots:{default:[Wm]},$$scope:{ctx:r}}}),t.$on("click",r[6]),i=new bt({props:{$$slots:{default:[Hm]},$$scope:{ctx:r}}}),i.$on("click",r[7]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment),o=F(),P(i.$$.fragment)},m(l,u){L(e,l,u),$(l,n,u),L(t,l,u),$(l,o,u),L(i,l,u),s=!0},p(l,u){const a={};u&8192&&(a.$$scope={dirty:u,ctx:l}),e.$set(a);const f={};u&8192&&(f.$$scope={dirty:u,ctx:l}),t.$set(f);const c={};u&8192&&(c.$$scope={dirty:u,ctx:l}),i.$set(c)},i(l){s||(w(e.$$.fragment,l),w(t.$$.fragment,l),w(i.$$.fragment,l),s=!0)},o(l){k(e.$$.fragment,l),k(t.$$.fragment,l),k(i.$$.fragment,l),s=!1},d(l){l&&(y(n),y(o)),C(e,l),C(t,l),C(i,l)}}}function Km(r){let e,n,t=r[0].interventionName(r[3])+"",o,i,s,l,u,a,f,c,p,m,h,b;s=new Ze({props:{$$slots:{default:[Zm]},$$scope:{ctx:r}}}),u=new ze({props:{errorMessage:r[0].interventionWarning(r[3])}});function v(g){r[8](g)}var E=r[0].editFeatureForm;function d(g,S){let _={cfg:g[0],gjSchemes:g[1],id:g[2]};return g[3].properties!==void 0&&(_.props=g[3].properties),{props:_}}return E&&(f=Nn(E,d(r)),K.push(()=>V(f,"props",v))),{c(){e=G("h2"),n=q("Editing "),o=q(t),i=F(),P(s.$$.fragment),l=F(),P(u.$$.fragment),a=F(),f&&P(f.$$.fragment),p=fe()},m(g,S){$(g,e,S),z(e,n),z(e,o),$(g,i,S),L(s,g,S),$(g,l,S),L(u,g,S),$(g,a,S),f&&L(f,g,S),$(g,p,S),m=!0,h||(b=he(window,"keydown",r[4]),h=!0)},p(g,[S]){(!m||S&9)&&t!==(t=g[0].interventionName(g[3])+"")&&ge(o,t);const _={};S&8198&&(_.$$scope={dirty:S,ctx:g}),s.$set(_);const M={};if(S&9&&(M.errorMessage=g[0].interventionWarning(g[3])),u.$set(M),S&1&&E!==(E=g[0].editFeatureForm)){if(f){se();const O=f;k(O.$$.fragment,1,0,()=>{C(O,1)}),le()}E?(f=Nn(E,d(g)),K.push(()=>V(f,"props",v)),P(f.$$.fragment),w(f.$$.fragment,1),L(f,p.parentNode,p)):f=null}else if(E){const O={};S&1&&(O.cfg=g[0]),S&2&&(O.gjSchemes=g[1]),S&4&&(O.id=g[2]),!c&&S&8&&(c=!0,O.props=g[3].properties,Q(()=>c=!1)),f.$set(O)}},i(g){m||(w(s.$$.fragment,g),w(u.$$.fragment,g),f&&w(f.$$.fragment,g),m=!0)},o(g){k(s.$$.fragment,g),k(u.$$.fragment,g),f&&k(f.$$.fragment,g),m=!1},d(g){g&&(y(e),y(i),y(l),y(a),y(p)),C(s,g),C(u,g),f&&C(f,g),h=!1,b()}}}function Vm(r,e,n){let t,o,i=ee,s=()=>(i(),i=We(u,d=>n(10,o=d)),u);Y(r,He,d=>n(9,t=d)),r.$$.on_destroy.push(()=>i());let{cfg:l}=e,{gjSchemes:u}=e;s();let{id:a}=e,f=o.features.find(d=>d.id==a);function c(d){u.set(o)}ot(()=>{t==null||t.on("click",p)}),Ye(()=>{t==null||t.off("click",p)});function p(d){for(let g of t.queryRenderedFeatures(d.point,{layers:["interventions-points","interventions-lines","interventions-polygons"]}))if(g.id==a)return;oe.set({mode:"list"})}function m(d){if(d.key=="Escape"){d.stopPropagation(),oe.set({mode:"list"});return}if(d.key=="Delete"){const g=d.target.tagName;if(g=="INPUT"||g=="TEXTAREA")return;d.stopPropagation(),ei(u,a)}if(d.key=="e"){const g=d.target.tagName;if(g=="INPUT"||g=="TEXTAREA")return;d.stopPropagation(),oe.set({mode:"edit-geometry",id:a})}}const h=()=>oe.set({mode:"list"}),b=()=>oe.set({mode:"edit-geometry",id:a}),v=()=>ei(u,a);function E(d){r.$$.not_equal(f.properties,d)&&(f.properties=d,n(3,f))}return r.$$set=d=>{"cfg"in d&&n(0,l=d.cfg),"gjSchemes"in d&&s(n(1,u=d.gjSchemes)),"id"in d&&n(2,a=d.id)},r.$$.update=()=>{r.$$.dirty&8&&c()},[l,u,a,f,m,h,b,v,E]}class Qm extends te{constructor(e){super(),ne(this,e,Vm,Km,x,{cfg:0,gjSchemes:1,id:2})}}const xm="/atip/ss_huge_refactor_pt1/assets/delete-3c023172.svg";function ko(r,e,n){const t=r.slice();t[29]=e[n];const o=t[0].interventionWarning(t[29]);return t[30]=o,t}function ed(r){let e,n,t;return{c(){e=G("img"),t=q(` - Delete`),Je(e.src,n=xm)||T(e,"src",n),T(e,"alt","Delete scheme")},m(o,i){$(o,e,i),$(o,t,i)},p:ee,d(o){o&&(y(e),y(t))}}}function td(r){let e;return{c(){e=q("Show")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function nd(r){let e,n;return e=new ze({props:{errorMessage:"There's a problem with "+r[8]+" interventions below"}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o[0]&256&&(i.errorMessage="There's a problem with "+t[8]+" interventions below"),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function rd(r){let e,n;return e=new ze({props:{errorMessage:"There's a problem with one intervention below"}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p:ee,i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function So(r){let e,n;return e=new ds({props:{text:r[30]}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o[0]&13&&(i.text=t[30]),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Eo(r,e){let n,t,o,i=e[0].interventionName(e[29])+"",s,l,u,a,f,c=e[30]&&So(e);function p(...b){return e[20](e[29],...b)}function m(){return e[21](e[29])}function h(){return e[22](e[29])}return{key:r,first:null,c(){n=G("li"),t=G("a"),c&&c.c(),o=F(),s=q(i),l=F(),T(t,"href","#"),this.first=n},m(b,v){$(b,n,v),z(n,t),c&&c.m(t,null),z(t,o),z(t,s),z(n,l),u=!0,a||(f=[he(t,"click",p),he(t,"mouseenter",m),he(t,"mouseleave",h)],a=!0)},p(b,v){e=b,e[30]?c?(c.p(e,v),v[0]&13&&w(c,1)):(c=So(e),c.c(),w(c,1),c.m(t,o)):c&&(se(),k(c,1,1,()=>{c=null}),le()),(!u||v[0]&13)&&i!==(i=e[0].interventionName(e[29])+"")&&ge(s,i)},i(b){u||(w(c),u=!0)},o(b){k(c),u=!1},d(b){b&&y(n),c&&c.d(),a=!1,Rr(f)}}}function Mo(r){let e,n,t,o,i=r[7]==1?"intervention":"interventions",s,l,u,a,f,c;function p(h){r[23](h)}let m={label:"Move interventions to another scheme",choices:r[13]()};return r[5]!==void 0&&(m.value=r[5]),a=new xn({props:m}),K.push(()=>V(a,"value",p)),a.$on("change",r[12]),{c(){e=G("p"),n=q("Do you want to first move "),t=q(r[7]),o=F(),s=q(i),l=q(" to another scheme?"),u=F(),P(a.$$.fragment)},m(h,b){$(h,e,b),z(e,n),z(e,t),z(e,o),z(e,s),z(e,l),$(h,u,b),L(a,h,b),c=!0},p(h,b){(!c||b[0]&128)&&ge(t,h[7]),(!c||b[0]&128)&&i!==(i=h[7]==1?"intervention":"interventions")&&ge(s,i);const v={};!f&&b[0]&32&&(f=!0,v.value=h[5],Q(()=>f=!1)),a.$set(v)},i(h){c||(w(a.$$.fragment,h),c=!0)},o(h){k(a.$$.fragment,h),c=!1},d(h){h&&(y(e),y(u)),C(a,h)}}}function id(r){let e;return{c(){e=q("Delete scheme")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function od(r){let e;return{c(){e=q("Cancel")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function sd(r){let e,n,t,o;return e=new bt({props:{$$slots:{default:[id]},$$scope:{ctx:r}}}),e.$on("click",r[11]),t=new ae({props:{$$slots:{default:[od]},$$scope:{ctx:r}}}),t.$on("click",r[24]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s[0]&67108864&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s[0]&67108864&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function ld(r){let e=r[7]>0&&r[13]().length>0,n,t,o,i=e&&Mo(r);return t=new Ze({props:{$$slots:{default:[sd]},$$scope:{ctx:r}}}),{c(){i&&i.c(),n=F(),P(t.$$.fragment)},m(s,l){i&&i.m(s,l),$(s,n,l),L(t,s,l),o=!0},p(s,l){l[0]&128&&(e=s[7]>0&&s[13]().length>0),e?i?(i.p(s,l),l[0]&128&&w(i,1)):(i=Mo(s),i.c(),w(i,1),i.m(n.parentNode,n)):i&&(se(),k(i,1,1,()=>{i=null}),le());const u={};l[0]&67108880&&(u.$$scope={dirty:l,ctx:s}),t.$set(u)},i(s){o||(w(i),w(t.$$.fragment,s),o=!0)},o(s){k(i),k(t.$$.fragment,s),o=!1},d(s){s&&y(n),i&&i.d(s),C(t,s)}}}function ud(r){let e,n=r[0].schemeName(r[3].schemes[r[2]])+"",t,o,i,s,l,u,a,f,c,p,m,h,b,v,E,d,g=[],S=new Map,_,M,O,B,D,I;l=new bt({props:{$$slots:{default:[ed]},$$scope:{ctx:r}}}),l.$on("click",r[17]);function A(J){r[18](J)}let R={$$slots:{default:[td]},$$scope:{ctx:r}};r[6]!==void 0&&(R.checked=r[6]),a=new ht({props:R}),K.push(()=>V(a,"checked",A)),a.$on("change",r[14]);const N=r[15].default,j=Wn(N,r,r[26],null);var H=r[0].editSchemeForm;function ie(J,Z){return{props:{gjSchemes:J[1],scheme_reference:J[2]}}}H&&(m=Nn(H,ie(r)));const ce=[rd,nd],U=[];function de(J,Z){return J[8]==1?0:J[8]>0?1:-1}~(b=de(r))&&(v=U[b]=ce[b](r));let _e=je(r[3].features.filter(r[19]));const Ee=J=>J[29].id;for(let J=0;J<_e.length;J+=1){let Z=ko(r,_e,J),Ie=Ee(Z);S.set(Ie,g[J]=Eo(Ie,Z))}function $e(J){r[25](J)}let pn={title:"Delete this scheme?",displayEscapeButton:!1,$$slots:{default:[ld]},$$scope:{ctx:r}};return r[4]!==void 0&&(pn.open=r[4]),M=new Lt({props:pn}),K.push(()=>V(M,"open",$e)),{c(){e=G("h3"),t=q(n),o=F(),i=G("input"),s=F(),P(l.$$.fragment),u=F(),P(a.$$.fragment),c=F(),j&&j.c(),p=F(),m&&P(m.$$.fragment),h=F(),v&&v.c(),E=F(),d=G("ol");for(let J=0;Jf=!1)),a.$set(X),j&&j.p&&(!B||Z[0]&67108864)&&Hn(j,N,J,J[26],B?Kn(N,J[26],Z,null):Zn(J[26]),null),Z[0]&1&&H!==(H=J[0].editSchemeForm)){if(m){se();const Me=m;k(Me.$$.fragment,1,0,()=>{C(Me,1)}),le()}H?(m=Nn(H,ie(J)),P(m.$$.fragment),w(m.$$.fragment,1),L(m,h.parentNode,h)):m=null}else if(H){const Me={};Z[0]&2&&(Me.gjSchemes=J[1]),Z[0]&4&&(Me.scheme_reference=J[2]),m.$set(Me)}let ye=b;b=de(J),b===ye?~b&&U[b].p(J,Z):(v&&(se(),k(U[ye],1,1,()=>{U[ye]=null}),le()),~b?(v=U[b],v?v.p(J,Z):(v=U[b]=ce[b](J),v.c()),w(v,1),v.m(E.parentNode,E)):v=null),Z[0]&1549&&(_e=je(J[3].features.filter(J[19])),se(),g=Or(g,Z,Ee,1,J,_e,S,d,jr,Eo,null,ko),le());const Ft={};Z[0]&67109040&&(Ft.$$scope={dirty:Z,ctx:J}),!O&&Z[0]&16&&(O=!0,Ft.open=J[4],Q(()=>O=!1)),M.$set(Ft)},i(J){if(!B){w(l.$$.fragment,J),w(a.$$.fragment,J),w(j,J),m&&w(m.$$.fragment,J),w(v);for(let Z=0;Z<_e.length;Z+=1)w(g[Z]);w(M.$$.fragment,J),B=!0}},o(J){k(l.$$.fragment,J),k(a.$$.fragment,J),k(j,J),m&&k(m.$$.fragment,J),k(v);for(let Z=0;Z(l(),l=We(m,U=>n(3,s=U)),m),a;Y(r,Vt,U=>n(27,i=U)),Y(r,He,U=>n(28,a=U)),r.$$.on_destroy.push(()=>l());let{$$slots:f={},$$scope:c}=e,{cfg:p}=e,{gjSchemes:m}=e;u();let{scheme_reference:h}=e,b=!1;Ye(()=>{Zt.set(null)});function v(U,de){U.preventDefault();let _e=s.features.find(Ee=>Ee.id==de);_e.geometry.type=="Point"?a==null||a.flyTo({center:_e.geometry.coordinates,duration:500}):a==null||a.fitBounds(Go(_e),{padding:200,duration:500}),oe.set({mode:"edit-form",id:de})}function E(U){Zt.update(de=>de==U?null:de)}function d(){m.update(U=>(U.features=U.features.filter(de=>de.properties.scheme_reference!=h),delete U.schemes[h],Object.keys(U.schemes).length==0&&(U=Br(p)),U)),Vt.update(U=>(U.delete(h),U)),n(4,b=!1)}let g="";function S(){g&&m.update(U=>{for(let de of U.features)de.properties.scheme_reference==h&&(de.properties.scheme_reference=g);return U})}function _(){return Object.values(s.schemes).filter(U=>U.scheme_reference!=h).map(U=>[U.scheme_reference,p.schemeName(U)])}let M=!i.has(h);function O(){Vt.update(U=>(M?U.delete(h):U.add(h),U))}function B(){s.schemes[h].color=this.value,m.set(s)}const D=()=>n(4,b=!0);function I(U){M=U,n(6,M)}const A=U=>U.properties.scheme_reference==h,R=(U,de)=>v(de,U.id),N=U=>Zt.set(U.id),j=U=>E(U.id);function H(U){g=U,n(5,g)}const ie=()=>n(4,b=!1);function ce(U){b=U,n(4,b)}return r.$$set=U=>{"cfg"in U&&n(0,p=U.cfg),"gjSchemes"in U&&u(n(1,m=U.gjSchemes)),"scheme_reference"in U&&n(2,h=U.scheme_reference),"$$scope"in U&&n(26,c=U.$$scope)},r.$$.update=()=>{r.$$.dirty[0]&13&&n(8,t=s.features.filter(U=>U.properties.scheme_reference==h&&p.interventionWarning(U)!=null).length),r.$$.dirty[0]&12&&n(7,o=s.features.filter(U=>U.properties.scheme_reference==h).length)},[p,m,h,s,b,g,M,o,t,v,E,d,S,_,O,f,B,D,I,A,R,N,j,H,ie,ce,c]}class fd extends te{constructor(e){super(),ne(this,e,ad,ud,x,{cfg:0,gjSchemes:1,scheme_reference:2},null,[-1,-1])}}function Po(r,e,n){const t=r.slice();return t[9]=e[n],t[11]=n,t}function cd(r){let e;return{c(){e=q("Add new blank scheme")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Lo(r){let e,n,t,o;function i(){return r[7](r[9])}e=new ae({props:{disabled:r[11]==0,$$slots:{default:[pd]},$$scope:{ctx:r}}}),e.$on("click",i);function s(){return r[8](r[9])}return t=new ae({props:{disabled:r[11]==Object.keys(r[3].schemes).length-1,$$slots:{default:[md]},$$scope:{ctx:r}}}),t.$on("click",s),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(l,u){L(e,l,u),$(l,n,u),L(t,l,u),o=!0},p(l,u){r=l;const a={};u&8&&(a.disabled=r[11]==0),u&4096&&(a.$$scope={dirty:u,ctx:r}),e.$set(a);const f={};u&8&&(f.disabled=r[11]==Object.keys(r[3].schemes).length-1),u&4096&&(f.$$scope={dirty:u,ctx:r}),t.$set(f)},i(l){o||(w(e.$$.fragment,l),w(t.$$.fragment,l),o=!0)},o(l){k(e.$$.fragment,l),k(t.$$.fragment,l),o=!1},d(l){l&&y(n),C(e,l),C(t,l)}}}function pd(r){let e;return{c(){e=q("Move up")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function md(r){let e;return{c(){e=q("Move down")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function dd(r){let e=Object.keys(r[3].schemes).length>1,n,t,o=e&&Lo(r);return{c(){o&&o.c(),n=fe()},m(i,s){o&&o.m(i,s),$(i,n,s),t=!0},p(i,s){s&8&&(e=Object.keys(i[3].schemes).length>1),e?o?(o.p(i,s),s&8&&w(o,1)):(o=Lo(i),o.c(),w(o,1),o.m(n.parentNode,n)):o&&(se(),k(o,1,1,()=>{o=null}),le())},i(i){t||(w(o),t=!0)},o(i){k(o),t=!1},d(i){i&&y(n),o&&o.d(i)}}}function Co(r,e){let n,t,o,i,s;return t=new fd({props:{cfg:e[0],gjSchemes:e[1],scheme_reference:e[9],$$slots:{default:[dd]},$$scope:{ctx:e}}}),{key:r,first:null,c(){n=fe(),P(t.$$.fragment),o=F(),i=G("hr"),this.first=n},m(l,u){$(l,n,u),L(t,l,u),$(l,o,u),$(l,i,u),s=!0},p(l,u){e=l;const a={};u&1&&(a.cfg=e[0]),u&2&&(a.gjSchemes=e[1]),u&8&&(a.scheme_reference=e[9]),u&4104&&(a.$$scope={dirty:u,ctx:e}),t.$set(a)},i(l){s||(w(t.$$.fragment,l),s=!0)},o(l){k(t.$$.fragment,l),s=!1},d(l){l&&(y(n),y(o),y(i)),C(t,l)}}}function gd(r){let e,n,t,o,i,s,l,u,a=[],f=new Map,c,p;e=new ae({props:{$$slots:{default:[cd]},$$scope:{ctx:r}}}),e.$on("click",r[4]),t=new qo({props:{label:"Add scheme from file",onLoad:r[5]}}),i=new ze({props:{errorMessage:r[2]}});let m=je(Object.keys(r[3].schemes));const h=b=>b[9];for(let b=0;b{n[t]=e[t]}),n}function bd(r,e,n){let t,o=ee,i=()=>(o(),o=We(l,h=>n(3,t=h)),l);r.$$.on_destroy.push(()=>o());let{cfg:s}=e,{gjSchemes:l}=e;i();function u(){dl(s,t),l.set(t)}let a="";function f(h,b){try{let v=s.backfill(JSON.parse(b));for(let d of Object.values(v.schemes)){if(d.scheme_reference in t.schemes)throw new Error("The file you're loading seems to contain duplicate data. Are you merging in the same file accidentally?");Be(l,t.schemes[d.scheme_reference]=d,t)}Be(l,t.features=t.features.concat(v.features),t);let E=1;t.features.forEach(d=>{d.id=E++}),l.set(t),n(2,a="")}catch(v){n(2,a=`Couldn't load scheme from a file: ${v}`)}}function c(h,b){const v=JSON.parse(JSON.stringify(Object.keys(t.schemes))),E=v.indexOf(h);if(E+b>=0&&E+bc(h,-1),m=h=>c(h,1);return r.$$set=h=>{"cfg"in h&&n(0,s=h.cfg),"gjSchemes"in h&&i(n(1,l=h.gjSchemes))},[s,l,a,t,u,f,c,p,m]}class vd extends te{constructor(e){super(),ne(this,e,bd,gd,x,{cfg:0,gjSchemes:1})}}function $d(r){let e;return{c(){e=q("Save")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function yd(r){let e;return{c(){e=q("Delete")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function wd(r){let e,n,t,o;return e=new st({props:{$$slots:{default:[$d]},$$scope:{ctx:r}}}),e.$on("click",r[6]),t=new bt({props:{disabled:!r[2],$$slots:{default:[yd]},$$scope:{ctx:r}}}),t.$on("click",r[4]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&512&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&4&&(u.disabled=!i[2]),s&512&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function kd(r){let e,n,t;return{c(){e=G("input"),T(e,"class","govuk-file-upload"),T(e,"id","load-image"),T(e,"type","file")},m(o,i){$(o,e,i),r[7](e),n||(t=he(e,"change",r[3]),n=!0)},p:ee,d(o){o&&y(e),r[7](null),n=!1,t()}}}function No(r){let e,n,t,o,i,s,l,u;return{c(){e=G("div"),n=G("label"),t=G("input"),o=q(` - Opacity: `),i=q(r[1]),s=q("%"),T(t,"type","range"),T(t,"min","0"),T(t,"max","100")},m(a,f){$(a,e,f),z(e,n),z(n,t),Le(t,r[1]),z(n,o),z(n,i),z(n,s),l||(u=[he(t,"change",r[8]),he(t,"input",r[8])],l=!0)},p(a,f){f&2&&Le(t,a[1]),f&2&&ge(i,a[1])},d(a){a&&y(e),l=!1,Rr(u)}}}function Sd(r){let e,n,t,o,i,s,l,u,a;e=new Ze({props:{$$slots:{default:[wd]},$$scope:{ctx:r}}}),t=new Mt({props:{label:"Load an image",id:"load-image",$$slots:{default:[kd]},$$scope:{ctx:r}}});let f=r[2]&&No(r);return{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment),o=F(),f&&f.c(),i=F(),s=G("p"),s.textContent=`Note this image isn't saved as part of this scheme. When you close this page, - it'll be lost.`},m(c,p){L(e,c,p),$(c,n,p),L(t,c,p),$(c,o,p),f&&f.m(c,p),$(c,i,p),$(c,s,p),l=!0,u||(a=he(window,"keydown",r[5]),u=!0)},p(c,[p]){const m={};p&516&&(m.$$scope={dirty:p,ctx:c}),e.$set(m);const h={};p&513&&(h.$$scope={dirty:p,ctx:c}),t.$set(h),c[2]?f?f.p(c,p):(f=No(c),f.c(),f.m(i.parentNode,i)):f&&(f.d(1),f=null)},i(c){l||(w(e.$$.fragment,c),w(t.$$.fragment,c),l=!0)},o(c){k(e.$$.fragment,c),k(t.$$.fragment,c),l=!1},d(c){c&&(y(n),y(o),y(i),y(s)),C(e,c),C(t,c),f&&f.d(c),u=!1,a()}}}function Ed(r,e,n){let t,o;Y(r,En,p=>n(1,t=p)),Y(r,Sn,p=>n(2,o=p));let i;async function s(p){let m=await i.files[0].arrayBuffer(),h=new Blob([new Uint8Array(m)]);Be(Sn,o=URL.createObjectURL(h),o)}function l(){Be(Sn,o=null,o),Be(En,t=100,t)}function u(p){p.key=="Escape"&&(p.stopPropagation(),oe.set({mode:"list"}))}const a=()=>oe.set({mode:"list"});function f(p){K[p?"unshift":"push"](()=>{i=p,n(0,i)})}function c(){t=gl(this.value),En.set(t)}return[i,t,o,s,l,u,a,f,c]}class Md extends te{constructor(e){super(),ne(this,e,Ed,Sd,x,{})}}function Pd(r){let e;return{c(){e=q("Cancel")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Ld(r){let e,n,t,o;return e=new ae({props:{$$slots:{default:[Pd]},$$scope:{ctx:r}}}),e.$on("click",r[0]),t=new vs({props:{editingExisting:!1}}),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,[s]){const l={};s&32&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function Cd(r,e,n){let t;Y(r,nn,u=>n(3,t=u));let{cfg:o}=e,{gjSchemes:i}=e;ot(()=>{t.start(),t.addEventListenerSuccess(s),t.addEventListenerFailure(l)}),Ye(()=>{t.stop(),t.clearEventListeners()});function s(u){u.properties||(u.properties={});let a=u;i.update(f=>(a.id=un(f),a.properties.scheme_reference=Qn(f),o.newPointFeature(a),f.features.push(a),f)),oe.set({mode:"edit-form",id:a.id})}function l(){oe.set({mode:"list"})}return r.$$set=u=>{"cfg"in u&&n(1,o=u.cfg),"gjSchemes"in u&&n(2,i=u.gjSchemes)},[l,o,i]}class Nd extends te{constructor(e){super(),ne(this,e,Cd,Ld,x,{cfg:1,gjSchemes:2})}}function Fd(r){let e;return{c(){e=q("Finish")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Ad(r){let e;return{c(){e=q("Cancel")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Rd(r){let e,n,t,o;return e=new st({props:{$$slots:{default:[Fd]},$$scope:{ctx:r}}}),e.$on("click",r[1]),t=new ae({props:{$$slots:{default:[Ad]},$$scope:{ctx:r}}}),t.$on("click",r[0]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&64&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&64&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function Od(r){let e,n,t,o;return e=new Ze({props:{$$slots:{default:[Rd]},$$scope:{ctx:r}}}),t=new $s({}),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,[s]){const l={};s&64&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function jd(r,e,n){let t;Y(r,It,a=>n(4,t=a));let{cfg:o}=e,{gjSchemes:i}=e;ot(()=>{t.startNew(),t.addEventListenerSuccess(s),t.addEventListenerFailure(l)}),Ye(()=>{t.stop(),t.clearEventListeners()});function s(a){a.properties||(a.properties={});let f=a;i.update(c=>(f.id=un(c),f.properties.scheme_reference=Qn(c),o.newPolygonFeature(f),c.features.push(f),c)),oe.set({mode:"edit-form",id:f.id})}function l(){oe.set({mode:"list"})}function u(){t.finish()}return r.$$set=a=>{"cfg"in a&&n(2,o=a.cfg),"gjSchemes"in a&&n(3,i=a.gjSchemes)},[l,u,o,i]}class Id extends te{constructor(e){super(),ne(this,e,jd,Od,x,{cfg:2,gjSchemes:3})}}function Bd(r){let e;return{c(){e=q("Finish")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function qd(r){let e;return{c(){e=q("Cancel")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Gd(r){let e,n,t,o;return e=new st({props:{$$slots:{default:[Bd]},$$scope:{ctx:r}}}),e.$on("click",r[2]),t=new ae({props:{$$slots:{default:[qd]},$$scope:{ctx:r}}}),t.$on("click",r[1]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&64&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&64&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function Td(r){let e,n,t,o;return e=new Ze({props:{$$slots:{default:[Gd]},$$scope:{ctx:r}}}),t=new ks({props:{cfg:r[0],extendRoute:!0}}),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,[s]){const l={};s&64&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&1&&(u.cfg=i[0]),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function Dd(r,e,n){let t;Y(r,Xe,a=>n(4,t=a));let{cfg:o}=e,{gjSchemes:i}=e;ot(()=>{t.startRoute(),t.addEventListenerSuccess(s),t.addEventListenerFailure(l)}),Ye(()=>{t.stop(),t.clearEventListeners()});function s(a){let f=a;i.update(c=>(f.id=un(c),f.properties.scheme_reference=Qn(c),o.newLineStringFeature(f),c.features.push(f),c)),oe.set({mode:"edit-form",id:f.id})}function l(){oe.set({mode:"list"})}function u(){t.finish()}return r.$$set=a=>{"cfg"in a&&n(0,o=a.cfg),"gjSchemes"in a&&n(3,i=a.gjSchemes)},[o,l,u,i]}class Ud extends te{constructor(e){super(),ne(this,e,Dd,Td,x,{cfg:0,gjSchemes:3})}}function zd(r){let e,n;return e=new ze({props:{errorMessage:"Failed to load route snapper"}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p:ee,i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Jd(r){let e,n,t;return{c(){e=G("label"),e.textContent="Route data unpacking",n=F(),t=G("progress"),T(e,"for","route-unpacking"),T(t,"id","route-unpacking"),T(t,"class","svelte-q3473n")},m(o,i){$(o,e,i),$(o,n,i),$(o,t,i)},p:ee,i:ee,o:ee,d(o){o&&(y(e),y(n),y(t))}}}function Yd(r){let e,n,t;return{c(){e=G("label"),e.textContent="Route tool loading",n=F(),t=G("progress"),T(e,"for","route-loading"),T(t,"id","route-loading"),t.value=r[0],T(t,"class","svelte-q3473n")},m(o,i){$(o,e,i),$(o,n,i),$(o,t,i)},p(o,i){i&1&&(t.value=o[0])},i:ee,o:ee,d(o){o&&(y(e),y(n),y(t))}}}function Xd(r){let e,n,t,o;const i=[Yd,Jd,zd],s=[];function l(u,a){return!u[1]&&!u[2]&&!u[3]?0:u[3]&&!u[1]&&!u[2]?1:u[2]?2:-1}return~(e=l(r))&&(n=s[e]=i[e](r)),{c(){n&&n.c(),t=fe()},m(u,a){~e&&s[e].m(u,a),$(u,t,a),o=!0},p(u,[a]){let f=e;e=l(u),e===f?~e&&s[e].p(u,a):(n&&(se(),k(s[f],1,1,()=>{s[f]=null}),le()),~e?(n=s[e],n?n.p(u,a):(n=s[e]=i[e](u),n.c()),w(n,1),n.m(t.parentNode,t)):n=null)},i(u){o||(w(n),o=!0)},o(u){k(n),o=!1},d(u){u&&y(t),~e&&s[e].d(u)}}}function Wd(r,e,n){let t,o;Y(r,He,a=>n(5,o=a));let{url:i}=e,s=0,l=!1,u=!1;return ot(async()=>{await ps(),console.log(`Grabbing ${i}`);try{const a=await aa(i,f=>{n(0,s=f)});Xe.set(new oa(o,a,ys,ws,Xr)),n(0,s=100),n(1,l=!0)}catch(a){console.log(`Route tool broke: ${a}`),n(2,u=!0)}}),r.$$set=a=>{"url"in a&&n(4,i=a.url)},r.$$.update=()=>{r.$$.dirty&1&&n(3,t=s>=100)},[s,l,u,t,i]}class Hd extends te{constructor(e){super(),ne(this,e,Wd,Xd,x,{url:4})}}function Zd(r){let e;return{c(){e=q("Finish")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Kd(r){let e;return{c(){e=q("Cancel")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Vd(r){let e,n,t,o;return e=new st({props:{$$slots:{default:[Zd]},$$scope:{ctx:r}}}),e.$on("click",r[1]),t=new ae({props:{$$slots:{default:[Kd]},$$scope:{ctx:r}}}),t.$on("click",r[0]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&64&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&64&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function Qd(r){let e,n,t,o;return e=new Ze({props:{$$slots:{default:[Vd]},$$scope:{ctx:r}}}),t=new Ss({}),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,[s]){const l={};s&64&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function xd(r,e,n){let t;Y(r,Xe,a=>n(4,t=a));let{cfg:o}=e,{gjSchemes:i}=e;ot(()=>{t.startArea(),t.addEventListenerSuccess(s),t.addEventListenerFailure(l)}),Ye(()=>{t.stop(),t.clearEventListeners()});function s(a){let f=a;i.update(c=>(f.id=un(c),f.properties.scheme_reference=Qn(c),o.newPolygonFeature(f),c.features.push(f),c)),oe.set({mode:"edit-form",id:f.id})}function l(){oe.set({mode:"list"})}function u(){t.finish()}return r.$$set=a=>{"cfg"in a&&n(2,o=a.cfg),"gjSchemes"in a&&n(3,i=a.gjSchemes)},[l,u,o,i]}class eg extends te{constructor(e){super(),ne(this,e,xd,Qd,x,{cfg:2,gjSchemes:3})}}function Fo(r){let e,n;return e=new Hd({props:{url:r[2]}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&4&&(i.url=t[2]),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function tg(r){let e,n,t,o;return t=new tp({props:{cfg:r[0]}}),{c(){e=G("h2"),e.textContent="StreetView",n=F(),P(t.$$.fragment)},m(i,s){$(i,e,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&1&&(l.cfg=i[0]),t.$set(l)},i(i){o||(w(t.$$.fragment,i),o=!0)},o(i){k(t.$$.fragment,i),o=!1},d(i){i&&(y(e),y(n)),C(t,i)}}}function ng(r){let e,n,t,o;return t=new Md({}),{c(){e=G("h2"),e.textContent="Georeference image",n=F(),P(t.$$.fragment)},m(i,s){$(i,e,s),$(i,n,s),L(t,i,s),o=!0},p:ee,i(i){o||(w(t.$$.fragment,i),o=!0)},o(i){k(t.$$.fragment,i),o=!1},d(i){i&&(y(e),y(n)),C(t,i)}}}function rg(r){let e,n,t,o,i,s;return t=new st({props:{$$slots:{default:[cg]},$$scope:{ctx:r}}}),t.$on("click",r[7]),{c(){e=G("h2"),e.textContent="Split route",n=F(),P(t.$$.fragment),o=F(),i=G("ul"),i.innerHTML=`
  • Click + to collaborate on designs.

    `,T(e,"class","govuk-prose")},m(n,t){$(n,e,t)},p:ee,d(n){n&&y(e)}}}function Jm(r){let e,n,t;function o(s){r[1](s)}let i={title:"Instructions",$$slots:{default:[zm]},$$scope:{ctx:r}};return r[0]!==void 0&&(i.open=r[0]),e=new Lt({props:i}),K.push(()=>V(e,"open",o)),{c(){P(e.$$.fragment)},m(s,l){L(e,s,l),t=!0},p(s,[l]){const u={};l&4&&(u.$$scope={dirty:l,ctx:s}),!n&&l&1&&(n=!0,u.open=s[0],Q(()=>n=!1)),e.$set(u)},i(s){t||(w(e.$$.fragment,s),t=!0)},o(s){k(e.$$.fragment,s),t=!1},d(s){C(e,s)}}}function Ym(r,e,n){let{open:t}=e;function o(i){t=i,n(0,t)}return r.$$set=i=>{"open"in i&&n(0,t=i.open)},[t,o]}class Xm extends te{constructor(e){super(),ne(this,e,Ym,Jm,x,{open:0})}}function Wm(r){let e;return{c(){e=q("Save")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Hm(r){let e;return{c(){e=q("Edit geometry")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Zm(r){let e;return{c(){e=q("Delete")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Km(r){let e,n,t,o,i,s;return e=new st({props:{$$slots:{default:[Wm]},$$scope:{ctx:r}}}),e.$on("click",r[5]),t=new ae({props:{$$slots:{default:[Hm]},$$scope:{ctx:r}}}),t.$on("click",r[6]),i=new bt({props:{$$slots:{default:[Zm]},$$scope:{ctx:r}}}),i.$on("click",r[7]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment),o=F(),P(i.$$.fragment)},m(l,u){L(e,l,u),$(l,n,u),L(t,l,u),$(l,o,u),L(i,l,u),s=!0},p(l,u){const a={};u&8192&&(a.$$scope={dirty:u,ctx:l}),e.$set(a);const f={};u&8192&&(f.$$scope={dirty:u,ctx:l}),t.$set(f);const c={};u&8192&&(c.$$scope={dirty:u,ctx:l}),i.$set(c)},i(l){s||(w(e.$$.fragment,l),w(t.$$.fragment,l),w(i.$$.fragment,l),s=!0)},o(l){k(e.$$.fragment,l),k(t.$$.fragment,l),k(i.$$.fragment,l),s=!1},d(l){l&&(y(n),y(o)),C(e,l),C(t,l),C(i,l)}}}function Vm(r){let e,n,t=r[0].interventionName(r[3])+"",o,i,s,l,u,a,f,c,p,m,g,b;s=new Ze({props:{$$slots:{default:[Km]},$$scope:{ctx:r}}}),u=new Je({props:{errorMessage:r[0].interventionWarning(r[3])}});function v(_){r[8](_)}var S=r[0].editFeatureForm;function d(_,E){let h={cfg:_[0],gjSchemes:_[1],id:_[2]};return _[3].properties!==void 0&&(h.props=_[3].properties),{props:h}}return S&&(f=Nn(S,d(r)),K.push(()=>V(f,"props",v))),{c(){e=G("h2"),n=q("Editing "),o=q(t),i=F(),P(s.$$.fragment),l=F(),P(u.$$.fragment),a=F(),f&&P(f.$$.fragment),p=fe()},m(_,E){$(_,e,E),z(e,n),z(e,o),$(_,i,E),L(s,_,E),$(_,l,E),L(u,_,E),$(_,a,E),f&&L(f,_,E),$(_,p,E),m=!0,g||(b=he(window,"keydown",r[4]),g=!0)},p(_,[E]){(!m||E&9)&&t!==(t=_[0].interventionName(_[3])+"")&&ge(o,t);const h={};E&8198&&(h.$$scope={dirty:E,ctx:_}),s.$set(h);const M={};if(E&9&&(M.errorMessage=_[0].interventionWarning(_[3])),u.$set(M),E&1&&S!==(S=_[0].editFeatureForm)){if(f){se();const O=f;k(O.$$.fragment,1,0,()=>{C(O,1)}),le()}S?(f=Nn(S,d(_)),K.push(()=>V(f,"props",v)),P(f.$$.fragment),w(f.$$.fragment,1),L(f,p.parentNode,p)):f=null}else if(S){const O={};E&1&&(O.cfg=_[0]),E&2&&(O.gjSchemes=_[1]),E&4&&(O.id=_[2]),!c&&E&8&&(c=!0,O.props=_[3].properties,Q(()=>c=!1)),f.$set(O)}},i(_){m||(w(s.$$.fragment,_),w(u.$$.fragment,_),f&&w(f.$$.fragment,_),m=!0)},o(_){k(s.$$.fragment,_),k(u.$$.fragment,_),f&&k(f.$$.fragment,_),m=!1},d(_){_&&(y(e),y(i),y(l),y(a),y(p)),C(s,_),C(u,_),f&&C(f,_),g=!1,b()}}}function Qm(r,e,n){let t,o,i=ee,s=()=>(i(),i=He(u,d=>n(10,o=d)),u);Y(r,qe,d=>n(9,t=d)),r.$$.on_destroy.push(()=>i());let{cfg:l}=e,{gjSchemes:u}=e;s();let{id:a}=e,f=o.features.find(d=>d.id==a);function c(d){u.set(o)}ot(()=>{t==null||t.on("click",p)}),Xe(()=>{t==null||t.off("click",p)});function p(d){for(let _ of t.queryRenderedFeatures(d.point,{layers:["interventions-points","interventions-lines","interventions-polygons"]}))if(_.id==a)return;oe.set({mode:"list"})}function m(d){if(d.key=="Escape"){d.stopPropagation(),oe.set({mode:"list"});return}if(d.key=="Delete"){const _=d.target.tagName;if(_=="INPUT"||_=="TEXTAREA")return;d.stopPropagation(),ei(u,a)}if(d.key=="e"){const _=d.target.tagName;if(_=="INPUT"||_=="TEXTAREA")return;d.stopPropagation(),oe.set({mode:"edit-geometry",id:a})}}const g=()=>oe.set({mode:"list"}),b=()=>oe.set({mode:"edit-geometry",id:a}),v=()=>ei(u,a);function S(d){r.$$.not_equal(f.properties,d)&&(f.properties=d,n(3,f))}return r.$$set=d=>{"cfg"in d&&n(0,l=d.cfg),"gjSchemes"in d&&s(n(1,u=d.gjSchemes)),"id"in d&&n(2,a=d.id)},r.$$.update=()=>{r.$$.dirty&8&&c()},[l,u,a,f,m,g,b,v,S]}class xm extends te{constructor(e){super(),ne(this,e,Qm,Vm,x,{cfg:0,gjSchemes:1,id:2})}}const ed="/atip/ss_huge_refactor_pt1/assets/delete-3c023172.svg";function ko(r,e,n){const t=r.slice();t[29]=e[n];const o=t[0].interventionWarning(t[29]);return t[30]=o,t}function td(r){let e,n,t;return{c(){e=G("img"),t=q(` + Delete`),Ye(e.src,n=ed)||T(e,"src",n),T(e,"alt","Delete scheme")},m(o,i){$(o,e,i),$(o,t,i)},p:ee,d(o){o&&(y(e),y(t))}}}function nd(r){let e;return{c(){e=q("Show")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function rd(r){let e,n;return e=new Je({props:{errorMessage:"There's a problem with "+r[8]+" interventions below"}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o[0]&256&&(i.errorMessage="There's a problem with "+t[8]+" interventions below"),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function id(r){let e,n;return e=new Je({props:{errorMessage:"There's a problem with one intervention below"}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p:ee,i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function So(r){let e,n;return e=new gs({props:{text:r[30]}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o[0]&13&&(i.text=t[30]),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Eo(r,e){let n,t,o,i=e[0].interventionName(e[29])+"",s,l,u,a,f,c=e[30]&&So(e);function p(...b){return e[20](e[29],...b)}function m(){return e[21](e[29])}function g(){return e[22](e[29])}return{key:r,first:null,c(){n=G("li"),t=G("a"),c&&c.c(),o=F(),s=q(i),l=F(),T(t,"href","#"),this.first=n},m(b,v){$(b,n,v),z(n,t),c&&c.m(t,null),z(t,o),z(t,s),z(n,l),u=!0,a||(f=[he(t,"click",p),he(t,"mouseenter",m),he(t,"mouseleave",g)],a=!0)},p(b,v){e=b,e[30]?c?(c.p(e,v),v[0]&13&&w(c,1)):(c=So(e),c.c(),w(c,1),c.m(t,o)):c&&(se(),k(c,1,1,()=>{c=null}),le()),(!u||v[0]&13)&&i!==(i=e[0].interventionName(e[29])+"")&&ge(s,i)},i(b){u||(w(c),u=!0)},o(b){k(c),u=!1},d(b){b&&y(n),c&&c.d(),a=!1,Rr(f)}}}function Mo(r){let e,n,t,o,i=r[7]==1?"intervention":"interventions",s,l,u,a,f,c;function p(g){r[23](g)}let m={label:"Move interventions to another scheme",choices:r[13]()};return r[5]!==void 0&&(m.value=r[5]),a=new xn({props:m}),K.push(()=>V(a,"value",p)),a.$on("change",r[12]),{c(){e=G("p"),n=q("Do you want to first move "),t=q(r[7]),o=F(),s=q(i),l=q(" to another scheme?"),u=F(),P(a.$$.fragment)},m(g,b){$(g,e,b),z(e,n),z(e,t),z(e,o),z(e,s),z(e,l),$(g,u,b),L(a,g,b),c=!0},p(g,b){(!c||b[0]&128)&&ge(t,g[7]),(!c||b[0]&128)&&i!==(i=g[7]==1?"intervention":"interventions")&&ge(s,i);const v={};!f&&b[0]&32&&(f=!0,v.value=g[5],Q(()=>f=!1)),a.$set(v)},i(g){c||(w(a.$$.fragment,g),c=!0)},o(g){k(a.$$.fragment,g),c=!1},d(g){g&&(y(e),y(u)),C(a,g)}}}function od(r){let e;return{c(){e=q("Delete scheme")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function sd(r){let e;return{c(){e=q("Cancel")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function ld(r){let e,n,t,o;return e=new bt({props:{$$slots:{default:[od]},$$scope:{ctx:r}}}),e.$on("click",r[11]),t=new ae({props:{$$slots:{default:[sd]},$$scope:{ctx:r}}}),t.$on("click",r[24]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s[0]&67108864&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s[0]&67108864&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function ud(r){let e=r[7]>0&&r[13]().length>0,n,t,o,i=e&&Mo(r);return t=new Ze({props:{$$slots:{default:[ld]},$$scope:{ctx:r}}}),{c(){i&&i.c(),n=F(),P(t.$$.fragment)},m(s,l){i&&i.m(s,l),$(s,n,l),L(t,s,l),o=!0},p(s,l){l[0]&128&&(e=s[7]>0&&s[13]().length>0),e?i?(i.p(s,l),l[0]&128&&w(i,1)):(i=Mo(s),i.c(),w(i,1),i.m(n.parentNode,n)):i&&(se(),k(i,1,1,()=>{i=null}),le());const u={};l[0]&67108880&&(u.$$scope={dirty:l,ctx:s}),t.$set(u)},i(s){o||(w(i),w(t.$$.fragment,s),o=!0)},o(s){k(i),k(t.$$.fragment,s),o=!1},d(s){s&&y(n),i&&i.d(s),C(t,s)}}}function ad(r){let e,n=r[0].schemeName(r[3].schemes[r[2]])+"",t,o,i,s,l,u,a,f,c,p,m,g,b,v,S,d,_=[],E=new Map,h,M,O,B,D,I;l=new bt({props:{$$slots:{default:[td]},$$scope:{ctx:r}}}),l.$on("click",r[17]);function A(J){r[18](J)}let R={$$slots:{default:[nd]},$$scope:{ctx:r}};r[6]!==void 0&&(R.checked=r[6]),a=new ht({props:R}),K.push(()=>V(a,"checked",A)),a.$on("change",r[14]);const N=r[15].default,j=Wn(N,r,r[26],null);var H=r[0].editSchemeForm;function ie(J,Z){return{props:{gjSchemes:J[1],scheme_reference:J[2]}}}H&&(m=Nn(H,ie(r)));const ce=[id,rd],U=[];function de(J,Z){return J[8]==1?0:J[8]>0?1:-1}~(b=de(r))&&(v=U[b]=ce[b](r));let _e=je(r[3].features.filter(r[19]));const Ee=J=>J[29].id;for(let J=0;J<_e.length;J+=1){let Z=ko(r,_e,J),Ie=Ee(Z);E.set(Ie,_[J]=Eo(Ie,Z))}function $e(J){r[25](J)}let pn={title:"Delete this scheme?",displayEscapeButton:!1,$$slots:{default:[ud]},$$scope:{ctx:r}};return r[4]!==void 0&&(pn.open=r[4]),M=new Lt({props:pn}),K.push(()=>V(M,"open",$e)),{c(){e=G("h3"),t=q(n),o=F(),i=G("input"),s=F(),P(l.$$.fragment),u=F(),P(a.$$.fragment),c=F(),j&&j.c(),p=F(),m&&P(m.$$.fragment),g=F(),v&&v.c(),S=F(),d=G("ol");for(let J=0;J<_.length;J+=1)_[J].c();h=F(),P(M.$$.fragment),T(i,"type","color"),T(d,"class","govuk-list govuk-list--number")},m(J,Z){$(J,e,Z),z(e,t),z(e,o),z(e,i),Le(i,r[3].schemes[r[2]].color),z(e,s),L(l,e,null),$(J,u,Z),L(a,J,Z),$(J,c,Z),j&&j.m(J,Z),$(J,p,Z),m&&L(m,J,Z),$(J,g,Z),~b&&U[b].m(J,Z),$(J,S,Z),$(J,d,Z);for(let Ie=0;Ie<_.length;Ie+=1)_[Ie]&&_[Ie].m(d,null);$(J,h,Z),L(M,J,Z),B=!0,D||(I=he(i,"input",r[16]),D=!0)},p(J,Z){(!B||Z[0]&13)&&n!==(n=J[0].schemeName(J[3].schemes[J[2]])+"")&&ge(t,n),Z[0]&12&&Le(i,J[3].schemes[J[2]].color);const Ie={};Z[0]&67108864&&(Ie.$$scope={dirty:Z,ctx:J}),l.$set(Ie);const X={};if(Z[0]&67108864&&(X.$$scope={dirty:Z,ctx:J}),!f&&Z[0]&64&&(f=!0,X.checked=J[6],Q(()=>f=!1)),a.$set(X),j&&j.p&&(!B||Z[0]&67108864)&&Hn(j,N,J,J[26],B?Kn(N,J[26],Z,null):Zn(J[26]),null),Z[0]&1&&H!==(H=J[0].editSchemeForm)){if(m){se();const Me=m;k(Me.$$.fragment,1,0,()=>{C(Me,1)}),le()}H?(m=Nn(H,ie(J)),P(m.$$.fragment),w(m.$$.fragment,1),L(m,g.parentNode,g)):m=null}else if(H){const Me={};Z[0]&2&&(Me.gjSchemes=J[1]),Z[0]&4&&(Me.scheme_reference=J[2]),m.$set(Me)}let ye=b;b=de(J),b===ye?~b&&U[b].p(J,Z):(v&&(se(),k(U[ye],1,1,()=>{U[ye]=null}),le()),~b?(v=U[b],v?v.p(J,Z):(v=U[b]=ce[b](J),v.c()),w(v,1),v.m(S.parentNode,S)):v=null),Z[0]&1549&&(_e=je(J[3].features.filter(J[19])),se(),_=Or(_,Z,Ee,1,J,_e,E,d,jr,Eo,null,ko),le());const Ft={};Z[0]&67109040&&(Ft.$$scope={dirty:Z,ctx:J}),!O&&Z[0]&16&&(O=!0,Ft.open=J[4],Q(()=>O=!1)),M.$set(Ft)},i(J){if(!B){w(l.$$.fragment,J),w(a.$$.fragment,J),w(j,J),m&&w(m.$$.fragment,J),w(v);for(let Z=0;Z<_e.length;Z+=1)w(_[Z]);w(M.$$.fragment,J),B=!0}},o(J){k(l.$$.fragment,J),k(a.$$.fragment,J),k(j,J),m&&k(m.$$.fragment,J),k(v);for(let Z=0;Z<_.length;Z+=1)k(_[Z]);k(M.$$.fragment,J),B=!1},d(J){J&&(y(e),y(u),y(c),y(p),y(g),y(S),y(d),y(h)),C(l),C(a,J),j&&j.d(J),m&&C(m,J),~b&&U[b].d(J);for(let Z=0;Z<_.length;Z+=1)_[Z].d();C(M,J),D=!1,I()}}}function fd(r,e,n){let t,o,i,s,l=ee,u=()=>(l(),l=He(m,U=>n(3,s=U)),m),a;Y(r,Vt,U=>n(27,i=U)),Y(r,qe,U=>n(28,a=U)),r.$$.on_destroy.push(()=>l());let{$$slots:f={},$$scope:c}=e,{cfg:p}=e,{gjSchemes:m}=e;u();let{scheme_reference:g}=e,b=!1;Xe(()=>{Zt.set(null)});function v(U,de){U.preventDefault();let _e=s.features.find(Ee=>Ee.id==de);_e.geometry.type=="Point"?a==null||a.flyTo({center:_e.geometry.coordinates,duration:500}):a==null||a.fitBounds(To(_e),{padding:200,duration:500}),oe.set({mode:"edit-form",id:de})}function S(U){Zt.update(de=>de==U?null:de)}function d(){m.update(U=>(U.features=U.features.filter(de=>de.properties.scheme_reference!=g),delete U.schemes[g],Object.keys(U.schemes).length==0&&(U=Br(p)),U)),Vt.update(U=>(U.delete(g),U)),n(4,b=!1)}let _="";function E(){_&&m.update(U=>{for(let de of U.features)de.properties.scheme_reference==g&&(de.properties.scheme_reference=_);return U})}function h(){return Object.values(s.schemes).filter(U=>U.scheme_reference!=g).map(U=>[U.scheme_reference,p.schemeName(U)])}let M=!i.has(g);function O(){Vt.update(U=>(M?U.delete(g):U.add(g),U))}function B(){s.schemes[g].color=this.value,m.set(s)}const D=()=>n(4,b=!0);function I(U){M=U,n(6,M)}const A=U=>U.properties.scheme_reference==g,R=(U,de)=>v(de,U.id),N=U=>Zt.set(U.id),j=U=>S(U.id);function H(U){_=U,n(5,_)}const ie=()=>n(4,b=!1);function ce(U){b=U,n(4,b)}return r.$$set=U=>{"cfg"in U&&n(0,p=U.cfg),"gjSchemes"in U&&u(n(1,m=U.gjSchemes)),"scheme_reference"in U&&n(2,g=U.scheme_reference),"$$scope"in U&&n(26,c=U.$$scope)},r.$$.update=()=>{r.$$.dirty[0]&13&&n(8,t=s.features.filter(U=>U.properties.scheme_reference==g&&p.interventionWarning(U)!=null).length),r.$$.dirty[0]&12&&n(7,o=s.features.filter(U=>U.properties.scheme_reference==g).length)},[p,m,g,s,b,_,M,o,t,v,S,d,E,h,O,f,B,D,I,A,R,N,j,H,ie,ce,c]}class cd extends te{constructor(e){super(),ne(this,e,fd,ad,x,{cfg:0,gjSchemes:1,scheme_reference:2},null,[-1,-1])}}function Po(r,e,n){const t=r.slice();return t[9]=e[n],t[11]=n,t}function pd(r){let e;return{c(){e=q("Add new blank scheme")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Lo(r){let e,n,t,o;function i(){return r[7](r[9])}e=new ae({props:{disabled:r[11]==0,$$slots:{default:[md]},$$scope:{ctx:r}}}),e.$on("click",i);function s(){return r[8](r[9])}return t=new ae({props:{disabled:r[11]==Object.keys(r[3].schemes).length-1,$$slots:{default:[dd]},$$scope:{ctx:r}}}),t.$on("click",s),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(l,u){L(e,l,u),$(l,n,u),L(t,l,u),o=!0},p(l,u){r=l;const a={};u&8&&(a.disabled=r[11]==0),u&4096&&(a.$$scope={dirty:u,ctx:r}),e.$set(a);const f={};u&8&&(f.disabled=r[11]==Object.keys(r[3].schemes).length-1),u&4096&&(f.$$scope={dirty:u,ctx:r}),t.$set(f)},i(l){o||(w(e.$$.fragment,l),w(t.$$.fragment,l),o=!0)},o(l){k(e.$$.fragment,l),k(t.$$.fragment,l),o=!1},d(l){l&&y(n),C(e,l),C(t,l)}}}function md(r){let e;return{c(){e=q("Move up")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function dd(r){let e;return{c(){e=q("Move down")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function gd(r){let e=Object.keys(r[3].schemes).length>1,n,t,o=e&&Lo(r);return{c(){o&&o.c(),n=fe()},m(i,s){o&&o.m(i,s),$(i,n,s),t=!0},p(i,s){s&8&&(e=Object.keys(i[3].schemes).length>1),e?o?(o.p(i,s),s&8&&w(o,1)):(o=Lo(i),o.c(),w(o,1),o.m(n.parentNode,n)):o&&(se(),k(o,1,1,()=>{o=null}),le())},i(i){t||(w(o),t=!0)},o(i){k(o),t=!1},d(i){i&&y(n),o&&o.d(i)}}}function Co(r,e){let n,t,o,i,s;return t=new cd({props:{cfg:e[0],gjSchemes:e[1],scheme_reference:e[9],$$slots:{default:[gd]},$$scope:{ctx:e}}}),{key:r,first:null,c(){n=fe(),P(t.$$.fragment),o=F(),i=G("hr"),this.first=n},m(l,u){$(l,n,u),L(t,l,u),$(l,o,u),$(l,i,u),s=!0},p(l,u){e=l;const a={};u&1&&(a.cfg=e[0]),u&2&&(a.gjSchemes=e[1]),u&8&&(a.scheme_reference=e[9]),u&4104&&(a.$$scope={dirty:u,ctx:e}),t.$set(a)},i(l){s||(w(t.$$.fragment,l),s=!0)},o(l){k(t.$$.fragment,l),s=!1},d(l){l&&(y(n),y(o),y(i)),C(t,l)}}}function hd(r){let e,n,t,o,i,s,l,u,a=[],f=new Map,c,p;e=new ae({props:{$$slots:{default:[pd]},$$scope:{ctx:r}}}),e.$on("click",r[4]),t=new Go({props:{label:"Add scheme from file",onLoad:r[5]}}),i=new Je({props:{errorMessage:r[2]}});let m=je(Object.keys(r[3].schemes));const g=b=>b[9];for(let b=0;b{n[t]=e[t]}),n}function vd(r,e,n){let t,o=ee,i=()=>(o(),o=He(l,g=>n(3,t=g)),l);r.$$.on_destroy.push(()=>o());let{cfg:s}=e,{gjSchemes:l}=e;i();function u(){gl(s,t),l.set(t)}let a="";function f(g,b){try{let v=s.backfill(JSON.parse(b));for(let d of Object.values(v.schemes)){if(d.scheme_reference in t.schemes)throw new Error("The file you're loading seems to contain duplicate data. Are you merging in the same file accidentally?");Be(l,t.schemes[d.scheme_reference]=d,t)}Be(l,t.features=t.features.concat(v.features),t);let S=1;t.features.forEach(d=>{d.id=S++}),l.set(t),n(2,a="")}catch(v){n(2,a=`Couldn't load scheme from a file: ${v}`)}}function c(g,b){const v=JSON.parse(JSON.stringify(Object.keys(t.schemes))),S=v.indexOf(g);if(S+b>=0&&S+bc(g,-1),m=g=>c(g,1);return r.$$set=g=>{"cfg"in g&&n(0,s=g.cfg),"gjSchemes"in g&&i(n(1,l=g.gjSchemes))},[s,l,a,t,u,f,c,p,m]}class $d extends te{constructor(e){super(),ne(this,e,vd,hd,x,{cfg:0,gjSchemes:1})}}function yd(r){let e;return{c(){e=q("Save")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function wd(r){let e;return{c(){e=q("Delete")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function kd(r){let e,n,t,o;return e=new st({props:{$$slots:{default:[yd]},$$scope:{ctx:r}}}),e.$on("click",r[6]),t=new bt({props:{disabled:!r[2],$$slots:{default:[wd]},$$scope:{ctx:r}}}),t.$on("click",r[4]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&512&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&4&&(u.disabled=!i[2]),s&512&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function Sd(r){let e,n,t;return{c(){e=G("input"),T(e,"class","govuk-file-upload"),T(e,"id","load-image"),T(e,"type","file")},m(o,i){$(o,e,i),r[7](e),n||(t=he(e,"change",r[3]),n=!0)},p:ee,d(o){o&&y(e),r[7](null),n=!1,t()}}}function No(r){let e,n,t,o,i,s,l,u;return{c(){e=G("div"),n=G("label"),t=G("input"),o=q(` + Opacity: `),i=q(r[1]),s=q("%"),T(t,"type","range"),T(t,"min","0"),T(t,"max","100")},m(a,f){$(a,e,f),z(e,n),z(n,t),Le(t,r[1]),z(n,o),z(n,i),z(n,s),l||(u=[he(t,"change",r[8]),he(t,"input",r[8])],l=!0)},p(a,f){f&2&&Le(t,a[1]),f&2&&ge(i,a[1])},d(a){a&&y(e),l=!1,Rr(u)}}}function Ed(r){let e,n,t,o,i,s,l,u,a;e=new Ze({props:{$$slots:{default:[kd]},$$scope:{ctx:r}}}),t=new Mt({props:{label:"Load an image",id:"load-image",$$slots:{default:[Sd]},$$scope:{ctx:r}}});let f=r[2]&&No(r);return{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment),o=F(),f&&f.c(),i=F(),s=G("p"),s.textContent=`Note this image isn't saved as part of this scheme. When you close this page, + it'll be lost.`},m(c,p){L(e,c,p),$(c,n,p),L(t,c,p),$(c,o,p),f&&f.m(c,p),$(c,i,p),$(c,s,p),l=!0,u||(a=he(window,"keydown",r[5]),u=!0)},p(c,[p]){const m={};p&516&&(m.$$scope={dirty:p,ctx:c}),e.$set(m);const g={};p&513&&(g.$$scope={dirty:p,ctx:c}),t.$set(g),c[2]?f?f.p(c,p):(f=No(c),f.c(),f.m(i.parentNode,i)):f&&(f.d(1),f=null)},i(c){l||(w(e.$$.fragment,c),w(t.$$.fragment,c),l=!0)},o(c){k(e.$$.fragment,c),k(t.$$.fragment,c),l=!1},d(c){c&&(y(n),y(o),y(i),y(s)),C(e,c),C(t,c),f&&f.d(c),u=!1,a()}}}function Md(r,e,n){let t,o;Y(r,En,p=>n(1,t=p)),Y(r,Sn,p=>n(2,o=p));let i;async function s(p){let m=await i.files[0].arrayBuffer(),g=new Blob([new Uint8Array(m)]);Be(Sn,o=URL.createObjectURL(g),o)}function l(){Be(Sn,o=null,o),Be(En,t=100,t)}function u(p){p.key=="Escape"&&(p.stopPropagation(),oe.set({mode:"list"}))}const a=()=>oe.set({mode:"list"});function f(p){K[p?"unshift":"push"](()=>{i=p,n(0,i)})}function c(){t=hl(this.value),En.set(t)}return[i,t,o,s,l,u,a,f,c]}class Pd extends te{constructor(e){super(),ne(this,e,Md,Ed,x,{})}}function Ld(r){let e;return{c(){e=q("Cancel")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Cd(r){let e,n,t,o;return e=new ae({props:{$$slots:{default:[Ld]},$$scope:{ctx:r}}}),e.$on("click",r[0]),t=new $s({props:{editingExisting:!1}}),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,[s]){const l={};s&32&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function Nd(r,e,n){let t;Y(r,nn,u=>n(3,t=u));let{cfg:o}=e,{gjSchemes:i}=e;ot(()=>{t.start(),t.addEventListenerSuccess(s),t.addEventListenerFailure(l)}),Xe(()=>{t.stop(),t.clearEventListeners()});function s(u){u.properties||(u.properties={});let a=u;i.update(f=>(a.id=un(f),a.properties.scheme_reference=Qn(f),o.newPointFeature(a),f.features.push(a),f)),oe.set({mode:"edit-form",id:a.id})}function l(){oe.set({mode:"list"})}return r.$$set=u=>{"cfg"in u&&n(1,o=u.cfg),"gjSchemes"in u&&n(2,i=u.gjSchemes)},[l,o,i]}class Fd extends te{constructor(e){super(),ne(this,e,Nd,Cd,x,{cfg:1,gjSchemes:2})}}function Ad(r){let e;return{c(){e=q("Finish")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Rd(r){let e;return{c(){e=q("Cancel")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Od(r){let e,n,t,o;return e=new st({props:{$$slots:{default:[Ad]},$$scope:{ctx:r}}}),e.$on("click",r[1]),t=new ae({props:{$$slots:{default:[Rd]},$$scope:{ctx:r}}}),t.$on("click",r[0]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&64&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&64&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function jd(r){let e,n,t,o;return e=new Ze({props:{$$slots:{default:[Od]},$$scope:{ctx:r}}}),t=new ys({}),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,[s]){const l={};s&64&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function Id(r,e,n){let t;Y(r,It,a=>n(4,t=a));let{cfg:o}=e,{gjSchemes:i}=e;ot(()=>{t.startNew(),t.addEventListenerSuccess(s),t.addEventListenerFailure(l)}),Xe(()=>{t.stop(),t.clearEventListeners()});function s(a){a.properties||(a.properties={});let f=a;i.update(c=>(f.id=un(c),f.properties.scheme_reference=Qn(c),o.newPolygonFeature(f),c.features.push(f),c)),oe.set({mode:"edit-form",id:f.id})}function l(){oe.set({mode:"list"})}function u(){t.finish()}return r.$$set=a=>{"cfg"in a&&n(2,o=a.cfg),"gjSchemes"in a&&n(3,i=a.gjSchemes)},[l,u,o,i]}class Bd extends te{constructor(e){super(),ne(this,e,Id,jd,x,{cfg:2,gjSchemes:3})}}function qd(r){let e;return{c(){e=q("Finish")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Gd(r){let e;return{c(){e=q("Cancel")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Td(r){let e,n,t,o;return e=new st({props:{$$slots:{default:[qd]},$$scope:{ctx:r}}}),e.$on("click",r[2]),t=new ae({props:{$$slots:{default:[Gd]},$$scope:{ctx:r}}}),t.$on("click",r[1]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&64&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&64&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function Dd(r){let e,n,t,o;return e=new Ze({props:{$$slots:{default:[Td]},$$scope:{ctx:r}}}),t=new Ss({props:{cfg:r[0],extendRoute:!0}}),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,[s]){const l={};s&64&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&1&&(u.cfg=i[0]),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function Ud(r,e,n){let t;Y(r,We,a=>n(4,t=a));let{cfg:o}=e,{gjSchemes:i}=e;ot(()=>{t.startRoute(),t.addEventListenerSuccess(s),t.addEventListenerFailure(l)}),Xe(()=>{t.stop(),t.clearEventListeners()});function s(a){let f=a;i.update(c=>(f.id=un(c),f.properties.scheme_reference=Qn(c),o.newLineStringFeature(f),c.features.push(f),c)),oe.set({mode:"edit-form",id:f.id})}function l(){oe.set({mode:"list"})}function u(){t.finish()}return r.$$set=a=>{"cfg"in a&&n(0,o=a.cfg),"gjSchemes"in a&&n(3,i=a.gjSchemes)},[o,l,u,i]}class zd extends te{constructor(e){super(),ne(this,e,Ud,Dd,x,{cfg:0,gjSchemes:3})}}function Jd(r){let e,n;return e=new Je({props:{errorMessage:"Failed to load route snapper"}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p:ee,i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function Yd(r){let e,n,t;return{c(){e=G("label"),e.textContent="Route data unpacking",n=F(),t=G("progress"),T(e,"for","route-unpacking"),T(t,"id","route-unpacking"),T(t,"class","svelte-q3473n")},m(o,i){$(o,e,i),$(o,n,i),$(o,t,i)},p:ee,i:ee,o:ee,d(o){o&&(y(e),y(n),y(t))}}}function Xd(r){let e,n,t;return{c(){e=G("label"),e.textContent="Route tool loading",n=F(),t=G("progress"),T(e,"for","route-loading"),T(t,"id","route-loading"),t.value=r[0],T(t,"class","svelte-q3473n")},m(o,i){$(o,e,i),$(o,n,i),$(o,t,i)},p(o,i){i&1&&(t.value=o[0])},i:ee,o:ee,d(o){o&&(y(e),y(n),y(t))}}}function Wd(r){let e,n,t,o;const i=[Xd,Yd,Jd],s=[];function l(u,a){return!u[1]&&!u[2]&&!u[3]?0:u[3]&&!u[1]&&!u[2]?1:u[2]?2:-1}return~(e=l(r))&&(n=s[e]=i[e](r)),{c(){n&&n.c(),t=fe()},m(u,a){~e&&s[e].m(u,a),$(u,t,a),o=!0},p(u,[a]){let f=e;e=l(u),e===f?~e&&s[e].p(u,a):(n&&(se(),k(s[f],1,1,()=>{s[f]=null}),le()),~e?(n=s[e],n?n.p(u,a):(n=s[e]=i[e](u),n.c()),w(n,1),n.m(t.parentNode,t)):n=null)},i(u){o||(w(n),o=!0)},o(u){k(n),o=!1},d(u){u&&y(t),~e&&s[e].d(u)}}}function Hd(r,e,n){let t,o;Y(r,qe,a=>n(5,o=a));let{url:i}=e,s=0,l=!1,u=!1;return ot(async()=>{await ms(),console.log(`Grabbing ${i}`);try{const a=await fa(i,f=>{n(0,s=f)});We.set(new sa(o,a,ws,ks,Xr)),n(0,s=100),n(1,l=!0)}catch(a){console.log(`Route tool broke: ${a}`),n(2,u=!0)}}),r.$$set=a=>{"url"in a&&n(4,i=a.url)},r.$$.update=()=>{r.$$.dirty&1&&n(3,t=s>=100)},[s,l,u,t,i]}class Zd extends te{constructor(e){super(),ne(this,e,Hd,Wd,x,{url:4})}}function Kd(r){let e;return{c(){e=q("Finish")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Vd(r){let e;return{c(){e=q("Cancel")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Qd(r){let e,n,t,o;return e=new st({props:{$$slots:{default:[Kd]},$$scope:{ctx:r}}}),e.$on("click",r[1]),t=new ae({props:{$$slots:{default:[Vd]},$$scope:{ctx:r}}}),t.$on("click",r[0]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&64&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&64&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function xd(r){let e,n,t,o;return e=new Ze({props:{$$slots:{default:[Qd]},$$scope:{ctx:r}}}),t=new Es({}),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,[s]){const l={};s&64&&(l.$$scope={dirty:s,ctx:i}),e.$set(l)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function eg(r,e,n){let t;Y(r,We,a=>n(4,t=a));let{cfg:o}=e,{gjSchemes:i}=e;ot(()=>{t.startArea(),t.addEventListenerSuccess(s),t.addEventListenerFailure(l)}),Xe(()=>{t.stop(),t.clearEventListeners()});function s(a){let f=a;i.update(c=>(f.id=un(c),f.properties.scheme_reference=Qn(c),o.newPolygonFeature(f),c.features.push(f),c)),oe.set({mode:"edit-form",id:f.id})}function l(){oe.set({mode:"list"})}function u(){t.finish()}return r.$$set=a=>{"cfg"in a&&n(2,o=a.cfg),"gjSchemes"in a&&n(3,i=a.gjSchemes)},[l,u,o,i]}class tg extends te{constructor(e){super(),ne(this,e,eg,xd,x,{cfg:2,gjSchemes:3})}}function Fo(r){let e,n;return e=new Zd({props:{url:r[2]}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&4&&(i.url=t[2]),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function ng(r){let e,n,t,o;return t=new np({props:{cfg:r[0]}}),{c(){e=G("h2"),e.textContent="StreetView",n=F(),P(t.$$.fragment)},m(i,s){$(i,e,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&1&&(l.cfg=i[0]),t.$set(l)},i(i){o||(w(t.$$.fragment,i),o=!0)},o(i){k(t.$$.fragment,i),o=!1},d(i){i&&(y(e),y(n)),C(t,i)}}}function rg(r){let e,n,t,o;return t=new Pd({}),{c(){e=G("h2"),e.textContent="Georeference image",n=F(),P(t.$$.fragment)},m(i,s){$(i,e,s),$(i,n,s),L(t,i,s),o=!0},p:ee,i(i){o||(w(t.$$.fragment,i),o=!0)},o(i){k(t.$$.fragment,i),o=!1},d(i){i&&(y(e),y(n)),C(t,i)}}}function ig(r){let e,n,t,o,i,s;return t=new st({props:{$$slots:{default:[pg]},$$scope:{ctx:r}}}),t.$on("click",r[7]),{c(){e=G("h2"),e.textContent="Split route",n=F(),P(t.$$.fragment),o=F(),i=G("ul"),i.innerHTML=`
  • Click on a route to split it
  • Click on the map or press Escape - to cancel
  • `},m(l,u){$(l,e,u),$(l,n,u),L(t,l,u),$(l,o,u),$(l,i,u),s=!0},p(l,u){const a={};u&512&&(a.$$scope={dirty:u,ctx:l}),t.$set(a)},i(l){s||(w(t.$$.fragment,l),s=!0)},o(l){k(t.$$.fragment,l),s=!1},d(l){l&&(y(e),y(n),y(o),y(i)),C(t,l)}}}function ig(r){let e,n,t,o;return t=new eg({props:{cfg:r[0],gjSchemes:r[1]}}),{c(){e=G("h2"),e.textContent="New polygon (snapped)",n=F(),P(t.$$.fragment)},m(i,s){$(i,e,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&1&&(l.cfg=i[0]),s&2&&(l.gjSchemes=i[1]),t.$set(l)},i(i){o||(w(t.$$.fragment,i),o=!0)},o(i){k(t.$$.fragment,i),o=!1},d(i){i&&(y(e),y(n)),C(t,i)}}}function og(r){let e,n,t,o;return t=new Id({props:{cfg:r[0],gjSchemes:r[1]}}),{c(){e=G("h2"),e.textContent="New polygon (freehand)",n=F(),P(t.$$.fragment)},m(i,s){$(i,e,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&1&&(l.cfg=i[0]),s&2&&(l.gjSchemes=i[1]),t.$set(l)},i(i){o||(w(t.$$.fragment,i),o=!0)},o(i){k(t.$$.fragment,i),o=!1},d(i){i&&(y(e),y(n)),C(t,i)}}}function sg(r){let e,n,t,o;return t=new Ud({props:{cfg:r[0],gjSchemes:r[1]}}),{c(){e=G("h2"),e.textContent="New route",n=F(),P(t.$$.fragment)},m(i,s){$(i,e,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&1&&(l.cfg=i[0]),s&2&&(l.gjSchemes=i[1]),t.$set(l)},i(i){o||(w(t.$$.fragment,i),o=!0)},o(i){k(t.$$.fragment,i),o=!1},d(i){i&&(y(e),y(n)),C(t,i)}}}function lg(r){let e,n,t,o;return t=new Nd({props:{cfg:r[0],gjSchemes:r[1]}}),{c(){e=G("h2"),e.textContent="New point",n=F(),P(t.$$.fragment)},m(i,s){$(i,e,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&1&&(l.cfg=i[0]),s&2&&(l.gjSchemes=i[1]),t.$set(l)},i(i){o||(w(t.$$.fragment,i),o=!0)},o(i){k(t.$$.fragment,i),o=!1},d(i){i&&(y(e),y(n)),C(t,i)}}}function ug(r){let e,n;return e=new Ff({props:{cfg:r[0],gjSchemes:r[1],id:r[4].id}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&1&&(i.cfg=t[0]),o&2&&(i.gjSchemes=t[1]),o&16&&(i.id=t[4].id),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function ag(r){let e,n;return e=new Qm({props:{cfg:r[0],gjSchemes:r[1],id:r[4].id}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&1&&(i.cfg=t[0]),o&2&&(i.gjSchemes=t[1]),o&16&&(i.id=t[4].id),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function fg(r){let e,n;return e=new vd({props:{cfg:r[0],gjSchemes:r[1]}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&1&&(i.cfg=t[0]),o&2&&(i.gjSchemes=t[1]),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function cg(r){let e;return{c(){e=q("Finish")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function pg(r){let e,n,t,o,i,s,l=r[3]&&Fo(r);const u=[fg,ag,ug,lg,sg,og,ig,rg,ng,tg],a=[];function f(c,p){return c[4].mode=="list"?0:c[4].mode=="edit-form"?1:c[4].mode=="edit-geometry"?2:c[4].mode=="new-point"?3:c[4].mode=="new-route"?4:c[4].mode=="new-freehand-polygon"?5:c[4].mode=="new-snapped-polygon"?6:c[4].mode=="split-route"?7:c[4].mode=="set-image"?8:c[4].mode=="streetview"?9:-1}return~(t=f(r))&&(o=a[t]=u[t](r)),{c(){e=G("div"),l&&l.c(),n=F(),o&&o.c(),i=fe(),Pe(e,"visibility",r[4].mode=="list"?"visible":"hidden")},m(c,p){$(c,e,p),l&&l.m(e,null),$(c,n,p),~t&&a[t].m(c,p),$(c,i,p),s=!0},p(c,[p]){c[3]?l?(l.p(c,p),p&8&&w(l,1)):(l=Fo(c),l.c(),w(l,1),l.m(e,null)):l&&(se(),k(l,1,1,()=>{l=null}),le()),p&16&&Pe(e,"visibility",c[4].mode=="list"?"visible":"hidden");let m=t;t=f(c),t===m?~t&&a[t].p(c,p):(o&&(se(),k(a[m],1,1,()=>{a[m]=null}),le()),~t?(o=a[t],o?o.p(c,p):(o=a[t]=u[t](c),o.c()),w(o,1),o.m(i.parentNode,i)):o=null)},i(c){s||(w(l),w(o),s=!0)},o(c){k(l),k(o),s=!1},d(c){c&&(y(e),y(n),y(i)),l&&l.d(),~t&&a[t].d(c)}}}function mg(r,e,n){let t,o,i,s,l;Y(r,Xe,p=>n(8,t=p)),Y(r,It,p=>n(5,o=p)),Y(r,nn,p=>n(6,i=p)),Y(r,He,p=>n(3,s=p)),Y(r,oe,p=>n(4,l=p));let{cfg:u}=e,{gjSchemes:a}=e,{routeSnapperUrl:f}=e;Ye(()=>{i==null||i.tearDown(),o==null||o.tearDown(),t==null||t.tearDown()});const c=()=>oe.set({mode:"list"});return r.$$set=p=>{"cfg"in p&&n(0,u=p.cfg),"gjSchemes"in p&&n(1,a=p.gjSchemes),"routeSnapperUrl"in p&&n(2,f=p.routeSnapperUrl)},r.$$.update=()=>{r.$$.dirty&72&&s&&!i&&nn.set(new Vl(s)),r.$$.dirty&40&&s&&!o&&It.set(new Lu(s))},[u,a,f,s,l,o,i,c]}class dg extends te{constructor(e){super(),ne(this,e,mg,pg,x,{cfg:0,gjSchemes:1,routeSnapperUrl:2})}}function Ao(r){let e,n,t,o,i,s,l,u,a,f,c,p,m,h,b,v,E;return p=new Al({props:{boundaryGeojson:r[2]}}),h=new Ze({props:{$$slots:{default:[_g]},$$scope:{ctx:r}}}),v=new _l({}),{c(){e=G("h2"),e.textContent="ATIP Scheme Sketcher",n=F(),t=G("p"),t.textContent=`App version: ${bl()}`,o=F(),i=G("div"),s=G("p"),s.textContent=`${r[11]()}`,l=F(),u=G("a"),a=q("Change area"),c=F(),P(p.$$.fragment),m=F(),P(h.$$.fragment),b=F(),P(v.$$.fragment),T(e,"class","svelte-1750ds5"),T(t,"class","svelte-1750ds5"),T(s,"class","svelte-1750ds5"),T(u,"href",f=`index.html?schema=${r[4]}`),T(u,"class","svelte-1750ds5"),Pe(i,"display","flex"),Pe(i,"justify-content","space-between"),T(i,"class","svelte-1750ds5")},m(d,g){$(d,e,g),$(d,n,g),$(d,t,g),$(d,o,g),$(d,i,g),z(i,s),z(i,l),z(i,u),z(u,a),z(i,c),L(p,i,null),$(d,m,g),L(h,d,g),$(d,b,g),L(v,d,g),E=!0},p(d,g){(!E||g&16&&f!==(f=`index.html?schema=${d[4]}`))&&T(u,"href",f);const S={};g&4&&(S.boundaryGeojson=d[2]),p.$set(S);const _={};g&131072&&(_.$$scope={dirty:g,ctx:d}),h.$set(_)},i(d){E||(w(p.$$.fragment,d),w(h.$$.fragment,d),w(v.$$.fragment,d),E=!0)},o(d){k(p.$$.fragment,d),k(h.$$.fragment,d),k(v.$$.fragment,d),E=!1},d(d){d&&(y(e),y(n),y(t),y(o),y(i),y(m),y(b)),C(p),C(h,d),C(v,d)}}}function gg(r){let e;return{c(){e=q("About")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function hg(r){let e;return{c(){e=q("Instructions")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function _g(r){let e,n,t,o;return e=new ae({props:{$$slots:{default:[gg]},$$scope:{ctx:r}}}),e.$on("click",r[9]),t=new ae({props:{$$slots:{default:[hg]},$$scope:{ctx:r}}}),t.$on("click",r[10]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&131072&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&131072&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function Ro(r){let e;return{c(){e=G("hr"),T(e,"class","svelte-1750ds5")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function bg(r){let e,n;return e=new Vc({props:{cfg:xe,gjSchemes:r[6]}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p:ee,i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function vg(r){let e,n;return e=new _p({props:{cfg:xe,gjSchemes:r[6]}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p:ee,i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function $g(r){let e,n,t,o,i,s,l,u,a,f,c,p,m,h,b;e=new Rl({props:{position:"top-right"}}),t=new Ya({props:{cfg:xe,boundaryGeojson:r[2]}}),i=new Qf({props:{cfg:xe,gjSchemes:r[6]}}),l=new Bf({props:{cfg:xe}});const v=[vg,bg],E=[];function d(g,S){return g[3].mode=="list"?0:g[3].mode=="split-route"?1:-1}return~(a=d(r))&&(f=E[a]=v[a](r)),p=new uc({props:{cfg:xe}}),h=new nc({props:{cfg:xe}}),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment),o=F(),P(i.$$.fragment),s=F(),P(l.$$.fragment),u=F(),f&&f.c(),c=F(),P(p.$$.fragment),m=F(),P(h.$$.fragment)},m(g,S){L(e,g,S),$(g,n,S),L(t,g,S),$(g,o,S),L(i,g,S),$(g,s,S),L(l,g,S),$(g,u,S),~a&&E[a].m(g,S),$(g,c,S),L(p,g,S),$(g,m,S),L(h,g,S),b=!0},p(g,S){const _={};S&4&&(_.boundaryGeojson=g[2]),t.$set(_);let M=a;a=d(g),a===M?~a&&E[a].p(g,S):(f&&(se(),k(E[M],1,1,()=>{E[M]=null}),le()),~a?(f=E[a],f?f.p(g,S):(f=E[a]=v[a](g),f.c()),w(f,1),f.m(c.parentNode,c)):f=null)},i(g){b||(w(e.$$.fragment,g),w(t.$$.fragment,g),w(i.$$.fragment,g),w(l.$$.fragment,g),w(f),w(p.$$.fragment,g),w(h.$$.fragment,g),b=!0)},o(g){k(e.$$.fragment,g),k(t.$$.fragment,g),k(i.$$.fragment,g),k(l.$$.fragment,g),k(f),k(p.$$.fragment,g),k(h.$$.fragment,g),b=!1},d(g){g&&(y(n),y(o),y(s),y(u),y(c),y(m)),C(e,g),C(t,g),C(i,g),C(l,g),~a&&E[a].d(g),C(p,g),C(h,g)}}}function yg(r){let e,n,t,o,i,s,l,u,a,f,c,p,m,h,b,v,E,d,g,S=r[3].mode=="list"&&Ao(r);o=new Dm({props:{cfg:xe,gjSchemes:r[6],authorityName:r[7]}}),s=new dg({props:{cfg:xe,gjSchemes:r[6],routeSnapperUrl:r[8]}});let _=r[3].mode!="list"&&Ro();a=new Fl({}),p=new hl({props:{style:r[5],$$slots:{default:[$g]},$$scope:{ctx:r}}});function M(I){r[13](I)}let O={};r[0]!==void 0&&(O.open=r[0]),h=new Ol({props:O}),K.push(()=>V(h,"open",M));function B(I){r[14](I)}let D={};return r[1]!==void 0&&(D.open=r[1]),E=new Ym({props:D}),K.push(()=>V(E,"open",B)),{c(){e=G("div"),n=G("div"),S&&S.c(),t=F(),P(o.$$.fragment),i=F(),P(s.$$.fragment),l=F(),_&&_.c(),u=F(),P(a.$$.fragment),f=F(),c=G("div"),P(p.$$.fragment),m=F(),P(h.$$.fragment),v=F(),P(E.$$.fragment),T(n,"class","sidebar govuk-prose svelte-1750ds5"),T(c,"class","main svelte-1750ds5"),T(e,"class","overall-layout svelte-1750ds5")},m(I,A){$(I,e,A),z(e,n),S&&S.m(n,null),z(n,t),L(o,n,null),z(n,i),L(s,n,null),z(n,l),_&&_.m(n,null),z(n,u),L(a,n,null),z(e,f),z(e,c),L(p,c,null),$(I,m,A),L(h,I,A),$(I,v,A),L(E,I,A),g=!0},p(I,[A]){I[3].mode=="list"?S?(S.p(I,A),A&8&&w(S,1)):(S=Ao(I),S.c(),w(S,1),S.m(n,t)):S&&(se(),k(S,1,1,()=>{S=null}),le()),I[3].mode!="list"?_||(_=Ro(),_.c(),_.m(n,u)):_&&(_.d(1),_=null);const R={};A&32&&(R.style=I[5]),A&131084&&(R.$$scope={dirty:A,ctx:I}),p.$set(R);const N={};!b&&A&1&&(b=!0,N.open=I[0],Q(()=>b=!1)),h.$set(N);const j={};!d&&A&2&&(d=!0,j.open=I[1],Q(()=>d=!1)),E.$set(j)},i(I){g||(w(S),w(o.$$.fragment,I),w(s.$$.fragment,I),w(a.$$.fragment,I),w(p.$$.fragment,I),w(h.$$.fragment,I),w(E.$$.fragment,I),g=!0)},o(I){k(S),k(o.$$.fragment,I),k(s.$$.fragment,I),k(a.$$.fragment,I),k(p.$$.fragment,I),k(h.$$.fragment,I),k(E.$$.fragment,I),g=!1},d(I){I&&(y(e),y(m),y(v)),S&&S.d(),C(o),C(s),_&&_.d(),C(a),C(p),C(h,I),C(E,I)}}}function wg(r,e,n){let t,o,i,s;Y(r,yl,S=>n(12,t=S)),Y(r,oe,S=>n(3,o=S)),Y(r,tt,S=>n(4,i=S)),Y(r,pr,S=>n(5,s=S));let l=at(Br(xe)),u=!1,a=!1,f=new URLSearchParams(window.location.search),c=f.get("authority");pr.set(f.get("style")||"streets");let p=`https://atip.uk/route-snappers/v2.6/${c}.bin.gz`;function m(){n(0,u=!u),n(1,a=!1)}function h(){n(1,a=!a),n(0,u=!1)}let b;ot(async()=>{vl(),n(2,b=await v())});async function v(){let S=await $l();return S.features=S.features.filter(_=>_.properties.full_name==c),S.features.length===0&&(window.location.href=`index.html?error=Authority name not found: ${c}`),S}function E(){let S=c.split("_");if(S.length==2){if(S[0]=="LAD")return`${S[1]} (LAD)`;if(S[0]=="TA")return`${S[1]} (Transport Authority)`}return c}function d(S){u=S,n(0,u)}function g(S){a=S,n(1,a)}return r.$$.update=()=>{r.$$.dirty&4096&&t&&He.set(t)},[u,a,b,o,i,s,l,c,p,m,h,E,t,d,g]}class kg extends te{constructor(e){super(),ne(this,e,wg,yg,x,{})}}document.body.className+=" js-enabled"+("noModule"in HTMLScriptElement.prototype?" govuk-frontend-supported":"");new kg({target:document.getElementById("app")}); + to cancel`},m(l,u){$(l,e,u),$(l,n,u),L(t,l,u),$(l,o,u),$(l,i,u),s=!0},p(l,u){const a={};u&512&&(a.$$scope={dirty:u,ctx:l}),t.$set(a)},i(l){s||(w(t.$$.fragment,l),s=!0)},o(l){k(t.$$.fragment,l),s=!1},d(l){l&&(y(e),y(n),y(o),y(i)),C(t,l)}}}function og(r){let e,n,t,o;return t=new tg({props:{cfg:r[0],gjSchemes:r[1]}}),{c(){e=G("h2"),e.textContent="New polygon (snapped)",n=F(),P(t.$$.fragment)},m(i,s){$(i,e,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&1&&(l.cfg=i[0]),s&2&&(l.gjSchemes=i[1]),t.$set(l)},i(i){o||(w(t.$$.fragment,i),o=!0)},o(i){k(t.$$.fragment,i),o=!1},d(i){i&&(y(e),y(n)),C(t,i)}}}function sg(r){let e,n,t,o;return t=new Bd({props:{cfg:r[0],gjSchemes:r[1]}}),{c(){e=G("h2"),e.textContent="New polygon (freehand)",n=F(),P(t.$$.fragment)},m(i,s){$(i,e,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&1&&(l.cfg=i[0]),s&2&&(l.gjSchemes=i[1]),t.$set(l)},i(i){o||(w(t.$$.fragment,i),o=!0)},o(i){k(t.$$.fragment,i),o=!1},d(i){i&&(y(e),y(n)),C(t,i)}}}function lg(r){let e,n,t,o;return t=new zd({props:{cfg:r[0],gjSchemes:r[1]}}),{c(){e=G("h2"),e.textContent="New route",n=F(),P(t.$$.fragment)},m(i,s){$(i,e,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&1&&(l.cfg=i[0]),s&2&&(l.gjSchemes=i[1]),t.$set(l)},i(i){o||(w(t.$$.fragment,i),o=!0)},o(i){k(t.$$.fragment,i),o=!1},d(i){i&&(y(e),y(n)),C(t,i)}}}function ug(r){let e,n,t,o;return t=new Fd({props:{cfg:r[0],gjSchemes:r[1]}}),{c(){e=G("h2"),e.textContent="New point",n=F(),P(t.$$.fragment)},m(i,s){$(i,e,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&1&&(l.cfg=i[0]),s&2&&(l.gjSchemes=i[1]),t.$set(l)},i(i){o||(w(t.$$.fragment,i),o=!0)},o(i){k(t.$$.fragment,i),o=!1},d(i){i&&(y(e),y(n)),C(t,i)}}}function ag(r){let e,n;return e=new Af({props:{cfg:r[0],gjSchemes:r[1],id:r[4].id}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&1&&(i.cfg=t[0]),o&2&&(i.gjSchemes=t[1]),o&16&&(i.id=t[4].id),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function fg(r){let e,n;return e=new xm({props:{cfg:r[0],gjSchemes:r[1],id:r[4].id}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&1&&(i.cfg=t[0]),o&2&&(i.gjSchemes=t[1]),o&16&&(i.id=t[4].id),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function cg(r){let e,n;return e=new $d({props:{cfg:r[0],gjSchemes:r[1]}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p(t,o){const i={};o&1&&(i.cfg=t[0]),o&2&&(i.gjSchemes=t[1]),e.$set(i)},i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function pg(r){let e;return{c(){e=q("Finish")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function mg(r){let e,n,t,o,i,s,l=r[3]&&Fo(r);const u=[cg,fg,ag,ug,lg,sg,og,ig,rg,ng],a=[];function f(c,p){return c[4].mode=="list"?0:c[4].mode=="edit-form"?1:c[4].mode=="edit-geometry"?2:c[4].mode=="new-point"?3:c[4].mode=="new-route"?4:c[4].mode=="new-freehand-polygon"?5:c[4].mode=="new-snapped-polygon"?6:c[4].mode=="split-route"?7:c[4].mode=="set-image"?8:c[4].mode=="streetview"?9:-1}return~(t=f(r))&&(o=a[t]=u[t](r)),{c(){e=G("div"),l&&l.c(),n=F(),o&&o.c(),i=fe(),Pe(e,"visibility",r[4].mode=="list"?"visible":"hidden")},m(c,p){$(c,e,p),l&&l.m(e,null),$(c,n,p),~t&&a[t].m(c,p),$(c,i,p),s=!0},p(c,[p]){c[3]?l?(l.p(c,p),p&8&&w(l,1)):(l=Fo(c),l.c(),w(l,1),l.m(e,null)):l&&(se(),k(l,1,1,()=>{l=null}),le()),p&16&&Pe(e,"visibility",c[4].mode=="list"?"visible":"hidden");let m=t;t=f(c),t===m?~t&&a[t].p(c,p):(o&&(se(),k(a[m],1,1,()=>{a[m]=null}),le()),~t?(o=a[t],o?o.p(c,p):(o=a[t]=u[t](c),o.c()),w(o,1),o.m(i.parentNode,i)):o=null)},i(c){s||(w(l),w(o),s=!0)},o(c){k(l),k(o),s=!1},d(c){c&&(y(e),y(n),y(i)),l&&l.d(),~t&&a[t].d(c)}}}function dg(r,e,n){let t,o,i,s,l;Y(r,We,p=>n(8,t=p)),Y(r,It,p=>n(5,o=p)),Y(r,nn,p=>n(6,i=p)),Y(r,qe,p=>n(3,s=p)),Y(r,oe,p=>n(4,l=p));let{cfg:u}=e,{gjSchemes:a}=e,{routeSnapperUrl:f}=e;Xe(()=>{i==null||i.tearDown(),o==null||o.tearDown(),t==null||t.tearDown()});const c=()=>oe.set({mode:"list"});return r.$$set=p=>{"cfg"in p&&n(0,u=p.cfg),"gjSchemes"in p&&n(1,a=p.gjSchemes),"routeSnapperUrl"in p&&n(2,f=p.routeSnapperUrl)},r.$$.update=()=>{r.$$.dirty&72&&s&&!i&&nn.set(new Ql(s)),r.$$.dirty&40&&s&&!o&&It.set(new Cu(s))},[u,a,f,s,l,o,i,c]}class gg extends te{constructor(e){super(),ne(this,e,dg,mg,x,{cfg:0,gjSchemes:1,routeSnapperUrl:2})}}function Ao(r){let e,n,t,o,i,s,l,u,a,f,c,p,m,g,b,v,S;return p=new Rl({props:{boundaryGeojson:r[2]}}),g=new Ze({props:{$$slots:{default:[bg]},$$scope:{ctx:r}}}),v=new bl({}),{c(){e=G("h2"),e.textContent="ATIP Scheme Sketcher",n=F(),t=G("p"),t.textContent=`App version: ${vl()}`,o=F(),i=G("div"),s=G("p"),s.textContent=`${r[12]()}`,l=F(),u=G("a"),a=q("Change area"),c=F(),P(p.$$.fragment),m=F(),P(g.$$.fragment),b=F(),P(v.$$.fragment),T(e,"class","svelte-1750ds5"),T(t,"class","svelte-1750ds5"),T(s,"class","svelte-1750ds5"),T(u,"href",f=`index.html?schema=${r[4]}`),T(u,"class","svelte-1750ds5"),Pe(i,"display","flex"),Pe(i,"justify-content","space-between"),T(i,"class","svelte-1750ds5")},m(d,_){$(d,e,_),$(d,n,_),$(d,t,_),$(d,o,_),$(d,i,_),z(i,s),z(i,l),z(i,u),z(u,a),z(i,c),L(p,i,null),$(d,m,_),L(g,d,_),$(d,b,_),L(v,d,_),S=!0},p(d,_){(!S||_&16&&f!==(f=`index.html?schema=${d[4]}`))&&T(u,"href",f);const E={};_&4&&(E.boundaryGeojson=d[2]),p.$set(E);const h={};_&262144&&(h.$$scope={dirty:_,ctx:d}),g.$set(h)},i(d){S||(w(p.$$.fragment,d),w(g.$$.fragment,d),w(v.$$.fragment,d),S=!0)},o(d){k(p.$$.fragment,d),k(g.$$.fragment,d),k(v.$$.fragment,d),S=!1},d(d){d&&(y(e),y(n),y(t),y(o),y(i),y(m),y(b)),C(p),C(g,d),C(v,d)}}}function hg(r){let e;return{c(){e=q("About")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function _g(r){let e;return{c(){e=q("Instructions")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function bg(r){let e,n,t,o;return e=new ae({props:{$$slots:{default:[hg]},$$scope:{ctx:r}}}),e.$on("click",r[10]),t=new ae({props:{$$slots:{default:[_g]},$$scope:{ctx:r}}}),t.$on("click",r[11]),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment)},m(i,s){L(e,i,s),$(i,n,s),L(t,i,s),o=!0},p(i,s){const l={};s&262144&&(l.$$scope={dirty:s,ctx:i}),e.$set(l);const u={};s&262144&&(u.$$scope={dirty:s,ctx:i}),t.$set(u)},i(i){o||(w(e.$$.fragment,i),w(t.$$.fragment,i),o=!0)},o(i){k(e.$$.fragment,i),k(t.$$.fragment,i),o=!1},d(i){i&&y(n),C(e,i),C(t,i)}}}function Ro(r){let e;return{c(){e=G("hr"),T(e,"class","svelte-1750ds5")},m(n,t){$(n,e,t)},d(n){n&&y(e)}}}function Oo(r){let e,n,t,o,i,s,l,u,a,f,c,p,m;e=new Xa({props:{cfg:xe,boundaryGeojson:r[2]}}),t=new xf({props:{cfg:xe,gjSchemes:r[7]}}),i=new qf({props:{cfg:xe}});const g=[$g,vg],b=[];function v(S,d){return S[3].mode=="list"?0:S[3].mode=="split-route"?1:-1}return~(l=v(r))&&(u=b[l]=g[l](r)),f=new ac({props:{cfg:xe}}),p=new rc({props:{cfg:xe}}),{c(){P(e.$$.fragment),n=F(),P(t.$$.fragment),o=F(),P(i.$$.fragment),s=F(),u&&u.c(),a=F(),P(f.$$.fragment),c=F(),P(p.$$.fragment)},m(S,d){L(e,S,d),$(S,n,d),L(t,S,d),$(S,o,d),L(i,S,d),$(S,s,d),~l&&b[l].m(S,d),$(S,a,d),L(f,S,d),$(S,c,d),L(p,S,d),m=!0},p(S,d){const _={};d&4&&(_.boundaryGeojson=S[2]),e.$set(_);let E=l;l=v(S),l===E?~l&&b[l].p(S,d):(u&&(se(),k(b[E],1,1,()=>{b[E]=null}),le()),~l?(u=b[l],u?u.p(S,d):(u=b[l]=g[l](S),u.c()),w(u,1),u.m(a.parentNode,a)):u=null)},i(S){m||(w(e.$$.fragment,S),w(t.$$.fragment,S),w(i.$$.fragment,S),w(u),w(f.$$.fragment,S),w(p.$$.fragment,S),m=!0)},o(S){k(e.$$.fragment,S),k(t.$$.fragment,S),k(i.$$.fragment,S),k(u),k(f.$$.fragment,S),k(p.$$.fragment,S),m=!1},d(S){S&&(y(n),y(o),y(s),y(a),y(c)),C(e,S),C(t,S),C(i,S),~l&&b[l].d(S),C(f,S),C(p,S)}}}function vg(r){let e,n;return e=new Qc({props:{cfg:xe,gjSchemes:r[7]}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p:ee,i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function $g(r){let e,n;return e=new bp({props:{cfg:xe,gjSchemes:r[7]}}),{c(){P(e.$$.fragment)},m(t,o){L(e,t,o),n=!0},p:ee,i(t){n||(w(e.$$.fragment,t),n=!0)},o(t){k(e.$$.fragment,t),n=!1},d(t){C(e,t)}}}function yg(r){let e,n,t,o;e=new Ol({props:{position:"top-right"}});let i=r[6]&&Oo(r);return{c(){P(e.$$.fragment),n=F(),i&&i.c(),t=fe()},m(s,l){L(e,s,l),$(s,n,l),i&&i.m(s,l),$(s,t,l),o=!0},p(s,l){s[6]?i?(i.p(s,l),l&64&&w(i,1)):(i=Oo(s),i.c(),w(i,1),i.m(t.parentNode,t)):i&&(se(),k(i,1,1,()=>{i=null}),le())},i(s){o||(w(e.$$.fragment,s),w(i),o=!0)},o(s){k(e.$$.fragment,s),k(i),o=!1},d(s){s&&(y(n),y(t)),C(e,s),i&&i.d(s)}}}function wg(r){let e,n,t,o,i,s,l,u,a,f,c,p,m,g,b,v,S,d,_,E=r[3].mode=="list"&&Ao(r);o=new Um({props:{cfg:xe,gjSchemes:r[7],authorityName:r[8]}}),s=new gg({props:{cfg:xe,gjSchemes:r[7],routeSnapperUrl:r[9]}});let h=r[3].mode!="list"&&Ro();a=new Al({}),p=new _l({props:{style:r[5],$$slots:{default:[yg]},$$scope:{ctx:r}}});function M(I){r[14](I)}let O={};r[0]!==void 0&&(O.open=r[0]),g=new jl({props:O}),K.push(()=>V(g,"open",M));function B(I){r[15](I)}let D={};return r[1]!==void 0&&(D.open=r[1]),S=new Xm({props:D}),K.push(()=>V(S,"open",B)),{c(){e=G("div"),n=G("div"),E&&E.c(),t=F(),P(o.$$.fragment),i=F(),P(s.$$.fragment),l=F(),h&&h.c(),u=F(),P(a.$$.fragment),f=F(),c=G("div"),P(p.$$.fragment),m=F(),P(g.$$.fragment),v=F(),P(S.$$.fragment),T(n,"class","sidebar govuk-prose svelte-1750ds5"),T(c,"class","main svelte-1750ds5"),T(e,"class","overall-layout svelte-1750ds5")},m(I,A){$(I,e,A),z(e,n),E&&E.m(n,null),z(n,t),L(o,n,null),z(n,i),L(s,n,null),z(n,l),h&&h.m(n,null),z(n,u),L(a,n,null),z(e,f),z(e,c),L(p,c,null),$(I,m,A),L(g,I,A),$(I,v,A),L(S,I,A),_=!0},p(I,[A]){I[3].mode=="list"?E?(E.p(I,A),A&8&&w(E,1)):(E=Ao(I),E.c(),w(E,1),E.m(n,t)):E&&(se(),k(E,1,1,()=>{E=null}),le()),I[3].mode!="list"?h||(h=Ro(),h.c(),h.m(n,u)):h&&(h.d(1),h=null);const R={};A&32&&(R.style=I[5]),A&262220&&(R.$$scope={dirty:A,ctx:I}),p.$set(R);const N={};!b&&A&1&&(b=!0,N.open=I[0],Q(()=>b=!1)),g.$set(N);const j={};!d&&A&2&&(d=!0,j.open=I[1],Q(()=>d=!1)),S.$set(j)},i(I){_||(w(E),w(o.$$.fragment,I),w(s.$$.fragment,I),w(a.$$.fragment,I),w(p.$$.fragment,I),w(g.$$.fragment,I),w(S.$$.fragment,I),_=!0)},o(I){k(E),k(o.$$.fragment,I),k(s.$$.fragment,I),k(a.$$.fragment,I),k(p.$$.fragment,I),k(g.$$.fragment,I),k(S.$$.fragment,I),_=!1},d(I){I&&(y(e),y(m),y(v)),E&&E.d(),C(o),C(s),h&&h.d(),C(a),C(p),C(g,I),C(S,I)}}}function kg(r,e,n){let t,o,i,s,l;Y(r,wl,h=>n(13,t=h)),Y(r,oe,h=>n(3,o=h)),Y(r,tt,h=>n(4,i=h)),Y(r,pr,h=>n(5,s=h)),Y(r,qe,h=>n(6,l=h));let u=at(Br(xe)),a=!1,f=!1,c=new URLSearchParams(window.location.search),p=c.get("authority");pr.set(c.get("style")||"streets");let m=`https://atip.uk/route-snappers/v2.6/${p}.bin.gz`;function g(){n(0,a=!a),n(1,f=!1)}function b(){n(1,f=!f),n(0,a=!1)}let v;ot(async()=>{$l(),n(2,v=await S())});async function S(){let h=await yl();return h.features=h.features.filter(M=>M.properties.full_name==p),h.features.length===0&&(window.location.href=`index.html?error=Authority name not found: ${p}`),h}function d(){let h=p.split("_");if(h.length==2){if(h[0]=="LAD")return`${h[1]} (LAD)`;if(h[0]=="TA")return`${h[1]} (Transport Authority)`}return p}function _(h){a=h,n(0,a)}function E(h){f=h,n(1,f)}return r.$$.update=()=>{r.$$.dirty&8192&&t&&qe.set(t)},[a,f,v,o,i,s,l,u,p,m,g,b,d,t,_,E]}class Sg extends te{constructor(e){super(),ne(this,e,kg,wg,x,{})}}document.body.className+=" js-enabled"+("noModule"in HTMLScriptElement.prototype?" govuk-frontend-supported":"");new Sg({target:document.getElementById("app")}); diff --git a/ss_huge_refactor_pt1/assets/nested2-07bc3e3b.js b/ss_huge_refactor_pt1/assets/nested2-b579e466.js similarity index 94% rename from ss_huge_refactor_pt1/assets/nested2-07bc3e3b.js rename to ss_huge_refactor_pt1/assets/nested2-b579e466.js index 84113cf9..0a63ba9f 100644 --- a/ss_huge_refactor_pt1/assets/nested2-07bc3e3b.js +++ b/ss_huge_refactor_pt1/assets/nested2-b579e466.js @@ -1,56 +1,56 @@ -import{S as V,i as Q,s as J,e as L,j as G,av as me,k as $,a4 as te,p,aQ as ts,b as U,c as W,f as T,h,m as b,x as xe,n as Y,t as _,o as d,q as k,O as at,T as ft,U as ut,V as ct,b1 as mn,l as w,ai as Se,a6 as ae,a7 as fe,as as et,v,J as B,a5 as Me,a8 as sn,a9 as ns,r as Z,aa as ls,ab as ss,ac as Ie,ad as rs,ae as os,b2 as ps,Y as gt,b3 as _n,b4 as ms,G as pt,aN as Xt,P as ne,H as he,a as tt,a$ as rn,a2 as mt,u as on,F as gn,w as Ve,b0 as x,b5 as pe,D as ee,C as ze,W as le,aq as re,a3 as Wt,N as is,aZ as Gt,b6 as Et,b7 as it,R as as,b8 as _s,b9 as gs,aR as ds,aS as xt,g as en,ba as hs,B as bs,L as ks,d as ws,E as vs,M as ys,y as Ss}from"./index-4a1c3090.js";import{e as dn,v as H,w as Qe,t as Cs,s as qe,j as Ls,M as Ts,h as Ze,n as ot,C as nt,a as se,x as be,R as Ms,f as $t,u as Ns,o as Ps,S as Os,B as Is,b as Rs,p as hn,g as Ds,d as bn,y as kn,c as wn,z as Bt,i as Ut,Z as As,G as Fs}from"./ZoomOutMap-2095bbd6.js";import{P as oe}from"./Popup-0181ae79.js";function qs(r){let e;return{c(){e=L("span"),G(e,"class","svelte-kzgqtg"),me(e,"background",r[0])},m(l,t){$(l,e,t)},p(l,[t]){t&1&&me(e,"background",l[0])},i:te,o:te,d(l){l&&p(e)}}}function zs(r,e,l){let{color:t}=e;return r.$$set=n=>{"color"in n&&l(0,t=n.color)},[t]}class Re extends V{constructor(e){super(),Q(this,e,zs,qs,J,{color:0})}}const Bs="/atip/ss_huge_refactor_pt1/assets/help-d011708a.svg";function js(r){let e,l;const t=r[1].default,n=at(t,r,r[4],null);return{c(){e=L("div"),n&&n.c(),G(e,"class","govuk-prose")},m(s,o){$(s,e,o),n&&n.m(e,null),l=!0},p(s,o){n&&n.p&&(!l||o&16)&&ft(n,t,s,s[4],l?ct(t,s[4],o,null):ut(s[4]),null)},i(s){l||(_(n,s),l=!0)},o(s){d(n,s),l=!1},d(s){s&&p(e),n&&n.d(s)}}}function Hs(r){let e,l,t,n,s,o,u;function a(f){r[3](f)}let i={title:"Help",$$slots:{default:[js]},$$scope:{ctx:r}};return r[0]!==void 0&&(i.open=r[0]),t=new ts({props:i}),U.push(()=>W(t,"open",a)),{c(){e=L("button"),e.innerHTML=`Help`,l=T(),h(t.$$.fragment),G(e,"class","svelte-7d9d1l")},m(f,c){$(f,e,c),$(f,l,c),b(t,f,c),s=!0,o||(u=xe(e,"click",r[2]),o=!0)},p(f,[c]){const m={};c&16&&(m.$$scope={dirty:c,ctx:f}),!n&&c&1&&(n=!0,m.open=f[0],Y(()=>n=!1)),t.$set(m)},i(f){s||(_(t.$$.fragment,f),s=!0)},o(f){d(t.$$.fragment,f),s=!1},d(f){f&&(p(e),p(l)),k(t,f),o=!1,u()}}}function Gs(r,e,l){let{$$slots:t={},$$scope:n}=e,s=!1;const o=()=>l(0,s=!0);function u(a){s=a,l(0,s)}return r.$$set=a=>{"$$scope"in a&&l(4,n=a.$$scope)},[s,t,o,u,n]}class ce extends V{constructor(e){super(),Q(this,e,Gs,Hs,J,{})}}const Es=r=>({}),vn=r=>({}),Us=r=>({}),yn=r=>({});function Ws(r){let e,l,t,n,s,o,u,a,i,f,c;const m=r[4].sidebar,g=at(m,r,r[3],yn),C=r[4].main,S=at(C,r,r[3],vn);return{c(){e=L("div"),l=L("aside"),t=L("div"),g&&g.c(),n=T(),s=L("button"),s.textContent="→",u=T(),a=L("main"),S&&S.c(),G(t,"class","sidebar-content content-container svelte-1n0etgd"),G(s,"type","button"),G(s,"class","sidebar-toggle rounded-rect svelte-1n0etgd"),G(l,"class",o=mn(r[1]?"":"collapsed")+" svelte-1n0etgd"),me(l,"--sidebarWidth",r[0]),G(a,"class","svelte-1n0etgd"),G(e,"class","overall-layout svelte-1n0etgd")},m(y,M){$(y,e,M),w(e,l),w(l,t),g&&g.m(t,null),w(l,n),w(l,s),w(e,u),w(e,a),S&&S.m(a,null),i=!0,f||(c=xe(s,"click",r[2]),f=!0)},p(y,[M]){g&&g.p&&(!i||M&8)&&ft(g,m,y,y[3],i?ct(m,y[3],M,Us):ut(y[3]),yn),(!i||M&2&&o!==(o=mn(y[1]?"":"collapsed")+" svelte-1n0etgd"))&&G(l,"class",o),(!i||M&1)&&me(l,"--sidebarWidth",y[0]),S&&S.p&&(!i||M&8)&&ft(S,C,y,y[3],i?ct(C,y[3],M,Es):ut(y[3]),vn)},i(y){i||(_(g,y),_(S,y),i=!0)},o(y){d(g,y),d(S,y),i=!1},d(y){y&&p(e),g&&g.d(y),S&&S.d(y),f=!1,c()}}}function Ys(r,e,l){let{$$slots:t={},$$scope:n}=e,{sidebarWidth:s="25rem"}=e,o=!0;function u(){l(1,o=!o)}return r.$$set=a=>{"sidebarWidth"in a&&l(0,s=a.sidebarWidth),"$$scope"in a&&l(3,n=a.$$scope)},[s,o,u,n,t]}class Js extends V{constructor(e){super(),Q(this,e,Ys,Ws,J,{sidebarWidth:0})}}function Sn(r,e,l){const t=r.slice();return t[1]=e[l][0],t[2]=e[l][1],t}function Cn(r){let e,l,t,n=r[1]+"",s,o,u;return l=new Re({props:{color:r[2]}}),{c(){e=L("li"),h(l.$$.fragment),t=T(),s=v(n),o=T()},m(a,i){$(a,e,i),b(l,e,null),w(e,t),w(e,s),w(e,o),u=!0},p(a,i){const f={};i&1&&(f.color=a[2]),l.$set(f),(!u||i&1)&&n!==(n=a[1]+"")&&B(s,n)},i(a){u||(_(l.$$.fragment,a),u=!0)},o(a){d(l.$$.fragment,a),u=!1},d(a){a&&p(e),k(l)}}}function Vs(r){let e,l,t=Se(r[0]),n=[];for(let o=0;od(n[o],1,1,()=>{n[o]=null});return{c(){e=L("ul");for(let o=0;o{"rows"in n&&l(0,t=n.rows)},[t]}class Qt extends V{constructor(e){super(),Q(this,e,Qs,Vs,J,{rows:0})}}function Ln(r){let e=r[0],l,t,n=Tn(r);return{c(){n.c(),l=Me()},m(s,o){n.m(s,o),$(s,l,o),t=!0},p(s,o){o&1&&J(e,e=s[0])?(ae(),d(n,1,1,te),fe(),n=Tn(s),n.c(),_(n,1),n.m(l.parentNode,l)):n.p(s,o)},i(s){t||(_(n),t=!0)},o(s){d(n),t=!1},d(s){s&&p(l),n.d(s)}}}function Tn(r){let e;const l=r[16].default,t=at(l,r,r[15],null);return{c(){t&&t.c()},m(n,s){t&&t.m(n,s),e=!0},p(n,s){t&&t.p&&(!e||s&32768)&&ft(t,l,n,n[15],e?ct(l,n[15],s,null):ut(n[15]),null)},i(n){e||(_(t,n),e=!0)},o(n){d(t,n),e=!1},d(n){t&&t.d(n)}}}function Zs(r){let e,l,t=r[0]&&Ln(r);return{c(){t&&t.c(),e=Me()},m(n,s){t&&t.m(n,s),$(n,e,s),l=!0},p(n,[s]){n[0]?t?(t.p(n,s),s&1&&_(t,1)):(t=Ln(n),t.c(),_(t,1),t.m(e.parentNode,e)):t&&(ae(),d(t,1,1,()=>{t=null}),fe())},i(n){l||(_(t),l=!0)},o(n){d(t),l=!1},d(n){n&&p(e),t&&t.d(n)}}}function Ks(r,e,l){let t,n,{$$slots:s={},$$scope:o}=e,{id:u=sn("raster-source")}=e,{tiles:a}=e,{tileSize:i=void 0}=e,{bounds:f=null}=e,{scheme:c=null}=e,{attribution:m=null}=e,{minzoom:g=null}=e,{maxzoom:C=null}=e,{volatile:S=null}=e;const{map:y,self:M}=ns();Z(r,y,O=>l(14,n=O)),Z(r,M,O=>l(0,t=O));let R,A=!0;return ls(()=>{t&&R&&n&&(ss(y,t,R),Ie(M,t=null,t),l(12,R=void 0))}),r.$$set=O=>{"id"in O&&l(3,u=O.id),"tiles"in O&&l(4,a=O.tiles),"tileSize"in O&&l(5,i=O.tileSize),"bounds"in O&&l(6,f=O.bounds),"scheme"in O&&l(7,c=O.scheme),"attribution"in O&&l(8,m=O.attribution),"minzoom"in O&&l(9,g=O.minzoom),"maxzoom"in O&&l(10,C=O.maxzoom),"volatile"in O&&l(11,S=O.volatile),"$$scope"in O&&l(15,o=O.$$scope)},r.$$.update=()=>{r.$$.dirty&24569&&n&&t!==u&&(Ie(M,t=u,t),rs(n,t,os({type:"raster",tiles:a,tileSize:i,bounds:f,scheme:c,attribution:m,minzoom:g,maxzoom:C,volatile:S}),O=>n&&O===t,()=>{t&&(l(12,R=n==null?void 0:n.getSource(t)),l(13,A=!0))})),r.$$.dirty&16392&&(n==null||n.on("style.load",()=>{l(12,R=n==null?void 0:n.getSource(u))})),r.$$.dirty&12304&&R&&(A?l(13,A=!1):R.setTiles(a))},[t,y,M,u,a,i,f,c,m,g,C,S,R,A,n,o,s]}class Xs extends V{constructor(e){super(),Q(this,e,Ks,Zs,J,{id:3,tiles:4,tileSize:5,bounds:6,scheme:7,attribution:8,minzoom:9,maxzoom:10,volatile:11})}}function xs(r){let e;const l=r[16].default,t=at(l,r,r[24],null);return{c(){t&&t.c()},m(n,s){t&&t.m(n,s),e=!0},p(n,s){t&&t.p&&(!e||s&16777216)&&ft(t,l,n,n[24],e?ct(l,n[24],s,null):ut(n[24]),null)},i(n){e||(_(t,n),e=!0)},o(n){d(t,n),e=!1},d(n){t&&t.d(n)}}}function er(r){let e,l,t;function n(o){r[17](o)}let s={id:r[1],type:"symbol",source:r[2],sourceLayer:r[3],beforeId:r[4],beforeLayerType:r[5],paint:r[6],layout:r[7],filter:r[8],applyToClusters:r[9],minzoom:r[10],maxzoom:r[11],hoverCursor:r[12],manageHoverState:r[13],eventsIfTopMost:r[14],interactive:r[15],$$slots:{default:[xs]},$$scope:{ctx:r}};return r[0]!==void 0&&(s.hovered=r[0]),e=new ps({props:s}),U.push(()=>W(e,"hovered",n)),e.$on("click",r[18]),e.$on("dblclick",r[19]),e.$on("contextmenu",r[20]),e.$on("mouseenter",r[21]),e.$on("mousemove",r[22]),e.$on("mouseleave",r[23]),{c(){h(e.$$.fragment)},m(o,u){b(e,o,u),t=!0},p(o,[u]){const a={};u&2&&(a.id=o[1]),u&4&&(a.source=o[2]),u&8&&(a.sourceLayer=o[3]),u&16&&(a.beforeId=o[4]),u&32&&(a.beforeLayerType=o[5]),u&64&&(a.paint=o[6]),u&128&&(a.layout=o[7]),u&256&&(a.filter=o[8]),u&512&&(a.applyToClusters=o[9]),u&1024&&(a.minzoom=o[10]),u&2048&&(a.maxzoom=o[11]),u&4096&&(a.hoverCursor=o[12]),u&8192&&(a.manageHoverState=o[13]),u&16384&&(a.eventsIfTopMost=o[14]),u&32768&&(a.interactive=o[15]),u&16777216&&(a.$$scope={dirty:u,ctx:o}),!l&&u&1&&(l=!0,a.hovered=o[0],Y(()=>l=!1)),e.$set(a)},i(o){t||(_(e.$$.fragment,o),t=!0)},o(o){d(e.$$.fragment,o),t=!1},d(o){k(e,o)}}}function tr(r,e,l){let{$$slots:t={},$$scope:n}=e,{id:s=sn("symbol")}=e,{source:o=void 0}=e,{sourceLayer:u=void 0}=e,{beforeId:a=void 0}=e,{beforeLayerType:i=void 0}=e,{paint:f=void 0}=e,{layout:c=void 0}=e,{filter:m=void 0}=e,{applyToClusters:g=void 0}=e,{minzoom:C=void 0}=e,{maxzoom:S=void 0}=e,{hoverCursor:y=void 0}=e,{manageHoverState:M=!1}=e,{hovered:R=null}=e,{eventsIfTopMost:A=!1}=e,{interactive:O=!0}=e;function N(q){R=q,l(0,R)}function I(q){gt.call(this,r,q)}function F(q){gt.call(this,r,q)}function P(q){gt.call(this,r,q)}function z(q){gt.call(this,r,q)}function X(q){gt.call(this,r,q)}function E(q){gt.call(this,r,q)}return r.$$set=q=>{"id"in q&&l(1,s=q.id),"source"in q&&l(2,o=q.source),"sourceLayer"in q&&l(3,u=q.sourceLayer),"beforeId"in q&&l(4,a=q.beforeId),"beforeLayerType"in q&&l(5,i=q.beforeLayerType),"paint"in q&&l(6,f=q.paint),"layout"in q&&l(7,c=q.layout),"filter"in q&&l(8,m=q.filter),"applyToClusters"in q&&l(9,g=q.applyToClusters),"minzoom"in q&&l(10,C=q.minzoom),"maxzoom"in q&&l(11,S=q.maxzoom),"hoverCursor"in q&&l(12,y=q.hoverCursor),"manageHoverState"in q&&l(13,M=q.manageHoverState),"hovered"in q&&l(0,R=q.hovered),"eventsIfTopMost"in q&&l(14,A=q.eventsIfTopMost),"interactive"in q&&l(15,O=q.interactive),"$$scope"in q&&l(24,n=q.$$scope)},[R,s,o,u,a,i,f,c,m,g,C,S,y,M,A,O,t,N,I,F,P,z,X,E,n]}class an extends V{constructor(e){super(),Q(this,e,tr,er,J,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}function Mn(r){let e=r[0],l,t,n=Nn(r);return{c(){n.c(),l=Me()},m(s,o){n.m(s,o),$(s,l,o),t=!0},p(s,o){o&1&&J(e,e=s[0])?(ae(),d(n,1,1,te),fe(),n=Nn(s),n.c(),_(n,1),n.m(l.parentNode,l)):n.p(s,o)},i(s){t||(_(n),t=!0)},o(s){d(n),t=!1},d(s){s&&p(l),n.d(s)}}}function Nn(r){let e;const l=r[15].default,t=at(l,r,r[14],null);return{c(){t&&t.c()},m(n,s){t&&t.m(n,s),e=!0},p(n,s){t&&t.p&&(!e||s&16384)&&ft(t,l,n,n[14],e?ct(l,n[14],s,null):ut(n[14]),null)},i(n){e||(_(t,n),e=!0)},o(n){d(t,n),e=!1},d(n){t&&t.d(n)}}}function nr(r){let e,l,t=r[0]&&Mn(r);return{c(){t&&t.c(),e=Me()},m(n,s){t&&t.m(n,s),$(n,e,s),l=!0},p(n,[s]){n[0]?t?(t.p(n,s),s&1&&_(t,1)):(t=Mn(n),t.c(),_(t,1),t.m(e.parentNode,e)):t&&(ae(),d(t,1,1,()=>{t=null}),fe())},i(n){l||(_(t),l=!0)},o(n){d(t),l=!1},d(n){n&&p(e),t&&t.d(n)}}}function lr(r,e,l){let t,n,{$$slots:s={},$$scope:o}=e,{id:u=sn("vector")}=e,{url:a=null}=e,{tiles:i=null}=e,{promoteId:f=null}=e,{bounds:c=null}=e,{scheme:m=null}=e,{attribution:g=null}=e,{minzoom:C=null}=e,{maxzoom:S=null}=e,{volatile:y=null}=e;if(a&&a.includes("pmtiles://")&&!_n.config.REGISTERED_PROTOCOLS.hasOwnProperty("pmtiles")){let O=new ms;_n.addProtocol("pmtiles",O.tile)}const{map:M,self:R}=ns();Z(r,M,O=>l(13,n=O)),Z(r,R,O=>l(0,t=O));let A;return ls(()=>{t&&n&&(ss(M,t,A),Ie(R,t=null,t),A=void 0)}),r.$$set=O=>{"id"in O&&l(3,u=O.id),"url"in O&&l(4,a=O.url),"tiles"in O&&l(5,i=O.tiles),"promoteId"in O&&l(6,f=O.promoteId),"bounds"in O&&l(7,c=O.bounds),"scheme"in O&&l(8,m=O.scheme),"attribution"in O&&l(9,g=O.attribution),"minzoom"in O&&l(10,C=O.minzoom),"maxzoom"in O&&l(11,S=O.maxzoom),"volatile"in O&&l(12,y=O.volatile),"$$scope"in O&&l(14,o=O.$$scope)},r.$$.update=()=>{r.$$.dirty&16377&&n&&t!==u&&(Ie(R,t=u,t),rs(n,t,os({type:"vector",url:a,tiles:i,promoteId:f,bounds:c,scheme:m,attribution:g,minzoom:C,maxzoom:S,volatile:y}),O=>n&&O===t,()=>{t&&(A=n==null?void 0:n.getSource(t))})),r.$$.dirty&8200&&(n==null||n.on("style.load",()=>{A=n==null?void 0:n.getSource(u)}))},[t,M,R,u,a,i,f,c,m,g,C,S,y,n,o,s]}class _e extends V{constructor(e){super(),Q(this,e,lr,nr,J,{id:3,url:4,tiles:5,promoteId:6,bounds:7,scheme:8,attribution:9,minzoom:10,maxzoom:11,volatile:12})}}function Pn(r,e,l){const t=r.slice();return t[11]=e[l],t[12]=e,t[13]=l,t}function sr(r){let e,l,t;return l=new tt({props:{$$slots:{default:[or]},$$scope:{ctx:r}}}),l.$on("click",r[9]),{c(){e=L("div"),h(l.$$.fragment)},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&16384&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function rr(r){let e,l,t,n,s,o,u,a,i,f;l=new tt({props:{$$slots:{default:[ir]},$$scope:{ctx:r}}}),l.$on("click",r[4]);let c=r[2]&&On(r);s=new qe({props:{label:"Help",$$slots:{default:[ar]},$$scope:{ctx:r}}}),u=new Ls({}),u.$on("click",r[3]);let m=Se(r[0]),g=[];for(let S=0;Sd(g[S],1,1,()=>{g[S]=null});return{c(){e=L("div"),h(l.$$.fragment),t=T(),c&&c.c(),n=T(),h(s.$$.fragment),o=T(),h(u.$$.fragment),a=T();for(let S=0;SClick +import{S as V,i as Q,s as J,e as L,j as G,av as me,k as $,a4 as te,p,aQ as ts,b as U,c as W,f as T,h,m as b,x as xe,n as Y,t as _,o as d,q as k,O as at,T as ft,U as ut,V as ct,b1 as mn,l as w,aj as Se,a6 as ae,a7 as fe,as as et,v,J as j,a5 as Me,a8 as sn,a9 as ns,r as Z,aa as ls,ab as ss,ac as Ie,ad as rs,ae as os,b2 as ps,Y as gt,b3 as _n,b4 as ms,G as pt,aN as Xt,P as ne,H as he,a as tt,a$ as rn,a2 as mt,u as on,F as gn,w as Ve,b0 as x,b5 as pe,D as ee,C as ze,W as le,aq as re,a3 as Wt,N as is,aZ as Gt,b6 as Et,b7 as it,R as as,b8 as _s,b9 as gs,aR as ds,aS as xt,g as en,ba as hs,B as bs,L as ks,d as ws,E as vs,M as ys,y as Ss}from"./index-a43921db.js";import{e as dn,v as H,w as Qe,t as Cs,s as qe,j as Ls,M as Ts,h as Ze,n as ot,C as nt,a as se,x as be,R as Ms,f as $t,u as Ns,o as Ps,S as Os,B as Is,b as Rs,p as hn,g as Ds,d as bn,y as kn,c as wn,z as jt,i as Ut,Z as As,G as Fs}from"./ZoomOutMap-cd8a62cd.js";import{P as oe}from"./Popup-8f6f85cd.js";function qs(r){let e;return{c(){e=L("span"),G(e,"class","svelte-kzgqtg"),me(e,"background",r[0])},m(l,t){$(l,e,t)},p(l,[t]){t&1&&me(e,"background",l[0])},i:te,o:te,d(l){l&&p(e)}}}function zs(r,e,l){let{color:t}=e;return r.$$set=n=>{"color"in n&&l(0,t=n.color)},[t]}class Re extends V{constructor(e){super(),Q(this,e,zs,qs,J,{color:0})}}const js="/atip/ss_huge_refactor_pt1/assets/help-d011708a.svg";function Bs(r){let e,l;const t=r[1].default,n=at(t,r,r[4],null);return{c(){e=L("div"),n&&n.c(),G(e,"class","govuk-prose")},m(s,o){$(s,e,o),n&&n.m(e,null),l=!0},p(s,o){n&&n.p&&(!l||o&16)&&ft(n,t,s,s[4],l?ct(t,s[4],o,null):ut(s[4]),null)},i(s){l||(_(n,s),l=!0)},o(s){d(n,s),l=!1},d(s){s&&p(e),n&&n.d(s)}}}function Hs(r){let e,l,t,n,s,o,u;function a(f){r[3](f)}let i={title:"Help",$$slots:{default:[Bs]},$$scope:{ctx:r}};return r[0]!==void 0&&(i.open=r[0]),t=new ts({props:i}),U.push(()=>W(t,"open",a)),{c(){e=L("button"),e.innerHTML=`Help`,l=T(),h(t.$$.fragment),G(e,"class","svelte-7d9d1l")},m(f,c){$(f,e,c),$(f,l,c),b(t,f,c),s=!0,o||(u=xe(e,"click",r[2]),o=!0)},p(f,[c]){const m={};c&16&&(m.$$scope={dirty:c,ctx:f}),!n&&c&1&&(n=!0,m.open=f[0],Y(()=>n=!1)),t.$set(m)},i(f){s||(_(t.$$.fragment,f),s=!0)},o(f){d(t.$$.fragment,f),s=!1},d(f){f&&(p(e),p(l)),k(t,f),o=!1,u()}}}function Gs(r,e,l){let{$$slots:t={},$$scope:n}=e,s=!1;const o=()=>l(0,s=!0);function u(a){s=a,l(0,s)}return r.$$set=a=>{"$$scope"in a&&l(4,n=a.$$scope)},[s,t,o,u,n]}class ce extends V{constructor(e){super(),Q(this,e,Gs,Hs,J,{})}}const Es=r=>({}),vn=r=>({}),Us=r=>({}),yn=r=>({});function Ws(r){let e,l,t,n,s,o,u,a,i,f,c;const m=r[4].sidebar,g=at(m,r,r[3],yn),C=r[4].main,S=at(C,r,r[3],vn);return{c(){e=L("div"),l=L("aside"),t=L("div"),g&&g.c(),n=T(),s=L("button"),s.textContent="→",u=T(),a=L("main"),S&&S.c(),G(t,"class","sidebar-content content-container svelte-1n0etgd"),G(s,"type","button"),G(s,"class","sidebar-toggle rounded-rect svelte-1n0etgd"),G(l,"class",o=mn(r[1]?"":"collapsed")+" svelte-1n0etgd"),me(l,"--sidebarWidth",r[0]),G(a,"class","svelte-1n0etgd"),G(e,"class","overall-layout svelte-1n0etgd")},m(y,M){$(y,e,M),w(e,l),w(l,t),g&&g.m(t,null),w(l,n),w(l,s),w(e,u),w(e,a),S&&S.m(a,null),i=!0,f||(c=xe(s,"click",r[2]),f=!0)},p(y,[M]){g&&g.p&&(!i||M&8)&&ft(g,m,y,y[3],i?ct(m,y[3],M,Us):ut(y[3]),yn),(!i||M&2&&o!==(o=mn(y[1]?"":"collapsed")+" svelte-1n0etgd"))&&G(l,"class",o),(!i||M&1)&&me(l,"--sidebarWidth",y[0]),S&&S.p&&(!i||M&8)&&ft(S,C,y,y[3],i?ct(C,y[3],M,Es):ut(y[3]),vn)},i(y){i||(_(g,y),_(S,y),i=!0)},o(y){d(g,y),d(S,y),i=!1},d(y){y&&p(e),g&&g.d(y),S&&S.d(y),f=!1,c()}}}function Ys(r,e,l){let{$$slots:t={},$$scope:n}=e,{sidebarWidth:s="25rem"}=e,o=!0;function u(){l(1,o=!o)}return r.$$set=a=>{"sidebarWidth"in a&&l(0,s=a.sidebarWidth),"$$scope"in a&&l(3,n=a.$$scope)},[s,o,u,n,t]}class Js extends V{constructor(e){super(),Q(this,e,Ys,Ws,J,{sidebarWidth:0})}}function Sn(r,e,l){const t=r.slice();return t[1]=e[l][0],t[2]=e[l][1],t}function Cn(r){let e,l,t,n=r[1]+"",s,o,u;return l=new Re({props:{color:r[2]}}),{c(){e=L("li"),h(l.$$.fragment),t=T(),s=v(n),o=T()},m(a,i){$(a,e,i),b(l,e,null),w(e,t),w(e,s),w(e,o),u=!0},p(a,i){const f={};i&1&&(f.color=a[2]),l.$set(f),(!u||i&1)&&n!==(n=a[1]+"")&&j(s,n)},i(a){u||(_(l.$$.fragment,a),u=!0)},o(a){d(l.$$.fragment,a),u=!1},d(a){a&&p(e),k(l)}}}function Vs(r){let e,l,t=Se(r[0]),n=[];for(let o=0;od(n[o],1,1,()=>{n[o]=null});return{c(){e=L("ul");for(let o=0;o{"rows"in n&&l(0,t=n.rows)},[t]}class Qt extends V{constructor(e){super(),Q(this,e,Qs,Vs,J,{rows:0})}}function Ln(r){let e=r[0],l,t,n=Tn(r);return{c(){n.c(),l=Me()},m(s,o){n.m(s,o),$(s,l,o),t=!0},p(s,o){o&1&&J(e,e=s[0])?(ae(),d(n,1,1,te),fe(),n=Tn(s),n.c(),_(n,1),n.m(l.parentNode,l)):n.p(s,o)},i(s){t||(_(n),t=!0)},o(s){d(n),t=!1},d(s){s&&p(l),n.d(s)}}}function Tn(r){let e;const l=r[16].default,t=at(l,r,r[15],null);return{c(){t&&t.c()},m(n,s){t&&t.m(n,s),e=!0},p(n,s){t&&t.p&&(!e||s&32768)&&ft(t,l,n,n[15],e?ct(l,n[15],s,null):ut(n[15]),null)},i(n){e||(_(t,n),e=!0)},o(n){d(t,n),e=!1},d(n){t&&t.d(n)}}}function Zs(r){let e,l,t=r[0]&&Ln(r);return{c(){t&&t.c(),e=Me()},m(n,s){t&&t.m(n,s),$(n,e,s),l=!0},p(n,[s]){n[0]?t?(t.p(n,s),s&1&&_(t,1)):(t=Ln(n),t.c(),_(t,1),t.m(e.parentNode,e)):t&&(ae(),d(t,1,1,()=>{t=null}),fe())},i(n){l||(_(t),l=!0)},o(n){d(t),l=!1},d(n){n&&p(e),t&&t.d(n)}}}function Ks(r,e,l){let t,n,{$$slots:s={},$$scope:o}=e,{id:u=sn("raster-source")}=e,{tiles:a}=e,{tileSize:i=void 0}=e,{bounds:f=null}=e,{scheme:c=null}=e,{attribution:m=null}=e,{minzoom:g=null}=e,{maxzoom:C=null}=e,{volatile:S=null}=e;const{map:y,self:M}=ns();Z(r,y,O=>l(14,n=O)),Z(r,M,O=>l(0,t=O));let R,A=!0;return ls(()=>{t&&R&&n&&(ss(y,t,R),Ie(M,t=null,t),l(12,R=void 0))}),r.$$set=O=>{"id"in O&&l(3,u=O.id),"tiles"in O&&l(4,a=O.tiles),"tileSize"in O&&l(5,i=O.tileSize),"bounds"in O&&l(6,f=O.bounds),"scheme"in O&&l(7,c=O.scheme),"attribution"in O&&l(8,m=O.attribution),"minzoom"in O&&l(9,g=O.minzoom),"maxzoom"in O&&l(10,C=O.maxzoom),"volatile"in O&&l(11,S=O.volatile),"$$scope"in O&&l(15,o=O.$$scope)},r.$$.update=()=>{r.$$.dirty&24569&&n&&t!==u&&(Ie(M,t=u,t),rs(n,t,os({type:"raster",tiles:a,tileSize:i,bounds:f,scheme:c,attribution:m,minzoom:g,maxzoom:C,volatile:S}),O=>n&&O===t,()=>{t&&(l(12,R=n==null?void 0:n.getSource(t)),l(13,A=!0))})),r.$$.dirty&16392&&(n==null||n.on("style.load",()=>{l(12,R=n==null?void 0:n.getSource(u))})),r.$$.dirty&12304&&R&&(A?l(13,A=!1):R.setTiles(a))},[t,y,M,u,a,i,f,c,m,g,C,S,R,A,n,o,s]}class Xs extends V{constructor(e){super(),Q(this,e,Ks,Zs,J,{id:3,tiles:4,tileSize:5,bounds:6,scheme:7,attribution:8,minzoom:9,maxzoom:10,volatile:11})}}function xs(r){let e;const l=r[16].default,t=at(l,r,r[24],null);return{c(){t&&t.c()},m(n,s){t&&t.m(n,s),e=!0},p(n,s){t&&t.p&&(!e||s&16777216)&&ft(t,l,n,n[24],e?ct(l,n[24],s,null):ut(n[24]),null)},i(n){e||(_(t,n),e=!0)},o(n){d(t,n),e=!1},d(n){t&&t.d(n)}}}function er(r){let e,l,t;function n(o){r[17](o)}let s={id:r[1],type:"symbol",source:r[2],sourceLayer:r[3],beforeId:r[4],beforeLayerType:r[5],paint:r[6],layout:r[7],filter:r[8],applyToClusters:r[9],minzoom:r[10],maxzoom:r[11],hoverCursor:r[12],manageHoverState:r[13],eventsIfTopMost:r[14],interactive:r[15],$$slots:{default:[xs]},$$scope:{ctx:r}};return r[0]!==void 0&&(s.hovered=r[0]),e=new ps({props:s}),U.push(()=>W(e,"hovered",n)),e.$on("click",r[18]),e.$on("dblclick",r[19]),e.$on("contextmenu",r[20]),e.$on("mouseenter",r[21]),e.$on("mousemove",r[22]),e.$on("mouseleave",r[23]),{c(){h(e.$$.fragment)},m(o,u){b(e,o,u),t=!0},p(o,[u]){const a={};u&2&&(a.id=o[1]),u&4&&(a.source=o[2]),u&8&&(a.sourceLayer=o[3]),u&16&&(a.beforeId=o[4]),u&32&&(a.beforeLayerType=o[5]),u&64&&(a.paint=o[6]),u&128&&(a.layout=o[7]),u&256&&(a.filter=o[8]),u&512&&(a.applyToClusters=o[9]),u&1024&&(a.minzoom=o[10]),u&2048&&(a.maxzoom=o[11]),u&4096&&(a.hoverCursor=o[12]),u&8192&&(a.manageHoverState=o[13]),u&16384&&(a.eventsIfTopMost=o[14]),u&32768&&(a.interactive=o[15]),u&16777216&&(a.$$scope={dirty:u,ctx:o}),!l&&u&1&&(l=!0,a.hovered=o[0],Y(()=>l=!1)),e.$set(a)},i(o){t||(_(e.$$.fragment,o),t=!0)},o(o){d(e.$$.fragment,o),t=!1},d(o){k(e,o)}}}function tr(r,e,l){let{$$slots:t={},$$scope:n}=e,{id:s=sn("symbol")}=e,{source:o=void 0}=e,{sourceLayer:u=void 0}=e,{beforeId:a=void 0}=e,{beforeLayerType:i=void 0}=e,{paint:f=void 0}=e,{layout:c=void 0}=e,{filter:m=void 0}=e,{applyToClusters:g=void 0}=e,{minzoom:C=void 0}=e,{maxzoom:S=void 0}=e,{hoverCursor:y=void 0}=e,{manageHoverState:M=!1}=e,{hovered:R=null}=e,{eventsIfTopMost:A=!1}=e,{interactive:O=!0}=e;function N(q){R=q,l(0,R)}function I(q){gt.call(this,r,q)}function F(q){gt.call(this,r,q)}function P(q){gt.call(this,r,q)}function z(q){gt.call(this,r,q)}function X(q){gt.call(this,r,q)}function E(q){gt.call(this,r,q)}return r.$$set=q=>{"id"in q&&l(1,s=q.id),"source"in q&&l(2,o=q.source),"sourceLayer"in q&&l(3,u=q.sourceLayer),"beforeId"in q&&l(4,a=q.beforeId),"beforeLayerType"in q&&l(5,i=q.beforeLayerType),"paint"in q&&l(6,f=q.paint),"layout"in q&&l(7,c=q.layout),"filter"in q&&l(8,m=q.filter),"applyToClusters"in q&&l(9,g=q.applyToClusters),"minzoom"in q&&l(10,C=q.minzoom),"maxzoom"in q&&l(11,S=q.maxzoom),"hoverCursor"in q&&l(12,y=q.hoverCursor),"manageHoverState"in q&&l(13,M=q.manageHoverState),"hovered"in q&&l(0,R=q.hovered),"eventsIfTopMost"in q&&l(14,A=q.eventsIfTopMost),"interactive"in q&&l(15,O=q.interactive),"$$scope"in q&&l(24,n=q.$$scope)},[R,s,o,u,a,i,f,c,m,g,C,S,y,M,A,O,t,N,I,F,P,z,X,E,n]}class an extends V{constructor(e){super(),Q(this,e,tr,er,J,{id:1,source:2,sourceLayer:3,beforeId:4,beforeLayerType:5,paint:6,layout:7,filter:8,applyToClusters:9,minzoom:10,maxzoom:11,hoverCursor:12,manageHoverState:13,hovered:0,eventsIfTopMost:14,interactive:15})}}function Mn(r){let e=r[0],l,t,n=Nn(r);return{c(){n.c(),l=Me()},m(s,o){n.m(s,o),$(s,l,o),t=!0},p(s,o){o&1&&J(e,e=s[0])?(ae(),d(n,1,1,te),fe(),n=Nn(s),n.c(),_(n,1),n.m(l.parentNode,l)):n.p(s,o)},i(s){t||(_(n),t=!0)},o(s){d(n),t=!1},d(s){s&&p(l),n.d(s)}}}function Nn(r){let e;const l=r[15].default,t=at(l,r,r[14],null);return{c(){t&&t.c()},m(n,s){t&&t.m(n,s),e=!0},p(n,s){t&&t.p&&(!e||s&16384)&&ft(t,l,n,n[14],e?ct(l,n[14],s,null):ut(n[14]),null)},i(n){e||(_(t,n),e=!0)},o(n){d(t,n),e=!1},d(n){t&&t.d(n)}}}function nr(r){let e,l,t=r[0]&&Mn(r);return{c(){t&&t.c(),e=Me()},m(n,s){t&&t.m(n,s),$(n,e,s),l=!0},p(n,[s]){n[0]?t?(t.p(n,s),s&1&&_(t,1)):(t=Mn(n),t.c(),_(t,1),t.m(e.parentNode,e)):t&&(ae(),d(t,1,1,()=>{t=null}),fe())},i(n){l||(_(t),l=!0)},o(n){d(t),l=!1},d(n){n&&p(e),t&&t.d(n)}}}function lr(r,e,l){let t,n,{$$slots:s={},$$scope:o}=e,{id:u=sn("vector")}=e,{url:a=null}=e,{tiles:i=null}=e,{promoteId:f=null}=e,{bounds:c=null}=e,{scheme:m=null}=e,{attribution:g=null}=e,{minzoom:C=null}=e,{maxzoom:S=null}=e,{volatile:y=null}=e;if(a&&a.includes("pmtiles://")&&!_n.config.REGISTERED_PROTOCOLS.hasOwnProperty("pmtiles")){let O=new ms;_n.addProtocol("pmtiles",O.tile)}const{map:M,self:R}=ns();Z(r,M,O=>l(13,n=O)),Z(r,R,O=>l(0,t=O));let A;return ls(()=>{t&&n&&(ss(M,t,A),Ie(R,t=null,t),A=void 0)}),r.$$set=O=>{"id"in O&&l(3,u=O.id),"url"in O&&l(4,a=O.url),"tiles"in O&&l(5,i=O.tiles),"promoteId"in O&&l(6,f=O.promoteId),"bounds"in O&&l(7,c=O.bounds),"scheme"in O&&l(8,m=O.scheme),"attribution"in O&&l(9,g=O.attribution),"minzoom"in O&&l(10,C=O.minzoom),"maxzoom"in O&&l(11,S=O.maxzoom),"volatile"in O&&l(12,y=O.volatile),"$$scope"in O&&l(14,o=O.$$scope)},r.$$.update=()=>{r.$$.dirty&16377&&n&&t!==u&&(Ie(R,t=u,t),rs(n,t,os({type:"vector",url:a,tiles:i,promoteId:f,bounds:c,scheme:m,attribution:g,minzoom:C,maxzoom:S,volatile:y}),O=>n&&O===t,()=>{t&&(A=n==null?void 0:n.getSource(t))})),r.$$.dirty&8200&&(n==null||n.on("style.load",()=>{A=n==null?void 0:n.getSource(u)}))},[t,M,R,u,a,i,f,c,m,g,C,S,y,n,o,s]}class _e extends V{constructor(e){super(),Q(this,e,lr,nr,J,{id:3,url:4,tiles:5,promoteId:6,bounds:7,scheme:8,attribution:9,minzoom:10,maxzoom:11,volatile:12})}}function Pn(r,e,l){const t=r.slice();return t[11]=e[l],t[12]=e,t[13]=l,t}function sr(r){let e,l,t;return l=new tt({props:{$$slots:{default:[or]},$$scope:{ctx:r}}}),l.$on("click",r[9]),{c(){e=L("div"),h(l.$$.fragment)},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&16384&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function rr(r){let e,l,t,n,s,o,u,a,i,f;l=new tt({props:{$$slots:{default:[ir]},$$scope:{ctx:r}}}),l.$on("click",r[4]);let c=r[2]&&On(r);s=new qe({props:{label:"Help",$$slots:{default:[ar]},$$scope:{ctx:r}}}),u=new Ls({}),u.$on("click",r[3]);let m=Se(r[0]),g=[];for(let S=0;Sd(g[S],1,1,()=>{g[S]=null});return{c(){e=L("div"),h(l.$$.fragment),t=T(),c&&c.c(),n=T(),h(s.$$.fragment),o=T(),h(u.$$.fragment),a=T();for(let S=0;SClick on the map to place a new waypoint
  • Click and drag an existing waypoint to move it
  • Click an existing waypoint to delete it
  • Press Escape - to exit this mode
  • `},m(l,t){$(l,e,t)},p:te,d(l){l&&p(e)}}}function fr(r){let e,l;return{c(){e=L("span"),l=T(),G(e,"class","dot svelte-1tzt432")},m(t,n){$(t,e,n),$(t,l,n)},p:te,d(t){t&&(p(e),p(l))}}}function In(r){let e,l,t;function n(u){r[7](u,r[11],r[12],r[13])}function s(){return r[8](r[13])}let o={draggable:!0,$$slots:{default:[fr]},$$scope:{ctx:r}};return r[11]!==void 0&&(o.lngLat=r[11]),e=new Ts({props:o}),U.push(()=>W(e,"lngLat",n)),e.$on("click",s),{c(){h(e.$$.fragment)},m(u,a){b(e,u,a),t=!0},p(u,a){r=u;const i={};a&16384&&(i.$$scope={dirty:a,ctx:r}),!l&&a&1&&(l=!0,i.lngLat=r[11],Y(()=>l=!1)),e.$set(i)},i(u){t||(_(e.$$.fragment,u),t=!0)},o(u){d(e.$$.fragment,u),t=!1},d(u){k(e,u)}}}function ur(r){let e,l;const t=[H("measurement-line"),{paint:{"line-color":Qe.measuringLine,"line-width":5}}];let n={};for(let s=0;s{i[g]=null}),fe(),l=i[e],l?l.p(c,m):(l=i[e]=a[e](c),l.c()),_(l,1),l.m(t.parentNode,t));const C={};m&1&&(C.data=c[0].length<2?dn():Xt(c[0])),m&16384&&(C.$$scope={dirty:m,ctx:c}),n.$set(C)},i(c){s||(_(l),_(n.$$.fragment,c),s=!0)},o(c){d(l),d(n.$$.fragment,c),s=!1},d(c){c&&p(t),i[e].d(c),k(n,c),o=!1,u()}}}function $r(r,e,l){let t,n=!1,s=[];function o(C){return C.length<2?null:1e3*Cs(Xt(C),{units:"kilometers"})}function u(C){l(0,s=[...s,C.detail.lngLat.toArray()])}function a(){l(1,n=!1),l(0,s=[])}function i(C){n&&C.key==="Escape"&&(C.stopPropagation(),a())}function f(C){s.splice(C,1),l(0,s)}function c(C,S,y,M){y[M]=C,l(0,s)}const m=C=>f(C),g=()=>l(1,n=!0);return r.$$.update=()=>{r.$$.dirty&1&&l(2,t=o(s))},[s,n,t,u,a,i,f,c,m,g]}class pr extends V{constructor(e){super(),Q(this,e,$r,cr,J,{})}}function mr(r){let e=new Map;for(let[t,n]of Object.entries(r.schemes))e.set(t,n);r.features=r.features.filter(t=>_r(t));let l=1;for(let t of r.features){let n=e.get(t.properties.scheme_reference);n.browse&&(t.properties.funding_programme=n.browse.funding_programme,t.properties.current_milestone=n.browse.current_milestone,t.id=l++)}return e}function _r(r){return!["eb0ad8ed183c137da4bae66afa944da9","0a568f07241be96f0a70aa73a0de80c8","6c4a5d57176eaeb3296eba790f869909","475e9a43749ce09c7edaaffa0ae57a2f","117b783cb2916a1bb4262960e523acc5","7a600e6342b226aa0983c8dfed19254f","84cc5eb1b52a4e49188058373e587ff0"].includes(r.properties.id)}const tn=["ATF2","ATF2 or ATF3","ATF3","ATF4","ATF4E","Planned pipeline","Other"];function gr(r){return Ze(["get","intervention_type"],{area:Qe.area,route:Qe.route,crossing:Qe.crossing,other:Qe.other},"white")}function dr(r){return[["Areas",Qe.area],["Routes",Qe.route],["Crossings",Qe.crossing],["Other",Qe.other]]}const K={education:{schools:"#007DBB",colleges:"maroon",universities:"navy"},hospitals:"#B73D25",mrn:"#781400",srn:"#006478",national_cycle_network:"#640078",sports_spaces:"#013220",parliamentary_constituencies:"#006E59",wards:"purple",combined_authorities:"cyan",local_authority_districts:"orange",local_planning_authorities:"red",bus_route_with_lane:"#9362BA",bus_route_without_lane:"#C2A6D8",trams:"black",signalized_crossing:"green",other_crossing:"black",cycle_paths:{track:"#0000FF",lane:"#009FEF",shared_use_segregated:"#FF9900",shared_use_unsegregated:"#E7E700"},sequential_low_to_high:["#CDE594","#80C6A3","#1F9EB7","#186290","#080C54"],funding_programmes:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","grey"],current_milestone:["grey","grey","red","red","#fbb862","#eddc76","#dafd9d","#76c384","#488f31"],gradient_flat_to_steep:["#267300","#70A800","#FFAA00","#E60000","#A80000","#730000"]},Ae=["interpolate",["exponential",1.6],["zoom"],3,1,7,2,18,20];function nn(){let[r,e]=fs(tn,K.funding_programmes);return[Ze(["get","funding_programme"],r,"grey"),e]}function hr(){let r=["removed","no data","not progressed","superseded","preliminary design completed","feasability design completed","detailed design completed","consruction started","construction completed"],[e,l]=fs(r,K.current_milestone);return[Ze(["get","current_milestone"],e,"grey"),l]}function fs(r,e){let l=[],t={},n=0;for(let s of r){let o=e[n++%e.length];t[s]=o,l.push([s,o])}return[t,l]}function br(r){let e,l;return e=new Qt({props:{rows:r[1]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&2&&(s.rows=t[1]),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function kr(r){let e,l,t,n,s;function o(a){r[3](a)}let u={label:"Color interventions",choices:[["fundingProgramme","By funding programme"],["interventionType","By intervention type"],["currentMilestone","By current milestone"]]};return r[0]!==void 0&&(u.value=r[0]),e=new ot({props:u}),U.push(()=>W(e,"value",o)),e.$on("change",r[2]),n=new qe({props:{label:"Legend",$$slots:{default:[br]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};!l&&i&1&&(l=!0,f.value=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&66&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}function wr(r,e,l){let t;Z(r,rn,i=>l(4,t=i));let n="fundingProgramme",[s,o]=nn();function u(){let i;n=="interventionType"?(i=gr(),l(1,o=dr())):n=="fundingProgramme"?l(1,[i,o]=nn(),o):n=="currentMilestone"&&l(1,[i,o]=hr(),o),t.setPaintProperty("interventions-points","circle-color",i),t.setPaintProperty("interventions-lines","line-color",i),t.setPaintProperty("interventions-polygons","fill-color",i),t.setPaintProperty("interventions-polygons-outlines","line-color",i)}function a(i){n=i,l(0,n)}return[n,o,u,a]}class vr extends V{constructor(e){super(),Q(this,e,wr,kr,J,{})}}const At=mt({type:"FeatureCollection",features:[],schemes:{}}),Yt=mt(new Map),Rn=mt(!0),jt=mt(""),Ht=mt("");function yr(r){let e;return{c(){e=v("Reset all filters")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Sr(r){let e;return{c(){e=v("Clear")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Cr(r){let e,l,t,n,s,o;return t=new tt({props:{$$slots:{default:[Sr]},$$scope:{ctx:r}}}),t.$on("click",r[19]),{c(){e=L("input"),l=T(),h(t.$$.fragment),G(e,"type","text"),G(e,"class","govuk-input govuk-input--width-10"),G(e,"id","filterInterventionText")},m(u,a){$(u,e,a),Ve(e,r[7]),$(u,l,a),b(t,u,a),n=!0,s||(o=xe(e,"input",r[18]),s=!0)},p(u,a){a&128&&e.value!==u[7]&&Ve(e,u[7]);const i={};a&134217728&&(i.$$scope={dirty:a,ctx:u}),t.$set(i)},i(u){n||(_(t.$$.fragment,u),n=!0)},o(u){d(t.$$.fragment,u),n=!1},d(u){u&&(p(e),p(l)),k(t,u),s=!1,o()}}}function Lr(r){let e;return{c(){e=v("Clear")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Tr(r){let e,l,t,n,s,o;return t=new tt({props:{$$slots:{default:[Lr]},$$scope:{ctx:r}}}),t.$on("click",r[21]),{c(){e=L("input"),l=T(),h(t.$$.fragment),G(e,"type","text"),G(e,"class","govuk-input govuk-input--width-10"),G(e,"id","filterSchemeText")},m(u,a){$(u,e,a),Ve(e,r[6]),$(u,l,a),b(t,u,a),n=!0,s||(o=xe(e,"input",r[20]),s=!0)},p(u,a){a&64&&e.value!==u[6]&&Ve(e,u[6]);const i={};a&134217728&&(i.$$scope={dirty:a,ctx:u}),t.$set(i)},i(u){n||(_(t.$$.fragment,u),n=!0)},o(u){d(t.$$.fragment,u),n=!1},d(u){u&&(p(e),p(l)),k(t,u),s=!1,o()}}}function Mr(r){let e,l,t,n,s,o,u,a,i,f,c,m,g,C,S,y,M,R,A,O;e=new tt({props:{$$slots:{default:[yr]},$$scope:{ctx:r}}}),e.$on("click",r[13]);function N(D){r[14](D)}let I={label:"Authority or region",choices:r[8],emptyOption:!0};r[2]!==void 0&&(I.value=r[2]),t=new ot({props:I}),U.push(()=>W(t,"value",N));function F(D){r[15](D)}let P={label:"Funding programme",choices:r[9],emptyOption:!0};r[3]!==void 0&&(P.value=r[3]),o=new ot({props:P}),U.push(()=>W(o,"value",F));function z(D){r[16](D)}let X={label:"Current milestone",choices:r[10],emptyOption:!0};r[4]!==void 0&&(X.value=r[4]),i=new ot({props:X}),U.push(()=>W(i,"value",z));function E(D){r[17](D)}let q={label:"Sketch source",choices:r[12],emptyOption:!0};return r[5]!==void 0&&(q.value=r[5]),m=new ot({props:q}),U.push(()=>W(m,"value",E)),S=new gn({props:{label:"Intervention name or description",id:"filterInterventionText",$$slots:{default:[Cr]},$$scope:{ctx:r}}}),M=new gn({props:{label:"Scheme name or reference",id:"filterSchemeText",$$slots:{default:[Tr]},$$scope:{ctx:r}}}),A=new vr({}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment),s=T(),h(o.$$.fragment),a=T(),h(i.$$.fragment),c=T(),h(m.$$.fragment),C=T(),h(S.$$.fragment),y=T(),h(M.$$.fragment),R=T(),h(A.$$.fragment)},m(D,j){b(e,D,j),$(D,l,j),b(t,D,j),$(D,s,j),b(o,D,j),$(D,a,j),b(i,D,j),$(D,c,j),b(m,D,j),$(D,C,j),b(S,D,j),$(D,y,j),b(M,D,j),$(D,R,j),b(A,D,j),O=!0},p(D,j){const $e={};j&134217728&&($e.$$scope={dirty:j,ctx:D}),e.$set($e);const Ce={};j&256&&(Ce.choices=D[8]),!n&&j&4&&(n=!0,Ce.value=D[2],Y(()=>n=!1)),t.$set(Ce);const Le={};j&512&&(Le.choices=D[9]),!u&&j&8&&(u=!0,Le.value=D[3],Y(()=>u=!1)),o.$set(Le);const ve={};j&1024&&(ve.choices=D[10]),!f&&j&16&&(f=!0,ve.value=D[4],Y(()=>f=!1)),i.$set(ve);const Ne={};!g&&j&32&&(g=!0,Ne.value=D[5],Y(()=>g=!1)),m.$set(Ne);const de={};j&134217856&&(de.$$scope={dirty:j,ctx:D}),S.$set(de);const je={};j&134217792&&(je.$$scope={dirty:j,ctx:D}),M.$set(je)},i(D){O||(_(e.$$.fragment,D),_(t.$$.fragment,D),_(o.$$.fragment,D),_(i.$$.fragment,D),_(m.$$.fragment,D),_(S.$$.fragment,D),_(M.$$.fragment,D),_(A.$$.fragment,D),O=!0)},o(D){d(e.$$.fragment,D),d(t.$$.fragment,D),d(o.$$.fragment,D),d(i.$$.fragment,D),d(m.$$.fragment,D),d(S.$$.fragment,D),d(M.$$.fragment,D),d(A.$$.fragment,D),O=!1},d(D){D&&(p(l),p(s),p(a),p(c),p(C),p(y),p(R)),k(e,D),k(t,D),k(o,D),k(i,D),k(m,D),k(S,D),k(M,D),k(A,D)}}}function Nr(r){let e,l=r[0].size.toLocaleString()+"",t,n,s=r[11].route.toLocaleString()+"",o,u,a=r[11].area.toLocaleString()+"",i,f,c=r[11].crossing.toLocaleString()+"",m,g,C=r[11].other.toLocaleString()+"",S,y,M=Dn(r[11].totalLength).toFixed(1)+"",R,A;return{c(){e=v("Showing "),t=v(l),n=v(" schemes ("),o=v(s),u=v(` + to exit this mode`},m(l,t){$(l,e,t)},p:te,d(l){l&&p(e)}}}function fr(r){let e,l;return{c(){e=L("span"),l=T(),G(e,"class","dot svelte-1tzt432")},m(t,n){$(t,e,n),$(t,l,n)},p:te,d(t){t&&(p(e),p(l))}}}function In(r){let e,l,t;function n(u){r[7](u,r[11],r[12],r[13])}function s(){return r[8](r[13])}let o={draggable:!0,$$slots:{default:[fr]},$$scope:{ctx:r}};return r[11]!==void 0&&(o.lngLat=r[11]),e=new Ts({props:o}),U.push(()=>W(e,"lngLat",n)),e.$on("click",s),{c(){h(e.$$.fragment)},m(u,a){b(e,u,a),t=!0},p(u,a){r=u;const i={};a&16384&&(i.$$scope={dirty:a,ctx:r}),!l&&a&1&&(l=!0,i.lngLat=r[11],Y(()=>l=!1)),e.$set(i)},i(u){t||(_(e.$$.fragment,u),t=!0)},o(u){d(e.$$.fragment,u),t=!1},d(u){k(e,u)}}}function ur(r){let e,l;const t=[H("measurement-line"),{paint:{"line-color":Qe.measuringLine,"line-width":5}}];let n={};for(let s=0;s{i[g]=null}),fe(),l=i[e],l?l.p(c,m):(l=i[e]=a[e](c),l.c()),_(l,1),l.m(t.parentNode,t));const C={};m&1&&(C.data=c[0].length<2?dn():Xt(c[0])),m&16384&&(C.$$scope={dirty:m,ctx:c}),n.$set(C)},i(c){s||(_(l),_(n.$$.fragment,c),s=!0)},o(c){d(l),d(n.$$.fragment,c),s=!1},d(c){c&&p(t),i[e].d(c),k(n,c),o=!1,u()}}}function $r(r,e,l){let t,n=!1,s=[];function o(C){return C.length<2?null:1e3*Cs(Xt(C),{units:"kilometers"})}function u(C){l(0,s=[...s,C.detail.lngLat.toArray()])}function a(){l(1,n=!1),l(0,s=[])}function i(C){n&&C.key==="Escape"&&(C.stopPropagation(),a())}function f(C){s.splice(C,1),l(0,s)}function c(C,S,y,M){y[M]=C,l(0,s)}const m=C=>f(C),g=()=>l(1,n=!0);return r.$$.update=()=>{r.$$.dirty&1&&l(2,t=o(s))},[s,n,t,u,a,i,f,c,m,g]}class pr extends V{constructor(e){super(),Q(this,e,$r,cr,J,{})}}function mr(r){let e=new Map;for(let[t,n]of Object.entries(r.schemes))e.set(t,n);r.features=r.features.filter(t=>_r(t));let l=1;for(let t of r.features){let n=e.get(t.properties.scheme_reference);n.browse&&(t.properties.funding_programme=n.browse.funding_programme,t.properties.current_milestone=n.browse.current_milestone,t.id=l++)}return e}function _r(r){return!["eb0ad8ed183c137da4bae66afa944da9","0a568f07241be96f0a70aa73a0de80c8","6c4a5d57176eaeb3296eba790f869909","475e9a43749ce09c7edaaffa0ae57a2f","117b783cb2916a1bb4262960e523acc5","7a600e6342b226aa0983c8dfed19254f","84cc5eb1b52a4e49188058373e587ff0"].includes(r.properties.id)}const tn=["ATF2","ATF2 or ATF3","ATF3","ATF4","ATF4E","Planned pipeline","Other"];function gr(r){return Ze(["get","intervention_type"],{area:Qe.area,route:Qe.route,crossing:Qe.crossing,other:Qe.other},"white")}function dr(r){return[["Areas",Qe.area],["Routes",Qe.route],["Crossings",Qe.crossing],["Other",Qe.other]]}const K={education:{schools:"#007DBB",colleges:"maroon",universities:"navy"},hospitals:"#B73D25",mrn:"#781400",srn:"#006478",national_cycle_network:"#640078",sports_spaces:"#013220",parliamentary_constituencies:"#006E59",wards:"purple",combined_authorities:"cyan",local_authority_districts:"orange",local_planning_authorities:"red",bus_route_with_lane:"#9362BA",bus_route_without_lane:"#C2A6D8",trams:"black",signalized_crossing:"green",other_crossing:"black",cycle_paths:{track:"#0000FF",lane:"#009FEF",shared_use_segregated:"#FF9900",shared_use_unsegregated:"#E7E700"},sequential_low_to_high:["#CDE594","#80C6A3","#1F9EB7","#186290","#080C54"],funding_programmes:["#66c2a5","#fc8d62","#8da0cb","#e78ac3","#a6d854","#ffd92f","grey"],current_milestone:["grey","grey","red","red","#fbb862","#eddc76","#dafd9d","#76c384","#488f31"],gradient_flat_to_steep:["#267300","#70A800","#FFAA00","#E60000","#A80000","#730000"]},Ae=["interpolate",["exponential",1.6],["zoom"],3,1,7,2,18,20];function nn(){let[r,e]=fs(tn,K.funding_programmes);return[Ze(["get","funding_programme"],r,"grey"),e]}function hr(){let r=["removed","no data","not progressed","superseded","preliminary design completed","feasability design completed","detailed design completed","consruction started","construction completed"],[e,l]=fs(r,K.current_milestone);return[Ze(["get","current_milestone"],e,"grey"),l]}function fs(r,e){let l=[],t={},n=0;for(let s of r){let o=e[n++%e.length];t[s]=o,l.push([s,o])}return[t,l]}function br(r){let e,l;return e=new Qt({props:{rows:r[1]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&2&&(s.rows=t[1]),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function kr(r){let e,l,t,n,s;function o(a){r[3](a)}let u={label:"Color interventions",choices:[["fundingProgramme","By funding programme"],["interventionType","By intervention type"],["currentMilestone","By current milestone"]]};return r[0]!==void 0&&(u.value=r[0]),e=new ot({props:u}),U.push(()=>W(e,"value",o)),e.$on("change",r[2]),n=new qe({props:{label:"Legend",$$slots:{default:[br]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};!l&&i&1&&(l=!0,f.value=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&66&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}function wr(r,e,l){let t;Z(r,rn,i=>l(4,t=i));let n="fundingProgramme",[s,o]=nn();function u(){let i;n=="interventionType"?(i=gr(),l(1,o=dr())):n=="fundingProgramme"?l(1,[i,o]=nn(),o):n=="currentMilestone"&&l(1,[i,o]=hr(),o),t.setPaintProperty("interventions-points","circle-color",i),t.setPaintProperty("interventions-lines","line-color",i),t.setPaintProperty("interventions-polygons","fill-color",i),t.setPaintProperty("interventions-polygons-outlines","line-color",i)}function a(i){n=i,l(0,n)}return[n,o,u,a]}class vr extends V{constructor(e){super(),Q(this,e,wr,kr,J,{})}}const At=mt({type:"FeatureCollection",features:[],schemes:{}}),Yt=mt(new Map),Rn=mt(!0),Bt=mt(""),Ht=mt("");function yr(r){let e;return{c(){e=v("Reset all filters")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Sr(r){let e;return{c(){e=v("Clear")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Cr(r){let e,l,t,n,s,o;return t=new tt({props:{$$slots:{default:[Sr]},$$scope:{ctx:r}}}),t.$on("click",r[19]),{c(){e=L("input"),l=T(),h(t.$$.fragment),G(e,"type","text"),G(e,"class","govuk-input govuk-input--width-10"),G(e,"id","filterInterventionText")},m(u,a){$(u,e,a),Ve(e,r[7]),$(u,l,a),b(t,u,a),n=!0,s||(o=xe(e,"input",r[18]),s=!0)},p(u,a){a&128&&e.value!==u[7]&&Ve(e,u[7]);const i={};a&134217728&&(i.$$scope={dirty:a,ctx:u}),t.$set(i)},i(u){n||(_(t.$$.fragment,u),n=!0)},o(u){d(t.$$.fragment,u),n=!1},d(u){u&&(p(e),p(l)),k(t,u),s=!1,o()}}}function Lr(r){let e;return{c(){e=v("Clear")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Tr(r){let e,l,t,n,s,o;return t=new tt({props:{$$slots:{default:[Lr]},$$scope:{ctx:r}}}),t.$on("click",r[21]),{c(){e=L("input"),l=T(),h(t.$$.fragment),G(e,"type","text"),G(e,"class","govuk-input govuk-input--width-10"),G(e,"id","filterSchemeText")},m(u,a){$(u,e,a),Ve(e,r[6]),$(u,l,a),b(t,u,a),n=!0,s||(o=xe(e,"input",r[20]),s=!0)},p(u,a){a&64&&e.value!==u[6]&&Ve(e,u[6]);const i={};a&134217728&&(i.$$scope={dirty:a,ctx:u}),t.$set(i)},i(u){n||(_(t.$$.fragment,u),n=!0)},o(u){d(t.$$.fragment,u),n=!1},d(u){u&&(p(e),p(l)),k(t,u),s=!1,o()}}}function Mr(r){let e,l,t,n,s,o,u,a,i,f,c,m,g,C,S,y,M,R,A,O;e=new tt({props:{$$slots:{default:[yr]},$$scope:{ctx:r}}}),e.$on("click",r[13]);function N(D){r[14](D)}let I={label:"Authority or region",choices:r[8],emptyOption:!0};r[2]!==void 0&&(I.value=r[2]),t=new ot({props:I}),U.push(()=>W(t,"value",N));function F(D){r[15](D)}let P={label:"Funding programme",choices:r[9],emptyOption:!0};r[3]!==void 0&&(P.value=r[3]),o=new ot({props:P}),U.push(()=>W(o,"value",F));function z(D){r[16](D)}let X={label:"Current milestone",choices:r[10],emptyOption:!0};r[4]!==void 0&&(X.value=r[4]),i=new ot({props:X}),U.push(()=>W(i,"value",z));function E(D){r[17](D)}let q={label:"Sketch source",choices:r[12],emptyOption:!0};return r[5]!==void 0&&(q.value=r[5]),m=new ot({props:q}),U.push(()=>W(m,"value",E)),S=new gn({props:{label:"Intervention name or description",id:"filterInterventionText",$$slots:{default:[Cr]},$$scope:{ctx:r}}}),M=new gn({props:{label:"Scheme name or reference",id:"filterSchemeText",$$slots:{default:[Tr]},$$scope:{ctx:r}}}),A=new vr({}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment),s=T(),h(o.$$.fragment),a=T(),h(i.$$.fragment),c=T(),h(m.$$.fragment),C=T(),h(S.$$.fragment),y=T(),h(M.$$.fragment),R=T(),h(A.$$.fragment)},m(D,B){b(e,D,B),$(D,l,B),b(t,D,B),$(D,s,B),b(o,D,B),$(D,a,B),b(i,D,B),$(D,c,B),b(m,D,B),$(D,C,B),b(S,D,B),$(D,y,B),b(M,D,B),$(D,R,B),b(A,D,B),O=!0},p(D,B){const $e={};B&134217728&&($e.$$scope={dirty:B,ctx:D}),e.$set($e);const Ce={};B&256&&(Ce.choices=D[8]),!n&&B&4&&(n=!0,Ce.value=D[2],Y(()=>n=!1)),t.$set(Ce);const Le={};B&512&&(Le.choices=D[9]),!u&&B&8&&(u=!0,Le.value=D[3],Y(()=>u=!1)),o.$set(Le);const ve={};B&1024&&(ve.choices=D[10]),!f&&B&16&&(f=!0,ve.value=D[4],Y(()=>f=!1)),i.$set(ve);const Ne={};!g&&B&32&&(g=!0,Ne.value=D[5],Y(()=>g=!1)),m.$set(Ne);const de={};B&134217856&&(de.$$scope={dirty:B,ctx:D}),S.$set(de);const Be={};B&134217792&&(Be.$$scope={dirty:B,ctx:D}),M.$set(Be)},i(D){O||(_(e.$$.fragment,D),_(t.$$.fragment,D),_(o.$$.fragment,D),_(i.$$.fragment,D),_(m.$$.fragment,D),_(S.$$.fragment,D),_(M.$$.fragment,D),_(A.$$.fragment,D),O=!0)},o(D){d(e.$$.fragment,D),d(t.$$.fragment,D),d(o.$$.fragment,D),d(i.$$.fragment,D),d(m.$$.fragment,D),d(S.$$.fragment,D),d(M.$$.fragment,D),d(A.$$.fragment,D),O=!1},d(D){D&&(p(l),p(s),p(a),p(c),p(C),p(y),p(R)),k(e,D),k(t,D),k(o,D),k(i,D),k(m,D),k(S,D),k(M,D),k(A,D)}}}function Nr(r){let e,l=r[0].size.toLocaleString()+"",t,n,s=r[11].route.toLocaleString()+"",o,u,a=r[11].area.toLocaleString()+"",i,f,c=r[11].crossing.toLocaleString()+"",m,g,C=r[11].other.toLocaleString()+"",S,y,M=Dn(r[11].totalLength).toFixed(1)+"",R,A;return{c(){e=v("Showing "),t=v(l),n=v(" schemes ("),o=v(s),u=v(` routes, `),i=v(a),f=v(` areas, `),m=v(c),g=v(" crossings, "),S=v(C),y=v(` - other, with total LineString length of `),R=v(M),A=v(" miles)")},m(O,N){$(O,e,N),$(O,t,N),$(O,n,N),$(O,o,N),$(O,u,N),$(O,i,N),$(O,f,N),$(O,m,N),$(O,g,N),$(O,S,N),$(O,y,N),$(O,R,N),$(O,A,N)},p(O,N){N&1&&l!==(l=O[0].size.toLocaleString()+"")&&B(t,l),N&2048&&s!==(s=O[11].route.toLocaleString()+"")&&B(o,s),N&2048&&a!==(a=O[11].area.toLocaleString()+"")&&B(i,a),N&2048&&c!==(c=O[11].crossing.toLocaleString()+"")&&B(m,c),N&2048&&C!==(C=O[11].other.toLocaleString()+"")&&B(S,C),N&2048&&M!==(M=Dn(O[11].totalLength).toFixed(1)+"")&&B(R,M)},d(O){O&&(p(e),p(t),p(n),p(o),p(u),p(i),p(f),p(m),p(g),p(S),p(y),p(R),p(A))}}}function Pr(r){let e,l,t;function n(o){r[22](o)}let s={$$slots:{default:[Nr]},$$scope:{ctx:r}};return r[1]!==void 0&&(s.checked=r[1]),e=new se({props:s}),U.push(()=>W(e,"checked",n)),{c(){h(e.$$.fragment)},m(o,u){b(e,o,u),t=!0},p(o,u){const a={};u&134219777&&(a.$$scope={dirty:u,ctx:o}),!l&&u&2&&(l=!0,a.checked=o[1],Y(()=>l=!1)),e.$set(a)},i(o){t||(_(e.$$.fragment,o),t=!0)},o(o){d(e.$$.fragment,o),t=!1},d(o){k(e,o)}}}function Or(r){let e,l,t,n;return e=new qe({props:{label:"Filters",$$slots:{default:[Mr]},$$scope:{ctx:r}}}),t=new nt({props:{small:!0,$$slots:{default:[Pr]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment)},m(s,o){b(e,s,o),$(s,l,o),b(t,s,o),n=!0},p(s,[o]){const u={};o&134219772&&(u.$$scope={dirty:o,ctx:s}),e.$set(u);const a={};o&134219779&&(a.$$scope={dirty:o,ctx:s}),t.$set(a)},i(s){n||(_(e.$$.fragment,s),_(t.$$.fragment,s),n=!0)},o(s){d(e.$$.fragment,s),d(t.$$.fragment,s),n=!1},d(s){s&&p(l),k(e,s),k(t,s)}}}function Dn(r){return r*621371e-9}function Ir(r,e,l){let t,n,s,o;Z(r,Ht,j=>l(6,t=j)),Z(r,jt,j=>l(7,n=j)),Z(r,At,j=>l(23,s=j)),Z(r,Yt,j=>l(24,o=j));let{schemesToBeShown:u=new Set}=e,{show:a=!0}=e,i=[],f="",c=[],m=new Set(tn.slice(0,-1)),g="",C=[],S="",y=[["ATF assessment","ATF assessment"],["LCWIP mapping","LCWIP mapping"],["Both","Both"]],M="",R={area:0,route:0,crossing:0,other:0,totalLength:0};on(()=>{var Le,ve,Ne;let j=new Set,$e=new Set,Ce=new Set;for(let de of o.values())(Le=de.browse)!=null&&Le.authority_or_region&&j.add(de.browse.authority_or_region),(ve=de.browse)!=null&&ve.funding_programme&&$e.add(de.browse.funding_programme),(Ne=de.browse)!=null&&Ne.current_milestone&&Ce.add(de.browse.current_milestone);l(8,i=Array.from(j.entries())),i.sort(),l(9,c=tn.map(de=>[de,de])),l(10,C=Array.from(Ce.entries())),C.sort()});function A(j,$e,Ce,Le,ve,Ne){let de=$e.toLowerCase(),je=Ce.toLowerCase(),Fe=ue=>{var ge,ye,Te,we,Ft,qt,zt;if(de&&!((ge=ue.properties.name)!=null&&ge.toLowerCase().includes(de))&&!((ye=ue.properties.description)!=null&&ye.toLowerCase().includes(de)))return!1;if(j||je||Le||ve||Ne){let He=o.get(ue.properties.scheme_reference);if(Le&&((Te=He.browse)==null?void 0:Te.authority_or_region)!=Le||ve&&ve!=="Other"&&((we=He.browse)==null?void 0:we.funding_programme)!=ve||ve==="Other"&&m.has(((Ft=He.browse)==null?void 0:Ft.funding_programme)??"")||Ne&&((qt=He.browse)==null?void 0:qt.current_milestone)!=Ne||je&&!He.scheme_reference.toLowerCase().includes(je)&&!(He.scheme_name??"").toLowerCase().includes(je)||j&&j!=="Both"&&j!==((zt=He.browse)==null?void 0:zt.sketch_source))return!1}return!0};l(0,u=new Set(s.features.filter(Fe).map(ue=>ue.properties.scheme_reference))),l(11,R={area:0,route:0,crossing:0,other:0,totalLength:0});let Pe=ue=>{var ge,ye;return!(!u.has(ue.properties.scheme_reference)||de&&!((ge=ue.properties.name)!=null&&ge.toLowerCase().includes(de))&&!((ye=ue.properties.description)!=null&&ye.toLowerCase().includes(de)))};for(let ue of s.features)Pe(ue)?(delete ue.properties.hide_while_editing,l(11,R[ue.properties.intervention_type]++,R),ue.geometry.type=="LineString"&&ue.properties.length_meters&&l(11,R.totalLength+=ue.properties.length_meters,R)):ue.properties.hide_while_editing=!0;At.set(s),l(11,R)}function O(){l(5,M=""),l(2,f=""),l(3,g=""),l(4,S=""),Ie(jt,n="",n),Ie(Ht,t="",t)}function N(j){f=j,l(2,f)}function I(j){g=j,l(3,g)}function F(j){S=j,l(4,S)}function P(j){M=j,l(5,M)}function z(){n=this.value,jt.set(n)}const X=()=>Ie(jt,n="",n);function E(){t=this.value,Ht.set(t)}const q=()=>Ie(Ht,t="",t);function D(j){a=j,l(1,a)}return r.$$set=j=>{"schemesToBeShown"in j&&l(0,u=j.schemesToBeShown),"show"in j&&l(1,a=j.show)},r.$$.update=()=>{r.$$.dirty&252&&A(M,n,t,f,g,S)},[u,a,f,g,S,M,t,n,i,c,C,R,y,O,N,I,F,P,z,X,E,q,D]}class Rr extends V{constructor(e){super(),Q(this,e,Ir,Or,J,{schemesToBeShown:0,show:1})}}function Dr(r){let e;return{c(){e=v(`Open Government License + other, with total LineString length of `),R=v(M),A=v(" miles)")},m(O,N){$(O,e,N),$(O,t,N),$(O,n,N),$(O,o,N),$(O,u,N),$(O,i,N),$(O,f,N),$(O,m,N),$(O,g,N),$(O,S,N),$(O,y,N),$(O,R,N),$(O,A,N)},p(O,N){N&1&&l!==(l=O[0].size.toLocaleString()+"")&&j(t,l),N&2048&&s!==(s=O[11].route.toLocaleString()+"")&&j(o,s),N&2048&&a!==(a=O[11].area.toLocaleString()+"")&&j(i,a),N&2048&&c!==(c=O[11].crossing.toLocaleString()+"")&&j(m,c),N&2048&&C!==(C=O[11].other.toLocaleString()+"")&&j(S,C),N&2048&&M!==(M=Dn(O[11].totalLength).toFixed(1)+"")&&j(R,M)},d(O){O&&(p(e),p(t),p(n),p(o),p(u),p(i),p(f),p(m),p(g),p(S),p(y),p(R),p(A))}}}function Pr(r){let e,l,t;function n(o){r[22](o)}let s={$$slots:{default:[Nr]},$$scope:{ctx:r}};return r[1]!==void 0&&(s.checked=r[1]),e=new se({props:s}),U.push(()=>W(e,"checked",n)),{c(){h(e.$$.fragment)},m(o,u){b(e,o,u),t=!0},p(o,u){const a={};u&134219777&&(a.$$scope={dirty:u,ctx:o}),!l&&u&2&&(l=!0,a.checked=o[1],Y(()=>l=!1)),e.$set(a)},i(o){t||(_(e.$$.fragment,o),t=!0)},o(o){d(e.$$.fragment,o),t=!1},d(o){k(e,o)}}}function Or(r){let e,l,t,n;return e=new qe({props:{label:"Filters",$$slots:{default:[Mr]},$$scope:{ctx:r}}}),t=new nt({props:{small:!0,$$slots:{default:[Pr]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment)},m(s,o){b(e,s,o),$(s,l,o),b(t,s,o),n=!0},p(s,[o]){const u={};o&134219772&&(u.$$scope={dirty:o,ctx:s}),e.$set(u);const a={};o&134219779&&(a.$$scope={dirty:o,ctx:s}),t.$set(a)},i(s){n||(_(e.$$.fragment,s),_(t.$$.fragment,s),n=!0)},o(s){d(e.$$.fragment,s),d(t.$$.fragment,s),n=!1},d(s){s&&p(l),k(e,s),k(t,s)}}}function Dn(r){return r*621371e-9}function Ir(r,e,l){let t,n,s,o;Z(r,Ht,B=>l(6,t=B)),Z(r,Bt,B=>l(7,n=B)),Z(r,At,B=>l(23,s=B)),Z(r,Yt,B=>l(24,o=B));let{schemesToBeShown:u=new Set}=e,{show:a=!0}=e,i=[],f="",c=[],m=new Set(tn.slice(0,-1)),g="",C=[],S="",y=[["ATF assessment","ATF assessment"],["LCWIP mapping","LCWIP mapping"],["Both","Both"]],M="",R={area:0,route:0,crossing:0,other:0,totalLength:0};on(()=>{var Le,ve,Ne;let B=new Set,$e=new Set,Ce=new Set;for(let de of o.values())(Le=de.browse)!=null&&Le.authority_or_region&&B.add(de.browse.authority_or_region),(ve=de.browse)!=null&&ve.funding_programme&&$e.add(de.browse.funding_programme),(Ne=de.browse)!=null&&Ne.current_milestone&&Ce.add(de.browse.current_milestone);l(8,i=Array.from(B.entries())),i.sort(),l(9,c=tn.map(de=>[de,de])),l(10,C=Array.from(Ce.entries())),C.sort()});function A(B,$e,Ce,Le,ve,Ne){let de=$e.toLowerCase(),Be=Ce.toLowerCase(),Fe=ue=>{var ge,ye,Te,we,Ft,qt,zt;if(de&&!((ge=ue.properties.name)!=null&&ge.toLowerCase().includes(de))&&!((ye=ue.properties.description)!=null&&ye.toLowerCase().includes(de)))return!1;if(B||Be||Le||ve||Ne){let He=o.get(ue.properties.scheme_reference);if(Le&&((Te=He.browse)==null?void 0:Te.authority_or_region)!=Le||ve&&ve!=="Other"&&((we=He.browse)==null?void 0:we.funding_programme)!=ve||ve==="Other"&&m.has(((Ft=He.browse)==null?void 0:Ft.funding_programme)??"")||Ne&&((qt=He.browse)==null?void 0:qt.current_milestone)!=Ne||Be&&!He.scheme_reference.toLowerCase().includes(Be)&&!(He.scheme_name??"").toLowerCase().includes(Be)||B&&B!=="Both"&&B!==((zt=He.browse)==null?void 0:zt.sketch_source))return!1}return!0};l(0,u=new Set(s.features.filter(Fe).map(ue=>ue.properties.scheme_reference))),l(11,R={area:0,route:0,crossing:0,other:0,totalLength:0});let Pe=ue=>{var ge,ye;return!(!u.has(ue.properties.scheme_reference)||de&&!((ge=ue.properties.name)!=null&&ge.toLowerCase().includes(de))&&!((ye=ue.properties.description)!=null&&ye.toLowerCase().includes(de)))};for(let ue of s.features)Pe(ue)?(delete ue.properties.hide_while_editing,l(11,R[ue.properties.intervention_type]++,R),ue.geometry.type=="LineString"&&ue.properties.length_meters&&l(11,R.totalLength+=ue.properties.length_meters,R)):ue.properties.hide_while_editing=!0;At.set(s),l(11,R)}function O(){l(5,M=""),l(2,f=""),l(3,g=""),l(4,S=""),Ie(Bt,n="",n),Ie(Ht,t="",t)}function N(B){f=B,l(2,f)}function I(B){g=B,l(3,g)}function F(B){S=B,l(4,S)}function P(B){M=B,l(5,M)}function z(){n=this.value,Bt.set(n)}const X=()=>Ie(Bt,n="",n);function E(){t=this.value,Ht.set(t)}const q=()=>Ie(Ht,t="",t);function D(B){a=B,l(1,a)}return r.$$set=B=>{"schemesToBeShown"in B&&l(0,u=B.schemesToBeShown),"show"in B&&l(1,a=B.show)},r.$$.update=()=>{r.$$.dirty&252&&A(M,n,t,f,g,S)},[u,a,f,g,S,M,t,n,i,c,C,R,y,O,N,I,F,P,z,X,E,q,D]}class Rr extends V{constructor(e){super(),Q(this,e,Ir,Or,J,{schemesToBeShown:0,show:1})}}function Dr(r){let e;return{c(){e=v(`Open Government License `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Ar(r){let e,l,t,n,s;return t=new x({props:{href:"http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/",$$slots:{default:[Dr]},$$scope:{ctx:r}}}),{c(){e=L("p"),l=v("License: "),h(t.$$.fragment),n=v(`. Contains OS data © Crown copyright and database right 2023.`)},m(o,u){$(o,e,u),w(e,l),b(t,e,null),w(e,n),s=!0},p(o,[u]){const a={};u&1&&(a.$$scope={dirty:u,ctx:o}),t.$set(a)},i(o){s||(_(t.$$.fragment,o),s=!0)},o(o){d(t.$$.fragment,o),s=!1},d(o){o&&p(e),k(t)}}}class De extends V{constructor(e){super(),Q(this,e,null,Ar,J,{})}}function An(r,e,l){const t=r.slice();return t[2]=e[l],t}function Fn(r,e,l){const t=r.slice();return t[5]=e[l],t}function qn(r){let e,l;return{c(){e=L("span"),l=v(`  - `),me(e,"background",r[5]),me(e,"width","100%"),me(e,"border","1px solid black")},m(t,n){$(t,e,n),w(e,l)},p(t,n){n&1&&me(e,"background",t[5])},d(t){t&&p(e)}}}function zn(r){let e,l=r[2]+"",t;return{c(){e=L("span"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&2&&l!==(l=n[2]+"")&&B(t,l)},d(n){n&&p(e)}}}function Fr(r){let e,l,t,n=Se(r[0]),s=[];for(let a=0;a{"colorScale"in s&&l(0,t=s.colorScale),"limits"in s&&l(1,n=s.limits)},[t,n]}class Be extends V{constructor(e){super(),Q(this,e,qr,Fr,J,{colorScale:0,limits:1})}}function ke(r){let e=new URLSearchParams(window.location.search).has(r),l=mt(e);return l.subscribe(t=>{let n=new URL(window.location.href);t?n.searchParams.set(r,"1"):n.searchParams.delete(r),window.history.replaceState(null,"",n.toString())}),l}function _t(r,e,l,t){let n=e,s=new URLSearchParams(window.location.search).get(r);if(s!=null)try{n=t(s)}catch(u){console.warn(`Parsing URL parameter ${r}=${s} failed, using default value: ${u}`)}let o=mt(n);return o.subscribe(u=>{let a=new URL(window.location.href),i=l(u);i==null?a.searchParams.delete(r):a.searchParams.set(r,i),window.history.replaceState(null,"",a.toString())}),o}function Bn(r){const e=r[14].OA21CD;r[15]=e;const l=r[14][r[3].kind];r[16]=l}function zr(r){let e;return{c(){e=v("Percent of households with a car")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Br(r){let e;return{c(){e=v(`NOMIS TS045 - `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function jr(r){let e;return{c(){e=v(`ONS Geography + `),me(e,"background",r[5]),me(e,"width","100%"),me(e,"border","1px solid black")},m(t,n){$(t,e,n),w(e,l)},p(t,n){n&1&&me(e,"background",t[5])},d(t){t&&p(e)}}}function zn(r){let e,l=r[2]+"",t;return{c(){e=L("span"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&2&&l!==(l=n[2]+"")&&j(t,l)},d(n){n&&p(e)}}}function Fr(r){let e,l,t,n=Se(r[0]),s=[];for(let a=0;a{"colorScale"in s&&l(0,t=s.colorScale),"limits"in s&&l(1,n=s.limits)},[t,n]}class je extends V{constructor(e){super(),Q(this,e,qr,Fr,J,{colorScale:0,limits:1})}}function ke(r){let e=new URLSearchParams(window.location.search).has(r),l=mt(e);return l.subscribe(t=>{let n=new URL(window.location.href);t?n.searchParams.set(r,"1"):n.searchParams.delete(r),window.history.replaceState(null,"",n.toString())}),l}function _t(r,e,l,t){let n=e,s=new URLSearchParams(window.location.search).get(r);if(s!=null)try{n=t(s)}catch(u){console.warn(`Parsing URL parameter ${r}=${s} failed, using default value: ${u}`)}let o=mt(n);return o.subscribe(u=>{let a=new URL(window.location.href),i=l(u);i==null?a.searchParams.delete(r):a.searchParams.set(r,i),window.history.replaceState(null,"",a.toString())}),o}function jn(r){const e=r[14].OA21CD;r[15]=e;const l=r[14][r[3].kind];r[16]=l}function zr(r){let e;return{c(){e=v("Percent of households with a car")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function jr(r){let e;return{c(){e=v(`NOMIS TS045 + `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Br(r){let e;return{c(){e=v(`ONS Geography `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Hr(r){let e;return{c(){e=v(`Open Government License - `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Gr(r){let e,l,t,n,s,o,u,a,i,f,c,m;return t=new x({props:{href:"https://www.nomisweb.co.uk/sources/census_2021_bulk",$$slots:{default:[Br]},$$scope:{ctx:r}}}),s=new x({props:{href:"https://geoportal.statistics.gov.uk/datasets/ons::output-areas-2021-boundaries-ew-bgc/explore",$$slots:{default:[jr]},$$scope:{ctx:r}}}),f=new x({props:{href:"http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/",$$slots:{default:[Hr]},$$scope:{ctx:r}}}),{c(){e=L("p"),l=v("Car/van availability data is from the 2021 census, via "),h(t.$$.fragment),n=v(". Output area boundaries from "),h(s.$$.fragment),o=v("."),u=T(),a=L("p"),i=v("License: "),h(f.$$.fragment),c=v(`. Contains OS data © Crown copyright and database - right 2023.`)},m(g,C){$(g,e,C),w(e,l),b(t,e,null),w(e,n),b(s,e,null),w(e,o),$(g,u,C),$(g,a,C),w(a,i),b(f,a,null),w(a,c),m=!0},p(g,C){const S={};C&131072&&(S.$$scope={dirty:C,ctx:g}),t.$set(S);const y={};C&131072&&(y.$$scope={dirty:C,ctx:g}),s.$set(y);const M={};C&131072&&(M.$$scope={dirty:C,ctx:g}),f.$set(M)},i(g){m||(_(t.$$.fragment,g),_(s.$$.fragment,g),_(f.$$.fragment,g),m=!0)},o(g){d(t.$$.fragment,g),d(s.$$.fragment,g),d(f.$$.fragment,g),m=!1},d(g){g&&(p(e),p(u),p(a)),k(t),k(s),k(f)}}}function Er(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Gr]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&131072&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function jn(r){let e,l;return e=new Be({props:{colorScale:r[4],limits:st(r[3].kind)}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&8&&(s.limits=st(t[3].kind)),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Ur(r){let e;return{c(){e=v("Average cars per household")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Wr(r){let e;return{c(){e=v(`NOMIS TS045 + `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Gr(r){let e,l,t,n,s,o,u,a,i,f,c,m;return t=new x({props:{href:"https://www.nomisweb.co.uk/sources/census_2021_bulk",$$slots:{default:[jr]},$$scope:{ctx:r}}}),s=new x({props:{href:"https://geoportal.statistics.gov.uk/datasets/ons::output-areas-2021-boundaries-ew-bgc/explore",$$slots:{default:[Br]},$$scope:{ctx:r}}}),f=new x({props:{href:"http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/",$$slots:{default:[Hr]},$$scope:{ctx:r}}}),{c(){e=L("p"),l=v("Car/van availability data is from the 2021 census, via "),h(t.$$.fragment),n=v(". Output area boundaries from "),h(s.$$.fragment),o=v("."),u=T(),a=L("p"),i=v("License: "),h(f.$$.fragment),c=v(`. Contains OS data © Crown copyright and database + right 2023.`)},m(g,C){$(g,e,C),w(e,l),b(t,e,null),w(e,n),b(s,e,null),w(e,o),$(g,u,C),$(g,a,C),w(a,i),b(f,a,null),w(a,c),m=!0},p(g,C){const S={};C&131072&&(S.$$scope={dirty:C,ctx:g}),t.$set(S);const y={};C&131072&&(y.$$scope={dirty:C,ctx:g}),s.$set(y);const M={};C&131072&&(M.$$scope={dirty:C,ctx:g}),f.$set(M)},i(g){m||(_(t.$$.fragment,g),_(s.$$.fragment,g),_(f.$$.fragment,g),m=!0)},o(g){d(t.$$.fragment,g),d(s.$$.fragment,g),d(f.$$.fragment,g),m=!1},d(g){g&&(p(e),p(u),p(a)),k(t),k(s),k(f)}}}function Er(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Gr]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&131072&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Bn(r){let e,l;return e=new je({props:{colorScale:r[4],limits:st(r[3].kind)}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&8&&(s.limits=st(t[3].kind)),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Ur(r){let e;return{c(){e=v("Average cars per household")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Wr(r){let e;return{c(){e=v(`NOMIS TS045 `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Yr(r){let e;return{c(){e=v(`ONS Geography `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Jr(r){let e;return{c(){e=v(`Open Government License `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Vr(r){let e,l,t,n,s,o,u,a,i,f,c,m,g,C;return s=new x({props:{href:"https://www.nomisweb.co.uk/sources/census_2021_bulk",$$slots:{default:[Wr]},$$scope:{ctx:r}}}),u=new x({props:{href:"https://geoportal.statistics.gov.uk/datasets/ons::output-areas-2021-boundaries-ew-bgc/explore",$$slots:{default:[Yr]},$$scope:{ctx:r}}}),m=new x({props:{href:"http://www.nationalarchives.gov.uk/doc/open-government-licence/version/3/",$$slots:{default:[Jr]},$$scope:{ctx:r}}}),{c(){e=L("p"),e.textContent=`Where the census counts "3 or more cars or vans", the average shown here assumes 3.`,l=T(),t=L("p"),n=v("Car/van availability data is from the 2021 census, via "),h(s.$$.fragment),o=v(". Output area boundaries from "),h(u.$$.fragment),a=v("."),i=T(),f=L("p"),c=v("License: "),h(m.$$.fragment),g=v(`. Contains OS data © Crown copyright and database - right 2023.`)},m(S,y){$(S,e,y),$(S,l,y),$(S,t,y),w(t,n),b(s,t,null),w(t,o),b(u,t,null),w(t,a),$(S,i,y),$(S,f,y),w(f,c),b(m,f,null),w(f,g),C=!0},p(S,y){const M={};y&131072&&(M.$$scope={dirty:y,ctx:S}),s.$set(M);const R={};y&131072&&(R.$$scope={dirty:y,ctx:S}),u.$set(R);const A={};y&131072&&(A.$$scope={dirty:y,ctx:S}),m.$set(A)},i(S){C||(_(s.$$.fragment,S),_(u.$$.fragment,S),_(m.$$.fragment,S),C=!0)},o(S){d(s.$$.fragment,S),d(u.$$.fragment,S),d(m.$$.fragment,S),C=!1},d(S){S&&(p(e),p(l),p(t),p(i),p(f)),k(s),k(u),k(m)}}}function Qr(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Vr]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&131072&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Hn(r){let e,l;return e=new Be({props:{colorScale:r[4],limits:st(r[3].kind)}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&8&&(s.limits=st(t[3].kind)),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Zr(r){let e;return{c(){e=v("Population density")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Kr(r){let e;return{c(){e=v(`NOMIS TS006 + right 2023.`)},m(S,y){$(S,e,y),$(S,l,y),$(S,t,y),w(t,n),b(s,t,null),w(t,o),b(u,t,null),w(t,a),$(S,i,y),$(S,f,y),w(f,c),b(m,f,null),w(f,g),C=!0},p(S,y){const M={};y&131072&&(M.$$scope={dirty:y,ctx:S}),s.$set(M);const R={};y&131072&&(R.$$scope={dirty:y,ctx:S}),u.$set(R);const A={};y&131072&&(A.$$scope={dirty:y,ctx:S}),m.$set(A)},i(S){C||(_(s.$$.fragment,S),_(u.$$.fragment,S),_(m.$$.fragment,S),C=!0)},o(S){d(s.$$.fragment,S),d(u.$$.fragment,S),d(m.$$.fragment,S),C=!1},d(S){S&&(p(e),p(l),p(t),p(i),p(f)),k(s),k(u),k(m)}}}function Qr(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Vr]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&131072&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Hn(r){let e,l;return e=new je({props:{colorScale:r[4],limits:st(r[3].kind)}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&8&&(s.limits=st(t[3].kind)),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Zr(r){let e;return{c(){e=v("Population density")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Kr(r){let e;return{c(){e=v(`NOMIS TS006 `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Xr(r){let e;return{c(){e=v(`ONS Geography - `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function xr(r){let e,l,t,n,s,o,u,a,i;return t=new x({props:{href:"https://www.nomisweb.co.uk/sources/census_2021_bulk",$$slots:{default:[Kr]},$$scope:{ctx:r}}}),s=new x({props:{href:"https://geoportal.statistics.gov.uk/datasets/ons::output-areas-2021-boundaries-ew-bgc/explore",$$slots:{default:[Xr]},$$scope:{ctx:r}}}),a=new De({}),{c(){e=L("p"),l=v("Population density data is from the 2021 census, via "),h(t.$$.fragment),n=v(". Output area boundaries from "),h(s.$$.fragment),o=v("."),u=T(),h(a.$$.fragment)},m(f,c){$(f,e,c),w(e,l),b(t,e,null),w(e,n),b(s,e,null),w(e,o),$(f,u,c),b(a,f,c),i=!0},p(f,c){const m={};c&131072&&(m.$$scope={dirty:c,ctx:f}),t.$set(m);const g={};c&131072&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){i||(_(t.$$.fragment,f),_(s.$$.fragment,f),_(a.$$.fragment,f),i=!0)},o(f){d(t.$$.fragment,f),d(s.$$.fragment,f),d(a.$$.fragment,f),i=!1},d(f){f&&(p(e),p(u)),k(t),k(s),k(a,f)}}}function eo(r){let e,l,t;return l=new ce({props:{$$slots:{default:[xr]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&131072&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Gn(r){let e,l,t,n;return t=new Be({props:{colorScale:r[4],limits:st(r[3].kind).map(En)}}),{c(){e=L("p"),e.textContent="(people per square kilometres)",l=T(),h(t.$$.fragment)},m(s,o){$(s,e,o),$(s,l,o),b(t,s,o),n=!0},p(s,o){const u={};o&8&&(u.limits=st(s[3].kind).map(En)),t.$set(u)},i(s){n||(_(t.$$.fragment,s),n=!0)},o(s){d(t.$$.fragment,s),n=!1},d(s){s&&(p(e),p(l)),k(t,s)}}}function to(r){let e,l,t,n=r[16].toLocaleString()+"",s,o,u=r[15]+"",a;return{c(){e=L("p"),l=v("There are "),t=L("b"),s=v(n),o=v(` - people per square kilometre in `),a=v(u)},m(i,f){$(i,e,f),w(e,l),w(e,t),w(t,s),w(e,o),w(e,a)},p(i,f){f&16392&&n!==(n=i[16].toLocaleString()+"")&&B(s,n),f&16384&&u!==(u=i[15]+"")&&B(a,u)},d(i){i&&p(e)}}}function no(r){let e,l,t=r[15]+"",n,s,o,u=r[16]+"",a,i;return{c(){e=L("p"),l=v("Households in "),n=v(t),s=v(` have an average of + `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function xr(r){let e,l,t,n,s,o,u,a,i;return t=new x({props:{href:"https://www.nomisweb.co.uk/sources/census_2021_bulk",$$slots:{default:[Kr]},$$scope:{ctx:r}}}),s=new x({props:{href:"https://geoportal.statistics.gov.uk/datasets/ons::output-areas-2021-boundaries-ew-bgc/explore",$$slots:{default:[Xr]},$$scope:{ctx:r}}}),a=new De({}),{c(){e=L("p"),l=v("Population density data is from the 2021 census, via "),h(t.$$.fragment),n=v(". Output area boundaries from "),h(s.$$.fragment),o=v("."),u=T(),h(a.$$.fragment)},m(f,c){$(f,e,c),w(e,l),b(t,e,null),w(e,n),b(s,e,null),w(e,o),$(f,u,c),b(a,f,c),i=!0},p(f,c){const m={};c&131072&&(m.$$scope={dirty:c,ctx:f}),t.$set(m);const g={};c&131072&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){i||(_(t.$$.fragment,f),_(s.$$.fragment,f),_(a.$$.fragment,f),i=!0)},o(f){d(t.$$.fragment,f),d(s.$$.fragment,f),d(a.$$.fragment,f),i=!1},d(f){f&&(p(e),p(u)),k(t),k(s),k(a,f)}}}function eo(r){let e,l,t;return l=new ce({props:{$$slots:{default:[xr]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&131072&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Gn(r){let e,l,t,n;return t=new je({props:{colorScale:r[4],limits:st(r[3].kind).map(En)}}),{c(){e=L("p"),e.textContent="(people per square kilometres)",l=T(),h(t.$$.fragment)},m(s,o){$(s,e,o),$(s,l,o),b(t,s,o),n=!0},p(s,o){const u={};o&8&&(u.limits=st(s[3].kind).map(En)),t.$set(u)},i(s){n||(_(t.$$.fragment,s),n=!0)},o(s){d(t.$$.fragment,s),n=!1},d(s){s&&(p(e),p(l)),k(t,s)}}}function to(r){let e,l,t,n=r[16].toLocaleString()+"",s,o,u=r[15]+"",a;return{c(){e=L("p"),l=v("There are "),t=L("b"),s=v(n),o=v(` + people per square kilometre in `),a=v(u)},m(i,f){$(i,e,f),w(e,l),w(e,t),w(t,s),w(e,o),w(e,a)},p(i,f){f&16392&&n!==(n=i[16].toLocaleString()+"")&&j(s,n),f&16384&&u!==(u=i[15]+"")&&j(a,u)},d(i){i&&p(e)}}}function no(r){let e,l,t=r[15]+"",n,s,o,u=r[16]+"",a,i;return{c(){e=L("p"),l=v("Households in "),n=v(t),s=v(` have an average of `),o=L("b"),a=v(u),i=v(` - cars`)},m(f,c){$(f,e,c),w(e,l),w(e,n),w(e,s),w(e,o),w(o,a),w(e,i)},p(f,c){c&16384&&t!==(t=f[15]+"")&&B(n,t),c&16392&&u!==(u=f[16]+"")&&B(a,u)},d(f){f&&p(e)}}}function lo(r){let e,l,t=r[16]+"",n,s,o,u=r[15]+"",a,i;return{c(){e=L("p"),l=L("b"),n=v(t),s=v("%"),o=v(` - of households in `),a=v(u),i=v(" have 1 or more cars")},m(f,c){$(f,e,c),w(e,l),w(l,n),w(l,s),w(e,o),w(e,a),w(e,i)},p(f,c){c&16392&&t!==(t=f[16]+"")&&B(n,t),c&16384&&u!==(u=f[15]+"")&&B(a,u)},d(f){f&&p(e)}}}function so(r){Bn(r);let e;function l(s,o){return s[3].kind=="percent_households_with_car"?lo:s[3].kind=="average_cars_per_household"?no:to}let t=l(r),n=t(r);return{c(){n.c(),e=Me()},m(s,o){n.m(s,o),$(s,e,o)},p(s,o){Bn(s),t===(t=l(s))&&n?n.p(s,o):(n.d(1),n=t(s),n&&(n.c(),n.m(e.parentNode,e)))},d(s){s&&p(e),n.d(s)}}}function ro(r){let e,l;return e=new oe({props:{$$slots:{default:[so,({props:t})=>({14:t}),({props:t})=>t?16384:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&147464&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function oo(r){let e,l,t,n;const s=[H(Ge),{sourceLayer:Ge},{paint:{"fill-color":be(["get",r[3].kind],st(r[3].kind),r[4]),"fill-opacity":ee(.5,.7)}},{layout:{visibility:r[3].kind!=""?"visible":"none"}},{eventsIfTopMost:!0},{manageHoverState:!0},{hoverCursor:"pointer"}];let o={$$slots:{default:[ro]},$$scope:{ctx:r}};for(let i=0;iW(e,"checked",S)),e.$on("change",r[8]);let M=r[3].kind=="percent_households_with_car"&&jn(r);function R(P){r[9](P)}let A={$$slots:{right:[Qr],default:[Ur]},$$scope:{ctx:r}};r[1]!==void 0&&(A.checked=r[1]),s=new se({props:A}),U.push(()=>W(s,"checked",R)),s.$on("change",r[10]);let O=r[3].kind=="average_cars_per_household"&&Hn(r);function N(P){r[11](P)}let I={$$slots:{right:[eo],default:[Zr]},$$scope:{ctx:r}};r[2]!==void 0&&(I.checked=r[2]),i=new se({props:I}),U.push(()=>W(i,"checked",N)),i.$on("change",r[12]);let F=r[3].kind=="population_density"&&Gn(r);return g=new _e({props:{url:`pmtiles://${pe()}/v1/${Ge}.pmtiles`,$$slots:{default:[oo]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),M&&M.c(),n=T(),h(s.$$.fragment),u=T(),O&&O.c(),a=T(),h(i.$$.fragment),c=T(),F&&F.c(),m=T(),h(g.$$.fragment)},m(P,z){b(e,P,z),$(P,t,z),M&&M.m(P,z),$(P,n,z),b(s,P,z),$(P,u,z),O&&O.m(P,z),$(P,a,z),b(i,P,z),$(P,c,z),F&&F.m(P,z),$(P,m,z),b(g,P,z),C=!0},p(P,[z]){const X={};z&131072&&(X.$$scope={dirty:z,ctx:P}),!l&&z&1&&(l=!0,X.checked=P[0],Y(()=>l=!1)),e.$set(X),P[3].kind=="percent_households_with_car"?M?(M.p(P,z),z&8&&_(M,1)):(M=jn(P),M.c(),_(M,1),M.m(n.parentNode,n)):M&&(ae(),d(M,1,1,()=>{M=null}),fe());const E={};z&131072&&(E.$$scope={dirty:z,ctx:P}),!o&&z&2&&(o=!0,E.checked=P[1],Y(()=>o=!1)),s.$set(E),P[3].kind=="average_cars_per_household"?O?(O.p(P,z),z&8&&_(O,1)):(O=Hn(P),O.c(),_(O,1),O.m(a.parentNode,a)):O&&(ae(),d(O,1,1,()=>{O=null}),fe());const q={};z&131072&&(q.$$scope={dirty:z,ctx:P}),!f&&z&4&&(f=!0,q.checked=P[2],Y(()=>f=!1)),i.$set(q),P[3].kind=="population_density"?F?(F.p(P,z),z&8&&_(F,1)):(F=Gn(P),F.c(),_(F,1),F.m(m.parentNode,m)):F&&(ae(),d(F,1,1,()=>{F=null}),fe());const D={};z&131080&&(D.$$scope={dirty:z,ctx:P}),g.$set(D)},i(P){C||(_(e.$$.fragment,P),_(M),_(s.$$.fragment,P),_(O),_(i.$$.fragment,P),_(F),_(g.$$.fragment,P),C=!0)},o(P){d(e.$$.fragment,P),d(M),d(s.$$.fragment,P),d(O),d(i.$$.fragment,P),d(F),d(g.$$.fragment,P),C=!1},d(P){P&&(p(t),p(n),p(u),p(a),p(c),p(m)),k(e,P),M&&M.d(P),k(s,P),O&&O.d(P),k(i,P),F&&F.d(P),k(g,P)}}}let Ge="census_output_areas";function ao(r){return r.show?r.kind:null}function fo(r){return{show:!0,kind:r}}function st(r){return r=="percent_households_with_car"?[0,20,40,60,80,100]:r=="average_cars_per_household"?[0,.5,1,1.5,2,2.5]:[0,4700,13e3,33e3,94e3,198e4]}const En=r=>r.toLocaleString();function uo(r,e,l){let t,n=K.sequential_low_to_high,o=_t(Ge,{show:!1,kind:""},ao,fo);Z(r,o,M=>l(3,t=M));let u=t.kind=="percent_households_with_car",a=t.kind=="average_cars_per_household",i=t.kind=="population_density";function f(M){let R=M.detail.features[0].properties.OA21CD;t.kind=="percent_households_with_car"||t.kind=="average_cars_per_household"?window.open(`https://www.ons.gov.uk/census/maps/choropleth/housing/number-of-cars-or-vans/number-of-cars-5a/no-cars-or-vans-in-household?oa=${R}`,"_blank"):window.open(`https://www.ons.gov.uk/census/maps/choropleth/population/population-density/population-density/persons-per-square-kilometre?oa=${R}`,"_blank")}function c(M){u=M,l(0,u)}const m=()=>{l(1,a=!1),l(2,i=!1)};function g(M){a=M,l(1,a)}const C=()=>{l(0,u=!1),l(2,i=!1)};function S(M){i=M,l(2,i)}const y=()=>{l(0,u=!1),l(1,a=!1)};return r.$$.update=()=>{r.$$.dirty&7&&(u?(Ie(o,t.show=!0,t),Ie(o,t.kind="percent_households_with_car",t)):a?(Ie(o,t.show=!0,t),Ie(o,t.kind="average_cars_per_household",t)):i?(Ie(o,t.show=!0,t),Ie(o,t.kind="population_density",t)):(Ie(o,t.show=!1,t),Ie(o,t.kind="",t)))},[u,a,i,t,n,o,f,c,m,g,C,S,y]}class co extends V{constructor(e){super(),Q(this,e,uo,io,J,{})}}function $o(r){let e,l,t;return e=new Re({props:{color:r[1]}}),{c(){h(e.$$.fragment),l=v(` + cars`)},m(f,c){$(f,e,c),w(e,l),w(e,n),w(e,s),w(e,o),w(o,a),w(e,i)},p(f,c){c&16384&&t!==(t=f[15]+"")&&j(n,t),c&16392&&u!==(u=f[16]+"")&&j(a,u)},d(f){f&&p(e)}}}function lo(r){let e,l,t=r[16]+"",n,s,o,u=r[15]+"",a,i;return{c(){e=L("p"),l=L("b"),n=v(t),s=v("%"),o=v(` + of households in `),a=v(u),i=v(" have 1 or more cars")},m(f,c){$(f,e,c),w(e,l),w(l,n),w(l,s),w(e,o),w(e,a),w(e,i)},p(f,c){c&16392&&t!==(t=f[16]+"")&&j(n,t),c&16384&&u!==(u=f[15]+"")&&j(a,u)},d(f){f&&p(e)}}}function so(r){jn(r);let e;function l(s,o){return s[3].kind=="percent_households_with_car"?lo:s[3].kind=="average_cars_per_household"?no:to}let t=l(r),n=t(r);return{c(){n.c(),e=Me()},m(s,o){n.m(s,o),$(s,e,o)},p(s,o){jn(s),t===(t=l(s))&&n?n.p(s,o):(n.d(1),n=t(s),n&&(n.c(),n.m(e.parentNode,e)))},d(s){s&&p(e),n.d(s)}}}function ro(r){let e,l;return e=new oe({props:{$$slots:{default:[so,({props:t})=>({14:t}),({props:t})=>t?16384:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&147464&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function oo(r){let e,l,t,n;const s=[H(Ge),{sourceLayer:Ge},{paint:{"fill-color":be(["get",r[3].kind],st(r[3].kind),r[4]),"fill-opacity":ee(.5,.7)}},{layout:{visibility:r[3].kind!=""?"visible":"none"}},{eventsIfTopMost:!0},{manageHoverState:!0},{hoverCursor:"pointer"}];let o={$$slots:{default:[ro]},$$scope:{ctx:r}};for(let i=0;iW(e,"checked",S)),e.$on("change",r[8]);let M=r[3].kind=="percent_households_with_car"&&Bn(r);function R(P){r[9](P)}let A={$$slots:{right:[Qr],default:[Ur]},$$scope:{ctx:r}};r[1]!==void 0&&(A.checked=r[1]),s=new se({props:A}),U.push(()=>W(s,"checked",R)),s.$on("change",r[10]);let O=r[3].kind=="average_cars_per_household"&&Hn(r);function N(P){r[11](P)}let I={$$slots:{right:[eo],default:[Zr]},$$scope:{ctx:r}};r[2]!==void 0&&(I.checked=r[2]),i=new se({props:I}),U.push(()=>W(i,"checked",N)),i.$on("change",r[12]);let F=r[3].kind=="population_density"&&Gn(r);return g=new _e({props:{url:`pmtiles://${pe()}/v1/${Ge}.pmtiles`,$$slots:{default:[oo]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),M&&M.c(),n=T(),h(s.$$.fragment),u=T(),O&&O.c(),a=T(),h(i.$$.fragment),c=T(),F&&F.c(),m=T(),h(g.$$.fragment)},m(P,z){b(e,P,z),$(P,t,z),M&&M.m(P,z),$(P,n,z),b(s,P,z),$(P,u,z),O&&O.m(P,z),$(P,a,z),b(i,P,z),$(P,c,z),F&&F.m(P,z),$(P,m,z),b(g,P,z),C=!0},p(P,[z]){const X={};z&131072&&(X.$$scope={dirty:z,ctx:P}),!l&&z&1&&(l=!0,X.checked=P[0],Y(()=>l=!1)),e.$set(X),P[3].kind=="percent_households_with_car"?M?(M.p(P,z),z&8&&_(M,1)):(M=Bn(P),M.c(),_(M,1),M.m(n.parentNode,n)):M&&(ae(),d(M,1,1,()=>{M=null}),fe());const E={};z&131072&&(E.$$scope={dirty:z,ctx:P}),!o&&z&2&&(o=!0,E.checked=P[1],Y(()=>o=!1)),s.$set(E),P[3].kind=="average_cars_per_household"?O?(O.p(P,z),z&8&&_(O,1)):(O=Hn(P),O.c(),_(O,1),O.m(a.parentNode,a)):O&&(ae(),d(O,1,1,()=>{O=null}),fe());const q={};z&131072&&(q.$$scope={dirty:z,ctx:P}),!f&&z&4&&(f=!0,q.checked=P[2],Y(()=>f=!1)),i.$set(q),P[3].kind=="population_density"?F?(F.p(P,z),z&8&&_(F,1)):(F=Gn(P),F.c(),_(F,1),F.m(m.parentNode,m)):F&&(ae(),d(F,1,1,()=>{F=null}),fe());const D={};z&131080&&(D.$$scope={dirty:z,ctx:P}),g.$set(D)},i(P){C||(_(e.$$.fragment,P),_(M),_(s.$$.fragment,P),_(O),_(i.$$.fragment,P),_(F),_(g.$$.fragment,P),C=!0)},o(P){d(e.$$.fragment,P),d(M),d(s.$$.fragment,P),d(O),d(i.$$.fragment,P),d(F),d(g.$$.fragment,P),C=!1},d(P){P&&(p(t),p(n),p(u),p(a),p(c),p(m)),k(e,P),M&&M.d(P),k(s,P),O&&O.d(P),k(i,P),F&&F.d(P),k(g,P)}}}let Ge="census_output_areas";function ao(r){return r.show?r.kind:null}function fo(r){return{show:!0,kind:r}}function st(r){return r=="percent_households_with_car"?[0,20,40,60,80,100]:r=="average_cars_per_household"?[0,.5,1,1.5,2,2.5]:[0,4700,13e3,33e3,94e3,198e4]}const En=r=>r.toLocaleString();function uo(r,e,l){let t,n=K.sequential_low_to_high,o=_t(Ge,{show:!1,kind:""},ao,fo);Z(r,o,M=>l(3,t=M));let u=t.kind=="percent_households_with_car",a=t.kind=="average_cars_per_household",i=t.kind=="population_density";function f(M){let R=M.detail.features[0].properties.OA21CD;t.kind=="percent_households_with_car"||t.kind=="average_cars_per_household"?window.open(`https://www.ons.gov.uk/census/maps/choropleth/housing/number-of-cars-or-vans/number-of-cars-5a/no-cars-or-vans-in-household?oa=${R}`,"_blank"):window.open(`https://www.ons.gov.uk/census/maps/choropleth/population/population-density/population-density/persons-per-square-kilometre?oa=${R}`,"_blank")}function c(M){u=M,l(0,u)}const m=()=>{l(1,a=!1),l(2,i=!1)};function g(M){a=M,l(1,a)}const C=()=>{l(0,u=!1),l(2,i=!1)};function S(M){i=M,l(2,i)}const y=()=>{l(0,u=!1),l(1,a=!1)};return r.$$.update=()=>{r.$$.dirty&7&&(u?(Ie(o,t.show=!0,t),Ie(o,t.kind="percent_households_with_car",t)):a?(Ie(o,t.show=!0,t),Ie(o,t.kind="average_cars_per_household",t)):i?(Ie(o,t.show=!0,t),Ie(o,t.kind="population_density",t)):(Ie(o,t.show=!1,t),Ie(o,t.kind="",t)))},[u,a,i,t,n,o,f,c,m,g,C,S,y]}class co extends V{constructor(e){super(),Q(this,e,uo,io,J,{})}}function $o(r){let e,l,t;return e=new Re({props:{color:r[1]}}),{c(){h(e.$$.fragment),l=v(` Combined authorities`)},m(n,s){b(e,n,s),$(n,l,s),t=!0},p:te,i(n){t||(_(e.$$.fragment,n),t=!0)},o(n){d(e.$$.fragment,n),t=!1},d(n){n&&p(l),k(e,n)}}}function po(r){let e;return{c(){e=v(`ONS Geography - `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function mo(r){let e,l,t,n,s,o,u;return t=new x({props:{href:"https://geoportal.statistics.gov.uk/datasets/ons::combined-authorities-december-2022-boundaries-en-buc/explore",$$slots:{default:[po]},$$scope:{ctx:r}}}),o=new De({}),{c(){e=L("p"),l=v("Data from "),h(t.$$.fragment),n=v(", as of December 2022."),s=T(),h(o.$$.fragment)},m(a,i){$(a,e,i),w(e,l),b(t,e,null),w(e,n),$(a,s,i),b(o,a,i),u=!0},p(a,i){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),t.$set(f)},i(a){u||(_(t.$$.fragment,a),_(o.$$.fragment,a),u=!0)},o(a){d(t.$$.fragment,a),d(o.$$.fragment,a),u=!1},d(a){a&&(p(e),p(s)),k(t),k(o,a)}}}function _o(r){let e,l,t;return l=new ce({props:{$$slots:{default:[mo]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&32&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function go(r){let e,l=r[4].name+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&16&&l!==(l=n[4].name+"")&&B(t,l)},d(n){n&&p(e)}}}function ho(r){let e,l;return e=new oe({props:{$$slots:{default:[go,({props:t})=>({4:t}),({props:t})=>t?16:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&48&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function bo(r){let e,l,t,n;const s=[H(dt),{paint:{"fill-color":r[1],"fill-opacity":ee(0,.5)}},{layout:{visibility:r[0]?"visible":"none"}},{manageHoverState:!0},{eventsIfTopMost:!0},{hoverCursor:"pointer"}];let o={$$slots:{default:[ho]},$$scope:{ctx:r}};for(let i=0;iW(e,"checked",o)),n=new pt({props:{data:`${pe()}/v1/${dt}.geojson`,$$slots:{default:[bo]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),!l&&i&1&&(l=!0,f.checked=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&33&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}let dt="combined_authorities";function wo(r){window.open(`https://www.ons.gov.uk/visualisations/areas/${r.detail.features[0].properties.CAUTH22CD}`,"_blank")}function vo(r,e,l){let t,n=K.combined_authorities,s=ke(dt);Z(r,s,u=>l(0,t=u));function o(u){t=u,s.set(t)}return[t,n,s,o]}class yo extends V{constructor(e){super(),Q(this,e,vo,ko,J,{})}}function So(r){let e;return{c(){e=v("Indices of Multiple Deprivation")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Co(r){let e;return{c(){e=v(`DLUCH GIS + `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function mo(r){let e,l,t,n,s,o,u;return t=new x({props:{href:"https://geoportal.statistics.gov.uk/datasets/ons::combined-authorities-december-2022-boundaries-en-buc/explore",$$slots:{default:[po]},$$scope:{ctx:r}}}),o=new De({}),{c(){e=L("p"),l=v("Data from "),h(t.$$.fragment),n=v(", as of December 2022."),s=T(),h(o.$$.fragment)},m(a,i){$(a,e,i),w(e,l),b(t,e,null),w(e,n),$(a,s,i),b(o,a,i),u=!0},p(a,i){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),t.$set(f)},i(a){u||(_(t.$$.fragment,a),_(o.$$.fragment,a),u=!0)},o(a){d(t.$$.fragment,a),d(o.$$.fragment,a),u=!1},d(a){a&&(p(e),p(s)),k(t),k(o,a)}}}function _o(r){let e,l,t;return l=new ce({props:{$$slots:{default:[mo]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&32&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function go(r){let e,l=r[4].name+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&16&&l!==(l=n[4].name+"")&&j(t,l)},d(n){n&&p(e)}}}function ho(r){let e,l;return e=new oe({props:{$$slots:{default:[go,({props:t})=>({4:t}),({props:t})=>t?16:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&48&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function bo(r){let e,l,t,n;const s=[H(dt),{paint:{"fill-color":r[1],"fill-opacity":ee(0,.5)}},{layout:{visibility:r[0]?"visible":"none"}},{manageHoverState:!0},{eventsIfTopMost:!0},{hoverCursor:"pointer"}];let o={$$slots:{default:[ho]},$$scope:{ctx:r}};for(let i=0;iW(e,"checked",o)),n=new pt({props:{data:`${pe()}/v1/${dt}.geojson`,$$slots:{default:[bo]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),!l&&i&1&&(l=!0,f.checked=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&33&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}let dt="combined_authorities";function wo(r){window.open(`https://www.ons.gov.uk/visualisations/areas/${r.detail.features[0].properties.CAUTH22CD}`,"_blank")}function vo(r,e,l){let t,n=K.combined_authorities,s=ke(dt);Z(r,s,u=>l(0,t=u));function o(u){t=u,s.set(t)}return[t,n,s,o]}class yo extends V{constructor(e){super(),Q(this,e,vo,ko,J,{})}}function So(r){let e;return{c(){e=v("Indices of Multiple Deprivation")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Co(r){let e;return{c(){e=v(`DLUCH GIS `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Lo(r){let e;return{c(){e=v(`here `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function To(r){let e,l,t,n,s,o,u,a,i;return t=new x({props:{href:"https://data-communities.opendata.arcgis.com/datasets/communities::indices-of-multiple-deprivation-imd-2019-1/explore",$$slots:{default:[Co]},$$scope:{ctx:r}}}),s=new x({props:{href:"http://dclgapps.communities.gov.uk/imd/iod_index.html",$$slots:{default:[Lo]},$$scope:{ctx:r}}}),a=new De({}),{c(){e=L("p"),l=v("The 2019 English IMD scores come from "),h(t.$$.fragment),n=v(`. Note the LSOAs identified are from the 2011 census. A - detailed breakdown of the score across different categories can be found `),h(s.$$.fragment),o=v("."),u=T(),h(a.$$.fragment)},m(f,c){$(f,e,c),w(e,l),b(t,e,null),w(e,n),b(s,e,null),w(e,o),$(f,u,c),b(a,f,c),i=!0},p(f,c){const m={};c&64&&(m.$$scope={dirty:c,ctx:f}),t.$set(m);const g={};c&64&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){i||(_(t.$$.fragment,f),_(s.$$.fragment,f),_(a.$$.fragment,f),i=!0)},o(f){d(t.$$.fragment,f),d(s.$$.fragment,f),d(a.$$.fragment,f),i=!1},d(f){f&&(p(e),p(u)),k(t),k(s),k(a,f)}}}function Mo(r){let e,l,t;return l=new ce({props:{$$slots:{default:[To]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&64&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Un(r){let e,l;return e=new Be({props:{colorScale:r[1],limits:["Least deprived","Most deprived"]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p:te,i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function No(r){let e,l=r[5].LSOA11CD+"",t,n,s,o=r[5].score+"",u,a,i,f,c,m=r[5].rank.toLocaleString()+"",g,C;return{c(){e=L("p"),t=v(l),n=v(` has an IMD score of + detailed breakdown of the score across different categories can be found `),h(s.$$.fragment),o=v("."),u=T(),h(a.$$.fragment)},m(f,c){$(f,e,c),w(e,l),b(t,e,null),w(e,n),b(s,e,null),w(e,o),$(f,u,c),b(a,f,c),i=!0},p(f,c){const m={};c&64&&(m.$$scope={dirty:c,ctx:f}),t.$set(m);const g={};c&64&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){i||(_(t.$$.fragment,f),_(s.$$.fragment,f),_(a.$$.fragment,f),i=!0)},o(f){d(t.$$.fragment,f),d(s.$$.fragment,f),d(a.$$.fragment,f),i=!1},d(f){f&&(p(e),p(u)),k(t),k(s),k(a,f)}}}function Mo(r){let e,l,t;return l=new ce({props:{$$slots:{default:[To]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&64&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Un(r){let e,l;return e=new je({props:{colorScale:r[1],limits:["Least deprived","Most deprived"]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p:te,i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function No(r){let e,l=r[5].LSOA11CD+"",t,n,s,o=r[5].score+"",u,a,i,f,c,m=r[5].rank.toLocaleString()+"",g,C;return{c(){e=L("p"),t=v(l),n=v(` has an IMD score of `),s=L("b"),u=v(o),a=T(),i=L("p"),f=v("Rank: "),c=L("b"),g=v(m),C=v(` - / 32,844 LSOAs`)},m(S,y){$(S,e,y),w(e,t),w(e,n),w(e,s),w(s,u),$(S,a,y),$(S,i,y),w(i,f),w(i,c),w(c,g),w(i,C)},p(S,y){y&32&&l!==(l=S[5].LSOA11CD+"")&&B(t,l),y&32&&o!==(o=S[5].score+"")&&B(u,o),y&32&&m!==(m=S[5].rank.toLocaleString()+"")&&B(g,m)},d(S){S&&(p(e),p(a),p(i))}}}function Po(r){let e,l;return e=new oe({props:{$$slots:{default:[No,({props:t})=>({5:t}),({props:t})=>t?32:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&96&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Oo(r){let e,l,t,n;const s=[H(Ee),{sourceLayer:Ee},{paint:{"fill-color":be(["-",10,["get","decile"]],r[2],r[1]),"fill-opacity":ee(.5,.7)}},{layout:{visibility:r[0]?"visible":"none"}},{manageHoverState:!0},{eventsIfTopMost:!0}];let o={$$slots:{default:[Po]},$$scope:{ctx:r}};for(let i=0;iW(e,"checked",u));let i=r[0]&&Un(r);return s=new _e({props:{url:`pmtiles://${pe()}/v1/${Ee}.pmtiles`,$$slots:{default:[Oo]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&64&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0],Y(()=>l=!1)),e.$set(m),f[0]?i?(i.p(f,c),c&1&&_(i,1)):(i=Un(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&65&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let Ee="imd";function Ro(r,e,l){let t,n=K.sequential_low_to_high,s=[0,2,4,6,8,10],o=ke(Ee);Z(r,o,a=>l(0,t=a));function u(a){t=a,o.set(t)}return[t,n,s,o,u]}class Do extends V{constructor(e){super(),Q(this,e,Ro,Io,J,{})}}function Ao(r){let e,l,t;return e=new Re({props:{color:r[1]}}),{c(){h(e.$$.fragment),l=v(` + / 32,844 LSOAs`)},m(S,y){$(S,e,y),w(e,t),w(e,n),w(e,s),w(s,u),$(S,a,y),$(S,i,y),w(i,f),w(i,c),w(c,g),w(i,C)},p(S,y){y&32&&l!==(l=S[5].LSOA11CD+"")&&j(t,l),y&32&&o!==(o=S[5].score+"")&&j(u,o),y&32&&m!==(m=S[5].rank.toLocaleString()+"")&&j(g,m)},d(S){S&&(p(e),p(a),p(i))}}}function Po(r){let e,l;return e=new oe({props:{$$slots:{default:[No,({props:t})=>({5:t}),({props:t})=>t?32:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&96&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Oo(r){let e,l,t,n;const s=[H(Ee),{sourceLayer:Ee},{paint:{"fill-color":be(["-",10,["get","decile"]],r[2],r[1]),"fill-opacity":ee(.5,.7)}},{layout:{visibility:r[0]?"visible":"none"}},{manageHoverState:!0},{eventsIfTopMost:!0}];let o={$$slots:{default:[Po]},$$scope:{ctx:r}};for(let i=0;iW(e,"checked",u));let i=r[0]&&Un(r);return s=new _e({props:{url:`pmtiles://${pe()}/v1/${Ee}.pmtiles`,$$slots:{default:[Oo]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&64&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0],Y(()=>l=!1)),e.$set(m),f[0]?i?(i.p(f,c),c&1&&_(i,1)):(i=Un(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&65&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let Ee="imd";function Ro(r,e,l){let t,n=K.sequential_low_to_high,s=[0,2,4,6,8,10],o=ke(Ee);Z(r,o,a=>l(0,t=a));function u(a){t=a,o.set(t)}return[t,n,s,o,u]}class Do extends V{constructor(e){super(),Q(this,e,Ro,Io,J,{})}}function Ao(r){let e,l,t;return e=new Re({props:{color:r[1]}}),{c(){h(e.$$.fragment),l=v(` Local Authority Districts`)},m(n,s){b(e,n,s),$(n,l,s),t=!0},p:te,i(n){t||(_(e.$$.fragment,n),t=!0)},o(n){d(e.$$.fragment,n),t=!1},d(n){n&&p(l),k(e,n)}}}function Fo(r){let e;return{c(){e=v(`ONS Geography - `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function qo(r){let e,l,t,n,s,o,u;return t=new x({props:{href:"https://geoportal.statistics.gov.uk/maps/79a4e87783be4b6bbb96ddad6dda52a3",$$slots:{default:[Fo]},$$scope:{ctx:r}}}),o=new De({}),{c(){e=L("p"),l=v("Data from "),h(t.$$.fragment),n=v(", as of January 2024."),s=T(),h(o.$$.fragment)},m(a,i){$(a,e,i),w(e,l),b(t,e,null),w(e,n),$(a,s,i),b(o,a,i),u=!0},p(a,i){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),t.$set(f)},i(a){u||(_(t.$$.fragment,a),_(o.$$.fragment,a),u=!0)},o(a){d(t.$$.fragment,a),d(o.$$.fragment,a),u=!1},d(a){a&&(p(e),p(s)),k(t),k(o,a)}}}function zo(r){let e,l,t;return l=new ce({props:{$$slots:{default:[qo]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&32&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Bo(r){let e,l=r[4].name+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&16&&l!==(l=n[4].name+"")&&B(t,l)},d(n){n&&p(e)}}}function jo(r){let e,l;return e=new oe({props:{$$slots:{default:[Bo,({props:t})=>({4:t}),({props:t})=>t?16:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&48&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Ho(r){let e,l,t,n;const s=[H(ht),{paint:{"fill-color":r[1],"fill-opacity":ee(0,.5)}},{layout:{visibility:r[0]?"visible":"none"}},{manageHoverState:!0},{eventsIfTopMost:!0},{hoverCursor:"pointer"}];let o={$$slots:{default:[jo]},$$scope:{ctx:r}};for(let i=0;iW(e,"checked",o)),n=new pt({props:{data:`${pe()}/v1/${ht}.geojson`,$$slots:{default:[Ho]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),!l&&i&1&&(l=!0,f.checked=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&33&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}let ht="local_authority_districts";function Eo(r){window.open(`https://www.ons.gov.uk/visualisations/areas/${r.detail.features[0].properties.LAD23CD}`,"_blank")}function Uo(r,e,l){let t,n=K.local_authority_districts,s=ke(ht);Z(r,s,u=>l(0,t=u));function o(u){t=u,s.set(t)}return[t,n,s,o]}class Wo extends V{constructor(e){super(),Q(this,e,Uo,Go,J,{})}}function Yo(r){let e,l,t;return e=new Re({props:{color:r[1]}}),{c(){h(e.$$.fragment),l=v(` + `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function qo(r){let e,l,t,n,s,o,u;return t=new x({props:{href:"https://geoportal.statistics.gov.uk/maps/79a4e87783be4b6bbb96ddad6dda52a3",$$slots:{default:[Fo]},$$scope:{ctx:r}}}),o=new De({}),{c(){e=L("p"),l=v("Data from "),h(t.$$.fragment),n=v(", as of January 2024."),s=T(),h(o.$$.fragment)},m(a,i){$(a,e,i),w(e,l),b(t,e,null),w(e,n),$(a,s,i),b(o,a,i),u=!0},p(a,i){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),t.$set(f)},i(a){u||(_(t.$$.fragment,a),_(o.$$.fragment,a),u=!0)},o(a){d(t.$$.fragment,a),d(o.$$.fragment,a),u=!1},d(a){a&&(p(e),p(s)),k(t),k(o,a)}}}function zo(r){let e,l,t;return l=new ce({props:{$$slots:{default:[qo]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&32&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function jo(r){let e,l=r[4].name+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&16&&l!==(l=n[4].name+"")&&j(t,l)},d(n){n&&p(e)}}}function Bo(r){let e,l;return e=new oe({props:{$$slots:{default:[jo,({props:t})=>({4:t}),({props:t})=>t?16:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&48&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Ho(r){let e,l,t,n;const s=[H(ht),{paint:{"fill-color":r[1],"fill-opacity":ee(0,.5)}},{layout:{visibility:r[0]?"visible":"none"}},{manageHoverState:!0},{eventsIfTopMost:!0},{hoverCursor:"pointer"}];let o={$$slots:{default:[Bo]},$$scope:{ctx:r}};for(let i=0;iW(e,"checked",o)),n=new pt({props:{data:`${pe()}/v1/${ht}.geojson`,$$slots:{default:[Ho]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),!l&&i&1&&(l=!0,f.checked=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&33&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}let ht="local_authority_districts";function Eo(r){window.open(`https://www.ons.gov.uk/visualisations/areas/${r.detail.features[0].properties.LAD23CD}`,"_blank")}function Uo(r,e,l){let t,n=K.local_authority_districts,s=ke(ht);Z(r,s,u=>l(0,t=u));function o(u){t=u,s.set(t)}return[t,n,s,o]}class Wo extends V{constructor(e){super(),Q(this,e,Uo,Go,J,{})}}function Yo(r){let e,l,t;return e=new Re({props:{color:r[1]}}),{c(){h(e.$$.fragment),l=v(` Local Planning Authorities`)},m(n,s){b(e,n,s),$(n,l,s),t=!0},p:te,i(n){t||(_(e.$$.fragment,n),t=!0)},o(n){d(e.$$.fragment,n),t=!1},d(n){n&&p(l),k(e,n)}}}function Jo(r){let e;return{c(){e=v(`local authority `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Vo(r){let e;return{c(){e=v(`national park authorit `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Qo(r){let e;return{c(){e=v(`development corporation `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Zo(r){let e;return{c(){e=v("this map")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Ko(r){let e;return{c(){e=v(`planning.data.gov.uk `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Xo(r){let e,l,t,n,s,o,u,a,i,f,c,m,g,C,S,y,M,R,A,O,N,I;return t=new x({props:{href:"https://www.planning.data.gov.uk/dataset/local-authority",$$slots:{default:[Jo]},$$scope:{ctx:r}}}),s=new x({props:{href:"https://www.planning.data.gov.uk/dataset/national-park-authority",$$slots:{default:[Vo]},$$scope:{ctx:r}}}),u=new x({props:{href:"https://www.planning.data.gov.uk/dataset/development-corporation",$$slots:{default:[Qo]},$$scope:{ctx:r}}}),g=new x({props:{href:"https://www.planning.data.gov.uk/map/?dataset=local-planning-authority",$$slots:{default:[Zo]},$$scope:{ctx:r}}}),R=new x({props:{href:"https://www.planning.data.gov.uk/dataset/local-planning-authority",$$slots:{default:[Ko]},$$scope:{ctx:r}}}),N=new De({}),{c(){e=L("p"),l=v("LPAs may be a "),h(t.$$.fragment),n=v(", "),h(s.$$.fragment),o=v("y, or "),h(u.$$.fragment),a=v("."),i=T(),f=L("p"),c=L("strong"),m=v(`Note there are overlapping LPAs near Northhamptonshire. Only one - authority name is shown when hovering. Use `),h(g.$$.fragment),C=v(" to get more details."),S=T(),y=L("p"),M=v("Data from ONS Geography via "),h(R.$$.fragment),A=v(", as of November 2022."),O=T(),h(N.$$.fragment)},m(F,P){$(F,e,P),w(e,l),b(t,e,null),w(e,n),b(s,e,null),w(e,o),b(u,e,null),w(e,a),$(F,i,P),$(F,f,P),w(f,c),w(c,m),b(g,c,null),w(c,C),$(F,S,P),$(F,y,P),w(y,M),b(R,y,null),w(y,A),$(F,O,P),b(N,F,P),I=!0},p(F,P){const z={};P&32&&(z.$$scope={dirty:P,ctx:F}),t.$set(z);const X={};P&32&&(X.$$scope={dirty:P,ctx:F}),s.$set(X);const E={};P&32&&(E.$$scope={dirty:P,ctx:F}),u.$set(E);const q={};P&32&&(q.$$scope={dirty:P,ctx:F}),g.$set(q);const D={};P&32&&(D.$$scope={dirty:P,ctx:F}),R.$set(D)},i(F){I||(_(t.$$.fragment,F),_(s.$$.fragment,F),_(u.$$.fragment,F),_(g.$$.fragment,F),_(R.$$.fragment,F),_(N.$$.fragment,F),I=!0)},o(F){d(t.$$.fragment,F),d(s.$$.fragment,F),d(u.$$.fragment,F),d(g.$$.fragment,F),d(R.$$.fragment,F),d(N.$$.fragment,F),I=!1},d(F){F&&(p(e),p(i),p(f),p(S),p(y),p(O)),k(t),k(s),k(u),k(g),k(R),k(N,F)}}}function xo(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Xo]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&32&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function ei(r){let e,l=r[4].name+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&16&&l!==(l=n[4].name+"")&&B(t,l)},d(n){n&&p(e)}}}function ti(r){let e,l;return e=new oe({props:{$$slots:{default:[ei,({props:t})=>({4:t}),({props:t})=>t?16:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&48&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function ni(r){let e,l,t,n;const s=[H(Ue),{sourceLayer:Ue},{paint:{"fill-color":r[1],"fill-opacity":ee(0,.5)}},{layout:{visibility:r[0]?"visible":"none"}},{manageHoverState:!0},{eventsIfTopMost:!0}];let o={$$slots:{default:[ti]},$$scope:{ctx:r}};for(let i=0;iW(e,"checked",o)),n=new _e({props:{url:`pmtiles://${pe()}/v1/${Ue}.pmtiles`,$$slots:{default:[ni]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),!l&&i&1&&(l=!0,f.checked=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&33&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}let Ue="local_planning_authorities";function si(r,e,l){let t,n=K.local_planning_authorities,s=ke(Ue);Z(r,s,u=>l(0,t=u));function o(u){t=u,s.set(t)}return[t,n,s,o]}class ri extends V{constructor(e){super(),Q(this,e,si,li,J,{})}}function oi(r){let e,l,t;return e=new Re({props:{color:r[1]}}),{c(){h(e.$$.fragment),l=v(` + authority name is shown when hovering. Use `),h(g.$$.fragment),C=v(" to get more details."),S=T(),y=L("p"),M=v("Data from ONS Geography via "),h(R.$$.fragment),A=v(", as of November 2022."),O=T(),h(N.$$.fragment)},m(F,P){$(F,e,P),w(e,l),b(t,e,null),w(e,n),b(s,e,null),w(e,o),b(u,e,null),w(e,a),$(F,i,P),$(F,f,P),w(f,c),w(c,m),b(g,c,null),w(c,C),$(F,S,P),$(F,y,P),w(y,M),b(R,y,null),w(y,A),$(F,O,P),b(N,F,P),I=!0},p(F,P){const z={};P&32&&(z.$$scope={dirty:P,ctx:F}),t.$set(z);const X={};P&32&&(X.$$scope={dirty:P,ctx:F}),s.$set(X);const E={};P&32&&(E.$$scope={dirty:P,ctx:F}),u.$set(E);const q={};P&32&&(q.$$scope={dirty:P,ctx:F}),g.$set(q);const D={};P&32&&(D.$$scope={dirty:P,ctx:F}),R.$set(D)},i(F){I||(_(t.$$.fragment,F),_(s.$$.fragment,F),_(u.$$.fragment,F),_(g.$$.fragment,F),_(R.$$.fragment,F),_(N.$$.fragment,F),I=!0)},o(F){d(t.$$.fragment,F),d(s.$$.fragment,F),d(u.$$.fragment,F),d(g.$$.fragment,F),d(R.$$.fragment,F),d(N.$$.fragment,F),I=!1},d(F){F&&(p(e),p(i),p(f),p(S),p(y),p(O)),k(t),k(s),k(u),k(g),k(R),k(N,F)}}}function xo(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Xo]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&32&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function ei(r){let e,l=r[4].name+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&16&&l!==(l=n[4].name+"")&&j(t,l)},d(n){n&&p(e)}}}function ti(r){let e,l;return e=new oe({props:{$$slots:{default:[ei,({props:t})=>({4:t}),({props:t})=>t?16:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&48&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function ni(r){let e,l,t,n;const s=[H(Ue),{sourceLayer:Ue},{paint:{"fill-color":r[1],"fill-opacity":ee(0,.5)}},{layout:{visibility:r[0]?"visible":"none"}},{manageHoverState:!0},{eventsIfTopMost:!0}];let o={$$slots:{default:[ti]},$$scope:{ctx:r}};for(let i=0;iW(e,"checked",o)),n=new _e({props:{url:`pmtiles://${pe()}/v1/${Ue}.pmtiles`,$$slots:{default:[ni]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),!l&&i&1&&(l=!0,f.checked=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&33&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}let Ue="local_planning_authorities";function si(r,e,l){let t,n=K.local_planning_authorities,s=ke(Ue);Z(r,s,u=>l(0,t=u));function o(u){t=u,s.set(t)}return[t,n,s,o]}class ri extends V{constructor(e){super(),Q(this,e,si,li,J,{})}}function oi(r){let e,l,t;return e=new Re({props:{color:r[1]}}),{c(){h(e.$$.fragment),l=v(` Parliamentary constituencies`)},m(n,s){b(e,n,s),$(n,l,s),t=!0},p:te,i(n){t||(_(e.$$.fragment,n),t=!0)},o(n){d(e.$$.fragment,n),t=!1},d(n){n&&p(l),k(e,n)}}}function ii(r){let e;return{c(){e=v(`Ordnance Survey Boundary-Line - `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function ai(r){let e,l,t,n,s,o,u;return t=new x({props:{href:"https://www.ordnancesurvey.co.uk/products/boundary-line",$$slots:{default:[ii]},$$scope:{ctx:r}}}),o=new De({}),{c(){e=L("p"),l=v("Data from "),h(t.$$.fragment),n=v(", as of May 2023."),s=T(),h(o.$$.fragment)},m(a,i){$(a,e,i),w(e,l),b(t,e,null),w(e,n),$(a,s,i),b(o,a,i),u=!0},p(a,i){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),t.$set(f)},i(a){u||(_(t.$$.fragment,a),_(o.$$.fragment,a),u=!0)},o(a){d(t.$$.fragment,a),d(o.$$.fragment,a),u=!1},d(a){a&&(p(e),p(s)),k(t),k(o,a)}}}function fi(r){let e,l,t;return l=new ce({props:{$$slots:{default:[ai]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&32&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function ui(r){let e,l=r[4].Name+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&16&&l!==(l=n[4].Name+"")&&B(t,l)},d(n){n&&p(e)}}}function ci(r){let e,l;return e=new oe({props:{$$slots:{default:[ui,({props:t})=>({4:t}),({props:t})=>t?16:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&48&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function $i(r){let e,l,t,n;const s=[H(We),{sourceLayer:We},{paint:{"fill-color":r[1],"fill-opacity":ee(0,.5)}},{layout:{visibility:r[0]?"visible":"none"}},{manageHoverState:!0},{eventsIfTopMost:!0},{hoverCursor:"pointer"}];let o={$$slots:{default:[ci]},$$scope:{ctx:r}};for(let i=0;iW(e,"checked",o)),n=new _e({props:{url:`pmtiles://${pe()}/v1/${We}.pmtiles`,$$slots:{default:[$i]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),!l&&i&1&&(l=!0,f.checked=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&33&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}let We="parliamentary_constituencies";function mi(r){let e=r.detail.features[0].properties.Name;e=e.replace(/ Boro Const$/,""),e=e.replace(/ Co Const$/,""),e=encodeURIComponent(e),window.open(`https://members.parliament.uk/members/Commons?SearchText=${e}`,"_blank")}function _i(r,e,l){let t,n=K.parliamentary_constituencies,s=ke(We);Z(r,s,u=>l(0,t=u));function o(u){t=u,s.set(t)}return[t,n,s,o]}class gi extends V{constructor(e){super(),Q(this,e,_i,pi,J,{})}}function di(r){let e;return{c(){e=v("Pollution")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function hi(r){let e;return{c(){e=v(`DEFRA + `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function ai(r){let e,l,t,n,s,o,u;return t=new x({props:{href:"https://www.ordnancesurvey.co.uk/products/boundary-line",$$slots:{default:[ii]},$$scope:{ctx:r}}}),o=new De({}),{c(){e=L("p"),l=v("Data from "),h(t.$$.fragment),n=v(", as of May 2023."),s=T(),h(o.$$.fragment)},m(a,i){$(a,e,i),w(e,l),b(t,e,null),w(e,n),$(a,s,i),b(o,a,i),u=!0},p(a,i){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),t.$set(f)},i(a){u||(_(t.$$.fragment,a),_(o.$$.fragment,a),u=!0)},o(a){d(t.$$.fragment,a),d(o.$$.fragment,a),u=!1},d(a){a&&(p(e),p(s)),k(t),k(o,a)}}}function fi(r){let e,l,t;return l=new ce({props:{$$slots:{default:[ai]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&32&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function ui(r){let e,l=r[4].Name+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&16&&l!==(l=n[4].Name+"")&&j(t,l)},d(n){n&&p(e)}}}function ci(r){let e,l;return e=new oe({props:{$$slots:{default:[ui,({props:t})=>({4:t}),({props:t})=>t?16:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&48&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function $i(r){let e,l,t,n;const s=[H(We),{sourceLayer:We},{paint:{"fill-color":r[1],"fill-opacity":ee(0,.5)}},{layout:{visibility:r[0]?"visible":"none"}},{manageHoverState:!0},{eventsIfTopMost:!0},{hoverCursor:"pointer"}];let o={$$slots:{default:[ci]},$$scope:{ctx:r}};for(let i=0;iW(e,"checked",o)),n=new _e({props:{url:`pmtiles://${pe()}/v1/${We}.pmtiles`,$$slots:{default:[$i]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),!l&&i&1&&(l=!0,f.checked=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&33&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}let We="parliamentary_constituencies";function mi(r){let e=r.detail.features[0].properties.Name;e=e.replace(/ Boro Const$/,""),e=e.replace(/ Co Const$/,""),e=encodeURIComponent(e),window.open(`https://members.parliament.uk/members/Commons?SearchText=${e}`,"_blank")}function _i(r,e,l){let t,n=K.parliamentary_constituencies,s=ke(We);Z(r,s,u=>l(0,t=u));function o(u){t=u,s.set(t)}return[t,n,s,o]}class gi extends V{constructor(e){super(),Q(this,e,_i,pi,J,{})}}function di(r){let e;return{c(){e=v("Pollution")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function hi(r){let e;return{c(){e=v(`DEFRA `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function bi(r){let e,l,t,n,s,o,u,a,i;return t=new x({props:{href:"https://uk-air.defra.gov.uk/data/wms-services",$$slots:{default:[hi]},$$scope:{ctx:r}}}),a=new De({}),{c(){e=L("p"),l=v("Most layers show air quality data from "),h(t.$$.fragment),n=v(`. The measurements are annual means, in units of µgm `),s=L("sup"),s.textContent="3",o=v(` . Note the particulate matter layers are not corrected for natural sources.`),u=T(),h(a.$$.fragment)},m(f,c){$(f,e,c),w(e,l),b(t,e,null),w(e,n),w(e,s),w(e,o),$(f,u,c),b(a,f,c),i=!0},p(f,c){const m={};c&4096&&(m.$$scope={dirty:c,ctx:f}),t.$set(m)},i(f){i||(_(t.$$.fragment,f),_(a.$$.fragment,f),i=!0)},o(f){d(t.$$.fragment,f),d(a.$$.fragment,f),i=!1},d(f){f&&(p(e),p(u)),k(t),k(a,f)}}}function ki(r){let e,l,t;return l=new ce({props:{$$slots:{default:[bi]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&4096&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Wn(r){let e,l,t,n,s=r[3](r[0].pollutant)+"",o,u,a,i,f,c,m,g,C,S,y,M,R;function A(N){r[6](N)}let O={label:"Pollutant",choices:[["PM25_viridis","Background PM2.5"],["PM10_viridis","Background PM10"],["NOx_viridis","Background NOx"],["PM25Roads_viridis","Roadside PM2.5"],["PM10Roads_viridis","Roadside PM10"],["NOxRoads_viridis","Roadside NOx"]]};return r[0].pollutant!==void 0&&(O.value=r[0].pollutant),e=new ot({props:O}),U.push(()=>W(e,"value",A)),{c(){h(e.$$.fragment),t=T(),n=L("p"),o=v(s),u=T(),a=L("div"),i=L("label"),f=v(`Opacity - `),c=L("input"),m=T(),g=L("img"),G(c,"type","range"),G(c,"min","0"),G(c,"max","100"),Wt(g.src,C=r[4](r[0].pollutant))||G(g,"src",C),G(g,"width",150),G(g,"alt",S=`Legend for ${r[0].pollutant} layer`)},m(N,I){b(e,N,I),$(N,t,I),$(N,n,I),w(n,o),$(N,u,I),$(N,a,I),w(a,i),w(i,f),w(i,c),Ve(c,r[0].opacity),$(N,m,I),$(N,g,I),y=!0,M||(R=[xe(c,"change",r[7]),xe(c,"input",r[7])],M=!0)},p(N,I){const F={};!l&&I&1&&(l=!0,F.value=N[0].pollutant,Y(()=>l=!1)),e.$set(F),(!y||I&1)&&s!==(s=N[3](N[0].pollutant)+"")&&B(o,s),I&1&&Ve(c,N[0].opacity),(!y||I&1&&!Wt(g.src,C=N[4](N[0].pollutant)))&&G(g,"src",C),(!y||I&1&&S!==(S=`Legend for ${N[0].pollutant} layer`))&&G(g,"alt",S)},i(N){y||(_(e.$$.fragment,N),y=!0)},o(N){d(e.$$.fragment,N),y=!1},d(N){N&&(p(t),p(n),p(u),p(a),p(m),p(g)),k(e,N),M=!1,is(R)}}}function wi(r){let e,l;const t=[H("pollution"),{paint:{"raster-opacity":r[0].opacity/100}},{layout:{visibility:r[0].show?"visible":"none"}}];let n={};for(let s=0;sW(e,"checked",u));let i=r[0].show&&Wn(r);return s=new Xs({props:{tiles:[r[1]],tileSize:256,$$slots:{default:[wi]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&4096&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0].show,Y(()=>l=!1)),e.$set(m),f[0].show?i?(i.p(f,c),c&1&&_(i,1)):(i=Wn(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&2&&(g.tiles=[f[1]]),c&4097&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}function yi(r){return r.show?`${r.pollutant}/${r.opacity}`:null}function Si(r){let[e,l]=r.split("/");return{show:!0,pollutant:e,opacity:parseInt(l)}}function Ci(r,e,l){let t,n,s,u=_t("pollution",{show:!1,pollutant:"PM25_viridis",opacity:50},yi,Si);Z(r,u,S=>l(0,s=S));function a(){return`https://ukair.maps.rcdo.co.uk/ukairserver/services/aq_amb_2022/${s.pollutant}/MapServer/WMSServer`}function i(S){return t[1]}function f(S){let y=new URLSearchParams({request:"GetMap",version:"1.3.0",format:"image/png",crs:"EPSG:3857",width:"256",height:"256",styles:"",layers:t[0]}).toString();return`${a()}?bbox={bbox-epsg-3857}&${y}`}function c(S){let y=new URLSearchParams({request:"GetLegendGraphic",version:"1.3.0",format:"image/png",layer:t[0]}).toString();return`${a()}?${y}`}function m(S){r.$$.not_equal(s.show,S)&&(s.show=S,u.set(s))}function g(S){r.$$.not_equal(s.pollutant,S)&&(s.pollutant=S,u.set(s))}function C(){s.opacity=Gt(this.value),u.set(s)}return r.$$.update=()=>{r.$$.dirty&1&&(t={NOx_viridis:["22","Data for 2022"],PM25_viridis:["21","Data for 2022"],PM10_viridis:["22","Data for 2022"],NOxRoads_viridis:["22","Data for 2022"],PM25Roads_viridis:["14","Data for 2022"],PM10Roads_viridis:["22","Data for 2022"]}[s.pollutant]),r.$$.dirty&1&&l(1,n=f(s.pollutant))},[s,n,u,i,c,m,g,C]}class Li extends V{constructor(e){super(),Q(this,e,Ci,vi,J,{})}}function Ti(r){let e;return{c(){e=v("Road noise")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Mi(r){let e;return{c(){e=v(`DEFRA + `),c=L("input"),m=T(),g=L("img"),G(c,"type","range"),G(c,"min","0"),G(c,"max","100"),Wt(g.src,C=r[4](r[0].pollutant))||G(g,"src",C),G(g,"width",150),G(g,"alt",S=`Legend for ${r[0].pollutant} layer`)},m(N,I){b(e,N,I),$(N,t,I),$(N,n,I),w(n,o),$(N,u,I),$(N,a,I),w(a,i),w(i,f),w(i,c),Ve(c,r[0].opacity),$(N,m,I),$(N,g,I),y=!0,M||(R=[xe(c,"change",r[7]),xe(c,"input",r[7])],M=!0)},p(N,I){const F={};!l&&I&1&&(l=!0,F.value=N[0].pollutant,Y(()=>l=!1)),e.$set(F),(!y||I&1)&&s!==(s=N[3](N[0].pollutant)+"")&&j(o,s),I&1&&Ve(c,N[0].opacity),(!y||I&1&&!Wt(g.src,C=N[4](N[0].pollutant)))&&G(g,"src",C),(!y||I&1&&S!==(S=`Legend for ${N[0].pollutant} layer`))&&G(g,"alt",S)},i(N){y||(_(e.$$.fragment,N),y=!0)},o(N){d(e.$$.fragment,N),y=!1},d(N){N&&(p(t),p(n),p(u),p(a),p(m),p(g)),k(e,N),M=!1,is(R)}}}function wi(r){let e,l;const t=[H("pollution"),{paint:{"raster-opacity":r[0].opacity/100}},{layout:{visibility:r[0].show?"visible":"none"}}];let n={};for(let s=0;sW(e,"checked",u));let i=r[0].show&&Wn(r);return s=new Xs({props:{tiles:[r[1]],tileSize:256,$$slots:{default:[wi]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&4096&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0].show,Y(()=>l=!1)),e.$set(m),f[0].show?i?(i.p(f,c),c&1&&_(i,1)):(i=Wn(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&2&&(g.tiles=[f[1]]),c&4097&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}function yi(r){return r.show?`${r.pollutant}/${r.opacity}`:null}function Si(r){let[e,l]=r.split("/");return{show:!0,pollutant:e,opacity:parseInt(l)}}function Ci(r,e,l){let t,n,s,u=_t("pollution",{show:!1,pollutant:"PM25_viridis",opacity:50},yi,Si);Z(r,u,S=>l(0,s=S));function a(){return`https://ukair.maps.rcdo.co.uk/ukairserver/services/aq_amb_2022/${s.pollutant}/MapServer/WMSServer`}function i(S){return t[1]}function f(S){let y=new URLSearchParams({request:"GetMap",version:"1.3.0",format:"image/png",crs:"EPSG:3857",width:"256",height:"256",styles:"",layers:t[0]}).toString();return`${a()}?bbox={bbox-epsg-3857}&${y}`}function c(S){let y=new URLSearchParams({request:"GetLegendGraphic",version:"1.3.0",format:"image/png",layer:t[0]}).toString();return`${a()}?${y}`}function m(S){r.$$.not_equal(s.show,S)&&(s.show=S,u.set(s))}function g(S){r.$$.not_equal(s.pollutant,S)&&(s.pollutant=S,u.set(s))}function C(){s.opacity=Gt(this.value),u.set(s)}return r.$$.update=()=>{r.$$.dirty&1&&(t={NOx_viridis:["22","Data for 2022"],PM25_viridis:["21","Data for 2022"],PM10_viridis:["22","Data for 2022"],NOxRoads_viridis:["22","Data for 2022"],PM25Roads_viridis:["14","Data for 2022"],PM10Roads_viridis:["22","Data for 2022"]}[s.pollutant]),r.$$.dirty&1&&l(1,n=f(s.pollutant))},[s,n,u,i,c,m,g,C]}class Li extends V{constructor(e){super(),Q(this,e,Ci,vi,J,{})}}function Ti(r){let e;return{c(){e=v("Road noise")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Mi(r){let e;return{c(){e=v(`DEFRA `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Ni(r){let e,l,t,n,s,o,u,a,i;return s=new x({props:{href:"https://environment.data.gov.uk/dataset/b9c6bf30-a02d-4378-94a0-2982de1bef86",$$slots:{default:[Mi]},$$scope:{ctx:r}}}),a=new De({}),{c(){e=L("p"),e.textContent=`This is the LAeq,16h dataset showing annual average noise levels in units of decibels for the 16-hour period between 7am and 11pm. Only - roads in areas with at least 100,000 people are included.`,l=T(),t=L("p"),n=v("Data from June 2019, produced by "),h(s.$$.fragment),o=v(". See there for methodology details"),u=T(),h(a.$$.fragment)},m(f,c){$(f,e,c),$(f,l,c),$(f,t,c),w(t,n),b(s,t,null),w(t,o),$(f,u,c),b(a,f,c),i=!0},p(f,c){const m={};c&32&&(m.$$scope={dirty:c,ctx:f}),s.$set(m)},i(f){i||(_(s.$$.fragment,f),_(a.$$.fragment,f),i=!0)},o(f){d(s.$$.fragment,f),d(a.$$.fragment,f),i=!1},d(f){f&&(p(e),p(l),p(t),p(u)),k(s),k(a,f)}}}function Pi(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Ni]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&32&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Yn(r){let e,l;return e=new Be({props:{colorScale:r[1],limits:["55","65","75",">"]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p:te,i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Oi(r){let e,l=r[4].noiseclass+"",t,n,s=Jn(r[4].noiseclass)+"",o,u;return{c(){e=L("p"),t=v(l),n=v(" dB ("),o=v(s),u=v(")")},m(a,i){$(a,e,i),w(e,t),w(e,n),w(e,o),w(e,u)},p(a,i){i&16&&l!==(l=a[4].noiseclass+"")&&B(t,l),i&16&&s!==(s=Jn(a[4].noiseclass)+"")&&B(o,s)},d(a){a&&p(e)}}}function Ii(r){let e,l;return e=new oe({props:{$$slots:{default:[Oi,({props:t})=>({4:t}),({props:t})=>t?16:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&48&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Ri(r){let e,l;const t=[H(bt),{sourceLayer:bt},{paint:{"fill-color":Ze(["get","noiseclass"],{"55.0-59.9":r[1][0],"60.0-64.9":r[1][0],"65.0-69.9":r[1][1],"70.0-74.9":r[1][1],">=75.0":r[1][2]},"red"),"fill-opacity":ee(.5,.8)}},{layout:{visibility:r[0]?"visible":"none"}},{manageHoverState:!0},{eventsIfTopMost:!0}];let n={$$slots:{default:[Ii]},$$scope:{ctx:r}};for(let s=0;s=75.0":s[1][2]},"red"),"fill-opacity":ee(.5,.8)}},o&1&&{layout:{visibility:s[0]?"visible":"none"}},t[4],t[5]]):{};o&32&&(u.$$scope={dirty:o,ctx:s}),e.$set(u)},i(s){l||(_(e.$$.fragment,s),l=!0)},o(s){d(e.$$.fragment,s),l=!1},d(s){k(e,s)}}}function Di(r){let e,l,t,n,s,o;function u(f){r[3](f)}let a={$$slots:{right:[Pi],default:[Ti]},$$scope:{ctx:r}};r[0]!==void 0&&(a.checked=r[0]),e=new se({props:a}),U.push(()=>W(e,"checked",u));let i=r[0]&&Yn(r);return s=new _e({props:{url:`pmtiles://${pe()}/v1/${bt}.pmtiles`,$$slots:{default:[Ri]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&32&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0],Y(()=>l=!1)),e.$set(m),f[0]?i?(i.p(f,c),c&1&&_(i,1)):(i=Yn(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&33&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let bt="road_noise";function Jn(r){return{"55.0-59.9":"Comfortable noise levels","60.0-64.9":"Comfortable noise levels","65.0-69.9":"Slightly noisy","70.0-74.9":"Slightly noisy",">=75.0":"Excessively noisy"}[r]}function Ai(r,e,l){let t,n=[K.sequential_low_to_high[0],K.sequential_low_to_high[2],K.sequential_low_to_high[4]],s=ke(bt);Z(r,s,u=>l(0,t=u));function o(u){t=u,s.set(t)}return[t,n,s,o]}class Fi extends V{constructor(e){super(),Q(this,e,Ai,Di,J,{})}}function qi(r){let e,l,t;return e=new Re({props:{color:r[1]}}),{c(){h(e.$$.fragment),l=v(` + roads in areas with at least 100,000 people are included.`,l=T(),t=L("p"),n=v("Data from June 2019, produced by "),h(s.$$.fragment),o=v(". See there for methodology details"),u=T(),h(a.$$.fragment)},m(f,c){$(f,e,c),$(f,l,c),$(f,t,c),w(t,n),b(s,t,null),w(t,o),$(f,u,c),b(a,f,c),i=!0},p(f,c){const m={};c&32&&(m.$$scope={dirty:c,ctx:f}),s.$set(m)},i(f){i||(_(s.$$.fragment,f),_(a.$$.fragment,f),i=!0)},o(f){d(s.$$.fragment,f),d(a.$$.fragment,f),i=!1},d(f){f&&(p(e),p(l),p(t),p(u)),k(s),k(a,f)}}}function Pi(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Ni]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&32&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Yn(r){let e,l;return e=new je({props:{colorScale:r[1],limits:["55","65","75",">"]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p:te,i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Oi(r){let e,l=r[4].noiseclass+"",t,n,s=Jn(r[4].noiseclass)+"",o,u;return{c(){e=L("p"),t=v(l),n=v(" dB ("),o=v(s),u=v(")")},m(a,i){$(a,e,i),w(e,t),w(e,n),w(e,o),w(e,u)},p(a,i){i&16&&l!==(l=a[4].noiseclass+"")&&j(t,l),i&16&&s!==(s=Jn(a[4].noiseclass)+"")&&j(o,s)},d(a){a&&p(e)}}}function Ii(r){let e,l;return e=new oe({props:{$$slots:{default:[Oi,({props:t})=>({4:t}),({props:t})=>t?16:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&48&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Ri(r){let e,l;const t=[H(bt),{sourceLayer:bt},{paint:{"fill-color":Ze(["get","noiseclass"],{"55.0-59.9":r[1][0],"60.0-64.9":r[1][0],"65.0-69.9":r[1][1],"70.0-74.9":r[1][1],">=75.0":r[1][2]},"red"),"fill-opacity":ee(.5,.8)}},{layout:{visibility:r[0]?"visible":"none"}},{manageHoverState:!0},{eventsIfTopMost:!0}];let n={$$slots:{default:[Ii]},$$scope:{ctx:r}};for(let s=0;s=75.0":s[1][2]},"red"),"fill-opacity":ee(.5,.8)}},o&1&&{layout:{visibility:s[0]?"visible":"none"}},t[4],t[5]]):{};o&32&&(u.$$scope={dirty:o,ctx:s}),e.$set(u)},i(s){l||(_(e.$$.fragment,s),l=!0)},o(s){d(e.$$.fragment,s),l=!1},d(s){k(e,s)}}}function Di(r){let e,l,t,n,s,o;function u(f){r[3](f)}let a={$$slots:{right:[Pi],default:[Ti]},$$scope:{ctx:r}};r[0]!==void 0&&(a.checked=r[0]),e=new se({props:a}),U.push(()=>W(e,"checked",u));let i=r[0]&&Yn(r);return s=new _e({props:{url:`pmtiles://${pe()}/v1/${bt}.pmtiles`,$$slots:{default:[Ri]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&32&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0],Y(()=>l=!1)),e.$set(m),f[0]?i?(i.p(f,c),c&1&&_(i,1)):(i=Yn(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&33&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let bt="road_noise";function Jn(r){return{"55.0-59.9":"Comfortable noise levels","60.0-64.9":"Comfortable noise levels","65.0-69.9":"Slightly noisy","70.0-74.9":"Slightly noisy",">=75.0":"Excessively noisy"}[r]}function Ai(r,e,l){let t,n=[K.sequential_low_to_high[0],K.sequential_low_to_high[2],K.sequential_low_to_high[4]],s=ke(bt);Z(r,s,u=>l(0,t=u));function o(u){t=u,s.set(t)}return[t,n,s,o]}class Fi extends V{constructor(e){super(),Q(this,e,Ai,Di,J,{})}}function qi(r){let e,l,t;return e=new Re({props:{color:r[1]}}),{c(){h(e.$$.fragment),l=v(` Wards`)},m(n,s){b(e,n,s),$(n,l,s),t=!0},p:te,i(n){t||(_(e.$$.fragment,n),t=!0)},o(n){d(e.$$.fragment,n),t=!1},d(n){n&&p(l),k(e,n)}}}function zi(r){let e;return{c(){e=v(`ONS Geography - `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Bi(r){let e,l,t,n,s,o,u;return t=new x({props:{href:"https://geoportal.statistics.gov.uk/datasets/ons::wards-may-2023-boundaries-uk-bgc/explore",$$slots:{default:[zi]},$$scope:{ctx:r}}}),o=new De({}),{c(){e=L("p"),l=v("Data from "),h(t.$$.fragment),n=v(", as of May 2023."),s=T(),h(o.$$.fragment)},m(a,i){$(a,e,i),w(e,l),b(t,e,null),w(e,n),$(a,s,i),b(o,a,i),u=!0},p(a,i){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),t.$set(f)},i(a){u||(_(t.$$.fragment,a),_(o.$$.fragment,a),u=!0)},o(a){d(t.$$.fragment,a),d(o.$$.fragment,a),u=!1},d(a){a&&(p(e),p(s)),k(t),k(o,a)}}}function ji(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Bi]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&32&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Hi(r){let e,l=r[4].name+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&16&&l!==(l=n[4].name+"")&&B(t,l)},d(n){n&&p(e)}}}function Gi(r){let e,l;return e=new oe({props:{$$slots:{default:[Hi,({props:t})=>({4:t}),({props:t})=>t?16:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&48&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Ei(r){let e,l,t,n;const s=[H(Ye),{sourceLayer:Ye},{paint:{"fill-color":r[1],"fill-opacity":ee(0,.5)}},{layout:{visibility:r[0]?"visible":"none"}},{manageHoverState:!0},{eventsIfTopMost:!0},{hoverCursor:"pointer"}];let o={$$slots:{default:[Gi]},$$scope:{ctx:r}};for(let i=0;iW(e,"checked",o)),n=new _e({props:{url:`pmtiles://${pe()}/v1/${Ye}.pmtiles`,$$slots:{default:[Ei]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),!l&&i&1&&(l=!0,f.checked=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&33&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}let Ye="wards";function Wi(r){let e=encodeURIComponent(r.detail.features[0].properties.name);window.open(`https://www.google.com/search?q=${e}+councillor`,"_blank")}function Yi(r,e,l){let t,n=K.wards,s=ke(Ye);Z(r,s,u=>l(0,t=u));function o(u){t=u,s.set(t)}return[t,n,s,o]}class Ji extends V{constructor(e){super(),Q(this,e,Yi,Ui,J,{})}}function Vi(r){let e;return{c(){e=v("Open Data Commons Open Database License")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Qi(r){let e,l,t,n;return t=new x({props:{href:"https://www.openstreetmap.org/copyright",$$slots:{default:[Vi]},$$scope:{ctx:r}}}),{c(){e=L("p"),l=v("License: "),h(t.$$.fragment)},m(s,o){$(s,e,o),w(e,l),b(t,e,null),n=!0},p(s,[o]){const u={};o&1&&(u.$$scope={dirty:o,ctx:s}),t.$set(u)},i(s){n||(_(t.$$.fragment,s),n=!0)},o(s){d(t.$$.fragment,s),n=!1},d(s){s&&p(e),k(t)}}}class Ke extends V{constructor(e){super(),Q(this,e,null,Qi,J,{})}}function Zi(r){let e,l,t;return e=new Re({props:{color:K.bus_route_with_lane}}),{c(){h(e.$$.fragment),l=v(` + `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function ji(r){let e,l,t,n,s,o,u;return t=new x({props:{href:"https://geoportal.statistics.gov.uk/datasets/ons::wards-may-2023-boundaries-uk-bgc/explore",$$slots:{default:[zi]},$$scope:{ctx:r}}}),o=new De({}),{c(){e=L("p"),l=v("Data from "),h(t.$$.fragment),n=v(", as of May 2023."),s=T(),h(o.$$.fragment)},m(a,i){$(a,e,i),w(e,l),b(t,e,null),w(e,n),$(a,s,i),b(o,a,i),u=!0},p(a,i){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),t.$set(f)},i(a){u||(_(t.$$.fragment,a),_(o.$$.fragment,a),u=!0)},o(a){d(t.$$.fragment,a),d(o.$$.fragment,a),u=!1},d(a){a&&(p(e),p(s)),k(t),k(o,a)}}}function Bi(r){let e,l,t;return l=new ce({props:{$$slots:{default:[ji]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&32&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Hi(r){let e,l=r[4].name+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&16&&l!==(l=n[4].name+"")&&j(t,l)},d(n){n&&p(e)}}}function Gi(r){let e,l;return e=new oe({props:{$$slots:{default:[Hi,({props:t})=>({4:t}),({props:t})=>t?16:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&48&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Ei(r){let e,l,t,n;const s=[H(Ye),{sourceLayer:Ye},{paint:{"fill-color":r[1],"fill-opacity":ee(0,.5)}},{layout:{visibility:r[0]?"visible":"none"}},{manageHoverState:!0},{eventsIfTopMost:!0},{hoverCursor:"pointer"}];let o={$$slots:{default:[Gi]},$$scope:{ctx:r}};for(let i=0;iW(e,"checked",o)),n=new _e({props:{url:`pmtiles://${pe()}/v1/${Ye}.pmtiles`,$$slots:{default:[Ei]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),!l&&i&1&&(l=!0,f.checked=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&33&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}let Ye="wards";function Wi(r){let e=encodeURIComponent(r.detail.features[0].properties.name);window.open(`https://www.google.com/search?q=${e}+councillor`,"_blank")}function Yi(r,e,l){let t,n=K.wards,s=ke(Ye);Z(r,s,u=>l(0,t=u));function o(u){t=u,s.set(t)}return[t,n,s,o]}class Ji extends V{constructor(e){super(),Q(this,e,Yi,Ui,J,{})}}function Vi(r){let e;return{c(){e=v("Open Data Commons Open Database License")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Qi(r){let e,l,t,n;return t=new x({props:{href:"https://www.openstreetmap.org/copyright",$$slots:{default:[Vi]},$$scope:{ctx:r}}}),{c(){e=L("p"),l=v("License: "),h(t.$$.fragment)},m(s,o){$(s,e,o),w(e,l),b(t,e,null),n=!0},p(s,[o]){const u={};o&1&&(u.$$scope={dirty:o,ctx:s}),t.$set(u)},i(s){n||(_(t.$$.fragment,s),n=!0)},o(s){d(t.$$.fragment,s),n=!1},d(s){s&&p(e),k(t)}}}class Ke extends V{constructor(e){super(),Q(this,e,null,Qi,J,{})}}function Zi(r){let e,l,t;return e=new Re({props:{color:K.bus_route_with_lane}}),{c(){h(e.$$.fragment),l=v(` Bus routes`)},m(n,s){b(e,n,s),$(n,l,s),t=!0},p:te,i(n){t||(_(e.$$.fragment,n),t=!0)},o(n){d(e.$$.fragment,n),t=!1},d(n){n&&p(l),k(e,n)}}}function Ki(r){let e;return{c(){e=v(`GTFS `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Xi(r){let e,l,t,n,s,o,u,a,i;return s=new x({props:{href:"https://gtfs.org",$$slots:{default:[Ki]},$$scope:{ctx:r}}}),a=new Ke({}),{c(){e=L("p"),e.textContent=`This shows all roads with at least one bus route crossing them. It also shows whether the road has a bus lane or not.`,l=T(),t=L("p"),n=v("Note this data is from OpenStreetMap (as of 9 August 2023), not "),h(s.$$.fragment),o=v(`, and doesn't include which routes are run or the @@ -68,14 +68,14 @@ import{S as V,i as Q,s as J,e as L,j as G,av as me,k as $,a4 as te,p,aQ as ts,b OpenStreetMap can be missing, mapped twice, or mapped incorrectly. Our processing is also imperfect. You can click a segment to see full OpenStreetMap data. Please do report issues with the classification or - data.`,o=T(),h(u.$$.fragment)},m(i,f){$(i,e,f),$(i,l,f),$(i,t,f),$(i,n,f),$(i,s,f),$(i,o,f),b(u,i,f),a=!0},p:te,i(i){a||(_(u.$$.fragment,i),a=!0)},o(i){d(u.$$.fragment,i),a=!1},d(i){i&&(p(e),p(l),p(t),p(n),p(s),p(o)),k(u,i)}}}function ua(r){let e,l,t;return l=new ce({props:{$$slots:{default:[fa]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&131072&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Zn(r){let e,l,t;return l=new nt({props:{$$slots:{default:[$a]},$$scope:{ctx:r}}}),{c(){e=L("div"),h(l.$$.fragment),me(e,"border","1px solid black"),me(e,"padding","8px")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&131073&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function ca(r){let e,l,t=r[13]+"",n,s,o;return e=new Re({props:{color:r[14]}}),{c(){h(e.$$.fragment),l=T(),n=v(t),s=T()},m(u,a){b(e,u,a),$(u,l,a),$(u,n,a),$(u,s,a),o=!0},p:te,i(u){o||(_(e.$$.fragment,u),o=!0)},o(u){d(e.$$.fragment,u),o=!1},d(u){u&&(p(l),p(n),p(s)),k(e,u)}}}function Kn(r){let e,l,t;function n(o){r[5](o,r[10])}let s={$$slots:{default:[ca]},$$scope:{ctx:r}};return r[0][r[10]]!==void 0&&(s.checked=r[0][r[10]]),e=new se({props:s}),U.push(()=>W(e,"checked",n)),{c(){h(e.$$.fragment)},m(o,u){b(e,o,u),t=!0},p(o,u){r=o;const a={};u&131072&&(a.$$scope={dirty:u,ctx:r}),!l&&u&5&&(l=!0,a.checked=r[0][r[10]],Y(()=>l=!1)),e.$set(a)},i(o){t||(_(e.$$.fragment,o),t=!0)},o(o){d(e.$$.fragment,o),t=!1},d(o){k(e,o)}}}function $a(r){let e,l,t=Se(r[2]),n=[];for(let o=0;od(n[o],1,1,()=>{n[o]=null});return{c(){for(let o=0;o({9:t}),({props:t})=>t?512:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&131584&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function _a(r){let e,l;const t=[H(wt),{sourceLayer:wt},{paint:{"line-color":Ze(["get","kind"],{track:K.cycle_paths.track,lane:K.cycle_paths.lane,shared_use_segregated:K.cycle_paths.shared_use_segregated,shared_use_unsegregated:K.cycle_paths.shared_use_unsegregated},"red"),"line-width":Ae,"line-opacity":ee(1,.5)}},{layout:{visibility:r[0].show?"visible":"none"}},{filter:r[3](r[0])},{manageHoverState:!0},{eventsIfTopMost:!0},{hoverCursor:"pointer"}];let n={$$slots:{default:[ma]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",u));let i=r[0].show&&Zn(r);return s=new _e({props:{url:`pmtiles://${pe()}/v1/${wt}.pmtiles`,$$slots:{default:[_a]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&131072&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0].show,Y(()=>l=!1)),e.$set(m),f[0].show?i?(i.p(f,c),c&1&&_(i,1)):(i=Zn(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&131073&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let wt="cycle_paths";function da(r){return{show:!0,track:r.includes("track"),lane:r.includes("lane"),shared_use_segregated:r.includes("shared_use_segregated"),shared_use_unsegregated:r.includes("shared_use_unsegregated")}}function ha(r){let e={track:"Separated track",lane:"Unprotected lane",shared_use_segregated:"Shared-use (segregated)",shared_use_unsegregated:"Shared-use (unsegregated)"}[r.kind],l={"one-way":"↑","two-way":"↕",unknown:""}[r.direction],t=r.width=="unknown"?"unknown":`${r.width} meters`;return[e,`${l} ${r.direction}`,t]}function ba(r){window.open(`http://openstreetmap.org/way/${r.detail.features[0].properties.osm_id}`,"_blank")}function ka(r,e,l){let t,n=["track","lane","shared_use_segregated","shared_use_unsegregated"],s={show:!1,track:!0,lane:!0,shared_use_segregated:!0,shared_use_unsegregated:!0};function o(m){return m.show?n.filter(g=>m[g]).join(","):null}let u=_t(wt,s,o,da);Z(r,u,m=>l(0,t=m));let a=[["track","Separated tracks",K.cycle_paths.track],["lane","Unprotected lanes",K.cycle_paths.lane],["shared_use_segregated","Shared-use (segregated)",K.cycle_paths.shared_use_segregated],["shared_use_unsegregated","Shared-use (unsegregated)",K.cycle_paths.shared_use_unsegregated]];function i(m){let g=n.filter(C=>m[C]);return["in",["get","kind"],["literal",g]]}function f(m){r.$$.not_equal(t.show,m)&&(t.show=m,u.set(t))}function c(m,g){r.$$.not_equal(t[g],m)&&(t[g]=m,u.set(t))}return[t,u,a,i,f,c]}class wa extends V{constructor(e){super(),Q(this,e,ka,ga,J,{})}}function va(r){let e,l,t;return e=new Re({props:{color:r[1]}}),{c(){h(e.$$.fragment),l=v(` + data.`,o=T(),h(u.$$.fragment)},m(i,f){$(i,e,f),$(i,l,f),$(i,t,f),$(i,n,f),$(i,s,f),$(i,o,f),b(u,i,f),a=!0},p:te,i(i){a||(_(u.$$.fragment,i),a=!0)},o(i){d(u.$$.fragment,i),a=!1},d(i){i&&(p(e),p(l),p(t),p(n),p(s),p(o)),k(u,i)}}}function ua(r){let e,l,t;return l=new ce({props:{$$slots:{default:[fa]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&131072&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Zn(r){let e,l,t;return l=new nt({props:{$$slots:{default:[$a]},$$scope:{ctx:r}}}),{c(){e=L("div"),h(l.$$.fragment),me(e,"border","1px solid black"),me(e,"padding","8px")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&131073&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function ca(r){let e,l,t=r[13]+"",n,s,o;return e=new Re({props:{color:r[14]}}),{c(){h(e.$$.fragment),l=T(),n=v(t),s=T()},m(u,a){b(e,u,a),$(u,l,a),$(u,n,a),$(u,s,a),o=!0},p:te,i(u){o||(_(e.$$.fragment,u),o=!0)},o(u){d(e.$$.fragment,u),o=!1},d(u){u&&(p(l),p(n),p(s)),k(e,u)}}}function Kn(r){let e,l,t;function n(o){r[5](o,r[10])}let s={$$slots:{default:[ca]},$$scope:{ctx:r}};return r[0][r[10]]!==void 0&&(s.checked=r[0][r[10]]),e=new se({props:s}),U.push(()=>W(e,"checked",n)),{c(){h(e.$$.fragment)},m(o,u){b(e,o,u),t=!0},p(o,u){r=o;const a={};u&131072&&(a.$$scope={dirty:u,ctx:r}),!l&&u&5&&(l=!0,a.checked=r[0][r[10]],Y(()=>l=!1)),e.$set(a)},i(o){t||(_(e.$$.fragment,o),t=!0)},o(o){d(e.$$.fragment,o),t=!1},d(o){k(e,o)}}}function $a(r){let e,l,t=Se(r[2]),n=[];for(let o=0;od(n[o],1,1,()=>{n[o]=null});return{c(){for(let o=0;o({9:t}),({props:t})=>t?512:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&131584&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function _a(r){let e,l;const t=[H(wt),{sourceLayer:wt},{paint:{"line-color":Ze(["get","kind"],{track:K.cycle_paths.track,lane:K.cycle_paths.lane,shared_use_segregated:K.cycle_paths.shared_use_segregated,shared_use_unsegregated:K.cycle_paths.shared_use_unsegregated},"red"),"line-width":Ae,"line-opacity":ee(1,.5)}},{layout:{visibility:r[0].show?"visible":"none"}},{filter:r[3](r[0])},{manageHoverState:!0},{eventsIfTopMost:!0},{hoverCursor:"pointer"}];let n={$$slots:{default:[ma]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",u));let i=r[0].show&&Zn(r);return s=new _e({props:{url:`pmtiles://${pe()}/v1/${wt}.pmtiles`,$$slots:{default:[_a]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&131072&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0].show,Y(()=>l=!1)),e.$set(m),f[0].show?i?(i.p(f,c),c&1&&_(i,1)):(i=Zn(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&131073&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let wt="cycle_paths";function da(r){return{show:!0,track:r.includes("track"),lane:r.includes("lane"),shared_use_segregated:r.includes("shared_use_segregated"),shared_use_unsegregated:r.includes("shared_use_unsegregated")}}function ha(r){let e={track:"Separated track",lane:"Unprotected lane",shared_use_segregated:"Shared-use (segregated)",shared_use_unsegregated:"Shared-use (unsegregated)"}[r.kind],l={"one-way":"↑","two-way":"↕",unknown:""}[r.direction],t=r.width=="unknown"?"unknown":`${r.width} meters`;return[e,`${l} ${r.direction}`,t]}function ba(r){window.open(`http://openstreetmap.org/way/${r.detail.features[0].properties.osm_id}`,"_blank")}function ka(r,e,l){let t,n=["track","lane","shared_use_segregated","shared_use_unsegregated"],s={show:!1,track:!0,lane:!0,shared_use_segregated:!0,shared_use_unsegregated:!0};function o(m){return m.show?n.filter(g=>m[g]).join(","):null}let u=_t(wt,s,o,da);Z(r,u,m=>l(0,t=m));let a=[["track","Separated tracks",K.cycle_paths.track],["lane","Unprotected lanes",K.cycle_paths.lane],["shared_use_segregated","Shared-use (segregated)",K.cycle_paths.shared_use_segregated],["shared_use_unsegregated","Shared-use (unsegregated)",K.cycle_paths.shared_use_unsegregated]];function i(m){let g=n.filter(C=>m[C]);return["in",["get","kind"],["literal",g]]}function f(m){r.$$.not_equal(t.show,m)&&(t.show=m,u.set(t))}function c(m,g){r.$$.not_equal(t[g],m)&&(t[g]=m,u.set(t))}return[t,u,a,i,f,c]}class wa extends V{constructor(e){super(),Q(this,e,ka,ga,J,{})}}function va(r){let e,l,t;return e=new Re({props:{color:r[1]}}),{c(){h(e.$$.fragment),l=v(` Major Road Network`)},m(n,s){b(e,n,s),$(n,l,s),t=!0},p:te,i(n){t||(_(e.$$.fragment,n),t=!0)},o(n){d(e.$$.fragment,n),t=!1},d(n){n&&p(l),k(e,n)}}}function ya(r){let e;return{c(){e=v(`Major Road Network - `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Sa(r){let e,l,t,n,s,o,u;return t=new x({props:{href:"https://maps.dft.gov.uk/major-road-network/index.html",$$slots:{default:[ya]},$$scope:{ctx:r}}}),o=new De({}),{c(){e=L("p"),l=v("Data from the "),h(t.$$.fragment),n=v(", as of September 2021."),s=T(),h(o.$$.fragment)},m(a,i){$(a,e,i),w(e,l),b(t,e,null),w(e,n),$(a,s,i),b(o,a,i),u=!0},p(a,i){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),t.$set(f)},i(a){u||(_(t.$$.fragment,a),_(o.$$.fragment,a),u=!0)},o(a){d(t.$$.fragment,a),d(o.$$.fragment,a),u=!1},d(a){a&&(p(e),p(s)),k(t),k(o,a)}}}function Ca(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Sa]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&32&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function La(r){let e,l=(r[4].name??"Unknown MRN road")+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&16&&l!==(l=(n[4].name??"Unknown MRN road")+"")&&B(t,l)},d(n){n&&p(e)}}}function Ta(r){let e,l;return e=new oe({props:{$$slots:{default:[La,({props:t})=>({4:t}),({props:t})=>t?16:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&48&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Ma(r){let e,l;const t=[H(vt),{sourceLayer:vt},{manageHoverState:!0},{eventsIfTopMost:!0},{paint:{"line-color":r[1],"line-width":7,"line-opacity":ee(1,.5)}},{layout:{visibility:r[0]?"visible":"none"}}];let n={$$slots:{default:[Ta]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",o)),n=new _e({props:{url:`pmtiles://${pe()}/v1/${vt}.pmtiles`,$$slots:{default:[Ma]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),!l&&i&1&&(l=!0,f.checked=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&33&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}let vt="mrn";function Pa(r,e,l){let t,n=K.mrn,s=ke(vt);Z(r,s,u=>l(0,t=u));function o(u){t=u,s.set(t)}return[t,n,s,o]}class Oa extends V{constructor(e){super(),Q(this,e,Pa,Na,J,{})}}function Ia(r){let e,l,t;return e=new Re({props:{color:r[1]}}),{c(){h(e.$$.fragment),l=v(` + `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Sa(r){let e,l,t,n,s,o,u;return t=new x({props:{href:"https://maps.dft.gov.uk/major-road-network/index.html",$$slots:{default:[ya]},$$scope:{ctx:r}}}),o=new De({}),{c(){e=L("p"),l=v("Data from the "),h(t.$$.fragment),n=v(", as of September 2021."),s=T(),h(o.$$.fragment)},m(a,i){$(a,e,i),w(e,l),b(t,e,null),w(e,n),$(a,s,i),b(o,a,i),u=!0},p(a,i){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),t.$set(f)},i(a){u||(_(t.$$.fragment,a),_(o.$$.fragment,a),u=!0)},o(a){d(t.$$.fragment,a),d(o.$$.fragment,a),u=!1},d(a){a&&(p(e),p(s)),k(t),k(o,a)}}}function Ca(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Sa]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&32&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function La(r){let e,l=(r[4].name??"Unknown MRN road")+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&16&&l!==(l=(n[4].name??"Unknown MRN road")+"")&&j(t,l)},d(n){n&&p(e)}}}function Ta(r){let e,l;return e=new oe({props:{$$slots:{default:[La,({props:t})=>({4:t}),({props:t})=>t?16:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&48&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Ma(r){let e,l;const t=[H(vt),{sourceLayer:vt},{manageHoverState:!0},{eventsIfTopMost:!0},{paint:{"line-color":r[1],"line-width":7,"line-opacity":ee(1,.5)}},{layout:{visibility:r[0]?"visible":"none"}}];let n={$$slots:{default:[Ta]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",o)),n=new _e({props:{url:`pmtiles://${pe()}/v1/${vt}.pmtiles`,$$slots:{default:[Ma]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),!l&&i&1&&(l=!0,f.checked=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&33&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}let vt="mrn";function Pa(r,e,l){let t,n=K.mrn,s=ke(vt);Z(r,s,u=>l(0,t=u));function o(u){t=u,s.set(t)}return[t,n,s,o]}class Oa extends V{constructor(e){super(),Q(this,e,Pa,Na,J,{})}}function Ia(r){let e,l,t;return e=new Re({props:{color:r[1]}}),{c(){h(e.$$.fragment),l=v(` Strategic Road Network`)},m(n,s){b(e,n,s),$(n,l,s),t=!0},p:te,i(n){t||(_(e.$$.fragment,n),t=!0)},o(n){d(e.$$.fragment,n),t=!1},d(n){n&&p(l),k(e,n)}}}function Ra(r){let e;return{c(){e=v(`OS Open Roads `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Da(r){let e,l,t,n,s,o,u;return t=new x({props:{href:"https://osdatahub.os.uk/downloads/open/OpenRoads",$$slots:{default:[Ra]},$$scope:{ctx:r}}}),o=new De({}),{c(){e=L("p"),l=v("Data from "),h(t.$$.fragment),n=v(`, as of December 2023. The SRN is equivalent to trunk - roads.`),s=T(),h(o.$$.fragment)},m(a,i){$(a,e,i),w(e,l),b(t,e,null),w(e,n),$(a,s,i),b(o,a,i),u=!0},p(a,i){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),t.$set(f)},i(a){u||(_(t.$$.fragment,a),_(o.$$.fragment,a),u=!0)},o(a){d(t.$$.fragment,a),d(o.$$.fragment,a),u=!1},d(a){a&&(p(e),p(s)),k(t),k(o,a)}}}function Aa(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Da]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&32&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Fa(r){let e,l=(r[4].name??"Unknown SRN road")+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&16&&l!==(l=(n[4].name??"Unknown SRN road")+"")&&B(t,l)},d(n){n&&p(e)}}}function qa(r){let e,l;return e=new oe({props:{$$slots:{default:[Fa,({props:t})=>({4:t}),({props:t})=>t?16:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&48&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function za(r){let e,l;const t=[H(yt),{sourceLayer:yt},{manageHoverState:!0},{eventsIfTopMost:!0},{paint:{"line-color":r[1],"line-width":7,"line-opacity":ee(1,.5)}},{layout:{visibility:r[0]?"visible":"none"}}];let n={$$slots:{default:[qa]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",o)),n=new _e({props:{url:`pmtiles://${pe()}/v1/${yt}.pmtiles`,$$slots:{default:[za]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),!l&&i&1&&(l=!0,f.checked=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&33&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}let yt="srn";function ja(r,e,l){let t,n=K.srn,s=ke(yt);Z(r,s,u=>l(0,t=u));function o(u){t=u,s.set(t)}return[t,n,s,o]}class Ha extends V{constructor(e){super(),Q(this,e,ja,Ba,J,{})}}function Ga(r){let e,l,t;return e=new Re({props:{color:r[1]}}),{c(){h(e.$$.fragment),l=v(` + roads.`),s=T(),h(o.$$.fragment)},m(a,i){$(a,e,i),w(e,l),b(t,e,null),w(e,n),$(a,s,i),b(o,a,i),u=!0},p(a,i){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),t.$set(f)},i(a){u||(_(t.$$.fragment,a),_(o.$$.fragment,a),u=!0)},o(a){d(t.$$.fragment,a),d(o.$$.fragment,a),u=!1},d(a){a&&(p(e),p(s)),k(t),k(o,a)}}}function Aa(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Da]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&32&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Fa(r){let e,l=(r[4].name??"Unknown SRN road")+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&16&&l!==(l=(n[4].name??"Unknown SRN road")+"")&&j(t,l)},d(n){n&&p(e)}}}function qa(r){let e,l;return e=new oe({props:{$$slots:{default:[Fa,({props:t})=>({4:t}),({props:t})=>t?16:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&48&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function za(r){let e,l;const t=[H(yt),{sourceLayer:yt},{manageHoverState:!0},{eventsIfTopMost:!0},{paint:{"line-color":r[1],"line-width":7,"line-opacity":ee(1,.5)}},{layout:{visibility:r[0]?"visible":"none"}}];let n={$$slots:{default:[qa]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",o)),n=new _e({props:{url:`pmtiles://${pe()}/v1/${yt}.pmtiles`,$$slots:{default:[za]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),!l&&i&1&&(l=!0,f.checked=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&33&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}let yt="srn";function Ba(r,e,l){let t,n=K.srn,s=ke(yt);Z(r,s,u=>l(0,t=u));function o(u){t=u,s.set(t)}return[t,n,s,o]}class Ha extends V{constructor(e){super(),Q(this,e,Ba,ja,J,{})}}function Ga(r){let e,l,t;return e=new Re({props:{color:r[1]}}),{c(){h(e.$$.fragment),l=v(` National Cycle Network`)},m(n,s){b(e,n,s),$(n,l,s),t=!0},p:te,i(n){t||(_(e.$$.fragment,n),t=!0)},o(n){d(e.$$.fragment,n),t=!1},d(n){n&&p(l),k(e,n)}}}function Ea(r){let e;return{c(){e=v(`National Cycle Network - `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Ua(r){let e,l,t,n,s,o,u;return t=new x({props:{href:"https://data-sustrans-uk.opendata.arcgis.com/",$$slots:{default:[Ea]},$$scope:{ctx:r}}}),o=new De({}),{c(){e=L("p"),l=v("Data from Sustrans about the "),h(t.$$.fragment),n=v(", downloaded on 22/01/2024."),s=T(),h(o.$$.fragment)},m(a,i){$(a,e,i),w(e,l),b(t,e,null),w(e,n),$(a,s,i),b(o,a,i),u=!0},p(a,i){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),t.$set(f)},i(a){u||(_(t.$$.fragment,a),_(o.$$.fragment,a),u=!0)},o(a){d(t.$$.fragment,a),d(o.$$.fragment,a),u=!1},d(a){a&&(p(e),p(s)),k(t),k(o,a)}}}function Wa(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Ua]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&32&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Xn(r){let e,l,t,n=r[4].Desc_+"",s;return{c(){e=L("li"),l=v("Description: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&16&&n!==(n=o[4].Desc_+"")&&B(s,n)},d(o){o&&p(e)}}}function xn(r){let e,l,t,n=r[4].Greenway+"",s;return{c(){e=L("li"),l=v("Is greenway: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&16&&n!==(n=o[4].Greenway+"")&&B(s,n)},d(o){o&&p(e)}}}function el(r){let e,l,t,n=r[4].RouteType+"",s;return{c(){e=L("li"),l=v("Route type: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&16&&n!==(n=o[4].RouteType+"")&&B(s,n)},d(o){o&&p(e)}}}function tl(r){let e,l,t,n=r[4].RouteNo+"",s;return{c(){e=L("li"),l=v("Route number: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&16&&n!==(n=o[4].RouteNo+"")&&B(s,n)},d(o){o&&p(e)}}}function nl(r){let e,l,t,n=r[4].RouteCat+"",s;return{c(){e=L("li"),l=v("Route Category: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&16&&n!==(n=o[4].RouteCat+"")&&B(s,n)},d(o){o&&p(e)}}}function ll(r){let e,l,t,n=r[4].OpenStatus+"",s;return{c(){e=L("li"),l=v("Open Status: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&16&&n!==(n=o[4].OpenStatus+"")&&B(s,n)},d(o){o&&p(e)}}}function sl(r){let e,l,t,n=r[4].Surface+"",s;return{c(){e=L("li"),l=v("Surface: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&16&&n!==(n=o[4].Surface+"")&&B(s,n)},d(o){o&&p(e)}}}function rl(r){let e,l,t,n=r[4].Quality+"",s;return{c(){e=L("li"),l=v("Quality: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&16&&n!==(n=o[4].Quality+"")&&B(s,n)},d(o){o&&p(e)}}}function ol(r){let e,l,t,n=r[4].RoadClass+"",s;return{c(){e=L("li"),l=v("Road Class: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&16&&n!==(n=o[4].RoadClass+"")&&B(s,n)},d(o){o&&p(e)}}}function Ya(r){let e,l,t,n,s,o,u,a,i,f=r[4].Desc_&&Xn(r),c=r[4].Greenway&&xn(r),m=r[4].RouteType&&el(r),g=r[4].RouteNo&&tl(r),C=r[4].RouteCat&&nl(r),S=r[4].OpenStatus&&ll(r),y=r[4].Surface&&sl(r),M=r[4].Quality&&rl(r),R=r[4].RoadClass&&ol(r);return{c(){e=L("ul"),f&&f.c(),l=T(),c&&c.c(),t=T(),m&&m.c(),n=T(),g&&g.c(),s=T(),C&&C.c(),o=T(),S&&S.c(),u=T(),y&&y.c(),a=T(),M&&M.c(),i=T(),R&&R.c()},m(A,O){$(A,e,O),f&&f.m(e,null),w(e,l),c&&c.m(e,null),w(e,t),m&&m.m(e,null),w(e,n),g&&g.m(e,null),w(e,s),C&&C.m(e,null),w(e,o),S&&S.m(e,null),w(e,u),y&&y.m(e,null),w(e,a),M&&M.m(e,null),w(e,i),R&&R.m(e,null)},p(A,O){A[4].Desc_?f?f.p(A,O):(f=Xn(A),f.c(),f.m(e,l)):f&&(f.d(1),f=null),A[4].Greenway?c?c.p(A,O):(c=xn(A),c.c(),c.m(e,t)):c&&(c.d(1),c=null),A[4].RouteType?m?m.p(A,O):(m=el(A),m.c(),m.m(e,n)):m&&(m.d(1),m=null),A[4].RouteNo?g?g.p(A,O):(g=tl(A),g.c(),g.m(e,s)):g&&(g.d(1),g=null),A[4].RouteCat?C?C.p(A,O):(C=nl(A),C.c(),C.m(e,o)):C&&(C.d(1),C=null),A[4].OpenStatus?S?S.p(A,O):(S=ll(A),S.c(),S.m(e,u)):S&&(S.d(1),S=null),A[4].Surface?y?y.p(A,O):(y=sl(A),y.c(),y.m(e,a)):y&&(y.d(1),y=null),A[4].Quality?M?M.p(A,O):(M=rl(A),M.c(),M.m(e,i)):M&&(M.d(1),M=null),A[4].RoadClass?R?R.p(A,O):(R=ol(A),R.c(),R.m(e,null)):R&&(R.d(1),R=null)},d(A){A&&p(e),f&&f.d(),c&&c.d(),m&&m.d(),g&&g.d(),C&&C.d(),S&&S.d(),y&&y.d(),M&&M.d(),R&&R.d()}}}function Ja(r){let e,l;return e=new oe({props:{$$slots:{default:[Ya,({props:t})=>({4:t}),({props:t})=>t?16:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&48&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Va(r){let e,l;const t=[H(St),{sourceLayer:St},{manageHoverState:!0},{eventsIfTopMost:!0},{paint:{"line-color":r[1],"line-width":4,"line-opacity":ee(1,.5)}},{layout:{visibility:r[0]?"visible":"none"}}];let n={$$slots:{default:[Ja]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",o)),n=new _e({props:{url:`pmtiles://${pe()}/v1/${St}.pmtiles`,$$slots:{default:[Va]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),!l&&i&1&&(l=!0,f.checked=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&33&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}let St="national_cycle_network";function Za(r,e,l){let t,n=K.national_cycle_network,s=ke(St);Z(r,s,u=>l(0,t=u));function o(u){t=u,s.set(t)}return[t,n,s,o]}class Ka extends V{constructor(e){super(),Q(this,e,Za,Qa,J,{})}}function il(r,e,l){const t=r.slice();return t[6]=e[l][0],t[7]=e[l][1],t[8]=e[l][2],t}function Xa(r){let e;return{c(){e=v("OS Pavement widths")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function xa(r){let e;return{c(){e=v(`Public Sector Geospatial Agreement + `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Ua(r){let e,l,t,n,s,o,u;return t=new x({props:{href:"https://data-sustrans-uk.opendata.arcgis.com/",$$slots:{default:[Ea]},$$scope:{ctx:r}}}),o=new De({}),{c(){e=L("p"),l=v("Data from Sustrans about the "),h(t.$$.fragment),n=v(", downloaded on 22/01/2024."),s=T(),h(o.$$.fragment)},m(a,i){$(a,e,i),w(e,l),b(t,e,null),w(e,n),$(a,s,i),b(o,a,i),u=!0},p(a,i){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),t.$set(f)},i(a){u||(_(t.$$.fragment,a),_(o.$$.fragment,a),u=!0)},o(a){d(t.$$.fragment,a),d(o.$$.fragment,a),u=!1},d(a){a&&(p(e),p(s)),k(t),k(o,a)}}}function Wa(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Ua]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&32&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Xn(r){let e,l,t,n=r[4].Desc_+"",s;return{c(){e=L("li"),l=v("Description: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&16&&n!==(n=o[4].Desc_+"")&&j(s,n)},d(o){o&&p(e)}}}function xn(r){let e,l,t,n=r[4].Greenway+"",s;return{c(){e=L("li"),l=v("Is greenway: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&16&&n!==(n=o[4].Greenway+"")&&j(s,n)},d(o){o&&p(e)}}}function el(r){let e,l,t,n=r[4].RouteType+"",s;return{c(){e=L("li"),l=v("Route type: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&16&&n!==(n=o[4].RouteType+"")&&j(s,n)},d(o){o&&p(e)}}}function tl(r){let e,l,t,n=r[4].RouteNo+"",s;return{c(){e=L("li"),l=v("Route number: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&16&&n!==(n=o[4].RouteNo+"")&&j(s,n)},d(o){o&&p(e)}}}function nl(r){let e,l,t,n=r[4].RouteCat+"",s;return{c(){e=L("li"),l=v("Route Category: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&16&&n!==(n=o[4].RouteCat+"")&&j(s,n)},d(o){o&&p(e)}}}function ll(r){let e,l,t,n=r[4].OpenStatus+"",s;return{c(){e=L("li"),l=v("Open Status: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&16&&n!==(n=o[4].OpenStatus+"")&&j(s,n)},d(o){o&&p(e)}}}function sl(r){let e,l,t,n=r[4].Surface+"",s;return{c(){e=L("li"),l=v("Surface: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&16&&n!==(n=o[4].Surface+"")&&j(s,n)},d(o){o&&p(e)}}}function rl(r){let e,l,t,n=r[4].Quality+"",s;return{c(){e=L("li"),l=v("Quality: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&16&&n!==(n=o[4].Quality+"")&&j(s,n)},d(o){o&&p(e)}}}function ol(r){let e,l,t,n=r[4].RoadClass+"",s;return{c(){e=L("li"),l=v("Road Class: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&16&&n!==(n=o[4].RoadClass+"")&&j(s,n)},d(o){o&&p(e)}}}function Ya(r){let e,l,t,n,s,o,u,a,i,f=r[4].Desc_&&Xn(r),c=r[4].Greenway&&xn(r),m=r[4].RouteType&&el(r),g=r[4].RouteNo&&tl(r),C=r[4].RouteCat&&nl(r),S=r[4].OpenStatus&&ll(r),y=r[4].Surface&&sl(r),M=r[4].Quality&&rl(r),R=r[4].RoadClass&&ol(r);return{c(){e=L("ul"),f&&f.c(),l=T(),c&&c.c(),t=T(),m&&m.c(),n=T(),g&&g.c(),s=T(),C&&C.c(),o=T(),S&&S.c(),u=T(),y&&y.c(),a=T(),M&&M.c(),i=T(),R&&R.c()},m(A,O){$(A,e,O),f&&f.m(e,null),w(e,l),c&&c.m(e,null),w(e,t),m&&m.m(e,null),w(e,n),g&&g.m(e,null),w(e,s),C&&C.m(e,null),w(e,o),S&&S.m(e,null),w(e,u),y&&y.m(e,null),w(e,a),M&&M.m(e,null),w(e,i),R&&R.m(e,null)},p(A,O){A[4].Desc_?f?f.p(A,O):(f=Xn(A),f.c(),f.m(e,l)):f&&(f.d(1),f=null),A[4].Greenway?c?c.p(A,O):(c=xn(A),c.c(),c.m(e,t)):c&&(c.d(1),c=null),A[4].RouteType?m?m.p(A,O):(m=el(A),m.c(),m.m(e,n)):m&&(m.d(1),m=null),A[4].RouteNo?g?g.p(A,O):(g=tl(A),g.c(),g.m(e,s)):g&&(g.d(1),g=null),A[4].RouteCat?C?C.p(A,O):(C=nl(A),C.c(),C.m(e,o)):C&&(C.d(1),C=null),A[4].OpenStatus?S?S.p(A,O):(S=ll(A),S.c(),S.m(e,u)):S&&(S.d(1),S=null),A[4].Surface?y?y.p(A,O):(y=sl(A),y.c(),y.m(e,a)):y&&(y.d(1),y=null),A[4].Quality?M?M.p(A,O):(M=rl(A),M.c(),M.m(e,i)):M&&(M.d(1),M=null),A[4].RoadClass?R?R.p(A,O):(R=ol(A),R.c(),R.m(e,null)):R&&(R.d(1),R=null)},d(A){A&&p(e),f&&f.d(),c&&c.d(),m&&m.d(),g&&g.d(),C&&C.d(),S&&S.d(),y&&y.d(),M&&M.d(),R&&R.d()}}}function Ja(r){let e,l;return e=new oe({props:{$$slots:{default:[Ya,({props:t})=>({4:t}),({props:t})=>t?16:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&48&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Va(r){let e,l;const t=[H(St),{sourceLayer:St},{manageHoverState:!0},{eventsIfTopMost:!0},{paint:{"line-color":r[1],"line-width":4,"line-opacity":ee(1,.5)}},{layout:{visibility:r[0]?"visible":"none"}}];let n={$$slots:{default:[Ja]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",o)),n=new _e({props:{url:`pmtiles://${pe()}/v1/${St}.pmtiles`,$$slots:{default:[Va]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),!l&&i&1&&(l=!0,f.checked=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&33&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}let St="national_cycle_network";function Za(r,e,l){let t,n=K.national_cycle_network,s=ke(St);Z(r,s,u=>l(0,t=u));function o(u){t=u,s.set(t)}return[t,n,s,o]}class Ka extends V{constructor(e){super(),Q(this,e,Za,Qa,J,{})}}function il(r,e,l){const t=r.slice();return t[6]=e[l][0],t[7]=e[l][1],t[8]=e[l][2],t}function Xa(r){let e;return{c(){e=v("OS Pavement widths")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function xa(r){let e;return{c(){e=v(`Public Sector Geospatial Agreement `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function ef(r){let e,l,t,n,s,o,u,a,i,f,c;return i=new x({props:{href:"https://www.ordnancesurvey.co.uk/documents/licensing/psga-member-licence.pdf",$$slots:{default:[xa]},$$scope:{ctx:r}}}),{c(){e=L("p"),e.textContent=`This shows the average and minimum pavement width (in meters) from Ordnance Survey. Because the shape of pavement may vary along a road, both average and minimum are reported. Measurements may be available for @@ -85,28 +85,28 @@ import{S as V,i as Q,s as J,e as L,j as G,av as me,k as $,a4 as te,p,aQ as ts,b road. (You won't be able to distinguish left and right though; use the OS Road basemap instead.)`,l=T(),t=L("p"),t.textContent=`Note these measurements are difficult to interpret near dual carriageways (shown as parallel lines).`,n=T(),s=L("p"),s.textContent="Data valid as of 1 January, 2024",o=T(),u=L("p"),a=v(`License: Contains OS data © Crown copyright and database right - 2023. Made available under the `),h(i.$$.fragment),f=v(".")},m(m,g){$(m,e,g),$(m,l,g),$(m,t,g),$(m,n,g),$(m,s,g),$(m,o,g),$(m,u,g),w(u,a),b(i,u,null),w(u,f),c=!0},p(m,g){const C={};g&2048&&(C.$$scope={dirty:g,ctx:m}),i.$set(C)},i(m){c||(_(i.$$.fragment,m),c=!0)},o(m){d(i.$$.fragment,m),c=!1},d(m){m&&(p(e),p(l),p(t),p(n),p(s),p(o),p(u)),k(i)}}}function tf(r){let e,l,t;return l=new ce({props:{$$slots:{default:[ef]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&2048&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function al(r){let e,l;return e=new Be({props:{colorScale:r[1],limits:r[2]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p:te,i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function nf(r){let e,l,t=Jt(r[5].angle+r[8])+"",n;return{c(){e=L("p"),l=new it(!1),n=v(` side of the road: no pavement + 2023. Made available under the `),h(i.$$.fragment),f=v(".")},m(m,g){$(m,e,g),$(m,l,g),$(m,t,g),$(m,n,g),$(m,s,g),$(m,o,g),$(m,u,g),w(u,a),b(i,u,null),w(u,f),c=!0},p(m,g){const C={};g&2048&&(C.$$scope={dirty:g,ctx:m}),i.$set(C)},i(m){c||(_(i.$$.fragment,m),c=!0)},o(m){d(i.$$.fragment,m),c=!1},d(m){m&&(p(e),p(l),p(t),p(n),p(s),p(o),p(u)),k(i)}}}function tf(r){let e,l,t;return l=new ce({props:{$$slots:{default:[ef]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&2048&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function al(r){let e,l;return e=new je({props:{colorScale:r[1],limits:r[2]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p:te,i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function nf(r){let e,l,t=Jt(r[5].angle+r[8])+"",n;return{c(){e=L("p"),l=new it(!1),n=v(` side of the road: no pavement `),l.a=n},m(s,o){$(s,e,o),l.m(t,e),w(e,n)},p(s,o){o&32&&t!==(t=Jt(s[5].angle+s[8])+"")&&l.p(t)},d(s){s&&p(e)}}}function lf(r){let e,l,t=Jt(r[5].angle+r[8])+"",n,s,o=r[6]+"",u,a,i,f=r[7]+"",c,m;return{c(){e=L("p"),l=new it(!1),n=v(` side of the road: `),s=L("b"),u=v(o),a=v(` m average, `),i=L("b"),c=v(f),m=v(` m minimum - `),l.a=n},m(g,C){$(g,e,C),l.m(t,e),w(e,n),w(e,s),w(s,u),w(e,a),w(e,i),w(i,c),w(e,m)},p(g,C){C&32&&t!==(t=Jt(g[5].angle+g[8])+"")&&l.p(t),C&32&&o!==(o=g[6]+"")&&B(u,o),C&32&&f!==(f=g[7]+"")&&B(c,f)},d(g){g&&p(e)}}}function fl(r){let e;function l(s,o){return s[6]?lf:nf}let t=l(r),n=t(r);return{c(){n.c(),e=Me()},m(s,o){n.m(s,o),$(s,e,o)},p(s,o){t===(t=l(s))&&n?n.p(s,o):(n.d(1),n=t(s),n&&(n.c(),n.m(e.parentNode,e)))},d(s){s&&p(e),n.d(s)}}}function sf(r){let e,l=Se([[r[5].left_average,r[5].left_minimum,-90],[r[5].right_average,r[5].right_minimum,90]]),t=[];for(let n=0;n<2;n+=1)t[n]=fl(il(r,l,n));return{c(){for(let n=0;n<2;n+=1)t[n].c();e=Me()},m(n,s){for(let o=0;o<2;o+=1)t[o]&&t[o].m(n,s);$(n,e,s)},p(n,s){if(s&32){l=Se([[n[5].left_average,n[5].left_minimum,-90],[n[5].right_average,n[5].right_minimum,90]]);let o;for(o=0;o<2;o+=1){const u=il(n,l,o);t[o]?t[o].p(u,s):(t[o]=fl(u),t[o].c(),t[o].m(e.parentNode,e))}for(;o<2;o+=1)t[o].d(1)}},d(n){n&&p(e),et(t,n)}}}function rf(r){let e,l;return e=new oe({props:{openOn:"hover",$$slots:{default:[sf,({props:t})=>({5:t}),({props:t})=>t?32:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&2080&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function of(r){let e,l;const t=[H(Ct),{sourceLayer:Ct},{manageHoverState:!0},{eventsIfTopMost:!0},{paint:{"line-color":be(["max",["number",["get","left_average"],0],["number",["get","right_average"],0]],r[2],r[1]),"line-width":Ae,"line-opacity":ee(1,.5)}},{layout:{visibility:r[0]?"visible":"none"}}];let n={$$slots:{default:[rf]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",u));let i=r[0]&&al(r);return s=new _e({props:{url:`pmtiles://${Et()}/v1/${Ct}.pmtiles`,$$slots:{default:[of]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&2048&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0],Y(()=>l=!1)),e.$set(m),f[0]?i?(i.p(f,c),c&1&&_(i,1)):(i=al(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&2049&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let Ct="pavement_widths";function ff(r){let e=Math.floor((r+22.5)%360/45);return["N","NE","E","SE","S","SW","W","NW","N"][e]}function Jt(r){return`${ff(r)} ⬆`}function uf(r,e,l){let t,n=K.sequential_low_to_high,s=[0,2,4,6,8,13],o=ke(Ct);Z(r,o,a=>l(0,t=a));function u(a){t=a,o.set(t)}return[t,n,s,o,u]}class cf extends V{constructor(e){super(),Q(this,e,uf,af,J,{})}}function $f(r){let e;return{c(){e=v("Propensity to Cycle Tool")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function pf(r){let e;return{c(){e=v("the PCT website")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function mf(r){let e;return{c(){e=v("2017 journal article")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function _f(r){let e,l,t,n,s,o,u,a,i,f,c;return u=new x({props:{href:"https://www.pct.bike",$$slots:{default:[pf]},$$scope:{ctx:r}}}),i=new x({props:{href:"https://www.jtlu.org/index.php/jtlu/article/view/862",$$slots:{default:[mf]},$$scope:{ctx:r}}}),{c(){e=L("p"),e.textContent=`The PCT shows major links on the transport network on which there is + `),l.a=n},m(g,C){$(g,e,C),l.m(t,e),w(e,n),w(e,s),w(s,u),w(e,a),w(e,i),w(i,c),w(e,m)},p(g,C){C&32&&t!==(t=Jt(g[5].angle+g[8])+"")&&l.p(t),C&32&&o!==(o=g[6]+"")&&j(u,o),C&32&&f!==(f=g[7]+"")&&j(c,f)},d(g){g&&p(e)}}}function fl(r){let e;function l(s,o){return s[6]?lf:nf}let t=l(r),n=t(r);return{c(){n.c(),e=Me()},m(s,o){n.m(s,o),$(s,e,o)},p(s,o){t===(t=l(s))&&n?n.p(s,o):(n.d(1),n=t(s),n&&(n.c(),n.m(e.parentNode,e)))},d(s){s&&p(e),n.d(s)}}}function sf(r){let e,l=Se([[r[5].left_average,r[5].left_minimum,-90],[r[5].right_average,r[5].right_minimum,90]]),t=[];for(let n=0;n<2;n+=1)t[n]=fl(il(r,l,n));return{c(){for(let n=0;n<2;n+=1)t[n].c();e=Me()},m(n,s){for(let o=0;o<2;o+=1)t[o]&&t[o].m(n,s);$(n,e,s)},p(n,s){if(s&32){l=Se([[n[5].left_average,n[5].left_minimum,-90],[n[5].right_average,n[5].right_minimum,90]]);let o;for(o=0;o<2;o+=1){const u=il(n,l,o);t[o]?t[o].p(u,s):(t[o]=fl(u),t[o].c(),t[o].m(e.parentNode,e))}for(;o<2;o+=1)t[o].d(1)}},d(n){n&&p(e),et(t,n)}}}function rf(r){let e,l;return e=new oe({props:{openOn:"hover",$$slots:{default:[sf,({props:t})=>({5:t}),({props:t})=>t?32:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&2080&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function of(r){let e,l;const t=[H(Ct),{sourceLayer:Ct},{manageHoverState:!0},{eventsIfTopMost:!0},{paint:{"line-color":be(["max",["number",["get","left_average"],0],["number",["get","right_average"],0]],r[2],r[1]),"line-width":Ae,"line-opacity":ee(1,.5)}},{layout:{visibility:r[0]?"visible":"none"}}];let n={$$slots:{default:[rf]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",u));let i=r[0]&&al(r);return s=new _e({props:{url:`pmtiles://${Et()}/v1/${Ct}.pmtiles`,$$slots:{default:[of]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&2048&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0],Y(()=>l=!1)),e.$set(m),f[0]?i?(i.p(f,c),c&1&&_(i,1)):(i=al(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&2049&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let Ct="pavement_widths";function ff(r){let e=Math.floor((r+22.5)%360/45);return["N","NE","E","SE","S","SW","W","NW","N"][e]}function Jt(r){return`${ff(r)} ⬆`}function uf(r,e,l){let t,n=K.sequential_low_to_high,s=[0,2,4,6,8,13],o=ke(Ct);Z(r,o,a=>l(0,t=a));function u(a){t=a,o.set(t)}return[t,n,s,o,u]}class cf extends V{constructor(e){super(),Q(this,e,uf,af,J,{})}}function $f(r){let e;return{c(){e=v("Propensity to Cycle Tool")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function pf(r){let e;return{c(){e=v("the PCT website")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function mf(r){let e;return{c(){e=v("2017 journal article")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function _f(r){let e,l,t,n,s,o,u,a,i,f,c;return u=new x({props:{href:"https://www.pct.bike",$$slots:{default:[pf]},$$scope:{ctx:r}}}),i=new x({props:{href:"https://www.jtlu.org/index.php/jtlu/article/view/862",$$slots:{default:[mf]},$$scope:{ctx:r}}}),{c(){e=L("p"),e.textContent=`The PCT shows major links on the transport network on which there is high latent demand for cycling under scenarios of change, based on the "fastest" routes from CycleStreets. Counts approximate daily rush hour traffic levels.`,l=T(),t=L("p"),t.textContent=`Note this layer uses 2011 census data and outdated OpenStreetMap data. - Please use this layer with caution.`,n=T(),s=L("p"),o=v("See "),h(u.$$.fragment),a=v(" and "),h(i.$$.fragment),f=v(" for details on methodology and data sources.")},m(m,g){$(m,e,g),$(m,l,g),$(m,t,g),$(m,n,g),$(m,s,g),w(s,o),b(u,s,null),w(s,a),b(i,s,null),w(s,f),c=!0},p(m,g){const C={};g&1024&&(C.$$scope={dirty:g,ctx:m}),u.$set(C);const S={};g&1024&&(S.$$scope={dirty:g,ctx:m}),i.$set(S)},i(m){c||(_(u.$$.fragment,m),_(i.$$.fragment,m),c=!0)},o(m){d(u.$$.fragment,m),d(i.$$.fragment,m),c=!1},d(m){m&&(p(e),p(l),p(t),p(n),p(s)),k(u),k(i)}}}function gf(r){let e,l,t;return l=new ce({props:{$$slots:{default:[_f]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&1024&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function ul(r){let e,l,t,n,s,o,u,a;e=new Be({props:{colorScale:r[1],limits:r[2]}});function i(g){r[6](g)}let f={legend:"Trip purpose",choices:[["pct_commute","Commuting"],["pct_school","School"]],inlineSmall:!0};r[0].tripPurpose!==void 0&&(f.value=r[0].tripPurpose),t=new as({props:f}),U.push(()=>W(t,"value",i));function c(g){r[7](g)}let m={label:"Scenario",choices:[["baseline","Baseline (2011)"],["gov_target","Government target (2025)"],["go_dutch","Go Dutch"]]};return r[0].scenario!==void 0&&(m.value=r[0].scenario),o=new ot({props:m}),U.push(()=>W(o,"value",c)),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment),s=T(),h(o.$$.fragment)},m(g,C){b(e,g,C),$(g,l,C),b(t,g,C),$(g,s,C),b(o,g,C),a=!0},p(g,C){const S={};!n&&C&1&&(n=!0,S.value=g[0].tripPurpose,Y(()=>n=!1)),t.$set(S);const y={};!u&&C&1&&(u=!0,y.value=g[0].scenario,Y(()=>u=!1)),o.$set(y)},i(g){a||(_(e.$$.fragment,g),_(t.$$.fragment,g),_(o.$$.fragment,g),a=!0)},o(g){d(e.$$.fragment,g),d(t.$$.fragment,g),d(o.$$.fragment,g),a=!1},d(g){g&&(p(l),p(s)),k(e,g),k(t,g),k(o,g)}}}function df(r){let e,l=r[4](r[9])+"",t;return{c(){e=new it(!1),t=Me(),e.a=t},m(n,s){e.m(l,n,s),$(n,t,s)},p(n,s){s&512&&l!==(l=n[4](n[9])+"")&&e.p(l)},d(n){n&&(p(t),e.d())}}}function hf(r){let e,l;return e=new oe({props:{$$slots:{default:[df,({props:t})=>({9:t}),({props:t})=>t?512:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&1536&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function bf(r){let e,l;const t=[H(Xe),{sourceLayer:Xe},{paint:{"line-color":be(["get",r[0].scenario],r[2],r[1]),"line-width":Ae,"line-opacity":ee(1,.5)}},{layout:{visibility:r[0].show&&r[0].tripPurpose==Xe?"visible":"none"}}];let n={$$slots:{default:[hf]},$$scope:{ctx:r}};for(let s=0;s({9:t}),({props:t})=>t?512:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&1536&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function vf(r){let e,l;const t=[H(rt),{sourceLayer:rt},{manageHoverState:!0},{eventsIfTopMost:!0},{paint:{"line-color":be(["get",r[0].scenario],r[2],r[1]),"line-width":Ae,"line-opacity":ee(1,.5)}},{layout:{visibility:r[0].show&&r[0].tripPurpose==rt?"visible":"none"}}];let n={$$slots:{default:[wf]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",i));let c=r[0].show&&ul(r);return s=new _e({props:{url:`pmtiles://${pe()}/v1/${Xe}.pmtiles`,$$slots:{default:[bf]},$$scope:{ctx:r}}}),u=new _e({props:{url:`pmtiles://${pe()}/v1/${rt}.pmtiles`,$$slots:{default:[vf]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),c&&c.c(),n=T(),h(s.$$.fragment),o=T(),h(u.$$.fragment)},m(m,g){b(e,m,g),$(m,t,g),c&&c.m(m,g),$(m,n,g),b(s,m,g),$(m,o,g),b(u,m,g),a=!0},p(m,[g]){const C={};g&1024&&(C.$$scope={dirty:g,ctx:m}),!l&&g&1&&(l=!0,C.checked=m[0].show,Y(()=>l=!1)),e.$set(C),m[0].show?c?(c.p(m,g),g&1&&_(c,1)):(c=ul(m),c.c(),_(c,1),c.m(n.parentNode,n)):c&&(ae(),d(c,1,1,()=>{c=null}),fe());const S={};g&1025&&(S.$$scope={dirty:g,ctx:m}),s.$set(S);const y={};g&1025&&(y.$$scope={dirty:g,ctx:m}),u.$set(y)},i(m){a||(_(e.$$.fragment,m),_(c),_(s.$$.fragment,m),_(u.$$.fragment,m),a=!0)},o(m){d(e.$$.fragment,m),d(c),d(s.$$.fragment,m),d(u.$$.fragment,m),a=!1},d(m){m&&(p(t),p(n),p(o)),k(e,m),c&&c.d(m),k(s,m),k(u,m)}}}let Xe="pct_commute",rt="pct_school";function Sf(r){return r.show?`${r.tripPurpose}/${r.scenario}`:null}function Cf(r){let[e,l]=r.split("/");return{show:!0,tripPurpose:e,scenario:l}}function Lf(r,e,l){let t,n=K.sequential_low_to_high,s=[0,50,100,500,1e3,2e3],u=_t("pct",{show:!1,tripPurpose:Xe,scenario:"baseline"},Sf,Cf);Z(r,u,m=>l(0,t=m));function a(m){let g=m.baseline,C=m.gov_target,S=m.go_dutch,y=`

    Trip purpose: ${t.tripPurpose==Xe?"commuting":"school"}

    `;if(y+=`

    Baseline (2011): ${g.toLocaleString()}

    `,g==0)y+=`

    Government target (2025): ${C.toLocaleString()}

    `,y+=`

    Go Dutch: ${S.toLocaleString()}

    `;else{let M=(C/g).toFixed(1),R=(S/g).toFixed(1);y+=`

    Government target (2025): ${C.toLocaleString()} (${M}x of baseline)

    `,y+=`

    Go Dutch: ${S.toLocaleString()} (${R}x of baseline)

    `}return y}function i(m){r.$$.not_equal(t.show,m)&&(t.show=m,u.set(t))}function f(m){r.$$.not_equal(t.tripPurpose,m)&&(t.tripPurpose=m,u.set(t))}function c(m){r.$$.not_equal(t.scenario,m)&&(t.scenario=m,u.set(t))}return[t,n,s,u,a,i,f,c]}class Tf extends V{constructor(e){super(),Q(this,e,Lf,yf,J,{})}}function Mf(r){let e;return{c(){e=v("OS Speeds")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Nf(r){let e;return{c(){e=v("Basemap")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Pf(r){let e;return{c(){e=v(`Public Sector Geospatial Agreement + Please use this layer with caution.`,n=T(),s=L("p"),o=v("See "),h(u.$$.fragment),a=v(" and "),h(i.$$.fragment),f=v(" for details on methodology and data sources.")},m(m,g){$(m,e,g),$(m,l,g),$(m,t,g),$(m,n,g),$(m,s,g),w(s,o),b(u,s,null),w(s,a),b(i,s,null),w(s,f),c=!0},p(m,g){const C={};g&1024&&(C.$$scope={dirty:g,ctx:m}),u.$set(C);const S={};g&1024&&(S.$$scope={dirty:g,ctx:m}),i.$set(S)},i(m){c||(_(u.$$.fragment,m),_(i.$$.fragment,m),c=!0)},o(m){d(u.$$.fragment,m),d(i.$$.fragment,m),c=!1},d(m){m&&(p(e),p(l),p(t),p(n),p(s)),k(u),k(i)}}}function gf(r){let e,l,t;return l=new ce({props:{$$slots:{default:[_f]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&1024&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function ul(r){let e,l,t,n,s,o,u,a;e=new je({props:{colorScale:r[1],limits:r[2]}});function i(g){r[6](g)}let f={legend:"Trip purpose",choices:[["pct_commute","Commuting"],["pct_school","School"]],inlineSmall:!0};r[0].tripPurpose!==void 0&&(f.value=r[0].tripPurpose),t=new as({props:f}),U.push(()=>W(t,"value",i));function c(g){r[7](g)}let m={label:"Scenario",choices:[["baseline","Baseline (2011)"],["gov_target","Government target (2025)"],["go_dutch","Go Dutch"]]};return r[0].scenario!==void 0&&(m.value=r[0].scenario),o=new ot({props:m}),U.push(()=>W(o,"value",c)),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment),s=T(),h(o.$$.fragment)},m(g,C){b(e,g,C),$(g,l,C),b(t,g,C),$(g,s,C),b(o,g,C),a=!0},p(g,C){const S={};!n&&C&1&&(n=!0,S.value=g[0].tripPurpose,Y(()=>n=!1)),t.$set(S);const y={};!u&&C&1&&(u=!0,y.value=g[0].scenario,Y(()=>u=!1)),o.$set(y)},i(g){a||(_(e.$$.fragment,g),_(t.$$.fragment,g),_(o.$$.fragment,g),a=!0)},o(g){d(e.$$.fragment,g),d(t.$$.fragment,g),d(o.$$.fragment,g),a=!1},d(g){g&&(p(l),p(s)),k(e,g),k(t,g),k(o,g)}}}function df(r){let e,l=r[4](r[9])+"",t;return{c(){e=new it(!1),t=Me(),e.a=t},m(n,s){e.m(l,n,s),$(n,t,s)},p(n,s){s&512&&l!==(l=n[4](n[9])+"")&&e.p(l)},d(n){n&&(p(t),e.d())}}}function hf(r){let e,l;return e=new oe({props:{$$slots:{default:[df,({props:t})=>({9:t}),({props:t})=>t?512:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&1536&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function bf(r){let e,l;const t=[H(Xe),{sourceLayer:Xe},{paint:{"line-color":be(["get",r[0].scenario],r[2],r[1]),"line-width":Ae,"line-opacity":ee(1,.5)}},{layout:{visibility:r[0].show&&r[0].tripPurpose==Xe?"visible":"none"}}];let n={$$slots:{default:[hf]},$$scope:{ctx:r}};for(let s=0;s({9:t}),({props:t})=>t?512:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&1536&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function vf(r){let e,l;const t=[H(rt),{sourceLayer:rt},{manageHoverState:!0},{eventsIfTopMost:!0},{paint:{"line-color":be(["get",r[0].scenario],r[2],r[1]),"line-width":Ae,"line-opacity":ee(1,.5)}},{layout:{visibility:r[0].show&&r[0].tripPurpose==rt?"visible":"none"}}];let n={$$slots:{default:[wf]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",i));let c=r[0].show&&ul(r);return s=new _e({props:{url:`pmtiles://${pe()}/v1/${Xe}.pmtiles`,$$slots:{default:[bf]},$$scope:{ctx:r}}}),u=new _e({props:{url:`pmtiles://${pe()}/v1/${rt}.pmtiles`,$$slots:{default:[vf]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),c&&c.c(),n=T(),h(s.$$.fragment),o=T(),h(u.$$.fragment)},m(m,g){b(e,m,g),$(m,t,g),c&&c.m(m,g),$(m,n,g),b(s,m,g),$(m,o,g),b(u,m,g),a=!0},p(m,[g]){const C={};g&1024&&(C.$$scope={dirty:g,ctx:m}),!l&&g&1&&(l=!0,C.checked=m[0].show,Y(()=>l=!1)),e.$set(C),m[0].show?c?(c.p(m,g),g&1&&_(c,1)):(c=ul(m),c.c(),_(c,1),c.m(n.parentNode,n)):c&&(ae(),d(c,1,1,()=>{c=null}),fe());const S={};g&1025&&(S.$$scope={dirty:g,ctx:m}),s.$set(S);const y={};g&1025&&(y.$$scope={dirty:g,ctx:m}),u.$set(y)},i(m){a||(_(e.$$.fragment,m),_(c),_(s.$$.fragment,m),_(u.$$.fragment,m),a=!0)},o(m){d(e.$$.fragment,m),d(c),d(s.$$.fragment,m),d(u.$$.fragment,m),a=!1},d(m){m&&(p(t),p(n),p(o)),k(e,m),c&&c.d(m),k(s,m),k(u,m)}}}let Xe="pct_commute",rt="pct_school";function Sf(r){return r.show?`${r.tripPurpose}/${r.scenario}`:null}function Cf(r){let[e,l]=r.split("/");return{show:!0,tripPurpose:e,scenario:l}}function Lf(r,e,l){let t,n=K.sequential_low_to_high,s=[0,50,100,500,1e3,2e3],u=_t("pct",{show:!1,tripPurpose:Xe,scenario:"baseline"},Sf,Cf);Z(r,u,m=>l(0,t=m));function a(m){let g=m.baseline,C=m.gov_target,S=m.go_dutch,y=`

    Trip purpose: ${t.tripPurpose==Xe?"commuting":"school"}

    `;if(y+=`

    Baseline (2011): ${g.toLocaleString()}

    `,g==0)y+=`

    Government target (2025): ${C.toLocaleString()}

    `,y+=`

    Go Dutch: ${S.toLocaleString()}

    `;else{let M=(C/g).toFixed(1),R=(S/g).toFixed(1);y+=`

    Government target (2025): ${C.toLocaleString()} (${M}x of baseline)

    `,y+=`

    Go Dutch: ${S.toLocaleString()} (${R}x of baseline)

    `}return y}function i(m){r.$$.not_equal(t.show,m)&&(t.show=m,u.set(t))}function f(m){r.$$.not_equal(t.tripPurpose,m)&&(t.tripPurpose=m,u.set(t))}function c(m){r.$$.not_equal(t.scenario,m)&&(t.scenario=m,u.set(t))}return[t,n,s,u,a,i,f,c]}class Tf extends V{constructor(e){super(),Q(this,e,Lf,yf,J,{})}}function Mf(r){let e;return{c(){e=v("OS Speeds")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Nf(r){let e;return{c(){e=v("Basemap")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Pf(r){let e;return{c(){e=v(`Public Sector Geospatial Agreement `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Of(r){let e,l,t,n,s,o,u,a,i,f,c,m;return t=new x({props:{href:"https://basemap.co.uk/speed-data",$$slots:{default:[Nf]},$$scope:{ctx:r}}}),f=new x({props:{href:"https://www.ordnancesurvey.co.uk/documents/licensing/psga-member-licence.pdf",$$slots:{default:[Pf]},$$scope:{ctx:r}}}),{c(){e=L("p"),l=v("The average speed data is collected over a six-month period by "),h(t.$$.fragment),n=v(` from 135,000 vehicle telematic systems and provided through Ordnance Survey. The averages are grouped by different time periods for weekdays and weekends. This map shows the highest average.`),s=T(),o=L("p"),o.textContent="Data valid as of 1 September, 2023",u=T(),a=L("p"),i=v(`License: Contains OS data © Crown copyright and database right - 2023. Made available under the `),h(f.$$.fragment),c=v(".")},m(g,C){$(g,e,C),w(e,l),b(t,e,null),w(e,n),$(g,s,C),$(g,o,C),$(g,u,C),$(g,a,C),w(a,i),b(f,a,null),w(a,c),m=!0},p(g,C){const S={};C&512&&(S.$$scope={dirty:C,ctx:g}),t.$set(S);const y={};C&512&&(y.$$scope={dirty:C,ctx:g}),f.$set(y)},i(g){m||(_(t.$$.fragment,g),_(f.$$.fragment,g),m=!0)},o(g){d(t.$$.fragment,g),d(f.$$.fragment,g),m=!1},d(g){g&&(p(e),p(s),p(o),p(u),p(a)),k(t),k(f)}}}function If(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Of]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&512&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function cl(r){let e,l,t,n,s;e=new Be({props:{colorScale:r[1],limits:r[2]}});function o(a){r[6](a)}let u={legend:"Show speed types",choices:[["indicative_mph","Posted speed limit"],["highest_mph","Highest measured average speed"]],inlineSmall:!0};return r[0].kind!==void 0&&(u.value=r[0].kind),t=new as({props:u}),U.push(()=>W(t,"value",o)),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment)},m(a,i){b(e,a,i),$(a,l,i),b(t,a,i),s=!0},p(a,i){const f={};!n&&i&1&&(n=!0,f.value=a[0].kind,Y(()=>n=!1)),t.$set(f)},i(a){s||(_(e.$$.fragment,a),_(t.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(t.$$.fragment,a),s=!1},d(a){a&&p(l),k(e,a),k(t,a)}}}function Rf(r){let e,l,t=r[8].indicative_mph+"",n,s,o,u,a,i=r[8].highest_mph+"",f,c,m=r[4][r[8].highest_description]+"",g,C;return{c(){e=L("p"),l=v("Posted speed limit: "),n=v(t),s=v(" mph"),o=T(),u=L("p"),a=v("Highest average speed: "),f=v(i),c=v(" mph (during "),g=v(m),C=v(")")},m(S,y){$(S,e,y),w(e,l),w(e,n),w(e,s),$(S,o,y),$(S,u,y),w(u,a),w(u,f),w(u,c),w(u,g),w(u,C)},p(S,y){y&256&&t!==(t=S[8].indicative_mph+"")&&B(n,t),y&256&&i!==(i=S[8].highest_mph+"")&&B(f,i),y&256&&m!==(m=S[4][S[8].highest_description]+"")&&B(g,m)},d(S){S&&(p(e),p(o),p(u))}}}function Df(r){let e,l;return e=new oe({props:{$$slots:{default:[Rf,({props:t})=>({8:t}),({props:t})=>t?256:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&768&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Af(r){let e,l;const t=[H(Lt),{sourceLayer:Lt},{manageHoverState:!0},{eventsIfTopMost:!0},{paint:{"line-color":be(["get",r[0].kind],r[2],r[1]),"line-width":Ae,"line-opacity":ee(1,.5)}},{layout:{visibility:r[0].show?"visible":"none"}}];let n={$$slots:{default:[Df]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",u));let i=r[0].show&&cl(r);return s=new _e({props:{url:`pmtiles://${Et()}/v1/${Lt}.pmtiles`,$$slots:{default:[Af]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&512&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0].show,Y(()=>l=!1)),e.$set(m),f[0].show?i?(i.p(f,c),c&1&&_(i,1)):(i=cl(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&513&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let Lt="road_speeds";function qf(r){return r.show?r.kind:null}function zf(r){return{show:!0,kind:r}}function Bf(r,e,l){let t,n=K.sequential_low_to_high,s=[0,20,30,40,50,90],u=_t(Lt,{show:!1,kind:"indicative_mph"},qf,zf);Z(r,u,c=>l(0,t=c));let a={mf4to7:"Monday-Friday 4-7am",mf7to9:"Monday-Friday 7-9am",mf9to12:"Monday-Friday 9am-12pm",mf12to14:"Monday-Friday 12-2pm",mf14to16:"Monday-Friday 2-4pm",mf16to19:"Monday-Friday 4-7pm",mf19to22:"Monday-Friday 7-10pm",mf22to4:"Monday-Friday 10pm-4am",ss4to7:"Saturday-Sunday 4-7am",ss7to10:"Saturday-Sunday 7-10am",ss10to14:"Saturday-Sunday 10am-2pm",ss14to19:"Saturday-Sunday 2-7pm",ss19to22:"Saturday-Sunday 7-10pm",ss22to4:"Saturday-Sunday 10pm-4am"};function i(c){r.$$.not_equal(t.show,c)&&(t.show=c,u.set(t))}function f(c){r.$$.not_equal(t.kind,c)&&(t.kind=c,u.set(t))}return[t,n,s,u,a,i,f]}class jf extends V{constructor(e){super(),Q(this,e,Bf,Ff,J,{})}}function Hf(r){let e;return{c(){e=v("OS Road widths")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Gf(r){let e;return{c(){e=v(`Public Sector Geospatial Agreement + 2023. Made available under the `),h(f.$$.fragment),c=v(".")},m(g,C){$(g,e,C),w(e,l),b(t,e,null),w(e,n),$(g,s,C),$(g,o,C),$(g,u,C),$(g,a,C),w(a,i),b(f,a,null),w(a,c),m=!0},p(g,C){const S={};C&512&&(S.$$scope={dirty:C,ctx:g}),t.$set(S);const y={};C&512&&(y.$$scope={dirty:C,ctx:g}),f.$set(y)},i(g){m||(_(t.$$.fragment,g),_(f.$$.fragment,g),m=!0)},o(g){d(t.$$.fragment,g),d(f.$$.fragment,g),m=!1},d(g){g&&(p(e),p(s),p(o),p(u),p(a)),k(t),k(f)}}}function If(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Of]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&512&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function cl(r){let e,l,t,n,s;e=new je({props:{colorScale:r[1],limits:r[2]}});function o(a){r[6](a)}let u={legend:"Show speed types",choices:[["indicative_mph","Posted speed limit"],["highest_mph","Highest measured average speed"]],inlineSmall:!0};return r[0].kind!==void 0&&(u.value=r[0].kind),t=new as({props:u}),U.push(()=>W(t,"value",o)),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment)},m(a,i){b(e,a,i),$(a,l,i),b(t,a,i),s=!0},p(a,i){const f={};!n&&i&1&&(n=!0,f.value=a[0].kind,Y(()=>n=!1)),t.$set(f)},i(a){s||(_(e.$$.fragment,a),_(t.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(t.$$.fragment,a),s=!1},d(a){a&&p(l),k(e,a),k(t,a)}}}function Rf(r){let e,l,t=r[8].indicative_mph+"",n,s,o,u,a,i=r[8].highest_mph+"",f,c,m=r[4][r[8].highest_description]+"",g,C;return{c(){e=L("p"),l=v("Posted speed limit: "),n=v(t),s=v(" mph"),o=T(),u=L("p"),a=v("Highest average speed: "),f=v(i),c=v(" mph (during "),g=v(m),C=v(")")},m(S,y){$(S,e,y),w(e,l),w(e,n),w(e,s),$(S,o,y),$(S,u,y),w(u,a),w(u,f),w(u,c),w(u,g),w(u,C)},p(S,y){y&256&&t!==(t=S[8].indicative_mph+"")&&j(n,t),y&256&&i!==(i=S[8].highest_mph+"")&&j(f,i),y&256&&m!==(m=S[4][S[8].highest_description]+"")&&j(g,m)},d(S){S&&(p(e),p(o),p(u))}}}function Df(r){let e,l;return e=new oe({props:{$$slots:{default:[Rf,({props:t})=>({8:t}),({props:t})=>t?256:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&768&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Af(r){let e,l;const t=[H(Lt),{sourceLayer:Lt},{manageHoverState:!0},{eventsIfTopMost:!0},{paint:{"line-color":be(["get",r[0].kind],r[2],r[1]),"line-width":Ae,"line-opacity":ee(1,.5)}},{layout:{visibility:r[0].show?"visible":"none"}}];let n={$$slots:{default:[Df]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",u));let i=r[0].show&&cl(r);return s=new _e({props:{url:`pmtiles://${Et()}/v1/${Lt}.pmtiles`,$$slots:{default:[Af]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&512&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0].show,Y(()=>l=!1)),e.$set(m),f[0].show?i?(i.p(f,c),c&1&&_(i,1)):(i=cl(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&513&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let Lt="road_speeds";function qf(r){return r.show?r.kind:null}function zf(r){return{show:!0,kind:r}}function jf(r,e,l){let t,n=K.sequential_low_to_high,s=[0,20,30,40,50,90],u=_t(Lt,{show:!1,kind:"indicative_mph"},qf,zf);Z(r,u,c=>l(0,t=c));let a={mf4to7:"Monday-Friday 4-7am",mf7to9:"Monday-Friday 7-9am",mf9to12:"Monday-Friday 9am-12pm",mf12to14:"Monday-Friday 12-2pm",mf14to16:"Monday-Friday 2-4pm",mf16to19:"Monday-Friday 4-7pm",mf19to22:"Monday-Friday 7-10pm",mf22to4:"Monday-Friday 10pm-4am",ss4to7:"Saturday-Sunday 4-7am",ss7to10:"Saturday-Sunday 7-10am",ss10to14:"Saturday-Sunday 10am-2pm",ss14to19:"Saturday-Sunday 2-7pm",ss19to22:"Saturday-Sunday 7-10pm",ss22to4:"Saturday-Sunday 10pm-4am"};function i(c){r.$$.not_equal(t.show,c)&&(t.show=c,u.set(t))}function f(c){r.$$.not_equal(t.kind,c)&&(t.kind=c,u.set(t))}return[t,n,s,u,a,i,f]}class Bf extends V{constructor(e){super(),Q(this,e,jf,Ff,J,{})}}function Hf(r){let e;return{c(){e=v("OS Road widths")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Gf(r){let e;return{c(){e=v(`Public Sector Geospatial Agreement `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Ef(r){let e,l,t,n,s,o,u,a,i;return u=new x({props:{href:"https://www.ordnancesurvey.co.uk/documents/licensing/psga-member-licence.pdf",$$slots:{default:[Gf]},$$scope:{ctx:r}}}),{c(){e=L("p"),e.textContent=`This is average and minimum road carriageway width (in meters) from Ordnance Survey. The coloring shows the average width, and the line thickness has no meaning. Be careful interpreting the data near dual carriageways and crossing islands.`,l=T(),t=L("p"),t.textContent="Data valid as of 1 September, 2023",n=T(),s=L("p"),o=v(`License: Contains OS data © Crown copyright and database right - 2023. Made available under the `),h(u.$$.fragment),a=v(".")},m(f,c){$(f,e,c),$(f,l,c),$(f,t,c),$(f,n,c),$(f,s,c),w(s,o),b(u,s,null),w(s,a),i=!0},p(f,c){const m={};c&64&&(m.$$scope={dirty:c,ctx:f}),u.$set(m)},i(f){i||(_(u.$$.fragment,f),i=!0)},o(f){d(u.$$.fragment,f),i=!1},d(f){f&&(p(e),p(l),p(t),p(n),p(s)),k(u)}}}function Uf(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Ef]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&64&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function $l(r){let e,l;return e=new Be({props:{colorScale:r[1],limits:r[2]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p:te,i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Wf(r){let e,l,t,n=r[5].average+"",s,o,u,a,i,f,c=r[5].minimum+"",m,g;return{c(){e=L("p"),l=v("Average width: "),t=L("b"),s=v(n),o=v(` + 2023. Made available under the `),h(u.$$.fragment),a=v(".")},m(f,c){$(f,e,c),$(f,l,c),$(f,t,c),$(f,n,c),$(f,s,c),w(s,o),b(u,s,null),w(s,a),i=!0},p(f,c){const m={};c&64&&(m.$$scope={dirty:c,ctx:f}),u.$set(m)},i(f){i||(_(u.$$.fragment,f),i=!0)},o(f){d(u.$$.fragment,f),i=!1},d(f){f&&(p(e),p(l),p(t),p(n),p(s)),k(u)}}}function Uf(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Ef]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&64&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function $l(r){let e,l;return e=new je({props:{colorScale:r[1],limits:r[2]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p:te,i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Wf(r){let e,l,t,n=r[5].average+"",s,o,u,a,i,f,c=r[5].minimum+"",m,g;return{c(){e=L("p"),l=v("Average width: "),t=L("b"),s=v(n),o=v(` meters`),u=T(),a=L("p"),i=v("Minimum width: "),f=L("b"),m=v(c),g=v(` - meters`)},m(C,S){$(C,e,S),w(e,l),w(e,t),w(t,s),w(e,o),$(C,u,S),$(C,a,S),w(a,i),w(a,f),w(f,m),w(a,g)},p(C,S){S&32&&n!==(n=C[5].average+"")&&B(s,n),S&32&&c!==(c=C[5].minimum+"")&&B(m,c)},d(C){C&&(p(e),p(u),p(a))}}}function Yf(r){let e,l;return e=new oe({props:{$$slots:{default:[Wf,({props:t})=>({5:t}),({props:t})=>t?32:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&96&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Jf(r){let e,l;const t=[H(Tt),{sourceLayer:Tt},{manageHoverState:!0},{eventsIfTopMost:!0},{paint:{"line-color":be(["get","average"],r[2],r[1]),"line-width":Ae,"line-opacity":ee(1,.5)}},{layout:{visibility:r[0]?"visible":"none"}}];let n={$$slots:{default:[Yf]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",u));let i=r[0]&&$l(r);return s=new _e({props:{url:`pmtiles://${Et()}/v1/${Tt}.pmtiles`,$$slots:{default:[Jf]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&64&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0],Y(()=>l=!1)),e.$set(m),f[0]?i?(i.p(f,c),c&1&&_(i,1)):(i=$l(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&65&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let Tt="road_widths";function Qf(r,e,l){let t,n=K.sequential_low_to_high,s=[0,5,10,15,20,100],o=ke(Tt);Z(r,o,a=>l(0,t=a));function u(a){t=a,o.set(t)}return[t,n,s,o,u]}class Zf extends V{constructor(e){super(),Q(this,e,Qf,Vf,J,{})}}function Kf(r){let e,l,t;return e=new Re({props:{color:K.trams}}),{c(){h(e.$$.fragment),l=v(` + meters`)},m(C,S){$(C,e,S),w(e,l),w(e,t),w(t,s),w(e,o),$(C,u,S),$(C,a,S),w(a,i),w(a,f),w(f,m),w(a,g)},p(C,S){S&32&&n!==(n=C[5].average+"")&&j(s,n),S&32&&c!==(c=C[5].minimum+"")&&j(m,c)},d(C){C&&(p(e),p(u),p(a))}}}function Yf(r){let e,l;return e=new oe({props:{$$slots:{default:[Wf,({props:t})=>({5:t}),({props:t})=>t?32:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&96&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Jf(r){let e,l;const t=[H(Tt),{sourceLayer:Tt},{manageHoverState:!0},{eventsIfTopMost:!0},{paint:{"line-color":be(["get","average"],r[2],r[1]),"line-width":Ae,"line-opacity":ee(1,.5)}},{layout:{visibility:r[0]?"visible":"none"}}];let n={$$slots:{default:[Yf]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",u));let i=r[0]&&$l(r);return s=new _e({props:{url:`pmtiles://${Et()}/v1/${Tt}.pmtiles`,$$slots:{default:[Jf]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&64&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0],Y(()=>l=!1)),e.$set(m),f[0]?i?(i.p(f,c),c&1&&_(i,1)):(i=$l(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&65&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let Tt="road_widths";function Qf(r,e,l){let t,n=K.sequential_low_to_high,s=[0,5,10,15,20,100],o=ke(Tt);Z(r,o,a=>l(0,t=a));function u(a){t=a,o.set(t)}return[t,n,s,o,u]}class Zf extends V{constructor(e){super(),Q(this,e,Qf,Vf,J,{})}}function Kf(r){let e,l,t;return e=new Re({props:{color:K.trams}}),{c(){h(e.$$.fragment),l=v(` Trams`)},m(n,s){b(e,n,s),$(n,l,s),t=!0},p:te,i(n){t||(_(e.$$.fragment,n),t=!0)},o(n){d(e.$$.fragment,n),t=!1},d(n){n&&p(l),k(e,n)}}}function Xf(r){let e,l,t,n;return t=new Ke({}),{c(){e=L("p"),e.textContent=`This shows all trams and light rail lines, according to OpenStreetMap (as of 7 February 2024). When these are close to a scheme, interactions between the modes must be designed carefully.`,l=T(),h(t.$$.fragment)},m(s,o){$(s,e,o),$(s,l,o),b(t,s,o),n=!0},p:te,i(s){n||(_(t.$$.fragment,s),n=!0)},o(s){d(t.$$.fragment,s),n=!1},d(s){s&&(p(e),p(l)),k(t,s)}}}function xf(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Xf]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&8&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function eu(r){let e,l;const t=[H(Mt),{sourceLayer:Mt},{paint:{"line-color":K.trams,"line-width":5,"line-opacity":ee(1,.5)}},{layout:{visibility:r[0]?"visible":"none"}},{manageHoverState:!0},{eventsIfTopMost:!0},{hoverCursor:"pointer"}];let n={};for(let s=0;sW(e,"checked",o)),n=new _e({props:{url:`pmtiles://${pe()}/v1/${Mt}.pmtiles`,$$slots:{default:[eu]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&8&&(f.$$scope={dirty:i,ctx:a}),!l&&i&1&&(l=!0,f.checked=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&9&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}let Mt="trams";function nu(r){window.open(`http://openstreetmap.org/way/${r.detail.features[0].properties.osm_id}`,"_blank")}function lu(r,e,l){let t,n=ke(Mt);Z(r,n,o=>l(0,t=o));function s(o){t=o,n.set(t)}return[t,n,s]}class su extends V{constructor(e){super(),Q(this,e,lu,tu,J,{})}}function ru(r){let e;return{c(){e=v("Bus stops")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function ou(r){let e;return{c(){e=v(`Bus Open Data Service @@ -118,41 +118,41 @@ import{S as V,i as Q,s as J,e as L,j as G,av as me,k as $,a4 as te,p,aQ as ts,b peak hour might occur from 8:25 to 9:25,for example.`),s=T(),o=L("p"),o.textContent=`There are known limitations with this layer, so please use caution when using these numbers. Some stops may not be shown at all. Frequency could be over- or under-counted, due to exceptions to the regular daily - schedule of a service.`,u=T(),h(a.$$.fragment)},m(f,c){$(f,e,c),w(e,l),b(t,e,null),w(e,n),$(f,s,c),$(f,o,c),$(f,u,c),b(a,f,c),i=!0},p(f,c){const m={};c&64&&(m.$$scope={dirty:c,ctx:f}),t.$set(m)},i(f){i||(_(t.$$.fragment,f),_(a.$$.fragment,f),i=!0)},o(f){d(t.$$.fragment,f),d(a.$$.fragment,f),i=!1},d(f){f&&(p(e),p(s),p(o),p(u)),k(t),k(a,f)}}}function au(r){let e,l,t;return l=new ce({props:{$$slots:{default:[iu]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&64&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function pl(r){let e,l,t,n;return t=new Be({props:{colorScale:r[1],limits:r[2]}}),{c(){e=L("p"),e.textContent="Peak hourly frequency:",l=T(),h(t.$$.fragment)},m(s,o){$(s,e,o),$(s,l,o),b(t,s,o),n=!0},p:te,i(s){n||(_(t.$$.fragment,s),n=!0)},o(s){d(t.$$.fragment,s),n=!1},d(s){s&&(p(e),p(l)),k(t,s)}}}function fu(r){let e,l,t,n=r[5].stop_name+"",s,o,u,a,i,f=r[5].peak+"",c,m,g,C,S,y=r[5].peak_description+"",M,R,A,O,N,I=r[5].total+"",F,P,z=r[5].total_description+"",X,E;return{c(){e=L("p"),l=v("Stop name: "),t=L("b"),s=v(n),o=T(),u=L("p"),a=v("Peak: "),i=L("b"),c=v(f),m=v(` + schedule of a service.`,u=T(),h(a.$$.fragment)},m(f,c){$(f,e,c),w(e,l),b(t,e,null),w(e,n),$(f,s,c),$(f,o,c),$(f,u,c),b(a,f,c),i=!0},p(f,c){const m={};c&64&&(m.$$scope={dirty:c,ctx:f}),t.$set(m)},i(f){i||(_(t.$$.fragment,f),_(a.$$.fragment,f),i=!0)},o(f){d(t.$$.fragment,f),d(a.$$.fragment,f),i=!1},d(f){f&&(p(e),p(s),p(o),p(u)),k(t),k(a,f)}}}function au(r){let e,l,t;return l=new ce({props:{$$slots:{default:[iu]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&64&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function pl(r){let e,l,t,n;return t=new je({props:{colorScale:r[1],limits:r[2]}}),{c(){e=L("p"),e.textContent="Peak hourly frequency:",l=T(),h(t.$$.fragment)},m(s,o){$(s,e,o),$(s,l,o),b(t,s,o),n=!0},p:te,i(s){n||(_(t.$$.fragment,s),n=!0)},o(s){d(t.$$.fragment,s),n=!1},d(s){s&&(p(e),p(l)),k(t,s)}}}function fu(r){let e,l,t,n=r[5].stop_name+"",s,o,u,a,i,f=r[5].peak+"",c,m,g,C,S,y=r[5].peak_description+"",M,R,A,O,N,I=r[5].total+"",F,P,z=r[5].total_description+"",X,E;return{c(){e=L("p"),l=v("Stop name: "),t=L("b"),s=v(n),o=T(),u=L("p"),a=v("Peak: "),i=L("b"),c=v(f),m=v(` buses during the busiest hour of any day`),g=T(),C=L("p"),S=v("The peak hour is "),M=v(y),R=T(),A=L("p"),O=v("Total buses per day: "),N=L("b"),F=v(I),P=v(` - (for `),X=v(z),E=v(", the busiest day of the week)")},m(q,D){$(q,e,D),w(e,l),w(e,t),w(t,s),$(q,o,D),$(q,u,D),w(u,a),w(u,i),w(i,c),w(u,m),$(q,g,D),$(q,C,D),w(C,S),w(C,M),$(q,R,D),$(q,A,D),w(A,O),w(A,N),w(N,F),w(A,P),w(A,X),w(A,E)},p(q,D){D&32&&n!==(n=q[5].stop_name+"")&&B(s,n),D&32&&f!==(f=q[5].peak+"")&&B(c,f),D&32&&y!==(y=q[5].peak_description+"")&&B(M,y),D&32&&I!==(I=q[5].total+"")&&B(F,I),D&32&&z!==(z=q[5].total_description+"")&&B(X,z)},d(q){q&&(p(e),p(o),p(u),p(g),p(C),p(R),p(A))}}}function uu(r){let e,l;return e=new oe({props:{$$slots:{default:[fu,({props:t})=>({5:t}),({props:t})=>t?32:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&96&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function cu(r){let e,l;const t=[H(Nt),{sourceLayer:Nt},{paint:{"circle-color":be(["get","peak"],r[2],r[1]),"circle-radius":["interpolate",["linear"],["zoom"],1,2,8,3,13,10]}},{layout:{visibility:r[0]?"visible":"none"}},{manageHoverState:!0},{eventsIfTopMost:!0}];let n={$$slots:{default:[uu]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",u));let i=r[0]&&pl(r);return s=new _e({props:{url:`pmtiles://${pe()}/v1/${Nt}.pmtiles`,$$slots:{default:[cu]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&64&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0],Y(()=>l=!1)),e.$set(m),f[0]?i?(i.p(f,c),c&1&&_(i,1)):(i=pl(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&65&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let Nt="bus_stops";function pu(r,e,l){let t,n=K.sequential_low_to_high,s=[0,3,10,20,30,100],o=ke(Nt);Z(r,o,a=>l(0,t=a));function u(a){t=a,o.set(t)}return[t,n,s,o,u]}class mu extends V{constructor(e){super(),Q(this,e,pu,$u,J,{})}}function _u(r){let e;return{c(){e=v("Crossings")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function gu(r){let e;return{c(){e=v("crossing")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function du(r){let e,l,t,n,s,o,u;return t=new x({props:{href:"https://wiki.openstreetmap.org/wiki/Key:crossing",$$slots:{default:[gu]},$$scope:{ctx:r}}}),o=new Ke({}),{c(){e=L("p"),l=v("This shows "),h(t.$$.fragment),n=v(" data from OpenStreetMap (as of 9 August 2023)."),s=T(),h(o.$$.fragment)},m(a,i){$(a,e,i),w(e,l),b(t,e,null),w(e,n),$(a,s,i),b(o,a,i),u=!0},p(a,i){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),t.$set(f)},i(a){u||(_(t.$$.fragment,a),_(o.$$.fragment,a),u=!0)},o(a){d(t.$$.fragment,a),d(o.$$.fragment,a),u=!1},d(a){a&&(p(e),p(s)),k(t),k(o,a)}}}function hu(r){let e,l,t;return l=new ce({props:{$$slots:{default:[du]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&32&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function ml(r){let e,l;return e=new Qt({props:{rows:r[2]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p:te,i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function bu(r){let e,l=_l(r[4])+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&16&&l!==(l=_l(n[4])+"")&&B(t,l)},d(n){n&&p(e)}}}function ku(r){let e,l;return e=new oe({props:{$$slots:{default:[bu,({props:t})=>({4:t}),({props:t})=>t?16:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&48&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function wu(r){let e,l;const t=[H(Pt),{sourceLayer:Pt},{paint:{"circle-color":Ze(["get","crossing"],{traffic_signals:K.signalized_crossing},K.other_crossing),"circle-radius":["interpolate",["linear"],["zoom"],1,2,8,3,13,10]}},{layout:{visibility:r[0]?"visible":"none"}},{hoverCursor:"pointer"},{eventsIfTopMost:!0}];let n={$$slots:{default:[ku]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",u));let i=r[0]&&ml(r);return s=new _e({props:{url:`pmtiles://${pe()}/v1/${Pt}.pmtiles`,$$slots:{default:[wu]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&32&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0],Y(()=>l=!1)),e.$set(m),f[0]?i?(i.p(f,c),c&1&&_(i,1)):(i=ml(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&33&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let Pt="crossings";function _l(r){return{no:"Location where crossing is impossible/illegal but where there is a clear desire line to cross",traffic_signals:"Signalised crossing",marked:"Crossing with no traffic signals",uncontrolled:"Crossing with no traffic signals",unmarked:"Crossing with no markings or signals",zebra:"Zebra crossing",island:"Crossing with an island",informal:"Informal crossing with an obvious desire line, but no official infrastructure to support it"}[r.crossing]??`Unknown crossing type (${r.crossing})`}function yu(r){window.open(`http://openstreetmap.org/node/${r.detail.features[0].properties.osm_id}`,"_blank")}function Su(r,e,l){let t,n=ke(Pt);Z(r,n,u=>l(0,t=u));let s=[["Signalized",K.signalized_crossing],["Other",K.other_crossing]];function o(u){t=u,n.set(t)}return[t,n,s,o]}class Cu extends V{constructor(e){super(),Q(this,e,Su,vu,J,{})}}function Lu(r){let e;return{c(){e=v("Gradients")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Tu(r){let e;return{c(){e=v("OS Terrain 50")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Mu(r){let e,l,t,n,s,o,u,a,i,f,c,m,g;return u=new x({props:{href:"https://www.ordnancesurvey.co.uk/products/os-terrain-50",$$slots:{default:[Tu]},$$scope:{ctx:r}}}),f=new De({}),m=new Ke({}),{c(){e=L("p"),e.textContent=`This layer shows the steepness of roads, with the arrows pointing + (for `),X=v(z),E=v(", the busiest day of the week)")},m(q,D){$(q,e,D),w(e,l),w(e,t),w(t,s),$(q,o,D),$(q,u,D),w(u,a),w(u,i),w(i,c),w(u,m),$(q,g,D),$(q,C,D),w(C,S),w(C,M),$(q,R,D),$(q,A,D),w(A,O),w(A,N),w(N,F),w(A,P),w(A,X),w(A,E)},p(q,D){D&32&&n!==(n=q[5].stop_name+"")&&j(s,n),D&32&&f!==(f=q[5].peak+"")&&j(c,f),D&32&&y!==(y=q[5].peak_description+"")&&j(M,y),D&32&&I!==(I=q[5].total+"")&&j(F,I),D&32&&z!==(z=q[5].total_description+"")&&j(X,z)},d(q){q&&(p(e),p(o),p(u),p(g),p(C),p(R),p(A))}}}function uu(r){let e,l;return e=new oe({props:{$$slots:{default:[fu,({props:t})=>({5:t}),({props:t})=>t?32:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&96&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function cu(r){let e,l;const t=[H(Nt),{sourceLayer:Nt},{paint:{"circle-color":be(["get","peak"],r[2],r[1]),"circle-radius":["interpolate",["linear"],["zoom"],1,2,8,3,13,10]}},{layout:{visibility:r[0]?"visible":"none"}},{manageHoverState:!0},{eventsIfTopMost:!0}];let n={$$slots:{default:[uu]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",u));let i=r[0]&&pl(r);return s=new _e({props:{url:`pmtiles://${pe()}/v1/${Nt}.pmtiles`,$$slots:{default:[cu]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&64&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0],Y(()=>l=!1)),e.$set(m),f[0]?i?(i.p(f,c),c&1&&_(i,1)):(i=pl(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&65&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let Nt="bus_stops";function pu(r,e,l){let t,n=K.sequential_low_to_high,s=[0,3,10,20,30,100],o=ke(Nt);Z(r,o,a=>l(0,t=a));function u(a){t=a,o.set(t)}return[t,n,s,o,u]}class mu extends V{constructor(e){super(),Q(this,e,pu,$u,J,{})}}function _u(r){let e;return{c(){e=v("Crossings")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function gu(r){let e;return{c(){e=v("crossing")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function du(r){let e,l,t,n,s,o,u;return t=new x({props:{href:"https://wiki.openstreetmap.org/wiki/Key:crossing",$$slots:{default:[gu]},$$scope:{ctx:r}}}),o=new Ke({}),{c(){e=L("p"),l=v("This shows "),h(t.$$.fragment),n=v(" data from OpenStreetMap (as of 9 August 2023)."),s=T(),h(o.$$.fragment)},m(a,i){$(a,e,i),w(e,l),b(t,e,null),w(e,n),$(a,s,i),b(o,a,i),u=!0},p(a,i){const f={};i&32&&(f.$$scope={dirty:i,ctx:a}),t.$set(f)},i(a){u||(_(t.$$.fragment,a),_(o.$$.fragment,a),u=!0)},o(a){d(t.$$.fragment,a),d(o.$$.fragment,a),u=!1},d(a){a&&(p(e),p(s)),k(t),k(o,a)}}}function hu(r){let e,l,t;return l=new ce({props:{$$slots:{default:[du]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&32&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function ml(r){let e,l;return e=new Qt({props:{rows:r[2]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p:te,i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function bu(r){let e,l=_l(r[4])+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&16&&l!==(l=_l(n[4])+"")&&j(t,l)},d(n){n&&p(e)}}}function ku(r){let e,l;return e=new oe({props:{$$slots:{default:[bu,({props:t})=>({4:t}),({props:t})=>t?16:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&48&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function wu(r){let e,l;const t=[H(Pt),{sourceLayer:Pt},{paint:{"circle-color":Ze(["get","crossing"],{traffic_signals:K.signalized_crossing},K.other_crossing),"circle-radius":["interpolate",["linear"],["zoom"],1,2,8,3,13,10]}},{layout:{visibility:r[0]?"visible":"none"}},{hoverCursor:"pointer"},{eventsIfTopMost:!0}];let n={$$slots:{default:[ku]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",u));let i=r[0]&&ml(r);return s=new _e({props:{url:`pmtiles://${pe()}/v1/${Pt}.pmtiles`,$$slots:{default:[wu]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&32&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0],Y(()=>l=!1)),e.$set(m),f[0]?i?(i.p(f,c),c&1&&_(i,1)):(i=ml(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&33&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let Pt="crossings";function _l(r){return{no:"Location where crossing is impossible/illegal but where there is a clear desire line to cross",traffic_signals:"Signalised crossing",marked:"Crossing with no traffic signals",uncontrolled:"Crossing with no traffic signals",unmarked:"Crossing with no markings or signals",zebra:"Zebra crossing",island:"Crossing with an island",informal:"Informal crossing with an obvious desire line, but no official infrastructure to support it"}[r.crossing]??`Unknown crossing type (${r.crossing})`}function yu(r){window.open(`http://openstreetmap.org/node/${r.detail.features[0].properties.osm_id}`,"_blank")}function Su(r,e,l){let t,n=ke(Pt);Z(r,n,u=>l(0,t=u));let s=[["Signalized",K.signalized_crossing],["Other",K.other_crossing]];function o(u){t=u,n.set(t)}return[t,n,s,o]}class Cu extends V{constructor(e){super(),Q(this,e,Su,vu,J,{})}}function Lu(r){let e;return{c(){e=v("Gradients")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Tu(r){let e;return{c(){e=v("OS Terrain 50")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Mu(r){let e,l,t,n,s,o,u,a,i,f,c,m,g;return u=new x({props:{href:"https://www.ordnancesurvey.co.uk/products/os-terrain-50",$$slots:{default:[Tu]},$$scope:{ctx:r}}}),f=new De({}),m=new Ke({}),{c(){e=L("p"),e.textContent=`This layer shows the steepness of roads, with the arrows pointing uphill. You have to zoom in to see all roads.`,l=T(),t=L("p"),t.textContent=`Note the gradient may be incorrect near bridges and tunnels, depending on the underlying Digital Elevation Model used.`,n=T(),s=L("p"),o=v("This layer is built from "),h(u.$$.fragment),a=v(` and roads from OpenStreetMap. The data is valid as of 18 - February 2024.`),i=T(),h(f.$$.fragment),c=T(),h(m.$$.fragment)},m(C,S){$(C,e,S),$(C,l,S),$(C,t,S),$(C,n,S),$(C,s,S),w(s,o),b(u,s,null),w(s,a),$(C,i,S),b(f,C,S),$(C,c,S),b(m,C,S),g=!0},p(C,S){const y={};S&64&&(y.$$scope={dirty:S,ctx:C}),u.$set(y)},i(C){g||(_(u.$$.fragment,C),_(f.$$.fragment,C),_(m.$$.fragment,C),g=!0)},o(C){d(u.$$.fragment,C),d(f.$$.fragment,C),d(m.$$.fragment,C),g=!1},d(C){C&&(p(e),p(l),p(t),p(n),p(s),p(i),p(c)),k(u),k(f,C),k(m,C)}}}function Nu(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Mu]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&64&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function gl(r){let e,l;return e=new Be({props:{colorScale:r[1],limits:r[2]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p:te,i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Pu(r){let e,l,t,n=Math.abs(r[5].gradient)/100+"",s,o;return{c(){e=L("p"),l=v("Gradient: "),t=L("b"),s=v(n),o=v(` - %`)},m(u,a){$(u,e,a),w(e,l),w(e,t),w(t,s),w(e,o)},p(u,a){a&32&&n!==(n=Math.abs(u[5].gradient)/100+"")&&B(s,n)},d(u){u&&p(e)}}}function Ou(r){let e,l;return e=new oe({props:{$$slots:{default:[Pu,({props:t})=>({5:t}),({props:t})=>t?32:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&96&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Iu(r){let e,l,t,n;const s=[H(Je),{sourceLayer:Je},{manageHoverState:!0},{paint:{"line-color":be(["/",["abs",["get","gradient"]],100],r[2],r[1]),"line-width":Ae,"line-opacity":ee(1,.5)}},{layout:{visibility:r[0]?"visible":"none"}}];let o={$$slots:{default:[Ou]},$$scope:{ctx:r}};for(let i=0;i",["abs",["get","gradient"]],300]},{layout:{"icon-image":"chevron","icon-size":1,"symbol-placement":"line","symbol-spacing":50,"icon-allow-overlap":!0,"icon-rotate":["case",["<",["get","gradient"],0],180,0],visibility:r[0]?"visible":"none"}}];let a={};for(let i=0;iW(e,"checked",u));let i=r[0]&&gl(r);return s=new _e({props:{url:`pmtiles://${pe()}/v1/${Je}.pmtiles`,$$slots:{default:[Iu]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&64&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0],Y(()=>l=!1)),e.$set(m),f[0]?i?(i.p(f,c),c&1&&_(i,1)):(i=gl(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&65&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let Je="gradient";function Du(r,e,l){let t,n=K.gradient_flat_to_steep,s=[0,3,5,8,10,20,100],o=ke(Je);Z(r,o,a=>l(0,t=a));function u(a){t=a,o.set(t)}return[t,n,s,o,u]}class Au extends V{constructor(e){super(),Q(this,e,Du,Ru,J,{})}}function Fu(r){let e,l,t;return{c(){e=L("img"),t=v(` - Cycle parking`),Wt(e.src,l=_s)||G(e,"src",l),G(e,"alt","a logo representing cycle parking")},m(n,s){$(n,e,s),$(n,t,s)},p:te,d(n){n&&(p(e),p(t))}}}function qu(r){let e;return{c(){e=v("OpenStreetMap")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function zu(r){let e;return{c(){e=v("OpenStreetMap Carto")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Bu(r){let e,l,t,n,s,o,u,a,i,f,c;return t=new x({props:{href:"https://wiki.openstreetmap.org/wiki/Tag:amenity%3Dbicycle_parking",$$slots:{default:[qu]},$$scope:{ctx:r}}}),a=new x({props:{href:"https://github.com/gravitystorm/openstreetmap-carto",$$slots:{default:[zu]},$$scope:{ctx:r}}}),f=new Ke({}),{c(){e=L("p"),l=v("Cycle parking, according to "),h(t.$$.fragment),n=v(` (as of 9 August 2023). The type of parking, public/private - access, and whether it's covered are not shown.`),s=T(),o=L("p"),u=v("Icon from "),h(a.$$.fragment),i=T(),h(f.$$.fragment)},m(m,g){$(m,e,g),w(e,l),b(t,e,null),w(e,n),$(m,s,g),$(m,o,g),w(o,u),b(a,o,null),$(m,i,g),b(f,m,g),c=!0},p(m,g){const C={};g&16&&(C.$$scope={dirty:g,ctx:m}),t.$set(C);const S={};g&16&&(S.$$scope={dirty:g,ctx:m}),a.$set(S)},i(m){c||(_(t.$$.fragment,m),_(a.$$.fragment,m),_(f.$$.fragment,m),c=!0)},o(m){d(t.$$.fragment,m),d(a.$$.fragment,m),d(f.$$.fragment,m),c=!1},d(m){m&&(p(e),p(s),p(o),p(i)),k(t),k(a),k(f,m)}}}function ju(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Bu]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&16&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Hu(r){let e,l,t,n=(r[3].capacity??"unknown")+"",s;return{c(){e=L("p"),l=v("Capacity: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&8&&n!==(n=(o[3].capacity??"unknown")+"")&&B(s,n)},d(o){o&&p(e)}}}function Gu(r){let e,l;return e=new oe({props:{$$slots:{default:[Hu,({props:t})=>({3:t}),({props:t})=>t?8:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&24&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Eu(r){let e,l;const t=[H(Ot),{sourceLayer:Ot},{layout:{"icon-image":"cycle_parking","icon-size":1,"icon-allow-overlap":!0,visibility:r[0]?"visible":"none"}}];let n={$$slots:{default:[Gu]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",o)),n=new _e({props:{url:`pmtiles://${pe()}/v1/${Ot}.pmtiles`,$$slots:{default:[Eu]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&16&&(f.$$scope={dirty:i,ctx:a}),!l&&i&1&&(l=!0,f.checked=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&17&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}let Ot="cycle_parking";function Wu(r,e,l){let t,n=ke(Ot);Z(r,n,o=>l(0,t=o));function s(o){t=o,n.set(t)}return[t,n,s]}class Yu extends V{constructor(e){super(),Q(this,e,Wu,Uu,J,{})}}function Ju(r){let e;return{c(){e=v("Education")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Vu(r){let e,l,t,n;return t=new Ke({}),{c(){e=L("p"),e.textContent=`This shows different places of education according to OpenStreetMap (as + February 2024.`),i=T(),h(f.$$.fragment),c=T(),h(m.$$.fragment)},m(C,S){$(C,e,S),$(C,l,S),$(C,t,S),$(C,n,S),$(C,s,S),w(s,o),b(u,s,null),w(s,a),$(C,i,S),b(f,C,S),$(C,c,S),b(m,C,S),g=!0},p(C,S){const y={};S&64&&(y.$$scope={dirty:S,ctx:C}),u.$set(y)},i(C){g||(_(u.$$.fragment,C),_(f.$$.fragment,C),_(m.$$.fragment,C),g=!0)},o(C){d(u.$$.fragment,C),d(f.$$.fragment,C),d(m.$$.fragment,C),g=!1},d(C){C&&(p(e),p(l),p(t),p(n),p(s),p(i),p(c)),k(u),k(f,C),k(m,C)}}}function Nu(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Mu]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&64&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function gl(r){let e,l;return e=new je({props:{colorScale:r[1],limits:r[2]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p:te,i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Pu(r){let e,l,t,n=Math.abs(r[5].gradient)/100+"",s,o;return{c(){e=L("p"),l=v("Gradient: "),t=L("b"),s=v(n),o=v(` + %`)},m(u,a){$(u,e,a),w(e,l),w(e,t),w(t,s),w(e,o)},p(u,a){a&32&&n!==(n=Math.abs(u[5].gradient)/100+"")&&j(s,n)},d(u){u&&p(e)}}}function Ou(r){let e,l;return e=new oe({props:{$$slots:{default:[Pu,({props:t})=>({5:t}),({props:t})=>t?32:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&96&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Iu(r){let e,l,t,n;const s=[H(Je),{sourceLayer:Je},{manageHoverState:!0},{paint:{"line-color":be(["/",["abs",["get","gradient"]],100],r[2],r[1]),"line-width":Ae,"line-opacity":ee(1,.5)}},{layout:{visibility:r[0]?"visible":"none"}}];let o={$$slots:{default:[Ou]},$$scope:{ctx:r}};for(let i=0;i",["abs",["get","gradient"]],300]},{layout:{"icon-image":"chevron","icon-size":1,"symbol-placement":"line","symbol-spacing":50,"icon-allow-overlap":!0,"icon-rotate":["case",["<",["get","gradient"],0],180,0],visibility:r[0]?"visible":"none"}}];let a={};for(let i=0;iW(e,"checked",u));let i=r[0]&&gl(r);return s=new _e({props:{url:`pmtiles://${pe()}/v1/${Je}.pmtiles`,$$slots:{default:[Iu]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&64&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0],Y(()=>l=!1)),e.$set(m),f[0]?i?(i.p(f,c),c&1&&_(i,1)):(i=gl(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&65&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let Je="gradient";function Du(r,e,l){let t,n=K.gradient_flat_to_steep,s=[0,3,5,8,10,20,100],o=ke(Je);Z(r,o,a=>l(0,t=a));function u(a){t=a,o.set(t)}return[t,n,s,o,u]}class Au extends V{constructor(e){super(),Q(this,e,Du,Ru,J,{})}}function Fu(r){let e,l,t;return{c(){e=L("img"),t=v(` + Cycle parking`),Wt(e.src,l=_s)||G(e,"src",l),G(e,"alt","a logo representing cycle parking")},m(n,s){$(n,e,s),$(n,t,s)},p:te,d(n){n&&(p(e),p(t))}}}function qu(r){let e;return{c(){e=v("OpenStreetMap")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function zu(r){let e;return{c(){e=v("OpenStreetMap Carto")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function ju(r){let e,l,t,n,s,o,u,a,i,f,c;return t=new x({props:{href:"https://wiki.openstreetmap.org/wiki/Tag:amenity%3Dbicycle_parking",$$slots:{default:[qu]},$$scope:{ctx:r}}}),a=new x({props:{href:"https://github.com/gravitystorm/openstreetmap-carto",$$slots:{default:[zu]},$$scope:{ctx:r}}}),f=new Ke({}),{c(){e=L("p"),l=v("Cycle parking, according to "),h(t.$$.fragment),n=v(` (as of 9 August 2023). The type of parking, public/private + access, and whether it's covered are not shown.`),s=T(),o=L("p"),u=v("Icon from "),h(a.$$.fragment),i=T(),h(f.$$.fragment)},m(m,g){$(m,e,g),w(e,l),b(t,e,null),w(e,n),$(m,s,g),$(m,o,g),w(o,u),b(a,o,null),$(m,i,g),b(f,m,g),c=!0},p(m,g){const C={};g&16&&(C.$$scope={dirty:g,ctx:m}),t.$set(C);const S={};g&16&&(S.$$scope={dirty:g,ctx:m}),a.$set(S)},i(m){c||(_(t.$$.fragment,m),_(a.$$.fragment,m),_(f.$$.fragment,m),c=!0)},o(m){d(t.$$.fragment,m),d(a.$$.fragment,m),d(f.$$.fragment,m),c=!1},d(m){m&&(p(e),p(s),p(o),p(i)),k(t),k(a),k(f,m)}}}function Bu(r){let e,l,t;return l=new ce({props:{$$slots:{default:[ju]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&16&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Hu(r){let e,l,t,n=(r[3].capacity??"unknown")+"",s;return{c(){e=L("p"),l=v("Capacity: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&8&&n!==(n=(o[3].capacity??"unknown")+"")&&j(s,n)},d(o){o&&p(e)}}}function Gu(r){let e,l;return e=new oe({props:{$$slots:{default:[Hu,({props:t})=>({3:t}),({props:t})=>t?8:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&24&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Eu(r){let e,l;const t=[H(Ot),{sourceLayer:Ot},{layout:{"icon-image":"cycle_parking","icon-size":1,"icon-allow-overlap":!0,visibility:r[0]?"visible":"none"}}];let n={$$slots:{default:[Gu]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",o)),n=new _e({props:{url:`pmtiles://${pe()}/v1/${Ot}.pmtiles`,$$slots:{default:[Eu]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&16&&(f.$$scope={dirty:i,ctx:a}),!l&&i&1&&(l=!0,f.checked=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&17&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}let Ot="cycle_parking";function Wu(r,e,l){let t,n=ke(Ot);Z(r,n,o=>l(0,t=o));function s(o){t=o,n.set(t)}return[t,n,s]}class Yu extends V{constructor(e){super(),Q(this,e,Wu,Uu,J,{})}}function Ju(r){let e;return{c(){e=v("Education")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Vu(r){let e,l,t,n;return t=new Ke({}),{c(){e=L("p"),e.textContent=`This shows different places of education according to OpenStreetMap (as of 07 February 2024).`,l=T(),h(t.$$.fragment)},m(s,o){$(s,e,o),$(s,l,o),b(t,s,o),n=!0},p:te,i(s){n||(_(t.$$.fragment,s),n=!0)},o(s){d(t.$$.fragment,s),n=!1},d(s){s&&(p(e),p(l)),k(t,s)}}}function Qu(r){let e,l,t;return l=new ce({props:{$$slots:{default:[Vu]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&2048&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function dl(r){let e,l,t;return l=new nt({props:{$$slots:{default:[xu]},$$scope:{ctx:r}}}),{c(){e=L("div"),h(l.$$.fragment),me(e,"border","1px solid black"),me(e,"padding","8px")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&2049&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Zu(r){let e,l,t;return e=new Re({props:{color:K.education.schools}}),{c(){h(e.$$.fragment),l=v(` Schools`)},m(n,s){b(e,n,s),$(n,l,s),t=!0},p:te,i(n){t||(_(e.$$.fragment,n),t=!0)},o(n){d(e.$$.fragment,n),t=!1},d(n){n&&p(l),k(e,n)}}}function Ku(r){let e,l,t;return e=new Re({props:{color:K.education.colleges}}),{c(){h(e.$$.fragment),l=v(` Colleges`)},m(n,s){b(e,n,s),$(n,l,s),t=!0},p:te,i(n){t||(_(e.$$.fragment,n),t=!0)},o(n){d(e.$$.fragment,n),t=!1},d(n){n&&p(l),k(e,n)}}}function Xu(r){let e,l,t;return e=new Re({props:{color:K.education.universities}}),{c(){h(e.$$.fragment),l=v(` - Universities`)},m(n,s){b(e,n,s),$(n,l,s),t=!0},p:te,i(n){t||(_(e.$$.fragment,n),t=!0)},o(n){d(e.$$.fragment,n),t=!1},d(n){n&&p(l),k(e,n)}}}function xu(r){let e,l,t,n,s,o,u,a,i;function f(y){r[4](y)}let c={$$slots:{default:[Zu]},$$scope:{ctx:r}};r[0].school!==void 0&&(c.checked=r[0].school),e=new se({props:c}),U.push(()=>W(e,"checked",f));function m(y){r[5](y)}let g={$$slots:{default:[Ku]},$$scope:{ctx:r}};r[0].college!==void 0&&(g.checked=r[0].college),n=new se({props:g}),U.push(()=>W(n,"checked",m));function C(y){r[6](y)}let S={$$slots:{default:[Xu]},$$scope:{ctx:r}};return r[0].university!==void 0&&(S.checked=r[0].university),u=new se({props:S}),U.push(()=>W(u,"checked",C)),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment),o=T(),h(u.$$.fragment)},m(y,M){b(e,y,M),$(y,t,M),b(n,y,M),$(y,o,M),b(u,y,M),i=!0},p(y,M){const R={};M&2048&&(R.$$scope={dirty:M,ctx:y}),!l&&M&1&&(l=!0,R.checked=y[0].school,Y(()=>l=!1)),e.$set(R);const A={};M&2048&&(A.$$scope={dirty:M,ctx:y}),!s&&M&1&&(s=!0,A.checked=y[0].college,Y(()=>s=!1)),n.$set(A);const O={};M&2048&&(O.$$scope={dirty:M,ctx:y}),!a&&M&1&&(a=!0,O.checked=y[0].university,Y(()=>a=!1)),u.$set(O)},i(y){i||(_(e.$$.fragment,y),_(n.$$.fragment,y),_(u.$$.fragment,y),i=!0)},o(y){d(e.$$.fragment,y),d(n.$$.fragment,y),d(u.$$.fragment,y),i=!1},d(y){y&&(p(t),p(o)),k(e,y),k(n,y),k(u,y)}}}function ec(r){let e,l=(r[10].name??"Unnamed institution")+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&1024&&l!==(l=(n[10].name??"Unnamed institution")+"")&&B(t,l)},d(n){n&&p(e)}}}function tc(r){let e,l;return e=new oe({props:{$$slots:{default:[ec,({props:t})=>({10:t}),({props:t})=>t?1024:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&3072&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function nc(r){let e,l;const t=[H(It),{sourceLayer:It},{paint:{"fill-color":Ze(["get","type"],{school:K.education.schools,college:K.education.colleges,university:K.education.universities},"grey"),"fill-opacity":ee(.7,1)}},{layout:{visibility:r[0].show?"visible":"none"}},{filter:r[2](r[0])},{manageHoverState:!0},{eventsIfTopMost:!0}];let n={$$slots:{default:[tc]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",u));let i=r[0].show&&dl(r);return s=new _e({props:{url:`pmtiles://${pe()}/v1/${It}.pmtiles`,$$slots:{default:[nc]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&2048&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0].show,Y(()=>l=!1)),e.$set(m),f[0].show?i?(i.p(f,c),c&1&&_(i,1)):(i=dl(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&2049&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let It="education";function sc(r){return{show:!0,school:r.includes("school"),college:r.includes("college"),university:r.includes("university")}}function rc(r,e,l){let t,n=["school","college","university"],s={show:!1,school:!0,college:!0,university:!0};function o(g){return g.show?n.filter(C=>g[C]).join(","):null}let u=_t(It,s,o,sc);Z(r,u,g=>l(0,t=g));function a(g){let C=n.filter(S=>g[S]);return["in",["get","type"],["literal",C]]}function i(g){r.$$.not_equal(t.show,g)&&(t.show=g,u.set(t))}function f(g){r.$$.not_equal(t.school,g)&&(t.school=g,u.set(t))}function c(g){r.$$.not_equal(t.college,g)&&(t.college=g,u.set(t))}function m(g){r.$$.not_equal(t.university,g)&&(t.university=g,u.set(t))}return[t,u,a,i,f,c,m]}class oc extends V{constructor(e){super(),Q(this,e,rc,lc,J,{})}}function ic(r){let e,l,t,n;return e=new Re({props:{color:r[4]}}),{c(){h(e.$$.fragment),l=T(),t=v(r[2])},m(s,o){b(e,s,o),$(s,l,o),$(s,t,o),n=!0},p(s,o){(!n||o&4)&&B(t,s[2])},i(s){n||(_(e.$$.fragment,s),n=!0)},o(s){d(e.$$.fragment,s),n=!1},d(s){s&&(p(l),p(t)),k(e,s)}}}function ac(r){let e;const l=r[6].default,t=at(l,r,r[8],null);return{c(){t&&t.c()},m(n,s){t&&t.m(n,s),e=!0},p(n,s){t&&t.p&&(!e||s&256)&&ft(t,l,n,n[8],e?ct(l,n[8],s,null):ut(n[8]),null)},i(n){e||(_(t,n),e=!0)},o(n){d(t,n),e=!1},d(n){t&&t.d(n)}}}function fc(r){let e,l,t;return l=new ce({props:{$$slots:{default:[ac]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&256&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function uc(r){let e,l=(r[9].name??`Unnamed ${r[1]}`)+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&514&&l!==(l=(n[9].name??`Unnamed ${n[1]}`)+"")&&B(t,l)},d(n){n&&p(e)}}}function cc(r){let e,l;return e=new oe({props:{$$slots:{default:[uc,({props:t})=>({9:t}),({props:t})=>t?512:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&770&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function $c(r){let e,l;const t=[H(r[0]),{sourceLayer:r[0]},{paint:{"fill-color":r[4],"fill-opacity":ee(.7,1)}},{layout:{visibility:r[3]?"visible":"none"}},{manageHoverState:!0},{eventsIfTopMost:!0}];let n={$$slots:{default:[cc]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",o)),n=new _e({props:{url:`pmtiles://${pe()}/v1/${r[0]}.pmtiles`,$$slots:{default:[$c]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&260&&(f.$$scope={dirty:i,ctx:a}),!l&&i&8&&(l=!0,f.checked=a[3],Y(()=>l=!1)),e.$set(f);const c={};i&1&&(c.url=`pmtiles://${pe()}/v1/${a[0]}.pmtiles`),i&267&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}function mc(r,e,l){let t,{$$slots:n={},$$scope:s}=e,{name:o}=e,{singularNoun:u}=e,{pluralNoun:a}=e,i=K[o],f=ke(o);Z(r,f,m=>l(3,t=m));function c(m){t=m,f.set(t)}return r.$$set=m=>{"name"in m&&l(0,o=m.name),"singularNoun"in m&&l(1,u=m.singularNoun),"pluralNoun"in m&&l(2,a=m.pluralNoun),"$$scope"in m&&l(8,s=m.$$scope)},[o,u,a,t,i,f,n,c,s]}class us extends V{constructor(e){super(),Q(this,e,mc,pc,J,{name:0,singularNoun:1,pluralNoun:2})}}function _c(r){let e;return{c(){e=v("hospital")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function gc(r){let e,l,t,n,s,o,u;return t=new x({props:{href:"https://wiki.openstreetmap.org/wiki/Tag:amenity%3Dhospital",$$slots:{default:[_c]},$$scope:{ctx:r}}}),o=new Ke({}),{c(){e=L("p"),l=v("This shows "),h(t.$$.fragment),n=v(` data from OpenStreetMap (as of 9 August 2023). It doesn't include + Universities`)},m(n,s){b(e,n,s),$(n,l,s),t=!0},p:te,i(n){t||(_(e.$$.fragment,n),t=!0)},o(n){d(e.$$.fragment,n),t=!1},d(n){n&&p(l),k(e,n)}}}function xu(r){let e,l,t,n,s,o,u,a,i;function f(y){r[4](y)}let c={$$slots:{default:[Zu]},$$scope:{ctx:r}};r[0].school!==void 0&&(c.checked=r[0].school),e=new se({props:c}),U.push(()=>W(e,"checked",f));function m(y){r[5](y)}let g={$$slots:{default:[Ku]},$$scope:{ctx:r}};r[0].college!==void 0&&(g.checked=r[0].college),n=new se({props:g}),U.push(()=>W(n,"checked",m));function C(y){r[6](y)}let S={$$slots:{default:[Xu]},$$scope:{ctx:r}};return r[0].university!==void 0&&(S.checked=r[0].university),u=new se({props:S}),U.push(()=>W(u,"checked",C)),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment),o=T(),h(u.$$.fragment)},m(y,M){b(e,y,M),$(y,t,M),b(n,y,M),$(y,o,M),b(u,y,M),i=!0},p(y,M){const R={};M&2048&&(R.$$scope={dirty:M,ctx:y}),!l&&M&1&&(l=!0,R.checked=y[0].school,Y(()=>l=!1)),e.$set(R);const A={};M&2048&&(A.$$scope={dirty:M,ctx:y}),!s&&M&1&&(s=!0,A.checked=y[0].college,Y(()=>s=!1)),n.$set(A);const O={};M&2048&&(O.$$scope={dirty:M,ctx:y}),!a&&M&1&&(a=!0,O.checked=y[0].university,Y(()=>a=!1)),u.$set(O)},i(y){i||(_(e.$$.fragment,y),_(n.$$.fragment,y),_(u.$$.fragment,y),i=!0)},o(y){d(e.$$.fragment,y),d(n.$$.fragment,y),d(u.$$.fragment,y),i=!1},d(y){y&&(p(t),p(o)),k(e,y),k(n,y),k(u,y)}}}function ec(r){let e,l=(r[10].name??"Unnamed institution")+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&1024&&l!==(l=(n[10].name??"Unnamed institution")+"")&&j(t,l)},d(n){n&&p(e)}}}function tc(r){let e,l;return e=new oe({props:{$$slots:{default:[ec,({props:t})=>({10:t}),({props:t})=>t?1024:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&3072&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function nc(r){let e,l;const t=[H(It),{sourceLayer:It},{paint:{"fill-color":Ze(["get","type"],{school:K.education.schools,college:K.education.colleges,university:K.education.universities},"grey"),"fill-opacity":ee(.7,1)}},{layout:{visibility:r[0].show?"visible":"none"}},{filter:r[2](r[0])},{manageHoverState:!0},{eventsIfTopMost:!0}];let n={$$slots:{default:[tc]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",u));let i=r[0].show&&dl(r);return s=new _e({props:{url:`pmtiles://${pe()}/v1/${It}.pmtiles`,$$slots:{default:[nc]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&2048&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0].show,Y(()=>l=!1)),e.$set(m),f[0].show?i?(i.p(f,c),c&1&&_(i,1)):(i=dl(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&2049&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let It="education";function sc(r){return{show:!0,school:r.includes("school"),college:r.includes("college"),university:r.includes("university")}}function rc(r,e,l){let t,n=["school","college","university"],s={show:!1,school:!0,college:!0,university:!0};function o(g){return g.show?n.filter(C=>g[C]).join(","):null}let u=_t(It,s,o,sc);Z(r,u,g=>l(0,t=g));function a(g){let C=n.filter(S=>g[S]);return["in",["get","type"],["literal",C]]}function i(g){r.$$.not_equal(t.show,g)&&(t.show=g,u.set(t))}function f(g){r.$$.not_equal(t.school,g)&&(t.school=g,u.set(t))}function c(g){r.$$.not_equal(t.college,g)&&(t.college=g,u.set(t))}function m(g){r.$$.not_equal(t.university,g)&&(t.university=g,u.set(t))}return[t,u,a,i,f,c,m]}class oc extends V{constructor(e){super(),Q(this,e,rc,lc,J,{})}}function ic(r){let e,l,t,n;return e=new Re({props:{color:r[4]}}),{c(){h(e.$$.fragment),l=T(),t=v(r[2])},m(s,o){b(e,s,o),$(s,l,o),$(s,t,o),n=!0},p(s,o){(!n||o&4)&&j(t,s[2])},i(s){n||(_(e.$$.fragment,s),n=!0)},o(s){d(e.$$.fragment,s),n=!1},d(s){s&&(p(l),p(t)),k(e,s)}}}function ac(r){let e;const l=r[6].default,t=at(l,r,r[8],null);return{c(){t&&t.c()},m(n,s){t&&t.m(n,s),e=!0},p(n,s){t&&t.p&&(!e||s&256)&&ft(t,l,n,n[8],e?ct(l,n[8],s,null):ut(n[8]),null)},i(n){e||(_(t,n),e=!0)},o(n){d(t,n),e=!1},d(n){t&&t.d(n)}}}function fc(r){let e,l,t;return l=new ce({props:{$$slots:{default:[ac]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&256&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function uc(r){let e,l=(r[9].name??`Unnamed ${r[1]}`)+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&514&&l!==(l=(n[9].name??`Unnamed ${n[1]}`)+"")&&j(t,l)},d(n){n&&p(e)}}}function cc(r){let e,l;return e=new oe({props:{$$slots:{default:[uc,({props:t})=>({9:t}),({props:t})=>t?512:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&770&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function $c(r){let e,l;const t=[H(r[0]),{sourceLayer:r[0]},{paint:{"fill-color":r[4],"fill-opacity":ee(.7,1)}},{layout:{visibility:r[3]?"visible":"none"}},{manageHoverState:!0},{eventsIfTopMost:!0}];let n={$$slots:{default:[cc]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",o)),n=new _e({props:{url:`pmtiles://${pe()}/v1/${r[0]}.pmtiles`,$$slots:{default:[$c]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&260&&(f.$$scope={dirty:i,ctx:a}),!l&&i&8&&(l=!0,f.checked=a[3],Y(()=>l=!1)),e.$set(f);const c={};i&1&&(c.url=`pmtiles://${pe()}/v1/${a[0]}.pmtiles`),i&267&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}function mc(r,e,l){let t,{$$slots:n={},$$scope:s}=e,{name:o}=e,{singularNoun:u}=e,{pluralNoun:a}=e,i=K[o],f=ke(o);Z(r,f,m=>l(3,t=m));function c(m){t=m,f.set(t)}return r.$$set=m=>{"name"in m&&l(0,o=m.name),"singularNoun"in m&&l(1,u=m.singularNoun),"pluralNoun"in m&&l(2,a=m.pluralNoun),"$$scope"in m&&l(8,s=m.$$scope)},[o,u,a,t,i,f,n,c,s]}class us extends V{constructor(e){super(),Q(this,e,mc,pc,J,{name:0,singularNoun:1,pluralNoun:2})}}function _c(r){let e;return{c(){e=v("hospital")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function gc(r){let e,l,t,n,s,o,u;return t=new x({props:{href:"https://wiki.openstreetmap.org/wiki/Tag:amenity%3Dhospital",$$slots:{default:[_c]},$$scope:{ctx:r}}}),o=new Ke({}),{c(){e=L("p"),l=v("This shows "),h(t.$$.fragment),n=v(` data from OpenStreetMap (as of 9 August 2023). It doesn't include outpatient clinics or individual doctor's offices.`),s=T(),h(o.$$.fragment)},m(a,i){$(a,e,i),w(e,l),b(t,e,null),w(e,n),$(a,s,i),b(o,a,i),u=!0},p(a,i){const f={};i&1&&(f.$$scope={dirty:i,ctx:a}),t.$set(f)},i(a){u||(_(t.$$.fragment,a),_(o.$$.fragment,a),u=!0)},o(a){d(t.$$.fragment,a),d(o.$$.fragment,a),u=!1},d(a){a&&(p(e),p(s)),k(t),k(o,a)}}}function dc(r){let e,l;return e=new us({props:{name:"hospitals",singularNoun:"hospital",pluralNoun:"Hospitals",$$slots:{default:[gc]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,[n]){const s={};n&1&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}class hc extends V{constructor(e){super(),Q(this,e,null,dc,J,{})}}function bc(r){let e,l,t;return{c(){e=L("img"),t=v(` Railway Stations`),Wt(e.src,l=gs)||G(e,"src",l),G(e,"alt","A logo representing a train")},m(n,s){$(n,e,s),$(n,t,s)},p:te,d(n){n&&(p(e),p(t))}}}function kc(r){let e;return{c(){e=v("railway station")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function wc(r){let e;return{c(){e=v(`National Rail - `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function vc(r){let e,l,t,n,s,o,u,a,i,f,c,m;return t=new x({props:{href:"https://wiki.openstreetmap.org/wiki/Tag:railway%3Dstation",$$slots:{default:[kc]},$$scope:{ctx:r}}}),a=new x({props:{href:"https://www.nationalrail.co.uk/",$$slots:{default:[wc]},$$scope:{ctx:r}}}),c=new Ke({}),{c(){e=L("p"),l=v("This shows "),h(t.$$.fragment),n=v(" data from OpenStreetMap (as of 9 August 2023)."),s=T(),o=L("p"),u=v("Icon from "),h(a.$$.fragment),i=v(". (Note that not all stations shown are National Rail.)"),f=T(),h(c.$$.fragment)},m(g,C){$(g,e,C),w(e,l),b(t,e,null),w(e,n),$(g,s,C),$(g,o,C),w(o,u),b(a,o,null),w(o,i),$(g,f,C),b(c,g,C),m=!0},p(g,C){const S={};C&16&&(S.$$scope={dirty:C,ctx:g}),t.$set(S);const y={};C&16&&(y.$$scope={dirty:C,ctx:g}),a.$set(y)},i(g){m||(_(t.$$.fragment,g),_(a.$$.fragment,g),_(c.$$.fragment,g),m=!0)},o(g){d(t.$$.fragment,g),d(a.$$.fragment,g),d(c.$$.fragment,g),m=!1},d(g){g&&(p(e),p(s),p(o),p(f)),k(t),k(a),k(c,g)}}}function yc(r){let e,l,t;return l=new ce({props:{$$slots:{default:[vc]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&16&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Sc(r){let e,l=(r[3].name??"Unnamed railway station")+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&8&&l!==(l=(n[3].name??"Unnamed railway station")+"")&&B(t,l)},d(n){n&&p(e)}}}function Cc(r){let e,l;return e=new oe({props:{$$slots:{default:[Sc,({props:t})=>({3:t}),({props:t})=>t?8:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&24&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Lc(r){let e,l;const t=[H(Vt),{layout:{"icon-image":"railway_station","icon-size":1,"icon-allow-overlap":!0,visibility:r[0]?"visible":"none"}}];let n={$$slots:{default:[Cc]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",o)),n=new pt({props:{data:`${pe()}/v1/${Vt}.geojson`,$$slots:{default:[Lc]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&16&&(f.$$scope={dirty:i,ctx:a}),!l&&i&1&&(l=!0,f.checked=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&17&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}let Vt="railway_stations";function Mc(r,e,l){let t,n=ke(Vt);Z(r,n,o=>l(0,t=o));function s(o){t=o,n.set(t)}return[t,n,s]}class Nc extends V{constructor(e){super(),Q(this,e,Mc,Tc,J,{})}}function Pc(r){let e;return{c(){e=v("sports pitches")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Oc(r){let e;return{c(){e=v("sports centres")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Ic(r){let e,l,t,n,s,o,u,a,i;return t=new x({props:{href:"https://wiki.openstreetmap.org/wiki/Tag:leisure%3Dpitch",$$slots:{default:[Pc]},$$scope:{ctx:r}}}),s=new x({props:{href:"https://wiki.openstreetmap.org/wiki/Tag:leisure%3Dsports_centre",$$slots:{default:[Oc]},$$scope:{ctx:r}}}),a=new Ke({}),{c(){e=L("p"),l=v("This shows "),h(t.$$.fragment),n=v(" and "),h(s.$$.fragment),o=v(" data from OpenStreetMap (as of 9 August 2023)."),u=T(),h(a.$$.fragment)},m(f,c){$(f,e,c),w(e,l),b(t,e,null),w(e,n),b(s,e,null),w(e,o),$(f,u,c),b(a,f,c),i=!0},p(f,c){const m={};c&1&&(m.$$scope={dirty:c,ctx:f}),t.$set(m);const g={};c&1&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){i||(_(t.$$.fragment,f),_(s.$$.fragment,f),_(a.$$.fragment,f),i=!0)},o(f){d(t.$$.fragment,f),d(s.$$.fragment,f),d(a.$$.fragment,f),i=!1},d(f){f&&(p(e),p(u)),k(t),k(s),k(a,f)}}}function Rc(r){let e,l;return e=new us({props:{name:"sports_spaces",singularNoun:"sports space",pluralNoun:"Sports spaces",$$slots:{default:[Ic]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,[n]){const s={};n&1&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}class Dc extends V{constructor(e){super(),Q(this,e,null,Rc,J,{})}}function Ac(r){let e;return{c(){e=v("Stats19")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Fc(r){let e;return{c(){e=v("DfT stats19")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function qc(r){let e;return{c(){e=v("documented by DfT")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function zc(r){let e,l,t,n,s,o,u,a,i,f,c,m,g,C,S,y,M,R,A,O,N,I,F;return t=new x({props:{href:"https://www.data.gov.uk/dataset/cb7ae6f0-4be6-4935-9277-47e5ce24a11f/road-safety-data",$$slots:{default:[Fc]},$$scope:{ctx:r}}}),M=new x({props:{href:"https://www.gov.uk/guidance/road-accident-and-safety-statistics-guidance",$$slots:{default:[qc]},$$scope:{ctx:r}}}),I=new De({}),{c(){e=L("p"),l=v("This layer shows collisions recorded in the "),h(t.$$.fragment),n=v(" dataset. Please note these limitations:"),s=T(),o=L("ul"),u=L("li"),u.textContent="Only collisions between 2017 and 2022 are included",a=T(),i=L("li"),i.textContent=`This tool is intended to be used at high-zoom levels, while inspecting + `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function vc(r){let e,l,t,n,s,o,u,a,i,f,c,m;return t=new x({props:{href:"https://wiki.openstreetmap.org/wiki/Tag:railway%3Dstation",$$slots:{default:[kc]},$$scope:{ctx:r}}}),a=new x({props:{href:"https://www.nationalrail.co.uk/",$$slots:{default:[wc]},$$scope:{ctx:r}}}),c=new Ke({}),{c(){e=L("p"),l=v("This shows "),h(t.$$.fragment),n=v(" data from OpenStreetMap (as of 9 August 2023)."),s=T(),o=L("p"),u=v("Icon from "),h(a.$$.fragment),i=v(". (Note that not all stations shown are National Rail.)"),f=T(),h(c.$$.fragment)},m(g,C){$(g,e,C),w(e,l),b(t,e,null),w(e,n),$(g,s,C),$(g,o,C),w(o,u),b(a,o,null),w(o,i),$(g,f,C),b(c,g,C),m=!0},p(g,C){const S={};C&16&&(S.$$scope={dirty:C,ctx:g}),t.$set(S);const y={};C&16&&(y.$$scope={dirty:C,ctx:g}),a.$set(y)},i(g){m||(_(t.$$.fragment,g),_(a.$$.fragment,g),_(c.$$.fragment,g),m=!0)},o(g){d(t.$$.fragment,g),d(a.$$.fragment,g),d(c.$$.fragment,g),m=!1},d(g){g&&(p(e),p(s),p(o),p(f)),k(t),k(a),k(c,g)}}}function yc(r){let e,l,t;return l=new ce({props:{$$slots:{default:[vc]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&16&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Sc(r){let e,l=(r[3].name??"Unnamed railway station")+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&8&&l!==(l=(n[3].name??"Unnamed railway station")+"")&&j(t,l)},d(n){n&&p(e)}}}function Cc(r){let e,l;return e=new oe({props:{$$slots:{default:[Sc,({props:t})=>({3:t}),({props:t})=>t?8:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&24&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Lc(r){let e,l;const t=[H(Vt),{layout:{"icon-image":"railway_station","icon-size":1,"icon-allow-overlap":!0,visibility:r[0]?"visible":"none"}}];let n={$$slots:{default:[Cc]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",o)),n=new pt({props:{data:`${pe()}/v1/${Vt}.geojson`,$$slots:{default:[Lc]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,[i]){const f={};i&16&&(f.$$scope={dirty:i,ctx:a}),!l&&i&1&&(l=!0,f.checked=a[0],Y(()=>l=!1)),e.$set(f);const c={};i&17&&(c.$$scope={dirty:i,ctx:a}),n.$set(c)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}let Vt="railway_stations";function Mc(r,e,l){let t,n=ke(Vt);Z(r,n,o=>l(0,t=o));function s(o){t=o,n.set(t)}return[t,n,s]}class Nc extends V{constructor(e){super(),Q(this,e,Mc,Tc,J,{})}}function Pc(r){let e;return{c(){e=v("sports pitches")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Oc(r){let e;return{c(){e=v("sports centres")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Ic(r){let e,l,t,n,s,o,u,a,i;return t=new x({props:{href:"https://wiki.openstreetmap.org/wiki/Tag:leisure%3Dpitch",$$slots:{default:[Pc]},$$scope:{ctx:r}}}),s=new x({props:{href:"https://wiki.openstreetmap.org/wiki/Tag:leisure%3Dsports_centre",$$slots:{default:[Oc]},$$scope:{ctx:r}}}),a=new Ke({}),{c(){e=L("p"),l=v("This shows "),h(t.$$.fragment),n=v(" and "),h(s.$$.fragment),o=v(" data from OpenStreetMap (as of 9 August 2023)."),u=T(),h(a.$$.fragment)},m(f,c){$(f,e,c),w(e,l),b(t,e,null),w(e,n),b(s,e,null),w(e,o),$(f,u,c),b(a,f,c),i=!0},p(f,c){const m={};c&1&&(m.$$scope={dirty:c,ctx:f}),t.$set(m);const g={};c&1&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){i||(_(t.$$.fragment,f),_(s.$$.fragment,f),_(a.$$.fragment,f),i=!0)},o(f){d(t.$$.fragment,f),d(s.$$.fragment,f),d(a.$$.fragment,f),i=!1},d(f){f&&(p(e),p(u)),k(t),k(s),k(a,f)}}}function Rc(r){let e,l;return e=new us({props:{name:"sports_spaces",singularNoun:"sports space",pluralNoun:"Sports spaces",$$slots:{default:[Ic]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,[n]){const s={};n&1&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}class Dc extends V{constructor(e){super(),Q(this,e,null,Rc,J,{})}}function Ac(r){let e;return{c(){e=v("Stats19")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Fc(r){let e;return{c(){e=v("DfT stats19")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function qc(r){let e;return{c(){e=v("documented by DfT")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function zc(r){let e,l,t,n,s,o,u,a,i,f,c,m,g,C,S,y,M,R,A,O,N,I,F;return t=new x({props:{href:"https://www.data.gov.uk/dataset/cb7ae6f0-4be6-4935-9277-47e5ce24a11f/road-safety-data",$$slots:{default:[Fc]},$$scope:{ctx:r}}}),M=new x({props:{href:"https://www.gov.uk/guidance/road-accident-and-safety-statistics-guidance",$$slots:{default:[qc]},$$scope:{ctx:r}}}),I=new De({}),{c(){e=L("p"),l=v("This layer shows collisions recorded in the "),h(t.$$.fragment),n=v(" dataset. Please note these limitations:"),s=T(),o=L("ul"),u=L("li"),u.textContent="Only collisions between 2017 and 2022 are included",a=T(),i=L("li"),i.textContent=`This tool is intended to be used at high-zoom levels, while inspecting a scheme or development area. Not all points are shown at lower zoom levels. Do not use this to look for trends across a city or region scale.`,f=T(),c=L("li"),c.textContent=`Approximately 150 collisions from the source data aren't included, due to problems with the recorded location`,m=T(),g=L("li"),g.textContent='The "pedestrians" category also include mobility scooters',C=T(),S=L("li"),y=v("All limitations "),h(M.$$.fragment),R=v(` also apply. Not all collisions or near misses are reported. - There's nuance with the severity categories.`),A=T(),O=L("p"),O.textContent="You can click a point to open the full report, thanks to CycleStreets.",N=T(),h(I.$$.fragment)},m(P,z){$(P,e,z),w(e,l),b(t,e,null),w(e,n),$(P,s,z),$(P,o,z),w(o,u),w(o,a),w(o,i),w(o,f),w(o,c),w(o,m),w(o,g),w(o,C),w(o,S),w(S,y),b(M,S,null),w(S,R),$(P,A,z),$(P,O,z),$(P,N,z),b(I,P,z),F=!0},p(P,z){const X={};z&4194304&&(X.$$scope={dirty:z,ctx:P}),t.$set(X);const E={};z&4194304&&(E.$$scope={dirty:z,ctx:P}),M.$set(E)},i(P){F||(_(t.$$.fragment,P),_(M.$$.fragment,P),_(I.$$.fragment,P),F=!0)},o(P){d(t.$$.fragment,P),d(M.$$.fragment,P),d(I.$$.fragment,P),F=!1},d(P){P&&(p(e),p(s),p(o),p(A),p(O),p(N)),k(t),k(M),k(I,P)}}}function Bc(r){let e,l,t;return l=new ce({props:{$$slots:{default:[zc]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&4194304&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function hl(r){let e,l,t,n,s,o,u,a,i,f,c,m,g;return l=new nt({props:{small:!0,$$slots:{default:[Uc]},$$scope:{ctx:r}}}),f=new Qt({props:{rows:r[9]}}),{c(){e=L("div"),h(l.$$.fragment),t=T(),n=L("div"),s=v(`Filter years: + There's nuance with the severity categories.`),A=T(),O=L("p"),O.textContent="You can click a point to open the full report, thanks to CycleStreets.",N=T(),h(I.$$.fragment)},m(P,z){$(P,e,z),w(e,l),b(t,e,null),w(e,n),$(P,s,z),$(P,o,z),w(o,u),w(o,a),w(o,i),w(o,f),w(o,c),w(o,m),w(o,g),w(o,C),w(o,S),w(S,y),b(M,S,null),w(S,R),$(P,A,z),$(P,O,z),$(P,N,z),b(I,P,z),F=!0},p(P,z){const X={};z&4194304&&(X.$$scope={dirty:z,ctx:P}),t.$set(X);const E={};z&4194304&&(E.$$scope={dirty:z,ctx:P}),M.$set(E)},i(P){F||(_(t.$$.fragment,P),_(M.$$.fragment,P),_(I.$$.fragment,P),F=!0)},o(P){d(t.$$.fragment,P),d(M.$$.fragment,P),d(I.$$.fragment,P),F=!1},d(P){P&&(p(e),p(s),p(o),p(A),p(O),p(N)),k(t),k(M),k(I,P)}}}function jc(r){let e,l,t;return l=new ce({props:{$$slots:{default:[zc]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&4194304&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function hl(r){let e,l,t,n,s,o,u,a,i,f,c,m,g;return l=new nt({props:{small:!0,$$slots:{default:[Uc]},$$scope:{ctx:r}}}),f=new Qt({props:{rows:r[9]}}),{c(){e=L("div"),h(l.$$.fragment),t=T(),n=L("div"),s=v(`Filter years: `),o=L("input"),u=v(` - - `),a=L("input"),i=T(),h(f.$$.fragment),G(o,"type","number"),G(o,"min",2017),G(o,"max",2022),G(o,"class","svelte-1ft65rw"),G(a,"type","number"),G(a,"min",2017),G(a,"max",2022),G(a,"class","svelte-1ft65rw"),me(e,"border","1px solid black"),me(e,"padding","8px")},m(C,S){$(C,e,S),b(l,e,null),w(e,t),w(e,n),w(n,s),w(n,o),Ve(o,r[0].minYear),w(n,u),w(n,a),Ve(a,r[0].maxYear),w(e,i),b(f,e,null),c=!0,m||(g=[xe(o,"input",r[15]),xe(a,"input",r[16])],m=!0)},p(C,S){const y={};S&4194305&&(y.$$scope={dirty:S,ctx:C}),l.$set(y),S&1&&Gt(o.value)!==C[0].minYear&&Ve(o,C[0].minYear),S&1&&Gt(a.value)!==C[0].maxYear&&Ve(a,C[0].maxYear)},i(C){c||(_(l.$$.fragment,C),_(f.$$.fragment,C),c=!0)},o(C){d(l.$$.fragment,C),d(f.$$.fragment,C),c=!1},d(C){C&&p(e),k(l),k(f),m=!1,is(g)}}}function jc(r){let e;return{c(){e=v("Pedestrians")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Hc(r){let e;return{c(){e=v("Cyclists")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Gc(r){let e;return{c(){e=v("Horse riders")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Ec(r){let e;return{c(){e=v("Other")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Uc(r){let e,l,t,n,s,o,u,a,i,f,c,m;function g(N){r[11](N)}let C={$$slots:{default:[jc]},$$scope:{ctx:r}};r[0].pedestrians!==void 0&&(C.checked=r[0].pedestrians),e=new se({props:C}),U.push(()=>W(e,"checked",g));function S(N){r[12](N)}let y={$$slots:{default:[Hc]},$$scope:{ctx:r}};r[0].cyclists!==void 0&&(y.checked=r[0].cyclists),n=new se({props:y}),U.push(()=>W(n,"checked",S));function M(N){r[13](N)}let R={$$slots:{default:[Gc]},$$scope:{ctx:r}};r[0].horseRiders!==void 0&&(R.checked=r[0].horseRiders),u=new se({props:R}),U.push(()=>W(u,"checked",M));function A(N){r[14](N)}let O={$$slots:{default:[Ec]},$$scope:{ctx:r}};return r[0].other!==void 0&&(O.checked=r[0].other),f=new se({props:O}),U.push(()=>W(f,"checked",A)),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment),o=T(),h(u.$$.fragment),i=T(),h(f.$$.fragment)},m(N,I){b(e,N,I),$(N,t,I),b(n,N,I),$(N,o,I),b(u,N,I),$(N,i,I),b(f,N,I),m=!0},p(N,I){const F={};I&4194304&&(F.$$scope={dirty:I,ctx:N}),!l&&I&1&&(l=!0,F.checked=N[0].pedestrians,Y(()=>l=!1)),e.$set(F);const P={};I&4194304&&(P.$$scope={dirty:I,ctx:N}),!s&&I&1&&(s=!0,P.checked=N[0].cyclists,Y(()=>s=!1)),n.$set(P);const z={};I&4194304&&(z.$$scope={dirty:I,ctx:N}),!a&&I&1&&(a=!0,z.checked=N[0].horseRiders,Y(()=>a=!1)),u.$set(z);const X={};I&4194304&&(X.$$scope={dirty:I,ctx:N}),!c&&I&1&&(c=!0,X.checked=N[0].other,Y(()=>c=!1)),f.$set(X)},i(N){m||(_(e.$$.fragment,N),_(n.$$.fragment,N),_(u.$$.fragment,N),_(f.$$.fragment,N),m=!0)},o(N){d(e.$$.fragment,N),d(n.$$.fragment,N),d(u.$$.fragment,N),d(f.$$.fragment,N),m=!1},d(N){N&&(p(t),p(o),p(i)),k(e,N),k(n,N),k(u,N),k(f,N)}}}function bl(r){let e,l,t,n=r[3][r[21].pedestrian_location]+"",s;return{c(){e=L("p"),l=v("Pedestrian location: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&2097152&&n!==(n=o[3][o[21].pedestrian_location]+"")&&B(s,n)},d(o){o&&p(e)}}}function kl(r){let e,l,t,n=r[4][r[21].pedestrian_movement]+"",s;return{c(){e=L("p"),l=v("Pedestrian movement: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&2097152&&n!==(n=o[4][o[21].pedestrian_movement]+"")&&B(s,n)},d(o){o&&p(e)}}}function Wc(r){let e,l,t,n=r[21].year+"",s,o,u,a,i,f=r[5][r[21].severity]+"",c,m,g,C,S,y=wl(r[21])+"",M,R,A,O,N,I=r[21].pedestrian_location&&bl(r),F=r[21].pedestrian_movement&&kl(r);return{c(){e=L("p"),l=v("Year: "),t=L("b"),s=v(n),o=T(),u=L("p"),a=v("Severity: "),i=L("b"),c=v(f),m=T(),g=L("p"),C=v("Casualties: "),S=L("b"),M=v(y),R=T(),I&&I.c(),A=T(),F&&F.c(),O=T(),N=L("p"),N.textContent="Click to open full report in CycleStreets"},m(P,z){$(P,e,z),w(e,l),w(e,t),w(t,s),$(P,o,z),$(P,u,z),w(u,a),w(u,i),w(i,c),$(P,m,z),$(P,g,z),w(g,C),w(g,S),w(S,M),$(P,R,z),I&&I.m(P,z),$(P,A,z),F&&F.m(P,z),$(P,O,z),$(P,N,z)},p(P,z){z&2097152&&n!==(n=P[21].year+"")&&B(s,n),z&2097152&&f!==(f=P[5][P[21].severity]+"")&&B(c,f),z&2097152&&y!==(y=wl(P[21])+"")&&B(M,y),P[21].pedestrian_location?I?I.p(P,z):(I=bl(P),I.c(),I.m(A.parentNode,A)):I&&(I.d(1),I=null),P[21].pedestrian_movement?F?F.p(P,z):(F=kl(P),F.c(),F.m(O.parentNode,O)):F&&(F.d(1),F=null)},d(P){P&&(p(e),p(o),p(u),p(m),p(g),p(R),p(A),p(O),p(N)),I&&I.d(P),F&&F.d(P)}}}function Yc(r){let e,l;return e=new oe({props:{$$slots:{default:[Wc,({props:t})=>({21:t}),({props:t})=>t?2097152:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&6291456&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Jc(r){let e,l;const t=[H(Rt),{sourceLayer:Rt},{paint:{"circle-color":be(["get","severity"],[1,2,3],[r[6],r[7],r[8]]),"circle-opacity":.9,"circle-radius":["interpolate",["linear"],["zoom"],1,2,8,3,13,15],"circle-stroke-color":"black","circle-stroke-width":.1}},{filter:r[1]},{layout:{visibility:r[0].show?"visible":"none"}},{hoverCursor:"pointer"},{eventsIfTopMost:!0}];let n={$$slots:{default:[Yc]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",u));let i=r[0].show&&hl(r);return s=new _e({props:{url:`pmtiles://${pe()}/v1/${Rt}.pmtiles`,$$slots:{default:[Jc]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&4194304&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0].show,Y(()=>l=!1)),e.$set(m),f[0].show?i?(i.p(f,c),c&1&&_(i,1)):(i=hl(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&4194307&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let Rt="stats19";function Qc(r){let[e,l,t]=r.split("/");return{show:!0,pedestrians:e.includes("pedestrians"),cyclists:e.includes("cyclists"),horseRiders:e.includes("horseRiders"),other:e.includes("other"),minYear:parseInt(l),maxYear:parseInt(t)}}function wl(r){let e=[];return r.pedestrian&&e.push("pedestrian"),r.cyclist&&e.push("cyclist"),r.horse_rider&&e.push("horse rider"),r.other&&e.push("other"),e.join(", ")}function Zc(r){window.open(`https://www.cyclestreets.net/collisions/reports/${r.detail.features[0].properties.accident_index}`,"_blank")}function Kc(r,e,l){let t,n,s=["pedestrians","cyclists","horseRiders","other"],o={show:!1,pedestrians:!0,cyclists:!0,horseRiders:!0,other:!1,minYear:2017,maxYear:2022};function u(P){return P.show?`${s.filter(X=>P[X]).join(",")}/${P.minYear}/${P.maxYear}`:null}let a=_t(Rt,o,u,Qc);Z(r,a,P=>l(0,n=P));function i(P,z,X,E,q,D){let j=["any"];return n.pedestrians&&j.push(["get","pedestrian"]),n.cyclists&&j.push(["get","cyclist"]),n.horseRiders&&j.push(["get","horse_rider"]),n.other&&j.push(["get","other"]),["all",[">=",["get","year"],n.minYear],["<=",["get","year"],n.maxYear],j]}let f={1:"Crossing on pedestrian crossing facility",2:"Crossing in zig-zag approach lines",3:"Crossing in zig-zag exit lines",4:"Crossing elsewhere within 50m. of pedestrian crossing",5:"In carriageway, crossing elsewhere",6:"On footway or verge",7:"On refuge, central island or central reservation",8:"In centre of carriageway - not on refuge, island or central reservation",9:"In carriageway, not crossing"},c={1:"Crossing from driver's nearside",2:"Crossing from nearside - masked by parked or stationary vehicle",3:"Crossing from driver's offside",4:"Crossing from offside - masked by parked or stationary vehicle",5:"In carriageway, stationary - not crossing (standing or playing)",6:"In carriageway, stationary - not crossing (standing or playing - masked by parked or stationary vehicle)",7:"Walking along in carriageway, facing traffic",8:"Walking along in carriageway, back to traffic"},m={1:"Fatal",2:"Serious",3:"Slight"},g=K.sequential_low_to_high[4],C=K.sequential_low_to_high[2],S=K.sequential_low_to_high[0],y=[["Fatal",g],["Serious",C],["Slight",S]];function M(P){r.$$.not_equal(n.show,P)&&(n.show=P,a.set(n))}function R(P){r.$$.not_equal(n.pedestrians,P)&&(n.pedestrians=P,a.set(n))}function A(P){r.$$.not_equal(n.cyclists,P)&&(n.cyclists=P,a.set(n))}function O(P){r.$$.not_equal(n.horseRiders,P)&&(n.horseRiders=P,a.set(n))}function N(P){r.$$.not_equal(n.other,P)&&(n.other=P,a.set(n))}function I(){n.minYear=Gt(this.value),a.set(n)}function F(){n.maxYear=Gt(this.value),a.set(n)}return r.$$.update=()=>{r.$$.dirty&1&&l(1,t=i(n.minYear,n.maxYear,n.pedestrians,n.cyclists,n.horseRiders,n.other))},[n,t,a,f,c,m,g,C,S,y,M,R,A,O,N,I,F]}class Xc extends V{constructor(e){super(),Q(this,e,Kc,Vc,J,{})}}function xc(r){let e;return{c(){e=v("Vehicle counts")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function e$(r){let e;return{c(){e=v(`DfT road statistics + `),a=L("input"),i=T(),h(f.$$.fragment),G(o,"type","number"),G(o,"min",2017),G(o,"max",2022),G(o,"class","svelte-1ft65rw"),G(a,"type","number"),G(a,"min",2017),G(a,"max",2022),G(a,"class","svelte-1ft65rw"),me(e,"border","1px solid black"),me(e,"padding","8px")},m(C,S){$(C,e,S),b(l,e,null),w(e,t),w(e,n),w(n,s),w(n,o),Ve(o,r[0].minYear),w(n,u),w(n,a),Ve(a,r[0].maxYear),w(e,i),b(f,e,null),c=!0,m||(g=[xe(o,"input",r[15]),xe(a,"input",r[16])],m=!0)},p(C,S){const y={};S&4194305&&(y.$$scope={dirty:S,ctx:C}),l.$set(y),S&1&&Gt(o.value)!==C[0].minYear&&Ve(o,C[0].minYear),S&1&&Gt(a.value)!==C[0].maxYear&&Ve(a,C[0].maxYear)},i(C){c||(_(l.$$.fragment,C),_(f.$$.fragment,C),c=!0)},o(C){d(l.$$.fragment,C),d(f.$$.fragment,C),c=!1},d(C){C&&p(e),k(l),k(f),m=!1,is(g)}}}function Bc(r){let e;return{c(){e=v("Pedestrians")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Hc(r){let e;return{c(){e=v("Cyclists")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Gc(r){let e;return{c(){e=v("Horse riders")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Ec(r){let e;return{c(){e=v("Other")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Uc(r){let e,l,t,n,s,o,u,a,i,f,c,m;function g(N){r[11](N)}let C={$$slots:{default:[Bc]},$$scope:{ctx:r}};r[0].pedestrians!==void 0&&(C.checked=r[0].pedestrians),e=new se({props:C}),U.push(()=>W(e,"checked",g));function S(N){r[12](N)}let y={$$slots:{default:[Hc]},$$scope:{ctx:r}};r[0].cyclists!==void 0&&(y.checked=r[0].cyclists),n=new se({props:y}),U.push(()=>W(n,"checked",S));function M(N){r[13](N)}let R={$$slots:{default:[Gc]},$$scope:{ctx:r}};r[0].horseRiders!==void 0&&(R.checked=r[0].horseRiders),u=new se({props:R}),U.push(()=>W(u,"checked",M));function A(N){r[14](N)}let O={$$slots:{default:[Ec]},$$scope:{ctx:r}};return r[0].other!==void 0&&(O.checked=r[0].other),f=new se({props:O}),U.push(()=>W(f,"checked",A)),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment),o=T(),h(u.$$.fragment),i=T(),h(f.$$.fragment)},m(N,I){b(e,N,I),$(N,t,I),b(n,N,I),$(N,o,I),b(u,N,I),$(N,i,I),b(f,N,I),m=!0},p(N,I){const F={};I&4194304&&(F.$$scope={dirty:I,ctx:N}),!l&&I&1&&(l=!0,F.checked=N[0].pedestrians,Y(()=>l=!1)),e.$set(F);const P={};I&4194304&&(P.$$scope={dirty:I,ctx:N}),!s&&I&1&&(s=!0,P.checked=N[0].cyclists,Y(()=>s=!1)),n.$set(P);const z={};I&4194304&&(z.$$scope={dirty:I,ctx:N}),!a&&I&1&&(a=!0,z.checked=N[0].horseRiders,Y(()=>a=!1)),u.$set(z);const X={};I&4194304&&(X.$$scope={dirty:I,ctx:N}),!c&&I&1&&(c=!0,X.checked=N[0].other,Y(()=>c=!1)),f.$set(X)},i(N){m||(_(e.$$.fragment,N),_(n.$$.fragment,N),_(u.$$.fragment,N),_(f.$$.fragment,N),m=!0)},o(N){d(e.$$.fragment,N),d(n.$$.fragment,N),d(u.$$.fragment,N),d(f.$$.fragment,N),m=!1},d(N){N&&(p(t),p(o),p(i)),k(e,N),k(n,N),k(u,N),k(f,N)}}}function bl(r){let e,l,t,n=r[3][r[21].pedestrian_location]+"",s;return{c(){e=L("p"),l=v("Pedestrian location: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&2097152&&n!==(n=o[3][o[21].pedestrian_location]+"")&&j(s,n)},d(o){o&&p(e)}}}function kl(r){let e,l,t,n=r[4][r[21].pedestrian_movement]+"",s;return{c(){e=L("p"),l=v("Pedestrian movement: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&2097152&&n!==(n=o[4][o[21].pedestrian_movement]+"")&&j(s,n)},d(o){o&&p(e)}}}function Wc(r){let e,l,t,n=r[21].year+"",s,o,u,a,i,f=r[5][r[21].severity]+"",c,m,g,C,S,y=wl(r[21])+"",M,R,A,O,N,I=r[21].pedestrian_location&&bl(r),F=r[21].pedestrian_movement&&kl(r);return{c(){e=L("p"),l=v("Year: "),t=L("b"),s=v(n),o=T(),u=L("p"),a=v("Severity: "),i=L("b"),c=v(f),m=T(),g=L("p"),C=v("Casualties: "),S=L("b"),M=v(y),R=T(),I&&I.c(),A=T(),F&&F.c(),O=T(),N=L("p"),N.textContent="Click to open full report in CycleStreets"},m(P,z){$(P,e,z),w(e,l),w(e,t),w(t,s),$(P,o,z),$(P,u,z),w(u,a),w(u,i),w(i,c),$(P,m,z),$(P,g,z),w(g,C),w(g,S),w(S,M),$(P,R,z),I&&I.m(P,z),$(P,A,z),F&&F.m(P,z),$(P,O,z),$(P,N,z)},p(P,z){z&2097152&&n!==(n=P[21].year+"")&&j(s,n),z&2097152&&f!==(f=P[5][P[21].severity]+"")&&j(c,f),z&2097152&&y!==(y=wl(P[21])+"")&&j(M,y),P[21].pedestrian_location?I?I.p(P,z):(I=bl(P),I.c(),I.m(A.parentNode,A)):I&&(I.d(1),I=null),P[21].pedestrian_movement?F?F.p(P,z):(F=kl(P),F.c(),F.m(O.parentNode,O)):F&&(F.d(1),F=null)},d(P){P&&(p(e),p(o),p(u),p(m),p(g),p(R),p(A),p(O),p(N)),I&&I.d(P),F&&F.d(P)}}}function Yc(r){let e,l;return e=new oe({props:{$$slots:{default:[Wc,({props:t})=>({21:t}),({props:t})=>t?2097152:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&6291456&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Jc(r){let e,l;const t=[H(Rt),{sourceLayer:Rt},{paint:{"circle-color":be(["get","severity"],[1,2,3],[r[6],r[7],r[8]]),"circle-opacity":.9,"circle-radius":["interpolate",["linear"],["zoom"],1,2,8,3,13,15],"circle-stroke-color":"black","circle-stroke-width":.1}},{filter:r[1]},{layout:{visibility:r[0].show?"visible":"none"}},{hoverCursor:"pointer"},{eventsIfTopMost:!0}];let n={$$slots:{default:[Yc]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",u));let i=r[0].show&&hl(r);return s=new _e({props:{url:`pmtiles://${pe()}/v1/${Rt}.pmtiles`,$$slots:{default:[Jc]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&4194304&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0].show,Y(()=>l=!1)),e.$set(m),f[0].show?i?(i.p(f,c),c&1&&_(i,1)):(i=hl(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&4194307&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let Rt="stats19";function Qc(r){let[e,l,t]=r.split("/");return{show:!0,pedestrians:e.includes("pedestrians"),cyclists:e.includes("cyclists"),horseRiders:e.includes("horseRiders"),other:e.includes("other"),minYear:parseInt(l),maxYear:parseInt(t)}}function wl(r){let e=[];return r.pedestrian&&e.push("pedestrian"),r.cyclist&&e.push("cyclist"),r.horse_rider&&e.push("horse rider"),r.other&&e.push("other"),e.join(", ")}function Zc(r){window.open(`https://www.cyclestreets.net/collisions/reports/${r.detail.features[0].properties.accident_index}`,"_blank")}function Kc(r,e,l){let t,n,s=["pedestrians","cyclists","horseRiders","other"],o={show:!1,pedestrians:!0,cyclists:!0,horseRiders:!0,other:!1,minYear:2017,maxYear:2022};function u(P){return P.show?`${s.filter(X=>P[X]).join(",")}/${P.minYear}/${P.maxYear}`:null}let a=_t(Rt,o,u,Qc);Z(r,a,P=>l(0,n=P));function i(P,z,X,E,q,D){let B=["any"];return n.pedestrians&&B.push(["get","pedestrian"]),n.cyclists&&B.push(["get","cyclist"]),n.horseRiders&&B.push(["get","horse_rider"]),n.other&&B.push(["get","other"]),["all",[">=",["get","year"],n.minYear],["<=",["get","year"],n.maxYear],B]}let f={1:"Crossing on pedestrian crossing facility",2:"Crossing in zig-zag approach lines",3:"Crossing in zig-zag exit lines",4:"Crossing elsewhere within 50m. of pedestrian crossing",5:"In carriageway, crossing elsewhere",6:"On footway or verge",7:"On refuge, central island or central reservation",8:"In centre of carriageway - not on refuge, island or central reservation",9:"In carriageway, not crossing"},c={1:"Crossing from driver's nearside",2:"Crossing from nearside - masked by parked or stationary vehicle",3:"Crossing from driver's offside",4:"Crossing from offside - masked by parked or stationary vehicle",5:"In carriageway, stationary - not crossing (standing or playing)",6:"In carriageway, stationary - not crossing (standing or playing - masked by parked or stationary vehicle)",7:"Walking along in carriageway, facing traffic",8:"Walking along in carriageway, back to traffic"},m={1:"Fatal",2:"Serious",3:"Slight"},g=K.sequential_low_to_high[4],C=K.sequential_low_to_high[2],S=K.sequential_low_to_high[0],y=[["Fatal",g],["Serious",C],["Slight",S]];function M(P){r.$$.not_equal(n.show,P)&&(n.show=P,a.set(n))}function R(P){r.$$.not_equal(n.pedestrians,P)&&(n.pedestrians=P,a.set(n))}function A(P){r.$$.not_equal(n.cyclists,P)&&(n.cyclists=P,a.set(n))}function O(P){r.$$.not_equal(n.horseRiders,P)&&(n.horseRiders=P,a.set(n))}function N(P){r.$$.not_equal(n.other,P)&&(n.other=P,a.set(n))}function I(){n.minYear=Gt(this.value),a.set(n)}function F(){n.maxYear=Gt(this.value),a.set(n)}return r.$$.update=()=>{r.$$.dirty&1&&l(1,t=i(n.minYear,n.maxYear,n.pedestrians,n.cyclists,n.horseRiders,n.other))},[n,t,a,f,c,m,g,C,S,y,M,R,A,O,N,I,F]}class Xc extends V{constructor(e){super(),Q(this,e,Kc,Vc,J,{})}}function xc(r){let e;return{c(){e=v("Vehicle counts")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function e$(r){let e;return{c(){e=v(`DfT road statistics `)},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function t$(r){let e;return{c(){e=v("methodology")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function n$(r){let e,l,t,n,s,o,u,a,i,f,c;return t=new x({props:{href:"https://roadtraffic.dft.gov.uk/downloads",$$slots:{default:[e$]},$$scope:{ctx:r}}}),s=new x({props:{href:"https://storage.googleapis.com/dft-statistics/road-traffic/all-traffic-data-metadata.pdf",$$slots:{default:[t$]},$$scope:{ctx:r}}}),f=new De({}),{c(){e=L("p"),l=v("AADF (annual average daily flow) data from "),h(t.$$.fragment),n=v(`. This counts the total daily number of vehicles traveling past a count point (in both directions) on an average day of the year. Data from the latest year available is shown. See `),h(s.$$.fragment),o=v(" for details and caveats about the measurements."),u=T(),a=L("p"),a.textContent=`The colors show motor vehicles AADF, not pedal cycles. The outline is thicker when the latest data is a manual or automatic count, and thinner when it's an estimate from previous years or nearby counters. Click a - point for full data.`,i=T(),h(f.$$.fragment)},m(m,g){$(m,e,g),w(e,l),b(t,e,null),w(e,n),b(s,e,null),w(e,o),$(m,u,g),$(m,a,g),$(m,i,g),b(f,m,g),c=!0},p(m,g){const C={};g&128&&(C.$$scope={dirty:g,ctx:m}),t.$set(C);const S={};g&128&&(S.$$scope={dirty:g,ctx:m}),s.$set(S)},i(m){c||(_(t.$$.fragment,m),_(s.$$.fragment,m),_(f.$$.fragment,m),c=!0)},o(m){d(t.$$.fragment,m),d(s.$$.fragment,m),d(f.$$.fragment,m),c=!1},d(m){m&&(p(e),p(u),p(a),p(i)),k(t),k(s),k(f,m)}}}function l$(r){let e,l,t;return l=new ce({props:{$$slots:{default:[n$]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&128&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function vl(r){let e,l;return e=new Be({props:{colorScale:r[1],limits:r[3]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p:te,i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function s$(r){let e,l=r[6].location+"",t,n,s,o,u=r[6].year+"",a,i,f,c=r[6].motor_vehicles.toLocaleString()+"",m,g,C,S,y=r[6].year+"",M,R,A,O=r[6].pedal_cycles.toLocaleString()+"",N,I,F,P,z,X=r[6].method+"",E;return{c(){e=L("h2"),t=v(l),n=T(),s=L("p"),o=v("Total motor vehicles ("),a=v(u),i=v(` AADF): + point for full data.`,i=T(),h(f.$$.fragment)},m(m,g){$(m,e,g),w(e,l),b(t,e,null),w(e,n),b(s,e,null),w(e,o),$(m,u,g),$(m,a,g),$(m,i,g),b(f,m,g),c=!0},p(m,g){const C={};g&128&&(C.$$scope={dirty:g,ctx:m}),t.$set(C);const S={};g&128&&(S.$$scope={dirty:g,ctx:m}),s.$set(S)},i(m){c||(_(t.$$.fragment,m),_(s.$$.fragment,m),_(f.$$.fragment,m),c=!0)},o(m){d(t.$$.fragment,m),d(s.$$.fragment,m),d(f.$$.fragment,m),c=!1},d(m){m&&(p(e),p(u),p(a),p(i)),k(t),k(s),k(f,m)}}}function l$(r){let e,l,t;return l=new ce({props:{$$slots:{default:[n$]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&128&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function vl(r){let e,l;return e=new je({props:{colorScale:r[1],limits:r[3]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p:te,i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function s$(r){let e,l=r[6].location+"",t,n,s,o,u=r[6].year+"",a,i,f,c=r[6].motor_vehicles.toLocaleString()+"",m,g,C,S,y=r[6].year+"",M,R,A,O=r[6].pedal_cycles.toLocaleString()+"",N,I,F,P,z,X=r[6].method+"",E;return{c(){e=L("h2"),t=v(l),n=T(),s=L("p"),o=v("Total motor vehicles ("),a=v(u),i=v(` AADF): `),f=L("b"),m=v(c),g=T(),C=L("p"),S=v("Total pedal cycles ("),M=v(y),R=v(` AADF): - `),A=L("b"),N=v(O),I=T(),F=L("p"),P=v("Count method: "),z=L("b"),E=v(X)},m(q,D){$(q,e,D),w(e,t),$(q,n,D),$(q,s,D),w(s,o),w(s,a),w(s,i),w(s,f),w(f,m),$(q,g,D),$(q,C,D),w(C,S),w(C,M),w(C,R),w(C,A),w(A,N),$(q,I,D),$(q,F,D),w(F,P),w(F,z),w(z,E)},p(q,D){D&64&&l!==(l=q[6].location+"")&&B(t,l),D&64&&u!==(u=q[6].year+"")&&B(a,u),D&64&&c!==(c=q[6].motor_vehicles.toLocaleString()+"")&&B(m,c),D&64&&y!==(y=q[6].year+"")&&B(M,y),D&64&&O!==(O=q[6].pedal_cycles.toLocaleString()+"")&&B(N,O),D&64&&X!==(X=q[6].method+"")&&B(E,X)},d(q){q&&(p(e),p(n),p(s),p(g),p(C),p(I),p(F))}}}function r$(r){let e,l;return e=new oe({props:{$$slots:{default:[s$,({props:t})=>({6:t}),({props:t})=>t?64:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&192&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function o$(r){let e,l;const t=[H(Dt),{sourceLayer:Dt},{paint:{"circle-color":be(["get","motor_vehicles"],r[2],r[1]),"circle-opacity":.9,"circle-radius":["interpolate",["linear"],["zoom"],1,2,8,3,13,15],"circle-stroke-color":"black","circle-stroke-width":["case",["in",["get","method"],["literal",["Manual count","Automatic counter"]]],1.5,.1]}},{layout:{visibility:r[0]?"visible":"none"}},{hoverCursor:"pointer"},{eventsIfTopMost:!0}];let n={$$slots:{default:[r$]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",u));let i=r[0]&&vl(r);return s=new _e({props:{url:`pmtiles://${pe()}/v1/${Dt}.pmtiles`,$$slots:{default:[o$]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&128&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0],Y(()=>l=!1)),e.$set(m),f[0]?i?(i.p(f,c),c&1&&_(i,1)):(i=vl(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&129&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let Dt="vehicle_counts";function a$(r){window.open(`https://roadtraffic.dft.gov.uk/manualcountpoints/${r.detail.features[0].properties.count_point}`,"_blank")}function f$(r,e,l){let t,n=K.sequential_low_to_high,s=[0,4e4,8e4,12e4,16e4,205e3],o=["","40k","80k","120k","160k",""],u=ke(Dt);Z(r,u,i=>l(0,t=i));function a(i){t=i,u.set(t)}return[t,n,s,o,u,a]}class u$ extends V{constructor(e){super(),Q(this,e,f$,i$,J,{})}}function yl(r,e,l){const t=r.slice();return t[6]=e[l],t}function c$(r){let e;return{c(){e=v("Issues & Conflicts")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function $$(r){let e,l,t;return{c(){e=L("p"),e.textContent=`Critical issues and policy conflicts from the Design Assistance Log. + `),A=L("b"),N=v(O),I=T(),F=L("p"),P=v("Count method: "),z=L("b"),E=v(X)},m(q,D){$(q,e,D),w(e,t),$(q,n,D),$(q,s,D),w(s,o),w(s,a),w(s,i),w(s,f),w(f,m),$(q,g,D),$(q,C,D),w(C,S),w(C,M),w(C,R),w(C,A),w(A,N),$(q,I,D),$(q,F,D),w(F,P),w(F,z),w(z,E)},p(q,D){D&64&&l!==(l=q[6].location+"")&&j(t,l),D&64&&u!==(u=q[6].year+"")&&j(a,u),D&64&&c!==(c=q[6].motor_vehicles.toLocaleString()+"")&&j(m,c),D&64&&y!==(y=q[6].year+"")&&j(M,y),D&64&&O!==(O=q[6].pedal_cycles.toLocaleString()+"")&&j(N,O),D&64&&X!==(X=q[6].method+"")&&j(E,X)},d(q){q&&(p(e),p(n),p(s),p(g),p(C),p(I),p(F))}}}function r$(r){let e,l;return e=new oe({props:{$$slots:{default:[s$,({props:t})=>({6:t}),({props:t})=>t?64:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&192&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function o$(r){let e,l;const t=[H(Dt),{sourceLayer:Dt},{paint:{"circle-color":be(["get","motor_vehicles"],r[2],r[1]),"circle-opacity":.9,"circle-radius":["interpolate",["linear"],["zoom"],1,2,8,3,13,15],"circle-stroke-color":"black","circle-stroke-width":["case",["in",["get","method"],["literal",["Manual count","Automatic counter"]]],1.5,.1]}},{layout:{visibility:r[0]?"visible":"none"}},{hoverCursor:"pointer"},{eventsIfTopMost:!0}];let n={$$slots:{default:[r$]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",u));let i=r[0]&&vl(r);return s=new _e({props:{url:`pmtiles://${pe()}/v1/${Dt}.pmtiles`,$$slots:{default:[o$]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&128&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0],Y(()=>l=!1)),e.$set(m),f[0]?i?(i.p(f,c),c&1&&_(i,1)):(i=vl(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&129&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let Dt="vehicle_counts";function a$(r){window.open(`https://roadtraffic.dft.gov.uk/manualcountpoints/${r.detail.features[0].properties.count_point}`,"_blank")}function f$(r,e,l){let t,n=K.sequential_low_to_high,s=[0,4e4,8e4,12e4,16e4,205e3],o=["","40k","80k","120k","160k",""],u=ke(Dt);Z(r,u,i=>l(0,t=i));function a(i){t=i,u.set(t)}return[t,n,s,o,u,a]}class u$ extends V{constructor(e){super(),Q(this,e,f$,i$,J,{})}}function yl(r,e,l){const t=r.slice();return t[6]=e[l],t}function c$(r){let e;return{c(){e=v("Issues & Conflicts")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function $$(r){let e,l,t;return{c(){e=L("p"),e.textContent=`Critical issues and policy conflicts from the Design Assistance Log. This is internally collected data.`,l=T(),t=L("p"),t.textContent=`This layer is manually copied from a copy of the DA Log. The data is - recent as of 10 June 2024.`},m(n,s){$(n,e,s),$(n,l,s),$(n,t,s)},p:te,d(n){n&&(p(e),p(l),p(t))}}}function p$(r){let e,l,t;return l=new ce({props:{$$slots:{default:[$$]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&512&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Sl(r){let e,l;return e=new Qt({props:{rows:r[3]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p:te,i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function m$(r){let e,l=r[5]["Issue ID"]+"",t,n,s=r[5].Code+"",o,u,a,i=r[5]["Issue Stage"]+"",f;return{c(){e=L("h2"),t=v(l),n=v(" - "),o=v(s),u=T(),a=L("p"),f=v(i)},m(c,m){$(c,e,m),w(e,t),w(e,n),w(e,o),$(c,u,m),$(c,a,m),w(a,f)},p(c,m){m&32&&l!==(l=c[5]["Issue ID"]+"")&&B(t,l),m&32&&s!==(s=c[5].Code+"")&&B(o,s),m&32&&i!==(i=c[5]["Issue Stage"]+"")&&B(f,i)},d(c){c&&(p(e),p(u),p(a))}}}function Cl(r){let e,l=r[6]+"",t,n,s,o=r[5][r[6]]+"",u,a;return{c(){e=L("p"),t=v(l),n=v(`: - `),s=L("b"),u=v(o),a=T()},m(i,f){$(i,e,f),w(e,t),w(e,n),w(e,s),w(s,u),w(e,a)},p(i,f){f&32&&o!==(o=i[5][i[6]]+"")&&B(u,o)},d(i){i&&p(e)}}}function _$(r){let e,l=Se(r[2]),t=[];for(let n=0;n({5:s}),({props:s})=>s?32:0]},$$scope:{ctx:r}}}),t=new oe({props:{openOn:"click",popupClass:"border-popup",$$slots:{default:[_$,({props:s})=>({5:s}),({props:s})=>s?32:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment)},m(s,o){b(e,s,o),$(s,l,o),b(t,s,o),n=!0},p(s,o){const u={};o&544&&(u.$$scope={dirty:o,ctx:s}),e.$set(u);const a={};o&544&&(a.$$scope={dirty:o,ctx:s}),t.$set(a)},i(s){n||(_(e.$$.fragment,s),_(t.$$.fragment,s),n=!0)},o(s){d(e.$$.fragment,s),d(t.$$.fragment,s),n=!1},d(s){s&&p(l),k(e,s),k(t,s)}}}function d$(r){let e,l;const t=[H(ln),{paint:{"circle-color":Ze(["get","Design Review Status"],Object.fromEntries(r[3]),"cyan"),"circle-opacity":.9,"circle-radius":["interpolate",["linear"],["zoom"],1,2,8,3,13,15],"circle-stroke-color":"black","circle-stroke-width":.1}},{layout:{visibility:r[0]?"visible":"none"}},{hoverCursor:"pointer"},{eventsIfTopMost:!0}];let n={$$slots:{default:[g$]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",u));let i=r[0]&&Sl(r);return s=new pt({props:{data:`${Et()}/v1/problems.geojson.gz`,$$slots:{default:[d$]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&512&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0],Y(()=>l=!1)),e.$set(m),f[0]?i?(i.p(f,c),c&1&&_(i,1)):(i=Sl(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&513&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let ln="problems";function b$(r,e,l){let t,n=ke(ln);Z(r,n,a=>l(0,t=a));let s=["Issue ID","Scheme ID","Date Logged","Inspector","Street Location","Code","Issue Description","External Inspectorate Comment for LA","Issue Stage","Resolved by Design","Design Review Status","Date of Resolution","Design Resolution"],o=[["Outstanding","red"],["Pending","yellow"],["Resolved","green"],["Not Applicable","grey"],["No Resolution Planned","black"]];function u(a){t=a,n.set(t)}return[t,n,s,o,u]}class k$ extends V{constructor(e){super(),Q(this,e,b$,h$,J,{})}}function w$(r){let e,l,t,n,s,o,u,a;return e=new oc({}),t=new hc({}),s=new Dc({}),u=new Nc({}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment),n=T(),h(s.$$.fragment),o=T(),h(u.$$.fragment)},m(i,f){b(e,i,f),$(i,l,f),b(t,i,f),$(i,n,f),b(s,i,f),$(i,o,f),b(u,i,f),a=!0},i(i){a||(_(e.$$.fragment,i),_(t.$$.fragment,i),_(s.$$.fragment,i),_(u.$$.fragment,i),a=!0)},o(i){d(e.$$.fragment,i),d(t.$$.fragment,i),d(s.$$.fragment,i),d(u.$$.fragment,i),a=!1},d(i){i&&(p(l),p(n),p(o)),k(e,i),k(t,i),k(s,i),k(u,i)}}}function v$(r){let e,l;return e=new nt({props:{small:!0,$$slots:{default:[w$]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&64&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function y$(r){let e,l,t,n,s,o,u,a,i,f,c,m;return e=new wa({}),t=new Ka({}),s=new Oa({}),u=new Ha({}),i=new Yu({}),c=new Cu({}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment),n=T(),h(s.$$.fragment),o=T(),h(u.$$.fragment),a=T(),h(i.$$.fragment),f=T(),h(c.$$.fragment)},m(g,C){b(e,g,C),$(g,l,C),b(t,g,C),$(g,n,C),b(s,g,C),$(g,o,C),b(u,g,C),$(g,a,C),b(i,g,C),$(g,f,C),b(c,g,C),m=!0},i(g){m||(_(e.$$.fragment,g),_(t.$$.fragment,g),_(s.$$.fragment,g),_(u.$$.fragment,g),_(i.$$.fragment,g),_(c.$$.fragment,g),m=!0)},o(g){d(e.$$.fragment,g),d(t.$$.fragment,g),d(s.$$.fragment,g),d(u.$$.fragment,g),d(i.$$.fragment,g),d(c.$$.fragment,g),m=!1},d(g){g&&(p(l),p(n),p(o),p(a),p(f)),k(e,g),k(t,g),k(s,g),k(u,g),k(i,g),k(c,g)}}}function S$(r){let e,l;return e=new nt({props:{small:!0,$$slots:{default:[y$]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&64&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function C$(r){let e,l,t,n,s,o;return e=new ia({}),t=new su({}),s=new mu({}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment),n=T(),h(s.$$.fragment)},m(u,a){b(e,u,a),$(u,l,a),b(t,u,a),$(u,n,a),b(s,u,a),o=!0},i(u){o||(_(e.$$.fragment,u),_(t.$$.fragment,u),_(s.$$.fragment,u),o=!0)},o(u){d(e.$$.fragment,u),d(t.$$.fragment,u),d(s.$$.fragment,u),o=!1},d(u){u&&(p(l),p(n)),k(e,u),k(t,u),k(s,u)}}}function L$(r){let e,l,t,n,s,o,u,a,i,f;return e=new gi({}),t=new Ji({}),s=new yo({}),u=new Wo({}),i=new ri({}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment),n=T(),h(s.$$.fragment),o=T(),h(u.$$.fragment),a=T(),h(i.$$.fragment)},m(c,m){b(e,c,m),$(c,l,m),b(t,c,m),$(c,n,m),b(s,c,m),$(c,o,m),b(u,c,m),$(c,a,m),b(i,c,m),f=!0},i(c){f||(_(e.$$.fragment,c),_(t.$$.fragment,c),_(s.$$.fragment,c),_(u.$$.fragment,c),_(i.$$.fragment,c),f=!0)},o(c){d(e.$$.fragment,c),d(t.$$.fragment,c),d(s.$$.fragment,c),d(u.$$.fragment,c),d(i.$$.fragment,c),f=!1},d(c){c&&(p(l),p(n),p(o),p(a)),k(e,c),k(t,c),k(s,c),k(u,c),k(i,c)}}}function T$(r){let e,l;return e=new nt({props:{small:!0,$$slots:{default:[L$]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&64&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function M$(r){let e,l,t,n;return e=new co({}),t=new Do({}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment)},m(s,o){b(e,s,o),$(s,l,o),b(t,s,o),n=!0},i(s){n||(_(e.$$.fragment,s),_(t.$$.fragment,s),n=!0)},o(s){d(e.$$.fragment,s),d(t.$$.fragment,s),n=!1},d(s){s&&p(l),k(e,s),k(t,s)}}}function N$(r){let e,l;return e=new nt({props:{small:!0,$$slots:{default:[M$]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&64&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function P$(r){let e,l,t,n,s,o,u,a;return e=new Zf({}),t=new cf({}),s=new jf({}),u=new k$({}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment),n=T(),h(s.$$.fragment),o=T(),h(u.$$.fragment)},m(i,f){b(e,i,f),$(i,l,f),b(t,i,f),$(i,n,f),b(s,i,f),$(i,o,f),b(u,i,f),a=!0},i(i){a||(_(e.$$.fragment,i),_(t.$$.fragment,i),_(s.$$.fragment,i),_(u.$$.fragment,i),a=!0)},o(i){d(e.$$.fragment,i),d(t.$$.fragment,i),d(s.$$.fragment,i),d(u.$$.fragment,i),a=!1},d(i){i&&(p(l),p(n),p(o)),k(e,i),k(t,i),k(s,i),k(u,i)}}}function O$(r){let e,l,t,n,s,o,u,a,i=en()=="Private (development)",f,c,m,g,C;e=new u$({}),t=new Xc({}),s=new Tf({}),u=new Au({});let S=i&&P$();return c=new Li({}),g=new Fi({}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment),n=T(),h(s.$$.fragment),o=T(),h(u.$$.fragment),a=T(),S&&S.c(),f=T(),h(c.$$.fragment),m=T(),h(g.$$.fragment)},m(y,M){b(e,y,M),$(y,l,M),b(t,y,M),$(y,n,M),b(s,y,M),$(y,o,M),b(u,y,M),$(y,a,M),S&&S.m(y,M),$(y,f,M),b(c,y,M),$(y,m,M),b(g,y,M),C=!0},p:te,i(y){C||(_(e.$$.fragment,y),_(t.$$.fragment,y),_(s.$$.fragment,y),_(u.$$.fragment,y),_(S),_(c.$$.fragment,y),_(g.$$.fragment,y),C=!0)},o(y){d(e.$$.fragment,y),d(t.$$.fragment,y),d(s.$$.fragment,y),d(u.$$.fragment,y),d(S),d(c.$$.fragment,y),d(g.$$.fragment,y),C=!1},d(y){y&&(p(l),p(n),p(o),p(a),p(f),p(m)),k(e,y),k(t,y),k(s,y),k(u,y),S&&S.d(y),k(c,y),k(g,y)}}}function I$(r){let e,l;return e=new nt({props:{small:!0,$$slots:{default:[O$]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&64&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function R$(r){let e,l,t,n,s;function o(a){r[5](a)}let u={cfg:r[4],map:r[2]};return r[0]!==void 0&&(u.enabled=r[0]),e=new Os({props:u}),U.push(()=>W(e,"enabled",o)),n=new pr({}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,i){const f={};i&4&&(f.map=a[2]),!l&&i&1&&(l=!0,f.enabled=a[0],Y(()=>l=!1)),e.$set(f)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}function D$(r){let e,l,t,n,s,o,u,a,i,f,c,m,g,C,S,y;return e=new qe({props:{label:"Trip generators",$$slots:{default:[v$]},$$scope:{ctx:r}}}),t=new qe({props:{label:"Existing infrastructure",$$slots:{default:[S$]},$$scope:{ctx:r}}}),s=new qe({props:{label:"Public transport",$$slots:{default:[C$]},$$scope:{ctx:r}}}),u=new qe({props:{label:"Boundaries",$$slots:{default:[T$]},$$scope:{ctx:r}}}),i=new qe({props:{label:"Census",$$slots:{default:[N$]},$$scope:{ctx:r}}}),c=new qe({props:{label:"Other",$$slots:{default:[I$]},$$scope:{ctx:r}}}),g=new qe({props:{label:"Tools",$$slots:{default:[R$]},$$scope:{ctx:r}}}),S=new Ns({props:{disabled:!r[1]}}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment),n=T(),h(s.$$.fragment),o=T(),h(u.$$.fragment),a=T(),h(i.$$.fragment),f=T(),h(c.$$.fragment),m=T(),h(g.$$.fragment),C=T(),h(S.$$.fragment)},m(M,R){b(e,M,R),$(M,l,R),b(t,M,R),$(M,n,R),b(s,M,R),$(M,o,R),b(u,M,R),$(M,a,R),b(i,M,R),$(M,f,R),b(c,M,R),$(M,m,R),b(g,M,R),$(M,C,R),b(S,M,R),y=!0},p(M,R){const A={};R&64&&(A.$$scope={dirty:R,ctx:M}),e.$set(A);const O={};R&64&&(O.$$scope={dirty:R,ctx:M}),t.$set(O);const N={};R&64&&(N.$$scope={dirty:R,ctx:M}),s.$set(N);const I={};R&64&&(I.$$scope={dirty:R,ctx:M}),u.$set(I);const F={};R&64&&(F.$$scope={dirty:R,ctx:M}),i.$set(F);const P={};R&64&&(P.$$scope={dirty:R,ctx:M}),c.$set(P);const z={};R&69&&(z.$$scope={dirty:R,ctx:M}),g.$set(z);const X={};R&2&&(X.disabled=!M[1]),S.$set(X)},i(M){y||(_(e.$$.fragment,M),_(t.$$.fragment,M),_(s.$$.fragment,M),_(u.$$.fragment,M),_(i.$$.fragment,M),_(c.$$.fragment,M),_(g.$$.fragment,M),_(S.$$.fragment,M),y=!0)},o(M){d(e.$$.fragment,M),d(t.$$.fragment,M),d(s.$$.fragment,M),d(u.$$.fragment,M),d(i.$$.fragment,M),d(c.$$.fragment,M),d(g.$$.fragment,M),d(S.$$.fragment,M),y=!1},d(M){M&&(p(l),p(n),p(o),p(a),p(f),p(m),p(C)),k(e,M),k(t,M),k(s,M),k(u,M),k(i,M),k(c,M),k(g,M),k(S,M)}}}function A$(r){let e,l;const t=[H("cover-interactive-layers"),{paint:{"fill-color":"black","fill-opacity":0}},{layout:{visibility:r[1]?"none":"visible"}}];let n={};for(let s=0;sl(1,n=i)),Z(r,rn,i=>l(2,s=i));let o={type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]}},u={getStreetViewRoadLayerNames:i=>Ps(i,ds(xt))};function a(i){t=i,l(0,t),l(1,n)}return r.$$.update=()=>{r.$$.dirty&2&&l(0,t=!n),r.$$.dirty&1&&Rn.set(!t)},[t,n,s,o,u,a]}class z$ extends V{constructor(e){super(),Q(this,e,q$,F$,J,{})}}function B$(r){let e;function l(s,o){return s[2]<=100?G$:H$}let t=l(r),n=t(r);return{c(){n.c(),e=Me()},m(s,o){n.m(s,o),$(s,e,o)},p(s,o){t===(t=l(s))&&n?n.p(s,o):(n.d(1),n=t(s),n&&(n.c(),n.m(e.parentNode,e)))},i:te,o:te,d(s){s&&p(e),n.d(s)}}}function j$(r){let e,l;return e=new tt({props:{$$slots:{default:[E$]},$$scope:{ctx:r}}}),e.$on("click",r[3]),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&64&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function H$(r){let e;return{c(){e=L("label"),e.innerHTML=`Processing scheme data + recent as of 10 June 2024.`},m(n,s){$(n,e,s),$(n,l,s),$(n,t,s)},p:te,d(n){n&&(p(e),p(l),p(t))}}}function p$(r){let e,l,t;return l=new ce({props:{$$slots:{default:[$$]},$$scope:{ctx:r}}}),{c(){e=L("span"),h(l.$$.fragment),G(e,"slot","right")},m(n,s){$(n,e,s),b(l,e,null),t=!0},p(n,s){const o={};s&512&&(o.$$scope={dirty:s,ctx:n}),l.$set(o)},i(n){t||(_(l.$$.fragment,n),t=!0)},o(n){d(l.$$.fragment,n),t=!1},d(n){n&&p(e),k(l)}}}function Sl(r){let e,l;return e=new Qt({props:{rows:r[3]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p:te,i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function m$(r){let e,l=r[5]["Issue ID"]+"",t,n,s=r[5].Code+"",o,u,a,i=r[5]["Issue Stage"]+"",f;return{c(){e=L("h2"),t=v(l),n=v(" - "),o=v(s),u=T(),a=L("p"),f=v(i)},m(c,m){$(c,e,m),w(e,t),w(e,n),w(e,o),$(c,u,m),$(c,a,m),w(a,f)},p(c,m){m&32&&l!==(l=c[5]["Issue ID"]+"")&&j(t,l),m&32&&s!==(s=c[5].Code+"")&&j(o,s),m&32&&i!==(i=c[5]["Issue Stage"]+"")&&j(f,i)},d(c){c&&(p(e),p(u),p(a))}}}function Cl(r){let e,l=r[6]+"",t,n,s,o=r[5][r[6]]+"",u,a;return{c(){e=L("p"),t=v(l),n=v(`: + `),s=L("b"),u=v(o),a=T()},m(i,f){$(i,e,f),w(e,t),w(e,n),w(e,s),w(s,u),w(e,a)},p(i,f){f&32&&o!==(o=i[5][i[6]]+"")&&j(u,o)},d(i){i&&p(e)}}}function _$(r){let e,l=Se(r[2]),t=[];for(let n=0;n({5:s}),({props:s})=>s?32:0]},$$scope:{ctx:r}}}),t=new oe({props:{openOn:"click",popupClass:"border-popup",$$slots:{default:[_$,({props:s})=>({5:s}),({props:s})=>s?32:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment)},m(s,o){b(e,s,o),$(s,l,o),b(t,s,o),n=!0},p(s,o){const u={};o&544&&(u.$$scope={dirty:o,ctx:s}),e.$set(u);const a={};o&544&&(a.$$scope={dirty:o,ctx:s}),t.$set(a)},i(s){n||(_(e.$$.fragment,s),_(t.$$.fragment,s),n=!0)},o(s){d(e.$$.fragment,s),d(t.$$.fragment,s),n=!1},d(s){s&&p(l),k(e,s),k(t,s)}}}function d$(r){let e,l;const t=[H(ln),{paint:{"circle-color":Ze(["get","Design Review Status"],Object.fromEntries(r[3]),"cyan"),"circle-opacity":.9,"circle-radius":["interpolate",["linear"],["zoom"],1,2,8,3,13,15],"circle-stroke-color":"black","circle-stroke-width":.1}},{layout:{visibility:r[0]?"visible":"none"}},{hoverCursor:"pointer"},{eventsIfTopMost:!0}];let n={$$slots:{default:[g$]},$$scope:{ctx:r}};for(let s=0;sW(e,"checked",u));let i=r[0]&&Sl(r);return s=new pt({props:{data:`${Et()}/v1/problems.geojson.gz`,$$slots:{default:[d$]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),t=T(),i&&i.c(),n=T(),h(s.$$.fragment)},m(f,c){b(e,f,c),$(f,t,c),i&&i.m(f,c),$(f,n,c),b(s,f,c),o=!0},p(f,[c]){const m={};c&512&&(m.$$scope={dirty:c,ctx:f}),!l&&c&1&&(l=!0,m.checked=f[0],Y(()=>l=!1)),e.$set(m),f[0]?i?(i.p(f,c),c&1&&_(i,1)):(i=Sl(f),i.c(),_(i,1),i.m(n.parentNode,n)):i&&(ae(),d(i,1,1,()=>{i=null}),fe());const g={};c&513&&(g.$$scope={dirty:c,ctx:f}),s.$set(g)},i(f){o||(_(e.$$.fragment,f),_(i),_(s.$$.fragment,f),o=!0)},o(f){d(e.$$.fragment,f),d(i),d(s.$$.fragment,f),o=!1},d(f){f&&(p(t),p(n)),k(e,f),i&&i.d(f),k(s,f)}}}let ln="problems";function b$(r,e,l){let t,n=ke(ln);Z(r,n,a=>l(0,t=a));let s=["Issue ID","Scheme ID","Date Logged","Inspector","Street Location","Code","Issue Description","External Inspectorate Comment for LA","Issue Stage","Resolved by Design","Design Review Status","Date of Resolution","Design Resolution"],o=[["Outstanding","red"],["Pending","yellow"],["Resolved","green"],["Not Applicable","grey"],["No Resolution Planned","black"]];function u(a){t=a,n.set(t)}return[t,n,s,o,u]}class k$ extends V{constructor(e){super(),Q(this,e,b$,h$,J,{})}}function w$(r){let e,l,t,n,s,o,u,a;return e=new oc({}),t=new hc({}),s=new Dc({}),u=new Nc({}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment),n=T(),h(s.$$.fragment),o=T(),h(u.$$.fragment)},m(i,f){b(e,i,f),$(i,l,f),b(t,i,f),$(i,n,f),b(s,i,f),$(i,o,f),b(u,i,f),a=!0},i(i){a||(_(e.$$.fragment,i),_(t.$$.fragment,i),_(s.$$.fragment,i),_(u.$$.fragment,i),a=!0)},o(i){d(e.$$.fragment,i),d(t.$$.fragment,i),d(s.$$.fragment,i),d(u.$$.fragment,i),a=!1},d(i){i&&(p(l),p(n),p(o)),k(e,i),k(t,i),k(s,i),k(u,i)}}}function v$(r){let e,l;return e=new nt({props:{small:!0,$$slots:{default:[w$]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&64&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function y$(r){let e,l,t,n,s,o,u,a,i,f,c,m;return e=new wa({}),t=new Ka({}),s=new Oa({}),u=new Ha({}),i=new Yu({}),c=new Cu({}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment),n=T(),h(s.$$.fragment),o=T(),h(u.$$.fragment),a=T(),h(i.$$.fragment),f=T(),h(c.$$.fragment)},m(g,C){b(e,g,C),$(g,l,C),b(t,g,C),$(g,n,C),b(s,g,C),$(g,o,C),b(u,g,C),$(g,a,C),b(i,g,C),$(g,f,C),b(c,g,C),m=!0},i(g){m||(_(e.$$.fragment,g),_(t.$$.fragment,g),_(s.$$.fragment,g),_(u.$$.fragment,g),_(i.$$.fragment,g),_(c.$$.fragment,g),m=!0)},o(g){d(e.$$.fragment,g),d(t.$$.fragment,g),d(s.$$.fragment,g),d(u.$$.fragment,g),d(i.$$.fragment,g),d(c.$$.fragment,g),m=!1},d(g){g&&(p(l),p(n),p(o),p(a),p(f)),k(e,g),k(t,g),k(s,g),k(u,g),k(i,g),k(c,g)}}}function S$(r){let e,l;return e=new nt({props:{small:!0,$$slots:{default:[y$]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&64&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function C$(r){let e,l,t,n,s,o;return e=new ia({}),t=new su({}),s=new mu({}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment),n=T(),h(s.$$.fragment)},m(u,a){b(e,u,a),$(u,l,a),b(t,u,a),$(u,n,a),b(s,u,a),o=!0},i(u){o||(_(e.$$.fragment,u),_(t.$$.fragment,u),_(s.$$.fragment,u),o=!0)},o(u){d(e.$$.fragment,u),d(t.$$.fragment,u),d(s.$$.fragment,u),o=!1},d(u){u&&(p(l),p(n)),k(e,u),k(t,u),k(s,u)}}}function L$(r){let e,l,t,n,s,o,u,a,i,f;return e=new gi({}),t=new Ji({}),s=new yo({}),u=new Wo({}),i=new ri({}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment),n=T(),h(s.$$.fragment),o=T(),h(u.$$.fragment),a=T(),h(i.$$.fragment)},m(c,m){b(e,c,m),$(c,l,m),b(t,c,m),$(c,n,m),b(s,c,m),$(c,o,m),b(u,c,m),$(c,a,m),b(i,c,m),f=!0},i(c){f||(_(e.$$.fragment,c),_(t.$$.fragment,c),_(s.$$.fragment,c),_(u.$$.fragment,c),_(i.$$.fragment,c),f=!0)},o(c){d(e.$$.fragment,c),d(t.$$.fragment,c),d(s.$$.fragment,c),d(u.$$.fragment,c),d(i.$$.fragment,c),f=!1},d(c){c&&(p(l),p(n),p(o),p(a)),k(e,c),k(t,c),k(s,c),k(u,c),k(i,c)}}}function T$(r){let e,l;return e=new nt({props:{small:!0,$$slots:{default:[L$]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&64&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function M$(r){let e,l,t,n;return e=new co({}),t=new Do({}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment)},m(s,o){b(e,s,o),$(s,l,o),b(t,s,o),n=!0},i(s){n||(_(e.$$.fragment,s),_(t.$$.fragment,s),n=!0)},o(s){d(e.$$.fragment,s),d(t.$$.fragment,s),n=!1},d(s){s&&p(l),k(e,s),k(t,s)}}}function N$(r){let e,l;return e=new nt({props:{small:!0,$$slots:{default:[M$]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&64&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function P$(r){let e,l,t,n,s,o,u,a;return e=new Zf({}),t=new cf({}),s=new Bf({}),u=new k$({}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment),n=T(),h(s.$$.fragment),o=T(),h(u.$$.fragment)},m(i,f){b(e,i,f),$(i,l,f),b(t,i,f),$(i,n,f),b(s,i,f),$(i,o,f),b(u,i,f),a=!0},i(i){a||(_(e.$$.fragment,i),_(t.$$.fragment,i),_(s.$$.fragment,i),_(u.$$.fragment,i),a=!0)},o(i){d(e.$$.fragment,i),d(t.$$.fragment,i),d(s.$$.fragment,i),d(u.$$.fragment,i),a=!1},d(i){i&&(p(l),p(n),p(o)),k(e,i),k(t,i),k(s,i),k(u,i)}}}function O$(r){let e,l,t,n,s,o,u,a,i=en()=="Private (development)",f,c,m,g,C;e=new u$({}),t=new Xc({}),s=new Tf({}),u=new Au({});let S=i&&P$();return c=new Li({}),g=new Fi({}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment),n=T(),h(s.$$.fragment),o=T(),h(u.$$.fragment),a=T(),S&&S.c(),f=T(),h(c.$$.fragment),m=T(),h(g.$$.fragment)},m(y,M){b(e,y,M),$(y,l,M),b(t,y,M),$(y,n,M),b(s,y,M),$(y,o,M),b(u,y,M),$(y,a,M),S&&S.m(y,M),$(y,f,M),b(c,y,M),$(y,m,M),b(g,y,M),C=!0},p:te,i(y){C||(_(e.$$.fragment,y),_(t.$$.fragment,y),_(s.$$.fragment,y),_(u.$$.fragment,y),_(S),_(c.$$.fragment,y),_(g.$$.fragment,y),C=!0)},o(y){d(e.$$.fragment,y),d(t.$$.fragment,y),d(s.$$.fragment,y),d(u.$$.fragment,y),d(S),d(c.$$.fragment,y),d(g.$$.fragment,y),C=!1},d(y){y&&(p(l),p(n),p(o),p(a),p(f),p(m)),k(e,y),k(t,y),k(s,y),k(u,y),S&&S.d(y),k(c,y),k(g,y)}}}function I$(r){let e,l;return e=new nt({props:{small:!0,$$slots:{default:[O$]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&64&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function R$(r){let e,l,t,n,s;function o(a){r[5](a)}let u={cfg:r[4],map:r[2]};return r[0]!==void 0&&(u.enabled=r[0]),e=new Os({props:u}),U.push(()=>W(e,"enabled",o)),n=new pr({}),{c(){h(e.$$.fragment),t=T(),h(n.$$.fragment)},m(a,i){b(e,a,i),$(a,t,i),b(n,a,i),s=!0},p(a,i){const f={};i&4&&(f.map=a[2]),!l&&i&1&&(l=!0,f.enabled=a[0],Y(()=>l=!1)),e.$set(f)},i(a){s||(_(e.$$.fragment,a),_(n.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(n.$$.fragment,a),s=!1},d(a){a&&p(t),k(e,a),k(n,a)}}}function D$(r){let e,l,t,n,s,o,u,a,i,f,c,m,g,C,S,y;return e=new qe({props:{label:"Trip generators",$$slots:{default:[v$]},$$scope:{ctx:r}}}),t=new qe({props:{label:"Existing infrastructure",$$slots:{default:[S$]},$$scope:{ctx:r}}}),s=new qe({props:{label:"Public transport",$$slots:{default:[C$]},$$scope:{ctx:r}}}),u=new qe({props:{label:"Boundaries",$$slots:{default:[T$]},$$scope:{ctx:r}}}),i=new qe({props:{label:"Census",$$slots:{default:[N$]},$$scope:{ctx:r}}}),c=new qe({props:{label:"Other",$$slots:{default:[I$]},$$scope:{ctx:r}}}),g=new qe({props:{label:"Tools",$$slots:{default:[R$]},$$scope:{ctx:r}}}),S=new Ns({props:{disabled:!r[1]}}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment),n=T(),h(s.$$.fragment),o=T(),h(u.$$.fragment),a=T(),h(i.$$.fragment),f=T(),h(c.$$.fragment),m=T(),h(g.$$.fragment),C=T(),h(S.$$.fragment)},m(M,R){b(e,M,R),$(M,l,R),b(t,M,R),$(M,n,R),b(s,M,R),$(M,o,R),b(u,M,R),$(M,a,R),b(i,M,R),$(M,f,R),b(c,M,R),$(M,m,R),b(g,M,R),$(M,C,R),b(S,M,R),y=!0},p(M,R){const A={};R&64&&(A.$$scope={dirty:R,ctx:M}),e.$set(A);const O={};R&64&&(O.$$scope={dirty:R,ctx:M}),t.$set(O);const N={};R&64&&(N.$$scope={dirty:R,ctx:M}),s.$set(N);const I={};R&64&&(I.$$scope={dirty:R,ctx:M}),u.$set(I);const F={};R&64&&(F.$$scope={dirty:R,ctx:M}),i.$set(F);const P={};R&64&&(P.$$scope={dirty:R,ctx:M}),c.$set(P);const z={};R&69&&(z.$$scope={dirty:R,ctx:M}),g.$set(z);const X={};R&2&&(X.disabled=!M[1]),S.$set(X)},i(M){y||(_(e.$$.fragment,M),_(t.$$.fragment,M),_(s.$$.fragment,M),_(u.$$.fragment,M),_(i.$$.fragment,M),_(c.$$.fragment,M),_(g.$$.fragment,M),_(S.$$.fragment,M),y=!0)},o(M){d(e.$$.fragment,M),d(t.$$.fragment,M),d(s.$$.fragment,M),d(u.$$.fragment,M),d(i.$$.fragment,M),d(c.$$.fragment,M),d(g.$$.fragment,M),d(S.$$.fragment,M),y=!1},d(M){M&&(p(l),p(n),p(o),p(a),p(f),p(m),p(C)),k(e,M),k(t,M),k(s,M),k(u,M),k(i,M),k(c,M),k(g,M),k(S,M)}}}function A$(r){let e,l;const t=[H("cover-interactive-layers"),{paint:{"fill-color":"black","fill-opacity":0}},{layout:{visibility:r[1]?"none":"visible"}}];let n={};for(let s=0;sl(1,n=i)),Z(r,rn,i=>l(2,s=i));let o={type:"Feature",properties:{},geometry:{type:"Polygon",coordinates:[[[180,90],[-180,90],[-180,-90],[180,-90],[180,90]]]}},u={getStreetViewRoadLayerNames:i=>Ps(i,ds(xt))};function a(i){t=i,l(0,t),l(1,n)}return r.$$.update=()=>{r.$$.dirty&2&&l(0,t=!n),r.$$.dirty&1&&Rn.set(!t)},[t,n,s,o,u,a]}class z$ extends V{constructor(e){super(),Q(this,e,q$,F$,J,{})}}function j$(r){let e;function l(s,o){return s[2]<=100?G$:H$}let t=l(r),n=t(r);return{c(){n.c(),e=Me()},m(s,o){n.m(s,o),$(s,e,o)},p(s,o){t===(t=l(s))&&n?n.p(s,o):(n.d(1),n=t(s),n&&(n.c(),n.m(e.parentNode,e)))},i:te,o:te,d(s){s&&p(e),n.d(s)}}}function B$(r){let e,l;return e=new tt({props:{$$slots:{default:[E$]},$$scope:{ctx:r}}}),e.$on("click",r[3]),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&64&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function H$(r){let e;return{c(){e=L("label"),e.innerHTML=`Processing scheme data `},m(l,t){$(l,e,t)},p:te,d(l){l&&p(e)}}}function G$(r){let e,l,t;return{c(){e=L("label"),l=v(`Downloading scheme data - `),t=L("progress"),t.value=r[2],G(t,"class","svelte-q3473n")},m(n,s){$(n,e,s),w(e,l),w(e,t)},p(n,s){s&4&&(t.value=n[2])},d(n){n&&p(e)}}}function E$(r){let e;return{c(){e=v("Load latest scheme data")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function U$(r){let e,l,t,n;const s=[j$,B$],o=[];function u(a,i){return a[0]?a[1]?1:-1:0}return~(e=u(r))&&(l=o[e]=s[e](r)),{c(){l&&l.c(),t=Me()},m(a,i){~e&&o[e].m(a,i),$(a,t,i),n=!0},p(a,[i]){let f=e;e=u(a),e===f?~e&&o[e].p(a,i):(l&&(ae(),d(o[f],1,1,()=>{o[f]=null}),fe()),~e?(l=o[e],l?l.p(a,i):(l=o[e]=s[e](a),l.c()),_(l,1),l.m(t.parentNode,t)):l=null)},i(a){n||(_(l),n=!0)},o(a){d(l),n=!1},d(a){a&&p(t),~e&&o[e].d(a)}}}function W$(r,e,l){let{loadFile:t}=e,n=!new URLSearchParams(window.location.search).has("disable_schemes"),s=!0,o=0;async function u(){let i=await hs(`${Et()}/v1/all_schemes_output.geojson.gz`,c=>{l(2,o=c)});l(2,o=100);let f=new TextDecoder().decode(i);t("all_schemes_output.geojson",f),l(1,s=!1)}on(async()=>{n&&await u()});async function a(){l(0,n=!0),await u()}return r.$$set=i=>{"loadFile"in i&&l(4,t=i.loadFile)},[n,s,o,a,t]}class Y$ extends V{constructor(e){super(),Q(this,e,W$,U$,J,{loadFile:4})}}function Ll(r){var s;let e,l,t=((s=r[0].browse)==null?void 0:s.current_milestone)+"",n;return{c(){e=L("p"),l=v("Current milestone: "),n=v(t)},m(o,u){$(o,e,u),w(e,l),w(e,n)},p(o,u){var a;u&1&&t!==(t=((a=o[0].browse)==null?void 0:a.current_milestone)+"")&&B(n,t)},d(o){o&&p(e)}}}function J$(r){let e;return{c(){e=v("Show on map")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function V$(r){let e;return{c(){e=v("Edit scheme locally")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Q$(r){let e,l,t,n;return e=new tt({props:{$$slots:{default:[J$]},$$scope:{ctx:r}}}),e.$on("click",r[1]),t=new tt({props:{$$slots:{default:[V$]},$$scope:{ctx:r}}}),t.$on("click",r[2]),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment)},m(s,o){b(e,s,o),$(s,l,o),b(t,s,o),n=!0},p(s,o){const u={};o&32&&(u.$$scope={dirty:o,ctx:s}),e.$set(u);const a={};o&32&&(a.$$scope={dirty:o,ctx:s}),t.$set(a)},i(s){n||(_(e.$$.fragment,s),_(t.$$.fragment,s),n=!0)},o(s){d(e.$$.fragment,s),d(t.$$.fragment,s),n=!1},d(s){s&&p(l),k(e,s),k(t,s)}}}function Z$(r){var z,X,E,q;let e,l,t=r[0].scheme_reference+"",n,s,o,u,a=((z=r[0].browse)==null?void 0:z.authority_or_region)+"",i,f,c,m,g=((X=r[0].browse)==null?void 0:X.capital_scheme_id)+"",C,S,y,M,R=((E=r[0].browse)==null?void 0:E.funding_programme)+"",A,O,N,I,F,P=((q=r[0].browse)==null?void 0:q.current_milestone)&&Ll(r);return I=new Is({props:{$$slots:{default:[Q$]},$$scope:{ctx:r}}}),{c(){e=L("p"),l=v("Scheme reference: "),n=v(t),s=T(),o=L("p"),u=v("Authority or region: "),i=v(a),f=T(),c=L("p"),m=v("Capital scheme ID: "),C=v(g),S=T(),y=L("p"),M=v("Funding programme: "),A=v(R),O=T(),P&&P.c(),N=T(),h(I.$$.fragment)},m(D,j){$(D,e,j),w(e,l),w(e,n),$(D,s,j),$(D,o,j),w(o,u),w(o,i),$(D,f,j),$(D,c,j),w(c,m),w(c,C),$(D,S,j),$(D,y,j),w(y,M),w(y,A),$(D,O,j),P&&P.m(D,j),$(D,N,j),b(I,D,j),F=!0},p(D,j){var Ce,Le,ve,Ne;(!F||j&1)&&t!==(t=D[0].scheme_reference+"")&&B(n,t),(!F||j&1)&&a!==(a=((Ce=D[0].browse)==null?void 0:Ce.authority_or_region)+"")&&B(i,a),(!F||j&1)&&g!==(g=((Le=D[0].browse)==null?void 0:Le.capital_scheme_id)+"")&&B(C,g),(!F||j&1)&&R!==(R=((ve=D[0].browse)==null?void 0:ve.funding_programme)+"")&&B(A,R),(Ne=D[0].browse)!=null&&Ne.current_milestone?P?P.p(D,j):(P=Ll(D),P.c(),P.m(N.parentNode,N)):P&&(P.d(1),P=null);const $e={};j&32&&($e.$$scope={dirty:j,ctx:D}),I.$set($e)},i(D){F||(_(I.$$.fragment,D),F=!0)},o(D){d(I.$$.fragment,D),F=!1},d(D){D&&(p(e),p(s),p(o),p(f),p(c),p(S),p(y),p(O),p(N)),P&&P.d(D),k(I,D)}}}function K$(r){let e,l;return e=new qe({props:{label:`${r[0].scheme_name}`,$$slots:{default:[Z$]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,[n]){const s={};n&1&&(s.label=`${t[0].scheme_name}`),n&33&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function X$(r,e,l){let t,n;Z(r,At,a=>l(3,t=a)),Z(r,rn,a=>l(4,n=a));let{scheme:s}=e;function o(){let a={type:"FeatureCollection",features:t.features.filter(i=>i.properties.scheme_reference==s.scheme_reference)};n==null||n.fitBounds(Rs(a),{padding:20,animate:!1})}function u(){var f,c;let a={type:"FeatureCollection",features:t.features.filter(m=>m.properties.scheme_reference==s.scheme_reference)},i=((f=s.browse)==null?void 0:f.authority_or_region)||"unknown authority";bs(i,JSON.stringify(a)),window.open(`scheme.html?authority=${(c=s.browse)==null?void 0:c.authority_or_region}`,"_blank")}return r.$$set=a=>{"scheme"in a&&l(0,s=a.scheme)},[s,o,u]}class x$ extends V{constructor(e){super(),Q(this,e,X$,K$,J,{scheme:0})}}function Tl(r){let e,l,t,n=r[0].status+"",s;return{c(){e=L("p"),l=v("Status: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&1&&n!==(n=o[0].status+"")&&B(s,n)},d(o){o&&p(e)}}}function Ml(r){let e,l,t,n=r[0].timescale+"",s;return{c(){e=L("p"),l=v("Timescale: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&1&&n!==(n=o[0].timescale+"")&&B(s,n)},d(o){o&&p(e)}}}function Nl(r){let e,l,t,n=r[0].timescale_year+"",s;return{c(){e=L("p"),l=v("Estimated completion year: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&1&&n!==(n=o[0].timescale_year+"")&&B(s,n)},d(o){o&&p(e)}}}function Pl(r){let e,l,t,n=r[0].year_published+"",s;return{c(){e=L("p"),l=v("Scheme most recently published: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&1&&n!==(n=o[0].year_published+"")&&B(s,n)},d(o){o&&p(e)}}}function Ol(r){let e,l,t,n=r[0].year_consulted+"",s;return{c(){e=L("p"),l=v("Scheme most recently consulted on: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&1&&n!==(n=o[0].year_consulted+"")&&B(s,n)},d(o){o&&p(e)}}}function ep(r){let e,l,t,n,s,o=r[0].status&&Tl(r),u=r[0].timescale&&Ml(r),a=r[0].timescale_year&&Nl(r),i=r[0].year_published&&Pl(r),f=r[0].year_consulted&&Ol(r);return{c(){o&&o.c(),e=T(),u&&u.c(),l=T(),a&&a.c(),t=T(),i&&i.c(),n=T(),f&&f.c(),s=Me()},m(c,m){o&&o.m(c,m),$(c,e,m),u&&u.m(c,m),$(c,l,m),a&&a.m(c,m),$(c,t,m),i&&i.m(c,m),$(c,n,m),f&&f.m(c,m),$(c,s,m)},p(c,[m]){c[0].status?o?o.p(c,m):(o=Tl(c),o.c(),o.m(e.parentNode,e)):o&&(o.d(1),o=null),c[0].timescale?u?u.p(c,m):(u=Ml(c),u.c(),u.m(l.parentNode,l)):u&&(u.d(1),u=null),c[0].timescale_year?a?a.p(c,m):(a=Nl(c),a.c(),a.m(t.parentNode,t)):a&&(a.d(1),a=null),c[0].year_published?i?i.p(c,m):(i=Pl(c),i.c(),i.m(n.parentNode,n)):i&&(i.d(1),i=null),c[0].year_consulted?f?f.p(c,m):(f=Ol(c),f.c(),f.m(s.parentNode,s)):f&&(f.d(1),f=null)},i:te,o:te,d(c){c&&(p(e),p(l),p(t),p(n),p(s)),o&&o.d(c),u&&u.d(c),a&&a.d(c),i&&i.d(c),f&&f.d(c)}}}function tp(r,e,l){let{props:t}=e;return r.$$set=n=>{"props"in n&&l(0,t=n.props)},[t]}class cs extends V{constructor(e){super(),Q(this,e,tp,ep,J,{props:0})}}function Il(r){let e,l,t,n=r[0].budget.toLocaleString()+"",s,o;return{c(){e=L("p"),l=v("Cost: "),t=L("b"),s=v(n),o=v(` - GBP`)},m(u,a){$(u,e,a),w(e,l),w(e,t),w(t,s),w(e,o)},p(u,a){a&1&&n!==(n=u[0].budget.toLocaleString()+"")&&B(s,n)},d(u){u&&p(e)}}}function Rl(r){let e;return{c(){e=L("p"),e.textContent="Development is fully funded"},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Dl(r){let e;return{c(){e=L("p"),e.textContent="Construction is fully funded"},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Al(r){let e,l,t,n;return{c(){e=L("p"),l=v("Funding sources: "),t=L("b"),n=v(r[1])},m(s,o){$(s,e,o),w(e,l),w(e,t),w(t,n)},p(s,o){o&2&&B(n,s[1])},d(s){s&&p(e)}}}function np(r){let e,l,t,n,s=r[0].budget&&Il(r),o=r[0].development_funded&&Rl(),u=r[0].construction_funded&&Dl(),a=r[1]&&Al(r);return{c(){s&&s.c(),e=T(),o&&o.c(),l=T(),u&&u.c(),t=T(),a&&a.c(),n=Me()},m(i,f){s&&s.m(i,f),$(i,e,f),o&&o.m(i,f),$(i,l,f),u&&u.m(i,f),$(i,t,f),a&&a.m(i,f),$(i,n,f)},p(i,[f]){i[0].budget?s?s.p(i,f):(s=Il(i),s.c(),s.m(e.parentNode,e)):s&&(s.d(1),s=null),i[0].development_funded?o||(o=Rl(),o.c(),o.m(l.parentNode,l)):o&&(o.d(1),o=null),i[0].construction_funded?u||(u=Dl(),u.c(),u.m(t.parentNode,t)):u&&(u.d(1),u=null),i[1]?a?a.p(i,f):(a=Al(i),a.c(),a.m(n.parentNode,n)):a&&(a.d(1),a=null)},i:te,o:te,d(i){i&&(p(e),p(l),p(t),p(n)),s&&s.d(i),o&&o.d(i),u&&u.d(i),a&&a.d(i)}}}function lp(r){if(!r.funding_sources)return"";let e=[];for(let l of["atf2","atf3","atf4","atf4e","crsts","luf"])r.funding_sources[l]&&e.push(l.toUpperCase());return r.funding_sources.other&&e.push(r.funding_sources.other),e.join(", ")}function sp(r,e,l){let t,{props:n}=e;return r.$$set=s=>{"props"in s&&l(0,n=s.props)},r.$$.update=()=>{r.$$.dirty&1&&l(1,t=lp(n))},[n,t]}class $s extends V{constructor(e){super(),Q(this,e,sp,np,J,{props:0})}}function Zt(r){const e=r.slice(),l=e[1].pipeline;return e[5]=l,e}function Kt(r){const e=r.slice(),l=e[0].pipeline;return e[5]=l,e}function Fl(r){let e,l,t,n=hn(r[0].length_meters)+"",s;return{c(){e=L("p"),l=v("Length: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&1&&n!==(n=hn(o[0].length_meters)+"")&&B(s,n)},d(o){o&&p(e)}}}function ql(r){let e,l=lt(r[0].description,r[2])+"";return{c(){e=L("p")},m(t,n){$(t,e,n),e.innerHTML=l},p(t,n){n&5&&l!==(l=lt(t[0].description,t[2])+"")&&(e.innerHTML=l)},d(t){t&&p(e)}}}function zl(r){let e,l,t,n,s,o,u,a=r[5].atf4_type&&Bl(r),i=r[5].accuracy&&jl(r),f=r[5].is_alternative&&Hl();return n=new $s({props:{props:r[5]}}),o=new cs({props:{props:r[5]}}),{c(){a&&a.c(),e=T(),i&&i.c(),l=T(),f&&f.c(),t=T(),h(n.$$.fragment),s=T(),h(o.$$.fragment)},m(c,m){a&&a.m(c,m),$(c,e,m),i&&i.m(c,m),$(c,l,m),f&&f.m(c,m),$(c,t,m),b(n,c,m),$(c,s,m),b(o,c,m),u=!0},p(c,m){c[5].atf4_type?a?a.p(c,m):(a=Bl(c),a.c(),a.m(e.parentNode,e)):a&&(a.d(1),a=null),c[5].accuracy?i?i.p(c,m):(i=jl(c),i.c(),i.m(l.parentNode,l)):i&&(i.d(1),i=null),c[5].is_alternative?f||(f=Hl(),f.c(),f.m(t.parentNode,t)):f&&(f.d(1),f=null);const g={};m&1&&(g.props=c[5]),n.$set(g);const C={};m&1&&(C.props=c[5]),o.$set(C)},i(c){u||(_(n.$$.fragment,c),_(o.$$.fragment,c),u=!0)},o(c){d(n.$$.fragment,c),d(o.$$.fragment,c),u=!1},d(c){c&&(p(e),p(l),p(t),p(s)),a&&a.d(c),i&&i.d(c),f&&f.d(c),k(n,c),k(o,c)}}}function Bl(r){let e,l,t,n=r[5].atf4_type+"",s;return{c(){e=L("p"),l=v("ATF4 type: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&1&&n!==(n=o[5].atf4_type+"")&&B(s,n)},d(o){o&&p(e)}}}function jl(r){let e,l,t,n=r[5].accuracy+"",s;return{c(){e=L("p"),l=v("Accuracy: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&1&&n!==(n=o[5].accuracy+"")&&B(s,n)},d(o){o&&p(e)}}}function Hl(r){let e;return{c(){e=L("p"),e.textContent="Represents an alternative route"},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Gl(r){var o;let e,l,t,n=((o=r[1].browse)==null?void 0:o.capital_scheme_id)+"",s;return{c(){e=L("p"),l=v("Capital scheme ID: "),t=L("b"),s=v(n)},m(u,a){$(u,e,a),w(e,l),w(e,t),w(t,s)},p(u,a){var i;a&2&&n!==(n=((i=u[1].browse)==null?void 0:i.capital_scheme_id)+"")&&B(s,n)},d(u){u&&p(e)}}}function El(r){var o;let e,l,t,n=((o=r[1].browse)==null?void 0:o.current_milestone)+"",s;return{c(){e=L("p"),l=v("Current milestone: "),t=L("b"),s=v(n)},m(u,a){$(u,e,a),w(e,l),w(e,t),w(t,s)},p(u,a){var i;a&2&&n!==(n=((i=u[1].browse)==null?void 0:i.current_milestone)+"")&&B(s,n)},d(u){u&&p(e)}}}function Ul(r){let e,l,t,n,s,o,u,a=r[5].scheme_type&&Wl(r),i=r[5].atf4_lead_type&&Yl(r),f=r[5].scheme_description&&Jl(r);return n=new $s({props:{props:r[5]}}),o=new cs({props:{props:r[5]}}),{c(){a&&a.c(),e=T(),i&&i.c(),l=T(),f&&f.c(),t=T(),h(n.$$.fragment),s=T(),h(o.$$.fragment)},m(c,m){a&&a.m(c,m),$(c,e,m),i&&i.m(c,m),$(c,l,m),f&&f.m(c,m),$(c,t,m),b(n,c,m),$(c,s,m),b(o,c,m),u=!0},p(c,m){c[5].scheme_type?a?a.p(c,m):(a=Wl(c),a.c(),a.m(e.parentNode,e)):a&&(a.d(1),a=null),c[5].atf4_lead_type?i?i.p(c,m):(i=Yl(c),i.c(),i.m(l.parentNode,l)):i&&(i.d(1),i=null),c[5].scheme_description?f?f.p(c,m):(f=Jl(c),f.c(),f.m(t.parentNode,t)):f&&(f.d(1),f=null);const g={};m&2&&(g.props=c[5]),n.$set(g);const C={};m&2&&(C.props=c[5]),o.$set(C)},i(c){u||(_(n.$$.fragment,c),_(o.$$.fragment,c),u=!0)},o(c){d(n.$$.fragment,c),d(o.$$.fragment,c),u=!1},d(c){c&&(p(e),p(l),p(t),p(s)),a&&a.d(c),i&&i.d(c),f&&f.d(c),k(n,c),k(o,c)}}}function Wl(r){let e,l,t,n=r[5].scheme_type+"",s;return{c(){e=L("p"),l=v("Scheme type: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&2&&n!==(n=o[5].scheme_type+"")&&B(s,n)},d(o){o&&p(e)}}}function Yl(r){let e,l,t,n=r[5].atf4_lead_type+"",s;return{c(){e=L("p"),l=v("ATF4 lead type: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&2&&n!==(n=o[5].atf4_lead_type+"")&&B(s,n)},d(o){o&&p(e)}}}function Jl(r){let e,l,t=r[5].scheme_description+"",n;return{c(){e=L("p"),l=v("Descripton: "),n=v(t)},m(s,o){$(s,e,o),w(e,l),w(e,n)},p(s,o){o&2&&t!==(t=s[5].scheme_description+"")&&B(n,t)},d(s){s&&p(e)}}}function rp(r){var Ft,qt,zt,He;let e,l,t,n=lt(r[0].name,r[2])+"",s,o=r[0].intervention_type+"",u,a,i,f,c,m,g,C,S,y,M,R=lt(r[1].scheme_name??"",r[3])+"",A,O,N=lt(r[0].scheme_reference,r[3])+"",I,F,P,z,X,E=((Ft=r[1].browse)==null?void 0:Ft.authority_or_region)+"",q,D,j,$e,Ce,Le,ve=((qt=r[1].browse)==null?void 0:qt.funding_programme)+"",Ne,de,je,Fe,Pe=r[0].length_meters&&Fl(r),ue=r[0].description&&ql(r),ge=r[0].pipeline&&zl(Kt(r)),ye=((zt=r[1].browse)==null?void 0:zt.capital_scheme_id)&&Gl(r),Te=((He=r[1].browse)==null?void 0:He.current_milestone)&&El(r),we=r[1].pipeline&&Ul(Zt(r));return{c(){e=L("div"),l=L("h2"),t=new it(!1),s=v(" ("),u=v(o),a=v(")"),i=T(),Pe&&Pe.c(),f=T(),ue&&ue.c(),c=T(),ge&&ge.c(),m=T(),g=L("hr"),C=T(),S=L("p"),y=v("Part of scheme: "),M=new it(!1),A=v(" ("),O=new it(!1),I=v(")"),F=T(),P=L("p"),z=v("Authority or region: "),X=L("b"),q=v(E),D=T(),ye&&ye.c(),j=T(),$e=L("p"),Ce=v("Funding programme: "),Le=L("b"),Ne=v(ve),de=T(),Te&&Te.c(),je=T(),we&&we.c(),t.a=s,M.a=A,O.a=I,me(e,"max-width","30vw"),me(e,"max-height","60vh"),me(e,"overflow","auto")},m(ie,Oe){$(ie,e,Oe),w(e,l),t.m(n,l),w(l,s),w(l,u),w(l,a),w(e,i),Pe&&Pe.m(e,null),w(e,f),ue&&ue.m(e,null),w(e,c),ge&&ge.m(e,null),w(e,m),w(e,g),w(e,C),w(e,S),w(S,y),M.m(R,S),w(S,A),O.m(N,S),w(S,I),w(e,F),w(e,P),w(P,z),w(P,X),w(X,q),w(e,D),ye&&ye.m(e,null),w(e,j),w(e,$e),w($e,Ce),w($e,Le),w(Le,Ne),w(e,de),Te&&Te.m(e,null),w(e,je),we&&we.m(e,null),Fe=!0},p(ie,[Oe]){var un,cn,$n,pn;(!Fe||Oe&5)&&n!==(n=lt(ie[0].name,ie[2])+"")&&t.p(n),(!Fe||Oe&1)&&o!==(o=ie[0].intervention_type+"")&&B(u,o),ie[0].length_meters?Pe?Pe.p(ie,Oe):(Pe=Fl(ie),Pe.c(),Pe.m(e,f)):Pe&&(Pe.d(1),Pe=null),ie[0].description?ue?ue.p(ie,Oe):(ue=ql(ie),ue.c(),ue.m(e,c)):ue&&(ue.d(1),ue=null),ie[0].pipeline?ge?(ge.p(Kt(ie),Oe),Oe&1&&_(ge,1)):(ge=zl(Kt(ie)),ge.c(),_(ge,1),ge.m(e,m)):ge&&(ae(),d(ge,1,1,()=>{ge=null}),fe()),(!Fe||Oe&10)&&R!==(R=lt(ie[1].scheme_name??"",ie[3])+"")&&M.p(R),(!Fe||Oe&9)&&N!==(N=lt(ie[0].scheme_reference,ie[3])+"")&&O.p(N),(!Fe||Oe&2)&&E!==(E=((un=ie[1].browse)==null?void 0:un.authority_or_region)+"")&&B(q,E),(cn=ie[1].browse)!=null&&cn.capital_scheme_id?ye?ye.p(ie,Oe):(ye=Gl(ie),ye.c(),ye.m(e,j)):ye&&(ye.d(1),ye=null),(!Fe||Oe&2)&&ve!==(ve=(($n=ie[1].browse)==null?void 0:$n.funding_programme)+"")&&B(Ne,ve),(pn=ie[1].browse)!=null&&pn.current_milestone?Te?Te.p(ie,Oe):(Te=El(ie),Te.c(),Te.m(e,je)):Te&&(Te.d(1),Te=null),ie[1].pipeline?we?(we.p(Zt(ie),Oe),Oe&2&&_(we,1)):(we=Ul(Zt(ie)),we.c(),_(we,1),we.m(e,null)):we&&(ae(),d(we,1,1,()=>{we=null}),fe())},i(ie){Fe||(_(ge),_(we),Fe=!0)},o(ie){d(ge),d(we),Fe=!1},d(ie){ie&&p(e),Pe&&Pe.d(),ue&&ue.d(),ge&&ge.d(),ye&&ye.d(),Te&&Te.d(),we&&we.d()}}}function lt(r,e){return e?r.replace(new RegExp(e,"gi"),l=>`${l}`):r}function op(r,e,l){let t,n,s,o;Z(r,Yt,a=>l(4,n=a)),Z(r,jt,a=>l(2,s=a)),Z(r,Ht,a=>l(3,o=a));let{props:u}=e;return r.$$set=a=>{"props"in a&&l(0,u=a.props)},r.$$.update=()=>{r.$$.dirty&17&&l(1,t=n.get(u.scheme_reference))},[u,t,s,o,n]}class fn extends V{constructor(e){super(),Q(this,e,op,rp,J,{props:0})}}function ip(r){let e,l=r[6].name+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&64&&l!==(l=n[6].name+"")&&B(t,l)},d(n){n&&p(e)}}}function ap(r){let e,l;return e=new fn({props:{props:r[6]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&64&&(s.props=t[6]),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function fp(r){let e,l,t,n;return e=new oe({props:{popupClass:"border-popup",$$slots:{default:[ip,({props:s})=>({6:s}),({props:s})=>s?64:0]},$$scope:{ctx:r}}}),t=new oe({props:{openOn:"click",popupClass:"border-popup",$$slots:{default:[ap,({props:s})=>({6:s}),({props:s})=>s?64:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment)},m(s,o){b(e,s,o),$(s,l,o),b(t,s,o),n=!0},p(s,o){const u={};o&192&&(u.$$scope={dirty:o,ctx:s}),e.$set(u);const a={};o&192&&(a.$$scope={dirty:o,ctx:s}),t.$set(a)},i(s){n||(_(e.$$.fragment,s),_(t.$$.fragment,s),n=!0)},o(s){d(e.$$.fragment,s),d(t.$$.fragment,s),n=!1},d(s){s&&p(l),k(e,s),k(t,s)}}}function up(r){let e,l=r[6].name+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&64&&l!==(l=n[6].name+"")&&B(t,l)},d(n){n&&p(e)}}}function cp(r){let e,l;return e=new fn({props:{props:r[6]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&64&&(s.props=t[6]),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function $p(r){let e,l,t,n;return e=new oe({props:{popupClass:"border-popup",$$slots:{default:[up,({props:s})=>({6:s}),({props:s})=>s?64:0]},$$scope:{ctx:r}}}),t=new oe({props:{openOn:"click",popupClass:"border-popup",$$slots:{default:[cp,({props:s})=>({6:s}),({props:s})=>s?64:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment)},m(s,o){b(e,s,o),$(s,l,o),b(t,s,o),n=!0},p(s,o){const u={};o&192&&(u.$$scope={dirty:o,ctx:s}),e.$set(u);const a={};o&192&&(a.$$scope={dirty:o,ctx:s}),t.$set(a)},i(s){n||(_(e.$$.fragment,s),_(t.$$.fragment,s),n=!0)},o(s){d(e.$$.fragment,s),d(t.$$.fragment,s),n=!1},d(s){s&&p(l),k(e,s),k(t,s)}}}function pp(r){let e,l=r[6].name+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&64&&l!==(l=n[6].name+"")&&B(t,l)},d(n){n&&p(e)}}}function mp(r){let e,l;return e=new fn({props:{props:r[6]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&64&&(s.props=t[6]),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function _p(r){let e,l,t,n;return e=new oe({props:{popupClass:"border-popup",$$slots:{default:[pp,({props:s})=>({6:s}),({props:s})=>s?64:0]},$$scope:{ctx:r}}}),t=new oe({props:{openOn:"click",popupClass:"border-popup",$$slots:{default:[mp,({props:s})=>({6:s}),({props:s})=>s?64:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment)},m(s,o){b(e,s,o),$(s,l,o),b(t,s,o),n=!0},p(s,o){const u={};o&192&&(u.$$scope={dirty:o,ctx:s}),e.$set(u);const a={};o&192&&(a.$$scope={dirty:o,ctx:s}),t.$set(a)},i(s){n||(_(e.$$.fragment,s),_(t.$$.fragment,s),n=!0)},o(s){d(e.$$.fragment,s),d(t.$$.fragment,s),n=!1},d(s){s&&p(l),k(e,s),k(t,s)}}}function gp(r){let e,l,t,n,s,o,u,a,i,f;const c=[H("interventions-points"),{filter:["all",bn,r[3],r[4]]},{manageHoverState:!0},{eventsIfTopMost:!0},{paint:{"circle-color":r[2],"circle-radius":kn,"circle-opacity":ee(1,.5)}},{layout:{visibility:r[0]?"visible":"none"}},{hoverCursor:"pointer"}];let m={$$slots:{default:[fp]},$$scope:{ctx:r}};for(let N=0;Nl(5,n=i));let{showSchemes:s}=e,[o]=nn();const u=["!=",["get","hide_while_editing"],!0],a=["!=",["get","endpoint"],!0];return r.$$set=i=>{"showSchemes"in i&&l(0,s=i.showSchemes)},r.$$.update=()=>{r.$$.dirty&32&&l(1,t=Ds(n))},[s,t,o,u,a,n]}class bp extends V{constructor(e){super(),Q(this,e,hp,dp,J,{showSchemes:0})}}function Vl(r,e,l){const t=r.slice();return t[13]=e[l],t}function Ql(r,e,l){const t=r.slice();return t[16]=e[l],t}function kp(r){let e,l;return e=new Y$({props:{loadFile:r[7]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p:te,i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Zl(r){let e,l,t,n,s;e=new tt({props:{$$slots:{default:[wp]},$$scope:{ctx:r}}}),e.$on("click",r[8]);function o(a){r[9](a)}let u={title:"About this scheme data",$$slots:{default:[vp]},$$scope:{ctx:r}};return r[3]!==void 0&&(u.open=r[3]),t=new ts({props:u}),U.push(()=>W(t,"open",o)),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment)},m(a,i){b(e,a,i),$(a,l,i),b(t,a,i),s=!0},p(a,i){const f={};i&524288&&(f.$$scope={dirty:i,ctx:a}),e.$set(f);const c={};i&524304&&(c.$$scope={dirty:i,ctx:a}),!n&&i&8&&(n=!0,c.open=a[3],Y(()=>n=!1)),t.$set(c)},i(a){s||(_(e.$$.fragment,a),_(t.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(t.$$.fragment,a),s=!1},d(a){a&&p(l),k(e,a),k(t,a)}}}function wp(r){let e;return{c(){e=v("About the scheme data")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Kl(r){let e,l,t=r[16]+"",n;return{c(){e=L("li"),l=L("p"),n=v(t)},m(s,o){$(s,e,o),w(e,l),w(l,n)},p(s,o){o&16&&t!==(t=s[16]+"")&&B(n,t)},d(s){s&&p(e)}}}function vp(r){let e,l,t,n,s=Se(r[4].notes),o=[];for(let u=0;uW(e,"schemesToBeShown",s)),U.push(()=>W(e,"show",o)),{c(){h(e.$$.fragment)},m(a,i){b(e,a,i),n=!0},p(a,i){const f={};!l&&i&2&&(l=!0,f.schemesToBeShown=a[1],Y(()=>l=!1)),!t&&i&4&&(t=!0,f.show=a[2],Y(()=>t=!1)),e.$set(f)},i(a){n||(_(e.$$.fragment,a),n=!0)},o(a){d(e.$$.fragment,a),n=!1},d(a){k(e,a)}}}function xl(r){let e,l;return e=new x$({props:{scheme:r[13]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&64&&(s.scheme=t[13]),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function es(r){let e=r[1].has(r[13].scheme_reference),l,t,n=e&&xl(r);return{c(){n&&n.c(),l=Me()},m(s,o){n&&n.m(s,o),$(s,l,o),t=!0},p(s,o){o&66&&(e=s[1].has(s[13].scheme_reference)),e?n?(n.p(s,o),o&66&&_(n,1)):(n=xl(s),n.c(),_(n,1),n.m(l.parentNode,l)):n&&(ae(),d(n,1,1,()=>{n=null}),fe())},i(s){t||(_(n),t=!0)},o(s){d(n),t=!1},d(s){s&&p(l),n&&n.d(s)}}}function yp(r){let e,l,t,n,s,o,u,a,i,f,c=en()=="Private (development)",m,g,C,S,y,M,R,A,O;s=new As({props:{boundaryGeojson:r[4]}}),i=new ks({});let N=c&&kp(r),I=r[4].notes&&Zl(r);C=new ws({props:{label:"Load schemes from GeoJSON",onLoad:r[7]}}),y=new vs({props:{errorMessage:r[0]}});let F=r[6].size>0&&Xl(r),P=Se(r[6].values()),z=[];for(let E=0;Ed(z[E],1,1,()=>{z[E]=null});return{c(){e=L("div"),l=L("div"),t=L("h1"),t.textContent="Browse schemes",n=T(),h(s.$$.fragment),o=T(),u=L("p"),u.textContent=`App version: ${en()}`,a=T(),h(i.$$.fragment),f=T(),N&&N.c(),m=T(),I&&I.c(),g=T(),h(C.$$.fragment),S=T(),h(y.$$.fragment),M=T(),F&&F.c(),R=T(),A=L("ul");for(let E=0;E{I=null}),fe());const j={};if(q&1&&(j.errorMessage=E[0]),y.$set(j),E[6].size>0?F?(F.p(E,q),q&64&&_(F,1)):(F=Xl(E),F.c(),_(F,1),F.m(e,R)):F&&(ae(),d(F,1,1,()=>{F=null}),fe()),q&66){P=Se(E[6].values());let $e;for($e=0;$el(4,t=y)),Z(r,xt,y=>l(5,n=y)),Z(r,Yt,y=>l(6,s=y)),on(()=>{Ss()});const o=new URLSearchParams(window.location.search);xt.set(o.get("style")||"dataviz");let u="",a=new Set,i=!0,f=!1;function c(y,M){try{At.set(JSON.parse(M)),Yt.set(mr(t)),l(0,u="")}catch(R){l(0,u=`The file you loaded is broken: ${R}`)}}const m=()=>l(3,f=!0);function g(y){f=y,l(3,f)}function C(y){a=y,l(1,a)}function S(y){i=y,l(2,i)}return[u,a,i,f,t,n,s,c,m,g,C,S]}class Mp extends V{constructor(e){super(),Q(this,e,Tp,Lp,J,{})}}document.body.className+=" js-enabled"+("noModule"in HTMLScriptElement.prototype?" govuk-frontend-supported":"");new Mp({target:document.getElementById("app")}); + `),t=L("progress"),t.value=r[2],G(t,"class","svelte-q3473n")},m(n,s){$(n,e,s),w(e,l),w(e,t)},p(n,s){s&4&&(t.value=n[2])},d(n){n&&p(e)}}}function E$(r){let e;return{c(){e=v("Load latest scheme data")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function U$(r){let e,l,t,n;const s=[B$,j$],o=[];function u(a,i){return a[0]?a[1]?1:-1:0}return~(e=u(r))&&(l=o[e]=s[e](r)),{c(){l&&l.c(),t=Me()},m(a,i){~e&&o[e].m(a,i),$(a,t,i),n=!0},p(a,[i]){let f=e;e=u(a),e===f?~e&&o[e].p(a,i):(l&&(ae(),d(o[f],1,1,()=>{o[f]=null}),fe()),~e?(l=o[e],l?l.p(a,i):(l=o[e]=s[e](a),l.c()),_(l,1),l.m(t.parentNode,t)):l=null)},i(a){n||(_(l),n=!0)},o(a){d(l),n=!1},d(a){a&&p(t),~e&&o[e].d(a)}}}function W$(r,e,l){let{loadFile:t}=e,n=!new URLSearchParams(window.location.search).has("disable_schemes"),s=!0,o=0;async function u(){let i=await hs(`${Et()}/v1/all_schemes_output.geojson.gz`,c=>{l(2,o=c)});l(2,o=100);let f=new TextDecoder().decode(i);t("all_schemes_output.geojson",f),l(1,s=!1)}on(async()=>{n&&await u()});async function a(){l(0,n=!0),await u()}return r.$$set=i=>{"loadFile"in i&&l(4,t=i.loadFile)},[n,s,o,a,t]}class Y$ extends V{constructor(e){super(),Q(this,e,W$,U$,J,{loadFile:4})}}function Ll(r){var s;let e,l,t=((s=r[0].browse)==null?void 0:s.current_milestone)+"",n;return{c(){e=L("p"),l=v("Current milestone: "),n=v(t)},m(o,u){$(o,e,u),w(e,l),w(e,n)},p(o,u){var a;u&1&&t!==(t=((a=o[0].browse)==null?void 0:a.current_milestone)+"")&&j(n,t)},d(o){o&&p(e)}}}function J$(r){let e;return{c(){e=v("Show on map")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function V$(r){let e;return{c(){e=v("Edit scheme locally")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Q$(r){let e,l,t,n;return e=new tt({props:{$$slots:{default:[J$]},$$scope:{ctx:r}}}),e.$on("click",r[1]),t=new tt({props:{$$slots:{default:[V$]},$$scope:{ctx:r}}}),t.$on("click",r[2]),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment)},m(s,o){b(e,s,o),$(s,l,o),b(t,s,o),n=!0},p(s,o){const u={};o&32&&(u.$$scope={dirty:o,ctx:s}),e.$set(u);const a={};o&32&&(a.$$scope={dirty:o,ctx:s}),t.$set(a)},i(s){n||(_(e.$$.fragment,s),_(t.$$.fragment,s),n=!0)},o(s){d(e.$$.fragment,s),d(t.$$.fragment,s),n=!1},d(s){s&&p(l),k(e,s),k(t,s)}}}function Z$(r){var z,X,E,q;let e,l,t=r[0].scheme_reference+"",n,s,o,u,a=((z=r[0].browse)==null?void 0:z.authority_or_region)+"",i,f,c,m,g=((X=r[0].browse)==null?void 0:X.capital_scheme_id)+"",C,S,y,M,R=((E=r[0].browse)==null?void 0:E.funding_programme)+"",A,O,N,I,F,P=((q=r[0].browse)==null?void 0:q.current_milestone)&&Ll(r);return I=new Is({props:{$$slots:{default:[Q$]},$$scope:{ctx:r}}}),{c(){e=L("p"),l=v("Scheme reference: "),n=v(t),s=T(),o=L("p"),u=v("Authority or region: "),i=v(a),f=T(),c=L("p"),m=v("Capital scheme ID: "),C=v(g),S=T(),y=L("p"),M=v("Funding programme: "),A=v(R),O=T(),P&&P.c(),N=T(),h(I.$$.fragment)},m(D,B){$(D,e,B),w(e,l),w(e,n),$(D,s,B),$(D,o,B),w(o,u),w(o,i),$(D,f,B),$(D,c,B),w(c,m),w(c,C),$(D,S,B),$(D,y,B),w(y,M),w(y,A),$(D,O,B),P&&P.m(D,B),$(D,N,B),b(I,D,B),F=!0},p(D,B){var Ce,Le,ve,Ne;(!F||B&1)&&t!==(t=D[0].scheme_reference+"")&&j(n,t),(!F||B&1)&&a!==(a=((Ce=D[0].browse)==null?void 0:Ce.authority_or_region)+"")&&j(i,a),(!F||B&1)&&g!==(g=((Le=D[0].browse)==null?void 0:Le.capital_scheme_id)+"")&&j(C,g),(!F||B&1)&&R!==(R=((ve=D[0].browse)==null?void 0:ve.funding_programme)+"")&&j(A,R),(Ne=D[0].browse)!=null&&Ne.current_milestone?P?P.p(D,B):(P=Ll(D),P.c(),P.m(N.parentNode,N)):P&&(P.d(1),P=null);const $e={};B&32&&($e.$$scope={dirty:B,ctx:D}),I.$set($e)},i(D){F||(_(I.$$.fragment,D),F=!0)},o(D){d(I.$$.fragment,D),F=!1},d(D){D&&(p(e),p(s),p(o),p(f),p(c),p(S),p(y),p(O),p(N)),P&&P.d(D),k(I,D)}}}function K$(r){let e,l;return e=new qe({props:{label:`${r[0].scheme_name}`,$$slots:{default:[Z$]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,[n]){const s={};n&1&&(s.label=`${t[0].scheme_name}`),n&33&&(s.$$scope={dirty:n,ctx:t}),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function X$(r,e,l){let t,n;Z(r,At,a=>l(3,t=a)),Z(r,rn,a=>l(4,n=a));let{scheme:s}=e;function o(){let a={type:"FeatureCollection",features:t.features.filter(i=>i.properties.scheme_reference==s.scheme_reference)};n==null||n.fitBounds(Rs(a),{padding:20,animate:!1})}function u(){var f,c;let a={type:"FeatureCollection",features:t.features.filter(m=>m.properties.scheme_reference==s.scheme_reference)},i=((f=s.browse)==null?void 0:f.authority_or_region)||"unknown authority";bs(i,JSON.stringify(a)),window.open(`scheme.html?authority=${(c=s.browse)==null?void 0:c.authority_or_region}`,"_blank")}return r.$$set=a=>{"scheme"in a&&l(0,s=a.scheme)},[s,o,u]}class x$ extends V{constructor(e){super(),Q(this,e,X$,K$,J,{scheme:0})}}function Tl(r){let e,l,t,n=r[0].status+"",s;return{c(){e=L("p"),l=v("Status: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&1&&n!==(n=o[0].status+"")&&j(s,n)},d(o){o&&p(e)}}}function Ml(r){let e,l,t,n=r[0].timescale+"",s;return{c(){e=L("p"),l=v("Timescale: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&1&&n!==(n=o[0].timescale+"")&&j(s,n)},d(o){o&&p(e)}}}function Nl(r){let e,l,t,n=r[0].timescale_year+"",s;return{c(){e=L("p"),l=v("Estimated completion year: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&1&&n!==(n=o[0].timescale_year+"")&&j(s,n)},d(o){o&&p(e)}}}function Pl(r){let e,l,t,n=r[0].year_published+"",s;return{c(){e=L("p"),l=v("Scheme most recently published: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&1&&n!==(n=o[0].year_published+"")&&j(s,n)},d(o){o&&p(e)}}}function Ol(r){let e,l,t,n=r[0].year_consulted+"",s;return{c(){e=L("p"),l=v("Scheme most recently consulted on: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&1&&n!==(n=o[0].year_consulted+"")&&j(s,n)},d(o){o&&p(e)}}}function ep(r){let e,l,t,n,s,o=r[0].status&&Tl(r),u=r[0].timescale&&Ml(r),a=r[0].timescale_year&&Nl(r),i=r[0].year_published&&Pl(r),f=r[0].year_consulted&&Ol(r);return{c(){o&&o.c(),e=T(),u&&u.c(),l=T(),a&&a.c(),t=T(),i&&i.c(),n=T(),f&&f.c(),s=Me()},m(c,m){o&&o.m(c,m),$(c,e,m),u&&u.m(c,m),$(c,l,m),a&&a.m(c,m),$(c,t,m),i&&i.m(c,m),$(c,n,m),f&&f.m(c,m),$(c,s,m)},p(c,[m]){c[0].status?o?o.p(c,m):(o=Tl(c),o.c(),o.m(e.parentNode,e)):o&&(o.d(1),o=null),c[0].timescale?u?u.p(c,m):(u=Ml(c),u.c(),u.m(l.parentNode,l)):u&&(u.d(1),u=null),c[0].timescale_year?a?a.p(c,m):(a=Nl(c),a.c(),a.m(t.parentNode,t)):a&&(a.d(1),a=null),c[0].year_published?i?i.p(c,m):(i=Pl(c),i.c(),i.m(n.parentNode,n)):i&&(i.d(1),i=null),c[0].year_consulted?f?f.p(c,m):(f=Ol(c),f.c(),f.m(s.parentNode,s)):f&&(f.d(1),f=null)},i:te,o:te,d(c){c&&(p(e),p(l),p(t),p(n),p(s)),o&&o.d(c),u&&u.d(c),a&&a.d(c),i&&i.d(c),f&&f.d(c)}}}function tp(r,e,l){let{props:t}=e;return r.$$set=n=>{"props"in n&&l(0,t=n.props)},[t]}class cs extends V{constructor(e){super(),Q(this,e,tp,ep,J,{props:0})}}function Il(r){let e,l,t,n=r[0].budget.toLocaleString()+"",s,o;return{c(){e=L("p"),l=v("Cost: "),t=L("b"),s=v(n),o=v(` + GBP`)},m(u,a){$(u,e,a),w(e,l),w(e,t),w(t,s),w(e,o)},p(u,a){a&1&&n!==(n=u[0].budget.toLocaleString()+"")&&j(s,n)},d(u){u&&p(e)}}}function Rl(r){let e;return{c(){e=L("p"),e.textContent="Development is fully funded"},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Dl(r){let e;return{c(){e=L("p"),e.textContent="Construction is fully funded"},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Al(r){let e,l,t,n;return{c(){e=L("p"),l=v("Funding sources: "),t=L("b"),n=v(r[1])},m(s,o){$(s,e,o),w(e,l),w(e,t),w(t,n)},p(s,o){o&2&&j(n,s[1])},d(s){s&&p(e)}}}function np(r){let e,l,t,n,s=r[0].budget&&Il(r),o=r[0].development_funded&&Rl(),u=r[0].construction_funded&&Dl(),a=r[1]&&Al(r);return{c(){s&&s.c(),e=T(),o&&o.c(),l=T(),u&&u.c(),t=T(),a&&a.c(),n=Me()},m(i,f){s&&s.m(i,f),$(i,e,f),o&&o.m(i,f),$(i,l,f),u&&u.m(i,f),$(i,t,f),a&&a.m(i,f),$(i,n,f)},p(i,[f]){i[0].budget?s?s.p(i,f):(s=Il(i),s.c(),s.m(e.parentNode,e)):s&&(s.d(1),s=null),i[0].development_funded?o||(o=Rl(),o.c(),o.m(l.parentNode,l)):o&&(o.d(1),o=null),i[0].construction_funded?u||(u=Dl(),u.c(),u.m(t.parentNode,t)):u&&(u.d(1),u=null),i[1]?a?a.p(i,f):(a=Al(i),a.c(),a.m(n.parentNode,n)):a&&(a.d(1),a=null)},i:te,o:te,d(i){i&&(p(e),p(l),p(t),p(n)),s&&s.d(i),o&&o.d(i),u&&u.d(i),a&&a.d(i)}}}function lp(r){if(!r.funding_sources)return"";let e=[];for(let l of["atf2","atf3","atf4","atf4e","crsts","luf"])r.funding_sources[l]&&e.push(l.toUpperCase());return r.funding_sources.other&&e.push(r.funding_sources.other),e.join(", ")}function sp(r,e,l){let t,{props:n}=e;return r.$$set=s=>{"props"in s&&l(0,n=s.props)},r.$$.update=()=>{r.$$.dirty&1&&l(1,t=lp(n))},[n,t]}class $s extends V{constructor(e){super(),Q(this,e,sp,np,J,{props:0})}}function Zt(r){const e=r.slice(),l=e[1].pipeline;return e[5]=l,e}function Kt(r){const e=r.slice(),l=e[0].pipeline;return e[5]=l,e}function Fl(r){let e,l,t,n=hn(r[0].length_meters)+"",s;return{c(){e=L("p"),l=v("Length: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&1&&n!==(n=hn(o[0].length_meters)+"")&&j(s,n)},d(o){o&&p(e)}}}function ql(r){let e,l=lt(r[0].description,r[2])+"";return{c(){e=L("p")},m(t,n){$(t,e,n),e.innerHTML=l},p(t,n){n&5&&l!==(l=lt(t[0].description,t[2])+"")&&(e.innerHTML=l)},d(t){t&&p(e)}}}function zl(r){let e,l,t,n,s,o,u,a=r[5].atf4_type&&jl(r),i=r[5].accuracy&&Bl(r),f=r[5].is_alternative&&Hl();return n=new $s({props:{props:r[5]}}),o=new cs({props:{props:r[5]}}),{c(){a&&a.c(),e=T(),i&&i.c(),l=T(),f&&f.c(),t=T(),h(n.$$.fragment),s=T(),h(o.$$.fragment)},m(c,m){a&&a.m(c,m),$(c,e,m),i&&i.m(c,m),$(c,l,m),f&&f.m(c,m),$(c,t,m),b(n,c,m),$(c,s,m),b(o,c,m),u=!0},p(c,m){c[5].atf4_type?a?a.p(c,m):(a=jl(c),a.c(),a.m(e.parentNode,e)):a&&(a.d(1),a=null),c[5].accuracy?i?i.p(c,m):(i=Bl(c),i.c(),i.m(l.parentNode,l)):i&&(i.d(1),i=null),c[5].is_alternative?f||(f=Hl(),f.c(),f.m(t.parentNode,t)):f&&(f.d(1),f=null);const g={};m&1&&(g.props=c[5]),n.$set(g);const C={};m&1&&(C.props=c[5]),o.$set(C)},i(c){u||(_(n.$$.fragment,c),_(o.$$.fragment,c),u=!0)},o(c){d(n.$$.fragment,c),d(o.$$.fragment,c),u=!1},d(c){c&&(p(e),p(l),p(t),p(s)),a&&a.d(c),i&&i.d(c),f&&f.d(c),k(n,c),k(o,c)}}}function jl(r){let e,l,t,n=r[5].atf4_type+"",s;return{c(){e=L("p"),l=v("ATF4 type: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&1&&n!==(n=o[5].atf4_type+"")&&j(s,n)},d(o){o&&p(e)}}}function Bl(r){let e,l,t,n=r[5].accuracy+"",s;return{c(){e=L("p"),l=v("Accuracy: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&1&&n!==(n=o[5].accuracy+"")&&j(s,n)},d(o){o&&p(e)}}}function Hl(r){let e;return{c(){e=L("p"),e.textContent="Represents an alternative route"},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Gl(r){var o;let e,l,t,n=((o=r[1].browse)==null?void 0:o.capital_scheme_id)+"",s;return{c(){e=L("p"),l=v("Capital scheme ID: "),t=L("b"),s=v(n)},m(u,a){$(u,e,a),w(e,l),w(e,t),w(t,s)},p(u,a){var i;a&2&&n!==(n=((i=u[1].browse)==null?void 0:i.capital_scheme_id)+"")&&j(s,n)},d(u){u&&p(e)}}}function El(r){var o;let e,l,t,n=((o=r[1].browse)==null?void 0:o.current_milestone)+"",s;return{c(){e=L("p"),l=v("Current milestone: "),t=L("b"),s=v(n)},m(u,a){$(u,e,a),w(e,l),w(e,t),w(t,s)},p(u,a){var i;a&2&&n!==(n=((i=u[1].browse)==null?void 0:i.current_milestone)+"")&&j(s,n)},d(u){u&&p(e)}}}function Ul(r){let e,l,t,n,s,o,u,a=r[5].scheme_type&&Wl(r),i=r[5].atf4_lead_type&&Yl(r),f=r[5].scheme_description&&Jl(r);return n=new $s({props:{props:r[5]}}),o=new cs({props:{props:r[5]}}),{c(){a&&a.c(),e=T(),i&&i.c(),l=T(),f&&f.c(),t=T(),h(n.$$.fragment),s=T(),h(o.$$.fragment)},m(c,m){a&&a.m(c,m),$(c,e,m),i&&i.m(c,m),$(c,l,m),f&&f.m(c,m),$(c,t,m),b(n,c,m),$(c,s,m),b(o,c,m),u=!0},p(c,m){c[5].scheme_type?a?a.p(c,m):(a=Wl(c),a.c(),a.m(e.parentNode,e)):a&&(a.d(1),a=null),c[5].atf4_lead_type?i?i.p(c,m):(i=Yl(c),i.c(),i.m(l.parentNode,l)):i&&(i.d(1),i=null),c[5].scheme_description?f?f.p(c,m):(f=Jl(c),f.c(),f.m(t.parentNode,t)):f&&(f.d(1),f=null);const g={};m&2&&(g.props=c[5]),n.$set(g);const C={};m&2&&(C.props=c[5]),o.$set(C)},i(c){u||(_(n.$$.fragment,c),_(o.$$.fragment,c),u=!0)},o(c){d(n.$$.fragment,c),d(o.$$.fragment,c),u=!1},d(c){c&&(p(e),p(l),p(t),p(s)),a&&a.d(c),i&&i.d(c),f&&f.d(c),k(n,c),k(o,c)}}}function Wl(r){let e,l,t,n=r[5].scheme_type+"",s;return{c(){e=L("p"),l=v("Scheme type: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&2&&n!==(n=o[5].scheme_type+"")&&j(s,n)},d(o){o&&p(e)}}}function Yl(r){let e,l,t,n=r[5].atf4_lead_type+"",s;return{c(){e=L("p"),l=v("ATF4 lead type: "),t=L("b"),s=v(n)},m(o,u){$(o,e,u),w(e,l),w(e,t),w(t,s)},p(o,u){u&2&&n!==(n=o[5].atf4_lead_type+"")&&j(s,n)},d(o){o&&p(e)}}}function Jl(r){let e,l,t=r[5].scheme_description+"",n;return{c(){e=L("p"),l=v("Descripton: "),n=v(t)},m(s,o){$(s,e,o),w(e,l),w(e,n)},p(s,o){o&2&&t!==(t=s[5].scheme_description+"")&&j(n,t)},d(s){s&&p(e)}}}function rp(r){var Ft,qt,zt,He;let e,l,t,n=lt(r[0].name,r[2])+"",s,o=r[0].intervention_type+"",u,a,i,f,c,m,g,C,S,y,M,R=lt(r[1].scheme_name??"",r[3])+"",A,O,N=lt(r[0].scheme_reference,r[3])+"",I,F,P,z,X,E=((Ft=r[1].browse)==null?void 0:Ft.authority_or_region)+"",q,D,B,$e,Ce,Le,ve=((qt=r[1].browse)==null?void 0:qt.funding_programme)+"",Ne,de,Be,Fe,Pe=r[0].length_meters&&Fl(r),ue=r[0].description&&ql(r),ge=r[0].pipeline&&zl(Kt(r)),ye=((zt=r[1].browse)==null?void 0:zt.capital_scheme_id)&&Gl(r),Te=((He=r[1].browse)==null?void 0:He.current_milestone)&&El(r),we=r[1].pipeline&&Ul(Zt(r));return{c(){e=L("div"),l=L("h2"),t=new it(!1),s=v(" ("),u=v(o),a=v(")"),i=T(),Pe&&Pe.c(),f=T(),ue&&ue.c(),c=T(),ge&&ge.c(),m=T(),g=L("hr"),C=T(),S=L("p"),y=v("Part of scheme: "),M=new it(!1),A=v(" ("),O=new it(!1),I=v(")"),F=T(),P=L("p"),z=v("Authority or region: "),X=L("b"),q=v(E),D=T(),ye&&ye.c(),B=T(),$e=L("p"),Ce=v("Funding programme: "),Le=L("b"),Ne=v(ve),de=T(),Te&&Te.c(),Be=T(),we&&we.c(),t.a=s,M.a=A,O.a=I,me(e,"max-width","30vw"),me(e,"max-height","60vh"),me(e,"overflow","auto")},m(ie,Oe){$(ie,e,Oe),w(e,l),t.m(n,l),w(l,s),w(l,u),w(l,a),w(e,i),Pe&&Pe.m(e,null),w(e,f),ue&&ue.m(e,null),w(e,c),ge&&ge.m(e,null),w(e,m),w(e,g),w(e,C),w(e,S),w(S,y),M.m(R,S),w(S,A),O.m(N,S),w(S,I),w(e,F),w(e,P),w(P,z),w(P,X),w(X,q),w(e,D),ye&&ye.m(e,null),w(e,B),w(e,$e),w($e,Ce),w($e,Le),w(Le,Ne),w(e,de),Te&&Te.m(e,null),w(e,Be),we&&we.m(e,null),Fe=!0},p(ie,[Oe]){var un,cn,$n,pn;(!Fe||Oe&5)&&n!==(n=lt(ie[0].name,ie[2])+"")&&t.p(n),(!Fe||Oe&1)&&o!==(o=ie[0].intervention_type+"")&&j(u,o),ie[0].length_meters?Pe?Pe.p(ie,Oe):(Pe=Fl(ie),Pe.c(),Pe.m(e,f)):Pe&&(Pe.d(1),Pe=null),ie[0].description?ue?ue.p(ie,Oe):(ue=ql(ie),ue.c(),ue.m(e,c)):ue&&(ue.d(1),ue=null),ie[0].pipeline?ge?(ge.p(Kt(ie),Oe),Oe&1&&_(ge,1)):(ge=zl(Kt(ie)),ge.c(),_(ge,1),ge.m(e,m)):ge&&(ae(),d(ge,1,1,()=>{ge=null}),fe()),(!Fe||Oe&10)&&R!==(R=lt(ie[1].scheme_name??"",ie[3])+"")&&M.p(R),(!Fe||Oe&9)&&N!==(N=lt(ie[0].scheme_reference,ie[3])+"")&&O.p(N),(!Fe||Oe&2)&&E!==(E=((un=ie[1].browse)==null?void 0:un.authority_or_region)+"")&&j(q,E),(cn=ie[1].browse)!=null&&cn.capital_scheme_id?ye?ye.p(ie,Oe):(ye=Gl(ie),ye.c(),ye.m(e,B)):ye&&(ye.d(1),ye=null),(!Fe||Oe&2)&&ve!==(ve=(($n=ie[1].browse)==null?void 0:$n.funding_programme)+"")&&j(Ne,ve),(pn=ie[1].browse)!=null&&pn.current_milestone?Te?Te.p(ie,Oe):(Te=El(ie),Te.c(),Te.m(e,Be)):Te&&(Te.d(1),Te=null),ie[1].pipeline?we?(we.p(Zt(ie),Oe),Oe&2&&_(we,1)):(we=Ul(Zt(ie)),we.c(),_(we,1),we.m(e,null)):we&&(ae(),d(we,1,1,()=>{we=null}),fe())},i(ie){Fe||(_(ge),_(we),Fe=!0)},o(ie){d(ge),d(we),Fe=!1},d(ie){ie&&p(e),Pe&&Pe.d(),ue&&ue.d(),ge&&ge.d(),ye&&ye.d(),Te&&Te.d(),we&&we.d()}}}function lt(r,e){return e?r.replace(new RegExp(e,"gi"),l=>`${l}`):r}function op(r,e,l){let t,n,s,o;Z(r,Yt,a=>l(4,n=a)),Z(r,Bt,a=>l(2,s=a)),Z(r,Ht,a=>l(3,o=a));let{props:u}=e;return r.$$set=a=>{"props"in a&&l(0,u=a.props)},r.$$.update=()=>{r.$$.dirty&17&&l(1,t=n.get(u.scheme_reference))},[u,t,s,o,n]}class fn extends V{constructor(e){super(),Q(this,e,op,rp,J,{props:0})}}function ip(r){let e,l=r[6].name+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&64&&l!==(l=n[6].name+"")&&j(t,l)},d(n){n&&p(e)}}}function ap(r){let e,l;return e=new fn({props:{props:r[6]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&64&&(s.props=t[6]),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function fp(r){let e,l,t,n;return e=new oe({props:{popupClass:"border-popup",$$slots:{default:[ip,({props:s})=>({6:s}),({props:s})=>s?64:0]},$$scope:{ctx:r}}}),t=new oe({props:{openOn:"click",popupClass:"border-popup",$$slots:{default:[ap,({props:s})=>({6:s}),({props:s})=>s?64:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment)},m(s,o){b(e,s,o),$(s,l,o),b(t,s,o),n=!0},p(s,o){const u={};o&192&&(u.$$scope={dirty:o,ctx:s}),e.$set(u);const a={};o&192&&(a.$$scope={dirty:o,ctx:s}),t.$set(a)},i(s){n||(_(e.$$.fragment,s),_(t.$$.fragment,s),n=!0)},o(s){d(e.$$.fragment,s),d(t.$$.fragment,s),n=!1},d(s){s&&p(l),k(e,s),k(t,s)}}}function up(r){let e,l=r[6].name+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&64&&l!==(l=n[6].name+"")&&j(t,l)},d(n){n&&p(e)}}}function cp(r){let e,l;return e=new fn({props:{props:r[6]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&64&&(s.props=t[6]),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function $p(r){let e,l,t,n;return e=new oe({props:{popupClass:"border-popup",$$slots:{default:[up,({props:s})=>({6:s}),({props:s})=>s?64:0]},$$scope:{ctx:r}}}),t=new oe({props:{openOn:"click",popupClass:"border-popup",$$slots:{default:[cp,({props:s})=>({6:s}),({props:s})=>s?64:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment)},m(s,o){b(e,s,o),$(s,l,o),b(t,s,o),n=!0},p(s,o){const u={};o&192&&(u.$$scope={dirty:o,ctx:s}),e.$set(u);const a={};o&192&&(a.$$scope={dirty:o,ctx:s}),t.$set(a)},i(s){n||(_(e.$$.fragment,s),_(t.$$.fragment,s),n=!0)},o(s){d(e.$$.fragment,s),d(t.$$.fragment,s),n=!1},d(s){s&&p(l),k(e,s),k(t,s)}}}function pp(r){let e,l=r[6].name+"",t;return{c(){e=L("p"),t=v(l)},m(n,s){$(n,e,s),w(e,t)},p(n,s){s&64&&l!==(l=n[6].name+"")&&j(t,l)},d(n){n&&p(e)}}}function mp(r){let e,l;return e=new fn({props:{props:r[6]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&64&&(s.props=t[6]),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function _p(r){let e,l,t,n;return e=new oe({props:{popupClass:"border-popup",$$slots:{default:[pp,({props:s})=>({6:s}),({props:s})=>s?64:0]},$$scope:{ctx:r}}}),t=new oe({props:{openOn:"click",popupClass:"border-popup",$$slots:{default:[mp,({props:s})=>({6:s}),({props:s})=>s?64:0]},$$scope:{ctx:r}}}),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment)},m(s,o){b(e,s,o),$(s,l,o),b(t,s,o),n=!0},p(s,o){const u={};o&192&&(u.$$scope={dirty:o,ctx:s}),e.$set(u);const a={};o&192&&(a.$$scope={dirty:o,ctx:s}),t.$set(a)},i(s){n||(_(e.$$.fragment,s),_(t.$$.fragment,s),n=!0)},o(s){d(e.$$.fragment,s),d(t.$$.fragment,s),n=!1},d(s){s&&p(l),k(e,s),k(t,s)}}}function gp(r){let e,l,t,n,s,o,u,a,i,f;const c=[H("interventions-points"),{filter:["all",bn,r[3],r[4]]},{manageHoverState:!0},{eventsIfTopMost:!0},{paint:{"circle-color":r[2],"circle-radius":kn,"circle-opacity":ee(1,.5)}},{layout:{visibility:r[0]?"visible":"none"}},{hoverCursor:"pointer"}];let m={$$slots:{default:[fp]},$$scope:{ctx:r}};for(let N=0;Nl(5,n=i));let{showSchemes:s}=e,[o]=nn();const u=["!=",["get","hide_while_editing"],!0],a=["!=",["get","endpoint"],!0];return r.$$set=i=>{"showSchemes"in i&&l(0,s=i.showSchemes)},r.$$.update=()=>{r.$$.dirty&32&&l(1,t=Ds(n))},[s,t,o,u,a,n]}class bp extends V{constructor(e){super(),Q(this,e,hp,dp,J,{showSchemes:0})}}function Vl(r,e,l){const t=r.slice();return t[13]=e[l],t}function Ql(r,e,l){const t=r.slice();return t[16]=e[l],t}function kp(r){let e,l;return e=new Y$({props:{loadFile:r[7]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p:te,i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function Zl(r){let e,l,t,n,s;e=new tt({props:{$$slots:{default:[wp]},$$scope:{ctx:r}}}),e.$on("click",r[8]);function o(a){r[9](a)}let u={title:"About this scheme data",$$slots:{default:[vp]},$$scope:{ctx:r}};return r[3]!==void 0&&(u.open=r[3]),t=new ts({props:u}),U.push(()=>W(t,"open",o)),{c(){h(e.$$.fragment),l=T(),h(t.$$.fragment)},m(a,i){b(e,a,i),$(a,l,i),b(t,a,i),s=!0},p(a,i){const f={};i&524288&&(f.$$scope={dirty:i,ctx:a}),e.$set(f);const c={};i&524304&&(c.$$scope={dirty:i,ctx:a}),!n&&i&8&&(n=!0,c.open=a[3],Y(()=>n=!1)),t.$set(c)},i(a){s||(_(e.$$.fragment,a),_(t.$$.fragment,a),s=!0)},o(a){d(e.$$.fragment,a),d(t.$$.fragment,a),s=!1},d(a){a&&p(l),k(e,a),k(t,a)}}}function wp(r){let e;return{c(){e=v("About the scheme data")},m(l,t){$(l,e,t)},d(l){l&&p(e)}}}function Kl(r){let e,l,t=r[16]+"",n;return{c(){e=L("li"),l=L("p"),n=v(t)},m(s,o){$(s,e,o),w(e,l),w(l,n)},p(s,o){o&16&&t!==(t=s[16]+"")&&j(n,t)},d(s){s&&p(e)}}}function vp(r){let e,l,t,n,s=Se(r[4].notes),o=[];for(let u=0;uW(e,"schemesToBeShown",s)),U.push(()=>W(e,"show",o)),{c(){h(e.$$.fragment)},m(a,i){b(e,a,i),n=!0},p(a,i){const f={};!l&&i&2&&(l=!0,f.schemesToBeShown=a[1],Y(()=>l=!1)),!t&&i&4&&(t=!0,f.show=a[2],Y(()=>t=!1)),e.$set(f)},i(a){n||(_(e.$$.fragment,a),n=!0)},o(a){d(e.$$.fragment,a),n=!1},d(a){k(e,a)}}}function xl(r){let e,l;return e=new x$({props:{scheme:r[13]}}),{c(){h(e.$$.fragment)},m(t,n){b(e,t,n),l=!0},p(t,n){const s={};n&64&&(s.scheme=t[13]),e.$set(s)},i(t){l||(_(e.$$.fragment,t),l=!0)},o(t){d(e.$$.fragment,t),l=!1},d(t){k(e,t)}}}function es(r){let e=r[1].has(r[13].scheme_reference),l,t,n=e&&xl(r);return{c(){n&&n.c(),l=Me()},m(s,o){n&&n.m(s,o),$(s,l,o),t=!0},p(s,o){o&66&&(e=s[1].has(s[13].scheme_reference)),e?n?(n.p(s,o),o&66&&_(n,1)):(n=xl(s),n.c(),_(n,1),n.m(l.parentNode,l)):n&&(ae(),d(n,1,1,()=>{n=null}),fe())},i(s){t||(_(n),t=!0)},o(s){d(n),t=!1},d(s){s&&p(l),n&&n.d(s)}}}function yp(r){let e,l,t,n,s,o,u,a,i,f,c=en()=="Private (development)",m,g,C,S,y,M,R,A,O;s=new As({props:{boundaryGeojson:r[4]}}),i=new ks({});let N=c&&kp(r),I=r[4].notes&&Zl(r);C=new ws({props:{label:"Load schemes from GeoJSON",onLoad:r[7]}}),y=new vs({props:{errorMessage:r[0]}});let F=r[6].size>0&&Xl(r),P=Se(r[6].values()),z=[];for(let E=0;Ed(z[E],1,1,()=>{z[E]=null});return{c(){e=L("div"),l=L("div"),t=L("h1"),t.textContent="Browse schemes",n=T(),h(s.$$.fragment),o=T(),u=L("p"),u.textContent=`App version: ${en()}`,a=T(),h(i.$$.fragment),f=T(),N&&N.c(),m=T(),I&&I.c(),g=T(),h(C.$$.fragment),S=T(),h(y.$$.fragment),M=T(),F&&F.c(),R=T(),A=L("ul");for(let E=0;E{I=null}),fe());const B={};if(q&1&&(B.errorMessage=E[0]),y.$set(B),E[6].size>0?F?(F.p(E,q),q&64&&_(F,1)):(F=Xl(E),F.c(),_(F,1),F.m(e,R)):F&&(ae(),d(F,1,1,()=>{F=null}),fe()),q&66){P=Se(E[6].values());let $e;for($e=0;$el(4,t=y)),Z(r,xt,y=>l(5,n=y)),Z(r,Yt,y=>l(6,s=y)),on(()=>{Ss()});const o=new URLSearchParams(window.location.search);xt.set(o.get("style")||"dataviz");let u="",a=new Set,i=!0,f=!1;function c(y,M){try{At.set(JSON.parse(M)),Yt.set(mr(t)),l(0,u="")}catch(R){l(0,u=`The file you loaded is broken: ${R}`)}}const m=()=>l(3,f=!0);function g(y){f=y,l(3,f)}function C(y){a=y,l(1,a)}function S(y){i=y,l(2,i)}return[u,a,i,f,t,n,s,c,m,g,C,S]}class Mp extends V{constructor(e){super(),Q(this,e,Tp,Lp,J,{})}}document.body.className+=" js-enabled"+("noModule"in HTMLScriptElement.prototype?" govuk-frontend-supported":"");new Mp({target:document.getElementById("app")}); diff --git a/ss_huge_refactor_pt1/browse.html b/ss_huge_refactor_pt1/browse.html index ef5e2949..1a76ef3c 100644 --- a/ss_huge_refactor_pt1/browse.html +++ b/ss_huge_refactor_pt1/browse.html @@ -7,10 +7,10 @@ content="initial-scale=1,maximum-scale=1,user-scalable=no" /> ATIP v2 scheme browser - - - - + + + + diff --git a/ss_huge_refactor_pt1/index.html b/ss_huge_refactor_pt1/index.html index 6a58bc02..fa9741b2 100644 --- a/ss_huge_refactor_pt1/index.html +++ b/ss_huge_refactor_pt1/index.html @@ -7,10 +7,10 @@ content="initial-scale=1,maximum-scale=1,user-scalable=no" /> Active Travel Infrastructure Platform v2 - - - - + + + + diff --git a/ss_huge_refactor_pt1/scheme.html b/ss_huge_refactor_pt1/scheme.html index 44831e52..efd90566 100644 --- a/ss_huge_refactor_pt1/scheme.html +++ b/ss_huge_refactor_pt1/scheme.html @@ -7,10 +7,10 @@ content="initial-scale=1,maximum-scale=1,user-scalable=no" /> ATIP v2 Scheme Sketcher - - - - + + + +