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ions/SearchAddressActions.js","webpack://@whistleout/webui/./Areas/Shared/React/js/utils/AddressHelper.js","webpack://@whistleout/webui/./Areas/Shared/React/js/components/Popover.tsx","webpack://@whistleout/webui/./Areas/Shared/React/js/components/addressSearch/StateNames.js","webpack://@whistleout/webui/./Areas/Shared/React/js/components/addressSearch/AddressAutocomplete.tsx","webpack://@whistleout/webui/./Areas/Shared/React/js/components/addressSearch/TomtomGeocodeService.js","webpack://@whistleout/webui/./Areas/Shared/React/js/components/addressSearch/MessageLabel.tsx","webpack://@whistleout/webui/./Areas/Shared/React/js/components/addressSearch/AddressSearch.tsx"],"sourcesContent":["import { actions } from '../../../js/redux/sharedSlice';\nimport { dispatch } from '../../../js/redux/store';\n\nconst onAddressCookieInit = address =>\n dispatch(\n actions.addressCookieInit({\n address: JSON.parse(address)\n })\n );\n\nexport default class SearchAddressActions {\n static setAddressCookie(value) {\n if (typeof window === 'undefined' || !window || !wo$) {\n return;\n }\n\n if (!value) {\n Cookies.set('address', null, { path: '/', expires: -1 });\n return;\n }\n\n const newValue = JSON.stringify({\n placeId: value.placeId,\n label: value.label,\n latitude: value.latitude,\n longitude: value.longitude,\n unit: value.unit,\n streetNumber: value.streetNumber,\n street: value.street,\n city: value.city,\n state: value.state,\n postcode: value.postcode,\n types: value.types,\n partialMatch: value.partialMatch\n });\n\n const current = window.Cookies.get('address');\n if (newValue === current) {\n onAddressCookieInit(current);\n return;\n }\n\n Cookies.set('address', newValue, { path: '/', expires: 1 });\n onAddressCookieInit(newValue);\n }\n\n static invalidateAddressCookie(value) {\n if (typeof window === 'undefined' || !window || !wo$) {\n return;\n }\n\n if (!value) {\n Cookies.set('address', null, { path: '/', expires: -1 });\n return;\n }\n\n const current = window.Cookies.get('address');\n if (current) {\n const currentValue = JSON.parse(current);\n if (currentValue && currentValue.label !== value) {\n Cookies.set('address', null, { path: '/', expires: -1 });\n }\n }\n }\n}\n","export default class AddressHelper {\n\n static isEqual(a, b) {\n if (a === b) return true;\n\n const labelA = a ? a.label : null;\n const labelB = b ? b.label : null;\n\n if (labelA === labelB) return true;\n\n // Unable to use placeId from Mapbox, because it is not unique\n // For example, 115 and 116 Alexander St Crows Nest have the same Id in mapbox\n\n // const placeIdA = a ? a.placeId : null;\n // const placeIdB = b ? b.placeId : null;\n\n // if (placeIdA == placeIdB) return true;\n }\n\n static cleanUpFormattedAddress(str, components) {\n if (!str) {\n return '';\n }\n\n const parts = str.split(', ');\n if (parts.length < 2) {\n return str;\n }\n\n // Remove country name\n const country = parts[parts.length - 1];\n let res = str.substring(0, str.indexOf(`, ${country}`));\n\n // Remove location name\n const locationName = parts[0];\n if (components.locationName && (\n locationName === components.locationName.long_name\n || locationName === components.locationName.short_name\n )) {\n res = res.substring(`${locationName}, `.length, res.length);\n }\n\n return res;\n }\n\n static map(gmaps, appCountry) {\n if (!gmaps || !gmaps.place_id) {\n return null;\n }\n\n const location = {\n lat: gmaps.geometry.location.lat(),\n lng: gmaps.geometry.location.lng()\n };\n\n const components = this.getAddressComponentDictionary(gmaps.address_components);\n const res = {\n placeId: gmaps.place_id,\n latitude: location.lat,\n longitude: location.lng,\n unit: this.mapAddressComponent(components.unit),\n streetNumber: this.mapAddressComponent(components.streetNumber),\n street: this.mapAddressComponent(components.street),\n city: this.mapAddressComponent(components.city),\n state: this.mapAddressComponent(components.state),\n postcode: this.mapAddressComponent(components.postcode),\n country: this.mapAddressComponent(components.country),\n types: gmaps.types,\n partialMatch: gmaps.partial_match\n };\n if (!res.city) {\n res.city = this.mapAddressComponent(components.colloquial);\n }\n this.FixGMapsComponents(res, appCountry);\n res.label = this.getLabel(res);\n return res;\n }\n\n static FixGMapsComponents(address, appCountry) {\n // Set the state in case it's not correctly defined by Google.\n // For example some territories in Australia: Christams Island, Cocos Island, Norfolk Island\n if (this.isOtherState(appCountry, (address.country || {}).shortName)) {\n if (!address.city) {\n address.city = address.country;\n }\n if (!address.state) {\n address.state = {\n shortName: null,\n longName: null\n };\n }\n address.country = {\n shortName: appCountry.toUpperCase(),\n longName: this.getCountryLongName(appCountry)\n };\n }\n this.FixForJbt(address, appCountry);\n }\n\n static FixForJbt(address, appCountry) {\n if (appCountry.toUpperCase() === 'AU' && address.state &&\n address.state.shortName && address.state.shortName.toUpperCase() === 'JBT') {\n address.state = {\n shortName: 'NSW',\n longName: null\n };\n address.postcode = {\n shortName: '2540',\n longName: '2540'\n };\n if (address.placeId === 'ChIJRWcFsaSIFGsR8NZDkLQJBgQ') {\n address.city = {\n shortName: 'Jervis Bay',\n longName: 'Jervis Bay'\n };\n }\n }\n if (appCountry.toUpperCase() === 'AU' && address.placeId === 'ChIJCz4U9E2OFGsRFI-_VVoFsaE') {\n address.state = {\n shortName: 'NSW',\n longName: null\n };\n address.postcode = {\n shortName: '2540',\n longName: '2540'\n };\n address.latitude = -35.149092;\n address.longitude = 150.69611540000005;\n }\n\n }\n\n static getLabel(address) {\n if (!address) {\n return '';\n }\n\n if (\n !address.unit\n && !address.streetNumber\n && !address.street\n && !address.city\n && !address.postcode\n ) {\n return address.state\n ? this.getComponentValue(address.state)\n : this.getComponentValue(address.country);\n }\n\n const isNullOrWhiteSpace = p => !p || p.trim() === '';\n\n let label = '';\n const appendWithSpaceIfNeeded = p => {\n if (!isNullOrWhiteSpace(p)) {\n if (!isNullOrWhiteSpace(label)) {\n label += ' ';\n }\n label += p;\n }\n };\n\n if (address.unit) {\n label += this.getComponentValue(address.unit);\n }\n\n if (address.streetNumber) {\n if (!isNullOrWhiteSpace(label)) {\n label += '/';\n }\n label += this.getComponentValue(address.streetNumber);\n }\n\n appendWithSpaceIfNeeded(this.getComponentValue(address.street, true));\n\n if (!isNullOrWhiteSpace(label)) {\n label += ',';\n }\n\n appendWithSpaceIfNeeded(this.getComponentValue(address.city));\n appendWithSpaceIfNeeded(this.getComponentValue(address.state, true));\n appendWithSpaceIfNeeded(this.getComponentValue(address.postcode));\n\n return label;\n }\n\n static getComponentValue(component, preferShorter) {\n if (!component)\n return '';\n if (preferShorter === true && component.shortName && component.shortName.length > 0)\n return component.shortName;\n return component.longName;\n }\n\n static handleCountryName(gmaps, components) {\n const country = components.country;\n const countryName = country.long_name || this.getCountryLongName(country.short_name);\n // HACK: Sometimes the 'formatted_address' value returned by Google only has the country name\n // so we use the 'name' property instead\n return gmaps.formatted_address === countryName && gmaps.name !== countryName\n ? gmaps.name\n : gmaps.formatted_address;\n }\n\n static getCountryLongName(shortName) {\n if (shortName.toLowerCase() === 'au') {\n return 'Australia';\n }\n if (shortName.toLowerCase() === 'ca') {\n return 'Canada';\n }\n if (shortName.toLowerCase() === 'us') {\n return 'United States';\n }\n }\n\n static removeUnitName(formattedAddress, components) {\n var regex = new RegExp(`(${components.unit.long_name})[\\\\s|-|/]+`);\n return formattedAddress.replace(regex, '');\n }\n\n // See https://developers.google.com/maps/documentation/geocoding/intro#Types\n static getAddressComponentType(types) {\n if (types.indexOf('colloquial_area') > -1) {\n return 'colloquial';\n }\n\n if (types.indexOf('premise') > -1) {\n return 'locationName';\n }\n\n if (types.indexOf('subpremise') > -1) {\n return 'unit';\n }\n\n if (types.indexOf('street_number') > -1) {\n return 'streetNumber';\n }\n\n if (types.indexOf('route') > -1) {\n return 'street';\n }\n\n if (types.indexOf('locality') > -1 && types.indexOf('colloquial_area') === -1) {\n return 'city';\n }\n\n if (types.indexOf('administrative_area_level_1') > -1) {\n return 'state';\n }\n\n if (types.indexOf('postal_code') > -1) {\n return 'postcode';\n }\n\n if (types.indexOf('country') > -1) {\n return 'country';\n }\n\n return null;\n }\n\n static getAddressComponentDictionary(addressComponents) {\n const res = {};\n addressComponents.forEach(function (item) {\n const type = this.getAddressComponentType(item.types);\n if (type) {\n res[type] = item;\n }\n }, this);\n return res;\n }\n\n static mapAddressComponent(component) {\n return component ? {\n shortName: component.short_name,\n longName: component.long_name\n } : null;\n }\n\n static isSameState(gmaps, expectedTerms, appCountry) {\n if (!expectedTerms || expectedTerms.length < 1) {\n return true;\n }\n\n const components = this.getAddressComponentDictionary(gmaps.address_components);\n const actual = this.isOtherState(appCountry, (components.country || {}).short_name) && !components.state\n ? components.country || {}\n : components.state || {};\n\n return expectedTerms.some(term => {\n if (!term || !term.value) {\n return false;\n }\n\n const expected = term.value.toLowerCase();\n return (actual.short_name || '').toLowerCase() === expected ||\n (actual.long_name || '').toLowerCase() === expected;\n });\n }\n\n static isEqualCountry(gmaps, countryCode) {\n if (!gmaps) {\n return true;\n }\n\n const components = this.getAddressComponentDictionary(gmaps.address_components);\n if (!components || !components.country) {\n return false;\n }\n\n const gmapsCountryCodes = this.getGmapsCountryCodes(countryCode);\n const gmapsCountryCode = (components.country.short_name || '').toUpperCase();\n return gmapsCountryCodes.indexOf(gmapsCountryCode) > -1;\n }\n\n static isCountry(address) {\n return !address ||\n !address.unit &&\n !address.streetNumber &&\n !address.street &&\n !address.city &&\n !address.postcode &&\n !address.state\n ;\n }\n\n static getGmapsCountryCodes(country) {\n if (!country) {\n return null;\n }\n\n const countryCode = country.toUpperCase();\n if (countryCode === 'AU') {\n\n // Include Australian territories which Google treats as separate country codes\n const christmasIsland = 'CX';\n const cocosIsland = 'CC';\n const norfolkIsland = 'NF';\n\n return [\n countryCode,\n christmasIsland,\n cocosIsland,\n norfolkIsland\n ];\n }\n\n return [country.toUpperCase()];\n }\n\n static isOtherState(appCountry, addressCountry) {\n if (!addressCountry) {\n return false;\n }\n\n const addressCountryUpper = addressCountry.toUpperCase();\n\n if (appCountry.toUpperCase() === 'AU') {\n return addressCountryUpper === 'CX' ||\n addressCountryUpper === 'CC' ||\n addressCountryUpper === 'NF';\n }\n\n return false;\n }\n}\n","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\n// TODO: Use https://react-bootstrap.github.io instead\nimport React, { useCallback, useEffect, useRef } from 'react';\nconst Popover = (props) => {\n const ref = useRef();\n const handleMount = useCallback(() => {\n const container = wo$(ref.current);\n WhistleOut.applyPopover(container);\n }, []);\n useEffect(() => handleMount(), [handleMount]);\n return (_jsxs(\"div\", { ref: ref, className: \"mar-t-2 mar-b-4 font-3 c-gray-light\", children: [props.title, props.content ? (_jsxs(\"span\", { \"data-toggle\": \"popover\", \"data-container\": props.container, \"data-trigger\": \"click\", \"data-placement\": props.placement, \"data-html\": \"true\", \"data-content\": props.content, children: [' ', _jsx(\"i\", { className: \"fa fa-info-circle\" })] })) : null] }));\n};\nexport default Popover;\n","export default class StateNames {\n constructor() {\n this.abbreviate = this.abbreviate.bind(this);\n }\n\n static abbreviate(name, country) {\n if (!name || name.length === 0) {\n return name;\n }\n\n if (country && country.length > 0) {\n const countryStates = this._states\n .filter(p => p.country.toLowerCase() === country.toLowerCase())[0];\n\n if (countryStates) {\n const match = this.getMatch(countryStates.states, name);\n if (match) {\n return match[0];\n }\n }\n }\n\n // All countries\n for (let i = 0; i < this._states.length; i++) {\n if (country && country.length > 0 && this._states[i].country.toLowerCase() === country.toLowerCase()) {\n // Already checked\n continue;\n }\n\n const match = this.getMatch(this._states[i].states, name);\n if (match) {\n return match[0];\n }\n }\n }\n\n static getMatch(items, name) {\n return items.filter(p => p[1].toLowerCase() === name.toLowerCase())[0];\n }\n}\n\n/*\n SELECT\n '[ ''' + [Code] + ''', ''' + [Name] + ''' ],'\n FROM [dbo].[State]\n*/\nStateNames._states = [\n {\n country: 'au',\n states: [\n ['ACT', 'Australian Capital Territory'],\n ['NSW', 'New South Wales'],\n ['NT', 'Northern Territory'],\n ['QLD', 'Queensland'],\n ['SA', 'South Australia'],\n ['TAS', 'Tasmania'],\n ['VIC', 'Victoria'],\n ['WA', 'Western Australia']\n ]\n },\n {\n country: 'ca',\n states: [\n ['AB', 'Alberta'],\n ['BC', 'British Columbia'],\n ['MB', 'Manitoba'],\n ['NB', 'New Brunswick'],\n ['NL', 'Newfoundland and Labrador'],\n ['NS', 'Nova Scotia'],\n ['ON', 'Ontario'],\n ['PE', 'Prince Edward Island'],\n ['QC', 'Quebec'],\n ['SK', 'Saskatchewan'],\n ['NT', 'Northwest Territories'],\n ['NU', 'Nunavut'],\n ['YT', 'Yukon Territory']\n ]\n },\n {\n country: 'mx',\n states: [\n ['AGU', 'Aguascalientes'],\n ['BCN', 'Baja California'],\n ['BCS', 'Baja California Sur'],\n ['CAM', 'Campeche\t'],\n ['CHP', 'Chiapas'],\n ['CHH', 'Chihuahua'],\n ['COA', 'Coahuila\t'],\n ['COL', 'Colima'],\n ['MEX', 'Estado de México'],\n ['DUR', 'Durango'],\n ['CDMX', 'Ciudad de Mexico'],\n ['GUA', 'Guanajuato'],\n ['GRO', 'Guerrero\t'],\n ['HID', 'Hidalgo'],\n ['JAL', 'Jalisco'],\n ['MIC', 'Michoacán'],\n ['MOR', 'Morelos'],\n ['NAY', 'Nayarit'],\n ['NLE', 'Nuevo León'],\n ['OAX', 'Oaxaca'],\n ['PUE', 'Puebla'],\n ['QUE', 'Querétaro'],\n ['ROO', 'Quintana Roo\t'],\n ['SLP', 'San Luis Potosí'],\n ['SIN', 'Sinaloa'],\n ['SON', 'Sonora'],\n ['TAB', 'Tabasco'],\n ['TAM', 'Tamaulipas'],\n ['TLA', 'Tlaxcala\t'],\n ['VER', 'Veracruz\t'],\n ['YUC', 'Yucatán'],\n ['ZAC', 'Zacatecas']\n ]\n },\n {\n country: 'us',\n states: [\n ['AL', 'Alabama'],\n ['AK', 'Alaska'],\n ['AZ', 'Arizona'],\n ['AR', 'Arkansas'],\n ['CA', 'California'],\n ['CO', 'Colorado'],\n ['CT', 'Connecticut'],\n ['DE', 'Delaware'],\n ['FL', 'Florida'],\n ['GA', 'Georgia'],\n ['HI', 'Hawaii'],\n ['ID', 'Idaho'],\n ['IL', 'Illinois'],\n ['IN', 'Indiana'],\n ['IA', 'Iowa'],\n ['KS', 'Kansas'],\n ['KY', 'Kentucky'],\n ['LA', 'Louisiana'],\n ['ME', 'Maine'],\n ['MD', 'Maryland'],\n ['MA', 'Massachusetts'],\n ['MI', 'Michigan'],\n ['MN', 'Minnesota'],\n ['MS', 'Mississippi'],\n ['MO', 'Missouri'],\n ['MT', 'Montana'],\n ['NE', 'Nebraska'],\n ['NV', 'Nevada'],\n ['NH', 'New Hampshire'],\n ['NJ', 'New Jersey'],\n ['NM', 'New Mexico'],\n ['NY', 'New York'],\n ['NC', 'North Carolina'],\n ['ND', 'North Dakota'],\n ['OH', 'Ohio'],\n ['OK', 'Oklahoma'],\n ['OR', 'Oregon'],\n ['PA', 'Pennsylvania'],\n ['RI', 'Rhode Island'],\n ['SC', 'South Carolina'],\n ['SD', 'South Dakota'],\n ['TN', 'Tennessee'],\n ['TX', 'Texas'],\n ['UT', 'Utah'],\n ['VT', 'Vermont'],\n ['VA', 'Virginia'],\n ['WA', 'Washington'],\n ['WV', 'West Virginia'],\n ['WI', 'Wisconsin'],\n ['WY', 'Wyoming']\n ]\n }\n];","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { createSlice } from '@reduxjs/toolkit';\nimport ClassNames from 'classnames';\nimport React, { forwardRef, lazy, Suspense, useCallback, useEffect, useImperativeHandle, useReducer, useRef } from 'react';\nimport { rollbar } from '../../../../js/common/rollbar';\nimport GeocodeService from './TomtomGeocodeService.js';\nconst { actions, reducer } = createSlice({\n name: 'address-autocomplete',\n initialState: {\n values: [],\n value: null,\n center: null,\n errorCount: 0,\n setCenterErrorCount: 0\n },\n reducers: {\n onError: (state, action) => {\n state.values = [];\n state.errorCount++;\n state.error = action.payload.error.textStatus;\n },\n onEmptyResults: (state, action) => {\n state.resultsFor = action.payload.resultsFor;\n state.values = [];\n state.errorCount = 0;\n state.setCenterErrorCount = 0;\n state.error = null;\n },\n onSelect: (state, action) => {\n state.shouldSelectFirst = false;\n if (state.value === action.payload) {\n return;\n }\n state.value = action.payload;\n state.errorCount = 0;\n state.setCenterErrorCount = 0;\n state.error = null;\n },\n onSetCenterError: state => {\n state.setCenterErrorCount++;\n },\n onResult: (state, action) => {\n const { resultsFor, values } = action.payload;\n state.resultsFor = resultsFor;\n state.values = values || [];\n state.errorCount = 0;\n state.setCenterErrorCount = 0;\n state.error = null;\n },\n processError: state => {\n state.errorCount = 0;\n state.setCenterErrorCount = 0;\n },\n requestSearch: (state, action) => {\n state.shouldSelectFirst = action.payload.shouldSelectFirst;\n },\n setCenter: (state, action) => {\n state.center = action.payload;\n },\n setInputValue: (state, action) => {\n if (state.value === action.payload) {\n return;\n }\n state.value = action.payload;\n state.values = [];\n state.errorCount = 0;\n state.setCenterErrorCount = 0;\n state.error = null;\n }\n }\n});\nconst geocodeService = new GeocodeService();\nconst ReactAutocomplete = lazy(() => import('react-autocomplete'));\nconst AddressAutocomplete = forwardRef((props, ref) => {\n const inputRef = useRef();\n const autocompleteRef = useCallback((element) => {\n if (!element) {\n return;\n }\n inputRef.current = element.refs.input;\n }, []);\n const [state, dispatch] = useReducer(reducer, {\n values: [],\n value: props.value,\n center: null,\n errorCount: 0,\n setCenterErrorCount: 0\n });\n const inputDelayTimeout = useRef();\n const doSearchTimeout = useRef();\n const sendRollbarError = useCallback((error, data) => {\n dispatch(actions.processError());\n rollbar.instance.error(error, {\n errorDetails: data,\n props: props,\n state: state\n });\n }, [props, state]);\n const setCenter = useCallback((callback) => {\n WhistleOut.getCurrentLatLng(latLng => {\n if (!props.country ||\n !latLng.countryCode ||\n (props.country || '').toLowerCase() === (latLng.countryCode || '').toLowerCase()) {\n dispatch(actions.setCenter(latLng));\n }\n callback();\n }, error => {\n const errorCountLimit = 5;\n dispatch(actions.onSetCenterError());\n if (state.setCenterErrorCount > errorCountLimit) {\n sendRollbarError('Error on setting geocode bias center', error);\n }\n if (callback) {\n // Proceed with the callback on error\n callback();\n }\n });\n }, [props.country, sendRollbarError, state.setCenterErrorCount]);\n const focus = useCallback(() => {\n const input = inputRef.current;\n if (!input) {\n return;\n }\n dispatch(actions.setInputValue(input.value));\n if (document.activeElement !== input) {\n input.focus();\n }\n if (WhistleOut.isiOS()) {\n window.setTimeout(() => {\n input.setSelectionRange(0, 999);\n }, 3);\n }\n else {\n input.select();\n }\n }, []);\n const onInputFocus = useCallback(() => {\n focus();\n }, [focus]);\n const getItemValue = useCallback((item) => {\n return item.label;\n }, []);\n const onResponseError = useCallback((e) => {\n dispatch(actions.onError(e));\n console.log('onResponseError: ', e);\n const errorCountLimit = 3;\n if (state.errorCount >= errorCountLimit) {\n sendRollbarError('Address autocomplete search error', e);\n }\n if (props.onResponseError) {\n props.onResponseError(e.error);\n }\n }, [props, sendRollbarError, state.errorCount]);\n const onEmptyResults = useCallback((resultFor, error) => {\n dispatch(actions.onEmptyResults({ resultsFor: resultFor }));\n if (props.onEmptyResults) {\n props.onEmptyResults(error);\n }\n console.log('onEmptyResults: ', error);\n }, [props]);\n const onSearchResponse = useCallback((values, term, shouldSelectFirst) => {\n dispatch(actions.onResult({\n resultsFor: term,\n values: values\n }));\n if (!values || values.length === 0) {\n if (shouldSelectFirst) {\n onEmptyResults(term, 'Not found');\n }\n return;\n }\n if (shouldSelectFirst && props.onSelect) {\n console.log(`onSearchResponse -> props.onSelect: ${values[0].label}`);\n props.onSelect(values[0]);\n }\n }, [onEmptyResults, props]);\n const doSearch = useCallback((term, shouldSelectFirst, initialise) => {\n if (!initialise && !state.center) {\n setCenter(() => doSearch(term, shouldSelectFirst, true));\n return;\n }\n dispatch(actions.requestSearch({ shouldSelectFirst }));\n if (\n // Empty string\n !term ||\n term.length === 0 ||\n new RegExp('^\\\\s+$', 'i').test(term) ||\n // Min length\n term.length < (props.searchTermMinLength || 3)) {\n dispatch(actions.onEmptyResults({ resultsFor: term }));\n return;\n }\n clearTimeout(doSearchTimeout.current);\n doSearchTimeout.current = setTimeout(() => {\n const args = {\n term,\n country: props.country,\n apiKey: props.apiKey,\n proximityLatLng: state.center,\n types: props.types\n };\n geocodeService.doSearch(args, (results) => onSearchResponse(results, term, shouldSelectFirst), onResponseError);\n }, initialise ? 0 : 150);\n }, [\n onResponseError,\n onSearchResponse,\n props.apiKey,\n props.country,\n props.searchTermMinLength,\n props.types,\n setCenter,\n state\n ]);\n const onChange = useCallback((e, value) => {\n const term = e.currentTarget.value;\n dispatch(actions.setInputValue(term));\n if (props.onChange) {\n props.onChange(e, value);\n }\n const trim = (p) => (p || '').trim().toLowerCase();\n clearTimeout(inputDelayTimeout.current);\n if (trim(state.resultsFor) !== trim(term)) {\n inputDelayTimeout.current = window.setTimeout(() => {\n doSearch(term);\n }, props.queryDelay || 250);\n }\n }, [doSearch, props, state]);\n const onSelect = useCallback((value) => {\n dispatch(actions.onSelect(value));\n let address;\n if (!value) {\n address = null;\n }\n else {\n const matches = state.values.filter(p => p.label === value);\n if (!matches || matches.length === 0) {\n return;\n }\n address = matches[0];\n }\n if (props.onSelect) {\n props.onSelect(address);\n }\n }, [props, state]);\n useEffect(() => {\n const ensureFirstIsSelected = () => {\n var _a;\n if (state.shouldSelectFirst && ((_a = state.values) === null || _a === void 0 ? void 0 : _a.length) > 0) {\n const label = state.values[0].label;\n if (label !== state.value) {\n onSelect(label);\n }\n }\n };\n ensureFirstIsSelected();\n }, [onSelect, state.shouldSelectFirst, state.value, state.values]);\n const selectFirstSuggest = useCallback((input) => {\n var _a;\n const searchText = input || inputRef.current.value;\n if (!searchText) {\n onSelect('');\n return;\n }\n if (((_a = state.resultsFor) === null || _a === void 0 ? void 0 : _a.trim().toLowerCase()) === searchText.trim().toLowerCase()) {\n const values = state.values;\n if (values && values.length > 0) {\n onSelect(values[0].label);\n return;\n }\n }\n doSearch(searchText, true);\n }, [doSearch, onSelect, state.resultsFor, state.values]);\n // TODO: Replace depricated keypress event\n const onKeyPress = useCallback((event) => {\n if (event.keyCode === 13) {\n window.setTimeout(() => {\n selectFirstSuggest();\n }, 350); // Use time out to prevent duplicate search call\n event.preventDefault();\n }\n }, [selectFirstSuggest]);\n const mapAutocompleteItem = useCallback((source) => {\n return {\n label: source.label,\n abbr: source.source.id,\n source: source\n };\n }, []);\n // TODO: Implement Consider using Mark.js\n // highlightTerms(element, keyword) {\n // const options = {\n // separateWordSearch: true,\n // diacritics: true\n // };\n // // // Determine selected options\n // // var options = {};\n // // [].forEach.call(optionInputs, function (opt) {\n // // options[opt.value] = opt.checked;\n // // });\n // const target = new Mark(wo$(element));\n // // Remove previous marked elements and mark\n // // the new keyword inside the context\n // target.unmark({\n // done: function () {\n // target.mark(keyword, options);\n // }\n // });\n // }\n const renderInput = useCallback((p) => {\n return (_jsx(\"input\", Object.assign({}, p, props.inputProps, { id: props.inputElementId, className: ClassNames('form-control', props.inputClassName), placeholder: props.placeholder, type: \"Text\", style: {\n display: 'inline-block',\n position: 'relative'\n } })));\n }, [props.inputClassName, props.inputElementId, props.inputProps, props.placeholder]);\n const renderItem = useCallback((item, isHighlighted) => {\n const getText = (p) => (p ? p.shortName : '');\n const address = item.source;\n return (_jsxs(\"li\", { className: ClassNames('pad-x-4 pad-y-3', { 'c-black': isHighlighted }), style: {\n backgroundColor: isHighlighted ? '#f5f5f5' : null\n }, children: [address.unit ? _jsxs(\"span\", { children: [getText(address.unit), \"/\"] }) : null, address.streetNumber ? _jsx(\"span\", { children: getText(address.streetNumber) }) : null, address.streetNumber && address.street ? _jsx(\"span\", { children: \" \" }) : null, address.street ? _jsx(\"span\", { children: getText(address.street) }) : null, address.streetNumber || address.street ? _jsx(\"span\", { children: \", \" }) : null, _jsxs(\"span\", { className: \"c-gray-light\", children: [getText(address.city), address.city ? _jsx(\"span\", { children: \" \" }) : null, getText(address.state), \"\\u00A0\", getText(address.postcode)] })] }, item.abbr));\n }, []);\n const renderMenu = useCallback((children) => {\n return (\n // TODO: Replace inline styles with classes\n !children || children.length === 0 ? (_jsx(\"div\", {})) : (_jsx(\"div\", { className: \"autocomplete-menu bg-white c-black-80 box-shadow-2 rounded-2\", style: {\n position: 'absolute',\n width: '100%',\n top: `${inputRef.current.offsetHeight + 2}px`,\n zIndex: 993,\n cursor: 'pointer'\n }, children: _jsx(\"ul\", { className: \"list-unstyled mar-b-0 font-4\", children: children }) })));\n }, []);\n useEffect(() => {\n const input = inputRef.current;\n if (!input) {\n return;\n }\n input.addEventListener('focus', onInputFocus);\n input.addEventListener('keypress', onKeyPress, false);\n // HACK: Chrome doesn't honour autocomplete=\"off\" on elements, so we set it to a random string\n // see: https://stackoverflow.com/questions/25823448/ng-form-and-autocomplete-off/39689037#39689037\n // and https://stackoverflow.com/questions/12374442/chrome-ignores-autocomplete-off#38961567\n // Updated: Setting the value to something other than 'off' disables address auto fill as long as there is no form tag around it. If there is then it will show the text based auto fill\n input.setAttribute('autocomplete', 'nope');\n if (props.autofocus) {\n focus();\n }\n // TODO\n // highlightTerms(el, state.value);\n return () => {\n input.removeEventListener('focus', onInputFocus);\n input.removeEventListener('keypress', onKeyPress);\n };\n }, [focus, onInputFocus, onKeyPress, props.autofocus]);\n useImperativeHandle(ref, () => ({\n focus: () => focus(),\n setValue: (value) => {\n inputRef.current.value = value;\n },\n doSearch: (term) => selectFirstSuggest(term),\n selectFirstSuggest: (term) => selectFirstSuggest(term)\n }));\n return (_jsx(Suspense, { fallback: _jsx(\"div\", { children: \"Loading...\" }), children: _jsx(ReactAutocomplete, { ref: autocompleteRef, wrapperProps: props.wrapperProps || {\n className: 'autocomplete-container',\n style: {\n position: 'relative'\n }\n }, wrapperStyle: {}, value: state.value, items: state.values.map(mapAutocompleteItem), getItemValue: getItemValue, onSelect: onSelect, onChange: onChange, renderInput: renderInput, renderMenu: renderMenu, renderItem: renderItem }) }));\n});\nAddressAutocomplete.displayName = 'AddressAutocomplete';\nexport default AddressAutocomplete;\n","import AddressHelper from '../../utils/AddressHelper';\nimport StateNames from './StateNames';\n\nexport default class TomtomGeocodeService {\n constructor() {\n this.mapAddressItem = this.mapAddressItem.bind(this);\n this.getWeight = this.getWeight.bind(this);\n }\n\n doSearch(args, onResponse, onError) {\n if (!args) {\n onResponse([]);\n return;\n }\n\n const requestUrl = this.getRequestUrl(args);\n wo$.ajax({\n type: 'GET',\n url: requestUrl,\n success: response => {\n console.log(response);\n try {\n const items = this.mapAddressItems(response, args);\n return onResponse(items);\n }\n catch (ex) {\n // HACK: Unable to serialise exception object\n const exObj = JSON.parse(JSON.stringify(ex, Object.getOwnPropertyNames(ex)));\n exObj.stack = ex.stack;\n\n onError({\n error: `Unable to map address results. ${ex.toString()}`,\n exception: exObj\n });\n }\n },\n error: (jqXHR, textStatus, errorThrown) => onError({\n error: {\n jqXHR: jqXHR,\n textStatus: textStatus,\n errorThrown: errorThrown\n },\n requestUrl,\n args\n })\n });\n }\n\n getRequestUrl(args) {\n const requestTemplate =\n 'https://api.tomtom.com/search/2/geocode/{query}.json?' +\n 'countrySet={country}&' +\n 'key={accessToken}&' +\n 'typeahead=true&' +\n 'limit=5&' +\n 'language={language}';\n\n let url = requestTemplate.replace('{query}', this.cleanupSearchText(args.term))\n .replace('{country}', args.country)\n .replace('{language}', 'en-US')\n .replace('{accessToken}', args.apiKey);\n\n const proximity = this.getProximity(args.proximityLatLng);\n if (proximity) {\n url += `&lat=${proximity.lat}&lon=${proximity.lng}`;\n }\n\n const types = this.getTypes(args.types);\n if (types) {\n url += `&idxSet=${types}`;\n }\n\n return url;\n }\n\n // TODO: Extract to GeocodeServiceHelper\n cleanupSearchText(input) {\n const cleanedUp = input\n .substring(0, 50)\n .replace('/', ' ')\n // Remove 'unit'\n .replace(/^(unit\\s+)(.+)$/i, '$2')\n // Remove unit number including the ones with letters (i.e. '100a')\n .replace(/^(\\d+\\w*\\s+)(\\d+.+)$/i, '$2')\n ;\n\n return encodeURIComponent(cleanedUp);\n }\n\n getProximity(latLng) {\n if (!latLng) {\n return null;\n }\n\n const center = {\n lat: latLng.lat.toFixed(3),\n lng: latLng.lng.toFixed(3)\n };\n\n return center;\n }\n\n // See: https://developer.tomtom.com/online-search/online-search-documentation-geocoding/structured-geocode#TypesAbbrv\n getTypes(items) {\n return !items || items.length === 0\n ? null\n : items.join(',');\n }\n\n mapAddressItems(response, args) {\n if (!response || !args) {\n return null;\n }\n\n const results = response.results;\n if (!results || results.length === 0) {\n return null;\n }\n\n const all = results\n .map(p => this.mapAddressItem(p, args.term.split(/\\/|\\s+/)))\n // Exclude country\n .filter(p => p.label !== p.country.longName)\n .sort(this.compare);\n\n const res = [];\n for (let i = 0; i < all.length; i++) {\n const element = all[i];\n if (res.filter(p => p.label === element.label).length === 0) {\n res.push(element);\n }\n }\n\n return res;\n }\n\n mapAddressItem(source, query) {\n // See: https://developer.tomtom.com/online-search/online-search-documentation-geocoding/structured-geocode\n\n const camelise = p =>\n p.replace(/(\\w)(\\w+)/g, (g0, g1, g2) => g1.toLowerCase() + g2);\n\n const getSegment = segmentName => {\n return source.address[segmentName] ||\n source.address[camelise(segmentName)];\n };\n\n const res = {\n placeId: source.id,\n longitude: source.position.lon,\n latitude: source.position.lat,\n relevance: source.score,\n source: source\n };\n\n const streetNumber = getSegment('streetNumber');\n res.streetNumber = this.getAddressComponent(streetNumber);\n if (res.streetNumber) {\n res.unit = this.getUnitComponent(query, streetNumber);\n }\n\n res.street = this.getStreetComponent(getSegment('streetName'));\n res.city = this.getCityComponent(\n getSegment('municipalitySubdivision') ||\n getSegment('municipality') ||\n getSegment('countrySecondarySubdivision'));\n\n res.postcode = this.getPostcodeComponent(getSegment('postalCode'));\n\n const countryCode = getSegment('countryCode');\n res.state = this.getStateComponent(getSegment('countrySubdivision'), countryCode);\n res.country = this.getAddressComponent(getSegment('country'), countryCode);\n\n res.label = AddressHelper.getLabel(res);\n res.weight = this.getWeight(res, query);\n return res;\n }\n\n // TODO: Extract to GeocodeServiceHelper\n getAddressComponent(longName, shortName) {\n if (!longName && !shortName) {\n return null;\n }\n\n return {\n longName: longName,\n shortName: shortName || longName,\n };\n }\n\n // TODO: Extract to GeocodeServiceHelper\n getUnitComponent(query, streetNumber) {\n const hasDigit = p => /\\d+/.test(p);\n\n const firstNumberIndex = hasDigit(query[0]) ? 0 : 1;\n if (!hasDigit(query[firstNumberIndex + 1])) {\n // Query has only street number\n return null;\n }\n\n // Check if the unit comes second in the query\n const unit = query[firstNumberIndex] !== streetNumber\n ? query[firstNumberIndex]\n : query[firstNumberIndex + 1];\n\n return this.getAddressComponent(unit, unit);\n }\n\n // TODO: Extract to GeocodeServiceHelper\n getStreetComponent(text) {\n if (!text || text.length === 0) {\n return this.getAddressComponent(text);\n }\n\n const streetName = text.split(',')[0];\n\n return this.getAddressComponent(streetName);\n }\n\n getPostcodeComponent(text) {\n if (!text || text.length === 0) {\n return this.getAddressComponent(text);\n }\n\n const postcode = text.split(',')[0];\n\n return this.getAddressComponent(postcode);\n }\n\n getCityComponent(text) {\n if (!text || text.length === 0) {\n return this.getAddressComponent(text);\n }\n\n const cityName = text.split(',')[0];\n\n return this.getAddressComponent(cityName);\n }\n\n // TODO: Extract to GeocodeServiceHelper\n getStateComponent(text, country) {\n if (!text || text.length === 0) {\n return this.getAddressComponent(text);\n }\n\n // TomTom can return multiple states, for example 'New South Wales, Australian Capital Territory'\n const items = text.split(',');\n if (items.length === 0) {\n return this.getAddressComponent(text);\n }\n\n // The last one is more specific, so we use that\n const longName = items[items.length - 1].trim();\n const shortName = StateNames.abbreviate(longName, country);\n if (!shortName || shortName.length === 0) {\n return this.getAddressComponent(longName);\n }\n\n return this.getAddressComponent(longName, shortName);\n }\n\n // TODO: Extract to GeocodeServiceHelper\n getWeight(address, query) {\n const getAddressTypeOrder = address => {\n if (!address) {\n return 0;\n }\n\n const cleanUp = p => !p ? '' : p.toLowerCase().replace(/,|\\s/, '');\n if (cleanUp(query.join(' ')) === cleanUp(address.label)) {\n return 100;\n }\n\n return address.unit\n ? 7\n : address.streetNumber\n ? 6\n : address.street\n ? 5\n : address.city\n ? 4\n : address.postcode\n ? 3\n : address.state\n ? 2\n : 1;\n };\n\n return getAddressTypeOrder(address) + address.relevance * 10;\n }\n\n // TODO: Extract to GeocodeServiceHelper\n compare(a, b) {\n // Order by weight descending\n return a.weight < b.weight\n ? 1\n : a.weight > b.weight\n ? -1\n : 0;\n }\n}\n","import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from \"react/jsx-runtime\";\nimport ClassNames from 'classnames';\nimport isEmpty from 'lodash/isEmpty';\nimport React from 'react';\nexport var MessageType;\n(function (MessageType) {\n MessageType[\"Error\"] = \"error\";\n MessageType[\"Warning\"] = \"warning\";\n})(MessageType || (MessageType = {}));\nconst MessageLabel = ({ type, text }) => {\n if (isEmpty(text)) {\n return null;\n }\n const colour = type === MessageType.Error ? 'c-brand-danger' : 'c-brand-warning';\n return (_jsxs(_Fragment, { children: [_jsx(\"div\", { className: \"row pad-y-3 pad-x-3 visible-sm visible-md visible-lg\", children: _jsxs(\"div\", { className: ClassNames('col-xs-23 col-xs-offset-1', colour), children: [_jsx(\"span\", { className: \"fa fa-exclamation-circle\" }), \" \", text] }) }), _jsx(\"div\", { className: \"row pad-y-3 pad-x-3 mar-t-neg-1 text-center visible-xs\", children: _jsxs(\"div\", { className: ClassNames('col-xs-24', colour), children: [_jsx(\"span\", { className: \"fa fa-exclamation-circle\" }), \" \", text] }) })] }));\n};\nexport default MessageLabel;\n","import { jsx as _jsx, jsxs as _jsxs } from \"react/jsx-runtime\";\nimport { createSlice } from '@reduxjs/toolkit';\nimport PropTypes from 'prop-types';\nimport React, { forwardRef, useCallback, useEffect, useImperativeHandle, useReducer, useRef } from 'react';\nimport SearchAddressActions from '../../actions/SearchAddressActions';\nimport AddressHelper from '../../utils/AddressHelper';\nimport Popover from '../Popover';\nimport AddressAutocomplete from './AddressAutocomplete';\nimport MessageLabel, { MessageType } from './MessageLabel';\n// TODO: Rename to event name\nexport const onAddressChangedEvent = 'AddressSearch.onAddressChanged';\nexport const dispatchAddressChangedEvent = (args) => {\n const event = new CustomEvent(onAddressChangedEvent, {\n detail: args\n });\n dispatchEvent(event);\n};\nlet counter = 0;\nconst { actions, reducer } = createSlice({\n name: 'address-autocomplete',\n initialState: {\n initialLabel: null,\n selected: null,\n addressNotFound: null,\n isError: false,\n shouldSetInputText: false\n },\n reducers: {\n onEmptyResults: state => {\n state.selected = null;\n state.addressNotFound = true;\n state.isError = false;\n state.shouldSetInputText = false;\n },\n onInput: state => {\n state.selected = null;\n state.addressNotFound = false;\n state.isError = false;\n },\n onResponseError: state => {\n state.selected = null;\n state.addressNotFound = false;\n state.isError = true;\n state.shouldSetInputText = false;\n },\n onSetInputText: state => {\n state.shouldSetInputText = false;\n },\n setAddress: (state, action) => {\n const address = action.payload;\n if ((address === null || address === void 0 ? void 0 : address.label) === state.initialLabel) {\n return;\n }\n state.initialLabel = address === null || address === void 0 ? void 0 : address.label;\n state.selected = address;\n state.addressNotFound = !address || (address === null || address === void 0 ? void 0 : address.partialMatch);\n state.isError = false;\n state.shouldSetInputText = false;\n }\n }\n});\nconst AddressSearch = forwardRef((props, ref) => {\n var _a, _b;\n const autocompleteRef = useRef(null);\n const id = useRef(counter++);\n const elementId = useRef(`enterAddressLocationInput-${id.current}`);\n const [state, dispatch] = useReducer(reducer, {\n initialLabel: (_a = props.current) === null || _a === void 0 ? void 0 : _a.label,\n selected: props.current,\n addressNotFound: (_b = props.current) === null || _b === void 0 ? void 0 : _b.partialMatch,\n isError: false,\n shouldSetInputText: false\n });\n useEffect(() => {\n dispatch(actions.setAddress(props.current || {}));\n }, [props]);\n // TODO: Rewrite this, use state.isLoading\n const endProgress = useCallback(() => {\n if (props.onEndProgress) {\n props.onEndProgress();\n }\n }, [props]);\n const getInputElement = useCallback(() => {\n if (typeof window === 'undefined' || !window) {\n return null;\n }\n return document.getElementById(elementId.current);\n }, []);\n const onInput = useCallback((e, value) => {\n dispatch(actions.onInput());\n if (props.onInput) {\n props.onInput(value);\n }\n }, [props]);\n const setInputText = useCallback((address) => {\n dispatch(actions.onSetInputText());\n if (address && !address.label) {\n address.label = AddressHelper.getLabel(address);\n }\n const inputText = address ? address.label : null;\n autocompleteRef.current.setValue(inputText);\n }, []);\n const isEmpty = useCallback((address) => {\n return (!address ||\n (!address.unit &&\n !address.streetNumber &&\n !address.street &&\n !address.city &&\n !address.postcode &&\n !address.state));\n }, []);\n const onAddressSelect = useCallback((address) => {\n endProgress();\n if (isEmpty(address)) {\n address = null;\n }\n setInputText(address);\n if (address && AddressHelper.isEqual(state.selected, address)) {\n if (props.onSelect) {\n props.onSelect();\n }\n return;\n }\n console.log('onAddressSelect', address);\n dispatch(actions.setAddress(address));\n if (!props.skipGlobalUpdate) {\n SearchAddressActions.setAddressCookie(address);\n }\n if (props.onChange) {\n props.onChange(address);\n }\n if (!props.skipGlobalUpdate) {\n dispatchAddressChangedEvent({\n sender: elementId.current,\n address: address\n });\n }\n if (props.onSelect) {\n props.onSelect();\n }\n }, [endProgress, isEmpty, props, setInputText, state.selected]);\n const onAddressChangedEventHandler = useCallback((e) => {\n if (!e.detail || e.detail.sender === elementId.current) {\n return;\n }\n setInputText(e.detail.address);\n if (AddressHelper.isEqual(state.selected, e.detail.address)) {\n return;\n }\n dispatch(actions.setAddress(e.detail.address));\n if (props.onChange) {\n props.onChange(e.detail.address);\n }\n }, [props, setInputText, state]);\n const onEmptyResults = useCallback((status) => {\n endProgress();\n console.log('onEmptyResults', status);\n dispatch(actions.onEmptyResults());\n // Reset Cookie\n SearchAddressActions.setAddressCookie(null);\n if (props.onEmptyResults) {\n props.onEmptyResults(status);\n }\n }, [endProgress, props]);\n const onResponseError = useCallback((error) => {\n endProgress();\n console.log('onResponseError', error);\n dispatch(actions.onResponseError());\n // Reset Cookie\n SearchAddressActions.setAddressCookie(null);\n if (props.onResponseError) {\n props.onResponseError(error);\n }\n }, [endProgress, props]);\n useEffect(() => {\n addEventListener(onAddressChangedEvent, onAddressChangedEventHandler);\n if (props.onInitialized) {\n const input = getInputElement();\n props.onInitialized(input);\n }\n return () => {\n removeEventListener(onAddressChangedEvent, onAddressChangedEventHandler);\n };\n }, [getInputElement, onAddressChangedEventHandler, props]);\n useImperativeHandle(ref, () => ({\n focus: autocompleteRef.current.focus,\n setValue: autocompleteRef.current.setValue,\n doSearch: autocompleteRef.current.doSearch,\n selectFirstSuggest: autocompleteRef.current.selectFirstSuggest\n }));\n const label = (state.selected || {}).label;\n return (_jsx(React.StrictMode, { children: _jsxs(React.Fragment, { children: [_jsxs(\"div\", { className: props.className, children: [\n //\n !props.hideLabel ? (_jsx(\"label\", { htmlFor: elementId.current, className: \"sr-only\", children: \"Location\" })) : null, _jsx(AddressAutocomplete\n //key={label}\n , { \n //key={label}\n ref: autocompleteRef, inputElementId: elementId.current, inputClassName: props.inputClassName, inputProps: props.inputProps, autofocus: props.autofocus, placeholder: props.placeholder, value: label, country: props.countryCode, types: props.types, queryDelay: props.queryDelay, searchTermMinLength: 3, apiKey: props.apiKey, onChange: onInput, onSelect: onAddressSelect, onEmptyResults: onEmptyResults, onResponseError: onResponseError }), props.children] }), props.tooltipLink ? (_jsx(Popover, { container: \"body\", placement: \"top\", linkClassName: \"mar-t-2 mar-b-4 font-3 c-gray-light\", title: props.tooltipLink, content: props.tooltipDescription })) : null, state.addressNotFound ? (_jsx(MessageLabel, { type: MessageType.Warning, text: props.addressNotFoundMessage })) : null, state.isError ? _jsx(MessageLabel, { type: MessageType.Error, text: props.commonErrorMessage }) : null] }) }));\n});\nAddressSearch.displayName = 'AddressSearch';\n/* eslint-disable import/no-named-as-default-member */\nAddressSearch.propTypes = {\n countryCode: PropTypes.string,\n types: PropTypes.arrayOf(PropTypes.string),\n placeholder: PropTypes.string,\n queryDelay: PropTypes.number,\n autofocus: PropTypes.bool,\n hideLabel: PropTypes.bool,\n addressNotFoundMessage: PropTypes.string,\n commonErrorMessage: PropTypes.string,\n showProgress: PropTypes.bool\n};\n/* eslint-enable */\nAddressSearch.defaultProps = {\n types: ['geocode'],\n placeholder: 'Enter Street Address',\n addressNotFoundMessage: 'Address not found',\n commonErrorMessage: 'Unable to verify the address',\n queryDelay: 350,\n autofocus: false,\n showProgress: true\n};\nexport default AddressSearch;\n"],"names":["onAddressCookieInit","address","dispatch","actions","addressCookieInit","JSON","parse","SearchAddressActions","setAddressCookie","value","window","wo$","Cookies","set","path","expires","newValue","stringify","placeId","label","latitude","longitude","unit","streetNumber","street","city","state","postcode","types","partialMatch","current","get","invalidateAddressCookie","currentValue","AddressHelper","isEqual","a","b","cleanUpFormattedAddress","str","components","parts","split","length","country","res","substring","indexOf","locationName","long_name","short_name","map","gmaps","appCountry","place_id","location","lat","geometry","lng","this","getAddressComponentDictionary","address_components","mapAddressComponent","partial_match","colloquial","FixGMapsComponents","getLabel","isOtherState","shortName","longName","toUpperCase","getCountryLongName","FixForJbt","getComponentValue","isNullOrWhiteSpace","p","trim","appendWithSpaceIfNeeded","component","preferShorter","handleCountryName","countryName","formatted_address","name","toLowerCase","removeUnitName","formattedAddress","regex","RegExp","replace","getAddressComponentType","addressComponents","forEach","item","type","isSameState","expectedTerms","actual","some","term","expected","isEqualCountry","countryCode","gmapsCountryCodes","getGmapsCountryCodes","gmapsCountryCode","isCountry","addressCountry","addressCountryUpper","props","ref","useRef","handleMount","useCallback","container","WhistleOut","applyPopover","useEffect","className","children","title","content","placement","StateNames","constructor","abbreviate","bind","countryStates","_states","filter","match","getMatch","states","i","items","reducer","initialState","values","center","errorCount","setCenterErrorCount","reducers","onError","action","error","payload","textStatus","onEmptyResults","resultsFor","onSelect","shouldSelectFirst","onSetCenterError","onResult","processError","requestSearch","setCenter","setInputValue","geocodeService","mapAddressItem","getWeight","doSearch","args","onResponse","requestUrl","getRequestUrl","ajax","url","success","response","mapAddressItems","ex","exObj","Object","getOwnPropertyNames","stack","toString","exception","jqXHR","errorThrown","cleanupSearchText","apiKey","proximity","getProximity","proximityLatLng","getTypes","input","cleanedUp","encodeURIComponent","latLng","toFixed","join","results","all","sort","compare","element","push","source","query","getSegment","segmentName","g0","g1","g2","id","position","lon","relevance","score","getAddressComponent","getUnitComponent","getStreetComponent","getCityComponent","getPostcodeComponent","getStateComponent","weight","hasDigit","test","firstNumberIndex","text","streetName","cityName","cleanUp","getAddressTypeOrder","ReactAutocomplete","lazy","AddressAutocomplete","forwardRef","inputRef","autocompleteRef","refs","useReducer","inputDelayTimeout","doSearchTimeout","sendRollbarError","data","rollbar","instance","errorDetails","callback","getCurrentLatLng","focus","document","activeElement","isiOS","setTimeout","setSelectionRange","select","onInputFocus","getItemValue","onResponseError","e","resultFor","onSearchResponse","initialise","searchTermMinLength","clearTimeout","onChange","currentTarget","queryDelay","matches","_a","ensureFirstIsSelected","selectFirstSuggest","searchText","onKeyPress","event","keyCode","preventDefault","mapAutocompleteItem","abbr","renderInput","assign","inputProps","inputElementId","inputClassName","placeholder","style","display","renderItem","isHighlighted","getText","backgroundColor","renderMenu","width","top","offsetHeight","zIndex","cursor","addEventListener","setAttribute","autofocus","removeEventListener","useImperativeHandle","setValue","Suspense","fallback","wrapperProps","wrapperStyle","displayName","MessageType","colour","Error","onAddressChangedEvent","dispatchAddressChangedEvent","CustomEvent","detail","dispatchEvent","counter","initialLabel","selected","addressNotFound","isError","shouldSetInputText","onInput","onSetInputText","setAddress","AddressSearch","_b","elementId","endProgress","onEndProgress","getInputElement","getElementById","setInputText","inputText","isEmpty","onAddressSelect","skipGlobalUpdate","sender","onAddressChangedEventHandler","status","onInitialized","hideLabel","htmlFor","tooltipLink","linkClassName","tooltipDescription","Warning","addressNotFoundMessage","commonErrorMessage","propTypes","showProgress","defaultProps"],"sourceRoot":""}