1"use strict";(self.__LOADABLE_LOADED_CHUNKS__=self.__LOADABLE_LOADED_CHUNKS__||[]).push([[2808],{64615:(e,t,n)=>{n.r(t),n.d(t,{default:()=>$});var o={};n.r(o),n.d(o,{CURRENT_LOCATION_ID:()=>O,GeocoderAttribution:()=>G,default:()=>K});var s={};n.r(s),n.d(s,{CURRENT_LOCATION_ID:()=>U,GeocoderAttribution:()=>W,default:()=>z});var i=n(89379),c=n(65043),r=n(98139),l=n.n(r),a=n(93950),d=n.n(a),h=n(63775),u=n(24141),p=(n(44356),n(18689));const g="LocationAutocompleteInput_root__P1ovG",m="LocationAutocompleteInput_icon__f-F0V",w="LocationAutocompleteInput_iconSvg__uTJlN",P="LocationAutocompleteInput_iconSvgGroup__UyK4b",f="LocationAutocompleteInput_iconSpinner__ODGWz",_="LocationAutocompleteInput_input__+5l0M",S="LocationAutocompleteInput_predictionsRoot__lR3E0",x="LocationAutocompleteInput_predictionsRootGoogle__T0BCK",v="LocationAutocompleteInput_predictionsRootMapbox__Xdsld",L="LocationAutocompleteInput_poweredByGoogle__3Hwy8",I="LocationAutocompleteInput_predictions__caeqM marketplaceBodyFontStyles",y="LocationAutocompleteInput_highlighted__J-WBN",A="LocationAutocompleteInput_currentLocation__0L622 p",N="LocationAutocompleteInput_currentLocationIcon__57FqY";var b=n(70579);const C=()=>(0,b.jsx)("svg",{className:w,width:"21",height:"22",viewBox:"0 0 21 22",xmlns:"http://www.w3.org/2000/svg",children:(0,b.jsxs)("g",{className:P,transform:"matrix(-1 0 0 1 20 1)",strokeWidth:"2",fill:"none",fillRule:"evenodd",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,b.jsx)("path",{d:"M13 14l5.241 5.241"}),(0,b.jsx)("circle",{cx:"7.5",cy:"7.5",r:"7.5"})]})}),D=()=>(0,b.jsx)("svg",{className:N,width:"12",height:"12",xmlns:"http://www.w3.org/2000/svg",children:(0,b.jsx)("path",{d:"M11.9269636.07279915c-.0779984-.0770013-.1959959-.0950016-.2924939-.04400074L.13470842 6.02889945c-.10199788.05300089-.15499678.16900284-.12749735.28100473.02799942.11150188.12799734.1900032.24299496.1900032h5.249891v5.25008842c0 .1150019.07899836.2160036.19049604.2430041C5.71009267 11.998 5.73059224 12 5.75009184 12c.0914981 0 .1779963-.0505009.22199539-.1345023L11.9719627.36530407c.0499989-.09650162.0319993-.21500362-.0449991-.29250492",fill:"#FFF",fillRule:"evenodd"})});var T=n(55346),E=n(63690);const{LatLng:M,LatLngBounds:k}=T.gK,O="current-location",j={address:500,country:2e3,region:2e3,postcode:2e3,district:2e3,place:2e3,locality:2e3,neighborhood:2e3,poi:2e3,"poi.landmark":2e3},B=(e,t)=>{if(!e)return null;const n=new window.mapboxgl.LngLat(e.lng,e.lat).toBounds(t);return new k(new M(n.getNorth(),n.getEast()),new M(n.getSouth(),n.getWest()))},R=e=>e&&Array.isArray(e.center)&&2===e.center.length?new M(e.center[1],e.center[0]):null,F=e=>{if(e){if(Array.isArray(e.bbox)&&4===e.bbox.length)return new k(new M(e.bbox[3],e.bbox[2]),new M(e.bbox[1],e.bbox[0]));{const t=Array.isArray(e.place_type)&&e.place_type[0],n=t&&j[t]||500;return B(R(e),n)}}return null},G=()=>null;const K=class{getClient(){if(!("undefined"!==typeof window&&window.mapboxgl&&window.mapboxSdk))throw new Error("Mapbox libraries are required for GeocoderMapbox");return this._client||(this._client=window.mapboxSdk({accessToken:window.mapboxgl.accessToken})),this._client}getPlacePredictions(e,t,n){const o=t?{countries:t}:{};return this.getClient().geocoding.forwardGeocode((0,i.A)((0,i.A)({query:e,limit:5},o),{},{language:[n]})).send().then((t=>({search:e,predictions:t.body.features})))}getPredictionId(e){return e.id}getPredictionAddress(e){return e.predictionPlace?e.predictionPlace.address:e.place_name}getPlaceDetails(e,t){return this.getPredictionId(e)===O?(0,E.hI)().then((e=>({address:"",origin:e,bounds:B(e,t)}))):e.predictionPlace?Promise.resolve(e.predictionPlace):Promise.resolve({address:this.getPredictionAddress(e),origin:R(e),bounds:F(e)})}};var H=n(17985);const U="current-location",W=e=>{const{rootClassName:t,className:n}=e,o=l()(t||L,n);return(0,b.jsx)("div",{className:o})};const z=class{constructor(){this.sessionToken=null}getSessionToken(){return this.sessionToken=this.sessionToken||new window.google.maps.places.AutocompleteSessionToken,this.sessionToken}getPlacePredictions(e,t){const n=t?{componentRestrictions:{country:t}}:{};
1return H.wJ(e,this.getSessionToken(),n).then((t=>({search:e,predictions:t.predictions})))}getPredictionId(e){return e.predictionPlace?e.id:e.place_id}getPredictionAddress(e){return e.predictionPlace?e.predictionPlace.address:e.description}getPlaceDetails(e,t){return this.getPredictionId(e)===U?(0,E.hI)().then((e=>({address:"",origin:e,bounds:H.JR(e,t)}))):e.predictionPlace?Promise.resolve(e.predictionPlace):H.ag(e.place_id,this.getSessionToken()).then((e=>(this.sessionToken=null,e)))}},J="down",q=e=>{const t=e&&e.changedTouches?e.changedTouches[0]:null;return t?{x:t.screenX,y:t.screenY}:null},Q=e=>"googleMaps"===e?s:o,X=e=>{const{rootClassName:t,className:n,children:o,predictions:s,currentLocationId:i,geocoder:c,isGoogleMapsInUse:r,highlightedIndex:a,onSelectStart:d,onSelectMove:h,onSelectEnd:p}=e;if(0===s.length)return null;const g=r?x:v,m=l()(t||S,g,n);return(0,b.jsxs)("div",{className:m,children:[(0,b.jsx)("ul",{className:I,children:s.map(((e,t)=>{const n=t===a,o=c.getPredictionId(e);return(0,b.jsx)("li",{className:n?y:null,onTouchStart:e=>{e.preventDefault(),d(q(e.nativeEvent))},onMouseDown:e=>{e.preventDefault(),d()},onTouchMove:e=>{e.preventDefault(),h(q(e.nativeEvent))},onTouchEnd:t=>{t.preventDefault(),p(e)},onMouseUp:t=>{t.preventDefault(),p(e)},children:o===i?(0,b.jsxs)("span",{className:A,children:[(0,b.jsx)(D,{}),(0,b.jsx)(u.sA,{id:"LocationAutocompleteInput.currentLocation"})]}):c.getPredictionAddress(e)},o)}))}),o]})};X.defaultProps={rootClassName:null,className:null,highlightedIndex:null};const Y=e=>{const t=e.input.value||{},{search:n="",predictions:o=[],selectedPlace:s=null}=t;return{search:n,predictions:o,selectedPlace:s}};class V extends c.Component{constructor(e){super(e),this._isMounted=!1,this.state={inputHasFocus:!1,selectionInProgress:!1,touchStartedFrom:null,highlightedIndex:-1,fetchingPlaceDetails:!1,fetchingPredictions:!1},this.input=null,this.shortQueryTimeout=null,this.getGeocoder=this.getGeocoder.bind(this),this.currentPredictions=this.currentPredictions.bind(this),this.changeHighlight=this.changeHighlight.bind(this),this.selectPrediction=this.selectPrediction.bind(this),this.selectItemIfNoneSelected=this.selectItemIfNoneSelected.bind(this),this.onKeyDown=this.onKeyDown.bind(this),this.onChange=this.onChange.bind(this),this.handleOnBlur=this.handleOnBlur.bind(this),this.handlePredictionsSelectStart=this.handlePredictionsSelectStart.bind(this),this.handlePredictionsSelectMove=this.handlePredictionsSelectMove.bind(this),this.handlePredictionsSelectEnd=this.handlePredictionsSelectEnd.bind(this),this.finalizeSelection=this.finalizeSelection.bind(this),this.predict=d()(this.predict.bind(this),300,{leading:!0})}componentDidMount(){this._isMounted=!0}componentWillUnmount(){window.clearTimeout(this.shortQueryTimeout),this._isMounted=!1}getGeocoder(){const e=Q(this.props.config.maps.mapProvider).default;return this._geocoder||(this._geocoder=new e),this._geocoder}currentPredictions(){const{search:e,predictions:t}=Y(this.props),{useDefaultPredictions:n,config:o}=this.props,s=t&&t.length>0,i=!e&&!s&&n,c=Q(o.maps.mapProvider),r=(o.maps.search.suggestCurrentLocation?[{id:c.CURRENT_LOCATION_ID,predictionPlace:{}}]:[]).concat(o.maps.search.defaults);return i?r:t}onKeyDown(e){if(38===e.keyCode)e.preventDefault(),this.changeHighlight("up");else if(40===e.keyCode)e.preventDefault(),this.changeHighlight(J);else if(13===e.keyCode){const{selectedPlace:t}=Y(this.props);t||(e.preventDefault(),e.stopPropagation(),this.selectItemIfNoneSelected(),this.input.blur())}else 9===e.keyCode?(this.selectItemIfNoneSelected(),this.input.blur()):27===e.keyCode&&this.input&&this.input.blur()}onChange(e){const t=this.props.input.onChange,n=this.currentPredictions(),o=e.target.value;t({search:o,predictions:o?n:[],selectedPlace:null}),this.setState({highlightedIndex:-1}),o&&(o.length>=3?(this.shortQueryTimeout&&window.clearTimeout(this.shortQueryTimeout),this.predict(o)):this.shortQueryTimeout=window.setTimeout((()=>{this.predict(o)}),1e3))}changeHighlight(e){this.setState(((t,n)=>{const o=this.currentPredictions(),s=t.highlightedIndex;let i=s;return"up"===e?i=0===s?0:s-1:e===J&&(i=s+1),i<0?i=-1:i>=o.length&&(i=o.length-1),{highlightedIndex:i}}))}selectPrediction(e){var t,n;const o=null===(t=this.props.config.maps)||void 0===t||null===(n=t.search)||void 0===n?void 0:n.currentLocationBoundsDistance;this.props.input.onChange((0,i.A)((0,i.A)({},this.props.input),{},{selectedPlace:null})),this.setState({fetchingPlaceDetails:!0}),this.getGeocoder().getPlaceDetails(e,o).then((e=>{this._isMounted&&(this.setState({fetchingPlaceDetails:!1}),this.props.input.onChange({search:e.address,predictions:[],selectedPlace:e}))})).catch((e=>{this.setState({fetchingPlaceDetails:!1}),console.error(e),this.props.input.onChange((0,i.A)((0,i.A)({},this.props.input.value),{},{selectedPlace:null}))}))}selectItemIfNoneSelected(){if(this.state.fetchingPredictions)return;const{search:e,selectedPlace:t}=Y(this.props),n=this.currentPredictions();if(!t)if(n&&n.length>0){const e=-1!==this.state.highlightedIndex?this.state.highlightedIndex:0;this.selectPrediction(n[e])}else this.predict(e)}predict(e){const t=this.props.config,n=this.props.input.onChange;return this.setState({fetchingPredictions:!0}),this.getGeocoder().getPlacePredictions(e,t.maps.search.countryLimit,t.localization.locale).then((e=>{const{search:t}=Y(this.props);this.setState({fetchingPredictions:!1}),e.search===t&&n({search:e.search,predictions:e.predictions,selectedPlace:null})})).catch((e=>{this.setState({fetchingPredictions:!1}),console.error(e);const t=Y(this.props);n((0,i.A)((0,i.A)({},t),{},{selectedPlace:null}))}))}finalizeSelection(){this.setState({inputHasFocus:!1,highlightedIndex:-1}),this.props.input.onBlur(Y(this.props))}handleOnBlur(){this.props.closeOnBlur&&!this.state.selectionInProgress&&this.finalizeSelection()}handlePredictionsSelectStart(e){this.setState({selectionInProgress:!0,touchStartedFrom:e,isSwipe:!1})}handlePredictionsSelectMove(e){this.setState((t=>{const n=t.touchStartedFrom;return{selectionInProgress:!1,isSwipe:!!!!n&&Math.abs(n.y-e.y)>5}}))}handlePredictionsSelectEnd(e){let t=!1;this.setState((e=>(e.isSwipe||(t=!0),{selectionInProgress:!1,touchStartedFrom:null,isSwipe:!1})),(()=>{t&&(this.selectPrediction(e),this.finalizeSelection())}))}render(){const{autoFocus:e,rootClassName:t,className:n,iconClassName:o,inputClassName:s,predictionsClassName:i,predictionsAttributionClassName:c,validClassName:r,placeholder:a,input
1:d,meta:h,inputRef:u,disabled:w,config:P}=this.props,{name:S,onFocus:x}=d,{search:v}=Y(this.props),{touched:L,valid:I}=h||{},y=I&&L,A=this.currentPredictions(),N=l()(t||g,n),D=l()(o||m),T=l()(s||_,{[r]:y}),E=l()(i),M=this.state.inputHasFocus,k=Q(P.maps.mapProvider),O=k.GeocoderAttribution;return(0,b.jsxs)("div",{className:N,children:[(0,b.jsx)("div",{className:D,children:this.state.fetchingPlaceDetails?(0,b.jsx)(p.X1,{className:f}):(0,b.jsx)(C,{})}),(0,b.jsx)("input",{className:T,type:"search",autoComplete:"off",autoFocus:e,placeholder:a,name:S,value:v,disabled:w||this.state.fetchingPlaceDetails,onFocus:e=>{this.setState({inputHasFocus:!0}),x(e)},onBlur:this.handleOnBlur,onChange:this.onChange,onKeyDown:this.onKeyDown,ref:e=>{this.input=e,u&&u(e)},title:v,"data-testid":"location-search"}),M?(0,b.jsx)(X,{rootClassName:E,predictions:A,currentLocationId:k.CURRENT_LOCATION_ID,isGoogleMapsInUse:"googleMaps"===P.maps.mapProvider,geocoder:this.getGeocoder(),highlightedIndex:this.state.highlightedIndex,onSelectStart:this.handlePredictionsSelectStart,onSelectMove:this.handlePredictionsSelectMove,onSelectEnd:this.handlePredictionsSelectEnd,children:(0,b.jsx)(O,{className:c})}):null]})}}const Z=e=>{const t=(0,h._r)();return(0,b.jsx)(V,(0,i.A)({config:t},e))};Z.defaultProps={autoFocus:!1,closeOnBlur:!0,rootClassName:null,className:null,iconClassName:null,inputClassName:null,predictionsClassName:null,predictionsAttributionClassName:null,validClassName:null,placeholder:"",useDefaultPredictions:!0,meta:null,inputRef:null};const $=Z},17985:(e,t,n)=>{n.d(t,{$q:()=>p,JR:()=>h,ag:()=>a,m:()=>u,wJ:()=>d});var o=n(89379),s=n(55346);const{LatLng:i,LatLngBounds:c}=s.gK,r=e=>e&&e.geometry&&e.geometry.location?new i(e.geometry.location.lat(),e.geometry.location.lng()):null,l=e=>{if(e&&e.geometry&&e.geometry.viewport){const t=e.geometry.viewport.getNorthEast(),n=e.geometry.viewport.getSouthWest
1();return new c(new i(t.lat(),t.lng()),new i(n.lat(),n.lng()))}return null},a=(e,t)=>new Promise(((n,s)=>{const i=window.google.maps.places.PlacesServiceStatus,c=document.createElement("div"),a=new window.google.maps.places.PlacesService(c),d=t?{sessionToken:t}:{};a.getDetails((0,o.A)({placeId:e,fields:["address_component","formatted_address","geometry","place_id"]},d),((t,o)=>{o!==i.OK?s(new Error('Could not get details for place id "'.concat(e,'", error status was "').concat(o,'"'))):n({address:t.formatted_address,origin:r(t),bounds:l(t)})}))})),d=(e,t,n)=>new Promise(((s,i)=>{const c=new window.google.maps.places.AutocompleteService,r=t?{sessionToken:t}:{};c.getPlacePredictions((0,o.A)((0,o.A)({input:e},r),n),((t,n)=>{if((e=>{const{OK:t,ZERO_RESULTS:n}=window.google.maps.places.PlacesServiceStatus;return e===t||e===n})(n)){s({search:e,predictions:t||[]})}else i(new Error("Prediction service status not OK: ".concat(n)))}))})),h=(e,t)=>{const n=new window.google.maps.Circle({center:new window.google.maps.LatLng(e.lat,e.lng),radius:t}
1).getBounds(),o=n.getNorthEast(),s=n.getSouthWest();return new c(new i(o.lat(),o.lng()),new i(s.lat(),s.lng()))},u=(e,t)=>{const{getPixelPositionOffset:n}=t;return"function"===typeof n?n(e.offsetWidth,e.offsetHeight):{}},p=(e,t,n)=>{const o=(e,t)=>new t(e.lat,e.lng),s=(e,t)=>new t(new window.google.maps.LatLng(e.ne.lat,e.ne.lng),new window.google.maps.LatLng(e.sw.lat,e.sw.lng)),i=(e,t,n)=>e instanceof t?e:n(e,t);if(n.bounds){return((e,t,n)=>{const o=e.fromLatLngToDivPixel(n.getNorthEast()),s=e.fromLatLngToDivPixel(n.getSouthWest());return o&&s?{left:"".concat(s.x+t.x,"px"),top:"".concat(o.y+t.y,"px"),width:"".concat(o.x-s.x-t.x,"px"),height:"".concat(s.y-o.y-t.y,"px")}:{left:"-9999px",top:"-9999px"}})(e,t,i(n.bounds,window.google.maps.LatLngBounds,s))}return((e,t,n)=>{const o=e.fromLatLngToDivPixel(n);if(o){const{x:e,y:n}=o;return{left:"".concat(e+t.x,"px"),top:"".concat(n+t.y,"px")}}return{left:"-9999px",top:"-9999px"}})(e,t,i(n.position,window.google.maps.LatLng,o))}}}]); 2//# sourceMappingURL=LocationAutocompleteInputImpl.726b2d71.chunk.js.map
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.