(window["webpackJsonpLIS"] = window["webpackJsonpLIS"] || []).push([[5],{

/***/ "./Packages/Plugins/Newland.AssetsNeos/Scripts/toubiz-map/map/maptoolkit/map-toolkit.js":
/*!**********************************************************************************************!*\
  !*** ./Packages/Plugins/Newland.AssetsNeos/Scripts/toubiz-map/map/maptoolkit/map-toolkit.js ***!
  \**********************************************************************************************/
/*! exports provided: MapToolkit */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"MapToolkit\", function() { return MapToolkit; });\n/* harmony import */ var _leaflet_leaflet__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../leaflet/leaflet */ \"./Packages/Plugins/Newland.AssetsNeos/Scripts/toubiz-map/map/leaflet/leaflet.js\");\n/* harmony import */ var _common_string_utilities__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../../common/string-utilities */ \"./Packages/Plugins/Newland.AssetsNeos/Scripts/common/string-utilities.js\");\n/* harmony import */ var _utilities__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../utilities */ \"./Packages/Plugins/Newland.AssetsNeos/Scripts/toubiz-map/utilities.js\");\nfunction _typeof(obj) { \"@babel/helpers - typeof\"; if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nfunction _createForOfIteratorHelper(o, allowArrayLike) { var it; if (typeof Symbol === \"undefined\" || o[Symbol.iterator] == null) { if (Array.isArray(o) || (it = _unsupportedIterableToArray(o)) || allowArrayLike && o && typeof o.length === \"number\") { if (it) o = it; var i = 0; var F = function F() {}; return { s: F, n: function n() { if (i >= o.length) return { done: true }; return { done: false, value: o[i++] }; }, e: function e(_e) { throw _e; }, f: F }; } throw new TypeError(\"Invalid attempt to iterate non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); } var normalCompletion = true, didErr = false, err; return { s: function s() { it = o[Symbol.iterator](); }, n: function n() { var step = it.next(); normalCompletion = step.done; return step; }, e: function e(_e2) { didErr = true; err = _e2; }, f: function f() { try { if (!normalCompletion && it.return != null) it.return(); } finally { if (didErr) throw err; } } }; }\n\nfunction _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === \"string\") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === \"Object\" && o.constructor) n = o.constructor.name; if (n === \"Map\" || n === \"Set\") return Array.from(o); if (n === \"Arguments\" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }\n\nfunction _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }\n\nfunction asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) { try { var info = gen[key](arg); var value = info.value; } catch (error) { reject(error); return; } if (info.done) { resolve(value); } else { Promise.resolve(value).then(_next, _throw); } }\n\nfunction _asyncToGenerator(fn) { return function () { var self = this, args = arguments; return new Promise(function (resolve, reject) { var gen = fn.apply(self, args); function _next(value) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"next\", value); } function _throw(err) { asyncGeneratorStep(gen, resolve, reject, _next, _throw, \"throw\", err); } _next(undefined); }); }; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _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); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nfunction _get(target, property, receiver) { if (typeof Reflect !== \"undefined\" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); }\n\nfunction _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; }\n\nfunction _inherits(subClass, superClass) { if (typeof superClass !== \"function\" && superClass !== null) { throw new TypeError(\"Super expression must either be null or a function\"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); }\n\nfunction _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); }\n\nfunction _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; }\n\nfunction _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === \"object\" || typeof call === \"function\")) { return call; } return _assertThisInitialized(self); }\n\nfunction _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); } return self; }\n\nfunction _isNativeReflectConstruct() { if (typeof Reflect === \"undefined\" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === \"function\") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } }\n\nfunction _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); }\n\n\n\n\n/**\n * Map toolkit implementation.\n * As map toolkit is just a wrapper around leaflet with some custom default values preset\n * this implementation just extends the Leaflet implementation and swaps out the map\n * initialization with the one provided by MTK.\n */\n\nvar MapToolkit = /*#__PURE__*/function (_Leaflet) {\n  _inherits(MapToolkit, _Leaflet);\n\n  var _super = _createSuper(MapToolkit);\n\n  function MapToolkit() {\n    _classCallCheck(this, MapToolkit);\n\n    return _super.apply(this, arguments);\n  }\n\n  _createClass(MapToolkit, [{\n    key: \"initializeMap\",\n\n    /**\n     * @returns {Promise}\n     * @protected\n     */\n    value: function () {\n      var _initializeMap = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {\n        var _this = this;\n\n        return regeneratorRuntime.wrap(function _callee$(_context) {\n          while (1) {\n            switch (_context.prev = _context.next) {\n              case 0:\n                _context.next = 2;\n                return Object(_utilities__WEBPACK_IMPORTED_MODULE_2__[\"loadMapToolkit\"])(this.options.toursprungApiKey, this.options.googleMapsApiKey);\n\n              case 2:\n                this.MTK = _context.sent;\n                this.L = window.L;\n                return _context.abrupt(\"return\", new Promise(function (resolve) {\n                  _this.MTK.createMap(_this.node, _this.mapToolkitConfiguration(), function (map) {\n                    _this.L.control.scale().addTo(map.leaflet);\n\n                    resolve(map.leaflet);\n                  });\n                }));\n\n              case 5:\n              case \"end\":\n                return _context.stop();\n            }\n          }\n        }, _callee, this);\n      }));\n\n      function initializeMap() {\n        return _initializeMap.apply(this, arguments);\n      }\n\n      return initializeMap;\n    }()\n    /**\n     * @private\n     * @returns {object}\n     */\n\n  }, {\n    key: \"mapToolkitConfiguration\",\n    value: function mapToolkitConfiguration() {\n      var center = this.coordinatesToLatLng(this.options.center);\n      center.lat = center.lat || 47.980870;\n      center.lng = center.lng || 7.820810;\n      var config = {\n        leaflet: {\n          zoomControl: false\n        },\n        map: {\n          minZoom: 0,\n          maxZoom: 18,\n          location: {\n            center: center,\n            zoom: this.options.zoom * 18 / 100\n          },\n          mapType: this.options.toursprungMapStyle[0].identifier,\n          mapTypes: {},\n          controls: []\n        }\n      };\n\n      var _iterator = _createForOfIteratorHelper(this.options.toursprungMapStyle),\n          _step;\n\n      try {\n        for (_iterator.s(); !(_step = _iterator.n()).done;) {\n          var style = _step.value;\n          config.map.mapTypes[style.identifier] = style.identifier;\n        }\n      } catch (err) {\n        _iterator.e(err);\n      } finally {\n        _iterator.f();\n      }\n\n      if (this.options.toursprungMapStyle.length > 1) {\n        config.map.controls.push(this.MTK.Control.MapTypes);\n      }\n\n      return config;\n    }\n  }, {\n    key: \"prepareOptions\",\n    value: function prepareOptions(options) {\n      options = _get(_getPrototypeOf(MapToolkit.prototype), \"prepareOptions\", this).call(this, options);\n      options.toursprungMapStyle = options.toursprungMapStyle || [{\n        identifier: 'terrain_v2'\n      }];\n\n      if (!options.toursprungApiKey) {\n        console.warn(Object(_common_string_utilities__WEBPACK_IMPORTED_MODULE_1__[\"stripMultilineIndention\"])(\"\\n                ## Toubiz Map Configuration Warning\\n                Using toursprung map without API key. Please provide a valid API key.\\n            \"));\n        options.toursprungApiKey = 'sandbox';\n      }\n\n      return options;\n    }\n  }]);\n\n  return MapToolkit;\n}(_leaflet_leaflet__WEBPACK_IMPORTED_MODULE_0__[\"Leaflet\"]);\n\n//# sourceURL=webpack://LIS/./Packages/Plugins/Newland.AssetsNeos/Scripts/toubiz-map/map/maptoolkit/map-toolkit.js?");

/***/ })

}]);