@defra/interactive-map 0.0.44-alpha → 0.0.45-alpha
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/assets/templates/add-polygons.njk +6 -6
- package/assets/templates/select-feature.njk +72 -15
- package/dist/css/index.css +1 -1
- package/dist/esm/im-core.js +1 -1
- package/dist/umd/im-core.js +1 -1
- package/docs/examples/add-marker-with-panel.mdx +4 -0
- package/docs/examples/add-polygons.mdx +16 -12
- package/docs/examples/add-symbols.mdx +4 -0
- package/docs/examples/basic-map.mdx +4 -0
- package/docs/examples/button-map.mdx +4 -0
- package/docs/examples/draw-tools.mdx +4 -0
- package/docs/examples/place-marker.mdx +4 -0
- package/docs/examples/search-control.mdx +4 -0
- package/docs/examples/select-feature.mdx +4 -0
- package/docs/examples/style-switcher.mdx +36 -44
- package/docs/examples/toggle-marker-label.mdx +4 -0
- package/package.json +1 -1
- package/plugins/search/dist/esm/im-search-plugin.js +1 -1
- package/plugins/search/dist/umd/im-search-plugin.js +1 -1
- package/plugins/search/src/components/Form/Form.jsx +3 -3
- package/plugins/search/src/components/Suggestions/Suggestions.jsx +2 -2
- package/plugins/search/src/components/Suggestions/Suggestions.test.jsx +1 -1
- package/providers/beta/esri/dist/esm/im-esri-provider.js +1 -1
- package/providers/beta/esri/src/utils/spatial.js +15 -13
- package/providers/beta/openlayers/dist/esm/im-openlayers-provider.js +1 -1
- package/providers/beta/openlayers/dist/umd/im-openlayers-provider.js +1 -1
- package/providers/beta/openlayers/src/utils/spatial.js +16 -14
- package/providers/beta/openlayers/src/utils/spatial.test.js +10 -6
- package/providers/maplibre/dist/esm/im-maplibre-provider.js +1 -1
- package/providers/maplibre/dist/umd/im-maplibre-provider.js +1 -1
- package/providers/maplibre/src/maplibreProvider.js +1 -1
- package/providers/maplibre/src/utils/spatial.js +19 -17
- package/providers/maplibre/src/utils/spatial.test.js +8 -5
- package/src/App/components/Panel/Panel.module.scss +4 -0
- package/src/config/appConfig.js +1 -1
- package/src/scss/tools/_govuk-content.scss +29 -0
- package/src/scss/tools/_index.scss +2 -1
- package/src/types.js +2 -2
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
/*! For license information please see im-search-plugin.js.LICENSE.txt */
|
|
2
|
-
"use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[254],[,(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach(function(e){a(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function a(t,e,r){return(e=function(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r.r(e),r.d(e,{manifest:()=>Tt});var s={TOGGLE_EXPANDED:function(t,e){return i(i({},t),{},{isExpanded:e,areSuggestionsVisible:e,hasFetchedSuggestions:!1,hasSearchError:!1})},SET_KEYBOARD_FOCUS_WITHIN:function(t,e){return i(i({},t),{},{hasKeyboardFocusWithin:e,areSuggestionsVisible:!0})},INPUT_BLUR:function(t,e){return i(i({},t),{},{hasKeyboardFocusWithin:!1,areSuggestionsVisible:t.areSuggestionsVisible&&"keyboard"!==e,selectedIndex:-1})},SET_VALUE:function(t,e){return i(i({},t),{},{value:e})},UPDATE_SUGGESTIONS:function(t,e){return i(i({},t),{},{suggestions:e.results,hasFetchedSuggestions:!0,hasSearchError:e.hasError})},SHOW_SUGGESTIONS:function(t){return i(i({},t),{},{areSuggestionsVisible:!0,hasFetchedSuggestions:!1,hasSearchError:!1})},HIDE_SUGGESTIONS:function(t){return i(i({},t),{},{areSuggestionsVisible:!1,hasFetchedSuggestions:!1,hasSearchError:!1})},SET_SELECTED:function(t,e){return i(i({},t),{},{selectedIndex:e,areSuggestionsVisible:e>=0})}},u=r(738),c=r(287),l=function(t){var e=t.id,r=t.pluginState,n=t.handleSuggestionClick;return(0,c.jsx)("ul",{id:"".concat(e,"-search-suggestions"),role:"listbox","aria-labelledby":"".concat(e,"-search"),className:"im-c-search-suggestions",style:r.areSuggestionsVisible&&r.suggestions.length?void 0:{display:"none"},children:r.suggestions.map(function(t,o){return(0,c.jsx)("li",{id:"".concat(e,"-search-suggestion-").concat(o),className:"im-c-search-suggestions__item",role:"option","aria-selected":r.selectedIndex===o,"aria-setsize":r.suggestions.length,"aria-posinset":o+1,onClick:function(){return n(t)},children:(0,c.jsx)("span",{className:"im-c-search-suggestions__label",dangerouslySetInnerHTML:{__html:t.marked}})},t.id)})})};function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function d(t,e,r){return(e=function(t){var e=function(t){if("object"!=f(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==f(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var h=function(t,e,r){return function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?p(Object(r),!0).forEach(function(e){d(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({display:t.expanded||e.isExpanded?"flex":void 0},"mobile"!==r.breakpoint&&(null==t?void 0:t.width)&&{width:t.width})},y=function(t){var e=t.id,r=t.pluginState,n=t.pluginConfig,o=t.appState,i=t.inputRef,a=t.events,s=t.services,f=t.children,p=r.areSuggestionsVisible,d=r.hasFetchedSuggestions,y=r.hasSearchError,m=r.suggestions,b=void 0===m?[]:m,g=n.noResultsMessage,v=n.searchErrorMessage;(0,u.useEffect)(function(){p&&d&&s.announce(function(t,e,r,n){if(e)return r;if(0===t)return n;var o=1===t?"result":"results";return"".concat(t," ").concat(o," available")}(b.length,y,v,g))},[b,d]);var w=["im-c-search-form",n.expanded&&"im-c-search-form--default-expanded","im-c-panel"].filter(Boolean).join(" "),S=p&&d&&(y||!b.length);return(0,c.jsxs)("form",{id:"".concat(e,"-search-form"),role:"search",className:w,style:h(n,r,o),"aria-controls":"".concat(e,"-viewport"),onSubmit:function(t){return a.handleSubmit(t,o,r)},children:[(0,c.jsx)("button",{type:"submit",style:{display:"none"},"aria-hidden":"true",tabIndex:-1,children:"Submit"}),(0,c.jsxs)("div",{className:"im-c-search__input-container".concat(r.hasKeyboardFocusWithin?" im-c-search__input-container--keyboard-focus-within":""),children:[(0,c.jsx)("label",{htmlFor:"".concat(e,"-search"),className:"im-u-visually-hidden",children:n.placeholder}),(0,c.jsx)("input",{id:"".concat(e,"-search"),className:"im-c-search__input",type:"search",role:"combobox","aria-expanded":r.suggestionsVisible,"aria-controls":"".concat(e,"-search-suggestions"),"aria-activedescendant":r.selectedIndex>=0?"".concat(e,"-search-suggestion-").concat(r.selectedIndex):void 0,"aria-describedby":r.value?void 0:"".concat(e,"-search-hint"),"aria-autocomplete":"list",autoComplete:"off",placeholder:n.placeholder,name:"".concat(e,"-search"),spellCheck:!1,enterKeyHint:"search",value:r.value,onClick:a.handleInputClick,onChange:a.handleInputChange,onFocus:function(){return a.handleInputFocus(o.interfaceType)},onBlur:function(){return a.handleInputBlur(o.interfaceType)},onKeyDown:function(t){return a.handleInputKeyDown(t,r)},ref:i}),(0,c.jsx)("span",{id:"".concat(e,"-search-hint"),className:"im-c-search__hint",children:"When search results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures."}),f]}),S&&(0,c.jsx)("div",{className:"im-c-search__status","aria-hidden":"true",children:y?v:g}),(0,c.jsx)(l,{id:e,appState:o,pluginState:r,handleSuggestionClick:function(t){return a.handleSuggestionClick(t,o)}})]})},m=function(t){var e=t.defaultExpanded,r=t.onClick,n=t.closeIcon;return(0,c.jsx)("button",{"aria-label":"Close search",className:"im-c-map-button im-c-search-close-button",type:"button",onClick:r,style:e?{display:"none"}:void 0,children:n&&(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:n}})})},b=function(t){var e=t.defaultExpanded,r=t.submitIcon;return(0,c.jsx)("button",{"aria-label":"Search",className:"im-c-map-button im-c-search-submit-button",type:"submit",style:e?void 0:{display:"none"},children:r&&(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:r}})})};let g=" ";class v{static get separator(){return g}static set separator(t){g=t}static parse(t){if(!isNaN(parseFloat(t))&&isFinite(t))return Number(t);const e=String(t).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==e[e.length-1]&&e.splice(e.length-1),""==e)return NaN;let r=null;switch(e.length){case 3:r=e[0]/1+e[1]/60+e[2]/3600;break;case 2:r=e[0]/1+e[1]/60;break;case 1:r=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(r=-r),Number(r)}static toDms(t,e="d",r=void 0){if(isNaN(t))return null;if("string"==typeof t&&""==t.trim())return null;if("boolean"==typeof t)return null;if(t==1/0)return null;if(null==t)return null;if(void 0===r)switch(e){case"d":case"deg":r=4;break;case"dm":case"deg+min":r=2;break;case"dms":case"deg+min+sec":r=0;break;default:e="d",r=4}t=Math.abs(t);let n=null,o=null,i=null,a=null;switch(e){default:case"d":case"deg":o=t.toFixed(r),o<100&&(o="0"+o),o<10&&(o="0"+o),n=o+"°";break;case"dm":case"deg+min":o=Math.floor(t),i=(60*t%60).toFixed(r),60==i&&(i=(0).toFixed(r),o++),o=("000"+o).slice(-3),i<10&&(i="0"+i),n=o+"°"+v.separator+i+"′";break;case"dms":case"deg+min+sec":o=Math.floor(t),i=Math.floor(3600*t/60)%60,a=(3600*t%60).toFixed(r),60==a&&(a=(0).toFixed(r),i++),60==i&&(i=0,o++),o=("000"+o).slice(-3),i=("00"+i).slice(-2),a<10&&(a="0"+a),n=o+"°"+v.separator+i+"′"+v.separator+a+"″"}return n}static toLat(t,e,r){const n=v.toDms(v.wrap90(t),e,r);return null===n?"–":n.slice(1)+v.separator+(t<0?"S":"N")}static toLon(t,e,r){const n=v.toDms(v.wrap180(t),e,r);return null===n?"–":n+v.separator+(t<0?"W":"E")}static toBrng(t,e,r){const n=v.toDms(v.wrap360(t),e,r);return null===n?"–":n.replace("360","0")}static fromLocale(t){const e=123456.789.toLocaleString(),r={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(r.thousands,"⁜").replace(r.decimal,".").replace("⁜",",")}static toLocale(t){const e=123456.789.toLocaleString(),r={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",r.decimal).replace("⁜",r.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=v.wrap360(t);const r=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*r/360)%r*16/r]}static wrap90(t){if(-90<=t&&t<=90)return t;const e=t;return 1*Math.abs(((e-90)%360+360)%360-180)-90}static wrap180(t){if(-180<=t&&t<=180)return t;const e=360;return((360*t/e-180)%e+e)%e-180}static wrap360(t){if(0<=t&&t<360)return t;const e=360;return(360*t/e%e+e)%e}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const w=v;class S{constructor(t,e,r){if(isNaN(t)||isNaN(e)||isNaN(r))throw new TypeError(`invalid vector [${t},${e},${r}]`);this.x=Number(t),this.y=Number(e),this.z=Number(r)}get length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}plus(t){if(!(t instanceof S))throw new TypeError("v is not Vector3d object");return new S(this.x+t.x,this.y+t.y,this.z+t.z)}minus(t){if(!(t instanceof S))throw new TypeError("v is not Vector3d object");return new S(this.x-t.x,this.y-t.y,this.z-t.z)}times(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new S(this.x*t,this.y*t,this.z*t)}dividedBy(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new S(this.x/t,this.y/t,this.z/t)}dot(t){if(!(t instanceof S))throw new TypeError("v is not Vector3d object");return this.x*t.x+this.y*t.y+this.z*t.z}cross(t){if(!(t instanceof S))throw new TypeError("v is not Vector3d object");const e=this.y*t.z-this.z*t.y,r=this.z*t.x-this.x*t.z,n=this.x*t.y-this.y*t.x;return new S(e,r,n)}negate(){return new S(-this.x,-this.y,-this.z)}unit(){const t=this.length;if(1==t)return this;if(0==t)return this;const e=this.x/t,r=this.y/t,n=this.z/t;return new S(e,r,n)}angleTo(t,e=void 0){if(!(t instanceof S))throw new TypeError("v is not Vector3d object");if(!(e instanceof S||null==e))throw new TypeError("n is not Vector3d object");const r=null==e||this.cross(t).dot(e)>=0?1:-1,n=this.cross(t).length*r,o=this.dot(t);return Math.atan2(n,o)}rotateAround(t,e){if(!(t instanceof S))throw new TypeError("axis is not Vector3d object");const r=e.toRadians(),n=this.unit(),o=t.unit(),i=Math.sin(r),a=Math.cos(r),s=1-a,u=o.x,c=o.y,l=o.z,f=[[s*u*u+a,s*u*c-i*l,s*u*l+i*c],[s*u*c+i*l,s*c*c+a,s*c*l-i*u],[s*u*l-i*c,s*c*l+i*u,s*l*l+a]],p=[f[0][0]*n.x+f[0][1]*n.y+f[0][2]*n.z,f[1][0]*n.x+f[1][1]*n.y+f[1][2]*n.z,f[2][0]*n.x+f[2][1]*n.y+f[2][2]*n.z];return new S(p[0],p[1],p[2])}toString(t=3){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const E=S,O={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563}},N={WGS84:{ellipsoid:O.WGS84}};Object.freeze(O.WGS84),Object.freeze(N.WGS84);class T{constructor(t,e,r=0){if(isNaN(t)||null==t)throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e)||null==e)throw new TypeError(`invalid lon ‘${e}’`);if(isNaN(r)||null==r)throw new TypeError(`invalid height ‘${r}’`);this._lat=w.wrap90(Number(t)),this._lon=w.wrap180(Number(e)),this._height=Number(r)}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?w.wrap90(w.parse(t)):w.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?w.wrap90(w.parse(t)):w.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid latitude ‘${t}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(t){if(this._lon=isNaN(t)?w.wrap180(w.parse(t)):w.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?w.wrap180(w.parse(t)):w.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?w.wrap180(w.parse(t)):w.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${t}’`)}get height(){return this._height}set height(t){if(this._height=Number(t),isNaN(this._height))throw new TypeError(`invalid height ‘${t}’`)}get datum(){return this._datum}set datum(t){this._datum=t}static get ellipsoids(){return O}static get datums(){return N}static parse(...t){if(0==t.length)throw new TypeError("invalid (empty) point");let e,r,n;if("object"==typeof t[0]&&(1==t.length||!isNaN(parseFloat(t[1])))){const o=t[0];if("Point"==o.type&&Array.isArray(o.coordinates)?([r,e,n]=o.coordinates,n=n||0):(null!=o.latitude&&(e=o.latitude),null!=o.lat&&(e=o.lat),null!=o.longitude&&(r=o.longitude),null!=o.lng&&(r=o.lng),null!=o.lon&&(r=o.lon),null!=o.height&&(n=o.height),e=w.wrap90(w.parse(e)),r=w.wrap180(w.parse(r))),null!=t[1]&&(n=t[1]),isNaN(e)||isNaN(r))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if("string"==typeof t[0]&&2==t[0].split(",").length&&([e,r]=t[0].split(","),e=w.wrap90(w.parse(e)),r=w.wrap180(w.parse(r)),n=t[1]||0,isNaN(e)||isNaN(r)))throw new TypeError(`invalid point ‘${t[0]}’`);if(null==e&&null==r&&([e,r]=t,e=w.wrap90(w.parse(e)),r=w.wrap180(w.parse(r)),n=t[2]||0,isNaN(e)||isNaN(r)))throw new TypeError(`invalid point ‘${t.toString()}’`);return new this(e,r,n)}toCartesian(){const t=this.datum?this.datum.ellipsoid:this.referenceFrame?this.referenceFrame.ellipsoid:O.WGS84,e=this.lat.toRadians(),r=this.lon.toRadians(),n=this.height,{a:o,f:i}=t,a=Math.sin(e),s=Math.cos(e),u=Math.sin(r),c=Math.cos(r),l=2*i-i*i,f=o/Math.sqrt(1-l*a*a);return new j((f+n)*s*c,(f+n)*s*u,(f*(1-l)+n)*a)}equals(t){if(!(t instanceof T))throw new TypeError(`invalid point ‘${t}’`);return!(Math.abs(this.lat-t.lat)>Number.EPSILON||Math.abs(this.lon-t.lon)>Number.EPSILON||Math.abs(this.height-t.height)>Number.EPSILON||this.datum!=t.datum||this.referenceFrame!=t.referenceFrame||this.epoch!=t.epoch)}toString(t="d",e=void 0,r=null){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);const n=(this.height>=0?" +":" ")+this.height.toFixed(r)+"m";return"n"==t?(null==e&&(e=4),`${this.lat.toFixed(e)}, ${this.lon.toFixed(e)}${null==r?"":n}`):`${w.toLat(this.lat,t,e)}, ${w.toLon(this.lon,t,e)}${null==r?"":n}`}}class j extends E{constructor(t,e,r){super(t,e,r)}toLatLon(t=O.WGS84){if(!t||!t.a)throw new TypeError(`invalid ellipsoid ‘${t}’`);const{x:e,y:r,z:n}=this,{a:o,b:i,f:a}=t,s=2*a-a*a,u=s/(1-s),c=Math.sqrt(e*e+r*r),l=i*n/(o*c)*(1+u*i/Math.sqrt(c*c+n*n)),f=l/Math.sqrt(1+l*l),p=f/l,d=isNaN(p)?0:Math.atan2(n+u*i*f*f*f,c-s*o*p*p*p),h=Math.atan2(r,e),y=Math.sin(d),m=c*Math.cos(d)+n*y-o*o/(o/Math.sqrt(1-s*y*y));return new T(d.toDegrees(),h.toDegrees(),m)}toString(t=0){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}const _={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563},Airy1830:{a:6377563.396,b:6356256.909,f:1/299.3249646},AiryModified:{a:6377340.189,b:6356034.448,f:1/299.3249646},Bessel1841:{a:6377397.155,b:6356078.962818,f:1/299.1528128},Clarke1866:{a:6378206.4,b:6356583.8,f:1/294.978698214},Clarke1880IGN:{a:6378249.2,b:6356515,f:1/293.466021294},GRS80:{a:6378137,b:6356752.31414,f:1/298.257222101},Intl1924:{a:6378388,b:6356911.946,f:1/297},WGS72:{a:6378135,b:6356750.5,f:1/298.26}},x={ED50:{ellipsoid:_.Intl1924,transform:[89.5,93.8,123.1,-1.2,0,0,.156]},ETRS89:{ellipsoid:_.GRS80,transform:[0,0,0,0,0,0,0]},Irl1975:{ellipsoid:_.AiryModified,transform:[-482.53,130.596,-564.557,-8.15,1.042,.214,.631]},NAD27:{ellipsoid:_.Clarke1866,transform:[8,-160,-176,0,0,0,0]},NAD83:{ellipsoid:_.GRS80,transform:[.9956,-1.9103,-.5215,-62e-5,.025915,.009426,.011599]},NTF:{ellipsoid:_.Clarke1880IGN,transform:[168,60,-320,0,0,0,0]},OSGB36:{ellipsoid:_.Airy1830,transform:[-446.448,125.157,-542.06,20.4894,-.1502,-.247,-.8421]},Potsdam:{ellipsoid:_.Bessel1841,transform:[-582,-105,-414,-8.3,1.04,.35,-3.08]},TokyoJapan:{ellipsoid:_.Bessel1841,transform:[148,-507,-685,0,0,0,0]},WGS72:{ellipsoid:_.WGS72,transform:[0,0,-4.5,-.22,0,0,.554]},WGS84:{ellipsoid:_.WGS84,transform:[0,0,0,0,0,0,0]}};Object.keys(_).forEach(t=>Object.freeze(_[t])),Object.keys(x).forEach(t=>{Object.freeze(x[t]),Object.freeze(x[t].transform)});class P extends T{constructor(t,e,r=0,n=x.WGS84){if(!n||null==n.ellipsoid)throw new TypeError(`unrecognised datum ‘${n}’`);super(t,e,r),this._datum=n}get datum(){return this._datum}static get ellipsoids(){return _}static get datums(){return x}static parse(...t){let e=x.WGS84;if((4==t.length||3==t.length&&"object"==typeof t[2])&&(e=t.pop()),!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const r=super.parse(...t);return r._datum=e,r}convertDatum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);return this.toCartesian().convertDatum(t).toLatLon()}toCartesian(){const t=super.toCartesian();return new G(t.x,t.y,t.z,this.datum)}}class G extends j{constructor(t,e,r,n=void 0){if(n&&null==n.ellipsoid)throw new TypeError(`unrecognised datum ‘${n}’`);super(t,e,r),n&&(this._datum=n)}get datum(){return this._datum}set datum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);this._datum=t}toLatLon(t=void 0){t&&(console.info("datum parameter to Cartesian_Datum.toLatLon is deprecated: set datum before calling toLatLon()"),this.datum=t);const e=this.datum||x.WGS84;if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const r=super.toLatLon(e.ellipsoid);return new P(r.lat,r.lon,r.height,this.datum)}convertDatum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);if(!this.datum)throw new TypeError("cartesian coordinate has no datum");let e=null,r=null;null!=this.datum&&this.datum!=x.WGS84||(e=this,r=t.transform),t==x.WGS84&&(e=this,r=this.datum.transform.map(t=>-t)),null==r&&(e=this.convertDatum(x.WGS84),r=t.transform);const n=e.applyTransform(r);return n.datum=t,n}applyTransform(t){const{x:e,y:r,z:n}=this,o=t[0],i=t[1],a=t[2],s=t[3]/1e6+1,u=(t[4]/3600).toRadians(),c=(t[5]/3600).toRadians(),l=(t[6]/3600).toRadians();return new G(o+e*s-r*l+n*c,i+e*l+r*s-n*u,a-e*c+r*u+n*s)}}const k={trueOrigin:{lat:49,lon:-2},falseOrigin:{easting:-4e5,northing:1e5},scaleFactor:.9996012717,ellipsoid:P.ellipsoids.Airy1830};class D{constructor(t,e){if(this.easting=Number(t),this.northing=Number(e),isNaN(t)||this.easting<0||this.easting>7e5)throw new RangeError(`invalid easting ‘${t}’`);if(isNaN(e)||this.northing<0||this.northing>13e5)throw new RangeError(`invalid northing ‘${e}’`)}toLatLon(t=P.datums.WGS84){const{easting:e,northing:r}=this,{a:n,b:o}=k.ellipsoid,i=k.trueOrigin.lat.toRadians(),a=k.trueOrigin.lon.toRadians(),s=-k.falseOrigin.easting,u=-k.falseOrigin.northing,c=k.scaleFactor,l=1-o*o/(n*n),f=(n-o)/(n+o),p=f*f,d=f*f*f;let h=i,y=0;do{h=(r-u-y)/(n*c)+h,y=o*c*((1+f+5/4*p+5/4*d)*(h-i)-(3*f+3*f*f+21/8*d)*Math.sin(h-i)*Math.cos(h+i)+(15/8*p+15/8*d)*Math.sin(2*(h-i))*Math.cos(2*(h+i))-35/24*d*Math.sin(3*(h-i))*Math.cos(3*(h+i)))}while(Math.abs(r-u-y)>=1e-5);const m=Math.cos(h),b=Math.sin(h),g=n*c/Math.sqrt(1-l*b*b),v=n*c*(1-l)/Math.pow(1-l*b*b,1.5),w=g/v-1,S=Math.tan(h),E=S*S,O=E*E,N=1/m,T=g*g*g,j=T*g*g,_=e-s,x=_*_,G=x*_,D=x*x,R=G*x;h=h-S/(2*v*g)*x+S/(24*v*T)*(5+3*E+w-9*E*w)*D-S/(720*v*j)*(61+90*E+45*O)*(D*x);const A=a+N/g*_-N/(6*T)*(g/v+2*E)*G+N/(120*j)*(5+28*E+24*O)*R-N/(j*g*g*5040)*(61+662*E+1320*O+O*E*720)*(R*x);let I=new M(h.toDegrees(),A.toDegrees(),0,P.datums.OSGB36);return t!=P.datums.OSGB36&&(I=I.convertDatum(t),I=new M(I.lat,I.lon,I.height,I.datum)),I}static parse(t){let e=(t=String(t).trim()).match(/^(\d+),\s*(\d+)$/);if(e)return new D(e[1],e[2]);if(e=t.match(/^[HNST][ABCDEFGHJKLMNOPQRSTUVWXYZ]\s*[0-9]+\s*[0-9]+$/i),!e)throw new Error(`invalid grid reference ‘${t}’`);let r=t.toUpperCase().charCodeAt(0)-"A".charCodeAt(0),n=t.toUpperCase().charCodeAt(1)-"A".charCodeAt(0);r>7&&r--,n>7&&n--;const o=(r-2)%5*5+n%5,i=19-5*Math.floor(r/5)-Math.floor(n/5);let a=t.slice(2).trim().split(/\s+/);if(1==a.length&&(a=[a[0].slice(0,a[0].length/2),a[0].slice(a[0].length/2)]),a[0].length!=a[1].length)throw new Error(`invalid grid reference ‘${t}’`);a[0]=a[0].padEnd(5,"0"),a[1]=a[1].padEnd(5,"0");const s=o+a[0],u=i+a[1];return new D(s,u)}toString(t=10){if(![0,2,4,6,8,10,12,14,16].includes(Number(t)))throw new RangeError(`invalid precision ‘${t}’`);let{easting:e,northing:r}=this;if(0==t){const t={useGrouping:!1,minimumIntegerDigits:6,maximumFractionDigits:3};return`${e.toLocaleString("en",t)},${r.toLocaleString("en",t)}`}const n=Math.floor(e/1e5),o=Math.floor(r/1e5);let i=19-o-(19-o)%5+Math.floor((n+10)/5),a=5*(19-o)%25+n%5;i>7&&i++,a>7&&a++;const s=String.fromCharCode(i+"A".charCodeAt(0),a+"A".charCodeAt(0));return e=Math.floor(e%1e5/Math.pow(10,5-t/2)),r=Math.floor(r%1e5/Math.pow(10,5-t/2)),e=e.toString().padStart(t/2,"0"),r=r.toString().padStart(t/2,"0"),`${s} ${e} ${r}`}}class M extends P{toOsGrid(){const t=this.datum==P.datums.OSGB36?this:this.convertDatum(P.datums.OSGB36),e=t.lat.toRadians(),r=t.lon.toRadians(),{a:n,b:o}=k.ellipsoid,i=k.trueOrigin.lat.toRadians(),a=k.trueOrigin.lon.toRadians(),s=-k.falseOrigin.easting,u=-k.falseOrigin.northing,c=k.scaleFactor,l=1-o*o/(n*n),f=(n-o)/(n+o),p=f*f,d=f*f*f,h=Math.cos(e),y=Math.sin(e),m=n*c/Math.sqrt(1-l*y*y),b=n*c*(1-l)/Math.pow(1-l*y*y,1.5),g=m/b-1,v=o*c*((1+f+5/4*p+5/4*d)*(e-i)-(3*f+3*f*f+21/8*d)*Math.sin(e-i)*Math.cos(e+i)+(15/8*p+15/8*d)*Math.sin(2*(e-i))*Math.cos(2*(e+i))-35/24*d*Math.sin(3*(e-i))*Math.cos(3*(e+i))),w=h*h*h,S=w*h*h,E=Math.tan(e)*Math.tan(e),O=E*E,N=r-a,T=N*N,j=T*N,_=j*N,x=_*N;let G=v+u+m/2*y*h*T+m/24*y*w*(5-E+9*g)*_+m/720*y*S*(61-58*E+O)*(x*N),M=s+m*h*N+m/6*w*(m/b-E)*j+m/120*S*(5-18*E+O+14*g-58*E*g)*x;G=Number(G.toFixed(3)),M=Number(M.toFixed(3));try{return new D(M,G)}catch(e){throw new Error(`${e.message} from (${t.lat.toFixed(6)},${t.lon.toFixed(6)}).toOsGrid()`)}}convertDatum(t){const e=super.convertDatum(t);return new M(e.lat,e.lon,e.height,e.datum)}}function R(t){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R(t)}var A;function I(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function C(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?I(Object(r),!0).forEach(function(e){L(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):I(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function L(t,e,r){return(e=function(t){var e=function(t){if("object"!=R(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=R(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==R(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var F=500,$=function(t){var e=t.GAZETTEER_ENTRY,r="eng"===e.NAME2_LANG?e.NAME2:e.NAME1;return t.GAZETTEER_ENTRY.NAME1=r,t.GAZETTEER_ENTRY.NAME1_LANG="eng",t},W=function(t,e){var r,n,o,i,a=e.MBR_XMIN,s=e.MBR_YMIN,u=e.MBR_XMAX,c=e.MBR_YMAX,l=e.GEOMETRY_X,f=e.GEOMETRY_Y;if(null==a?(r=l-F,n=f-F,o=l+F,i=f+F):(r=a,n=s,o=u,i=c),"EPSG:27700"===t)return[r,n,o,i];if("EPSG:4326"===t){var p=new D(r,n).toLatLon(),d=new D(o,i).toLatLon();return[p.lon,p.lat,d.lon,d.lat].map(function(t){return Math.round(1e6*t)/1e6})}throw new Error("Unsupported CRS: ".concat(t))},U=function(t,e){var r=e.GEOMETRY_X,n=e.GEOMETRY_Y;if("EPSG:27700"===t)return[r,n];if("EPSG:4326"===t){var o=new D(r,n).toLatLon();return[Math.round(1e6*o.lon)/1e6,Math.round(1e6*o.lat)/1e6]}throw new Error("Unsupported CRS: ".concat(t))};function B(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function z(t){return function(t){if(Array.isArray(t))return q(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Y(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function V(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Y(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function Y(t,e){if(t){if("string"==typeof t)return q(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?q(t,e):void 0}}function q(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function H(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var u=n&&n.prototype instanceof s?n:s,c=Object.create(u.prototype);return Z(c,"_invoke",function(r,n,o){var i,s,u,c=0,l=o||[],f=!1,p={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,r){return i=e,s=0,u=t,p.n=r,a}};function d(r,n){for(s=r,u=n,e=0;!f&&c&&!o&&e<l.length;e++){var o,i=l[e],d=p.p,h=i[2];r>3?(o=h===n)&&(u=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=r<2&&d<i[1])?(s=0,p.v=n,p.n=i[1]):d<h&&(o=r<3||i[0]>n||n>h)&&(i[4]=r,i[5]=n,p.n=h,s=0))}if(o||r>1)return a;throw f=!0,n}return function(o,l,h){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,h),s=l,u=h;(e=s<2?t:u)||!f;){i||(s?s<3?(s>1&&(p.n=-1),d(s,u)):p.n=u:p.v=u);try{if(c=2,i){if(s||(o="next"),e=i[o]){if(!(e=e.call(i,u)))throw TypeError("iterator result is not an object");if(!e.done)return e;u=e.value,s<2&&(s=0)}else 1===s&&(e=i.return)&&e.call(i),s<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=t}else if((e=(f=p.n<0)?u:r.call(n,p))!==a)break}catch(e){i=t,s=1,u=e}finally{c=1}}return{value:e,done:f}}}(r,o,i),!0),c}var a={};function s(){}function u(){}function c(){}e=Object.getPrototypeOf;var l=[][n]?e(e([][n]())):(Z(e={},n,function(){return this}),e),f=c.prototype=s.prototype=Object.create(l);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,Z(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return u.prototype=c,Z(f,"constructor",c),Z(c,"constructor",u),u.displayName="GeneratorFunction",Z(c,o,"GeneratorFunction"),Z(f),Z(f,o,"Generator"),Z(f,n,function(){return this}),Z(f,"toString",function(){return"[object Generator]"}),(H=function(){return{w:i,m:p}})()}function Z(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Z=function(t,e,r,n){function i(e,r){Z(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},Z(t,e,r,n)}function K(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function X(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){K(i,n,o,a,s,"next",t)}function s(t){K(i,n,o,a,s,"throw",t)}a(void 0)})}}var J=function(t){return t.replaceAll(/[^a-zA-Z0-9\s\-.,]/g,"").trim()},Q=function(t){var e=t.url,r=t.options;return new Request(e,r)},tt=function(){var t=X(H().m(function t(e,r,n){var o,i,a,s;return H().w(function(t){for(;;)switch(t.n){case 0:if(i={url:null===(o=e.urlTemplate)||void 0===o?void 0:o.replace("{query}",encodeURIComponent(r)),options:{method:"GET"}},!e.buildRequest){t.n=1;break}return a=e.buildRequest(r,function(){return i}),t.a(2,a instanceof Request?a:Q(a));case 1:if(!n){t.n=3;break}return s=Q,t.n=2,n(i,r);case 2:return t.a(2,s(t.v));case 3:return t.a(2,Q(i))}},t)}));return function(e,r,n){return t.apply(this,arguments)}}(),et=function(){var t=X(H().m(function t(e,r,n){var o,i,a;return H().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,fetch(r);case 1:if((o=t.v).ok){t.n=2;break}return console.error("Fetch error for ".concat(e.label||"dataset",": ").concat(o.status)),t.a(2,{error:!0});case 2:return t.n=3,o.json();case 3:return i=t.v,t.a(2,e.parseResults(i,n));case 4:return t.p=4,a=t.v,console.error("Network error for ".concat(e.label||"dataset",":"),a),t.a(2,{error:!0})}},t,null,[[0,4]])}));return function(e,r,n){return t.apply(this,arguments)}}(),rt=function(){var t=X(H().m(function t(e,r,n,o){var i,a,s,u,c,l,f,p,d,h;return H().w(function(t){for(;;)switch(t.p=t.n){case 0:i=J(e),a=r.filter(function(t){var r=!t.includeRegex||t.includeRegex.test(e),n=!!t.excludeRegex&&t.excludeRegex.test(i);return r&&!n}),s=[],u=!1,c=V(a),t.p=1,c.s();case 2:if((l=c.n()).done){t.n=6;break}return f=l.value,t.n=3,tt(f,i,o);case 3:return p=t.v,t.n=4,et(f,p,i);case 4:if(null!=(d=t.v)&&d.error?u=!0:null!=d&&d.length&&(s=[].concat(z(s),z(d))),!f.exclusive||!s.length){t.n=5;break}return t.a(3,6);case 5:t.n=2;break;case 6:t.n=8;break;case 7:t.p=7,h=t.v,c.e(h);case 8:return t.p=8,c.f(),t.f(8);case 9:return n({type:"UPDATE_SUGGESTIONS",payload:{results:s,hasError:u}}),t.a(2,{results:s,sanitisedValue:i})}},t,null,[[1,7,8,9]])}));return function(e,r,n,o){return t.apply(this,arguments)}}();function nt(t){var e=t.mapProvider,r=t.bounds,n=t.point,o=t.markers,i=t.showMarker,a=t.markerOptions;e.fitToBounds(r),i&&o.add("search",n,a)}var ot=r(604);function it(t){return it="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},it(t)}function at(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var u=n&&n.prototype instanceof s?n:s,c=Object.create(u.prototype);return st(c,"_invoke",function(r,n,o){var i,s,u,c=0,l=o||[],f=!1,p={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,r){return i=e,s=0,u=t,p.n=r,a}};function d(r,n){for(s=r,u=n,e=0;!f&&c&&!o&&e<l.length;e++){var o,i=l[e],d=p.p,h=i[2];r>3?(o=h===n)&&(u=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=r<2&&d<i[1])?(s=0,p.v=n,p.n=i[1]):d<h&&(o=r<3||i[0]>n||n>h)&&(i[4]=r,i[5]=n,p.n=h,s=0))}if(o||r>1)return a;throw f=!0,n}return function(o,l,h){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,h),s=l,u=h;(e=s<2?t:u)||!f;){i||(s?s<3?(s>1&&(p.n=-1),d(s,u)):p.n=u:p.v=u);try{if(c=2,i){if(s||(o="next"),e=i[o]){if(!(e=e.call(i,u)))throw TypeError("iterator result is not an object");if(!e.done)return e;u=e.value,s<2&&(s=0)}else 1===s&&(e=i.return)&&e.call(i),s<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=t}else if((e=(f=p.n<0)?u:r.call(n,p))!==a)break}catch(e){i=t,s=1,u=e}finally{c=1}}return{value:e,done:f}}}(r,o,i),!0),c}var a={};function s(){}function u(){}function c(){}e=Object.getPrototypeOf;var l=[][n]?e(e([][n]())):(st(e={},n,function(){return this}),e),f=c.prototype=s.prototype=Object.create(l);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,st(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return u.prototype=c,st(f,"constructor",c),st(c,"constructor",u),u.displayName="GeneratorFunction",st(c,o,"GeneratorFunction"),st(f),st(f,o,"Generator"),st(f,n,function(){return this}),st(f,"toString",function(){return"[object Generator]"}),(at=function(){return{w:i,m:p}})()}function st(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}st=function(t,e,r,n){function i(e,r){st(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},st(t,e,r,n)}function ut(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function ct(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ut(Object(r),!0).forEach(function(e){lt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ut(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function lt(t,e,r){return(e=function(t){var e=function(t){if("object"!=it(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=it(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==it(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ft(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}var pt=function(t){var e=t.dispatch,r=t.services,n=t.viewportRef,o=t.mapProvider,i=t.markers,a=t.datasets,s=t.transformRequest,u=t.showMarker,c=t.markerOptions,l="";return{handleCloseClick:function(t,n){var o,a,s;e({type:"TOGGLE_EXPANDED",payload:!1}),e({type:"UPDATE_SUGGESTIONS",payload:{results:[],hasError:!1}}),e({type:"SET_VALUE",payload:""}),o=null==n?void 0:n.buttonRefs,a=0,s=function(){var t=function(t){var e;return(null==t||null===(e=t.current)||void 0===e?void 0:e.search)||document.querySelector(".im-c-map-button--search")}(o);t&&(t.focus(),document.activeElement===t)||a<30&&(a+=1,requestAnimationFrame(s))},requestAnimationFrame(s),i.remove("search"),r.eventBus.emit("search:clear"),r.eventBus.emit("search:close")},handleSubmit:function(t,f,p){return(d=at().m(function d(){var h,y,m,b,g,v,w,S,E,O,N,T;return at().w(function(d){for(;;)switch(d.n){case 0:if(t.preventDefault(),h=p.suggestions,y=p.selectedIndex,m=p.value,b=null==m?void 0:m.trim(),e({type:"SET_SELECTED",payload:-1}),e({type:"HIDE_SUGGESTIONS"}),!(y>=0)){d.n=1;break}return v=h[y],e({type:"SET_VALUE",payload:v.text}),null===(g=n.current)||void 0===g||g.focus(),nt({mapProvider:o,bounds:v.bounds,point:v.point,markers:i,showMarker:u,markerOptions:c}),r.eventBus.emit("search:match",ct({query:v.text},v)),d.a(2);case 1:if(!((null==b?void 0:b.length)<ot.z.minSearchLength)){d.n=2;break}return d.a(2);case 2:if(w=h,h.length&&b===l){d.n=4;break}return d.n=3,rt(b,a,e,s);case 3:S=d.v,E=S.results,O=S.sanitisedValue,w=E,l=O;case 4:w.length&&(null===(N=n.current)||void 0===N||N.focus(),"mobile"===f.breakpoint&&(e({type:"TOGGLE_EXPANDED",payload:!1}),r.eventBus.emit("search:close")),T=w[0],nt({mapProvider:o,bounds:T.bounds,point:T.point,markers:i,showMarker:u,markerOptions:c}),r.eventBus.emit("search:match",ct({query:m},T)));case 5:return d.a(2)}},d)}),function(){var t=this,e=arguments;return new Promise(function(r,n){var o=d.apply(t,e);function i(t){ft(o,r,n,i,a,"next",t)}function a(t){ft(o,r,n,i,a,"throw",t)}i(void 0)})})();var d}}};function dt(t){return dt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dt(t)}function ht(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function yt(t,e,r){return(e=function(t){var e=function(t){if("object"!=dt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=dt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==dt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function mt(t){return mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mt(t)}function bt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function gt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?bt(Object(r),!0).forEach(function(e){vt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):bt(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function vt(t,e,r){return(e=function(t){var e=function(t){if("object"!=mt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=mt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==mt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wt(t){var e,r,n,o=t.dispatch,i=t.searchContainerRef,a=(e=function(e){return rt(e,t.datasets,o,t.transformRequest)},r=null,n=function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];clearTimeout(r),r=setTimeout(function(){e.apply(void 0,n)},350)},n.cancel=function(){r&&(clearTimeout(r),r=null)},n),s=pt(t),u=function(t){var e=t.dispatch,r=t.debouncedFetchSuggestions;return{handleInputClick:function(){e({type:"SHOW_SUGGESTIONS"})},handleInputFocus:function(t){e({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:"keyboard"===t})},handleInputBlur:function(t){e({type:"INPUT_BLUR",payload:t})},handleInputChange:function(t){var n=t.target.value;if(e({type:"SET_VALUE",payload:n}),n.length<ot.z.minSearchLength)return r.cancel(),e({type:"UPDATE_SUGGESTIONS",payload:{results:[],hasError:!1}}),void e({type:"HIDE_SUGGESTIONS"});e({type:"SHOW_SUGGESTIONS"}),r(n)}}}(gt(gt({},t),{},{debouncedFetchSuggestions:a})),c=function(t){var e=t.dispatch,r=t.services,n=t.mapProvider,o=t.markers,i=t.showMarker,a=t.markerOptions,s=t.viewportRef,u=function(t,e){var r;return e>=0?"".concat(null===(r=t[e])||void 0===r?void 0:r.text,". ").concat(e+1," of ").concat(t.length," is highlighted"):"".concat(t.length," suggestions available")};return{handleSuggestionClick:function(t,u){var c;e({type:"SET_VALUE",payload:t.text}),e({type:"HIDE_SUGGESTIONS"}),e({type:"SET_SELECTED",payload:-1}),"mobile"===u.breakpoint&&(e({type:"TOGGLE_EXPANDED",payload:!1}),r.eventBus.emit("search:close")),null===(c=s.current)||void 0===c||c.focus(),nt({mapProvider:n,bounds:t.bounds,point:t.point,markers:o,showMarker:i,markerOptions:a}),r.eventBus.emit("search:match",function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ht(Object(r),!0).forEach(function(e){yt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ht(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({query:t.text},t))},handleInputKeyDown:function(t,n){var o=n.suggestions,i=n.selectedIndex;switch(t.key){case"ArrowDown":if(null==o||!o.length)return;if(t.preventDefault(),i<o.length-1){var a=i+1;r.announce(u(o,a)),e({type:"SET_SELECTED",payload:a}),e({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:!1})}break;case"ArrowUp":if(null==o||!o.length)return;t.preventDefault();var s=i>0?i-1:-1;r.announce(u(o,s)),e({type:"SET_SELECTED",payload:s}),e({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:s<0});break;case"Escape":t.preventDefault(),e({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:!0}),e({type:"HIDE_SUGGESTIONS"}),e({type:"SET_SELECTED",payload:-1})}}}}(t);return gt(gt(gt(gt({},s),u),c),{},{handleOutside:function(e){i.current.contains(e.target)||(o({type:"TOGGLE_EXPANDED",payload:!1}),t.services.eventBus.emit("search:close"))}})}function St(t){return St="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},St(t)}var Et=["marker"];function Ot(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function Nt(t,e,r){return(e=function(t){var e=function(t){if("object"!=St(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=St(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==St(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Tt={reducer:{initialState:{isExpanded:!1,hasKeyboardFocusWithin:!1,value:"",suggestions:[],areSuggestionsVisible:!1,hasFetchedSuggestions:!1,hasSearchError:!1,selectedIndex:-1},actions:s},buttons:[{id:"search",label:"Search",iconId:"search",ariaControls:function(t){var e=t.appConfig;return"".concat(e.id,"-search-form")},expandedWhen:function(t){return t.pluginState.isExpanded},excludeWhen:function(t){var e=t.pluginConfig;return Boolean(e.expanded)},keepFocus:!0,onClick:function(t,e){var r=e.pluginState,n=e.services;r.dispatch({type:"TOGGLE_EXPANDED",payload:!0}),n.eventBus.emit("search:open")},mobile:{slot:"top-right",showLabel:!1},tablet:{slot:"top-left",showLabel:!1},desktop:{slot:"top-left",showLabel:!1}}],controls:[{id:"search",mobile:{slot:"header"},tablet:{slot:"top-left"},desktop:{slot:"top-left"},render:function(t){var e=t.appConfig,r=t.iconRegistry,n=t.pluginState,o=t.pluginConfig,i=t.appState,a=t.mapState,s=t.services,l=t.mapProvider,f=e.id,p=i.interfaceType,d=o.expanded,h=o.customDatasets,g=o.osNamesURL,v=o.regions,w=o.maxSuggestions,S=n.dispatch,E=n.isExpanded,O=n.areSuggestionsVisible,N=n.suggestions,T=r.close,j=r.search,_=(0,u.useRef)(null),x=(0,u.useRef)(null),P=i.layoutRefs.viewportRef,G=function(t){var e,r=t.customDatasets,n=void 0===r?[]:r,o=t.osNamesURL,i=t.crs,a=t.regions,s=void 0===a?["england","scotland","wales"]:a,u=t.maxSuggestions;return o?[].concat([{name:"osNames",urlTemplate:o,parseResults:function(t,e){return function(t,e,r,n){var o,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:8;if(!t||t.error||0===(null===(o=t.header)||void 0===o?void 0:o.totalresults))return[];var a=t.results;return a=function(t,e){var r=e.toLowerCase().replace(/,/g,"").split(" ");return t.map($).filter(function(t){return r.some(function(r){return t.GAZETTEER_ENTRY.NAME1.toLowerCase().includes(r)||(n=(n=e).replace(/\s/g,""),/^(([A-Z]{1,2}\d[A-Z\d]?|ASCN|STHL|TDCU|BBND|[BFS]IQQ|PCRN|TKCA) ?\d[A-Z]{2}|BFPO ?\d{1,4}|(KY\d|MSR|VG|AI)[ -]?\d{4}|[A-Z]{2} ?\d{2}|GE ?CX|GIR ?0A{2}|SAN ?TA1)$/i.test(n));var n})})}(a,e),a=function(t,e){return t.filter(function(t){var r,n=null==t||null===(r=t.GAZETTEER_ENTRY)||void 0===r||null===(r=r.COUNTRY)||void 0===r?void 0:r.toLowerCase();return n&&e.includes(n)})}(a=function(t){return Array.from(new Map(t.map(function(t){return[t.GAZETTEER_ENTRY.ID,t]})).values())}(a),r),(a=a.slice(0,i)).map(function(t){return C(C({id:t.GAZETTEER_ENTRY.ID,bounds:W(n,t.GAZETTEER_ENTRY),point:U(n,t.GAZETTEER_ENTRY)},function(t,e){var r,n,o,i,a,s,u=e.NAME1,c=e.COUNTY_UNITARY,l=e.DISTRICT_BOROUGH,f=e.POSTCODE_DISTRICT,p=e.LOCAL_TYPE,d="".concat(["City","Postcode"].includes(p)?"":f+", ").concat("City"===p?"":c||l),h="".concat(u).concat(d?", "+d:"");return{text:h,marked:(r=h,n=t,a=n.replace(/\s+/g,"").split("").join(String.raw(A||(o=["s*"],(i=["\\s*"])||(i=o.slice(0)),A=Object.freeze(Object.defineProperties(o,{raw:{value:Object.freeze(i)}}))))),s=new RegExp("(".concat(a,")"),"i"),r.replace(s,"<mark>$1</mark>"))}}(e,t.GAZETTEER_ENTRY)),{},{type:"os-names"})})}(t,e,s,i,u)},includeRegex:/[a-zA-Z0-9]/,excludeRegex:/^(?:[a-z]{2}\s*(?:\d{3}\s*\d{3}|\d{4}\s*\d{4}|\d{5}\s*\d{5})|\d+\s*,?\s*\d+)$/i}],function(t){if(Array.isArray(t))return B(t)}(e=n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||function(t,e){if(t){if("string"==typeof t)return B(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?B(t,e):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()):n}({customDatasets:h,osNamesURL:g,regions:v,maxSuggestions:w,crs:l.crs}),k=(0,u.useRef)(null);if(!k.current){var D=o.marker,M=function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(o,Et);k.current=wt(function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ot(Object(r),!0).forEach(function(e){Nt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ot(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({dispatch:S,datasets:G,services:s,mapProvider:l,viewportRef:P,searchContainerRef:_,markers:a.markers,markerOptions:D},M))}var R=k.current,I=E||!!(d&&O&&N.length);(0,u.useEffect)(function(){var t;E&&(null===(t=x.current)||void 0===t||t.focus())},[E]),(0,u.useLayoutEffect)(function(){if(i.dispatch({type:"TOGGLE_HAS_EXCLUSIVE_CONTROL",payload:E}),I)return P.current.style.pointerEvents="none",document.addEventListener("focusin",R.handleOutside),document.addEventListener("pointerdown",R.handleOutside),function(){P.current.style.pointerEvents="auto",document.removeEventListener("focusin",R.handleOutside),document.removeEventListener("pointerdown",R.handleOutside)}},[E,p,O,N]);var L=d||E;return(0,c.jsx)("div",{className:"im-c-search".concat(L?"":" im-c-search--collapsed"),ref:_,children:(0,c.jsxs)(y,{id:f,pluginState:n,pluginConfig:o,appState:i,inputRef:x,events:R,services:s,children:[(0,c.jsx)(m,{defaultExpanded:d,onClick:function(t){return R.handleCloseClick(t,i)},closeIcon:T}),(0,c.jsx)(b,{defaultExpanded:d,submitIcon:j})]})})}}],icons:[{id:"search",svgContent:'<path d="m21 21-4.34-4.34"></path><circle cx="11" cy="11" r="8"></circle>'}]}}]]);
|
|
2
|
+
"use strict";(this.webpackChunkdefra_DefraMap=this.webpackChunkdefra_DefraMap||[]).push([[254],[,(t,e,r)=>{function n(t){return n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},n(t)}function o(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function i(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?o(Object(r),!0).forEach(function(e){a(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):o(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function a(t,e,r){return(e=function(t){var e=function(t){if("object"!=n(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=n(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==n(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}r.r(e),r.d(e,{manifest:()=>Tt});var s={TOGGLE_EXPANDED:function(t,e){return i(i({},t),{},{isExpanded:e,areSuggestionsVisible:e,hasFetchedSuggestions:!1,hasSearchError:!1})},SET_KEYBOARD_FOCUS_WITHIN:function(t,e){return i(i({},t),{},{hasKeyboardFocusWithin:e,areSuggestionsVisible:!0})},INPUT_BLUR:function(t,e){return i(i({},t),{},{hasKeyboardFocusWithin:!1,areSuggestionsVisible:t.areSuggestionsVisible&&"keyboard"!==e,selectedIndex:-1})},SET_VALUE:function(t,e){return i(i({},t),{},{value:e})},UPDATE_SUGGESTIONS:function(t,e){return i(i({},t),{},{suggestions:e.results,hasFetchedSuggestions:!0,hasSearchError:e.hasError})},SHOW_SUGGESTIONS:function(t){return i(i({},t),{},{areSuggestionsVisible:!0,hasFetchedSuggestions:!1,hasSearchError:!1})},HIDE_SUGGESTIONS:function(t){return i(i({},t),{},{areSuggestionsVisible:!1,hasFetchedSuggestions:!1,hasSearchError:!1})},SET_SELECTED:function(t,e){return i(i({},t),{},{selectedIndex:e,areSuggestionsVisible:e>=0})}},u=r(738),c=r(287),l=function(t){var e=t.id,r=t.pluginState,n=t.handleSuggestionClick;return(0,c.jsx)("ul",{id:"".concat(e,"-search-suggestions"),role:"listbox","aria-labelledby":"".concat(e,"-search-input"),className:"im-c-search-suggestions",style:r.areSuggestionsVisible&&r.suggestions.length?void 0:{display:"none"},children:r.suggestions.map(function(t,o){return(0,c.jsx)("li",{id:"".concat(e,"-search-suggestion-").concat(o),className:"im-c-search-suggestions__item",role:"option","aria-selected":r.selectedIndex===o,"aria-setsize":r.suggestions.length,"aria-posinset":o+1,onClick:function(){return n(t)},children:(0,c.jsx)("span",{className:"im-c-search-suggestions__label",dangerouslySetInnerHTML:{__html:t.marked}})},"".concat(e,"-").concat(t.type,"-").concat(t.id))})})};function f(t){return f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},f(t)}function p(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function d(t,e,r){return(e=function(t){var e=function(t){if("object"!=f(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=f(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==f(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var h=function(t,e,r){return function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?p(Object(r),!0).forEach(function(e){d(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):p(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({display:t.expanded||e.isExpanded?"flex":void 0},"mobile"!==r.breakpoint&&(null==t?void 0:t.width)&&{width:t.width})},y=function(t){var e=t.id,r=t.pluginState,n=t.pluginConfig,o=t.appState,i=t.inputRef,a=t.events,s=t.services,f=t.children,p=r.areSuggestionsVisible,d=r.hasFetchedSuggestions,y=r.hasSearchError,m=r.suggestions,b=void 0===m?[]:m,g=n.noResultsMessage,v=n.searchErrorMessage;(0,u.useEffect)(function(){p&&d&&s.announce(function(t,e,r,n){if(e)return r;if(0===t)return n;var o=1===t?"result":"results";return"".concat(t," ").concat(o," available")}(b.length,y,v,g))},[b,d]);var w=["im-c-search-form",n.expanded&&"im-c-search-form--default-expanded","im-c-panel"].filter(Boolean).join(" "),S=p&&d&&(y||!b.length);return(0,c.jsxs)("form",{id:"".concat(e,"-search-form"),role:"search",className:w,style:h(n,r,o),"aria-controls":"".concat(e,"-viewport"),onSubmit:function(t){return a.handleSubmit(t,o,r)},children:[(0,c.jsx)("button",{type:"submit",style:{display:"none"},"aria-hidden":"true",tabIndex:-1,children:"Submit"}),(0,c.jsxs)("div",{className:"im-c-search__input-container".concat(r.hasKeyboardFocusWithin?" im-c-search__input-container--keyboard-focus-within":""),children:[(0,c.jsx)("label",{htmlFor:"".concat(e,"-search-input"),className:"im-u-visually-hidden",children:n.placeholder}),(0,c.jsx)("input",{id:"".concat(e,"-search-input"),className:"im-c-search__input",type:"search",role:"combobox","aria-expanded":r.suggestionsVisible,"aria-controls":"".concat(e,"-search-suggestions"),"aria-activedescendant":r.selectedIndex>=0?"".concat(e,"-search-suggestion-").concat(r.selectedIndex):void 0,"aria-describedby":r.value?void 0:"".concat(e,"-search-hint"),"aria-autocomplete":"list",autoComplete:"off",placeholder:n.placeholder,name:"".concat(e,"-search-input"),spellCheck:!1,enterKeyHint:"search",value:r.value,onClick:a.handleInputClick,onChange:a.handleInputChange,onFocus:function(){return a.handleInputFocus(o.interfaceType)},onBlur:function(){return a.handleInputBlur(o.interfaceType)},onKeyDown:function(t){return a.handleInputKeyDown(t,r)},ref:i}),(0,c.jsx)("span",{id:"".concat(e,"-search-hint"),className:"im-c-search__hint",children:"When search results are available use up and down arrows to review and enter to select. Touch device users, explore by touch or with swipe gestures."}),f]}),S&&(0,c.jsx)("div",{className:"im-c-search__status","aria-hidden":"true",children:y?v:g}),(0,c.jsx)(l,{id:e,appState:o,pluginState:r,handleSuggestionClick:function(t){return a.handleSuggestionClick(t,o)}})]})},m=function(t){var e=t.defaultExpanded,r=t.onClick,n=t.closeIcon;return(0,c.jsx)("button",{"aria-label":"Close search",className:"im-c-map-button im-c-search-close-button",type:"button",onClick:r,style:e?{display:"none"}:void 0,children:n&&(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:n}})})},b=function(t){var e=t.defaultExpanded,r=t.submitIcon;return(0,c.jsx)("button",{"aria-label":"Search",className:"im-c-map-button im-c-search-submit-button",type:"submit",style:e?void 0:{display:"none"},children:r&&(0,c.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",dangerouslySetInnerHTML:{__html:r}})})};let g=" ";class v{static get separator(){return g}static set separator(t){g=t}static parse(t){if(!isNaN(parseFloat(t))&&isFinite(t))return Number(t);const e=String(t).trim().replace(/^-/,"").replace(/[NSEW]$/i,"").split(/[^0-9.,]+/);if(""==e[e.length-1]&&e.splice(e.length-1),""==e)return NaN;let r=null;switch(e.length){case 3:r=e[0]/1+e[1]/60+e[2]/3600;break;case 2:r=e[0]/1+e[1]/60;break;case 1:r=e[0];break;default:return NaN}return/^-|[WS]$/i.test(t.trim())&&(r=-r),Number(r)}static toDms(t,e="d",r=void 0){if(isNaN(t))return null;if("string"==typeof t&&""==t.trim())return null;if("boolean"==typeof t)return null;if(t==1/0)return null;if(null==t)return null;if(void 0===r)switch(e){case"d":case"deg":r=4;break;case"dm":case"deg+min":r=2;break;case"dms":case"deg+min+sec":r=0;break;default:e="d",r=4}t=Math.abs(t);let n=null,o=null,i=null,a=null;switch(e){default:case"d":case"deg":o=t.toFixed(r),o<100&&(o="0"+o),o<10&&(o="0"+o),n=o+"°";break;case"dm":case"deg+min":o=Math.floor(t),i=(60*t%60).toFixed(r),60==i&&(i=(0).toFixed(r),o++),o=("000"+o).slice(-3),i<10&&(i="0"+i),n=o+"°"+v.separator+i+"′";break;case"dms":case"deg+min+sec":o=Math.floor(t),i=Math.floor(3600*t/60)%60,a=(3600*t%60).toFixed(r),60==a&&(a=(0).toFixed(r),i++),60==i&&(i=0,o++),o=("000"+o).slice(-3),i=("00"+i).slice(-2),a<10&&(a="0"+a),n=o+"°"+v.separator+i+"′"+v.separator+a+"″"}return n}static toLat(t,e,r){const n=v.toDms(v.wrap90(t),e,r);return null===n?"–":n.slice(1)+v.separator+(t<0?"S":"N")}static toLon(t,e,r){const n=v.toDms(v.wrap180(t),e,r);return null===n?"–":n+v.separator+(t<0?"W":"E")}static toBrng(t,e,r){const n=v.toDms(v.wrap360(t),e,r);return null===n?"–":n.replace("360","0")}static fromLocale(t){const e=123456.789.toLocaleString(),r={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(r.thousands,"⁜").replace(r.decimal,".").replace("⁜",",")}static toLocale(t){const e=123456.789.toLocaleString(),r={thousands:e.slice(3,4),decimal:e.slice(7,8)};return t.replace(/,([0-9])/,"⁜$1").replace(".",r.decimal).replace("⁜",r.thousands)}static compassPoint(t,e=3){if(![1,2,3].includes(Number(e)))throw new RangeError(`invalid precision ‘${e}’`);t=v.wrap360(t);const r=4*2**(e-1);return["N","NNE","NE","ENE","E","ESE","SE","SSE","S","SSW","SW","WSW","W","WNW","NW","NNW"][Math.round(t*r/360)%r*16/r]}static wrap90(t){if(-90<=t&&t<=90)return t;const e=t;return 1*Math.abs(((e-90)%360+360)%360-180)-90}static wrap180(t){if(-180<=t&&t<=180)return t;const e=360;return((360*t/e-180)%e+e)%e-180}static wrap360(t){if(0<=t&&t<360)return t;const e=360;return(360*t/e%e+e)%e}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const w=v;class S{constructor(t,e,r){if(isNaN(t)||isNaN(e)||isNaN(r))throw new TypeError(`invalid vector [${t},${e},${r}]`);this.x=Number(t),this.y=Number(e),this.z=Number(r)}get length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}plus(t){if(!(t instanceof S))throw new TypeError("v is not Vector3d object");return new S(this.x+t.x,this.y+t.y,this.z+t.z)}minus(t){if(!(t instanceof S))throw new TypeError("v is not Vector3d object");return new S(this.x-t.x,this.y-t.y,this.z-t.z)}times(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new S(this.x*t,this.y*t,this.z*t)}dividedBy(t){if(isNaN(t))throw new TypeError(`invalid scalar value ‘${t}’`);return new S(this.x/t,this.y/t,this.z/t)}dot(t){if(!(t instanceof S))throw new TypeError("v is not Vector3d object");return this.x*t.x+this.y*t.y+this.z*t.z}cross(t){if(!(t instanceof S))throw new TypeError("v is not Vector3d object");const e=this.y*t.z-this.z*t.y,r=this.z*t.x-this.x*t.z,n=this.x*t.y-this.y*t.x;return new S(e,r,n)}negate(){return new S(-this.x,-this.y,-this.z)}unit(){const t=this.length;if(1==t)return this;if(0==t)return this;const e=this.x/t,r=this.y/t,n=this.z/t;return new S(e,r,n)}angleTo(t,e=void 0){if(!(t instanceof S))throw new TypeError("v is not Vector3d object");if(!(e instanceof S||null==e))throw new TypeError("n is not Vector3d object");const r=null==e||this.cross(t).dot(e)>=0?1:-1,n=this.cross(t).length*r,o=this.dot(t);return Math.atan2(n,o)}rotateAround(t,e){if(!(t instanceof S))throw new TypeError("axis is not Vector3d object");const r=e.toRadians(),n=this.unit(),o=t.unit(),i=Math.sin(r),a=Math.cos(r),s=1-a,u=o.x,c=o.y,l=o.z,f=[[s*u*u+a,s*u*c-i*l,s*u*l+i*c],[s*u*c+i*l,s*c*c+a,s*c*l-i*u],[s*u*l-i*c,s*c*l+i*u,s*l*l+a]],p=[f[0][0]*n.x+f[0][1]*n.y+f[0][2]*n.z,f[1][0]*n.x+f[1][1]*n.y+f[1][2]*n.z,f[2][0]*n.x+f[2][1]*n.y+f[2][2]*n.z];return new S(p[0],p[1],p[2])}toString(t=3){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}Number.prototype.toRadians=function(){return this*Math.PI/180},Number.prototype.toDegrees=function(){return 180*this/Math.PI};const E=S,O={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563}},N={WGS84:{ellipsoid:O.WGS84}};Object.freeze(O.WGS84),Object.freeze(N.WGS84);class T{constructor(t,e,r=0){if(isNaN(t)||null==t)throw new TypeError(`invalid lat ‘${t}’`);if(isNaN(e)||null==e)throw new TypeError(`invalid lon ‘${e}’`);if(isNaN(r)||null==r)throw new TypeError(`invalid height ‘${r}’`);this._lat=w.wrap90(Number(t)),this._lon=w.wrap180(Number(e)),this._height=Number(r)}get lat(){return this._lat}get latitude(){return this._lat}set lat(t){if(this._lat=isNaN(t)?w.wrap90(w.parse(t)):w.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid lat ‘${t}’`)}set latitude(t){if(this._lat=isNaN(t)?w.wrap90(w.parse(t)):w.wrap90(Number(t)),isNaN(this._lat))throw new TypeError(`invalid latitude ‘${t}’`)}get lon(){return this._lon}get lng(){return this._lon}get longitude(){return this._lon}set lon(t){if(this._lon=isNaN(t)?w.wrap180(w.parse(t)):w.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lon ‘${t}’`)}set lng(t){if(this._lon=isNaN(t)?w.wrap180(w.parse(t)):w.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid lng ‘${t}’`)}set longitude(t){if(this._lon=isNaN(t)?w.wrap180(w.parse(t)):w.wrap180(Number(t)),isNaN(this._lon))throw new TypeError(`invalid longitude ‘${t}’`)}get height(){return this._height}set height(t){if(this._height=Number(t),isNaN(this._height))throw new TypeError(`invalid height ‘${t}’`)}get datum(){return this._datum}set datum(t){this._datum=t}static get ellipsoids(){return O}static get datums(){return N}static parse(...t){if(0==t.length)throw new TypeError("invalid (empty) point");let e,r,n;if("object"==typeof t[0]&&(1==t.length||!isNaN(parseFloat(t[1])))){const o=t[0];if("Point"==o.type&&Array.isArray(o.coordinates)?([r,e,n]=o.coordinates,n=n||0):(null!=o.latitude&&(e=o.latitude),null!=o.lat&&(e=o.lat),null!=o.longitude&&(r=o.longitude),null!=o.lng&&(r=o.lng),null!=o.lon&&(r=o.lon),null!=o.height&&(n=o.height),e=w.wrap90(w.parse(e)),r=w.wrap180(w.parse(r))),null!=t[1]&&(n=t[1]),isNaN(e)||isNaN(r))throw new TypeError(`invalid point ‘${JSON.stringify(t[0])}’`)}if("string"==typeof t[0]&&2==t[0].split(",").length&&([e,r]=t[0].split(","),e=w.wrap90(w.parse(e)),r=w.wrap180(w.parse(r)),n=t[1]||0,isNaN(e)||isNaN(r)))throw new TypeError(`invalid point ‘${t[0]}’`);if(null==e&&null==r&&([e,r]=t,e=w.wrap90(w.parse(e)),r=w.wrap180(w.parse(r)),n=t[2]||0,isNaN(e)||isNaN(r)))throw new TypeError(`invalid point ‘${t.toString()}’`);return new this(e,r,n)}toCartesian(){const t=this.datum?this.datum.ellipsoid:this.referenceFrame?this.referenceFrame.ellipsoid:O.WGS84,e=this.lat.toRadians(),r=this.lon.toRadians(),n=this.height,{a:o,f:i}=t,a=Math.sin(e),s=Math.cos(e),u=Math.sin(r),c=Math.cos(r),l=2*i-i*i,f=o/Math.sqrt(1-l*a*a);return new j((f+n)*s*c,(f+n)*s*u,(f*(1-l)+n)*a)}equals(t){if(!(t instanceof T))throw new TypeError(`invalid point ‘${t}’`);return!(Math.abs(this.lat-t.lat)>Number.EPSILON||Math.abs(this.lon-t.lon)>Number.EPSILON||Math.abs(this.height-t.height)>Number.EPSILON||this.datum!=t.datum||this.referenceFrame!=t.referenceFrame||this.epoch!=t.epoch)}toString(t="d",e=void 0,r=null){if(!["d","dm","dms","n"].includes(t))throw new RangeError(`invalid format ‘${t}’`);const n=(this.height>=0?" +":" ")+this.height.toFixed(r)+"m";return"n"==t?(null==e&&(e=4),`${this.lat.toFixed(e)}, ${this.lon.toFixed(e)}${null==r?"":n}`):`${w.toLat(this.lat,t,e)}, ${w.toLon(this.lon,t,e)}${null==r?"":n}`}}class j extends E{constructor(t,e,r){super(t,e,r)}toLatLon(t=O.WGS84){if(!t||!t.a)throw new TypeError(`invalid ellipsoid ‘${t}’`);const{x:e,y:r,z:n}=this,{a:o,b:i,f:a}=t,s=2*a-a*a,u=s/(1-s),c=Math.sqrt(e*e+r*r),l=i*n/(o*c)*(1+u*i/Math.sqrt(c*c+n*n)),f=l/Math.sqrt(1+l*l),p=f/l,d=isNaN(p)?0:Math.atan2(n+u*i*f*f*f,c-s*o*p*p*p),h=Math.atan2(r,e),y=Math.sin(d),m=c*Math.cos(d)+n*y-o*o/(o/Math.sqrt(1-s*y*y));return new T(d.toDegrees(),h.toDegrees(),m)}toString(t=0){return`[${this.x.toFixed(t)},${this.y.toFixed(t)},${this.z.toFixed(t)}]`}}const _={WGS84:{a:6378137,b:6356752.314245,f:1/298.257223563},Airy1830:{a:6377563.396,b:6356256.909,f:1/299.3249646},AiryModified:{a:6377340.189,b:6356034.448,f:1/299.3249646},Bessel1841:{a:6377397.155,b:6356078.962818,f:1/299.1528128},Clarke1866:{a:6378206.4,b:6356583.8,f:1/294.978698214},Clarke1880IGN:{a:6378249.2,b:6356515,f:1/293.466021294},GRS80:{a:6378137,b:6356752.31414,f:1/298.257222101},Intl1924:{a:6378388,b:6356911.946,f:1/297},WGS72:{a:6378135,b:6356750.5,f:1/298.26}},x={ED50:{ellipsoid:_.Intl1924,transform:[89.5,93.8,123.1,-1.2,0,0,.156]},ETRS89:{ellipsoid:_.GRS80,transform:[0,0,0,0,0,0,0]},Irl1975:{ellipsoid:_.AiryModified,transform:[-482.53,130.596,-564.557,-8.15,1.042,.214,.631]},NAD27:{ellipsoid:_.Clarke1866,transform:[8,-160,-176,0,0,0,0]},NAD83:{ellipsoid:_.GRS80,transform:[.9956,-1.9103,-.5215,-62e-5,.025915,.009426,.011599]},NTF:{ellipsoid:_.Clarke1880IGN,transform:[168,60,-320,0,0,0,0]},OSGB36:{ellipsoid:_.Airy1830,transform:[-446.448,125.157,-542.06,20.4894,-.1502,-.247,-.8421]},Potsdam:{ellipsoid:_.Bessel1841,transform:[-582,-105,-414,-8.3,1.04,.35,-3.08]},TokyoJapan:{ellipsoid:_.Bessel1841,transform:[148,-507,-685,0,0,0,0]},WGS72:{ellipsoid:_.WGS72,transform:[0,0,-4.5,-.22,0,0,.554]},WGS84:{ellipsoid:_.WGS84,transform:[0,0,0,0,0,0,0]}};Object.keys(_).forEach(t=>Object.freeze(_[t])),Object.keys(x).forEach(t=>{Object.freeze(x[t]),Object.freeze(x[t].transform)});class P extends T{constructor(t,e,r=0,n=x.WGS84){if(!n||null==n.ellipsoid)throw new TypeError(`unrecognised datum ‘${n}’`);super(t,e,r),this._datum=n}get datum(){return this._datum}static get ellipsoids(){return _}static get datums(){return x}static parse(...t){let e=x.WGS84;if((4==t.length||3==t.length&&"object"==typeof t[2])&&(e=t.pop()),!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const r=super.parse(...t);return r._datum=e,r}convertDatum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);return this.toCartesian().convertDatum(t).toLatLon()}toCartesian(){const t=super.toCartesian();return new G(t.x,t.y,t.z,this.datum)}}class G extends j{constructor(t,e,r,n=void 0){if(n&&null==n.ellipsoid)throw new TypeError(`unrecognised datum ‘${n}’`);super(t,e,r),n&&(this._datum=n)}get datum(){return this._datum}set datum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);this._datum=t}toLatLon(t=void 0){t&&(console.info("datum parameter to Cartesian_Datum.toLatLon is deprecated: set datum before calling toLatLon()"),this.datum=t);const e=this.datum||x.WGS84;if(!e||null==e.ellipsoid)throw new TypeError(`unrecognised datum ‘${e}’`);const r=super.toLatLon(e.ellipsoid);return new P(r.lat,r.lon,r.height,this.datum)}convertDatum(t){if(!t||null==t.ellipsoid)throw new TypeError(`unrecognised datum ‘${t}’`);if(!this.datum)throw new TypeError("cartesian coordinate has no datum");let e=null,r=null;null!=this.datum&&this.datum!=x.WGS84||(e=this,r=t.transform),t==x.WGS84&&(e=this,r=this.datum.transform.map(t=>-t)),null==r&&(e=this.convertDatum(x.WGS84),r=t.transform);const n=e.applyTransform(r);return n.datum=t,n}applyTransform(t){const{x:e,y:r,z:n}=this,o=t[0],i=t[1],a=t[2],s=t[3]/1e6+1,u=(t[4]/3600).toRadians(),c=(t[5]/3600).toRadians(),l=(t[6]/3600).toRadians();return new G(o+e*s-r*l+n*c,i+e*l+r*s-n*u,a-e*c+r*u+n*s)}}const k={trueOrigin:{lat:49,lon:-2},falseOrigin:{easting:-4e5,northing:1e5},scaleFactor:.9996012717,ellipsoid:P.ellipsoids.Airy1830};class D{constructor(t,e){if(this.easting=Number(t),this.northing=Number(e),isNaN(t)||this.easting<0||this.easting>7e5)throw new RangeError(`invalid easting ‘${t}’`);if(isNaN(e)||this.northing<0||this.northing>13e5)throw new RangeError(`invalid northing ‘${e}’`)}toLatLon(t=P.datums.WGS84){const{easting:e,northing:r}=this,{a:n,b:o}=k.ellipsoid,i=k.trueOrigin.lat.toRadians(),a=k.trueOrigin.lon.toRadians(),s=-k.falseOrigin.easting,u=-k.falseOrigin.northing,c=k.scaleFactor,l=1-o*o/(n*n),f=(n-o)/(n+o),p=f*f,d=f*f*f;let h=i,y=0;do{h=(r-u-y)/(n*c)+h,y=o*c*((1+f+5/4*p+5/4*d)*(h-i)-(3*f+3*f*f+21/8*d)*Math.sin(h-i)*Math.cos(h+i)+(15/8*p+15/8*d)*Math.sin(2*(h-i))*Math.cos(2*(h+i))-35/24*d*Math.sin(3*(h-i))*Math.cos(3*(h+i)))}while(Math.abs(r-u-y)>=1e-5);const m=Math.cos(h),b=Math.sin(h),g=n*c/Math.sqrt(1-l*b*b),v=n*c*(1-l)/Math.pow(1-l*b*b,1.5),w=g/v-1,S=Math.tan(h),E=S*S,O=E*E,N=1/m,T=g*g*g,j=T*g*g,_=e-s,x=_*_,G=x*_,D=x*x,R=G*x;h=h-S/(2*v*g)*x+S/(24*v*T)*(5+3*E+w-9*E*w)*D-S/(720*v*j)*(61+90*E+45*O)*(D*x);const A=a+N/g*_-N/(6*T)*(g/v+2*E)*G+N/(120*j)*(5+28*E+24*O)*R-N/(j*g*g*5040)*(61+662*E+1320*O+O*E*720)*(R*x);let I=new M(h.toDegrees(),A.toDegrees(),0,P.datums.OSGB36);return t!=P.datums.OSGB36&&(I=I.convertDatum(t),I=new M(I.lat,I.lon,I.height,I.datum)),I}static parse(t){let e=(t=String(t).trim()).match(/^(\d+),\s*(\d+)$/);if(e)return new D(e[1],e[2]);if(e=t.match(/^[HNST][ABCDEFGHJKLMNOPQRSTUVWXYZ]\s*[0-9]+\s*[0-9]+$/i),!e)throw new Error(`invalid grid reference ‘${t}’`);let r=t.toUpperCase().charCodeAt(0)-"A".charCodeAt(0),n=t.toUpperCase().charCodeAt(1)-"A".charCodeAt(0);r>7&&r--,n>7&&n--;const o=(r-2)%5*5+n%5,i=19-5*Math.floor(r/5)-Math.floor(n/5);let a=t.slice(2).trim().split(/\s+/);if(1==a.length&&(a=[a[0].slice(0,a[0].length/2),a[0].slice(a[0].length/2)]),a[0].length!=a[1].length)throw new Error(`invalid grid reference ‘${t}’`);a[0]=a[0].padEnd(5,"0"),a[1]=a[1].padEnd(5,"0");const s=o+a[0],u=i+a[1];return new D(s,u)}toString(t=10){if(![0,2,4,6,8,10,12,14,16].includes(Number(t)))throw new RangeError(`invalid precision ‘${t}’`);let{easting:e,northing:r}=this;if(0==t){const t={useGrouping:!1,minimumIntegerDigits:6,maximumFractionDigits:3};return`${e.toLocaleString("en",t)},${r.toLocaleString("en",t)}`}const n=Math.floor(e/1e5),o=Math.floor(r/1e5);let i=19-o-(19-o)%5+Math.floor((n+10)/5),a=5*(19-o)%25+n%5;i>7&&i++,a>7&&a++;const s=String.fromCharCode(i+"A".charCodeAt(0),a+"A".charCodeAt(0));return e=Math.floor(e%1e5/Math.pow(10,5-t/2)),r=Math.floor(r%1e5/Math.pow(10,5-t/2)),e=e.toString().padStart(t/2,"0"),r=r.toString().padStart(t/2,"0"),`${s} ${e} ${r}`}}class M extends P{toOsGrid(){const t=this.datum==P.datums.OSGB36?this:this.convertDatum(P.datums.OSGB36),e=t.lat.toRadians(),r=t.lon.toRadians(),{a:n,b:o}=k.ellipsoid,i=k.trueOrigin.lat.toRadians(),a=k.trueOrigin.lon.toRadians(),s=-k.falseOrigin.easting,u=-k.falseOrigin.northing,c=k.scaleFactor,l=1-o*o/(n*n),f=(n-o)/(n+o),p=f*f,d=f*f*f,h=Math.cos(e),y=Math.sin(e),m=n*c/Math.sqrt(1-l*y*y),b=n*c*(1-l)/Math.pow(1-l*y*y,1.5),g=m/b-1,v=o*c*((1+f+5/4*p+5/4*d)*(e-i)-(3*f+3*f*f+21/8*d)*Math.sin(e-i)*Math.cos(e+i)+(15/8*p+15/8*d)*Math.sin(2*(e-i))*Math.cos(2*(e+i))-35/24*d*Math.sin(3*(e-i))*Math.cos(3*(e+i))),w=h*h*h,S=w*h*h,E=Math.tan(e)*Math.tan(e),O=E*E,N=r-a,T=N*N,j=T*N,_=j*N,x=_*N;let G=v+u+m/2*y*h*T+m/24*y*w*(5-E+9*g)*_+m/720*y*S*(61-58*E+O)*(x*N),M=s+m*h*N+m/6*w*(m/b-E)*j+m/120*S*(5-18*E+O+14*g-58*E*g)*x;G=Number(G.toFixed(3)),M=Number(M.toFixed(3));try{return new D(M,G)}catch(e){throw new Error(`${e.message} from (${t.lat.toFixed(6)},${t.lon.toFixed(6)}).toOsGrid()`)}}convertDatum(t){const e=super.convertDatum(t);return new M(e.lat,e.lon,e.height,e.datum)}}function R(t){return R="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},R(t)}var A;function I(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function C(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?I(Object(r),!0).forEach(function(e){L(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):I(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function L(t,e,r){return(e=function(t){var e=function(t){if("object"!=R(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=R(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==R(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var F=500,$=function(t){var e=t.GAZETTEER_ENTRY,r="eng"===e.NAME2_LANG?e.NAME2:e.NAME1;return t.GAZETTEER_ENTRY.NAME1=r,t.GAZETTEER_ENTRY.NAME1_LANG="eng",t},W=function(t,e){var r,n,o,i,a=e.MBR_XMIN,s=e.MBR_YMIN,u=e.MBR_XMAX,c=e.MBR_YMAX,l=e.GEOMETRY_X,f=e.GEOMETRY_Y;if(null==a?(r=l-F,n=f-F,o=l+F,i=f+F):(r=a,n=s,o=u,i=c),"EPSG:27700"===t)return[r,n,o,i];if("EPSG:4326"===t){var p=new D(r,n).toLatLon(),d=new D(o,i).toLatLon();return[p.lon,p.lat,d.lon,d.lat].map(function(t){return Math.round(1e6*t)/1e6})}throw new Error("Unsupported CRS: ".concat(t))},U=function(t,e){var r=e.GEOMETRY_X,n=e.GEOMETRY_Y;if("EPSG:27700"===t)return[r,n];if("EPSG:4326"===t){var o=new D(r,n).toLatLon();return[Math.round(1e6*o.lon)/1e6,Math.round(1e6*o.lat)/1e6]}throw new Error("Unsupported CRS: ".concat(t))};function B(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function z(t){return function(t){if(Array.isArray(t))return q(t)}(t)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(t)||Y(t)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function V(t,e){var r="undefined"!=typeof Symbol&&t[Symbol.iterator]||t["@@iterator"];if(!r){if(Array.isArray(t)||(r=Y(t))||e&&t&&"number"==typeof t.length){r&&(t=r);var n=0,o=function(){};return{s:o,n:function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}},e:function(t){throw t},f:o}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var i,a=!0,s=!1;return{s:function(){r=r.call(t)},n:function(){var t=r.next();return a=t.done,t},e:function(t){s=!0,i=t},f:function(){try{a||null==r.return||r.return()}finally{if(s)throw i}}}}function Y(t,e){if(t){if("string"==typeof t)return q(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?q(t,e):void 0}}function q(t,e){(null==e||e>t.length)&&(e=t.length);for(var r=0,n=Array(e);r<e;r++)n[r]=t[r];return n}function H(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var u=n&&n.prototype instanceof s?n:s,c=Object.create(u.prototype);return Z(c,"_invoke",function(r,n,o){var i,s,u,c=0,l=o||[],f=!1,p={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,r){return i=e,s=0,u=t,p.n=r,a}};function d(r,n){for(s=r,u=n,e=0;!f&&c&&!o&&e<l.length;e++){var o,i=l[e],d=p.p,h=i[2];r>3?(o=h===n)&&(u=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=r<2&&d<i[1])?(s=0,p.v=n,p.n=i[1]):d<h&&(o=r<3||i[0]>n||n>h)&&(i[4]=r,i[5]=n,p.n=h,s=0))}if(o||r>1)return a;throw f=!0,n}return function(o,l,h){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,h),s=l,u=h;(e=s<2?t:u)||!f;){i||(s?s<3?(s>1&&(p.n=-1),d(s,u)):p.n=u:p.v=u);try{if(c=2,i){if(s||(o="next"),e=i[o]){if(!(e=e.call(i,u)))throw TypeError("iterator result is not an object");if(!e.done)return e;u=e.value,s<2&&(s=0)}else 1===s&&(e=i.return)&&e.call(i),s<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=t}else if((e=(f=p.n<0)?u:r.call(n,p))!==a)break}catch(e){i=t,s=1,u=e}finally{c=1}}return{value:e,done:f}}}(r,o,i),!0),c}var a={};function s(){}function u(){}function c(){}e=Object.getPrototypeOf;var l=[][n]?e(e([][n]())):(Z(e={},n,function(){return this}),e),f=c.prototype=s.prototype=Object.create(l);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,Z(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return u.prototype=c,Z(f,"constructor",c),Z(c,"constructor",u),u.displayName="GeneratorFunction",Z(c,o,"GeneratorFunction"),Z(f),Z(f,o,"Generator"),Z(f,n,function(){return this}),Z(f,"toString",function(){return"[object Generator]"}),(H=function(){return{w:i,m:p}})()}function Z(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}Z=function(t,e,r,n){function i(e,r){Z(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},Z(t,e,r,n)}function K(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}function X(t){return function(){var e=this,r=arguments;return new Promise(function(n,o){var i=t.apply(e,r);function a(t){K(i,n,o,a,s,"next",t)}function s(t){K(i,n,o,a,s,"throw",t)}a(void 0)})}}var J=function(t){return t.replaceAll(/[^a-zA-Z0-9\s\-.,]/g,"").trim()},Q=function(t){var e=t.url,r=t.options;return new Request(e,r)},tt=function(){var t=X(H().m(function t(e,r,n){var o,i,a,s;return H().w(function(t){for(;;)switch(t.n){case 0:if(i={url:null===(o=e.urlTemplate)||void 0===o?void 0:o.replace("{query}",encodeURIComponent(r)),options:{method:"GET"}},!e.buildRequest){t.n=1;break}return a=e.buildRequest(r,function(){return i}),t.a(2,a instanceof Request?a:Q(a));case 1:if(!n){t.n=3;break}return s=Q,t.n=2,n(i,r);case 2:return t.a(2,s(t.v));case 3:return t.a(2,Q(i))}},t)}));return function(e,r,n){return t.apply(this,arguments)}}(),et=function(){var t=X(H().m(function t(e,r,n){var o,i,a;return H().w(function(t){for(;;)switch(t.p=t.n){case 0:return t.p=0,t.n=1,fetch(r);case 1:if((o=t.v).ok){t.n=2;break}return console.error("Fetch error for ".concat(e.label||"dataset",": ").concat(o.status)),t.a(2,{error:!0});case 2:return t.n=3,o.json();case 3:return i=t.v,t.a(2,e.parseResults(i,n));case 4:return t.p=4,a=t.v,console.error("Network error for ".concat(e.label||"dataset",":"),a),t.a(2,{error:!0})}},t,null,[[0,4]])}));return function(e,r,n){return t.apply(this,arguments)}}(),rt=function(){var t=X(H().m(function t(e,r,n,o){var i,a,s,u,c,l,f,p,d,h;return H().w(function(t){for(;;)switch(t.p=t.n){case 0:i=J(e),a=r.filter(function(t){var r=!t.includeRegex||t.includeRegex.test(e),n=!!t.excludeRegex&&t.excludeRegex.test(i);return r&&!n}),s=[],u=!1,c=V(a),t.p=1,c.s();case 2:if((l=c.n()).done){t.n=6;break}return f=l.value,t.n=3,tt(f,i,o);case 3:return p=t.v,t.n=4,et(f,p,i);case 4:if(null!=(d=t.v)&&d.error?u=!0:null!=d&&d.length&&(s=[].concat(z(s),z(d))),!f.exclusive||!s.length){t.n=5;break}return t.a(3,6);case 5:t.n=2;break;case 6:t.n=8;break;case 7:t.p=7,h=t.v,c.e(h);case 8:return t.p=8,c.f(),t.f(8);case 9:return n({type:"UPDATE_SUGGESTIONS",payload:{results:s,hasError:u}}),t.a(2,{results:s,sanitisedValue:i})}},t,null,[[1,7,8,9]])}));return function(e,r,n,o){return t.apply(this,arguments)}}();function nt(t){var e=t.mapProvider,r=t.bounds,n=t.point,o=t.markers,i=t.showMarker,a=t.markerOptions;e.fitToBounds(r),i&&o.add("search",n,a)}var ot=r(604);function it(t){return it="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},it(t)}function at(){var t,e,r="function"==typeof Symbol?Symbol:{},n=r.iterator||"@@iterator",o=r.toStringTag||"@@toStringTag";function i(r,n,o,i){var u=n&&n.prototype instanceof s?n:s,c=Object.create(u.prototype);return st(c,"_invoke",function(r,n,o){var i,s,u,c=0,l=o||[],f=!1,p={p:0,n:0,v:t,a:d,f:d.bind(t,4),d:function(e,r){return i=e,s=0,u=t,p.n=r,a}};function d(r,n){for(s=r,u=n,e=0;!f&&c&&!o&&e<l.length;e++){var o,i=l[e],d=p.p,h=i[2];r>3?(o=h===n)&&(u=i[(s=i[4])?5:(s=3,3)],i[4]=i[5]=t):i[0]<=d&&((o=r<2&&d<i[1])?(s=0,p.v=n,p.n=i[1]):d<h&&(o=r<3||i[0]>n||n>h)&&(i[4]=r,i[5]=n,p.n=h,s=0))}if(o||r>1)return a;throw f=!0,n}return function(o,l,h){if(c>1)throw TypeError("Generator is already running");for(f&&1===l&&d(l,h),s=l,u=h;(e=s<2?t:u)||!f;){i||(s?s<3?(s>1&&(p.n=-1),d(s,u)):p.n=u:p.v=u);try{if(c=2,i){if(s||(o="next"),e=i[o]){if(!(e=e.call(i,u)))throw TypeError("iterator result is not an object");if(!e.done)return e;u=e.value,s<2&&(s=0)}else 1===s&&(e=i.return)&&e.call(i),s<2&&(u=TypeError("The iterator does not provide a '"+o+"' method"),s=1);i=t}else if((e=(f=p.n<0)?u:r.call(n,p))!==a)break}catch(e){i=t,s=1,u=e}finally{c=1}}return{value:e,done:f}}}(r,o,i),!0),c}var a={};function s(){}function u(){}function c(){}e=Object.getPrototypeOf;var l=[][n]?e(e([][n]())):(st(e={},n,function(){return this}),e),f=c.prototype=s.prototype=Object.create(l);function p(t){return Object.setPrototypeOf?Object.setPrototypeOf(t,c):(t.__proto__=c,st(t,o,"GeneratorFunction")),t.prototype=Object.create(f),t}return u.prototype=c,st(f,"constructor",c),st(c,"constructor",u),u.displayName="GeneratorFunction",st(c,o,"GeneratorFunction"),st(f),st(f,o,"Generator"),st(f,n,function(){return this}),st(f,"toString",function(){return"[object Generator]"}),(at=function(){return{w:i,m:p}})()}function st(t,e,r,n){var o=Object.defineProperty;try{o({},"",{})}catch(t){o=0}st=function(t,e,r,n){function i(e,r){st(t,e,function(t){return this._invoke(e,r,t)})}e?o?o(t,e,{value:r,enumerable:!n,configurable:!n,writable:!n}):t[e]=r:(i("next",0),i("throw",1),i("return",2))},st(t,e,r,n)}function ut(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function ct(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ut(Object(r),!0).forEach(function(e){lt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ut(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function lt(t,e,r){return(e=function(t){var e=function(t){if("object"!=it(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=it(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==it(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function ft(t,e,r,n,o,i,a){try{var s=t[i](a),u=s.value}catch(t){return void r(t)}s.done?e(u):Promise.resolve(u).then(n,o)}var pt=function(t){var e=t.dispatch,r=t.services,n=t.viewportRef,o=t.mapProvider,i=t.markers,a=t.datasets,s=t.transformRequest,u=t.showMarker,c=t.markerOptions,l="";return{handleCloseClick:function(t,n){var o,a,s;e({type:"TOGGLE_EXPANDED",payload:!1}),e({type:"UPDATE_SUGGESTIONS",payload:{results:[],hasError:!1}}),e({type:"SET_VALUE",payload:""}),o=null==n?void 0:n.buttonRefs,a=0,s=function(){var t=function(t){var e;return(null==t||null===(e=t.current)||void 0===e?void 0:e.search)||document.querySelector(".im-c-map-button--search")}(o);t&&(t.focus(),document.activeElement===t)||a<30&&(a+=1,requestAnimationFrame(s))},requestAnimationFrame(s),i.remove("search"),r.eventBus.emit("search:clear"),r.eventBus.emit("search:close")},handleSubmit:function(t,f,p){return(d=at().m(function d(){var h,y,m,b,g,v,w,S,E,O,N,T;return at().w(function(d){for(;;)switch(d.n){case 0:if(t.preventDefault(),h=p.suggestions,y=p.selectedIndex,m=p.value,b=null==m?void 0:m.trim(),e({type:"SET_SELECTED",payload:-1}),e({type:"HIDE_SUGGESTIONS"}),!(y>=0)){d.n=1;break}return v=h[y],e({type:"SET_VALUE",payload:v.text}),null===(g=n.current)||void 0===g||g.focus(),nt({mapProvider:o,bounds:v.bounds,point:v.point,markers:i,showMarker:u,markerOptions:c}),r.eventBus.emit("search:match",ct({query:v.text},v)),d.a(2);case 1:if(!((null==b?void 0:b.length)<ot.z.minSearchLength)){d.n=2;break}return d.a(2);case 2:if(w=h,h.length&&b===l){d.n=4;break}return d.n=3,rt(b,a,e,s);case 3:S=d.v,E=S.results,O=S.sanitisedValue,w=E,l=O;case 4:w.length&&(null===(N=n.current)||void 0===N||N.focus(),"mobile"===f.breakpoint&&(e({type:"TOGGLE_EXPANDED",payload:!1}),r.eventBus.emit("search:close")),T=w[0],nt({mapProvider:o,bounds:T.bounds,point:T.point,markers:i,showMarker:u,markerOptions:c}),r.eventBus.emit("search:match",ct({query:m},T)));case 5:return d.a(2)}},d)}),function(){var t=this,e=arguments;return new Promise(function(r,n){var o=d.apply(t,e);function i(t){ft(o,r,n,i,a,"next",t)}function a(t){ft(o,r,n,i,a,"throw",t)}i(void 0)})})();var d}}};function dt(t){return dt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},dt(t)}function ht(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function yt(t,e,r){return(e=function(t){var e=function(t){if("object"!=dt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=dt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==dt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function mt(t){return mt="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},mt(t)}function bt(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function gt(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?bt(Object(r),!0).forEach(function(e){vt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):bt(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}function vt(t,e,r){return(e=function(t){var e=function(t){if("object"!=mt(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=mt(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==mt(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}function wt(t){var e,r,n,o=t.dispatch,i=t.searchContainerRef,a=(e=function(e){return rt(e,t.datasets,o,t.transformRequest)},r=null,n=function(){for(var t=arguments.length,n=new Array(t),o=0;o<t;o++)n[o]=arguments[o];clearTimeout(r),r=setTimeout(function(){e.apply(void 0,n)},350)},n.cancel=function(){r&&(clearTimeout(r),r=null)},n),s=pt(t),u=function(t){var e=t.dispatch,r=t.debouncedFetchSuggestions;return{handleInputClick:function(){e({type:"SHOW_SUGGESTIONS"})},handleInputFocus:function(t){e({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:"keyboard"===t})},handleInputBlur:function(t){e({type:"INPUT_BLUR",payload:t})},handleInputChange:function(t){var n=t.target.value;if(e({type:"SET_VALUE",payload:n}),n.length<ot.z.minSearchLength)return r.cancel(),e({type:"UPDATE_SUGGESTIONS",payload:{results:[],hasError:!1}}),void e({type:"HIDE_SUGGESTIONS"});e({type:"SHOW_SUGGESTIONS"}),r(n)}}}(gt(gt({},t),{},{debouncedFetchSuggestions:a})),c=function(t){var e=t.dispatch,r=t.services,n=t.mapProvider,o=t.markers,i=t.showMarker,a=t.markerOptions,s=t.viewportRef,u=function(t,e){var r;return e>=0?"".concat(null===(r=t[e])||void 0===r?void 0:r.text,". ").concat(e+1," of ").concat(t.length," is highlighted"):"".concat(t.length," suggestions available")};return{handleSuggestionClick:function(t,u){var c;e({type:"SET_VALUE",payload:t.text}),e({type:"HIDE_SUGGESTIONS"}),e({type:"SET_SELECTED",payload:-1}),"mobile"===u.breakpoint&&(e({type:"TOGGLE_EXPANDED",payload:!1}),r.eventBus.emit("search:close")),null===(c=s.current)||void 0===c||c.focus(),nt({mapProvider:n,bounds:t.bounds,point:t.point,markers:o,showMarker:i,markerOptions:a}),r.eventBus.emit("search:match",function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?ht(Object(r),!0).forEach(function(e){yt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):ht(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({query:t.text},t))},handleInputKeyDown:function(t,n){var o=n.suggestions,i=n.selectedIndex;switch(t.key){case"ArrowDown":if(null==o||!o.length)return;if(t.preventDefault(),i<o.length-1){var a=i+1;r.announce(u(o,a)),e({type:"SET_SELECTED",payload:a}),e({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:!1})}break;case"ArrowUp":if(null==o||!o.length)return;t.preventDefault();var s=i>0?i-1:-1;r.announce(u(o,s)),e({type:"SET_SELECTED",payload:s}),e({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:s<0});break;case"Escape":t.preventDefault(),e({type:"SET_KEYBOARD_FOCUS_WITHIN",payload:!0}),e({type:"HIDE_SUGGESTIONS"}),e({type:"SET_SELECTED",payload:-1})}}}}(t);return gt(gt(gt(gt({},s),u),c),{},{handleOutside:function(e){i.current.contains(e.target)||(o({type:"TOGGLE_EXPANDED",payload:!1}),t.services.eventBus.emit("search:close"))}})}function St(t){return St="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},St(t)}var Et=["marker"];function Ot(t,e){var r=Object.keys(t);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(t);e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)}return r}function Nt(t,e,r){return(e=function(t){var e=function(t){if("object"!=St(t)||!t)return t;var e=t[Symbol.toPrimitive];if(void 0!==e){var r=e.call(t,"string");if("object"!=St(r))return r;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(t)}(t);return"symbol"==St(e)?e:e+""}(e))in t?Object.defineProperty(t,e,{value:r,enumerable:!0,configurable:!0,writable:!0}):t[e]=r,t}var Tt={reducer:{initialState:{isExpanded:!1,hasKeyboardFocusWithin:!1,value:"",suggestions:[],areSuggestionsVisible:!1,hasFetchedSuggestions:!1,hasSearchError:!1,selectedIndex:-1},actions:s},buttons:[{id:"search",label:"Search",iconId:"search",ariaControls:function(t){var e=t.appConfig;return"".concat(e.id,"-search-form")},expandedWhen:function(t){return t.pluginState.isExpanded},excludeWhen:function(t){var e=t.pluginConfig;return Boolean(e.expanded)},keepFocus:!0,onClick:function(t,e){var r=e.pluginState,n=e.services;r.dispatch({type:"TOGGLE_EXPANDED",payload:!0}),n.eventBus.emit("search:open")},mobile:{slot:"top-right",showLabel:!1},tablet:{slot:"top-left",showLabel:!1},desktop:{slot:"top-left",showLabel:!1}}],controls:[{id:"search",mobile:{slot:"header"},tablet:{slot:"top-left"},desktop:{slot:"top-left"},render:function(t){var e=t.appConfig,r=t.iconRegistry,n=t.pluginState,o=t.pluginConfig,i=t.appState,a=t.mapState,s=t.services,l=t.mapProvider,f=e.id,p=i.interfaceType,d=o.expanded,h=o.customDatasets,g=o.osNamesURL,v=o.regions,w=o.maxSuggestions,S=n.dispatch,E=n.isExpanded,O=n.areSuggestionsVisible,N=n.suggestions,T=r.close,j=r.search,_=(0,u.useRef)(null),x=(0,u.useRef)(null),P=i.layoutRefs.viewportRef,G=function(t){var e,r=t.customDatasets,n=void 0===r?[]:r,o=t.osNamesURL,i=t.crs,a=t.regions,s=void 0===a?["england","scotland","wales"]:a,u=t.maxSuggestions;return o?[].concat([{name:"osNames",urlTemplate:o,parseResults:function(t,e){return function(t,e,r,n){var o,i=arguments.length>4&&void 0!==arguments[4]?arguments[4]:8;if(!t||t.error||0===(null===(o=t.header)||void 0===o?void 0:o.totalresults))return[];var a=t.results;return a=function(t,e){var r=e.toLowerCase().replace(/,/g,"").split(" ");return t.map($).filter(function(t){return r.some(function(r){return t.GAZETTEER_ENTRY.NAME1.toLowerCase().includes(r)||(n=(n=e).replace(/\s/g,""),/^(([A-Z]{1,2}\d[A-Z\d]?|ASCN|STHL|TDCU|BBND|[BFS]IQQ|PCRN|TKCA) ?\d[A-Z]{2}|BFPO ?\d{1,4}|(KY\d|MSR|VG|AI)[ -]?\d{4}|[A-Z]{2} ?\d{2}|GE ?CX|GIR ?0A{2}|SAN ?TA1)$/i.test(n));var n})})}(a,e),a=function(t,e){return t.filter(function(t){var r,n=null==t||null===(r=t.GAZETTEER_ENTRY)||void 0===r||null===(r=r.COUNTRY)||void 0===r?void 0:r.toLowerCase();return n&&e.includes(n)})}(a=function(t){return Array.from(new Map(t.map(function(t){return[t.GAZETTEER_ENTRY.ID,t]})).values())}(a),r),(a=a.slice(0,i)).map(function(t){return C(C({id:t.GAZETTEER_ENTRY.ID,bounds:W(n,t.GAZETTEER_ENTRY),point:U(n,t.GAZETTEER_ENTRY)},function(t,e){var r,n,o,i,a,s,u=e.NAME1,c=e.COUNTY_UNITARY,l=e.DISTRICT_BOROUGH,f=e.POSTCODE_DISTRICT,p=e.LOCAL_TYPE,d="".concat(["City","Postcode"].includes(p)?"":f+", ").concat("City"===p?"":c||l),h="".concat(u).concat(d?", "+d:"");return{text:h,marked:(r=h,n=t,a=n.replace(/\s+/g,"").split("").join(String.raw(A||(o=["s*"],(i=["\\s*"])||(i=o.slice(0)),A=Object.freeze(Object.defineProperties(o,{raw:{value:Object.freeze(i)}}))))),s=new RegExp("(".concat(a,")"),"i"),r.replace(s,"<mark>$1</mark>"))}}(e,t.GAZETTEER_ENTRY)),{},{type:"os-names"})})}(t,e,s,i,u)},includeRegex:/[a-zA-Z0-9]/,excludeRegex:/^(?:[a-z]{2}\s*(?:\d{3}\s*\d{3}|\d{4}\s*\d{4}|\d{5}\s*\d{5})|\d+\s*,?\s*\d+)$/i}],function(t){if(Array.isArray(t))return B(t)}(e=n)||function(t){if("undefined"!=typeof Symbol&&null!=t[Symbol.iterator]||null!=t["@@iterator"])return Array.from(t)}(e)||function(t,e){if(t){if("string"==typeof t)return B(t,e);var r={}.toString.call(t).slice(8,-1);return"Object"===r&&t.constructor&&(r=t.constructor.name),"Map"===r||"Set"===r?Array.from(t):"Arguments"===r||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?B(t,e):void 0}}(e)||function(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()):n}({customDatasets:h,osNamesURL:g,regions:v,maxSuggestions:w,crs:l.crs}),k=(0,u.useRef)(null);if(!k.current){var D=o.marker,M=function(t,e){if(null==t)return{};var r,n,o=function(t,e){if(null==t)return{};var r={};for(var n in t)if({}.hasOwnProperty.call(t,n)){if(-1!==e.indexOf(n))continue;r[n]=t[n]}return r}(t,e);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);for(n=0;n<i.length;n++)r=i[n],-1===e.indexOf(r)&&{}.propertyIsEnumerable.call(t,r)&&(o[r]=t[r])}return o}(o,Et);k.current=wt(function(t){for(var e=1;e<arguments.length;e++){var r=null!=arguments[e]?arguments[e]:{};e%2?Ot(Object(r),!0).forEach(function(e){Nt(t,e,r[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(r)):Ot(Object(r)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(r,e))})}return t}({dispatch:S,datasets:G,services:s,mapProvider:l,viewportRef:P,searchContainerRef:_,markers:a.markers,markerOptions:D},M))}var R=k.current,I=E||!!(d&&O&&N.length);(0,u.useEffect)(function(){var t;E&&(null===(t=x.current)||void 0===t||t.focus())},[E]),(0,u.useLayoutEffect)(function(){if(i.dispatch({type:"TOGGLE_HAS_EXCLUSIVE_CONTROL",payload:E}),I)return P.current.style.pointerEvents="none",document.addEventListener("focusin",R.handleOutside),document.addEventListener("pointerdown",R.handleOutside),function(){P.current.style.pointerEvents="auto",document.removeEventListener("focusin",R.handleOutside),document.removeEventListener("pointerdown",R.handleOutside)}},[E,p,O,N]);var L=d||E;return(0,c.jsx)("div",{className:"im-c-search".concat(L?"":" im-c-search--collapsed"),ref:_,children:(0,c.jsxs)(y,{id:f,pluginState:n,pluginConfig:o,appState:i,inputRef:x,events:R,services:s,children:[(0,c.jsx)(m,{defaultExpanded:d,onClick:function(t){return R.handleCloseClick(t,i)},closeIcon:T}),(0,c.jsx)(b,{defaultExpanded:d,submitIcon:j})]})})}}],icons:[{id:"search",svgContent:'<path d="m21 21-4.34-4.34"></path><circle cx="11" cy="11" r="8"></circle>'}]}}]]);
|
|
@@ -63,9 +63,9 @@ export const Form = ({
|
|
|
63
63
|
</button>
|
|
64
64
|
|
|
65
65
|
<div className={`im-c-search__input-container${pluginState.hasKeyboardFocusWithin ? ' im-c-search__input-container--keyboard-focus-within' : ''}`}>
|
|
66
|
-
<label htmlFor={`${id}-search`} className='im-u-visually-hidden'>{pluginConfig.placeholder}</label>
|
|
66
|
+
<label htmlFor={`${id}-search-input`} className='im-u-visually-hidden'>{pluginConfig.placeholder}</label>
|
|
67
67
|
<input
|
|
68
|
-
id={`${id}-search`}
|
|
68
|
+
id={`${id}-search-input`}
|
|
69
69
|
className='im-c-search__input'
|
|
70
70
|
type='search'
|
|
71
71
|
role='combobox'
|
|
@@ -76,7 +76,7 @@ export const Form = ({
|
|
|
76
76
|
aria-autocomplete='list'
|
|
77
77
|
autoComplete='off'
|
|
78
78
|
placeholder={pluginConfig.placeholder}
|
|
79
|
-
name={`${id}-search`}
|
|
79
|
+
name={`${id}-search-input`}
|
|
80
80
|
spellCheck={false}
|
|
81
81
|
enterKeyHint='search'
|
|
82
82
|
value={pluginState.value}
|
|
@@ -4,13 +4,13 @@ export const Suggestions = ({ id, pluginState, handleSuggestionClick }) => {
|
|
|
4
4
|
<ul // NOSONAR
|
|
5
5
|
id={`${id}-search-suggestions`}
|
|
6
6
|
role='listbox' // NOSONAR
|
|
7
|
-
aria-labelledby={`${id}-search`} // Option A: label from input
|
|
7
|
+
aria-labelledby={`${id}-search-input`} // Option A: label from input
|
|
8
8
|
className='im-c-search-suggestions'
|
|
9
9
|
style={!pluginState.areSuggestionsVisible || !pluginState.suggestions.length ? { display: 'none' } : undefined}
|
|
10
10
|
>
|
|
11
11
|
{pluginState.suggestions.map((suggestion, i) => (
|
|
12
12
|
<li // NOSONAR
|
|
13
|
-
key={suggestion.id}
|
|
13
|
+
key={`${id}-${suggestion.type}-${suggestion.id}`}
|
|
14
14
|
id={`${id}-search-suggestion-${i}`}
|
|
15
15
|
className='im-c-search-suggestions__item'
|
|
16
16
|
role='option' // NOSONAR
|
|
@@ -25,7 +25,7 @@ describe('Suggestions', () => {
|
|
|
25
25
|
render(<Suggestions {...baseProps} />)
|
|
26
26
|
const listbox = screen.getByRole('listbox')
|
|
27
27
|
expect(listbox).toHaveAttribute('id', 'test-search-suggestions')
|
|
28
|
-
expect(listbox).toHaveAttribute('aria-labelledby', 'test-search')
|
|
28
|
+
expect(listbox).toHaveAttribute('aria-labelledby', 'test-search-input')
|
|
29
29
|
expect(listbox.className).toContain('im-c-search-suggestions')
|
|
30
30
|
})
|
|
31
31
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import e from"@babel/runtime/helpers/asyncToGenerator";import t from"@babel/runtime/helpers/defineProperty";import r from"@arcgis/core/config.js";import n from"@arcgis/core/layers/support/TileInfo.js";import a from"@arcgis/core/Map.js";import i from"@arcgis/core/views/MapView.js";import o from"@arcgis/core/layers/VectorTileLayer.js";import s from"@arcgis/core/geometry/Point.js";import{when as m,once as l,watch as u}from"@arcgis/core/core/reactiveUtils.js";import p from"@arcgis/core/geometry/Extent.js";class c{isBaseMapReady(){throw new Error(this.name+" must implement isBaseMapReady()")}}var v={animationDuration:200},y=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom"];var h=(e,t)=>{var r=null,n=function(){for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];clearTimeout(r),r=setTimeout(()=>{e(...a)},t)};return n.cancel=()=>{r&&(clearTimeout(r),r=null)},n};function d(e){var{mapProvider:t,view:r,baseTileLayer:n,events:a,eventBus:i,getZoom:o,getCenter:s,getBounds:p,getResolution:c}=e,v=!1,y=[],d=[],f=e=>{var t=(()=>{if(v||!r||r.destroyed||!r.extent)return null;var{maxZoom:e,minZoom:t}=r.constraints;return{center:s(),bounds:p(),resolution:c(),zoom:o(),isAtMaxZoom:r.zoom+.01>=e,isAtMinZoom:r.zoom-.01<=t}})();t&&i.emit(e,t)};m(()=>n.loaded&&r.resolution>0,()=>f(a.MAP_LOADED)),l(()=>r.ready).then(()=>{v||(t.setBaseMapReady(!0),i.emit(a.MAP_READY,{map:t.map,view:t.view,mapStyleId:t.mapStyleId,mapSize:t.mapSize,crs:t.crs}))}),l(()=>r.stationary).then(()=>f(a.MAP_FIRST_IDLE));var g=h(()=>f(a.MAP_MOVE_END),500);d.push(g),y.push(u(()=>[r.interacting,r.animation],e=>{var[t,r]=e;(t||r)&&i.emit(a.MAP_MOVE_START),t||r||g()}));var w,x,M,b=(w=()=>f(a.MAP_MOVE),x=10,M=0,function(){var e=Date.now();e-M>=x&&(M=e,w(...arguments))});d.push(b),y.push(u(()=>r.zoom,b)),y.push(u(()=>r.extent,()=>i.emit(a.MAP_RENDER),{initial:!1}));var E=h(()=>f(a.MAP_DATA_CHANGE),500);d.push(E),y.push(u(()=>r.updating,e=>!e&&E()));var R=null,A=null;return y.push(r.on("pointer-down",e=>{R=e.x,A=e.y})),y.push(r.on("pointer-up",e=>{var n;if(0===e.button&&!(Math.hypot(e.x-R,e.y-A)>6)&&"active"!==(null===(n=t.sketchViewModel)||void 0===n?void 0:n.state)){var o={x:e.x,y:e.y},s=r.toMap(o);s&&i.emit(a.MAP_CLICK,{point:o,coords:[s.x,s.y]})}})),{remove(){v=!0,d.forEach(e=>e.cancel()),y.forEach(e=>e.remove())}}}var f=e=>e?new p({xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3],spatialReference:{wkid:27700}}):void 0,g=e=>e?new s({x:e[0],y:e[1],spatialReference:{wkid:27700}}):void 0,w=(e,t)=>{if(e)if("FeatureCollection"===e.type)e.features.forEach(e=>w(e,t));else if("Feature"===e.type)w(e.geometry,t);else if("GeometryCollection"===e.type)e.geometries.forEach(e=>w(e,t));else{var r=e=>{Array.isArray(e)&&("number"==typeof e[0]?t.push(e):e.forEach(r))};r(e.coordinates)}},x=e=>{var t=[];w(e,t);var r=t.map(e=>e[0]),n=t.map(e=>e[1]);return f([Math.min(...r),Math.min(...n),Math.max(...r),Math.max(...n)])},M=e=>{var t=1609.344,r=e/t;if(r<.5/t)
|
|
1
|
+
import e from"@babel/runtime/helpers/asyncToGenerator";import t from"@babel/runtime/helpers/defineProperty";import r from"@arcgis/core/config.js";import n from"@arcgis/core/layers/support/TileInfo.js";import a from"@arcgis/core/Map.js";import i from"@arcgis/core/views/MapView.js";import o from"@arcgis/core/layers/VectorTileLayer.js";import s from"@arcgis/core/geometry/Point.js";import{when as m,once as l,watch as u}from"@arcgis/core/core/reactiveUtils.js";import p from"@arcgis/core/geometry/Extent.js";class c{isBaseMapReady(){throw new Error(this.name+" must implement isBaseMapReady()")}}var v={animationDuration:200},y=["showKeyboardHelp","selectControl","moveLarge","nudgeMap","zoomLarge","nudgeZoom"];var h=(e,t)=>{var r=null,n=function(){for(var n=arguments.length,a=new Array(n),i=0;i<n;i++)a[i]=arguments[i];clearTimeout(r),r=setTimeout(()=>{e(...a)},t)};return n.cancel=()=>{r&&(clearTimeout(r),r=null)},n};function d(e){var{mapProvider:t,view:r,baseTileLayer:n,events:a,eventBus:i,getZoom:o,getCenter:s,getBounds:p,getResolution:c}=e,v=!1,y=[],d=[],f=e=>{var t=(()=>{if(v||!r||r.destroyed||!r.extent)return null;var{maxZoom:e,minZoom:t}=r.constraints;return{center:s(),bounds:p(),resolution:c(),zoom:o(),isAtMaxZoom:r.zoom+.01>=e,isAtMinZoom:r.zoom-.01<=t}})();t&&i.emit(e,t)};m(()=>n.loaded&&r.resolution>0,()=>f(a.MAP_LOADED)),l(()=>r.ready).then(()=>{v||(t.setBaseMapReady(!0),i.emit(a.MAP_READY,{map:t.map,view:t.view,mapStyleId:t.mapStyleId,mapSize:t.mapSize,crs:t.crs}))}),l(()=>r.stationary).then(()=>f(a.MAP_FIRST_IDLE));var g=h(()=>f(a.MAP_MOVE_END),500);d.push(g),y.push(u(()=>[r.interacting,r.animation],e=>{var[t,r]=e;(t||r)&&i.emit(a.MAP_MOVE_START),t||r||g()}));var w,x,M,b=(w=()=>f(a.MAP_MOVE),x=10,M=0,function(){var e=Date.now();e-M>=x&&(M=e,w(...arguments))});d.push(b),y.push(u(()=>r.zoom,b)),y.push(u(()=>r.extent,()=>i.emit(a.MAP_RENDER),{initial:!1}));var E=h(()=>f(a.MAP_DATA_CHANGE),500);d.push(E),y.push(u(()=>r.updating,e=>!e&&E()));var R=null,A=null;return y.push(r.on("pointer-down",e=>{R=e.x,A=e.y})),y.push(r.on("pointer-up",e=>{var n;if(0===e.button&&!(Math.hypot(e.x-R,e.y-A)>6)&&"active"!==(null===(n=t.sketchViewModel)||void 0===n?void 0:n.state)){var o={x:e.x,y:e.y},s=r.toMap(o);s&&i.emit(a.MAP_CLICK,{point:o,coords:[s.x,s.y]})}})),{remove(){v=!0,d.forEach(e=>e.cancel()),y.forEach(e=>e.remove())}}}var f=e=>e?new p({xmin:e[0],ymin:e[1],xmax:e[2],ymax:e[3],spatialReference:{wkid:27700}}):void 0,g=e=>e?new s({x:e[0],y:e[1],spatialReference:{wkid:27700}}):void 0,w=(e,t)=>{if(e)if("FeatureCollection"===e.type)e.features.forEach(e=>w(e,t));else if("Feature"===e.type)w(e.geometry,t);else if("GeometryCollection"===e.type)e.geometries.forEach(e=>w(e,t));else{var r=e=>{Array.isArray(e)&&("number"==typeof e[0]?t.push(e):e.forEach(r))};r(e.coordinates)}},x=e=>{var t=[];w(e,t);var r=t.map(e=>e[0]),n=t.map(e=>e[1]);return f([Math.min(...r),Math.min(...n),Math.max(...r),Math.max(...n)])},M=e=>{var t=1609.344,r=e/t;if(r<.5/t){var n=Math.round(e),a=1===n?"metre":"metres";return"".concat(n," ").concat(a)}if(r<10){var i=Number.parseFloat(r.toFixed(1)),o=1===i?"mile":"miles";return"".concat(i," ").concat(o)}var s=Math.round(r),m=1===s?"mile":"miles";return"".concat(s," ").concat(m)};var b={top:0,right:0,bottom:0,left:0};function E(){return(E=e(function*(e,t){if(!e||!t)return[];var r=e.map.layers.filter(e=>e instanceof o);return r.length?(yield e.hitTest(t,{include:r.toArray()})).results.map(e=>({layerId:e.layer.id,layerTitle:e.layer.title||e.layer.id,type:e.layer.type,geometry:e.graphic.geometry,symbol:e.graphic.symbol})):[]})).apply(this,arguments)}function R(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(t){return Object.getOwnPropertyDescriptor(e,t).enumerable})),r.push.apply(r,n)}return r}function A(e){for(var r=1;r<arguments.length;r++){var n=null!=arguments[r]?arguments[r]:{};r%2?R(Object(n),!0).forEach(function(r){t(e,r,n[r])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(n)):R(Object(n)).forEach(function(t){Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))})}return e}class T extends c{constructor(e){var{mapProviderConfig:r={},events:n,eventBus:a}=e;super(),t(this,"_isBaseMapReady",!1),this.events=n,this.eventBus=a,this.capabilities={supportedShortcuts:y,supportsMapSizes:!1},Object.assign(this,r),this.mapEventHandles=[],this.appEventHandles=[]}get name(){return"EsriProvider"}initMap(t){var s=this;return e(function*(){var{container:e,padding:m,mapStyle:l,mapSize:u,maxExtent:p}=t;s.mapStyleId=null==l?void 0:l.id,s.mapSize=u;var{events:c,eventBus:v}=s;s.setupConfig&&(yield s.setupConfig(r));var y=new o({id:"baselayer",url:l.url,visible:!0}),h=new a({layers:[y]}),w=p?f(p):null,x=new i({spatialReference:27700,container:e,map:h,zoom:t.zoom,center:g(t.center),maxExtent:p,constraints:{lods:n.create({spatialReference:{wkid:27700}}).lods,snapToZoom:!1,minZoom:t.minZoom,maxZoom:t.maxZoom,maxScale:0,geometry:w,rotationEnabled:!1},ui:{components:[]},popupEnabled:!1});(e=>{if(e){var t=e.querySelector(".esri-view-surface");t.removeAttribute("role"),t.tabIndex=-1,t.style["outline-color"]="transparent",t.style.touchAction="none"}})(x.container),x.padding=m,t.bounds&&x.when(()=>x.goTo(f(t.bounds),{duration:0})),s.mapEventHandles=d({mapProvider:s,view:x,baseTileLayer:y,events:c,eventBus:v,getZoom:s.getZoom.bind(s),getCenter:s.getCenter.bind(s),getBounds:s.getBounds.bind(s),getResolution:s.getResolution.bind(s)}),s.appEventHandles=function(e){var{baseTileLayer:t,events:r,eventBus:n}=e,a=e=>{t.loadStyle(e.url).then(()=>{n.emit(r.MAP_STYLE_CHANGE,{mapStyleId:e.id})})};return n.on(r.MAP_SET_STYLE,a),{remove(){n.off(r.MAP_SET_STYLE,a)}}}({baseTileLayer:y,events:c,eventBus:v})||[],s.map=h,s.view=x,s.baseTileLayer=y})()}setBaseMapReady(e){this._isBaseMapReady=e}isBaseMapReady(){return this._isBaseMapReady}destroyMap(){var e,t;null===(e=this.mapEvents)||void 0===e||e.remove(),null===(t=this.appEvents)||void 0===t||t.remove(),this.mapEvents=null,this.appEvents=null,this.view&&(this.view.container=null,this.view.destroy(),this.view=null),this.map&&(this.map.removeAll(),this.map=null)}setView(e){var t,{center:r,zoom:n}=e;null===(t=this.view.animation)||void 0===t||t.destroy();var a={center:r?new s({x:r[0],y:r[1],spatialReference:{wkid:27700}}):this.view.center,zoom:null!=n?n:this.view.zoom};this.view.goTo(A(A({},a),{},{duration:v.animationDuration}))}zoomIn(e){var t;null===(t=this.view.animation)||void 0===t||t.destroy(),this.view.goTo({zoom:this.view.zoom+e,duration:v.animationDuration})}zoomOut(e){var t;null===(t=this.view.animation)||void 0===t||t.destroy(),this.view.goTo({zoom:this.view.zoom-e,duration:v.animationDuration})}panBy(e){var{x:t,y:r}=this.view.toScreen(this.view.center),n={x:t+e[0],y:r+e[1]},a=this.view.toMap(n);this.view.goTo({center:a,duration:v.animationDuration})}fitToBounds(e){var t=Array.isArray(e)?f(e):x(e);this.view.goTo(t,{duration:v.DELAY})}setPadding(e){this.view.padding=e}getCenter(){var e=this.view.center;return[e.x,e.y].map(e=>Math.round(100*e)/100)}getZoom(){return this.view.zoom}getBounds(){var{xmin:e,ymin:t,xmax:r,ymax:n}=this.view.extent;return[e,t,r,n].map(e=>Math.round(100*e)/100)}getFeaturesAtPoint(e,t){return function(e,t){return E.apply(this,arguments)}(this.view,e)}getVisibleFeatures(e){return[]}getAreaDimensions(){return(e=>{if(!(e&&e instanceof p))return"";var t=e.xmin,r=e.ymin,n=e.xmax,a=e.ymax-r,i=M(n-t),o=M(a);return"".concat(o," by ").concat(i)})(function(e){var t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:b;if(!e.container)return null;var{width:r,height:n}=e.container.getBoundingClientRect(),a={x:t.left,y:n-t.bottom},i={x:r-t.right,y:t.top},o=e.toMap(a),s=e.toMap(i);return new p({xmin:o.x,ymin:o.y,xmax:s.x,ymax:s.y,spatialReference:o.spatialReference})}(this.view))}getCardinalMove(e,t){return function(e,t){var[r,n]=e,[a,i]=t,o=a-r,s=i-n,m=[];return Math.abs(s)>.1&&m.push("".concat(s>0?"north":"south"," ").concat(M(Math.abs(s)))),Math.abs(o)>.1&&m.push("".concat(o>0?"east":"west"," ").concat(M(Math.abs(o)))),m.join(", ")}(e,t)}getResolution(){return this.view.resolution}mapToScreen(e){var t=g(e),r=this.view.toScreen(t);return{x:r.x,y:r.y}}screenToMap(e){var t=this.view.toMap(e);return[t.x,t.y]}isGeometryObscured(e,t){return((e,t,r)=>{if(null==r||!r.container)return!1;var n=r.container.getBoundingClientRect(),a=x(e),i=[r.toScreen(new s({x:a.xmin,y:a.ymin,spatialReference:a.spatialReference})),r.toScreen(new s({x:a.xmin,y:a.ymax,spatialReference:a.spatialReference})),r.toScreen(new s({x:a.xmax,y:a.ymin,spatialReference:a.spatialReference})),r.toScreen(new s({x:a.xmax,y:a.ymax,spatialReference:a.spatialReference}))],o=Math.min(...i.map(e=>e.x)),m=Math.max(...i.map(e=>e.x)),l=Math.min(...i.map(e=>e.y)),u=Math.max(...i.map(e=>e.y)),p=t.left-n.left,c=t.top-n.top,v=t.right-n.left,y=t.bottom-n.top;return o<v&&m>p&&l<y&&u>c})(e,t,this.view)}}export{T as default};
|
|
@@ -7,17 +7,19 @@ import { getBboxFromGeoJSON } from './coords.js'
|
|
|
7
7
|
// -----------------------------------------------------------------------------
|
|
8
8
|
|
|
9
9
|
/**
|
|
10
|
-
* Format dimension,
|
|
10
|
+
* Format dimension, metres if less than 0.5 miles, otherwise miles
|
|
11
11
|
*/
|
|
12
|
-
const formatDimension = (
|
|
12
|
+
const formatDimension = (metres) => {
|
|
13
13
|
const WHOLE_MILE_THRESHOLD = 10
|
|
14
14
|
const MILE_THRESHOLD = 0.5
|
|
15
|
-
const
|
|
15
|
+
const METRES_PER_MILE = 1609.344
|
|
16
16
|
|
|
17
|
-
const miles =
|
|
17
|
+
const miles = metres / METRES_PER_MILE
|
|
18
18
|
|
|
19
|
-
if (miles < MILE_THRESHOLD /
|
|
20
|
-
|
|
19
|
+
if (miles < MILE_THRESHOLD / METRES_PER_MILE) {
|
|
20
|
+
const roundedMetres = Math.round(metres)
|
|
21
|
+
const units = roundedMetres === 1 ? 'metre' : 'metres'
|
|
22
|
+
return `${roundedMetres} ${units}`
|
|
21
23
|
}
|
|
22
24
|
|
|
23
25
|
if (miles < WHOLE_MILE_THRESHOLD) {
|
|
@@ -37,7 +39,7 @@ const formatDimension = (meters) => {
|
|
|
37
39
|
|
|
38
40
|
/**
|
|
39
41
|
* Returns a string like "height by width" for an Esri Extent in 27700
|
|
40
|
-
* @param {Extent} extent - The Esri extent (projected in
|
|
42
|
+
* @param {Extent} extent - The Esri extent (projected in metres)
|
|
41
43
|
* @returns {string}
|
|
42
44
|
*/
|
|
43
45
|
const getAreaDimensions = (extent) => {
|
|
@@ -51,12 +53,12 @@ const getAreaDimensions = (extent) => {
|
|
|
51
53
|
const north = extent.ymax
|
|
52
54
|
|
|
53
55
|
// Width: west <-> east
|
|
54
|
-
const
|
|
56
|
+
const widthMetres = east - west
|
|
55
57
|
// Height: south <-> north
|
|
56
|
-
const
|
|
58
|
+
const heightMetres = north - south
|
|
57
59
|
|
|
58
|
-
const widthLabel = formatDimension(
|
|
59
|
-
const heightLabel = formatDimension(
|
|
60
|
+
const widthLabel = formatDimension(widthMetres)
|
|
61
|
+
const heightLabel = formatDimension(heightMetres)
|
|
60
62
|
|
|
61
63
|
return `${heightLabel} by ${widthLabel}`
|
|
62
64
|
}
|
|
@@ -64,7 +66,7 @@ const getAreaDimensions = (extent) => {
|
|
|
64
66
|
/**
|
|
65
67
|
* Generate a cardinal direction move description for projected coordinates (e.g., EPSG:27700)
|
|
66
68
|
* Only non-zero moves are announced.
|
|
67
|
-
* Example: "north
|
|
69
|
+
* Example: "north 400 metres", "east 750 metres", or "south 400 metres, west 750 metres"
|
|
68
70
|
* @param {number[]} from - [easting, northing]
|
|
69
71
|
* @param {number[]} to - [easting, northing]
|
|
70
72
|
* @returns {string}
|
|
@@ -78,7 +80,7 @@ function getCardinalMove (from, to) {
|
|
|
78
80
|
|
|
79
81
|
const moves = []
|
|
80
82
|
|
|
81
|
-
// Threshold to ignore tiny movements (in
|
|
83
|
+
// Threshold to ignore tiny movements (in metres)
|
|
82
84
|
const THRESHOLD = 0.1
|
|
83
85
|
|
|
84
86
|
if (Math.abs(dY) > THRESHOLD) {
|