(window["webpackJsonpLIS"] = window["webpackJsonpLIS"] || []).push([["vendors~toubiz-poi-results-list-controller"],{

/***/ "./node_modules/@newland/assets-neos/Scripts/toubiz-poi/results-list-controller.js":
/*!*****************************************************************************************!*\
  !*** ./node_modules/@newland/assets-neos/Scripts/toubiz-poi/results-list-controller.js ***!
  \*****************************************************************************************/
/*! exports provided: default */
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, \"default\", function() { return ToubizPoiResultsListController; });\n/* harmony import */ var _common_results_list_controller_class__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../common/results-list-controller.class */ \"./node_modules/@newland/assets-neos/Scripts/common/results-list-controller.class.js\");\n/* harmony import */ var _common_selector_utilities__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../common/selector-utilities */ \"./node_modules/@newland/assets-neos/Scripts/common/selector-utilities.js\");\n/* harmony import */ var _toubiz_map_data_marker__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../toubiz-map/data/marker */ \"./node_modules/@newland/assets-neos/Scripts/toubiz-map/data/marker.js\");\n/* harmony import */ var _nimius_dom_utility__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @nimius/dom-utility */ \"./node_modules/@newland/assets-neos/node_modules/@nimius/dom-utility/index.js\");\n/* harmony import */ var _toubiz_map_map_map_factory__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../toubiz-map/map/map-factory */ \"./node_modules/@newland/assets-neos/Scripts/toubiz-map/map/map-factory.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 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 _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 _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\nvar ATTRIBUTE = Object.freeze({\n  SPLITSCREEN_ACTIVE_CLASS: 'data-toubiz-results.splitscreen.active-classes',\n  SPLITSCREEN_INACTIVE_CLASS: 'data-toubiz-results.splitscreen.inactive-classes',\n  SPLITSCREEN_TOGGLE: 'data-toubiz-results.splitscreen.toggle-input',\n  SPLITSCREEN_MARKER: 'data-toubiz-results.splitscreen.marker',\n  SPLITSCREEN_MAP_CONTAINER: 'data-toubiz-results.splitscreen.map-container',\n  SPLITSCREEN_SCROLL_CONTAINER: 'data-toubiz-results.splitscreen.scroll-container'\n});\n/**\n * Controls pagination and list rendering on toubiz poi results view.\n */\n\nvar ToubizPoiResultsListController = /*#__PURE__*/function (_ResultsListControlle) {\n  _inherits(ToubizPoiResultsListController, _ResultsListControlle);\n\n  var _super = _createSuper(ToubizPoiResultsListController);\n\n  function ToubizPoiResultsListController() {\n    _classCallCheck(this, ToubizPoiResultsListController);\n\n    return _super.apply(this, arguments);\n  }\n\n  _createClass(ToubizPoiResultsListController, [{\n    key: \"onInitialize\",\n    value: function onInitialize() {\n      var _this = this;\n\n      /** @private {boolean} */\n      this.splitScreen = false;\n      /** @private {Marker[]} */\n\n      this.mapMarkers = [];\n      /** @private {AbstractMapWithMarkers} */\n\n      this.map = null;\n      /** @private {number} */\n\n      this.lastSplitScreenToggle = window.performance.now();\n\n      var _iterator = _createForOfIteratorHelper(document.querySelectorAll(Object(_common_selector_utilities__WEBPACK_IMPORTED_MODULE_1__[\"attributeSelector\"])(ATTRIBUTE.SPLITSCREEN_TOGGLE))),\n          _step;\n\n      try {\n        for (_iterator.s(); !(_step = _iterator.n()).done;) {\n          var input = _step.value;\n          // Set to false initially because in firefox it stays checked after reload\n          input.checked = false;\n          input.addEventListener('change', function (event) {\n            var enableSplitScreen = event.target.checked || false;\n\n            _this.toggleSplitScreen(enableSplitScreen);\n          });\n        }\n      } catch (err) {\n        _iterator.e(err);\n      } finally {\n        _iterator.f();\n      }\n\n      this.toggleSplitScreen(false);\n    }\n  }, {\n    key: \"onReinitialize\",\n    value: function () {\n      var _onReinitialize = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee() {\n        var _this2 = this;\n\n        var _iterator2, _step2, _loop;\n\n        return regeneratorRuntime.wrap(function _callee$(_context) {\n          while (1) {\n            switch (_context.prev = _context.next) {\n              case 0:\n                this.mapMarkers = [];\n                _iterator2 = _createForOfIteratorHelper(this.container.querySelectorAll(Object(_common_selector_utilities__WEBPACK_IMPORTED_MODULE_1__[\"attributeSelector\"])(ATTRIBUTE.SPLITSCREEN_MARKER)));\n\n                try {\n                  _loop = function _loop() {\n                    var coord = _step2.value;\n                    var data = Object(_nimius_dom_utility__WEBPACK_IMPORTED_MODULE_3__[\"extractPrefixedAttributesFromElement\"])(coord, \"\".concat(ATTRIBUTE.SPLITSCREEN_MARKER, \".\"));\n                    var marker = new _toubiz_map_data_marker__WEBPACK_IMPORTED_MODULE_2__[\"Marker\"]();\n                    marker.coordinates = {\n                      latitude: parseFloat(data.latitude),\n                      longitude: parseFloat(data.longitude)\n                    };\n                    marker.style = {\n                      iconUrl: data.iconUrl,\n                      height: 50,\n                      width: 35,\n                      offsetX: 25,\n                      offsetY: 35,\n                      iconSize: 19\n                    };\n                    marker.style.iconUrl = data.iconUrl;\n\n                    marker.contentRenderer = function () {\n                      return coord.innerHTML;\n                    };\n\n                    if (data.tour) {\n                      marker.tour = {\n                        polygon: data.tour\n                      };\n                    }\n\n                    _this2.mapMarkers.push(marker);\n                  };\n\n                  for (_iterator2.s(); !(_step2 = _iterator2.n()).done;) {\n                    _loop();\n                  }\n                } catch (err) {\n                  _iterator2.e(err);\n                } finally {\n                  _iterator2.f();\n                }\n\n                if (!this.map) {\n                  _context.next = 8;\n                  break;\n                }\n\n                _context.next = 6;\n                return this.map.render(this.mapMarkers);\n\n              case 6:\n                _context.next = 8;\n                return this.map.centerMapOnMarkers(this.mapMarkers);\n\n              case 8:\n              case \"end\":\n                return _context.stop();\n            }\n          }\n        }, _callee, this);\n      }));\n\n      function onReinitialize() {\n        return _onReinitialize.apply(this, arguments);\n      }\n\n      return onReinitialize;\n    }()\n  }, {\n    key: \"onReload\",\n    value: function () {\n      var _onReload = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee2() {\n        var container;\n        return regeneratorRuntime.wrap(function _callee2$(_context2) {\n          while (1) {\n            switch (_context2.prev = _context2.next) {\n              case 0:\n                this.mapMarkers = [];\n\n                if (!this.map) {\n                  _context2.next = 6;\n                  break;\n                }\n\n                _context2.next = 4;\n                return this.map.render(this.mapMarkers);\n\n              case 4:\n                if (this.map.closeInfoWindow) {\n                  this.map.closeInfoWindow();\n                }\n\n                if (this.map.clearTours) {\n                  this.map.clearTours();\n                }\n\n              case 6:\n                container = document.querySelector(Object(_common_selector_utilities__WEBPACK_IMPORTED_MODULE_1__[\"attributeSelector\"])(ATTRIBUTE.SPLITSCREEN_SCROLL_CONTAINER));\n\n                if (container) {\n                  container.scrollTo({\n                    top: 0,\n                    behavior: 'smooth'\n                  });\n                }\n\n              case 8:\n              case \"end\":\n                return _context2.stop();\n            }\n          }\n        }, _callee2, this);\n      }));\n\n      function onReload() {\n        return _onReload.apply(this, arguments);\n      }\n\n      return onReload;\n    }()\n  }, {\n    key: \"formReloadOptions\",\n    value: function formReloadOptions(form) {\n      var _this3 = this;\n\n      var options = _get(_getPrototypeOf(ToubizPoiResultsListController.prototype), \"formReloadOptions\", this).call(this, form);\n\n      var formDataTransform = options.formDataTransform;\n\n      options.formDataTransform = function (data) {\n        data.append('layout', _this3.splitScreen ? 'list' : 'teaser');\n\n        if (formDataTransform) {\n          data = formDataTransform(data);\n        }\n\n        return data;\n      };\n\n      return options;\n    }\n  }, {\n    key: \"toggleSplitScreen\",\n    value: function () {\n      var _toggleSplitScreen = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee3() {\n        var status,\n            before,\n            _args3 = arguments;\n        return regeneratorRuntime.wrap(function _callee3$(_context3) {\n          while (1) {\n            switch (_context3.prev = _context3.next) {\n              case 0:\n                status = _args3.length > 0 && _args3[0] !== undefined ? _args3[0] : null;\n                before = this.splitScreen;\n\n                if (status === null) {\n                  status = !this.splitScreen;\n                }\n\n                this.splitScreen = status;\n\n                if (!this.splitScreen) {\n                  _context3.next = 14;\n                  break;\n                }\n\n                this.addClassesToAllChildren(ATTRIBUTE.SPLITSCREEN_ACTIVE_CLASS);\n                this.removeClassesFromAllChildren(ATTRIBUTE.SPLITSCREEN_INACTIVE_CLASS);\n                document.querySelector('html').classList.add('has-overlay');\n\n                if (this.map) {\n                  _context3.next = 12;\n                  break;\n                }\n\n                _context3.next = 11;\n                return this.initializeMap();\n\n              case 11:\n                this.map = _context3.sent;\n\n              case 12:\n                _context3.next = 17;\n                break;\n\n              case 14:\n                this.addClassesToAllChildren(ATTRIBUTE.SPLITSCREEN_INACTIVE_CLASS);\n                this.removeClassesFromAllChildren(ATTRIBUTE.SPLITSCREEN_ACTIVE_CLASS);\n                document.querySelector('html').classList.remove('has-overlay');\n\n              case 17:\n                if (before !== this.splitScreen) {\n                  this.lastSplitScreenToggle = window.performance.now();\n                  this.formReload.reload();\n                }\n\n              case 18:\n              case \"end\":\n                return _context3.stop();\n            }\n          }\n        }, _callee3, this);\n      }));\n\n      function toggleSplitScreen() {\n        return _toggleSplitScreen.apply(this, arguments);\n      }\n\n      return toggleSplitScreen;\n    }()\n  }, {\n    key: \"shouldPaginationBeResetBeforeLoadingContent\",\n    value: function shouldPaginationBeResetBeforeLoadingContent(lastKnownPage, currentPage) {\n      if (window.performance.now() - this.lastSplitScreenToggle < 1000) {\n        return false;\n      }\n\n      return _get(_getPrototypeOf(ToubizPoiResultsListController.prototype), \"shouldPaginationBeResetBeforeLoadingContent\", this).call(this, lastKnownPage, currentPage);\n    }\n  }, {\n    key: \"initializeMap\",\n    value: function () {\n      var _initializeMap2 = _asyncToGenerator( /*#__PURE__*/regeneratorRuntime.mark(function _callee4() {\n        var mapContainer, mapConfig, map;\n        return regeneratorRuntime.wrap(function _callee4$(_context4) {\n          while (1) {\n            switch (_context4.prev = _context4.next) {\n              case 0:\n                mapContainer = document.querySelector(Object(_common_selector_utilities__WEBPACK_IMPORTED_MODULE_1__[\"attributeSelector\"])(ATTRIBUTE.SPLITSCREEN_MAP_CONTAINER));\n                mapConfig = Object(_nimius_dom_utility__WEBPACK_IMPORTED_MODULE_3__[\"extractPrefixedAttributesFromElement\"])(mapContainer, 'data-toubiz-results.splitscreen.');\n                mapConfig.mapType = mapConfig.mapType || 'osm';\n                mapConfig.map = mapConfig.map || {};\n                mapConfig.map.center = mapConfig.map.center || {\n                  latitude: 0,\n                  longitude: 0\n                };\n                mapConfig.map.zoom = mapConfig.map.zoom || 60;\n                mapConfig.map.clustering = mapConfig.map.clustering || {};\n                mapConfig.map.clustering.color = mapConfig.map.clustering.color || 'white';\n                mapConfig.map.clustering.backgroundColor = mapConfig.map.clustering.backgroundColor || 'tomato';\n                _context4.next = 11;\n                return Object(_toubiz_map_map_map_factory__WEBPACK_IMPORTED_MODULE_4__[\"initializeMap\"])(mapConfig.mapType, mapContainer, mapConfig.map);\n\n              case 11:\n                map = _context4.sent;\n                Object(_toubiz_map_map_map_factory__WEBPACK_IMPORTED_MODULE_4__[\"setupAutomaticClickHandling\"])(map);\n                return _context4.abrupt(\"return\", map);\n\n              case 14:\n              case \"end\":\n                return _context4.stop();\n            }\n          }\n        }, _callee4);\n      }));\n\n      function initializeMap() {\n        return _initializeMap2.apply(this, arguments);\n      }\n\n      return initializeMap;\n    }()\n  }, {\n    key: \"addClassesToAllChildren\",\n    value: function addClassesToAllChildren(attributeName) {\n      var _iterator3 = _createForOfIteratorHelper(document.querySelectorAll(Object(_common_selector_utilities__WEBPACK_IMPORTED_MODULE_1__[\"attributeSelector\"])(attributeName))),\n          _step3;\n\n      try {\n        var _loop2 = function _loop2() {\n          var child = _step3.value;\n          child.getAttribute(attributeName).split(' ').forEach(function (clss) {\n            return child.classList.add(clss);\n          });\n        };\n\n        for (_iterator3.s(); !(_step3 = _iterator3.n()).done;) {\n          _loop2();\n        }\n      } catch (err) {\n        _iterator3.e(err);\n      } finally {\n        _iterator3.f();\n      }\n    }\n  }, {\n    key: \"removeClassesFromAllChildren\",\n    value: function removeClassesFromAllChildren(attributeName) {\n      var _iterator4 = _createForOfIteratorHelper(document.querySelectorAll(Object(_common_selector_utilities__WEBPACK_IMPORTED_MODULE_1__[\"attributeSelector\"])(attributeName))),\n          _step4;\n\n      try {\n        var _loop3 = function _loop3() {\n          var child = _step4.value;\n          child.getAttribute(attributeName).split(' ').forEach(function (clss) {\n            return child.classList.remove(clss);\n          });\n        };\n\n        for (_iterator4.s(); !(_step4 = _iterator4.n()).done;) {\n          _loop3();\n        }\n      } catch (err) {\n        _iterator4.e(err);\n      } finally {\n        _iterator4.f();\n      }\n    }\n  }]);\n\n  return ToubizPoiResultsListController;\n}(_common_results_list_controller_class__WEBPACK_IMPORTED_MODULE_0__[\"ResultsListController\"]);\n\n\n\n//# sourceURL=webpack://LIS/./node_modules/@newland/assets-neos/Scripts/toubiz-poi/results-list-controller.js?");

/***/ })

}]);