{"version":3,"file":"osagai-map.mjs","sources":["../node_modules/osagai/osagai.js","../node_modules/osagai/lifecycles.mjs","../node_modules/osagai/dom.mjs","../src/utils.js","../src/osagai-map.js","../src/osagai-map-marker.js"],"sourcesContent":["'use strict';\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\nconst query = element => q =>\n  Promise.resolve().then(() => element.querySelector(q));\n\nconst queryAll = element => q =>\n  Promise.resolve().then(() => element.querySelectorAll(q));\n\nconst SHADOW_DOM = \"__shadowDom__\";\n\nconst define = (\n  name,\n  Element,\n  {\n    BaseElement = HTMLElement,\n    observedAttributes,\n    renderer,\n    ...customElementOptions\n  } = {}\n) => {\n  class Component extends BaseElement {\n    static get observedAttributes() {\n      return Element.observedAttributes || observedAttributes;\n    }\n\n    constructor() {\n      super();\n\n      this._initialized = false;\n      this.__handleAttributeChangedCallback__ = [];\n      this.__handleConnectedCallback__ = [];\n      this.__handleDisconnectedCallback__ = [];\n      this.__currentState__ = undefined;\n      this.__hasCustomRenderer__ = !!renderer;\n      this.__renderer__ =\n        renderer ||\n        function renderer(element, template) {\n          let root = element[SHADOW_DOM] || element;\n          root.innerHTML = template;\n        };\n\n      this._template = Element({\n        element: this,\n        query: query(this),\n        queryAll: queryAll(this)\n      });\n\n      this._shouldUpdate =\n        this._template && typeof this._template === \"function\";\n    }\n\n    connectedCallback() {\n      if (this._shouldUpdate && !this._initialized) {\n        this._initialized = true;\n        this.__renderer__(\n          this,\n          this._templateWithClearing(this.__currentState__)\n        );\n      }\n\n      this.__handleConnectedCallback__.forEach(function(callback) {\n        callback();\n      });\n    }\n\n    disconnectedCallback() {\n      this.__handleDisconnectedCallback__.forEach(function(callback) {\n        callback();\n      });\n    }\n\n    _templateWithClearing(state) {\n      const template = this._template(state);\n\n      return typeof template === \"string\" ? template.trim() : template;\n    }\n\n    attributeChangedCallback(name, oldValue, newValue) {\n      if (!this.isConnected) {\n        return;\n      }\n\n      this.__handleAttributeChangedCallback__.forEach(function(callback) {\n        callback({\n          name,\n          current: newValue,\n          old: oldValue\n        });\n      });\n    }\n  }\n\n  if (!customElements.get(name)) {\n    customElements.define(name, Component, customElementOptions);\n  }\n\n  return {\n    name,\n    component: Component\n  };\n};\n\nexports.define = define;\n","function onAttributeChanged(element, callback) {\n  element.__handleAttributeChangedCallback__.push(callback);\n}\n\nfunction onConnected(element, callback) {\n  element.__handleConnectedCallback__.push(callback);\n}\n\nfunction onDisconnected(element, callback) {\n  element.__handleDisconnectedCallback__.push(callback);\n}\n\nexport { onAttributeChanged, onConnected, onDisconnected };\n","var range; // Create a range object for efficently rendering strings to elements.\nvar NS_XHTML = \"http://www.w3.org/1999/xhtml\";\n\nvar doc = typeof document === \"undefined\" ? undefined : document;\n\nvar testEl = doc ? doc.body || doc.createElement(\"div\") : {};\n\n// Fixes <https://github.com/patrick-steele-idem/morphdom/issues/32>\n// (IE7+ support) <=IE7 does not support el.hasAttribute(name)\nvar actualHasAttributeNS;\n\nif (testEl.hasAttributeNS) {\n  actualHasAttributeNS = function(el, namespaceURI, name) {\n    return el.hasAttributeNS(namespaceURI, name);\n  };\n} else if (testEl.hasAttribute) {\n  actualHasAttributeNS = function(el, namespaceURI, name) {\n    return el.hasAttribute(name);\n  };\n} else {\n  actualHasAttributeNS = function(el, namespaceURI, name) {\n    return el.getAttributeNode(namespaceURI, name) != null;\n  };\n}\n\nvar hasAttributeNS = actualHasAttributeNS;\n\nfunction toElement(str) {\n  if (!range && doc.createRange) {\n    range = doc.createRange();\n    range.selectNode(doc.body);\n  }\n\n  var fragment;\n  if (range && range.createContextualFragment) {\n    fragment = range.createContextualFragment(str);\n  } else {\n    fragment = doc.createElement(\"body\");\n    fragment.innerHTML = str;\n  }\n  return fragment.childNodes[0];\n}\n\n/**\n * Returns true if two node's names are the same.\n *\n * NOTE: We don't bother checking `namespaceURI` because you will never find two HTML elements with the same\n *       nodeName and different namespace URIs.\n *\n * @param {Element} a\n * @param {Element} b The target element\n * @return {boolean}\n */\nfunction compareNodeNames(fromEl, toEl) {\n  var fromNodeName = fromEl.nodeName;\n  var toNodeName = toEl.nodeName;\n\n  if (fromNodeName === toNodeName) {\n    return true;\n  }\n\n  if (\n    toEl.actualize &&\n    fromNodeName.charCodeAt(0) < 91 /* from tag name is upper case */ &&\n    toNodeName.charCodeAt(0) > 90 /* target tag name is lower case */\n  ) {\n    // If the target element is a virtual DOM node then we may need to normalize the tag name\n    // before comparing. Normal HTML elements that are in the \"http://www.w3.org/1999/xhtml\"\n    // are converted to upper case\n    return fromNodeName === toNodeName.toUpperCase();\n  } else {\n    return false;\n  }\n}\n\n/**\n * Create an element, optionally with a known namespace URI.\n *\n * @param {string} name the element name, e.g. 'div' or 'svg'\n * @param {string} [namespaceURI] the element's namespace URI, i.e. the value of\n * its `xmlns` attribute or its inferred namespace.\n *\n * @return {Element}\n */\nfunction createElementNS(name, namespaceURI) {\n  return !namespaceURI || namespaceURI === NS_XHTML\n    ? doc.createElement(name)\n    : doc.createElementNS(namespaceURI, name);\n}\n\n/**\n * Copies the children of one DOM element to another DOM element\n */\nfunction moveChildren(fromEl, toEl) {\n  var curChild = fromEl.firstChild;\n  while (curChild) {\n    var nextChild = curChild.nextSibling;\n    toEl.appendChild(curChild);\n    curChild = nextChild;\n  }\n  return toEl;\n}\n\n/**\n * Check if the element is a custom element or not\n *\n * @param {Element} element the element that will be checked\n *\n * @returns {boolean}\n */\nfunction isCustomElement(element) {\n  // By definition custom elements must have \"-\" in the tag name\n  return /-/.test(element.tagName);\n}\n\nfunction morphAttrs(fromNode, toNode) {\n  var attrs = toNode.attributes;\n  var i;\n  var attr;\n  var attrName;\n  var attrNamespaceURI;\n  var attrValue;\n  var fromValue;\n\n  for (i = attrs.length - 1; i >= 0; --i) {\n    attr = attrs[i];\n    attrName = attr.name;\n    attrNamespaceURI = attr.namespaceURI;\n    attrValue = attr.value;\n\n    if (attrNamespaceURI) {\n      attrName = attr.localName || attrName;\n      fromValue = fromNode.getAttributeNS(attrNamespaceURI, attrName);\n\n      if (fromValue !== attrValue) {\n        fromNode.setAttributeNS(attrNamespaceURI, attrName, attrValue);\n      }\n    } else {\n      fromValue = fromNode.getAttribute(attrName);\n\n      if (fromValue !== attrValue) {\n        fromNode.setAttribute(attrName, attrValue);\n      }\n    }\n  }\n\n  // Remove any extra attributes found on the original DOM element that\n  // weren't found on the target element.\n  attrs = fromNode.attributes;\n\n  for (i = attrs.length - 1; i >= 0; --i) {\n    attr = attrs[i];\n    if (attr.specified !== false) {\n      attrName = attr.name;\n      attrNamespaceURI = attr.namespaceURI;\n\n      if (attrNamespaceURI) {\n        attrName = attr.localName || attrName;\n\n        if (!hasAttributeNS(toNode, attrNamespaceURI, attrName)) {\n          fromNode.removeAttributeNS(attrNamespaceURI, attrName);\n        }\n      } else {\n        if (!hasAttributeNS(toNode, null, attrName)) {\n          fromNode.removeAttribute(attrName);\n        }\n      }\n    }\n  }\n}\n\nfunction syncBooleanAttrProp(fromEl, toEl, name) {\n  if (fromEl[name] !== toEl[name]) {\n    fromEl[name] = toEl[name];\n    if (fromEl[name]) {\n      fromEl.setAttribute(name, \"\");\n    } else {\n      fromEl.removeAttribute(name);\n    }\n  }\n}\n\nvar specialElHandlers = {\n  /**\n   * Needed for IE. Apparently IE doesn't think that \"selected\" is an\n   * attribute when reading over the attributes using selectEl.attributes\n   */\n  OPTION: function(fromEl, toEl) {\n    syncBooleanAttrProp(fromEl, toEl, \"selected\");\n  },\n  /**\n   * The \"value\" attribute is special for the <input> element since it sets\n   * the initial value. Changing the \"value\" attribute without changing the\n   * \"value\" property will have no effect since it is only used to the set the\n   * initial value.  Similar for the \"checked\" attribute, and \"disabled\".\n   */\n  INPUT: function(fromEl, toEl) {\n    syncBooleanAttrProp(fromEl, toEl, \"checked\");\n    syncBooleanAttrProp(fromEl, toEl, \"disabled\");\n\n    if (fromEl.value !== toEl.value) {\n      fromEl.value = toEl.value;\n    }\n\n    if (!hasAttributeNS(toEl, null, \"value\")) {\n      fromEl.removeAttribute(\"value\");\n    }\n  },\n\n  TEXTAREA: function(fromEl, toEl) {\n    var newValue = toEl.value;\n    if (fromEl.value !== newValue) {\n      fromEl.value = newValue;\n    }\n\n    var firstChild = fromEl.firstChild;\n    if (firstChild) {\n      // Needed for IE. Apparently IE sets the placeholder as the\n      // node value and vise versa. This ignores an empty update.\n      var oldValue = firstChild.nodeValue;\n\n      if (\n        oldValue == newValue ||\n        (!newValue && oldValue == fromEl.placeholder)\n      ) {\n        return;\n      }\n\n      firstChild.nodeValue = newValue;\n    }\n  },\n  SELECT: function(fromEl, toEl) {\n    if (!hasAttributeNS(toEl, null, \"multiple\")) {\n      var i = 0;\n      var curChild = toEl.firstChild;\n      while (curChild) {\n        var nodeName = curChild.nodeName;\n        if (nodeName && nodeName.toUpperCase() === \"OPTION\") {\n          if (hasAttributeNS(curChild, null, \"selected\")) {\n            break;\n          }\n          i++;\n        }\n        curChild = curChild.nextSibling;\n      }\n\n      fromEl.selectedIndex = i;\n    }\n  }\n};\n\nvar ELEMENT_NODE = 1;\nvar TEXT_NODE = 3;\nvar COMMENT_NODE = 8;\n\nfunction noop() {}\n\nfunction defaultGetNodeKey(node) {\n  return node.id;\n}\n\nfunction morphdomFactory(morphAttrs) {\n  return function morphdom(fromNode, toNode, options) {\n    if (!options) {\n      options = {};\n    }\n\n    if (typeof toNode === \"string\") {\n      if (fromNode.nodeName === \"#document\" || fromNode.nodeName === \"HTML\") {\n        var toNodeHtml = toNode;\n        toNode = doc.createElement(\"html\");\n        toNode.innerHTML = toNodeHtml;\n      } else {\n        toNode = toElement(toNode);\n      }\n    }\n\n    var getNodeKey = options.getNodeKey || defaultGetNodeKey;\n    var onBeforeNodeAdded = options.onBeforeNodeAdded || noop;\n    var onNodeAdded = options.onNodeAdded || noop;\n    var onBeforeElUpdated = options.onBeforeElUpdated || noop;\n    var onElUpdated = options.onElUpdated || noop;\n    var onBeforeNodeDiscarded = options.onBeforeNodeDiscarded || noop;\n    var onNodeDiscarded = options.onNodeDiscarded || noop;\n    var onBeforeElChildrenUpdated = options.onBeforeElChildrenUpdated || noop;\n    var childrenOnly = options.childrenOnly === true;\n\n    // This object is used as a lookup to quickly find all keyed elements in the original DOM tree.\n    var fromNodesLookup = {};\n    var keyedRemovalList;\n\n    function addKeyedRemoval(key) {\n      if (keyedRemovalList) {\n        keyedRemovalList.push(key);\n      } else {\n        keyedRemovalList = [key];\n      }\n    }\n\n    function walkDiscardedChildNodes(node, skipKeyedNodes) {\n      if (node.nodeType === ELEMENT_NODE) {\n        var curChild = node.firstChild;\n        while (curChild) {\n          var key = undefined;\n\n          if (skipKeyedNodes && (key = getNodeKey(curChild))) {\n            // If we are skipping keyed nodes then we add the key\n            // to a list so that it can be handled at the very end.\n            addKeyedRemoval(key);\n          } else {\n            // Only report the node as discarded if it is not keyed. We do this because\n            // at the end we loop through all keyed elements that were unmatched\n            // and then discard them in one final pass.\n            onNodeDiscarded(curChild);\n            if (curChild.firstChild) {\n              walkDiscardedChildNodes(curChild, skipKeyedNodes);\n            }\n          }\n\n          curChild = curChild.nextSibling;\n        }\n      }\n    }\n\n    /**\n     * Removes a DOM node out of the original DOM\n     *\n     * @param  {Node} node The node to remove\n     * @param  {Node} parentNode The nodes parent\n     * @param  {Boolean} skipKeyedNodes If true then elements with keys will be skipped and not discarded.\n     * @return {undefined}\n     */\n    function removeNode(node, parentNode, skipKeyedNodes) {\n      if (onBeforeNodeDiscarded(node) === false) {\n        return;\n      }\n\n      if (parentNode) {\n        parentNode.removeChild(node);\n      }\n\n      onNodeDiscarded(node);\n      walkDiscardedChildNodes(node, skipKeyedNodes);\n    }\n\n    // // TreeWalker implementation is no faster, but keeping this around in case this changes in the future\n    // function indexTree(root) {\n    //     var treeWalker = document.createTreeWalker(\n    //         root,\n    //         NodeFilter.SHOW_ELEMENT);\n    //\n    //     var el;\n    //     while((el = treeWalker.nextNode())) {\n    //         var key = getNodeKey(el);\n    //         if (key) {\n    //             fromNodesLookup[key] = el;\n    //         }\n    //     }\n    // }\n\n    // // NodeIterator implementation is no faster, but keeping this around in case this changes in the future\n    //\n    // function indexTree(node) {\n    //     var nodeIterator = document.createNodeIterator(node, NodeFilter.SHOW_ELEMENT);\n    //     var el;\n    //     while((el = nodeIterator.nextNode())) {\n    //         var key = getNodeKey(el);\n    //         if (key) {\n    //             fromNodesLookup[key] = el;\n    //         }\n    //     }\n    // }\n\n    function indexTree(node) {\n      if (node.nodeType === ELEMENT_NODE) {\n        var curChild = node.firstChild;\n        while (curChild) {\n          var key = getNodeKey(curChild);\n          if (key) {\n            fromNodesLookup[key] = curChild;\n          }\n\n          // Walk recursively\n          indexTree(curChild);\n\n          curChild = curChild.nextSibling;\n        }\n      }\n    }\n\n    indexTree(fromNode);\n\n    function handleNodeAdded(el) {\n      onNodeAdded(el);\n\n      var curChild = el.firstChild;\n      while (curChild) {\n        var nextSibling = curChild.nextSibling;\n\n        var key = getNodeKey(curChild);\n        if (key) {\n          var unmatchedFromEl = fromNodesLookup[key];\n          if (unmatchedFromEl && compareNodeNames(curChild, unmatchedFromEl)) {\n            curChild.parentNode.replaceChild(unmatchedFromEl, curChild);\n            morphEl(unmatchedFromEl, curChild);\n          }\n        }\n\n        handleNodeAdded(curChild);\n        curChild = nextSibling;\n      }\n    }\n\n    function morphEl(fromEl, toEl, childrenOnly) {\n      var toElKey = getNodeKey(toEl);\n      var curFromNodeKey;\n\n      if (toElKey) {\n        // If an element with an ID is being morphed then it is will be in the final\n        // DOM so clear it out of the saved elements collection\n        delete fromNodesLookup[toElKey];\n      }\n\n      if (toNode.isSameNode && toNode.isSameNode(fromNode)) {\n        return;\n      }\n\n      if (!childrenOnly) {\n        if (onBeforeElUpdated(fromEl, toEl) === false) {\n          return;\n        }\n\n        morphAttrs(fromEl, toEl);\n        onElUpdated(fromEl);\n\n        if (onBeforeElChildrenUpdated(fromEl, toEl) === false) {\n          return;\n        }\n      }\n\n      if (fromEl.nodeName !== \"TEXTAREA\" && !isCustomElement(fromEl)) {\n        var curToNodeChild = toEl.firstChild;\n        var curFromNodeChild = fromEl.firstChild;\n        var curToNodeKey;\n\n        var fromNextSibling;\n        var toNextSibling;\n        var matchingFromEl;\n\n        outer: while (curToNodeChild) {\n          toNextSibling = curToNodeChild.nextSibling;\n          curToNodeKey = getNodeKey(curToNodeChild);\n\n          while (curFromNodeChild) {\n            fromNextSibling = curFromNodeChild.nextSibling;\n\n            if (\n              curToNodeChild.isSameNode &&\n              curToNodeChild.isSameNode(curFromNodeChild)\n            ) {\n              curToNodeChild = toNextSibling;\n              curFromNodeChild = fromNextSibling;\n              continue outer;\n            }\n\n            curFromNodeKey = getNodeKey(curFromNodeChild);\n\n            var curFromNodeType = curFromNodeChild.nodeType;\n\n            var isCompatible = undefined;\n\n            if (curFromNodeType === curToNodeChild.nodeType) {\n              if (curFromNodeType === ELEMENT_NODE) {\n                // Both nodes being compared are Element nodes\n\n                if (curToNodeKey) {\n                  // The target node has a key so we want to match it up with the correct element\n                  // in the original DOM tree\n                  if (curToNodeKey !== curFromNodeKey) {\n                    // The current element in the original DOM tree does not have a matching key so\n                    // let's check our lookup to see if there is a matching element in the original\n                    // DOM tree\n                    if ((matchingFromEl = fromNodesLookup[curToNodeKey])) {\n                      if (curFromNodeChild.nextSibling === matchingFromEl) {\n                        // Special case for single element removals. To avoid removing the original\n                        // DOM node out of the tree (since that can break CSS transitions, etc.),\n                        // we will instead discard the current node and wait until the next\n                        // iteration to properly match up the keyed target element with its matching\n                        // element in the original tree\n                        isCompatible = false;\n                      } else {\n                        // We found a matching keyed element somewhere in the original DOM tree.\n                        // Let's moving the original DOM node into the current position and morph\n                        // it.\n\n                        // NOTE: We use insertBefore instead of replaceChild because we want to go through\n                        // the `removeNode()` function for the node that is being discarded so that\n                        // all lifecycle hooks are correctly invoked\n                        fromEl.insertBefore(matchingFromEl, curFromNodeChild);\n\n                        fromNextSibling = curFromNodeChild.nextSibling;\n\n                        if (curFromNodeKey) {\n                          // Since the node is keyed it might be matched up later so we defer\n                          // the actual removal to later\n                          addKeyedRemoval(curFromNodeKey);\n                        } else {\n                          // NOTE: we skip nested keyed nodes from being removed since there is\n                          //       still a chance they will be matched up later\n                          removeNode(\n                            curFromNodeChild,\n                            fromEl,\n                            true /* skip keyed nodes */\n                          );\n                        }\n\n                        curFromNodeChild = matchingFromEl;\n                      }\n                    } else {\n                      // The nodes are not compatible since the \"to\" node has a key and there\n                      // is no matching keyed node in the source tree\n                      isCompatible = false;\n                    }\n                  }\n                } else if (curFromNodeKey) {\n                  // The original has a key\n                  isCompatible = false;\n                }\n\n                isCompatible =\n                  isCompatible !== false &&\n                  compareNodeNames(curFromNodeChild, curToNodeChild);\n                if (isCompatible) {\n                  // We found compatible DOM elements so transform\n                  // the current \"from\" node to match the current\n                  // target DOM node.\n                  morphEl(curFromNodeChild, curToNodeChild);\n                }\n              } else if (\n                curFromNodeType === TEXT_NODE ||\n                curFromNodeType == COMMENT_NODE\n              ) {\n                // Both nodes being compared are Text or Comment nodes\n                isCompatible = true;\n                // Simply update nodeValue on the original node to\n                // change the text value\n                if (curFromNodeChild.nodeValue !== curToNodeChild.nodeValue) {\n                  curFromNodeChild.nodeValue = curToNodeChild.nodeValue;\n                }\n              }\n            }\n\n            if (isCompatible) {\n              // Advance both the \"to\" child and the \"from\" child since we found a match\n              curToNodeChild = toNextSibling;\n              curFromNodeChild = fromNextSibling;\n              continue outer;\n            }\n\n            // No compatible match so remove the old node from the DOM and continue trying to find a\n            // match in the original DOM. However, we only do this if the from node is not keyed\n            // since it is possible that a keyed node might match up with a node somewhere else in the\n            // target tree and we don't want to discard it just yet since it still might find a\n            // home in the final DOM tree. After everything is done we will remove any keyed nodes\n            // that didn't find a home\n            if (curFromNodeKey) {\n              // Since the node is keyed it might be matched up later so we defer\n              // the actual removal to later\n              addKeyedRemoval(curFromNodeKey);\n            } else {\n              // NOTE: we skip nested keyed nodes from being removed since there is\n              //       still a chance they will be matched up later\n              removeNode(curFromNodeChild, fromEl, true /* skip keyed nodes */);\n            }\n\n            curFromNodeChild = fromNextSibling;\n          }\n\n          // If we got this far then we did not find a candidate match for\n          // our \"to node\" and we exhausted all of the children \"from\"\n          // nodes. Therefore, we will just append the current \"to\" node\n          // to the end\n          if (\n            curToNodeKey &&\n            (matchingFromEl = fromNodesLookup[curToNodeKey]) &&\n            compareNodeNames(matchingFromEl, curToNodeChild)\n          ) {\n            fromEl.appendChild(matchingFromEl);\n            morphEl(matchingFromEl, curToNodeChild);\n          } else {\n            var onBeforeNodeAddedResult = onBeforeNodeAdded(curToNodeChild);\n            if (onBeforeNodeAddedResult !== false) {\n              if (onBeforeNodeAddedResult) {\n                curToNodeChild = onBeforeNodeAddedResult;\n              }\n\n              if (curToNodeChild.actualize) {\n                curToNodeChild = curToNodeChild.actualize(\n                  fromEl.ownerDocument || doc\n                );\n              }\n              fromEl.appendChild(curToNodeChild);\n              handleNodeAdded(curToNodeChild);\n            }\n          }\n\n          curToNodeChild = toNextSibling;\n          curFromNodeChild = fromNextSibling;\n        }\n\n        // We have processed all of the \"to nodes\". If curFromNodeChild is\n        // non-null then we still have some from nodes left over that need\n        // to be removed\n        while (curFromNodeChild) {\n          fromNextSibling = curFromNodeChild.nextSibling;\n          if ((curFromNodeKey = getNodeKey(curFromNodeChild))) {\n            // Since the node is keyed it might be matched up later so we defer\n            // the actual removal to later\n            addKeyedRemoval(curFromNodeKey);\n          } else {\n            // NOTE: we skip nested keyed nodes from being removed since there is\n            //       still a chance they will be matched up later\n            removeNode(curFromNodeChild, fromEl, true /* skip keyed nodes */);\n          }\n          curFromNodeChild = fromNextSibling;\n        }\n      }\n\n      var specialElHandler = specialElHandlers[fromEl.nodeName];\n      if (specialElHandler) {\n        specialElHandler(fromEl, toEl);\n      }\n    } // END: morphEl(...)\n\n    var morphedNode = fromNode;\n    var morphedNodeType = morphedNode.nodeType;\n    var toNodeType = toNode.nodeType;\n\n    if (!childrenOnly) {\n      // Handle the case where we are given two DOM nodes that are not\n      // compatible (e.g. <div> --> <span> or <div> --> TEXT)\n      if (morphedNodeType === ELEMENT_NODE) {\n        if (toNodeType === ELEMENT_NODE) {\n          if (!compareNodeNames(fromNode, toNode)) {\n            onNodeDiscarded(fromNode);\n            morphedNode = moveChildren(\n              fromNode,\n              createElementNS(toNode.nodeName, toNode.namespaceURI)\n            );\n          }\n        } else {\n          // Going from an element node to a text node\n          morphedNode = toNode;\n        }\n      } else if (\n        morphedNodeType === TEXT_NODE ||\n        morphedNodeType === COMMENT_NODE\n      ) {\n        // Text or comment node\n        if (toNodeType === morphedNodeType) {\n          if (morphedNode.nodeValue !== toNode.nodeValue) {\n            morphedNode.nodeValue = toNode.nodeValue;\n          }\n\n          return morphedNode;\n        } else {\n          // Text node to something else\n          morphedNode = toNode;\n        }\n      }\n    }\n\n    if (morphedNode === toNode) {\n      // The \"to node\" was not compatible with the \"from node\" so we had to\n      // toss out the \"from node\" and use the \"to node\"\n      onNodeDiscarded(fromNode);\n    } else {\n      morphEl(morphedNode, toNode, childrenOnly);\n\n      // We now need to loop over any keyed nodes that might need to be\n      // removed. We only do the removal if we know that the keyed node\n      // never found a match. When a keyed node is matched up we remove\n      // it out of fromNodesLookup and we use fromNodesLookup to determine\n      // if a keyed node has been matched up or not\n      if (keyedRemovalList) {\n        for (var i = 0, len = keyedRemovalList.length; i < len; i++) {\n          var elToRemove = fromNodesLookup[keyedRemovalList[i]];\n          if (elToRemove) {\n            removeNode(elToRemove, elToRemove.parentNode, false);\n          }\n        }\n      }\n    }\n\n    if (!childrenOnly && morphedNode !== fromNode && fromNode.parentNode) {\n      if (morphedNode.actualize) {\n        morphedNode = morphedNode.actualize(fromNode.ownerDocument || doc);\n      }\n      // If we had to swap out the from node with a new node because the old\n      // node was not compatible with the target node then we need to\n      // replace the old DOM node in the original DOM tree. This is only\n      // possible if the original DOM node was part of a DOM tree which\n      // we know is the case if it has a parent node.\n      fromNode.parentNode.replaceChild(morphedNode, fromNode);\n    }\n\n    return morphedNode;\n  };\n}\n\nvar morphdom = morphdomFactory(morphAttrs);\n\n// Using morphdom for applying the diff\n\nfunction updateDom(fromNode, toNode) {\n  return morphdom(fromNode, toNode);\n}\n\nfunction attachShadow(element, shadowRootInit = { mode: \"open\" }) {\n  element[SHADOW_DOM] = element.attachShadow(shadowRootInit);\n  return element[SHADOW_DOM];\n}\n\nconst SHADOW_DOM = \"__shadowDom__\";\n\nfunction update(element, stateChanger = () => {}) {\n  return Promise.resolve(stateChanger(element.__currentState__)).then(\n    nextState => {\n      return new Promise(resolve => {\n        requestAnimationFrame(() => {\n          element.__currentState__ = nextState;\n\n          if (element._shouldUpdate) {\n            const template = element._templateWithClearing(nextState);\n\n            if (element.__hasCustomRenderer__) {\n              element.__renderer__(element, template);\n            } else {\n              const root = element[SHADOW_DOM] || element;\n              updateDom(root.childNodes[0], template);\n            }\n          }\n\n          resolve(nextState);\n        });\n      });\n    }\n  );\n}\n\nexport { update, attachShadow, SHADOW_DOM };\n","export function getBooleanAttribute(element, attrName) {\n  const attr = element.getAttribute(attrName);\n  return attr === \"true\" || attr === \"\" ? true : false;\n}\n\nexport function dispatch(element, name, data) {\n  element.dispatchEvent(createEvent(name, data));\n}\n\nexport function createEvent(name, data) {\n  return new CustomEvent(\"osagai-map-\" + name, { detail: data });\n}\n","import { define } from \"osagai\";\nimport { onConnected, onAttributeChanged } from \"osagai/lifecycles\";\nimport { attachShadow, SHADOW_DOM } from \"osagai/dom\";\n\nimport { getBooleanAttribute, dispatch } from \"./utils\";\n\nconst API_URL = \"https://maps.googleapis.com/maps/api/js?\";\nconst API_VERSION = \"3.34\";\nconst API_LIBRARIES = \"drawing,geometry,places,visualization\";\nlet isScriptCalled = false;\nconst scriptCallback = new Promise(function(resolve) {\n  window.__initGoogleMapsApi = resolve;\n});\n\nOsagaiMap.observedAttributes = [\"click-events\", \"drag-events\", \"mouse-events\"];\n\n/**\n * Custom element for rendering a map using [Google Maps API](https://developers.google.com/maps/documentation/)\n *\n * @name osagai-map\n * @param {String} api-key API key to be used on Google Maps. [Get API Key docs](https://developers.google.com/maps/documentation/javascript/get-api-key)\n * @param {String} [version=3.34] Version of the Google Maps API\n * @param {String} [libraries=drawing,geometry,places,visualization] Libraries to use on the Google Maps API, separated by \",\"\n * @param {Number} latitude Latitude to show in the map\n * @param {Number} longitude Longitude to show in the map\n * @param {Number} [zoom=undefined] Zoom to use in the map\n * @param {Boolean} [no-auto-tilt=false] Don't use a tilt\n * @param {String} map-type Type of the map to use (roadmap|satellite|hybrid|terrain). [mapTypes docs](https://developers.google.com/maps/documentation/javascript/maptypes)\n * @param {Boolean} [disable-default-ui=false] Disable default UIs\n * @param {Boolean} [disable-map-type-control=false] Disable the map type controls\n * @param {Boolean} [disable-street-view-control=false] Disable the street-view controls\n * @param {Boolean} [disable-zoom=false] Disable zoom capabilities (Double click and scroll whell)\n * @param {Number} [max-zoom=undefined] Max zoom allowed\n * @param {Number} [min-zoom=undefined] Min zoom allowed\n *\n */\nfunction OsagaiMap({ element }) {\n  const apiKey = element.getAttribute(\"api-key\");\n  const version = element.getAttribute(\"version\");\n  const libraries = element.getAttribute(\"libraries\");\n  const scriptPromise = loadScript(apiKey, version, libraries);\n  attachShadow(element);\n\n  onConnected(element, function mapConnected() {\n    scriptPromise\n      .then(function scriptLoaded() {\n        initMap(element);\n      })\n      .catch(console.error);\n  });\n\n  onAttributeChanged(element, function mapAttributeChanged(attribute) {\n    switch (attribute.name) {\n      case \"click-events\":\n        clickEventsChanged(element);\n        break;\n      case \"drag-events\":\n        dragEventsChanged(element);\n        break;\n      case \"mouse-events\":\n        mouseEventsChanged(element);\n        break;\n    }\n  });\n\n  return function() {\n    return `\n      <style>\n        :host {\n          position: relative;\n          display: block;\n          height: 100%;\n        }\n        #map {\n          position: absolute;\n          top: 0;\n          right: 0;\n          bottom: 0;\n          left: 0;\n        }\n      </style>\n\n      <div id=\"map\"></div>\n    `;\n  };\n}\n\ndefine(\"osagai-map\", OsagaiMap);\n\nfunction loadScript(apiKey, version, libraries) {\n  if (isScriptCalled) {\n    return scriptCallback;\n  }\n\n  const script = document.createElement(\"script\");\n  const url = `${API_URL}v=${version || API_VERSION}&libraries=${libraries ||\n    API_LIBRARIES}&key=${apiKey}&callback=__initGoogleMapsApi`;\n  script.src = url;\n  document.head.appendChild(script);\n  isScriptCalled = true;\n\n  return scriptCallback;\n}\n\nfunction initMap(element) {\n  if (element.map) {\n    return;\n  }\n\n  element.map = new google.maps.Map(\n    element[SHADOW_DOM].querySelector(\"#map\"),\n    getMapOptions(element)\n  );\n  element.listeners = {};\n\n  updateCenter(element);\n  loadKml(element);\n  updateMarkers(element);\n  addMapListeners(element);\n\n  dispatch(element, \"ready\");\n}\n\nfunction updateCenter(element) {\n  if (map(element) && latitude(element) && longitude(element)) {\n    const lat = latitude(element);\n    const lng = longitude(element);\n\n    const center = new google.maps.LatLng(lat, lng);\n    const oldCenter = map(element).getCenter();\n\n    if (!oldCenter) {\n      map(element).setCenter(center);\n    } else {\n      const oldLatLng = new google.maps.LatLng(\n        oldCenter.lat(),\n        oldCenter.lng()\n      );\n\n      if (!oldLatLng.equals(center)) {\n        map(element).panTo(center);\n      }\n    }\n  }\n}\n\nfunction loadKml(element) {\n  if (map(element) && kml(element)) {\n    return new google.maps.KmlLayer({\n      url: kml(element),\n      map: map(element)\n    });\n  }\n}\n\nfunction updateMarkers(element) {\n  const newMarkers = Array.prototype.slice.call(\n    element.querySelectorAll(\"osagai-map-marker\")\n  );\n\n  const added = newMarkers.filter(function(marker) {\n    return !element.markers || element.markers.indexOf(marker) === -1;\n  });\n\n  if (added.length === 0) {\n    return;\n  }\n\n  setMarkers(element, newMarkers);\n}\n\nfunction addMapListeners(element) {\n  google.maps.event.addListener(\n    map(element),\n    \"center_changed\",\n    function centerChangedCallback() {\n      const center = map(element).getCenter();\n      setLatitude(element, center.lat());\n      setLongitude(element, center.lng());\n    }\n  );\n  google.maps.event.addListener(\n    map(element),\n    \"zoom_changed\",\n    function zoomChangedCallback() {\n      setZoom(element, map(element).getZoom());\n    }\n  );\n  google.maps.event.addListener(\n    map(element),\n    \"maptypeid_changed\",\n    function mapTypeIdChangedCallback() {\n      setMapType(element, map(element).getMapTypeId());\n    }\n  );\n\n  clickEventsChanged(element);\n  dragEventsChanged(element);\n  mouseEventsChanged(element);\n\n  idleEvent(element);\n}\n\nfunction clickEventsChanged(element) {\n  if (map(element)) {\n    if (clickEvents(element)) {\n      forwardEvent(element, \"click\");\n      forwardEvent(element, \"dblclick\");\n      forwardEvent(element, \"rightclick\");\n    } else {\n      clearListener(element, \"click\");\n      clearListener(element, \"dblclick\");\n      clearListener(element, \"rightclick\");\n    }\n  }\n}\n\nfunction dragEventsChanged(element) {\n  if (map(element)) {\n    if (dragEvents(element)) {\n      forwardEvent(element, \"drag\");\n      forwardEvent(element, \"dragend\");\n      forwardEvent(element, \"dragstart\");\n    } else {\n      clearListener(element, \"drag\");\n      clearListener(element, \"dragend\");\n      clearListener(element, \"dragstart\");\n    }\n  }\n}\n\nfunction mouseEventsChanged(element) {\n  if (map(element)) {\n    if (mouseEvents(element)) {\n      forwardEvent(element, \"mousemove\");\n      forwardEvent(element, \"mouseout\");\n      forwardEvent(element, \"mouseover\");\n    } else {\n      clearListener(element, \"mousemove\");\n      clearListener(element, \"mouseout\");\n      clearListener(element, \"mouseover\");\n    }\n  }\n}\n\nfunction idleEvent(element) {\n  if (map(element)) {\n    forwardEvent(element, \"idle\");\n  } else {\n    clearListener(element, \"idle\");\n  }\n}\n\nfunction setMarkers(element, markers) {\n  element.markers = [];\n\n  markers.forEach(function(marker) {\n    marker.map = map(element);\n    element.markers.push(marker);\n  });\n}\n\n/*\n * GETTERS/SETTERS\n */\nfunction listeners(element) {\n  return element.listeners;\n}\nfunction map(element) {\n  return element.map;\n}\nfunction latitude(element) {\n  return Number(element.getAttribute(\"latitude\"));\n}\nfunction setLatitude(element, value) {\n  element.setAttribute(\"latitude\", value);\n}\nfunction longitude(element) {\n  return Number(element.getAttribute(\"longitude\"));\n}\nfunction setLongitude(element, value) {\n  element.setAttribute(\"longitude\", value);\n}\nfunction kml(element) {\n  return element.getAttribute(\"kml\");\n}\nfunction zoom(element) {\n  return Number(element.getAttribute(\"zoom\")) || null;\n}\nfunction setZoom(element, value) {\n  element.setAttribute(\"zoom\", value);\n}\nfunction mapType(element) {\n  return element.getAttribute(\"map-type\");\n}\nfunction setMapType(element, value) {\n  element.setAttribute(\"map-type\", value);\n}\nfunction clickEvents(element) {\n  return getBooleanAttribute(element, \"click-events\");\n}\nfunction dragEvents(element) {\n  return getBooleanAttribute(element, \"drag-events\");\n}\nfunction mouseEvents(element) {\n  return getBooleanAttribute(element, \"mouse-events\");\n}\n\nfunction forwardEvent(element, name) {\n  listeners(element)[name] = google.maps.event.addListener(\n    map(element),\n    name,\n    function eventListenerCallback(event) {\n      dispatch(element, name, event);\n    }\n  );\n}\nfunction clearListener(element, name) {\n  if (listeners(element)[name]) {\n    google.maps.event.removeListener(listeners(element)[name]);\n    listeners(element)[name] = null;\n  }\n}\n\nfunction getMapOptions(element) {\n  return {\n    zoom: zoom(element),\n    tilt: getBooleanAttribute(element, \"no-auto-tilt\") ? 0 : 45,\n    mapTypeId: mapType(element) || undefined,\n    disableDefaultUI: getBooleanAttribute(element, \"disable-default-ui\"),\n    mapTypeControl:\n      !getBooleanAttribute(element, \"disable-default-ui\") &&\n      !getBooleanAttribute(element, \"disable-map-type-control\"),\n    streetViewControl:\n      !getBooleanAttribute(element, \"disable-default-ui\") &&\n      !getBooleanAttribute(element, \"disable-street-view-control\"),\n    disableDoubleClickZoom: getBooleanAttribute(element, \"disable-zoom\"),\n    scrollwheel: !getBooleanAttribute(element, \"disable-zoom\"),\n    maxZoom: Number(element.getAttribute(\"max-zoom\")) || undefined,\n    minZoom: Number(element.getAttribute(\"min-zoom\")) || undefined\n  };\n}\n","import { define } from \"osagai\";\nimport { attachShadow } from \"osagai/dom\";\nimport { onConnected } from \"osagai/lifecycles\";\nimport { getBooleanAttribute, dispatch } from \"./utils\";\n\n/**\n * Custom element for rendering a marker in a Google map. [Marker documentation](https://developers.google.com/maps/documentation/javascript/markers)\n *\n * @name osagai-map-marker\n * @param {Number} latitude Latitude to show in the map\n * @param {Number} longitude Longitude to show in the map\n * @param {String} [title=undefined] Title of the marker that will appear as a tooltip\n * @param {String} [animation=undefined] Animation to exhibit dynamic movement to the marker. Values supported from google maps api. [Animate marker docs](https://developers.google.com/maps/documentation/javascript/markers#animate)\n * @param {Boolean} [hidden=false] Hide the marker\n * @param {String} [label=undefined] A marker label that appear inside a marker\n */\nfunction OsagaiMapMarker({ element }) {\n  attachShadow(element);\n\n  Object.defineProperties(element, {\n    marker: {\n      get: function() {\n        return element._marker;\n      },\n      set: function(marker) {\n        element._marker = marker;\n      }\n    },\n    map: {\n      get: function() {\n        return element._map;\n      },\n      set: function(map) {\n        element._map = map;\n\n        mapChanged(element);\n      }\n    },\n    open: {\n      get: function() {\n        return element._open;\n      },\n      set: function(open) {\n        element._open = open;\n\n        openChanged(element);\n      }\n    }\n  });\n\n  onConnected(element, function markerConnected() {\n    if (element.marker) {\n      element.marker.setMap(element.map);\n    }\n  });\n\n  return function() {\n    return `\n      <style>\n        :host {\n          display: none;\n        }\n      </style>\n    `;\n  };\n}\n\ndefine(\"osagai-map-marker\", OsagaiMapMarker);\n\nfunction mapChanged(element) {\n  if (element.marker) {\n    element.marker.setMap(null);\n    google.maps.event.clearInstanceListeners(element.marker);\n  }\n\n  if (element.map && element.map instanceof google.maps.Map) {\n    mapReady(element);\n  }\n}\n\nfunction mapReady(element) {\n  element.listeners = {};\n  element.marker = new google.maps.Marker({\n    map: element.map,\n    position: {\n      lat: latitude(element),\n      lng: longitude(element)\n    },\n    title: title(element),\n    animation: animation(element),\n    visible: !hidden(element),\n    label: label(element)\n  });\n\n  contentChanged(element);\n}\n\nfunction contentChanged(element) {\n  const content = element.innerHTML.trim();\n  if (content) {\n    if (!element.info) {\n      element.info = new google.maps.InfoWindow();\n      element.openInfoHandler = google.maps.event.addListener(\n        element.marker,\n        \"click\",\n        function clickInfoWindow() {\n          element.open = true;\n        }\n      );\n      element.closeInfoHandler = google.maps.event.addListener(\n        element.info,\n        \"closeclick\",\n        function closeInfoWindow() {\n          element.open = false;\n        }\n      );\n    }\n\n    element.info.setContent(content);\n  } else {\n    if (element.info) {\n      google.maps.event.removeListener(element.openInfoHandler);\n      google.maps.event.removeListener(element.closeInfoHandler);\n      element.info = null;\n    }\n  }\n}\n\nfunction openChanged(element) {\n  if (element.info) {\n    if (element.open) {\n      element.info.open(element.map, element.marker);\n      dispatch(element, \"marker-open\");\n    } else {\n      element.info.close();\n      dispatch(element, \"marker-close\");\n    }\n  }\n}\n\n/*\n * GETTERS/SETTERS\n */\nfunction listeners(element) {\n  return element.listeners;\n}\nfunction map(element) {\n  return element.map;\n}\nfunction latitude(element) {\n  return Number(element.getAttribute(\"latitude\"));\n}\nfunction longitude(element) {\n  return Number(element.getAttribute(\"longitude\"));\n}\nfunction title(element) {\n  return element.getAttribute(\"title\");\n}\nfunction animation(element) {\n  return element.getAttribute(\"animation\");\n}\nfunction hidden(element) {\n  return getBooleanAttribute(element, \"hidden\");\n}\nfunction label(element) {\n  return element.getAttribute(\"label\");\n}\n"],"names":["Object","defineProperty","exports","value","query","element","q","Promise","resolve","then","querySelector","queryAll","querySelectorAll","SHADOW_DOM","name","Element","BaseElement","HTMLElement","observedAttributes","renderer","customElementOptions","Component","[object Object]","super","this","_initialized","__handleAttributeChangedCallback__","__handleConnectedCallback__","__handleDisconnectedCallback__","__currentState__","undefined","__hasCustomRenderer__","__renderer__","template","innerHTML","_template","_shouldUpdate","_templateWithClearing","forEach","callback","state","trim","oldValue","newValue","isConnected","current","old","customElements","get","define","component","onConnected","push","doc","document","attachShadow","shadowRootInit","mode","body","createElement","getBooleanAttribute","attrName","attr","getAttribute","dispatch","data","dispatchEvent","CustomEvent","detail","createEvent","const","API_URL","API_VERSION","API_LIBRARIES","isScriptCalled","scriptCallback","window","__initGoogleMapsApi","OsagaiMap","ref","scriptPromise","apiKey","version","libraries","script","src","head","appendChild","loadScript","map","google","maps","Map","zoom","tilt","mapTypeId","mapType","disableDefaultUI","mapTypeControl","streetViewControl","disableDoubleClickZoom","scrollwheel","maxZoom","Number","minZoom","getMapOptions","listeners","latitude","longitude","lat","lng","center","LatLng","oldCenter","getCenter","equals","panTo","setCenter","updateCenter","kml","KmlLayer","url","loadKml","newMarkers","Array","prototype","slice","call","filter","marker","markers","indexOf","length","setMarkers","updateMarkers","event","addListener","setAttribute","setLatitude","setLongitude","setZoom","getZoom","setMapType","getMapTypeId","clickEventsChanged","dragEventsChanged","mouseEventsChanged","forwardEvent","clearListener","idleEvent","addMapListeners","initMap","catch","console","error","onAttributeChanged","attribute","clickEvents","dragEvents","mouseEvents","removeListener","title","animation","hidden","label","defineProperties","_marker","set","_map","setMap","clearInstanceListeners","Marker","position","visible","content","info","InfoWindow","openInfoHandler","open","closeInfoHandler","setContent","contentChanged","mapReady","mapChanged","_open","close","openChanged"],"mappings":"yBAEAA,OAAOC,eAAeC,EAAS,aAAc,CAAEC,OAAO,IAEtD,MAAMC,EAAQC,GAAWC,GACvBC,QAAQC,UAAUC,KAAK,IAAMJ,EAAQK,cAAcJ,IAE/CK,EAAWN,GAAWC,GAC1BC,QAAQC,UAAUC,KAAK,IAAMJ,EAAQO,iBAAiBN,IAElDO,EAAa,gBA8FnBX,SA5Fe,EACbY,EACAC,GAEEC,YAAAA,EAAcC,YACdC,mBAAAA,EACAC,SAAAA,KACGC,GACD,MAEJ,MAAMC,UAAkBL,EACtBE,gCACE,OAAOH,EAAQG,oBAAsBA,EAGvCI,cACEC,QAEAC,KAAKC,cAAe,EACpBD,KAAKE,mCAAqC,GAC1CF,KAAKG,4BAA8B,GACnCH,KAAKI,+BAAiC,GACtCJ,KAAKK,sBAAmBC,EACxBN,KAAKO,wBAA0BZ,EAC/BK,KAAKQ,aACHb,GACA,SAAkBd,EAAS4B,IACd5B,EAAQQ,IAAeR,GAC7B6B,UAAYD,GAGrBT,KAAKW,UAAYpB,EAAQ,CACvBV,QAASmB,KACTpB,MAAOA,EAAMoB,MACbb,SAAUA,EAASa,QAGrBA,KAAKY,cACH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