New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

geolocator

Package Overview
Dependencies
Maintainers
1
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

geolocator - npm Package Compare versions

Comparing version 2.1.3 to 2.1.5

17

CHANGELOG.md

@@ -5,2 +5,16 @@ # Geolocator Changelog:

## [2.1.5](https://github.com/onury/geolocator/compare/v2.1.3...v2.1.5) (2019-01-09)
### Fixed
- An issue where `locateByIP()` method would fail due to external service being shut down. Added a new (default) Geo-IP service provider to [GeoJS](https://www.geojs.io) with `HTTPS` support.
- An issue where XHR request handlers would not be invoked in IE9.
### Changed
- `getIP()` method now uses XHR request instead of JSONP, since CORS is supported by the service.
- Added ability fetch location-by-IP data via XHR. (Set `xhr` to `true` when passing a new Geo-IP source to `setGeoIPSource()` method.)
- Default value for `timeout` option is changed to `6000` for `.locate()` method.
- Improved minification and reduced library size.
- (Dev) Removed grunt in favour of npm scripts. Removed Jasmine in favour of Jest.
## [2.1.3](https://github.com/onury/geolocator/compare/v2.1.1...v2.1.3) (2018-04-02)

@@ -14,4 +28,5 @@

- Geo IP source: IPStack (requires a free API key).
_Note that this is a [separate file](https://github.com/onury/geolocator/blob/master/src/geo-ip-sources/ipstack.js), you can include in your HTML. Or you can use a [different provider](https://github.com/onury/geolocator/tree/master/src/geo-ip-sources) if you like._
_Note that this is a [separate file](https://github.com/onury/geolocator/blob/master/src/geo-ip-sources/ipstack.js), you can include in your HTML. Or you can use a [different provider](https://github.com/onury/geolocator/tree/master/src/geo-ip-sources) if you like. See the [Caveats](https://github.com/onury/geolocator#caveats) section before you do so._
## [2.1.1](https://github.com/onury/geolocator/compare/v2.1.0...v2.1.1) (2017-03-11)

@@ -18,0 +33,0 @@

@@ -1,2 +0,6 @@

!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("geolocator",[],t):"object"==typeof exports?exports.geolocator=t():e.geolocator=t()}(this,function(){return function(e){function t(n){if(o[n])return o[n].exports;var r=o[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,t),r.l=!0,r.exports}var o={};return t.m=e,t.c=o,t.i=function(e){return e},t.d=function(e,o,n){t.o(e,o)||Object.defineProperty(e,o,{configurable:!1,enumerable:!0,get:n})},t.n=function(e){var o=e&&e.__esModule?function(){return e.default}:function(){return e};return t.d(o,"a",o),o},t.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},t.p="dist/",t(t.s=7)}([function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=Object.prototype.toString,a={noop:function(){},isString:function(e){return"string"==typeof e},isStringSet:function(e){return"string"==typeof e&&e.trim().length>0},isNumber:function(e){return"number"==typeof e},isObject:function(e){var t=void 0===e?"undefined":n(e);return Boolean(e)&&("object"===t||"function"===t)},isFunction:function(e){return"function"==typeof e},isArray:function(e){return Boolean(e)&&"[object Array]"===r.call(e)},isFilledArray:function(e){return a.isArray(e)&&e.length>0},isPlainObject:function(e){return Boolean(e)&&"object"===(void 0===e?"undefined":n(e))&&"[object Object]"===r.call(e)},isDate:function(e){return Boolean(e)&&"[object Date]"===r.call(e)},isElement:function(e){return!!e&&(e instanceof HTMLElement||"object"===(void 0===e?"undefined":n(e))&&1===e.nodeType)},isNode:function(e){return!!e&&(e instanceof Node||"object"===(void 0===e?"undefined":n(e))&&"number"==typeof e.nodeType)},isJQueryObject:function(e){return!!e&&("jQuery"in window&&e instanceof window.jQuery&&Boolean(e[0]))},isPositionError:function(e){return Boolean(e)&&"[object PositionError]"===r.call(e)},isError:function(e){return e instanceof Error||a.isPositionError(e)},removeQuery:function(e){return e.replace(/\?.*$/,"")},removeProtocol:function(e){return e.replace(/^(.*:)?\/\//,"")},setProtocol:function(e,t){var o=void 0;return o=void 0===t||null===t?window.location.protocol:t?"https:":"http:",e=a.removeProtocol(e),o+"//"+e},trimDots:function(e){return e.replace(/^\.+?(.*?)\.+?$/g,"$1")},encodeURI:function(e){return encodeURIComponent(e).replace(/%20/g,"+")},decodeURI:function(e){return decodeURIComponent(e.replace(/\+/g,"%20"))},toString:function(e){return null===e||void 0===e?"":e.toString&&a.isFunction(e.toString)?e.toString():String(e)},randomString:function(e){return e&&a.isNumber(e)||(e=1),e=-Math.abs(e),Math.random().toString(36).slice(e)},abbr:function(e,t){t=a.extend({upper:!0,dots:!0},t);var o=t.dots?".":"",n=e.match(/(\b\w)/gi).join(o)+o;return t.upper?n.toUpperCase():n},params:function e(t,o){if(!a.isPlainObject(t)||0===Object.keys(t).length)return"";o=a.extend({encode:!0,operator:"=",separator:"&",include:void 0,exclude:void 0},o);var e=[],n=a.isArray(o.include)?o.include:null,r=!n&&a.isArray(o.exclude)?o.exclude:null;return a.forIn(t,function(t,i){if((!n||n.indexOf(i)>=0)&&(!r||r.indexOf(i)<0)){var u=a.toString(t);u=o.encode?a.encodeURI(u):u;var l=o.encode?a.encodeURI(i):i;e.push(l+o.operator+u)}}),e.join(o.separator)},notateGlobalObj:function(e){e=a.trimDots(e);var t=e.split("."),o=window;return"window"!==t[0]&&"document"!==t[0]||t.shift(),t.forEach(function(e){o=o[e]}),o},forIn:function(e,t){var o=void 0;for(o in e)if(t(e[o],o,e)===!1)break},extend:function(e){if(!a.isObject(e))return{};for(var t=void 0,o=void 0,n=arguments.length,r=Array(n>1?n-1:0),i=1;i<n;i++)r[i-1]=arguments[i];return r.forEach(function(n){for(t in n)o=n[t],a.isArray(o)?e[t]=o.concat():a.isDate(o)?e[t]=new Date(o):a.isFunction(o)?e[t]=o:a.isObject(o)?e[t]=a.extend({},o):e[t]=o}),e},clone:function(e,t){if(!e)return{};a.isArray(t)&&(t={keys:t}),t=a.extend({keys:null,own:!0},t);var o=void 0,n={};return a.forIn(e,function(r,i){(o=t.keys?t.keys.indexOf(i)>=0:t.own&&e.hasOwnProperty(i)||!t.own)&&(a.isObject(r)?n[i]=a.clone(r,t):n[i]=r)}),n},mapToSchema:function(e,t){var o={};return a.forIn(t,function(t,n){a.isPlainObject(t)?o[n]=a.mapToSchema(e,t):o[n]=e[t]}),o},safeJsonParse:function(e){var t=null;try{t=JSON.parse(e)}catch(e){}return t},time:function(e){var t=Date.now();return e?parseInt(t/1e3,10):t}};t.default=a},function(e,t,o){"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n="//maps.googleapis.com/maps/api",r=Object.freeze({URL:{IP:"//api.ipify.org",FLAG:"//cdnjs.cloudflare.com/ajax/libs/flag-icon-css/2.3.1/flags/4x3/",GOOGLE_MAPS_API:n+"/js",GOOGLE_SATATIC_MAP:n+"/staticmap",GOOGLE_GEOLOCATION:"//www.googleapis.com/geolocation/v1/geolocate",GOOGLE_GEOCODE:"//maps.googleapis.com/maps/api/geocode/json",GOOGLE_TIMEZONE:"//maps.googleapis.com/maps/api/timezone/json",GOOGLE_DISTANCE_MATRIX:"//maps.googleapis.com/maps/api/distancematrix/json"},MapTypeId:{HYBRID:"hybrid",ROADMAP:"roadmap",SATELLITE:"satellite",TERRAIN:"terrain"},LocationType:{ROOFTOP:"ROOFTOP",RANGE_INTERPOLATED:"RANGE_INTERPOLATED",GEOMETRIC_CENTER:"GEOMETRIC_CENTER",APPROXIMATE:"APPROXIMATE"},TravelMode:{DRIVING:"DRIVING",WALKING:"WALKING",BICYCLING:"BICYCLING",TRANSIT:"TRANSIT"},UnitSystem:{METRIC:0,IMPERIAL:1},RadioType:{LTE:"lte",GSM:"gsm",CDMA:"cdma",WCDMA:"wcdma"},DistanceFormula:{HAVERSINE:"haversine",PYTHAGOREAN:"pythagorean"},ImageFormat:{PNG:"png",PNG_8:"png8",PNG_32:"png32",GIF:"gif",JPG:"jpg",JPG_BASELINE:"jpg-baseline"}});t.default=r},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e){return e?"OK"===e?null:"ZERO_RESULTS"===e?c.Code.NOT_FOUND:c.Code.hasOwnProperty(e)?e:null:c.Code.INVALID_RESPONSE}function i(e){switch(e){case"invalid":return c.Code.INVALID_REQUEST;case"dailyLimitExceeded":return c.Code.DAILY_LIMIT_EXCEEDED;case"keyInvalid":return c.Code.GOOGLE_KEY_INVALID;case"userRateLimitExceeded":return c.Code.USER_RATE_LIMIT_EXCEEDED;case"notFound":return c.Code.NOT_FOUND;case"parseError":return c.Code.PARSE_ERROR;default:return null}}Object.defineProperty(t,"__esModule",{value:!0});var u="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},l=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}(),d=o(0),s=n(d),c=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.Code.UNKNOWN_ERROR,o=arguments[1];r(this,e),o=o||String(t),Object.defineProperty(this,"name",{enumerable:!1,writable:!1,value:"GeoError"}),Object.defineProperty(this,"code",{enumerable:!1,writable:!0,value:t}),Object.defineProperty(this,"message",{enumerable:!1,writable:!0,value:o}),Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(this,this.constructor):Object.defineProperty(this,"stack",{enumerable:!1,writable:!1,value:new Error(o).stack})}return l(e,null,[{key:"create",value:function(t){if(t instanceof e)return t;var o=void 0,n=void 0;if(s.default.isPositionError(t)&&t.code){switch(t.code){case 1:o=e.Code.PERMISSION_DENIED;break;case 2:o=e.Code.POSITION_UNAVAILABLE;break;case 3:o=e.Code.TIMEOUT;break;default:o=e.Code.UNKNOWN_ERROR}return new e(o,t.message||"")}return"string"==typeof t?o=n=t:"object"===(void 0===t?"undefined":u(t))&&(o=t.code||t.message,n=t.message||t.code),o&&e.isValidErrorCode(o)?new e(o,n):new e(e.Code.UNKNOWN_ERROR,n)}},{key:"fromResponse",value:function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!t)return new e(e.Code.INVALID_RESPONSE);var n=void 0;if(s.default.isString(t)&&(n=a(t)))return new e(n,o||t);if(!s.default.isObject(t))return null;var r=t.error_message||t.errorMessage||t.error&&t.error.message||""||"";if(t.status&&(n=a(t.status)))return new e(n,r||o||t.status);if(t.error){var u=t.reason||t.error.reason;if(!u){var l=t.error.errors;s.default.isArray(l)&&l.length>0&&(u=l[0].reason,r=r||l[0].message)}return n=i(u)||e.Code.UNKNOWN_ERROR,new e(n,r||u||o)}return r?(n=a(r)||e.Code.UNKNOWN_ERROR,new e(n,r||o)):null}},{key:"isGeoError",value:function(t){return t instanceof e}},{key:"isValidErrorCode",value:function(t){var o=void 0;for(o in e.Code)if(e.Code.hasOwnProperty(o)&&t===e.Code[o])return!0;return!1}}]),e}();c.prototype.toString=function(){var e=this.code!==this.message?" ("+this.message+")":"";return this.name+": "+this.code+e},"function"==typeof Object.setPrototypeOf?Object.setPrototypeOf(c.prototype,Error.prototype):c.prototype=Object.create(Error.prototype),c.Code={GEOLOCATION_NOT_SUPPORTED:"GEOLOCATION_NOT_SUPPORTED",INVALID_GEO_IP_SOURCE:"INVALID_GEO_IP_SOURCE",PERMISSION_DENIED:"PERMISSION_DENIED",POSITION_UNAVAILABLE:"POSITION_UNAVAILABLE",TIMEOUT:"TIMEOUT",INVALID_PARAMETERS:"INVALID_PARAMETERS",INVALID_RESPONSE:"INVALID_RESPONSE",INVALID_REQUEST:"INVALID_REQUEST",REQUEST_DENIED:"REQUEST_DENIED",REQUEST_FAILED:"REQUEST_FAILED",GOOGLE_API_FAILED:"GOOGLE_API_FAILED",OVER_QUERY_LIMIT:"OVER_QUERY_LIMIT",USER_RATE_LIMIT_EXCEEDED:"USER_RATE_LIMIT_EXCEEDED",DAILY_LIMIT_EXCEEDED:"DAILY_LIMIT_EXCEEDED",GOOGLE_KEY_INVALID:"GOOGLE_KEY_INVALID",MAX_ELEMENTS_EXCEEDED:"MAX_ELEMENTS_EXCEEDED",MAX_DIMENSIONS_EXCEEDED:"MAX_DIMENSIONS_EXCEEDED",MAX_WAYPOINTS_EXCEEDED:"MAX_WAYPOINTS_EXCEEDED",PARSE_ERROR:"PARSE_ERROR",NOT_FOUND:"NOT_FOUND",INTERNAL_ERROR:"INTERNAL_ERROR",UNKNOWN_ERROR:"UNKNOWN_ERROR"},t.default=c},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e,t,o){return t=l.default.isString(t)?{url:t}:t||{},t.method=e,d.xhr(t,o)}Object.defineProperty(t,"__esModule",{value:!0});var i=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}(),u=o(0),l=n(u),d=function(){function e(){r(this,e)}return i(e,null,[{key:"jsonp",value:function(e,t){function o(o,a,l){n&&(clearTimeout(n),n=null),(a||e.clean)&&r.parentNode&&r.parentNode.removeChild(r),d&&delete u[i],t(o,l)}var n=void 0;if(t=l.default.isFunction(t)?t:l.default.noop,l.default.isString(e)&&(e={url:e}),!l.default.isPlainObject(e))return t(new Error("No options or target URL is provided."));if(e=l.default.extend({async:!0,defer:!1,timeout:0,params:{},clean:!0},e),l.default.isString(e.url)===!1||""===e.url.trim())return t(new Error("No target URL is provided."));var r=document.createElement("script"),a=l.default.isString(e.callbackParam)&&""!==e.callbackParam.trim(),i=void 0,u=void 0,d=l.default.isString(e.rootName)&&"window"!==e.rootName&&"document"!==e.rootName&&""!==e.rootName.trim();a&&(i="_jsonp_"+l.default.randomString(10),e.params[e.callbackParam]=d?e.rootName+"."+i:i);var s=l.default.params(e.params)||"",c=e.url.indexOf("?")>=0?"&":"?",f=s?""+e.url+c+s:e.url;if(i){var m=function(e){o(null,!1,e)};u=d?l.default.notateGlobalObj(e.rootName):window,u[i]=m}else r.readyState?r.onreadystatechange=function(){"loaded"!==r.readyState&&"complete"!==r.readyState||(r.onreadystatechange=null,o(null))}:r.onload=function(){o(null)};r.onerror=function(t){var n="Could not load source at "+l.default.removeQuery(e.url);t&&(n+="\n"+(t.message||t)),o(new Error(n))},e.type&&(r.type=e.type),e.charset&&(r.charset=e.charset),e.async&&(r.async=!0),e.defer&&(r.defer=!0),e.crossorigin&&(r.crossorigin=e.crossorigin),r.src=f,document.getElementsByTagName("head")[0].appendChild(r),l.default.isNumber(e.timeout)&&e.timeout>0&&(n=setTimeout(function(){r.src="",o(new Error("Operation timed out."),!0)},e.timeout))}},{key:"xhr",value:function t(o,n){var t=void 0,r=void 0;if(!("XMLHttpRequest"in window))throw new Error("XMLHttpRequest is not supported!");t=new XMLHttpRequest;var a=l.default.isFunction(n);n=a?n:l.default.noop,l.default.isString(o)&&(o={url:o}),l.default.isPlainObject(o)?o=l.default.extend({method:"GET",data:void 0,async:!0,timeout:0,withCredentials:!1,mimeType:void 0,username:"",password:""},o):n(new Error("No options or target URL is provided.")),l.default.isString(o.url)===!1&&n(new Error("No target URL is provided.")),o.username=String(o.username),o.password=String(o.password),o.method=o.method.toUpperCase(),"POST"!==o.method&&"PUT"!==o.method&&(o.data=void 0),a&&(t.onreadystatechange=function(){if(t.readyState===e.XHR_READY_STATE.DONE)if(200===t.status)n(null,t);else{var o=0===t.status?". Make sure you have permission if this is a cross-domain request.":"";r=new Error("The request returned status: "+t.status+o),n(r,t)}},l.default.isNumber(o.timeout)&&o.timeout>0&&(t.timeout=o.timeout,t.ontimeout=function(){r=new Error("The request had timed out."),n(r,t)})),t.open(o.method,o.url,o.async,o.username,o.password),l.default.isPlainObject(o.headers)&&Object.keys(o.headers).forEach(function(e){var n=o.headers[e];t.setRequestHeader(e,n)}),o.mimeType&&t.overrideMimeType(o.mimeType),t.send(o.data)}},{key:"get",value:function(t,o){return e.xhr(t,o)}},{key:"post",value:function(e,t){return a("POST",e,t)}},{key:"put",value:function(e,t){return a("PUT",e,t)}},{key:"delete",value:function(e,t){return a("DELETE",e,t)}}]),e}();d.XHR_READY_STATE={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4},t.default=d},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function a(e){return!_.default.isString(e)&&!_.default.isArray(e)&&!_.default.isPlainObject(e)}function i(e,t){if(e)return A.default.create(e);if(!t)return new A.default(A.default.Code.REQUEST_FAILED);var o=_.default.safeJsonParse(t.responseText);return A.default.fromResponse(o)||o}function u(e){if((!e||e.addressLookup||e.timezone||e.map||e.staticMap)&&!D._.config.google.key)throw new A.default(A.default.Code.GOOGLE_KEY_INVALID,"A Google API key is required but it's not set or valid.")}function l(e,t){return _.default.isObject(e)?e.center=t.coords:e={element:e,center:t.coords},t.formattedAddress&&(e.title=t.formattedAddress),!e.zoom&&t.coords&&_.default.isNumber(t.coords.accuracy)&&t.coords.accuracy<1500&&(e.zoom=15),e}function d(e){var t=e.element,o=t._geolocatorMapData,n=o&&o.instance||null,r=o&&o.marker||null,a=o&&o.infoWindow||null,i=new google.maps.LatLng(e.center.latitude,e.center.longitude),u={mapTypeId:e.mapTypeId,center:i,zoom:e.zoom,styles:e.styles||null};return n?n.setOptions(u):n=new google.maps.Map(e.element,u),a&&(a=null),r&&r instanceof google.maps.Marker&&(google.maps.event.clearInstanceListeners(r),r.setMap(null),r=null),e.marker&&(r=new google.maps.Marker({position:u.center,map:n}),e.title&&(a=new google.maps.InfoWindow,a.setContent(e.title),google.maps.event.addListener(r,"click",function(){a.open(n,r)}))),o={element:t,instance:n,marker:r,infoWindow:a,options:u},t._geolocatorMapData=o,o}function s(e,t){if(e&&e.address){var o=void 0,n=e.address;if(_.default.isString(n.countryCode)&&2===n.countryCode.length?o=n.countryCode:_.default.isString(n.country)&&2===n.country.length&&(o=n.country),o&&(e.flag=N.default.URL.FLAG+o.toLowerCase()+".svg",t.staticMap)){var r=_.default.isPlainObject(t.staticMap)?_.default.clone(t.staticMap):{};r.center=e.coords,e.staticMap=D.getStaticMap(r)}}}function c(e,t){return function(o,n){return o?t(A.default.create(o),null):(s(n,e),e.map?(e.map=l(e.map,n),void D.createMap(e.map,function(e,o){return e?t(e,null):(n.map=o,t(null,n))})):t(null,n))}}function f(e,t,o){u(),b.default.geocode(e,D._.config,t,c(t,o))}function m(e,t,o){function n(e){D.getTimeZone(r.coords,function(t,o){if(t)return e(t,null);delete o.timestamp,r.timezone=o,r.timestamp=_.default.time(),e(null,r)})}var r=_.default.clone(e,{own:!1});if(!t.addressLookup&&!t.timezone)return o(null,r);t.addressLookup?D.reverseGeocode(r.coords,function(e,a){if(e)return o(e,null);r=_.default.extend({},a,r),r.address=a.address,r.timestamp=_.default.time(),t.timezone?n(o):o(e,r)}):t.timezone?n(o):o(null,r)}function p(e,t,o){function n(){r?t(r):o(new A.default(A.default.Code.POSITION_UNAVAILABLE))}var r=void 0,a=void 0,i=_.default.isFunction(e.onProgress)?e.onProgress:_.default.noop;a=D.watch(e,function(t,u){if(t)return a.clear(function(){o(t)});r=u,a.cycle>1&&r.coords.accuracy<=e.desiredAccuracy?a.clear(n):i(r)}),a.clear(e.maximumWait+100,n)}function g(e){var t=D._.config;return _.default.isFilledArray(e.styles)?e.styles:_.default.isFilledArray(t.google.styles)?t.google.styles:null}Object.defineProperty(t,"__esModule",{value:!0});var y="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},E=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}(),v=o(0),_=n(v),I=o(3),O=n(I),h=o(5),b=n(h),R=o(2),A=n(R),T=o(6),S=n(T),P=o(1),N=n(P),w=6371,L=3959,M={language:"en",https:!0,google:{version:"3",key:"",styles:null}},D=function(){function e(){r(this,e)}return E(e,null,[{key:"config",value:function(t){return t&&(e._.config=_.default.extend(M,t)),e._.config}},{key:"getStaticMap",value:function(t,o){if(!_.default.isPlainObject(t)||!t.center)throw new A.default(A.default.Code.INVALID_PARAMETERS,"A center address or coordinates are required.");if(_.default.isString(t.center))return e.geocode(t.center,function(n,r){n&&o(n),t.center=r.coords,o(null,e.getStaticMap(t))});var n=e._.config,r=_.default.extend({mapTypeId:N.default.MapTypeId.ROADMAP,size:{width:600,height:300},scale:1,zoom:9,marker:"red",format:N.default.ImageFormat.PNG,language:n.language||"en",region:null},t),a=_.default.isPlainObject(r.center)?r.center.latitude+","+r.center.longitude:String(r.center),i=_.default.isPlainObject(r.size)?r.size.width+"x"+r.size.height:String(r.size),u=N.default.URL.GOOGLE_SATATIC_MAP+"?center="+a+"&maptype="+r.mapTypeId+"&size="+i+"&scale="+r.scale+"&zoom="+r.zoom+"&format="+r.format+"&language="+r.language;if(r.marker){var l=_.default.isString(r.marker)?r.marker:"red";u+="&markers="+encodeURIComponent("color:"+l+"|"+a)}r.region&&(u+="&region="+r.region),n.google.key&&(u+="&key="+n.google.key);var d=g(r);return d&&(u+="&"+b.default.mapStylesToParams(d)),_.default.isFunction(o)?o(null,u):u}},{key:"createMap",value:function(t,o){_.default.isPlainObject(t)||(t={element:t}),t=_.default.extend({element:null,mapTypeId:N.default.MapTypeId.ROADMAP,title:void 0,marker:!0,zoom:9},t);var n=t.element,r=void 0;if(_.default.isString(n)?r=document.getElementById(n):_.default.isJQueryObject(n)?r=n[0]:e.isGoogleLoaded()&&n instanceof google.maps.Map&&(r=n.getDiv()),!_.default.isElement(r)&&!_.default.isNode(r))throw new A.default(A.default.Code.INVALID_PARAMETERS,"A valid DOM element or element ID is required to create a map.");if(!_.default.isPlainObject(t.center)||!_.default.isNumber(t.center.latitude)||!_.default.isNumber(t.center.longitude))throw new A.default(A.default.Code.INVALID_PARAMETERS,"Center coordinates are required to create a map.");t.element=r;var a=e._.config,i=a.google.key;t.styles=g(t),e.ensureGoogleLoaded(i,function(e){if(e)throw new A.default(A.default.Code.GOOGLE_API_FAILED,String(e.message||e));o(null,d(t))})}},{key:"locate",value:function(t,o){function n(o){if(t.fallbackToIP)return e.locateByIP(t,function(e,t){return e?i(e,null):i(null,t)});i(o,null)}function r(e){m(e,t,i)}function a(e){e=A.default.create(e),n(e)}t=_.default.extend({enableHighAccuracy:!0,timeout:5e3,maximumWait:1e4,maximumAge:0,desiredAccuracy:30,onProgress:_.default.noop,fallbackToIP:!1,addressLookup:!1,timezone:!1,map:void 0,staticMap:!1},t),t.enableHighAccuracy&&(t.maximumAge=0),t.timeout<1e3&&(t.timeout=1e3),t.maximumWait<t.timeout&&(t.maximumWait=t.timeout),u(t);var i=c(t,o);if(e.isGeolocationSupported())t.enableHighAccuracy?p(t,r,a):navigator.geolocation.getCurrentPosition(r,a,t);else{n(new A.default(A.default.Code.GEOLOCATION_NOT_SUPPORTED))}}},{key:"locateByMobile",value:function(t,o){if(!_.default.isPlainObject(t))throw new A.default(A.default.Code.INVALID_PARAMETERS);var n=c(t,o);t=_.default.extend({homeMobileCountryCode:void 0,homeMobileNetworkCode:void 0,radioType:void 0,carrier:void 0,fallbackToIP:!1,cellTowers:void 0,wifiAccessPoints:void 0,addressLookup:!1,timezone:!1,map:void 0,raw:!1},t),t.considerIp=t.fallbackToIP,u();var r=e._.config,a=r.google.key||"",l=_.default.setProtocol(N.default.URL.GOOGLE_GEOLOCATION,r.https),d={url:l+"?key="+a,headers:{"Content-Type":"application/json"},data:JSON.stringify(t)};O.default.post(d,function(e,o){var r=i(e,o);if(A.default.isGeoError(r))return n(r,null);r=t.raw?r:{coords:{latitude:r.location.lat,longitude:r.location.lng,accuracy:r.accuracy},timestamp:_.default.time()},m(r,t,n)})}},{key:"locateByIP",value:function(t,o){var n=e._.geoIpSource;if(!_.default.isPlainObject(n))throw new A.default(A.default.Code.INVALID_GEO_IP_SOURCE,"Please set a valid Geo-IP Source via geolocator.setGeoIPSource(options).");u(t||{});var r={url:n.url,async:!0,clean:!0};if(n.callbackParam)r.callbackParam=n.callbackParam,r.rootName="geolocator._.cb";else if(!n.globalVar)throw new A.default(A.default.Code.INVALID_GEO_IP_SOURCE,"Either callbackParam or globalVar should be set for Geo-IP source.");return O.default.jsonp(r,function(e,r){return e?o(A.default.create(e),null):(n.globalVar&&(window[n.globalVar]?(r=_.default.clone(window[n.globalVar]),delete window[n.globalVar]):r=null),r?(_.default.isPlainObject(n.schema)?r=_.default.mapToSchema(r,n.schema):_.default.isFunction(n.schema)&&(r=n.schema(r)),r.provider=n.provider||"unknown",s(r,t),r.coords&&(r.coords.latitude=Number(r.coords.latitude),r.coords.longitude=Number(r.coords.longitude)),void m(r,t,c(t,o))):(e=new A.default(A.default.Code.INVALID_RESPONSE),o(e,null)))})}},{key:"setGeoIPSource",value:function(t){if(!_.default.isPlainObject(t))throw new A.default(A.default.Code.INVALID_PARAMETERS,"Geo-IP source options is invalid.");if(!_.default.isStringSet(t.url))throw new A.default(A.default.Code.INVALID_PARAMETERS,"Geo-IP source should have a valid URI.");e._.geoIpSource=Object.freeze(t)}},{key:"watch",value:function(t,o){function n(t){var n=_.default.clone(t,{own:!1});if(i){var r=e.calcDistance({from:t.coords,to:i,formula:e.DistanceFormula.HAVERSINE,unitSystem:i.unitSystem});n.targetReached=r<=i.radius,a&&n.targetReached&&a.clear(function(){return o(null,n)})}return o(null,n)}function r(e){o(A.default.create(e),null)}if(!e.isGeolocationSupported())return o(new A.default(A.default.Code.GEOLOCATION_NOT_SUPPORTED),null),{};var a=void 0,i=void 0;return t=_.default.extend({enableHighAccuracy:!0,timeout:6e3,maximumAge:0,clearOnError:!1},t),_.default.isPlainObject(t.target)&&(i=_.default.extend({radius:.5,unitSystem:e.UnitSystem.METRIC},t.target)),new S.default(n,r,t)}},{key:"geocode",value:function(e,t){f(!1,e,t)}},{key:"reverseGeocode",value:function(e,t){f(!0,e,t)}},{key:"addressLookup",value:function(t,o){e.reverseGeocode(t,o)}},{key:"getTimeZone",value:function(t,o){if(!_.default.isPlainObject(t)||!_.default.isNumber(t.latitude)||!_.default.isNumber(t.longitude))throw new A.default(A.default.Code.INVALID_PARAMETERS);u();var n=e._.config;t=_.default.extend({key:n.google.key||"",language:n.language||"en",timestamp:_.default.time(!0),raw:!1},t);var r=_.default.setProtocol(N.default.URL.GOOGLE_TIMEZONE,n.https),a={url:r+"?location="+t.latitude+","+t.longitude+"&timestamp="+t.timestamp+"&language="+t.language+"&key="+t.key};O.default.xhr(a,function(e,n){var r=i(e,n);if(A.default.isGeoError(r))return o(r,null);r=t.raw?r:{id:r.timeZoneId,name:r.timeZoneName,abbr:_.default.abbr(r.timeZoneName,{dots:!1}),dstOffset:r.dstOffset,rawOffset:r.rawOffset,timestamp:t.timestamp},o(e,r)})}},{key:"getDistanceMatrix",value:function(t,o){u();var n=e._.config.google.key;e.ensureGoogleLoaded(n,function(e){if(e)throw new A.default(A.default.Code.GOOGLE_API_FAILED,String(e.message||e));var n=t.origins||t.origin||t.from,r=t.destinations||t.destination||t.to;if(!_.default.isPlainObject(t)||a(n)||a(r))throw new A.default(A.default.Code.INVALID_PARAMETERS);t.origins=b.default.toPointList(n),t.destinations=b.default.toPointList(r),t=_.default.extend({travelMode:google.maps.TravelMode.DRIVING,avoidFerries:void 0,avoidHighways:void 0,avoidTolls:void 0,unitSystem:google.maps.UnitSystem.METRIC},t),(new google.maps.DistanceMatrixService).getDistanceMatrix(t,function(e,n){var r=null;n!==google.maps.DistanceMatrixStatus.OK?(r=A.default.fromResponse(n)||A.default.fromResponse(e),e=null):e=t.raw?e:b.default.formatDistanceResults(e),o(r,e)})})}},{key:"calcDistance",value:function(t){t=_.default.extend({formula:e.DistanceFormula.HAVERSINE,unitSystem:e.UnitSystem.METRIC},t);var o=t.from,n=t.to,r=t.unitSystem===e.UnitSystem.METRIC?w:L;if(t.formula===e.DistanceFormula.HAVERSINE){var a=e.degToRad(n.latitude-o.latitude),i=e.degToRad(n.longitude-o.longitude),u=Math.sin(a/2)*Math.sin(a/2)+Math.cos(e.degToRad(o.latitude))*Math.cos(e.degToRad(n.longitude))*Math.sin(i/2)*Math.sin(i/2);return r*(2*Math.atan2(Math.sqrt(u),Math.sqrt(1-u)))}var l=e.degToRad(o.latitude),d=e.degToRad(n.latitude),s=e.degToRad(o.longitude),c=e.degToRad(n.longitude),f=(c-s)*Math.cos((l+d)/2),m=d-l;return Math.sqrt(f*f+m*m)*r}},{key:"getIP",value:function(t){var o=e._.config,n={url:_.default.setProtocol(N.default.URL.IP,o.https),async:!0,clean:!0,params:{format:"jsonp"},callbackParam:"callback",rootName:"geolocator._.cb"};return O.default.jsonp(n,function(e,o){return e?t(A.default.create(e),null):o?("object"===(void 0===o?"undefined":y(o))&&(o.timestamp=_.default.time()),void t(null,o)):(e=new A.default(A.default.Code.INVALID_RESPONSE),t(e,null))})}},{key:"ensureGoogleLoaded",value:function(t,o){var n=void 0;if(_.default.isFunction(t)?o=t:n=t,!e.isGoogleLoaded()){var r={url:N.default.URL.GOOGLE_MAPS_API,async:!0,callbackParam:"callback",params:{key:n||""},rootName:"geolocator._.cb"};return O.default.jsonp(r,o)}o()}},{key:"isGoogleLoaded",value:function(){return"google"in window&&google.maps}},{key:"isPositionError",value:function(e){return _.default.isPositionError(e)}},{key:"isGeoError",value:function(e){return A.default.isGeoError(e)}},{key:"isGeolocationSupported",value:function(){return navigator&&"geolocation"in navigator}},{key:"kmToMi",value:function(e){return.621371*e}},{key:"miToKm",value:function(e){return e/.621371}},{key:"degToRad",value:function(e){return e*(Math.PI/180)}},{key:"radToDeg",value:function(e){return e*(180/Math.PI)}},{key:"decToDegMinSec",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=e<0?-1:1,n=e<0?"S":"N",r=e<0?"W":"E",a=t?r:n,i=Math.abs(Math.round(1e6*e));return Math.floor(i/1e6)*o+"° "+Math.floor(60*(i/1e6-Math.floor(i/1e6)))+"' "+60*Math.floor(1e5*(60*(i/1e6-Math.floor(i/1e6))-Math.floor(60*(i/1e6-Math.floor(i/1e6)))))/1e5+'" '+a}},{key:"Error",get:function(){return A.default}},{key:"MapTypeId",get:function(){return N.default.MapTypeId}},{key:"LocationType",get:function(){return N.default.LocationType}},{key:"TravelMode",get:function(){return N.default.TravelMode}},{key:"UnitSystem",get:function(){return N.default.UnitSystem}},{key:"RadioType",get:function(){return N.default.RadioType}},{key:"DistanceFormula",get:function(){return N.default.DistanceFormula}},{key:"ImageFormat",get:function(){return N.default.ImageFormat}}]),e}();D._={config:_.default.extend({},M),cb:{}},D.setGeoIPSource({provider:"nekudo",url:"https://geoip.nekudo.com/api",callbackParam:"callback",schema:function(e){var t=e.location||{},o=(t.time_zone||"").replace(/\\/g,"");return{ip:e.ip,coords:{latitude:t.latitude,longitude:t.longitude},address:{city:e.city,state:"",stateCode:"",postalCode:"",countryCode:e.country.code,country:e.country.name,region:""},timezone:{id:o}}}}),t.default=D},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}Object.defineProperty(t,"__esModule",{value:!0});var r=o(0),a=n(r),i=o(3),u=n(i),l=o(1),d=n(l),s=o(2),c=n(s),f={toGoogleCoords:function(e){return{lat:e.lat||e.latitude,lng:e.lng||e.longitude}},fromGoogleCoords:function(e){return{latitude:e.latitude||e.lat,longitude:e.longitude||e.lng}},toPointList:function(e){return e=a.default.isArray(e)?e:[e],e.map(function(e){return a.default.isString(e)?e:f.toGoogleCoords(e)})},getGeocodeComps:function(e){return{route:e.route,locality:e.locality,administrative_area:e.administrativeArea,postal_code:e.postalCode,country:e.country,region:e.region}},buildGeocodeParams:function(e,t){var o=[],n=a.default.encodeURI;if(t)e.placeId?o.push("place_id="+e.placeId):e.latitude&&e.longitude&&o.push("latlng="+e.latitude+","+e.longitude);else{e.address&&o.push("address="+n(e.address));var r=f.getGeocodeComps(e);r=a.default.params(r,{operator:":",separator:"|"}),o.push("components="+r);var i=e.bounds;a.default.isArray(i)&&4===i.length?o.push("bounds="+i[0]+","+i[1]+"|"+i[2]+","+i[3]):a.default.isPlainObject(i)&&4===Object.keys(i).length&&o.push("bounds="+i.southwestLat+","+i.southwestLng+"|"+i.northeastLat+","+i.northeastLng)}return o.push("language="+e.language),o.push("key="+e.key),o.join("&")},formatGeocodeResults:function(e){if(!a.default.isArray(e)||e.length<=0)return{location:null,address:null,formattedAddress:"",type:null,placeId:""};var t=void 0,o=void 0,n={},r=e[0],i=r.address_components;for(t=0;t<i.length;t+=1)o=i[t],o.types&&o.types.length>0&&(n[o.types[0]]=o.long_name,n[o.types[0]+"_s"]=o.short_name);var u=r.geometry;return{coords:u&&u.location?{latitude:u.location.lat,longitude:u.location.lng}:null,address:{commonName:n.point_of_interest||n.premise||n.subpremise||n.colloquial_area||"",streetNumber:n.street_number||"",street:n.administrative_area_level_4||n.administrative_area_level_3||n.route||"",route:n.route||"",neighborhood:n.neighborhood||n.administrative_area_level_5||n.administrative_area_level_4||"",town:n.sublocality||n.administrative_area_level_2||"",city:n.locality||n.administrative_area_level_1||"",region:n.administrative_area_level_2||n.administrative_area_level_1||"",postalCode:n.postal_code||"",state:n.administrative_area_level_1||"",stateCode:n.administrative_area_level_1_s||"",country:n.country||"",countryCode:n.country_s||""},formattedAddress:r.formatted_address,type:u.location_type||"",placeId:r.place_id,timestamp:a.default.time()}},geocode:function(e,t,o,n){var r={};if(a.default.isString(o)){r={};r[e?"placeId":"address"]=o}else{if(!a.default.isPlainObject(o))throw new c.default(c.default.Code.INVALID_PARAMETERS);r=o}if(e){var i=a.default.isNumber(o.latitude)&&a.default.isNumber(o.longitude);if(!a.default.isString(o.placeId)&&!i)throw new c.default(c.default.Code.INVALID_PARAMETERS)}r=a.default.extend({key:t.google.key||"",language:t.language||"en",raw:!1},r);var l=f.buildGeocodeParams(r,e),s=a.default.setProtocol(d.default.URL.GOOGLE_GEOCODE,t.https),m={url:s+"?"+l};u.default.xhr(m,function(e,t){if(e)return n(c.default.create(e),null);var r=a.default.safeJsonParse(t.responseText),i=c.default.fromResponse(r);if(i)return n(i,null);r=o.raw?r:f.formatGeocodeResults(r.results),n(null,r)})},formatDistanceResults:function(e){if(!a.default.isPlainObject(e))return null;var t=[],o=e.originAddresses,n=e.destinationAddresses,r=e.rows,i=void 0;return o.forEach(function(e,o){n.forEach(function(n,u){i=r[o].elements[u],t.push({from:e,to:n,distance:i.distance,duration:i.duration,fare:i.fare,timestamp:a.default.time()})})}),t},mapStylesToParams:function(e){if(!e)return"";a.default.isArray(e)||(e=[e]);var t=[];return e.forEach(function(e,o,n){var r="";e.stylers&&e.stylers.length>0&&(r+=(e.hasOwnProperty("featureType")?"feature:"+e.featureType:"feature:all")+"|",r+=(e.hasOwnProperty("elementType")?"element:"+e.elementType:"element:all")+"|",e.stylers.forEach(function(e,t,o){var n=Object.keys(e)[0];r+=n+":"+e[n].toString().replace("#","0x")+"|"})),t.push("style="+encodeURIComponent(r))}),t.join("&")}};t.default=f},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function r(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}Object.defineProperty(t,"__esModule",{value:!0});var a=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}(),i=o(0),u=n(i),l=function(){function e(t,o){var n=this,a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};r(this,e),this.isCleared=!1,this.cycle=0,this._timer=null,this.id=navigator.geolocation.watchPosition(function(e){n.cycle++,u.default.isFunction(t)&&t(e)},function(e){n.cycle++,u.default.isFunction(o)&&o(e),a.clearOnError&&n.clear()},a)}return a(e,[{key:"_clear",value:function(){navigator.geolocation.clearWatch(this.id),this.isCleared=!0,this._timer=null}},{key:"clear",value:function(e,t){var o=this,n=u.default.isNumber(e)?e:0,r=u.default.isFunction(t)?t:u.default.isFunction(e)?e:null;if(this._timer&&(clearTimeout(this._timer),this._timer=null),!this.isCleared){if(0===n)return this._clear(),void(r&&r());this._timer=setTimeout(function(){o._clear(),r&&r()},n)}}}]),e}();t.default=l},function(e,t,o){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}var r=o(4),a=n(r);"undefined"!=typeof window&&void 0===window.geolocator&&(window.geolocator=a.default),e.exports=a.default}])});
/*!
* Geolocator.js https://github.com/onury/geolocator
* @license MIT. © 2019, Onur Yıldırım
*/
!function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define("geolocator",[],t):"object"==typeof exports?exports.geolocator=t():e.geolocator=t()}(window,function(){return function(e){var t={};function o(n){if(t[n])return t[n].exports;var r=t[n]={i:n,l:!1,exports:{}};return e[n].call(r.exports,r,r.exports,o),r.l=!0,r.exports}return o.m=e,o.c=t,o.d=function(e,t,n){o.o(e,t)||Object.defineProperty(e,t,{configurable:!1,enumerable:!0,get:n})},o.r=function(e){Object.defineProperty(e,"__esModule",{value:!0})},o.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return o.d(t,"a",t),t},o.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},o.p="dist/",o(o.s=1)}([function(e,t,o){"use strict";o.r(t);var n="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},r=Object.prototype.toString,i={noop:function(){},isString:function(e){return"string"==typeof e},isStringSet:function(e){return"string"==typeof e&&e.trim().length>0},isNumber:function(e){return"number"==typeof e},isObject:function(e){var t=void 0===e?"undefined":n(e);return Boolean(e)&&("object"===t||"function"===t)},isFunction:function(e){return"function"==typeof e},isArray:function(e){return Boolean(e)&&"[object Array]"===r.call(e)},isFilledArray:function(e){return i.isArray(e)&&e.length>0},isPlainObject:function(e){return Boolean(e)&&"object"===(void 0===e?"undefined":n(e))&&"[object Object]"===r.call(e)},isDate:function(e){return Boolean(e)&&"[object Date]"===r.call(e)},isElement:function(e){return!!e&&(e instanceof HTMLElement||"object"===(void 0===e?"undefined":n(e))&&1===e.nodeType)},isNode:function(e){return!!e&&(e instanceof Node||"object"===(void 0===e?"undefined":n(e))&&"number"==typeof e.nodeType)},isJQueryObject:function(e){return!!e&&("jQuery"in window&&e instanceof window.jQuery&&Boolean(e[0]))},isPositionError:function(e){return Boolean(e)&&"[object PositionError]"===r.call(e)},isError:function(e){return e instanceof Error||i.isPositionError(e)},removeQuery:function(e){return e.replace(/\?.*$/,"")},removeProtocol:function(e){return e.replace(/^(.*:)?\/\//,"")},setProtocol:function(e,t){return(void 0===t||null===t?window.location.protocol:t?"https:":"http:")+"//"+(e=i.removeProtocol(e))},trimDots:function(e){return e.replace(/^\.+?(.*?)\.+?$/g,"$1")},encodeURI:function(e){return encodeURIComponent(e).replace(/%20/g,"+")},decodeURI:function(e){return decodeURIComponent(e.replace(/\+/g,"%20"))},toString:function(e){return null===e||void 0===e?"":e.toString&&i.isFunction(e.toString)?e.toString():String(e)},randomString:function(e){return e&&i.isNumber(e)||(e=1),e=-Math.abs(e),Math.random().toString(36).slice(e)},abbr:function(e,t){var o=(t=i.extend({upper:!0,dots:!0},t)).dots?".":"",n=e.match(/(\b\w)/gi).join(o)+o;return t.upper?n.toUpperCase():n},params:function(e,t){if(!i.isPlainObject(e)||0===Object.keys(e).length)return"";t=i.extend({encode:!0,operator:"=",separator:"&",include:void 0,exclude:void 0},t);var o=[],n=i.isArray(t.include)?t.include:null,r=!n&&i.isArray(t.exclude)?t.exclude:null;return i.forIn(e,function(e,a){if((!n||n.indexOf(a)>=0)&&(!r||r.indexOf(a)<0)){var u=i.toString(e);u=t.encode?i.encodeURI(u):u;var s=t.encode?i.encodeURI(a):a;o.push(s+t.operator+u)}}),o.join(t.separator)},notateGlobalObj:function(e){var t=(e=i.trimDots(e)).split("."),o=window;return"window"!==t[0]&&"document"!==t[0]||t.shift(),t.forEach(function(e){o=o[e]}),o},forIn:function(e,t){var o=void 0;for(o in e)if(!1===t(e[o],o,e))break},extend:function(e){if(!i.isObject(e))return{};for(var t=void 0,o=void 0,n=arguments.length,r=Array(n>1?n-1:0),a=1;a<n;a++)r[a-1]=arguments[a];return r.forEach(function(n){for(t in n)o=n[t],i.isArray(o)?e[t]=o.concat():i.isDate(o)?e[t]=new Date(o):i.isFunction(o)?e[t]=o:i.isObject(o)?e[t]=i.extend({},o):e[t]=o}),e},clone:function(e,t){if(!e)return{};i.isArray(t)&&(t={keys:t}),t=i.extend({keys:null,own:!0},t);var o={};return i.forIn(e,function(n,r){(t.keys?t.keys.indexOf(r)>=0:t.own&&e.hasOwnProperty(r)||!t.own)&&(i.isObject(n)?o[r]=i.clone(n,t):o[r]=n)}),o},mapToSchema:function(e,t){var o={};return i.forIn(t,function(t,n){i.isPlainObject(t)?o[n]=i.mapToSchema(e,t):o[n]=e[t]}),o},safeJsonParse:function(e){var t=null;try{t=JSON.parse(e)}catch(e){}return t},time:function(e){var t=Date.now();return e?parseInt(t/1e3,10):t}},a=i,u=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}();var s=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return u(e,null,[{key:"jsonp",value:function(e,t){var o=void 0;if(t=a.isFunction(t)?t:a.noop,a.isString(e)&&(e={url:e}),!a.isPlainObject(e))return t(new Error("No options or target URL is provided."));if(e=a.extend({async:!0,defer:!1,timeout:0,params:{},clean:!0},e),!1===a.isString(e.url)||""===e.url.trim())return t(new Error("No target URL is provided."));var n=document.createElement("script"),r=a.isString(e.callbackParam)&&""!==e.callbackParam.trim(),i=void 0,u=void 0,s=a.isString(e.rootName)&&"window"!==e.rootName&&"document"!==e.rootName&&""!==e.rootName.trim();r&&(i="_jsonp_"+a.randomString(10),e.params[e.callbackParam]=s?e.rootName+"."+i:i);var l=a.params(e.params)||"",c=e.url.indexOf("?")>=0?"&":"?",d=l?""+e.url+c+l:e.url;function f(r,a,l){o&&(clearTimeout(o),o=null),(a||e.clean)&&n.parentNode&&n.parentNode.removeChild(n),s&&delete u[i],t(r,l)}if(i){(u=s?a.notateGlobalObj(e.rootName):window)[i]=function(e){f(null,!1,e)}}else n.readyState?n.onreadystatechange=function(){"loaded"!==n.readyState&&"complete"!==n.readyState||(n.onreadystatechange=null,f(null))}:n.onload=function(){f(null)};n.onerror=function(t){var o="Could not load source at "+a.removeQuery(e.url);t&&(o+="\n"+(t.message||t)),f(new Error(o))},e.type&&(n.type=e.type),e.charset&&(n.charset=e.charset),e.async&&(n.async=!0),e.defer&&(n.defer=!0),e.crossorigin&&(n.crossorigin=e.crossorigin),n.src=d,document.getElementsByTagName("head")[0].appendChild(n),a.isNumber(e.timeout)&&e.timeout>0&&(o=setTimeout(function(){n.src="",f(new Error("Operation timed out."),!0)},e.timeout))}},{key:"xhr",value:function(t,o){var n=void 0,r=void 0,i=!1;if("XMLHttpRequest"in window)n=new XMLHttpRequest;else{if(!("XDomainRequest"in window))throw new Error("XMLHttpRequest is not supported!");n=new XDomainRequest,i=!0}var u=a.isFunction(o);function s(){var e=0===n.status?". Make sure you have permission if this is a cross-domain request.":"";r=new Error("The request returned status: "+n.status+e),o(r,n)}o=u?o:a.noop,a.isString(t)&&(t={url:t}),a.isPlainObject(t)?t=a.extend({method:"GET",data:void 0,async:!0,timeout:0,withCredentials:!1,mimeType:void 0,username:"",password:""},t):o(new Error("No options or target URL is provided.")),!1===a.isString(t.url)&&o(new Error("No target URL is provided.")),t.username=String(t.username),t.password=String(t.password),t.method=t.method.toUpperCase(),"POST"!==t.method&&"PUT"!==t.method&&(t.data=void 0),u&&(i?(n.onload=function(){o(null,n)},n.onerror=s):n.onreadystatechange=function(){n.readyState===e.XHR_READY_STATE.DONE&&(200===n.status?o(null,n):s())},a.isNumber(t.timeout)&&t.timeout>0&&(n.timeout=t.timeout,n.ontimeout=function(){r=new Error("The request had timed out."),o(r,n)})),n.open(t.method,t.url,t.async,t.username,t.password),i||(a.isPlainObject(t.headers)&&Object.keys(t.headers).forEach(function(e){var o=t.headers[e];n.setRequestHeader(e,o)}),t.mimeType&&n.overrideMimeType(t.mimeType)),n.send(t.data)}},{key:"get",value:function(t,o){return e.xhr(t,o)}},{key:"post",value:function(e,t){return l("POST",e,t)}},{key:"put",value:function(e,t){return l("PUT",e,t)}},{key:"delete",value:function(e,t){return l("DELETE",e,t)}}]),e}();function l(e,t,o){return(t=a.isString(t)?{url:t}:t||{}).method=e,s.xhr(t,o)}s.XHR_READY_STATE={UNSENT:0,OPENED:1,HEADERS_RECEIVED:2,LOADING:3,DONE:4};var c=s,d=Object.freeze({URL:{IP:"//api.ipify.org",FLAG:"//cdnjs.cloudflare.com/ajax/libs/flag-icon-css/2.3.1/flags/4x3/",GOOGLE_MAPS_API:"//maps.googleapis.com/maps/api/js",GOOGLE_SATATIC_MAP:"//maps.googleapis.com/maps/api/staticmap",GOOGLE_GEOLOCATION:"//www.googleapis.com/geolocation/v1/geolocate",GOOGLE_GEOCODE:"//maps.googleapis.com/maps/api/geocode/json",GOOGLE_TIMEZONE:"//maps.googleapis.com/maps/api/timezone/json",GOOGLE_DISTANCE_MATRIX:"//maps.googleapis.com/maps/api/distancematrix/json"},MapTypeId:{HYBRID:"hybrid",ROADMAP:"roadmap",SATELLITE:"satellite",TERRAIN:"terrain"},LocationType:{ROOFTOP:"ROOFTOP",RANGE_INTERPOLATED:"RANGE_INTERPOLATED",GEOMETRIC_CENTER:"GEOMETRIC_CENTER",APPROXIMATE:"APPROXIMATE"},TravelMode:{DRIVING:"DRIVING",WALKING:"WALKING",BICYCLING:"BICYCLING",TRANSIT:"TRANSIT"},UnitSystem:{METRIC:0,IMPERIAL:1},RadioType:{LTE:"lte",GSM:"gsm",CDMA:"cdma",WCDMA:"wcdma"},DistanceFormula:{HAVERSINE:"haversine",PYTHAGOREAN:"pythagorean"},ImageFormat:{PNG:"png",PNG_8:"png8",PNG_32:"png32",GIF:"gif",JPG:"jpg",JPG_BASELINE:"jpg-baseline"}}),f="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e},m=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}();var p=function(){function e(){var t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:e.Code.UNKNOWN_ERROR,o=arguments[1];!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),o=o||String(t),Object.defineProperty(this,"name",{enumerable:!1,writable:!1,value:"GeoError"}),Object.defineProperty(this,"code",{enumerable:!1,writable:!0,value:t}),Object.defineProperty(this,"message",{enumerable:!1,writable:!0,value:o}),Error.hasOwnProperty("captureStackTrace")?Error.captureStackTrace(this,this.constructor):Object.defineProperty(this,"stack",{enumerable:!1,writable:!1,value:new Error(o).stack})}return m(e,null,[{key:"create",value:function(t){if(t instanceof e)return t;var o=void 0,n=void 0;if(a.isPositionError(t)&&t.code){switch(t.code){case 1:o=e.Code.PERMISSION_DENIED;break;case 2:o=e.Code.POSITION_UNAVAILABLE;break;case 3:o=e.Code.TIMEOUT;break;default:o=e.Code.UNKNOWN_ERROR}return new e(o,t.message||"")}return"string"==typeof t?o=n=t:"object"===(void 0===t?"undefined":f(t))&&(o=t.code||t.message,n=t.message||t.code),o&&e.isValidErrorCode(o)?new e(o,n):new e(e.Code.UNKNOWN_ERROR,n)}},{key:"fromResponse",value:function(t){var o=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"";if(!t)return new e(e.Code.INVALID_RESPONSE);var n=void 0;if(a.isString(t)&&(n=g(t)))return new e(n,o||t);if(!a.isObject(t))return null;var r=t.error_message||t.errorMessage||t.error&&t.error.message||"";if(t.status&&(n=g(t.status)))return new e(n,r||o||t.status);if(t.error){var i=t.reason||t.error.reason;if(!i){var u=t.error.errors;a.isArray(u)&&u.length>0&&(i=u[0].reason,r=r||u[0].message)}return new e(n=function(e){switch(e){case"invalid":return p.Code.INVALID_REQUEST;case"dailyLimitExceeded":return p.Code.DAILY_LIMIT_EXCEEDED;case"keyInvalid":return p.Code.GOOGLE_KEY_INVALID;case"userRateLimitExceeded":return p.Code.USER_RATE_LIMIT_EXCEEDED;case"notFound":return p.Code.NOT_FOUND;case"parseError":return p.Code.PARSE_ERROR;default:return null}}(i)||e.Code.UNKNOWN_ERROR,r||i||o)}return r?new e(n=g(r)||e.Code.UNKNOWN_ERROR,r||o):null}},{key:"isGeoError",value:function(t){return t instanceof e}},{key:"isValidErrorCode",value:function(t){var o=void 0;for(o in e.Code)if(e.Code.hasOwnProperty(o)&&t===e.Code[o])return!0;return!1}}]),e}();function g(e){return e?"OK"===e?null:"ZERO_RESULTS"===e?p.Code.NOT_FOUND:p.Code.hasOwnProperty(e)?e:null:p.Code.INVALID_RESPONSE}p.prototype.toString=function(){var e=this.code!==this.message?" ("+this.message+")":"";return this.name+": "+this.code+e},"function"==typeof Object.setPrototypeOf?Object.setPrototypeOf(p.prototype,Error.prototype):p.prototype=Object.create(Error.prototype),p.Code={GEOLOCATION_NOT_SUPPORTED:"GEOLOCATION_NOT_SUPPORTED",INVALID_GEO_IP_SOURCE:"INVALID_GEO_IP_SOURCE",PERMISSION_DENIED:"PERMISSION_DENIED",POSITION_UNAVAILABLE:"POSITION_UNAVAILABLE",TIMEOUT:"TIMEOUT",INVALID_PARAMETERS:"INVALID_PARAMETERS",INVALID_RESPONSE:"INVALID_RESPONSE",INVALID_REQUEST:"INVALID_REQUEST",REQUEST_DENIED:"REQUEST_DENIED",REQUEST_FAILED:"REQUEST_FAILED",GOOGLE_API_FAILED:"GOOGLE_API_FAILED",OVER_QUERY_LIMIT:"OVER_QUERY_LIMIT",USER_RATE_LIMIT_EXCEEDED:"USER_RATE_LIMIT_EXCEEDED",DAILY_LIMIT_EXCEEDED:"DAILY_LIMIT_EXCEEDED",GOOGLE_KEY_INVALID:"GOOGLE_KEY_INVALID",MAX_ELEMENTS_EXCEEDED:"MAX_ELEMENTS_EXCEEDED",MAX_DIMENSIONS_EXCEEDED:"MAX_DIMENSIONS_EXCEEDED",MAX_WAYPOINTS_EXCEEDED:"MAX_WAYPOINTS_EXCEEDED",PARSE_ERROR:"PARSE_ERROR",NOT_FOUND:"NOT_FOUND",INTERNAL_ERROR:"INTERNAL_ERROR",UNKNOWN_ERROR:"UNKNOWN_ERROR"};var E=p,y={toGoogleCoords:function(e){return{lat:e.lat||e.latitude,lng:e.lng||e.longitude}},fromGoogleCoords:function(e){return{latitude:e.latitude||e.lat,longitude:e.longitude||e.lng}},toPointList:function(e){return(e=a.isArray(e)?e:[e]).map(function(e){return a.isString(e)?e:y.toGoogleCoords(e)})},getGeocodeComps:function(e){return{route:e.route,locality:e.locality,administrative_area:e.administrativeArea,postal_code:e.postalCode,country:e.country,region:e.region}},buildGeocodeParams:function(e,t){var o=[],n=a.encodeURI;if(t)e.placeId?o.push("place_id="+e.placeId):e.latitude&&e.longitude&&o.push("latlng="+e.latitude+","+e.longitude);else{e.address&&o.push("address="+n(e.address));var r=y.getGeocodeComps(e);r=a.params(r,{operator:":",separator:"|"}),o.push("components="+r);var i=e.bounds;a.isArray(i)&&4===i.length?o.push("bounds="+i[0]+","+i[1]+"|"+i[2]+","+i[3]):a.isPlainObject(i)&&4===Object.keys(i).length&&o.push("bounds="+i.southwestLat+","+i.southwestLng+"|"+i.northeastLat+","+i.northeastLng)}return o.push("language="+e.language),o.push("key="+e.key),o.join("&")},formatGeocodeResults:function(e){if(!a.isArray(e)||e.length<=0)return{location:null,address:null,formattedAddress:"",type:null,placeId:""};var t=void 0,o=void 0,n={},r=e[0],i=r.address_components;for(t=0;t<i.length;t+=1)(o=i[t]).types&&o.types.length>0&&(n[o.types[0]]=o.long_name,n[o.types[0]+"_s"]=o.short_name);var u=r.geometry;return{coords:u&&u.location?{latitude:u.location.lat,longitude:u.location.lng}:null,address:{commonName:n.point_of_interest||n.premise||n.subpremise||n.colloquial_area||"",streetNumber:n.street_number||"",street:n.administrative_area_level_4||n.administrative_area_level_3||n.route||"",route:n.route||"",neighborhood:n.neighborhood||n.administrative_area_level_5||n.administrative_area_level_4||"",town:n.sublocality||n.administrative_area_level_2||"",city:n.locality||n.administrative_area_level_1||"",region:n.administrative_area_level_2||n.administrative_area_level_1||"",postalCode:n.postal_code||"",state:n.administrative_area_level_1||"",stateCode:n.administrative_area_level_1_s||"",country:n.country||"",countryCode:n.country_s||""},formattedAddress:r.formatted_address,type:u.location_type||"",placeId:r.place_id,timestamp:a.time()}},geocode:function(e,t,o,n){var r={};if(a.isString(o)){(r={})[e?"placeId":"address"]=o}else{if(!a.isPlainObject(o))throw new E(E.Code.INVALID_PARAMETERS);r=o}if(e){var i=a.isNumber(o.latitude)&&a.isNumber(o.longitude);if(!a.isString(o.placeId)&&!i)throw new E(E.Code.INVALID_PARAMETERS)}r=a.extend({key:t.google.key||"",language:t.language||"en",raw:!1},r);var u=y.buildGeocodeParams(r,e),s={url:a.setProtocol(d.URL.GOOGLE_GEOCODE,t.https)+"?"+u};c.xhr(s,function(e,t){if(e)return n(E.create(e),null);var r=a.safeJsonParse(t.responseText),i=E.fromResponse(r);if(i)return n(i,null);r=o.raw?r:y.formatGeocodeResults(r.results),n(null,r)})},formatDistanceResults:function(e){if(!a.isPlainObject(e))return null;var t=[],o=e.originAddresses,n=e.destinationAddresses,r=e.rows,i=void 0;return o.forEach(function(e,o){n.forEach(function(n,u){i=r[o].elements[u],t.push({from:e,to:n,distance:i.distance,duration:i.duration,fare:i.fare,timestamp:a.time()})})}),t},mapStylesToParams:function(e){if(!e)return"";a.isArray(e)||(e=[e]);var t=[];return e.forEach(function(e,o,n){var r="";e.stylers&&e.stylers.length>0&&(r+=(e.hasOwnProperty("featureType")?"feature:"+e.featureType:"feature:all")+"|",r+=(e.hasOwnProperty("elementType")?"element:"+e.elementType:"element:all")+"|",e.stylers.forEach(function(e,t,o){var n=Object.keys(e)[0],i=e[n].toString().replace("#","0x");r+=n+":"+i+"|"})),t.push("style="+encodeURIComponent(r))}),t.join("&")}},v=y,I=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}();var O=function(){function e(t,o){var n=this,r=arguments.length>2&&void 0!==arguments[2]?arguments[2]:{};!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e),this.isCleared=!1,this.cycle=0,this._timer=null,this.id=navigator.geolocation.watchPosition(function(e){n.cycle++,a.isFunction(t)&&t(e)},function(e){n.cycle++,a.isFunction(o)&&o(e),r.clearOnError&&n.clear()},r)}return I(e,[{key:"_clear",value:function(){navigator.geolocation.clearWatch(this.id),this.isCleared=!0,this._timer=null}},{key:"clear",value:function(e,t){var o=this,n=a.isNumber(e)?e:0,r=a.isFunction(t)?t:a.isFunction(e)?e:null;if(this._timer&&(clearTimeout(this._timer),this._timer=null),!this.isCleared){if(0===n)return this._clear(),void(r&&r());this._timer=setTimeout(function(){o._clear(),r&&r()},n)}}}]),e}();o.d(t,"geolocator",function(){return R});var _=function(){function e(e,t){for(var o=0;o<t.length;o++){var n=t[o];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,n.key,n)}}return function(t,o,n){return o&&e(t.prototype,o),n&&e(t,n),t}}();var h={language:"en",https:!0,google:{version:"3",key:"",styles:null}},R=function(){function e(){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,e)}return _(e,null,[{key:"config",value:function(t){return t&&(e._.config=a.extend(h,t)),e._.config}},{key:"getStaticMap",value:function(t,o){if(!a.isPlainObject(t)||!t.center)throw new E(E.Code.INVALID_PARAMETERS,"A center address or coordinates are required.");if(a.isString(t.center))return e.geocode(t.center,function(n,r){n&&o(n),t.center=r.coords,o(null,e.getStaticMap(t))});var n=e._.config,r=a.extend({mapTypeId:d.MapTypeId.ROADMAP,size:{width:600,height:300},scale:1,zoom:9,marker:"red",format:d.ImageFormat.PNG,language:n.language||"en",region:null},t),i=a.isPlainObject(r.center)?r.center.latitude+","+r.center.longitude:String(r.center),u=a.isPlainObject(r.size)?r.size.width+"x"+r.size.height:String(r.size),s=d.URL.GOOGLE_SATATIC_MAP+"?center="+i+"&maptype="+r.mapTypeId+"&size="+u+"&scale="+r.scale+"&zoom="+r.zoom+"&format="+r.format+"&language="+r.language;if(r.marker){var l=a.isString(r.marker)?r.marker:"red";s+="&markers="+encodeURIComponent("color:"+l+"|"+i)}r.region&&(s+="&region="+r.region),n.google.key&&(s+="&key="+n.google.key);var c=L(r);return c&&(s+="&"+v.mapStylesToParams(c)),a.isFunction(o)?o(null,s):s}},{key:"createMap",value:function(t,o){a.isPlainObject(t)||(t={element:t});var n=(t=a.extend({element:null,mapTypeId:d.MapTypeId.ROADMAP,title:void 0,marker:!0,zoom:9},t)).element,r=void 0;if(a.isString(n)?r=document.getElementById(n):a.isJQueryObject(n)?r=n[0]:e.isGoogleLoaded()&&n instanceof google.maps.Map&&(r=n.getDiv()),!a.isElement(r)&&!a.isNode(r))throw new E(E.Code.INVALID_PARAMETERS,"A valid DOM element or element ID is required to create a map.");if(!a.isPlainObject(t.center)||!a.isNumber(t.center.latitude)||!a.isNumber(t.center.longitude))throw new E(E.Code.INVALID_PARAMETERS,"Center coordinates are required to create a map.");t.element=r;var i=e._.config.google.key;t.styles=L(t),e.ensureGoogleLoaded(i,function(e){if(e)throw new E(E.Code.GOOGLE_API_FAILED,String(e.message||e));var n=function(e){var t=e.element,o=t._geolocatorMapData,n=o&&o.instance||null,r=o&&o.marker||null,i=o&&o.infoWindow||null,a=new google.maps.LatLng(e.center.latitude,e.center.longitude),u={mapTypeId:e.mapTypeId,center:a,zoom:e.zoom,styles:e.styles||null};n?n.setOptions(u):n=new google.maps.Map(e.element,u);i&&(i=null);r&&r instanceof google.maps.Marker&&(google.maps.event.clearInstanceListeners(r),r.setMap(null),r=null);e.marker&&(r=new google.maps.Marker({position:u.center,map:n}),e.title&&((i=new google.maps.InfoWindow).setContent(e.title),google.maps.event.addListener(r,"click",function(){i.open(n,r)})));return o={element:t,instance:n,marker:r,infoWindow:i,options:u},t._geolocatorMapData=o,o}(t);o(null,n)})}},{key:"locate",value:function(t,o){(t=a.extend({enableHighAccuracy:!0,timeout:6e3,maximumWait:1e4,maximumAge:0,desiredAccuracy:30,onProgress:a.noop,fallbackToIP:!1,addressLookup:!1,timezone:!1,map:void 0,staticMap:!1},t)).enableHighAccuracy&&(t.maximumAge=0),t.timeout<1e3&&(t.timeout=1e3),t.maximumWait<t.timeout&&(t.maximumWait=t.timeout),b(t);var n=N(t,o);function r(o){if(t.fallbackToIP)return e.locateByIP(t,function(e,t){return e?n(e,null):n(null,t)});n(o,null)}function i(e){w(e,t,n)}function u(e){r(e=E.create(e))}e.isGeolocationSupported()?t.enableHighAccuracy?function(e,t,o){var n=void 0,r=void 0,i=a.isFunction(e.onProgress)?e.onProgress:a.noop;function u(){r=null,n?t(n):o(new E(E.Code.POSITION_UNAVAILABLE))}(r=R.watch(e,function(t,a){if(r){if(t)return r.clear(function(){o(t)});n=a,r.cycle>1&&n.coords.accuracy<=e.desiredAccuracy?r.clear(u):i(n)}}))&&r.clear(e.maximumWait+100,u)}(t,i,u):navigator.geolocation.getCurrentPosition(i,u,t):r(new E(E.Code.GEOLOCATION_NOT_SUPPORTED))}},{key:"locateByMobile",value:function(t,o){if(!a.isPlainObject(t))throw new E(E.Code.INVALID_PARAMETERS);var n=N(t,o);(t=a.extend({homeMobileCountryCode:void 0,homeMobileNetworkCode:void 0,radioType:void 0,carrier:void 0,fallbackToIP:!1,cellTowers:void 0,wifiAccessPoints:void 0,addressLookup:!1,timezone:!1,map:void 0,raw:!1},t)).considerIp=t.fallbackToIP,b();var r=e._.config,i=r.google.key||"",u={url:a.setProtocol(d.URL.GOOGLE_GEOLOCATION,r.https)+"?key="+i,headers:{"Content-Type":"application/json"},data:JSON.stringify(t)};c.post(u,function(e,o){var r=T(e,o);if(E.isGeoError(r))return n(r,null);w(r=t.raw?r:{coords:{latitude:r.location.lat,longitude:r.location.lng,accuracy:r.accuracy},timestamp:a.time()},t,n)})}},{key:"locateByIP",value:function(t,o){var n=e._.geoIpSource;if(!a.isPlainObject(n))throw new E(E.Code.INVALID_GEO_IP_SOURCE,"Please set a valid Geo-IP Source via geolocator.setGeoIPSource(options).");function r(e){if(!e){var r=new E(E.Code.INVALID_RESPONSE);return o(r,null)}a.isPlainObject(n.schema)?e=a.mapToSchema(e,n.schema):a.isFunction(n.schema)&&(e=n.schema(e)),e.provider=n.provider||"unknown",S(e,t),e.coords&&(e.coords.latitude=Number(e.coords.latitude),e.coords.longitude=Number(e.coords.longitude));var i=N(t,o);w(e,t,i)}if(b(t||{}),n.xhr){var i={url:n.url,async:!0};return c.get(i,function(e,t){var n=t.responseText?JSON.parse(t.responseText):null;if(e)return o(E.create(e),null);r(n)})}if(n.callbackParam||n.globalVar){var u={url:n.url,async:!0,clean:!0};return n.callbackParam&&(u.callbackParam=n.callbackParam,u.rootName="geolocator._.cb"),c.jsonp(u,function(e,t){if(e)return o(E.create(e),null);n.globalVar&&(window[n.globalVar]?(t=a.clone(window[n.globalVar]),delete window[n.globalVar]):t=null),r(t)})}throw new E(E.Code.INVALID_GEO_IP_SOURCE,"Either xhr, callbackParam or globalVar should be set for Geo-IP source.")}},{key:"setGeoIPSource",value:function(t){if(!a.isPlainObject(t))throw new E(E.Code.INVALID_PARAMETERS,"Geo-IP source options is invalid.");if(!a.isStringSet(t.url))throw new E(E.Code.INVALID_PARAMETERS,"Geo-IP source should have a valid URI.");e._.geoIpSource=Object.freeze(t)}},{key:"watch",value:function(t,o){if(!e.isGeolocationSupported())return o(new E(E.Code.GEOLOCATION_NOT_SUPPORTED),null),{};var n=void 0,r=void 0;return t=a.extend({enableHighAccuracy:!0,timeout:6e3,maximumAge:0,clearOnError:!1},t),a.isPlainObject(t.target)&&(r=a.extend({radius:.5,unitSystem:e.UnitSystem.METRIC},t.target)),new O(function(t){var i=a.clone(t,{own:!1});if(r){var u=e.calcDistance({from:t.coords,to:r,formula:e.DistanceFormula.HAVERSINE,unitSystem:r.unitSystem});i.targetReached=u<=r.radius,n&&i.targetReached&&n.clear(function(){return o(null,i)})}return o(null,i)},function(e){o(E.create(e),null)},t)}},{key:"geocode",value:function(e,t){P(!1,e,t)}},{key:"reverseGeocode",value:function(e,t){P(!0,e,t)}},{key:"addressLookup",value:function(t,o){e.reverseGeocode(t,o)}},{key:"getTimeZone",value:function(t,o){if(!a.isPlainObject(t)||!a.isNumber(t.latitude)||!a.isNumber(t.longitude))throw new E(E.Code.INVALID_PARAMETERS);b();var n=e._.config;t=a.extend({key:n.google.key||"",language:n.language||"en",timestamp:a.time(!0),raw:!1},t);var r={url:a.setProtocol(d.URL.GOOGLE_TIMEZONE,n.https)+"?location="+t.latitude+","+t.longitude+"&timestamp="+t.timestamp+"&language="+t.language+"&key="+t.key};c.xhr(r,function(e,n){var r=T(e,n);if(E.isGeoError(r))return o(r,null);r=t.raw?r:{id:r.timeZoneId,name:r.timeZoneName,abbr:a.abbr(r.timeZoneName,{dots:!1}),dstOffset:r.dstOffset,rawOffset:r.rawOffset,timestamp:t.timestamp},o(e,r)})}},{key:"getDistanceMatrix",value:function(t,o){b();var n=e._.config.google.key;e.ensureGoogleLoaded(n,function(e){if(e)throw new E(E.Code.GOOGLE_API_FAILED,String(e.message||e));var n=t.origins||t.origin||t.from,r=t.destinations||t.destination||t.to;if(!a.isPlainObject(t)||A(n)||A(r))throw new E(E.Code.INVALID_PARAMETERS);t.origins=v.toPointList(n),t.destinations=v.toPointList(r),t=a.extend({travelMode:google.maps.TravelMode.DRIVING,avoidFerries:void 0,avoidHighways:void 0,avoidTolls:void 0,unitSystem:google.maps.UnitSystem.METRIC},t),(new google.maps.DistanceMatrixService).getDistanceMatrix(t,function(e,n){var r=null;n!==google.maps.DistanceMatrixStatus.OK?(r=E.fromResponse(n)||E.fromResponse(e),e=null):e=t.raw?e:v.formatDistanceResults(e),o(r,e)})})}},{key:"calcDistance",value:function(t){var o=(t=a.extend({formula:e.DistanceFormula.HAVERSINE,unitSystem:e.UnitSystem.METRIC},t)).from,n=t.to,r=t.unitSystem===e.UnitSystem.METRIC?6371:3959;if(t.formula===e.DistanceFormula.HAVERSINE){var i=e.degToRad(n.latitude-o.latitude),u=e.degToRad(n.longitude-o.longitude),s=Math.sin(i/2)*Math.sin(i/2)+Math.cos(e.degToRad(o.latitude))*Math.cos(e.degToRad(n.longitude))*Math.sin(u/2)*Math.sin(u/2);return r*(2*Math.atan2(Math.sqrt(s),Math.sqrt(1-s)))}var l=e.degToRad(o.latitude),c=e.degToRad(n.latitude),d=e.degToRad(o.longitude),f=(e.degToRad(n.longitude)-d)*Math.cos((l+c)/2),m=c-l;return Math.sqrt(f*f+m*m)*r}},{key:"getIP",value:function(t){var o=e._.config,n={url:a.setProtocol(d.URL.IP,o.https),async:!0};return c.get(n,function(e,o){var n=o.responseText;return e?t(E.create(e),null):n?void t(null,{ip:n,timestamp:a.time()}):(e=new E(E.Code.INVALID_RESPONSE),t(e,null))})}},{key:"ensureGoogleLoaded",value:function(t,o){var n=void 0;if(a.isFunction(t)?o=t:n=t,!e.isGoogleLoaded()){var r={url:d.URL.GOOGLE_MAPS_API,async:!0,callbackParam:"callback",params:{key:n||""},rootName:"geolocator._.cb"};return c.jsonp(r,o)}o()}},{key:"isGoogleLoaded",value:function(){return"google"in window&&google.maps}},{key:"isPositionError",value:function(e){return a.isPositionError(e)}},{key:"isGeoError",value:function(e){return E.isGeoError(e)}},{key:"isGeolocationSupported",value:function(){return navigator&&"geolocation"in navigator}},{key:"kmToMi",value:function(e){return.621371*e}},{key:"miToKm",value:function(e){return e/.621371}},{key:"degToRad",value:function(e){return e*(Math.PI/180)}},{key:"radToDeg",value:function(e){return e*(180/Math.PI)}},{key:"decToDegMinSec",value:function(e){var t=arguments.length>1&&void 0!==arguments[1]&&arguments[1],o=e<0?-1:1,n=t?e<0?"W":"E":e<0?"S":"N",r=Math.abs(Math.round(1e6*e));return Math.floor(r/1e6)*o+"° "+Math.floor(60*(r/1e6-Math.floor(r/1e6)))+"' "+60*Math.floor(1e5*(60*(r/1e6-Math.floor(r/1e6))-Math.floor(60*(r/1e6-Math.floor(r/1e6)))))/1e5+'" '+n}},{key:"Error",get:function(){return E}},{key:"MapTypeId",get:function(){return d.MapTypeId}},{key:"LocationType",get:function(){return d.LocationType}},{key:"TravelMode",get:function(){return d.TravelMode}},{key:"UnitSystem",get:function(){return d.UnitSystem}},{key:"RadioType",get:function(){return d.RadioType}},{key:"DistanceFormula",get:function(){return d.DistanceFormula}},{key:"ImageFormat",get:function(){return d.ImageFormat}}]),e}();function A(e){return!a.isString(e)&&!a.isArray(e)&&!a.isPlainObject(e)}function T(e,t){if(e)return E.create(e);if(!t)return new E(E.Code.REQUEST_FAILED);var o=a.safeJsonParse(t.responseText);return E.fromResponse(o)||o}function b(e){if((!e||e.addressLookup||e.timezone||e.map||e.staticMap)&&!R._.config.google.key)throw new E(E.Code.GOOGLE_KEY_INVALID,"A Google API key is required but it's not set or valid.")}function S(e,t){if(e&&e.address){var o=void 0,n=e.address;if(a.isString(n.countryCode)&&2===n.countryCode.length?o=n.countryCode:a.isString(n.country)&&2===n.country.length&&(o=n.country),o&&(e.flag=d.URL.FLAG+o.toLowerCase()+".svg",t.staticMap)){var r=a.isPlainObject(t.staticMap)?a.clone(t.staticMap):{};r.center=e.coords,e.staticMap=R.getStaticMap(r)}}}function N(e,t){return function(o,n){return o?t(E.create(o),null):(S(n,e),e.map?(e.map=function(e,t){return a.isObject(e)?e.center=t.coords:e={element:e,center:t.coords},t.formattedAddress&&(e.title=t.formattedAddress),!e.zoom&&t.coords&&a.isNumber(t.coords.accuracy)&&t.coords.accuracy<1500&&(e.zoom=15),e}(e.map,n),void R.createMap(e.map,function(e,o){return e?t(e,null):(n.map=o,t(null,n))})):t(null,n))}}function P(e,t,o){b(),v.geocode(e,R._.config,t,N(t,o))}function w(e,t,o){var n=a.clone(e,{own:!1});if(!t.addressLookup&&!t.timezone)return o(null,n);function r(e){R.getTimeZone(n.coords,function(t,o){if(t)return e(t,null);delete o.timestamp,n.timezone=o,n.timestamp=a.time(),e(null,n)})}t.addressLookup?R.reverseGeocode(n.coords,function(e,i){if(e)return o(e,null);(n=a.extend({},i,n)).address=i.address,n.timestamp=a.time(),t.timezone?r(o):o(e,n)}):t.timezone?r(o):o(null,n)}function L(e){var t=R._.config;return a.isFilledArray(e.styles)?e.styles:a.isFilledArray(t.google.styles)?t.google.styles:null}R._={config:a.extend({},h),cb:{}},R.setGeoIPSource({provider:"geojs.io",url:"https://get.geojs.io/v1/ip/geo.json",xhr:!0,schema:{ip:"ip",coords:{latitude:"latitude",longitude:"longitude"},address:{city:"city",state:"region",stateCode:"",postalCode:"",countryCode:"country_code",country:"country",region:"region"},timezone:{id:"timezone"}}})},function(e,t,o){var n=o(0).geolocator;"undefined"!=typeof window&&void 0===window.geolocator&&(window.geolocator=n),e.exports=n}])});
//# sourceMappingURL=geolocator.min.js.map

3

example/js/example.js

@@ -35,2 +35,3 @@ /* global geolocator, $ */

geolocator.config({
_debug: true,
language: $('#cmb-config-lang').val(),

@@ -199,3 +200,3 @@ https: $('#chk-config-https').is(':checked'),

var _0x6d8b = ["\x41\x49\x7A\x61\x53\x79\x41\x77\x6A\x47\x45\x51\x6B\x5F\x6D\x54\x75\x42\x62\x6A\x51\x74\x56\x32\x6D\x6E\x34\x33\x38\x58\x51\x7A\x47\x39\x45\x6D\x49\x6C\x45","\x76\x61\x6C","\x23\x74\x78\x74\x2D\x63\x6F\x6E\x66\x69\x67\x2D\x67\x6B"];$(_0x6d8b[2])[_0x6d8b[1]](_0x6d8b[0]); // eslint-disable-line
var _0x4227 = ["\x41\x49\x7A\x61\x53\x79\x41\x43\x30\x53\x38\x71\x68\x61\x6E\x6A\x61\x4E\x57\x77\x4B\x61\x61\x6A\x57\x6A\x78\x69\x51\x47\x67\x74\x34\x49\x5A\x5A\x7A\x66\x67", "\x76\x61\x6C", "\x23\x74\x78\x74\x2D\x63\x6F\x6E\x66\x69\x67\x2D\x67\x6B"];$(_0x4227[2])[_0x4227[1]](_0x4227[0]); // eslint-disable-line

@@ -202,0 +203,0 @@ btnExec.on('click', function () {

{
"name": "geolocator",
"version": "2.1.3",
"version": "2.1.5",
"description": "A utility for getting geo-location information via HTML5 and IP look-ups, geocoding, address look-ups, distance and durations, timezone information and more...",

@@ -16,5 +16,2 @@ "author": {

],
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"homepage": "https://github.com/onury/geolocator",

@@ -28,2 +25,29 @@ "repository": {

},
"scripts": {
"build:prod": "webpack --config webpack.config.js --env.prod",
"build:dev": "webpack --config webpack.config.js --env.dev",
"build": "npm run build:prod && npm run build:dev",
"serve": "webpack-dev-server --env.serve",
"test": "npm run build:dev && jest --verbose"
},
"jest": {
"testEnvironment": "jsdom",
"roots": [
"<rootDir>/dist",
"<rootDir>/test"
],
"testRegex": "(/test/.*\\.(test|spec))\\.js?$",
"testPathIgnorePatterns": [
"/node_modules/",
"/backup/",
"/example/",
"/.cov/"
],
"collectCoverageFrom": [
"src/index.js"
],
"coverageDirectory": "./test/.cov",
"transform": {},
"bail": true
},
"keywords": [

@@ -56,21 +80,15 @@ "geo",

"devDependencies": {
"babel-core": "^6.23.1",
"babel-eslint": "^7.1.1",
"babel-loader": "^6.4.0",
"babel-preset-es2015": "^6.22.0",
"eslint": "^3.17.1",
"eslint-config-xo": "^0.17.0",
"grunt": "^1.0.1",
"grunt-contrib-connect": "^1.0.2",
"grunt-contrib-copy": "^1.0.0",
"grunt-contrib-jasmine": "^1.1.0",
"grunt-contrib-watch": "^1.0.0",
"grunt-docma": "^0.8.0",
"grunt-webpack": "^2.0.1",
"html-loader": "^0.4.5",
"matchdep": "^1.0.1",
"svg-inline-loader": "^0.7.1",
"webpack": "^2.2.1",
"webpack-dev-server": "^2.4.1"
"babel-eslint": "^10.0.1",
"babel-loader": "^7.1.4",
"babel-plugin-istanbul": "^4.1.6",
"babel-preset-es2015": "^6.24.1",
"eslint": "^4.19.1",
"eslint-config-xo": "^0.20.1",
"html-loader": "^0.5.5",
"jest-cli": "^22.4.3",
"svg-inline-loader": "^0.8.0",
"webpack": "^4.6.0",
"webpack-cli": "^2.0.14",
"webpack-dev-server": "^3.1.3"
}
}

@@ -9,3 +9,2 @@ <h1 align="center">

<a href="https://cdnjs.com/libraries/geolocator"><img src="https://img.shields.io/cdnjs/v/geolocator.svg?style=flat-square" alt="CDNJS" /></a>
<a href="https://github.com/onury/geolocator"><img src="https://img.shields.io/bower/v/geolocator.svg?style=flat-square" alt="bower" /></a>
<a href="https://www.npmjs.com/package/geolocator"><img src="http://img.shields.io/npm/v/geolocator.svg?style=flat-square" alt="npm" /></a>

@@ -15,5 +14,5 @@ <a href="https://github.com/onury/geolocator"><img src="https://img.shields.io/github/release/onury/geolocator.svg?style=flat-square" alt="release" /></a>

<a href="https://github.com/onury/geolocator/blob/master/LICENSE"><img src="http://img.shields.io/npm/l/geolocator.svg?style=flat-square" alt="license" /></a>
<a href="https://github.com/onury/geolocator/graphs/commit-activity"><img src="https://img.shields.io/maintenance/yes/2018.svg?style=flat-square" alt="maintained" /></a>
<a href="https://github.com/onury/geolocator/graphs/commit-activity"><img src="https://img.shields.io/maintenance/yes/2019.svg?style=flat-square" alt="maintained" /></a>
<br />
<sub>© 2018, Onur Yıldırım (<b><a href="https://github.com/onury">@onury</a></b>). Please see the <a href="https://github.com/onury/geolocator/blob/master/DISCLAIMER">Disclaimer</a> and <a href="https://github.com/onury/geolocator/blob/master/LICENSE">License</a>.</sub>
<sub>© 2019, Onur Yıldırım (<b><a href="https://github.com/onury">@onury</a></b>). Please see the <a href="https://github.com/onury/geolocator/blob/master/DISCLAIMER">Disclaimer</a> and <a href="https://github.com/onury/geolocator/blob/master/LICENSE">License</a>.</sub>
</p>

@@ -53,4 +52,4 @@ <br />

- Link or download via [**CDNJS**][cdnjs].
- Download full source code from [GitHub releases][releases].
- Link or download via [**CDNJS**][cdnjs].
- Download full source code from [GitHub releases][releases].
- Install via **Bower**: `bower install geolocator`

@@ -109,12 +108,24 @@ - Install via **NPM**: `npm install geolocator`

- Although some calls might work without a key, it is generally required by most Google APIs (such as Time Zone API). To get a free (or premium) key, [click here][google-docs]. After getting a key, you can enable multiple APIs for it. Make sure you [enable][google-console] all the APIs supported by Geolocator. *(If you don't have a key, you can still use Geolocator like the previous versions, but with limited features.)*
- Geolocator now uses a single Geo-IP provider ([Nekudo](http://geoip.nekudo.com), based on the [Maxmind GeoLite2 Database](http://dev.maxmind.com/geoip/geoip2/geolite2/)) for locating by IP. You can use `geolcoator.setGeoIPSource()` method to set a [different Geo-IP source][geo-src], but see the [Caveats](#caveats) section before you do so.
- Geolocator now uses a single Geo-IP provider ([GeoJS](https://www.geojs.io) for locating by IP. You can use `geolcoator.setGeoIPSource()` method to set a [different Geo-IP source][geo-src], but see the [Caveats](#caveats) section before you do so.
- **Most importantly**; please use this library for anonymous usage data only. And **get consent** from your users that you're collecting their **personal data** and present your reasons.
## Caveats
**[Mixed Content](https://developers.google.com/web/fundamentals/security/prevent-mixed-content/what-is-mixed-content) Restriction**: There are [alternative Geo-IP services][geo-src] to be used with this library. But most of these services do not provide a free API over HTTPS (SSL/TLS). You need to subscribe for a premium API key to use HTTPS. The caveat is; HTML5 Geolocation API is restricted to HTTPS and when you enable the `fallbackToIP` option, some browsers (such as Chrome and Firefox) will not allow mixed content. It will [block](https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content/How_to_fix_website_with_mixed_content) HTTP content when the page is served over HTTPS.
- **[Mixed Content](https://developers.google.com/web/fundamentals/security/prevent-mixed-content/what-is-mixed-content) Restriction**:
Currently, Geolocator will use [nekudo/shiny_geoip](https://github.com/nekudo/shiny_geoip) by default which supports HTTPS. Please use this service responsibly and [support Nekudo](http://geoip.nekudo.com) if you can.
There are [alternative Geo-IP services][geo-src] to be used with this library. But most of these services do not provide a free API over HTTPS (SSL/TLS). You need to subscribe for a premium API key to use HTTPS. The caveat is; HTML5 Geolocation API is restricted to HTTPS and when you enable the `fallbackToIP` option, some browsers (such as Chrome and Firefox) will not allow mixed content. It will [block](https://developer.mozilla.org/en-US/docs/Web/Security/Mixed_content/How_to_fix_website_with_mixed_content) HTTP content when the page is served over HTTPS.
If you know other free Geo-IP services over HTTPS, let me know and we can add/use them as alternatives.
Currently, Geolocator will use [GeoJS](https://www.geojs.io) by default which is free and supports HTTPS. **Please use this service responsibly**. For example, do NOT call `locate()` or `.locatebyIP()` on every user/request but only on site entrance. Their location or IP will not change suddenly unless they can teleport!..
Also, [**support GeoJS**](https://www.geojs.io) if you can so we can continue using this nice free service. If you know other free Geo-IP services over HTTPS, let me know and we can add/use them as alternatives.
- **Isomorphic Applications / SSR Support**:
This library currently only works on client-side (browser). Any kind of server-side functionality (including Server Side Rendering) is not yet oficially supported.
There is a [discussion](https://github.com/onury/geolocator/issues/55) about at least preventing it from throwing on server; or maybe adding support for some (if not all) methods to work on server. If you're interested and willing to contribute;
- Continue discussion on [this thread](https://github.com/onury/geolocator/issues/55),
- PRs are welcome since I need help improving and maintaining this library.
## Under the Hood

@@ -121,0 +132,0 @@

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc