1(function(){"use strict";function k(n,t,i){var r=n*Math.PI/180,f=t*Math.PI/180,e=1-i.b*i.b/(i.a*i.a),u=i.a/Math.sqrt(1-e*Math.sin(r)*Math.sin(r));return{x:u*Math.cos(r)*Math.cos(f),y:u*Math.cos(r)*Math.sin(f),z:u*(1-e)*Math.sin(r)}}function d(n,t){for(var r=1-t.b*t.b/(t.a*t.a),u=Math.sqrt(n.x*n.x+n.y*n.y),i=Math.atan2(n.z,u*(1-r)),f=2*Math.PI,e;Math.abs(i-f)>1e-12;)f=i,e=t.a/Math.sqrt(1-r*Math.sin(i)*Math.sin(i)),i=Math.atan2(n.z+r*e*Math.sin(i),u);return{lat:i*180/Math.PI,lng:Math.atan2(n.y,n.x)*180/Math.PI}}function g(n,t,i){var r=i?-1:1,u=1+r*t.s/1e6,f=r*t.rx/3600*Math.PI/180,e=r*t.ry/3600*Math.PI/180,o=r*t.rz/3600*Math.PI/180;return{x:r*t.tx+u*n.x-o*n.y+e*n.z,y:r*t.ty+o*n.x+u*n.y-f*n.z,z:r*t.tz-e*n.x+f*n.y+u*n.z}}function ut(n,t){return d(g(k(n,t,y),b,!1),f)}function ft(n,t){return d(g(k(n,t,f),b,!0),y)}function nt(n,i){var a=f.a,y=f.b,e=n*Math.PI/180,tt=i*Math.PI/180,k=1-y*y/(a*a),s=(a-y)/(a+y),d=s*s,b=s*s*s,h=Math.sin(e),v=Math.cos(e),u=Math.tan(e),o=a*r/Math.sqrt(1-k*h*h),nt=a*r*(1-k)/Math.pow(1-k*h*h,1.5),g=o/nt-1,it=y*r*((1+s+5/4*d+5/4*b)*(e-t)-(3*s+3*d+21/8*b)*Math.sin(e-t)*Math.cos(e+t)+(15/8*d+15/8*b)*Math.sin(2*(e-t))*Math.cos(2*(e+t))-35/24*b*Math.sin(3*(e-t))*Math.cos(3*(e+t))),rt=it+c,ut=o/2*h*v,ft=o/24*h*Math.pow(v,3)*(5-u*u+9*g),et=o/720*h*Math.pow(v,5)*(61-58*u*u+Math.pow(u,4)),ot=o*v,st=o/6*Math.pow(v,3)*(o/nt-u*u),ht=o/120*Math.pow(v,5)*(5-18*u*u+Math.pow(u,4)+14*g-58*u*u*g),l=tt-p;return{N:rt+ut*l*l+ft*Math.pow(l,4)+et*Math.pow(l,6),E:w+ot*l+st*Math.pow(l,3)+ht*Math.pow(l,5)}}function et(n,i){var h=f.a,a=f.b,nt=1-a*a/(h*h),l=(h-a)/(h+a),tt=l*l,b=l*l*l,u=t,it=0;do u=(i-c-it)/(h*r)+u,it=a*r*((1+l+5/4*tt+5/4*b)*(u-t)-(3*l+3*tt+21/8*b)*Math.sin(u-t)*Math.cos(u+t)+(15/8*tt+15/8*b)*Math.sin(2*(u-t))*Math.cos(2*(u+t))-35/24*b*Math.sin(3*(u-t))*Math.cos(3*(u+t)));while(Math.abs(i-c-it)>1e-5);var k=Math.sin(u),v=Math.tan(u),d=1/Math.cos(u),e=h*r/Math.sqrt(1-nt*k*k),y=h*r*(1-nt)/Math.pow(1-nt*k*k,1.5),rt=e/y-1,o=v*v,g=o*o,ut=g*o,ft=v/(2*y*e),et=v/(24*y*Math.pow(e,3))*(5+3*o+rt-9*o*rt),ot=v/(720*y*Math.pow(e,5))*(61+90*o+45*g),st=d/e,ht=d/(6*Math.pow(e,3))*(e/y+2*o),ct=d/(120*Math.pow(e,5))*(5+28*o+24*g),lt=d/(5040*Math.pow(e,7))*(61+662*o+1320*g+720*ut),s=n-w,at=u-ft*s*s+et*Math.pow(s,4)-ot*Math.pow(s,6),vt=p+st*s-ht*Math.pow(s,3)+ct*Math.pow(s,5)-lt*Math.pow(s,7);return{lat:at*180/Math.PI,lng:vt*180/Math.PI}}function tt(n,t,i){if(n<0||n>=7e5||t<0||t>=13e5)return null;var h=Math.floor(n/1e5),f=Math.floor(t/1e5),e=19-f-(19-f)%5+Math.floor((h+10)/5),o=(19-f)*5%25+h%5;e>7&&e++;o>7&&o++;for(var l=String.fromCharCode(e+65)+String.fromCharCode(o+65),s=i/2,c=Math.pow(10,5-s),r=String(Math.floor(n%1e5/c)),u=String(Math.floor(t%1e5/c));r.length<s;)r="0"+r;while(u.length<s)u="0"+u;return l+" "+r+" "+u}function ot(n){var t,i,r,f,e,o,u;return(n=String(n||"").trim().toUpperCase().replace(/[^A-Z0-9]/g,""),t=n.match(/^([A-HJ-Z][A-HJ-Z])(\d{2,10})$/),!t||t[2].length%2!=0)?null:(i=t[1].charCodeAt(0)-65,r=t[1].charCodeAt(1)-65,i>8&&i--,r>8&&r--,f=(i-2)%5*5+r%5,e=19-Math.floor(i/5)*5-Math.floor(r/5),f<0||f>6||e<0||e>12)?null:(o=t[2].length/2,u=Math.pow(10,5-o),{E:f*1e5+parseInt(t[2].slice(0,o),10)*u+u/2,N:e*1e5+parseInt(t[2].slice(o),10)*u+u/2,figures:t[2].length})}function s(n,t,i){var u=ut(n,t),r=nt(u.lat,u.lng),f=tt(r.E,r.N,i||6);return f?{ref:f,E:Math.round(r.E),N:Math.round(r.N)}:null}function it(n){var t=ot(n),i,r;return t?(i=et(t.E,t.N),r=ft(i.lat,i.lng),{lat:r.lat,lng:r.lng,E:t.E,N:t.N,figures:t.figures}):null}function i(n,t){var i=window.WIML_I18N;return i&&i[n]||t}function st(){var n=document.querySelector('input[name="osg-figures"]:checked');return n?parseInt(n.value,10):6}function rt(){if(u){var t=s(u.lat,u.lng,st());if(!t){n("osg-mine").textContent=i("t_outside_gb","Outside the National Grid");n("osg-en").textContent=i("t_osg_gb_only","The OS grid covers Great Britain only â see the notes below.");return}n("osg-mine").textContent=t.ref;n("osg-en").textContent="E "+t.E+" N "+t.N+(u.acc?" (±"+Math.round(u.acc)+" m GPS)":"")}}function h(t,r,u){var h=s(t,r,10),f;if(n("osg-out").hidden=!1,!h){n("osg-ref-out").textContent=i("t_outside_gb","Outside the National Grid");n("osg-ref-rows").innerHTML="";n("osg-latlng-out").textContent=t.toFixed(6)+", "+r.toFixed(6)+" â "+i("t_osg_gb_only_short","Great Britain only; use UTM elsewhere.");return}n("osg-ref-out").textContent=h.ref;f=n("osg-ref-rows");f.innerHTML="";
1[[6,"100 m"],[8,"10 m"],[4,"1 km"]].forEach(function(n){var o=s(t,r,n[0]),u=document.createElement("div"),e=document.createElement("dt"),i;e.textContent=n[0]+"-figure ("+n[1]+")";i=document.createElement("dd");i.className="coord-value";i.textContent=o.ref;u.appendChild(e);u.appendChild(i);f.appendChild(u)});n("osg-latlng-out").textContent=t.toFixed(6)+", "+r.toFixed(6)+(u?" â "+u:"");e.loadLeaflet(function(){o||(o=e.makeMap("osg-map",{lat:t,lng:r},{zoom:14,staticPin:!0}));n("osg-map-card").hidden=!1;o.setPoint(t,r,14);o.map.invalidateSize()})}function a(){var t=n("osg-q").value.trim(),r,u;if(t){if(r=it(t),r){h(r.lat,r.lng,t.toUpperCase().replace(/\s+/g," "));n("osg-conv-status").textContent="";return}if(u=e.coords.parseCoordinates(t),u){h(u.lat,u.lng,null);n("osg-conv-status").textContent="";return}n("osg-conv-status").textContent=i("t_resolving","Resolvingâ¦");e.resolveLocation(t).then(function(t){n("osg-conv-status").textContent="";h(t.lat,t.lng,t.label)}).catch(function(){n("osg-conv-status").textContent=i("t_osg_no_match","Not a grid reference, coordinates, or a findable place â try âTQ 304 801â, â51.5, -0.1â, or a town name.")})}}var e=window.WIML=window.WIML||{},y={a:6378137,b:6356752.314245},f={a:6377563.396,b:6356256.909},r=.9996012717,t=49*Math.PI/180,p=Math.PI/-90,c=-1e5,w=4e5,b={tx:-446.448,ty:125.157,tz:-542.06,rx:-.1502,ry:-.247,rz:-.8421,s:20.4894},l,n,u,o,v;(e.osgrid={toGridRef:s,fromGridRef:it,_osgb36ToEN:nt,_enToGridRef:tt},l=document.getElementById("osgrid-tool"),l)&&(n=function(n){return document.getElementById(n)},u=null,o=null,n("btn-osg-locate").addEventListener("click",function(){if(!navigator.geolocation){n("osg-status").textContent=i("t_geolocation_not_supported","Geolocation not supported.");return}n("osg-status").textContent=i("t_getting_your_position","Getting your positionâ¦");navigator.geolocation.getCurrentPosition(function(t){u={lat:t.coords.latitude,lng:t.coords.longitude,acc:t.coords.accuracy};n("osg-status").textContent="";n("osg-mine-card").hidden=!1;rt()},function(){n("osg-status").textContent=i("t_osg_denied","Permission denied â you can still convert below.")},{enableHighAccuracy:!0,timeout:12e3,maximumAge:0})}),l.addEventListener("change",function(n){n.target&&n.target.name==="osg-figures"&&rt()}),n("btn-osg-copy").addEventListener("click",function(){var t=n("osg-mine").textContent;t&&t!=="â"&&navigator.clipboard.writeText(t).then(function(){n("btn-osg-copy").textContent=i("t_copied","â Copied");setTimeout(function(){n("btn-osg-copy").textContent=i("t_copy","Copy")},1500)})}),n("btn-osg-go").addEventListener("click",a),n("osg-q").addEventListener("keydown",function(n){n.key==="Enter"&&(n.preventDefault(),a())}),n("osg-q").addEventListener("recent-selected",function(n){h(n.detail.lat,n.detail.lng,n.detail.name)}),v=new URLSearchParams(location.search).get("q"),v&&(n("osg-q").value=v,a()))})()
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.