waygo-maps 1.1.49 → 1.1.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.js +40 -18
- package/dist/style.css +34 -0
- package/package.json +1 -1
package/dist/bundle.js
CHANGED
|
@@ -570,7 +570,7 @@ eval("// Currently in sync with Node.js lib/internal/util/comparisons.js\n// htt
|
|
|
570
570
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
571
571
|
|
|
572
572
|
"use strict";
|
|
573
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _components_SliderBar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/SliderBar */ \"./src/components/SliderBar.js\");\n/* harmony import */ var _core_Control__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Control */ \"./src/core/Control.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prototype : t), e, r); return 2 & o ? function (t) { return p.apply(r, t); } : p; }\nfunction _get() { return _get = \"undefined\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }\nfunction _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\nvar CategoryBarControl = /*#__PURE__*/function (_Control) {\n function CategoryBarControl() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, CategoryBarControl);\n _this = _callSuper(this, CategoryBarControl, [options]);\n _this.categoryBarContainerName = 'category-bar';\n _this.categoryBar = new _components_SliderBar__WEBPACK_IMPORTED_MODULE_0__[\"default\"]([], {\n container: 'category-bar'\n });\n _this.map = null;\n return _this;\n }\n _inherits(CategoryBarControl, _Control);\n return _createClass(CategoryBarControl, [{\n key: \"onAdd\",\n value: function onAdd(map) {\n this.map = map;\n this.container = document.createElement('div');\n this.container.className = 'category-bar-control-container';\n var element = this.categoryBar.getElement();\n this.container.appendChild(element);\n this.initializeEventListeners();\n this._attachResizeListener();\n this._initialize();\n this.show();\n return this.container;\n }\n }, {\n key: \"onRemove\",\n value: function onRemove() {\n _superPropGet(CategoryBarControl, \"onRemove\", this, 3)([]);\n }\n }, {\n key: \"initializeEventListeners\",\n value: function initializeEventListeners() {\n this.categoryBar.on(\"\".concat(this.categoryBarContainerName, \":selectNew\"), this._handleNewCategoryButtonSelect.bind(this));\n this.categoryBar.on(\"\".concat(this.categoryBarContainerName, \":deselect\"), this._handleCategoryButtonDeselect.bind(this));\n this.map.on('state:default', this._handleDefaultState.bind(this));\n this.map.on('state:search', this._handleSearchState.bind(this));\n this.map.on('state:selectedContent', this._handleSelectedContentState.bind(this));\n this.map.on('state:directions', this._handleDirectionsState.bind(this));\n this.map.on('state:setup', this._handleSetupState.bind(this));\n this.map.on('load', this._handleMapLoad.bind(this));\n }\n }, {\n key: \"_handleMapLoad\",\n value: function _handleMapLoad(data) {\n var mapData = data.mapData;\n var suggestedSearchTerms = mapData.suggested_search_terms;\n if (suggestedSearchTerms) {\n this.categoryBar.updateItems(suggestedSearchTerms);\n }\n }\n }, {\n key: \"_renderDesktopView\",\n value: function _renderDesktopView() {\n // TO RENDER DESKTOP VIEW\n var element = this.categoryBar.getElement();\n this.container.appendChild(element);\n this.container.classList.remove('mobile-view');\n this.container.classList.add('desktop-view');\n var newWidth = this.map.mapContainer.offsetWidth;\n this.categoryBar.setViewForDesktop();\n }\n }, {\n key: \"_renderMobileView\",\n value: function _renderMobileView() {\n var element = this.categoryBar.getElement();\n this.container.appendChild(element);\n var newWidth = this.map.mapContainer.offsetWidth;\n this.container.classList.remove('desktop-view');\n this.container.classList.add('mobile-view');\n this.categoryBar.setViewForMobile();\n }\n }, {\n key: \"_handleDefaultState\",\n value: function _handleDefaultState() {\n this.show();\n this.categoryBar.refresh();\n this.categoryBar.deselectAll();\n }\n }, {\n key: \"_handleSelectedContentState\",\n value: function _handleSelectedContentState(_) {\n this.hide();\n }\n }, {\n key: \"_handleDirectionsState\",\n value: function _handleDirectionsState(_) {\n this.hide();\n }\n }, {\n key: \"_handleNewCategoryButtonSelect\",\n value: function _handleNewCategoryButtonSelect(data) {\n var query = data.query;\n var floor = this.map.getCurrentFloor();\n
|
|
573
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _components_SliderBar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/SliderBar */ \"./src/components/SliderBar.js\");\n/* harmony import */ var _core_Control__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Control */ \"./src/core/Control.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prototype : t), e, r); return 2 & o ? function (t) { return p.apply(r, t); } : p; }\nfunction _get() { return _get = \"undefined\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }\nfunction _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\nvar CategoryBarControl = /*#__PURE__*/function (_Control) {\n function CategoryBarControl() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, CategoryBarControl);\n _this = _callSuper(this, CategoryBarControl, [options]);\n _this.categoryBarContainerName = 'category-bar';\n _this.categoryBar = new _components_SliderBar__WEBPACK_IMPORTED_MODULE_0__[\"default\"]([], {\n container: 'category-bar'\n });\n _this.map = null;\n return _this;\n }\n _inherits(CategoryBarControl, _Control);\n return _createClass(CategoryBarControl, [{\n key: \"onAdd\",\n value: function onAdd(map) {\n this.map = map;\n this.container = document.createElement('div');\n this.container.className = 'category-bar-control-container';\n var element = this.categoryBar.getElement();\n this.container.appendChild(element);\n this.initializeEventListeners();\n this._attachResizeListener();\n this._initialize();\n this.show();\n return this.container;\n }\n }, {\n key: \"onRemove\",\n value: function onRemove() {\n _superPropGet(CategoryBarControl, \"onRemove\", this, 3)([]);\n }\n }, {\n key: \"initializeEventListeners\",\n value: function initializeEventListeners() {\n this.categoryBar.on(\"\".concat(this.categoryBarContainerName, \":selectNew\"), this._handleNewCategoryButtonSelect.bind(this));\n this.categoryBar.on(\"\".concat(this.categoryBarContainerName, \":deselect\"), this._handleCategoryButtonDeselect.bind(this));\n this.map.on('state:default', this._handleDefaultState.bind(this));\n this.map.on('state:search', this._handleSearchState.bind(this));\n this.map.on('state:selectedContent', this._handleSelectedContentState.bind(this));\n this.map.on('state:directions', this._handleDirectionsState.bind(this));\n this.map.on('state:setup', this._handleSetupState.bind(this));\n this.map.on('load', this._handleMapLoad.bind(this));\n }\n }, {\n key: \"_handleMapLoad\",\n value: function _handleMapLoad(data) {\n var mapData = data.mapData;\n var suggestedSearchTerms = mapData.suggested_search_terms;\n if (suggestedSearchTerms) {\n this.categoryBar.updateItems(suggestedSearchTerms);\n }\n }\n }, {\n key: \"_renderDesktopView\",\n value: function _renderDesktopView() {\n // TO RENDER DESKTOP VIEW\n var element = this.categoryBar.getElement();\n this.container.appendChild(element);\n this.container.classList.remove('mobile-view');\n this.container.classList.add('desktop-view');\n var newWidth = this.map.mapContainer.offsetWidth;\n this.categoryBar.setViewForDesktop();\n }\n }, {\n key: \"_renderMobileView\",\n value: function _renderMobileView() {\n var element = this.categoryBar.getElement();\n this.container.appendChild(element);\n var newWidth = this.map.mapContainer.offsetWidth;\n this.container.classList.remove('desktop-view');\n this.container.classList.add('mobile-view');\n this.categoryBar.setViewForMobile();\n }\n }, {\n key: \"_handleDefaultState\",\n value: function _handleDefaultState() {\n this.show();\n // this.hide();\n this.categoryBar.refresh();\n this.categoryBar.deselectAll();\n }\n }, {\n key: \"_handleSelectedContentState\",\n value: function _handleSelectedContentState(_) {\n this.hide();\n }\n }, {\n key: \"_handleDirectionsState\",\n value: function _handleDirectionsState(_) {\n this.hide();\n }\n }, {\n key: \"_handleNewCategoryButtonSelect\",\n value: function _handleNewCategoryButtonSelect(data) {\n var query = data.query;\n var floor = this.map.getCurrentFloor();\n this.map.setToSearchState(query, 0, 40, floor);\n }\n }, {\n key: \"_handleCategoryButtonDeselect\",\n value: function _handleCategoryButtonDeselect() {\n this.map.setToDefaultState();\n }\n }, {\n key: \"_handleSearchState\",\n value: function _handleSearchState(data) {\n var query = data.query,\n results = data.results;\n this.show();\n this.categoryBar.deselectAllNotMatchingQuery(query);\n }\n }, {\n key: \"_handleSetupState\",\n value: function _handleSetupState() {\n this.hide();\n }\n }]);\n}(_core_Control__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (CategoryBarControl);\n\n//# sourceURL=webpack://waygomaps/./src/Controls/CategoryBarControl.js?");
|
|
574
574
|
|
|
575
575
|
/***/ }),
|
|
576
576
|
|
|
@@ -581,7 +581,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
581
581
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
582
582
|
|
|
583
583
|
"use strict";
|
|
584
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _components_ContentPlacementView_ContentDetails__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/ContentPlacementView/ContentDetails */ \"./src/components/ContentPlacementView/ContentDetails.js\");\n/* harmony import */ var _core_Control__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Control */ \"./src/core/Control.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prototype : t), e, r); return 2 & o ? function (t) { return p.apply(r, t); } : p; }\nfunction _get() { return _get = \"undefined\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }\nfunction _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\nvar ContentPlacementControl = /*#__PURE__*/function (_Control) {\n function ContentPlacementControl() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, ContentPlacementControl);\n _this = _callSuper(this, ContentPlacementControl, [options]);\n _this.map = null;\n _this.contentPlacementIds = [];\n _this.currentContentPlacement = null;\n _this.contentPlacementView = null;\n _this.currentTop = window.innerHeight;\n _this.startingY = 0;\n _this.scrollConfiguration = {\n initialHeight: 0.5,\n // percent of the map container height\n minDistFromBottom: 110 // 185 // in px\n };\n _this.isDragging = false;\n _this.isAtTop = false;\n _this.velocity = 0;\n _this.decelerationFactor = 0.95;\n _this.minVelocity = 0.1;\n return _this;\n }\n _inherits(ContentPlacementControl, _Control);\n return _createClass(ContentPlacementControl, [{\n key: \"onAdd\",\n value: function onAdd(map) {\n this.map = map;\n this.container = document.createElement('div');\n this.container.className = 'content-details-control-container';\n this.initializeEventListeners();\n this._attachResizeListener();\n this._initialize();\n this.hide();\n return this.container;\n }\n }, {\n key: \"onRemove\",\n value: function onRemove() {\n _superPropGet(ContentPlacementControl, \"onRemove\", this, 3)([]);\n }\n }, {\n key: \"initializeEventListeners\",\n value: function initializeEventListeners() {\n this.map.on('state:default', this._handleDefaultState.bind(this));\n this.map.on('state:search', this._handleSearchState.bind(this));\n this.map.on('state:selectedContent', this._handleSelectedContentState.bind(this));\n this.map.on('state:directions', this._handleDirectionsState.bind(this));\n this.map.on('state:setup', this._handleSetupState.bind(this));\n this.map.on('initiate:back', this._handleMapInitiateBack.bind(this));\n this.map.map.on('mousedown', this._handleMapFocus.bind(this));\n this.map.map.on('touchstart', this._handleMapFocus.bind(this));\n this.container.addEventListener('mousedown', function (e) {\n return e.stopPropagation();\n });\n this.container.addEventListener('click', function (e) {\n return e.stopPropagation();\n });\n this.container.addEventListener('dblclick', function (e) {\n return e.stopPropagation();\n });\n // this.container.addEventListener('touchstart', (e) => e.stopPropagation());\n\n this.container.addEventListener('touchstart', this.handleTouchStart.bind(this));\n this.container.addEventListener('touchmove', this.handleTouchMove.bind(this));\n this.container.addEventListener('touchend', this.handleTouchEnd.bind(this));\n this.container.addEventListener('wheel', this.handleWheelScroll.bind(this));\n }\n }, {\n key: \"_handleMapFocus\",\n value: function _handleMapFocus(e) {\n if (this.currentViewType === 'desktop') return;\n var features = this.map.map.queryRenderedFeatures(e.point);\n var symbolFeatures = features.filter(function (feature) {\n return feature.layer.type === 'symbol';\n });\n if (symbolFeatures.length === 0) {\n this.scrollToMin(true);\n }\n }\n }, {\n key: \"handleTouchStart\",\n value: function handleTouchStart(event) {\n event.stopPropagation();\n this.startingY = event.touches[0].clientY;\n this.isDragging = true;\n this.velocity = 0;\n }\n }, {\n key: \"handleScrolling\",\n value: function handleScrolling(scrollAmount) {\n var element = this.contentPlacementView.getElement();\n var elementHeight = element.offsetHeight;\n var rect = this.map.mapContainer.getBoundingClientRect();\n var containerBottom = rect.bottom;\n var newTop = null;\n if (scrollAmount <= 0) {\n newTop = Math.max(containerBottom - elementHeight - rect.top, this.currentTop + scrollAmount);\n } else if (scrollAmount > 0) {\n newTop = Math.min(containerBottom - this.scrollConfiguration.minDistFromBottom - rect.top, this.currentTop + scrollAmount);\n }\n this.scrollTo(newTop);\n }\n }, {\n key: \"handleTouchMove\",\n value: function handleTouchMove(event) {\n if (this.currentViewType === 'desktop') return;\n if (!this.isDragging) return;\n var touchY = event.touches[0].clientY;\n var scrollAmount = -1 * (this.startingY - touchY);\n this.velocity = scrollAmount;\n this.handleScrolling(scrollAmount);\n this.startingY = touchY;\n }\n }, {\n key: \"handleTouchEnd\",\n value: function handleTouchEnd() {\n this.isDragging = false;\n this._applyInertia();\n }\n }, {\n key: \"_applyInertia\",\n value: function _applyInertia() {\n var _this2 = this;\n var rect = this.map.mapContainer.getBoundingClientRect();\n var element = this.contentPlacementView.getElement();\n var elementHeight = element.offsetHeight;\n var containerBottom = rect.bottom;\n var upperLimit = containerBottom - elementHeight - rect.top; // Upper scroll boundary\n var lowerLimit = containerBottom - this.scrollConfiguration.minDistFromBottom - rect.top;\n var initialVelocity = this.velocity;\n var duration = 400; // Duration of inertia in milliseconds (tweak this value)\n var startTime = performance.now(); // Start time of the inertia\n\n var _inertia = function inertia() {\n var currentTime = performance.now();\n var elapsedTime = currentTime - startTime;\n if (elapsedTime >= duration || Math.abs(_this2.velocity) < _this2.minVelocity) {\n _this2.velocity = 0;\n return;\n }\n ; // Stop when velocity is too low\n\n var progress = elapsedTime / duration; // Normalize time to [0, 1]\n var easingFactor = 1 - Math.pow(1 - progress, 2);\n _this2.velocity = initialVelocity * (1 - easingFactor);\n var newTop = _this2.currentTop + _this2.velocity;\n if (newTop <= upperLimit) {\n _this2.scrollTo(upperLimit);\n _this2.velocity = 0; // Stop inertia\n return;\n } else if (newTop >= lowerLimit) {\n _this2.scrollTo(lowerLimit);\n _this2.velocity = 0; // Stop inertia\n return;\n }\n\n // this.velocity *= this.decelerationFactor; // Apply deceleration\n // const easingFactor = Math.max(0.1, 1 - time / 100); // Easing factor decreases over time (clamped at 0.1)\n // this.velocity *= this.decelerationFactor * easingFactor;\n\n _this2.scrollTo(newTop); // Update position\n\n // time++;\n requestAnimationFrame(_inertia);\n };\n _inertia();\n }\n }, {\n key: \"handleWheelScroll\",\n value: function handleWheelScroll(event) {\n if (this.currentViewType === 'desktop') return;\n var scrollAmount = -event.deltaY;\n this.handleScrolling(scrollAmount);\n }\n\n // handleScroll() {\n // if (this.container.classList.contains('mobile-view')) {\n // // Get current scroll position\n // const scrollAmount = this.container.scrollTop;\n\n // // Adjust bottom position based on scroll amount\n // // As the user scrolls up, the container moves up (increase the bottom offset)\n // this.container.style.bottom = `${Math.min(45 + scrollAmount / 10, 100)}%`;\n\n // // If you want the container to reset to the bottom when done scrolling, add this:\n // clearTimeout(this.isScrolling);\n // this.isScrolling = setTimeout(() => {\n // this.container.style.bottom = '0px'; // Reset position when scrolling stops\n // }, 200);\n // }\n // }\n }, {\n key: \"_renderDesktopView\",\n value: function _renderDesktopView() {\n if (!this.contentPlacementView) {\n return;\n }\n var element = this.contentPlacementView.getElement();\n this.container.appendChild(element);\n this.container.classList.remove('mobile-view');\n this.container.classList.add('desktop-view');\n }\n }, {\n key: \"_renderMobileView\",\n value: function _renderMobileView() {\n if (!this.contentPlacementView) {\n return;\n }\n var element = this.contentPlacementView.getElement();\n this.container.appendChild(element);\n this.container.classList.remove('desktop-view');\n this.container.classList.add('mobile-view');\n }\n }, {\n key: \"_handleMapInitiateBack\",\n value: function _handleMapInitiateBack() {\n var currentState = this.map._stateCoordinator.state;\n if (currentState === 'selectedContent') {\n if (this.contentPlacementIds.length === 0) return;else if (this.contentPlacementIds.length === 1) {\n var stateHistory = this.map._stateCoordinator.stateHistory;\n var previousMapState = stateHistory[stateHistory.length - 2];\n stateHistory.pop();\n stateHistory.pop();\n if (previousMapState === 'search') {\n this.map.initiateSetToSearchState();\n } else {\n this.map.setToDefaultState();\n }\n } else {\n this.contentPlacementIds.pop();\n this.map.setToSelectedContentState(this.contentPlacementIds);\n }\n } else if (currentState === 'directions') {\n this.map.setToSelectedContentState(this.contentPlacementIds);\n }\n }\n }, {\n key: \"_handleSelectChildContentPlacement\",\n value: function _handleSelectChildContentPlacement(data) {\n var placementId = data.placementId;\n this.contentPlacementIds.push(placementId);\n this.map.setToSelectedContentState(this.contentPlacementIds);\n }\n }, {\n key: \"_handleDefaultState\",\n value: function () {\n var _handleDefaultState2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n if (!(this.currentViewType === 'mobile')) {\n _context.next = 3;\n break;\n }\n _context.next = 3;\n return this._scrollToBottom(true, {\n duration: 50\n });\n case 3:\n this.hide();\n this.contentPlacementIds = [];\n this.currentContentPlacement = null;\n this._clearViews();\n case 7:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this);\n }));\n function _handleDefaultState() {\n return _handleDefaultState2.apply(this, arguments);\n }\n return _handleDefaultState;\n }()\n }, {\n key: \"_handleSearchState\",\n value: function _handleSearchState(_) {\n this.hide();\n this.contentPlacementIds = [];\n this.currentContentPlacement = null;\n this._clearViews();\n if (this.currentViewType === 'mobile') {\n this._scrollToBottom();\n }\n }\n }, {\n key: \"_handleSelectedContentState\",\n value: function _handleSelectedContentState(data) {\n var contentPlacementIds = data.contentPlacementIds,\n selectedContentPlacement = data.selectedContentPlacement;\n this.contentPlacementIds = contentPlacementIds;\n this.currentContentPlacement = selectedContentPlacement;\n this._updateContentViews();\n this.show();\n }\n }, {\n key: \"_handleDirectionsState\",\n value: function _handleDirectionsState(_) {\n this.hide();\n }\n }, {\n key: \"_handleSetupState\",\n value: function _handleSetupState() {\n this.hide();\n }\n }, {\n key: \"_handleSelectDirectionsButton\",\n value: function () {\n var _handleSelectDirectionsButton2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data) {\n var placementId;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n placementId = data.placementId;\n _context2.next = 3;\n return this.map.setToDirectionsState(null, placementId);\n case 3:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this);\n }));\n function _handleSelectDirectionsButton(_x) {\n return _handleSelectDirectionsButton2.apply(this, arguments);\n }\n return _handleSelectDirectionsButton;\n }()\n }, {\n key: \"_handleSelectShareButton\",\n value: function () {\n var _handleSelectShareButton2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(data) {\n var _this3 = this;\n var placementId, floor, accountId, mapId, mapViewId, center, longitude, latitude, pitch, bearing, zoom, textToCopy;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n placementId = data.placementId;\n floor = this.map.getCurrentFloor();\n accountId = this.map.mapData.account_id;\n mapId = this.map.mapData.map_id;\n mapViewId = this.map.mapData.map_view_id;\n center = this.map.map.getCenter(); // Returns a LngLat object\n longitude = center.lng.toFixed(6);\n latitude = center.lat.toFixed(6);\n pitch = this.map.map.getPitch().toFixed(2); // Returns the pitch (tilt angle)\n bearing = this.map.map.getBearing().toFixed(2); // Returns the bearing (rotation angle)\n zoom = this.map.map.getZoom().toFixed(2);\n textToCopy = \"https://maps.waygomaps.com/\".concat(mapId, \"/\").concat(mapViewId, \"/selected-content/\").concat(placementId, \"/f\").concat(floor, \"@\").concat(longitude, \",\").concat(latitude, \",\").concat(zoom, \",\").concat(pitch, \",\").concat(bearing);\n navigator.clipboard.writeText(textToCopy).then(function () {\n _this3.contentPlacementView.showCopyPopup();\n })[\"catch\"](function (err) {\n return console.error('Failed to copy text:', err);\n });\n case 13:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3, this);\n }));\n function _handleSelectShareButton(_x2) {\n return _handleSelectShareButton2.apply(this, arguments);\n }\n return _handleSelectShareButton;\n }()\n }, {\n key: \"_handleSelectPhotos\",\n value: function _handleSelectPhotos(data) {\n var _this4 = this;\n var placementId = data.placementId,\n images = data.images;\n var currentImageIndex = 0;\n var totalImages = images.length;\n if (this.currentViewType === 'desktop' || this.currentViewType === 'mobile') {\n this.map.showModal(\"\\n <div class=\\\"waygo-map-modal-content photo-modal\\\">\\n <button class=\\\"modal-close-button\\\">\\n <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" fill=\\\"none\\\" viewBox=\\\"0 0 24 24\\\" stroke-width=\\\"1.5\\\" stroke=\\\"currentColor\\\">\\n <path stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\" d=\\\"M6 18L18 6M6 6l12 12\\\" />\\n </svg>\\n </button>\\n \\n <div class=\\\"modal-counter\\\">\\n <span id=\\\"imageCounter\\\">\".concat(currentImageIndex + 1, \" / \").concat(totalImages, \"</span>\\n </div>\\n \\n <div class=\\\"modal-image-container\\\">\\n <button id=\\\"prevButton\\\" class=\\\"modal-nav-button prev\\\">\\n <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" fill=\\\"none\\\" viewBox=\\\"0 0 24 24\\\" stroke-width=\\\"1.5\\\" stroke=\\\"currentColor\\\">\\n <path stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\" d=\\\"M15.75 19.5L8.25 12l7.5-7.5\\\" />\\n </svg>\\n </button>\\n \\n <div class=\\\"modal-image-wrapper\\\">\\n <img id=\\\"modalImage\\\" src=\\\"\").concat(images[currentImageIndex], \"\\\" class=\\\"modal-image\\\">\\n </div>\\n \\n <button id=\\\"nextButton\\\" class=\\\"modal-nav-button next\\\">\\n <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" fill=\\\"none\\\" viewBox=\\\"0 0 24 24\\\" stroke-width=\\\"1.5\\\" stroke=\\\"currentColor\\\">\\n <path stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\" d=\\\"M8.25 4.5l7.5 7.5-7.5 7.5\\\" />\\n </svg>\\n </button>\\n </div>\\n </div>\\n \"));\n\n // Add close button listener\n var closeButton = document.querySelector('.modal-close-button');\n closeButton.addEventListener('click', function () {\n return _this4.map.hideModal();\n });\n } else {\n this.map.showModal(\"\\n <div class=\\\"waygo-map-modal-content photo-modal\\\">\\n <img src=\\\"\".concat(images[currentImageIndex], \"\\\" class=\\\"modal-image\\\">\\n </div>\\n \"));\n }\n\n // Add event listeners after modal is shown\n var modalImage = document.getElementById('modalImage');\n var prevButton = document.getElementById('prevButton');\n var nextButton = document.getElementById('nextButton');\n var imageCounter = document.getElementById('imageCounter');\n prevButton.onclick = function () {\n currentImageIndex = (currentImageIndex - 1 + images.length) % images.length;\n modalImage.src = images[currentImageIndex];\n imageCounter.textContent = \"\".concat(currentImageIndex + 1, \" / \").concat(totalImages);\n };\n nextButton.onclick = function () {\n currentImageIndex = (currentImageIndex + 1) % images.length;\n modalImage.src = images[currentImageIndex];\n imageCounter.textContent = \"\".concat(currentImageIndex + 1, \" / \").concat(totalImages);\n };\n }\n }, {\n key: \"_updateContentViews\",\n value: function _updateContentViews() {\n this._clearViews();\n this._render();\n }\n }, {\n key: \"hide\",\n value: function hide() {\n this.container.scrollTop = 0;\n if (!this.container) {\n return;\n }\n this.container.style.display = 'none';\n }\n }, {\n key: \"scrollTo\",\n value: function scrollTo(targetHeight) {\n var _this5 = this;\n var animation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var animationOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var defaultAnimationOptions = {\n duration: 150,\n easing: 'easeInOut'\n };\n var options = _objectSpread(_objectSpread({}, defaultAnimationOptions), animationOptions);\n var startHeight = this.currentTop;\n var distance = targetHeight - startHeight;\n var startTime = null;\n\n // Easing functions\n var easingFunctions = {\n linear: function linear(t) {\n return t;\n },\n easeInOut: function easeInOut(t) {\n return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;\n },\n easeIn: function easeIn(t) {\n return t * t;\n },\n easeOut: function easeOut(t) {\n return t * (2 - t);\n }\n };\n\n // Choose easing function\n var easingFunction = easingFunctions[options.easing] || easingFunctions.easeInOut;\n var duration = options.duration;\n return new Promise(function (resolve) {\n if (!animation) {\n _this5.currentTop = targetHeight; // Set the target height immediately\n _this5.container.style.top = \"\".concat(_this5.currentTop, \"px\");\n _this5.container.style.height = \"calc(100vh - \".concat(_this5.currentTop, \"px)\"); // Update height\n resolve();\n return; // Exit the function early\n }\n\n // Animate function using requestAnimationFrame\n var _animate = function animate(currentTime) {\n if (startTime === null) startTime = currentTime;\n var elapsed = currentTime - startTime;\n var progress = Math.min(elapsed / duration, 1); // Ensure progress doesn't exceed 1\n\n // Calculate current top position based on easing function\n var easedProgress = easingFunction(progress);\n var newHeight = startHeight + easedProgress * distance;\n\n // Update the container's top position and height\n _this5.currentTop = newHeight;\n _this5.container.style.top = \"\".concat(_this5.currentTop, \"px\");\n _this5.container.style.height = \"calc(100vh - \".concat(_this5.currentTop, \"px)\");\n if (progress < 1) {\n requestAnimationFrame(_animate); // Continue animating\n } else {\n resolve();\n }\n };\n\n // Start the animation\n requestAnimationFrame(_animate);\n });\n\n // if (!animation) {\n // this.currentTop = targetHeight; // Set the target height immediately\n // this.container.style.top = `${this.currentTop}px`;\n // this.container.style.height = `calc(100vh - ${this.currentTop}px)`; // Update height\n // return; // Exit the function early\n // }\n\n // // Animate function using requestAnimationFrame\n // const animate = (currentTime) => {\n // if (startTime === null) startTime = currentTime;\n // const elapsed = currentTime - startTime;\n // const progress = Math.min(elapsed / duration, 1); // Ensure progress doesn't exceed 1\n\n // // Calculate current top position based on easing function\n // const easedProgress = easingFunction(progress);\n // const newHeight = startHeight + easedProgress * distance;\n\n // // Update the container's top position and height\n // this.currentTop = newHeight;\n // this.container.style.top = `${this.currentTop}px`;\n // this.container.style.height = `calc(100vh - ${this.currentTop}px)`;\n\n // if (progress < 1) {\n // requestAnimationFrame(animate); // Continue animating\n // }\n // };\n\n // // Start the animation\n // requestAnimationFrame(animate);\n }\n }, {\n key: \"_resetScroll\",\n value: function _resetScroll() {\n var _this6 = this;\n var rect = this.map.mapContainer.getBoundingClientRect();\n var height = this.map.mapContainer.offsetHeight;\n if (this.currentTop < rect.top) {\n this.scrollTo(rect.bottom);\n }\n var viableKeys = this.contentPlacementView.findViableAdditionalData(this.currentContentPlacement);\n var viableKeyCount = Object.keys(viableKeys).length;\n var childCount = Object.keys(this.currentContentPlacement.children).length;\n console.log('children count', childCount);\n var pixelHeight = height * (1 - this.scrollConfiguration.initialHeight);\n if (viableKeyCount === 0 && childCount === 0) {\n setTimeout(function () {\n if (_this6.contentPlacementView && _this6.contentPlacementView.contentPlacementHeader) {\n var headerElem = _this6.contentPlacementView.header;\n var headerHeight = headerElem.offsetHeight;\n pixelHeight = height - headerHeight - 20;\n // console.log(height, headerHeight, pixelHeight);\n }\n _this6.scrollTo(pixelHeight, true);\n }, 50); // Delay by 100 milliseconds\n } else {\n this.scrollTo(pixelHeight, true);\n }\n }\n }, {\n key: \"_scrollToBottom\",\n value: function _scrollToBottom() {\n var animate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n var animationOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var rect = this.map.mapContainer.getBoundingClientRect();\n return this.scrollTo(rect.bottom, animate, animationOptions);\n }\n }, {\n key: \"scrollToMin\",\n value: function scrollToMin() {\n var animate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n var rect = this.map.mapContainer.getBoundingClientRect();\n this.scrollTo(rect.bottom - this.scrollConfiguration.minDistFromBottom, animate);\n }\n }, {\n key: \"_render\",\n value: function _render() {\n if (this.contentPlacementIds.length === 0 || this.currentContentPlacement === null) return;\n\n // if (this.currentViewType === 'mobile') {\n // this._resetScroll();\n // }\n this.contentPlacementView = new _components_ContentPlacementView_ContentDetails__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n this.contentPlacementView.updateView(this.currentContentPlacement);\n this.contentPlacementView.on('selectChildContentPlacement', this._handleSelectChildContentPlacement.bind(this));\n this.contentPlacementView.on('selectDirectionsButton', this._handleSelectDirectionsButton.bind(this));\n this.contentPlacementView.on('selectShareButton', this._handleSelectShareButton.bind(this));\n this.contentPlacementView.on('selectPhotos', this._handleSelectPhotos.bind(this));\n this._initialize();\n if (this.currentViewType === 'mobile') {\n this._resetScroll();\n }\n }\n }]);\n}(_core_Control__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ContentPlacementControl);\n\n//# sourceURL=webpack://waygomaps/./src/Controls/ContentPlacementControl.js?");
|
|
584
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _components_ContentPlacementView_ContentDetails__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/ContentPlacementView/ContentDetails */ \"./src/components/ContentPlacementView/ContentDetails.js\");\n/* harmony import */ var _core_Control__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Control */ \"./src/core/Control.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prototype : t), e, r); return 2 & o ? function (t) { return p.apply(r, t); } : p; }\nfunction _get() { return _get = \"undefined\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }\nfunction _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\nvar ContentPlacementControl = /*#__PURE__*/function (_Control) {\n function ContentPlacementControl() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, ContentPlacementControl);\n _this = _callSuper(this, ContentPlacementControl, [options]);\n _this.map = null;\n _this.contentPlacementIds = [];\n _this.currentContentPlacement = null;\n _this.contentPlacementView = null;\n _this.currentTop = window.innerHeight;\n _this.startingY = 0;\n _this.scrollConfiguration = {\n initialHeight: 0.5,\n // percent of the map container height\n minDistFromBottom: 110 // 185 // in px\n };\n _this.isDragging = false;\n _this.isAtTop = false;\n _this.velocity = 0;\n _this.decelerationFactor = 0.95;\n _this.minVelocity = 0.1;\n return _this;\n }\n _inherits(ContentPlacementControl, _Control);\n return _createClass(ContentPlacementControl, [{\n key: \"onAdd\",\n value: function onAdd(map) {\n this.map = map;\n this.container = document.createElement('div');\n this.container.className = 'content-details-control-container';\n this.initializeEventListeners();\n this._attachResizeListener();\n this._initialize();\n this.hide();\n return this.container;\n }\n }, {\n key: \"onRemove\",\n value: function onRemove() {\n _superPropGet(ContentPlacementControl, \"onRemove\", this, 3)([]);\n }\n }, {\n key: \"initializeEventListeners\",\n value: function initializeEventListeners() {\n this.map.on('state:default', this._handleDefaultState.bind(this));\n this.map.on('state:search', this._handleSearchState.bind(this));\n this.map.on('state:selectedContent', this._handleSelectedContentState.bind(this));\n this.map.on('state:directions', this._handleDirectionsState.bind(this));\n this.map.on('state:setup', this._handleSetupState.bind(this));\n this.map.on('initiate:back', this._handleMapInitiateBack.bind(this));\n this.map.map.on('mousedown', this._handleMapFocus.bind(this));\n this.map.map.on('touchstart', this._handleMapFocus.bind(this));\n this.container.addEventListener('mousedown', function (e) {\n return e.stopPropagation();\n });\n this.container.addEventListener('click', function (e) {\n return e.stopPropagation();\n });\n this.container.addEventListener('dblclick', function (e) {\n return e.stopPropagation();\n });\n // this.container.addEventListener('touchstart', (e) => e.stopPropagation());\n\n this.container.addEventListener('touchstart', this.handleTouchStart.bind(this));\n this.container.addEventListener('touchmove', this.handleTouchMove.bind(this));\n this.container.addEventListener('touchend', this.handleTouchEnd.bind(this));\n this.container.addEventListener('wheel', this.handleWheelScroll.bind(this));\n\n // Add loading state event listeners\n // this.map.on('loading:start', this._handleLoadingStart.bind(this));\n // this.map.on('loading:end', this._handleLoadingEnd.bind(this));\n }\n }, {\n key: \"_handleMapFocus\",\n value: function _handleMapFocus(e) {\n if (this.currentViewType === 'desktop') return;\n var features = this.map.map.queryRenderedFeatures(e.point);\n var symbolFeatures = features.filter(function (feature) {\n return feature.layer.type === 'symbol';\n });\n if (symbolFeatures.length === 0) {\n this.scrollToMin(true);\n }\n }\n }, {\n key: \"handleTouchStart\",\n value: function handleTouchStart(event) {\n event.stopPropagation();\n this.startingY = event.touches[0].clientY;\n this.isDragging = true;\n this.velocity = 0;\n }\n }, {\n key: \"handleScrolling\",\n value: function handleScrolling(scrollAmount) {\n var element = this.contentPlacementView.getElement();\n var elementHeight = element.offsetHeight;\n var rect = this.map.mapContainer.getBoundingClientRect();\n var containerBottom = rect.bottom;\n var newTop = null;\n if (scrollAmount <= 0) {\n newTop = Math.max(containerBottom - elementHeight - rect.top, this.currentTop + scrollAmount);\n } else if (scrollAmount > 0) {\n newTop = Math.min(containerBottom - this.scrollConfiguration.minDistFromBottom - rect.top, this.currentTop + scrollAmount);\n }\n this.scrollTo(newTop);\n }\n }, {\n key: \"handleTouchMove\",\n value: function handleTouchMove(event) {\n if (this.currentViewType === 'desktop') return;\n if (!this.isDragging) return;\n var touchY = event.touches[0].clientY;\n var scrollAmount = -1 * (this.startingY - touchY);\n this.velocity = scrollAmount;\n this.handleScrolling(scrollAmount);\n this.startingY = touchY;\n }\n }, {\n key: \"handleTouchEnd\",\n value: function handleTouchEnd() {\n this.isDragging = false;\n this._applyInertia();\n }\n }, {\n key: \"_applyInertia\",\n value: function _applyInertia() {\n var _this2 = this;\n var rect = this.map.mapContainer.getBoundingClientRect();\n var element = this.contentPlacementView.getElement();\n var elementHeight = element.offsetHeight;\n var containerBottom = rect.bottom;\n var upperLimit = containerBottom - elementHeight - rect.top; // Upper scroll boundary\n var lowerLimit = containerBottom - this.scrollConfiguration.minDistFromBottom - rect.top;\n var initialVelocity = this.velocity;\n var duration = 400; // Duration of inertia in milliseconds (tweak this value)\n var startTime = performance.now(); // Start time of the inertia\n\n var _inertia = function inertia() {\n var currentTime = performance.now();\n var elapsedTime = currentTime - startTime;\n if (elapsedTime >= duration || Math.abs(_this2.velocity) < _this2.minVelocity) {\n _this2.velocity = 0;\n return;\n }\n ; // Stop when velocity is too low\n\n var progress = elapsedTime / duration; // Normalize time to [0, 1]\n var easingFactor = 1 - Math.pow(1 - progress, 2);\n _this2.velocity = initialVelocity * (1 - easingFactor);\n var newTop = _this2.currentTop + _this2.velocity;\n if (newTop <= upperLimit) {\n _this2.scrollTo(upperLimit);\n _this2.velocity = 0; // Stop inertia\n return;\n } else if (newTop >= lowerLimit) {\n _this2.scrollTo(lowerLimit);\n _this2.velocity = 0; // Stop inertia\n return;\n }\n\n // this.velocity *= this.decelerationFactor; // Apply deceleration\n // const easingFactor = Math.max(0.1, 1 - time / 100); // Easing factor decreases over time (clamped at 0.1)\n // this.velocity *= this.decelerationFactor * easingFactor;\n\n _this2.scrollTo(newTop); // Update position\n\n // time++;\n requestAnimationFrame(_inertia);\n };\n _inertia();\n }\n }, {\n key: \"handleWheelScroll\",\n value: function handleWheelScroll(event) {\n if (this.currentViewType === 'desktop') return;\n var scrollAmount = -event.deltaY;\n this.handleScrolling(scrollAmount);\n }\n\n // handleScroll() {\n // if (this.container.classList.contains('mobile-view')) {\n // // Get current scroll position\n // const scrollAmount = this.container.scrollTop;\n\n // // Adjust bottom position based on scroll amount\n // // As the user scrolls up, the container moves up (increase the bottom offset)\n // this.container.style.bottom = `${Math.min(45 + scrollAmount / 10, 100)}%`;\n\n // // If you want the container to reset to the bottom when done scrolling, add this:\n // clearTimeout(this.isScrolling);\n // this.isScrolling = setTimeout(() => {\n // this.container.style.bottom = '0px'; // Reset position when scrolling stops\n // }, 200);\n // }\n // }\n }, {\n key: \"_renderDesktopView\",\n value: function _renderDesktopView() {\n if (!this.contentPlacementView) {\n return;\n }\n var element = this.contentPlacementView.getElement();\n this.container.appendChild(element);\n this.container.classList.remove('mobile-view');\n this.container.classList.add('desktop-view');\n }\n }, {\n key: \"_renderMobileView\",\n value: function _renderMobileView() {\n if (!this.contentPlacementView) {\n return;\n }\n var element = this.contentPlacementView.getElement();\n this.container.appendChild(element);\n this.container.classList.remove('desktop-view');\n this.container.classList.add('mobile-view');\n }\n }, {\n key: \"_handleMapInitiateBack\",\n value: function _handleMapInitiateBack() {\n var currentState = this.map._stateCoordinator.state;\n if (currentState === 'selectedContent') {\n if (this.contentPlacementIds.length === 0) return;else if (this.contentPlacementIds.length === 1) {\n var stateHistory = this.map._stateCoordinator.stateHistory;\n var previousMapState = stateHistory[stateHistory.length - 2];\n stateHistory.pop();\n stateHistory.pop();\n if (previousMapState === 'search') {\n this.map.initiateSetToSearchState();\n } else {\n this.map.setToDefaultState();\n }\n } else {\n this.contentPlacementIds.pop();\n this.map.setToSelectedContentState(this.contentPlacementIds);\n }\n } else if (currentState === 'directions') {\n this.map.setToSelectedContentState(this.contentPlacementIds);\n }\n }\n }, {\n key: \"_handleSelectChildContentPlacement\",\n value: function _handleSelectChildContentPlacement(data) {\n var placementId = data.placementId;\n this.contentPlacementIds.push(placementId);\n this.map.setToSelectedContentState(this.contentPlacementIds);\n }\n }, {\n key: \"_handleDefaultState\",\n value: function () {\n var _handleDefaultState2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n if (!(this.currentViewType === 'mobile')) {\n _context.next = 3;\n break;\n }\n _context.next = 3;\n return this._scrollToBottom(true, {\n duration: 50\n });\n case 3:\n this.hide();\n this.contentPlacementIds = [];\n this.currentContentPlacement = null;\n this._clearViews();\n case 7:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this);\n }));\n function _handleDefaultState() {\n return _handleDefaultState2.apply(this, arguments);\n }\n return _handleDefaultState;\n }()\n }, {\n key: \"_handleSearchState\",\n value: function _handleSearchState(_) {\n this.hide();\n this.contentPlacementIds = [];\n this.currentContentPlacement = null;\n this._clearViews();\n if (this.currentViewType === 'mobile') {\n this._scrollToBottom();\n }\n }\n }, {\n key: \"_handleSelectedContentState\",\n value: function _handleSelectedContentState(data) {\n var contentPlacementIds = data.contentPlacementIds,\n selectedContentPlacement = data.selectedContentPlacement;\n this.contentPlacementIds = contentPlacementIds;\n this.currentContentPlacement = selectedContentPlacement;\n this._updateContentViews();\n this.show();\n }\n }, {\n key: \"_handleDirectionsState\",\n value: function _handleDirectionsState(_) {\n this.hide();\n }\n }, {\n key: \"_handleSetupState\",\n value: function _handleSetupState() {\n this.hide();\n }\n }, {\n key: \"_handleSelectDirectionsButton\",\n value: function () {\n var _handleSelectDirectionsButton2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data) {\n var placementId;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n placementId = data.placementId;\n _context2.next = 3;\n return this.map.setToDirectionsState(null, placementId);\n case 3:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this);\n }));\n function _handleSelectDirectionsButton(_x) {\n return _handleSelectDirectionsButton2.apply(this, arguments);\n }\n return _handleSelectDirectionsButton;\n }()\n }, {\n key: \"_handleSelectShareButton\",\n value: function () {\n var _handleSelectShareButton2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(data) {\n var _this3 = this;\n var placementId, floor, accountId, mapId, mapViewId, center, longitude, latitude, pitch, bearing, zoom, textToCopy;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n placementId = data.placementId;\n floor = this.map.getCurrentFloor();\n accountId = this.map.mapData.account_id;\n mapId = this.map.mapData.map_id;\n mapViewId = this.map.mapData.map_view_id;\n center = this.map.map.getCenter(); // Returns a LngLat object\n longitude = center.lng.toFixed(6);\n latitude = center.lat.toFixed(6);\n pitch = this.map.map.getPitch().toFixed(2); // Returns the pitch (tilt angle)\n bearing = this.map.map.getBearing().toFixed(2); // Returns the bearing (rotation angle)\n zoom = this.map.map.getZoom().toFixed(2);\n textToCopy = \"https://maps.waygomaps.com/\".concat(mapId, \"/\").concat(mapViewId, \"/selected-content/\").concat(placementId, \"/f\").concat(floor, \"@\").concat(longitude, \",\").concat(latitude, \",\").concat(zoom, \",\").concat(pitch, \",\").concat(bearing);\n navigator.clipboard.writeText(textToCopy).then(function () {\n _this3.contentPlacementView.showCopyPopup();\n })[\"catch\"](function (err) {\n return console.error('Failed to copy text:', err);\n });\n case 13:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3, this);\n }));\n function _handleSelectShareButton(_x2) {\n return _handleSelectShareButton2.apply(this, arguments);\n }\n return _handleSelectShareButton;\n }()\n }, {\n key: \"_handleSelectPhotos\",\n value: function _handleSelectPhotos(data) {\n var _this4 = this;\n var placementId = data.placementId,\n images = data.images;\n var currentImageIndex = 0;\n var totalImages = images.length;\n if (this.currentViewType === 'desktop' || this.currentViewType === 'mobile') {\n this.map.showModal(\"\\n <div class=\\\"waygo-map-modal-content photo-modal\\\">\\n <button class=\\\"modal-close-button\\\">\\n <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" fill=\\\"none\\\" viewBox=\\\"0 0 24 24\\\" stroke-width=\\\"1.5\\\" stroke=\\\"currentColor\\\">\\n <path stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\" d=\\\"M6 18L18 6M6 6l12 12\\\" />\\n </svg>\\n </button>\\n \\n <div class=\\\"modal-counter\\\">\\n <span id=\\\"imageCounter\\\">\".concat(currentImageIndex + 1, \" / \").concat(totalImages, \"</span>\\n </div>\\n \\n <div class=\\\"modal-image-container\\\">\\n <button id=\\\"prevButton\\\" class=\\\"modal-nav-button prev\\\">\\n <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" fill=\\\"none\\\" viewBox=\\\"0 0 24 24\\\" stroke-width=\\\"1.5\\\" stroke=\\\"currentColor\\\">\\n <path stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\" d=\\\"M15.75 19.5L8.25 12l7.5-7.5\\\" />\\n </svg>\\n </button>\\n \\n <div class=\\\"modal-image-wrapper\\\">\\n <img id=\\\"modalImage\\\" src=\\\"\").concat(images[currentImageIndex], \"\\\" class=\\\"modal-image\\\">\\n </div>\\n \\n <button id=\\\"nextButton\\\" class=\\\"modal-nav-button next\\\">\\n <svg xmlns=\\\"http://www.w3.org/2000/svg\\\" fill=\\\"none\\\" viewBox=\\\"0 0 24 24\\\" stroke-width=\\\"1.5\\\" stroke=\\\"currentColor\\\">\\n <path stroke-linecap=\\\"round\\\" stroke-linejoin=\\\"round\\\" d=\\\"M8.25 4.5l7.5 7.5-7.5 7.5\\\" />\\n </svg>\\n </button>\\n </div>\\n </div>\\n \"));\n\n // Add close button listener\n var closeButton = document.querySelector('.modal-close-button');\n closeButton.addEventListener('click', function () {\n return _this4.map.hideModal();\n });\n } else {\n this.map.showModal(\"\\n <div class=\\\"waygo-map-modal-content photo-modal\\\">\\n <img src=\\\"\".concat(images[currentImageIndex], \"\\\" class=\\\"modal-image\\\">\\n </div>\\n \"));\n }\n\n // Add event listeners after modal is shown\n var modalImage = document.getElementById('modalImage');\n var prevButton = document.getElementById('prevButton');\n var nextButton = document.getElementById('nextButton');\n var imageCounter = document.getElementById('imageCounter');\n prevButton.onclick = function () {\n currentImageIndex = (currentImageIndex - 1 + images.length) % images.length;\n modalImage.src = images[currentImageIndex];\n imageCounter.textContent = \"\".concat(currentImageIndex + 1, \" / \").concat(totalImages);\n };\n nextButton.onclick = function () {\n currentImageIndex = (currentImageIndex + 1) % images.length;\n modalImage.src = images[currentImageIndex];\n imageCounter.textContent = \"\".concat(currentImageIndex + 1, \" / \").concat(totalImages);\n };\n }\n }, {\n key: \"_updateContentViews\",\n value: function _updateContentViews() {\n this._clearViews();\n this._render();\n }\n }, {\n key: \"hide\",\n value: function hide() {\n this.container.scrollTop = 0;\n if (!this.container) {\n return;\n }\n this.container.style.display = 'none';\n }\n }, {\n key: \"scrollTo\",\n value: function scrollTo(targetHeight) {\n var _this5 = this;\n var animation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n var animationOptions = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var defaultAnimationOptions = {\n duration: 150,\n easing: 'easeInOut'\n };\n var options = _objectSpread(_objectSpread({}, defaultAnimationOptions), animationOptions);\n var startHeight = this.currentTop;\n var distance = targetHeight - startHeight;\n var startTime = null;\n\n // Easing functions\n var easingFunctions = {\n linear: function linear(t) {\n return t;\n },\n easeInOut: function easeInOut(t) {\n return t < 0.5 ? 2 * t * t : -1 + (4 - 2 * t) * t;\n },\n easeIn: function easeIn(t) {\n return t * t;\n },\n easeOut: function easeOut(t) {\n return t * (2 - t);\n }\n };\n\n // Choose easing function\n var easingFunction = easingFunctions[options.easing] || easingFunctions.easeInOut;\n var duration = options.duration;\n return new Promise(function (resolve) {\n if (!animation) {\n _this5.currentTop = targetHeight; // Set the target height immediately\n _this5.container.style.top = \"\".concat(_this5.currentTop, \"px\");\n _this5.container.style.height = \"calc(100vh - \".concat(_this5.currentTop, \"px)\"); // Update height\n resolve();\n return; // Exit the function early\n }\n\n // Animate function using requestAnimationFrame\n var _animate = function animate(currentTime) {\n if (startTime === null) startTime = currentTime;\n var elapsed = currentTime - startTime;\n var progress = Math.min(elapsed / duration, 1); // Ensure progress doesn't exceed 1\n\n // Calculate current top position based on easing function\n var easedProgress = easingFunction(progress);\n var newHeight = startHeight + easedProgress * distance;\n\n // Update the container's top position and height\n _this5.currentTop = newHeight;\n _this5.container.style.top = \"\".concat(_this5.currentTop, \"px\");\n _this5.container.style.height = \"calc(100vh - \".concat(_this5.currentTop, \"px)\");\n if (progress < 1) {\n requestAnimationFrame(_animate); // Continue animating\n } else {\n resolve();\n }\n };\n\n // Start the animation\n requestAnimationFrame(_animate);\n });\n\n // if (!animation) {\n // this.currentTop = targetHeight; // Set the target height immediately\n // this.container.style.top = `${this.currentTop}px`;\n // this.container.style.height = `calc(100vh - ${this.currentTop}px)`; // Update height\n // return; // Exit the function early\n // }\n\n // // Animate function using requestAnimationFrame\n // const animate = (currentTime) => {\n // if (startTime === null) startTime = currentTime;\n // const elapsed = currentTime - startTime;\n // const progress = Math.min(elapsed / duration, 1); // Ensure progress doesn't exceed 1\n\n // // Calculate current top position based on easing function\n // const easedProgress = easingFunction(progress);\n // const newHeight = startHeight + easedProgress * distance;\n\n // // Update the container's top position and height\n // this.currentTop = newHeight;\n // this.container.style.top = `${this.currentTop}px`;\n // this.container.style.height = `calc(100vh - ${this.currentTop}px)`;\n\n // if (progress < 1) {\n // requestAnimationFrame(animate); // Continue animating\n // }\n // };\n\n // // Start the animation\n // requestAnimationFrame(animate);\n }\n }, {\n key: \"_resetScroll\",\n value: function _resetScroll() {\n var _this6 = this;\n var rect = this.map.mapContainer.getBoundingClientRect();\n var height = this.map.mapContainer.offsetHeight;\n if (this.currentTop < rect.top) {\n this.scrollTo(rect.bottom);\n }\n var viableKeys = this.contentPlacementView.findViableAdditionalData(this.currentContentPlacement);\n var viableKeyCount = Object.keys(viableKeys).length;\n var childCount = Object.keys(this.currentContentPlacement.children).length;\n var pixelHeight = height * (1 - this.scrollConfiguration.initialHeight);\n if (viableKeyCount === 0 && childCount === 0) {\n setTimeout(function () {\n if (_this6.contentPlacementView && _this6.contentPlacementView.contentPlacementHeader) {\n var headerElem = _this6.contentPlacementView.header;\n var headerHeight = headerElem.offsetHeight;\n pixelHeight = height - headerHeight - 20;\n }\n _this6.scrollTo(pixelHeight, true);\n }, 50); // Delay by 100 milliseconds\n } else {\n this.scrollTo(pixelHeight, true);\n }\n }\n }, {\n key: \"_scrollToBottom\",\n value: function _scrollToBottom() {\n var animate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n var animationOptions = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n var rect = this.map.mapContainer.getBoundingClientRect();\n return this.scrollTo(rect.bottom, animate, animationOptions);\n }\n }, {\n key: \"scrollToMin\",\n value: function scrollToMin() {\n var animate = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;\n var rect = this.map.mapContainer.getBoundingClientRect();\n this.scrollTo(rect.bottom - this.scrollConfiguration.minDistFromBottom, animate);\n }\n }, {\n key: \"_render\",\n value: function _render() {\n if (this.contentPlacementIds.length === 0 || this.currentContentPlacement === null) return;\n\n // if (this.currentViewType === 'mobile') {\n // this._resetScroll();\n // }\n this.contentPlacementView = new _components_ContentPlacementView_ContentDetails__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n this.contentPlacementView.updateView(this.currentContentPlacement);\n this.contentPlacementView.on('selectChildContentPlacement', this._handleSelectChildContentPlacement.bind(this));\n this.contentPlacementView.on('selectDirectionsButton', this._handleSelectDirectionsButton.bind(this));\n this.contentPlacementView.on('selectShareButton', this._handleSelectShareButton.bind(this));\n this.contentPlacementView.on('selectPhotos', this._handleSelectPhotos.bind(this));\n this._initialize();\n if (this.currentViewType === 'mobile') {\n this._resetScroll();\n }\n }\n\n // _handleLoadingStart(data) {\n // const { type } = data;\n\n // if (type === 'content') {\n // // Show loading indicator for content placement view\n // if (this.contentPlacementView) {\n // this.contentPlacementView.showLoading();\n // }\n // } else if (type === 'directions') {\n // // Show loading indicator for directions\n // if (this.contentPlacementView) {\n // this.contentPlacementView.showDirectionsLoading();\n // }\n // }\n // }\n\n // _handleLoadingEnd(data) {\n // const { type } = data;\n\n // if (type === 'content') {\n // // Hide loading indicator for content placement view\n // if (this.contentPlacementView) {\n // this.contentPlacementView.hideLoading();\n // }\n // } else if (type === 'directions') {\n // // Hide loading indicator for directions\n // if (this.contentPlacementView) {\n // this.contentPlacementView.hideDirectionsLoading();\n // }\n // }\n // }\n }]);\n}(_core_Control__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ContentPlacementControl);\n\n//# sourceURL=webpack://waygomaps/./src/Controls/ContentPlacementControl.js?");
|
|
585
585
|
|
|
586
586
|
/***/ }),
|
|
587
587
|
|
|
@@ -592,7 +592,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
592
592
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
593
593
|
|
|
594
594
|
"use strict";
|
|
595
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Control__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Control */ \"./src/core/Control.js\");\n/* harmony import */ var _components_DirectionsView_DirectionsView__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/DirectionsView/DirectionsView */ \"./src/components/DirectionsView/DirectionsView.js\");\n/* harmony import */ var _WaygoMaps__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../WaygoMaps */ \"./src/WaygoMaps.js\");\n/* harmony import */ var _components_DirectionsView_StepsView__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/DirectionsView/StepsView */ \"./src/components/DirectionsView/StepsView.js\");\n/* harmony import */ var _utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/coordinateSystems */ \"./src/utils/coordinateSystems.js\");\n/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! axios */ \"./node_modules/axios/lib/axios.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _iterableToArray(r) { if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r); }\nfunction _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prototype : t), e, r); return 2 & o ? function (t) { return p.apply(r, t); } : p; }\nfunction _get() { return _get = \"undefined\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }\nfunction _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\n\n\n\nvar DirectionsControl = /*#__PURE__*/function (_Control) {\n function DirectionsControl() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, DirectionsControl);\n _this = _callSuper(this, DirectionsControl, [options]);\n _this.directionsView = null;\n _this.stepsView = null;\n _this.map = null;\n _this.searchApi = _WaygoMaps__WEBPACK_IMPORTED_MODULE_2__[\"default\"].getSearchApi();\n _this.startContentPlacement = null;\n _this.endContentPlacement = null;\n return _this;\n }\n _inherits(DirectionsControl, _Control);\n return _createClass(DirectionsControl, [{\n key: \"onAdd\",\n value: function onAdd(map) {\n this.map = map;\n this.container = document.createElement('div');\n this.container.className = 'directions-control-container';\n this.directionsView = new _components_DirectionsView_DirectionsView__WEBPACK_IMPORTED_MODULE_1__[\"default\"]();\n this.stepsView = new _components_DirectionsView_StepsView__WEBPACK_IMPORTED_MODULE_3__[\"default\"]();\n this.container.appendChild(this.directionsView.getElement());\n this.initializeEventListeners();\n this.createDirectionsLineLayer();\n this._attachResizeListener();\n this._initialize();\n this.hide();\n return this.container;\n }\n }, {\n key: \"onRemove\",\n value: function onRemove() {\n _superPropGet(DirectionsControl, \"onRemove\", this, 3)([]);\n }\n }, {\n key: \"initializeEventListeners\",\n value: function initializeEventListeners() {\n this.map.on('state:default', this._handleDefaultState.bind(this));\n this.map.on('state:search', this._handleSearchState.bind(this));\n this.map.on('state:selectedContent', this._handleSelectedContentState.bind(this));\n this.map.on('state:directions', this._handleDirectionsState.bind(this));\n this.map.on('state:setup', this._handleSetupState.bind(this));\n // this.map.on('initiate:back', this._handleMapInitiateBack.bind(this));\n\n this.directionsView.on('getStartSuggestions', this._handleGettingStartSearchBarSuggestions.bind(this));\n this.directionsView.on('getEndSuggestions', this._handleGettingEndSearchBarSuggestions.bind(this));\n this.directionsView.on('initiate:findPath', this._handleIntiateFindPath.bind(this));\n this.directionsView.on('initiate:findPathFromLocation', this._handleInitiateFindPathFromLocation.bind(this));\n // this.directionsView.on('initiate:changeLeg', this._handleLegChange.bind(this));\n this.directionsView.on('selectedStartContentPlacement', this._handleStartContentPlacementSelected.bind(this));\n this.directionsView.on('selectedEndContentPlacement', this._handleEndContentPlacementSelected.bind(this));\n this.stepsView.on('legSelect', this._handleLegChange.bind(this));\n }\n }, {\n key: \"_handleEndContentPlacementSelected\",\n value: function _handleEndContentPlacementSelected(data) {\n var endContentPlacement = data.endContentPlacement;\n this.endContentPlacement = endContentPlacement;\n var _convertVertexToCoord = (0,_utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_4__.convertVertexToCoordinate)(endContentPlacement.location, null, 30.0),\n lat = _convertVertexToCoord.lat,\n lon = _convertVertexToCoord.lon;\n var coordinate = [lon, lat];\n if (!endContentPlacement.name) {\n if (endContentPlacement.catalog && endContentPlacement.content) {\n var titleKey = endContentPlacement.catalog.content_title_key;\n if (titleKey) {\n // const titleKey = endContentPlacement.content.title_key;\n var title = endContentPlacement.content.data[titleKey];\n endContentPlacement.name = title;\n }\n }\n }\n endContentPlacement._floor = endContentPlacement.floor;\n this.map.addSelectedFeature(coordinate, endContentPlacement);\n }\n }, {\n key: \"_handleStartContentPlacementSelected\",\n value: function _handleStartContentPlacementSelected(data) {\n var startContentPlacement = data.startContentPlacement;\n this.startContentPlacement = startContentPlacement;\n var _convertVertexToCoord2 = (0,_utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_4__.convertVertexToCoordinate)(startContentPlacement.location, null, 30.0),\n lat = _convertVertexToCoord2.lat,\n lon = _convertVertexToCoord2.lon;\n var coordinate = [lon, lat];\n if (!startContentPlacement.name) {\n if (startContentPlacement.catalog && startContentPlacement.content) {\n var titleKey = startContentPlacement.catalog.content_title_key;\n if (titleKey) {\n // const titleKey = startContentPlacement.content.title_key;\n var title = startContentPlacement.content.data[titleKey];\n startContentPlacement.name = title;\n }\n }\n }\n startContentPlacement._floor = startContentPlacement.floor;\n this.map.clearHighlightedContentLayer();\n this.map.addHighlightedFeature(coordinate, startContentPlacement);\n }\n }, {\n key: \"_handleLegChange\",\n value: function _handleLegChange(data) {\n var index = data.index;\n if (!this.directionsView || !this.pathData) {\n return;\n }\n this.updateMapForPathLeg(this.pathData.legs[index]);\n }\n }, {\n key: \"_handleGettingStartSearchBarSuggestions\",\n value: function () {\n var _handleGettingStartSearchBarSuggestions2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {\n var query, currentSearch, skip, limit, results;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n if (this.directionsView) {\n _context.next = 2;\n break;\n }\n return _context.abrupt(\"return\");\n case 2:\n query = data.query;\n currentSearch = ++this.directionsView.startSearchBox.searchCount;\n if (!(query === '')) {\n _context.next = 7;\n break;\n }\n this.directionsView.startSearchBox.searchBarSuggestionsView.updateResults([]);\n return _context.abrupt(\"return\");\n case 7:\n if (this.map.mapData) {\n _context.next = 9;\n break;\n }\n return _context.abrupt(\"return\");\n case 9:\n skip = 0;\n limit = 5;\n _context.prev = 11;\n _context.next = 14;\n return this.searchApi.search(this.map.mapData.map_id, this.map.mapData.map_view_id, query, skip, limit);\n case 14:\n results = _context.sent;\n if (currentSearch === this.directionsView.startSearchBox.searchCount) {\n this.directionsView.startSearchBox.searchBarSuggestionsView.updateResults(results);\n }\n _context.next = 21;\n break;\n case 18:\n _context.prev = 18;\n _context.t0 = _context[\"catch\"](11);\n if (axios__WEBPACK_IMPORTED_MODULE_5__[\"default\"].isCancel(_context.t0)) {\n console.error('Request canceled:', _context.t0.message);\n } else {\n console.error('Search error:', _context.t0);\n }\n case 21:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this, [[11, 18]]);\n }));\n function _handleGettingStartSearchBarSuggestions(_x) {\n return _handleGettingStartSearchBarSuggestions2.apply(this, arguments);\n }\n return _handleGettingStartSearchBarSuggestions;\n }()\n }, {\n key: \"_handleGettingEndSearchBarSuggestions\",\n value: function () {\n var _handleGettingEndSearchBarSuggestions2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data) {\n var query, currentSearch, skip, limit, results;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n if (this.directionsView) {\n _context2.next = 2;\n break;\n }\n return _context2.abrupt(\"return\");\n case 2:\n query = data.query;\n currentSearch = ++this.directionsView.endSearchBox.searchCount;\n if (!(query === '')) {\n _context2.next = 7;\n break;\n }\n this.directionsView.endSearchBox.searchBarSuggestionsView.updateResults([]);\n return _context2.abrupt(\"return\");\n case 7:\n if (this.map.mapData) {\n _context2.next = 9;\n break;\n }\n return _context2.abrupt(\"return\");\n case 9:\n skip = 0;\n limit = 5;\n _context2.prev = 11;\n _context2.next = 14;\n return this.searchApi.search(this.map.mapData.map_id, this.map.mapData.map_view_id, query, skip, limit);\n case 14:\n results = _context2.sent;\n if (currentSearch === this.directionsView.endSearchBox.searchCount) {\n this.directionsView.endSearchBox.searchBarSuggestionsView.updateResults(results);\n }\n _context2.next = 21;\n break;\n case 18:\n _context2.prev = 18;\n _context2.t0 = _context2[\"catch\"](11);\n if (axios__WEBPACK_IMPORTED_MODULE_5__[\"default\"].isCancel(_context2.t0)) {\n console.error('Request canceled:', _context2.t0.message);\n } else {\n console.error('Search error:', _context2.t0);\n }\n case 21:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this, [[11, 18]]);\n }));\n function _handleGettingEndSearchBarSuggestions(_x2) {\n return _handleGettingEndSearchBarSuggestions2.apply(this, arguments);\n }\n return _handleGettingEndSearchBarSuggestions;\n }()\n }, {\n key: \"_renderDesktopView\",\n value: function _renderDesktopView() {\n if (!this.directionsView) {\n return;\n }\n this.container.innerHTML = \"\";\n var element = this.directionsView.getElement();\n this.container.appendChild(element);\n this.container.classList.remove('mobile-view');\n this.container.classList.add('desktop-view');\n this.container.appendChild(this.stepsView.getElement());\n // this.element.appendChild(this.stepsView.getElement());\n }\n }, {\n key: \"_renderMobileView\",\n value: function _renderMobileView() {\n if (!this.directionsView) {\n return;\n }\n this.container.innerHTML = \"\";\n var element = this.directionsView.getElement();\n this.container.appendChild(element);\n this.container.classList.remove('desktop-view');\n this.container.classList.add('mobile-view');\n this.container.appendChild(this.stepsView.getElement());\n // this.element.appendChild(this.stepsView.getElement());\n }\n }, {\n key: \"createDirectionsLineLayer\",\n value: function createDirectionsLineLayer() {\n this.map.map.addSource('directionsLineSource', {\n 'type': 'geojson',\n 'data': {\n 'type': 'Feature',\n 'properties': {},\n 'geometry': {\n 'type': 'LineString',\n 'coordinates': []\n }\n }\n });\n\n // Add a new layer for the line\n this.map.map.addLayer({\n 'id': 'directionsLineLayer',\n 'type': 'line',\n 'source': 'directionsLineSource',\n 'layout': {\n 'line-join': 'round',\n 'line-cap': 'round'\n },\n 'paint': {\n 'line-color': '#333333',\n 'line-width': 8\n // 'line-blur': 0.9\n }\n });\n\n // this.map.map.moveLayer('directionsLineLayer', 'off-limits');\n // this.map.map.moveLayer('directionsLineLayer', '0-tertiary-area');\n this.map.map.moveLayer('directionsLineLayer', 'FIRST_ELEVATED_FEATURE');\n }\n }, {\n key: \"updateMapForPathLeg\",\n value: function updateMapForPathLeg(leg) {\n this.clearLineData();\n var points = [];\n leg.steps.forEach(function (step, index) {\n points.push.apply(points, _toConsumableArray(index === 0 ? step.path : step.path.slice(1)));\n });\n var coordinates = (0,_utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_4__.convertVerticesToCoordinates)(points, null, 30.0);\n this._updateMapLineData(coordinates, leg.floor);\n var currentFloor = this.map.getCurrentFloor();\n if (currentFloor !== leg.floor) {\n this.map.updateFloor(leg.floor, false);\n }\n }\n }, {\n key: \"_updateMapLineData\",\n value: function _updateMapLineData(newCoordinates, floor) {\n this.map.map.getSource('directionsLineSource').setData({\n 'type': 'Feature',\n 'properties': {\n '_floor': floor\n },\n 'geometry': {\n 'type': 'LineString',\n 'coordinates': newCoordinates\n }\n });\n var bounds = new mapboxgl.LngLatBounds();\n newCoordinates.forEach(function (coordinate) {\n bounds.extend(coordinate);\n });\n if (this.currentViewType === 'desktop') {\n this.map.map.fitBounds(bounds, _defineProperty(_defineProperty(_defineProperty({\n padding: 200\n }, \"padding\", {\n top: 200,\n bottom: 200,\n left: 500,\n right: 150\n }), \"maxZoom\", 15), \"duration\", 1000));\n } else {\n this.map.map.fitBounds(bounds, {\n // padding: 200, // Add padding around the edges of the map\n padding: {\n top: 350,\n bottom: 60,\n left: 80,\n right: 100\n },\n maxZoom: 14,\n // Optional: Limit the maximum zoom level\n duration: 1000 // Optional: Animation duration in milliseconds\n });\n }\n }\n }, {\n key: \"clearLineData\",\n value: function clearLineData() {\n this.map.map.getSource('directionsLineSource').setData({\n 'type': 'Feature',\n 'properties': {},\n 'geometry': {\n 'type': 'LineString',\n 'coordinates': []\n }\n });\n }\n }, {\n key: \"_handleDefaultState\",\n value: function _handleDefaultState() {\n this.hide();\n // this.clearLineData();\n this.clearData();\n }\n }, {\n key: \"_handleSearchState\",\n value: function _handleSearchState(data) {\n var query = data.query,\n results = data.results;\n this.hide();\n // this.clearLineData();\n this.clearData();\n }\n }, {\n key: \"_handleSelectedContentState\",\n value: function _handleSelectedContentState(data) {\n var contentPlacementIds = data.contentPlacementIds,\n selectedContentPlacement = data.selectedContentPlacement;\n this.hide();\n this.directionsView.updateView(null, null);\n // this.clearLineData();\n this.clearData();\n // this.map.clearSelectedContentLayer();\n this.map.clearHighlightedContentLayer();\n }\n }, {\n key: \"_handleSetupState\",\n value: function _handleSetupState() {\n this.hide();\n }\n }, {\n key: \"clearData\",\n value: function clearData() {\n this.pathData = null;\n this.clearLineData();\n this.stepsView.clear();\n }\n }, {\n key: \"_handleDirectionsState\",\n value: function () {\n var _handleDirectionsState2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(data) {\n var startContentPlacement, endContentPlacement, _convertVertexToCoord3, lat, lon, coordinate, titleKey, title, firstLocation, _convertVertexToCoord4, _lat, _lon, _coordinate;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n startContentPlacement = data.startContentPlacement, endContentPlacement = data.endContentPlacement;\n this.clearData();\n // this._initialize();\n this.show();\n // this.clearLineData();\n this.directionsView.updateView(startContentPlacement, endContentPlacement);\n if (!endContentPlacement) {\n _context3.next = 16;\n break;\n }\n _convertVertexToCoord3 = (0,_utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_4__.convertVertexToCoordinate)(endContentPlacement.location, null, 30.0), lat = _convertVertexToCoord3.lat, lon = _convertVertexToCoord3.lon;\n coordinate = [lon, lat];\n if (!endContentPlacement.name) {\n if (endContentPlacement.catalog) {\n titleKey = endContentPlacement.catalog.content_title_key;\n if (titleKey) {\n // const titleKey = endContentPlacement.content.title_key;\n title = endContentPlacement.content.data[titleKey];\n endContentPlacement.name = title;\n }\n }\n }\n endContentPlacement._floor = endContentPlacement.floor;\n this.map.addSelectedFeature(coordinate, endContentPlacement);\n if (!(this.map.location && !startContentPlacement)) {\n _context3.next = 16;\n break;\n }\n _context3.next = 13;\n return this.map.findPathFromNodeToPlacement(this.map.location, endContentPlacement.placement_id);\n case 13:\n this.pathData = _context3.sent;\n // this.map.addHighlightedFeature(coordinate, startContentPlacement);\n console;\n if (this.pathData) {\n this.directionsView.setNewPath(this.pathData, true);\n console.log(\"PATH DATA 2\");\n firstLocation = this.pathData.legs[0].steps[0].path[0];\n console.log(firstLocation, this.pathData.legs[0]);\n _convertVertexToCoord4 = (0,_utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_4__.convertVertexToCoordinate)(firstLocation, null, 30.0), _lat = _convertVertexToCoord4.lat, _lon = _convertVertexToCoord4.lon;\n _coordinate = [_lon, _lat];\n this.map.addHighlightedFeature(_coordinate, {\n '_floor': this.pathData.legs[0].floor,\n 'name': 'Start'\n });\n if (this.currentViewType === 'mobile') {\n this.stepsView.setNewPath(this.pathData, false);\n } else {\n this.stepsView.setNewPath(this.pathData);\n }\n this.updateMapForPathLeg(this.pathData.legs[0]);\n }\n case 16:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3, this);\n }));\n function _handleDirectionsState(_x3) {\n return _handleDirectionsState2.apply(this, arguments);\n }\n return _handleDirectionsState;\n }()\n }, {\n key: \"_handleInitiateFindPathFromLocation\",\n value: function () {\n var _handleInitiateFindPathFromLocation2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(data) {\n var endContentPlacement;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) switch (_context4.prev = _context4.next) {\n case 0:\n endContentPlacement = data.endContentPlacement;\n console.log(\"END CONTENT PLACEMENT\");\n console.log(endContentPlacement);\n if (!(this.map.location && endContentPlacement)) {\n _context4.next = 8;\n break;\n }\n _context4.next = 6;\n return this.map.findPathFromNodeToPlacement(this.map.location, endContentPlacement.placement_id);\n case 6:\n this.pathData = _context4.sent;\n // this.map.addHighlightedFeature(coordinate, startContentPlacement);\n if (this.pathData) {\n this.directionsView.setNewPath(this.pathData, true);\n console.log(\"PATH DATA\");\n console.log(this.pathData);\n if (this.currentViewType === 'mobile') {\n this.stepsView.setNewPath(this.pathData, false);\n } else {\n this.stepsView.setNewPath(this.pathData);\n }\n this.updateMapForPathLeg(this.pathData.legs[0]);\n }\n case 8:\n case \"end\":\n return _context4.stop();\n }\n }, _callee4, this);\n }));\n function _handleInitiateFindPathFromLocation(_x4) {\n return _handleInitiateFindPathFromLocation2.apply(this, arguments);\n }\n return _handleInitiateFindPathFromLocation;\n }() // async _handleInitiateFindNodeToPlacementPath(data) {\n // const { startNodeId, endContentPlacementId } = data;\n // this.pathData = await this.map.findPathNodeToPlacement(startNodeId, endContentPlacementId);\n // }\n }, {\n key: \"_handleIntiateFindPath\",\n value: function () {\n var _handleIntiateFindPath2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(data) {\n var startContentPlacementId, endContentPlacementId;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) switch (_context5.prev = _context5.next) {\n case 0:\n startContentPlacementId = data.startContentPlacementId, endContentPlacementId = data.endContentPlacementId;\n _context5.next = 3;\n return this.map.findPath(startContentPlacementId, endContentPlacementId);\n case 3:\n this.pathData = _context5.sent;\n this.directionsView.setNewPath(this.pathData);\n if (this.currentViewType === 'mobile') {\n this.stepsView.setNewPath(this.pathData, false);\n } else {\n this.stepsView.setNewPath(this.pathData);\n }\n this.updateMapForPathLeg(this.pathData.legs[0]);\n case 7:\n case \"end\":\n return _context5.stop();\n }\n }, _callee5, this);\n }));\n function _handleIntiateFindPath(_x5) {\n return _handleIntiateFindPath2.apply(this, arguments);\n }\n return _handleIntiateFindPath;\n }()\n }, {\n key: \"_handleSelectDirectionsButton\",\n value: function _handleSelectDirectionsButton(data) {\n var placementId = data.placementId;\n }\n }, {\n key: \"_render\",\n value: function _render() {\n return;\n }\n }]);\n}(_core_Control__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DirectionsControl);\n\n//# sourceURL=webpack://waygomaps/./src/Controls/DirectionsControl.js?");
|
|
595
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Control__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Control */ \"./src/core/Control.js\");\n/* harmony import */ var _components_DirectionsView_DirectionsView__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/DirectionsView/DirectionsView */ \"./src/components/DirectionsView/DirectionsView.js\");\n/* harmony import */ var _WaygoMaps__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../WaygoMaps */ \"./src/WaygoMaps.js\");\n/* harmony import */ var _components_DirectionsView_StepsView__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/DirectionsView/StepsView */ \"./src/components/DirectionsView/StepsView.js\");\n/* harmony import */ var _utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../utils/coordinateSystems */ \"./src/utils/coordinateSystems.js\");\n/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! axios */ \"./node_modules/axios/lib/axios.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toConsumableArray(r) { return _arrayWithoutHoles(r) || _iterableToArray(r) || _unsupportedIterableToArray(r) || _nonIterableSpread(); }\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _iterableToArray(r) { if (\"undefined\" != typeof Symbol && null != r[Symbol.iterator] || null != r[\"@@iterator\"]) return Array.from(r); }\nfunction _arrayWithoutHoles(r) { if (Array.isArray(r)) return _arrayLikeToArray(r); }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prototype : t), e, r); return 2 & o ? function (t) { return p.apply(r, t); } : p; }\nfunction _get() { return _get = \"undefined\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }\nfunction _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\n\n\n\nvar DirectionsControl = /*#__PURE__*/function (_Control) {\n function DirectionsControl() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, DirectionsControl);\n _this = _callSuper(this, DirectionsControl, [options]);\n _this.directionsView = null;\n _this.stepsView = null;\n _this.map = null;\n _this.searchApi = _WaygoMaps__WEBPACK_IMPORTED_MODULE_2__[\"default\"].getSearchApi();\n _this.startContentPlacement = null;\n _this.endContentPlacement = null;\n return _this;\n }\n _inherits(DirectionsControl, _Control);\n return _createClass(DirectionsControl, [{\n key: \"onAdd\",\n value: function onAdd(map) {\n this.map = map;\n this.container = document.createElement('div');\n this.container.className = 'directions-control-container';\n this.directionsView = new _components_DirectionsView_DirectionsView__WEBPACK_IMPORTED_MODULE_1__[\"default\"]();\n this.stepsView = new _components_DirectionsView_StepsView__WEBPACK_IMPORTED_MODULE_3__[\"default\"]();\n this.container.appendChild(this.directionsView.getElement());\n this.initializeEventListeners();\n this.createDirectionsLineLayer();\n this._attachResizeListener();\n this._initialize();\n this.hide();\n return this.container;\n }\n }, {\n key: \"onRemove\",\n value: function onRemove() {\n _superPropGet(DirectionsControl, \"onRemove\", this, 3)([]);\n }\n }, {\n key: \"initializeEventListeners\",\n value: function initializeEventListeners() {\n this.map.on('state:default', this._handleDefaultState.bind(this));\n this.map.on('state:search', this._handleSearchState.bind(this));\n this.map.on('state:selectedContent', this._handleSelectedContentState.bind(this));\n this.map.on('state:directions', this._handleDirectionsState.bind(this));\n this.map.on('state:setup', this._handleSetupState.bind(this));\n // this.map.on('initiate:back', this._handleMapInitiateBack.bind(this));\n\n this.directionsView.on('getStartSuggestions', this._handleGettingStartSearchBarSuggestions.bind(this));\n this.directionsView.on('getEndSuggestions', this._handleGettingEndSearchBarSuggestions.bind(this));\n this.directionsView.on('initiate:findPath', this._handleIntiateFindPath.bind(this));\n this.directionsView.on('initiate:findPathFromLocation', this._handleInitiateFindPathFromLocation.bind(this));\n // this.directionsView.on('initiate:changeLeg', this._handleLegChange.bind(this));\n this.directionsView.on('selectedStartContentPlacement', this._handleStartContentPlacementSelected.bind(this));\n this.directionsView.on('selectedEndContentPlacement', this._handleEndContentPlacementSelected.bind(this));\n this.stepsView.on('legSelect', this._handleLegChange.bind(this));\n }\n }, {\n key: \"_handleEndContentPlacementSelected\",\n value: function _handleEndContentPlacementSelected(data) {\n var endContentPlacement = data.endContentPlacement;\n this.endContentPlacement = endContentPlacement;\n var _convertVertexToCoord = (0,_utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_4__.convertVertexToCoordinate)(endContentPlacement.location, null, 30.0),\n lat = _convertVertexToCoord.lat,\n lon = _convertVertexToCoord.lon;\n var coordinate = [lon, lat];\n if (!endContentPlacement.name) {\n if (endContentPlacement.catalog && endContentPlacement.content) {\n var titleKey = endContentPlacement.catalog.content_title_key;\n if (titleKey) {\n // const titleKey = endContentPlacement.content.title_key;\n var title = endContentPlacement.content.data[titleKey];\n endContentPlacement.name = title;\n }\n }\n }\n endContentPlacement._floor = endContentPlacement.floor;\n this.map.addSelectedFeature(coordinate, endContentPlacement);\n }\n }, {\n key: \"_handleStartContentPlacementSelected\",\n value: function _handleStartContentPlacementSelected(data) {\n var startContentPlacement = data.startContentPlacement;\n this.startContentPlacement = startContentPlacement;\n var _convertVertexToCoord2 = (0,_utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_4__.convertVertexToCoordinate)(startContentPlacement.location, null, 30.0),\n lat = _convertVertexToCoord2.lat,\n lon = _convertVertexToCoord2.lon;\n var coordinate = [lon, lat];\n if (!startContentPlacement.name) {\n if (startContentPlacement.catalog && startContentPlacement.content) {\n var titleKey = startContentPlacement.catalog.content_title_key;\n if (titleKey) {\n // const titleKey = startContentPlacement.content.title_key;\n var title = startContentPlacement.content.data[titleKey];\n startContentPlacement.name = title;\n }\n }\n }\n startContentPlacement._floor = startContentPlacement.floor;\n this.map.clearHighlightedContentLayer();\n this.map.addHighlightedFeature(coordinate, startContentPlacement);\n }\n }, {\n key: \"_handleLegChange\",\n value: function _handleLegChange(data) {\n var index = data.index;\n if (!this.directionsView || !this.pathData) {\n return;\n }\n this.updateMapForPathLeg(this.pathData.legs[index]);\n }\n }, {\n key: \"_handleGettingStartSearchBarSuggestions\",\n value: function () {\n var _handleGettingStartSearchBarSuggestions2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {\n var query, currentSearch, skip, limit, results;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n if (this.directionsView) {\n _context.next = 2;\n break;\n }\n return _context.abrupt(\"return\");\n case 2:\n query = data.query;\n currentSearch = ++this.directionsView.startSearchBox.searchCount;\n if (!(query === '')) {\n _context.next = 7;\n break;\n }\n this.directionsView.startSearchBox.searchBarSuggestionsView.updateResults([]);\n return _context.abrupt(\"return\");\n case 7:\n if (this.map.mapData) {\n _context.next = 9;\n break;\n }\n return _context.abrupt(\"return\");\n case 9:\n skip = 0;\n limit = 5;\n _context.prev = 11;\n _context.next = 14;\n return this.searchApi.search(this.map.mapData.map_id, this.map.mapData.map_view_id, query, skip, limit);\n case 14:\n results = _context.sent;\n if (currentSearch === this.directionsView.startSearchBox.searchCount) {\n this.directionsView.startSearchBox.searchBarSuggestionsView.updateResults(results);\n }\n _context.next = 21;\n break;\n case 18:\n _context.prev = 18;\n _context.t0 = _context[\"catch\"](11);\n if (axios__WEBPACK_IMPORTED_MODULE_5__[\"default\"].isCancel(_context.t0)) {\n console.error('Request canceled:', _context.t0.message);\n } else {\n console.error('Search error:', _context.t0);\n }\n case 21:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this, [[11, 18]]);\n }));\n function _handleGettingStartSearchBarSuggestions(_x) {\n return _handleGettingStartSearchBarSuggestions2.apply(this, arguments);\n }\n return _handleGettingStartSearchBarSuggestions;\n }()\n }, {\n key: \"_handleGettingEndSearchBarSuggestions\",\n value: function () {\n var _handleGettingEndSearchBarSuggestions2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data) {\n var query, currentSearch, skip, limit, results;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n if (this.directionsView) {\n _context2.next = 2;\n break;\n }\n return _context2.abrupt(\"return\");\n case 2:\n query = data.query;\n currentSearch = ++this.directionsView.endSearchBox.searchCount;\n if (!(query === '')) {\n _context2.next = 7;\n break;\n }\n this.directionsView.endSearchBox.searchBarSuggestionsView.updateResults([]);\n return _context2.abrupt(\"return\");\n case 7:\n if (this.map.mapData) {\n _context2.next = 9;\n break;\n }\n return _context2.abrupt(\"return\");\n case 9:\n skip = 0;\n limit = 5;\n _context2.prev = 11;\n _context2.next = 14;\n return this.searchApi.search(this.map.mapData.map_id, this.map.mapData.map_view_id, query, skip, limit);\n case 14:\n results = _context2.sent;\n if (currentSearch === this.directionsView.endSearchBox.searchCount) {\n this.directionsView.endSearchBox.searchBarSuggestionsView.updateResults(results);\n }\n _context2.next = 21;\n break;\n case 18:\n _context2.prev = 18;\n _context2.t0 = _context2[\"catch\"](11);\n if (axios__WEBPACK_IMPORTED_MODULE_5__[\"default\"].isCancel(_context2.t0)) {\n console.error('Request canceled:', _context2.t0.message);\n } else {\n console.error('Search error:', _context2.t0);\n }\n case 21:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this, [[11, 18]]);\n }));\n function _handleGettingEndSearchBarSuggestions(_x2) {\n return _handleGettingEndSearchBarSuggestions2.apply(this, arguments);\n }\n return _handleGettingEndSearchBarSuggestions;\n }()\n }, {\n key: \"_renderDesktopView\",\n value: function _renderDesktopView() {\n if (!this.directionsView) {\n return;\n }\n this.container.innerHTML = \"\";\n var element = this.directionsView.getElement();\n this.container.appendChild(element);\n this.container.classList.remove('mobile-view');\n this.container.classList.add('desktop-view');\n this.container.appendChild(this.stepsView.getElement());\n // this.element.appendChild(this.stepsView.getElement());\n }\n }, {\n key: \"_renderMobileView\",\n value: function _renderMobileView() {\n if (!this.directionsView) {\n return;\n }\n this.container.innerHTML = \"\";\n var element = this.directionsView.getElement();\n this.container.appendChild(element);\n this.container.classList.remove('desktop-view');\n this.container.classList.add('mobile-view');\n this.container.appendChild(this.stepsView.getElement());\n // this.element.appendChild(this.stepsView.getElement());\n }\n }, {\n key: \"createDirectionsLineLayer\",\n value: function createDirectionsLineLayer() {\n this.map.map.addSource('directionsLineSource', {\n 'type': 'geojson',\n 'data': {\n 'type': 'Feature',\n 'properties': {},\n 'geometry': {\n 'type': 'LineString',\n 'coordinates': []\n }\n }\n });\n\n // Add a new layer for the line\n this.map.map.addLayer({\n 'id': 'directionsLineLayer',\n 'type': 'line',\n 'source': 'directionsLineSource',\n 'layout': {\n 'line-join': 'round',\n 'line-cap': 'round'\n },\n 'paint': {\n 'line-color': '#333333',\n 'line-width': 8\n // 'line-blur': 0.9\n }\n });\n\n // this.map.map.moveLayer('directionsLineLayer', 'off-limits');\n // this.map.map.moveLayer('directionsLineLayer', '0-tertiary-area');\n this.map.map.moveLayer('directionsLineLayer', 'FIRST_ELEVATED_FEATURE');\n }\n }, {\n key: \"updateMapForPathLeg\",\n value: function updateMapForPathLeg(leg) {\n this.clearLineData();\n var points = [];\n leg.steps.forEach(function (step, index) {\n points.push.apply(points, _toConsumableArray(index === 0 ? step.path : step.path.slice(1)));\n });\n var coordinates = (0,_utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_4__.convertVerticesToCoordinates)(points, null, 30.0);\n this._updateMapLineData(coordinates, leg.floor);\n var currentFloor = this.map.getCurrentFloor();\n if (currentFloor !== leg.floor) {\n this.map.updateFloor(leg.floor, false);\n }\n }\n }, {\n key: \"_updateMapLineData\",\n value: function _updateMapLineData(newCoordinates, floor) {\n this.map.map.getSource('directionsLineSource').setData({\n 'type': 'Feature',\n 'properties': {\n '_floor': floor\n },\n 'geometry': {\n 'type': 'LineString',\n 'coordinates': newCoordinates\n }\n });\n var bounds = new mapboxgl.LngLatBounds();\n newCoordinates.forEach(function (coordinate) {\n bounds.extend(coordinate);\n });\n if (this.currentViewType === 'desktop') {\n this.map.map.fitBounds(bounds, _defineProperty(_defineProperty(_defineProperty({\n padding: 200\n }, \"padding\", {\n top: 200,\n bottom: 200,\n left: 500,\n right: 150\n }), \"maxZoom\", 15), \"duration\", 1000));\n } else {\n this.map.map.fitBounds(bounds, {\n // padding: 200, // Add padding around the edges of the map\n padding: {\n top: 350,\n bottom: 60,\n left: 80,\n right: 100\n },\n maxZoom: 14,\n // Optional: Limit the maximum zoom level\n duration: 1000 // Optional: Animation duration in milliseconds\n });\n }\n }\n }, {\n key: \"clearLineData\",\n value: function clearLineData() {\n this.map.map.getSource('directionsLineSource').setData({\n 'type': 'Feature',\n 'properties': {},\n 'geometry': {\n 'type': 'LineString',\n 'coordinates': []\n }\n });\n }\n }, {\n key: \"_handleDefaultState\",\n value: function _handleDefaultState() {\n this.hide();\n // this.clearLineData();\n this.clearData();\n }\n }, {\n key: \"_handleSearchState\",\n value: function _handleSearchState(data) {\n var query = data.query,\n results = data.results;\n this.hide();\n // this.clearLineData();\n this.clearData();\n }\n }, {\n key: \"_handleSelectedContentState\",\n value: function _handleSelectedContentState(data) {\n var contentPlacementIds = data.contentPlacementIds,\n selectedContentPlacement = data.selectedContentPlacement;\n this.hide();\n this.directionsView.updateView(null, null);\n // this.clearLineData();\n this.clearData();\n // this.map.clearSelectedContentLayer();\n this.map.clearHighlightedContentLayer();\n }\n }, {\n key: \"_handleSetupState\",\n value: function _handleSetupState() {\n this.hide();\n }\n }, {\n key: \"clearData\",\n value: function clearData() {\n this.pathData = null;\n this.clearLineData();\n this.stepsView.clear();\n }\n }, {\n key: \"_handleDirectionsState\",\n value: function () {\n var _handleDirectionsState2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(data) {\n var startContentPlacement, endContentPlacement, _convertVertexToCoord3, lat, lon, coordinate, titleKey, title, firstLocation, _convertVertexToCoord4, _lat, _lon, _coordinate;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n startContentPlacement = data.startContentPlacement, endContentPlacement = data.endContentPlacement;\n this.clearData();\n // this._initialize();\n this.show();\n // this.clearLineData();\n this.directionsView.updateView(startContentPlacement, endContentPlacement);\n if (!endContentPlacement) {\n _context3.next = 16;\n break;\n }\n _convertVertexToCoord3 = (0,_utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_4__.convertVertexToCoordinate)(endContentPlacement.location, null, 30.0), lat = _convertVertexToCoord3.lat, lon = _convertVertexToCoord3.lon;\n coordinate = [lon, lat];\n if (!endContentPlacement.name) {\n if (endContentPlacement.catalog) {\n titleKey = endContentPlacement.catalog.content_title_key;\n if (titleKey) {\n // const titleKey = endContentPlacement.content.title_key;\n title = endContentPlacement.content.data[titleKey];\n endContentPlacement.name = title;\n }\n }\n }\n endContentPlacement._floor = endContentPlacement.floor;\n this.map.addSelectedFeature(coordinate, endContentPlacement);\n if (!(this.map.location && !startContentPlacement)) {\n _context3.next = 16;\n break;\n }\n _context3.next = 13;\n return this.map.findPathFromNodeToPlacement(this.map.location, endContentPlacement.placement_id);\n case 13:\n this.pathData = _context3.sent;\n // this.map.addHighlightedFeature(coordinate, startContentPlacement);\n console;\n if (this.pathData) {\n this.directionsView.setNewPath(this.pathData, true);\n firstLocation = this.pathData.legs[0].steps[0].path[0];\n _convertVertexToCoord4 = (0,_utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_4__.convertVertexToCoordinate)(firstLocation, null, 30.0), _lat = _convertVertexToCoord4.lat, _lon = _convertVertexToCoord4.lon;\n _coordinate = [_lon, _lat];\n this.map.addHighlightedFeature(_coordinate, {\n '_floor': this.pathData.legs[0].floor,\n 'name': 'Start'\n });\n if (this.currentViewType === 'mobile') {\n this.stepsView.setNewPath(this.pathData, false);\n } else {\n this.stepsView.setNewPath(this.pathData);\n }\n this.updateMapForPathLeg(this.pathData.legs[0]);\n }\n case 16:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3, this);\n }));\n function _handleDirectionsState(_x3) {\n return _handleDirectionsState2.apply(this, arguments);\n }\n return _handleDirectionsState;\n }()\n }, {\n key: \"_handleInitiateFindPathFromLocation\",\n value: function () {\n var _handleInitiateFindPathFromLocation2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(data) {\n var endContentPlacement;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) switch (_context4.prev = _context4.next) {\n case 0:\n endContentPlacement = data.endContentPlacement;\n if (!(this.map.location && endContentPlacement)) {\n _context4.next = 6;\n break;\n }\n _context4.next = 4;\n return this.map.findPathFromNodeToPlacement(this.map.location, endContentPlacement.placement_id);\n case 4:\n this.pathData = _context4.sent;\n // this.map.addHighlightedFeature(coordinate, startContentPlacement);\n if (this.pathData) {\n this.directionsView.setNewPath(this.pathData, true);\n if (this.currentViewType === 'mobile') {\n this.stepsView.setNewPath(this.pathData, false);\n } else {\n this.stepsView.setNewPath(this.pathData);\n }\n this.updateMapForPathLeg(this.pathData.legs[0]);\n }\n case 6:\n case \"end\":\n return _context4.stop();\n }\n }, _callee4, this);\n }));\n function _handleInitiateFindPathFromLocation(_x4) {\n return _handleInitiateFindPathFromLocation2.apply(this, arguments);\n }\n return _handleInitiateFindPathFromLocation;\n }() // async _handleInitiateFindNodeToPlacementPath(data) {\n // const { startNodeId, endContentPlacementId } = data;\n // this.pathData = await this.map.findPathNodeToPlacement(startNodeId, endContentPlacementId);\n // }\n }, {\n key: \"_handleIntiateFindPath\",\n value: function () {\n var _handleIntiateFindPath2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(data) {\n var startContentPlacementId, endContentPlacementId;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) switch (_context5.prev = _context5.next) {\n case 0:\n startContentPlacementId = data.startContentPlacementId, endContentPlacementId = data.endContentPlacementId;\n _context5.next = 3;\n return this.map.findPath(startContentPlacementId, endContentPlacementId);\n case 3:\n this.pathData = _context5.sent;\n this.directionsView.setNewPath(this.pathData);\n if (this.currentViewType === 'mobile') {\n this.stepsView.setNewPath(this.pathData, false);\n } else {\n this.stepsView.setNewPath(this.pathData);\n }\n this.updateMapForPathLeg(this.pathData.legs[0]);\n case 7:\n case \"end\":\n return _context5.stop();\n }\n }, _callee5, this);\n }));\n function _handleIntiateFindPath(_x5) {\n return _handleIntiateFindPath2.apply(this, arguments);\n }\n return _handleIntiateFindPath;\n }()\n }, {\n key: \"_handleSelectDirectionsButton\",\n value: function _handleSelectDirectionsButton(data) {\n var placementId = data.placementId;\n }\n }, {\n key: \"_render\",\n value: function _render() {\n return;\n }\n }]);\n}(_core_Control__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DirectionsControl);\n\n//# sourceURL=webpack://waygomaps/./src/Controls/DirectionsControl.js?");
|
|
596
596
|
|
|
597
597
|
/***/ }),
|
|
598
598
|
|
|
@@ -603,7 +603,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
603
603
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
604
604
|
|
|
605
605
|
"use strict";
|
|
606
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _components_SliderBar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/SliderBar */ \"./src/components/SliderBar.js\");\n/* harmony import */ var _core_Control__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Control */ \"./src/core/Control.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prototype : t), e, r); return 2 & o ? function (t) { return p.apply(r, t); } : p; }\nfunction _get() { return _get = \"undefined\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }\nfunction _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\nvar FloorSelectorControl = /*#__PURE__*/function (_Control) {\n function FloorSelectorControl() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, FloorSelectorControl);\n _this = _callSuper(this, FloorSelectorControl, [options]);\n _this.floorSelectorContainerName = 'floor-selector';\n _this.floorSelector = new _components_SliderBar__WEBPACK_IMPORTED_MODULE_0__[\"default\"]([], {\n container: 'floor-selector',\n allowsToggle: false\n });\n _this.map = null;\n return _this;\n }\n _inherits(FloorSelectorControl, _Control);\n return _createClass(FloorSelectorControl, [{\n key: \"onAdd\",\n value: function onAdd(map) {\n this.map = map;\n this.container = document.createElement('div');\n this.container.className = 'floor-selector-control-container';\n var element = this.floorSelector.getElement();\n this.container.appendChild(element);\n this.initializeEventListeners();\n this._attachResizeListener();\n this._initialize();\n\n // this.show();\n\n return this.container;\n }\n }, {\n key: \"onRemove\",\n value: function onRemove() {\n _superPropGet(FloorSelectorControl, \"onRemove\", this, 3)([]);\n }\n }, {\n key: \"initializeEventListeners\",\n value: function initializeEventListeners() {\n this.floorSelector.on(\"\".concat(this.floorSelectorContainerName, \":selectNew\"), this._handleFloorSelectorSelect.bind(this));\n this.map.on('state:default', this._handleDefaultState.bind(this));\n this.map.on('state:search', this._handleSearchState.bind(this));\n this.map.on('state:selectedContent', this._handleSelectedContentState.bind(this));\n this.map.on('state:directions', this._handleDirectionsState.bind(this));\n this.map.on('state:setup', this._handleSetupState.bind(this));\n this.map.on('load', this._handleMapLoad.bind(this));\n this.map.on('floorChanged', this._handleFloorChange.bind(this));\n }\n }, {\n key: \"_handleMapLoad\",\n value: function _handleMapLoad(data) {\n var mapData = data.mapData;\n var floors = mapData.floors;\n var floorIndicators = [];\n floors.forEach(function (floor) {\n floorIndicators.push(floor.indicator);\n });\n if (floorIndicators.length < 2) {\n return;\n }\n this.floorSelector.updateItems(floorIndicators);\n this.floorSelector.selectButtonAtIndex(this.map.options.floor);\n\n // const mockFloorIndicators = ['P2', 'P1', 'L', '1', '2', '3', '4'];\n // const mockFloorIndicators = ['L1', 'L2'];\n // this.floorSelector.updateItems(mockFloorIndicators);\n }\n }, {\n key: \"_handleFloorChange\",\n value: function _handleFloorChange(data) {\n var floorIndex = data.floorIndex;\n if (this.floorSelector.getIndexOfSelectedButton() !== floorIndex) {\n this.floorSelector.selectButtonAtIndex(floorIndex);\n }\n }\n }, {\n key: \"_renderDesktopView\",\n value: function _renderDesktopView() {\n // TO RENDER DESKTOP VIEW\n var element = this.floorSelector.getElement();\n this.container.appendChild(element);\n this.container.classList.remove('mobile-view');\n this.container.classList.add('desktop-view');\n var newWidth = this.map.mapContainer.offsetWidth;\n this.floorSelector.setViewForDesktop();\n }\n }, {\n key: \"_renderMobileView\",\n value: function _renderMobileView() {\n var element = this.floorSelector.getElement();\n this.container.appendChild(element);\n var newWidth = this.map.mapContainer.offsetWidth;\n this.container.classList.remove('desktop-view');\n this.container.classList.add('mobile-view');\n this.floorSelector.setViewForMobile();\n }\n }, {\n key: \"_handleDefaultState\",\n value: function _handleDefaultState() {\n this.show();\n // this.floorSelector.deselectAll();\n }\n }, {\n key: \"_handleSelectedContentState\",\n value: function _handleSelectedContentState(_) {\n if (this.currentViewType === 'mobile') {\n this.hide();\n } else {\n this.show();\n }\n }\n }, {\n key: \"_handleDirectionsState\",\n value: function _handleDirectionsState(_) {\n this.hide();\n return;\n }\n\n // Have to update it for selecting floor and also for ____\n }, {\n key: \"_handleFloorSelectorSelect\",\n value: function _handleFloorSelectorSelect(data) {\n var query = data.query,\n index = data.index;\n var currentFloor = this.map.getCurrentFloor();\n if (index !== currentFloor) {\n this.map.updateFloor(index);\n }\n
|
|
606
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _components_SliderBar__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/SliderBar */ \"./src/components/SliderBar.js\");\n/* harmony import */ var _core_Control__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Control */ \"./src/core/Control.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prototype : t), e, r); return 2 & o ? function (t) { return p.apply(r, t); } : p; }\nfunction _get() { return _get = \"undefined\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }\nfunction _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\nvar FloorSelectorControl = /*#__PURE__*/function (_Control) {\n function FloorSelectorControl() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, FloorSelectorControl);\n _this = _callSuper(this, FloorSelectorControl, [options]);\n _this.floorSelectorContainerName = 'floor-selector';\n _this.floorSelector = new _components_SliderBar__WEBPACK_IMPORTED_MODULE_0__[\"default\"]([], {\n container: 'floor-selector',\n allowsToggle: false\n });\n _this.map = null;\n return _this;\n }\n _inherits(FloorSelectorControl, _Control);\n return _createClass(FloorSelectorControl, [{\n key: \"onAdd\",\n value: function onAdd(map) {\n this.map = map;\n this.container = document.createElement('div');\n this.container.className = 'floor-selector-control-container';\n var element = this.floorSelector.getElement();\n this.container.appendChild(element);\n this.initializeEventListeners();\n this._attachResizeListener();\n this._initialize();\n\n // this.show();\n\n return this.container;\n }\n }, {\n key: \"onRemove\",\n value: function onRemove() {\n _superPropGet(FloorSelectorControl, \"onRemove\", this, 3)([]);\n }\n }, {\n key: \"initializeEventListeners\",\n value: function initializeEventListeners() {\n this.floorSelector.on(\"\".concat(this.floorSelectorContainerName, \":selectNew\"), this._handleFloorSelectorSelect.bind(this));\n this.map.on('state:default', this._handleDefaultState.bind(this));\n this.map.on('state:search', this._handleSearchState.bind(this));\n this.map.on('state:selectedContent', this._handleSelectedContentState.bind(this));\n this.map.on('state:directions', this._handleDirectionsState.bind(this));\n this.map.on('state:setup', this._handleSetupState.bind(this));\n this.map.on('load', this._handleMapLoad.bind(this));\n this.map.on('floorChanged', this._handleFloorChange.bind(this));\n }\n }, {\n key: \"_handleMapLoad\",\n value: function _handleMapLoad(data) {\n var mapData = data.mapData;\n var floors = mapData.floors;\n var floorIndicators = [];\n floors.forEach(function (floor) {\n floorIndicators.push(floor.indicator);\n });\n if (floorIndicators.length < 2) {\n return;\n }\n this.floorSelector.updateItems(floorIndicators);\n this.floorSelector.selectButtonAtIndex(this.map.options.floor);\n\n // const mockFloorIndicators = ['P2', 'P1', 'L', '1', '2', '3', '4'];\n // const mockFloorIndicators = ['L1', 'L2'];\n // this.floorSelector.updateItems(mockFloorIndicators);\n }\n }, {\n key: \"_handleFloorChange\",\n value: function _handleFloorChange(data) {\n var floorIndex = data.floorIndex;\n if (this.floorSelector.getIndexOfSelectedButton() !== floorIndex) {\n this.floorSelector.selectButtonAtIndex(floorIndex);\n }\n }\n }, {\n key: \"_renderDesktopView\",\n value: function _renderDesktopView() {\n // TO RENDER DESKTOP VIEW\n var element = this.floorSelector.getElement();\n this.container.appendChild(element);\n this.container.classList.remove('mobile-view');\n this.container.classList.add('desktop-view');\n var newWidth = this.map.mapContainer.offsetWidth;\n this.floorSelector.setViewForDesktop();\n }\n }, {\n key: \"_renderMobileView\",\n value: function _renderMobileView() {\n var element = this.floorSelector.getElement();\n this.container.appendChild(element);\n var newWidth = this.map.mapContainer.offsetWidth;\n this.container.classList.remove('desktop-view');\n this.container.classList.add('mobile-view');\n this.floorSelector.setViewForMobile();\n }\n }, {\n key: \"_handleDefaultState\",\n value: function _handleDefaultState() {\n this.show();\n // this.floorSelector.deselectAll();\n }\n }, {\n key: \"_handleSelectedContentState\",\n value: function _handleSelectedContentState(_) {\n if (this.currentViewType === 'mobile') {\n this.hide();\n } else {\n this.show();\n }\n }\n }, {\n key: \"_handleDirectionsState\",\n value: function _handleDirectionsState(_) {\n this.hide();\n return;\n }\n\n // Have to update it for selecting floor and also for ____\n }, {\n key: \"_handleFloorSelectorSelect\",\n value: function _handleFloorSelectorSelect(data) {\n var query = data.query,\n index = data.index;\n var currentFloor = this.map.getCurrentFloor();\n if (index !== currentFloor) {\n this.map.updateFloor(index);\n }\n }\n }, {\n key: \"_handleSearchState\",\n value: function _handleSearchState(data) {\n var query = data.query,\n results = data.results;\n this.show();\n // this.floorSelector.deselectAllNotMatchingQuery(this.floorSelector.selectedValue);\n }\n }, {\n key: \"_handleSetupState\",\n value: function _handleSetupState() {\n this.show();\n }\n }]);\n}(_core_Control__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (FloorSelectorControl);\n\n// db.attachments_collection.updateOne({ _id: ObjectId(\"6748819a8db2dc30f9669793\") }, { $set: { \"criteria.0\": { host_key: \"name\", child_key: \"Room Number\", operator: \"==\", value: null } }});\n\n//# sourceURL=webpack://waygomaps/./src/Controls/FloorSelectorControl.js?");
|
|
607
607
|
|
|
608
608
|
/***/ }),
|
|
609
609
|
|
|
@@ -614,7 +614,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
614
614
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
615
615
|
|
|
616
616
|
"use strict";
|
|
617
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var webpack__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! webpack */ \"./node_modules/webpack/lib/index.js\");\n/* harmony import */ var webpack__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(webpack__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _core_Control__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Control */ \"./src/core/Control.js\");\n/* harmony import */ var _utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/coordinateSystems */ \"./src/utils/coordinateSystems.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prototype : t), e, r); return 2 & o ? function (t) { return p.apply(r, t); } : p; }\nfunction _get() { return _get = \"undefined\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }\nfunction _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\nvar InteractionControl = /*#__PURE__*/function (_Control) {\n function InteractionControl() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, InteractionControl);\n _this = _callSuper(this, InteractionControl, [options]);\n _this.map = null;\n _this.previouslySelectedFeature = null;\n _this.previouslySelectedIcon = null;\n _this.previouslySelectedTextColor = null;\n _this.previouslySelectedTextOffset = null;\n _this.previouslyHoveredFeature = null;\n _this.originalTextColor = null;\n _this.textColorReference = {};\n _this.currentView = null; // Can be set to 'desktop' or 'mobile'\n\n _this.selectedTextColor = '#BE2E28';\n _this.interactionEnabled = true;\n return _this;\n }\n _inherits(InteractionControl, _Control);\n return _createClass(InteractionControl, [{\n key: \"onAdd\",\n value: function onAdd(map) {\n this.map = map;\n this.container = document.createElement('div');\n this.container.className = 'interaction-control-container';\n this.initializeEventListeners();\n this._attachResizeListener();\n this._initialize();\n this.createHighlightedContentLayer();\n this.createSelectedContentLayer();\n this.storeTextColorReferences();\n // this.applyHoverEffectToAllSymbolLayers();\n\n return this.container;\n }\n }, {\n key: \"_initialize\",\n value: function _initialize() {\n var containerWidth = this.map.mapContainer.offsetWidth;\n this._configureView(containerWidth);\n }\n }, {\n key: \"onRemove\",\n value: function onRemove() {\n _superPropGet(InteractionControl, \"onRemove\", this, 3)([]);\n }\n\n // _attachResizeListener() {\n // window.addEventListener('resize', () => {\n // const newWidth = this.map.mapContainer.offsetWidth;\n // this._configureView(newWidth);\n // });\n // }\n }, {\n key: \"_configureView\",\n value: function _configureView(width) {\n if (width > 767) {\n this._setViewForDesktop();\n } else {\n this._setViewForMobile();\n }\n }\n }, {\n key: \"_setViewForDesktop\",\n value: function _setViewForDesktop() {\n this.currentView = 'desktop';\n }\n }, {\n key: \"_setViewForMobile\",\n value: function _setViewForMobile() {\n this.currentView = 'mobile';\n }\n }, {\n key: \"initializeEventListeners\",\n value: function initializeEventListeners() {\n var _this2 = this;\n this.map.map.on('styleimagemissing', function (e) {\n var missingImage = e.id;\n console.warn(\"Image \\\"\".concat(missingImage, \"\\\" could not be loaded.\"));\n });\n this.map.map.on('click', function (e) {\n _this2._handleClick(e);\n });\n this.map.on('state:default', this._handleDefaultState.bind(this));\n this.map.on('state:search', this._handleSearchState.bind(this));\n this.map.on('state:selectedContent', this._handleSelectedContentState.bind(this));\n this.map.on('state:directions', this._handleDirectionsState.bind(this));\n this.map.on('state:setup', this._handleSetupState.bind(this));\n this.map.on('additionalSearchResults', this._handleAdditionalSearch.bind(this));\n this.map.on('hoverSearchResult', this._handleHoverSearchResult.bind(this));\n this.map.on('hoverEndSearchResult', this._handleHoverEndSearchResult.bind(this));\n }\n }, {\n key: \"storeTextColorReferences\",\n value: function storeTextColorReferences() {\n var _this3 = this;\n var layers = this.map.map.getStyle().layers;\n layers.forEach(function (layer) {\n if (layer.type === 'symbol') {\n var textColor = _this3.map.map.getPaintProperty(layer.id, 'text-color');\n if (textColor !== undefined) {\n _this3.textColorReference[layer.id] = textColor; // Store the text color reference using the layer ID as the key\n }\n }\n });\n }\n }, {\n key: \"createSelectedContentLayer\",\n value: function createSelectedContentLayer() {\n this.map.map.addSource('selected-content', {\n 'type': 'geojson',\n 'data': {\n 'type': 'FeatureCollection',\n 'features': [] // Initially empty, you will add features dynamically\n }\n });\n\n // Add a layer that references this GeoJSON source and matches the styling in your Mapbox Studio project\n this.map.map.addLayer({\n 'id': 'selected-content-layer',\n 'type': 'symbol',\n // Or 'fill', 'line', etc. based on your needs\n 'source': 'selected-content',\n 'layout': {\n 'text-field': ['get', 'name'],\n 'text-font': ['Inter Medium'],\n 'text-size': 14,\n 'text-justify': 'left',\n 'text-anchor': 'bottom-left',\n 'text-offset': [1.3, -1],\n 'icon-image': 'selected-pin',\n 'icon-size': 0.5,\n 'icon-offset': [0, -5],\n 'icon-anchor': 'bottom',\n 'symbol-z-elevate': true,\n 'text-padding': 10,\n 'icon-padding': 5\n },\n 'paint': {\n 'text-color': '#BE2E28',\n 'text-halo-color': '#ffffff',\n 'text-halo-width': 1\n }\n });\n }\n }, {\n key: \"createHighlightedContentLayer\",\n value: function createHighlightedContentLayer() {\n this.map.map.addSource('highlighted-content', {\n 'type': 'geojson',\n 'data': {\n 'type': 'FeatureCollection',\n 'features': []\n }\n });\n this.map.map.addLayer({\n 'id': 'highlighted-content-layer',\n 'type': 'symbol',\n 'source': 'highlighted-content',\n 'layout': {\n 'text-field': ['get', 'name'],\n 'text-font': ['Inter Medium'],\n 'text-size': 14,\n 'text-justify': 'left',\n 'text-anchor': 'bottom-left',\n 'text-offset': [1.2, -0.6],\n 'icon-image': 'highlightedPin',\n 'icon-size': 0.5,\n 'icon-offset': [0, -5],\n 'icon-anchor': 'bottom',\n 'symbol-z-elevate': true,\n 'text-padding': 5,\n 'icon-padding': 5\n },\n 'paint': {\n 'text-color': '#1E1E1E',\n 'text-halo-color': '#ffffff',\n 'text-halo-width': 1\n }\n });\n }\n\n // clearSelectedContentLayer() {\n // this.map.map.getSource('selected-content').setData({\n // 'type': 'FeatureCollection',\n // 'features': []\n // });\n // }\n\n // clearHighlightedContentLayer() {\n // this.map.map.getSource('highlighted-content').setData({\n // 'type': 'FeatureCollection',\n // 'features': []\n // });\n // }\n\n // addSelectedFeature(coordinates, properties) {\n // const source = this.map.map.getSource('selected-content');\n // const currentData = source._data;\n // const newFeature = {\n // 'type': 'Feature',\n // 'geometry': {\n // 'type': 'Point',\n // 'coordinates': coordinates\n // },\n // 'properties': properties\n // };\n // currentData.features.push(newFeature);\n // source.setData(currentData);\n // }\n\n // addHighlightedFeature(coordinates, properties) {\n // const source = this.map.map.getSource('highlighted-content');\n // const currentData = source._data;\n // const newFeature = {\n // 'type': 'Feature',\n // 'geometry': {\n // 'type': 'Point',\n // 'coordinates': coordinates\n // },\n // 'properties': properties\n // };\n // currentData.features.push(newFeature);\n // source.setData(currentData);\n\n // return newFeature;\n // }\n }, {\n key: \"_handleDefaultState\",\n value: function _handleDefaultState() {\n this.interactionEnabled = true;\n this.applyHoverEffectToAllSymbolLayers();\n this.map.clearHighlightedContentLayer();\n this.map.clearSelectedContentLayer();\n this.showSymbolLayers();\n }\n }, {\n key: \"_handleSearchState\",\n value: function _handleSearchState(data) {\n var query = data.query,\n results = data.results;\n this.interactionEnabled = true;\n this.applyHoverEffectToAllSymbolLayers();\n this.hideSymbolLayers();\n this.map.clearSelectedContentLayer();\n\n // Find the floor with the most results\n var floorCounts = results.reduce(function (acc, result) {\n acc[result.floor] = (acc[result.floor] || 0) + 1;\n return acc;\n }, {});\n\n // Get the floor with the highest count\n var bestFloor = Object.entries(floorCounts).reduce(function (a, b) {\n return b[1] > a[1] ? b : a;\n }, [0, 0])[0];\n\n // Only switch floors if none of the results are on the current floor\n var currentFloor = this.map.getCurrentFloor();\n var hasResultsOnCurrentFloor = results.some(function (result) {\n return result.floor === currentFloor;\n });\n console.log('bestFloor', bestFloor);\n var chosenFloor = currentFloor;\n if (!hasResultsOnCurrentFloor) {\n console.log('no results on current floor');\n chosenFloor = bestFloor;\n this.map.updateFloor(parseInt(chosenFloor));\n }\n chosenFloor = parseInt(chosenFloor);\n console.log('chosenFloor', chosenFloor);\n this.updateLabelsForSearchResults(results, true, chosenFloor);\n }\n }, {\n key: \"_handleAdditionalSearch\",\n value: function _handleAdditionalSearch(data) {\n var results = data.results;\n this.updateLabelsForSearchResults(results, true);\n }\n }, {\n key: \"_handleHoverSearchResult\",\n value: function _handleHoverSearchResult(data) {\n var result = data.result;\n this.updateLabelForSelectedContentPlacement(result, false);\n }\n }, {\n key: \"_handleHoverEndSearchResult\",\n value: function _handleHoverEndSearchResult() {\n if (this.map.getCurrentState() === 'search') {\n this.map.clearSelectedContentLayer();\n }\n }\n }, {\n key: \"_handleSelectedContentState\",\n value: function _handleSelectedContentState(data) {\n var contentPlacementIds = data.contentPlacementIds,\n selectedContentPlacement = data.selectedContentPlacement;\n this.interactionEnabled = true;\n this.applyHoverEffectToAllSymbolLayers();\n // console.log(\"SELECTED CONTENT STATE\");\n console.log(selectedContentPlacement);\n this.updateLabelForSelectedContentPlacement(selectedContentPlacement);\n }\n }, {\n key: \"_handleDirectionsState\",\n value: function _handleDirectionsState(data) {\n this.interactionEnabled = false;\n this.removeHoverEffects();\n this.showSymbolLayers();\n return;\n }\n }, {\n key: \"_handleSetupState\",\n value: function _handleSetupState() {\n this.interactionEnabled = false;\n this.removeHoverEffects();\n }\n }, {\n key: \"hideSymbolLayers\",\n value: function hideSymbolLayers() {\n var _this4 = this;\n var layers = this.map.map.getStyle().layers;\n layers.forEach(function (layer) {\n if (layer.type === 'symbol' && layer.id !== 'selected-content-layer' && layer.id !== 'highlighted-content-layer') {\n _this4.map.map.setLayoutProperty(layer.id, 'visibility', 'none');\n }\n });\n }\n }, {\n key: \"showSymbolLayers\",\n value: function showSymbolLayers() {\n var _this5 = this;\n var layers = this.map.map.getStyle().layers;\n layers.forEach(function (layer) {\n if (layer.type === 'symbol') {\n _this5.map.map.setLayoutProperty(layer.id, 'visibility', 'visible');\n }\n });\n }\n }, {\n key: \"updateLabelsForSearchResults\",\n value: function updateLabelsForSearchResults(results) {\n var _this6 = this;\n var animate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n var floor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n console.log('chosen floor', floor);\n if (floor === null) {\n floor = this.map.getCurrentFloor();\n console.log('floor is null, using current floor', floor);\n }\n this.map.clearHighlightedContentLayer();\n var features = [];\n var featuresOnFloor = [];\n results.forEach(function (result) {\n // console.log(\"result\", floor, result);\n result._floor = result.floor;\n var coordinates = (0,_utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_2__.convertVerticesToCoordinates)([result.location], null, 30.0);\n var coordinate = coordinates[0];\n var titleKey = result.catalog.content_title_key;\n result.name = result.content.data[titleKey];\n var feature = _this6.map.addHighlightedFeature(coordinate, result);\n features.push(feature);\n if (result.floor === floor) {\n featuresOnFloor.push(feature);\n }\n });\n if (featuresOnFloor.length && animate) {\n var bounds = new mapboxgl.LngLatBounds();\n featuresOnFloor.forEach(function (feature) {\n bounds.extend(feature.geometry.coordinates);\n });\n if (this.currentView === 'desktop') {\n this.map.map.fitBounds(bounds, {\n padding: {\n top: 50,\n bottom: 50,\n left: 350,\n right: 50\n },\n maxZoom: 15,\n pitch: 45,\n bearing: -37,\n duration: 1000\n });\n } else if (this.currentView === 'mobile') {\n var mapHeight = this.map.mapContainer.offsetHeight;\n var mapWidth = this.map.mapContainer.offsetWidth;\n var bottomPaddingPercent = 45;\n var sidePaddingPercent = 8;\n var bottomPaddingInPixels = mapHeight * (bottomPaddingPercent / 100);\n var sidePaddingInPixels = mapWidth * (sidePaddingPercent / 100);\n this.map.map.fitBounds(bounds, {\n padding: {\n top: 150,\n bottom: bottomPaddingInPixels,\n left: sidePaddingInPixels,\n right: sidePaddingInPixels + 95\n },\n maxZoom: 16,\n pitch: 45,\n bearing: -37,\n duration: 1000\n });\n }\n }\n }\n }, {\n key: \"updateLabelForSelectedContentPlacement\",\n value: function updateLabelForSelectedContentPlacement(result) {\n var animate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n // console.log(\"UPDATE LABEL FOR SELECTED CONTENT PLACEMENT\");\n // console.log(result);\n this.map.clearSelectedContentLayer();\n var coordinates = (0,_utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_2__.convertVerticesToCoordinates)([result.location], null, 30.0);\n // console.log(\"COORDINATES\");\n // console.log(coordinates);\n var coordinate = coordinates[0];\n result._floor = result.floor;\n // console.log(\"floor\");\n // console.log(result._floor);\n if (!result.name) {\n // console.log('no result name');\n if (result.content && result.catalog) {\n // console.log('result content and catalog');\n var title_key = result.catalog.content_title_key;\n var title = result.content.data[title_key];\n result.name = title;\n }\n }\n\n // console.log(\"coordinate\");\n // console.log(coordinate);\n\n this.map.addSelectedFeature(coordinate, result);\n if (animate) {\n if (this.currentView === 'desktop') {\n this.map.map.easeTo({\n center: coordinate,\n padding: {\n top: 0,\n bottom: 0,\n left: 330,\n right: 0\n },\n duration: 1000\n });\n } else if (this.currentView === 'mobile') {\n var mapHeight = this.map.mapContainer.offsetHeight;\n var bottomPaddingPercent = 35;\n var bottomPaddingInPixels = mapHeight * (bottomPaddingPercent / 100);\n this.map.map.easeTo({\n center: coordinate,\n padding: {\n top: 0,\n bottom: bottomPaddingInPixels,\n left: 0,\n right: 0\n },\n duration: 1000\n });\n }\n }\n }\n }, {\n key: \"applyHoverEffectToAllSymbolLayers\",\n value: function applyHoverEffectToAllSymbolLayers() {\n var _this7 = this;\n var layers = this.map.map.getStyle().layers;\n layers.forEach(function (layer) {\n if (layer.type === 'symbol') {\n var layerId = layer.id;\n var defaultTextColor = _this7.textColorReference[layerId];\n _this7.map.map.on('mouseenter', layerId, function (e) {\n var feature = e.features[0];\n var placementId = feature.properties.placement_id;\n if (!_this7.previouslySelectedFeature || _this7.previouslySelectedFeature.layer.id !== feature.layer.id) {\n _this7.originalTextColor = _this7.map.map.getPaintProperty(layerId, 'text-color');\n _this7.map.map.setPaintProperty(layerId, 'text-color', ['case', ['==', ['get', 'placement_id'], placementId], '#4B90F7', defaultTextColor]);\n } else {\n _this7.originalTextColor = _this7.previouslySelectedTextColor;\n var previouslySelectedPlacementId = _this7.previouslySelectedFeature.properties.placement_id;\n _this7.map.map.setPaintProperty(layerId, 'text-color', ['case', ['==', ['get', 'placement_id'], placementId], '#4B90F7', ['==', ['get', 'placement_id'], previouslySelectedPlacementId], _this7.selectedTextColor, defaultTextColor]);\n }\n _this7.map.map.getCanvas().style.cursor = 'pointer';\n });\n _this7.map.map.on('mouseleave', layerId, function () {\n if (!_this7.previouslySelectedFeature) {\n _this7.map.map.setPaintProperty(layerId, 'text-color', defaultTextColor);\n } else {\n // If a feature is selected, maintain its selected color\n var previouslySelectedPlacementId = _this7.previouslySelectedFeature.properties.placement_id;\n _this7.map.map.setPaintProperty(layerId, 'text-color', ['case', ['==', ['get', 'placement_id'], previouslySelectedPlacementId], _this7.selectedTextColor, defaultTextColor]);\n }\n _this7.map.map.getCanvas().style.cursor = 'default';\n });\n }\n });\n }\n }, {\n key: \"removeHoverEffects\",\n value: function removeHoverEffects() {\n var _this8 = this;\n var layers = this.map.map.getStyle().layers;\n layers.forEach(function (layer) {\n if (layer.type === 'symbol') {\n var layerId = layer.id;\n // Reset to default text color\n var defaultTextColor = _this8.textColorReference[layerId];\n _this8.map.map.setPaintProperty(layerId, 'text-color', defaultTextColor);\n\n // Remove event listeners\n _this8.map.map.off('mouseenter', layerId);\n _this8.map.map.off('mouseleave', layerId);\n }\n });\n this.map.map.getCanvas().style.cursor = 'default';\n }\n }, {\n key: \"_handleClick\",\n value: function _handleClick(e) {\n if (!this.interactionEnabled) return;\n var features = this.map.map.queryRenderedFeatures(e.point);\n var symbolFeatures = features.filter(function (feature) {\n return feature.layer.type === 'symbol';\n });\n if (symbolFeatures.length > 0) {\n var placementId = symbolFeatures[0].properties.placement_id;\n this.map.setToSelectedContentState([placementId]);\n }\n }\n }]);\n}(_core_Control__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (InteractionControl);\n\n//# sourceURL=webpack://waygomaps/./src/Controls/InteractionControl.js?");
|
|
617
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var webpack__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! webpack */ \"./node_modules/webpack/lib/index.js\");\n/* harmony import */ var webpack__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(webpack__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _core_Control__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Control */ \"./src/core/Control.js\");\n/* harmony import */ var _utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/coordinateSystems */ \"./src/utils/coordinateSystems.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prototype : t), e, r); return 2 & o ? function (t) { return p.apply(r, t); } : p; }\nfunction _get() { return _get = \"undefined\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }\nfunction _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\nvar InteractionControl = /*#__PURE__*/function (_Control) {\n function InteractionControl() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, InteractionControl);\n _this = _callSuper(this, InteractionControl, [options]);\n _this.map = null;\n _this.previouslySelectedFeature = null;\n _this.previouslySelectedIcon = null;\n _this.previouslySelectedTextColor = null;\n _this.previouslySelectedTextOffset = null;\n _this.previouslyHoveredFeature = null;\n _this.originalTextColor = null;\n _this.textColorReference = {};\n _this.currentView = null; // Can be set to 'desktop' or 'mobile'\n\n _this.selectedTextColor = '#BE2E28';\n _this.interactionEnabled = true;\n return _this;\n }\n _inherits(InteractionControl, _Control);\n return _createClass(InteractionControl, [{\n key: \"onAdd\",\n value: function onAdd(map) {\n this.map = map;\n this.container = document.createElement('div');\n this.container.className = 'interaction-control-container';\n this.initializeEventListeners();\n this._attachResizeListener();\n this._initialize();\n this.createHighlightedContentLayer();\n this.createSelectedContentLayer();\n this.storeTextColorReferences();\n // this.applyHoverEffectToAllSymbolLayers();\n\n return this.container;\n }\n }, {\n key: \"_initialize\",\n value: function _initialize() {\n var containerWidth = this.map.mapContainer.offsetWidth;\n this._configureView(containerWidth);\n }\n }, {\n key: \"onRemove\",\n value: function onRemove() {\n _superPropGet(InteractionControl, \"onRemove\", this, 3)([]);\n }\n\n // _attachResizeListener() {\n // window.addEventListener('resize', () => {\n // const newWidth = this.map.mapContainer.offsetWidth;\n // this._configureView(newWidth);\n // });\n // }\n }, {\n key: \"_configureView\",\n value: function _configureView(width) {\n if (width > 767) {\n this._setViewForDesktop();\n } else {\n this._setViewForMobile();\n }\n }\n }, {\n key: \"_setViewForDesktop\",\n value: function _setViewForDesktop() {\n this.currentView = 'desktop';\n }\n }, {\n key: \"_setViewForMobile\",\n value: function _setViewForMobile() {\n this.currentView = 'mobile';\n }\n }, {\n key: \"initializeEventListeners\",\n value: function initializeEventListeners() {\n var _this2 = this;\n this.map.map.on('styleimagemissing', function (e) {\n var missingImage = e.id;\n console.warn(\"Image \\\"\".concat(missingImage, \"\\\" could not be loaded.\"));\n });\n this.map.map.on('click', function (e) {\n _this2._handleClick(e);\n });\n this.map.on('state:default', this._handleDefaultState.bind(this));\n this.map.on('state:search', this._handleSearchState.bind(this));\n this.map.on('state:selectedContent', this._handleSelectedContentState.bind(this));\n this.map.on('state:directions', this._handleDirectionsState.bind(this));\n this.map.on('state:setup', this._handleSetupState.bind(this));\n this.map.on('additionalSearchResults', this._handleAdditionalSearch.bind(this));\n this.map.on('hoverSearchResult', this._handleHoverSearchResult.bind(this));\n this.map.on('hoverEndSearchResult', this._handleHoverEndSearchResult.bind(this));\n }\n }, {\n key: \"storeTextColorReferences\",\n value: function storeTextColorReferences() {\n var _this3 = this;\n var layers = this.map.map.getStyle().layers;\n layers.forEach(function (layer) {\n if (layer.type === 'symbol') {\n var textColor = _this3.map.map.getPaintProperty(layer.id, 'text-color');\n if (textColor !== undefined) {\n _this3.textColorReference[layer.id] = textColor; // Store the text color reference using the layer ID as the key\n }\n }\n });\n }\n }, {\n key: \"createSelectedContentLayer\",\n value: function createSelectedContentLayer() {\n this.map.map.addSource('selected-content', {\n 'type': 'geojson',\n 'data': {\n 'type': 'FeatureCollection',\n 'features': [] // Initially empty, you will add features dynamically\n }\n });\n\n // Add a layer that references this GeoJSON source and matches the styling in your Mapbox Studio project\n this.map.map.addLayer({\n 'id': 'selected-content-layer',\n 'type': 'symbol',\n // Or 'fill', 'line', etc. based on your needs\n 'source': 'selected-content',\n 'layout': {\n 'text-field': ['get', 'name'],\n 'text-font': ['Inter Medium'],\n 'text-size': 14,\n 'text-justify': 'left',\n 'text-anchor': 'bottom-left',\n 'text-offset': [1.3, -1],\n 'icon-image': 'selected-pin',\n 'icon-size': 0.5,\n 'icon-offset': [0, -5],\n 'icon-anchor': 'bottom',\n 'symbol-z-elevate': true,\n 'text-padding': 10,\n 'icon-padding': 5\n },\n 'paint': {\n 'text-color': '#BE2E28',\n 'text-halo-color': '#ffffff',\n 'text-halo-width': 1\n }\n });\n }\n }, {\n key: \"createHighlightedContentLayer\",\n value: function createHighlightedContentLayer() {\n this.map.map.addSource('highlighted-content', {\n 'type': 'geojson',\n 'data': {\n 'type': 'FeatureCollection',\n 'features': []\n }\n });\n this.map.map.addLayer({\n 'id': 'highlighted-content-layer',\n 'type': 'symbol',\n 'source': 'highlighted-content',\n 'layout': {\n 'text-field': ['get', 'name'],\n 'text-font': ['Inter Medium'],\n 'text-size': 14,\n 'text-justify': 'left',\n 'text-anchor': 'bottom-left',\n 'text-offset': [1.2, -0.6],\n 'icon-image': 'highlightedPin',\n 'icon-size': 0.5,\n 'icon-offset': [0, -5],\n 'icon-anchor': 'bottom',\n 'symbol-z-elevate': true,\n 'text-padding': 5,\n 'icon-padding': 5\n },\n 'paint': {\n 'text-color': '#1E1E1E',\n 'text-halo-color': '#ffffff',\n 'text-halo-width': 1\n }\n });\n }\n\n // clearSelectedContentLayer() {\n // this.map.map.getSource('selected-content').setData({\n // 'type': 'FeatureCollection',\n // 'features': []\n // });\n // }\n\n // clearHighlightedContentLayer() {\n // this.map.map.getSource('highlighted-content').setData({\n // 'type': 'FeatureCollection',\n // 'features': []\n // });\n // }\n\n // addSelectedFeature(coordinates, properties) {\n // const source = this.map.map.getSource('selected-content');\n // const currentData = source._data;\n // const newFeature = {\n // 'type': 'Feature',\n // 'geometry': {\n // 'type': 'Point',\n // 'coordinates': coordinates\n // },\n // 'properties': properties\n // };\n // currentData.features.push(newFeature);\n // source.setData(currentData);\n // }\n\n // addHighlightedFeature(coordinates, properties) {\n // const source = this.map.map.getSource('highlighted-content');\n // const currentData = source._data;\n // const newFeature = {\n // 'type': 'Feature',\n // 'geometry': {\n // 'type': 'Point',\n // 'coordinates': coordinates\n // },\n // 'properties': properties\n // };\n // currentData.features.push(newFeature);\n // source.setData(currentData);\n\n // return newFeature;\n // }\n }, {\n key: \"_handleDefaultState\",\n value: function _handleDefaultState() {\n this.interactionEnabled = true;\n this.applyHoverEffectToAllSymbolLayers();\n this.map.clearHighlightedContentLayer();\n this.map.clearSelectedContentLayer();\n this.showSymbolLayers();\n }\n }, {\n key: \"_handleSearchState\",\n value: function _handleSearchState(data) {\n var query = data.query,\n results = data.results;\n this.interactionEnabled = true;\n this.applyHoverEffectToAllSymbolLayers();\n this.hideSymbolLayers();\n this.map.clearSelectedContentLayer();\n\n // Find the floor with the most results\n var floorCounts = results.reduce(function (acc, result) {\n acc[result.floor] = (acc[result.floor] || 0) + 1;\n return acc;\n }, {});\n\n // Get the floor with the highest count\n var bestFloor = Object.entries(floorCounts).reduce(function (a, b) {\n return b[1] > a[1] ? b : a;\n }, [0, 0])[0];\n\n // Only switch floors if none of the results are on the current floor\n var currentFloor = this.map.getCurrentFloor();\n var hasResultsOnCurrentFloor = results.some(function (result) {\n return result.floor === currentFloor;\n });\n var chosenFloor = currentFloor;\n if (!hasResultsOnCurrentFloor) {\n chosenFloor = bestFloor;\n this.map.updateFloor(parseInt(chosenFloor));\n }\n chosenFloor = parseInt(chosenFloor);\n this.updateLabelsForSearchResults(results, true, chosenFloor);\n }\n }, {\n key: \"_handleAdditionalSearch\",\n value: function _handleAdditionalSearch(data) {\n var results = data.results;\n this.updateLabelsForSearchResults(results, true);\n }\n }, {\n key: \"_handleHoverSearchResult\",\n value: function _handleHoverSearchResult(data) {\n var result = data.result;\n this.updateLabelForSelectedContentPlacement(result, false);\n }\n }, {\n key: \"_handleHoverEndSearchResult\",\n value: function _handleHoverEndSearchResult() {\n if (this.map.getCurrentState() === 'search') {\n this.map.clearSelectedContentLayer();\n }\n }\n }, {\n key: \"_handleSelectedContentState\",\n value: function _handleSelectedContentState(data) {\n var contentPlacementIds = data.contentPlacementIds,\n selectedContentPlacement = data.selectedContentPlacement;\n this.interactionEnabled = true;\n this.applyHoverEffectToAllSymbolLayers();\n this.updateLabelForSelectedContentPlacement(selectedContentPlacement);\n }\n }, {\n key: \"_handleDirectionsState\",\n value: function _handleDirectionsState(data) {\n this.interactionEnabled = false;\n this.removeHoverEffects();\n this.showSymbolLayers();\n return;\n }\n }, {\n key: \"_handleSetupState\",\n value: function _handleSetupState() {\n this.interactionEnabled = false;\n this.removeHoverEffects();\n }\n }, {\n key: \"hideSymbolLayers\",\n value: function hideSymbolLayers() {\n var _this4 = this;\n var layers = this.map.map.getStyle().layers;\n layers.forEach(function (layer) {\n if (layer.type === 'symbol' && layer.id !== 'selected-content-layer' && layer.id !== 'highlighted-content-layer') {\n _this4.map.map.setLayoutProperty(layer.id, 'visibility', 'none');\n }\n });\n }\n }, {\n key: \"showSymbolLayers\",\n value: function showSymbolLayers() {\n var _this5 = this;\n var layers = this.map.map.getStyle().layers;\n layers.forEach(function (layer) {\n if (layer.type === 'symbol') {\n _this5.map.map.setLayoutProperty(layer.id, 'visibility', 'visible');\n }\n });\n }\n }, {\n key: \"updateLabelsForSearchResults\",\n value: function updateLabelsForSearchResults(results) {\n var _this6 = this;\n var animate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n var floor = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : null;\n if (floor === null) {\n floor = this.map.getCurrentFloor();\n }\n this.map.clearHighlightedContentLayer();\n var features = [];\n var featuresOnFloor = [];\n results.forEach(function (result) {\n result._floor = result.floor;\n var coordinates = (0,_utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_2__.convertVerticesToCoordinates)([result.location], null, 30.0);\n var coordinate = coordinates[0];\n var titleKey = result.catalog.content_title_key;\n result.name = result.content.data[titleKey];\n var feature = _this6.map.addHighlightedFeature(coordinate, result);\n features.push(feature);\n if (result.floor === floor) {\n featuresOnFloor.push(feature);\n }\n });\n if (featuresOnFloor.length && animate) {\n var bounds = new mapboxgl.LngLatBounds();\n featuresOnFloor.forEach(function (feature) {\n bounds.extend(feature.geometry.coordinates);\n });\n if (this.currentView === 'desktop') {\n this.map.map.fitBounds(bounds, {\n padding: {\n top: 50,\n bottom: 50,\n left: 350,\n right: 50\n },\n maxZoom: 15,\n pitch: 45,\n bearing: -37,\n duration: 1000\n });\n } else if (this.currentView === 'mobile') {\n var mapHeight = this.map.mapContainer.offsetHeight;\n var mapWidth = this.map.mapContainer.offsetWidth;\n var bottomPaddingPercent = 45;\n var sidePaddingPercent = 8;\n var bottomPaddingInPixels = mapHeight * (bottomPaddingPercent / 100);\n var sidePaddingInPixels = mapWidth * (sidePaddingPercent / 100);\n this.map.map.fitBounds(bounds, {\n padding: {\n top: 150,\n bottom: bottomPaddingInPixels,\n left: sidePaddingInPixels,\n right: sidePaddingInPixels + 95\n },\n maxZoom: 16,\n pitch: 45,\n bearing: -37,\n duration: 1000\n });\n }\n }\n }\n }, {\n key: \"updateLabelForSelectedContentPlacement\",\n value: function updateLabelForSelectedContentPlacement(result) {\n var animate = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n this.map.clearSelectedContentLayer();\n var coordinates = (0,_utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_2__.convertVerticesToCoordinates)([result.location], null, 30.0);\n var coordinate = coordinates[0];\n result._floor = result.floor;\n if (!result.name) {\n if (result.content && result.catalog) {\n var title_key = result.catalog.content_title_key;\n var title = result.content.data[title_key];\n result.name = title;\n }\n }\n this.map.addSelectedFeature(coordinate, result);\n if (animate) {\n if (this.currentView === 'desktop') {\n this.map.map.easeTo({\n center: coordinate,\n padding: {\n top: 0,\n bottom: 0,\n left: 330,\n right: 0\n },\n duration: 1000\n });\n } else if (this.currentView === 'mobile') {\n var mapHeight = this.map.mapContainer.offsetHeight;\n var bottomPaddingPercent = 35;\n var bottomPaddingInPixels = mapHeight * (bottomPaddingPercent / 100);\n this.map.map.easeTo({\n center: coordinate,\n padding: {\n top: 0,\n bottom: bottomPaddingInPixels,\n left: 0,\n right: 0\n },\n duration: 1000\n });\n }\n }\n }\n }, {\n key: \"applyHoverEffectToAllSymbolLayers\",\n value: function applyHoverEffectToAllSymbolLayers() {\n var _this7 = this;\n var layers = this.map.map.getStyle().layers;\n layers.forEach(function (layer) {\n if (layer.type === 'symbol') {\n var layerId = layer.id;\n var defaultTextColor = _this7.textColorReference[layerId];\n _this7.map.map.on('mouseenter', layerId, function (e) {\n var feature = e.features[0];\n var placementId = feature.properties.placement_id;\n if (!_this7.previouslySelectedFeature || _this7.previouslySelectedFeature.layer.id !== feature.layer.id) {\n _this7.originalTextColor = _this7.map.map.getPaintProperty(layerId, 'text-color');\n _this7.map.map.setPaintProperty(layerId, 'text-color', ['case', ['==', ['get', 'placement_id'], placementId], '#4B90F7', defaultTextColor]);\n } else {\n _this7.originalTextColor = _this7.previouslySelectedTextColor;\n var previouslySelectedPlacementId = _this7.previouslySelectedFeature.properties.placement_id;\n _this7.map.map.setPaintProperty(layerId, 'text-color', ['case', ['==', ['get', 'placement_id'], placementId], '#4B90F7', ['==', ['get', 'placement_id'], previouslySelectedPlacementId], _this7.selectedTextColor, defaultTextColor]);\n }\n _this7.map.map.getCanvas().style.cursor = 'pointer';\n });\n _this7.map.map.on('mouseleave', layerId, function () {\n if (!_this7.previouslySelectedFeature) {\n _this7.map.map.setPaintProperty(layerId, 'text-color', defaultTextColor);\n } else {\n // If a feature is selected, maintain its selected color\n var previouslySelectedPlacementId = _this7.previouslySelectedFeature.properties.placement_id;\n _this7.map.map.setPaintProperty(layerId, 'text-color', ['case', ['==', ['get', 'placement_id'], previouslySelectedPlacementId], _this7.selectedTextColor, defaultTextColor]);\n }\n _this7.map.map.getCanvas().style.cursor = 'default';\n });\n }\n });\n }\n }, {\n key: \"removeHoverEffects\",\n value: function removeHoverEffects() {\n var _this8 = this;\n var layers = this.map.map.getStyle().layers;\n layers.forEach(function (layer) {\n if (layer.type === 'symbol') {\n var layerId = layer.id;\n // Reset to default text color\n var defaultTextColor = _this8.textColorReference[layerId];\n _this8.map.map.setPaintProperty(layerId, 'text-color', defaultTextColor);\n\n // Remove event listeners\n _this8.map.map.off('mouseenter', layerId);\n _this8.map.map.off('mouseleave', layerId);\n }\n });\n this.map.map.getCanvas().style.cursor = 'default';\n }\n }, {\n key: \"_handleClick\",\n value: function _handleClick(e) {\n if (!this.interactionEnabled) return;\n var features = this.map.map.queryRenderedFeatures(e.point);\n var symbolFeatures = features.filter(function (feature) {\n return feature.layer.type === 'symbol';\n });\n if (symbolFeatures.length > 0) {\n var placementId = symbolFeatures[0].properties.placement_id;\n this.map.setToSelectedContentState([placementId]);\n }\n }\n }]);\n}(_core_Control__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (InteractionControl);\n\n//# sourceURL=webpack://waygomaps/./src/Controls/InteractionControl.js?");
|
|
618
618
|
|
|
619
619
|
/***/ }),
|
|
620
620
|
|
|
@@ -625,7 +625,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
625
625
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
626
626
|
|
|
627
627
|
"use strict";
|
|
628
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _components_SearchBox_SearchBox__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/SearchBox/SearchBox */ \"./src/components/SearchBox/SearchBox.js\");\n/* harmony import */ var _core_Control__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Control */ \"./src/core/Control.js\");\n/* harmony import */ var _WaygoMaps__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../WaygoMaps */ \"./src/WaygoMaps.js\");\n/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! axios */ \"./node_modules/axios/lib/axios.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prototype : t), e, r); return 2 & o ? function (t) { return p.apply(r, t); } : p; }\nfunction _get() { return _get = \"undefined\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }\nfunction _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\n\nvar SearchBoxControl = /*#__PURE__*/function (_Control) {\n function SearchBoxControl() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, SearchBoxControl);\n _this = _callSuper(this, SearchBoxControl, [options]);\n _this.searchBox = new _components_SearchBox_SearchBox__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n _this.searchApi = _WaygoMaps__WEBPACK_IMPORTED_MODULE_2__[\"default\"].getSearchApi();\n return _this;\n }\n _inherits(SearchBoxControl, _Control);\n return _createClass(SearchBoxControl, [{\n key: \"onAdd\",\n value: function onAdd(map) {\n this.map = map;\n this.container = document.createElement('div');\n this.container.className = 'search-box-control-container';\n var element = this.searchBox.getElement();\n this.container.appendChild(element);\n this._initializeEventListeners();\n this._attachResizeListener();\n this._initialize();\n this.show();\n return this.container;\n }\n }, {\n key: \"onRemove\",\n value: function onRemove() {\n _superPropGet(SearchBoxControl, \"onRemove\", this, 3)([]);\n }\n }, {\n key: \"_initializeEventListeners\",\n value: function _initializeEventListeners() {\n this.searchBox.searchBarSuggestionsView.on('selectCell', this._handleSuggestionSelect.bind(this));\n this.searchBox.searchBar.on('cancel', this._handleSearchBarCancel.bind(this));\n this.searchBox.on('search', this._handleSearchBoxSearch.bind(this));\n this.searchBox.on('selectBack', this._handleSearchBoxSelectBack.bind(this));\n this.searchBox.on('getSearchBarSuggestions', this._handleGettingSearchBarSuggestions.bind(this));\n this.map.on('state:default', this._handleDefaultState.bind(this));\n this.map.on('state:search', this._handleSearchState.bind(this));\n this.map.on('state:selectedContent', this._handleSelectedContentState.bind(this));\n this.map.on('state:directions', this._handleDirectionsState.bind(this));\n this.map.on('state:setup', this._handleSetupState.bind(this));\n this.map.on('load', this._handleMapLoad.bind(this));\n }\n }, {\n key: \"_handleMapLoad\",\n value: function _handleMapLoad(data) {\n var mapData = data.mapData;\n var mapName = mapData.map_name;\n if (mapName) {\n this.searchBox.searchBar.setPlaceholderText(\"Search \".concat(mapName));\n } else {\n this.searchBox.searchBar.setPlaceholderText(\"Search\");\n }\n }\n }, {\n key: \"_handleGettingSearchBarSuggestions\",\n value: function () {\n var _handleGettingSearchBarSuggestions2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {\n var query, currentSearch, skip, limit, results;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n query = data.query;\n currentSearch = ++this.searchBox.searchCount;\n if (!(query === '')) {\n _context.next = 5;\n break;\n }\n this.searchBox.searchBarSuggestionsView.updateResults([]);\n return _context.abrupt(\"return\");\n case 5:\n if (this.map.mapData) {\n _context.next = 7;\n break;\n }\n return _context.abrupt(\"return\");\n case 7:\n skip = 0;\n limit = 5;\n _context.prev = 9;\n _context.next = 12;\n return this.searchApi.search(this.map.mapData.map_id, this.map.mapData.map_view_id, query, skip, limit);\n case 12:\n results = _context.sent;\n if (currentSearch === this.searchBox.searchCount) {\n this.searchBox.searchBarSuggestionsView.updateResults(results);\n }\n _context.next = 19;\n break;\n case 16:\n _context.prev = 16;\n _context.t0 = _context[\"catch\"](9);\n if (axios__WEBPACK_IMPORTED_MODULE_3__[\"default\"].isCancel(_context.t0)) {\n console.error('Request canceled:', _context.t0.message);\n } else {\n console.error('Search error:', _context.t0);\n }\n case 19:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this, [[9, 16]]);\n }));\n function _handleGettingSearchBarSuggestions(_x) {\n return _handleGettingSearchBarSuggestions2.apply(this, arguments);\n }\n return _handleGettingSearchBarSuggestions;\n }()\n }, {\n key: \"_renderDesktopView\",\n value: function _renderDesktopView() {\n var element = this.searchBox.getElement();\n this.container.appendChild(element);\n this.container.classList.add('desktop-view');\n this.container.classList.remove('mobile-view');\n if (element) {\n this.searchBox.setViewForDesktop();\n }\n }\n }, {\n key: \"_renderMobileView\",\n value: function _renderMobileView() {\n var element = this.searchBox.getElement();\n this.container.appendChild(element);\n this.container.classList.add('mobile-view');\n this.container.classList.remove('desktop-view');\n if (element) {\n this.searchBox.setViewForMobile();\n }\n }\n }, {\n key: \"bringToFront\",\n value: function bringToFront() {\n /* z-index: 7; */\n this.container.style.zIndex = '10';\n }\n }, {\n key: \"bringBack\",\n value: function bringBack() {\n this.container.style.zIndex = '';\n }\n }, {\n key: \"_handleSearchBoxSelectBack\",\n value: function _handleSearchBoxSelectBack() {\n this.map.initiateBack();\n }\n }, {\n key: \"_handleSearchBarCancel\",\n value: function _handleSearchBarCancel(_) {\n this.map.setToDefaultState();\n }\n }, {\n key: \"_handleSearchBoxSearch\",\n value: function _handleSearchBoxSearch(data) {\n var query = data.query;\n this.map.setToSearchState(query);\n }\n }, {\n key: \"_handleSuggestionSelect\",\n value: function _handleSuggestionSelect(data) {\n var result = data.result;\n this.map.setToSelectedContentState([result.placement_id]);\n }\n }, {\n key: \"_handleDefaultState\",\n value: function _handleDefaultState() {\n this.searchBox.searchBarSuggestionsView.clearResults();\n this.searchBox.closeSuggestionsView();\n this.searchBox.searchBar.setText(\"\");\n this.searchBox.searchBar.updateRightButtonIcon('search');\n this.searchBox.searchBar.updateLeftButtonIcon('none');\n this.bringToFront();\n this.show();\n }\n }, {\n key: \"_handleSearchState\",\n value: function _handleSearchState(data) {\n var query = data.query,\n results = data.results;\n this.searchBox.searchBar.setText(query);\n this.searchBox.searchBar.updateRightButtonIcon('cancel');\n this.searchBox.searchBar.updateLeftButtonIcon('none');\n this.bringToFront();\n this.show();\n }\n }, {\n key: \"_handleSelectedContentState\",\n value: function _handleSelectedContentState(data) {\n var contentPlacementIds = data.contentPlacementIds,\n selectedContentPlacement = data.selectedContentPlacement;\n this.show();\n this.bringToFront();\n\n // const title_key = selectedContentPlacement.content.title_key;\n var title_key = selectedContentPlacement.catalog.content_title_key;\n var title = selectedContentPlacement.content.data[title_key];\n this.searchBox.searchBar.setText(title);\n this.searchBox.searchBar.updateRightButtonIcon('cancel');\n var stateHistoryLength = this.map._stateCoordinator.stateHistory.length;\n if (stateHistoryLength > 2 || contentPlacementIds.length > 1) {\n this.searchBox.searchBar.updateLeftButtonIcon('back');\n } else {\n this.searchBox.searchBar.updateLeftButtonIcon('none');\n }\n }\n }, {\n key: \"_handleDirectionsState\",\n value: function _handleDirectionsState(_) {\n this.bringBack();\n var stateHistoryLength = this.map._stateCoordinator.stateHistory.length;\n this.searchBox.searchBar.updateRightButtonIcon('cancel');\n if (stateHistoryLength > 2) {\n this.searchBox.searchBar.updateLeftButtonIcon('back');\n } else {\n this.searchBox.searchBar.updateLeftButtonIcon('none');\n }\n }\n }, {\n key: \"_handleSetupState\",\n value: function _handleSetupState() {\n this.hide();\n }\n }]);\n}(_core_Control__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SearchBoxControl);\n\n//# sourceURL=webpack://waygomaps/./src/Controls/SearchBoxControl.js?");
|
|
628
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _components_SearchBox_SearchBox__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components/SearchBox/SearchBox */ \"./src/components/SearchBox/SearchBox.js\");\n/* harmony import */ var _core_Control__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../core/Control */ \"./src/core/Control.js\");\n/* harmony import */ var _WaygoMaps__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../WaygoMaps */ \"./src/WaygoMaps.js\");\n/* harmony import */ var axios__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! axios */ \"./node_modules/axios/lib/axios.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prototype : t), e, r); return 2 & o ? function (t) { return p.apply(r, t); } : p; }\nfunction _get() { return _get = \"undefined\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }\nfunction _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\n\nvar SearchBoxControl = /*#__PURE__*/function (_Control) {\n function SearchBoxControl() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, SearchBoxControl);\n _this = _callSuper(this, SearchBoxControl, [options]);\n _this.searchBox = new _components_SearchBox_SearchBox__WEBPACK_IMPORTED_MODULE_0__[\"default\"]();\n _this.searchApi = _WaygoMaps__WEBPACK_IMPORTED_MODULE_2__[\"default\"].getSearchApi();\n return _this;\n }\n _inherits(SearchBoxControl, _Control);\n return _createClass(SearchBoxControl, [{\n key: \"onAdd\",\n value: function onAdd(map) {\n this.map = map;\n this.container = document.createElement('div');\n this.container.className = 'search-box-control-container';\n var element = this.searchBox.getElement();\n this.container.appendChild(element);\n this._initializeEventListeners();\n this._attachResizeListener();\n this._initialize();\n this.show();\n\n // Add a method to manually test loading state\n this.testLoadingState = this._testLoadingState.bind(this);\n return this.container;\n }\n }, {\n key: \"onRemove\",\n value: function onRemove() {\n _superPropGet(SearchBoxControl, \"onRemove\", this, 3)([]);\n }\n }, {\n key: \"_initializeEventListeners\",\n value: function _initializeEventListeners() {\n this.searchBox.searchBarSuggestionsView.on('selectCell', this._handleSuggestionSelect.bind(this));\n this.searchBox.searchBar.on('cancel', this._handleSearchBarCancel.bind(this));\n this.searchBox.on('search', this._handleSearchBoxSearch.bind(this));\n this.searchBox.on('selectBack', this._handleSearchBoxSelectBack.bind(this));\n this.searchBox.on('getSearchBarSuggestions', this._handleGettingSearchBarSuggestions.bind(this));\n this.map.on('state:default', this._handleDefaultState.bind(this));\n this.map.on('state:search', this._handleSearchState.bind(this));\n this.map.on('state:selectedContent', this._handleSelectedContentState.bind(this));\n this.map.on('state:directions', this._handleDirectionsState.bind(this));\n this.map.on('state:setup', this._handleSetupState.bind(this));\n this.map.on('load', this._handleMapLoad.bind(this));\n this.map.on('loading:start', this._handleLoadingStart.bind(this));\n this.map.on('loading:end', this._handleLoadingEnd.bind(this));\n }\n }, {\n key: \"_handleMapLoad\",\n value: function _handleMapLoad(data) {\n var mapData = data.mapData;\n var mapName = mapData.map_name;\n if (mapName) {\n this.searchBox.searchBar.setPlaceholderText(\"Search \".concat(mapName));\n } else {\n this.searchBox.searchBar.setPlaceholderText(\"Search\");\n }\n }\n }, {\n key: \"_handleGettingSearchBarSuggestions\",\n value: function () {\n var _handleGettingSearchBarSuggestions2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {\n var query, currentSearch, skip, limit, results;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n query = data.query;\n currentSearch = ++this.searchBox.searchCount;\n if (!(query === '')) {\n _context.next = 5;\n break;\n }\n this.searchBox.searchBarSuggestionsView.updateResults([]);\n return _context.abrupt(\"return\");\n case 5:\n if (this.map.mapData) {\n _context.next = 7;\n break;\n }\n return _context.abrupt(\"return\");\n case 7:\n skip = 0;\n limit = 5;\n _context.prev = 9;\n _context.next = 12;\n return this.searchApi.search(this.map.mapData.map_id, this.map.mapData.map_view_id, query, skip, limit);\n case 12:\n results = _context.sent;\n if (currentSearch === this.searchBox.searchCount) {\n this.searchBox.searchBarSuggestionsView.updateResults(results);\n }\n _context.next = 19;\n break;\n case 16:\n _context.prev = 16;\n _context.t0 = _context[\"catch\"](9);\n if (axios__WEBPACK_IMPORTED_MODULE_3__[\"default\"].isCancel(_context.t0)) {\n console.error('Request canceled:', _context.t0.message);\n } else {\n console.error('Search error:', _context.t0);\n }\n case 19:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this, [[9, 16]]);\n }));\n function _handleGettingSearchBarSuggestions(_x) {\n return _handleGettingSearchBarSuggestions2.apply(this, arguments);\n }\n return _handleGettingSearchBarSuggestions;\n }()\n }, {\n key: \"_renderDesktopView\",\n value: function _renderDesktopView() {\n var element = this.searchBox.getElement();\n this.container.appendChild(element);\n this.container.classList.add('desktop-view');\n this.container.classList.remove('mobile-view');\n if (element) {\n this.searchBox.setViewForDesktop();\n }\n }\n }, {\n key: \"_renderMobileView\",\n value: function _renderMobileView() {\n var element = this.searchBox.getElement();\n this.container.appendChild(element);\n this.container.classList.add('mobile-view');\n this.container.classList.remove('desktop-view');\n if (element) {\n this.searchBox.setViewForMobile();\n }\n }\n }, {\n key: \"bringToFront\",\n value: function bringToFront() {\n /* z-index: 7; */\n this.container.style.zIndex = '10';\n }\n }, {\n key: \"bringBack\",\n value: function bringBack() {\n this.container.style.zIndex = '';\n }\n }, {\n key: \"_handleSearchBoxSelectBack\",\n value: function _handleSearchBoxSelectBack() {\n this.map.initiateBack();\n }\n }, {\n key: \"_handleSearchBarCancel\",\n value: function _handleSearchBarCancel(_) {\n this.map.setToDefaultState();\n }\n }, {\n key: \"_handleSearchBoxSearch\",\n value: function _handleSearchBoxSearch(data) {\n var query = data.query;\n this.map.setToSearchState(query);\n }\n }, {\n key: \"_handleSuggestionSelect\",\n value: function _handleSuggestionSelect(data) {\n var result = data.result;\n this.map.setToSelectedContentState([result.placement_id]);\n }\n }, {\n key: \"_handleDefaultState\",\n value: function _handleDefaultState() {\n this.searchBox.searchBarSuggestionsView.clearResults();\n this.searchBox.closeSuggestionsView();\n this.searchBox.searchBar.setText(\"\");\n this.searchBox.searchBar.updateRightButtonIcon('search');\n this.searchBox.searchBar.updateLeftButtonIcon('none');\n this.searchBox.searchBar.hideLoading();\n this.bringToFront();\n this.show();\n }\n }, {\n key: \"_handleSearchState\",\n value: function _handleSearchState(data) {\n var query = data.query,\n results = data.results;\n this.searchBox.searchBar.setText(query);\n this.searchBox.searchBar.updateRightButtonIcon('cancel');\n this.searchBox.searchBar.updateLeftButtonIcon('none');\n this.bringToFront();\n this.show();\n }\n }, {\n key: \"_handleSelectedContentState\",\n value: function _handleSelectedContentState(data) {\n var contentPlacementIds = data.contentPlacementIds,\n selectedContentPlacement = data.selectedContentPlacement;\n this.show();\n this.bringToFront();\n\n // const title_key = selectedContentPlacement.content.title_key;\n var title_key = selectedContentPlacement.catalog.content_title_key;\n var title = selectedContentPlacement.content.data[title_key];\n this.searchBox.searchBar.setText(title);\n this.searchBox.searchBar.updateRightButtonIcon('cancel');\n var stateHistoryLength = this.map._stateCoordinator.stateHistory.length;\n if (stateHistoryLength > 2 || contentPlacementIds.length > 1) {\n this.searchBox.searchBar.updateLeftButtonIcon('back');\n } else {\n this.searchBox.searchBar.updateLeftButtonIcon('none');\n }\n }\n }, {\n key: \"_handleDirectionsState\",\n value: function _handleDirectionsState(_) {\n this.bringBack();\n var stateHistoryLength = this.map._stateCoordinator.stateHistory.length;\n this.searchBox.searchBar.updateRightButtonIcon('cancel');\n if (stateHistoryLength > 2) {\n this.searchBox.searchBar.updateLeftButtonIcon('back');\n } else {\n this.searchBox.searchBar.updateLeftButtonIcon('none');\n }\n }\n }, {\n key: \"_handleSetupState\",\n value: function _handleSetupState() {\n this.hide();\n }\n }, {\n key: \"_handleLoadingStart\",\n value: function _handleLoadingStart(data) {\n this.searchBox.searchBar.showLoading();\n this.searchBox.searchBar.updateRightButtonIcon(this.searchBox.searchBar.rightButtonState);\n this.searchBox.searchBar.updateLeftButtonIcon(this.searchBox.searchBar.leftButtonState);\n }\n }, {\n key: \"_handleLoadingEnd\",\n value: function _handleLoadingEnd(data) {\n this.searchBox.searchBar.hideLoading();\n }\n }, {\n key: \"_testLoadingState\",\n value: function _testLoadingState() {\n var _this2 = this;\n this.searchBox.searchBar.showLoading();\n setTimeout(function () {\n _this2.searchBox.searchBar.hideLoading();\n }, 2000);\n }\n }]);\n}(_core_Control__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SearchBoxControl);\n\n//# sourceURL=webpack://waygomaps/./src/Controls/SearchBoxControl.js?");
|
|
629
629
|
|
|
630
630
|
/***/ }),
|
|
631
631
|
|
|
@@ -636,7 +636,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
636
636
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
637
637
|
|
|
638
638
|
"use strict";
|
|
639
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var webpack__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! webpack */ \"./node_modules/webpack/lib/index.js\");\n/* harmony import */ var webpack__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(webpack__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _components_SearchResultsView_SearchResultsView__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/SearchResultsView/SearchResultsView */ \"./src/components/SearchResultsView/SearchResultsView.js\");\n/* harmony import */ var _core_Control__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/Control */ \"./src/core/Control.js\");\n/* harmony import */ var _WaygoMaps__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../WaygoMaps */ \"./src/WaygoMaps.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prototype : t), e, r); return 2 & o ? function (t) { return p.apply(r, t); } : p; }\nfunction _get() { return _get = \"undefined\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }\nfunction _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\n\nvar SearchResultsControl = /*#__PURE__*/function (_Control) {\n function SearchResultsControl() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, SearchResultsControl);\n _this = _callSuper(this, SearchResultsControl, [options]);\n _this.searchResultsView = new _components_SearchResultsView_SearchResultsView__WEBPACK_IMPORTED_MODULE_1__[\"default\"]();\n _this.searchApi = _WaygoMaps__WEBPACK_IMPORTED_MODULE_3__[\"default\"].getSearchApi();\n _this.searchedQuery = null;\n _this.map = null;\n _this.lastSearchLength = 0;\n _this.skip = 0;\n _this.limit = 40;\n return _this;\n }\n _inherits(SearchResultsControl, _Control);\n return _createClass(SearchResultsControl, [{\n key: \"onAdd\",\n value: function onAdd(map) {\n this.map = map;\n this.container = document.createElement('div');\n this.container.className = 'search-results-control-container';\n var element = this.searchResultsView.getElement();\n this.container.appendChild(element);\n this.hide();\n this._initializeEventListeners();\n this._attachResizeListener();\n this._attachScrollListener();\n this._initialize();\n return this.container;\n }\n }, {\n key: \"onRemove\",\n value: function onRemove() {\n _superPropGet(SearchResultsControl, \"onRemove\", this, 3)([]);\n }\n }, {\n key: \"_initializeEventListeners\",\n value: function _initializeEventListeners() {\n this.map.on('state:default', this._handleDefaultState.bind(this));\n this.map.on('state:search', this._handleSearchState.bind(this));\n this.map.on('state:selectedContent', this._handleSelectedContentState.bind(this));\n this.map.on('initiate:search', this._handleInitiateSearchState.bind(this));\n this.map.on('state:directions', this._handleDirectionsState.bind(this));\n this.map.on('state:setup', this._handleSetupState.bind(this));\n this.searchResultsView.on('closeView', this._handleCloseSearchResultsView.bind(this));\n this.searchResultsView.on('selectCell', this._handleSearchResultSelect.bind(this));\n this.searchResultsView.on('hoverCell', this._handleCellHover.bind(this));\n this.searchResultsView.on('hoverOutCell', this._handleCellHoverOut.bind(this));\n }\n }, {\n key: \"_handleCellHover\",\n value: function _handleCellHover(data) {\n var result = data.result;\n this.map.fire('hoverSearchResult', {\n result: result\n });\n }\n }, {\n key: \"_handleCellHoverOut\",\n value: function _handleCellHoverOut(data) {\n var result = data.result;\n this.map.fire('hoverEndSearchResult', {\n result: result\n });\n }\n }, {\n key: \"_attachScrollListener\",\n value: function _attachScrollListener() {\n var searchResultsElement = this.searchResultsView.getElement();\n searchResultsElement.addEventListener('scroll', this._handleScroll.bind(this));\n }\n }, {\n key: \"_renderDesktopView\",\n value: function _renderDesktopView() {\n var element = this.searchResultsView.getElement();\n this.container.appendChild(element);\n this.container.classList.remove('mobile-view');\n this.container.classList.add('desktop-view');\n }\n }, {\n key: \"_renderMobileView\",\n value: function _renderMobileView() {\n var element = this.searchResultsView.getElement();\n this.container.appendChild(element);\n this.container.classList.remove('desktop-view');\n this.container.classList.add('mobile-view');\n }\n }, {\n key: \"_handleScroll\",\n value: function () {\n var _handleScroll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var searchResultsElement, scrollTop, scrollHeight, clientHeight, threshold, distFromBottom, newResults;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n searchResultsElement = this.searchResultsView.getElement();\n scrollTop = searchResultsElement.scrollTop, scrollHeight = searchResultsElement.scrollHeight, clientHeight = searchResultsElement.clientHeight;\n threshold = 0;\n distFromBottom = scrollHeight - scrollTop - clientHeight + threshold;\n console.log(this.lastSearchLength, this.limit);\n if (!(distFromBottom < 10 && !this.searchResultsView.loading && this.lastSearchLength === this.limit)) {\n _context.next = 15;\n break;\n }\n // scrollTop = 0;\n this.searchResultsView.showLoadingCell();\n _context.next = 9;\n return this._getAdditionalSearchResults();\n case 9:\n newResults = _context.sent;\n this.lastSearchLength = newResults.length;\n this.searchResultsView.extendResults(newResults);\n this.skip += this.limit;\n this.map.fire('additionalSearchResults', {\n results: newResults\n });\n this.searchResultsView.hideLoadingCell();\n case 15:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this);\n }));\n function _handleScroll() {\n return _handleScroll2.apply(this, arguments);\n }\n return _handleScroll;\n }()\n }, {\n key: \"_getAdditionalSearchResults\",\n value: function () {\n var _getAdditionalSearchResults2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n var query, floor, results;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n query = this.searchedQuery;\n floor = this.map.getCurrentFloor();\n if (!(query === '')) {\n _context2.next = 5;\n break;\n }\n this.searchBox.searchBarSuggestionsView.updateResults([]);\n return _context2.abrupt(\"return\");\n case 5:\n if (this.map.mapData) {\n _context2.next = 7;\n break;\n }\n return _context2.abrupt(\"return\");\n case 7:\n _context2.prev = 7;\n console.log('getting additional search results WITH SKIP', this.skip);\n _context2.next = 11;\n return this.searchApi.search(this.map.mapData.map_id, this.map.mapData.map_view_id, query, this.skip, this.limit, floor);\n case 11:\n results = _context2.sent;\n return _context2.abrupt(\"return\", results);\n case 15:\n _context2.prev = 15;\n _context2.t0 = _context2[\"catch\"](7);\n if (axios.isCancel(_context2.t0)) {\n console.error('Request canceled:', _context2.t0.message);\n } else {\n console.error('Search error:', _context2.t0);\n }\n case 18:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this, [[7, 15]]);\n }));\n function _getAdditionalSearchResults() {\n return _getAdditionalSearchResults2.apply(this, arguments);\n }\n return _getAdditionalSearchResults;\n }()\n }, {\n key: \"_handleInitiateSearchState\",\n value: function _handleInitiateSearchState() {\n this.map.setToSearchState(this.searchedQuery);\n }\n }, {\n key: \"_handleSearchResultSelect\",\n value: function _handleSearchResultSelect(data) {\n var result = data.result;\n var placementId = result.placement_id;\n this.map.setToSelectedContentState([placementId]);\n }\n }, {\n key: \"_handleCloseSearchResultsView\",\n value: function _handleCloseSearchResultsView() {\n this.map.setToDefaultState();\n }\n }, {\n key: \"_handleDefaultState\",\n value: function _handleDefaultState() {\n this.searchedQuery = null;\n this.searchResultsView.updateResults([]);\n this.searchResultsView.scrollToTop();\n this.hide();\n }\n }, {\n key: \"_handleSearchState\",\n value: function _handleSearchState(data) {\n var query = data.query,\n results = data.results;\n\n // // Find the floor with the most results\n // const floorCounts = results.reduce((acc, result) => {\n // acc[result.floor] = (acc[result.floor] || 0) + 1;\n // return acc;\n // }, {});\n\n // // Get the floor with the highest count\n // const bestFloor = Object.entries(floorCounts)\n // .reduce((a, b) => (b[1] > a[1] ? b : a), [0, 0])[0];\n\n // // Only switch floors if none of the results are on the current floor\n // const currentFloor = this.map.getCurrentFloor();\n // const hasResultsOnCurrentFloor = results.some(result => result.floor === currentFloor);\n\n // if (!hasResultsOnCurrentFloor) {\n // this.map.updateFloor(parseInt(bestFloor));\n // }\n\n // console.log('search results', results);\n\n this.searchedQuery = query;\n this.lastSearchLength = results.length;\n this.skip = this.limit;\n this.searchResultsView.updateResults([]);\n var floors = this.map.mapData.floors;\n if (floors.length > 1) {\n this.searchResultsView.updateView(results, query, floors);\n }\n this.searchResultsView.updateView(results, query);\n this.show();\n // this.searchResultsView.scrollToTop();\n\n // Get the maps floors here!!!!!\n // element.scrollTop = 0;\n // this.container.scrollTop = 0;\n // window.scrollTo(0,0);\n }\n }, {\n key: \"_handleSelectedContentState\",\n value: function _handleSelectedContentState(_) {\n this.searchResultsView.updateResults([]);\n this.hide();\n }\n }, {\n key: \"_handleDirectionsState\",\n value: function _handleDirectionsState(_) {\n return;\n }\n }, {\n key: \"_handleSetupState\",\n value: function _handleSetupState() {\n this.hide();\n }\n }]);\n}(_core_Control__WEBPACK_IMPORTED_MODULE_2__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SearchResultsControl);\n\n//# sourceURL=webpack://waygomaps/./src/Controls/SearchResultsControl.js?");
|
|
639
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var webpack__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! webpack */ \"./node_modules/webpack/lib/index.js\");\n/* harmony import */ var webpack__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(webpack__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _components_SearchResultsView_SearchResultsView__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components/SearchResultsView/SearchResultsView */ \"./src/components/SearchResultsView/SearchResultsView.js\");\n/* harmony import */ var _core_Control__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../core/Control */ \"./src/core/Control.js\");\n/* harmony import */ var _WaygoMaps__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../WaygoMaps */ \"./src/WaygoMaps.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prototype : t), e, r); return 2 & o ? function (t) { return p.apply(r, t); } : p; }\nfunction _get() { return _get = \"undefined\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }\nfunction _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\n\nvar SearchResultsControl = /*#__PURE__*/function (_Control) {\n function SearchResultsControl() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, SearchResultsControl);\n _this = _callSuper(this, SearchResultsControl, [options]);\n _this.searchResultsView = new _components_SearchResultsView_SearchResultsView__WEBPACK_IMPORTED_MODULE_1__[\"default\"]();\n _this.searchApi = _WaygoMaps__WEBPACK_IMPORTED_MODULE_3__[\"default\"].getSearchApi();\n _this.searchedQuery = null;\n _this.map = null;\n _this.lastSearchLength = 0;\n _this.skip = 0;\n _this.limit = 40;\n return _this;\n }\n _inherits(SearchResultsControl, _Control);\n return _createClass(SearchResultsControl, [{\n key: \"onAdd\",\n value: function onAdd(map) {\n this.map = map;\n this.container = document.createElement('div');\n this.container.className = 'search-results-control-container';\n var element = this.searchResultsView.getElement();\n this.container.appendChild(element);\n this.hide();\n this._initializeEventListeners();\n this._attachResizeListener();\n this._attachScrollListener();\n this._initialize();\n return this.container;\n }\n }, {\n key: \"onRemove\",\n value: function onRemove() {\n _superPropGet(SearchResultsControl, \"onRemove\", this, 3)([]);\n }\n }, {\n key: \"_initializeEventListeners\",\n value: function _initializeEventListeners() {\n this.map.on('state:default', this._handleDefaultState.bind(this));\n this.map.on('state:search', this._handleSearchState.bind(this));\n this.map.on('state:selectedContent', this._handleSelectedContentState.bind(this));\n this.map.on('initiate:search', this._handleInitiateSearchState.bind(this));\n this.map.on('state:directions', this._handleDirectionsState.bind(this));\n this.map.on('state:setup', this._handleSetupState.bind(this));\n this.searchResultsView.on('closeView', this._handleCloseSearchResultsView.bind(this));\n this.searchResultsView.on('selectCell', this._handleSearchResultSelect.bind(this));\n this.searchResultsView.on('hoverCell', this._handleCellHover.bind(this));\n this.searchResultsView.on('hoverOutCell', this._handleCellHoverOut.bind(this));\n }\n }, {\n key: \"_handleCellHover\",\n value: function _handleCellHover(data) {\n var result = data.result;\n this.map.fire('hoverSearchResult', {\n result: result\n });\n }\n }, {\n key: \"_handleCellHoverOut\",\n value: function _handleCellHoverOut(data) {\n var result = data.result;\n this.map.fire('hoverEndSearchResult', {\n result: result\n });\n }\n }, {\n key: \"_attachScrollListener\",\n value: function _attachScrollListener() {\n var searchResultsElement = this.searchResultsView.getElement();\n searchResultsElement.addEventListener('scroll', this._handleScroll.bind(this));\n }\n }, {\n key: \"_renderDesktopView\",\n value: function _renderDesktopView() {\n var element = this.searchResultsView.getElement();\n this.container.appendChild(element);\n this.container.classList.remove('mobile-view');\n this.container.classList.add('desktop-view');\n }\n }, {\n key: \"_renderMobileView\",\n value: function _renderMobileView() {\n var element = this.searchResultsView.getElement();\n this.container.appendChild(element);\n this.container.classList.remove('desktop-view');\n this.container.classList.add('mobile-view');\n }\n }, {\n key: \"_handleScroll\",\n value: function () {\n var _handleScroll2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var searchResultsElement, scrollTop, scrollHeight, clientHeight, threshold, distFromBottom, newResults;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n searchResultsElement = this.searchResultsView.getElement();\n scrollTop = searchResultsElement.scrollTop, scrollHeight = searchResultsElement.scrollHeight, clientHeight = searchResultsElement.clientHeight;\n threshold = 0;\n distFromBottom = scrollHeight - scrollTop - clientHeight + threshold;\n if (!(distFromBottom < 10 && !this.searchResultsView.loading && this.lastSearchLength === this.limit)) {\n _context.next = 14;\n break;\n }\n // scrollTop = 0;\n this.searchResultsView.showLoadingCell();\n _context.next = 8;\n return this._getAdditionalSearchResults();\n case 8:\n newResults = _context.sent;\n this.lastSearchLength = newResults.length;\n this.searchResultsView.extendResults(newResults);\n this.skip += this.limit;\n this.map.fire('additionalSearchResults', {\n results: newResults\n });\n this.searchResultsView.hideLoadingCell();\n case 14:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this);\n }));\n function _handleScroll() {\n return _handleScroll2.apply(this, arguments);\n }\n return _handleScroll;\n }()\n }, {\n key: \"_getAdditionalSearchResults\",\n value: function () {\n var _getAdditionalSearchResults2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n var query, floor, results;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n query = this.searchedQuery;\n floor = this.map.getCurrentFloor();\n if (!(query === '')) {\n _context2.next = 5;\n break;\n }\n this.searchBox.searchBarSuggestionsView.updateResults([]);\n return _context2.abrupt(\"return\");\n case 5:\n if (this.map.mapData) {\n _context2.next = 7;\n break;\n }\n return _context2.abrupt(\"return\");\n case 7:\n _context2.prev = 7;\n _context2.next = 10;\n return this.searchApi.search(this.map.mapData.map_id, this.map.mapData.map_view_id, query, this.skip, this.limit, floor);\n case 10:\n results = _context2.sent;\n return _context2.abrupt(\"return\", results);\n case 14:\n _context2.prev = 14;\n _context2.t0 = _context2[\"catch\"](7);\n if (axios.isCancel(_context2.t0)) {\n console.error('Request canceled:', _context2.t0.message);\n } else {\n console.error('Search error:', _context2.t0);\n }\n case 17:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this, [[7, 14]]);\n }));\n function _getAdditionalSearchResults() {\n return _getAdditionalSearchResults2.apply(this, arguments);\n }\n return _getAdditionalSearchResults;\n }()\n }, {\n key: \"_handleInitiateSearchState\",\n value: function _handleInitiateSearchState() {\n this.map.setToSearchState(this.searchedQuery);\n }\n }, {\n key: \"_handleSearchResultSelect\",\n value: function _handleSearchResultSelect(data) {\n var result = data.result;\n var placementId = result.placement_id;\n this.map.setToSelectedContentState([placementId]);\n }\n }, {\n key: \"_handleCloseSearchResultsView\",\n value: function _handleCloseSearchResultsView() {\n this.map.setToDefaultState();\n }\n }, {\n key: \"_handleDefaultState\",\n value: function _handleDefaultState() {\n this.searchedQuery = null;\n this.searchResultsView.updateResults([]);\n this.searchResultsView.scrollToTop();\n this.hide();\n }\n }, {\n key: \"_handleSearchState\",\n value: function _handleSearchState(data) {\n var query = data.query,\n results = data.results;\n\n // // Find the floor with the most results\n // const floorCounts = results.reduce((acc, result) => {\n // acc[result.floor] = (acc[result.floor] || 0) + 1;\n // return acc;\n // }, {});\n\n // // Get the floor with the highest count\n // const bestFloor = Object.entries(floorCounts)\n // .reduce((a, b) => (b[1] > a[1] ? b : a), [0, 0])[0];\n\n // // Only switch floors if none of the results are on the current floor\n // const currentFloor = this.map.getCurrentFloor();\n // const hasResultsOnCurrentFloor = results.some(result => result.floor === currentFloor);\n\n // if (!hasResultsOnCurrentFloor) {\n // this.map.updateFloor(parseInt(bestFloor));\n // }\n\n this.searchedQuery = query;\n this.lastSearchLength = results.length;\n this.skip = this.limit;\n this.searchResultsView.updateResults([]);\n var floors = this.map.mapData.floors;\n if (floors.length > 1) {\n this.searchResultsView.updateView(results, query, floors);\n }\n this.searchResultsView.updateView(results, query);\n this.show();\n // this.searchResultsView.scrollToTop();\n\n // Get the maps floors here!!!!!\n // element.scrollTop = 0;\n // this.container.scrollTop = 0;\n // window.scrollTo(0,0);\n }\n }, {\n key: \"_handleSelectedContentState\",\n value: function _handleSelectedContentState(_) {\n this.searchResultsView.updateResults([]);\n this.hide();\n }\n }, {\n key: \"_handleDirectionsState\",\n value: function _handleDirectionsState(_) {\n return;\n }\n }, {\n key: \"_handleSetupState\",\n value: function _handleSetupState() {\n this.hide();\n }\n }]);\n}(_core_Control__WEBPACK_IMPORTED_MODULE_2__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SearchResultsControl);\n\n//# sourceURL=webpack://waygomaps/./src/Controls/SearchResultsControl.js?");
|
|
640
640
|
|
|
641
641
|
/***/ }),
|
|
642
642
|
|
|
@@ -647,7 +647,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
647
647
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
648
648
|
|
|
649
649
|
"use strict";
|
|
650
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Control__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Control */ \"./src/core/Control.js\");\n/* harmony import */ var _WaygoMaps__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../WaygoMaps */ \"./src/WaygoMaps.js\");\n/* harmony import */ var _utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/coordinateSystems */ \"./src/utils/coordinateSystems.js\");\n/* harmony import */ var _components_SetupView_SetupView__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/SetupView/SetupView */ \"./src/components/SetupView/SetupView.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prototype : t), e, r); return 2 & o ? function (t) { return p.apply(r, t); } : p; }\nfunction _get() { return _get = \"undefined\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }\nfunction _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n// import SearchBox from \"../components/SearchBox/SearchBox\";\n\n\n\n\nvar SetupControl = /*#__PURE__*/function (_Control) {\n function SetupControl() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, SetupControl);\n _this = _callSuper(this, SetupControl, [options]);\n // this.searchBox = new SearchBox();\n _this.setupView = new _components_SetupView_SetupView__WEBPACK_IMPORTED_MODULE_3__[\"default\"]();\n // this.searchApi = waygoMaps.getSearchApi();\n _this.routesApi = _WaygoMaps__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getRotuesApi();\n _this.node = null;\n return _this;\n }\n _inherits(SetupControl, _Control);\n return _createClass(SetupControl, [{\n key: \"onAdd\",\n value: function onAdd(map) {\n // console.log(\"ON ADD SETUP CONTROL\");\n this.map = map;\n this.container = document.createElement('div');\n this.container.className = 'setup-control-container';\n this._initializeEventListeners();\n this._attachResizeListener();\n this._initialize();\n this.show();\n return this.container;\n }\n }, {\n key: \"onRemove\",\n value: function onRemove() {\n this.removeDraggablePoint();\n _superPropGet(SetupControl, \"onRemove\", this, 3)([]);\n }\n }, {\n key: \"removeDraggablePoint\",\n value: function removeDraggablePoint() {\n if (this.map && this.map.map) {\n // Remove layers first\n if (this.map.map.getLayer('point')) {\n this.map.map.removeLayer('point');\n }\n if (this.map.map.getLayer('point-border')) {\n this.map.map.removeLayer('point-border');\n }\n // Then remove source\n if (this.map.map.getSource('point')) {\n this.map.map.removeSource('point');\n }\n }\n }\n }, {\n key: \"initializeDraggablePoint\",\n value: function initializeDraggablePoint() {\n var _this2 = this;\n // console.log(\"INITIALIZE DRAGGABLE POINT\");\n var canvas = this.map.map.getCanvas();\n\n // console.log(canvas);\n\n var geojson = {\n type: 'FeatureCollection',\n features: [{\n type: 'Feature',\n geometry: {\n type: 'Point',\n coordinates: [0, 0]\n },\n properties: {\n _floor: this.map.getCurrentFloor() // Initialize with default floor\n }\n }]\n };\n var onMove = function onMove(e) {\n var coords = e.lngLat;\n\n // Set a UI indicator for dragging.\n // canvas.style.cursor = 'grabbing';\n\n // Update the Point feature in `geojson` coordinates\n // and call setData to the source layer `point` on it.\n geojson.features[0].geometry.coordinates = [coords.lng, coords.lat];\n\n // console.log(\"SET DATA 2\");\n var pointSource = _this2.map.map.getSource('point');\n if (pointSource) {\n pointSource.setData(geojson);\n }\n // this.map.map.getSource('point').setData(geojson);\n };\n var onUp = /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {\n var coords, vertex, floor;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n coords = e.lngLat;\n canvas.style.cursor = '';\n vertex = (0,_utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_2__.convertCoordinateToVertex)([coords.lng, coords.lat], [0, 0], 30); // vertex[0] = Number(vertex[0].toFixed(2));\n // vertex[1] = Number(vertex[1].toFixed(2));\n // console.log(\"VERTEX AFTER\", vertex);\n floor = geojson.features[0].properties._floor; // console.log(\"FLOOR\", floor);\n console.log(\"GETTING CLOSEST NODE 1\");\n _context.next = 7;\n return _this2.getClosestNode(vertex, floor);\n case 7:\n // Unbind mouse/touch events\n _this2.map.map.off('mousemove', onMove);\n _this2.map.map.off('touchmove', onMove);\n case 9:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return function onUp(_x) {\n return _ref.apply(this, arguments);\n };\n }();\n this.map.on('floorChanged', function (data) {\n var floorIndex = data.floorIndex;\n // console.log(\"FLOOR CHANGED\", floorIndex);\n // Update the point's floor property\n geojson.features[0].properties._floor = floorIndex;\n // Update the source data\n // console.log(\"SET DATA 3\");\n var pointSource = _this2.map.map.getSource('point');\n if (pointSource) {\n pointSource.setData(geojson);\n }\n });\n\n // console.log(\"ADD SOURCE\");\n // Add a single point to the map.\n this.map.map.addSource('point', {\n 'type': 'geojson',\n 'data': geojson\n });\n\n // console.log(\"ADD LAYER\");\n // Add white border circle layer\n this.map.map.addLayer({\n 'id': 'point-border',\n 'type': 'circle',\n 'source': 'point',\n 'paint': {\n 'circle-radius': 18,\n 'circle-color': '#FFFFFF'\n }\n });\n\n // Add red inner circle layer\n this.map.map.addLayer({\n 'id': 'point',\n 'type': 'circle',\n 'source': 'point',\n 'paint': {\n 'circle-radius': 15,\n 'circle-color': '#F84C4C' // red color\n }\n });\n\n // When the cursor enters a feature in\n // the point layer, prepare for dragging.\n this.map.map.on('mouseenter', 'point', function () {\n _this2.map.map.setPaintProperty('point', 'circle-color', '#FF8080');\n canvas.style.cursor = 'pointer';\n });\n this.map.map.on('mouseleave', 'point', function () {\n _this2.map.map.setPaintProperty('point', 'circle-color', '#F84C4C');\n canvas.style.cursor = 'default';\n });\n this.map.map.on('mousedown', 'point', function (e) {\n // Prevent the default map drag behavior.\n e.preventDefault();\n canvas.style.cursor = 'grabbing';\n _this2.map.map.on('mousemove', onMove);\n _this2.map.map.once('mouseup', onUp);\n });\n this.map.map.on('touchstart', 'point', function (e) {\n if (e.points.length !== 1) return;\n\n // Prevent the default map drag behavior.\n e.preventDefault();\n _this2.map.map.on('touchmove', onMove);\n _this2.map.map.once('touchend', onUp);\n });\n }\n }, {\n key: \"getVertex\",\n value: function getVertex() {\n var features = this.map.map.querySourceFeatures('point');\n if (features.length > 0) {\n var coordinates = features[0].geometry.coordinates;\n return (0,_utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_2__.convertCoordinateToVertex)(coordinates, this.map.mapData.reference_point, 30.0);\n }\n return null;\n }\n }, {\n key: \"getClosestNode\",\n value: function () {\n var _getClosestNode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(vertex, floor) {\n var node;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return this.routesApi.findClosestNode(this.map.mapData.map_id, vertex, floor);\n case 2:\n node = _context2.sent;\n // console.log(\"NODE2\", node);\n\n this.node = node;\n\n // console.log(\"MAP\", this.map);\n\n this.map.location = node.node_id;\n\n // this.setupView.setNode(node);\n this.setupView.codeSnippet.innerHTML = \"https://waygomaps.com/\".concat(this.map.mapData.map_id, \"?location=\").concat(node.node_id);\n case 6:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this);\n }));\n function getClosestNode(_x2, _x3) {\n return _getClosestNode.apply(this, arguments);\n }\n return getClosestNode;\n }()\n }, {\n key: \"_initializeEventListeners\",\n value: function _initializeEventListeners() {\n this.map.on('state:default', this._handleDefaultState.bind(this));\n this.map.on('state:search', this._handleSearchState.bind(this));\n this.map.on('state:selectedContent', this._handleSelectedContentState.bind(this));\n this.map.on('state:directions', this._handleDirectionsState.bind(this));\n this.map.on('state:setup', this._handleSetupState.bind(this));\n this.map.on('load', this._handleMapLoad.bind(this));\n this.map.on('floorChanged', this._handleFloorChange.bind(this));\n this.setupView.on('exit', this._handleSetupViewExitState.bind(this));\n this.setupView.on('configure', this._handleSetupViewConfigureState.bind(this));\n }\n }, {\n key: \"_handleMapLoad\",\n value: function _handleMapLoad(_) {\n // const { mapData } = data\n // const mapName = mapData.map_name;\n // if (mapName) {\n // this.searchBox.searchBar.setPlaceholderText(`Search ${mapName}`);\n // } else {\n // this.searchBox.searchBar.setPlaceholderText(`Search`);\n // }\n return;\n }\n }, {\n key: \"_renderDesktopView\",\n value: function _renderDesktopView() {\n // const element = this.searchBox.getElement();\n // this.container.appendChild(element);\n this.container.classList.add('desktop-view');\n this.container.classList.remove('mobile-view');\n // if (element) {\n // this.searchBox.setViewForDesktop();\n // }\n }\n }, {\n key: \"_renderMobileView\",\n value: function _renderMobileView() {\n // const element = this.searchBox.getElement();\n // this.container.appendChild(element);\n this.container.classList.add('mobile-view');\n this.container.classList.remove('desktop-view');\n // if (element) {\n // this.searchBox.setViewForMobile();\n // }\n }\n }, {\n key: \"bringToFront\",\n value: function bringToFront() {\n /* z-index: 7; */\n this.container.style.zIndex = '1';\n }\n }, {\n key: \"bringBack\",\n value: function bringBack() {\n this.container.style.zIndex = '';\n }\n }, {\n key: \"_handleDefaultState\",\n value: function _handleDefaultState() {\n this.hide();\n }\n }, {\n key: \"_handleSearchState\",\n value: function _handleSearchState(_) {\n this.hide();\n }\n }, {\n key: \"_handleSelectedContentState\",\n value: function _handleSelectedContentState(_) {\n this.hide();\n }\n }, {\n key: \"_handleDirectionsState\",\n value: function _handleDirectionsState(_) {\n this.hide();\n }\n }, {\n key: \"_handleSetupState\",\n value: function () {\n var _handleSetupState2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n var _this3 = this;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) switch (_context4.prev = _context4.next) {\n case 0:\n this.initializeDraggablePoint();\n this.show();\n // const vertex = this.getVertex();\n // const floor = this.map.getCurrentFloor();\n // console.log(\"VERTEX\", vertex);\n // console.log(\"FLOOR\", floor);\n // if (vertex && floor) {\n // const node = await this.getClosestNode(vertex, floor);\n // this.node = node;\n // this.setupView.codeSnippet.innerHTML = `https://waygomaps.com/${this.map.mapData.map_id}?location=${node.node_id}`;\n // }\n\n setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n var vertex, floor, element;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n vertex = _this3.getVertex();\n floor = _this3.map.getCurrentFloor(); // console.log(\"VERTEX\", vertex);\n // console.log(\"FLOOR\", floor);\n if (!(vertex !== null && floor !== null)) {\n _context3.next = 5;\n break;\n }\n _context3.next = 5;\n return _this3.getClosestNode(vertex, floor);\n case 5:\n element = _this3.setupView.getElement();\n _this3.container.appendChild(element);\n case 7:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3);\n })), 200);\n case 3:\n case \"end\":\n return _context4.stop();\n }\n }, _callee4, this);\n }));\n function _handleSetupState() {\n return _handleSetupState2.apply(this, arguments);\n }\n return _handleSetupState;\n }()\n }, {\n key: \"_handleFloorChange\",\n value: function _handleFloorChange(data) {\n var floorIndex = data.floorIndex;\n var vertex = this.getVertex();\n var state = this.map.getCurrentState();\n if (state === 'setup') {\n this.getClosestNode(vertex, floorIndex);\n }\n }\n }, {\n key: \"_handleSetupViewExitState\",\n value: function _handleSetupViewExitState() {\n // console.log(\"HANDLE SETUP VIEW EXIT STATE\");\n this.removeDraggablePoint();\n this.map.setToDefaultState();\n }\n }, {\n key: \"_handleSetupViewConfigureState\",\n value: function _handleSetupViewConfigureState() {\n // console.log(\"HANDLE SETUP VIEW CONFIGURE STATE\", this.map.location, this.node.node_id);\n\n this.removeDraggablePoint();\n this.map.setToDefaultState();\n }\n }]);\n}(_core_Control__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SetupControl);\n\n//# sourceURL=webpack://waygomaps/./src/Controls/SetupControl.js?");
|
|
650
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Control__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core/Control */ \"./src/core/Control.js\");\n/* harmony import */ var _WaygoMaps__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../WaygoMaps */ \"./src/WaygoMaps.js\");\n/* harmony import */ var _utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../utils/coordinateSystems */ \"./src/utils/coordinateSystems.js\");\n/* harmony import */ var _components_SetupView_SetupView__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../components/SetupView/SetupView */ \"./src/components/SetupView/SetupView.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _superPropGet(t, e, r, o) { var p = _get(_getPrototypeOf(1 & o ? t.prototype : t), e, r); return 2 & o ? function (t) { return p.apply(r, t); } : p; }\nfunction _get() { return _get = \"undefined\" != typeof Reflect && Reflect.get ? Reflect.get.bind() : function (e, t, r) { var p = _superPropBase(e, t); if (p) { var n = Object.getOwnPropertyDescriptor(p, t); return n.get ? n.get.call(arguments.length < 3 ? e : r) : n.value; } }, _get.apply(null, arguments); }\nfunction _superPropBase(t, o) { for (; !{}.hasOwnProperty.call(t, o) && null !== (t = _getPrototypeOf(t));); return t; }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n// import SearchBox from \"../components/SearchBox/SearchBox\";\n\n\n\n\nvar SetupControl = /*#__PURE__*/function (_Control) {\n function SetupControl() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, SetupControl);\n _this = _callSuper(this, SetupControl, [options]);\n // this.searchBox = new SearchBox();\n _this.setupView = new _components_SetupView_SetupView__WEBPACK_IMPORTED_MODULE_3__[\"default\"]();\n // this.searchApi = waygoMaps.getSearchApi();\n _this.routesApi = _WaygoMaps__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getRotuesApi();\n _this.node = null;\n return _this;\n }\n _inherits(SetupControl, _Control);\n return _createClass(SetupControl, [{\n key: \"onAdd\",\n value: function onAdd(map) {\n this.map = map;\n this.container = document.createElement('div');\n this.container.className = 'setup-control-container';\n this._initializeEventListeners();\n this._attachResizeListener();\n this._initialize();\n this.show();\n return this.container;\n }\n }, {\n key: \"onRemove\",\n value: function onRemove() {\n this.removeDraggablePoint();\n _superPropGet(SetupControl, \"onRemove\", this, 3)([]);\n }\n }, {\n key: \"removeDraggablePoint\",\n value: function removeDraggablePoint() {\n if (this.map && this.map.map) {\n // Remove layers first\n if (this.map.map.getLayer('point')) {\n this.map.map.removeLayer('point');\n }\n if (this.map.map.getLayer('point-border')) {\n this.map.map.removeLayer('point-border');\n }\n // Then remove source\n if (this.map.map.getSource('point')) {\n this.map.map.removeSource('point');\n }\n }\n }\n }, {\n key: \"initializeDraggablePoint\",\n value: function initializeDraggablePoint() {\n var _this2 = this;\n var canvas = this.map.map.getCanvas();\n var geojson = {\n type: 'FeatureCollection',\n features: [{\n type: 'Feature',\n geometry: {\n type: 'Point',\n coordinates: [0, 0]\n },\n properties: {\n _floor: this.map.getCurrentFloor() // Initialize with default floor\n }\n }]\n };\n var onMove = function onMove(e) {\n var coords = e.lngLat;\n\n // Set a UI indicator for dragging.\n // canvas.style.cursor = 'grabbing';\n\n // Update the Point feature in `geojson` coordinates\n // and call setData to the source layer `point` on it.\n geojson.features[0].geometry.coordinates = [coords.lng, coords.lat];\n var pointSource = _this2.map.map.getSource('point');\n if (pointSource) {\n pointSource.setData(geojson);\n }\n // this.map.map.getSource('point').setData(geojson);\n };\n var onUp = /*#__PURE__*/function () {\n var _ref = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(e) {\n var coords, vertex, floor;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n coords = e.lngLat;\n canvas.style.cursor = '';\n vertex = (0,_utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_2__.convertCoordinateToVertex)([coords.lng, coords.lat], [0, 0], 30);\n floor = geojson.features[0].properties._floor;\n _context.next = 6;\n return _this2.getClosestNode(vertex, floor);\n case 6:\n // Unbind mouse/touch events\n _this2.map.map.off('mousemove', onMove);\n _this2.map.map.off('touchmove', onMove);\n case 8:\n case \"end\":\n return _context.stop();\n }\n }, _callee);\n }));\n return function onUp(_x) {\n return _ref.apply(this, arguments);\n };\n }();\n this.map.on('floorChanged', function (data) {\n var floorIndex = data.floorIndex;\n // Update the point's floor property\n geojson.features[0].properties._floor = floorIndex;\n // Update the source data\n var pointSource = _this2.map.map.getSource('point');\n if (pointSource) {\n pointSource.setData(geojson);\n }\n });\n\n // Add a single point to the map.\n this.map.map.addSource('point', {\n 'type': 'geojson',\n 'data': geojson\n });\n\n // console.log(\"ADD LAYER\");\n // Add white border circle layer\n this.map.map.addLayer({\n 'id': 'point-border',\n 'type': 'circle',\n 'source': 'point',\n 'paint': {\n 'circle-radius': 18,\n 'circle-color': '#FFFFFF'\n }\n });\n\n // Add red inner circle layer\n this.map.map.addLayer({\n 'id': 'point',\n 'type': 'circle',\n 'source': 'point',\n 'paint': {\n 'circle-radius': 15,\n 'circle-color': '#F84C4C' // red color\n }\n });\n\n // When the cursor enters a feature in\n // the point layer, prepare for dragging.\n this.map.map.on('mouseenter', 'point', function () {\n _this2.map.map.setPaintProperty('point', 'circle-color', '#FF8080');\n canvas.style.cursor = 'pointer';\n });\n this.map.map.on('mouseleave', 'point', function () {\n _this2.map.map.setPaintProperty('point', 'circle-color', '#F84C4C');\n canvas.style.cursor = 'default';\n });\n this.map.map.on('mousedown', 'point', function (e) {\n // Prevent the default map drag behavior.\n e.preventDefault();\n canvas.style.cursor = 'grabbing';\n _this2.map.map.on('mousemove', onMove);\n _this2.map.map.once('mouseup', onUp);\n });\n this.map.map.on('touchstart', 'point', function (e) {\n if (e.points.length !== 1) return;\n\n // Prevent the default map drag behavior.\n e.preventDefault();\n _this2.map.map.on('touchmove', onMove);\n _this2.map.map.once('touchend', onUp);\n });\n }\n }, {\n key: \"getVertex\",\n value: function getVertex() {\n var features = this.map.map.querySourceFeatures('point');\n if (features.length > 0) {\n var coordinates = features[0].geometry.coordinates;\n return (0,_utils_coordinateSystems__WEBPACK_IMPORTED_MODULE_2__.convertCoordinateToVertex)(coordinates, this.map.mapData.reference_point, 30.0);\n }\n return null;\n }\n }, {\n key: \"getClosestNode\",\n value: function () {\n var _getClosestNode = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(vertex, floor) {\n var node;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n _context2.next = 2;\n return this.routesApi.findClosestNode(this.map.mapData.map_id, vertex, floor);\n case 2:\n node = _context2.sent;\n this.node = node;\n this.map.location = node.node_id;\n\n // this.setupView.setNode(node);\n this.setupView.codeSnippet.innerHTML = \"https://waygomaps.com/\".concat(this.map.mapData.map_id, \"?location=\").concat(node.node_id);\n case 6:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this);\n }));\n function getClosestNode(_x2, _x3) {\n return _getClosestNode.apply(this, arguments);\n }\n return getClosestNode;\n }()\n }, {\n key: \"_initializeEventListeners\",\n value: function _initializeEventListeners() {\n this.map.on('state:default', this._handleDefaultState.bind(this));\n this.map.on('state:search', this._handleSearchState.bind(this));\n this.map.on('state:selectedContent', this._handleSelectedContentState.bind(this));\n this.map.on('state:directions', this._handleDirectionsState.bind(this));\n this.map.on('state:setup', this._handleSetupState.bind(this));\n this.map.on('load', this._handleMapLoad.bind(this));\n this.map.on('floorChanged', this._handleFloorChange.bind(this));\n this.setupView.on('exit', this._handleSetupViewExitState.bind(this));\n this.setupView.on('configure', this._handleSetupViewConfigureState.bind(this));\n }\n }, {\n key: \"_handleMapLoad\",\n value: function _handleMapLoad(_) {\n // const { mapData } = data\n // const mapName = mapData.map_name;\n // if (mapName) {\n // this.searchBox.searchBar.setPlaceholderText(`Search ${mapName}`);\n // } else {\n // this.searchBox.searchBar.setPlaceholderText(`Search`);\n // }\n return;\n }\n }, {\n key: \"_renderDesktopView\",\n value: function _renderDesktopView() {\n // const element = this.searchBox.getElement();\n // this.container.appendChild(element);\n this.container.classList.add('desktop-view');\n this.container.classList.remove('mobile-view');\n // if (element) {\n // this.searchBox.setViewForDesktop();\n // }\n }\n }, {\n key: \"_renderMobileView\",\n value: function _renderMobileView() {\n // const element = this.searchBox.getElement();\n // this.container.appendChild(element);\n this.container.classList.add('mobile-view');\n this.container.classList.remove('desktop-view');\n // if (element) {\n // this.searchBox.setViewForMobile();\n // }\n }\n }, {\n key: \"bringToFront\",\n value: function bringToFront() {\n /* z-index: 7; */\n this.container.style.zIndex = '1';\n }\n }, {\n key: \"bringBack\",\n value: function bringBack() {\n this.container.style.zIndex = '';\n }\n }, {\n key: \"_handleDefaultState\",\n value: function _handleDefaultState() {\n this.hide();\n }\n }, {\n key: \"_handleSearchState\",\n value: function _handleSearchState(_) {\n this.hide();\n }\n }, {\n key: \"_handleSelectedContentState\",\n value: function _handleSelectedContentState(_) {\n this.hide();\n }\n }, {\n key: \"_handleDirectionsState\",\n value: function _handleDirectionsState(_) {\n this.hide();\n }\n }, {\n key: \"_handleSetupState\",\n value: function () {\n var _handleSetupState2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4() {\n var _this3 = this;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) switch (_context4.prev = _context4.next) {\n case 0:\n this.initializeDraggablePoint();\n this.show();\n // const vertex = this.getVertex();\n // const floor = this.map.getCurrentFloor();\n // if (vertex && floor) {\n // const node = await this.getClosestNode(vertex, floor);\n // this.node = node;\n // this.setupView.codeSnippet.innerHTML = `https://waygomaps.com/${this.map.mapData.map_id}?location=${node.node_id}`;\n // }\n\n setTimeout( /*#__PURE__*/_asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n var vertex, floor, element;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n vertex = _this3.getVertex();\n floor = _this3.map.getCurrentFloor();\n if (!(vertex !== null && floor !== null)) {\n _context3.next = 5;\n break;\n }\n _context3.next = 5;\n return _this3.getClosestNode(vertex, floor);\n case 5:\n element = _this3.setupView.getElement();\n _this3.container.appendChild(element);\n case 7:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3);\n })), 200);\n case 3:\n case \"end\":\n return _context4.stop();\n }\n }, _callee4, this);\n }));\n function _handleSetupState() {\n return _handleSetupState2.apply(this, arguments);\n }\n return _handleSetupState;\n }()\n }, {\n key: \"_handleFloorChange\",\n value: function _handleFloorChange(data) {\n var floorIndex = data.floorIndex;\n var vertex = this.getVertex();\n var state = this.map.getCurrentState();\n if (state === 'setup') {\n this.getClosestNode(vertex, floorIndex);\n }\n }\n }, {\n key: \"_handleSetupViewExitState\",\n value: function _handleSetupViewExitState() {\n this.removeDraggablePoint();\n this.map.setToDefaultState();\n }\n }, {\n key: \"_handleSetupViewConfigureState\",\n value: function _handleSetupViewConfigureState() {\n this.removeDraggablePoint();\n this.map.setToDefaultState();\n }\n }]);\n}(_core_Control__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SetupControl);\n\n//# sourceURL=webpack://waygomaps/./src/Controls/SetupControl.js?");
|
|
651
651
|
|
|
652
652
|
/***/ }),
|
|
653
653
|
|
|
@@ -713,7 +713,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
713
713
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
714
714
|
|
|
715
715
|
"use strict";
|
|
716
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ContentChildButton: () => (/* binding */ ContentChildButton),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core/Component */ \"./src/core/Component.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(r) { if (Array.isArray(r)) return r; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\nvar ContentChildButton = /*#__PURE__*/function (_Component) {\n function ContentChildButton(childPlacement) {\n var _this;\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n _classCallCheck(this, ContentChildButton);\n _this = _callSuper(this, ContentChildButton, [options]);\n _this.childPlacement = childPlacement;\n _this.maxValueLength = 50;\n _this.maxEntriesToShow = 3;\n _this._initialize();\n return _this;\n }\n _inherits(ContentChildButton, _Component);\n return _createClass(ContentChildButton, [{\n key: \"_initialize\",\n value: function _initialize() {\n this.element = document.createElement('button');\n this.element.className = 'content-details-child-view';\n this.titleElement = document.createElement('div');\n this.titleElement.className = 'content-details-child-view-title';\n var titleKey = this.childPlacement.catalog.content_title_key;\n var titleValue = this.childPlacement.content.data[titleKey];\n
|
|
716
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ContentChildButton: () => (/* binding */ ContentChildButton),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core/Component */ \"./src/core/Component.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(r) { if (Array.isArray(r)) return r; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\nvar ContentChildButton = /*#__PURE__*/function (_Component) {\n function ContentChildButton(childPlacement) {\n var _this;\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n _classCallCheck(this, ContentChildButton);\n _this = _callSuper(this, ContentChildButton, [options]);\n _this.childPlacement = childPlacement;\n _this.maxValueLength = 50;\n _this.maxEntriesToShow = 3;\n _this._initialize();\n return _this;\n }\n _inherits(ContentChildButton, _Component);\n return _createClass(ContentChildButton, [{\n key: \"_initialize\",\n value: function _initialize() {\n this.element = document.createElement('button');\n this.element.className = 'content-details-child-view';\n this.titleElement = document.createElement('div');\n this.titleElement.className = 'content-details-child-view-title';\n var titleKey = this.childPlacement.catalog.content_title_key;\n var titleValue = this.childPlacement.content.data[titleKey];\n this.titleElement.textContent = \"\".concat(titleValue);\n this._render();\n }\n }, {\n key: \"_truncateText\",\n value: function _truncateText(text, maxLength) {\n if (text.length > maxLength) {\n return text.slice(0, maxLength - 3) + '...'; // Truncate and append \"...\"\n }\n return text;\n }\n }, {\n key: \"findViableData\",\n value: function findViableData(contentPlacement) {\n var data = contentPlacement.content.data;\n var keys = Object.keys(data);\n var titleKey = contentPlacement.catalog.content_title_key;\n var excludedKeys = contentPlacement.excluded_child_fields || [];\n var viableData = {};\n keys.forEach(function (key) {\n var value = data[key];\n if (key !== titleKey &&\n // key !== 'Type' &&\n !key.toLowerCase().includes('description') && !excludedKeys.includes(key) && contentPlacement.catalog.data_schema[key] !== 'image' && contentPlacement.catalog.data_schema[key] !== 'url' && value !== null && value !== undefined && value !== \"\") {\n viableData[key] = value;\n }\n });\n return viableData;\n }\n }, {\n key: \"_render\",\n value: function _render() {\n var _this2 = this;\n this.element.appendChild(this.titleElement);\n var dataDict = this.findViableData(this.childPlacement);\n var entries = Object.entries(dataDict);\n if (Object.keys(dataDict).length === 0) {\n this.titleElement.style.marginBottom = \"0px\";\n }\n entries.slice(0, this.maxEntriesToShow).forEach(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n key = _ref2[0],\n value = _ref2[1];\n // for (const [key, value] of ) {\n var dataRow = document.createElement('div');\n dataRow.className = 'content-details-child-view-data-row';\n var keyElement = document.createElement('div');\n keyElement.className = 'content-details-child-view-data-key';\n keyElement.textContent = key.toUpperCase(); // `${key}: `;\n\n var valueElement = document.createElement('div');\n valueElement.className = 'content-details-child-view-data-value';\n valueElement.textContent = _this2._truncateText(value.toString(), _this2.maxValueLength); // value;\n\n dataRow.appendChild(keyElement);\n dataRow.appendChild(valueElement);\n _this2.element.appendChild(dataRow);\n });\n }\n }, {\n key: \"getElement\",\n value: function getElement() {\n return this.element;\n }\n }]);\n}(_core_Component__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ContentChildButton);\n\n//# sourceURL=webpack://waygomaps/./src/components/ContentPlacementView/ContentChildButton.js?");
|
|
717
717
|
|
|
718
718
|
/***/ }),
|
|
719
719
|
|
|
@@ -735,7 +735,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
735
735
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
736
736
|
|
|
737
737
|
"use strict";
|
|
738
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ContentDetails: () => (/* binding */ ContentDetails),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core/Component */ \"./src/core/Component.js\");\n/* harmony import */ var _ContentPlacementHeader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ContentPlacementHeader */ \"./src/components/ContentPlacementView/ContentPlacementHeader.js\");\n/* harmony import */ var _ContextualLocationView__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ContextualLocationView */ \"./src/components/ContentPlacementView/ContextualLocationView.js\");\n/* harmony import */ var _DetailsView__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./DetailsView */ \"./src/components/ContentPlacementView/DetailsView.js\");\n/* harmony import */ var _ContentChildrenView__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ContentChildrenView */ \"./src/components/ContentPlacementView/ContentChildrenView.js\");\n/* harmony import */ var _assets_location_svg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../assets/location.svg */ \"./src/assets/location.svg\");\n/* harmony import */ var _assets_website_svg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../assets/website.svg */ \"./src/assets/website.svg\");\n/* harmony import */ var _assets_copyIcon_svg__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../assets/copyIcon.svg */ \"./src/assets/copyIcon.svg\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(r) { if (Array.isArray(r)) return r; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\n\n\n\n\n\nvar ContentDetails = /*#__PURE__*/function (_Component) {\n function ContentDetails() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, ContentDetails);\n _this = _callSuper(this, ContentDetails, [options]);\n _this.contentPlacement = null;\n _this.element = document.createElement('div');\n _this.element.className = 'content-details';\n _this.header = document.createElement('div');\n _this.header.className = 'content-details-header';\n _this.contentPlacementHeader = null;\n _this.actionsView = document.createElement('div');\n _this.actionsView.className = 'content-details-section';\n _this.actionButtons = document.createElement('div');\n _this.actionButtons.className = 'content-details-action-buttons';\n _this.directionsButton = document.createElement('button');\n _this.directionsButton.className = 'content-details-directions-button';\n _this.directionsButton.textContent = 'Directions';\n _this.shareButton = document.createElement('button');\n _this.shareButton.className = 'content-details-share-button';\n _this.shareButton.textContent = 'Share';\n var copyIconElement = document.createElement('img');\n copyIconElement.src = _assets_copyIcon_svg__WEBPACK_IMPORTED_MODULE_7__[\"default\"];\n copyIconElement.className = 'copy-icon'; // Add a class for styling\n\n _this.shareButton.appendChild(copyIconElement);\n _this.locationButton = null;\n // this.websiteButton = null;\n _this.websiteButtons = [];\n _this.detailsView = null;\n _this.childrenComponents = [];\n _this.imageContainer = null;\n return _this;\n }\n _inherits(ContentDetails, _Component);\n return _createClass(ContentDetails, [{\n key: \"_setupEventListeners\",\n value: function _setupEventListeners() {\n var _this2 = this;\n this.childrenComponents.forEach(function (childrenComponent) {\n childrenComponent.on('selectChildContentPlacement', _this2._handleSelectChildContentPlacement.bind(_this2));\n });\n this.directionsButton.addEventListener('click', this._handleDirectionsButtonSelect.bind(this));\n this.shareButton.addEventListener('click', this._handleShareButtonSelect.bind(this));\n }\n }, {\n key: \"_render\",\n value: function _render() {\n var _this3 = this;\n this.element.innerHTML = '';\n this.header.innerHTML = '';\n this.actionsView.innerHTML = '';\n\n // Header elements\n if (this.contentPlacementHeader) {\n this.header.appendChild(this.contentPlacementHeader.getElement());\n }\n this.actionButtons.appendChild(this.directionsButton);\n this.actionButtons.appendChild(this.shareButton);\n this.header.appendChild(this.actionButtons);\n if (this.locationButton) {\n this.actionsView.appendChild(this.locationButton.getElement());\n }\n\n // if (this.websiteButton) {\n // this.actionsView.appendChild(this.websiteButton.getElement());\n // }\n\n this.websiteButtons.forEach(function (websiteButton) {\n _this3.actionsView.appendChild(websiteButton.getElement());\n });\n\n // Add image container if there are images\n if (this.imageContainer) {\n this.actionsView.appendChild(this.imageContainer);\n }\n this.header.appendChild(this.actionsView);\n this.element.appendChild(this.header);\n\n // Details view element\n if (this.detailsView) {\n this.detailsView.innerHTML = '';\n this.element.appendChild(this.detailsView.getElement());\n }\n\n // Children view elements\n this.childrenComponents.forEach(function (childrenComponent) {\n _this3.element.appendChild(childrenComponent.getElement());\n });\n }\n }, {\n key: \"_handleShareButtonSelect\",\n value: function _handleShareButtonSelect() {\n this.fire('selectShareButton', {\n placementId: this.contentPlacement.placement_id\n });\n }\n }, {\n key: \"showCopyPopup\",\n value: function showCopyPopup() {\n // Create popup element\n var popup = document.createElement('div');\n popup.className = 'copy-popup';\n popup.textContent = 'Copied to clipboard';\n\n // Position the popup below the share button\n var buttonRect = this.shareButton.getBoundingClientRect();\n var popupWidth = 120;\n popup.style.position = 'absolute';\n popup.style.left = \"\".concat(buttonRect.left + buttonRect.width / 2 - popupWidth / 2, \"px\"); // `${buttonRect.left}px`;\n popup.style.top = \"\".concat(buttonRect.bottom + window.scrollY, \"px\"); // Adjust for scroll position\n popup.style.zIndex = '9999'; // Ensure it appears on top of other components\n\n document.body.appendChild(popup);\n\n // Fade out and remove popup after 2 seconds\n setTimeout(function () {\n popup.style.opacity = '0';\n popup.style.transition = 'opacity 0.5s';\n setTimeout(function () {\n popup.remove();\n }, 500);\n }, 1500);\n }\n }, {\n key: \"_handleDirectionsButtonSelect\",\n value: function _handleDirectionsButtonSelect() {\n this.fire('selectDirectionsButton', {\n placementId: this.contentPlacement.placement_id\n });\n }\n }, {\n key: \"_handleBackArrowClick\",\n value: function _handleBackArrowClick() {\n this.fire('selectBackButton');\n }\n }, {\n key: \"_handleSelectChildContentPlacement\",\n value: function _handleSelectChildContentPlacement(data) {\n var placementId = data.placementId;\n this.fire('selectChildContentPlacement', {\n placementId: placementId\n });\n }\n }, {\n key: \"findViableAdditionalData\",\n value: function findViableAdditionalData(contentPlacement) {\n // const schema = contentPlacement.catalog.data_schema;\n // const titleKey = contentPlacement.catalog.content_title_key;\n // const excludedKeys = contentPlacement.excluded_child_fields || [];\n // var viableData = {};\n\n // for (const [key, value] of Object.entries(schema)) {\n // if (value !== 'image' && value !== 'url' && key !== titleKey && !excludedKeys.includes(key)) {\n // const dataValue = contentPlacement.content.data[key];\n // if (dataValue && dataValue.trim() !== '') {\n // const cleanDataValue = dataValue.trim().replace(/\\s+/g, ' ');\n // viableData[key] = cleanDataValue;\n // }\n // }\n // }\n // return viableData;\n\n var schema = contentPlacement.catalog.data_schema;\n var titleKey = contentPlacement.catalog.content_title_key;\n var excludedKeys = contentPlacement.excluded_child_fields || [];\n var viableData = {};\n for (var _i = 0, _Object$entries = Object.entries(schema); _i < _Object$entries.length; _i++) {\n var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),\n key = _Object$entries$_i[0],\n value = _Object$entries$_i[1];\n if (value !== 'image' && value !== 'url' && key !== titleKey && !excludedKeys.includes(key)) {\n var dataValue = contentPlacement.content.data[key];\n if (dataValue && dataValue.trim() !== '') {\n // Only trim leading/trailing whitespace, preserve newlines and other content\n var cleanDataValue = dataValue.trim();\n console.log(\"[ContentDetails] Processing field \\\"\".concat(key, \"\\\":\"), {\n original: JSON.stringify(dataValue),\n cleaned: JSON.stringify(cleanDataValue),\n hasNewlines: dataValue.includes('\\n'),\n hasTabs: dataValue.includes('\\t'),\n length: dataValue.length\n });\n viableData[key] = cleanDataValue;\n }\n }\n }\n return viableData;\n }\n }, {\n key: \"updateView\",\n value: function updateView(contentPlacement) {\n var _this4 = this;\n this.contentPlacement = contentPlacement;\n\n // Update the header\n this.contentPlacementHeader = new _ContentPlacementHeader__WEBPACK_IMPORTED_MODULE_1__[\"default\"](contentPlacement);\n var schema = contentPlacement.catalog.data_schema;\n\n // Update location and website buttons\n this.locationButton = new _ContextualLocationView__WEBPACK_IMPORTED_MODULE_2__[\"default\"](_assets_location_svg__WEBPACK_IMPORTED_MODULE_5__[\"default\"], contentPlacement.contextual_location);\n // const websiteUrl = contentPlacement.content.data['URL'] || contentPlacement.content.data['Website'] || contentPlacement.content.data['LinkedIn'] || contentPlacement.content.data['Website URL'] || contentPlacement.content.data['SNS'];\n var urlFields = ['URL', 'Website', 'LinkedIn', 'Website URL', 'SNS', 'Networking Link'];\n for (var _i2 = 0, _Object$entries2 = Object.entries(schema); _i2 < _Object$entries2.length; _i2++) {\n var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),\n key = _Object$entries2$_i[0],\n value = _Object$entries2$_i[1];\n if (value === 'url') {\n var url = contentPlacement.content.data[key];\n if (url && url.trim() !== '') {\n this.websiteButtons.push(new _ContextualLocationView__WEBPACK_IMPORTED_MODULE_2__[\"default\"](_assets_website_svg__WEBPACK_IMPORTED_MODULE_6__[\"default\"], url, url));\n }\n }\n }\n\n // Make a copy of content data\n var contentDataCopy = _objectSpread({}, contentPlacement.content.data);\n\n // Collect image keys and remove them from copy\n var images = [];\n var displayImgKey = contentPlacement.catalog.content_display_img_key;\n for (var _i3 = 0, _Object$entries3 = Object.entries(schema); _i3 < _Object$entries3.length; _i3++) {\n var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i3], 2),\n _key = _Object$entries3$_i[0],\n _value = _Object$entries3$_i[1];\n if (_value === 'image' && _key !== displayImgKey) {\n var imageUrl = contentPlacement.content.data[_key];\n if (imageUrl) {\n images.push(imageUrl);\n }\n delete contentDataCopy[_key];\n }\n }\n\n // Update details view with new viable data\n var viableAdditionalData = this.findViableAdditionalData(contentPlacement);\n var viableDataKeys = Object.keys(viableAdditionalData);\n this.detailsView = viableDataKeys.length > 0 ? new _DetailsView__WEBPACK_IMPORTED_MODULE_3__[\"default\"](viableAdditionalData) : null;\n\n // Update children components\n this.childrenComponents = [];\n for (var _i4 = 0, _Object$entries4 = Object.entries(contentPlacement.children); _i4 < _Object$entries4.length; _i4++) {\n var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i4], 2),\n title = _Object$entries4$_i[0],\n children = _Object$entries4$_i[1];\n var childrenComponent = new _ContentChildrenView__WEBPACK_IMPORTED_MODULE_4__[\"default\"](title, children);\n this.childrenComponents.push(childrenComponent);\n }\n\n // Handle images\n if (images.length > 0) {\n this.imageContainer = document.createElement('div');\n this.imageContainer.className = 'content-details-image-container';\n var firstImage = document.createElement('img');\n firstImage.src = images[0];\n firstImage.className = 'content-details-preview-image';\n var hoverPopup = document.createElement('div');\n hoverPopup.className = 'image-hover-popup';\n hoverPopup.textContent = 'See photos';\n this.imageContainer.appendChild(firstImage);\n this.imageContainer.appendChild(hoverPopup);\n this.imageContainer.addEventListener('click', function () {\n _this4.fire('selectPhotos', {\n placementId: _this4.contentPlacement.placement_id,\n images: images\n });\n });\n } else {\n this.imageContainer = null;\n }\n\n // Reset event listeners\n this._setupEventListeners();\n\n // Re-render the component with the new data\n this._render();\n }\n }, {\n key: \"getElement\",\n value: function getElement() {\n return this.element;\n }\n }]);\n}(_core_Component__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ContentDetails);\n\n//# sourceURL=webpack://waygomaps/./src/components/ContentPlacementView/ContentDetails.js?");
|
|
738
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ContentDetails: () => (/* binding */ ContentDetails),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core/Component */ \"./src/core/Component.js\");\n/* harmony import */ var _ContentPlacementHeader__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./ContentPlacementHeader */ \"./src/components/ContentPlacementView/ContentPlacementHeader.js\");\n/* harmony import */ var _ContextualLocationView__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./ContextualLocationView */ \"./src/components/ContentPlacementView/ContextualLocationView.js\");\n/* harmony import */ var _DetailsView__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./DetailsView */ \"./src/components/ContentPlacementView/DetailsView.js\");\n/* harmony import */ var _ContentChildrenView__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./ContentChildrenView */ \"./src/components/ContentPlacementView/ContentChildrenView.js\");\n/* harmony import */ var _assets_location_svg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../assets/location.svg */ \"./src/assets/location.svg\");\n/* harmony import */ var _assets_website_svg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../assets/website.svg */ \"./src/assets/website.svg\");\n/* harmony import */ var _assets_copyIcon_svg__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../assets/copyIcon.svg */ \"./src/assets/copyIcon.svg\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _slicedToArray(r, e) { return _arrayWithHoles(r) || _iterableToArrayLimit(r, e) || _unsupportedIterableToArray(r, e) || _nonIterableRest(); }\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.\"); }\nfunction _unsupportedIterableToArray(r, a) { if (r) { if (\"string\" == typeof r) return _arrayLikeToArray(r, a); var t = {}.toString.call(r).slice(8, -1); return \"Object\" === t && r.constructor && (t = r.constructor.name), \"Map\" === t || \"Set\" === t ? Array.from(r) : \"Arguments\" === t || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t) ? _arrayLikeToArray(r, a) : void 0; } }\nfunction _arrayLikeToArray(r, a) { (null == a || a > r.length) && (a = r.length); for (var e = 0, n = Array(a); e < a; e++) n[e] = r[e]; return n; }\nfunction _iterableToArrayLimit(r, l) { var t = null == r ? null : \"undefined\" != typeof Symbol && r[Symbol.iterator] || r[\"@@iterator\"]; if (null != t) { var e, n, i, u, a = [], f = !0, o = !1; try { if (i = (t = t.call(r)).next, 0 === l) { if (Object(t) !== t) return; f = !1; } else for (; !(f = (e = i.call(t)).done) && (a.push(e.value), a.length !== l); f = !0); } catch (r) { o = !0, n = r; } finally { try { if (!f && null != t[\"return\"] && (u = t[\"return\"](), Object(u) !== u)) return; } finally { if (o) throw n; } } return a; } }\nfunction _arrayWithHoles(r) { if (Array.isArray(r)) return r; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\n\n\n\n\n\nvar ContentDetails = /*#__PURE__*/function (_Component) {\n function ContentDetails() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, ContentDetails);\n _this = _callSuper(this, ContentDetails, [options]);\n _this.contentPlacement = null;\n _this.element = document.createElement('div');\n _this.element.className = 'content-details';\n _this.header = document.createElement('div');\n _this.header.className = 'content-details-header';\n _this.contentPlacementHeader = null;\n _this.actionsView = document.createElement('div');\n _this.actionsView.className = 'content-details-section';\n _this.actionButtons = document.createElement('div');\n _this.actionButtons.className = 'content-details-action-buttons';\n _this.directionsButton = document.createElement('button');\n _this.directionsButton.className = 'content-details-directions-button';\n _this.directionsButton.textContent = 'Directions';\n _this.shareButton = document.createElement('button');\n _this.shareButton.className = 'content-details-share-button';\n _this.shareButton.textContent = 'Share';\n var copyIconElement = document.createElement('img');\n copyIconElement.src = _assets_copyIcon_svg__WEBPACK_IMPORTED_MODULE_7__[\"default\"];\n copyIconElement.className = 'copy-icon'; // Add a class for styling\n\n _this.shareButton.appendChild(copyIconElement);\n _this.locationButton = null;\n // this.websiteButton = null;\n _this.websiteButtons = [];\n _this.detailsView = null;\n _this.childrenComponents = [];\n _this.imageContainer = null;\n return _this;\n }\n _inherits(ContentDetails, _Component);\n return _createClass(ContentDetails, [{\n key: \"_setupEventListeners\",\n value: function _setupEventListeners() {\n var _this2 = this;\n this.childrenComponents.forEach(function (childrenComponent) {\n childrenComponent.on('selectChildContentPlacement', _this2._handleSelectChildContentPlacement.bind(_this2));\n });\n this.directionsButton.addEventListener('click', this._handleDirectionsButtonSelect.bind(this));\n this.shareButton.addEventListener('click', this._handleShareButtonSelect.bind(this));\n }\n }, {\n key: \"_render\",\n value: function _render() {\n var _this3 = this;\n this.element.innerHTML = '';\n this.header.innerHTML = '';\n this.actionsView.innerHTML = '';\n\n // Header elements\n if (this.contentPlacementHeader) {\n this.header.appendChild(this.contentPlacementHeader.getElement());\n }\n this.actionButtons.appendChild(this.directionsButton);\n this.actionButtons.appendChild(this.shareButton);\n this.header.appendChild(this.actionButtons);\n if (this.locationButton) {\n this.actionsView.appendChild(this.locationButton.getElement());\n }\n\n // if (this.websiteButton) {\n // this.actionsView.appendChild(this.websiteButton.getElement());\n // }\n\n this.websiteButtons.forEach(function (websiteButton) {\n _this3.actionsView.appendChild(websiteButton.getElement());\n });\n\n // Add image container if there are images\n if (this.imageContainer) {\n this.actionsView.appendChild(this.imageContainer);\n }\n this.header.appendChild(this.actionsView);\n this.element.appendChild(this.header);\n\n // Details view element\n if (this.detailsView) {\n this.detailsView.innerHTML = '';\n this.element.appendChild(this.detailsView.getElement());\n }\n\n // Children view elements\n this.childrenComponents.forEach(function (childrenComponent) {\n _this3.element.appendChild(childrenComponent.getElement());\n });\n }\n }, {\n key: \"_handleShareButtonSelect\",\n value: function _handleShareButtonSelect() {\n this.fire('selectShareButton', {\n placementId: this.contentPlacement.placement_id\n });\n }\n }, {\n key: \"showCopyPopup\",\n value: function showCopyPopup() {\n // Create popup element\n var popup = document.createElement('div');\n popup.className = 'copy-popup';\n popup.textContent = 'Copied to clipboard';\n\n // Position the popup below the share button\n var buttonRect = this.shareButton.getBoundingClientRect();\n var popupWidth = 120;\n popup.style.position = 'absolute';\n popup.style.left = \"\".concat(buttonRect.left + buttonRect.width / 2 - popupWidth / 2, \"px\"); // `${buttonRect.left}px`;\n popup.style.top = \"\".concat(buttonRect.bottom + window.scrollY, \"px\"); // Adjust for scroll position\n popup.style.zIndex = '9999'; // Ensure it appears on top of other components\n\n document.body.appendChild(popup);\n\n // Fade out and remove popup after 2 seconds\n setTimeout(function () {\n popup.style.opacity = '0';\n popup.style.transition = 'opacity 0.5s';\n setTimeout(function () {\n popup.remove();\n }, 500);\n }, 1500);\n }\n }, {\n key: \"_handleDirectionsButtonSelect\",\n value: function _handleDirectionsButtonSelect() {\n this.fire('selectDirectionsButton', {\n placementId: this.contentPlacement.placement_id\n });\n }\n }, {\n key: \"_handleBackArrowClick\",\n value: function _handleBackArrowClick() {\n this.fire('selectBackButton');\n }\n }, {\n key: \"_handleSelectChildContentPlacement\",\n value: function _handleSelectChildContentPlacement(data) {\n var placementId = data.placementId;\n this.fire('selectChildContentPlacement', {\n placementId: placementId\n });\n }\n }, {\n key: \"findViableAdditionalData\",\n value: function findViableAdditionalData(contentPlacement) {\n // const schema = contentPlacement.catalog.data_schema;\n // const titleKey = contentPlacement.catalog.content_title_key;\n // const excludedKeys = contentPlacement.excluded_child_fields || [];\n // var viableData = {};\n\n // for (const [key, value] of Object.entries(schema)) {\n // if (value !== 'image' && value !== 'url' && key !== titleKey && !excludedKeys.includes(key)) {\n // const dataValue = contentPlacement.content.data[key];\n // if (dataValue && dataValue.trim() !== '') {\n // const cleanDataValue = dataValue.trim().replace(/\\s+/g, ' ');\n // viableData[key] = cleanDataValue;\n // }\n // }\n // }\n // return viableData;\n\n var schema = contentPlacement.catalog.data_schema;\n var titleKey = contentPlacement.catalog.content_title_key;\n var excludedKeys = contentPlacement.excluded_child_fields || [];\n var viableData = {};\n for (var _i = 0, _Object$entries = Object.entries(schema); _i < _Object$entries.length; _i++) {\n var _Object$entries$_i = _slicedToArray(_Object$entries[_i], 2),\n key = _Object$entries$_i[0],\n value = _Object$entries$_i[1];\n if (value !== 'image' && value !== 'url' && key !== titleKey && !excludedKeys.includes(key)) {\n var dataValue = contentPlacement.content.data[key];\n if (dataValue && dataValue.trim() !== '') {\n // Only trim leading/trailing whitespace, preserve newlines and other content\n var cleanDataValue = dataValue.trim();\n viableData[key] = cleanDataValue;\n }\n }\n }\n return viableData;\n }\n }, {\n key: \"updateView\",\n value: function updateView(contentPlacement) {\n var _this4 = this;\n this.contentPlacement = contentPlacement;\n\n // Update the header\n this.contentPlacementHeader = new _ContentPlacementHeader__WEBPACK_IMPORTED_MODULE_1__[\"default\"](contentPlacement);\n var schema = contentPlacement.catalog.data_schema;\n\n // Update location and website buttons\n this.locationButton = new _ContextualLocationView__WEBPACK_IMPORTED_MODULE_2__[\"default\"](_assets_location_svg__WEBPACK_IMPORTED_MODULE_5__[\"default\"], contentPlacement.contextual_location);\n // const websiteUrl = contentPlacement.content.data['URL'] || contentPlacement.content.data['Website'] || contentPlacement.content.data['LinkedIn'] || contentPlacement.content.data['Website URL'] || contentPlacement.content.data['SNS'];\n var urlFields = ['URL', 'Website', 'LinkedIn', 'Website URL', 'SNS', 'Networking Link'];\n for (var _i2 = 0, _Object$entries2 = Object.entries(schema); _i2 < _Object$entries2.length; _i2++) {\n var _Object$entries2$_i = _slicedToArray(_Object$entries2[_i2], 2),\n key = _Object$entries2$_i[0],\n value = _Object$entries2$_i[1];\n if (value === 'url') {\n var url = contentPlacement.content.data[key];\n if (url && url.trim() !== '') {\n this.websiteButtons.push(new _ContextualLocationView__WEBPACK_IMPORTED_MODULE_2__[\"default\"](_assets_website_svg__WEBPACK_IMPORTED_MODULE_6__[\"default\"], url, url));\n }\n }\n }\n\n // Make a copy of content data\n var contentDataCopy = _objectSpread({}, contentPlacement.content.data);\n\n // Collect image keys and remove them from copy\n var images = [];\n var displayImgKey = contentPlacement.catalog.content_display_img_key;\n for (var _i3 = 0, _Object$entries3 = Object.entries(schema); _i3 < _Object$entries3.length; _i3++) {\n var _Object$entries3$_i = _slicedToArray(_Object$entries3[_i3], 2),\n _key = _Object$entries3$_i[0],\n _value = _Object$entries3$_i[1];\n if (_value === 'image' && _key !== displayImgKey) {\n var imageUrl = contentPlacement.content.data[_key];\n if (imageUrl) {\n images.push(imageUrl);\n }\n delete contentDataCopy[_key];\n }\n }\n\n // Update details view with new viable data\n var viableAdditionalData = this.findViableAdditionalData(contentPlacement);\n var viableDataKeys = Object.keys(viableAdditionalData);\n this.detailsView = viableDataKeys.length > 0 ? new _DetailsView__WEBPACK_IMPORTED_MODULE_3__[\"default\"](viableAdditionalData) : null;\n\n // Update children components\n this.childrenComponents = [];\n for (var _i4 = 0, _Object$entries4 = Object.entries(contentPlacement.children); _i4 < _Object$entries4.length; _i4++) {\n var _Object$entries4$_i = _slicedToArray(_Object$entries4[_i4], 2),\n title = _Object$entries4$_i[0],\n children = _Object$entries4$_i[1];\n var childrenComponent = new _ContentChildrenView__WEBPACK_IMPORTED_MODULE_4__[\"default\"](title, children);\n this.childrenComponents.push(childrenComponent);\n }\n\n // Handle images\n if (images.length > 0) {\n this.imageContainer = document.createElement('div');\n this.imageContainer.className = 'content-details-image-container';\n var firstImage = document.createElement('img');\n firstImage.src = images[0];\n firstImage.className = 'content-details-preview-image';\n var hoverPopup = document.createElement('div');\n hoverPopup.className = 'image-hover-popup';\n hoverPopup.textContent = 'See photos';\n this.imageContainer.appendChild(firstImage);\n this.imageContainer.appendChild(hoverPopup);\n this.imageContainer.addEventListener('click', function () {\n _this4.fire('selectPhotos', {\n placementId: _this4.contentPlacement.placement_id,\n images: images\n });\n });\n } else {\n this.imageContainer = null;\n }\n\n // Reset event listeners\n this._setupEventListeners();\n\n // Re-render the component with the new data\n this._render();\n }\n }, {\n key: \"getElement\",\n value: function getElement() {\n return this.element;\n }\n }]);\n}(_core_Component__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ContentDetails);\n\n//# sourceURL=webpack://waygomaps/./src/components/ContentPlacementView/ContentDetails.js?");
|
|
739
739
|
|
|
740
740
|
/***/ }),
|
|
741
741
|
|
|
@@ -746,7 +746,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
746
746
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
747
747
|
|
|
748
748
|
"use strict";
|
|
749
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ContentPlacementHeader: () => (/* binding */ ContentPlacementHeader),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core/Component */ \"./src/core/Component.js\");\n/* harmony import */ var _assets_volks_svg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../assets/volks.svg */ \"./src/assets/volks.svg\");\n/* harmony import */ var _assets_location_svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../assets/location.svg */ \"./src/assets/location.svg\");\n/* harmony import */ var _assets_defaultIconImage_svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../assets/defaultIconImage.svg */ \"./src/assets/defaultIconImage.svg\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\n\nvar ContentPlacementHeader = /*#__PURE__*/function (_Component) {\n function ContentPlacementHeader(contentPlacement) {\n var _this;\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n _classCallCheck(this, ContentPlacementHeader);\n _this = _callSuper(this, ContentPlacementHeader, [options]);\n _this.contentPlacement = contentPlacement;\n _this._initialize();\n return _this;\n }\n _inherits(ContentPlacementHeader, _Component);\n return _createClass(ContentPlacementHeader, [{\n key: \"_initialize\",\n value: function _initialize() {\n var content = this.contentPlacement.content;\n this.element = document.createElement('div');\n this.element.className = 'content-placement-header';\n this.textContainer = document.createElement('div');\n this.textContainer.className = 'header-text-container';\n this.textContainer.style.paddingLeft = '10px';\n this.nameElement = document.createElement('div');\n this.nameElement.className = 'header-content-name';\n var title_key = this.contentPlacement.catalog.content_title_key;\n var titleValue = content.data[title_key];\n
|
|
749
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ ContentPlacementHeader: () => (/* binding */ ContentPlacementHeader),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core/Component */ \"./src/core/Component.js\");\n/* harmony import */ var _assets_volks_svg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../assets/volks.svg */ \"./src/assets/volks.svg\");\n/* harmony import */ var _assets_location_svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../assets/location.svg */ \"./src/assets/location.svg\");\n/* harmony import */ var _assets_defaultIconImage_svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../assets/defaultIconImage.svg */ \"./src/assets/defaultIconImage.svg\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\n\nvar ContentPlacementHeader = /*#__PURE__*/function (_Component) {\n function ContentPlacementHeader(contentPlacement) {\n var _this;\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n _classCallCheck(this, ContentPlacementHeader);\n _this = _callSuper(this, ContentPlacementHeader, [options]);\n _this.contentPlacement = contentPlacement;\n _this._initialize();\n return _this;\n }\n _inherits(ContentPlacementHeader, _Component);\n return _createClass(ContentPlacementHeader, [{\n key: \"_initialize\",\n value: function _initialize() {\n var content = this.contentPlacement.content;\n this.element = document.createElement('div');\n this.element.className = 'content-placement-header';\n this.textContainer = document.createElement('div');\n this.textContainer.className = 'header-text-container';\n this.textContainer.style.paddingLeft = '10px';\n this.nameElement = document.createElement('div');\n this.nameElement.className = 'header-content-name';\n var title_key = this.contentPlacement.catalog.content_title_key;\n var titleValue = content.data[title_key];\n this.nameElement.textContent = titleValue;\n this.catalogNameElement = document.createElement('div');\n this.catalogNameElement.className = 'header-catalog-name';\n this.catalogNameElement.textContent = this.contentPlacement.catalog.title;\n this.textContainer.appendChild(this.nameElement);\n this.textContainer.appendChild(this.catalogNameElement);\n var displayImgKey = this.contentPlacement.catalog.content_display_img_key;\n var displayImgUrl = content.data[displayImgKey];\n if (displayImgUrl) {\n this.imageViewElement = document.createElement('div');\n this.imageViewElement.className = 'header-image-view';\n var imageElement = document.createElement('img');\n imageElement.className = 'header-image';\n imageElement.src = displayImgUrl;\n imageElement.style.width = '100%';\n imageElement.style.height = '100%';\n // imageElement.style.objectFit = 'cover';\n imageElement.style.objectFit = 'contain';\n imageElement.style.background = 'white';\n this.imageViewElement.appendChild(imageElement);\n this.element.appendChild(this.imageViewElement);\n }\n\n // const imageElement = document.createElement('img');\n // imageElement.className = 'header-image';\n // imageElement.src = defaultIconImage;\n // this.imageViewElement.appendChild(imageElement);\n\n // this.element.appendChild(this.imageViewElement);\n this.element.appendChild(this.textContainer);\n }\n }, {\n key: \"getElement\",\n value: function getElement() {\n return this.element;\n }\n }]);\n}(_core_Component__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (ContentPlacementHeader);\n\n//# sourceURL=webpack://waygomaps/./src/components/ContentPlacementView/ContentPlacementHeader.js?");
|
|
750
750
|
|
|
751
751
|
/***/ }),
|
|
752
752
|
|
|
@@ -768,7 +768,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
768
768
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
769
769
|
|
|
770
770
|
"use strict";
|
|
771
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DetailsView: () => (/* binding */ DetailsView),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core/Component */ \"./src/core/Component.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\nvar DetailsView = /*#__PURE__*/function (_Component) {\n function DetailsView(data) {\n var _this;\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n _classCallCheck(this, DetailsView);\n _this = _callSuper(this, DetailsView, [options]);\n _this.data = data;\n _this._initialize();\n return _this;\n }\n _inherits(DetailsView, _Component);\n return _createClass(DetailsView, [{\n key: \"_initialize\",\n value: function _initialize() {\n var _this2 = this;\n this.element = document.createElement('div');\n this.element.className = 'content-placement-details-view';\n this.titleView = document.createElement('div');\n this.titleView.className = 'content-details-section-title';\n this.titleView.textContent = 'Additional details';\n this.element.appendChild(this.titleView);\n var dataKeys = Object.keys(this.data);\n dataKeys.forEach(function (key, index) {\n var value = _this2.data[key];\n
|
|
771
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ DetailsView: () => (/* binding */ DetailsView),\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core/Component */ \"./src/core/Component.js\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\nvar DetailsView = /*#__PURE__*/function (_Component) {\n function DetailsView(data) {\n var _this;\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n _classCallCheck(this, DetailsView);\n _this = _callSuper(this, DetailsView, [options]);\n _this.data = data;\n _this._initialize();\n return _this;\n }\n _inherits(DetailsView, _Component);\n return _createClass(DetailsView, [{\n key: \"_initialize\",\n value: function _initialize() {\n var _this2 = this;\n this.element = document.createElement('div');\n this.element.className = 'content-placement-details-view';\n this.titleView = document.createElement('div');\n this.titleView.className = 'content-details-section-title';\n this.titleView.textContent = 'Additional details';\n this.element.appendChild(this.titleView);\n var dataKeys = Object.keys(this.data);\n dataKeys.forEach(function (key, index) {\n var value = _this2.data[key];\n var itemElement = document.createElement('div');\n itemElement.className = 'details-view-item';\n var keyElement = document.createElement('div');\n keyElement.className = 'details-view-key';\n keyElement.textContent = key;\n var valueElement = document.createElement('span');\n valueElement.className = 'details-view-value';\n valueElement.textContent = value;\n itemElement.appendChild(keyElement);\n itemElement.appendChild(valueElement);\n if (index < dataKeys.length - 1) {\n var lineElement = document.createElement('hr');\n lineElement.className = 'details-view-line';\n itemElement.append(lineElement);\n }\n _this2.element.appendChild(itemElement);\n });\n }\n }, {\n key: \"getElement\",\n value: function getElement() {\n return this.element;\n }\n }]);\n}(_core_Component__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DetailsView);\n\n//# sourceURL=webpack://waygomaps/./src/components/ContentPlacementView/DetailsView.js?");
|
|
772
772
|
|
|
773
773
|
/***/ }),
|
|
774
774
|
|
|
@@ -779,7 +779,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
779
779
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
780
780
|
|
|
781
781
|
"use strict";
|
|
782
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core/Component */ \"./src/core/Component.js\");\n/* harmony import */ var _SearchBox_SearchBox__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../SearchBox/SearchBox */ \"./src/components/SearchBox/SearchBox.js\");\n/* harmony import */ var _WaygoMaps__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../WaygoMaps */ \"./src/WaygoMaps.js\");\n/* harmony import */ var _assets_pinOutlineIcon_svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../assets/pinOutlineIcon.svg */ \"./src/assets/pinOutlineIcon.svg\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n// import StepsView from \"../DirectionsView/StepsView\";\n\n\nvar DirectionsView = /*#__PURE__*/function (_Component) {\n function DirectionsView() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, DirectionsView);\n _this = _callSuper(this, DirectionsView, [options]);\n _this.startSearchBox = new _SearchBox_SearchBox__WEBPACK_IMPORTED_MODULE_1__[\"default\"](); // Create a SearchBox for the start location\n _this.endSearchBox = new _SearchBox_SearchBox__WEBPACK_IMPORTED_MODULE_1__[\"default\"](); // Create a SearchBox for the end location\n\n _this.startContentPlacement = null;\n _this.endContentPlacement = null;\n _this.pathData = null;\n _this.fromLocation = false;\n _this.searchApi = _WaygoMaps__WEBPACK_IMPORTED_MODULE_2__[\"default\"].getSearchApi();\n\n // this.stepsView = new StepsView();\n\n _this._initialize();\n return _this;\n }\n _inherits(DirectionsView, _Component);\n return _createClass(DirectionsView, [{\n key: \"_initialize\",\n value: function _initialize() {\n this.element = document.createElement(\"div\");\n this.element.className = \"directions-view\";\n this.directionsViewHeader = document.createElement(\"div\");\n this.directionsViewHeader.className = \"directions-view-header\";\n this.searchBoxesContainer = document.createElement('div');\n this.searchBoxesContainer.className = \"directions-search-boxes-container\";\n this.circlesAndSearchWrapper = document.createElement('div');\n this.circlesAndSearchWrapper.className = 'directions-circles-search-wrapper';\n var circlesContainer = this._createCirclesContainer();\n this.circlesAndSearchWrapper.appendChild(circlesContainer);\n this.startSearchBox.searchBar.updateLeftButtonIcon('none');\n this.startSearchBox.searchBar.updateRightButtonIcon('none');\n this.endSearchBox.searchBar.updateLeftButtonIcon('none');\n this.endSearchBox.searchBar.updateRightButtonIcon('none');\n this.startSearchBox.searchBar.setPlaceholderText('Choose starting point');\n this.endSearchBox.searchBar.setPlaceholderText('Choose destination');\n this.searchBoxesContainer.appendChild(this.startSearchBox.getElement());\n this.searchBoxesContainer.appendChild(this.endSearchBox.getElement());\n this.circlesAndSearchWrapper.appendChild(this.searchBoxesContainer);\n this.directionsViewHeader.appendChild(this.circlesAndSearchWrapper);\n this._render();\n this._setupEventListeners();\n }\n }, {\n key: \"_createCirclesContainer\",\n value: function _createCirclesContainer() {\n var circlesContainer = document.createElement('div');\n circlesContainer.className = \"directions-circles-container\";\n var startCircle = document.createElement('div');\n startCircle.className = \"large-circle\";\n var endCircle = document.createElement('div');\n endCircle.className = \"end-circle\";\n var smallCircle1 = document.createElement('div');\n smallCircle1.className = \"small-circle\";\n var smallCircle2 = document.createElement('div');\n smallCircle2.className = \"small-circle\";\n var smallCircle3 = document.createElement('div');\n smallCircle3.className = \"small-circle\";\n circlesContainer.appendChild(startCircle);\n circlesContainer.appendChild(smallCircle1);\n circlesContainer.appendChild(smallCircle2);\n circlesContainer.appendChild(smallCircle3);\n circlesContainer.appendChild(endCircle);\n return circlesContainer;\n }\n }, {\n key: \"_render\",\n value: function _render() {\n this.element.innerHTML = \"\";\n this.element.appendChild(this.directionsViewHeader);\n\n // if (this.pathData) {\n // this.element.appendChild(this.stepsView.getElement());\n // }\n }\n }, {\n key: \"_setupEventListeners\",\n value: function _setupEventListeners() {\n this.startSearchBox.searchBar.on('focus', this._handleStartSearchBarFocus.bind(this));\n this.startSearchBox.searchBar.on('blur', this._handleStartSearchBarBlur.bind(this));\n this.startSearchBox.on('getSearchBarSuggestions', this._handleGettingStartSearchBarSuggestions.bind(this));\n this.endSearchBox.searchBar.on('focus', this._handleEndSearchBarFocus.bind(this));\n this.endSearchBox.searchBar.on('blur', this._handleEndSearchBarBlur.bind(this));\n this.endSearchBox.on('getSearchBarSuggestions', this._handleGettingEndSearchBarSuggestions.bind(this));\n this.startSearchBox.searchBarSuggestionsView.on('selectCell', this._handleStartContentPlacementSelect.bind(this));\n this.endSearchBox.searchBarSuggestionsView.on('selectCell', this._handleEndContentPlacementSelect.bind(this));\n\n // this.stepsView.on('legSelect', this._handleLegChange.bind(this));\n }\n\n // _handleLegChange(data) {\n // const { index } = data;\n // this.fire('initiate:changeLeg', data);\n\n // }\n }, {\n key: \"_handleGettingStartSearchBarSuggestions\",\n value: function () {\n var _handleGettingStartSearchBarSuggestions2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {\n var query;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n query = data.query;\n this.fire('getStartSuggestions', {\n query: query\n });\n case 2:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this);\n }));\n function _handleGettingStartSearchBarSuggestions(_x) {\n return _handleGettingStartSearchBarSuggestions2.apply(this, arguments);\n }\n return _handleGettingStartSearchBarSuggestions;\n }()\n }, {\n key: \"_handleGettingEndSearchBarSuggestions\",\n value: function () {\n var _handleGettingEndSearchBarSuggestions2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data) {\n var query;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n query = data.query;\n this.fire('getEndSuggestions', {\n query: query\n });\n case 2:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this);\n }));\n function _handleGettingEndSearchBarSuggestions(_x2) {\n return _handleGettingEndSearchBarSuggestions2.apply(this, arguments);\n }\n return _handleGettingEndSearchBarSuggestions;\n }()\n }, {\n key: \"_handleStartContentPlacementSelect\",\n value: function () {\n var _handleStartContentPlacementSelect2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(data) {\n var result, placementId, titleKey, startContentPlacement;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n result = data.result;\n placementId = result.placement_id;\n titleKey = result.catalog.content_title_key; // const titleKey = result.content.title_key;\n this.startSearchBox.searchBar.setText(result.content.data[titleKey]);\n _context3.next = 6;\n return this.searchApi.fetchContentPlacementDetails(placementId);\n case 6:\n startContentPlacement = _context3.sent;\n this.fire('selectedStartContentPlacement', {\n startContentPlacement: startContentPlacement\n });\n this.updateView(startContentPlacement, this.endContentPlacement);\n case 9:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3, this);\n }));\n function _handleStartContentPlacementSelect(_x3) {\n return _handleStartContentPlacementSelect2.apply(this, arguments);\n }\n return _handleStartContentPlacementSelect;\n }()\n }, {\n key: \"_handleEndContentPlacementSelect\",\n value: function () {\n var _handleEndContentPlacementSelect2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(data) {\n var result, placementId, titleKey, endContentPlacement;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) switch (_context4.prev = _context4.next) {\n case 0:\n result = data.result;\n placementId = result.placement_id; // const titleKey = result.content.title_key;\n titleKey = result.catalog.content_title_key;\n this.endSearchBox.searchBar.setText(result.content.data[titleKey]);\n _context4.next = 6;\n return this.searchApi.fetchContentPlacementDetails(placementId);\n case 6:\n endContentPlacement = _context4.sent;\n this.fire('selectedEndContentPlacement', {\n endContentPlacement: endContentPlacement\n });\n this.updateView(this.startContentPlacement, endContentPlacement);\n case 9:\n case \"end\":\n return _context4.stop();\n }\n }, _callee4, this);\n }));\n function _handleEndContentPlacementSelect(_x4) {\n return _handleEndContentPlacementSelect2.apply(this, arguments);\n }\n return _handleEndContentPlacementSelect;\n }()\n }, {\n key: \"_handleStartSearchBarFocus\",\n value: function _handleStartSearchBarFocus() {\n this.startSearchBox.searchBar.updateRightButtonIcon('search');\n this.startSearchBox.searchBar.setPlaceholderText('Choose starting point');\n }\n }, {\n key: \"_handleEndSearchBarFocus\",\n value: function _handleEndSearchBarFocus() {\n this.endSearchBox.searchBar.updateRightButtonIcon('search');\n }\n }, {\n key: \"_handleStartSearchBarBlur\",\n value: function _handleStartSearchBarBlur() {\n this.startSearchBox.searchBar.updateRightButtonIcon('none');\n }\n }, {\n key: \"_handleEndSearchBarBlur\",\n value: function _handleEndSearchBarBlur() {\n this.endSearchBox.searchBar.updateRightButtonIcon('none');\n }\n }, {\n key: \"updateView\",\n value: function updateView(startContentPlacement, endContentPlacement) {\n this.startContentPlacement = startContentPlacement;\n this.endContentPlacement = endContentPlacement;\n if (startContentPlacement && endContentPlacement) {\n this.fire('initiate:findPath', {\n startContentPlacementId: startContentPlacement.placement_id,\n endContentPlacementId: endContentPlacement.placement_id\n });\n } else if (startContentPlacement) {\n var data = startContentPlacement.content.data;\n // const titleKey = startContentPlacement.content.title_key;\n var titleKey = startContentPlacement.catalog.content_title_key;\n var title = data[titleKey];\n this.startSearchBox.searchBar.setText(title);\n this.endSearchBox.searchBar.setText('');\n this.endSearchBox.searchBar.input.focus();\n // this.clearSteps();\n } else if (endContentPlacement) {\n var _data = endContentPlacement.content.data;\n // const titleKey = endContentPlacement.content.title_key;\n var _titleKey = endContentPlacement.catalog.content_title_key;\n var _title = _data[_titleKey];\n this.endSearchBox.searchBar.setText(_title);\n this.startSearchBox.searchBar.setText('');\n if (this.fromLocation) {\n this.fire('initiate:findPathFromLocation', {\n endContentPlacement: endContentPlacement\n });\n }\n // this.clearSteps();\n }\n }\n\n // setSteps(steps) {\n // this.steps = steps;\n // this._render();\n // }\n }, {\n key: \"setNewPath\",\n value: function setNewPath(pathData) {\n var fromLocation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n this.fromLocation = fromLocation;\n\n // Add extra leg for testing\n var leg = pathData.legs[0];\n var step = leg.steps[0];\n var customLeg = {\n floor: 1,\n steps: [{\n instruction: 'right',\n distance: 20.0,\n path: step.path,\n text: 'Instruction for this step'\n }, {\n instruction: 'right',\n distance: 20.0,\n path: step.path,\n text: 'Instruction for this step'\n }, {\n instruction: 'right',\n distance: 20.0,\n path: step.path,\n text: 'Instruction for this step'\n }]\n };\n // const customLeg2 = {\n // floor: 2,\n // steps: [\n // {\n // instruction: 'right',\n // distance: 20.0,\n // path: step.path,\n // text: 'Instruction for this step'\n // },\n // {\n // instruction: 'right',\n // distance: 20.0,\n // path: step.path,\n // text: 'Instruction for this step'\n // },\n // {\n // instruction: 'right',\n // distance: 20.0,\n // path: step.path,\n // text: 'Instruction for this step'\n // }\n // ]\n // }\n // pathData.legs.push(customLeg);\n // pathData.legs.push(customLeg2);\n\n if (fromLocation) {\n this.startSearchBox.searchBar.setPlaceholderText('Your location');\n }\n this.pathData = pathData;\n // this.stepsView.setNewPath(pathData);\n this._render();\n }\n\n // clearSteps() {\n // const stepsViewElement = this.element.querySelector('.steps-view'); // Assuming .steps-view is a class in StepsView\n // if (stepsViewElement) {\n // stepsViewElement.remove(); // Remove the StepsView element if it exists\n // }\n // }\n }, {\n key: \"getElement\",\n value: function getElement() {\n return this.element;\n }\n }]);\n}(_core_Component__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DirectionsView);\n\n//# sourceURL=webpack://waygomaps/./src/components/DirectionsView/DirectionsView.js?");
|
|
782
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core/Component */ \"./src/core/Component.js\");\n/* harmony import */ var _SearchBox_SearchBox__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../SearchBox/SearchBox */ \"./src/components/SearchBox/SearchBox.js\");\n/* harmony import */ var _WaygoMaps__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../WaygoMaps */ \"./src/WaygoMaps.js\");\n/* harmony import */ var _assets_pinOutlineIcon_svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../assets/pinOutlineIcon.svg */ \"./src/assets/pinOutlineIcon.svg\");\n/* harmony import */ var _assets_loading_spinner_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../assets/loading-spinner.svg */ \"./src/assets/loading-spinner.svg\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n// import StepsView from \"../DirectionsView/StepsView\";\n\n\n\nvar DirectionsView = /*#__PURE__*/function (_Component) {\n function DirectionsView() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, DirectionsView);\n _this = _callSuper(this, DirectionsView, [options]);\n _this.startSearchBox = new _SearchBox_SearchBox__WEBPACK_IMPORTED_MODULE_1__[\"default\"](); // Create a SearchBox for the start location\n _this.endSearchBox = new _SearchBox_SearchBox__WEBPACK_IMPORTED_MODULE_1__[\"default\"](); // Create a SearchBox for the end location\n\n _this.startContentPlacement = null;\n _this.endContentPlacement = null;\n _this.pathData = null;\n _this.fromLocation = false;\n _this.searchApi = _WaygoMaps__WEBPACK_IMPORTED_MODULE_2__[\"default\"].getSearchApi();\n\n // this.stepsView = new StepsView();\n\n _this._initialize();\n return _this;\n }\n _inherits(DirectionsView, _Component);\n return _createClass(DirectionsView, [{\n key: \"_initialize\",\n value: function _initialize() {\n this.element = document.createElement(\"div\");\n this.element.className = \"directions-view\";\n this.directionsViewHeader = document.createElement(\"div\");\n this.directionsViewHeader.className = \"directions-view-header\";\n this.searchBoxesContainer = document.createElement('div');\n this.searchBoxesContainer.className = \"directions-search-boxes-container\";\n this.circlesAndSearchWrapper = document.createElement('div');\n this.circlesAndSearchWrapper.className = 'directions-circles-search-wrapper';\n var circlesContainer = this._createCirclesContainer();\n this.circlesAndSearchWrapper.appendChild(circlesContainer);\n this.startSearchBox.searchBar.updateLeftButtonIcon('none');\n this.startSearchBox.searchBar.updateRightButtonIcon('none');\n this.endSearchBox.searchBar.updateLeftButtonIcon('none');\n this.endSearchBox.searchBar.updateRightButtonIcon('none');\n this.startSearchBox.searchBar.setPlaceholderText('Choose starting point');\n this.endSearchBox.searchBar.setPlaceholderText('Choose destination');\n this.searchBoxesContainer.appendChild(this.startSearchBox.getElement());\n this.searchBoxesContainer.appendChild(this.endSearchBox.getElement());\n this.circlesAndSearchWrapper.appendChild(this.searchBoxesContainer);\n this.directionsViewHeader.appendChild(this.circlesAndSearchWrapper);\n this._render();\n this._setupEventListeners();\n }\n }, {\n key: \"_createCirclesContainer\",\n value: function _createCirclesContainer() {\n var circlesContainer = document.createElement('div');\n circlesContainer.className = \"directions-circles-container\";\n var startCircle = document.createElement('div');\n startCircle.className = \"large-circle\";\n var endCircle = document.createElement('div');\n endCircle.className = \"end-circle\";\n var smallCircle1 = document.createElement('div');\n smallCircle1.className = \"small-circle\";\n var smallCircle2 = document.createElement('div');\n smallCircle2.className = \"small-circle\";\n var smallCircle3 = document.createElement('div');\n smallCircle3.className = \"small-circle\";\n circlesContainer.appendChild(startCircle);\n circlesContainer.appendChild(smallCircle1);\n circlesContainer.appendChild(smallCircle2);\n circlesContainer.appendChild(smallCircle3);\n circlesContainer.appendChild(endCircle);\n return circlesContainer;\n }\n }, {\n key: \"_render\",\n value: function _render() {\n this.element.innerHTML = \"\";\n this.element.appendChild(this.directionsViewHeader);\n\n // if (this.pathData) {\n // this.element.appendChild(this.stepsView.getElement());\n // }\n }\n }, {\n key: \"_setupEventListeners\",\n value: function _setupEventListeners() {\n this.startSearchBox.searchBar.on('focus', this._handleStartSearchBarFocus.bind(this));\n this.startSearchBox.searchBar.on('blur', this._handleStartSearchBarBlur.bind(this));\n this.startSearchBox.on('getSearchBarSuggestions', this._handleGettingStartSearchBarSuggestions.bind(this));\n this.endSearchBox.searchBar.on('focus', this._handleEndSearchBarFocus.bind(this));\n this.endSearchBox.searchBar.on('blur', this._handleEndSearchBarBlur.bind(this));\n this.endSearchBox.on('getSearchBarSuggestions', this._handleGettingEndSearchBarSuggestions.bind(this));\n this.startSearchBox.searchBarSuggestionsView.on('selectCell', this._handleStartContentPlacementSelect.bind(this));\n this.endSearchBox.searchBarSuggestionsView.on('selectCell', this._handleEndContentPlacementSelect.bind(this));\n\n // this.stepsView.on('legSelect', this._handleLegChange.bind(this));\n }\n\n // _handleLegChange(data) {\n // const { index } = data;\n // this.fire('initiate:changeLeg', data);\n\n // }\n }, {\n key: \"_handleGettingStartSearchBarSuggestions\",\n value: function () {\n var _handleGettingStartSearchBarSuggestions2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee(data) {\n var query;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n query = data.query;\n this.fire('getStartSuggestions', {\n query: query\n });\n case 2:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this);\n }));\n function _handleGettingStartSearchBarSuggestions(_x) {\n return _handleGettingStartSearchBarSuggestions2.apply(this, arguments);\n }\n return _handleGettingStartSearchBarSuggestions;\n }()\n }, {\n key: \"_handleGettingEndSearchBarSuggestions\",\n value: function () {\n var _handleGettingEndSearchBarSuggestions2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2(data) {\n var query;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n query = data.query;\n this.fire('getEndSuggestions', {\n query: query\n });\n case 2:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this);\n }));\n function _handleGettingEndSearchBarSuggestions(_x2) {\n return _handleGettingEndSearchBarSuggestions2.apply(this, arguments);\n }\n return _handleGettingEndSearchBarSuggestions;\n }()\n }, {\n key: \"_handleStartContentPlacementSelect\",\n value: function () {\n var _handleStartContentPlacementSelect2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3(data) {\n var result, placementId, titleKey, startContentPlacement;\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n result = data.result;\n placementId = result.placement_id;\n titleKey = result.catalog.content_title_key; // const titleKey = result.content.title_key;\n this.startSearchBox.searchBar.setText(result.content.data[titleKey]);\n _context3.next = 6;\n return this.searchApi.fetchContentPlacementDetails(placementId);\n case 6:\n startContentPlacement = _context3.sent;\n this.fire('selectedStartContentPlacement', {\n startContentPlacement: startContentPlacement\n });\n this.updateView(startContentPlacement, this.endContentPlacement);\n case 9:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3, this);\n }));\n function _handleStartContentPlacementSelect(_x3) {\n return _handleStartContentPlacementSelect2.apply(this, arguments);\n }\n return _handleStartContentPlacementSelect;\n }()\n }, {\n key: \"_handleEndContentPlacementSelect\",\n value: function () {\n var _handleEndContentPlacementSelect2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(data) {\n var result, placementId, titleKey, endContentPlacement;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) switch (_context4.prev = _context4.next) {\n case 0:\n result = data.result;\n placementId = result.placement_id; // const titleKey = result.content.title_key;\n titleKey = result.catalog.content_title_key;\n this.endSearchBox.searchBar.setText(result.content.data[titleKey]);\n _context4.next = 6;\n return this.searchApi.fetchContentPlacementDetails(placementId);\n case 6:\n endContentPlacement = _context4.sent;\n this.fire('selectedEndContentPlacement', {\n endContentPlacement: endContentPlacement\n });\n this.updateView(this.startContentPlacement, endContentPlacement);\n case 9:\n case \"end\":\n return _context4.stop();\n }\n }, _callee4, this);\n }));\n function _handleEndContentPlacementSelect(_x4) {\n return _handleEndContentPlacementSelect2.apply(this, arguments);\n }\n return _handleEndContentPlacementSelect;\n }()\n }, {\n key: \"_handleStartSearchBarFocus\",\n value: function _handleStartSearchBarFocus() {\n this.startSearchBox.searchBar.updateRightButtonIcon('search');\n this.startSearchBox.searchBar.setPlaceholderText('Choose starting point');\n }\n }, {\n key: \"_handleEndSearchBarFocus\",\n value: function _handleEndSearchBarFocus() {\n this.endSearchBox.searchBar.updateRightButtonIcon('search');\n }\n }, {\n key: \"_handleStartSearchBarBlur\",\n value: function _handleStartSearchBarBlur() {\n this.startSearchBox.searchBar.updateRightButtonIcon('none');\n }\n }, {\n key: \"_handleEndSearchBarBlur\",\n value: function _handleEndSearchBarBlur() {\n this.endSearchBox.searchBar.updateRightButtonIcon('none');\n }\n }, {\n key: \"updateView\",\n value: function updateView(startContentPlacement, endContentPlacement) {\n this.startContentPlacement = startContentPlacement;\n this.endContentPlacement = endContentPlacement;\n if (startContentPlacement && endContentPlacement) {\n this.fire('initiate:findPath', {\n startContentPlacementId: startContentPlacement.placement_id,\n endContentPlacementId: endContentPlacement.placement_id\n });\n } else if (startContentPlacement) {\n var data = startContentPlacement.content.data;\n // const titleKey = startContentPlacement.content.title_key;\n var titleKey = startContentPlacement.catalog.content_title_key;\n var title = data[titleKey];\n this.startSearchBox.searchBar.setText(title);\n this.endSearchBox.searchBar.setText('');\n this.endSearchBox.searchBar.input.focus();\n // this.clearSteps();\n } else if (endContentPlacement) {\n var _data = endContentPlacement.content.data;\n // const titleKey = endContentPlacement.content.title_key;\n var _titleKey = endContentPlacement.catalog.content_title_key;\n var _title = _data[_titleKey];\n this.endSearchBox.searchBar.setText(_title);\n this.startSearchBox.searchBar.setText('');\n if (this.fromLocation) {\n this.fire('initiate:findPathFromLocation', {\n endContentPlacement: endContentPlacement\n });\n }\n // this.clearSteps();\n }\n }\n\n // setSteps(steps) {\n // this.steps = steps;\n // this._render();\n // }\n }, {\n key: \"setNewPath\",\n value: function setNewPath(pathData) {\n var fromLocation = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false;\n this.fromLocation = fromLocation;\n\n // Add extra leg for testing\n var leg = pathData.legs[0];\n var step = leg.steps[0];\n var customLeg = {\n floor: 1,\n steps: [{\n instruction: 'right',\n distance: 20.0,\n path: step.path,\n text: 'Instruction for this step'\n }, {\n instruction: 'right',\n distance: 20.0,\n path: step.path,\n text: 'Instruction for this step'\n }, {\n instruction: 'right',\n distance: 20.0,\n path: step.path,\n text: 'Instruction for this step'\n }]\n };\n // const customLeg2 = {\n // floor: 2,\n // steps: [\n // {\n // instruction: 'right',\n // distance: 20.0,\n // path: step.path,\n // text: 'Instruction for this step'\n // },\n // {\n // instruction: 'right',\n // distance: 20.0,\n // path: step.path,\n // text: 'Instruction for this step'\n // },\n // {\n // instruction: 'right',\n // distance: 20.0,\n // path: step.path,\n // text: 'Instruction for this step'\n // }\n // ]\n // }\n // pathData.legs.push(customLeg);\n // pathData.legs.push(customLeg2);\n\n if (fromLocation) {\n this.startSearchBox.searchBar.setPlaceholderText('Your location');\n }\n this.pathData = pathData;\n // this.stepsView.setNewPath(pathData);\n this._render();\n }\n\n // clearSteps() {\n // const stepsViewElement = this.element.querySelector('.steps-view'); // Assuming .steps-view is a class in StepsView\n // if (stepsViewElement) {\n // stepsViewElement.remove(); // Remove the StepsView element if it exists\n // }\n // }\n }, {\n key: \"getElement\",\n value: function getElement() {\n return this.element;\n }\n }, {\n key: \"showLoading\",\n value: function showLoading() {\n // Show loading state while directions are being calculated\n if (this.loadingElement) {\n this.loadingElement.style.display = 'flex';\n }\n }\n }, {\n key: \"hideLoading\",\n value: function hideLoading() {\n // Hide loading state when directions are ready\n if (this.loadingElement) {\n this.loadingElement.style.display = 'none';\n }\n }\n }]);\n}(_core_Component__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (DirectionsView);\n\n//# sourceURL=webpack://waygomaps/./src/components/DirectionsView/DirectionsView.js?");
|
|
783
783
|
|
|
784
784
|
/***/ }),
|
|
785
785
|
|
|
@@ -790,7 +790,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
790
790
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
791
791
|
|
|
792
792
|
"use strict";
|
|
793
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var path_browserify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! path-browserify */ \"./node_modules/path-browserify/index.js\");\n/* harmony import */ var path_browserify__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path_browserify__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _core_Component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../core/Component */ \"./src/core/Component.js\");\n/* harmony import */ var _SliderBar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../SliderBar */ \"./src/components/SliderBar.js\");\n/* harmony import */ var _assets_directionArrowIcons_DirectionsArrowLeft_svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../assets/directionArrowIcons/DirectionsArrowLeft.svg */ \"./src/assets/directionArrowIcons/DirectionsArrowLeft.svg\");\n/* harmony import */ var _assets_directionArrowIcons_DirectionsArrowRight_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../assets/directionArrowIcons/DirectionsArrowRight.svg */ \"./src/assets/directionArrowIcons/DirectionsArrowRight.svg\");\n/* harmony import */ var _assets_directionArrowIcons_DirectionsArrowUp_svg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../assets/directionArrowIcons/DirectionsArrowUp.svg */ \"./src/assets/directionArrowIcons/DirectionsArrowUp.svg\");\n/* harmony import */ var _assets_directionArrowIcons_DirectionsArrowUpLeft_svg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../assets/directionArrowIcons/DirectionsArrowUpLeft.svg */ \"./src/assets/directionArrowIcons/DirectionsArrowUpLeft.svg\");\n/* harmony import */ var _assets_directionArrowIcons_DirectionsArrowUpRight_svg__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../assets/directionArrowIcons/DirectionsArrowUpRight.svg */ \"./src/assets/directionArrowIcons/DirectionsArrowUpRight.svg\");\n/* harmony import */ var _assets_directionArrowIcons_DirectionsArrowDownLeft_svg__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../assets/directionArrowIcons/DirectionsArrowDownLeft.svg */ \"./src/assets/directionArrowIcons/DirectionsArrowDownLeft.svg\");\n/* harmony import */ var _assets_directionArrowIcons_DirectionsArrowDownRight_svg__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../assets/directionArrowIcons/DirectionsArrowDownRight.svg */ \"./src/assets/directionArrowIcons/DirectionsArrowDownRight.svg\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\n\n\n\n\n\n\n\nvar StepsView = /*#__PURE__*/function (_Component) {\n function StepsView() {\n var _this;\n var steps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n _classCallCheck(this, StepsView);\n _this = _callSuper(this, StepsView, [options]);\n _this.pathData = null;\n _this.legSelector = null;\n _this.legSelectorContainerName = 'leg-selector';\n _this.selectedLegIndex = 0;\n _this.stepsVisible = true;\n _this.toggleButton = null;\n _this._initialize();\n return _this;\n }\n _inherits(StepsView, _Component);\n return _createClass(StepsView, [{\n key: \"_initialize\",\n value: function _initialize() {\n this.element = document.createElement(\"div\");\n this.element.className = \"steps-view\";\n this._render();\n }\n }, {\n key: \"_createToggleButton\",\n value: function _createToggleButton() {\n var button = document.createElement(\"button\");\n button.className = \"toggle-steps-button\";\n button.textContent = this.stepsVisible ? \"Hide Steps\" : \"Show Steps\";\n button.addEventListener(\"click\", this._toggleStepsVisibility.bind(this));\n return button;\n }\n }, {\n key: \"_toggleStepsVisibility\",\n value: function _toggleStepsVisibility() {\n this.stepsVisible = !this.stepsVisible;\n this._render();\n }\n }, {\n key: \"_createLegSelector\",\n value: function _createLegSelector(legs) {\n var legSelectorTitles = [];\n legs.forEach(function (leg) {\n legSelectorTitles.push(\"Floor \".concat(leg.floor));\n });\n var legSelector = new _SliderBar__WEBPACK_IMPORTED_MODULE_2__[\"default\"](legSelectorTitles, {\n container: this.legSelectorContainerName\n });\n legSelector.on(\"\".concat(this.legSelectorContainerName, \":selectNew\"), this._handleLegSelectorSelect.bind(this));\n return legSelector;\n }\n }, {\n key: \"_handleLegSelectorSelect\",\n value: function _handleLegSelectorSelect(data) {\n var index = data.index;\n if (index !== this.selectedLegIndex) {\n this.selectedLegIndex = index;\n this.fire('legSelect', data);\n this._render();\n }\n }\n }, {\n key: \"_render\",\n value: function _render() {\n var _this2 = this;\n this.element.innerHTML = \"\";\n if (!this.pathData) {\n this.element.style.display = \"none\";\n return;\n }\n this.element.style.display = \"\";\n\n // const heading = document.createElement(\"h2\");\n // heading.textContent = \"Steps\";\n // this.element.appendChild(heading);\n\n if (this.pathData.legs.length > 1) {\n this.legSelector = this._createLegSelector(this.pathData.legs);\n this.legSelector.selectButtonAtIndex(this.selectedLegIndex);\n this.element.appendChild(this.legSelector.getElement());\n }\n var stepsContainer = document.createElement(\"div\");\n stepsContainer.className = \"steps-container\";\n if (this.stepsVisible) {\n var list = document.createElement(\"ul\");\n var leg = this.pathData.legs[this.selectedLegIndex];\n leg.steps.forEach(function (step, index) {\n var listItem = document.createElement(\"li\");\n var stepCount = index + 1;\n if (_this2.selectedLegIndex !== 0) {\n var previousStepCount = _this2.pathData.legs.slice(0, _this2.selectedLegIndex).reduce(function (sum, item) {\n return sum + item.steps.length;\n }, 0);\n stepCount += previousStepCount;\n }\n\n // Step container\n var stepContainer = document.createElement('div');\n stepContainer.className = 'step-container';\n\n // Icon\n var stepIcon = document.createElement(\"img\");\n stepIcon.className = \"step-icon\";\n // console.log(step.instruction);\n if (step.instruction === 'left') {\n stepIcon.src = _assets_directionArrowIcons_DirectionsArrowLeft_svg__WEBPACK_IMPORTED_MODULE_3__[\"default\"];\n } else if (step.instruction === 'hard left') {\n stepIcon.src = _assets_directionArrowIcons_DirectionsArrowDownLeft_svg__WEBPACK_IMPORTED_MODULE_8__[\"default\"];\n } else if (step.instruction === 'slight left') {\n stepIcon.src = _assets_directionArrowIcons_DirectionsArrowUpLeft_svg__WEBPACK_IMPORTED_MODULE_6__[\"default\"];\n } else if (step.instruction === 'right') {\n stepIcon.src = _assets_directionArrowIcons_DirectionsArrowRight_svg__WEBPACK_IMPORTED_MODULE_4__[\"default\"];\n } else if (step.instruction === 'hard right') {\n stepIcon.src = _assets_directionArrowIcons_DirectionsArrowDownRight_svg__WEBPACK_IMPORTED_MODULE_9__[\"default\"];\n } else if (step.instruction === 'slight right') {\n stepIcon.src = _assets_directionArrowIcons_DirectionsArrowUpRight_svg__WEBPACK_IMPORTED_MODULE_7__[\"default\"];\n } else if (step.instruction === 'straight') {\n stepIcon.src = _assets_directionArrowIcons_DirectionsArrowUp_svg__WEBPACK_IMPORTED_MODULE_5__[\"default\"];\n } else if (step.instruction === 'arrival') {\n stepIcon.src = ArrivalIcon;\n }\n stepContainer.appendChild(stepIcon);\n\n // Step defatails container\n var stepDetails = document.createElement(\"div\");\n stepDetails.className = \"step-details\";\n\n // Step instruction\n var stepInstruction = document.createElement(\"div\");\n stepInstruction.className = \"step-instruction\";\n stepInstruction.textContent = step.text;\n stepDetails.appendChild(stepInstruction);\n if (index !== leg.steps.length - 1) {\n // Distance\n var stepDistance = document.createElement(\"div\");\n stepDistance.className = \"step-distance\";\n var distanceText = parseFloat(step.distance.toFixed(0));\n if (_this2.pathData.unit === 'Feet') {\n distanceText += ' ft';\n } else if (_this2.pathData.unit === 'Meters') {\n distanceText += ' m';\n }\n stepDistance.textContent = distanceText;\n stepDetails.appendChild(stepDistance);\n }\n stepContainer.appendChild(stepDetails);\n listItem.appendChild(stepContainer);\n list.appendChild(listItem);\n });\n stepsContainer.appendChild(list);\n this.element.appendChild(stepsContainer);\n }\n this.toggleButton = this._createToggleButton();\n this.element.appendChild(this.toggleButton);\n }\n }, {\n key: \"clearSteps\",\n value: function clearSteps() {\n var stepsViewElement = this.element.querySelector('.steps-view'); // Assuming .steps-view is a class in StepsView\n if (stepsViewElement) {\n stepsViewElement.remove(); // Remove the StepsView element if it exists\n }\n }\n }, {\n key: \"clear\",\n value: function clear() {\n this.pathData = null;\n this._render();\n }\n }, {\n key: \"setNewPath\",\n value: function setNewPath(pathData) {\n var stepsVisible = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n this.pathData = pathData;\n if (stepsVisible !== null) {\n this.stepsVisible = stepsVisible;\n }\n this.selectedLegIndex = 0;\n this._render();\n }\n }, {\n key: \"getElement\",\n value: function getElement() {\n return this.element;\n }\n }]);\n}(_core_Component__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (StepsView);\n\n//# sourceURL=webpack://waygomaps/./src/components/DirectionsView/StepsView.js?");
|
|
793
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var path_browserify__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! path-browserify */ \"./node_modules/path-browserify/index.js\");\n/* harmony import */ var path_browserify__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(path_browserify__WEBPACK_IMPORTED_MODULE_0__);\n/* harmony import */ var _core_Component__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../core/Component */ \"./src/core/Component.js\");\n/* harmony import */ var _SliderBar__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../SliderBar */ \"./src/components/SliderBar.js\");\n/* harmony import */ var _assets_directionArrowIcons_DirectionsArrowLeft_svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../assets/directionArrowIcons/DirectionsArrowLeft.svg */ \"./src/assets/directionArrowIcons/DirectionsArrowLeft.svg\");\n/* harmony import */ var _assets_directionArrowIcons_DirectionsArrowRight_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../assets/directionArrowIcons/DirectionsArrowRight.svg */ \"./src/assets/directionArrowIcons/DirectionsArrowRight.svg\");\n/* harmony import */ var _assets_directionArrowIcons_DirectionsArrowUp_svg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../assets/directionArrowIcons/DirectionsArrowUp.svg */ \"./src/assets/directionArrowIcons/DirectionsArrowUp.svg\");\n/* harmony import */ var _assets_directionArrowIcons_DirectionsArrowUpLeft_svg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../assets/directionArrowIcons/DirectionsArrowUpLeft.svg */ \"./src/assets/directionArrowIcons/DirectionsArrowUpLeft.svg\");\n/* harmony import */ var _assets_directionArrowIcons_DirectionsArrowUpRight_svg__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../../assets/directionArrowIcons/DirectionsArrowUpRight.svg */ \"./src/assets/directionArrowIcons/DirectionsArrowUpRight.svg\");\n/* harmony import */ var _assets_directionArrowIcons_DirectionsArrowDownLeft_svg__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../../assets/directionArrowIcons/DirectionsArrowDownLeft.svg */ \"./src/assets/directionArrowIcons/DirectionsArrowDownLeft.svg\");\n/* harmony import */ var _assets_directionArrowIcons_DirectionsArrowDownRight_svg__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../../assets/directionArrowIcons/DirectionsArrowDownRight.svg */ \"./src/assets/directionArrowIcons/DirectionsArrowDownRight.svg\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\n\n\n\n\n\n\n\nvar StepsView = /*#__PURE__*/function (_Component) {\n function StepsView() {\n var _this;\n var steps = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];\n var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n _classCallCheck(this, StepsView);\n _this = _callSuper(this, StepsView, [options]);\n _this.pathData = null;\n _this.legSelector = null;\n _this.legSelectorContainerName = 'leg-selector';\n _this.selectedLegIndex = 0;\n _this.stepsVisible = true;\n _this.toggleButton = null;\n _this._initialize();\n return _this;\n }\n _inherits(StepsView, _Component);\n return _createClass(StepsView, [{\n key: \"_initialize\",\n value: function _initialize() {\n this.element = document.createElement(\"div\");\n this.element.className = \"steps-view\";\n this._render();\n }\n }, {\n key: \"_createToggleButton\",\n value: function _createToggleButton() {\n var button = document.createElement(\"button\");\n button.className = \"toggle-steps-button\";\n button.textContent = this.stepsVisible ? \"Hide Steps\" : \"Show Steps\";\n button.addEventListener(\"click\", this._toggleStepsVisibility.bind(this));\n return button;\n }\n }, {\n key: \"_toggleStepsVisibility\",\n value: function _toggleStepsVisibility() {\n this.stepsVisible = !this.stepsVisible;\n this._render();\n }\n }, {\n key: \"_createLegSelector\",\n value: function _createLegSelector(legs) {\n var legSelectorTitles = [];\n legs.forEach(function (leg) {\n legSelectorTitles.push(\"Floor \".concat(leg.floor));\n });\n var legSelector = new _SliderBar__WEBPACK_IMPORTED_MODULE_2__[\"default\"](legSelectorTitles, {\n container: this.legSelectorContainerName\n });\n legSelector.on(\"\".concat(this.legSelectorContainerName, \":selectNew\"), this._handleLegSelectorSelect.bind(this));\n return legSelector;\n }\n }, {\n key: \"_handleLegSelectorSelect\",\n value: function _handleLegSelectorSelect(data) {\n var index = data.index;\n if (index !== this.selectedLegIndex) {\n this.selectedLegIndex = index;\n this.fire('legSelect', data);\n this._render();\n }\n }\n }, {\n key: \"_render\",\n value: function _render() {\n var _this2 = this;\n this.element.innerHTML = \"\";\n if (!this.pathData) {\n this.element.style.display = \"none\";\n return;\n }\n this.element.style.display = \"\";\n\n // const heading = document.createElement(\"h2\");\n // heading.textContent = \"Steps\";\n // this.element.appendChild(heading);\n\n if (this.pathData.legs.length > 1) {\n this.legSelector = this._createLegSelector(this.pathData.legs);\n this.legSelector.selectButtonAtIndex(this.selectedLegIndex);\n this.element.appendChild(this.legSelector.getElement());\n }\n var stepsContainer = document.createElement(\"div\");\n stepsContainer.className = \"steps-container\";\n if (this.stepsVisible) {\n var list = document.createElement(\"ul\");\n var leg = this.pathData.legs[this.selectedLegIndex];\n leg.steps.forEach(function (step, index) {\n var listItem = document.createElement(\"li\");\n var stepCount = index + 1;\n if (_this2.selectedLegIndex !== 0) {\n var previousStepCount = _this2.pathData.legs.slice(0, _this2.selectedLegIndex).reduce(function (sum, item) {\n return sum + item.steps.length;\n }, 0);\n stepCount += previousStepCount;\n }\n\n // Step container\n var stepContainer = document.createElement('div');\n stepContainer.className = 'step-container';\n\n // Icon\n var stepIcon = document.createElement(\"img\");\n stepIcon.className = \"step-icon\";\n if (step.instruction === 'left') {\n stepIcon.src = _assets_directionArrowIcons_DirectionsArrowLeft_svg__WEBPACK_IMPORTED_MODULE_3__[\"default\"];\n } else if (step.instruction === 'hard left') {\n stepIcon.src = _assets_directionArrowIcons_DirectionsArrowDownLeft_svg__WEBPACK_IMPORTED_MODULE_8__[\"default\"];\n } else if (step.instruction === 'slight left') {\n stepIcon.src = _assets_directionArrowIcons_DirectionsArrowUpLeft_svg__WEBPACK_IMPORTED_MODULE_6__[\"default\"];\n } else if (step.instruction === 'right') {\n stepIcon.src = _assets_directionArrowIcons_DirectionsArrowRight_svg__WEBPACK_IMPORTED_MODULE_4__[\"default\"];\n } else if (step.instruction === 'hard right') {\n stepIcon.src = _assets_directionArrowIcons_DirectionsArrowDownRight_svg__WEBPACK_IMPORTED_MODULE_9__[\"default\"];\n } else if (step.instruction === 'slight right') {\n stepIcon.src = _assets_directionArrowIcons_DirectionsArrowUpRight_svg__WEBPACK_IMPORTED_MODULE_7__[\"default\"];\n } else if (step.instruction === 'straight') {\n stepIcon.src = _assets_directionArrowIcons_DirectionsArrowUp_svg__WEBPACK_IMPORTED_MODULE_5__[\"default\"];\n } else if (step.instruction === 'arrival') {\n stepIcon.src = ArrivalIcon;\n }\n stepContainer.appendChild(stepIcon);\n\n // Step defatails container\n var stepDetails = document.createElement(\"div\");\n stepDetails.className = \"step-details\";\n\n // Step instruction\n var stepInstruction = document.createElement(\"div\");\n stepInstruction.className = \"step-instruction\";\n stepInstruction.textContent = step.text;\n stepDetails.appendChild(stepInstruction);\n if (index !== leg.steps.length - 1) {\n // Distance\n var stepDistance = document.createElement(\"div\");\n stepDistance.className = \"step-distance\";\n var distanceText = parseFloat(step.distance.toFixed(0));\n if (_this2.pathData.unit === 'Feet') {\n distanceText += ' ft';\n } else if (_this2.pathData.unit === 'Meters') {\n distanceText += ' m';\n }\n stepDistance.textContent = distanceText;\n stepDetails.appendChild(stepDistance);\n }\n stepContainer.appendChild(stepDetails);\n listItem.appendChild(stepContainer);\n list.appendChild(listItem);\n });\n stepsContainer.appendChild(list);\n this.element.appendChild(stepsContainer);\n }\n this.toggleButton = this._createToggleButton();\n this.element.appendChild(this.toggleButton);\n }\n }, {\n key: \"clearSteps\",\n value: function clearSteps() {\n var stepsViewElement = this.element.querySelector('.steps-view'); // Assuming .steps-view is a class in StepsView\n if (stepsViewElement) {\n stepsViewElement.remove(); // Remove the StepsView element if it exists\n }\n }\n }, {\n key: \"clear\",\n value: function clear() {\n this.pathData = null;\n this._render();\n }\n }, {\n key: \"setNewPath\",\n value: function setNewPath(pathData) {\n var stepsVisible = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n this.pathData = pathData;\n if (stepsVisible !== null) {\n this.stepsVisible = stepsVisible;\n }\n this.selectedLegIndex = 0;\n this._render();\n }\n }, {\n key: \"getElement\",\n value: function getElement() {\n return this.element;\n }\n }]);\n}(_core_Component__WEBPACK_IMPORTED_MODULE_1__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (StepsView);\n\n//# sourceURL=webpack://waygomaps/./src/components/DirectionsView/StepsView.js?");
|
|
794
794
|
|
|
795
795
|
/***/ }),
|
|
796
796
|
|
|
@@ -801,7 +801,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
801
801
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
802
802
|
|
|
803
803
|
"use strict";
|
|
804
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MapView: () => (/* binding */ MapView)\n/* harmony export */ });\n/* harmony import */ var _utils_resourceLoader__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/resourceLoader */ \"./src/utils/resourceLoader.js\");\n/* harmony import */ var _WaygoMaps__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../WaygoMaps */ \"./src/WaygoMaps.js\");\n/* harmony import */ var _core_Component__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../core/Component */ \"./src/core/Component.js\");\n/* harmony import */ var _StateCoordinator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./StateCoordinator */ \"./src/components/MapView/StateCoordinator.js\");\n/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../index */ \"./src/index.js\");\n/* harmony import */ var _assets_logoOutline_svg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../assets/logoOutline.svg */ \"./src/assets/logoOutline.svg\");\n/* harmony import */ var _assets_logoInner_svg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../assets/logoInner.svg */ \"./src/assets/logoInner.svg\");\nvar _defaultMapOptions;\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n\n\n\n\n\n\n\n\n// import WaygoLogoUrl from \"../../assets/WaygoLogoWhite.svg\";\n// import WaygoLogoUrl from \"../../assets/WaygoIconWhite.svg\";\n\n// import { convertVerticesToCoordinates } from \"../../utils/coordinateSystems\";\n\nvar mapboxCSS = 'https://api.mapbox.com/mapbox-gl-js/v3.5.1/mapbox-gl.css';\nvar mapboxJS = 'https://api.mapbox.com/mapbox-gl-js/v3.5.1/mapbox-gl.js';\nvar accessToken = 'pk.eyJ1Ijoid2F5Z28tbWFwcyIsImEiOiJjbGtxYzZ1N3QxdG43M210bXFuYmJ4a3gxIn0.tlbznj_fRJ8La6s2UUMO6A';\nvar mock = {\n '2d1d26267da84c4b87eedc1751d71067:0dc23522b7f841ab88756a94428538d1': {\n 'steps': ['Leave Keynote Theater and make a left (73 ft)', 'Turn right at Kyndral (104 ft)', 'Turn left at SAP (182 ft)', 'Turn right at Samsung (47 ft)', 'Turn left at May Mobility (142 feet)', 'Turn right and arrive at Monta, on your left'],\n 'path': [[-81.557308010743881, -195.68687504906683], [-66.793528483184829, -195.68687504906688], [-66.793528483184829, -136.30367294932935], [-6.7541584044446665, -136.30367294932955], [-6.7541584044446195, -106.92078820451393], [81.828518760909716, -106.92078820451393], [81.828518760909716, -47.209502115275079], [140.88363687114594, -47.209502115275079]]\n }\n};\nvar mockData = {\n 'b1800bf6e3ed480cae21526e42464676:a7fa2fb07ae04049b9026c296d015d66': {\n 'steps': ['Leave Roundtable and make a left', 'Turn right after walking 177 feet', 'Turn left after walking 203 feet', 'Turn right after walking 100 feet', 'Continue straight in 242 feet', 'Arrive at Stage 4, on your left'],\n 'path': [[95.645948774511609, -118.96329432647396], [41.840174496296385, -118.96329432647379], [41.840174496296484, -56.955420310725756], [10.344111504170499, -56.955420310725756], [10.34411150417062, 18.175813285074767], [0.17350782962993705, 18.175813285074767], [0.17350782962999536, 54.265052130219125], [-25.417043351472369, 54.26505213021921]]\n },\n // ROUNDTABLE TO STAGE 4\n '529803fcdd7e4d5db5ed71b9ff1ef0e2:899969e0115b4d8da8fb51bedf7caff2': {\n 'steps': [\"Leave Startups Info Point and make a left\", \"Turn right in 12 feet\", \"Turn left in 37 feet\", \"Continue straight for 182 feet\", \"Turn right in 36 feet\", \"Turn left after 29 feet\", \"Turn right after 57 feet\", \"Turn left after walking 42 feet\", \"Arrive at Alpha 1, on your right\"],\n 'path': [[284.28160504078147, -119.85123601826949], [258.75367051155007, -119.8512360182694], [258.75367051155007, -57.515278013020058], [-40.902596633706594, -57.515278013019092], [-40.902596633706445, 19.584459519789313], [-169.83960450772221, 19.584459519789728], [-169.83960450772213, 78.311493640524645], [-215.11519505890323, 78.311493640524787]]\n },\n 'd1910e5724844b40bf8e2a721fba172a:3673b48d96b04d7aa65937dec3276d3c': {\n 'steps': [\"Leave startup lounge and make a right\", \"Continue straight for 22 feet, then turn left\", \"Turn right in 37 feet\", \"Continue straight for 143 feet, then turn left\", \"Turn right in 32 feet\", \"Continue straight for 210 feet\", \"Turn right, and continue for 5 feet\", \"Arrive at The Black Innovation Zone, on your right\"],\n 'path': [[417.35544488563073, 75.74517709550193], [356.33182283838664, 75.745177095502129], [356.33182283838653, 17.674310953769847], [121.7517703449482, 17.674310953770604], [121.75177034494808, -56.800754663027305], [-207.21694798680142, -56.80075466302624], [-207.21694798680144, -78.116837633560053]]\n }\n};\nvar defaultMapOptions = (_defaultMapOptions = {\n container: 'map',\n sourceId: '2024.2xw_YUXYS8GoDTB2AQgN3A',\n center: [0, 0],\n floor: 0,\n zoom: 13,\n bearing: 0,\n // 46.15762290134818,-25.60000000000025\n // pitch: 30,\n pitch: 46\n}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defaultMapOptions, \"bearing\", -25), \"minPitch\", 0), \"maxPitch\", 60), \"minZoom\", 10.5), \"maxZoom\", 19.5), \"bounds\", null), \"doubleClickZoom\", true), \"dragPan\", true), \"dragRotate\", true), \"scrollZoom\", true), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defaultMapOptions, \"touchPitch\", true), \"touchZoomRotate\", true), \"interactive\", true), \"trackResize\", true), \"keyboard\", true), \"defaultControls\", false), \"setup\", false));\nvar MapView = /*#__PURE__*/function (_Component) {\n function MapView() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, MapView);\n _this = _callSuper(this, MapView, [_objectSpread(_objectSpread({}, defaultMapOptions), options)]);\n _this.mapViewApi = _WaygoMaps__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getMapViewApi();\n _this.searchApi = _WaygoMaps__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getSearchApi();\n _this.routesApi = _WaygoMaps__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getRotuesApi();\n _this.mapContainer = document.createElement('div');\n _this.mapContainer.className = 'inner-map-container';\n _this.ready = _this._initialize(options);\n _this.initialLoad = false;\n _this.originalFilters = {};\n _this._currentFloorIndex = options.floor;\n _this.mapData = null;\n _this._stateCoordinator = new _StateCoordinator__WEBPACK_IMPORTED_MODULE_3__[\"default\"](_this);\n _this.defaultControls = options.defaultControls; // || false;\n _this.setupControl = null;\n _this.location = options.location || null;\n _this.modalContainer = null;\n return _this;\n }\n _inherits(MapView, _Component);\n return _createClass(MapView, [{\n key: \"showModal\",\n value: function showModal(content) {\n var _this2 = this;\n // Create modal container if it doesn't exist\n if (!this.modalContainer) {\n this.modalContainer = document.createElement('div');\n this.modalContainer.className = 'waygo-map-modal-container';\n this.mapContainer.appendChild(this.modalContainer);\n\n // Add click handler to close modal when clicking outside\n this.modalContainer.addEventListener('click', function (e) {\n if (e.target === _this2.modalContainer) {\n _this2.hideModal();\n }\n });\n }\n\n // Create modal content\n var modalContent = document.createElement('div');\n modalContent.className = 'waygo-map-modal-content';\n\n // Can accept HTML string or DOM element\n if (typeof content === 'string') {\n modalContent.innerHTML = content;\n } else {\n modalContent.appendChild(content);\n }\n\n // Clear existing content and add new\n this.modalContainer.innerHTML = '';\n this.modalContainer.appendChild(modalContent);\n this.modalContainer.style.display = 'flex';\n }\n }, {\n key: \"hideModal\",\n value: function hideModal() {\n if (this.modalContainer) {\n this.modalContainer.style.display = 'none';\n }\n }\n }, {\n key: \"_initialize\",\n value: function () {\n var _initialize2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var _this3 = this;\n var styleId;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _context.prev = 0;\n _context.next = 3;\n return this._loadMapLibraries();\n case 3:\n mapboxgl.clearStorage();\n this.render();\n _context.next = 7;\n return this._initializeMapData();\n case 7:\n if (this.mapData) {\n _context.next = 10;\n break;\n }\n console.error(\"Error initializing map data.\");\n return _context.abrupt(\"return\");\n case 10:\n styleId = this.mapData.style_id;\n if (typeof mapboxgl !== 'undefined' && styleId) {\n mapboxgl.accessToken = accessToken;\n this.map = new mapboxgl.Map({\n container: this.mapContainer,\n style: \"mapbox://styles/waygo-maps/\".concat(styleId),\n center: this.options.center,\n zoom: this.options.zoom,\n bearing: this.options.bearing,\n pitch: this.options.pitch,\n minPitch: this.options.minPitch,\n maxPitch: this.options.maxPitch,\n minZoom: this.options.minZoom,\n maxZoom: this.options.maxZoom,\n bounds: this.options.bounds,\n doubleClickZoom: this.options.doubleClickZoom,\n dragPan: this.options.dragPan,\n dragRotate: this.options.dragRotate,\n scrollZoom: this.options.scrollZoom,\n touchPitch: this.options.touchPitch,\n touchZoomRotate: this.options.touchZoomRotate,\n interactive: this.options.interactive,\n trackResize: this.options.trackResize,\n keyboard: this.options.keyboard\n });\n this.map.on('styledata', function () {\n if (!_this3.initialLoad) {\n _this3._initializeOriginalFilters();\n _this3.updateFloor(_this3.options.floor, false);\n _this3.initialLoad = true;\n }\n });\n this.map.on('load', function () {\n if (_this3.defaultControls) {\n _this3._addLogoImage();\n _this3._addDefaultControls();\n _this3.updateFloor(_this3.options.floor, false);\n }\n if (_this3.options.setup) {\n _this3.setToSetupState();\n }\n _this3.fire('load', {\n mapData: _this3.mapData\n });\n });\n this._initializeEventListeners();\n } else {\n console.error('Mapbox GL JS is not loaded.');\n }\n _context.next = 17;\n break;\n case 14:\n _context.prev = 14;\n _context.t0 = _context[\"catch\"](0);\n console.error('Failed to initialize the map:', _context.t0);\n case 17:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this, [[0, 14]]);\n }));\n function _initialize() {\n return _initialize2.apply(this, arguments);\n }\n return _initialize;\n }()\n }, {\n key: \"_addLogoImage\",\n value: function _addLogoImage() {\n var linkUrl = 'https://waygomaps.com';\n var imageContainer = document.createElement('div');\n imageContainer.className = 'logo-image-container';\n var outlineImageElement = document.createElement('img');\n outlineImageElement.className = 'logo-outline-element';\n outlineImageElement.src = _assets_logoOutline_svg__WEBPACK_IMPORTED_MODULE_5__[\"default\"];\n outlineImageElement.alt = 'Clickable image';\n\n // Append the image to the container\n imageContainer.appendChild(outlineImageElement);\n var fillImageElement = document.createElement('img');\n fillImageElement.className = 'logo-fill-element';\n fillImageElement.src = _assets_logoInner_svg__WEBPACK_IMPORTED_MODULE_6__[\"default\"];\n fillImageElement.alt = 'Clickable image';\n\n // Append the image to the container\n imageContainer.appendChild(fillImageElement);\n\n // Add click event to open the link\n imageContainer.addEventListener('click', function () {\n window.open(linkUrl, '_blank'); // Open link in a new tab\n });\n\n // Append the container to the map container\n this.mapContainer.appendChild(imageContainer);\n\n // const websiteContainer = document.createElement('div');\n // websiteContainer.className = 'website-container';\n // websiteContainer.textContent = '© Waygo Maps';\n // // websiteContainer.textContent = 'waygomaps.com';\n\n // websiteContainer.addEventListener('click', () => {\n // window.open(linkUrl, '_blank'); // Open link in a new tab\n // });\n\n // this.mapContainer.appendChild(websiteContainer);\n }\n }, {\n key: \"getCurrentFloor\",\n value: function getCurrentFloor() {\n return this._currentFloorIndex;\n }\n }, {\n key: \"_addDefaultControls\",\n value: function _addDefaultControls() {\n var _this4 = this;\n var controls = [\n // new waygo.ContentPlacementControl(),\n new _index__WEBPACK_IMPORTED_MODULE_4__[\"default\"].SearchBoxControl(), new _index__WEBPACK_IMPORTED_MODULE_4__[\"default\"].FloorSelectorControl(), new _index__WEBPACK_IMPORTED_MODULE_4__[\"default\"].CategoryBarControl(), new _index__WEBPACK_IMPORTED_MODULE_4__[\"default\"].SearchResultsControl(), new _index__WEBPACK_IMPORTED_MODULE_4__[\"default\"].ContentPlacementControl(), new _index__WEBPACK_IMPORTED_MODULE_4__[\"default\"].DirectionsControl(), new _index__WEBPACK_IMPORTED_MODULE_4__[\"default\"].InteractionControl()\n // new waygo.FloorSelectorControl()\n ];\n controls.forEach(function (control) {\n return _this4.addControl(control);\n });\n }\n }, {\n key: \"_initializeOriginalFilters\",\n value: function _initializeOriginalFilters() {\n var _this5 = this;\n var layers = this.map.getStyle().layers;\n layers.forEach(function (layer) {\n if (layer.type !== 'background' && layer.type !== 'raster' && layer.type !== 'heatmap') {\n // Get and store the original filter, or set to null if no filter exists\n _this5.originalFilters[layer.id] = _this5.map.getFilter(layer.id) || null;\n }\n });\n }\n }, {\n key: \"_initializeEventListeners\",\n value: function _initializeEventListeners() {\n var _this6 = this;\n this.mapContainer.addEventListener('mousedown', function (event) {\n return _this6.fire('mousedown', {\n originalEvent: event\n });\n });\n // preclick\n this.mapContainer.addEventListener('click', function (event) {\n return _this6.fire('click', {\n originalEvent: event\n });\n });\n this.mapContainer.addEventListener('mouseover', function (event) {\n return _this6.fire('mouseover', {\n originalEvent: event\n });\n });\n this.mapContainer.addEventListener('mousemove', function (event) {\n return _this6.fire('mousemove', {\n originalEvent: event\n });\n });\n this.mapContainer.addEventListener('dblclick', function (event) {\n return _this6.fire('dblclick', {\n originalEvent: event\n });\n });\n // mouseenter\n // mouseleave\n this.mapContainer.addEventListener('mouseout', function (event) {\n return _this6.fire('mouseout', {\n originalEvent: event\n });\n });\n this.mapContainer.addEventListener('contextmenu', function (event) {\n return _this6.fire('contextmenu', {\n originalEvent: event\n });\n });\n this.mapContainer.addEventListener('wheel', function (event) {\n return _this6.fire('wheel', {\n originalEvent: event\n });\n });\n this.mapContainer.addEventListener('touchstart', function (event) {\n return _this6.fire('touchstart', {\n originalEvent: event\n });\n });\n this.mapContainer.addEventListener('touchend', function (event) {\n return _this6.fire('touchend', {\n originalEvent: event\n });\n });\n this.mapContainer.addEventListener('touchmove', function (event) {\n return _this6.fire('touchmove', {\n originalEvent: event\n });\n });\n this.mapContainer.addEventListener('touchcancel', function (event) {\n return _this6.fire('touchcancel', {\n originalEvent: event\n });\n });\n this.mapContainer.addEventListener('move', function (event) {\n return _this6.fire('move', {\n originalEvent: event\n });\n });\n var movementEvents = ['movestart', 'move', 'moveend', 'dragstart', 'drag', 'dragend', 'zoomstart', 'zoom', 'zoomend', 'rotatestart', 'rotate', 'rotateend', 'pitchstart', 'pitch', 'pitchend', 'boxzoomstart', 'boxzoomend', 'boxzoomcancel'];\n movementEvents.forEach(function (eventName) {\n _this6.map.on(eventName, function (event) {\n _this6.fire(eventName, {\n originalEvent: event\n });\n });\n });\n }\n }, {\n key: \"_initializeMapData\",\n value: function () {\n var _initializeMapData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n var parts, mapId, mapViewId, data;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n parts = this.options.sourceId.split('.');\n if (!(parts.length < 1 || parts.length > 2)) {\n _context2.next = 4;\n break;\n }\n console.error('The sourceId format is incorrect. It should be in the format \"mapId\" or \"mapId.mapViewId\".');\n return _context2.abrupt(\"return\");\n case 4:\n // let accountId = parts[0] || '';\n // let mapId = parts[1] || '';\n // let mapViewId = parts[2] || '';\n mapId = parts[0];\n mapViewId = parts[1]; // console.log(\"MAP ID\", mapId);\n // console.log(\"MAP VIEW ID\", mapViewId);\n // Set account id in WaygoMaps\n // waygoMaps.setAccountId(accountId);\n _context2.prev = 6;\n _context2.next = 9;\n return this.mapViewApi.loadMapView(mapId, mapViewId);\n case 9:\n data = _context2.sent;\n this.mapData = data;\n // console.log(\"DATA\", data.account_id);\n // console.log(data);\n _WaygoMaps__WEBPACK_IMPORTED_MODULE_1__[\"default\"].setAccountId(data.account_id);\n _context2.next = 17;\n break;\n case 14:\n _context2.prev = 14;\n _context2.t0 = _context2[\"catch\"](6);\n console.error('Error fetching map style:', _context2.t0);\n case 17:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this, [[6, 14]]);\n }));\n function _initializeMapData() {\n return _initializeMapData2.apply(this, arguments);\n }\n return _initializeMapData;\n }()\n }, {\n key: \"_loadMapLibraries\",\n value: function () {\n var _loadMapLibraries2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n _context3.next = 2;\n return (0,_utils_resourceLoader__WEBPACK_IMPORTED_MODULE_0__.loadCSS)(mapboxCSS);\n case 2:\n _context3.next = 4;\n return (0,_utils_resourceLoader__WEBPACK_IMPORTED_MODULE_0__.loadScript)(mapboxJS);\n case 4:\n mapboxgl.clearStorage();\n case 5:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3);\n }));\n function _loadMapLibraries() {\n return _loadMapLibraries2.apply(this, arguments);\n }\n return _loadMapLibraries;\n }()\n }, {\n key: \"render\",\n value: function render() {\n // this._addLogoImage();\n var targetContainer = document.getElementById(this.options.container);\n if (targetContainer) {\n targetContainer.appendChild(this.mapContainer);\n this.mapContainer.style.width = '100%';\n this.mapContainer.style.height = '100%';\n this.mapContainer.style.position = 'relative';\n } else {\n console.error(\"Container element with id \\\"\".concat(this.containerId, \"\\\" not found.\"));\n }\n }\n }, {\n key: \"updateFloor\",\n value: function updateFloor(floorIndex) {\n var _this7 = this;\n var zoomOut = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n var layers = this.map.getStyle().layers;\n layers.forEach(function (layer) {\n if (layer.type !== 'background' && layer.type !== 'raster' && layer.type !== 'heatmap') {\n // console.log(\"LAYER\");\n // console.log(layer);\n var originalFilter = _this7.originalFilters[layer.id];\n _this7.map.setFilter(layer.id, originalFilter);\n var floorFilter = ['==', ['get', '_floor'], floorIndex];\n if (originalFilter) {\n var combinedFilter = ['all', floorFilter, originalFilter];\n _this7.map.setFilter(layer.id, combinedFilter);\n } else {\n _this7.map.setFilter(layer.id, floorFilter);\n }\n }\n });\n this._currentFloorIndex = floorIndex;\n if (zoomOut) {\n var style = this.map.getStyle();\n var sources = Object.keys(style.sources);\n\n // console.log(\"STYLE\");\n // console.log(style);\n\n // Debug log to see available sources\n // console.log(\"Available sources:\", sources);\n\n var allFeatures = [];\n sources.forEach(function (sourceId) {\n // console.log(\"SOURCE ID\");\n // console.log(sourceId);\n var floorSourceLayer = \"\".concat(floorIndex, \"-feature\");\n var features = _this7.map.querySourceFeatures(sourceId, {\n sourceLayer: floorSourceLayer\n });\n // console.log(\"FEATURES\");\n // console.log(features);\n allFeatures = allFeatures.concat(features);\n });\n\n // console.log(\"ALL FEATURES\");\n // console.log(allFeatures.length, allFeatures);\n\n // If we have features, calculate their bounds\n if (allFeatures.length > 0) {\n var bounds = new mapboxgl.LngLatBounds();\n allFeatures.forEach(function (feature) {\n var geom = feature.geometry;\n // Handle different geometry types:\n if (geom.type === 'Point') {\n bounds.extend(geom.coordinates);\n } else if (geom.type === 'LineString') {\n geom.coordinates.forEach(function (coord) {\n return bounds.extend(coord);\n });\n } else if (geom.type === 'Polygon') {\n // For a Polygon, iterate through the outer ring (and inner rings if needed)\n geom.coordinates[0].forEach(function (coord) {\n return bounds.extend(coord);\n });\n }\n // Add cases for MultiPoint, MultiLineString, MultiPolygon as needed\n });\n var currentPitch = this.map.getPitch();\n var currentBearing = this.map.getBearing();\n\n // Fit the map to these bounds with some padding\n this.map.fitBounds(bounds, {\n padding: 50,\n duration: 1300,\n maxZoom: 15.5,\n pitch: currentPitch,\n bearing: currentBearing\n // speed: 1.2,\n });\n } else {\n // If no features found, zoom out from current center\n // console.log(\"NO FEATURES FOUND\");\n this.map.once('moveend', function () {\n console.log(\"FLY TO COMPLETE\");\n var allFeaturesAgain = [];\n sources.forEach(function (sourceId) {\n // console.log(\"SOURCE ID\");\n // console.log(sourceId);\n var floorSourceLayer = \"\".concat(floorIndex, \"-feature\");\n var features = _this7.map.querySourceFeatures(sourceId, {\n sourceLayer: floorSourceLayer\n });\n // console.log(\"FEATURES\");\n // console.log(features);\n allFeaturesAgain = allFeaturesAgain.concat(features);\n });\n if (allFeaturesAgain.length > 0) {\n var _bounds = new mapboxgl.LngLatBounds();\n allFeaturesAgain.forEach(function (feature) {\n var geom = feature.geometry;\n // Handle different geometry types:\n if (geom.type === 'Point') {\n _bounds.extend(geom.coordinates);\n } else if (geom.type === 'LineString') {\n geom.coordinates.forEach(function (coord) {\n return _bounds.extend(coord);\n });\n } else if (geom.type === 'Polygon') {\n // For a Polygon, iterate through the outer ring (and inner rings if needed)\n geom.coordinates[0].forEach(function (coord) {\n return _bounds.extend(coord);\n });\n }\n // Add cases for MultiPoint, MultiLineString, MultiPolygon as needed\n });\n var _currentPitch = _this7.map.getPitch();\n var _currentBearing = _this7.map.getBearing();\n\n // Fit the map to these bounds with some padding\n _this7.map.fitBounds(_bounds, {\n padding: 50,\n duration: 1300,\n maxZoom: 15.5,\n pitch: _currentPitch,\n bearing: _currentBearing\n // speed: 1.2,\n });\n }\n });\n // this.map.jumpTo({\n // zoom: this.map.getZoom() - 3\n // });\n this.map.flyTo({\n zoom: this.map.getZoom() - 3,\n duration: 500,\n essential: true\n });\n }\n }\n this.fire('floorChanged', {\n floorIndex: floorIndex\n });\n }\n }, {\n key: \"addHighlightedFeature\",\n value: function addHighlightedFeature(coordinates, properties) {\n var source = this.map.getSource('highlighted-content');\n var currentData = source._data;\n var newFeature = {\n 'type': 'Feature',\n 'geometry': {\n 'type': 'Point',\n 'coordinates': coordinates\n },\n 'properties': properties\n };\n currentData.features.push(newFeature);\n source.setData(currentData);\n return newFeature;\n }\n }, {\n key: \"addSelectedFeature\",\n value: function addSelectedFeature(coordinates, properties) {\n var allow_multi_select = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var source = this.map.getSource('selected-content');\n var currentData = source._data;\n var newFeature = {\n 'type': 'Feature',\n 'geometry': {\n 'type': 'Point',\n 'coordinates': coordinates\n },\n 'properties': properties\n };\n if (allow_multi_select) {\n currentData.features.push(newFeature);\n } else {\n currentData.features = [newFeature];\n }\n source.setData(currentData);\n }\n }, {\n key: \"clearSelectedContentLayer\",\n value: function clearSelectedContentLayer() {\n this.map.getSource('selected-content').setData({\n 'type': 'FeatureCollection',\n 'features': []\n });\n }\n }, {\n key: \"clearHighlightedContentLayer\",\n value: function clearHighlightedContentLayer() {\n this.map.getSource('highlighted-content').setData({\n 'type': 'FeatureCollection',\n 'features': []\n });\n }\n\n // MARK: Controls\n }, {\n key: \"addControl\",\n value: function addControl(control) {\n var container = control.onAdd(this);\n this.mapContainer.appendChild(container);\n }\n }, {\n key: \"removeControl\",\n value: function removeControl(control) {\n this.map.removeControl(control);\n }\n\n // MARK: Map states\n }, {\n key: \"getCurrentState\",\n value: function getCurrentState() {\n return this._stateCoordinator.state;\n }\n }, {\n key: \"setToDefaultState\",\n value: function setToDefaultState() {\n // console.log(\"SET TO DEFAULT STATE\", this.location);\n this._stateCoordinator.transitionTo('default');\n }\n }, {\n key: \"setToSearchState\",\n value: function () {\n var _setToSearchState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(query) {\n var skip,\n limit,\n floor,\n results,\n _args4 = arguments;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) switch (_context4.prev = _context4.next) {\n case 0:\n skip = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : 0;\n limit = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : 40;\n floor = _args4.length > 3 && _args4[3] !== undefined ? _args4[3] : null;\n _context4.next = 5;\n return this.search(query, skip, limit, floor);\n case 5:\n results = _context4.sent;\n this._stateCoordinator.transitionTo('search', {\n query: query,\n results: results\n });\n case 7:\n case \"end\":\n return _context4.stop();\n }\n }, _callee4, this);\n }));\n function setToSearchState(_x) {\n return _setToSearchState.apply(this, arguments);\n }\n return setToSearchState;\n }()\n }, {\n key: \"setToSelectedContentState\",\n value: function () {\n var _setToSelectedContentState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(contentPlacementIds) {\n var lastContentPlacementId, selectedContentPlacement;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) switch (_context5.prev = _context5.next) {\n case 0:\n lastContentPlacementId = contentPlacementIds[contentPlacementIds.length - 1];\n _context5.next = 3;\n return this.getContentPlacementDetails(lastContentPlacementId);\n case 3:\n selectedContentPlacement = _context5.sent;\n this.updateFloor(selectedContentPlacement.floor);\n this._stateCoordinator.transitionTo('selectedContent', {\n contentPlacementIds: contentPlacementIds,\n selectedContentPlacement: selectedContentPlacement\n });\n case 6:\n case \"end\":\n return _context5.stop();\n }\n }, _callee5, this);\n }));\n function setToSelectedContentState(_x2) {\n return _setToSelectedContentState.apply(this, arguments);\n }\n return setToSelectedContentState;\n }()\n }, {\n key: \"setToDirectionsState\",\n value: function () {\n var _setToDirectionsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n var startContentPlacementId,\n endContentPlacementId,\n startContentPlacement,\n endContentPlacement,\n _args6 = arguments;\n return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n while (1) switch (_context6.prev = _context6.next) {\n case 0:\n startContentPlacementId = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : null;\n endContentPlacementId = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : null;\n startContentPlacement = null;\n if (!startContentPlacementId) {\n _context6.next = 7;\n break;\n }\n _context6.next = 6;\n return this.getContentPlacementDetails(startContentPlacementId);\n case 6:\n startContentPlacement = _context6.sent;\n case 7:\n endContentPlacement = null;\n if (!endContentPlacementId) {\n _context6.next = 12;\n break;\n }\n _context6.next = 11;\n return this.getContentPlacementDetails(endContentPlacementId);\n case 11:\n endContentPlacement = _context6.sent;\n case 12:\n this._stateCoordinator.transitionTo('directions', {\n startContentPlacement: startContentPlacement,\n endContentPlacement: endContentPlacement\n });\n case 13:\n case \"end\":\n return _context6.stop();\n }\n }, _callee6, this);\n }));\n function setToDirectionsState() {\n return _setToDirectionsState.apply(this, arguments);\n }\n return setToDirectionsState;\n }()\n }, {\n key: \"setToSetupState\",\n value: function () {\n var _setToSetupState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n while (1) switch (_context7.prev = _context7.next) {\n case 0:\n // console.log(\"SET TO SETUP STATE\");\n\n // Reset map view to default top-down perspective\n if (this.map) {\n this.map.easeTo({\n pitch: 0,\n bearing: 0,\n duration: 0\n });\n }\n if (!this.setupControl) {\n this.setupControl = new _index__WEBPACK_IMPORTED_MODULE_4__[\"default\"].SetupControl();\n this.addControl(this.setupControl);\n }\n this._stateCoordinator.transitionTo('setup');\n case 3:\n case \"end\":\n return _context7.stop();\n }\n }, _callee7, this);\n }));\n function setToSetupState() {\n return _setToSetupState.apply(this, arguments);\n }\n return setToSetupState;\n }()\n }, {\n key: \"initiateBack\",\n value: function initiateBack() {\n this.fire('initiate:back');\n }\n }, {\n key: \"initiateSetToSearchState\",\n value: function initiateSetToSearchState() {\n this.fire('initiate:search');\n }\n }, {\n key: \"findPath\",\n value: function () {\n var _findPath = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(startContentPlacementId, endContentPlacementId) {\n var response_data;\n return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n while (1) switch (_context8.prev = _context8.next) {\n case 0:\n _context8.next = 2;\n return this.routesApi.findPath(this.mapData.map_id, startContentPlacementId, endContentPlacementId);\n case 2:\n response_data = _context8.sent;\n if (!response_data) {\n _context8.next = 7;\n break;\n }\n return _context8.abrupt(\"return\", response_data);\n case 7:\n console.error('Failed to find path.');\n case 8:\n case \"end\":\n return _context8.stop();\n }\n }, _callee8, this);\n }));\n function findPath(_x3, _x4) {\n return _findPath.apply(this, arguments);\n }\n return findPath;\n }()\n }, {\n key: \"findPathFromNodeToPlacement\",\n value: function () {\n var _findPathFromNodeToPlacement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(startNodeId, endPlacementId) {\n var response_data;\n return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n while (1) switch (_context9.prev = _context9.next) {\n case 0:\n _context9.next = 2;\n return this.routesApi.findPathFromNodeToPlacement(this.mapData.map_id, startNodeId, endPlacementId);\n case 2:\n response_data = _context9.sent;\n if (!response_data) {\n _context9.next = 7;\n break;\n }\n return _context9.abrupt(\"return\", response_data);\n case 7:\n console.error('Failed to find path.');\n case 8:\n case \"end\":\n return _context9.stop();\n }\n }, _callee9, this);\n }));\n function findPathFromNodeToPlacement(_x5, _x6) {\n return _findPathFromNodeToPlacement.apply(this, arguments);\n }\n return findPathFromNodeToPlacement;\n }() // MARK: Map methods\n }, {\n key: \"_findFeatureByPlacementId\",\n value: function _findFeatureByPlacementId(placementId) {\n var features = this.map.queryRenderedFeatures({\n filter: ['==', ['get', 'placement_id'], placementId]\n });\n\n // Return the first feature that matches the placementId\n return features.length > 0 ? features[0] : null;\n }\n }, {\n key: \"getCenter\",\n value: function getCenter() {\n // Update to convert from lat, lon, to x, y in meters\n if (this.map) {\n return this.map.getCenter();\n } else {\n console.error('Map is not initialized.');\n }\n }\n }, {\n key: \"setCenter\",\n value: function setCenter(lngLat) {\n // Update to convert from lat, lon, to x, y in meters\n if (this.map) {\n this.map.setCenter(lngLat);\n } else {\n console.error('Map is not initialized.');\n }\n }\n }, {\n key: \"search\",\n value: function () {\n var _search = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(query) {\n var skip,\n limit,\n floor,\n _args10 = arguments;\n return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n while (1) switch (_context10.prev = _context10.next) {\n case 0:\n skip = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : 0;\n limit = _args10.length > 2 && _args10[2] !== undefined ? _args10[2] : 40;\n floor = _args10.length > 3 && _args10[3] !== undefined ? _args10[3] : null;\n if (!(query === '')) {\n _context10.next = 5;\n break;\n }\n return _context10.abrupt(\"return\");\n case 5:\n if (this.mapData) {\n _context10.next = 7;\n break;\n }\n return _context10.abrupt(\"return\");\n case 7:\n _context10.prev = 7;\n _context10.next = 10;\n return this.searchApi.search(this.mapData.map_id, this.mapData.map_view_id, query, skip, limit, floor);\n case 10:\n return _context10.abrupt(\"return\", _context10.sent);\n case 13:\n _context10.prev = 13;\n _context10.t0 = _context10[\"catch\"](7);\n if (axios.isCancel(_context10.t0)) {\n console.error('Request canceled:', _context10.t0.message);\n } else {\n console.error('Search error:', _context10.t0);\n }\n case 16:\n case \"end\":\n return _context10.stop();\n }\n }, _callee10, this, [[7, 13]]);\n }));\n function search(_x7) {\n return _search.apply(this, arguments);\n }\n return search;\n }()\n }, {\n key: \"getContentPlacementDetails\",\n value: function () {\n var _getContentPlacementDetails = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(contentPlacementId) {\n var details;\n return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n while (1) switch (_context11.prev = _context11.next) {\n case 0:\n _context11.prev = 0;\n _context11.next = 3;\n return this.searchApi.fetchContentPlacementDetails(contentPlacementId);\n case 3:\n details = _context11.sent;\n return _context11.abrupt(\"return\", details);\n case 7:\n _context11.prev = 7;\n _context11.t0 = _context11[\"catch\"](0);\n if (axios.isCancel(_context11.t0)) {\n console.error('Request canceled:', _context11.t0.message);\n } else {\n console.error('Fetching content placement details error:', _context11.t0);\n }\n case 10:\n case \"end\":\n return _context11.stop();\n }\n }, _callee11, this, [[0, 7]]);\n }));\n function getContentPlacementDetails(_x8) {\n return _getContentPlacementDetails.apply(this, arguments);\n }\n return getContentPlacementDetails;\n }()\n }, {\n key: \"flyTo\",\n value: function flyTo(options) {\n // console.log('flyTo', options);\n this.map.flyTo(options);\n }\n }]);\n}(_core_Component__WEBPACK_IMPORTED_MODULE_2__[\"default\"]);\n\n//# sourceURL=webpack://waygomaps/./src/components/MapView/MapView.js?");
|
|
804
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ MapView: () => (/* binding */ MapView)\n/* harmony export */ });\n/* harmony import */ var _utils_resourceLoader__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../utils/resourceLoader */ \"./src/utils/resourceLoader.js\");\n/* harmony import */ var _WaygoMaps__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../WaygoMaps */ \"./src/WaygoMaps.js\");\n/* harmony import */ var _core_Component__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../core/Component */ \"./src/core/Component.js\");\n/* harmony import */ var _StateCoordinator__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./StateCoordinator */ \"./src/components/MapView/StateCoordinator.js\");\n/* harmony import */ var _index__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../index */ \"./src/index.js\");\n/* harmony import */ var _assets_logoOutline_svg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../assets/logoOutline.svg */ \"./src/assets/logoOutline.svg\");\n/* harmony import */ var _assets_logoInner_svg__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../assets/logoInner.svg */ \"./src/assets/logoInner.svg\");\nvar _defaultMapOptions;\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _regeneratorRuntime() { \"use strict\"; /*! regenerator-runtime -- Copyright (c) 2014-present, Facebook, Inc. -- license (MIT): https://github.com/facebook/regenerator/blob/main/LICENSE */ _regeneratorRuntime = function _regeneratorRuntime() { return e; }; var t, e = {}, r = Object.prototype, n = r.hasOwnProperty, o = Object.defineProperty || function (t, e, r) { t[e] = r.value; }, i = \"function\" == typeof Symbol ? Symbol : {}, a = i.iterator || \"@@iterator\", c = i.asyncIterator || \"@@asyncIterator\", u = i.toStringTag || \"@@toStringTag\"; function define(t, e, r) { return Object.defineProperty(t, e, { value: r, enumerable: !0, configurable: !0, writable: !0 }), t[e]; } try { define({}, \"\"); } catch (t) { define = function define(t, e, r) { return t[e] = r; }; } function wrap(t, e, r, n) { var i = e && e.prototype instanceof Generator ? e : Generator, a = Object.create(i.prototype), c = new Context(n || []); return o(a, \"_invoke\", { value: makeInvokeMethod(t, r, c) }), a; } function tryCatch(t, e, r) { try { return { type: \"normal\", arg: t.call(e, r) }; } catch (t) { return { type: \"throw\", arg: t }; } } e.wrap = wrap; var h = \"suspendedStart\", l = \"suspendedYield\", f = \"executing\", s = \"completed\", y = {}; function Generator() {} function GeneratorFunction() {} function GeneratorFunctionPrototype() {} var p = {}; define(p, a, function () { return this; }); var d = Object.getPrototypeOf, v = d && d(d(values([]))); v && v !== r && n.call(v, a) && (p = v); var g = GeneratorFunctionPrototype.prototype = Generator.prototype = Object.create(p); function defineIteratorMethods(t) { [\"next\", \"throw\", \"return\"].forEach(function (e) { define(t, e, function (t) { return this._invoke(e, t); }); }); } function AsyncIterator(t, e) { function invoke(r, o, i, a) { var c = tryCatch(t[r], t, o); if (\"throw\" !== c.type) { var u = c.arg, h = u.value; return h && \"object\" == _typeof(h) && n.call(h, \"__await\") ? e.resolve(h.__await).then(function (t) { invoke(\"next\", t, i, a); }, function (t) { invoke(\"throw\", t, i, a); }) : e.resolve(h).then(function (t) { u.value = t, i(u); }, function (t) { return invoke(\"throw\", t, i, a); }); } a(c.arg); } var r; o(this, \"_invoke\", { value: function value(t, n) { function callInvokeWithMethodAndArg() { return new e(function (e, r) { invoke(t, n, e, r); }); } return r = r ? r.then(callInvokeWithMethodAndArg, callInvokeWithMethodAndArg) : callInvokeWithMethodAndArg(); } }); } function makeInvokeMethod(e, r, n) { var o = h; return function (i, a) { if (o === f) throw Error(\"Generator is already running\"); if (o === s) { if (\"throw\" === i) throw a; return { value: t, done: !0 }; } for (n.method = i, n.arg = a;;) { var c = n.delegate; if (c) { var u = maybeInvokeDelegate(c, n); if (u) { if (u === y) continue; return u; } } if (\"next\" === n.method) n.sent = n._sent = n.arg;else if (\"throw\" === n.method) { if (o === h) throw o = s, n.arg; n.dispatchException(n.arg); } else \"return\" === n.method && n.abrupt(\"return\", n.arg); o = f; var p = tryCatch(e, r, n); if (\"normal\" === p.type) { if (o = n.done ? s : l, p.arg === y) continue; return { value: p.arg, done: n.done }; } \"throw\" === p.type && (o = s, n.method = \"throw\", n.arg = p.arg); } }; } function maybeInvokeDelegate(e, r) { var n = r.method, o = e.iterator[n]; if (o === t) return r.delegate = null, \"throw\" === n && e.iterator[\"return\"] && (r.method = \"return\", r.arg = t, maybeInvokeDelegate(e, r), \"throw\" === r.method) || \"return\" !== n && (r.method = \"throw\", r.arg = new TypeError(\"The iterator does not provide a '\" + n + \"' method\")), y; var i = tryCatch(o, e.iterator, r.arg); if (\"throw\" === i.type) return r.method = \"throw\", r.arg = i.arg, r.delegate = null, y; var a = i.arg; return a ? a.done ? (r[e.resultName] = a.value, r.next = e.nextLoc, \"return\" !== r.method && (r.method = \"next\", r.arg = t), r.delegate = null, y) : a : (r.method = \"throw\", r.arg = new TypeError(\"iterator result is not an object\"), r.delegate = null, y); } function pushTryEntry(t) { var e = { tryLoc: t[0] }; 1 in t && (e.catchLoc = t[1]), 2 in t && (e.finallyLoc = t[2], e.afterLoc = t[3]), this.tryEntries.push(e); } function resetTryEntry(t) { var e = t.completion || {}; e.type = \"normal\", delete e.arg, t.completion = e; } function Context(t) { this.tryEntries = [{ tryLoc: \"root\" }], t.forEach(pushTryEntry, this), this.reset(!0); } function values(e) { if (e || \"\" === e) { var r = e[a]; if (r) return r.call(e); if (\"function\" == typeof e.next) return e; if (!isNaN(e.length)) { var o = -1, i = function next() { for (; ++o < e.length;) if (n.call(e, o)) return next.value = e[o], next.done = !1, next; return next.value = t, next.done = !0, next; }; return i.next = i; } } throw new TypeError(_typeof(e) + \" is not iterable\"); } return GeneratorFunction.prototype = GeneratorFunctionPrototype, o(g, \"constructor\", { value: GeneratorFunctionPrototype, configurable: !0 }), o(GeneratorFunctionPrototype, \"constructor\", { value: GeneratorFunction, configurable: !0 }), GeneratorFunction.displayName = define(GeneratorFunctionPrototype, u, \"GeneratorFunction\"), e.isGeneratorFunction = function (t) { var e = \"function\" == typeof t && t.constructor; return !!e && (e === GeneratorFunction || \"GeneratorFunction\" === (e.displayName || e.name)); }, e.mark = function (t) { return Object.setPrototypeOf ? Object.setPrototypeOf(t, GeneratorFunctionPrototype) : (t.__proto__ = GeneratorFunctionPrototype, define(t, u, \"GeneratorFunction\")), t.prototype = Object.create(g), t; }, e.awrap = function (t) { return { __await: t }; }, defineIteratorMethods(AsyncIterator.prototype), define(AsyncIterator.prototype, c, function () { return this; }), e.AsyncIterator = AsyncIterator, e.async = function (t, r, n, o, i) { void 0 === i && (i = Promise); var a = new AsyncIterator(wrap(t, r, n, o), i); return e.isGeneratorFunction(r) ? a : a.next().then(function (t) { return t.done ? t.value : a.next(); }); }, defineIteratorMethods(g), define(g, u, \"Generator\"), define(g, a, function () { return this; }), define(g, \"toString\", function () { return \"[object Generator]\"; }), e.keys = function (t) { var e = Object(t), r = []; for (var n in e) r.push(n); return r.reverse(), function next() { for (; r.length;) { var t = r.pop(); if (t in e) return next.value = t, next.done = !1, next; } return next.done = !0, next; }; }, e.values = values, Context.prototype = { constructor: Context, reset: function reset(e) { if (this.prev = 0, this.next = 0, this.sent = this._sent = t, this.done = !1, this.delegate = null, this.method = \"next\", this.arg = t, this.tryEntries.forEach(resetTryEntry), !e) for (var r in this) \"t\" === r.charAt(0) && n.call(this, r) && !isNaN(+r.slice(1)) && (this[r] = t); }, stop: function stop() { this.done = !0; var t = this.tryEntries[0].completion; if (\"throw\" === t.type) throw t.arg; return this.rval; }, dispatchException: function dispatchException(e) { if (this.done) throw e; var r = this; function handle(n, o) { return a.type = \"throw\", a.arg = e, r.next = n, o && (r.method = \"next\", r.arg = t), !!o; } for (var o = this.tryEntries.length - 1; o >= 0; --o) { var i = this.tryEntries[o], a = i.completion; if (\"root\" === i.tryLoc) return handle(\"end\"); if (i.tryLoc <= this.prev) { var c = n.call(i, \"catchLoc\"), u = n.call(i, \"finallyLoc\"); if (c && u) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } else if (c) { if (this.prev < i.catchLoc) return handle(i.catchLoc, !0); } else { if (!u) throw Error(\"try statement without catch or finally\"); if (this.prev < i.finallyLoc) return handle(i.finallyLoc); } } } }, abrupt: function abrupt(t, e) { for (var r = this.tryEntries.length - 1; r >= 0; --r) { var o = this.tryEntries[r]; if (o.tryLoc <= this.prev && n.call(o, \"finallyLoc\") && this.prev < o.finallyLoc) { var i = o; break; } } i && (\"break\" === t || \"continue\" === t) && i.tryLoc <= e && e <= i.finallyLoc && (i = null); var a = i ? i.completion : {}; return a.type = t, a.arg = e, i ? (this.method = \"next\", this.next = i.finallyLoc, y) : this.complete(a); }, complete: function complete(t, e) { if (\"throw\" === t.type) throw t.arg; return \"break\" === t.type || \"continue\" === t.type ? this.next = t.arg : \"return\" === t.type ? (this.rval = this.arg = t.arg, this.method = \"return\", this.next = \"end\") : \"normal\" === t.type && e && (this.next = e), y; }, finish: function finish(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.finallyLoc === t) return this.complete(r.completion, r.afterLoc), resetTryEntry(r), y; } }, \"catch\": function _catch(t) { for (var e = this.tryEntries.length - 1; e >= 0; --e) { var r = this.tryEntries[e]; if (r.tryLoc === t) { var n = r.completion; if (\"throw\" === n.type) { var o = n.arg; resetTryEntry(r); } return o; } } throw Error(\"illegal catch attempt\"); }, delegateYield: function delegateYield(e, r, n) { return this.delegate = { iterator: values(e), resultName: r, nextLoc: n }, \"next\" === this.method && (this.arg = t), y; } }, e; }\nfunction asyncGeneratorStep(n, t, e, r, o, a, c) { try { var i = n[a](c), u = i.value; } catch (n) { return void e(n); } i.done ? t(u) : Promise.resolve(u).then(r, o); }\nfunction _asyncToGenerator(n) { return function () { var t = this, e = arguments; return new Promise(function (r, o) { var a = n.apply(t, e); function _next(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"next\", n); } function _throw(n) { asyncGeneratorStep(a, r, o, _next, _throw, \"throw\", n); } _next(void 0); }); }; }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n\n\n\n\n\n\n\n\n// import WaygoLogoUrl from \"../../assets/WaygoLogoWhite.svg\";\n// import WaygoLogoUrl from \"../../assets/WaygoIconWhite.svg\";\n\n// import { convertVerticesToCoordinates } from \"../../utils/coordinateSystems\";\n\nvar mapboxCSS = 'https://api.mapbox.com/mapbox-gl-js/v3.5.1/mapbox-gl.css';\nvar mapboxJS = 'https://api.mapbox.com/mapbox-gl-js/v3.5.1/mapbox-gl.js';\nvar accessToken = 'pk.eyJ1Ijoid2F5Z28tbWFwcyIsImEiOiJjbGtxYzZ1N3QxdG43M210bXFuYmJ4a3gxIn0.tlbznj_fRJ8La6s2UUMO6A';\nvar mock = {\n '2d1d26267da84c4b87eedc1751d71067:0dc23522b7f841ab88756a94428538d1': {\n 'steps': ['Leave Keynote Theater and make a left (73 ft)', 'Turn right at Kyndral (104 ft)', 'Turn left at SAP (182 ft)', 'Turn right at Samsung (47 ft)', 'Turn left at May Mobility (142 feet)', 'Turn right and arrive at Monta, on your left'],\n 'path': [[-81.557308010743881, -195.68687504906683], [-66.793528483184829, -195.68687504906688], [-66.793528483184829, -136.30367294932935], [-6.7541584044446665, -136.30367294932955], [-6.7541584044446195, -106.92078820451393], [81.828518760909716, -106.92078820451393], [81.828518760909716, -47.209502115275079], [140.88363687114594, -47.209502115275079]]\n }\n};\nvar mockData = {\n 'b1800bf6e3ed480cae21526e42464676:a7fa2fb07ae04049b9026c296d015d66': {\n 'steps': ['Leave Roundtable and make a left', 'Turn right after walking 177 feet', 'Turn left after walking 203 feet', 'Turn right after walking 100 feet', 'Continue straight in 242 feet', 'Arrive at Stage 4, on your left'],\n 'path': [[95.645948774511609, -118.96329432647396], [41.840174496296385, -118.96329432647379], [41.840174496296484, -56.955420310725756], [10.344111504170499, -56.955420310725756], [10.34411150417062, 18.175813285074767], [0.17350782962993705, 18.175813285074767], [0.17350782962999536, 54.265052130219125], [-25.417043351472369, 54.26505213021921]]\n },\n // ROUNDTABLE TO STAGE 4\n '529803fcdd7e4d5db5ed71b9ff1ef0e2:899969e0115b4d8da8fb51bedf7caff2': {\n 'steps': [\"Leave Startups Info Point and make a left\", \"Turn right in 12 feet\", \"Turn left in 37 feet\", \"Continue straight for 182 feet\", \"Turn right in 36 feet\", \"Turn left after 29 feet\", \"Turn right after 57 feet\", \"Turn left after walking 42 feet\", \"Arrive at Alpha 1, on your right\"],\n 'path': [[284.28160504078147, -119.85123601826949], [258.75367051155007, -119.8512360182694], [258.75367051155007, -57.515278013020058], [-40.902596633706594, -57.515278013019092], [-40.902596633706445, 19.584459519789313], [-169.83960450772221, 19.584459519789728], [-169.83960450772213, 78.311493640524645], [-215.11519505890323, 78.311493640524787]]\n },\n 'd1910e5724844b40bf8e2a721fba172a:3673b48d96b04d7aa65937dec3276d3c': {\n 'steps': [\"Leave startup lounge and make a right\", \"Continue straight for 22 feet, then turn left\", \"Turn right in 37 feet\", \"Continue straight for 143 feet, then turn left\", \"Turn right in 32 feet\", \"Continue straight for 210 feet\", \"Turn right, and continue for 5 feet\", \"Arrive at The Black Innovation Zone, on your right\"],\n 'path': [[417.35544488563073, 75.74517709550193], [356.33182283838664, 75.745177095502129], [356.33182283838653, 17.674310953769847], [121.7517703449482, 17.674310953770604], [121.75177034494808, -56.800754663027305], [-207.21694798680142, -56.80075466302624], [-207.21694798680144, -78.116837633560053]]\n }\n};\nvar defaultMapOptions = (_defaultMapOptions = {\n container: 'map',\n sourceId: '2024.2xw_YUXYS8GoDTB2AQgN3A',\n center: [0, 0],\n floor: 0,\n zoom: 13,\n bearing: 0,\n // 46.15762290134818,-25.60000000000025\n // pitch: 30,\n pitch: 46\n}, _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defaultMapOptions, \"bearing\", -25), \"minPitch\", 0), \"maxPitch\", 60), \"minZoom\", 10.5), \"maxZoom\", 19.5), \"bounds\", null), \"doubleClickZoom\", true), \"dragPan\", true), \"dragRotate\", true), \"scrollZoom\", true), _defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defineProperty(_defaultMapOptions, \"touchPitch\", true), \"touchZoomRotate\", true), \"interactive\", true), \"trackResize\", true), \"keyboard\", true), \"defaultControls\", false), \"setup\", false));\nvar MapView = /*#__PURE__*/function (_Component) {\n function MapView() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, MapView);\n _this = _callSuper(this, MapView, [_objectSpread(_objectSpread({}, defaultMapOptions), options)]);\n _this.mapViewApi = _WaygoMaps__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getMapViewApi();\n _this.searchApi = _WaygoMaps__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getSearchApi();\n _this.routesApi = _WaygoMaps__WEBPACK_IMPORTED_MODULE_1__[\"default\"].getRotuesApi();\n _this.mapContainer = document.createElement('div');\n _this.mapContainer.className = 'inner-map-container';\n _this.ready = _this._initialize(options);\n _this.initialLoad = false;\n _this.originalFilters = {};\n _this._currentFloorIndex = options.floor;\n _this.mapData = null;\n _this._stateCoordinator = new _StateCoordinator__WEBPACK_IMPORTED_MODULE_3__[\"default\"](_this);\n _this.defaultControls = options.defaultControls; // || false;\n _this.setupControl = null;\n _this.location = options.location || null;\n _this.modalContainer = null;\n return _this;\n }\n _inherits(MapView, _Component);\n return _createClass(MapView, [{\n key: \"showModal\",\n value: function showModal(content) {\n var _this2 = this;\n // Create modal container if it doesn't exist\n if (!this.modalContainer) {\n this.modalContainer = document.createElement('div');\n this.modalContainer.className = 'waygo-map-modal-container';\n this.mapContainer.appendChild(this.modalContainer);\n\n // Add click handler to close modal when clicking outside\n this.modalContainer.addEventListener('click', function (e) {\n if (e.target === _this2.modalContainer) {\n _this2.hideModal();\n }\n });\n }\n\n // Create modal content\n var modalContent = document.createElement('div');\n modalContent.className = 'waygo-map-modal-content';\n\n // Can accept HTML string or DOM element\n if (typeof content === 'string') {\n modalContent.innerHTML = content;\n } else {\n modalContent.appendChild(content);\n }\n\n // Clear existing content and add new\n this.modalContainer.innerHTML = '';\n this.modalContainer.appendChild(modalContent);\n this.modalContainer.style.display = 'flex';\n }\n }, {\n key: \"hideModal\",\n value: function hideModal() {\n if (this.modalContainer) {\n this.modalContainer.style.display = 'none';\n }\n }\n }, {\n key: \"_initialize\",\n value: function () {\n var _initialize2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee() {\n var _this3 = this;\n var styleId;\n return _regeneratorRuntime().wrap(function _callee$(_context) {\n while (1) switch (_context.prev = _context.next) {\n case 0:\n _context.prev = 0;\n _context.next = 3;\n return this._loadMapLibraries();\n case 3:\n mapboxgl.clearStorage();\n this.render();\n _context.next = 7;\n return this._initializeMapData();\n case 7:\n if (this.mapData) {\n _context.next = 10;\n break;\n }\n console.error(\"Error initializing map data.\");\n return _context.abrupt(\"return\");\n case 10:\n styleId = this.mapData.style_id;\n if (typeof mapboxgl !== 'undefined' && styleId) {\n mapboxgl.accessToken = accessToken;\n this.map = new mapboxgl.Map({\n container: this.mapContainer,\n style: \"mapbox://styles/waygo-maps/\".concat(styleId),\n center: this.options.center,\n zoom: this.options.zoom,\n bearing: this.options.bearing,\n pitch: this.options.pitch,\n minPitch: this.options.minPitch,\n maxPitch: this.options.maxPitch,\n minZoom: this.options.minZoom,\n maxZoom: this.options.maxZoom,\n bounds: this.options.bounds,\n doubleClickZoom: this.options.doubleClickZoom,\n dragPan: this.options.dragPan,\n dragRotate: this.options.dragRotate,\n scrollZoom: this.options.scrollZoom,\n touchPitch: this.options.touchPitch,\n touchZoomRotate: this.options.touchZoomRotate,\n interactive: this.options.interactive,\n trackResize: this.options.trackResize,\n keyboard: this.options.keyboard\n });\n this.map.on('styledata', function () {\n if (!_this3.initialLoad) {\n _this3._initializeOriginalFilters();\n _this3.updateFloor(_this3.options.floor, false);\n _this3.initialLoad = true;\n }\n });\n this.map.on('load', function () {\n if (_this3.defaultControls) {\n _this3._addLogoImage();\n _this3._addDefaultControls();\n _this3.updateFloor(_this3.options.floor, false);\n }\n if (_this3.options.setup) {\n _this3.setToSetupState();\n }\n _this3.fire('load', {\n mapData: _this3.mapData\n });\n });\n this._initializeEventListeners();\n } else {\n console.error('Mapbox GL JS is not loaded.');\n }\n _context.next = 17;\n break;\n case 14:\n _context.prev = 14;\n _context.t0 = _context[\"catch\"](0);\n console.error('Failed to initialize the map:', _context.t0);\n case 17:\n case \"end\":\n return _context.stop();\n }\n }, _callee, this, [[0, 14]]);\n }));\n function _initialize() {\n return _initialize2.apply(this, arguments);\n }\n return _initialize;\n }()\n }, {\n key: \"_addLogoImage\",\n value: function _addLogoImage() {\n var linkUrl = 'https://waygomaps.com';\n var imageContainer = document.createElement('div');\n imageContainer.className = 'logo-image-container';\n var outlineImageElement = document.createElement('img');\n outlineImageElement.className = 'logo-outline-element';\n outlineImageElement.src = _assets_logoOutline_svg__WEBPACK_IMPORTED_MODULE_5__[\"default\"];\n outlineImageElement.alt = 'Clickable image';\n\n // Append the image to the container\n imageContainer.appendChild(outlineImageElement);\n var fillImageElement = document.createElement('img');\n fillImageElement.className = 'logo-fill-element';\n fillImageElement.src = _assets_logoInner_svg__WEBPACK_IMPORTED_MODULE_6__[\"default\"];\n fillImageElement.alt = 'Clickable image';\n\n // Append the image to the container\n imageContainer.appendChild(fillImageElement);\n\n // Add click event to open the link\n imageContainer.addEventListener('click', function () {\n window.open(linkUrl, '_blank'); // Open link in a new tab\n });\n\n // Append the container to the map container\n this.mapContainer.appendChild(imageContainer);\n\n // const websiteContainer = document.createElement('div');\n // websiteContainer.className = 'website-container';\n // websiteContainer.textContent = '© Waygo Maps';\n // // websiteContainer.textContent = 'waygomaps.com';\n\n // websiteContainer.addEventListener('click', () => {\n // window.open(linkUrl, '_blank'); // Open link in a new tab\n // });\n\n // this.mapContainer.appendChild(websiteContainer);\n }\n }, {\n key: \"getCurrentFloor\",\n value: function getCurrentFloor() {\n return this._currentFloorIndex;\n }\n }, {\n key: \"_addDefaultControls\",\n value: function _addDefaultControls() {\n var _this4 = this;\n var controls = [\n // new waygo.ContentPlacementControl(),\n new _index__WEBPACK_IMPORTED_MODULE_4__[\"default\"].SearchBoxControl(), new _index__WEBPACK_IMPORTED_MODULE_4__[\"default\"].FloorSelectorControl(), new _index__WEBPACK_IMPORTED_MODULE_4__[\"default\"].CategoryBarControl(), new _index__WEBPACK_IMPORTED_MODULE_4__[\"default\"].SearchResultsControl(), new _index__WEBPACK_IMPORTED_MODULE_4__[\"default\"].ContentPlacementControl(), new _index__WEBPACK_IMPORTED_MODULE_4__[\"default\"].DirectionsControl(), new _index__WEBPACK_IMPORTED_MODULE_4__[\"default\"].InteractionControl()\n // new waygo.FloorSelectorControl()\n ];\n controls.forEach(function (control) {\n return _this4.addControl(control);\n });\n }\n }, {\n key: \"_initializeOriginalFilters\",\n value: function _initializeOriginalFilters() {\n var _this5 = this;\n var layers = this.map.getStyle().layers;\n layers.forEach(function (layer) {\n if (layer.type !== 'background' && layer.type !== 'raster' && layer.type !== 'heatmap') {\n // Get and store the original filter, or set to null if no filter exists\n _this5.originalFilters[layer.id] = _this5.map.getFilter(layer.id) || null;\n }\n });\n }\n }, {\n key: \"_initializeEventListeners\",\n value: function _initializeEventListeners() {\n var _this6 = this;\n this.mapContainer.addEventListener('mousedown', function (event) {\n return _this6.fire('mousedown', {\n originalEvent: event\n });\n });\n // preclick\n this.mapContainer.addEventListener('click', function (event) {\n return _this6.fire('click', {\n originalEvent: event\n });\n });\n this.mapContainer.addEventListener('mouseover', function (event) {\n return _this6.fire('mouseover', {\n originalEvent: event\n });\n });\n this.mapContainer.addEventListener('mousemove', function (event) {\n return _this6.fire('mousemove', {\n originalEvent: event\n });\n });\n this.mapContainer.addEventListener('dblclick', function (event) {\n return _this6.fire('dblclick', {\n originalEvent: event\n });\n });\n // mouseenter\n // mouseleave\n this.mapContainer.addEventListener('mouseout', function (event) {\n return _this6.fire('mouseout', {\n originalEvent: event\n });\n });\n this.mapContainer.addEventListener('contextmenu', function (event) {\n return _this6.fire('contextmenu', {\n originalEvent: event\n });\n });\n this.mapContainer.addEventListener('wheel', function (event) {\n return _this6.fire('wheel', {\n originalEvent: event\n });\n });\n this.mapContainer.addEventListener('touchstart', function (event) {\n return _this6.fire('touchstart', {\n originalEvent: event\n });\n });\n this.mapContainer.addEventListener('touchend', function (event) {\n return _this6.fire('touchend', {\n originalEvent: event\n });\n });\n this.mapContainer.addEventListener('touchmove', function (event) {\n return _this6.fire('touchmove', {\n originalEvent: event\n });\n });\n this.mapContainer.addEventListener('touchcancel', function (event) {\n return _this6.fire('touchcancel', {\n originalEvent: event\n });\n });\n this.mapContainer.addEventListener('move', function (event) {\n return _this6.fire('move', {\n originalEvent: event\n });\n });\n var movementEvents = ['movestart', 'move', 'moveend', 'dragstart', 'drag', 'dragend', 'zoomstart', 'zoom', 'zoomend', 'rotatestart', 'rotate', 'rotateend', 'pitchstart', 'pitch', 'pitchend', 'boxzoomstart', 'boxzoomend', 'boxzoomcancel'];\n movementEvents.forEach(function (eventName) {\n _this6.map.on(eventName, function (event) {\n _this6.fire(eventName, {\n originalEvent: event\n });\n });\n });\n }\n }, {\n key: \"_initializeMapData\",\n value: function () {\n var _initializeMapData2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee2() {\n var parts, mapId, mapViewId, data;\n return _regeneratorRuntime().wrap(function _callee2$(_context2) {\n while (1) switch (_context2.prev = _context2.next) {\n case 0:\n parts = this.options.sourceId.split('.');\n if (!(parts.length < 1 || parts.length > 2)) {\n _context2.next = 4;\n break;\n }\n console.error('The sourceId format is incorrect. It should be in the format \"mapId\" or \"mapId.mapViewId\".');\n return _context2.abrupt(\"return\");\n case 4:\n // let accountId = parts[0] || '';\n // let mapId = parts[1] || '';\n // let mapViewId = parts[2] || '';\n mapId = parts[0];\n mapViewId = parts[1]; // Set account id in WaygoMaps\n // waygoMaps.setAccountId(accountId);\n _context2.prev = 6;\n _context2.next = 9;\n return this.mapViewApi.loadMapView(mapId, mapViewId);\n case 9:\n data = _context2.sent;\n this.mapData = data;\n _WaygoMaps__WEBPACK_IMPORTED_MODULE_1__[\"default\"].setAccountId(data.account_id);\n _context2.next = 17;\n break;\n case 14:\n _context2.prev = 14;\n _context2.t0 = _context2[\"catch\"](6);\n console.error('Error fetching map style:', _context2.t0);\n case 17:\n case \"end\":\n return _context2.stop();\n }\n }, _callee2, this, [[6, 14]]);\n }));\n function _initializeMapData() {\n return _initializeMapData2.apply(this, arguments);\n }\n return _initializeMapData;\n }()\n }, {\n key: \"_loadMapLibraries\",\n value: function () {\n var _loadMapLibraries2 = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee3() {\n return _regeneratorRuntime().wrap(function _callee3$(_context3) {\n while (1) switch (_context3.prev = _context3.next) {\n case 0:\n _context3.next = 2;\n return (0,_utils_resourceLoader__WEBPACK_IMPORTED_MODULE_0__.loadCSS)(mapboxCSS);\n case 2:\n _context3.next = 4;\n return (0,_utils_resourceLoader__WEBPACK_IMPORTED_MODULE_0__.loadScript)(mapboxJS);\n case 4:\n mapboxgl.clearStorage();\n case 5:\n case \"end\":\n return _context3.stop();\n }\n }, _callee3);\n }));\n function _loadMapLibraries() {\n return _loadMapLibraries2.apply(this, arguments);\n }\n return _loadMapLibraries;\n }()\n }, {\n key: \"render\",\n value: function render() {\n // this._addLogoImage();\n var targetContainer = document.getElementById(this.options.container);\n if (targetContainer) {\n targetContainer.appendChild(this.mapContainer);\n this.mapContainer.style.width = '100%';\n this.mapContainer.style.height = '100%';\n this.mapContainer.style.position = 'relative';\n } else {\n console.error(\"Container element with id \\\"\".concat(this.containerId, \"\\\" not found.\"));\n }\n }\n }, {\n key: \"updateFloor\",\n value: function updateFloor(floorIndex) {\n var _this7 = this;\n var zoomOut = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true;\n var layers = this.map.getStyle().layers;\n layers.forEach(function (layer) {\n if (layer.type !== 'background' && layer.type !== 'raster' && layer.type !== 'heatmap') {\n var originalFilter = _this7.originalFilters[layer.id];\n _this7.map.setFilter(layer.id, originalFilter);\n var floorFilter = ['==', ['get', '_floor'], floorIndex];\n if (originalFilter) {\n var combinedFilter = ['all', floorFilter, originalFilter];\n _this7.map.setFilter(layer.id, combinedFilter);\n } else {\n _this7.map.setFilter(layer.id, floorFilter);\n }\n }\n });\n this._currentFloorIndex = floorIndex;\n if (zoomOut) {\n var style = this.map.getStyle();\n var sources = Object.keys(style.sources);\n\n // console.log(\"STYLE\");\n // console.log(style);\n\n // Debug log to see available sources\n // console.log(\"Available sources:\", sources);\n\n var allFeatures = [];\n sources.forEach(function (sourceId) {\n // console.log(\"SOURCE ID\");\n // console.log(sourceId);\n var floorSourceLayer = \"\".concat(floorIndex, \"-feature\");\n var features = _this7.map.querySourceFeatures(sourceId, {\n sourceLayer: floorSourceLayer\n });\n // console.log(\"FEATURES\");\n // console.log(features);\n allFeatures = allFeatures.concat(features);\n });\n\n // console.log(\"ALL FEATURES\");\n // console.log(allFeatures.length, allFeatures);\n\n // If we have features, calculate their bounds\n if (allFeatures.length > 0) {\n var bounds = new mapboxgl.LngLatBounds();\n allFeatures.forEach(function (feature) {\n var geom = feature.geometry;\n // Handle different geometry types:\n if (geom.type === 'Point') {\n bounds.extend(geom.coordinates);\n } else if (geom.type === 'LineString') {\n geom.coordinates.forEach(function (coord) {\n return bounds.extend(coord);\n });\n } else if (geom.type === 'Polygon') {\n // For a Polygon, iterate through the outer ring (and inner rings if needed)\n geom.coordinates[0].forEach(function (coord) {\n return bounds.extend(coord);\n });\n }\n // Add cases for MultiPoint, MultiLineString, MultiPolygon as needed\n });\n var currentPitch = this.map.getPitch();\n var currentBearing = this.map.getBearing();\n\n // Fit the map to these bounds with some padding\n this.map.fitBounds(bounds, {\n padding: 50,\n duration: 1300,\n maxZoom: 15.5,\n pitch: currentPitch,\n bearing: currentBearing\n // speed: 1.2,\n });\n } else {\n // If no features found, zoom out from current center\n // console.log(\"NO FEATURES FOUND\");\n this.map.once('moveend', function () {\n var allFeaturesAgain = [];\n sources.forEach(function (sourceId) {\n // console.log(\"SOURCE ID\");\n // console.log(sourceId);\n var floorSourceLayer = \"\".concat(floorIndex, \"-feature\");\n var features = _this7.map.querySourceFeatures(sourceId, {\n sourceLayer: floorSourceLayer\n });\n // console.log(\"FEATURES\");\n // console.log(features);\n allFeaturesAgain = allFeaturesAgain.concat(features);\n });\n if (allFeaturesAgain.length > 0) {\n var _bounds = new mapboxgl.LngLatBounds();\n allFeaturesAgain.forEach(function (feature) {\n var geom = feature.geometry;\n // Handle different geometry types:\n if (geom.type === 'Point') {\n _bounds.extend(geom.coordinates);\n } else if (geom.type === 'LineString') {\n geom.coordinates.forEach(function (coord) {\n return _bounds.extend(coord);\n });\n } else if (geom.type === 'Polygon') {\n // For a Polygon, iterate through the outer ring (and inner rings if needed)\n geom.coordinates[0].forEach(function (coord) {\n return _bounds.extend(coord);\n });\n }\n // Add cases for MultiPoint, MultiLineString, MultiPolygon as needed\n });\n var _currentPitch = _this7.map.getPitch();\n var _currentBearing = _this7.map.getBearing();\n\n // Fit the map to these bounds with some padding\n _this7.map.fitBounds(_bounds, {\n padding: 50,\n duration: 1300,\n maxZoom: 15.5,\n pitch: _currentPitch,\n bearing: _currentBearing\n // speed: 1.2,\n });\n }\n });\n // this.map.jumpTo({\n // zoom: this.map.getZoom() - 3\n // });\n this.map.flyTo({\n zoom: this.map.getZoom() - 3,\n duration: 500,\n essential: true\n });\n }\n }\n this.fire('floorChanged', {\n floorIndex: floorIndex\n });\n }\n }, {\n key: \"addHighlightedFeature\",\n value: function addHighlightedFeature(coordinates, properties) {\n var source = this.map.getSource('highlighted-content');\n var currentData = source._data;\n var newFeature = {\n 'type': 'Feature',\n 'geometry': {\n 'type': 'Point',\n 'coordinates': coordinates\n },\n 'properties': properties\n };\n currentData.features.push(newFeature);\n source.setData(currentData);\n return newFeature;\n }\n }, {\n key: \"addSelectedFeature\",\n value: function addSelectedFeature(coordinates, properties) {\n var allow_multi_select = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;\n var source = this.map.getSource('selected-content');\n var currentData = source._data;\n var newFeature = {\n 'type': 'Feature',\n 'geometry': {\n 'type': 'Point',\n 'coordinates': coordinates\n },\n 'properties': properties\n };\n if (allow_multi_select) {\n currentData.features.push(newFeature);\n } else {\n currentData.features = [newFeature];\n }\n source.setData(currentData);\n }\n }, {\n key: \"clearSelectedContentLayer\",\n value: function clearSelectedContentLayer() {\n this.map.getSource('selected-content').setData({\n 'type': 'FeatureCollection',\n 'features': []\n });\n }\n }, {\n key: \"clearHighlightedContentLayer\",\n value: function clearHighlightedContentLayer() {\n this.map.getSource('highlighted-content').setData({\n 'type': 'FeatureCollection',\n 'features': []\n });\n }\n\n // MARK: Controls\n }, {\n key: \"addControl\",\n value: function addControl(control) {\n var container = control.onAdd(this);\n this.mapContainer.appendChild(container);\n }\n }, {\n key: \"removeControl\",\n value: function removeControl(control) {\n this.map.removeControl(control);\n }\n\n // MARK: Map states\n }, {\n key: \"getCurrentState\",\n value: function getCurrentState() {\n return this._stateCoordinator.state;\n }\n }, {\n key: \"setToDefaultState\",\n value: function setToDefaultState() {\n // console.log(\"SET TO DEFAULT STATE\", this.location);\n this._stateCoordinator.transitionTo('default');\n }\n }, {\n key: \"setToSearchState\",\n value: function () {\n var _setToSearchState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee4(query) {\n var skip,\n limit,\n floor,\n results,\n _args4 = arguments;\n return _regeneratorRuntime().wrap(function _callee4$(_context4) {\n while (1) switch (_context4.prev = _context4.next) {\n case 0:\n skip = _args4.length > 1 && _args4[1] !== undefined ? _args4[1] : 0;\n limit = _args4.length > 2 && _args4[2] !== undefined ? _args4[2] : 40;\n floor = _args4.length > 3 && _args4[3] !== undefined ? _args4[3] : null;\n // Set loading state\n this._stateCoordinator.setLoading(true, 'search');\n _context4.prev = 4;\n _context4.next = 7;\n return this.search(query, skip, limit, floor);\n case 7:\n results = _context4.sent;\n this._stateCoordinator.transitionTo('search', {\n query: query,\n results: results\n });\n // Loading state will be reset in the transitionTo method\n _context4.next = 15;\n break;\n case 11:\n _context4.prev = 11;\n _context4.t0 = _context4[\"catch\"](4);\n console.error(\"\\u274C MapView: Search error occurred:\", _context4.t0);\n this._stateCoordinator.setLoading(false, 'search');\n // Handle error appropriately\n case 15:\n _context4.prev = 15;\n this._stateCoordinator.setLoading(false, 'search');\n return _context4.finish(15);\n case 18:\n case \"end\":\n return _context4.stop();\n }\n }, _callee4, this, [[4, 11, 15, 18]]);\n }));\n function setToSearchState(_x) {\n return _setToSearchState.apply(this, arguments);\n }\n return setToSearchState;\n }()\n }, {\n key: \"setToSelectedContentState\",\n value: function () {\n var _setToSelectedContentState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee5(contentPlacementIds) {\n var lastContentPlacementId, selectedContentPlacement;\n return _regeneratorRuntime().wrap(function _callee5$(_context5) {\n while (1) switch (_context5.prev = _context5.next) {\n case 0:\n // console.log(`📄 MapView: setToSelectedContentState called with IDs:`, contentPlacementIds);\n\n // Set loading state\n this._stateCoordinator.setLoading(true, 'content');\n _context5.prev = 1;\n lastContentPlacementId = contentPlacementIds[contentPlacementIds.length - 1];\n _context5.next = 5;\n return this.getContentPlacementDetails(lastContentPlacementId);\n case 5:\n selectedContentPlacement = _context5.sent;\n this.updateFloor(selectedContentPlacement.floor);\n this._stateCoordinator.transitionTo('selectedContent', {\n contentPlacementIds: contentPlacementIds,\n selectedContentPlacement: selectedContentPlacement\n });\n // Loading state will be reset in the transitionTo method\n _context5.next = 14;\n break;\n case 10:\n _context5.prev = 10;\n _context5.t0 = _context5[\"catch\"](1);\n console.error(\"\\u274C MapView: Content loading error occurred:\", _context5.t0);\n this._stateCoordinator.setLoading(false, 'content');\n // Handle error appropriately\n case 14:\n _context5.prev = 14;\n this._stateCoordinator.setLoading(false, 'content');\n return _context5.finish(14);\n case 17:\n case \"end\":\n return _context5.stop();\n }\n }, _callee5, this, [[1, 10, 14, 17]]);\n }));\n function setToSelectedContentState(_x2) {\n return _setToSelectedContentState.apply(this, arguments);\n }\n return setToSelectedContentState;\n }()\n }, {\n key: \"setToDirectionsState\",\n value: function () {\n var _setToDirectionsState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee6() {\n var startContentPlacementId,\n endContentPlacementId,\n startContentPlacement,\n endContentPlacement,\n _args6 = arguments;\n return _regeneratorRuntime().wrap(function _callee6$(_context6) {\n while (1) switch (_context6.prev = _context6.next) {\n case 0:\n startContentPlacementId = _args6.length > 0 && _args6[0] !== undefined ? _args6[0] : null;\n endContentPlacementId = _args6.length > 1 && _args6[1] !== undefined ? _args6[1] : null;\n _context6.prev = 2;\n startContentPlacement = null;\n if (!startContentPlacementId) {\n _context6.next = 8;\n break;\n }\n _context6.next = 7;\n return this.getContentPlacementDetails(startContentPlacementId);\n case 7:\n startContentPlacement = _context6.sent;\n case 8:\n endContentPlacement = null;\n if (!endContentPlacementId) {\n _context6.next = 13;\n break;\n }\n _context6.next = 12;\n return this.getContentPlacementDetails(endContentPlacementId);\n case 12:\n endContentPlacement = _context6.sent;\n case 13:\n this._stateCoordinator.transitionTo('directions', {\n startContentPlacement: startContentPlacement,\n endContentPlacement: endContentPlacement\n });\n // Loading state will be reset in the transitionTo method\n _context6.next = 19;\n break;\n case 16:\n _context6.prev = 16;\n _context6.t0 = _context6[\"catch\"](2);\n console.error(\"\\u274C MapView: Directions state error occurred:\", _context6.t0);\n // console.log(`🔄 MapView: Resetting loading state due to error`);\n // this._stateCoordinator.setLoading(false, 'directions');\n // Handle error appropriately\n case 19:\n case \"end\":\n return _context6.stop();\n }\n }, _callee6, this, [[2, 16]]);\n }));\n function setToDirectionsState() {\n return _setToDirectionsState.apply(this, arguments);\n }\n return setToDirectionsState;\n }()\n }, {\n key: \"setToSetupState\",\n value: function () {\n var _setToSetupState = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee7() {\n return _regeneratorRuntime().wrap(function _callee7$(_context7) {\n while (1) switch (_context7.prev = _context7.next) {\n case 0:\n // console.log(\"SET TO SETUP STATE\");\n\n // Reset map view to default top-down perspective\n if (this.map) {\n this.map.easeTo({\n pitch: 0,\n bearing: 0,\n duration: 0\n });\n }\n if (!this.setupControl) {\n this.setupControl = new _index__WEBPACK_IMPORTED_MODULE_4__[\"default\"].SetupControl();\n this.addControl(this.setupControl);\n }\n this._stateCoordinator.transitionTo('setup');\n case 3:\n case \"end\":\n return _context7.stop();\n }\n }, _callee7, this);\n }));\n function setToSetupState() {\n return _setToSetupState.apply(this, arguments);\n }\n return setToSetupState;\n }()\n }, {\n key: \"initiateBack\",\n value: function initiateBack() {\n this.fire('initiate:back');\n }\n }, {\n key: \"initiateSetToSearchState\",\n value: function initiateSetToSearchState() {\n this.fire('initiate:search');\n }\n }, {\n key: \"findPath\",\n value: function () {\n var _findPath = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee8(startContentPlacementId, endContentPlacementId) {\n var response_data;\n return _regeneratorRuntime().wrap(function _callee8$(_context8) {\n while (1) switch (_context8.prev = _context8.next) {\n case 0:\n this._stateCoordinator.setLoading(true, 'directions');\n _context8.prev = 1;\n _context8.next = 4;\n return this.routesApi.findPath(this.mapData.map_id, startContentPlacementId, endContentPlacementId);\n case 4:\n response_data = _context8.sent;\n if (!response_data) {\n _context8.next = 9;\n break;\n }\n return _context8.abrupt(\"return\", response_data);\n case 9:\n console.error('Failed to find path.');\n case 10:\n _context8.prev = 10;\n this._stateCoordinator.setLoading(false, 'directions');\n return _context8.finish(10);\n case 13:\n case \"end\":\n return _context8.stop();\n }\n }, _callee8, this, [[1,, 10, 13]]);\n }));\n function findPath(_x3, _x4) {\n return _findPath.apply(this, arguments);\n }\n return findPath;\n }()\n }, {\n key: \"findPathFromNodeToPlacement\",\n value: function () {\n var _findPathFromNodeToPlacement = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee9(startNodeId, endPlacementId) {\n var response_data;\n return _regeneratorRuntime().wrap(function _callee9$(_context9) {\n while (1) switch (_context9.prev = _context9.next) {\n case 0:\n this._stateCoordinator.setLoading(true, 'directions');\n _context9.prev = 1;\n _context9.next = 4;\n return this.routesApi.findPathFromNodeToPlacement(this.mapData.map_id, startNodeId, endPlacementId);\n case 4:\n response_data = _context9.sent;\n if (!response_data) {\n _context9.next = 9;\n break;\n }\n return _context9.abrupt(\"return\", response_data);\n case 9:\n console.error('Failed to find path.');\n case 10:\n _context9.prev = 10;\n this._stateCoordinator.setLoading(false, 'directions');\n return _context9.finish(10);\n case 13:\n case \"end\":\n return _context9.stop();\n }\n }, _callee9, this, [[1,, 10, 13]]);\n }));\n function findPathFromNodeToPlacement(_x5, _x6) {\n return _findPathFromNodeToPlacement.apply(this, arguments);\n }\n return findPathFromNodeToPlacement;\n }() // MARK: Map methods\n }, {\n key: \"_findFeatureByPlacementId\",\n value: function _findFeatureByPlacementId(placementId) {\n var features = this.map.queryRenderedFeatures({\n filter: ['==', ['get', 'placement_id'], placementId]\n });\n\n // Return the first feature that matches the placementId\n return features.length > 0 ? features[0] : null;\n }\n }, {\n key: \"getCenter\",\n value: function getCenter() {\n // Update to convert from lat, lon, to x, y in meters\n if (this.map) {\n return this.map.getCenter();\n } else {\n console.error('Map is not initialized.');\n }\n }\n }, {\n key: \"setCenter\",\n value: function setCenter(lngLat) {\n // Update to convert from lat, lon, to x, y in meters\n if (this.map) {\n this.map.setCenter(lngLat);\n } else {\n console.error('Map is not initialized.');\n }\n }\n }, {\n key: \"search\",\n value: function () {\n var _search = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee10(query) {\n var skip,\n limit,\n floor,\n _args10 = arguments;\n return _regeneratorRuntime().wrap(function _callee10$(_context10) {\n while (1) switch (_context10.prev = _context10.next) {\n case 0:\n skip = _args10.length > 1 && _args10[1] !== undefined ? _args10[1] : 0;\n limit = _args10.length > 2 && _args10[2] !== undefined ? _args10[2] : 40;\n floor = _args10.length > 3 && _args10[3] !== undefined ? _args10[3] : null;\n if (!(query === '')) {\n _context10.next = 5;\n break;\n }\n return _context10.abrupt(\"return\");\n case 5:\n if (this.mapData) {\n _context10.next = 7;\n break;\n }\n return _context10.abrupt(\"return\");\n case 7:\n _context10.prev = 7;\n _context10.next = 10;\n return this.searchApi.search(this.mapData.map_id, this.mapData.map_view_id, query, skip, limit, floor);\n case 10:\n return _context10.abrupt(\"return\", _context10.sent);\n case 13:\n _context10.prev = 13;\n _context10.t0 = _context10[\"catch\"](7);\n if (axios.isCancel(_context10.t0)) {\n console.error('Request canceled:', _context10.t0.message);\n } else {\n console.error('Search error:', _context10.t0);\n }\n case 16:\n case \"end\":\n return _context10.stop();\n }\n }, _callee10, this, [[7, 13]]);\n }));\n function search(_x7) {\n return _search.apply(this, arguments);\n }\n return search;\n }()\n }, {\n key: \"getContentPlacementDetails\",\n value: function () {\n var _getContentPlacementDetails = _asyncToGenerator( /*#__PURE__*/_regeneratorRuntime().mark(function _callee11(contentPlacementId) {\n var details;\n return _regeneratorRuntime().wrap(function _callee11$(_context11) {\n while (1) switch (_context11.prev = _context11.next) {\n case 0:\n _context11.prev = 0;\n _context11.next = 3;\n return this.searchApi.fetchContentPlacementDetails(contentPlacementId);\n case 3:\n details = _context11.sent;\n return _context11.abrupt(\"return\", details);\n case 7:\n _context11.prev = 7;\n _context11.t0 = _context11[\"catch\"](0);\n if (axios.isCancel(_context11.t0)) {\n console.error('Request canceled:', _context11.t0.message);\n } else {\n console.error('Fetching content placement details error:', _context11.t0);\n }\n case 10:\n case \"end\":\n return _context11.stop();\n }\n }, _callee11, this, [[0, 7]]);\n }));\n function getContentPlacementDetails(_x8) {\n return _getContentPlacementDetails.apply(this, arguments);\n }\n return getContentPlacementDetails;\n }()\n }, {\n key: \"flyTo\",\n value: function flyTo(options) {\n // console.log('flyTo', options);\n this.map.flyTo(options);\n }\n }]);\n}(_core_Component__WEBPACK_IMPORTED_MODULE_2__[\"default\"]);\n\n//# sourceURL=webpack://waygomaps/./src/components/MapView/MapView.js?");
|
|
805
805
|
|
|
806
806
|
/***/ }),
|
|
807
807
|
|
|
@@ -812,7 +812,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
812
812
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
813
813
|
|
|
814
814
|
"use strict";
|
|
815
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nvar StateCoordinator = /*#__PURE__*/function () {\n function StateCoordinator(mapView) {\n _classCallCheck(this, StateCoordinator);\n this.mapView = mapView;\n this.state = 'default';\n this.stateHistory = ['default'];\n }\n return _createClass(StateCoordinator, [{\n key: \"transitionTo\",\n value: function transitionTo(newState) {\n var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n this.state = newState;\n var lastState = this.stateHistory[this.stateHistory.length - 1];\n if (newState == 'default') {\n this.stateHistory = ['default'];\n } else if (newState !== lastState) {\n this.stateHistory.push(newState);\n }\n this.mapView.fire(\"state:\".concat(newState), data);\n }\n }]);\n}();\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (StateCoordinator);\n\n//# sourceURL=webpack://waygomaps/./src/components/MapView/StateCoordinator.js?");
|
|
815
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nvar StateCoordinator = /*#__PURE__*/function () {\n function StateCoordinator(mapView) {\n _classCallCheck(this, StateCoordinator);\n this.mapView = mapView;\n this.state = 'default';\n this.stateHistory = ['default'];\n this.isLoading = false;\n this.loadingType = null;\n }\n return _createClass(StateCoordinator, [{\n key: \"transitionTo\",\n value: function transitionTo(newState) {\n var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n this.state = newState;\n var lastState = this.stateHistory[this.stateHistory.length - 1];\n if (newState == 'default') {\n this.stateHistory = ['default'];\n } else if (newState !== lastState) {\n this.stateHistory.push(newState);\n }\n\n // Only reset loading state after the state transition is complete\n // Don't reset it here - let the loading:end event handle it\n\n this.mapView.fire(\"state:\".concat(newState), data);\n }\n }, {\n key: \"setLoading\",\n value: function setLoading(loading) {\n var type = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n var previousLoading = this.isLoading;\n var previousType = this.loadingType;\n this.isLoading = loading;\n this.loadingType = type;\n if (loading) {\n this.mapView.fire('loading:start', {\n type: type\n });\n } else {\n this.mapView.fire('loading:end', {\n type: type || previousType\n });\n }\n }\n }, {\n key: \"getLoadingState\",\n value: function getLoadingState() {\n return {\n isLoading: this.isLoading,\n loadingType: this.loadingType\n };\n }\n }]);\n}();\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (StateCoordinator);\n\n//# sourceURL=webpack://waygomaps/./src/components/MapView/StateCoordinator.js?");
|
|
816
816
|
|
|
817
817
|
/***/ }),
|
|
818
818
|
|
|
@@ -823,7 +823,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
823
823
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
824
824
|
|
|
825
825
|
"use strict";
|
|
826
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core/Component */ \"./src/core/Component.js\");\n/* harmony import */ var _assets_magnify_svg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../assets/magnify.svg */ \"./src/assets/magnify.svg\");\n/* harmony import */ var _assets_cancel_svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../assets/cancel.svg */ \"./src/assets/cancel.svg\");\n/* harmony import */ var _assets_arrows_backArrow_svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../assets/arrows/backArrow.svg */ \"./src/assets/arrows/backArrow.svg\");\n/* harmony import */ var _assets_WaygoIcon_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../assets/WaygoIcon.svg */ \"./src/assets/WaygoIcon.svg\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\n\n\nvar SearchBar = /*#__PURE__*/function (_Component) {\n function SearchBar() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, SearchBar);\n _this = _callSuper(this, SearchBar, [options]);\n _this._initialize();\n return _this;\n }\n _inherits(SearchBar, _Component);\n return _createClass(SearchBar, [{\n key: \"_initialize\",\n value: function _initialize() {\n this.element = document.createElement('div');\n this.element.className = 'search-bar-container';\n this.input = document.createElement('input');\n this.input.type = 'text';\n this.input.placeholder = '';\n this.input.className = 'search-bar';\n this.rightButton = document.createElement('button');\n this.rightButton.className = 'search-bar-button-right';\n this.updateRightButtonIcon('search');\n this.leftButton = document.createElement('button');\n this.leftButton.className = 'search-bar-button-left';\n this.updateLeftButtonIcon('none');\n this.element.appendChild(this.leftButton);\n this.element.appendChild(this.input);\n this.element.appendChild(this.rightButton);\n this._setupEventListeners();\n }\n }, {\n key: \"_setupEventListeners\",\n value: function _setupEventListeners() {\n var _this2 = this;\n this.input.addEventListener('input', function (e) {\n return _this2._handleInput(e);\n });\n this.input.addEventListener('focus', this._handleFocus.bind(this));\n this.input.addEventListener('blur', this._handleBlur.bind(this));\n this.input.addEventListener('keydown', function (e) {\n if (e.key === 'Enter') {\n _this2._handleEnterSelect(e);\n }\n });\n this.rightButton.addEventListener('click', function (e) {\n return _this2._handleRightButtonSelect(e);\n });\n this.leftButton.addEventListener('click', function (e) {\n return _this2._handleLeftButtonSelect(e);\n });\n }\n }, {\n key: \"_handleInput\",\n value: function _handleInput(e) {\n this.fire('input', {\n event: e,\n query: this.getText()\n });\n }\n }, {\n key: \"_handleFocus\",\n value: function _handleFocus() {\n var _this3 = this;\n var previousHeight = window.innerHeight;\n var stableHeightCheckCount = 0;\n var _checkKeyboardStabilized = function checkKeyboardStabilized() {\n var currentHeight = window.innerHeight;\n if (currentHeight === previousHeight) {\n stableHeightCheckCount += 1;\n } else {\n stableHeightCheckCount = 0;\n }\n previousHeight = currentHeight;\n if (stableHeightCheckCount >= 3) {\n // this.input.focus();\n _this3.fire('focus');\n } else {\n requestAnimationFrame(_checkKeyboardStabilized);\n }\n };\n requestAnimationFrame(_checkKeyboardStabilized);\n }\n }, {\n key: \"_handleBlur\",\n value: function _handleBlur() {\n var _this4 = this;\n setTimeout(function () {\n var elem = document.activeElement;\n if (elem === _this4.rightButton) {\n _this4.updateStyleWithoutSuggestions();\n _this4.fire('blur');\n } else if (elem === _this4.input) {} else {\n _this4.updateStyleWithoutSuggestions();\n _this4.fire('blur');\n }\n }, 150);\n }\n }, {\n key: \"_handleEnterSelect\",\n value: function _handleEnterSelect(e) {\n var query = this.getText();\n if (query.length > 0) {\n this.fire('search', {\n query: query,\n event: e\n });\n this.input.blur();\n }\n }\n }, {\n key: \"_handleRightButtonSelect\",\n value: function _handleRightButtonSelect(e) {\n if (this.rightButtonState === 'search') {\n var query = this.getText();\n if (query.length > 0) {\n this.fire('search', {\n query: query,\n event: e\n });\n this.input.blur();\n }\n } else if (this.rightButtonState === 'cancel') {\n this.fire('cancel', {\n event: e\n });\n }\n }\n }, {\n key: \"_handleLeftButtonSelect\",\n value: function _handleLeftButtonSelect(e) {\n if (this.leftButtonState === 'logo') {\n this.input.focus();\n } else if (this.leftButtonState === 'back') {\n this.fire('back');\n }\n }\n }, {\n key: \"updateStyleWithSuggestions\",\n value: function updateStyleWithSuggestions() {\n this.element.classList.add('with-results');\n }\n }, {\n key: \"updateStyleWithoutSuggestions\",\n value: function updateStyleWithoutSuggestions() {\n this.element.classList.remove('with-results');\n }\n }, {\n key: \"updateRightButtonIcon\",\n value: function updateRightButtonIcon(state) {\n this.rightButtonState = state;\n if (state === 'search') {\n this.rightButton.innerHTML = \"<img src=\\\"\".concat(_assets_magnify_svg__WEBPACK_IMPORTED_MODULE_1__[\"default\"], \"\\\" alt=\\\"Search\\\" />\");\n this.rightButton.style.display = 'flex';\n } else if (state === 'cancel') {\n this.rightButton.innerHTML = \"<img src=\\\"\".concat(_assets_cancel_svg__WEBPACK_IMPORTED_MODULE_2__[\"default\"], \"\\\" alt=\\\"Cancel\\\" />\");\n this.rightButton.style.display = 'flex';\n } else if (state === 'none') {\n this.rightButton.style.display = 'none';\n }\n }\n }, {\n key: \"updateLeftButtonIcon\",\n value: function updateLeftButtonIcon(state) {\n this.leftButtonState = state;\n if (state === 'logo') {\n this.leftButton.innerHTML = \"<img src=\\\"\".concat(_assets_WaygoIcon_svg__WEBPACK_IMPORTED_MODULE_4__[\"default\"], \"\\\" alt=\\\"\").concat(state, \"\\\" />\");\n var imgElement = this.leftButton.querySelector('img');\n imgElement.style.width = '16px';\n imgElement.style.height = '16px';\n this.leftButton.style.display = 'flex';\n } else if (state === 'back') {\n this.leftButton.innerHTML = \"<img src=\\\"\".concat(_assets_arrows_backArrow_svg__WEBPACK_IMPORTED_MODULE_3__[\"default\"], \"\\\" alt=\\\"\").concat(state, \"\\\" />\");\n var _imgElement = this.leftButton.querySelector('img');\n _imgElement.style.width = '20px';\n _imgElement.style.height = '20px';\n this.leftButton.style.display = 'flex';\n } else if (state === 'none') {\n this.leftButton.style.display = 'none';\n }\n }\n }, {\n key: \"setPlaceholderText\",\n value: function setPlaceholderText(placeholderText) {\n this.input.placeholder = placeholderText;\n }\n }, {\n key: \"getText\",\n value: function getText() {\n return this.input.value;\n }\n }, {\n key: \"setText\",\n value: function setText(query) {\n this.input.value = query;\n }\n }, {\n key: \"getElement\",\n value: function getElement() {\n return this.element;\n }\n }, {\n key: \"setViewForDesktop\",\n value: function setViewForDesktop() {\n this.element.classList.remove('mobile-view');\n this.input.classList.remove('mobile-view');\n }\n }, {\n key: \"setViewForMobile\",\n value: function setViewForMobile() {\n this.element.classList.add('mobile-view');\n this.input.classList.add('mobile-view');\n }\n }]);\n}(_core_Component__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SearchBar);\n\n//# sourceURL=webpack://waygomaps/./src/components/SearchBox/SearchBar.js?");
|
|
826
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony import */ var _core_Component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../../core/Component */ \"./src/core/Component.js\");\n/* harmony import */ var _assets_magnify_svg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../../assets/magnify.svg */ \"./src/assets/magnify.svg\");\n/* harmony import */ var _assets_cancel_svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../../assets/cancel.svg */ \"./src/assets/cancel.svg\");\n/* harmony import */ var _assets_loading_spinner_1_svg__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../../assets/loading-spinner 1.svg */ \"./src/assets/loading-spinner 1.svg\");\n/* harmony import */ var _assets_arrows_backArrow_svg__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../../assets/arrows/backArrow.svg */ \"./src/assets/arrows/backArrow.svg\");\n/* harmony import */ var _assets_WaygoIcon_svg__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../../assets/WaygoIcon.svg */ \"./src/assets/WaygoIcon.svg\");\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\nfunction _callSuper(t, o, e) { return o = _getPrototypeOf(o), _possibleConstructorReturn(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], _getPrototypeOf(t).constructor) : o.apply(t, e)); }\nfunction _possibleConstructorReturn(t, e) { if (e && (\"object\" == _typeof(e) || \"function\" == typeof e)) return e; if (void 0 !== e) throw new TypeError(\"Derived constructors may only return object or undefined\"); return _assertThisInitialized(t); }\nfunction _assertThisInitialized(e) { if (void 0 === e) throw new ReferenceError(\"this hasn't been initialised - super() hasn't been called\"); return e; }\nfunction _isNativeReflectConstruct() { try { var t = !Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); } catch (t) {} return (_isNativeReflectConstruct = function _isNativeReflectConstruct() { return !!t; })(); }\nfunction _getPrototypeOf(t) { return _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function (t) { return t.__proto__ || Object.getPrototypeOf(t); }, _getPrototypeOf(t); }\nfunction _inherits(t, e) { if (\"function\" != typeof e && null !== e) throw new TypeError(\"Super expression must either be null or a function\"); t.prototype = Object.create(e && e.prototype, { constructor: { value: t, writable: !0, configurable: !0 } }), Object.defineProperty(t, \"prototype\", { writable: !1 }), e && _setPrototypeOf(t, e); }\nfunction _setPrototypeOf(t, e) { return _setPrototypeOf = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function (t, e) { return t.__proto__ = e, t; }, _setPrototypeOf(t, e); }\n\n\n\n\n\n\nvar SearchBar = /*#__PURE__*/function (_Component) {\n function SearchBar() {\n var _this;\n var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};\n _classCallCheck(this, SearchBar);\n _this = _callSuper(this, SearchBar, [options]);\n _this._initialize();\n return _this;\n }\n _inherits(SearchBar, _Component);\n return _createClass(SearchBar, [{\n key: \"_initialize\",\n value: function _initialize() {\n this.element = document.createElement('div');\n this.element.className = 'search-bar-container';\n this.input = document.createElement('input');\n this.input.type = 'text';\n this.input.placeholder = '';\n this.input.className = 'search-bar';\n this.rightButton = document.createElement('button');\n this.rightButton.className = 'search-bar-button-right';\n this.updateRightButtonIcon('search');\n this.leftButton = document.createElement('button');\n this.leftButton.className = 'search-bar-button-left';\n this.updateLeftButtonIcon('none');\n\n // Add loading indicator between input and right button\n this.loadingIndicator = document.createElement('div');\n this.loadingIndicator.className = 'search-bar-loading-indicator';\n this.loadingIndicator.innerHTML = \"<img src=\\\"\".concat(_assets_loading_spinner_1_svg__WEBPACK_IMPORTED_MODULE_3__[\"default\"], \"\\\" alt=\\\"Loading\\\" />\");\n this.loadingIndicator.style.display = 'none';\n this.element.appendChild(this.leftButton);\n this.element.appendChild(this.input);\n this.element.appendChild(this.loadingIndicator);\n this.element.appendChild(this.rightButton);\n this._setupEventListeners();\n }\n }, {\n key: \"_setupEventListeners\",\n value: function _setupEventListeners() {\n var _this2 = this;\n this.input.addEventListener('input', function (e) {\n return _this2._handleInput(e);\n });\n this.input.addEventListener('focus', this._handleFocus.bind(this));\n this.input.addEventListener('blur', this._handleBlur.bind(this));\n this.input.addEventListener('keydown', function (e) {\n if (e.key === 'Enter') {\n _this2._handleEnterSelect(e);\n }\n });\n this.rightButton.addEventListener('click', function (e) {\n return _this2._handleRightButtonSelect(e);\n });\n this.leftButton.addEventListener('click', function (e) {\n return _this2._handleLeftButtonSelect(e);\n });\n }\n }, {\n key: \"_handleInput\",\n value: function _handleInput(e) {\n this.fire('input', {\n event: e,\n query: this.getText()\n });\n }\n }, {\n key: \"_handleFocus\",\n value: function _handleFocus() {\n var _this3 = this;\n var previousHeight = window.innerHeight;\n var stableHeightCheckCount = 0;\n var _checkKeyboardStabilized = function checkKeyboardStabilized() {\n var currentHeight = window.innerHeight;\n if (currentHeight === previousHeight) {\n stableHeightCheckCount += 1;\n } else {\n stableHeightCheckCount = 0;\n }\n previousHeight = currentHeight;\n if (stableHeightCheckCount >= 3) {\n // this.input.focus();\n _this3.fire('focus');\n } else {\n requestAnimationFrame(_checkKeyboardStabilized);\n }\n };\n requestAnimationFrame(_checkKeyboardStabilized);\n }\n }, {\n key: \"_handleBlur\",\n value: function _handleBlur() {\n var _this4 = this;\n setTimeout(function () {\n var elem = document.activeElement;\n if (elem === _this4.rightButton) {\n _this4.updateStyleWithoutSuggestions();\n _this4.fire('blur');\n } else if (elem === _this4.input) {} else {\n _this4.updateStyleWithoutSuggestions();\n _this4.fire('blur');\n }\n }, 150);\n }\n }, {\n key: \"_handleEnterSelect\",\n value: function _handleEnterSelect(e) {\n var query = this.getText();\n if (query.length > 0) {\n this.fire('search', {\n query: query,\n event: e\n });\n this.input.blur();\n }\n }\n }, {\n key: \"_handleRightButtonSelect\",\n value: function _handleRightButtonSelect(e) {\n if (this.rightButtonState === 'search') {\n var query = this.getText();\n if (query.length > 0) {\n this.fire('search', {\n query: query,\n event: e\n });\n this.input.blur();\n }\n } else if (this.rightButtonState === 'cancel') {\n this.fire('cancel', {\n event: e\n });\n }\n }\n }, {\n key: \"_handleLeftButtonSelect\",\n value: function _handleLeftButtonSelect(e) {\n if (this.leftButtonState === 'logo') {\n this.input.focus();\n } else if (this.leftButtonState === 'back') {\n this.fire('back');\n }\n }\n }, {\n key: \"updateStyleWithSuggestions\",\n value: function updateStyleWithSuggestions() {\n this.element.classList.add('with-results');\n }\n }, {\n key: \"updateStyleWithoutSuggestions\",\n value: function updateStyleWithoutSuggestions() {\n this.element.classList.remove('with-results');\n }\n }, {\n key: \"updateRightButtonIcon\",\n value: function updateRightButtonIcon(state) {\n this.rightButtonState = state;\n if (state === 'search') {\n this.rightButton.innerHTML = \"<img src=\\\"\".concat(_assets_magnify_svg__WEBPACK_IMPORTED_MODULE_1__[\"default\"], \"\\\" alt=\\\"Search\\\" />\");\n this.rightButton.style.display = 'flex';\n } else if (state === 'cancel') {\n this.rightButton.innerHTML = \"<img src=\\\"\".concat(_assets_cancel_svg__WEBPACK_IMPORTED_MODULE_2__[\"default\"], \"\\\" alt=\\\"Cancel\\\" />\");\n this.rightButton.style.display = 'flex';\n } else if (state === 'none') {\n this.rightButton.style.display = 'none';\n }\n }\n }, {\n key: \"updateLeftButtonIcon\",\n value: function updateLeftButtonIcon(state) {\n this.leftButtonState = state;\n if (state === 'logo') {\n this.leftButton.innerHTML = \"<img src=\\\"\".concat(_assets_WaygoIcon_svg__WEBPACK_IMPORTED_MODULE_5__[\"default\"], \"\\\" alt=\\\"\").concat(state, \"\\\" />\");\n var imgElement = this.leftButton.querySelector('img');\n imgElement.style.width = '16px';\n imgElement.style.height = '16px';\n this.leftButton.style.display = 'flex';\n } else if (state === 'back') {\n this.leftButton.innerHTML = \"<img src=\\\"\".concat(_assets_arrows_backArrow_svg__WEBPACK_IMPORTED_MODULE_4__[\"default\"], \"\\\" alt=\\\"\").concat(state, \"\\\" />\");\n var _imgElement = this.leftButton.querySelector('img');\n _imgElement.style.width = '20px';\n _imgElement.style.height = '20px';\n this.leftButton.style.display = 'flex';\n } else if (state === 'none') {\n this.leftButton.style.display = 'none';\n }\n }\n }, {\n key: \"setPlaceholderText\",\n value: function setPlaceholderText(placeholderText) {\n this.input.placeholder = placeholderText;\n }\n }, {\n key: \"getText\",\n value: function getText() {\n return this.input.value;\n }\n }, {\n key: \"setText\",\n value: function setText(query) {\n this.input.value = query;\n }\n }, {\n key: \"getElement\",\n value: function getElement() {\n return this.element;\n }\n }, {\n key: \"setViewForDesktop\",\n value: function setViewForDesktop() {\n this.element.classList.remove('mobile-view');\n this.input.classList.remove('mobile-view');\n }\n }, {\n key: \"setViewForMobile\",\n value: function setViewForMobile() {\n this.element.classList.add('mobile-view');\n this.input.classList.add('mobile-view');\n }\n }, {\n key: \"showLoading\",\n value: function showLoading() {\n this.loadingIndicator.style.display = 'flex';\n // this.rightButton.style.display = 'none';\n }\n }, {\n key: \"hideLoading\",\n value: function hideLoading() {\n this.loadingIndicator.style.display = 'none';\n this.rightButton.style.display = 'flex';\n }\n }]);\n}(_core_Component__WEBPACK_IMPORTED_MODULE_0__[\"default\"]);\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (SearchBar);\n\n//# sourceURL=webpack://waygomaps/./src/components/SearchBox/SearchBar.js?");
|
|
827
827
|
|
|
828
828
|
/***/ }),
|
|
829
829
|
|
|
@@ -955,7 +955,7 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
955
955
|
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
956
956
|
|
|
957
957
|
"use strict";
|
|
958
|
-
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n// src/core/Events.js\nvar Events = /*#__PURE__*/function () {\n function Events() {\n _classCallCheck(this, Events);\n this._listeners = {};\n }\n return _createClass(Events, [{\n key: \"on\",\n value: function on(type, listener) {\n if (!this._listeners[type]) {\n this._listeners[type] = [];\n }\n this._listeners[type].push(listener);\n return this;\n }\n }, {\n key: \"off\",\n value: function off(type, listener) {\n if (!this._listeners[type]) return this;\n var index = this._listeners[type].indexOf(listener);\n if (index !== -1) {\n this._listeners[type].splice(index, 1);\n }\n return this;\n }\n }, {\n key: \"fire\",\n value: function fire(type) {\n var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n if (!this._listeners[type]) return this;\n\n // Add the event type to the data\n
|
|
958
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\nfunction _typeof(o) { \"@babel/helpers - typeof\"; return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (o) { return typeof o; } : function (o) { return o && \"function\" == typeof Symbol && o.constructor === Symbol && o !== Symbol.prototype ? \"symbol\" : typeof o; }, _typeof(o); }\nfunction ownKeys(e, r) { var t = Object.keys(e); if (Object.getOwnPropertySymbols) { var o = Object.getOwnPropertySymbols(e); r && (o = o.filter(function (r) { return Object.getOwnPropertyDescriptor(e, r).enumerable; })), t.push.apply(t, o); } return t; }\nfunction _objectSpread(e) { for (var r = 1; r < arguments.length; r++) { var t = null != arguments[r] ? arguments[r] : {}; r % 2 ? ownKeys(Object(t), !0).forEach(function (r) { _defineProperty(e, r, t[r]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(e, Object.getOwnPropertyDescriptors(t)) : ownKeys(Object(t)).forEach(function (r) { Object.defineProperty(e, r, Object.getOwnPropertyDescriptor(t, r)); }); } return e; }\nfunction _defineProperty(e, r, t) { return (r = _toPropertyKey(r)) in e ? Object.defineProperty(e, r, { value: t, enumerable: !0, configurable: !0, writable: !0 }) : e[r] = t, e; }\nfunction _classCallCheck(a, n) { if (!(a instanceof n)) throw new TypeError(\"Cannot call a class as a function\"); }\nfunction _defineProperties(e, r) { for (var t = 0; t < r.length; t++) { var o = r[t]; o.enumerable = o.enumerable || !1, o.configurable = !0, \"value\" in o && (o.writable = !0), Object.defineProperty(e, _toPropertyKey(o.key), o); } }\nfunction _createClass(e, r, t) { return r && _defineProperties(e.prototype, r), t && _defineProperties(e, t), Object.defineProperty(e, \"prototype\", { writable: !1 }), e; }\nfunction _toPropertyKey(t) { var i = _toPrimitive(t, \"string\"); return \"symbol\" == _typeof(i) ? i : i + \"\"; }\nfunction _toPrimitive(t, r) { if (\"object\" != _typeof(t) || !t) return t; var e = t[Symbol.toPrimitive]; if (void 0 !== e) { var i = e.call(t, r || \"default\"); if (\"object\" != _typeof(i)) return i; throw new TypeError(\"@@toPrimitive must return a primitive value.\"); } return (\"string\" === r ? String : Number)(t); }\n// src/core/Events.js\nvar Events = /*#__PURE__*/function () {\n function Events() {\n _classCallCheck(this, Events);\n this._listeners = {};\n }\n return _createClass(Events, [{\n key: \"on\",\n value: function on(type, listener) {\n if (!this._listeners[type]) {\n this._listeners[type] = [];\n }\n this._listeners[type].push(listener);\n return this;\n }\n }, {\n key: \"off\",\n value: function off(type, listener) {\n if (!this._listeners[type]) return this;\n var index = this._listeners[type].indexOf(listener);\n if (index !== -1) {\n this._listeners[type].splice(index, 1);\n }\n return this;\n }\n }, {\n key: \"fire\",\n value: function fire(type) {\n var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};\n if (!this._listeners[type]) {\n // console.log(`📡 Events: Firing event '${type}' but no listeners registered`);\n return this;\n }\n\n // Create a copy of the data to avoid modifying the original\n var eventData = _objectSpread({}, data);\n\n // Add the event type to the data, but preserve original data.type if it exists\n if (!eventData.hasOwnProperty('type')) {\n eventData.type = type;\n }\n\n // console.log(`📡 Events: Firing event '${type}' to ${this._listeners[type].length} listener(s)`);\n // if (type.startsWith('loading:')) {\n // console.log(` Loading event data:`, eventData);\n // }\n\n // Call each listener with the event data\n this._listeners[type].forEach(function (listener, index) {\n try {\n // console.log(` 📡 Events: Calling listener ${index + 1} for event '${type}'`);\n listener(eventData);\n } catch (error) {\n console.error(\" \\u274C Events: Error in listener \".concat(index + 1, \" for event '\").concat(type, \"':\"), error);\n }\n });\n return this;\n }\n }]);\n}();\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Events);\n\n//# sourceURL=webpack://waygomaps/./src/core/Events.js?");
|
|
959
959
|
|
|
960
960
|
/***/ }),
|
|
961
961
|
|
|
@@ -3864,6 +3864,28 @@ eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpac
|
|
|
3864
3864
|
|
|
3865
3865
|
/***/ }),
|
|
3866
3866
|
|
|
3867
|
+
/***/ "./src/assets/loading-spinner 1.svg":
|
|
3868
|
+
/*!******************************************!*\
|
|
3869
|
+
!*** ./src/assets/loading-spinner 1.svg ***!
|
|
3870
|
+
\******************************************/
|
|
3871
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3872
|
+
|
|
3873
|
+
"use strict";
|
|
3874
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KPGcgY2xpcC1wYXRoPSJ1cmwoI2NsaXAwXzI1MzFfOTIpIj4KPHBhdGggZD0iTTEyIDIyQzE3LjUyMjggMjIgMjIgMTcuNTIyOCAyMiAxMkMyMiA2LjQ3NzE1IDE3LjUyMjggMiAxMiAyQzYuNDc3MTUgMiAyIDYuNDc3MTUgMiAxMkMyIDE3LjUyMjggNi40NzcxNSAyMiAxMiAyMloiIHN0cm9rZT0iI0U1RTdFQiIgc3Ryb2tlLXdpZHRoPSIyIiBzdHJva2UtbGluZWNhcD0icm91bmQiLz4KPHBhdGggZD0iTTE5LjE0MjEgNS4wNzEwN0MxNS4yMzY4IDEuMTY1NzIgOC45MDUzNiAxLjE2NTcyIDUuMDAwMDEgNS4wNzEwNyIgc3Ryb2tlPSIjMTcxNzE3IiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIvPgo8L2c+CjxkZWZzPgo8Y2xpcFBhdGggaWQ9ImNsaXAwXzI1MzFfOTIiPgo8cmVjdCB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIGZpbGw9IndoaXRlIi8+CjwvY2xpcFBhdGg+CjwvZGVmcz4KPC9zdmc+Cg==\");\n\n//# sourceURL=webpack://waygomaps/./src/assets/loading-spinner_1.svg?");
|
|
3875
|
+
|
|
3876
|
+
/***/ }),
|
|
3877
|
+
|
|
3878
|
+
/***/ "./src/assets/loading-spinner.svg":
|
|
3879
|
+
/*!****************************************!*\
|
|
3880
|
+
!*** ./src/assets/loading-spinner.svg ***!
|
|
3881
|
+
\****************************************/
|
|
3882
|
+
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
|
|
3883
|
+
|
|
3884
|
+
"use strict";
|
|
3885
|
+
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony export */ __webpack_require__.d(__webpack_exports__, {\n/* harmony export */ \"default\": () => (__WEBPACK_DEFAULT_EXPORT__)\n/* harmony export */ });\n/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (\"data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iMjQiIGhlaWdodD0iMjQiIHZpZXdCb3g9IjAgMCAyNCAyNCIgZmlsbD0ibm9uZSIgeG1sbnM9Imh0dHA6Ly93d3cudzMub3JnLzIwMDAvc3ZnIj4KICA8Y2lyY2xlIGN4PSIxMiIgY3k9IjEyIiByPSIxMCIgc3Ryb2tlPSIjRTVFN0VCIiBzdHJva2Utd2lkdGg9IjIiIHN0cm9rZS1saW5lY2FwPSJyb3VuZCIvPgogIDxwYXRoIGQ9Ik0xMiAyQzYuNDc3IDIgMiA2LjQ3NyAyIDEyIiBzdHJva2U9IiMxNzE3MTciIHN0cm9rZS13aWR0aD0iMiIgc3Ryb2tlLWxpbmVjYXA9InJvdW5kIiBzdHJva2UtZGFzaGFycmF5PSI0IDQiPgogICAgPGFuaW1hdGVUcmFuc2Zvcm0gYXR0cmlidXRlTmFtZT0idHJhbnNmb3JtIiB0eXBlPSJyb3RhdGUiIHZhbHVlcz0iMCAxMiAxMjszNjAgMTIgMTIiIGR1cj0iMXMiIHJlcGVhdENvdW50PSJpbmRlZmluaXRlIi8+CiAgPC9wYXRoPgo8L3N2Zz4=\");\n\n//# sourceURL=webpack://waygomaps/./src/assets/loading-spinner.svg?");
|
|
3886
|
+
|
|
3887
|
+
/***/ }),
|
|
3888
|
+
|
|
3867
3889
|
/***/ "./src/assets/location.svg":
|
|
3868
3890
|
/*!*********************************!*\
|
|
3869
3891
|
!*** ./src/assets/location.svg ***!
|