PageSourceSearch

https://www.bcpcouncil.gov.uk/_mk7dvA_e6bfaad7-9b78-4ed1-813d-b97e…llingStationLookup.1791f118d6eda29c8447.mjs

js bcpcouncil.gov.uk collected 2026-10-02 02:51:20 UTC 9,522 bytes, 215 lines download raw bytes

1"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[4278],{69080(le,y,u){u.r(y),u.d(y,{default:()=>V});var e=u(48322),L=u(34500);const B=L.default.div`
2  ${({theme:{colors:c,mq:a}})=>(0,L.css)`
3      .pollingStationLookup-Title {
4        margin: 2rem 0 1rem 0;
5        width: 100%
6        display: block;
7        position: relative;
8      }
9
10      .pollingStationLookup-Text {
11        margin: 0 0 2rem 0;
12        width: 100%
13        display: block;
14        position: relative;
15      }
16
17      .pollingStationLookup-Content {
18        margin: 1rem 0;
19        width: 100%
20        display: block;
21        position: relative;
22      }
23
24      .pollingStationLookup-Content.active {
25        border-left: 5px solid #A00000;
26        padding-left: 1rem;
27      }
28
29      .pollingStationLookup-Content-Title {
30        margin: 1rem 0;
31        width: 100%
32        display: block;
33        position: relative;
34      }
35
36      .pollingStationLookup-Content-Postcode, .pollingStationLookup-Content-Number {
37        margin: 1rem 0;
38        width: 100%
39        display: block;
40        position: relative;
41      }
42
43      .pollingStationLookup-Content-Postcode label, .pollingStationLookup-Content-Postcode input[type="text"],
44      .pollingStationLookup-Content-Number label, .pollingStationLookup-Content-Number input[type="text"] {
45        width: 200px;
46        display: block;
47        position: relative;
48      }
49
50      .pollingStationLookup-Content-Postcode label, .pollingStationLookup-Content-Number label {
51        width: 100%;
52      }
53
54      #results {
55        width: 100%;
56        display: none;
57        position: relative;
58        list-style-type: none;
59        padding: 0;
60        margin: 0 0 2rem 0;
61      }
62
63      #results.active {
64        display: block;
65      }
66
67      #results li {
68        width: 100%;
69        display: flex;
70        flex-direction: row;
71        flex-wrap: nowrap;
72        align-items: center;
73        justify-content: flex-start;
74        position: relative;
75        margin: 0 0 1rem 0;
76      }
77
78      #results li input[type="radio"] {
79        margin-right: 0.5rem;
80        width: 20px;
81        height: 20px;
82      }
83
84      #btnFindAddress, #btnContinue {
85        width: auto;
86        text-decoration: none;
87        cursor: pointer;
88        display: flex;
89        -webkit-box-align: center;
90        align-items: center;
91        padding: 0.8rem;
92        border: none;
93        box-shadow: rgb(0, 45, 24) 0px 2px 0px;
94        border-radius: 0px;
95        font-size: 1.5rem;
96        font-weight: 700;
97        color: rgb(255, 255, 255);
98        background-color: rgb(0, 112, 60);
99        transition: 0.3s ease-in-out;
100        text-align: center;
101        width: max-content;
102        margin-top: 1rem;
103      }
104
105      #btnFindAddress:hover, #btnContinue:hover {
106        background-color: rgb(0, 90, 48);
107        color: rgb(255, 255, 255);
108        transition: 0.3s ease-in-out;
109        box-shadow: rgb(0, 45, 24) 0px 2px 0px;
110      }
111
112      #btnFindAddress:focus, #btnContinue:focus {
113        outline: none;
114        transition: none;
115        background-color: rgb(255, 221, 0);
116        box-shadow: rgb(0, 45, 24) 0px 2px 0px;
117        text-decoration-thickness: 3px;
118      }
119
120      #station {
121        width: 100%;
122        display: none;
123        position: relative;
124        margin: 1rem 0;
125      }
126
127      #station.active {
128        display: block;
129      }
130
131      #continue {
132        display: none;
133        width: 100%;
134        position: relative;
135      }
136
137      #continue.active {
138        display: block;
139      }
140
141      #continue-warning {
142        display: none;
143        color: #A00000;
144        font-weight: bold;
145      }
146
147      #continue-warning.active {
148        display: block;
149        border-left: 5px solid #A00000;
150        padding-left: 1rem;
151      }
152
153      #continue.warn #results {
154        border-left: 5px solid #A00000;
155        padding-left: 1rem;
156      }
157
158      #lookup-warning {
159        display: none;
160        width: 100%;
161        position: relative;
162        color: #A00000;
163        font-weight: bold;
164      }
165
166      #lookup-warning.active {
167        display: block;
168      }
169
170      #lookup {
171        width: 100%
172        display: block;
173        position: relative;
174      }
175
176      #lookup.warn {
177        border-left: 5px solid #A00000;
178        padding-left: 1rem;
179      }
180
181      #map {
182        width: 100%;
183        display: none;
184        position: relative;
185      }
186
187      #map.active {
188        display: block;
189      }
190
191      #map iframe {
192        border: 0;
193        width: 100%;
194      }
195
196      #btnReset {
197        width: auto;
198        height: 2rem;
199        padding: 0;
200        margin: 20px 0;
201        background-color: transparent;
202        border: none;
203        cursor: pointer;
204        text-decoration: underline;
205      }
206
207      #no-results {
208        display: none;
209      }
210
211      #no-results.active {
212        display: block;
213      }
214    `}
215`;var $=u(43860);const h=1,W=2,j=10,U=11,z=12,H=13,K=14,J=15,Q=c=>{const a=c.toUpperCase().trim();return a.includes(" ")?a:a.slice(0,-3)+" "+a.slice(-3)},r=(...c)=>
215c.filter(Boolean).join(" ")||void 0,V=({title:c,text:a})=>{const[n,X]=(0,e.useState)(null),[v,C]=(0,e.useState)(""),[S,N]=(0,e.useState)(""),[A,w]=(0,e.useState)([]),[k,f]=(0,e.useState)(""),[O,E]=(0,e.useState)(!1),[Y,p]=(0,e.useState)(!1),[Z,x]=(0,e.useState)(!1),[P,m]=(0,e.useState)(!1),[G,D]=(0,e.useState)(""),[T,_]=(0,e.useState)(""),[g,F]=(0,e.useState)(null),[b,I]=(0,e.useState)(null),q=(0,e.useMemo)(()=>{if(!n)return new Map;const t=new Map;return n.forEach((o,l)=>{var i;const s=(i=o[W])==null?void 0:i.trim();if(s){const d=t.get(s);d?d.push(l):t.set(s,[l])}}),t},[n]),ee=(0,e.useMemo)(()=>{if(!n)return new Map;const t=new Map;return n.forEach((o,l)=>{var i;const s=(i=o[h])==null?void 0:i.replaceAll('"',"");s&&t.set(s,l)}),t},[n]);(0,e.useEffect)(()=>{fetch("/_mk7dvA_e6bfaad7-9b78-4ed1-813d-b97ea6bd773f/static/assets/elections_lookup.csv").then(t=>t.text()).then(t=>{const o=t.trim().split(/\r?\n/).slice(1).filter(Boolean).map(l=>l.split(","));X(o)})},[]);const te=()=>{var t;if(!v.trim()){E(!0);return}E(!1),p(!1),w([]),f(""),x(!1),m(!1);const o=Q(v);try{const l=n!=null?n:[],i=((t=q.get(o))!=null?t:[]).map(d=>l[d]),s=S.trim()?i.filter(d=>d[h].includes(S)):i;s.length>0?(w(s),x(!0)):p(!0)}catch(l){p(!0)}},oe=()=>{if(!k){m(!0);return}m(!1);const t=ee.get(k),o=t!==void 0?(n!=null?n:[])[t]:void 0;o&&(D(o[z]),_(o[J]),I({lat:o[j],lon:o[U]}),F({lat:o[H],lon:o[K]}))},ne=()=>{C(""),N(""),w([]),f(""),E(!1),p(!1),x(!1),m(!1),D(""),_(""),F(null),I(null)},M=Boolean(T),R=Boolean(b&&g);return e.createElement(B,null,e.createElement("div",{className:"pollingStationLookup"},c&&e.createElement("div",{className:"pollingStationLookup-Title"},e.createElement("h2",null,c)),a&&e.createElement("div",{className:"pollingStationLookup-Text"},e.createElement($.default,{text:a})),n===null&&e.createElement("div",null,"Loading data, please wait..."),n&&n.length>0&&e.createElement("div",{className:"pollingStationLookup-Content"},e.createElement("div",{id:"lookup",className:r(O&&"warn")},e.createElement("div",{className:"pollingStationLookup-Content-Title"},e.createElement("h3",null,"Find address")),e.createElement("div",{id:"lookup-warning",className:r(O&&"active")},"Please enter a postcode"),e.createElement("div",{className:"pollingStationLookup-Content-Postcode"},e.createElement("label",{htmlFor:"txtPostcode"},"Postcode"),e.createElement("input",{type:"text",id:"txtPostcode",value:v,onChange:t=>C(t.target.value)})),e.createElement("div",{className:"pollingStationLookup-Content-Number"},e.createElement("label",{htmlFor:"txtNumber"},"Building number or name (optional)"),e.createElement("p",null,"For example, 15 or Sanctuary Buildings"),e.createElement("input",{type:"text",id:"txtNumber",value:S,onChange:t=>N(t.target.value)}))),e.createElement("div",{className:"pollingStationLookup-Content-Number"},e.createElement("button",{type:"button",id:"btnFindAddress",onClick:te},"Find address")),e.createElement("div",{id:"no-results",className:r(Y&&"active")},"No scheduled elections in your area at this time."),e.createElement("div",{id:"continue",className:r(Z&&"active",P&&"warn")},e.createElement("div",{id:"continue-warning",className:r(P&&"active")},"Select an address"),e.createElement("ul",{id:"results",className:r(A.length>0&&"active")},A.map((t,o)=>{const l=t[h].replaceAll('"',"");return e.createElement("li",{key:o},e.createElement("input",{type:"radio",name:"addr",checked:k===l,onChange:()=>{var i;f(l),(i=document.getElementById("btnContinue"))==null||i.scrollIntoView(!0)}}),e.createElement("span",null,l))})),e.createElement("button",{type:"button",id:"btnContinue",onClick:oe},"Continue")),e.createElement("div",{id:"station",className:r(M&&"active")},M&&e.createElement(e.Fragment,null,e.createElement("strong",null,"Your polling station is:"),e.createElement("br",null),e.createElement("br",null),T,e.createElement("br",null),e.createElement("br",null),"To view a suggested walking route, please click More options in the map below")),e.createElement("div",{id:"map",className:r(R&&"active")},R&&b&&g&&e.createElement("iframe",{src:`https://www.google.com/maps/embed/v1/directions?key=AIzaSyDS6pgDnZeoX9KptOm_4EFJIQ9BUe1PtWc&origin=${b.lat}%2C${b.lon}&destination=${g.lat}%2C${g.lon}`,width:"600",height:"450",loading:"lazy",referrerPolicy:"no-referrer-when-downgrade",title:`Directions to ${G}`,allowFullScreen:!0})),e.createElement("div",{id:"reset"},e.createElement("button",{type:"button",id:"btnReset",onClick:ne},"Reset")))))}}}]);

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.