From e4505e2a6b560cb3e061d5d542b8bfff5fa5c3d3 Mon Sep 17 00:00:00 2001 From: Moz Morris Date: Mon, 29 Jun 2015 17:48:37 +0100 Subject: [PATCH] Merge umd-build branch. This closes #13 commit 8b1ed17602b01c2c63d7c341f6cc70711ff8f925 Author: Moz Morris Date: Sun Jun 28 11:33:40 2015 +0100 Fixup exports. commit a64ce1c6fb73fe9dee9f2d0bec38574ad7d1897e Author: Moz Morris Date: Sun Jun 28 10:42:28 2015 +0100 [added] bower support --- .gitignore | 3 +- README.md | 8 + bower.json | 31 + lib/umd/GoogleMapReact.js | 4175 +++++++++++++++++++++++++++++++++ lib/umd/GoogleMapReact.min.js | 7 + package.json | 11 +- scripts/build.sh | 14 +- src/index.js | 2 +- webpack.config.js | 38 + 9 files changed, 4281 insertions(+), 8 deletions(-) create mode 100644 bower.json create mode 100644 lib/umd/GoogleMapReact.js create mode 100644 lib/umd/GoogleMapReact.min.js create mode 100644 webpack.config.js diff --git a/.gitignore b/.gitignore index c9cd57d..c64af19 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,3 @@ +lib/* +!lib/umd /node_modules -/modules \ No newline at end of file diff --git a/README.md b/README.md index ce023a1..240092c 100644 --- a/README.md +++ b/README.md @@ -3,10 +3,18 @@ It allows you to create interfaces like this [example](http://istarkov.github.io/google-map-react/map/main) *(You can scroll the table, zoom/move the map, hover/click on markers, and click on table rows)* ##Installation + +### npm ``` npm install --save google-map-react ``` +### bower +``` +bower install --save google-map-react +``` +The global will be available at: `window.GoogleMapReact` + ##What's it Look Like? In the simple case you just need to add `lat` `lng` props to any child of `GoogleMap` component. [simple example in action](http://istarkov.github.io/google-map-react/map/simple) diff --git a/bower.json b/bower.json new file mode 100644 index 0000000..b194263 --- /dev/null +++ b/bower.json @@ -0,0 +1,31 @@ +{ + "name": "google-map-react", + "description": "isomorphic google map react component, allows render react components on the google map", + "main": "lib/umd/GoogleMapReact.js", + "homepage": "https://github.com/istarkov/google-map-react", + "authors": [ + "Ivan Starkov " + ], + "keywords": [ + "react", + "reactjs", + "google", + "map", + "maps", + "isomorphic", + "render", + "component", + "javascript", + "react-component" + ], + "license": "MIT", + "ignore": [ + "**/.*", + "node_modules", + "bower_components", + "src", + "scripts", + "package.json", + "webpack.config.js" + ] +} diff --git a/lib/umd/GoogleMapReact.js b/lib/umd/GoogleMapReact.js new file mode 100644 index 0000000..804c53b --- /dev/null +++ b/lib/umd/GoogleMapReact.js @@ -0,0 +1,4175 @@ +(function webpackUniversalModuleDefinition(root, factory) { + if(typeof exports === 'object' && typeof module === 'object') + module.exports = factory(require("react")); + else if(typeof define === 'function' && define.amd) + define(["react"], factory); + else if(typeof exports === 'object') + exports["GoogleMapReact"] = factory(require("react")); + else + root["GoogleMapReact"] = factory(root["React"]); +})(this, function(__WEBPACK_EXTERNAL_MODULE_1__) { +return /******/ (function(modules) { // webpackBootstrap +/******/ // The module cache +/******/ var installedModules = {}; + +/******/ // The require function +/******/ function __webpack_require__(moduleId) { + +/******/ // Check if module is in cache +/******/ if(installedModules[moduleId]) +/******/ return installedModules[moduleId].exports; + +/******/ // Create a new module (and put it into the cache) +/******/ var module = installedModules[moduleId] = { +/******/ exports: {}, +/******/ id: moduleId, +/******/ loaded: false +/******/ }; + +/******/ // Execute the module function +/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); + +/******/ // Flag the module as loaded +/******/ module.loaded = true; + +/******/ // Return the exports of the module +/******/ return module.exports; +/******/ } + + +/******/ // expose the modules object (__webpack_modules__) +/******/ __webpack_require__.m = modules; + +/******/ // expose the module cache +/******/ __webpack_require__.c = installedModules; + +/******/ // __webpack_public_path__ +/******/ __webpack_require__.p = ""; + +/******/ // Load entry module and return exports +/******/ return __webpack_require__(0); +/******/ }) +/************************************************************************/ +/******/ ([ +/* 0 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _google_mapJs = __webpack_require__(15); + + var _google_mapJs2 = _interopRequireDefault(_google_mapJs); + + exports['default'] = _google_mapJs2['default']; + module.exports = exports['default']; + +/***/ }, +/* 1 */ +/***/ function(module, exports) { + + module.exports = __WEBPACK_EXTERNAL_MODULE_1__; + +/***/ }, +/* 2 */ +/***/ function(module, exports) { + + /** + * lodash 3.0.3 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + + /** `Object#toString` result references. */ + var argsTag = '[object Arguments]'; + + /** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ + function isObjectLike(value) { + return !!value && typeof value == 'object'; + } + + /** Used for native method references. */ + var objectProto = Object.prototype; + + /** + * Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) + * of values. + */ + var objToString = objectProto.toString; + + /** + * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) + * of an array-like value. + */ + var MAX_SAFE_INTEGER = 9007199254740991; + + /** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new function. + */ + function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; + } + + /** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) + * that affects Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ + var getLength = baseProperty('length'); + + /** + * Checks if `value` is array-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + */ + function isArrayLike(value) { + return value != null && isLength(getLength(value)); + } + + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ + function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + } + + /** + * Checks if `value` is classified as an `arguments` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isArguments(function() { return arguments; }()); + * // => true + * + * _.isArguments([1, 2, 3]); + * // => false + */ + function isArguments(value) { + return isObjectLike(value) && isArrayLike(value) && objToString.call(value) == argsTag; + } + + module.exports = isArguments; + + +/***/ }, +/* 3 */ +/***/ function(module, exports) { + + /** + * lodash 3.0.3 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + + /** `Object#toString` result references. */ + var arrayTag = '[object Array]', + funcTag = '[object Function]'; + + /** + * Used to match `RegExp` [special characters](http://www.regular-expressions.info/characters.html#special). + * In addition to special characters the forward slash is escaped to allow for + * easier `eval` use and `Function` compilation. + */ + var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g, + reHasRegExpChars = RegExp(reRegExpChars.source); + + /** Used to detect host constructors (Safari > 5). */ + var reIsHostCtor = /^\[object .+?Constructor\]$/; + + /** + * Converts `value` to a string if it's not one. An empty string is returned + * for `null` or `undefined` values. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ + function baseToString(value) { + if (typeof value == 'string') { + return value; + } + return value == null ? '' : (value + ''); + } + + /** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ + function isObjectLike(value) { + return !!value && typeof value == 'object'; + } + + /** Used for native method references. */ + var objectProto = Object.prototype; + + /** Used to resolve the decompiled source of functions. */ + var fnToString = Function.prototype.toString; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** + * Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) + * of values. + */ + var objToString = objectProto.toString; + + /** Used to detect if a method is native. */ + var reIsNative = RegExp('^' + + escapeRegExp(fnToString.call(hasOwnProperty)) + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + ); + + /* Native method references for those with the same name as other `lodash` methods. */ + var nativeIsArray = getNative(Array, 'isArray'); + + /** + * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) + * of an array-like value. + */ + var MAX_SAFE_INTEGER = 9007199254740991; + + /** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ + function getNative(object, key) { + var value = object == null ? undefined : object[key]; + return isNative(value) ? value : undefined; + } + + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ + function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + } + + /** + * Checks if `value` is classified as an `Array` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isArray([1, 2, 3]); + * // => true + * + * _.isArray(function() { return arguments; }()); + * // => false + */ + var isArray = nativeIsArray || function(value) { + return isObjectLike(value) && isLength(value.length) && objToString.call(value) == arrayTag; + }; + + /** + * Checks if `value` is a native function. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ + function isNative(value) { + if (value == null) { + return false; + } + if (objToString.call(value) == funcTag) { + return reIsNative.test(fnToString.call(value)); + } + return isObjectLike(value) && reIsHostCtor.test(value); + } + + /** + * Escapes the `RegExp` special characters "\", "/", "^", "$", ".", "|", "?", + * "*", "+", "(", ")", "[", "]", "{" and "}" in `string`. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to escape. + * @returns {string} Returns the escaped string. + * @example + * + * _.escapeRegExp('[lodash](https://lodash.com/)'); + * // => '\[lodash\]\(https:\/\/lodash\.com\/\)' + */ + function escapeRegExp(string) { + string = baseToString(string); + return (string && reHasRegExpChars.test(string)) + ? string.replace(reRegExpChars, '\\$&') + : string; + } + + module.exports = isArray; + + +/***/ }, +/* 4 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } + + var _react = __webpack_require__(1); + + var _react2 = _interopRequireDefault(_react); + + var _reactPureRenderFunction = __webpack_require__(14); + + var _reactPureRenderFunction2 = _interopRequireDefault(_reactPureRenderFunction); + + var mainStyle = { + width: '100%', + height: '100%', + left: 0, + top: 0, + margin: 0, + padding: 0, + position: 'absolute' + }; + + var style = { + width: 0, + height: 0, + left: 0, + top: 0, + backgroundColor: 'transparent', + position: 'absolute' + }; + + var GoogleMapMarkers = (function (_Component) { + function GoogleMapMarkers(props) { + var _this = this; + + _classCallCheck(this, GoogleMapMarkers); + + _Component.call(this, props); + this.shouldComponentUpdate = _reactPureRenderFunction2['default']; + + this._getState = function () { + return { + children: _this.props.dispatcher.getChildren(), + updateCounter: _this.props.dispatcher.getUpdateCounter() + }; + }; + + this._onChangeHandler = function () { + if (!_this.dimesionsCache_) { + return; + } + + var state = _this._getState(); + _this.setState(state); + }; + + this._onChildClick = function () { + if (_this.props.onChildClick) { + if (_this.hoverChildProps_) { + var hoverKey = _this.hoverKey_; + var childProps = _this.hoverChildProps_; + // click works only on hovered item + _this.props.onChildClick(hoverKey, childProps); + } + } + }; + + this._onChildMouseEnter = function (hoverKey, childProps) { + if (!_this.dimesionsCache_) { + return; + } + + if (_this.props.onChildMouseEnter) { + _this.props.onChildMouseEnter(hoverKey, childProps); + } + + _this.hoverChildProps_ = childProps; + _this.hoverKey_ = hoverKey; + _this.setState({ hoverKey: hoverKey }); + }; + + this._onChildMouseLeave = function () { + if (!_this.dimesionsCache_) { + return; + } + + var hoverKey = _this.hoverKey_; + var childProps = _this.hoverChildProps_; + + if (hoverKey !== undefined && hoverKey !== null) { + if (_this.props.onChildMouseLeave) { + _this.props.onChildMouseLeave(hoverKey, childProps); + } + + _this.hoverKey_ = null; + _this.hoverChildProps_ = null; + _this.setState({ hoverKey: null }); + } + }; + + this._onMouseAllow = function (value) { + if (!value) { + _this._onChildMouseLeave(); + } + + _this.allowMouse_ = value; + }; + + this._onMouseChangeHandler = function () { + if (_this.allowMouse_) { + _this._onMouseChangeHandler_raf(); + } + }; + + this._onMouseChangeHandler_raf = function () { + if (!_this.dimesionsCache_) { + return; + } + + var mp = _this.props.dispatcher.getMousePosition(); + + if (mp) { + (function () { + var distances = []; + + _react2['default'].Children.forEach(_this.state.children, function (child, childIndex) { + var childKey = child.key !== undefined && child.key !== null ? child.key : childIndex; + var dist = _this.props.distanceToMouse(_this.dimesionsCache_[childKey], mp, child.props); + if (dist < _this.props.hoverDistance) { + distances.push({ + key: childKey, + dist: dist, + props: child.props + }); + } + }); + + if (distances.length) { + distances.sort(function (a, b) { + return a.dist - b.dist; + }); + var hoverKey = distances[0].key; + var childProps = distances[0].props; + + if (_this.hoverKey_ !== hoverKey) { + _this._onChildMouseLeave(); + + _this._onChildMouseEnter(hoverKey, childProps); + } + } else { + _this._onChildMouseLeave(); + } + })(); + } else { + _this._onChildMouseLeave(); + } + }; + + this._getDimensions = function (key) { + var childKey = key; + return _this.dimesionsCache_[childKey]; + }; + + this.props.dispatcher.on('kON_CHANGE', this._onChangeHandler); + this.props.dispatcher.on('kON_MOUSE_POSITION_CHANGE', this._onMouseChangeHandler); + this.props.dispatcher.on('kON_CLICK', this._onChildClick); + + this.dimesionsCache_ = {}; + this.hoverKey_ = null; + this.hoverChildProps_ = null; + this.allowMouse_ = true; + + this.state = _extends({}, this._getState(), { hoverKey: null }); + } + + _inherits(GoogleMapMarkers, _Component); + + GoogleMapMarkers.prototype.componentWillUnmount = function componentWillUnmount() { + this.props.dispatcher.removeListener('kON_CHANGE', this._onChangeHandler); + this.props.dispatcher.removeListener('kON_MOUSE_POSITION_CHANGE', this._onMouseChangeHandler); + this.props.dispatcher.removeListener('kON_CLICK', this._onChildClick); + + this.dimesionsCache_ = null; + }; + + GoogleMapMarkers.prototype.render = function render() { + var _this2 = this; + + var mainElementStyle = this.props.style || mainStyle; + + this.dimesionsCache_ = {}; + + var markers = _react2['default'].Children.map(this.state.children, function (child, childIndex) { + var pt = _this2.props.geoService.project({ lat: child.props.lat, lng: child.props.lng }, _this2.props.projectFromLeftTop); + var stylePtPos = { + left: pt.x, + top: pt.y + }; + + var dx = 0; + var dy = 0; + + if (!_this2.props.projectFromLeftTop) { + // center projection + if (_this2.props.geoService.hasSize()) { + dx = _this2.props.geoService.getWidth() / 2; + dy = _this2.props.geoService.getHeight() / 2; + } + } + + // to prevent rerender on child element i need to pass const params $getDimensions and $dimensionKey instead of dimension object + var childKey = child.key !== undefined && child.key !== null ? child.key : childIndex; + _this2.dimesionsCache_[childKey] = { x: pt.x + dx, y: pt.y + dy, lat: child.props.lat, lng: child.props.lng }; + + return _react2['default'].createElement( + 'div', + { key: childKey, style: _extends({}, style, stylePtPos) }, + _react2['default'].cloneElement(child, { + $hover: childKey === _this2.state.hoverKey, + $getDimensions: _this2._getDimensions, + $dimensionKey: childKey, + $geoService: _this2.props.geoService, + $onMouseAllow: _this2._onMouseAllow + }) + ); + }); + + return _react2['default'].createElement( + 'div', + { style: mainElementStyle }, + markers + ); + }; + + _createClass(GoogleMapMarkers, null, [{ + key: 'propTypes', + value: { + geoService: _react.PropTypes.any, + style: _react.PropTypes.any, + distanceToMouse: _react.PropTypes.func, + dispatcher: _react.PropTypes.any, + onChildClick: _react.PropTypes.func, + onChildMouseLeave: _react.PropTypes.func, + onChildMouseEnter: _react.PropTypes.func, + hoverDistance: _react.PropTypes.number, + projectFromLeftTop: _react.PropTypes.bool + }, + enumerable: true + }, { + key: 'defaultProps', + value: { + projectFromLeftTop: false + }, + enumerable: true + }]); + + return GoogleMapMarkers; + })(_react.Component); + + exports['default'] = GoogleMapMarkers; + module.exports = exports['default']; + +/***/ }, +/* 5 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + module.exports = LatLng; + + var wrap = __webpack_require__(6).wrap; + + function LatLng(lat, lng) { + if (isNaN(lat) || isNaN(lng)) { + throw new Error('Invalid LatLng object: (' + lat + ', ' + lng + ')'); + } + this.lat = +lat; + this.lng = +lng; + } + + LatLng.prototype.wrap = function () { + return new LatLng(this.lat, wrap(this.lng, -180, 180)); + }; + + // constructs LatLng from an array if necessary + + LatLng.convert = function (a) { + if (a instanceof LatLng) { + return a; + } + if (Array.isArray(a)) { + return new LatLng(a[0], a[1]); + } + return a; + }; + +/***/ }, +/* 6 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.wrap = function (n, min, max) { + var d = max - min; + return n === max ? n : ((n - min) % d + d) % d + min; + }; + +/***/ }, +/* 7 */ +/***/ function(module, exports) { + + /** + * lodash 3.0.2 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + + /** + * The base implementation of `baseForIn` and `baseForOwn` which iterates + * over `object` properties returned by `keysFunc` invoking `iteratee` for + * each property. Iteratee functions may exit iteration early by explicitly + * returning `false`. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @param {Function} keysFunc The function to get the keys of `object`. + * @returns {Object} Returns `object`. + */ + var baseFor = createBaseFor(); + + /** + * Creates a base function for `_.forIn` or `_.forInRight`. + * + * @private + * @param {boolean} [fromRight] Specify iterating from right to left. + * @returns {Function} Returns the new base function. + */ + function createBaseFor(fromRight) { + return function(object, iteratee, keysFunc) { + var iterable = toObject(object), + props = keysFunc(object), + length = props.length, + index = fromRight ? length : -1; + + while ((fromRight ? index-- : ++index < length)) { + var key = props[index]; + if (iteratee(iterable[key], key, iterable) === false) { + break; + } + } + return object; + }; + } + + /** + * Converts `value` to an object if it's not one. + * + * @private + * @param {*} value The value to process. + * @returns {Object} Returns the object. + */ + function toObject(value) { + return isObject(value) ? value : Object(value); + } + + /** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ + function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); + } + + module.exports = baseFor; + + +/***/ }, +/* 8 */ +/***/ function(module, exports) { + + /** + * lodash 3.0.1 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + + /** + * A specialized version of `baseCallback` which only supports `this` binding + * and specifying the number of arguments to provide to `func`. + * + * @private + * @param {Function} func The function to bind. + * @param {*} thisArg The `this` binding of `func`. + * @param {number} [argCount] The number of arguments to provide to `func`. + * @returns {Function} Returns the callback. + */ + function bindCallback(func, thisArg, argCount) { + if (typeof func != 'function') { + return identity; + } + if (thisArg === undefined) { + return func; + } + switch (argCount) { + case 1: return function(value) { + return func.call(thisArg, value); + }; + case 3: return function(value, index, collection) { + return func.call(thisArg, value, index, collection); + }; + case 4: return function(accumulator, value, index, collection) { + return func.call(thisArg, accumulator, value, index, collection); + }; + case 5: return function(value, other, key, object, source) { + return func.call(thisArg, value, other, key, object, source); + }; + } + return function() { + return func.apply(thisArg, arguments); + }; + } + + /** + * This method returns the first argument provided to it. + * + * @static + * @memberOf _ + * @category Utility + * @param {*} value Any value. + * @returns {*} Returns `value`. + * @example + * + * var object = { 'user': 'fred' }; + * + * _.identity(object) === object; + * // => true + */ + function identity(value) { + return value; + } + + module.exports = bindCallback; + + +/***/ }, +/* 9 */ +/***/ function(module, exports) { + + /** + * lodash 3.9.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + + /** `Object#toString` result references. */ + var funcTag = '[object Function]'; + + /** + * Used to match `RegExp` [special characters](http://www.regular-expressions.info/characters.html#special). + * In addition to special characters the forward slash is escaped to allow for + * easier `eval` use and `Function` compilation. + */ + var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g, + reHasRegExpChars = RegExp(reRegExpChars.source); + + /** Used to detect host constructors (Safari > 5). */ + var reIsHostCtor = /^\[object .+?Constructor\]$/; + + /** + * Converts `value` to a string if it's not one. An empty string is returned + * for `null` or `undefined` values. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ + function baseToString(value) { + if (typeof value == 'string') { + return value; + } + return value == null ? '' : (value + ''); + } + + /** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ + function isObjectLike(value) { + return !!value && typeof value == 'object'; + } + + /** Used for native method references. */ + var objectProto = Object.prototype; + + /** Used to resolve the decompiled source of functions. */ + var fnToString = Function.prototype.toString; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** + * Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) + * of values. + */ + var objToString = objectProto.toString; + + /** Used to detect if a method is native. */ + var reIsNative = RegExp('^' + + escapeRegExp(fnToString.call(hasOwnProperty)) + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + ); + + /** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ + function getNative(object, key) { + var value = object == null ? undefined : object[key]; + return isNative(value) ? value : undefined; + } + + /** + * Checks if `value` is a native function. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ + function isNative(value) { + if (value == null) { + return false; + } + if (objToString.call(value) == funcTag) { + return reIsNative.test(fnToString.call(value)); + } + return isObjectLike(value) && reIsHostCtor.test(value); + } + + /** + * Escapes the `RegExp` special characters "\", "/", "^", "$", ".", "|", "?", + * "*", "+", "(", ")", "[", "]", "{" and "}" in `string`. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to escape. + * @returns {string} Returns the escaped string. + * @example + * + * _.escapeRegExp('[lodash](https://lodash.com/)'); + * // => '\[lodash\]\(https:\/\/lodash\.com\/\)' + */ + function escapeRegExp(string) { + string = baseToString(string); + return (string && reHasRegExpChars.test(string)) + ? string.replace(reRegExpChars, '\\$&') + : string; + } + + module.exports = getNative; + + +/***/ }, +/* 10 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * lodash 3.1.1 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + var getNative = __webpack_require__(9), + isArguments = __webpack_require__(2), + isArray = __webpack_require__(3); + + /** Used to detect unsigned integer values. */ + var reIsUint = /^\d+$/; + + /** Used for native method references. */ + var objectProto = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /* Native method references for those with the same name as other `lodash` methods. */ + var nativeKeys = getNative(Object, 'keys'); + + /** + * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) + * of an array-like value. + */ + var MAX_SAFE_INTEGER = 9007199254740991; + + /** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new function. + */ + function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; + } + + /** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) + * that affects Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ + var getLength = baseProperty('length'); + + /** + * Checks if `value` is array-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + */ + function isArrayLike(value) { + return value != null && isLength(getLength(value)); + } + + /** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ + function isIndex(value, length) { + value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; + length = length == null ? MAX_SAFE_INTEGER : length; + return value > -1 && value % 1 == 0 && value < length; + } + + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ + function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + } + + /** + * A fallback implementation of `Object.keys` which creates an array of the + * own enumerable property names of `object`. + * + * @private + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + */ + function shimKeys(object) { + var props = keysIn(object), + propsLength = props.length, + length = propsLength && object.length; + + var allowIndexes = !!length && isLength(length) && + (isArray(object) || isArguments(object)); + + var index = -1, + result = []; + + while (++index < propsLength) { + var key = props[index]; + if ((allowIndexes && isIndex(key, length)) || hasOwnProperty.call(object, key)) { + result.push(key); + } + } + return result; + } + + /** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ + function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); + } + + /** + * Creates an array of the own enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. See the + * [ES spec](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.keys) + * for more details. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keys(new Foo); + * // => ['a', 'b'] (iteration order is not guaranteed) + * + * _.keys('hi'); + * // => ['0', '1'] + */ + var keys = !nativeKeys ? shimKeys : function(object) { + var Ctor = object == null ? null : object.constructor; + if ((typeof Ctor == 'function' && Ctor.prototype === object) || + (typeof object != 'function' && isArrayLike(object))) { + return shimKeys(object); + } + return isObject(object) ? nativeKeys(object) : []; + }; + + /** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + */ + function keysIn(object) { + if (object == null) { + return []; + } + if (!isObject(object)) { + object = Object(object); + } + var length = object.length; + length = (length && isLength(length) && + (isArray(object) || isArguments(object)) && length) || 0; + + var Ctor = object.constructor, + index = -1, + isProto = typeof Ctor == 'function' && Ctor.prototype === object, + result = Array(length), + skipIndexes = length > 0; + + while (++index < length) { + result[index] = (index + ''); + } + for (var key in object) { + if (!(skipIndexes && isIndex(key, length)) && + !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } + } + return result; + } + + module.exports = keys; + + +/***/ }, +/* 11 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * lodash 3.0.8 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + var isArguments = __webpack_require__(2), + isArray = __webpack_require__(3); + + /** Used to detect unsigned integer values. */ + var reIsUint = /^\d+$/; + + /** Used for native method references. */ + var objectProto = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** + * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) + * of an array-like value. + */ + var MAX_SAFE_INTEGER = 9007199254740991; + + /** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ + function isIndex(value, length) { + value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; + length = length == null ? MAX_SAFE_INTEGER : length; + return value > -1 && value % 1 == 0 && value < length; + } + + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ + function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + } + + /** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ + function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); + } + + /** + * Creates an array of the own and inherited enumerable property names of `object`. + * + * **Note:** Non-object values are coerced to objects. + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The object to query. + * @returns {Array} Returns the array of property names. + * @example + * + * function Foo() { + * this.a = 1; + * this.b = 2; + * } + * + * Foo.prototype.c = 3; + * + * _.keysIn(new Foo); + * // => ['a', 'b', 'c'] (iteration order is not guaranteed) + */ + function keysIn(object) { + if (object == null) { + return []; + } + if (!isObject(object)) { + object = Object(object); + } + var length = object.length; + length = (length && isLength(length) && + (isArray(object) || isArguments(object)) && length) || 0; + + var Ctor = object.constructor, + index = -1, + isProto = typeof Ctor == 'function' && Ctor.prototype === object, + result = Array(length), + skipIndexes = length > 0; + + while (++index < length) { + result[index] = (index + ''); + } + for (var key in object) { + if (!(skipIndexes && isIndex(key, length)) && + !(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { + result.push(key); + } + } + return result; + } + + module.exports = keysIn; + + +/***/ }, +/* 12 */ +/***/ function(module, exports) { + + /** + * lodash 3.6.1 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + + /** Used as the `TypeError` message for "Functions" methods. */ + var FUNC_ERROR_TEXT = 'Expected a function'; + + /* Native method references for those with the same name as other `lodash` methods. */ + var nativeMax = Math.max; + + /** + * Creates a function that invokes `func` with the `this` binding of the + * created function and arguments from `start` and beyond provided as an array. + * + * **Note:** This method is based on the [rest parameter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/rest_parameters). + * + * @static + * @memberOf _ + * @category Function + * @param {Function} func The function to apply a rest parameter to. + * @param {number} [start=func.length-1] The start position of the rest parameter. + * @returns {Function} Returns the new function. + * @example + * + * var say = _.restParam(function(what, names) { + * return what + ' ' + _.initial(names).join(', ') + + * (_.size(names) > 1 ? ', & ' : '') + _.last(names); + * }); + * + * say('hello', 'fred', 'barney', 'pebbles'); + * // => 'hello fred, barney, & pebbles' + */ + function restParam(func, start) { + if (typeof func != 'function') { + throw new TypeError(FUNC_ERROR_TEXT); + } + start = nativeMax(start === undefined ? (func.length - 1) : (+start || 0), 0); + return function() { + var args = arguments, + index = -1, + length = nativeMax(args.length - start, 0), + rest = Array(length); + + while (++index < length) { + rest[index] = args[start + index]; + } + switch (start) { + case 0: return func.call(this, rest); + case 1: return func.call(this, args[0], rest); + case 2: return func.call(this, args[0], args[1], rest); + } + var otherArgs = Array(start + 1); + index = -1; + while (++index < start) { + otherArgs[index] = args[index]; + } + otherArgs[start] = rest; + return func.apply(this, otherArgs); + }; + } + + module.exports = restParam; + + +/***/ }, +/* 13 */ +/***/ function(module, exports) { + + 'use strict'; + + module.exports = Point; + + function Point(x, y) { + this.x = x; + this.y = y; + } + + Point.prototype = { + clone: function() { return new Point(this.x, this.y); }, + + add: function(p) { return this.clone()._add(p); }, + sub: function(p) { return this.clone()._sub(p); }, + mult: function(k) { return this.clone()._mult(k); }, + div: function(k) { return this.clone()._div(k); }, + rotate: function(a) { return this.clone()._rotate(a); }, + matMult: function(m) { return this.clone()._matMult(m); }, + unit: function() { return this.clone()._unit(); }, + perp: function() { return this.clone()._perp(); }, + round: function() { return this.clone()._round(); }, + + mag: function() { + return Math.sqrt(this.x * this.x + this.y * this.y); + }, + + equals: function(p) { + return this.x === p.x && + this.y === p.y; + }, + + dist: function(p) { + return Math.sqrt(this.distSqr(p)); + }, + + distSqr: function(p) { + var dx = p.x - this.x, + dy = p.y - this.y; + return dx * dx + dy * dy; + }, + + angle: function() { + return Math.atan2(this.y, this.x); + }, + + angleTo: function(b) { + return Math.atan2(this.y - b.y, this.x - b.x); + }, + + angleWith: function(b) { + return this.angleWithSep(b.x, b.y); + }, + + // Find the angle of the two vectors, solving the formula for the cross product a x b = |a||b|sin(θ) for θ. + angleWithSep: function(x, y) { + return Math.atan2( + this.x * y - this.y * x, + this.x * x + this.y * y); + }, + + _matMult: function(m) { + var x = m[0] * this.x + m[1] * this.y, + y = m[2] * this.x + m[3] * this.y; + this.x = x; + this.y = y; + return this; + }, + + _add: function(p) { + this.x += p.x; + this.y += p.y; + return this; + }, + + _sub: function(p) { + this.x -= p.x; + this.y -= p.y; + return this; + }, + + _mult: function(k) { + this.x *= k; + this.y *= k; + return this; + }, + + _div: function(k) { + this.x /= k; + this.y /= k; + return this; + }, + + _unit: function() { + this._div(this.mag()); + return this; + }, + + _perp: function() { + var y = this.y; + this.y = this.x; + this.x = -y; + return this; + }, + + _rotate: function(angle) { + var cos = Math.cos(angle), + sin = Math.sin(angle), + x = cos * this.x - sin * this.y, + y = sin * this.x + cos * this.y; + this.x = x; + this.y = y; + return this; + }, + + _round: function() { + this.x = Math.round(this.x); + this.y = Math.round(this.y); + return this; + } + }; + + // constructs Point from an array if necessary + Point.convert = function (a) { + if (a instanceof Point) { + return a; + } + if (Array.isArray(a)) { + return new Point(a[0], a[1]); + } + return a; + }; + + +/***/ }, +/* 14 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + exports['default'] = shouldPureComponentUpdate; + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + var _shallowEqual = __webpack_require__(37); + + var _shallowEqual2 = _interopRequireDefault(_shallowEqual); + + function shouldPureComponentUpdate(nextProps, nextState) { + return !(0, _shallowEqual2['default'])(this.props, nextProps) || !(0, _shallowEqual2['default'])(this.state, nextState); + } + + module.exports = exports['default']; + +/***/ }, +/* 15 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ('value' in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } + + var _react = __webpack_require__(1); + + var _react2 = _interopRequireDefault(_react); + + var _reactPureRenderFunction = __webpack_require__(14); + + var _reactPureRenderFunction2 = _interopRequireDefault(_reactPureRenderFunction); + + var _marker_dispatcherJs = __webpack_require__(18); + + var _marker_dispatcherJs2 = _interopRequireDefault(_marker_dispatcherJs); + + var _google_map_mapJs = __webpack_require__(16); + + var _google_map_mapJs2 = _interopRequireDefault(_google_map_mapJs); + + var _google_map_markersJs = __webpack_require__(4); + + var _google_map_markersJs2 = _interopRequireDefault(_google_map_markersJs); + + var _google_map_markers_prerenderJs = __webpack_require__(17); + + var _google_map_markers_prerenderJs2 = _interopRequireDefault(_google_map_markers_prerenderJs); + + var _utilsLoadersGoogle_map_loaderJs = __webpack_require__(23); + + var _utilsLoadersGoogle_map_loaderJs2 = _interopRequireDefault(_utilsLoadersGoogle_map_loaderJs); + + var _utilsDetectJs = __webpack_require__(20); + + var _utilsDetectJs2 = _interopRequireDefault(_utilsDetectJs); + + var _utilsGeoJs = __webpack_require__(21); + + var _utilsGeoJs2 = _interopRequireDefault(_utilsGeoJs); + + var _utilsArray_helperJs = __webpack_require__(19); + + var _utilsArray_helperJs2 = _interopRequireDefault(_utilsArray_helperJs); + + var _lodashIsfunction = __webpack_require__(30); + + var _lodashIsfunction2 = _interopRequireDefault(_lodashIsfunction); + + var _lodashIsplainobject = __webpack_require__(32); + + var _lodashIsplainobject2 = _interopRequireDefault(_lodashIsplainobject); + + var _lodashPick = __webpack_require__(33); + + var _lodashPick2 = _interopRequireDefault(_lodashPick); + + var _lodashAssign = __webpack_require__(25); + + var _lodashAssign2 = _interopRequireDefault(_lodashAssign); + + var _lodashIsnumber = __webpack_require__(31); + + var _lodashIsnumber2 = _interopRequireDefault(_lodashIsnumber); + + var kEPS = 0.00001; + var K_GOOGLE_TILE_SIZE = 256; + + function defaultOptions_() { + return { + overviewMapControl: false, + streetViewControl: false, + rotateControl: true, + mapTypeControl: false, + // disable poi + styles: [{ featureType: 'poi', elementType: 'labels', stylers: [{ visibility: 'off' }] }], + minZoom: 3 // i need to dynamically calculate possible zoom value + }; + } + + var style = { + width: '100%', + height: '100%', + margin: 0, + padding: 0, + position: 'relative' + }; + + var GoogleMap = (function (_Component) { + function GoogleMap(props) { + var _this = this; + + _classCallCheck(this, GoogleMap); + + _Component.call(this, props); + this.shouldComponentUpdate = _reactPureRenderFunction2['default']; + + this._initMap = function () { + var center = _this.props.center; + _this.geoService_.setView(center, _this.props.zoom, 0); + + _this._onBoundsChanged(); // now we can calculate map bounds center etc... + + _this.props.googleMapLoader(_this.props.apiKey).then(function (maps) { + if (!_this.mounted_) { + return; + } + + var centerLatLng = _this.geoService_.getCenter(); + + var propsOptions = { + zoom: _this.props.zoom, + center: new maps.LatLng(centerLatLng.lat, centerLatLng.lng) + }; + + // prevent to exapose full api + // next props must be exposed (console.log(Object.keys(pick(maps, isPlainObject)))) + // "Animation", "ControlPosition", "MapTypeControlStyle", "MapTypeId", + // "NavigationControlStyle", "ScaleControlStyle", "StrokePosition", "SymbolPath", "ZoomControlStyle", + // "event", "DirectionsStatus", "DirectionsTravelMode", "DirectionsUnitSystem", "DistanceMatrixStatus", + // "DistanceMatrixElementStatus", "ElevationStatus", "GeocoderLocationType", "GeocoderStatus", "KmlLayerStatus", + // "MaxZoomStatus", "StreetViewStatus", "TransitMode", "TransitRoutePreference", "TravelMode", "UnitSystem" + var mapPlainObjects = _lodashPick2['default'](maps, _lodashIsplainobject2['default']); + var options = _lodashIsfunction2['default'](_this.props.options) ? _this.props.options(mapPlainObjects) : _this.props.options; + var defaultOptions = defaultOptions_(mapPlainObjects); + + var mapOptions = _extends({}, defaultOptions, options, propsOptions); + + var map = new maps.Map(_react2['default'].findDOMNode(_this.refs.google_map_dom), mapOptions); + _this.map_ = map; + _this.maps_ = maps; + + // render in overlay + var this_ = _this; + var overlay = _lodashAssign2['default'](new maps.OverlayView(), { + onAdd: function onAdd() { + var K_MAX_WIDTH = typeof screen !== 'undefined' ? screen.width + 'px' : '2000px'; + var K_MAX_HEIGHT = typeof screen !== 'undefined' ? screen.height + 'px' : '2000px'; + + var div = document.createElement('div'); + this.div = div; + div.style.backgroundColor = 'transparent'; + div.style.position = 'absolute'; + div.style.left = '0px'; + div.style.top = '0px'; + div.style.width = K_MAX_WIDTH; // prevents some chrome draw defects + div.style.height = K_MAX_HEIGHT; + + var panes = this.getPanes(); + panes.overlayMouseTarget.appendChild(div); + + _react2['default'].render(_react2['default'].createElement(_google_map_markersJs2['default'], { + onChildClick: this_._onChildClick, + onChildMouseEnter: this_._onChildMouseEnter, + onChildMouseLeave: this_._onChildMouseLeave, + geoService: this_.geoService_, + projectFromLeftTop: true, + distanceToMouse: this_.props.distanceToMouse, + hoverDistance: this_.props.hoverDistance, + dispatcher: this_.markersDispatcher_ }), div, function () { + // remove prerendered markers + this_.setState({ overlayCreated: true }); + }); + }, + + draw: function draw() { + var div = overlay.div; + var overlayProjection = overlay.getProjection(); + var bounds = map.getBounds(); + var ne = bounds.getNorthEast(); + var sw = bounds.getSouthWest(); + var ptx = overlayProjection.fromLatLngToDivPixel(new maps.LatLng(ne.lat(), sw.lng())); + + // need round for safari still can't find what need for firefox + var ptxRounded = _utilsDetectJs2['default']().isSafari ? { x: Math.round(ptx.x), y: Math.round(ptx.y) } : { x: ptx.x, y: ptx.y }; + + this_.updateCounter_++; + this_._onBoundsChanged(map, maps, !this_.props.debounced); + + div.style.left = ptxRounded.x + 'px'; + div.style.top = ptxRounded.y + 'px'; + if (this_.markersDispatcher_) { + this_.markersDispatcher_.emit('kON_CHANGE'); + } + } + }); + + overlay.setMap(map); + + maps.event.addListener(map, 'idle', function () { + if (_this.resetSizeOnIdle_) { + _this._setViewSize(); + _this.resetSizeOnIdle_ = false; + } + + var div = overlay.div; + var overlayProjection = overlay.getProjection(); + var bounds = map.getBounds(); + var ne = bounds.getNorthEast(); + var sw = bounds.getSouthWest(); + var ptx = overlayProjection.fromLatLngToDivPixel(new maps.LatLng(ne.lat(), sw.lng())); + // need round for safari still can't find what need for firefox + var ptxRounded = _utilsDetectJs2['default']().isSafari ? { x: Math.round(ptx.x), y: Math.round(ptx.y) } : { x: ptx.x, y: ptx.y }; + + this_.updateCounter_++; + this_._onBoundsChanged(map, maps); + + this_.dragTime_ = 0; + div.style.left = ptxRounded.x + 'px'; + div.style.top = ptxRounded.y + 'px'; + if (this_.markersDispatcher_) { + this_.markersDispatcher_.emit('kON_CHANGE'); + if (this_.fireMouseEventOnIdle_) { + this_.markersDispatcher_.emit('kON_MOUSE_POSITION_CHANGE'); + } + } + }); + + maps.event.addListener(map, 'mouseover', function () { + // has advantage over div MouseLeave + this_.mouseInMap_ = true; + }); + + maps.event.addListener(map, 'mouseout', function () { + // has advantage over div MouseLeave + this_.mouseInMap_ = false; + this_.mouse_ = null; + this_.markersDispatcher_.emit('kON_MOUSE_POSITION_CHANGE'); + }); + + maps.event.addListener(map, 'drag', function () { + this_.dragTime_ = new Date().getTime(); + }); + })['catch'](function (e) { + console.error(e); // eslint-disable-line no-console + throw e; + }); + }; + + this._onChildClick = function () { + if (_this.props.onChildClick) { + var _props; + + return (_props = _this.props).onChildClick.apply(_props, arguments); + } + }; + + this._onChildMouseEnter = function () { + if (_this.props.onChildMouseEnter) { + var _props2; + + return (_props2 = _this.props).onChildMouseEnter.apply(_props2, arguments); + } + }; + + this._onChildMouseLeave = function () { + if (_this.props.onChildMouseLeave) { + var _props3; + + return (_props3 = _this.props).onChildMouseLeave.apply(_props3, arguments); + } + }; + + this._setViewSize = function () { + var mapDom = _react2['default'].findDOMNode(_this.refs.google_map_dom); + _this.geoService_.setViewSize(mapDom.clientWidth, mapDom.clientHeight); + _this._onBoundsChanged(); + }; + + this._onWindowResize = function () { + _this.resetSizeOnIdle_ = true; + }; + + this._onBoundsChanged = function (map, maps, callExtBoundsChange) { + if (map) { + var gmC = map.getCenter(); + _this.geoService_.setView([gmC.lat(), gmC.lng()], map.getZoom(), 0); + } + + if (_this.props.onBoundsChange && _this.geoService_.canProject()) { + var zoom = _this.geoService_.getZoom(); + var bounds = _this.geoService_.getBounds(); + var centerLatLng = _this.geoService_.getCenter(); + + if (!_utilsArray_helperJs2['default'](bounds, _this.prevBounds_, kEPS)) { + if (callExtBoundsChange !== false) { + var marginBounds = _this.geoService_.getBounds(_this.props.margin); + _this.props.onBoundsChange([centerLatLng.lat, centerLatLng.lng], zoom, bounds, marginBounds); + _this.prevBounds_ = bounds; + } + } + // uncomment for strange bugs + if (false) { + // compare with google calculations + if (map) { + var locBounds = map.getBounds(); + var ne = locBounds.getNorthEast(); + var sw = locBounds.getSouthWest(); + + var gmC = map.getCenter(); + // compare with google map + + if (!_utilsArray_helperJs2['default']([centerLatLng.lat, centerLatLng.lng], [gmC.lat(), gmC.lng()], kEPS)) { + console.info('GoogleMap center not eq:', [centerLatLng.lat, centerLatLng.lng], [gmC.lat(), gmC.lng()]); // eslint-disable-line no-console + } + + if (!_utilsArray_helperJs2['default'](bounds, [ne.lat(), sw.lng(), sw.lat(), ne.lng()], kEPS)) { + // this is normal if this message occured on resize + console.info('GoogleMap bounds not eq:', '\n', bounds, '\n', [ne.lat(), sw.lng(), sw.lat(), ne.lng()]); // eslint-disable-line no-console + } + } + } + } + }; + + this._onMouseMove = function (e) { + if (!_this.mouseInMap_) return; + + var currTime = new Date().getTime(); + var K_RECALC_CLIENT_RECT_MS = 3000; + + if (currTime - _this.mouseMoveTime_ > K_RECALC_CLIENT_RECT_MS) { + _this.boundingRect_ = e.currentTarget.getBoundingClientRect(); + } + _this.mouseMoveTime_ = currTime; + + var mousePosX = e.clientX - _this.boundingRect_.left; + var mousePosY = e.clientY - _this.boundingRect_.top; + + if (!_this.mouse_) { + _this.mouse_ = { x: 0, y: 0, lat: 0, lng: 0 }; + } + var K_IDLE_TIMEOUT = 100; + + _this.mouse_.x = mousePosX; + _this.mouse_.y = mousePosY; + + var latLng = _this.geoService_.unproject(_this.mouse_, true); + _this.mouse_.lat = latLng.lat; + _this.mouse_.lng = latLng.lng; + + if (currTime - _this.dragTime_ < K_IDLE_TIMEOUT) { + _this.fireMouseEventOnIdle_ = true; + } else { + _this.markersDispatcher_.emit('kON_MOUSE_POSITION_CHANGE'); + _this.fireMouseEventOnIdle_ = false; + } + }; + + this._onMapClick = function () { + if (_this.markersDispatcher_) { + var K_IDLE_TIMEOUT = 100; + var currTime = new Date().getTime(); + if (currTime - _this.dragTime_ > K_IDLE_TIMEOUT) { + _this.markersDispatcher_.emit('kON_CLICK'); + } + } + }; + + this._isCenterDefined = function (center) { + return center && center.length === 2 && _lodashIsnumber2['default'](center[0]) && _lodashIsnumber2['default'](center[1]); + }; + + this.mounted_ = false; + + this.map_ = null; + this.maps_ = null; + this.prevBounds_ = null; + + this.mouse_ = null; + this.mouseMoveTime_ = 0; + this.boundingRect_ = null; + this.mouseInMap_ = true; + + this.dragTime_ = 0; + this.fireMouseEventOnIdle_ = false; + this.updateCounter_ = 0; + + this.markersDispatcher_ = new _marker_dispatcherJs2['default'](this); + this.geoService_ = new _utilsGeoJs2['default'](K_GOOGLE_TILE_SIZE); + if (this._isCenterDefined(this.props.center)) { + this.geoService_.setView(this.props.center, this.props.zoom, 0); + } + + this.state = { + overlayCreated: false + }; + } + + _inherits(GoogleMap, _Component); + + GoogleMap.prototype.componentDidMount = function componentDidMount() { + var _this2 = this; + + this.mounted_ = true; + window.addEventListener('resize', this._onWindowResize); + + setTimeout(function () { + // to detect size + _this2._setViewSize(); + if (_this2._isCenterDefined(_this2.props.center)) { + _this2._initMap(); + } else { + _this2.props.googleMapLoader(_this2.props.apiKey); // начать подгружать можно уже сейчас + } + }, 0, this); + }; + + GoogleMap.prototype.componentWillUnmount = function componentWillUnmount() { + this.mounted_ = false; + + window.removeEventListener('resize', this._onWindowResize); + + if (this.maps_ && this.map_) { + this.maps_.event.clearInstanceListeners(this.map_); + } + + this.map_ = null; + this.maps_ = null; + this.markersDispatcher_.dispose(); + + this.resetSizeOnIdle_ = false; + + delete this.map_; + delete this.markersDispatcher_; + }; + + GoogleMap.prototype.componentWillReceiveProps = function componentWillReceiveProps(nextProps) { + var _this3 = this; + + if (!this._isCenterDefined(this.props.center) && this._isCenterDefined(nextProps.center)) { + setTimeout(function () { + return _this3._initMap(); + }, 0); + } + + if (this.map_) { + var centerLatLng = this.geoService_.getCenter(); + if (nextProps.center) { + if (Math.abs(nextProps.center[0] - centerLatLng.lat) + Math.abs(nextProps.center[1] - centerLatLng.lng) > kEPS) { + this.map_.panTo({ lat: nextProps.center[0], lng: nextProps.center[1] }); + } + } + + // if zoom chaged by user + if (Math.abs(nextProps.zoom - this.props.zoom) > 0) { + this.map_.setZoom(nextProps.zoom); + } + } + }; + + GoogleMap.prototype.componentDidUpdate = function componentDidUpdate() { + this.markersDispatcher_.emit('kON_CHANGE'); + }; + + GoogleMap.prototype.render = function render() { + var mapMarkerPrerender = !this.state.overlayCreated ? _react2['default'].createElement(_google_map_markers_prerenderJs2['default'], { + onChildClick: this._onChildClick, + onChildMouseEnter: this._onChildMouseEnter, + onChildMouseLeave: this._onChildMouseLeave, + geoService: this.geoService_, + projectFromLeftTop: false, + distanceToMouse: this.props.distanceToMouse, + hoverDistance: this.props.hoverDistance, + dispatcher: this.markersDispatcher_ }) : null; + + return _react2['default'].createElement( + 'div', + { style: style, onMouseMove: this._onMouseMove, onClick: this._onMapClick }, + _react2['default'].createElement(_google_map_mapJs2['default'], { ref: 'google_map_dom' }), + mapMarkerPrerender + ); + }; + + _createClass(GoogleMap, null, [{ + key: 'propTypes', + value: { + apiKey: _react.PropTypes.string, + center: _react.PropTypes.array.isRequired, + zoom: _react.PropTypes.number.isRequired, + onBoundsChange: _react.PropTypes.func, + onChildClick: _react.PropTypes.func, + onChildMouseEnter: _react.PropTypes.func, + onChildMouseLeave: _react.PropTypes.func, + options: _react.PropTypes.any, + distanceToMouse: _react.PropTypes.func, + hoverDistance: _react.PropTypes.number, + debounced: _react.PropTypes.bool, + margin: _react.PropTypes.array, + googleMapLoader: _react.PropTypes.any + }, + enumerable: true + }, { + key: 'defaultProps', + value: { + distanceToMouse: function distanceToMouse(pt, mousePos /*, markerProps*/) { + var x = pt.x; + var y = pt.y; // - 20; + return Math.sqrt((x - mousePos.x) * (x - mousePos.x) + (y - mousePos.y) * (y - mousePos.y)); + }, + hoverDistance: 30, + debounced: true, + options: defaultOptions_, + googleMapLoader: _utilsLoadersGoogle_map_loaderJs2['default'] + }, + enumerable: true + }]); + + return GoogleMap; + })(_react.Component); + + exports['default'] = GoogleMap; + module.exports = exports['default']; + /*maps*/ /*render markers before map load done*/ + +/***/ }, +/* 16 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } + + var _react = __webpack_require__(1); + + var _react2 = _interopRequireDefault(_react); + + var style = { + width: '100%', + height: '100%', + left: 0, + top: 0, + margin: 0, + padding: 0, + position: 'absolute' + }; + + var GoogleMapMap = (function (_Component) { + function GoogleMapMap(props) { + _classCallCheck(this, GoogleMapMap); + + _Component.call(this, props); + } + + _inherits(GoogleMapMap, _Component); + + GoogleMapMap.prototype.shouldComponentUpdate = function shouldComponentUpdate() { + return false; // disable react on this div + }; + + GoogleMapMap.prototype.render = function render() { + return _react2['default'].createElement('div', { style: style }); + }; + + return GoogleMapMap; + })(_react.Component); + + exports['default'] = GoogleMapMap; + module.exports = exports['default']; + +/***/ }, +/* 17 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } + + var _react = __webpack_require__(1); + + var _react2 = _interopRequireDefault(_react); + + var _google_map_markersJs = __webpack_require__(4); + + var _google_map_markersJs2 = _interopRequireDefault(_google_map_markersJs); + + var style = { + width: '50%', + height: '50%', + left: '50%', + top: '50%', + // backgroundColor: 'red', + margin: 0, + padding: 0, + position: 'absolute' + // opacity: 0.3 + }; + + var GoogleMapMarkersPrerender = (function (_Component) { + function GoogleMapMarkersPrerender(props) { + _classCallCheck(this, GoogleMapMarkersPrerender); + + _Component.call(this, props); + } + + _inherits(GoogleMapMarkersPrerender, _Component); + + GoogleMapMarkersPrerender.prototype.render = function render() { + return _react2['default'].createElement( + 'div', + { style: style }, + _react2['default'].createElement(_google_map_markersJs2['default'], this.props) + ); + }; + + return GoogleMapMarkersPrerender; + })(_react.Component); + + exports['default'] = GoogleMapMarkersPrerender; + module.exports = exports['default']; + +/***/ }, +/* 18 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + function _inherits(subClass, superClass) { if (typeof superClass !== 'function' && superClass !== null) { throw new TypeError('Super expression must either be null or a function, not ' + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } + + var _eventemitter3 = __webpack_require__(24); + + var _eventemitter32 = _interopRequireDefault(_eventemitter3); + + var MarkerDispatcher = (function (_EventEmitter) { + function MarkerDispatcher(gmapInstance) { + _classCallCheck(this, MarkerDispatcher); + + _EventEmitter.call(this); + this.gmapInstance = gmapInstance; + } + + _inherits(MarkerDispatcher, _EventEmitter); + + MarkerDispatcher.prototype.getChildren = function getChildren() { + return this.gmapInstance.props.children; + }; + + MarkerDispatcher.prototype.getMousePosition = function getMousePosition() { + return this.gmapInstance.mouse_; + }; + + MarkerDispatcher.prototype.getUpdateCounter = function getUpdateCounter() { + return this.gmapInstance.updateCounter_; + }; + + MarkerDispatcher.prototype.dispose = function dispose() { + this.gmapInstance = null; + this.removeAllListeners(); + }; + + return MarkerDispatcher; + })(_eventemitter32['default']); + + exports['default'] = MarkerDispatcher; + module.exports = exports['default']; + +/***/ }, +/* 19 */ +/***/ function(module, exports) { + + "use strict"; + + exports.__esModule = true; + exports["default"] = isArraysEqualEps; + + function isArraysEqualEps(arrayA, arrayB, eps) { + if (arrayA && arrayB) { + for (var i = 0; i !== arrayA.length; ++i) { + if (Math.abs(arrayA[i] - arrayB[i]) > eps) { + return false; + } + } + return true; + } + return false; + } + + module.exports = exports["default"]; + +/***/ }, +/* 20 */ +/***/ function(module, exports) { + + // code here http://stackoverflow.com/questions/5899783/detect-safari-chrome-ie-firefox-opera-with-user-agent + 'use strict'; + + exports.__esModule = true; + exports['default'] = detectBrowser; + var detectBrowserResult_ = null; + + function detectBrowser() { + if (detectBrowserResult_) { + return detectBrowserResult_; + } + + if (typeof navigator !== 'undefined') { + var isExplorer = navigator.userAgent.indexOf('MSIE') > -1; + var isFirefox = navigator.userAgent.indexOf('Firefox') > -1; + var isOpera = navigator.userAgent.toLowerCase().indexOf('op') > -1; + + var isChrome = navigator.userAgent.indexOf('Chrome') > -1; + var isSafari = navigator.userAgent.indexOf('Safari') > -1; + + if (isChrome && isSafari) { + isSafari = false; + } + + if (isChrome && isOpera) { + isChrome = false; + } + + detectBrowserResult_ = { isExplorer: isExplorer, isFirefox: isFirefox, isOpera: isOpera, isChrome: isChrome, isSafari: isSafari }; + return detectBrowserResult_; + } + + detectBrowserResult_ = { isChrome: true, isExplorer: false, isFirefox: false, isOpera: false, isSafari: false }; + return detectBrowserResult_; + } + + module.exports = exports['default']; + +/***/ }, +/* 21 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + exports.__esModule = true; + + var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; + + function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { 'default': obj }; } + + function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError('Cannot call a class as a function'); } } + + var _lib_geoLat_lngJs = __webpack_require__(5); + + var _lib_geoLat_lngJs2 = _interopRequireDefault(_lib_geoLat_lngJs); + + var _pointGeometry = __webpack_require__(13); + + var _pointGeometry2 = _interopRequireDefault(_pointGeometry); + + var _lib_geoTransformJs = __webpack_require__(22); + + var _lib_geoTransformJs2 = _interopRequireDefault(_lib_geoTransformJs); + + var Geo = (function () { + function Geo(tileSize) { + _classCallCheck(this, Geo); + + // left_top view пользует гугл + // super(); + this.hasSize_ = false; + this.hasView_ = false; + this.transform_ = new _lib_geoTransformJs2['default'](tileSize || 512); + } + + Geo.prototype.setView = function setView(center, zoom, bearing) { + this.transform_.center = _lib_geoLat_lngJs2['default'].convert(center); + this.transform_.zoom = +zoom; + this.transform_.bearing = +bearing; + this.hasView_ = true; + }; + + Geo.prototype.setViewSize = function setViewSize(width, height) { + this.transform_.width = width; + this.transform_.height = height; + this.hasSize_ = true; + }; + + Geo.prototype.canProject = function canProject() { + return this.hasSize_ && this.hasView_; + }; + + Geo.prototype.hasSize = function hasSize() { + return this.hasSize_; + }; + + Geo.prototype.unproject = function unproject(ptXY, viewFromLeftTop) { + var ptRes = undefined; + if (viewFromLeftTop) { + var ptxy = _extends({}, ptXY); + ptxy.x -= this.transform_.width / 2; + ptxy.y -= this.transform_.height / 2; + ptRes = this.transform_.pointLocation(_pointGeometry2['default'].convert(ptxy)); + } else { + ptRes = this.transform_.pointLocation(_pointGeometry2['default'].convert(ptXY)); + } + + ptRes.lng -= 360 * Math.round(ptRes.lng / 360); // convert 2 google format + return ptRes; + }; + + Geo.prototype.project = function project(ptLatLng, viewFromLeftTop) { + if (viewFromLeftTop) { + var pt = this.transform_.locationPoint(_lib_geoLat_lngJs2['default'].convert(ptLatLng)); + pt.x -= this.transform_.worldSize * Math.round(pt.x / this.transform_.worldSize); + + pt.x += this.transform_.width / 2; + pt.y += this.transform_.height / 2; + + return pt; + } + + return this.transform_.locationPoint(_lib_geoLat_lngJs2['default'].convert(ptLatLng)); + }; + + Geo.prototype.getWidth = function getWidth() { + return this.transform_.width; + }; + + Geo.prototype.getHeight = function getHeight() { + return this.transform_.height; + }; + + Geo.prototype.getZoom = function getZoom() { + return this.transform_.zoom; + }; + + Geo.prototype.getCenter = function getCenter() { + var ptRes = this.transform_.pointLocation({ x: 0, y: 0 }); + + return ptRes; + }; + + Geo.prototype.getBounds = function getBounds(margins, roundFactor) { + var bndT = margins && margins[0] || 0; + var bndR = margins && margins[1] || 0; + var bndB = margins && margins[2] || 0; + var bndL = margins && margins[3] || 0; + + if (this.getWidth() - bndR - bndL > 0 && this.getHeight() - bndT - bndB > 0) { + var topLeftCorner = this.unproject({ x: bndL - this.getWidth() / 2, y: bndT - this.getHeight() / 2 }); + var bottomRightCorner = this.unproject({ x: this.getWidth() / 2 - bndR, y: this.getHeight() / 2 - bndB }); + + var res = [topLeftCorner.lat, topLeftCorner.lng, bottomRightCorner.lat, bottomRightCorner.lng]; + + if (roundFactor) { + res = res.map(function (r) { + return Math.round(r * roundFactor) / roundFactor; + }); + } + return res; + } + + return [0, 0, 0, 0]; + }; + + return Geo; + })(); + + exports['default'] = Geo; + module.exports = exports['default']; + +/***/ }, +/* 22 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var LatLng = __webpack_require__(5); + var Point = __webpack_require__(13); + var wrap = __webpack_require__(6).wrap; + + // A single transform, generally used for a single tile to be scaled, rotated, and zoomed. + + function Transform(tileSize, minZoom, maxZoom) { + this.tileSize = tileSize || 512; // constant + + this._minZoom = minZoom || 0; + this._maxZoom = maxZoom || 52; + + this.latRange = [-85.05113, 85.05113]; + + this.width = 0; + this.height = 0; + this.zoom = 0; + this.center = new LatLng(0, 0); + this.angle = 0; + } + + Transform.prototype = Object.defineProperties({ + + zoomScale: function zoomScale(zoom) { + return Math.pow(2, zoom); + }, + scaleZoom: function scaleZoom(scale) { + return Math.log(scale) / Math.LN2; + }, + + project: function project(latlng, worldSize) { + return new Point(this.lngX(latlng.lng, worldSize), this.latY(latlng.lat, worldSize)); + }, + + unproject: function unproject(point, worldSize) { + return new LatLng(this.yLat(point.y, worldSize), this.xLng(point.x, worldSize)); + }, + + // lat/lon <-> absolute pixel coords convertion + lngX: function lngX(lon, worldSize) { + return (180 + lon) * (worldSize || this.worldSize) / 360; + }, + // latitude to absolute y coord + latY: function latY(lat, worldSize) { + var y = 180 / Math.PI * Math.log(Math.tan(Math.PI / 4 + lat * Math.PI / 360)); + return (180 - y) * (worldSize || this.worldSize) / 360; + }, + + xLng: function xLng(x, worldSize) { + return x * 360 / (worldSize || this.worldSize) - 180; + }, + yLat: function yLat(y, worldSize) { + var y2 = 180 - y * 360 / (worldSize || this.worldSize); + return 360 / Math.PI * Math.atan(Math.exp(y2 * Math.PI / 180)) - 90; + }, + + locationPoint: function locationPoint(latlng) { + var p = this.project(latlng); + return this.centerPoint._sub(this.point._sub(p)._rotate(this.angle)); + }, + + pointLocation: function pointLocation(p) { + var p2 = this.centerPoint._sub(p)._rotate(-this.angle); + return this.unproject(this.point.sub(p2)); + } + + }, { + minZoom: { + get: function get() { + return this._minZoom; + }, + set: function set(zoom) { + this._minZoom = zoom; + this.zoom = Math.max(this.zoom, zoom); + }, + configurable: true, + enumerable: true + }, + maxZoom: { + get: function get() { + return this._maxZoom; + }, + set: function set(zoom) { + this._maxZoom = zoom; + this.zoom = Math.min(this.zoom, zoom); + }, + configurable: true, + enumerable: true + }, + worldSize: { + get: function get() { + return this.tileSize * this.scale; + }, + configurable: true, + enumerable: true + }, + centerPoint: { + get: function get() { + return new Point(0, 0); // this.size._div(2); + }, + configurable: true, + enumerable: true + }, + size: { + get: function get() { + return new Point(this.width, this.height); + }, + configurable: true, + enumerable: true + }, + bearing: { + get: function get() { + return -this.angle / Math.PI * 180; + }, + set: function set(bearing) { + this.angle = -wrap(bearing, -180, 180) * Math.PI / 180; + }, + configurable: true, + enumerable: true + }, + zoom: { + get: function get() { + return this._zoom; + }, + set: function set(zoom) { + zoom = Math.min(Math.max(zoom, this.minZoom), this.maxZoom); + this._zoom = zoom; + this.scale = this.zoomScale(zoom); + this.tileZoom = Math.floor(zoom); + this.zoomFraction = zoom - this.tileZoom; + }, + configurable: true, + enumerable: true + }, + x: { + get: function get() { + return this.lngX(this.center.lng); + }, + configurable: true, + enumerable: true + }, + y: { + get: function get() { + return this.latY(this.center.lat); + }, + configurable: true, + enumerable: true + }, + point: { + get: function get() { + return new Point(this.x, this.y); + }, + configurable: true, + enumerable: true + } + }); + + module.exports = Transform; + +/***/ }, +/* 23 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + var $script_ = null; + + var _loadPromise = undefined; + + // TODO add libraries language and other map options + module.exports = function googleMapLoader(apiKey) { + if (!$script_) { + $script_ = __webpack_require__(38); + } + + if (_loadPromise) { + return _loadPromise; + } + + _loadPromise = new Promise(function (resolve, reject) { + if (typeof window === 'undefined') { + reject(new Error('google map cannot be loaded outside browser env')); + return; + } + + if (window.google && window.google.maps) { + resolve(window.google.maps); + return; + } + + if (typeof window._$_google_map_initialize_$_ !== 'undefined') { + reject(new Error('google map initialization error')); + } + + window._$_google_map_initialize_$_ = function () { + delete window._$_google_map_initialize_$_; + resolve(window.google.maps); + }; + + var apiKeyString = apiKey ? '&key=' + apiKey : ''; + + $script_('https://maps.googleapis.com/maps/api/js?callback=_$_google_map_initialize_$_' + apiKeyString, function () { + if (typeof window.google === 'undefined') { + reject(new Error('google map initialization error (not loaded)')); + } + }); + }); + + return _loadPromise; + }; + +/***/ }, +/* 24 */ +/***/ function(module, exports, __webpack_require__) { + + 'use strict'; + + // + // We store our EE objects in a plain object whose properties are event names. + // If `Object.create(null)` is not supported we prefix the event names with a + // `~` to make sure that the built-in object properties are not overridden or + // used as an attack vector. + // We also assume that `Object.create(null)` is available when the event name + // is an ES6 Symbol. + // + var prefix = typeof Object.create !== 'function' ? '~' : false; + + /** + * Representation of a single EventEmitter function. + * + * @param {Function} fn Event handler to be called. + * @param {Mixed} context Context for function execution. + * @param {Boolean} once Only emit once + * @api private + */ + function EE(fn, context, once) { + this.fn = fn; + this.context = context; + this.once = once || false; + } + + /** + * Minimal EventEmitter interface that is molded against the Node.js + * EventEmitter interface. + * + * @constructor + * @api public + */ + function EventEmitter() { /* Nothing to set */ } + + /** + * Holds the assigned EventEmitters by name. + * + * @type {Object} + * @private + */ + EventEmitter.prototype._events = undefined; + + /** + * Return a list of assigned event listeners. + * + * @param {String} event The events that should be listed. + * @param {Boolean} exists We only need to know if there are listeners. + * @returns {Array|Boolean} + * @api public + */ + EventEmitter.prototype.listeners = function listeners(event, exists) { + var evt = prefix ? prefix + event : event + , available = this._events && this._events[evt]; + + if (exists) return !!available; + if (!available) return []; + if (available.fn) return [available.fn]; + + for (var i = 0, l = available.length, ee = new Array(l); i < l; i++) { + ee[i] = available[i].fn; + } + + return ee; + }; + + /** + * Emit an event to all registered event listeners. + * + * @param {String} event The name of the event. + * @returns {Boolean} Indication if we've emitted an event. + * @api public + */ + EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { + var evt = prefix ? prefix + event : event; + + if (!this._events || !this._events[evt]) return false; + + var listeners = this._events[evt] + , len = arguments.length + , args + , i; + + if ('function' === typeof listeners.fn) { + if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); + + switch (len) { + case 1: return listeners.fn.call(listeners.context), true; + case 2: return listeners.fn.call(listeners.context, a1), true; + case 3: return listeners.fn.call(listeners.context, a1, a2), true; + case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; + case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; + case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; + } + + for (i = 1, args = new Array(len -1); i < len; i++) { + args[i - 1] = arguments[i]; + } + + listeners.fn.apply(listeners.context, args); + } else { + var length = listeners.length + , j; + + for (i = 0; i < length; i++) { + if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); + + switch (len) { + case 1: listeners[i].fn.call(listeners[i].context); break; + case 2: listeners[i].fn.call(listeners[i].context, a1); break; + case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; + default: + if (!args) for (j = 1, args = new Array(len -1); j < len; j++) { + args[j - 1] = arguments[j]; + } + + listeners[i].fn.apply(listeners[i].context, args); + } + } + } + + return true; + }; + + /** + * Register a new EventListener for the given event. + * + * @param {String} event Name of the event. + * @param {Functon} fn Callback function. + * @param {Mixed} context The context of the function. + * @api public + */ + EventEmitter.prototype.on = function on(event, fn, context) { + var listener = new EE(fn, context || this) + , evt = prefix ? prefix + event : event; + + if (!this._events) this._events = prefix ? {} : Object.create(null); + if (!this._events[evt]) this._events[evt] = listener; + else { + if (!this._events[evt].fn) this._events[evt].push(listener); + else this._events[evt] = [ + this._events[evt], listener + ]; + } + + return this; + }; + + /** + * Add an EventListener that's only called once. + * + * @param {String} event Name of the event. + * @param {Function} fn Callback function. + * @param {Mixed} context The context of the function. + * @api public + */ + EventEmitter.prototype.once = function once(event, fn, context) { + var listener = new EE(fn, context || this, true) + , evt = prefix ? prefix + event : event; + + if (!this._events) this._events = prefix ? {} : Object.create(null); + if (!this._events[evt]) this._events[evt] = listener; + else { + if (!this._events[evt].fn) this._events[evt].push(listener); + else this._events[evt] = [ + this._events[evt], listener + ]; + } + + return this; + }; + + /** + * Remove event listeners. + * + * @param {String} event The event we want to remove. + * @param {Function} fn The listener that we need to find. + * @param {Mixed} context Only remove listeners matching this context. + * @param {Boolean} once Only remove once listeners. + * @api public + */ + EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { + var evt = prefix ? prefix + event : event; + + if (!this._events || !this._events[evt]) return this; + + var listeners = this._events[evt] + , events = []; + + if (fn) { + if (listeners.fn) { + if ( + listeners.fn !== fn + || (once && !listeners.once) + || (context && listeners.context !== context) + ) { + events.push(listeners); + } + } else { + for (var i = 0, length = listeners.length; i < length; i++) { + if ( + listeners[i].fn !== fn + || (once && !listeners[i].once) + || (context && listeners[i].context !== context) + ) { + events.push(listeners[i]); + } + } + } + } + + // + // Reset the array, or remove it completely if we have no more listeners. + // + if (events.length) { + this._events[evt] = events.length === 1 ? events[0] : events; + } else { + delete this._events[evt]; + } + + return this; + }; + + /** + * Remove all listeners or only the listeners for the specified event. + * + * @param {String} event The event want to remove all listeners for. + * @api public + */ + EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { + if (!this._events) return this; + + if (event) delete this._events[prefix ? prefix + event : event]; + else this._events = prefix ? {} : Object.create(null); + + return this; + }; + + // + // Alias methods names because people roll like that. + // + EventEmitter.prototype.off = EventEmitter.prototype.removeListener; + EventEmitter.prototype.addListener = EventEmitter.prototype.on; + + // + // This function doesn't apply anymore. + // + EventEmitter.prototype.setMaxListeners = function setMaxListeners() { + return this; + }; + + // + // Expose the prefix. + // + EventEmitter.prefixed = prefix; + + // + // Expose the module. + // + if (true) { + module.exports = EventEmitter; + } + + +/***/ }, +/* 25 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * lodash 3.2.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + var baseAssign = __webpack_require__(26), + createAssigner = __webpack_require__(28), + keys = __webpack_require__(10); + + /** + * A specialized version of `_.assign` for customizing assigned values without + * support for argument juggling, multiple sources, and `this` binding `customizer` + * functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @param {Function} customizer The function to customize assigned values. + * @returns {Object} Returns `object`. + */ + function assignWith(object, source, customizer) { + var index = -1, + props = keys(source), + length = props.length; + + while (++index < length) { + var key = props[index], + value = object[key], + result = customizer(value, source[key], key, object, source); + + if ((result === result ? (result !== value) : (value === value)) || + (value === undefined && !(key in object))) { + object[key] = result; + } + } + return object; + } + + /** + * Assigns own enumerable properties of source object(s) to the destination + * object. Subsequent sources overwrite property assignments of previous sources. + * If `customizer` is provided it is invoked to produce the assigned values. + * The `customizer` is bound to `thisArg` and invoked with five arguments: + * (objectValue, sourceValue, key, object, source). + * + * **Note:** This method mutates `object` and is based on + * [`Object.assign`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.assign). + * + * @static + * @memberOf _ + * @alias extend + * @category Object + * @param {Object} object The destination object. + * @param {...Object} [sources] The source objects. + * @param {Function} [customizer] The function to customize assigned values. + * @param {*} [thisArg] The `this` binding of `customizer`. + * @returns {Object} Returns `object`. + * @example + * + * _.assign({ 'user': 'barney' }, { 'age': 40 }, { 'user': 'fred' }); + * // => { 'user': 'fred', 'age': 40 } + * + * // using a customizer callback + * var defaults = _.partialRight(_.assign, function(value, other) { + * return _.isUndefined(value) ? other : value; + * }); + * + * defaults({ 'user': 'barney' }, { 'age': 36 }, { 'user': 'fred' }); + * // => { 'user': 'barney', 'age': 36 } + */ + var assign = createAssigner(function(object, source, customizer) { + return customizer + ? assignWith(object, source, customizer) + : baseAssign(object, source); + }); + + module.exports = assign; + + +/***/ }, +/* 26 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * lodash 3.2.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + var baseCopy = __webpack_require__(27), + keys = __webpack_require__(10); + + /** + * The base implementation of `_.assign` without support for argument juggling, + * multiple sources, and `customizer` functions. + * + * @private + * @param {Object} object The destination object. + * @param {Object} source The source object. + * @returns {Object} Returns `object`. + */ + function baseAssign(object, source) { + return source == null + ? object + : baseCopy(source, keys(source), object); + } + + module.exports = baseAssign; + + +/***/ }, +/* 27 */ +/***/ function(module, exports) { + + /** + * lodash 3.0.1 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + + /** + * Copies properties of `source` to `object`. + * + * @private + * @param {Object} source The object to copy properties from. + * @param {Array} props The property names to copy. + * @param {Object} [object={}] The object to copy properties to. + * @returns {Object} Returns `object`. + */ + function baseCopy(source, props, object) { + object || (object = {}); + + var index = -1, + length = props.length; + + while (++index < length) { + var key = props[index]; + object[key] = source[key]; + } + return object; + } + + module.exports = baseCopy; + + +/***/ }, +/* 28 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * lodash 3.1.1 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + var bindCallback = __webpack_require__(8), + isIterateeCall = __webpack_require__(29), + restParam = __webpack_require__(12); + + /** + * Creates a function that assigns properties of source object(s) to a given + * destination object. + * + * **Note:** This function is used to create `_.assign`, `_.defaults`, and `_.merge`. + * + * @private + * @param {Function} assigner The function to assign values. + * @returns {Function} Returns the new assigner function. + */ + function createAssigner(assigner) { + return restParam(function(object, sources) { + var index = -1, + length = object == null ? 0 : sources.length, + customizer = length > 2 ? sources[length - 2] : undefined, + guard = length > 2 ? sources[2] : undefined, + thisArg = length > 1 ? sources[length - 1] : undefined; + + if (typeof customizer == 'function') { + customizer = bindCallback(customizer, thisArg, 5); + length -= 2; + } else { + customizer = typeof thisArg == 'function' ? thisArg : undefined; + length -= (customizer ? 1 : 0); + } + if (guard && isIterateeCall(sources[0], sources[1], guard)) { + customizer = length < 3 ? undefined : customizer; + length = 1; + } + while (++index < length) { + var source = sources[index]; + if (source) { + assigner(object, source, customizer); + } + } + return object; + }); + } + + module.exports = createAssigner; + + +/***/ }, +/* 29 */ +/***/ function(module, exports) { + + /** + * lodash 3.0.9 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + + /** Used to detect unsigned integer values. */ + var reIsUint = /^\d+$/; + + /** + * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) + * of an array-like value. + */ + var MAX_SAFE_INTEGER = 9007199254740991; + + /** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new function. + */ + function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; + } + + /** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) + * that affects Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ + var getLength = baseProperty('length'); + + /** + * Checks if `value` is array-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + */ + function isArrayLike(value) { + return value != null && isLength(getLength(value)); + } + + /** + * Checks if `value` is a valid array-like index. + * + * @private + * @param {*} value The value to check. + * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. + * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. + */ + function isIndex(value, length) { + value = (typeof value == 'number' || reIsUint.test(value)) ? +value : -1; + length = length == null ? MAX_SAFE_INTEGER : length; + return value > -1 && value % 1 == 0 && value < length; + } + + /** + * Checks if the provided arguments are from an iteratee call. + * + * @private + * @param {*} value The potential iteratee value argument. + * @param {*} index The potential iteratee index or key argument. + * @param {*} object The potential iteratee object argument. + * @returns {boolean} Returns `true` if the arguments are from an iteratee call, else `false`. + */ + function isIterateeCall(value, index, object) { + if (!isObject(object)) { + return false; + } + var type = typeof index; + if (type == 'number' + ? (isArrayLike(object) && isIndex(index, object.length)) + : (type == 'string' && index in object)) { + var other = object[index]; + return value === value ? (value === other) : (other !== other); + } + return false; + } + + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ + function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + } + + /** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ + function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); + } + + module.exports = isIterateeCall; + + +/***/ }, +/* 30 */ +/***/ function(module, exports) { + + /* WEBPACK VAR INJECTION */(function(global) {/** + * lodash 3.0.5 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + + /** `Object#toString` result references. */ + var funcTag = '[object Function]'; + + /** + * Used to match `RegExp` [special characters](http://www.regular-expressions.info/characters.html#special). + * In addition to special characters the forward slash is escaped to allow for + * easier `eval` use and `Function` compilation. + */ + var reRegExpChars = /[.*+?^${}()|[\]\/\\]/g, + reHasRegExpChars = RegExp(reRegExpChars.source); + + /** Used to detect host constructors (Safari > 5). */ + var reIsHostCtor = /^\[object .+?Constructor\]$/; + + /** + * The base implementation of `_.isFunction` without support for environments + * with incorrect `typeof` results. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + */ + function baseIsFunction(value) { + // Avoid a Chakra JIT bug in compatibility modes of IE 11. + // See https://github.com/jashkenas/underscore/issues/1621 for more details. + return typeof value == 'function' || false; + } + + /** + * Converts `value` to a string if it's not one. An empty string is returned + * for `null` or `undefined` values. + * + * @private + * @param {*} value The value to process. + * @returns {string} Returns the string. + */ + function baseToString(value) { + if (typeof value == 'string') { + return value; + } + return value == null ? '' : (value + ''); + } + + /** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ + function isObjectLike(value) { + return !!value && typeof value == 'object'; + } + + /** Used for native method references. */ + var objectProto = Object.prototype; + + /** Used to resolve the decompiled source of functions. */ + var fnToString = Function.prototype.toString; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** + * Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) + * of values. + */ + var objToString = objectProto.toString; + + /** Used to detect if a method is native. */ + var reIsNative = RegExp('^' + + escapeRegExp(fnToString.call(hasOwnProperty)) + .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' + ); + + /** Native method references. */ + var Uint8Array = getNative(global, 'Uint8Array'); + + /** + * Gets the native function at `key` of `object`. + * + * @private + * @param {Object} object The object to query. + * @param {string} key The key of the method to get. + * @returns {*} Returns the function if it's native, else `undefined`. + */ + function getNative(object, key) { + var value = object == null ? undefined : object[key]; + return isNative(value) ? value : undefined; + } + + /** + * Checks if `value` is classified as a `Function` object. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isFunction(_); + * // => true + * + * _.isFunction(/abc/); + * // => false + */ + var isFunction = !(baseIsFunction(/x/) || (Uint8Array && !baseIsFunction(Uint8Array))) ? baseIsFunction : function(value) { + // The use of `Object#toString` avoids issues with the `typeof` operator + // in older versions of Chrome and Safari which return 'function' for regexes + // and Safari 8 equivalents which return 'object' for typed array constructors. + return objToString.call(value) == funcTag; + }; + + /** + * Checks if `value` is a native function. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a native function, else `false`. + * @example + * + * _.isNative(Array.prototype.push); + * // => true + * + * _.isNative(_); + * // => false + */ + function isNative(value) { + if (value == null) { + return false; + } + if (objToString.call(value) == funcTag) { + return reIsNative.test(fnToString.call(value)); + } + return isObjectLike(value) && reIsHostCtor.test(value); + } + + /** + * Escapes the `RegExp` special characters "\", "/", "^", "$", ".", "|", "?", + * "*", "+", "(", ")", "[", "]", "{" and "}" in `string`. + * + * @static + * @memberOf _ + * @category String + * @param {string} [string=''] The string to escape. + * @returns {string} Returns the escaped string. + * @example + * + * _.escapeRegExp('[lodash](https://lodash.com/)'); + * // => '\[lodash\]\(https:\/\/lodash\.com\/\)' + */ + function escapeRegExp(string) { + string = baseToString(string); + return (string && reHasRegExpChars.test(string)) + ? string.replace(reRegExpChars, '\\$&') + : string; + } + + module.exports = isFunction; + + /* WEBPACK VAR INJECTION */}.call(exports, (function() { return this; }()))) + +/***/ }, +/* 31 */ +/***/ function(module, exports) { + + /** + * lodash 3.0.1 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.2 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + + /** `Object#toString` result references. */ + var numberTag = '[object Number]'; + + /** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ + function isObjectLike(value) { + return !!value && typeof value == 'object'; + } + + /** Used for native method references. */ + var objectProto = Object.prototype; + + /** + * Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) + * of values. + */ + var objToString = objectProto.toString; + + /** + * Checks if `value` is classified as a `Number` primitive or object. + * + * **Note:** To exclude `Infinity`, `-Infinity`, and `NaN`, which are classified + * as numbers, use the `_.isFinite` method. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`. + * @example + * + * _.isNumber(8.4); + * // => true + * + * _.isNumber(NaN); + * // => true + * + * _.isNumber('8.4'); + * // => false + */ + function isNumber(value) { + return typeof value == 'number' || (isObjectLike(value) && objToString.call(value) == numberTag); + } + + module.exports = isNumber; + + +/***/ }, +/* 32 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * lodash 3.1.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + var baseFor = __webpack_require__(7), + getNative = __webpack_require__(9), + keysIn = __webpack_require__(11); + + /** `Object#toString` result references. */ + var objectTag = '[object Object]'; + + /** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ + function isObjectLike(value) { + return !!value && typeof value == 'object'; + } + + /** Used for native method references. */ + var objectProto = Object.prototype; + + /** Used to check objects for own properties. */ + var hasOwnProperty = objectProto.hasOwnProperty; + + /** + * Used to resolve the [`toStringTag`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-object.prototype.tostring) + * of values. + */ + var objToString = objectProto.toString; + + /** Native method references. */ + var getPrototypeOf = getNative(Object, 'getPrototypeOf'); + + /** + * The base implementation of `_.forIn` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ + function baseForIn(object, iteratee) { + return baseFor(object, iteratee, keysIn); + } + + /** + * A fallback implementation of `_.isPlainObject` which checks if `value` + * is an object created by the `Object` constructor or has a `[[Prototype]]` + * of `null`. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. + */ + function shimIsPlainObject(value) { + var Ctor; + + // Exit early for non `Object` objects. + if (!(isObjectLike(value) && objToString.call(value) == objectTag) || + (!hasOwnProperty.call(value, 'constructor') && + (Ctor = value.constructor, typeof Ctor == 'function' && !(Ctor instanceof Ctor)))) { + return false; + } + // IE < 9 iterates inherited properties before own properties. If the first + // iterated property is an object's own property then there are no inherited + // enumerable properties. + var result; + // In most environments an object's own properties are iterated before + // its inherited properties. If the last iterated property is an object's + // own property then there are no inherited enumerable properties. + baseForIn(value, function(subValue, key) { + result = key; + }); + return result === undefined || hasOwnProperty.call(value, result); + } + + /** + * Checks if `value` is a plain object, that is, an object created by the + * `Object` constructor or one with a `[[Prototype]]` of `null`. + * + * **Note:** This method assumes objects created by the `Object` constructor + * have no inherited enumerable properties. + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. + * @example + * + * function Foo() { + * this.a = 1; + * } + * + * _.isPlainObject(new Foo); + * // => false + * + * _.isPlainObject([1, 2, 3]); + * // => false + * + * _.isPlainObject({ 'x': 0, 'y': 0 }); + * // => true + * + * _.isPlainObject(Object.create(null)); + * // => true + */ + var isPlainObject = !getPrototypeOf ? shimIsPlainObject : function(value) { + if (!(value && objToString.call(value) == objectTag)) { + return false; + } + var valueOf = getNative(value, 'valueOf'), + objProto = valueOf && (objProto = getPrototypeOf(valueOf)) && getPrototypeOf(objProto); + + return objProto + ? (value == objProto || getPrototypeOf(value) == objProto) + : shimIsPlainObject(value); + }; + + module.exports = isPlainObject; + + +/***/ }, +/* 33 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * lodash 3.1.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.2 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + var baseFlatten = __webpack_require__(34), + bindCallback = __webpack_require__(8), + pickByArray = __webpack_require__(35), + pickByCallback = __webpack_require__(36), + restParam = __webpack_require__(12); + + /** + * Creates an object composed of the picked `object` properties. Property + * names may be specified as individual arguments or as arrays of property + * names. If `predicate` is provided it is invoked for each property of `object` + * picking the properties `predicate` returns truthy for. The predicate is + * bound to `thisArg` and invoked with three arguments: (value, key, object). + * + * @static + * @memberOf _ + * @category Object + * @param {Object} object The source object. + * @param {Function|...(string|string[])} [predicate] The function invoked per + * iteration or property names to pick, specified as individual property + * names or arrays of property names. + * @param {*} [thisArg] The `this` binding of `predicate`. + * @returns {Object} Returns the new object. + * @example + * + * var object = { 'user': 'fred', 'age': 40 }; + * + * _.pick(object, 'user'); + * // => { 'user': 'fred' } + * + * _.pick(object, _.isString); + * // => { 'user': 'fred' } + */ + var pick = restParam(function(object, props) { + if (object == null) { + return {}; + } + return typeof props[0] == 'function' + ? pickByCallback(object, bindCallback(props[0], props[1], 3)) + : pickByArray(object, baseFlatten(props)); + }); + + module.exports = pick; + + +/***/ }, +/* 34 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * lodash 3.1.3 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + var isArguments = __webpack_require__(2), + isArray = __webpack_require__(3); + + /** + * Checks if `value` is object-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is object-like, else `false`. + */ + function isObjectLike(value) { + return !!value && typeof value == 'object'; + } + + /** + * Used as the [maximum length](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-number.max_safe_integer) + * of an array-like value. + */ + var MAX_SAFE_INTEGER = 9007199254740991; + + /** + * The base implementation of `_.flatten` with added support for restricting + * flattening and specifying the start index. + * + * @private + * @param {Array} array The array to flatten. + * @param {boolean} [isDeep] Specify a deep flatten. + * @param {boolean} [isStrict] Restrict flattening to arrays-like objects. + * @returns {Array} Returns the new flattened array. + */ + function baseFlatten(array, isDeep, isStrict) { + var index = -1, + length = array.length, + resIndex = -1, + result = []; + + while (++index < length) { + var value = array[index]; + if (isObjectLike(value) && isArrayLike(value) && + (isStrict || isArray(value) || isArguments(value))) { + if (isDeep) { + // Recursively flatten arrays (susceptible to call stack limits). + value = baseFlatten(value, isDeep, isStrict); + } + var valIndex = -1, + valLength = value.length; + + while (++valIndex < valLength) { + result[++resIndex] = value[valIndex]; + } + } else if (!isStrict) { + result[++resIndex] = value; + } + } + return result; + } + + /** + * The base implementation of `_.property` without support for deep paths. + * + * @private + * @param {string} key The key of the property to get. + * @returns {Function} Returns the new function. + */ + function baseProperty(key) { + return function(object) { + return object == null ? undefined : object[key]; + }; + } + + /** + * Gets the "length" property value of `object`. + * + * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792) + * that affects Safari on at least iOS 8.1-8.3 ARM64. + * + * @private + * @param {Object} object The object to query. + * @returns {*} Returns the "length" value. + */ + var getLength = baseProperty('length'); + + /** + * Checks if `value` is array-like. + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is array-like, else `false`. + */ + function isArrayLike(value) { + return value != null && isLength(getLength(value)); + } + + /** + * Checks if `value` is a valid array-like length. + * + * **Note:** This function is based on [`ToLength`](https://people.mozilla.org/~jorendorff/es6-draft.html#sec-tolength). + * + * @private + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. + */ + function isLength(value) { + return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; + } + + module.exports = baseFlatten; + + +/***/ }, +/* 35 */ +/***/ function(module, exports) { + + /** + * lodash 3.0.2 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.8.3 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + + /** + * A specialized version of `_.pick` which picks `object` properties specified + * by `props`. + * + * @private + * @param {Object} object The source object. + * @param {string[]} props The property names to pick. + * @returns {Object} Returns the new object. + */ + function pickByArray(object, props) { + object = toObject(object); + + var index = -1, + length = props.length, + result = {}; + + while (++index < length) { + var key = props[index]; + if (key in object) { + result[key] = object[key]; + } + } + return result; + } + + /** + * Converts `value` to an object if it's not one. + * + * @private + * @param {*} value The value to process. + * @returns {Object} Returns the object. + */ + function toObject(value) { + return isObject(value) ? value : Object(value); + } + + /** + * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`. + * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) + * + * @static + * @memberOf _ + * @category Lang + * @param {*} value The value to check. + * @returns {boolean} Returns `true` if `value` is an object, else `false`. + * @example + * + * _.isObject({}); + * // => true + * + * _.isObject([1, 2, 3]); + * // => true + * + * _.isObject(1); + * // => false + */ + function isObject(value) { + // Avoid a V8 JIT bug in Chrome 19-20. + // See https://code.google.com/p/v8/issues/detail?id=2291 for more details. + var type = typeof value; + return !!value && (type == 'object' || type == 'function'); + } + + module.exports = pickByArray; + + +/***/ }, +/* 36 */ +/***/ function(module, exports, __webpack_require__) { + + /** + * lodash 3.0.0 (Custom Build) + * Build: `lodash modern modularize exports="npm" -o ./` + * Copyright 2012-2015 The Dojo Foundation + * Based on Underscore.js 1.7.0 + * Copyright 2009-2015 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors + * Available under MIT license + */ + var baseFor = __webpack_require__(7), + keysIn = __webpack_require__(11); + + /** + * The base implementation of `_.forIn` without support for callback + * shorthands and `this` binding. + * + * @private + * @param {Object} object The object to iterate over. + * @param {Function} iteratee The function invoked per iteration. + * @returns {Object} Returns `object`. + */ + function baseForIn(object, iteratee) { + return baseFor(object, iteratee, keysIn); + } + + /** + * A specialized version of `_.pick` that picks `object` properties `predicate` + * returns truthy for. + * + * @private + * @param {Object} object The source object. + * @param {Function} predicate The function invoked per iteration. + * @returns {Object} Returns the new object. + */ + function pickByCallback(object, predicate) { + var result = {}; + baseForIn(object, function(value, key, object) { + if (predicate(value, key, object)) { + result[key] = value; + } + }); + return result; + } + + module.exports = pickByCallback; + + +/***/ }, +/* 37 */ +/***/ function(module, exports) { + + 'use strict'; + + exports.__esModule = true; + exports['default'] = shallowEqual; + + function shallowEqual(objA, objB) { + if (objA === objB) { + return true; + } + + if (typeof objA !== 'object' || objA === null || typeof objB !== 'object' || objB === null) { + return false; + } + + var keysA = Object.keys(objA); + var keysB = Object.keys(objB); + + if (keysA.length !== keysB.length) { + return false; + } + + // Test for A's keys different from B. + var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB); + for (var i = 0; i < keysA.length; i++) { + if (!bHasOwnProperty(keysA[i]) || objA[keysA[i]] !== objB[keysA[i]]) { + return false; + } + } + + return true; + } + + module.exports = exports['default']; + +/***/ }, +/* 38 */ +/***/ function(module, exports, __webpack_require__) { + + var __WEBPACK_AMD_DEFINE_FACTORY__, __WEBPACK_AMD_DEFINE_RESULT__;/*! + * $script.js JS loader & dependency manager + * https://github.com/ded/script.js + * (c) Dustin Diaz 2014 | License MIT + */ + + (function (name, definition) { + if (typeof module != 'undefined' && module.exports) module.exports = definition() + else if (true) !(__WEBPACK_AMD_DEFINE_FACTORY__ = (definition), __WEBPACK_AMD_DEFINE_RESULT__ = (typeof __WEBPACK_AMD_DEFINE_FACTORY__ === 'function' ? (__WEBPACK_AMD_DEFINE_FACTORY__.call(exports, __webpack_require__, exports, module)) : __WEBPACK_AMD_DEFINE_FACTORY__), __WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__)) + else this[name] = definition() + })('$script', function () { + var doc = document + , head = doc.getElementsByTagName('head')[0] + , s = 'string' + , f = false + , push = 'push' + , readyState = 'readyState' + , onreadystatechange = 'onreadystatechange' + , list = {} + , ids = {} + , delay = {} + , scripts = {} + , scriptpath + , urlArgs + + function every(ar, fn) { + for (var i = 0, j = ar.length; i < j; ++i) if (!fn(ar[i])) return f + return 1 + } + function each(ar, fn) { + every(ar, function (el) { + return !fn(el) + }) + } + + function $script(paths, idOrDone, optDone) { + paths = paths[push] ? paths : [paths] + var idOrDoneIsDone = idOrDone && idOrDone.call + , done = idOrDoneIsDone ? idOrDone : optDone + , id = idOrDoneIsDone ? paths.join('') : idOrDone + , queue = paths.length + function loopFn(item) { + return item.call ? item() : list[item] + } + function callback() { + if (!--queue) { + list[id] = 1 + done && done() + for (var dset in delay) { + every(dset.split('|'), loopFn) && !each(delay[dset], loopFn) && (delay[dset] = []) + } + } + } + setTimeout(function () { + each(paths, function loading(path, force) { + if (path === null) return callback() + path = !force && path.indexOf('.js') === -1 && !/^https?:\/\//.test(path) && scriptpath ? scriptpath + path + '.js' : path + if (scripts[path]) { + if (id) ids[id] = 1 + return (scripts[path] == 2) ? callback() : setTimeout(function () { loading(path, true) }, 0) + } + + scripts[path] = 1 + if (id) ids[id] = 1 + create(path, callback) + }) + }, 0) + return $script + } + + function create(path, fn) { + var el = doc.createElement('script'), loaded + el.onload = el.onerror = el[onreadystatechange] = function () { + if ((el[readyState] && !(/^c|loade/.test(el[readyState]))) || loaded) return; + el.onload = el[onreadystatechange] = null + loaded = 1 + scripts[path] = 2 + fn() + } + el.async = 1 + el.src = urlArgs ? path + (path.indexOf('?') === -1 ? '?' : '&') + urlArgs : path; + head.insertBefore(el, head.lastChild) + } + + $script.get = create + + $script.order = function (scripts, id, done) { + (function callback(s) { + s = scripts.shift() + !scripts.length ? $script(s, id, done) : $script(s, callback) + }()) + } + + $script.path = function (p) { + scriptpath = p + } + $script.urlArgs = function (str) { + urlArgs = str; + } + $script.ready = function (deps, ready, req) { + deps = deps[push] ? deps : [deps] + var missing = []; + !each(deps, function (dep) { + list[dep] || missing[push](dep); + }) && every(deps, function (dep) {return list[dep]}) ? + ready() : !function (key) { + delay[key] = delay[key] || [] + delay[key][push](ready) + req && req(missing) + }(deps.join('|')) + return $script + } + + $script.done = function (idOrDone) { + $script([null], idOrDone) + } + + return $script + }); + + +/***/ } +/******/ ]) +}); +; \ No newline at end of file diff --git a/lib/umd/GoogleMapReact.min.js b/lib/umd/GoogleMapReact.min.js new file mode 100644 index 0000000..a5e3348 --- /dev/null +++ b/lib/umd/GoogleMapReact.min.js @@ -0,0 +1,7 @@ +!function(t,e){"object"==typeof exports&&"object"==typeof module?module.exports=e(require("react")):"function"==typeof define&&define.amd?define(["react"],e):"object"==typeof exports?exports.GoogleMapReact=e(require("react")):t.GoogleMapReact=e(t.React)}(this,function(t){return function(t){function e(o){if(n[o])return n[o].exports;var r=n[o]={exports:{},id:o,loaded:!1};return t[o].call(r.exports,r,r.exports,e),r.loaded=!0,r.exports}var n={};return e.m=t,e.c=n,e.p="",e(0)}([function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}e.__esModule=!0;var r=n(15),i=o(r);e["default"]=i["default"],t.exports=e["default"]},function(e,n){e.exports=t},function(t,e){function n(t){return!!t&&"object"==typeof t}function o(t){return function(e){return null==e?void 0:e[t]}}function r(t){return null!=t&&i(f(t))}function i(t){return"number"==typeof t&&t>-1&&t%1==0&&l>=t}function s(t){return n(t)&&r(t)&&c.call(t)==u}var u="[object Arguments]",a=Object.prototype,c=a.toString,l=9007199254740991,f=o("length");t.exports=s},function(t,e){function n(t){return"string"==typeof t?t:null==t?"":t+""}function o(t){return!!t&&"object"==typeof t}function r(t,e){var n=null==t?void 0:t[e];return s(n)?n:void 0}function i(t){return"number"==typeof t&&t>-1&&t%1==0&&m>=t}function s(t){return null==t?!1:v.call(t)==c?g.test(d.call(t)):o(t)&&p.test(t)}function u(t){return t=n(t),t&&f.test(t)?t.replace(l,"\\$&"):t}var a="[object Array]",c="[object Function]",l=/[.*+?^${}()|[\]\/\\]/g,f=RegExp(l.source),p=/^\[object .+?Constructor\]$/,h=Object.prototype,d=Function.prototype.toString,_=h.hasOwnProperty,v=h.toString,g=RegExp("^"+u(d.call(_)).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),y=r(Array,"isArray"),m=9007199254740991,x=y||function(t){return o(t)&&i(t.length)&&v.call(t)==a};t.exports=x},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(t.__proto__=e)}e.__esModule=!0;var s=Object.assign||function(t){for(var e=1;e-1&&t%1==0&&e>t}function s(t){return"number"==typeof t&&t>-1&&t%1==0&&g>=t}function u(t){for(var e=c(t),n=e.length,o=n&&t.length,r=!!o&&s(o)&&(p(t)||f(t)),u=-1,a=[];++u0;++o-1&&t%1==0&&e>t}function r(t){return"number"==typeof t&&t>-1&&t%1==0&&p>=t}function i(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}function s(t){if(null==t)return[];i(t)||(t=Object(t));var e=t.length;e=e&&r(e)&&(a(t)||u(t))&&e||0;for(var n=t.constructor,s=-1,c="function"==typeof n&&n.prototype===t,l=Array(e),p=e>0;++sn&&(o.boundingRect_=t.currentTarget.getBoundingClientRect()),o.mouseMoveTime_=e;var r=t.clientX-o.boundingRect_.left,i=t.clientY-o.boundingRect_.top;o.mouse_||(o.mouse_={x:0,y:0,lat:0,lng:0});var s=100;o.mouse_.x=r,o.mouse_.y=i;var u=o.geoService_.unproject(o.mouse_,!0);o.mouse_.lat=u.lat,o.mouse_.lng=u.lng,e-o.dragTime_t&&o.markersDispatcher_.emit("kON_CLICK")}},this._isCenterDefined=function(t){return t&&2===t.length&&$["default"](t[0])&&$["default"](t[1])},this.mounted_=!1,this.map_=null,this.maps_=null,this.prevBounds_=null,this.mouse_=null,this.mouseMoveTime_=0,this.boundingRect_=null,this.mouseInMap_=!0,this.dragTime_=0,this.fireMouseEventOnIdle_=!1,this.updateCounter_=0,this.markersDispatcher_=new d["default"](this),this.geoService_=new S["default"](R),this._isCenterDefined(this.props.center)&&this.geoService_.setView(this.props.center,this.props.zoom,0),this.state={overlayCreated:!1}}return i(e,t),e.prototype.componentDidMount=function(){var t=this;this.mounted_=!0,window.addEventListener("resize",this._onWindowResize),setTimeout(function(){t._setViewSize(),t._isCenterDefined(t.props.center)?t._initMap():t.props.googleMapLoader(t.props.apiKey)},0,this)},e.prototype.componentWillUnmount=function(){this.mounted_=!1,window.removeEventListener("resize",this._onWindowResize),this.maps_&&this.map_&&this.maps_.event.clearInstanceListeners(this.map_),this.map_=null,this.maps_=null,this.markersDispatcher_.dispose(),this.resetSizeOnIdle_=!1,delete this.map_,delete this.markersDispatcher_},e.prototype.componentWillReceiveProps=function(t){var e=this;if(!this._isCenterDefined(this.props.center)&&this._isCenterDefined(t.center)&&setTimeout(function(){return e._initMap()},0),this.map_){var n=this.geoService_.getCenter();t.center&&Math.abs(t.center[0]-n.lat)+Math.abs(t.center[1]-n.lng)>H&&this.map_.panTo({lat:t.center[0],lng:t.center[1]}),Math.abs(t.zoom-this.props.zoom)>0&&this.map_.setZoom(t.zoom)}},e.prototype.componentDidUpdate=function(){this.markersDispatcher_.emit("kON_CHANGE")},e.prototype.render=function(){var t=this.state.overlayCreated?null:l["default"].createElement(x["default"],{onChildClick:this._onChildClick,onChildMouseEnter:this._onChildMouseEnter,onChildMouseLeave:this._onChildMouseLeave,geoService:this.geoService_,projectFromLeftTop:!1,distanceToMouse:this.props.distanceToMouse,hoverDistance:this.props.hoverDistance,dispatcher:this.markersDispatcher_});return l["default"].createElement("div",{style:B,onMouseMove:this._onMouseMove,onClick:this._onMapClick},l["default"].createElement(v["default"],{ref:"google_map_dom"}),t)},a(e,null,[{key:"propTypes",value:{apiKey:c.PropTypes.string,center:c.PropTypes.array.isRequired,zoom:c.PropTypes.number.isRequired,onBoundsChange:c.PropTypes.func,onChildClick:c.PropTypes.func,onChildMouseEnter:c.PropTypes.func,onChildMouseLeave:c.PropTypes.func,options:c.PropTypes.any,distanceToMouse:c.PropTypes.func,hoverDistance:c.PropTypes.number,debounced:c.PropTypes.bool,margin:c.PropTypes.array,googleMapLoader:c.PropTypes.any},enumerable:!0},{key:"defaultProps",value:{distanceToMouse:function(t,e){var n=t.x,o=t.y;return Math.sqrt((n-e.x)*(n-e.x)+(o-e.y)*(o-e.y))},hoverDistance:30,debounced:!0,options:s,googleMapLoader:C["default"]},enumerable:!0}]),e}(c.Component);e["default"]=Z,t.exports=e["default"]},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(t.__proto__=e)}e.__esModule=!0;var s=n(1),u=o(s),a={width:"100%",height:"100%",left:0,top:0,margin:0,padding:0,position:"absolute"},c=function(t){function e(n){r(this,e),t.call(this,n)}return i(e,t),e.prototype.shouldComponentUpdate=function(){return!1},e.prototype.render=function(){return u["default"].createElement("div",{style:a})},e}(s.Component);e["default"]=c,t.exports=e["default"]},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(t.__proto__=e)}e.__esModule=!0;var s=n(1),u=o(s),a=n(4),c=o(a),l={width:"50%",height:"50%",left:"50%",top:"50%",margin:0,padding:0,position:"absolute"},f=function(t){function e(n){r(this,e),t.call(this,n)}return i(e,t),e.prototype.render=function(){return u["default"].createElement("div",{style:l},u["default"].createElement(c["default"],this.props))},e}(s.Component);e["default"]=f,t.exports=e["default"]},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}function i(t,e){if("function"!=typeof e&&null!==e)throw new TypeError("Super expression must either be null or a function, not "+typeof e);t.prototype=Object.create(e&&e.prototype,{constructor:{value:t,enumerable:!1,writable:!0,configurable:!0}}),e&&(t.__proto__=e)}e.__esModule=!0;var s=n(24),u=o(s),a=function(t){function e(n){r(this,e),t.call(this),this.gmapInstance=n}return i(e,t),e.prototype.getChildren=function(){return this.gmapInstance.props.children},e.prototype.getMousePosition=function(){return this.gmapInstance.mouse_},e.prototype.getUpdateCounter=function(){return this.gmapInstance.updateCounter_},e.prototype.dispose=function(){this.gmapInstance=null,this.removeAllListeners()},e}(u["default"]);e["default"]=a,t.exports=e["default"]},function(t,e){"use strict";function n(t,e,n){if(t&&e){for(var o=0;o!==t.length;++o)if(Math.abs(t[o]-e[o])>n)return!1;return!0}return!1}e.__esModule=!0,e["default"]=n,t.exports=e["default"]},function(t,e){"use strict";function n(){if(o)return o;if("undefined"!=typeof navigator){var t=navigator.userAgent.indexOf("MSIE")>-1,e=navigator.userAgent.indexOf("Firefox")>-1,n=navigator.userAgent.toLowerCase().indexOf("op")>-1,r=navigator.userAgent.indexOf("Chrome")>-1,i=navigator.userAgent.indexOf("Safari")>-1;return r&&i&&(i=!1),r&&n&&(r=!1),o={isExplorer:t,isFirefox:e,isOpera:n,isChrome:r,isSafari:i}}return o={isChrome:!0,isExplorer:!1,isFirefox:!1,isOpera:!1,isSafari:!1}}e.__esModule=!0,e["default"]=n;var o=null;t.exports=e["default"]},function(t,e,n){"use strict";function o(t){return t&&t.__esModule?t:{"default":t}}function r(t,e){if(!(t instanceof e))throw new TypeError("Cannot call a class as a function")}e.__esModule=!0;var i=Object.assign||function(t){for(var e=1;e0&&this.getHeight()-n-r>0){var s=this.unproject({x:i-this.getWidth()/2,y:n-this.getHeight()/2}),u=this.unproject({x:this.getWidth()/2-o,y:this.getHeight()/2-r}),a=[s.lat,s.lng,u.lat,u.lng];return e&&(a=a.map(function(t){return Math.round(t*e)/e})),a}return[0,0,0,0]},t}();e["default"]=p,t.exports=e["default"]},function(t,e,n){"use strict";function o(t,e,n){this.tileSize=t||512,this._minZoom=e||0,this._maxZoom=n||52,this.latRange=[-85.05113,85.05113],this.width=0,this.height=0,this.zoom=0,this.center=new r(0,0),this.angle=0}var r=n(5),i=n(13),s=n(6).wrap;o.prototype=Object.defineProperties({zoomScale:function(t){return Math.pow(2,t)},scaleZoom:function(t){return Math.log(t)/Math.LN2},project:function(t,e){return new i(this.lngX(t.lng,e),this.latY(t.lat,e))},unproject:function(t,e){return new r(this.yLat(t.y,e),this.xLng(t.x,e))},lngX:function(t,e){return(180+t)*(e||this.worldSize)/360},latY:function(t,e){var n=180/Math.PI*Math.log(Math.tan(Math.PI/4+t*Math.PI/360));return(180-n)*(e||this.worldSize)/360},xLng:function(t,e){return 360*t/(e||this.worldSize)-180},yLat:function(t,e){var n=180-360*t/(e||this.worldSize);return 360/Math.PI*Math.atan(Math.exp(n*Math.PI/180))-90},locationPoint:function(t){var e=this.project(t);return this.centerPoint._sub(this.point._sub(e)._rotate(this.angle))},pointLocation:function(t){var e=this.centerPoint._sub(t)._rotate(-this.angle);return this.unproject(this.point.sub(e))}},{minZoom:{get:function(){return this._minZoom},set:function(t){this._minZoom=t,this.zoom=Math.max(this.zoom,t)},configurable:!0,enumerable:!0},maxZoom:{get:function(){return this._maxZoom},set:function(t){this._maxZoom=t,this.zoom=Math.min(this.zoom,t)},configurable:!0,enumerable:!0},worldSize:{get:function(){return this.tileSize*this.scale},configurable:!0,enumerable:!0},centerPoint:{get:function(){return new i(0,0)},configurable:!0,enumerable:!0},size:{get:function(){return new i(this.width,this.height)},configurable:!0,enumerable:!0},bearing:{get:function(){return-this.angle/Math.PI*180},set:function(t){this.angle=-s(t,-180,180)*Math.PI/180},configurable:!0,enumerable:!0},zoom:{get:function(){return this._zoom},set:function(t){t=Math.min(Math.max(t,this.minZoom),this.maxZoom),this._zoom=t,this.scale=this.zoomScale(t),this.tileZoom=Math.floor(t),this.zoomFraction=t-this.tileZoom},configurable:!0,enumerable:!0},x:{get:function(){return this.lngX(this.center.lng)},configurable:!0,enumerable:!0},y:{get:function(){return this.latY(this.center.lat)},configurable:!0,enumerable:!0},point:{get:function(){return new i(this.x,this.y)},configurable:!0,enumerable:!0}}),t.exports=o},function(t,e,n){"use strict";var o=null,r=void 0;t.exports=function(t){return o||(o=n(38)),r?r:r=new Promise(function(e,n){if("undefined"==typeof window)return void n(new Error("google map cannot be loaded outside browser env"));if(window.google&&window.google.maps)return void e(window.google.maps);"undefined"!=typeof window._$_google_map_initialize_$_&&n(new Error("google map initialization error")),window._$_google_map_initialize_$_=function(){delete window._$_google_map_initialize_$_,e(window.google.maps)};var r=t?"&key="+t:"";o("https://maps.googleapis.com/maps/api/js?callback=_$_google_map_initialize_$_"+r,function(){"undefined"==typeof window.google&&n(new Error("google map initialization error (not loaded)"))})})}},function(t,e,n){"use strict";function o(t,e,n){this.fn=t,this.context=e,this.once=n||!1}function r(){}var i="function"!=typeof Object.create?"~":!1;r.prototype._events=void 0,r.prototype.listeners=function(t,e){var n=i?i+t:t,o=this._events&&this._events[n];if(e)return!!o;if(!o)return[];if(o.fn)return[o.fn];for(var r=0,s=o.length,u=new Array(s);s>r;r++)u[r]=o[r].fn;return u},r.prototype.emit=function(t,e,n,o,r,s){var u=i?i+t:t;if(!this._events||!this._events[u])return!1;var a,c,l=this._events[u],f=arguments.length;if("function"==typeof l.fn){switch(l.once&&this.removeListener(t,l.fn,void 0,!0),f){case 1:return l.fn.call(l.context),!0;case 2:return l.fn.call(l.context,e),!0;case 3:return l.fn.call(l.context,e,n),!0;case 4:return l.fn.call(l.context,e,n,o),!0;case 5:return l.fn.call(l.context,e,n,o,r),!0;case 6:return l.fn.call(l.context,e,n,o,r,s),!0}for(c=1,a=new Array(f-1);f>c;c++)a[c-1]=arguments[c];l.fn.apply(l.context,a)}else{var p,h=l.length;for(c=0;h>c;c++)switch(l[c].once&&this.removeListener(t,l[c].fn,void 0,!0),f){case 1:l[c].fn.call(l[c].context);break;case 2:l[c].fn.call(l[c].context,e);break;case 3:l[c].fn.call(l[c].context,e,n);break;default:if(!a)for(p=1,a=new Array(f-1);f>p;p++)a[p-1]=arguments[p];l[c].fn.apply(l[c].context,a)}}return!0},r.prototype.on=function(t,e,n){var r=new o(e,n||this),s=i?i+t:t;return this._events||(this._events=i?{}:Object.create(null)),this._events[s]?this._events[s].fn?this._events[s]=[this._events[s],r]:this._events[s].push(r):this._events[s]=r,this},r.prototype.once=function(t,e,n){var r=new o(e,n||this,!0),s=i?i+t:t;return this._events||(this._events=i?{}:Object.create(null)),this._events[s]?this._events[s].fn?this._events[s]=[this._events[s],r]:this._events[s].push(r):this._events[s]=r,this},r.prototype.removeListener=function(t,e,n,o){var r=i?i+t:t;if(!this._events||!this._events[r])return this;var s=this._events[r],u=[];if(e)if(s.fn)(s.fn!==e||o&&!s.once||n&&s.context!==n)&&u.push(s);else for(var a=0,c=s.length;c>a;a++)(s[a].fn!==e||o&&!s[a].once||n&&s[a].context!==n)&&u.push(s[a]);return u.length?this._events[r]=1===u.length?u[0]:u:delete this._events[r],this},r.prototype.removeAllListeners=function(t){return this._events?(t?delete this._events[i?i+t:t]:this._events=i?{}:Object.create(null),this):this},r.prototype.off=r.prototype.removeListener,r.prototype.addListener=r.prototype.on,r.prototype.setMaxListeners=function(){return this},r.prefixed=i, +t.exports=r},function(t,e,n){function o(t,e,n){for(var o=-1,r=s(e),i=r.length;++o2?n[s-2]:void 0,a=s>2?n[2]:void 0,c=s>1?n[s-1]:void 0;for("function"==typeof u?(u=r(u,c,5),s-=2):(u="function"==typeof c?c:void 0,s-=u?1:0),a&&i(n[0],n[1],a)&&(u=3>s?void 0:u,s=1);++o-1&&t%1==0&&e>t}function i(t,e,n){if(!u(n))return!1;var i=typeof e;if("number"==i?o(n)&&r(e,n.length):"string"==i&&e in n){var s=n[e];return t===t?t===s:s!==s}return!1}function s(t){return"number"==typeof t&&t>-1&&t%1==0&&c>=t}function u(t){var e=typeof t;return!!t&&("object"==e||"function"==e)}var a=/^\d+$/,c=9007199254740991,l=n("length");t.exports=i},function(t,e){(function(e){function n(t){return"function"==typeof t||!1}function o(t){return"string"==typeof t?t:null==t?"":t+""}function r(t){return!!t&&"object"==typeof t}function i(t,e){var n=null==t?void 0:t[e];return s(n)?n:void 0}function s(t){return null==t?!1:_.call(t)==a?v.test(h.call(t)):r(t)&&f.test(t)}function u(t){return t=o(t),t&&l.test(t)?t.replace(c,"\\$&"):t}var a="[object Function]",c=/[.*+?^${}()|[\]\/\\]/g,l=RegExp(c.source),f=/^\[object .+?Constructor\]$/,p=Object.prototype,h=Function.prototype.toString,d=p.hasOwnProperty,_=p.toString,v=RegExp("^"+u(h.call(d)).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,"$1.*?")+"$"),g=i(e,"Uint8Array"),y=n(/x/)||g&&!n(g)?function(t){return _.call(t)==a}:n;t.exports=y}).call(e,function(){return this}())},function(t,e){function n(t){return!!t&&"object"==typeof t}function o(t){return"number"==typeof t||n(t)&&s.call(t)==r}var r="[object Number]",i=Object.prototype,s=i.toString;t.exports=o},function(t,e,n){function o(t){return!!t&&"object"==typeof t}function r(t,e){return s(t,e,a)}function i(t){var e;if(!o(t)||p.call(t)!=c||!f.call(t,"constructor")&&(e=t.constructor,"function"==typeof e&&!(e instanceof e)))return!1;var n;return r(t,function(t,e){n=e}),void 0===n||f.call(t,n)}var s=n(7),u=n(9),a=n(11),c="[object Object]",l=Object.prototype,f=l.hasOwnProperty,p=l.toString,h=u(Object,"getPrototypeOf"),d=h?function(t){if(!t||p.call(t)!=c)return!1;var e=u(t,"valueOf"),n=e&&(n=h(e))&&h(n);return n?t==n||h(t)==n:i(t)}:i;t.exports=d},function(t,e,n){var o=n(34),r=n(8),i=n(35),s=n(36),u=n(12),a=u(function(t,e){return null==t?{}:"function"==typeof e[0]?s(t,r(e[0],e[1],3)):i(t,o(e))});t.exports=a},function(t,e,n){function o(t){return!!t&&"object"==typeof t}function r(t,e,n){for(var i=-1,u=t.length,l=-1,f=[];++i-1&&t%1==0&&l>=t}var a=n(2),c=n(3),l=9007199254740991,f=i("length");t.exports=r},function(t,e){function n(t,e){t=o(t);for(var n=-1,r=e.length,i={};++nn;++n)if(!e(t[n]))return a;return 1}function e(e,n){t(e,function(t){return!n(t)})}function n(i,s,u){function a(t){return t.call?t():p[t]}function l(){if(!--y){p[g]=1,v&&v();for(var n in d)t(n.split("|"),a)&&!e(d[n],a)&&(d[n]=[])}}i=i[c]?i:[i];var f=s&&s.call,v=f?s:u,g=f?i.join(""):s,y=i.length;return setTimeout(function(){e(i,function t(e,n){return null===e?l():(e=n||-1!==e.indexOf(".js")||/^https?:\/\//.test(e)||!r?e:r+e+".js",_[e]?(g&&(h[g]=1),2==_[e]?l():setTimeout(function(){t(e,!0)},0)):(_[e]=1,g&&(h[g]=1),void o(e,l)))})},0),n}function o(t,e){var n,o=s.createElement("script");o.onload=o.onerror=o[f]=function(){o[l]&&!/^c|loade/.test(o[l])||n||(o.onload=o[f]=null,n=1,_[t]=2,e())},o.async=1,o.src=i?t+(-1===t.indexOf("?")?"?":"&")+i:t,u.insertBefore(o,u.lastChild)}var r,i,s=document,u=s.getElementsByTagName("head")[0],a=!1,c="push",l="readyState",f="onreadystatechange",p={},h={},d={},_={};return n.get=o,n.order=function(t,e,o){!function r(i){i=t.shift(),t.length?n(i,r):n(i,e,o)}()},n.path=function(t){r=t},n.urlArgs=function(t){i=t},n.ready=function(o,r,i){o=o[c]?o:[o];var s=[];return!e(o,function(t){p[t]||s[c](t)})&&t(o,function(t){return p[t]})?r():!function(t){d[t]=d[t]||[],d[t][c](r),i&&i(s)}(o.join("|")),n},n.done=function(t){n([null],t)},n})}])}); \ No newline at end of file diff --git a/package.json b/package.json index c359752..aebf48a 100644 --- a/package.json +++ b/package.json @@ -1,13 +1,13 @@ { "name": "google-map-react", - "version": "0.3.3", + "version": "0.4.0", "description": "isomorphic google map react component, allows render react components on the google map", - "main": "modules/index.js", + "main": "lib/index", "scripts": { "build": "./scripts/build.sh", "prepublish": "npm run build", "eyetest": "babel-node ./src/__tests__/eye_test.js", - "es5eyetest": "node ./modules/__tests__/eye_test.js" + "es5eyetest": "node ./lib/__tests__/eye_test.js" }, "repository": { "type": "git", @@ -47,6 +47,9 @@ }, "devDependencies": { "babel": "^5.5.6", - "react": "^0.13.3" + "babel-core": "^5.6.15", + "babel-loader": "^5.2.2", + "react": "^0.13.3", + "webpack": "^1.10.0" } } diff --git a/scripts/build.sh b/scripts/build.sh index 7d32a89..9f28592 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,3 +1,13 @@ #!/bin/sh -rm -rf modules -./node_modules/.bin/babel src --out-dir modules +babel=node_modules/.bin/babel +webpack=node_modules/.bin/webpack +build_dir=lib + +rm -rf $build_dir + +$babel ./src -d $build_dir --ignore "__tests__" --loose all + +NODE_ENV=production $webpack src/index.js $build_dir/umd/GoogleMapReact.js +NODE_ENV=production $webpack -p src/index.js $build_dir/umd/GoogleMapReact.min.js + +echo "gzipped, the global build is `gzip -c $build_dir/umd/GoogleMapReact.min.js | wc -c | sed -e 's/^[[:space:]]*//'` bytes" diff --git a/src/index.js b/src/index.js index 1e79cb8..83a4cb6 100644 --- a/src/index.js +++ b/src/index.js @@ -1 +1 @@ -export * from './google_map.js'; +export default from './google_map.js'; diff --git a/webpack.config.js b/webpack.config.js new file mode 100644 index 0000000..4dae701 --- /dev/null +++ b/webpack.config.js @@ -0,0 +1,38 @@ +var webpack = require('webpack'); + +module.exports = { + + output: { + library: 'GoogleMapReact', + libraryTarget: 'umd' + }, + + externals: [ + { + "react": { + root: "React", + commonjs2: "react", + commonjs: "react", + amd: "react" + } + } + ], + + module: { + loaders: [ + { test: /\.js$/, exclude: /node_modules/, loader: 'babel?loose=all' } + ] + }, + + node: { + Buffer: false + }, + + plugins: [ + new webpack.optimize.OccurenceOrderPlugin(), + new webpack.DefinePlugin({ + 'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV) + }) + ] + +};