{ "version": 3, "sources": ["../../node_modules/lazysizes/lazysizes.js", "../../UI/Scripts/tabs.js", "../../UI/Scripts/modal.js", "../../node_modules/google-maps/lib/Google.js", "../../node_modules/utmgeoconv/index.js", "../../node_modules/priority-nav/dist/priority-nav.js", "../../UI/Scripts/main.js", "../../UI/Scripts/navDropdown.js", "../../UI/Scripts/subnav.js", "../../UI/Scripts/processSlide.js", "../../UI/Scripts/pseudoElement.js", "../../UI/Scripts/stickyNav.js", "../../UI/Scripts/popupNav.js", "../../UI/Scripts/calcHeightNav.js", "../../UI/Scripts/rowWidth.js", "../../UI/Scripts/urgentMessage.js", "../../UI/Scripts/areamap.js", "../../node_modules/dawa-autocomplete2/dist/js/dawa-autocomplete2.es.js", "../../UI/Scripts/connectionCalculator.js", "../../node_modules/tiny-slider/src/helpers/raf.js", "../../node_modules/tiny-slider/src/helpers/caf.js", "../../node_modules/tiny-slider/src/helpers/extend.js", "../../node_modules/tiny-slider/src/helpers/checkStorageValue.js", "../../node_modules/tiny-slider/src/helpers/setLocalStorage.js", "../../node_modules/tiny-slider/src/helpers/getSlideId.js", "../../node_modules/tiny-slider/src/helpers/getBody.js", "../../node_modules/tiny-slider/src/helpers/docElement.js", "../../node_modules/tiny-slider/src/helpers/setFakeBody.js", "../../node_modules/tiny-slider/src/helpers/resetFakeBody.js", "../../node_modules/tiny-slider/src/helpers/calc.js", "../../node_modules/tiny-slider/src/helpers/percentageLayout.js", "../../node_modules/tiny-slider/src/helpers/mediaquerySupport.js", "../../node_modules/tiny-slider/src/helpers/createStyleSheet.js", "../../node_modules/tiny-slider/src/helpers/addCSSRule.js", "../../node_modules/tiny-slider/src/helpers/removeCSSRule.js", "../../node_modules/tiny-slider/src/helpers/getCssRulesLength.js", "../../node_modules/tiny-slider/src/helpers/toDegree.js", "../../node_modules/tiny-slider/src/helpers/getTouchDirection.js", "../../node_modules/tiny-slider/src/helpers/forEach.js", "../../node_modules/tiny-slider/src/helpers/classListSupport.js", "../../node_modules/tiny-slider/src/helpers/hasClass.js", "../../node_modules/tiny-slider/src/helpers/addClass.js", "../../node_modules/tiny-slider/src/helpers/removeClass.js", "../../node_modules/tiny-slider/src/helpers/hasAttr.js", "../../node_modules/tiny-slider/src/helpers/getAttr.js", "../../node_modules/tiny-slider/src/helpers/isNodeList.js", "../../node_modules/tiny-slider/src/helpers/setAttrs.js", "../../node_modules/tiny-slider/src/helpers/removeAttrs.js", "../../node_modules/tiny-slider/src/helpers/arrayFromNodeList.js", "../../node_modules/tiny-slider/src/helpers/hideElement.js", "../../node_modules/tiny-slider/src/helpers/showElement.js", "../../node_modules/tiny-slider/src/helpers/isVisible.js", "../../node_modules/tiny-slider/src/helpers/whichProperty.js", "../../node_modules/tiny-slider/src/helpers/has3DTransforms.js", "../../node_modules/tiny-slider/src/helpers/getEndProperty.js", "../../node_modules/tiny-slider/src/helpers/passiveOption.js", "../../node_modules/tiny-slider/src/helpers/addEvents.js", "../../node_modules/tiny-slider/src/helpers/removeEvents.js", "../../node_modules/tiny-slider/src/helpers/events.js", "../../node_modules/tiny-slider/src/helpers/jsTransform.js", "../../node_modules/tiny-slider/src/tiny-slider.js", "../../UI/Scripts/tinySlider.js"], "sourcesContent": ["(function(window, factory) {\n\tvar lazySizes = factory(window, window.document, Date);\n\twindow.lazySizes = lazySizes;\n\tif(typeof module == 'object' && module.exports){\n\t\tmodule.exports = lazySizes;\n\t}\n}(typeof window != 'undefined' ?\n window : {}, \n/**\n * import(\"./types/global\")\n * @typedef { import(\"./types/lazysizes-config\").LazySizesConfigPartial } LazySizesConfigPartial\n */\nfunction l(window, document, Date) { // Pass in the window Date function also for SSR because the Date class can be lost\n\t'use strict';\n\t/*jshint eqnull:true */\n\n\tvar lazysizes,\n\t\t/**\n\t\t * @type { LazySizesConfigPartial }\n\t\t */\n\t\tlazySizesCfg;\n\n\t(function(){\n\t\tvar prop;\n\n\t\tvar lazySizesDefaults = {\n\t\t\tlazyClass: 'lazyload',\n\t\t\tloadedClass: 'lazyloaded',\n\t\t\tloadingClass: 'lazyloading',\n\t\t\tpreloadClass: 'lazypreload',\n\t\t\terrorClass: 'lazyerror',\n\t\t\t//strictClass: 'lazystrict',\n\t\t\tautosizesClass: 'lazyautosizes',\n\t\t\tfastLoadedClass: 'ls-is-cached',\n\t\t\tiframeLoadMode: 0,\n\t\t\tsrcAttr: 'data-src',\n\t\t\tsrcsetAttr: 'data-srcset',\n\t\t\tsizesAttr: 'data-sizes',\n\t\t\t//preloadAfterLoad: false,\n\t\t\tminSize: 40,\n\t\t\tcustomMedia: {},\n\t\t\tinit: true,\n\t\t\texpFactor: 1.5,\n\t\t\thFac: 0.8,\n\t\t\tloadMode: 2,\n\t\t\tloadHidden: true,\n\t\t\tricTimeout: 0,\n\t\t\tthrottleDelay: 125,\n\t\t};\n\n\t\tlazySizesCfg = window.lazySizesConfig || window.lazysizesConfig || {};\n\n\t\tfor(prop in lazySizesDefaults){\n\t\t\tif(!(prop in lazySizesCfg)){\n\t\t\t\tlazySizesCfg[prop] = lazySizesDefaults[prop];\n\t\t\t}\n\t\t}\n\t})();\n\n\tif (!document || !document.getElementsByClassName) {\n\t\treturn {\n\t\t\tinit: function () {},\n\t\t\t/**\n\t\t\t * @type { LazySizesConfigPartial }\n\t\t\t */\n\t\t\tcfg: lazySizesCfg,\n\t\t\t/**\n\t\t\t * @type { true }\n\t\t\t */\n\t\t\tnoSupport: true,\n\t\t};\n\t}\n\n\tvar docElem = document.documentElement;\n\n\tvar supportPicture = window.HTMLPictureElement;\n\n\tvar _addEventListener = 'addEventListener';\n\n\tvar _getAttribute = 'getAttribute';\n\n\t/**\n\t * Update to bind to window because 'this' becomes null during SSR\n\t * builds.\n\t */\n\tvar addEventListener = window[_addEventListener].bind(window);\n\n\tvar setTimeout = window.setTimeout;\n\n\tvar requestAnimationFrame = window.requestAnimationFrame || setTimeout;\n\n\tvar requestIdleCallback = window.requestIdleCallback;\n\n\tvar regPicture = /^picture$/i;\n\n\tvar loadEvents = ['load', 'error', 'lazyincluded', '_lazyloaded'];\n\n\tvar regClassCache = {};\n\n\tvar forEach = Array.prototype.forEach;\n\n\t/**\n\t * @param ele {Element}\n\t * @param cls {string}\n\t */\n\tvar hasClass = function(ele, cls) {\n\t\tif(!regClassCache[cls]){\n\t\t\tregClassCache[cls] = new RegExp('(\\\\s|^)'+cls+'(\\\\s|$)');\n\t\t}\n\t\treturn regClassCache[cls].test(ele[_getAttribute]('class') || '') && regClassCache[cls];\n\t};\n\n\t/**\n\t * @param ele {Element}\n\t * @param cls {string}\n\t */\n\tvar addClass = function(ele, cls) {\n\t\tif (!hasClass(ele, cls)){\n\t\t\tele.setAttribute('class', (ele[_getAttribute]('class') || '').trim() + ' ' + cls);\n\t\t}\n\t};\n\n\t/**\n\t * @param ele {Element}\n\t * @param cls {string}\n\t */\n\tvar removeClass = function(ele, cls) {\n\t\tvar reg;\n\t\tif ((reg = hasClass(ele,cls))) {\n\t\t\tele.setAttribute('class', (ele[_getAttribute]('class') || '').replace(reg, ' '));\n\t\t}\n\t};\n\n\tvar addRemoveLoadEvents = function(dom, fn, add){\n\t\tvar action = add ? _addEventListener : 'removeEventListener';\n\t\tif(add){\n\t\t\taddRemoveLoadEvents(dom, fn);\n\t\t}\n\t\tloadEvents.forEach(function(evt){\n\t\t\tdom[action](evt, fn);\n\t\t});\n\t};\n\n\t/**\n\t * @param elem { Element }\n\t * @param name { string }\n\t * @param detail { any }\n\t * @param noBubbles { boolean }\n\t * @param noCancelable { boolean }\n\t * @returns { CustomEvent }\n\t */\n\tvar triggerEvent = function(elem, name, detail, noBubbles, noCancelable){\n\t\tvar event = document.createEvent('Event');\n\n\t\tif(!detail){\n\t\t\tdetail = {};\n\t\t}\n\n\t\tdetail.instance = lazysizes;\n\n\t\tevent.initEvent(name, !noBubbles, !noCancelable);\n\n\t\tevent.detail = detail;\n\n\t\telem.dispatchEvent(event);\n\t\treturn event;\n\t};\n\n\tvar updatePolyfill = function (el, full){\n\t\tvar polyfill;\n\t\tif( !supportPicture && ( polyfill = (window.picturefill || lazySizesCfg.pf) ) ){\n\t\t\tif(full && full.src && !el[_getAttribute]('srcset')){\n\t\t\t\tel.setAttribute('srcset', full.src);\n\t\t\t}\n\t\t\tpolyfill({reevaluate: true, elements: [el]});\n\t\t} else if(full && full.src){\n\t\t\tel.src = full.src;\n\t\t}\n\t};\n\n\tvar getCSS = function (elem, style){\n\t\treturn (getComputedStyle(elem, null) || {})[style];\n\t};\n\n\t/**\n\t *\n\t * @param elem { Element }\n\t * @param parent { Element }\n\t * @param [width] {number}\n\t * @returns {number}\n\t */\n\tvar getWidth = function(elem, parent, width){\n\t\twidth = width || elem.offsetWidth;\n\n\t\twhile(width < lazySizesCfg.minSize && parent && !elem._lazysizesWidth){\n\t\t\twidth = parent.offsetWidth;\n\t\t\tparent = parent.parentNode;\n\t\t}\n\n\t\treturn width;\n\t};\n\n\tvar rAF = (function(){\n\t\tvar running, waiting;\n\t\tvar firstFns = [];\n\t\tvar secondFns = [];\n\t\tvar fns = firstFns;\n\n\t\tvar run = function(){\n\t\t\tvar runFns = fns;\n\n\t\t\tfns = firstFns.length ? secondFns : firstFns;\n\n\t\t\trunning = true;\n\t\t\twaiting = false;\n\n\t\t\twhile(runFns.length){\n\t\t\t\trunFns.shift()();\n\t\t\t}\n\n\t\t\trunning = false;\n\t\t};\n\n\t\tvar rafBatch = function(fn, queue){\n\t\t\tif(running && !queue){\n\t\t\t\tfn.apply(this, arguments);\n\t\t\t} else {\n\t\t\t\tfns.push(fn);\n\n\t\t\t\tif(!waiting){\n\t\t\t\t\twaiting = true;\n\t\t\t\t\t(document.hidden ? setTimeout : requestAnimationFrame)(run);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\trafBatch._lsFlush = run;\n\n\t\treturn rafBatch;\n\t})();\n\n\tvar rAFIt = function(fn, simple){\n\t\treturn simple ?\n\t\t\tfunction() {\n\t\t\t\trAF(fn);\n\t\t\t} :\n\t\t\tfunction(){\n\t\t\t\tvar that = this;\n\t\t\t\tvar args = arguments;\n\t\t\t\trAF(function(){\n\t\t\t\t\tfn.apply(that, args);\n\t\t\t\t});\n\t\t\t}\n\t\t;\n\t};\n\n\tvar throttle = function(fn){\n\t\tvar running;\n\t\tvar lastTime = 0;\n\t\tvar gDelay = lazySizesCfg.throttleDelay;\n\t\tvar rICTimeout = lazySizesCfg.ricTimeout;\n\t\tvar run = function(){\n\t\t\trunning = false;\n\t\t\tlastTime = Date.now();\n\t\t\tfn();\n\t\t};\n\t\tvar idleCallback = requestIdleCallback && rICTimeout > 49 ?\n\t\t\tfunction(){\n\t\t\t\trequestIdleCallback(run, {timeout: rICTimeout});\n\n\t\t\t\tif(rICTimeout !== lazySizesCfg.ricTimeout){\n\t\t\t\t\trICTimeout = lazySizesCfg.ricTimeout;\n\t\t\t\t}\n\t\t\t} :\n\t\t\trAFIt(function(){\n\t\t\t\tsetTimeout(run);\n\t\t\t}, true)\n\t\t;\n\n\t\treturn function(isPriority){\n\t\t\tvar delay;\n\n\t\t\tif((isPriority = isPriority === true)){\n\t\t\t\trICTimeout = 33;\n\t\t\t}\n\n\t\t\tif(running){\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\trunning = true;\n\n\t\t\tdelay = gDelay - (Date.now() - lastTime);\n\n\t\t\tif(delay < 0){\n\t\t\t\tdelay = 0;\n\t\t\t}\n\n\t\t\tif(isPriority || delay < 9){\n\t\t\t\tidleCallback();\n\t\t\t} else {\n\t\t\t\tsetTimeout(idleCallback, delay);\n\t\t\t}\n\t\t};\n\t};\n\n\t//based on http://modernjavascript.blogspot.de/2013/08/building-better-debounce.html\n\tvar debounce = function(func) {\n\t\tvar timeout, timestamp;\n\t\tvar wait = 99;\n\t\tvar run = function(){\n\t\t\ttimeout = null;\n\t\t\tfunc();\n\t\t};\n\t\tvar later = function() {\n\t\t\tvar last = Date.now() - timestamp;\n\n\t\t\tif (last < wait) {\n\t\t\t\tsetTimeout(later, wait - last);\n\t\t\t} else {\n\t\t\t\t(requestIdleCallback || run)(run);\n\t\t\t}\n\t\t};\n\n\t\treturn function() {\n\t\t\ttimestamp = Date.now();\n\n\t\t\tif (!timeout) {\n\t\t\t\ttimeout = setTimeout(later, wait);\n\t\t\t}\n\t\t};\n\t};\n\n\tvar loader = (function(){\n\t\tvar preloadElems, isCompleted, resetPreloadingTimer, loadMode, started;\n\n\t\tvar eLvW, elvH, eLtop, eLleft, eLright, eLbottom, isBodyHidden;\n\n\t\tvar regImg = /^img$/i;\n\t\tvar regIframe = /^iframe$/i;\n\n\t\tvar supportScroll = ('onscroll' in window) && !(/(gle|ing)bot/.test(navigator.userAgent));\n\n\t\tvar shrinkExpand = 0;\n\t\tvar currentExpand = 0;\n\n\t\tvar isLoading = 0;\n\t\tvar lowRuns = -1;\n\n\t\tvar resetPreloading = function(e){\n\t\t\tisLoading--;\n\t\t\tif(!e || isLoading < 0 || !e.target){\n\t\t\t\tisLoading = 0;\n\t\t\t}\n\t\t};\n\n\t\tvar isVisible = function (elem) {\n\t\t\tif (isBodyHidden == null) {\n\t\t\t\tisBodyHidden = getCSS(document.body, 'visibility') == 'hidden';\n\t\t\t}\n\n\t\t\treturn isBodyHidden || !(getCSS(elem.parentNode, 'visibility') == 'hidden' && getCSS(elem, 'visibility') == 'hidden');\n\t\t};\n\n\t\tvar isNestedVisible = function(elem, elemExpand){\n\t\t\tvar outerRect;\n\t\t\tvar parent = elem;\n\t\t\tvar visible = isVisible(elem);\n\n\t\t\teLtop -= elemExpand;\n\t\t\teLbottom += elemExpand;\n\t\t\teLleft -= elemExpand;\n\t\t\teLright += elemExpand;\n\n\t\t\twhile(visible && (parent = parent.offsetParent) && parent != document.body && parent != docElem){\n\t\t\t\tvisible = ((getCSS(parent, 'opacity') || 1) > 0);\n\n\t\t\t\tif(visible && getCSS(parent, 'overflow') != 'visible'){\n\t\t\t\t\touterRect = parent.getBoundingClientRect();\n\t\t\t\t\tvisible = eLright > outerRect.left &&\n\t\t\t\t\t\teLleft < outerRect.right &&\n\t\t\t\t\t\teLbottom > outerRect.top - 1 &&\n\t\t\t\t\t\teLtop < outerRect.bottom + 1\n\t\t\t\t\t;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn visible;\n\t\t};\n\n\t\tvar checkElements = function() {\n\t\t\tvar eLlen, i, rect, autoLoadElem, loadedSomething, elemExpand, elemNegativeExpand, elemExpandVal,\n\t\t\t\tbeforeExpandVal, defaultExpand, preloadExpand, hFac;\n\t\t\tvar lazyloadElems = lazysizes.elements;\n\n\t\t\tif((loadMode = lazySizesCfg.loadMode) && isLoading < 8 && (eLlen = lazyloadElems.length)){\n\n\t\t\t\ti = 0;\n\n\t\t\t\tlowRuns++;\n\n\t\t\t\tfor(; i < eLlen; i++){\n\n\t\t\t\t\tif(!lazyloadElems[i] || lazyloadElems[i]._lazyRace){continue;}\n\n\t\t\t\t\tif(!supportScroll || (lazysizes.prematureUnveil && lazysizes.prematureUnveil(lazyloadElems[i]))){unveilElement(lazyloadElems[i]);continue;}\n\n\t\t\t\t\tif(!(elemExpandVal = lazyloadElems[i][_getAttribute]('data-expand')) || !(elemExpand = elemExpandVal * 1)){\n\t\t\t\t\t\telemExpand = currentExpand;\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!defaultExpand) {\n\t\t\t\t\t\tdefaultExpand = (!lazySizesCfg.expand || lazySizesCfg.expand < 1) ?\n\t\t\t\t\t\t\tdocElem.clientHeight > 500 && docElem.clientWidth > 500 ? 500 : 370 :\n\t\t\t\t\t\t\tlazySizesCfg.expand;\n\n\t\t\t\t\t\tlazysizes._defEx = defaultExpand;\n\n\t\t\t\t\t\tpreloadExpand = defaultExpand * lazySizesCfg.expFactor;\n\t\t\t\t\t\thFac = lazySizesCfg.hFac;\n\t\t\t\t\t\tisBodyHidden = null;\n\n\t\t\t\t\t\tif(currentExpand < preloadExpand && isLoading < 1 && lowRuns > 2 && loadMode > 2 && !document.hidden){\n\t\t\t\t\t\t\tcurrentExpand = preloadExpand;\n\t\t\t\t\t\t\tlowRuns = 0;\n\t\t\t\t\t\t} else if(loadMode > 1 && lowRuns > 1 && isLoading < 6){\n\t\t\t\t\t\t\tcurrentExpand = defaultExpand;\n\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\tcurrentExpand = shrinkExpand;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tif(beforeExpandVal !== elemExpand){\n\t\t\t\t\t\teLvW = innerWidth + (elemExpand * hFac);\n\t\t\t\t\t\telvH = innerHeight + elemExpand;\n\t\t\t\t\t\telemNegativeExpand = elemExpand * -1;\n\t\t\t\t\t\tbeforeExpandVal = elemExpand;\n\t\t\t\t\t}\n\n\t\t\t\t\trect = lazyloadElems[i].getBoundingClientRect();\n\n\t\t\t\t\tif ((eLbottom = rect.bottom) >= elemNegativeExpand &&\n\t\t\t\t\t\t(eLtop = rect.top) <= elvH &&\n\t\t\t\t\t\t(eLright = rect.right) >= elemNegativeExpand * hFac &&\n\t\t\t\t\t\t(eLleft = rect.left) <= eLvW &&\n\t\t\t\t\t\t(eLbottom || eLright || eLleft || eLtop) &&\n\t\t\t\t\t\t(lazySizesCfg.loadHidden || isVisible(lazyloadElems[i])) &&\n\t\t\t\t\t\t((isCompleted && isLoading < 3 && !elemExpandVal && (loadMode < 3 || lowRuns < 4)) || isNestedVisible(lazyloadElems[i], elemExpand))){\n\t\t\t\t\t\tunveilElement(lazyloadElems[i]);\n\t\t\t\t\t\tloadedSomething = true;\n\t\t\t\t\t\tif(isLoading > 9){break;}\n\t\t\t\t\t} else if(!loadedSomething && isCompleted && !autoLoadElem &&\n\t\t\t\t\t\tisLoading < 4 && lowRuns < 4 && loadMode > 2 &&\n\t\t\t\t\t\t(preloadElems[0] || lazySizesCfg.preloadAfterLoad) &&\n\t\t\t\t\t\t(preloadElems[0] || (!elemExpandVal && ((eLbottom || eLright || eLleft || eLtop) || lazyloadElems[i][_getAttribute](lazySizesCfg.sizesAttr) != 'auto')))){\n\t\t\t\t\t\tautoLoadElem = preloadElems[0] || lazyloadElems[i];\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif(autoLoadElem && !loadedSomething){\n\t\t\t\t\tunveilElement(autoLoadElem);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tvar throttledCheckElements = throttle(checkElements);\n\n\t\tvar switchLoadingClass = function(e){\n\t\t\tvar elem = e.target;\n\n\t\t\tif (elem._lazyCache) {\n\t\t\t\tdelete elem._lazyCache;\n\t\t\t\treturn;\n\t\t\t}\n\n\t\t\tresetPreloading(e);\n\t\t\taddClass(elem, lazySizesCfg.loadedClass);\n\t\t\tremoveClass(elem, lazySizesCfg.loadingClass);\n\t\t\taddRemoveLoadEvents(elem, rafSwitchLoadingClass);\n\t\t\ttriggerEvent(elem, 'lazyloaded');\n\t\t};\n\t\tvar rafedSwitchLoadingClass = rAFIt(switchLoadingClass);\n\t\tvar rafSwitchLoadingClass = function(e){\n\t\t\trafedSwitchLoadingClass({target: e.target});\n\t\t};\n\n\t\tvar changeIframeSrc = function(elem, src){\n\t\t\tvar loadMode = elem.getAttribute('data-load-mode') || lazySizesCfg.iframeLoadMode;\n\n\t\t\t// loadMode can be also a string!\n\t\t\tif (loadMode == 0) {\n\t\t\t\telem.contentWindow.location.replace(src);\n\t\t\t} else if (loadMode == 1) {\n\t\t\t\telem.src = src;\n\t\t\t}\n\t\t};\n\n\t\tvar handleSources = function(source){\n\t\t\tvar customMedia;\n\n\t\t\tvar sourceSrcset = source[_getAttribute](lazySizesCfg.srcsetAttr);\n\n\t\t\tif( (customMedia = lazySizesCfg.customMedia[source[_getAttribute]('data-media') || source[_getAttribute]('media')]) ){\n\t\t\t\tsource.setAttribute('media', customMedia);\n\t\t\t}\n\n\t\t\tif(sourceSrcset){\n\t\t\t\tsource.setAttribute('srcset', sourceSrcset);\n\t\t\t}\n\t\t};\n\n\t\tvar lazyUnveil = rAFIt(function (elem, detail, isAuto, sizes, isImg){\n\t\t\tvar src, srcset, parent, isPicture, event, firesLoad;\n\n\t\t\tif(!(event = triggerEvent(elem, 'lazybeforeunveil', detail)).defaultPrevented){\n\n\t\t\t\tif(sizes){\n\t\t\t\t\tif(isAuto){\n\t\t\t\t\t\taddClass(elem, lazySizesCfg.autosizesClass);\n\t\t\t\t\t} else {\n\t\t\t\t\t\telem.setAttribute('sizes', sizes);\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tsrcset = elem[_getAttribute](lazySizesCfg.srcsetAttr);\n\t\t\t\tsrc = elem[_getAttribute](lazySizesCfg.srcAttr);\n\n\t\t\t\tif(isImg) {\n\t\t\t\t\tparent = elem.parentNode;\n\t\t\t\t\tisPicture = parent && regPicture.test(parent.nodeName || '');\n\t\t\t\t}\n\n\t\t\t\tfiresLoad = detail.firesLoad || (('src' in elem) && (srcset || src || isPicture));\n\n\t\t\t\tevent = {target: elem};\n\n\t\t\t\taddClass(elem, lazySizesCfg.loadingClass);\n\n\t\t\t\tif(firesLoad){\n\t\t\t\t\tclearTimeout(resetPreloadingTimer);\n\t\t\t\t\tresetPreloadingTimer = setTimeout(resetPreloading, 2500);\n\t\t\t\t\taddRemoveLoadEvents(elem, rafSwitchLoadingClass, true);\n\t\t\t\t}\n\n\t\t\t\tif(isPicture){\n\t\t\t\t\tforEach.call(parent.getElementsByTagName('source'), handleSources);\n\t\t\t\t}\n\n\t\t\t\tif(srcset){\n\t\t\t\t\telem.setAttribute('srcset', srcset);\n\t\t\t\t} else if(src && !isPicture){\n\t\t\t\t\tif(regIframe.test(elem.nodeName)){\n\t\t\t\t\t\tchangeIframeSrc(elem, src);\n\t\t\t\t\t} else {\n\t\t\t\t\t\telem.src = src;\n\t\t\t\t\t}\n\t\t\t\t}\n\n\t\t\t\tif(isImg && (srcset || isPicture)){\n\t\t\t\t\tupdatePolyfill(elem, {src: src});\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(elem._lazyRace){\n\t\t\t\tdelete elem._lazyRace;\n\t\t\t}\n\t\t\tremoveClass(elem, lazySizesCfg.lazyClass);\n\n\t\t\trAF(function(){\n\t\t\t\t// Part of this can be removed as soon as this fix is older: https://bugs.chromium.org/p/chromium/issues/detail?id=7731 (2015)\n\t\t\t\tvar isLoaded = elem.complete && elem.naturalWidth > 1;\n\n\t\t\t\tif( !firesLoad || isLoaded){\n\t\t\t\t\tif (isLoaded) {\n\t\t\t\t\t\taddClass(elem, lazySizesCfg.fastLoadedClass);\n\t\t\t\t\t}\n\t\t\t\t\tswitchLoadingClass(event);\n\t\t\t\t\telem._lazyCache = true;\n\t\t\t\t\tsetTimeout(function(){\n\t\t\t\t\t\tif ('_lazyCache' in elem) {\n\t\t\t\t\t\t\tdelete elem._lazyCache;\n\t\t\t\t\t\t}\n\t\t\t\t\t}, 9);\n\t\t\t\t}\n\t\t\t\tif (elem.loading == 'lazy') {\n\t\t\t\t\tisLoading--;\n\t\t\t\t}\n\t\t\t}, true);\n\t\t});\n\n\t\t/**\n\t\t *\n\t\t * @param elem { Element }\n\t\t */\n\t\tvar unveilElement = function (elem){\n\t\t\tif (elem._lazyRace) {return;}\n\t\t\tvar detail;\n\n\t\t\tvar isImg = regImg.test(elem.nodeName);\n\n\t\t\t//allow using sizes=\"auto\", but don't use. it's invalid. Use data-sizes=\"auto\" or a valid value for sizes instead (i.e.: sizes=\"80vw\")\n\t\t\tvar sizes = isImg && (elem[_getAttribute](lazySizesCfg.sizesAttr) || elem[_getAttribute]('sizes'));\n\t\t\tvar isAuto = sizes == 'auto';\n\n\t\t\tif( (isAuto || !isCompleted) && isImg && (elem[_getAttribute]('src') || elem.srcset) && !elem.complete && !hasClass(elem, lazySizesCfg.errorClass) && hasClass(elem, lazySizesCfg.lazyClass)){return;}\n\n\t\t\tdetail = triggerEvent(elem, 'lazyunveilread').detail;\n\n\t\t\tif(isAuto){\n\t\t\t\t autoSizer.updateElem(elem, true, elem.offsetWidth);\n\t\t\t}\n\n\t\t\telem._lazyRace = true;\n\t\t\tisLoading++;\n\n\t\t\tlazyUnveil(elem, detail, isAuto, sizes, isImg);\n\t\t};\n\n\t\tvar afterScroll = debounce(function(){\n\t\t\tlazySizesCfg.loadMode = 3;\n\t\t\tthrottledCheckElements();\n\t\t});\n\n\t\tvar altLoadmodeScrollListner = function(){\n\t\t\tif(lazySizesCfg.loadMode == 3){\n\t\t\t\tlazySizesCfg.loadMode = 2;\n\t\t\t}\n\t\t\tafterScroll();\n\t\t};\n\n\t\tvar onload = function(){\n\t\t\tif(isCompleted){return;}\n\t\t\tif(Date.now() - started < 999){\n\t\t\t\tsetTimeout(onload, 999);\n\t\t\t\treturn;\n\t\t\t}\n\n\n\t\t\tisCompleted = true;\n\n\t\t\tlazySizesCfg.loadMode = 3;\n\n\t\t\tthrottledCheckElements();\n\n\t\t\taddEventListener('scroll', altLoadmodeScrollListner, true);\n\t\t};\n\n\t\treturn {\n\t\t\t_: function(){\n\t\t\t\tstarted = Date.now();\n\n\t\t\t\tlazysizes.elements = document.getElementsByClassName(lazySizesCfg.lazyClass);\n\t\t\t\tpreloadElems = document.getElementsByClassName(lazySizesCfg.lazyClass + ' ' + lazySizesCfg.preloadClass);\n\n\t\t\t\taddEventListener('scroll', throttledCheckElements, true);\n\n\t\t\t\taddEventListener('resize', throttledCheckElements, true);\n\n\t\t\t\taddEventListener('pageshow', function (e) {\n\t\t\t\t\tif (e.persisted) {\n\t\t\t\t\t\tvar loadingElements = document.querySelectorAll('.' + lazySizesCfg.loadingClass);\n\n\t\t\t\t\t\tif (loadingElements.length && loadingElements.forEach) {\n\t\t\t\t\t\t\trequestAnimationFrame(function () {\n\t\t\t\t\t\t\t\tloadingElements.forEach( function (img) {\n\t\t\t\t\t\t\t\t\tif (img.complete) {\n\t\t\t\t\t\t\t\t\t\tunveilElement(img);\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t});\n\t\t\t\t\t\t\t});\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t});\n\n\t\t\t\tif(window.MutationObserver){\n\t\t\t\t\tnew MutationObserver( throttledCheckElements ).observe( docElem, {childList: true, subtree: true, attributes: true} );\n\t\t\t\t} else {\n\t\t\t\t\tdocElem[_addEventListener]('DOMNodeInserted', throttledCheckElements, true);\n\t\t\t\t\tdocElem[_addEventListener]('DOMAttrModified', throttledCheckElements, true);\n\t\t\t\t\tsetInterval(throttledCheckElements, 999);\n\t\t\t\t}\n\n\t\t\t\taddEventListener('hashchange', throttledCheckElements, true);\n\n\t\t\t\t//, 'fullscreenchange'\n\t\t\t\t['focus', 'mouseover', 'click', 'load', 'transitionend', 'animationend'].forEach(function(name){\n\t\t\t\t\tdocument[_addEventListener](name, throttledCheckElements, true);\n\t\t\t\t});\n\n\t\t\t\tif((/d$|^c/.test(document.readyState))){\n\t\t\t\t\tonload();\n\t\t\t\t} else {\n\t\t\t\t\taddEventListener('load', onload);\n\t\t\t\t\tdocument[_addEventListener]('DOMContentLoaded', throttledCheckElements);\n\t\t\t\t\tsetTimeout(onload, 20000);\n\t\t\t\t}\n\n\t\t\t\tif(lazysizes.elements.length){\n\t\t\t\t\tcheckElements();\n\t\t\t\t\trAF._lsFlush();\n\t\t\t\t} else {\n\t\t\t\t\tthrottledCheckElements();\n\t\t\t\t}\n\t\t\t},\n\t\t\tcheckElems: throttledCheckElements,\n\t\t\tunveil: unveilElement,\n\t\t\t_aLSL: altLoadmodeScrollListner,\n\t\t};\n\t})();\n\n\n\tvar autoSizer = (function(){\n\t\tvar autosizesElems;\n\n\t\tvar sizeElement = rAFIt(function(elem, parent, event, width){\n\t\t\tvar sources, i, len;\n\t\t\telem._lazysizesWidth = width;\n\t\t\twidth += 'px';\n\n\t\t\telem.setAttribute('sizes', width);\n\n\t\t\tif(regPicture.test(parent.nodeName || '')){\n\t\t\t\tsources = parent.getElementsByTagName('source');\n\t\t\t\tfor(i = 0, len = sources.length; i < len; i++){\n\t\t\t\t\tsources[i].setAttribute('sizes', width);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif(!event.detail.dataAttr){\n\t\t\t\tupdatePolyfill(elem, event.detail);\n\t\t\t}\n\t\t});\n\t\t/**\n\t\t *\n\t\t * @param elem {Element}\n\t\t * @param dataAttr\n\t\t * @param [width] { number }\n\t\t */\n\t\tvar getSizeElement = function (elem, dataAttr, width){\n\t\t\tvar event;\n\t\t\tvar parent = elem.parentNode;\n\n\t\t\tif(parent){\n\t\t\t\twidth = getWidth(elem, parent, width);\n\t\t\t\tevent = triggerEvent(elem, 'lazybeforesizes', {width: width, dataAttr: !!dataAttr});\n\n\t\t\t\tif(!event.defaultPrevented){\n\t\t\t\t\twidth = event.detail.width;\n\n\t\t\t\t\tif(width && width !== elem._lazysizesWidth){\n\t\t\t\t\t\tsizeElement(elem, parent, event, width);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tvar updateElementsSizes = function(){\n\t\t\tvar i;\n\t\t\tvar len = autosizesElems.length;\n\t\t\tif(len){\n\t\t\t\ti = 0;\n\n\t\t\t\tfor(; i < len; i++){\n\t\t\t\t\tgetSizeElement(autosizesElems[i]);\n\t\t\t\t}\n\t\t\t}\n\t\t};\n\n\t\tvar debouncedUpdateElementsSizes = debounce(updateElementsSizes);\n\n\t\treturn {\n\t\t\t_: function(){\n\t\t\t\tautosizesElems = document.getElementsByClassName(lazySizesCfg.autosizesClass);\n\t\t\t\taddEventListener('resize', debouncedUpdateElementsSizes);\n\t\t\t},\n\t\t\tcheckElems: debouncedUpdateElementsSizes,\n\t\t\tupdateElem: getSizeElement\n\t\t};\n\t})();\n\n\tvar init = function(){\n\t\tif(!init.i && document.getElementsByClassName){\n\t\t\tinit.i = true;\n\t\t\tautoSizer._();\n\t\t\tloader._();\n\t\t}\n\t};\n\n\tsetTimeout(function(){\n\t\tif(lazySizesCfg.init){\n\t\t\tinit();\n\t\t}\n\t});\n\n\tlazysizes = {\n\t\t/**\n\t\t * @type { LazySizesConfigPartial }\n\t\t */\n\t\tcfg: lazySizesCfg,\n\t\tautoSizer: autoSizer,\n\t\tloader: loader,\n\t\tinit: init,\n\t\tuP: updatePolyfill,\n\t\taC: addClass,\n\t\trC: removeClass,\n\t\thC: hasClass,\n\t\tfire: triggerEvent,\n\t\tgW: getWidth,\n\t\trAF: rAF,\n\t};\n\n\treturn lazysizes;\n}\n));\n", "\uFEFF\"use strict\";\r\n\r\nconst tabbed = {\r\n tablist: null,\r\n tabs: [],\r\n panels: [],\r\n setTablist: function() {\r\n var lists = Array.from(document.querySelectorAll(\"[data-tab-nav]\")).filter(\r\n nav => nav.querySelectorAll(\"[data-tab-link]\").length > 0\r\n );\r\n if (lists.length > 0) {\r\n this.tablist = lists[0];\r\n this.tablist.setAttribute(\"role\", \"tablist\");\r\n this.setTabs();\r\n }\r\n },\r\n setTabs: function() {\r\n if (this.tablist != null) {\r\n this.tabs = this.tablist.querySelectorAll(\"[data-tab-link]\");\r\n this.setPanels();\r\n }\r\n },\r\n setPanels: function() {\r\n if (this.tabs.length > 0) {\r\n this.panels = Array.from(this.tabs).map(tab =>\r\n document.querySelectorAll(\"[data-tab]\" + tab.getAttribute(\"href\"))\r\n );\r\n }\r\n },\r\n switchTab: function(oldTab, newTab) {\r\n if (oldTab == null) {\r\n let currentTab = document.querySelector(\"[data-tab-link][aria-selected]\");\r\n if (currentTab != null) {\r\n this.switchTab(currentTab, newTab);\r\n } else {\r\n this.switchTab(newTab, newTab);\r\n }\r\n return;\r\n }\r\n\r\n oldTab.classList.remove(\"active\");\r\n oldTab.removeAttribute(\"aria-selected\");\r\n oldTab.setAttribute(\"tabindex\", \"-1\");\r\n\r\n newTab.focus();\r\n // Make the active tab focusable by the user (Tab key)\r\n newTab.removeAttribute(\"tabindex\");\r\n // Set the selected state\r\n newTab.setAttribute(\"aria-selected\", \"true\");\r\n newTab.classList.add(\"active\");\r\n\r\n var currentButton = this.tablist.querySelector(\r\n \".content-nav__item--current\"\r\n );\r\n if (currentButton != null) {\r\n currentButton.innerText = newTab.innerText;\r\n }\r\n // Get the indices of the new and old tabs to find the correct\r\n // tab panels to show and hide\r\n let index = Array.prototype.indexOf.call(this.tabs, newTab);\r\n let oldIndex = Array.prototype.indexOf.call(this.tabs, oldTab);\r\n this.panels[oldIndex][0].hidden = true;\r\n this.panels[index][0].hidden = false;\r\n\r\n history.pushState(null, newTab.innerText, newTab.getAttribute(\"href\"));\r\n },\r\n init: function() {\r\n this.setTablist();\r\n\r\n if (this.tablist == null) {\r\n return;\r\n }\r\n\r\n var that = this;\r\n\r\n // Add semantics are remove user focusability for each tab\r\n Array.prototype.forEach.call(that.tabs, (tab, i) => {\r\n tab.setAttribute(\"role\", \"tab\");\r\n tab.setAttribute(\"id\", \"tab\" + (i + 1));\r\n tab.setAttribute(\"tabindex\", \"-1\");\r\n tab.parentNode.setAttribute(\"role\", \"presentation\");\r\n\r\n // Handle clicking of tabs for mouse users\r\n tab.addEventListener(\"click\", e => {\r\n e.preventDefault();\r\n let currentTab = that.tablist.querySelector(\"[aria-selected]\");\r\n if (e.currentTarget !== currentTab) {\r\n that.switchTab(currentTab, e.currentTarget);\r\n }\r\n });\r\n\r\n // Handle keydown events for keyboard users\r\n tab.addEventListener(\"keydown\", e => {\r\n // Get the index of the current tab in the tabs node list\r\n let index = Array.prototype.indexOf.call(that.tabs, e.currentTarget);\r\n // Work out which key the user is pressing and\r\n // Calculate the new tab's index where appropriate\r\n let dir =\r\n e.which === 37\r\n ? index - 1\r\n : e.which === 39\r\n ? index + 1\r\n : e.which === 40\r\n ? \"down\"\r\n : null;\r\n if (dir !== null) {\r\n e.preventDefault();\r\n // If the down key is pressed, move focus to the open panel,\r\n // otherwise switch to the adjacent tab\r\n dir === \"down\"\r\n ? panels[i].focus()\r\n : that.tabs[dir]\r\n ? switchTab(e.currentTarget, that.tabs[dir])\r\n : void 0;\r\n }\r\n });\r\n });\r\n\r\n // Add tab panel semantics and hide them all\r\n Array.prototype.forEach.call(that.panels, (panel, i) => {\r\n panel[0].setAttribute(\"role\", \"tabpanel\");\r\n panel[0].setAttribute(\"tabindex\", \"-1\");\r\n let id = panel[0].getAttribute(\"id\");\r\n panel[0].setAttribute(\"aria-labelledby\", that.tabs[i].id);\r\n panel[0].hidden = true;\r\n });\r\n\r\n let selectedTab = false;\r\n\r\n if (!selectedTab) {\r\n // Initially activate the first tab and reveal the first tab panel\r\n that.tabs[0].removeAttribute(\"tabindex\");\r\n that.tabs[0].setAttribute(\"aria-selected\", \"true\");\r\n that.panels[0][0].hidden = false;\r\n }\r\n\r\n if (window.location.hash != \"\") {\r\n var currentTabs = Array.from(that.tabs).filter(function(tab) {\r\n return tab.getAttribute(\"href\") == window.location.hash;\r\n });\r\n\r\n if (currentTabs.length > 0) {\r\n that.switchTab(null, currentTabs[0]);\r\n //window.scrollTo(0, 0);\r\n //setTimeout(() => window.scrollTo(0, 0), 10);\r\n }\r\n }\r\n\r\n Array.from(\r\n document.querySelectorAll(\r\n 'a[href^=\"' +\r\n window.location.pathname +\r\n '#\"]:not(data-tab-link), a[href^=\"#\"]:not(data-tab-link)'\r\n )\r\n ).forEach(link => {\r\n link.addEventListener(\r\n \"click\",\r\n () => {\r\n var id = link.getAttribute(\"href\");\r\n id = id.substring(id.indexOf(\"#\"));\r\n var currentTabs = Array.from(that.tabs).filter(function(tab) {\r\n return tab.getAttribute(\"href\") == id;\r\n });\r\n if (currentTabs.length > 0) {\r\n that.switchTab(null, currentTabs[0]);\r\n //window.scrollTo(0, 0);\r\n //setTimeout(() => window.scrollTo(0, 0), 10);\r\n }\r\n },\r\n false\r\n );\r\n });\r\n }\r\n};\r\n\r\nmodule.exports = tabbed.init();\r\n", "\uFEFF\"use strict\";\r\n\r\nconst Modal = {\r\n init: function() {\r\n this.body = document.getElementsByTagName(\"body\")[0];\r\n this.buttons = document.querySelectorAll(\".init-modal\");\r\n\r\n this.events();\r\n },\r\n\r\n events: function() {\r\n var self = this;\r\n\r\n this.onClick();\r\n\r\n this.body.onkeydown = function(e) {\r\n e.keyCode === 27 ? self.onClose() : false;\r\n };\r\n\r\n this.body.addEventListener(\"click\", function(e) {\r\n e.target === self.overlay ? self.onClose() : false;\r\n });\r\n },\r\n\r\n onClick: function() {\r\n var self = this;\r\n\r\n for (let i = 0; i < this.buttons.length; i++) {\r\n this.buttons[i].addEventListener(\"click\", function(e) {\r\n self.initOverlay(e);\r\n });\r\n }\r\n },\r\n\r\n initOverlay: function(e) {\r\n var target = e.currentTarget;\r\n\r\n this.overlay = document.createElement(\"div\");\r\n this.overlay.classList.add(\"overlay\");\r\n\r\n this.body.append(this.overlay);\r\n this.body.classList.add(\"body--lock\");\r\n\r\n this.initModal(target);\r\n },\r\n\r\n initModal: function(target) {\r\n var self = this;\r\n\r\n this.modal = document.createElement(\"div\");\r\n this.modal.classList.add(\"modal\");\r\n\r\n this.close = document.createElement(\"button\");\r\n this.close.classList.add(\"button\");\r\n this.close.classList.add(\"overlay--close\");\r\n this.close.innerHTML = '';\r\n\r\n this.close.addEventListener(\"click\", function() {\r\n self.onClose();\r\n });\r\n\r\n this.overlay.appendChild(this.modal);\r\n this.modal.appendChild(this.close);\r\n\r\n this.populateModal(target);\r\n },\r\n\r\n onClose: function() {\r\n if (!this.overlay || this.body.classList.contains(\"body--lock\") === false) {\r\n return;\r\n }\r\n\r\n this.overlay.parentNode.removeChild(this.overlay);\r\n this.body.classList.remove(\"body--lock\");\r\n },\r\n\r\n populateModal: function(target) {\r\n this.container = document.createElement(\"div\");\r\n this.container.classList.add(\"modal__container\");\r\n\r\n this.iframe = document.createElement(\"iframe\");\r\n this.iframe.src =\r\n \"https://www.youtube.com/embed/\" +\r\n target.getAttribute(\"data-id\") +\r\n \"?autoplay=1&rel=0\";\r\n\r\n this.modal.appendChild(this.iframe);\r\n }\r\n};\r\n\r\nmodule.exports = Modal.init();\r\n", "(function(root, factory) {\n\n\tif (root === null) {\n\t\tthrow new Error('Google-maps package can be used only in browser');\n\t}\n\n\tif (typeof define === 'function' && define.amd) {\n\t\tdefine(factory);\n\t} else if (typeof exports === 'object') {\n\t\tmodule.exports = factory();\n\t} else {\n\t\troot.GoogleMapsLoader = factory();\n\t}\n\n})(typeof window !== 'undefined' ? window : null, function() {\n\n\n\t'use strict';\n\n\n\tvar googleVersion = '3.31';\n\n\tvar script = null;\n\n\tvar google = null;\n\n\tvar loading = false;\n\n\tvar callbacks = [];\n\n\tvar onLoadEvents = [];\n\n\tvar originalCreateLoaderMethod = null;\n\n\n\tvar GoogleMapsLoader = {};\n\n\n\tGoogleMapsLoader.URL = 'https://maps.googleapis.com/maps/api/js';\n\n\tGoogleMapsLoader.KEY = null;\n\n\tGoogleMapsLoader.LIBRARIES = [];\n\n\tGoogleMapsLoader.CLIENT = null;\n\n\tGoogleMapsLoader.CHANNEL = null;\n\n\tGoogleMapsLoader.LANGUAGE = null;\n\n\tGoogleMapsLoader.REGION = null;\n\n\tGoogleMapsLoader.VERSION = googleVersion;\n\n\tGoogleMapsLoader.WINDOW_CALLBACK_NAME = '__google_maps_api_provider_initializator__';\n\n\n\tGoogleMapsLoader._googleMockApiObject = {};\n\n\n\tGoogleMapsLoader.load = function(fn) {\n\t\tif (google === null) {\n\t\t\tif (loading === true) {\n\t\t\t\tif (fn) {\n\t\t\t\t\tcallbacks.push(fn);\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tloading = true;\n\n\t\t\t\twindow[GoogleMapsLoader.WINDOW_CALLBACK_NAME] = function() {\n\t\t\t\t\tready(fn);\n\t\t\t\t};\n\n\t\t\t\tGoogleMapsLoader.createLoader();\n\t\t\t}\n\t\t} else if (fn) {\n\t\t\tfn(google);\n\t\t}\n\t};\n\n\n\tGoogleMapsLoader.createLoader = function() {\n\t\tscript = document.createElement('script');\n\t\tscript.type = 'text/javascript';\n\t\tscript.src = GoogleMapsLoader.createUrl();\n\n\t\tdocument.body.appendChild(script);\n\t};\n\n\n\tGoogleMapsLoader.isLoaded = function() {\n\t\treturn google !== null;\n\t};\n\n\n\tGoogleMapsLoader.createUrl = function() {\n\t\tvar url = GoogleMapsLoader.URL;\n\n\t\turl += '?callback=' + GoogleMapsLoader.WINDOW_CALLBACK_NAME;\n\n\t\tif (GoogleMapsLoader.KEY) {\n\t\t\turl += '&key=' + GoogleMapsLoader.KEY;\n\t\t}\n\n\t\tif (GoogleMapsLoader.LIBRARIES.length > 0) {\n\t\t\turl += '&libraries=' + GoogleMapsLoader.LIBRARIES.join(',');\n\t\t}\n\n\t\tif (GoogleMapsLoader.CLIENT) {\n\t\t\turl += '&client=' + GoogleMapsLoader.CLIENT;\n\t\t}\n\n\t\tif (GoogleMapsLoader.CHANNEL) {\n\t\t\turl += '&channel=' + GoogleMapsLoader.CHANNEL;\n\t\t}\n\n\t\tif (GoogleMapsLoader.LANGUAGE) {\n\t\t\turl += '&language=' + GoogleMapsLoader.LANGUAGE;\n\t\t}\n\n\t\tif (GoogleMapsLoader.REGION) {\n\t\t\turl += '®ion=' + GoogleMapsLoader.REGION;\n\t\t}\n\n\t\tif (GoogleMapsLoader.VERSION) {\n\t\t\turl += '&v=' + GoogleMapsLoader.VERSION;\n\t\t}\n\n\t\treturn url;\n\t};\n\n\n\tGoogleMapsLoader.release = function(fn) {\n\t\tvar release = function() {\n\t\t\tGoogleMapsLoader.KEY = null;\n\t\t\tGoogleMapsLoader.LIBRARIES = [];\n\t\t\tGoogleMapsLoader.CLIENT = null;\n\t\t\tGoogleMapsLoader.CHANNEL = null;\n\t\t\tGoogleMapsLoader.LANGUAGE = null;\n\t\t\tGoogleMapsLoader.REGION = null;\n\t\t\tGoogleMapsLoader.VERSION = googleVersion;\n\n\t\t\tgoogle = null;\n\t\t\tloading = false;\n\t\t\tcallbacks = [];\n\t\t\tonLoadEvents = [];\n\n\t\t\tif (typeof window.google !== 'undefined') {\n\t\t\t\tdelete window.google;\n\t\t\t}\n\n\t\t\tif (typeof window[GoogleMapsLoader.WINDOW_CALLBACK_NAME] !== 'undefined') {\n\t\t\t\tdelete window[GoogleMapsLoader.WINDOW_CALLBACK_NAME];\n\t\t\t}\n\n\t\t\tif (originalCreateLoaderMethod !== null) {\n\t\t\t\tGoogleMapsLoader.createLoader = originalCreateLoaderMethod;\n\t\t\t\toriginalCreateLoaderMethod = null;\n\t\t\t}\n\n\t\t\tif (script !== null) {\n\t\t\t\tscript.parentElement.removeChild(script);\n\t\t\t\tscript = null;\n\t\t\t}\n\n\t\t\tif (fn) {\n\t\t\t\tfn();\n\t\t\t}\n\t\t};\n\n\t\tif (loading) {\n\t\t\tGoogleMapsLoader.load(function() {\n\t\t\t\trelease();\n\t\t\t});\n\t\t} else {\n\t\t\trelease();\n\t\t}\n\t};\n\n\n\tGoogleMapsLoader.onLoad = function(fn) {\n\t\tonLoadEvents.push(fn);\n\t};\n\n\n\tGoogleMapsLoader.makeMock = function() {\n\t\toriginalCreateLoaderMethod = GoogleMapsLoader.createLoader;\n\n\t\tGoogleMapsLoader.createLoader = function() {\n\t\t\twindow.google = GoogleMapsLoader._googleMockApiObject;\n\t\t\twindow[GoogleMapsLoader.WINDOW_CALLBACK_NAME]();\n\t\t};\n\t};\n\n\n\tvar ready = function(fn) {\n\t\tvar i;\n\n\t\tloading = false;\n\n\t\tif (google === null) {\n\t\t\tgoogle = window.google;\n\t\t}\n\n\t\tfor (i = 0; i < onLoadEvents.length; i++) {\n\t\t\tonLoadEvents[i](google);\n\t\t}\n\n\t\tif (fn) {\n\t\t\tfn(google);\n\t\t}\n\n\t\tfor (i = 0; i < callbacks.length; i++) {\n\t\t\tcallbacks[i](google);\n\t\t}\n\n\t\tcallbacks = [];\n\t};\n\n\n\treturn GoogleMapsLoader;\n\n});\n", "var pi = 3.14159265358979;\n\n/* Ellipsoid model constants (actual values here are for WGS84) */\nvar sm_a = 6378137.0;\nvar sm_b = 6356752.314;\nvar sm_EccSquared = 6.69437999013e-03;\n\nvar UTMScaleFactor = 0.9996;\n\n/*\n * DegToRad\n *\n * Converts degrees to radians.\n *\n */\nfunction DegToRad(deg) {\n return (deg / 180.0 * pi)\n}\n\n/*\n * RadToDeg\n *\n * Converts radians to degrees.\n *\n */\nfunction RadToDeg(rad) {\n return (rad / pi * 180.0)\n}\n\n/*\n * ArcLengthOfMeridian\n *\n * Computes the ellipsoidal distance from the equator to a point at a\n * given latitude.\n *\n * Reference: Hoffmann-Wellenhof, B., Lichtenegger, H., and Collins, J.,\n * GPS: Theory and Practice, 3rd ed. New York: Springer-Verlag Wien, 1994.\n *\n * Inputs:\n * phi - Latitude of the point, in radians.\n *\n * Globals:\n * sm_a - Ellipsoid model major axis.\n * sm_b - Ellipsoid model minor axis.\n *\n * Returns:\n * The ellipsoidal distance of the point from the equator, in meters.\n *\n */\nfunction ArcLengthOfMeridian(phi) {\n var alpha, beta, gamma, delta, epsilon, n;\n var result;\n\n /* Precalculate n */\n n = (sm_a - sm_b) / (sm_a + sm_b);\n\n /* Precalculate alpha */\n alpha = ((sm_a + sm_b) / 2.0)\n * (1.0 + (Math.pow(n, 2.0) / 4.0) + (Math.pow(n, 4.0) / 64.0));\n\n /* Precalculate beta */\n beta = (-3.0 * n / 2.0) + (9.0 * Math.pow(n, 3.0) / 16.0)\n + (-3.0 * Math.pow(n, 5.0) / 32.0);\n\n /* Precalculate gamma */\n gamma = (15.0 * Math.pow(n, 2.0) / 16.0)\n + (-15.0 * Math.pow(n, 4.0) / 32.0);\n\n /* Precalculate delta */\n delta = (-35.0 * Math.pow(n, 3.0) / 48.0)\n + (105.0 * Math.pow(n, 5.0) / 256.0);\n\n /* Precalculate epsilon */\n epsilon = (315.0 * Math.pow(n, 4.0) / 512.0);\n\n /* Now calculate the sum of the series and return */\n result = alpha\n * (phi + (beta * Math.sin(2.0 * phi))\n + (gamma * Math.sin(4.0 * phi))\n + (delta * Math.sin(6.0 * phi))\n + (epsilon * Math.sin(8.0 * phi)));\n\n return result;\n}\n\n/*\n * UTMCentralMeridian\n *\n * Determines the central meridian for the given UTM zone.\n *\n * Inputs:\n * zone - An integer value designating the UTM zone, range [1,60].\n *\n * Returns:\n * The central meridian for the given UTM zone, in radians, or zero\n * if the UTM zone parameter is outside the range [1,60].\n * Range of the central meridian is the radian equivalent of [-177,+177].\n *\n */\nfunction UTMCentralMeridian(zone) {\n var cmeridian;\n\n cmeridian = DegToRad(-183.0 + (zone * 6.0));\n\n return cmeridian;\n}\n\n/*\n * FootpointLatitude\n *\n * Computes the footpoint latitude for use in converting transverse\n * Mercator coordinates to ellipsoidal coordinates.\n *\n * Reference: Hoffmann-Wellenhof, B., Lichtenegger, H., and Collins, J.,\n * GPS: Theory and Practice, 3rd ed. New York: Springer-Verlag Wien, 1994.\n *\n * Inputs:\n * y - The UTM northing coordinate, in meters.\n *\n * Returns:\n * The footpoint latitude, in radians.\n *\n */\nfunction FootpointLatitude(y) {\n var y_, alpha_, beta_, gamma_, delta_, epsilon_, n;\n var result;\n\n /* Precalculate n (Eq. 10.18) */\n n = (sm_a - sm_b) / (sm_a + sm_b);\n\n /* Precalculate alpha_ (Eq. 10.22) */\n /* (Same as alpha in Eq. 10.17) */\n alpha_ = ((sm_a + sm_b) / 2.0)\n * (1 + (Math.pow(n, 2.0) / 4) + (Math.pow(n, 4.0) / 64));\n\n /* Precalculate y_ (Eq. 10.23) */\n y_ = y / alpha_;\n\n /* Precalculate beta_ (Eq. 10.22) */\n beta_ = (3.0 * n / 2.0) + (-27.0 * Math.pow(n, 3.0) / 32.0)\n + (269.0 * Math.pow(n, 5.0) / 512.0);\n\n /* Precalculate gamma_ (Eq. 10.22) */\n gamma_ = (21.0 * Math.pow(n, 2.0) / 16.0)\n + (-55.0 * Math.pow(n, 4.0) / 32.0);\n\n /* Precalculate delta_ (Eq. 10.22) */\n delta_ = (151.0 * Math.pow(n, 3.0) / 96.0)\n + (-417.0 * Math.pow(n, 5.0) / 128.0);\n\n /* Precalculate epsilon_ (Eq. 10.22) */\n epsilon_ = (1097.0 * Math.pow(n, 4.0) / 512.0);\n\n /* Now calculate the sum of the series (Eq. 10.21) */\n result = y_ + (beta_ * Math.sin(2.0 * y_))\n + (gamma_ * Math.sin(4.0 * y_))\n + (delta_ * Math.sin(6.0 * y_))\n + (epsilon_ * Math.sin(8.0 * y_));\n\n return result;\n}\n\n/*\n * MapLatLonToXY\n *\n * Converts a latitude/longitude pair to x and y coordinates in the\n * Transverse Mercator projection. Note that Transverse Mercator is not\n * the same as UTM; a scale factor is required to convert between them.\n *\n * Reference: Hoffmann-Wellenhof, B., Lichtenegger, H., and Collins, J.,\n * GPS: Theory and Practice, 3rd ed. New York: Springer-Verlag Wien, 1994.\n *\n * Inputs:\n * phi - Latitude of the point, in radians.\n * lambda - Longitude of the point, in radians.\n * lambda0 - Longitude of the central meridian to be used, in radians.\n *\n * Outputs:\n * xy - A 2-element array containing the x and y coordinates\n * of the computed point.\n *\n * Returns:\n * The function does not return a value.\n *\n */\nfunction MapLatLonToXY(phi, lambda, lambda0, xy) {\n var N, nu2, ep2, t, t2, l;\n var l3coef, l4coef, l5coef, l6coef, l7coef, l8coef;\n var tmp;\n\n /* Precalculate ep2 */\n ep2 = (Math.pow(sm_a, 2.0) - Math.pow(sm_b, 2.0)) / Math.pow(sm_b, 2.0);\n\n /* Precalculate nu2 */\n nu2 = ep2 * Math.pow(Math.cos(phi), 2.0);\n\n /* Precalculate N */\n N = Math.pow(sm_a, 2.0) / (sm_b * Math.sqrt(1 + nu2));\n\n /* Precalculate t */\n t = Math.tan(phi);\n t2 = t * t;\n tmp = (t2 * t2 * t2) - Math.pow(t, 6.0);\n\n /* Precalculate l */\n l = lambda - lambda0;\n\n /* Precalculate coefficients for l**n in the equations below\n so a normal human being can read the expressions for easting\n and northing\n -- l**1 and l**2 have coefficients of 1.0 */\n l3coef = 1.0 - t2 + nu2;\n\n l4coef = 5.0 - t2 + 9 * nu2 + 4.0 * (nu2 * nu2);\n\n l5coef = 5.0 - 18.0 * t2 + (t2 * t2) + 14.0 * nu2\n - 58.0 * t2 * nu2;\n\n l6coef = 61.0 - 58.0 * t2 + (t2 * t2) + 270.0 * nu2\n - 330.0 * t2 * nu2;\n\n l7coef = 61.0 - 479.0 * t2 + 179.0 * (t2 * t2) - (t2 * t2 * t2);\n\n l8coef = 1385.0 - 3111.0 * t2 + 543.0 * (t2 * t2) - (t2 * t2 * t2);\n\n /* Calculate easting (x) */\n xy[0] = N * Math.cos(phi) * l\n + (N / 6.0 * Math.pow(Math.cos(phi), 3.0) * l3coef * Math.pow(l, 3.0))\n + (N / 120.0 * Math.pow(Math.cos(phi), 5.0) * l5coef * Math.pow(l, 5.0))\n + (N / 5040.0 * Math.pow(Math.cos(phi), 7.0) * l7coef * Math.pow(l, 7.0));\n\n /* Calculate northing (y) */\n xy[1] = ArcLengthOfMeridian(phi)\n + (t / 2.0 * N * Math.pow(Math.cos(phi), 2.0) * Math.pow(l, 2.0))\n + (t / 24.0 * N * Math.pow(Math.cos(phi), 4.0) * l4coef * Math.pow(l, 4.0))\n + (t / 720.0 * N * Math.pow(Math.cos(phi), 6.0) * l6coef * Math.pow(l, 6.0))\n + (t / 40320.0 * N * Math.pow(Math.cos(phi), 8.0) * l8coef * Math.pow(l, 8.0));\n\n return;\n}\n\n/*\n * MapXYToLatLon\n *\n * Converts x and y coordinates in the Transverse Mercator projection to\n * a latitude/longitude pair. Note that Transverse Mercator is not\n * the same as UTM; a scale factor is required to convert between them.\n *\n * Reference: Hoffmann-Wellenhof, B., Lichtenegger, H., and Collins, J.,\n * GPS: Theory and Practice, 3rd ed. New York: Springer-Verlag Wien, 1994.\n *\n * Inputs:\n * x - The easting of the point, in meters.\n * y - The northing of the point, in meters.\n * lambda0 - Longitude of the central meridian to be used, in radians.\n *\n * Outputs:\n * philambda - A 2-element containing the latitude and longitude\n * in radians.\n *\n * Returns:\n * The function does not return a value.\n *\n * Remarks:\n * The local variables Nf, nuf2, tf, and tf2 serve the same purpose as\n * N, nu2, t, and t2 in MapLatLonToXY, but they are computed with respect\n * to the footpoint latitude phif.\n *\n * x1frac, x2frac, x2poly, x3poly, etc. are to enhance readability and\n * to optimize computations.\n *\n */\nfunction MapXYToLatLon(x, y, lambda0, philambda) {\n var phif, Nf, Nfpow, nuf2, ep2, tf, tf2, tf4, cf;\n var x1frac, x2frac, x3frac, x4frac, x5frac, x6frac, x7frac, x8frac;\n var x2poly, x3poly, x4poly, x5poly, x6poly, x7poly, x8poly;\n\n /* Get the value of phif, the footpoint latitude. */\n phif = FootpointLatitude(y);\n\n /* Precalculate ep2 */\n ep2 = (Math.pow(sm_a, 2.0) - Math.pow(sm_b, 2.0))\n / Math.pow(sm_b, 2.0);\n\n /* Precalculate cos (phif) */\n cf = Math.cos(phif);\n\n /* Precalculate nuf2 */\n nuf2 = ep2 * Math.pow(cf, 2.0);\n\n /* Precalculate Nf and initialize Nfpow */\n Nf = Math.pow(sm_a, 2.0) / (sm_b * Math.sqrt(1 + nuf2));\n Nfpow = Nf;\n\n /* Precalculate tf */\n tf = Math.tan(phif);\n tf2 = tf * tf;\n tf4 = tf2 * tf2;\n\n /* Precalculate fractional coefficients for x**n in the equations\n below to simplify the expressions for latitude and longitude. */\n x1frac = 1.0 / (Nfpow * cf);\n\n Nfpow *= Nf;\n /* now equals Nf**2) */\n x2frac = tf / (2.0 * Nfpow);\n\n Nfpow *= Nf;\n /* now equals Nf**3) */\n x3frac = 1.0 / (6.0 * Nfpow * cf);\n\n Nfpow *= Nf;\n /* now equals Nf**4) */\n x4frac = tf / (24.0 * Nfpow);\n\n Nfpow *= Nf;\n /* now equals Nf**5) */\n x5frac = 1.0 / (120.0 * Nfpow * cf);\n\n Nfpow *= Nf;\n /* now equals Nf**6) */\n x6frac = tf / (720.0 * Nfpow);\n\n Nfpow *= Nf;\n /* now equals Nf**7) */\n x7frac = 1.0 / (5040.0 * Nfpow * cf);\n\n Nfpow *= Nf;\n /* now equals Nf**8) */\n x8frac = tf / (40320.0 * Nfpow);\n\n /* Precalculate polynomial coefficients for x**n.\n -- x**1 does not have a polynomial coefficient. */\n x2poly = -1.0 - nuf2;\n\n x3poly = -1.0 - 2 * tf2 - nuf2;\n\n x4poly = 5.0 + 3.0 * tf2 + 6.0 * nuf2 - 6.0 * tf2 * nuf2\n - 3.0 * (nuf2 * nuf2) - 9.0 * tf2 * (nuf2 * nuf2);\n\n x5poly = 5.0 + 28.0 * tf2 + 24.0 * tf4 + 6.0 * nuf2 + 8.0 * tf2 * nuf2;\n\n x6poly = -61.0 - 90.0 * tf2 - 45.0 * tf4 - 107.0 * nuf2\n + 162.0 * tf2 * nuf2;\n\n x7poly = -61.0 - 662.0 * tf2 - 1320.0 * tf4 - 720.0 * (tf4 * tf2);\n\n x8poly = 1385.0 + 3633.0 * tf2 + 4095.0 * tf4 + 1575 * (tf4 * tf2);\n\n /* Calculate latitude */\n philambda[0] = phif + x2frac * x2poly * (x * x)\n + x4frac * x4poly * Math.pow(x, 4.0)\n + x6frac * x6poly * Math.pow(x, 6.0)\n + x8frac * x8poly * Math.pow(x, 8.0);\n\n /* Calculate longitude */\n philambda[1] = lambda0 + x1frac * x\n + x3frac * x3poly * Math.pow(x, 3.0)\n + x5frac * x5poly * Math.pow(x, 5.0)\n + x7frac * x7poly * Math.pow(x, 7.0);\n\n return;\n}\n\n/*\n * btnToUTM_OnClick\n *\n * Called when the btnToUTM button is clicked.\n *\n */\nfunction btnToUTM_OnClick() {\n var xy = new Array(2);\n\n if (isNaN(parseFloat(document.frmConverter.txtLongitude.value))) {\n alert(\"Please enter a valid longitude in the lon field.\");\n return false;\n }\n\n lon = parseFloat(document.frmConverter.txtLongitude.value);\n\n if ((lon < -180.0) || (180.0 <= lon)) {\n alert(\"The longitude you entered is out of range. \" +\n \"Please enter a number in the range [-180, 180).\");\n return false;\n }\n\n if (isNaN(parseFloat(document.frmConverter.txtLatitude.value))) {\n alert(\"Please enter a valid latitude in the lat field.\");\n return false;\n }\n\n lat = parseFloat(document.frmConverter.txtLatitude.value);\n\n if ((lat < -90.0) || (90.0 < lat)) {\n alert(\"The latitude you entered is out of range. \" +\n \"Please enter a number in the range [-90, 90].\");\n return false;\n }\n\n // Compute the UTM zone.\n zone = Math.floor((lon + 180.0) / 6) + 1;\n\n zone = LatLonToUTMXY(DegToRad(lat), DegToRad(lon), zone, xy);\n\n /* Set the output controls. */\n document.frmConverter.txtX.value = xy[0];\n document.frmConverter.txtY.value = xy[1];\n document.frmConverter.txtZone.value = zone;\n if (lat < 0)\n // Set the S button.\n document.frmConverter.rbtnHemisphere[1].checked = true;\n else\n // Set the N button.\n document.frmConverter.rbtnHemisphere[0].checked = true;\n\n\n return true;\n}\n\n/*\n * btnToGeographic_OnClick\n *\n * Called when the btnToGeographic button is clicked.\n *\n */\nfunction btnToGeographic_OnClick() {\n latlon = new Array(2);\n var x, y, zone, southhemi;\n\n if (isNaN(parseFloat(document.frmConverter.txtX.value))) {\n alert(\"Please enter a valid easting in the x field.\");\n return false;\n }\n\n x = parseFloat(document.frmConverter.txtX.value);\n\n if (isNaN(parseFloat(document.frmConverter.txtY.value))) {\n alert(\"Please enter a valid northing in the y field.\");\n return false;\n }\n\n y = parseFloat(document.frmConverter.txtY.value);\n\n if (isNaN(parseInt(document.frmConverter.txtZone.value))) {\n alert(\"Please enter a valid UTM zone in the zone field.\");\n return false;\n }\n\n zone = parseFloat(document.frmConverter.txtZone.value);\n\n if ((zone < 1) || (60 < zone)) {\n alert(\"The UTM zone you entered is out of range. \" +\n \"Please enter a number in the range [1, 60].\");\n return false;\n }\n\n if (document.frmConverter.rbtnHemisphere[1].checked == true)\n southhemi = true;\n else\n southhemi = false;\n\n UTMXYToLatLon(x, y, zone, southhemi, latlon);\n\n document.frmConverter.txtLongitude.value = RadToDeg(latlon[1]);\n document.frmConverter.txtLatitude.value = RadToDeg(latlon[0]);\n\n return true;\n}\n\n\n/*\n * LatLonToUTMXY\n *\n * Converts a latitude/longitude pair to x and y coordinates in the\n * Universal Transverse Mercator projection.\n *\n * Inputs:\n * lat - Latitude of the point, in radians.\n * lon - Longitude of the point, in radians.\n * zone - UTM zone to be used for calculating values for x and y.\n * If zone is less than 1 or greater than 60, the routine\n * will determine the appropriate zone from the value of lon.\n *\n * Outputs:\n * xy - A 2-element array where the UTM x and y values will be stored.\n *\n * Returns:\n * The UTM zone used for calculating the values of x and y.\n *\n */\nfunction LatLonToUTMXY(lat, lon, zone, xy) {\n MapLatLonToXY(lat, lon, UTMCentralMeridian(zone), xy);\n\n /* Adjust easting and northing for UTM system. */\n xy[0] = xy[0] * UTMScaleFactor + 500000.0;\n xy[1] = xy[1] * UTMScaleFactor;\n if (xy[1] < 0.0)\n xy[1] = xy[1] + 10000000.0;\n\n return zone;\n}\n\n/*\n * UTMXYToLatLon\n *\n * Converts x and y coordinates in the Universal Transverse Mercator\n * projection to a latitude/longitude pair.\n *\n * Inputs:\n *\tx - The easting of the point, in meters.\n *\ty - The northing of the point, in meters.\n *\tzone - The UTM zone in which the point lies.\n *\tsouthhemi - True if the point is in the southern hemisphere;\n * false otherwise.\n *\n * Outputs:\n *\tlatlon - A 2-element array containing the latitude and\n * longitude of the point, in radians.\n *\n * Returns:\n *\tThe function does not return a value.\n *\n */\nfunction UTMXYToLatLon(x, y, zone, southhemi, latlon) {\n var cmeridian;\n\n x -= 500000.0;\n x /= UTMScaleFactor;\n\n /* If in southern hemisphere, adjust y accordingly. */\n if (southhemi)\n y -= 10000000.0;\n\n y /= UTMScaleFactor;\n\n cmeridian = UTMCentralMeridian(zone);\n MapXYToLatLon(x, y, cmeridian, latlon);\n\n return;\n}\n\n\nmodule.exports = {\n latLonToUtm: function (lat, lon, zone) {\n if (isNaN(lat)) {\n throw 'lat must be a number';\n }\n\n if (isNaN(lon)) {\n throw 'lon must be a number';\n }\n\n if (isNaN(zone)) {\n throw 'zome must be a number';\n }\n\n if (lat < -90 || lat > 90) {\n throw 'lat must be a number between -90 and 90';\n }\n\n if (lon < -180 || lon > 180) {\n throw 'lon must be a number between -180 and 180';\n }\n\n var xy = {};\n\n LatLonToUTMXY(DegToRad(lat), DegToRad(lon), zone, xy);\n\n return {x: Math.round(xy['0'] * 10) / 10, y: Math.round(xy['1'] * 10) / 10};\n },\n utmToLatLon: function (zone, hemisphere, x, y) {\n var latLng = {};\n\n var southernHemisphere;\n\n if (typeof hemisphere == 'string' || hemisphere instanceof String) {\n if (hemisphere.toLowerCase() === 's') {\n southernHemisphere = true;\n } else if (hemisphere.toLowerCase() === 'n') {\n southernHemisphere = false;\n } else {\n throw 'hemisphere should be either \\'s\\' or \\'n\\'';\n }\n }\n\n UTMXYToLatLon(x, y, zone, southernHemisphere, latLng);\n\n return {lat: Math.round(RadToDeg(latLng['0'] * 1e6)) / 1e6, lon: Math.round(RadToDeg(latLng['1'] * 1e6)) / 1e6};\n }\n}", "/*\n * priority-nav - v1.0.13 | (c) 2018 @gijsroge | MIT license\n * Repository: https://github.com/gijsroge/priority-navigation.git\n * Description: Priority+ pattern navigation that hides menu items if they don't fit on screen.\n * Demo: http://gijsroge.github.io/priority-nav.js/\n */\n(function (root, factory) {\n if (typeof define === \"function\" && define.amd) {\n define(\"priorityNav\", factory(root));\n } else if (typeof exports === \"object\") {\n module.exports = factory(root);\n } else {\n root.priorityNav = factory(root);\n }\n})(window || this, function (root) {\n\n \"use strict\";\n\n /**\n * Variables\n */\n var priorityNav = {}; // Object for public APIs\n var breaks = []; // Object to store instances with breakpoints where the instances menu item\"s didin\"t fit.\n var supports = !!document.querySelector && !!root.addEventListener; // Feature test\n var settings = {};\n var instance = 0;\n var count = 0;\n var mainNavWrapper, totalWidth, restWidth, mainNav, navDropdown, navDropdownToggle, dropDownWidth, toggleWrapper;\n var viewportWidth = 0;\n\n /**\n * Default settings\n * @type {{initClass: string, navDropdown: string, navDropdownToggle: string, mainNavWrapper: string, moved: Function, movedBack: Function}}\n */\n var defaults = {\n initClass: \"js-priorityNav\", // Class that will be printed on html element to allow conditional css styling.\n mainNavWrapper: \"nav\", // mainnav wrapper selector (must be direct parent from mainNav)\n mainNav: \"ul\", // mainnav selector. (must be inline-block)\n navDropdownClassName: \"nav__dropdown\", // class used for the dropdown.\n navDropdownToggleClassName: \"nav__dropdown-toggle\", // class used for the dropdown toggle.\n navDropdownLabel: \"more\", // Text that is used for the dropdown toggle.\n navDropdownBreakpointLabel: \"menu\", //button label for navDropdownToggle when the breakPoint is reached.\n breakPoint: 500, //amount of pixels when all menu items should be moved to dropdown to simulate a mobile menu\n throttleDelay: 50, // this will throttle the calculating logic on resize because i'm a responsible dev.\n offsetPixels: 0, // increase to decrease the time it takes to move an item.\n count: true, // prints the amount of items are moved to the attribute data-count to style with css counter.\n\n //Callbacks\n moved: function () {\n },\n movedBack: function () {\n }\n };\n\n\n /**\n * A simple forEach() implementation for Arrays, Objects and NodeLists\n * @private\n * @param {Array|Object|NodeList} collection Collection of items to iterate\n * @param {Function} callback Callback function for each iteration\n * @param {Array|Object|NodeList} scope Object/NodeList/Array that forEach is iterating over (aka `this`)\n */\n var forEach = function (collection, callback, scope) {\n if (Object.prototype.toString.call(collection) === \"[object Object]\") {\n for (var prop in collection) {\n if (Object.prototype.hasOwnProperty.call(collection, prop)) {\n callback.call(scope, collection[prop], prop, collection);\n }\n }\n } else {\n for (var i = 0, len = collection.length; i < len; i++) {\n callback.call(scope, collection[i], i, collection);\n }\n }\n };\n\n\n /**\n * Get the closest matching element up the DOM tree\n * @param {Element} elem Starting element\n * @param {String} selector Selector to match against (class, ID, or data attribute)\n * @return {Boolean|Element} Returns false if not match found\n */\n var getClosest = function (elem, selector) {\n var firstChar = selector.charAt(0);\n for (; elem && elem !== document; elem = elem.parentNode) {\n if (firstChar === \".\") {\n if (elem.classList.contains(selector.substr(1))) {\n return elem;\n }\n } else if (firstChar === \"#\") {\n if (elem.id === selector.substr(1)) {\n return elem;\n }\n } else if (firstChar === \"[\") {\n if (elem.hasAttribute(selector.substr(1, selector.length - 2))) {\n return elem;\n }\n }\n }\n return false;\n };\n\n\n /**\n * Merge defaults with user options\n * @private\n * @param {Object} defaults Default settings\n * @param {Object} options User options\n * @returns {Object} Merged values of defaults and options\n */\n var extend = function (defaults, options) {\n var extended = {};\n forEach(defaults, function (value, prop) {\n extended[prop] = defaults[prop];\n });\n forEach(options, function (value, prop) {\n extended[prop] = options[prop];\n });\n return extended;\n };\n\n\n /**\n * Debounced resize to throttle execution\n * @param func\n * @param wait\n * @param immediate\n * @returns {Function}\n */\n function debounce(func, wait, immediate) {\n var timeout;\n return function () {\n var context = this, args = arguments;\n var later = function () {\n timeout = null;\n if (!immediate) func.apply(context, args);\n };\n var callNow = immediate && !timeout;\n clearTimeout(timeout);\n timeout = setTimeout(later, wait);\n if (callNow) func.apply(context, args);\n };\n }\n\n\n /**\n * Toggle class on element\n * @param el\n * @param className\n */\n var toggleClass = function (el, className) {\n if (el.classList) {\n el.classList.toggle(className);\n } else {\n var classes = el.className.split(\" \");\n var existingIndex = classes.indexOf(className);\n\n if (existingIndex >= 0)\n classes.splice(existingIndex, 1); else\n classes.push(className);\n\n el.className = classes.join(\" \");\n }\n };\n\n\n /**\n * Check if dropdown menu is already on page before creating it\n * @param mainNavWrapper\n */\n var prepareHtml = function (_this, settings) {\n\n /**\n * Create dropdow menu\n * @type {HTMLElement}\n */\n toggleWrapper = document.createElement(\"span\");\n navDropdown = document.createElement(\"ul\");\n navDropdownToggle = document.createElement(\"button\");\n\n /**\n * Set label for dropdown toggle\n * @type {string}\n */\n navDropdownToggle.innerHTML = settings.navDropdownLabel;\n\n /**\n * Set aria attributes for accessibility\n */\n navDropdownToggle.setAttribute(\"aria-controls\", \"menu\");\n navDropdownToggle.setAttribute(\"type\", \"button\");\n navDropdown.setAttribute(\"aria-hidden\", \"true\");\n\n\n /**\n * Move elements to the right spot\n */\n if(_this.querySelector(mainNav).parentNode !== _this){\n console.warn(\"mainNav is not a direct child of mainNavWrapper, double check please\");\n return;\n }\n\n _this.insertAfter(toggleWrapper, _this.querySelector(mainNav));\n\n toggleWrapper.appendChild(navDropdownToggle);\n toggleWrapper.appendChild(navDropdown);\n\n /**\n * Add classes so we can target elements\n */\n navDropdown.classList.add(settings.navDropdownClassName);\n navDropdown.classList.add(\"priority-nav__dropdown\");\n\n navDropdownToggle.classList.add(settings.navDropdownToggleClassName);\n navDropdownToggle.classList.add(\"priority-nav__dropdown-toggle\");\n \n //fix so button is type=\"button\" and do not submit forms\n navDropdownToggle.setAttribute(\"type\", \"button\");\n\n toggleWrapper.classList.add(settings.navDropdownClassName+\"-wrapper\");\n toggleWrapper.classList.add(\"priority-nav__wrapper\");\n\n _this.classList.add(\"priority-nav\");\n };\n\n\n /**\n * Get innerwidth without padding\n * @param element\n * @returns {number}\n */\n var getElementContentWidth = function(element) {\n var styles = window.getComputedStyle(element);\n var padding = parseFloat(styles.paddingLeft) +\n parseFloat(styles.paddingRight);\n\n return element.clientWidth - padding;\n };\n\n\n /**\n * Get viewport size\n * @returns {{width: number, height: number}}\n */\n var viewportSize = function() {\n var doc = document, w = window;\n var docEl = (doc.compatMode && doc.compatMode === \"CSS1Compat\")?\n doc.documentElement: doc.body;\n\n var width = docEl.clientWidth;\n var height = docEl.clientHeight;\n\n // mobile zoomed in?\n if ( w.innerWidth && width > w.innerWidth ) {\n width = w.innerWidth;\n height = w.innerHeight;\n }\n\n return {width: width, height: height};\n };\n\n\n /**\n * Get width\n * @param elem\n * @returns {number}\n */\n var calculateWidths = function (_this) {\n totalWidth = getElementContentWidth(_this);\n //Check if parent is the navwrapper before calculating its width\n if (_this.querySelector(navDropdown).parentNode === _this) {\n dropDownWidth = _this.querySelector(navDropdown).offsetWidth;\n } else {\n dropDownWidth = 0;\n }\n restWidth = getChildrenWidth(_this) + settings.offsetPixels;\n viewportWidth = viewportSize().width;\n };\n\n\n /**\n * Move item to array\n * @param item\n */\n priorityNav.doesItFit = function (_this) {\n\n /**\n * Check if it is the first run\n */\n var delay = _this.getAttribute(\"instance\") === 0 ? delay : settings.throttleDelay;\n\n /**\n * Increase instance\n */\n instance++;\n\n /**\n * Debounced execution of the main logic\n */\n (debounce(function () {\n\n /**\n * Get the current element\"s instance\n * @type {string}\n */\n var identifier = _this.getAttribute(\"instance\");\n\n /**\n * Update width\n */\n calculateWidths(_this);\n\n /**\n * Keep executing until all menu items that are overflowing are moved\n */\n while (totalWidth <= restWidth && _this.querySelector(mainNav).children.length > 0 || viewportWidth < settings.breakPoint && _this.querySelector(mainNav).children.length > 0) {\n //move item to dropdown\n priorityNav.toDropdown(_this, identifier);\n //recalculate widths\n calculateWidths(_this, identifier);\n //update dropdownToggle label\n if(viewportWidth < settings.breakPoint) updateLabel(_this, identifier, settings.navDropdownBreakpointLabel);\n }\n\n /**\n * Keep executing until all menu items that are able to move back are moved\n */\n while (totalWidth >= breaks[identifier][breaks[identifier].length - 1] && viewportWidth > settings.breakPoint) {\n //move item to menu\n priorityNav.toMenu(_this, identifier);\n //update dropdownToggle label\n if(viewportWidth > settings.breakPoint) updateLabel(_this, identifier, settings.navDropdownLabel);\n }\n\n /**\n * If there are no items in dropdown hide dropdown\n */\n if (breaks[identifier].length < 1) {\n _this.querySelector(navDropdown).classList.remove(\"show\");\n //show navDropdownLabel\n updateLabel(_this, identifier, settings.navDropdownLabel);\n }\n\n /**\n * If there are no items in menu\n */\n if (_this.querySelector(mainNav).children.length < 1) {\n //show navDropdownBreakpointLabel\n _this.classList.add(\"is-empty\");\n updateLabel(_this, identifier, settings.navDropdownBreakpointLabel);\n }else{\n _this.classList.remove(\"is-empty\");\n }\n\n /**\n * Check if we need to show toggle menu button\n */\n showToggle(_this, identifier);\n\n }, delay ))();\n };\n\n\n /**\n * Show/hide toggle button\n */\n var showToggle = function (_this, identifier) {\n if (breaks[identifier].length < 1) {\n _this.querySelector(navDropdownToggle).classList.add(\"priority-nav-is-hidden\");\n _this.querySelector(navDropdownToggle).classList.remove(\"priority-nav-is-visible\");\n _this.classList.remove(\"priority-nav-has-dropdown\");\n\n /**\n * Set aria attributes for accessibility\n */\n _this.querySelector(\".priority-nav__wrapper\").setAttribute(\"aria-haspopup\", \"false\");\n\n } else {\n _this.querySelector(navDropdownToggle).classList.add(\"priority-nav-is-visible\");\n _this.querySelector(navDropdownToggle).classList.remove(\"priority-nav-is-hidden\");\n _this.classList.add(\"priority-nav-has-dropdown\");\n\n /**\n * Set aria attributes for accessibility\n */\n _this.querySelector(\".priority-nav__wrapper\").setAttribute(\"aria-haspopup\", \"true\");\n }\n };\n\n\n /**\n * Update count on dropdown toggle button\n */\n var updateCount = function (_this, identifier) {\n _this.querySelector(navDropdownToggle).setAttribute(\"priorityNav-count\", breaks[identifier].length);\n };\n\n var updateLabel = function(_this, identifier, label){\n _this.querySelector(navDropdownToggle).innerHTML = label;\n };\n\n\n /**\n * Move item to dropdown\n */\n priorityNav.toDropdown = function (_this, identifier) {\n\n\n /**\n * move last child of navigation menu to dropdown\n */\n if (_this.querySelector(navDropdown).firstChild && _this.querySelector(mainNav).children.length > 0) {\n _this.querySelector(navDropdown).insertBefore(_this.querySelector(mainNav).lastElementChild, _this.querySelector(navDropdown).firstChild);\n } else if (_this.querySelector(mainNav).children.length > 0) {\n _this.querySelector(navDropdown).appendChild(_this.querySelector(mainNav).lastElementChild);\n }\n\n /**\n * store breakpoints\n */\n breaks[identifier].push(restWidth);\n\n /**\n * check if we need to show toggle menu button\n */\n showToggle(_this, identifier);\n\n /**\n * update count on dropdown toggle button\n */\n if (_this.querySelector(mainNav).children.length > 0 && settings.count) {\n updateCount(_this, identifier);\n }\n\n /**\n * If item has been moved to dropdown trigger the callback\n */\n settings.moved();\n };\n\n\n /**\n * Move item to menu\n */\n priorityNav.toMenu = function (_this, identifier) {\n\n /**\n * move last child of navigation menu to dropdown\n */\n if (_this.querySelector(navDropdown).children.length > 0) _this.querySelector(mainNav).appendChild(_this.querySelector(navDropdown).firstElementChild);\n\n /**\n * remove last breakpoint\n */\n breaks[identifier].pop();\n\n /**\n * Check if we need to show toggle menu button\n */\n showToggle(_this, identifier);\n\n /**\n * update count on dropdown toggle button\n */\n if (_this.querySelector(mainNav).children.length > 0 && settings.count) {\n updateCount(_this, identifier);\n }\n\n /**\n * If item has been moved back to the main menu trigger the callback\n */\n settings.movedBack();\n };\n\n\n /**\n * Count width of children and return the value\n * @param e\n */\n var getChildrenWidth = function (e) {\n var children = e.childNodes;\n var sum = 0;\n for (var i = 0; i < children.length; i++) {\n if (children[i].nodeType !== 3) {\n if(!isNaN(children[i].offsetWidth)){\n sum += children[i].offsetWidth;\n }\n\n }\n }\n return sum;\n };\n\n\n\n /**\n * Bind eventlisteners\n */\n var listeners = function (_this, settings) {\n\n // Check if an item needs to move\n if(window.attachEvent) {\n window.attachEvent(\"onresize\", function() {\n if(priorityNav.doesItFit)priorityNav.doesItFit(_this);\n });\n }\n else if(window.addEventListener) {\n window.addEventListener(\"resize\", function() {\n if(priorityNav.doesItFit)priorityNav.doesItFit(_this);\n }, true);\n }\n\n // Toggle dropdown\n _this.querySelector(navDropdownToggle).addEventListener(\"click\", function () {\n toggleClass(_this.querySelector(navDropdown), \"show\");\n toggleClass(this, \"is-open\");\n toggleClass(_this, \"is-open\");\n\n /**\n * Toggle aria hidden for accessibility\n */\n if(-1 !== _this.className.indexOf( \"is-open\" )){\n _this.querySelector(navDropdown).setAttribute(\"aria-hidden\", \"false\");\n }else{\n _this.querySelector(navDropdown).setAttribute(\"aria-hidden\", \"true\");\n _this.querySelector(navDropdown).blur();\n }\n });\n\n /*\n * Remove when clicked outside dropdown\n */\n document.addEventListener(\"click\", function (event) {\n if (!getClosest(event.target, \".\"+settings.navDropdownClassName) && event.target !== _this.querySelector(navDropdownToggle)) {\n _this.querySelector(navDropdown).classList.remove(\"show\");\n _this.querySelector(navDropdownToggle).classList.remove(\"is-open\");\n _this.classList.remove(\"is-open\");\n }\n });\n\n /**\n * Remove when escape key is pressed\n */\n document.onkeydown = function (evt) {\n evt = evt || window.event;\n if (evt.keyCode === 27) {\n document.querySelector(navDropdown).classList.remove(\"show\");\n document.querySelector(navDropdownToggle).classList.remove(\"is-open\");\n mainNavWrapper.classList.remove(\"is-open\");\n }\n };\n };\n\n\n /**\n * Remove function\n */\n Element.prototype.remove = function() {\n this.parentElement.removeChild(this);\n };\n\n /*global HTMLCollection */\n NodeList.prototype.remove = HTMLCollection.prototype.remove = function() {\n for(var i = 0, len = this.length; i < len; i++) {\n if(this[i] && this[i].parentElement) {\n this[i].parentElement.removeChild(this[i]);\n }\n }\n };\n\n\n /**\n * Destroy the current initialization.\n * @public\n */\n priorityNav.destroy = function () {\n // If plugin isn\"t already initialized, stop\n if (!settings) return;\n // Remove feedback class\n document.documentElement.classList.remove(settings.initClass);\n // Remove toggle\n toggleWrapper.remove();\n // Remove settings\n settings = null;\n delete priorityNav.init;\n delete priorityNav.doesItFit;\n };\n\n\n /**\n * insertAfter function\n * @param n\n * @param r\n */\n if (supports && typeof Node !== \"undefined\"){\n Node.prototype.insertAfter = function(n,r) {this.insertBefore(n,r.nextSibling);};\n }\n\n var checkForSymbols = function(string){\n var firstChar = string.charAt(0);\n if (firstChar === \".\" || firstChar === \"#\") {\n return false;\n }else{\n return true;\n }\n };\n\n\n /**\n * Initialize Plugin\n * @public\n * @param {Object} options User settings\n */\n priorityNav.init = function (options) {\n\n /**\n * Merge user options with defaults\n * @type {Object}\n */\n settings = extend(defaults, options || {});\n\n // Feature test.\n if (!supports && typeof Node === \"undefined\"){\n console.warn(\"This browser doesn't support priorityNav\");\n return;\n }\n\n // Options check\n if (!checkForSymbols(settings.navDropdownClassName) || !checkForSymbols(settings.navDropdownToggleClassName)){\n console.warn(\"No symbols allowed in navDropdownClassName & navDropdownToggleClassName. These are not selectors.\");\n return;\n }\n\n /**\n * Store nodes\n * @type {NodeList}\n */\n var elements = document.querySelectorAll(settings.mainNavWrapper);\n\n /**\n * Loop over every instance and reference _this\n */\n forEach(elements, function(_this){\n\n /**\n * Create breaks array\n * @type {number}\n */\n breaks[count] = [];\n\n /**\n * Set the instance number as data attribute\n */\n _this.setAttribute(\"instance\", count++);\n\n /**\n * Store the wrapper element\n */\n mainNavWrapper = _this;\n if (!mainNavWrapper) {\n console.warn(\"couldn't find the specified mainNavWrapper element\");\n return;\n }\n\n /**\n * Store the menu elementStore the menu element\n */\n mainNav = settings.mainNav;\n if (!_this.querySelector(mainNav)) {\n console.warn(\"couldn't find the specified mainNav element\");\n return;\n }\n\n /**\n * Check if we need to create the dropdown elements\n */\n prepareHtml(_this, settings);\n\n /**\n * Store the dropdown element\n */\n navDropdown = \".\"+settings.navDropdownClassName;\n if (!_this.querySelector(navDropdown)) {\n console.warn(\"couldn't find the specified navDropdown element\");\n return;\n }\n\n /**\n * Store the dropdown toggle element\n */\n navDropdownToggle = \".\"+settings.navDropdownToggleClassName;\n if (!_this.querySelector(navDropdownToggle)) {\n console.warn(\"couldn't find the specified navDropdownToggle element\");\n return;\n }\n\n /**\n * Event listeners\n */\n listeners(_this, settings);\n\n /**\n * Start first check\n */\n priorityNav.doesItFit(_this);\n\n });\n\n /**\n * Count amount of instances\n */\n instance++;\n\n /**\n * Add class to HTML element to activate conditional CSS\n */\n document.documentElement.classList.add(settings.initClass);\n };\n\n\n /**\n * Public APIs\n */\n return priorityNav;\n\n});\n", "\r\nimport lazySizes from \"lazysizes\";\r\n\r\nimport \"./tabs\";\r\nimport \"./navDropdown\";\r\nimport \"./subnav\";\r\nimport \"./processSlide\";\r\nimport \"./pseudoElement\"\r\nimport \"./stickyNav\";\r\nimport \"./popupNav\";\r\nimport \"./accordion\";\r\nimport \"./calcHeightNav\";\r\nimport \"./rowWidth\";\r\nimport \"./modal\";\r\nimport \"./urgentMessage\";\r\nimport \"./areamap\";\r\nimport \"./connectionCalculator\";\r\nimport \"./tinySlider\";\r\n\r\nimport priorityNav from \"priority-nav\";\r\n\r\n// needed because prioritynav has a polyfill for this, but it's not working\r\nElement.prototype.remove = function () {\r\n if (this.parentElement) {\r\n this.parentElement.removeChild(this);\r\n }\r\n else if (this.parentNode) {\r\n this.parentNode.removeChild(this);\r\n }\r\n};\r\n\r\nconst mainNavToggle = document.querySelector(\".main-nav__toggle\")\r\nmainNavToggle.addEventListener(\"click\", () => {\r\n const html = document.querySelector(\".html\")\r\n if (html.classList.contains(\"html--lock\")) {\r\n html.classList.remove(\"html--lock\")\r\n } else {\r\n html.classList.add(\"html--lock\")\r\n }\r\n})\r\n\r\npriorityNav.init({\r\n mainNavWrapper: \"[data-priority-nav=\\\"wrapper\\\"]\",\r\n mainNav: \"[data-priority-nav=\\\"nav\\\"]\",\r\n navDropdownLabel: \"Mere\",\r\n navDropdownBreakpointLabel: \"☰\",\r\n navDropdownClassName: \"main-nav__dropdown\", // class used for the dropdown - this is a class name, not a selector.\r\n navDropdownToggleClassName: \"main-nav__dropdown-toggle\", // class used for the dropdown toggle - this is a class name, not a selector.\r\n breakPoint: 900,\r\n offsetPixels: 0, // increase to decrease the time it takes to move an item.\r\n throttleDelay: 200 // this will throttle the calculating logic on resize because i'm a responsible dev.\r\n});\r\n", "\uFEFFconst navDropdown = {\r\n init: function () {\r\n\r\n this.classToAdd = \"main-nav-visible\";\r\n\r\n this.rootElm = document.querySelector(\"html\");\r\n this.mainNavToggle = document.querySelector(\"[data-main-nav=\\\"toggle\\\"]\");\r\n\r\n if (this.mainNavToggle && this.rootElm) {\r\n this.mainNavToggle.addEventListener(\"click\", () => {\r\n this.rootElm.classList.toggle(this.classToAdd);\r\n });\r\n }\r\n\r\n\r\n // fjern class fra rootElm, hvis sk\u00E6rmen er st\u00F8rre end n\u00F8dvendigt\r\n this.mediaQuery = window.matchMedia(\"(min-width:992px)\");\r\n\r\n var removeClass = function (mq, rootElm, classToAdd) {\r\n // hvis media querien er true, rootElm findes, og har den \u00F8nskede class - s\u00E5 fjern class'en\r\n if (rootElm && rootElm.classList.contains(classToAdd) && mq.matches) {\r\n rootElm.classList.remove(classToAdd);\r\n }\r\n };\r\n\r\n this.mediaQuery.addListener((mq) => removeClass(mq, this.rootElm, this.classToAdd));\r\n removeClass(this.mediaQuery, this.rootElm, this.classToAdd);\r\n\r\n this.initSubNavs();\r\n },\r\n\r\n initSubNavs: function () {\r\n\r\n this.carets = document.querySelectorAll(\"[data-main-nav=\\\"toggle-sub-nav\\\"]\");\r\n if (!this.carets) return;\r\n\r\n window.addEventListener(\"click\", (event) => {\r\n\r\n // check if the target is inside a toggler\r\n if (!event.target.closest(\"[data-main-nav=\\\"toggle-sub-nav\\\"]\")) return;\r\n\r\n // find closest navItem (if any)\r\n let navItem = event.target.closest(\"[data-main-nav=\\\"parent\\\"]\");\r\n if (!navItem) return;\r\n\r\n navItem.classList.toggle(\"show\");\r\n\r\n let subNav = navItem.querySelector(\"[data-main-nav=\\\"sub-nav\\\"]\");\r\n if (subNav) {\r\n\r\n // move the subnav offscreen, and unset the maxheight to be able to calc the height\r\n subNav.style.position = \"absolute !important\";\r\n subNav.style.bottom = \"200vh !important\";\r\n subNav.style.maxHeight = \"none\";\r\n\r\n // set the max-height of the navItem.\r\n // calculate total desired height (if navItem has .show, include the subNavs height, else exclude)\r\n let totalHeight = navItem.offsetHeight + (navItem.classList.contains(\"show\") ? subNav.offsetHeight : -subNav.offsetHeight);\r\n\r\n // set max-height and transition-duration according to totalHeight\r\n navItem.style.setProperty(\"max-height\", totalHeight + \"px\");\r\n navItem.style.setProperty(\"transition-duration\", (totalHeight / 1000) + \"s\");\r\n\r\n // reset style changes to move the subnav back in the nav\r\n subNav.style.position = null;\r\n subNav.style.bottom = null;\r\n\r\n }\r\n\r\n\r\n\r\n });\r\n\r\n }\r\n};\r\n\r\nexport default navDropdown.init();\r\n", "\uFEFF\"use strict\";\r\n\r\nconst subNav = {\r\n init: function() {\r\n this.subNav = document.querySelector(\"#subnav\");\r\n\r\n if (this.subNav === null) {\r\n return;\r\n }\r\n\r\n this.subNavItem = this.subNav.querySelectorAll(\".subnav__list--item\");\r\n this.subNavList = this.subNav.querySelector(\"#subnav__list \");\r\n this.subNavIcon = this.subNav.querySelector(\"#subnav-icon\");\r\n\r\n this.events();\r\n },\r\n\r\n events: function() {\r\n this.subNav.addEventListener(\"click\", () => {\r\n this.toggleSubNav();\r\n });\r\n },\r\n\r\n toggleSubNav: function() {\r\n if (window.innerWidth < 992) {\r\n this.subNav.classList.toggle(\"show\");\r\n\r\n for (var x = 0; x < this.subNavItem.length; x++) {\r\n var subHeightCalc = this.subNavItem.length * 4.0625;\r\n }\r\n\r\n if (this.subNav.classList.contains(\"show\")) {\r\n this.subNav.style.height = subHeightCalc + \"rem\";\r\n } else {\r\n this.subNav.style.height = \"4.0625rem\";\r\n }\r\n }\r\n }\r\n};\r\n\r\nexport default subNav.init();\r\n", "\uFEFFconst slide = {\r\n init: function () {\r\n this.el = document.querySelector(\"#progress-slider\");\r\n\r\n if (this.el === null) return;\r\n\r\n this.slideProgress = this.el.querySelectorAll(\".progress-slider__number\");\r\n this.slideItem = this.el.querySelectorAll(\".slide__item\");\r\n this.slideButtons = this.el.querySelectorAll(\".slide__button\");\r\n this.prevButton = this.slideButtons[0]\r\n this.nextButton = this.slideButtons[1]\r\n\r\n this.index = 0;\r\n this.slideCount = this.slideItem.length\r\n this.n = this.slideCount - 1;\r\n\r\n this.events();\r\n },\r\n\r\n events: function () {\r\n for (let i = 0; i < this.slideButtons.length; i++) {\r\n this.slideButtons[i].addEventListener('click', e => this.onClick(e))\r\n }\r\n\r\n for (let i = 0; i < this.slideProgress.length; i++) {\r\n this.slideProgress[i].addEventListener('click', e => this.goTo(e))\r\n }\r\n },\r\n\r\n onClick: function (e) {\r\n let target = e.currentTarget;\r\n\r\n this.slideItem[this.index].classList.toggle(\"active\");\r\n this.slideProgress[this.index].classList.toggle(\"active\");\r\n\r\n if (this.slideProgress[this.index].nextElementSibling) {\r\n this.slideProgress[this.index].nextElementSibling.querySelector('.progress-bar').classList.toggle('active')\r\n }\r\n\r\n target.classList.contains('prev') ? this.prev() : this.next()\r\n\r\n this.slideItem[this.index].classList.toggle(\"active\");\r\n this.slideProgress[this.index].classList.toggle(\"active\");\r\n\r\n if (this.slideProgress[this.index].nextElementSibling) {\r\n this.slideProgress[this.index].nextElementSibling.querySelector('.progress-bar').classList.toggle('active')\r\n }\r\n \r\n this.updatePosition()\r\n this.disable()\r\n },\r\n\r\n goTo: function (e) {\r\n let target = e.currentTarget;\r\n let targetId = target.parentElement.getAttribute('data-id')\r\n let activeItem = this.el.querySelector('.slide__item.active')\r\n let activeProgress = this.el.querySelector('.progress-slider__number.active')\r\n\r\n this.index = parseFloat(targetId)\r\n\r\n this.slideItem[targetId].classList.toggle(\"active\");\r\n this.slideProgress[targetId].classList.toggle(\"active\");\r\n \r\n if (this.slideProgress[targetId].nextElementSibling) {\r\n this.slideProgress[targetId].nextElementSibling.querySelector('.progress-bar').classList.toggle('active')\r\n }\r\n \r\n activeItem.classList.toggle('active')\r\n activeProgress.classList.toggle('active')\r\n \r\n if (activeProgress.nextElementSibling) {\r\n activeProgress.nextElementSibling.querySelector('.progress-bar').classList.toggle('active')\r\n }\r\n \r\n this.updatePosition()\r\n this.disable()\r\n },\r\n\r\n prev: function () {\r\n if (this.index === 0) {\r\n this.index = this.n;\r\n }\r\n else {\r\n this.index = this.index - 1;\r\n }\r\n\r\n return this.index;\r\n },\r\n\r\n next: function () {\r\n if (this.index !== this.n) {\r\n this.index = this.index + 1;\r\n }\r\n else {\r\n this.index = 0;\r\n }\r\n \r\n return this.index;\r\n },\r\n\r\n timer: function (target, startIndex = 0, slideCount) {\r\n var timerInterval = 12000;\r\n var i = startIndex\r\n\r\n var timerFn = function () {\r\n if (i >= slideCount) {\r\n clearInterval(timerObj);\r\n } else {\r\n target.click()\r\n i++;\r\n }\r\n }\r\n\r\n var timerObj = setInterval(timerFn, timerInterval);\r\n\r\n this.reset = function (newIndex) {\r\n i = newIndex\r\n\r\n clearInterval(timerObj)\r\n timerObj = setInterval(timerFn, timerInterval);\r\n\r\n return this;\r\n }\r\n },\r\n\r\n updatePosition: function () {\r\n let processPosition = document.querySelector(\"[js-process-position]\")\r\n processPosition.textContent = this.index + 1\r\n },\r\n\r\n disable: function () {\r\n this.prevButton.removeAttribute('disabled')\r\n this.nextButton.removeAttribute('disabled')\r\n\r\n if (this.index === 0) {\r\n this.prevButton.setAttribute('disabled', 'disabled')\r\n this.nextButton.removeAttribute('disabled')\r\n\r\n // this.autoNext(this.nextButton, 1, this.n)\r\n }\r\n\r\n if (this.index === this.n) {\r\n this.nextButton.setAttribute('disabled', 'disabled')\r\n this.prevButton.removeAttribute('disabled')\r\n }\r\n }\r\n};\r\n\r\nexport default slide.init();\r\n", "\uFEFFconst pseudoElement = {\r\n init: function() {\r\n this.header = document.getElementById(\"header\")\r\n this.sticky = document.querySelector(\"#subnav\") === null ? document.getElementById(\"main-nav\") : document.getElementById(\"subnav\")\r\n this.elementHeight = this.sticky.offsetHeight;\r\n this.header.setAttribute(\"data-height\", this.elementHeight)\r\n\r\n this.pseudoElement = document.createElement(\"div\")\r\n this.pseudoElement.setAttribute(\"id\", \"pseudo\")\r\n this.pseudoElement.setAttribute(\"style\", `height: ${this.elementHeight}px`)\r\n this.header.append(this.pseudoElement)\r\n\r\n window.addEventListener(\"scroll\", () => {\r\n if (window.innerWidth > 991) {\r\n var elementTarget = 300;\r\n\r\n if (window.scrollY > elementTarget) {\r\n this.pseudoElement.style.position = \"static\";\r\n } else {\r\n this.pseudoElement.style.position = null;\r\n }\r\n }\r\n });\r\n },\r\n};\r\n\r\nexport default pseudoElement.init();\r\n", "\uFEFFconst stickyNav = {\r\n init: function() {\r\n this.mainDropdownBtn = document.getElementById(\"main-nav__btn\");\r\n\r\n //Main nav scroll sticky\r\n if (document.querySelector(\"#subnav\") == null) {\r\n window.addEventListener(\"scroll\", () => {\r\n if (window.innerWidth > 991) {\r\n this.scrollLogo = document.querySelector(\"#header__logo--scroll\");\r\n this.logo = document.querySelector(\"#header__logo\");\r\n this.sticky = document.getElementById(\"main-nav\");\r\n var changeLogo = 200;\r\n var elementTarget = 300;\r\n\r\n if (window.scrollY > changeLogo) {\r\n this.scrollLogo.style.display = \"flex\";\r\n this.logo.style.display = \"none\";\r\n } else {\r\n this.scrollLogo.style.display = \"none\";\r\n this.logo.style.display = \"flex\";\r\n }\r\n\r\n if (window.scrollY > elementTarget) {\r\n this.sticky.classList.add(\"navbar-fixed\");\r\n } else {\r\n this.sticky.classList.remove(\"navbar-fixed\");\r\n }\r\n }\r\n });\r\n } else {\r\n window.addEventListener(\"scroll\", () => {\r\n if (window.innerWidth > 991) {\r\n this.sticky = document.getElementById(\"subnav\");\r\n var elementTarget = 300;\r\n\r\n if (window.scrollY > elementTarget) {\r\n this.sticky.classList.add(\"navbar-fixed\");\r\n this.sticky.classList.add(\"scroll-show\");\r\n } else {\r\n this.sticky.classList.remove(\"navbar-fixed\");\r\n this.sticky.classList.remove(\"scroll-show\");\r\n }\r\n }\r\n });\r\n }\r\n\r\n this.events();\r\n },\r\n\r\n events: function () {\r\n if (this.mainDropdownBtn) {\r\n this.mainDropdownBtn.addEventListener(\"click\", () => {\r\n this.toggleClass();\r\n });\r\n }\r\n },\r\n\r\n toggleClass: function () {\r\n if (this.sticky) {\r\n this.sticky.classList.toggle(\"navbar-fixed\");\r\n }\r\n }\r\n};\r\n\r\nexport default stickyNav.init();\r\n", "\uFEFFconst popupNav = {\r\n init: function() {\r\n this.popupNav = document.getElementById(\"popup_nav\");\r\n this.popupTrigger = document.getElementsByClassName(\"popup-trigger\");\r\n this.notSelected = document.getElementById(\"popupTrigger\");\r\n\r\n this.events();\r\n },\r\n\r\n events: function() {\r\n if (this.popupNav != null) {\r\n\r\n window.addEventListener(\"mouseover\", e => {\r\n var target = e.target\r\n if (target.closest(\".header__buttons\") && !target.closest(\".header__buttons .button--transparent\")) {\r\n this.addClass();\r\n }\r\n else {\r\n this.removeClass();\r\n }\r\n })//,\r\n /*\r\n window.addEventListener(\"click\", e => {\r\n if (this.popupNav.classList.contains(\"show\")) {\r\n if (\r\n !this.popupNav.contains(e.target) &&\r\n !this.notSelected.contains(e.target)\r\n ) {\r\n this.removeClass();\r\n }\r\n }\r\n });\r\n \r\n for (var i = 0; i < this.popupTrigger.length; i++) {\r\n this.popupTrigger[i].addEventListener(\"click\", () => {\r\n this.toggleClass();\r\n });\r\n }\r\n */\r\n }\r\n },\r\n\r\n toggleClass: function() {\r\n this.popupNav.classList.toggle(\"show\");\r\n },\r\n\r\n addClass: function () {\r\n this.popupNav.classList.add(\"show\");\r\n },\r\n\r\n removeClass: function() {\r\n this.popupNav.classList.remove(\"show\");\r\n }\r\n};\r\n\r\nexport default popupNav.init();\r\n", "\uFEFFconst calcHeightNav = {\r\n init: function() {\r\n this.dropdownItem = document.getElementsByClassName(\"dropdown-icon\");\r\n this.mainDropdownBtn = document.getElementById(\"main-nav__btn\");\r\n this.mainNav = document.getElementById(\"main-nav__primary\");\r\n this.secondaryNav = document.getElementById(\"secondary-nav\");\r\n this.mainNavPos = document.getElementById(\"main-nav\");\r\n this.mainNavItem = document.querySelectorAll(\".main-nav__item\");\r\n\r\n this.events();\r\n },\r\n\r\n events: function() {\r\n for (let counter = 0; counter < this.dropdownItem.length; counter++) {\r\n this.dropdownItem[counter].classList.remove(\"active\");\r\n\r\n this.dropdownItem[counter].addEventListener(\"click\", () => {\r\n if (\r\n this.dropdownItem[counter].parentElement.classList.contains(\"active\")\r\n ) {\r\n this.dropdownItem[counter].parentElement.classList.remove(\"active\");\r\n } else {\r\n this.dropdownItem[counter].parentElement.classList.add(\"active\");\r\n }\r\n });\r\n }\r\n }\r\n};\r\n\r\nexport default calcHeightNav.init();\r\n", "\uFEFFconst rowWidth = {\r\n init: function() {\r\n this.smallCta = document.querySelectorAll(\r\n \".umbraco-forms-footer-cta-small\"\r\n );\r\n this.bigCta = document.querySelectorAll(\r\n \".umbraco-forms-bootstrap3-horizontal\"\r\n );\r\n\r\n this.events();\r\n },\r\n\r\n events: function() {\r\n for (var wCount = 0; wCount < this.smallCta.length; wCount++) {\r\n this.firstParent = this.smallCta[wCount].parentNode;\r\n this.parent = this.firstParent.parentNode;\r\n\r\n this.firstParent.style.margin = \"0\";\r\n this.parent.style.maxWidth = \"unset\";\r\n }\r\n\r\n for (var wCount = 0; wCount < this.bigCta.length; wCount++) {\r\n this.firstParent = this.bigCta[wCount].parentNode;\r\n this.parent = this.firstParent.parentNode;\r\n\r\n this.firstParent.style.margin = \"0\";\r\n this.parent.style.maxWidth = \"unset\";\r\n }\r\n }\r\n};\r\n\r\nexport default rowWidth.init();\r\n", "\uFEFF\"use strict\";\r\n\r\nconst urgentMessage = {\r\n init: function () {\r\n this.el = document.querySelector(\"[data-set-cookie]\");\r\n this.sub = document.querySelector(\".subnav\");\r\n this.html = document.querySelector(\".html\")\r\n\r\n if (this.el) {\r\n this.attribute = this.el.getAttribute(\"data-set-cookie\");\r\n this.name = this.attribute.split(\"=\")[0];\r\n this.version = this.attribute.split(\"=\")[1];\r\n\r\n this.events();\r\n }\r\n },\r\n\r\n events: function () {\r\n var self = this;\r\n\r\n this.el.addEventListener(\"click\", function () {\r\n document.getElementsByClassName(self.name).remove()\r\n\r\n self.setCookie();\r\n });\r\n },\r\n\r\n setCookie: function () { \r\n var self = this;\r\n\r\n document.cookie = self.attribute + \"; expires=\" + new Date(new Date().getFullYear() + 1, 1, 1).toUTCString() + \"; path=/\";\r\n }\r\n\r\n};\r\n\r\nexport default urgentMessage.init();\r\n", "\uFEFF\"use strict\";\r\n\r\nimport GoogleMapsLoader from \"google-maps\";\r\nimport * as dawaAutocomplete2 from 'dawa-autocomplete2';\r\nconst utmgeoconv = require(\"utmgeoconv\");\r\n\r\nconst areaMap = {\r\n\r\n areas: [],\r\n\r\n setAreas: function () {\r\n\r\n this.areas = [...document.querySelectorAll(\"[data-area-map='container']\")].map(domArea => this.initArea(domArea));\r\n },\r\n\r\n initArea: function (areaDom) {\r\n let area = {\r\n container: areaDom,\r\n areaListId: areaDom.dataset.areaListId,\r\n map: areaDom.querySelector(\"[data-area-map='map']\"),\r\n form: areaDom.querySelector(\"form[data-area-map='form']\"),\r\n addressInput: areaDom.querySelector(\"input[data-area-map='address-input']\"),\r\n addresSearchBtn: areaDom.querySelector(\"button[data-area-map='address-search-btn']\"),\r\n result: areaDom.querySelector(\"[data-area-map='result']\"),\r\n streetViewContainer: areaDom.querySelector(\"[data-area-map='streetview-container']\"),\r\n streetViewImg: areaDom.querySelector(\"img[data-area-map='streetview']\"),\r\n statuses: {\r\n \"-1\": [...areaDom.querySelectorAll(\"[data-area-map='status--1']\")],\r\n \"0\": [...areaDom.querySelectorAll(\"[data-area-map='status-0']\")],\r\n \"1\": [...areaDom.querySelectorAll(\"[data-area-map='status-1']\")],\r\n \"2\": [...areaDom.querySelectorAll(\"[data-area-map='status-2']\")],\r\n \"3\": [...areaDom.querySelectorAll(\"[data-area-map='status-3']\")]\r\n },\r\n address: areaDom.querySelector(\"[data-area-map='address']\"),\r\n callToAction: areaDom.querySelector(\"[data-area-map='callToAction']\"),\r\n };\r\n\r\n setTimeout(function () {\r\n var mapWrapper = document.body.querySelector(\"[data-area-map='map']\");\r\n if (mapWrapper.querySelector(\"iframe\"))\r\n {\r\n mapWrapper.querySelector(\"iframe\").setAttribute(\"title\", \"Se om du kan tilsluttes fjernvarme\");\r\n mapWrapper.querySelector(\"iframe\").removeAttribute(\"frameborder\");\r\n }\r\n }, 250);\r\n\r\n area.statuses.all = [...area.statuses[\"-1\"], ...area.statuses[\"0\"], ...area.statuses[\"1\"], ...area.statuses[\"2\"], ...area.statuses[\"3\"]];\r\n\r\n return area;\r\n },\r\n\r\n initMaps: function () {\r\n\r\n GoogleMapsLoader.KEY = \"AIzaSyCnkJGT0HnNnWNN1HBvOR8tyjypeXlz1no\";\r\n GoogleMapsLoader.VERSION = \"3.56\";\r\n\r\n this.areas.map(area => {\r\n\r\n if (area.map) {\r\n GoogleMapsLoader.load(function (google) {\r\n area.googleMap = new google.maps.Map(area.map, {\r\n center: { lat: 55.426835, lng: 9.727015 },\r\n zoom: 8,\r\n disableDefaultUI: true,\r\n styles: [\r\n {\r\n \"featureType\": \"administrative\",\r\n \"elementType\": \"geometry\",\r\n \"stylers\": [\r\n {\r\n \"visibility\": \"off\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"administrative.country\",\r\n \"elementType\": \"labels.icon\",\r\n \"stylers\": [\r\n {\r\n \"visibility\": \"off\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"administrative.country\",\r\n \"elementType\": \"labels.text\",\r\n \"stylers\": [\r\n {\r\n \"visibility\": \"off\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"administrative.land_parcel\",\r\n \"stylers\": [\r\n {\r\n \"visibility\": \"off\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"administrative.neighborhood\",\r\n \"stylers\": [\r\n {\r\n \"visibility\": \"off\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"administrative.province\",\r\n \"elementType\": \"labels.icon\",\r\n \"stylers\": [\r\n {\r\n \"visibility\": \"off\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"administrative.province\",\r\n \"elementType\": \"labels.text\",\r\n \"stylers\": [\r\n {\r\n \"visibility\": \"off\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"poi\",\r\n \"stylers\": [\r\n {\r\n \"visibility\": \"off\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"poi\",\r\n \"elementType\": \"geometry.fill\",\r\n \"stylers\": [\r\n {\r\n \"visibility\": \"off\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"poi\",\r\n \"elementType\": \"labels.text\",\r\n \"stylers\": [\r\n {\r\n \"visibility\": \"off\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"road\",\r\n \"elementType\": \"labels\",\r\n \"stylers\": [\r\n {\r\n \"visibility\": \"off\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"road\",\r\n \"elementType\": \"labels.icon\",\r\n \"stylers\": [\r\n {\r\n \"visibility\": \"off\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"transit\",\r\n \"stylers\": [\r\n {\r\n \"visibility\": \"off\"\r\n }\r\n ]\r\n },\r\n {\r\n \"featureType\": \"water\",\r\n \"elementType\": \"labels.text\",\r\n \"stylers\": [\r\n {\r\n \"visibility\": \"off\"\r\n }\r\n ]\r\n }\r\n ]\r\n });\r\n\r\n var bounds = new google.maps.LatLngBounds();\r\n bounds.extend(new google.maps.LatLng(55.665038, 8.440598));\r\n bounds.extend(new google.maps.LatLng(54.917089, 11.102005));\r\n area.googleMap.fitBounds(bounds);\r\n });\r\n }\r\n\r\n });\r\n },\r\n\r\n initSearch: function () {\r\n this.areas.map(area => {\r\n if (area.addressInput) {\r\n dawaAutocomplete2.dawaAutocomplete(area.addressInput, {\r\n select: selected => {\r\n\r\n area.selected = selected;\r\n this.getCoordinatesBySelected(area);\r\n }\r\n });\r\n }\r\n\r\n if (area.form) {\r\n area.form.addEventListener(\"submit\", (event) => {\r\n event.preventDefault();\r\n });\r\n }\r\n });\r\n\r\n },\r\n\r\n getCoordinatesBySelected: function (area) {\r\n\r\n if (area.selected) {\r\n\r\n fetch(\"https://dawa.aws.dk/adgangsadresser?vejnavn=\" + area.selected.data.vejnavn + \"&husnr=\" + area.selected.data.husnr + \"&postnr=\" + area.selected.data.postnr + \"&struktur=mini\", {\r\n method: \"GET\",\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n }\r\n })\r\n .then(response => response.json())\r\n .then(json => {\r\n\r\n if (json[0]) {\r\n\r\n area.selectedItem = json[0];\r\n this.moveMapToPosition(area);\r\n this.calculateUtm32Coords(area);\r\n this.searchInGis(area, 0);\r\n }\r\n\r\n });\r\n\r\n }\r\n\r\n },\r\n\r\n\r\n moveMapToPosition: function (area) {\r\n\r\n if (area.selectedItem && area.googleMap) {\r\n\r\n let latLng = { lat: area.selectedItem.y, lng: area.selectedItem.x };\r\n\r\n new google.maps.Marker({\r\n position: latLng,\r\n map: area.googleMap,\r\n title: area.selectedItem.vejnavn + \" \" + area.selectedItem.husnr + \", \" + area.selectedItem.postnr + \" \" + area.selectedItem.postnrnavn\r\n });\r\n\r\n area.googleMap.setZoom(16);\r\n area.googleMap.panTo(latLng);\r\n }\r\n },\r\n\r\n calculateUtm32Coords: function (area) {\r\n if (area && area.selectedItem) {\r\n area.utm32Coords = utmgeoconv.latLonToUtm(area.selectedItem.y, area.selectedItem.x, 32);\r\n }\r\n },\r\n\r\n searchInGis: function (area, layer) {\r\n\r\n if (!area || !area.selectedItem) { return; }\r\n if (!area.utm32Coords) { this.calculateUtm32Coords(area); }\r\n\r\n var params = {\r\n x: area.utm32Coords.x,\r\n y: area.utm32Coords.y,\r\n vejkode: area.selectedItem.vejkode,\r\n husnr: area.selectedItem.husnr,\r\n listId: area.areaListId\r\n };\r\n\r\n var url = \"/umbraco/api/AreaMap/GetStatus?\" + Object.keys(params).map(key => encodeURIComponent(key) + '=' + encodeURIComponent(params[key])).join('&');\r\n\r\n fetch(url, {\r\n method: \"GET\",\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n }\r\n })\r\n .then(response => response.json())\r\n .then(json => {\r\n this.setAndShowResult(area, json);\r\n });\r\n\r\n },\r\n\r\n\r\n\r\n setAndShowResult: function (area, gisStatus) {\r\n if (area.result && gisStatus) {\r\n var address = area.selectedItem.vejnavn + \" \" + area.selectedItem.husnr;\r\n\r\n if (area.streetViewImg) {\r\n area.streetViewImg.src = \"/umbraco/api/AreaMap/GetStreetView/?location=\" + encodeURIComponent(address + \", \" + area.selectedItem.postnr + \" \" + area.selectedItem.postnrnavn);\r\n }\r\n if (area.address) {\r\n area.address.innerText = address;\r\n }\r\n\r\n var status = gisStatus.status.toString();\r\n\r\n area.statuses.all.map(s => s.classList.add(\"hidden!\"));\r\n area.statuses[status].map(s => s.classList.remove(\"hidden!\"));\r\n console.log(gisStatus);\r\n\r\n if (status == \"2\") {\r\n area.statuses[\"2\"].filter(s => s.dataset.areaMapCalltoaction !== undefined).map(s => s.setAttribute(\"href\", gisStatus.nextStepLink));\r\n }\r\n area.addressInput.blur();\r\n area.result.classList.remove(\"hidden\");\r\n }\r\n },\r\n\r\n hideResult: function (area) {\r\n if (area.result) {\r\n area.result.classList.add(\"hidden\");\r\n }\r\n },\r\n\r\n init: function () {\r\n\r\n this.setAreas();\r\n this.initMaps();\r\n this.initSearch();\r\n }\r\n};\r\n\r\nexport default areaMap.init();\r\n", "var commonjsGlobal = typeof globalThis !== 'undefined' ? globalThis : typeof window !== 'undefined' ? window : typeof global !== 'undefined' ? global : typeof self !== 'undefined' ? self : {};\n\nfunction unwrapExports (x) {\n\treturn x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;\n}\n\nfunction createCommonjsModule(fn, module) {\n\treturn module = { exports: {} }, fn(module, module.exports), module.exports;\n}\n\nvar _global = createCommonjsModule(function (module) {\n// https://github.com/zloirock/core-js/issues/86#issuecomment-115759028\nvar global = module.exports = typeof window != 'undefined' && window.Math == Math\n ? window : typeof self != 'undefined' && self.Math == Math ? self\n // eslint-disable-next-line no-new-func\n : Function('return this')();\nif (typeof __g == 'number') __g = global; // eslint-disable-line no-undef\n});\n\nvar _core = createCommonjsModule(function (module) {\nvar core = module.exports = { version: '2.6.12' };\nif (typeof __e == 'number') __e = core; // eslint-disable-line no-undef\n});\nvar _core_1 = _core.version;\n\nvar _isObject = function (it) {\n return typeof it === 'object' ? it !== null : typeof it === 'function';\n};\n\nvar _anObject = function (it) {\n if (!_isObject(it)) throw TypeError(it + ' is not an object!');\n return it;\n};\n\nvar _fails = function (exec) {\n try {\n return !!exec();\n } catch (e) {\n return true;\n }\n};\n\n// Thank's IE8 for his funny defineProperty\nvar _descriptors = !_fails(function () {\n return Object.defineProperty({}, 'a', { get: function () { return 7; } }).a != 7;\n});\n\nvar document$1 = _global.document;\n// typeof document.createElement is 'object' in old IE\nvar is = _isObject(document$1) && _isObject(document$1.createElement);\nvar _domCreate = function (it) {\n return is ? document$1.createElement(it) : {};\n};\n\nvar _ie8DomDefine = !_descriptors && !_fails(function () {\n return Object.defineProperty(_domCreate('div'), 'a', { get: function () { return 7; } }).a != 7;\n});\n\n// 7.1.1 ToPrimitive(input [, PreferredType])\n\n// instead of the ES6 spec version, we didn't implement @@toPrimitive case\n// and the second argument - flag - preferred type is a string\nvar _toPrimitive = function (it, S) {\n if (!_isObject(it)) return it;\n var fn, val;\n if (S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;\n if (typeof (fn = it.valueOf) == 'function' && !_isObject(val = fn.call(it))) return val;\n if (!S && typeof (fn = it.toString) == 'function' && !_isObject(val = fn.call(it))) return val;\n throw TypeError(\"Can't convert object to primitive value\");\n};\n\nvar dP = Object.defineProperty;\n\nvar f = _descriptors ? Object.defineProperty : function defineProperty(O, P, Attributes) {\n _anObject(O);\n P = _toPrimitive(P, true);\n _anObject(Attributes);\n if (_ie8DomDefine) try {\n return dP(O, P, Attributes);\n } catch (e) { /* empty */ }\n if ('get' in Attributes || 'set' in Attributes) throw TypeError('Accessors not supported!');\n if ('value' in Attributes) O[P] = Attributes.value;\n return O;\n};\n\nvar _objectDp = {\n\tf: f\n};\n\nvar _propertyDesc = function (bitmap, value) {\n return {\n enumerable: !(bitmap & 1),\n configurable: !(bitmap & 2),\n writable: !(bitmap & 4),\n value: value\n };\n};\n\nvar _hide = _descriptors ? function (object, key, value) {\n return _objectDp.f(object, key, _propertyDesc(1, value));\n} : function (object, key, value) {\n object[key] = value;\n return object;\n};\n\nvar hasOwnProperty = {}.hasOwnProperty;\nvar _has = function (it, key) {\n return hasOwnProperty.call(it, key);\n};\n\nvar id = 0;\nvar px = Math.random();\nvar _uid = function (key) {\n return 'Symbol('.concat(key === undefined ? '' : key, ')_', (++id + px).toString(36));\n};\n\nvar _shared = createCommonjsModule(function (module) {\nvar SHARED = '__core-js_shared__';\nvar store = _global[SHARED] || (_global[SHARED] = {});\n\n(module.exports = function (key, value) {\n return store[key] || (store[key] = value !== undefined ? value : {});\n})('versions', []).push({\n version: _core.version,\n mode: 'global',\n copyright: '\u00A9 2020 Denis Pushkarev (zloirock.ru)'\n});\n});\n\nvar _functionToString = _shared('native-function-to-string', Function.toString);\n\nvar _redefine = createCommonjsModule(function (module) {\nvar SRC = _uid('src');\n\nvar TO_STRING = 'toString';\nvar TPL = ('' + _functionToString).split(TO_STRING);\n\n_core.inspectSource = function (it) {\n return _functionToString.call(it);\n};\n\n(module.exports = function (O, key, val, safe) {\n var isFunction = typeof val == 'function';\n if (isFunction) _has(val, 'name') || _hide(val, 'name', key);\n if (O[key] === val) return;\n if (isFunction) _has(val, SRC) || _hide(val, SRC, O[key] ? '' + O[key] : TPL.join(String(key)));\n if (O === _global) {\n O[key] = val;\n } else if (!safe) {\n delete O[key];\n _hide(O, key, val);\n } else if (O[key]) {\n O[key] = val;\n } else {\n _hide(O, key, val);\n }\n// add fake Function#toString for correct work wrapped methods / constructors with methods like LoDash isNative\n})(Function.prototype, TO_STRING, function toString() {\n return typeof this == 'function' && this[SRC] || _functionToString.call(this);\n});\n});\n\nvar _aFunction = function (it) {\n if (typeof it != 'function') throw TypeError(it + ' is not a function!');\n return it;\n};\n\n// optional / simple context binding\n\nvar _ctx = function (fn, that, length) {\n _aFunction(fn);\n if (that === undefined) return fn;\n switch (length) {\n case 1: return function (a) {\n return fn.call(that, a);\n };\n case 2: return function (a, b) {\n return fn.call(that, a, b);\n };\n case 3: return function (a, b, c) {\n return fn.call(that, a, b, c);\n };\n }\n return function (/* ...args */) {\n return fn.apply(that, arguments);\n };\n};\n\nvar PROTOTYPE = 'prototype';\n\nvar $export = function (type, name, source) {\n var IS_FORCED = type & $export.F;\n var IS_GLOBAL = type & $export.G;\n var IS_STATIC = type & $export.S;\n var IS_PROTO = type & $export.P;\n var IS_BIND = type & $export.B;\n var target = IS_GLOBAL ? _global : IS_STATIC ? _global[name] || (_global[name] = {}) : (_global[name] || {})[PROTOTYPE];\n var exports = IS_GLOBAL ? _core : _core[name] || (_core[name] = {});\n var expProto = exports[PROTOTYPE] || (exports[PROTOTYPE] = {});\n var key, own, out, exp;\n if (IS_GLOBAL) source = name;\n for (key in source) {\n // contains in native\n own = !IS_FORCED && target && target[key] !== undefined;\n // export native or passed\n out = (own ? target : source)[key];\n // bind timers to global for call from export context\n exp = IS_BIND && own ? _ctx(out, _global) : IS_PROTO && typeof out == 'function' ? _ctx(Function.call, out) : out;\n // extend global\n if (target) _redefine(target, key, out, type & $export.U);\n // export\n if (exports[key] != out) _hide(exports, key, exp);\n if (IS_PROTO && expProto[key] != out) expProto[key] = out;\n }\n};\n_global.core = _core;\n// type bitmap\n$export.F = 1; // forced\n$export.G = 2; // global\n$export.S = 4; // static\n$export.P = 8; // proto\n$export.B = 16; // bind\n$export.W = 32; // wrap\n$export.U = 64; // safe\n$export.R = 128; // real proto method for `library`\nvar _export = $export;\n\nvar toString = {}.toString;\n\nvar _cof = function (it) {\n return toString.call(it).slice(8, -1);\n};\n\n// fallback for non-array-like ES3 and non-enumerable old V8 strings\n\n// eslint-disable-next-line no-prototype-builtins\nvar _iobject = Object('z').propertyIsEnumerable(0) ? Object : function (it) {\n return _cof(it) == 'String' ? it.split('') : Object(it);\n};\n\n// 7.2.1 RequireObjectCoercible(argument)\nvar _defined = function (it) {\n if (it == undefined) throw TypeError(\"Can't call method on \" + it);\n return it;\n};\n\n// to indexed object, toObject with fallback for non-array-like ES3 strings\n\n\nvar _toIobject = function (it) {\n return _iobject(_defined(it));\n};\n\n// 7.1.4 ToInteger\nvar ceil = Math.ceil;\nvar floor = Math.floor;\nvar _toInteger = function (it) {\n return isNaN(it = +it) ? 0 : (it > 0 ? floor : ceil)(it);\n};\n\n// 7.1.15 ToLength\n\nvar min = Math.min;\nvar _toLength = function (it) {\n return it > 0 ? min(_toInteger(it), 0x1fffffffffffff) : 0; // pow(2, 53) - 1 == 9007199254740991\n};\n\nvar max = Math.max;\nvar min$1 = Math.min;\nvar _toAbsoluteIndex = function (index, length) {\n index = _toInteger(index);\n return index < 0 ? max(index + length, 0) : min$1(index, length);\n};\n\n// false -> Array#indexOf\n// true -> Array#includes\n\n\n\nvar _arrayIncludes = function (IS_INCLUDES) {\n return function ($this, el, fromIndex) {\n var O = _toIobject($this);\n var length = _toLength(O.length);\n var index = _toAbsoluteIndex(fromIndex, length);\n var value;\n // Array#includes uses SameValueZero equality algorithm\n // eslint-disable-next-line no-self-compare\n if (IS_INCLUDES && el != el) while (length > index) {\n value = O[index++];\n // eslint-disable-next-line no-self-compare\n if (value != value) return true;\n // Array#indexOf ignores holes, Array#includes - not\n } else for (;length > index; index++) if (IS_INCLUDES || index in O) {\n if (O[index] === el) return IS_INCLUDES || index || 0;\n } return !IS_INCLUDES && -1;\n };\n};\n\nvar shared = _shared('keys');\n\nvar _sharedKey = function (key) {\n return shared[key] || (shared[key] = _uid(key));\n};\n\nvar arrayIndexOf = _arrayIncludes(false);\nvar IE_PROTO = _sharedKey('IE_PROTO');\n\nvar _objectKeysInternal = function (object, names) {\n var O = _toIobject(object);\n var i = 0;\n var result = [];\n var key;\n for (key in O) if (key != IE_PROTO) _has(O, key) && result.push(key);\n // Don't enum bug & hidden keys\n while (names.length > i) if (_has(O, key = names[i++])) {\n ~arrayIndexOf(result, key) || result.push(key);\n }\n return result;\n};\n\n// IE 8- don't enum bug keys\nvar _enumBugKeys = (\n 'constructor,hasOwnProperty,isPrototypeOf,propertyIsEnumerable,toLocaleString,toString,valueOf'\n).split(',');\n\n// 19.1.2.14 / 15.2.3.14 Object.keys(O)\n\n\n\nvar _objectKeys = Object.keys || function keys(O) {\n return _objectKeysInternal(O, _enumBugKeys);\n};\n\nvar f$1 = Object.getOwnPropertySymbols;\n\nvar _objectGops = {\n\tf: f$1\n};\n\nvar f$2 = {}.propertyIsEnumerable;\n\nvar _objectPie = {\n\tf: f$2\n};\n\n// 7.1.13 ToObject(argument)\n\nvar _toObject = function (it) {\n return Object(_defined(it));\n};\n\n// 19.1.2.1 Object.assign(target, source, ...)\n\n\n\n\n\n\nvar $assign = Object.assign;\n\n// should work with symbols and should have deterministic property order (V8 bug)\nvar _objectAssign = !$assign || _fails(function () {\n var A = {};\n var B = {};\n // eslint-disable-next-line no-undef\n var S = Symbol();\n var K = 'abcdefghijklmnopqrst';\n A[S] = 7;\n K.split('').forEach(function (k) { B[k] = k; });\n return $assign({}, A)[S] != 7 || Object.keys($assign({}, B)).join('') != K;\n}) ? function assign(target, source) { // eslint-disable-line no-unused-vars\n var T = _toObject(target);\n var aLen = arguments.length;\n var index = 1;\n var getSymbols = _objectGops.f;\n var isEnum = _objectPie.f;\n while (aLen > index) {\n var S = _iobject(arguments[index++]);\n var keys = getSymbols ? _objectKeys(S).concat(getSymbols(S)) : _objectKeys(S);\n var length = keys.length;\n var j = 0;\n var key;\n while (length > j) {\n key = keys[j++];\n if (!_descriptors || isEnum.call(S, key)) T[key] = S[key];\n }\n } return T;\n} : $assign;\n\n// 19.1.3.1 Object.assign(target, source)\n\n\n_export(_export.S + _export.F, 'Object', { assign: _objectAssign });\n\nvar _wks = createCommonjsModule(function (module) {\nvar store = _shared('wks');\n\nvar Symbol = _global.Symbol;\nvar USE_SYMBOL = typeof Symbol == 'function';\n\nvar $exports = module.exports = function (name) {\n return store[name] || (store[name] =\n USE_SYMBOL && Symbol[name] || (USE_SYMBOL ? Symbol : _uid)('Symbol.' + name));\n};\n\n$exports.store = store;\n});\n\n// 7.2.8 IsRegExp(argument)\n\n\nvar MATCH = _wks('match');\nvar _isRegexp = function (it) {\n var isRegExp;\n return _isObject(it) && ((isRegExp = it[MATCH]) !== undefined ? !!isRegExp : _cof(it) == 'RegExp');\n};\n\n// 7.3.20 SpeciesConstructor(O, defaultConstructor)\n\n\nvar SPECIES = _wks('species');\nvar _speciesConstructor = function (O, D) {\n var C = _anObject(O).constructor;\n var S;\n return C === undefined || (S = _anObject(C)[SPECIES]) == undefined ? D : _aFunction(S);\n};\n\n// true -> String#at\n// false -> String#codePointAt\nvar _stringAt = function (TO_STRING) {\n return function (that, pos) {\n var s = String(_defined(that));\n var i = _toInteger(pos);\n var l = s.length;\n var a, b;\n if (i < 0 || i >= l) return TO_STRING ? '' : undefined;\n a = s.charCodeAt(i);\n return a < 0xd800 || a > 0xdbff || i + 1 === l || (b = s.charCodeAt(i + 1)) < 0xdc00 || b > 0xdfff\n ? TO_STRING ? s.charAt(i) : a\n : TO_STRING ? s.slice(i, i + 2) : (a - 0xd800 << 10) + (b - 0xdc00) + 0x10000;\n };\n};\n\nvar at = _stringAt(true);\n\n // `AdvanceStringIndex` abstract operation\n// https://tc39.github.io/ecma262/#sec-advancestringindex\nvar _advanceStringIndex = function (S, index, unicode) {\n return index + (unicode ? at(S, index).length : 1);\n};\n\n// getting tag from 19.1.3.6 Object.prototype.toString()\n\nvar TAG = _wks('toStringTag');\n// ES3 wrong here\nvar ARG = _cof(function () { return arguments; }()) == 'Arguments';\n\n// fallback for IE11 Script Access Denied error\nvar tryGet = function (it, key) {\n try {\n return it[key];\n } catch (e) { /* empty */ }\n};\n\nvar _classof = function (it) {\n var O, T, B;\n return it === undefined ? 'Undefined' : it === null ? 'Null'\n // @@toStringTag case\n : typeof (T = tryGet(O = Object(it), TAG)) == 'string' ? T\n // builtinTag case\n : ARG ? _cof(O)\n // ES3 arguments fallback\n : (B = _cof(O)) == 'Object' && typeof O.callee == 'function' ? 'Arguments' : B;\n};\n\nvar builtinExec = RegExp.prototype.exec;\n\n // `RegExpExec` abstract operation\n// https://tc39.github.io/ecma262/#sec-regexpexec\nvar _regexpExecAbstract = function (R, S) {\n var exec = R.exec;\n if (typeof exec === 'function') {\n var result = exec.call(R, S);\n if (typeof result !== 'object') {\n throw new TypeError('RegExp exec method returned something other than an Object or null');\n }\n return result;\n }\n if (_classof(R) !== 'RegExp') {\n throw new TypeError('RegExp#exec called on incompatible receiver');\n }\n return builtinExec.call(R, S);\n};\n\n// 21.2.5.3 get RegExp.prototype.flags\n\nvar _flags = function () {\n var that = _anObject(this);\n var result = '';\n if (that.global) result += 'g';\n if (that.ignoreCase) result += 'i';\n if (that.multiline) result += 'm';\n if (that.unicode) result += 'u';\n if (that.sticky) result += 'y';\n return result;\n};\n\nvar nativeExec = RegExp.prototype.exec;\n// This always refers to the native implementation, because the\n// String#replace polyfill uses ./fix-regexp-well-known-symbol-logic.js,\n// which loads this file before patching the method.\nvar nativeReplace = String.prototype.replace;\n\nvar patchedExec = nativeExec;\n\nvar LAST_INDEX = 'lastIndex';\n\nvar UPDATES_LAST_INDEX_WRONG = (function () {\n var re1 = /a/,\n re2 = /b*/g;\n nativeExec.call(re1, 'a');\n nativeExec.call(re2, 'a');\n return re1[LAST_INDEX] !== 0 || re2[LAST_INDEX] !== 0;\n})();\n\n// nonparticipating capturing group, copied from es5-shim's String#split patch.\nvar NPCG_INCLUDED = /()??/.exec('')[1] !== undefined;\n\nvar PATCH = UPDATES_LAST_INDEX_WRONG || NPCG_INCLUDED;\n\nif (PATCH) {\n patchedExec = function exec(str) {\n var re = this;\n var lastIndex, reCopy, match, i;\n\n if (NPCG_INCLUDED) {\n reCopy = new RegExp('^' + re.source + '$(?!\\\\s)', _flags.call(re));\n }\n if (UPDATES_LAST_INDEX_WRONG) lastIndex = re[LAST_INDEX];\n\n match = nativeExec.call(re, str);\n\n if (UPDATES_LAST_INDEX_WRONG && match) {\n re[LAST_INDEX] = re.global ? match.index + match[0].length : lastIndex;\n }\n if (NPCG_INCLUDED && match && match.length > 1) {\n // Fix browsers whose `exec` methods don't consistently return `undefined`\n // for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/\n // eslint-disable-next-line no-loop-func\n nativeReplace.call(match[0], reCopy, function () {\n for (i = 1; i < arguments.length - 2; i++) {\n if (arguments[i] === undefined) match[i] = undefined;\n }\n });\n }\n\n return match;\n };\n}\n\nvar _regexpExec = patchedExec;\n\n_export({\n target: 'RegExp',\n proto: true,\n forced: _regexpExec !== /./.exec\n}, {\n exec: _regexpExec\n});\n\nvar SPECIES$1 = _wks('species');\n\nvar REPLACE_SUPPORTS_NAMED_GROUPS = !_fails(function () {\n // #replace needs built-in support for named groups.\n // #match works fine because it just return the exec results, even if it has\n // a \"grops\" property.\n var re = /./;\n re.exec = function () {\n var result = [];\n result.groups = { a: '7' };\n return result;\n };\n return ''.replace(re, '$') !== '7';\n});\n\nvar SPLIT_WORKS_WITH_OVERWRITTEN_EXEC = (function () {\n // Chrome 51 has a buggy \"split\" implementation when RegExp#exec !== nativeExec\n var re = /(?:)/;\n var originalExec = re.exec;\n re.exec = function () { return originalExec.apply(this, arguments); };\n var result = 'ab'.split(re);\n return result.length === 2 && result[0] === 'a' && result[1] === 'b';\n})();\n\nvar _fixReWks = function (KEY, length, exec) {\n var SYMBOL = _wks(KEY);\n\n var DELEGATES_TO_SYMBOL = !_fails(function () {\n // String methods call symbol-named RegEp methods\n var O = {};\n O[SYMBOL] = function () { return 7; };\n return ''[KEY](O) != 7;\n });\n\n var DELEGATES_TO_EXEC = DELEGATES_TO_SYMBOL ? !_fails(function () {\n // Symbol-named RegExp methods call .exec\n var execCalled = false;\n var re = /a/;\n re.exec = function () { execCalled = true; return null; };\n if (KEY === 'split') {\n // RegExp[@@split] doesn't call the regex's exec method, but first creates\n // a new one. We need to return the patched regex when creating the new one.\n re.constructor = {};\n re.constructor[SPECIES$1] = function () { return re; };\n }\n re[SYMBOL]('');\n return !execCalled;\n }) : undefined;\n\n if (\n !DELEGATES_TO_SYMBOL ||\n !DELEGATES_TO_EXEC ||\n (KEY === 'replace' && !REPLACE_SUPPORTS_NAMED_GROUPS) ||\n (KEY === 'split' && !SPLIT_WORKS_WITH_OVERWRITTEN_EXEC)\n ) {\n var nativeRegExpMethod = /./[SYMBOL];\n var fns = exec(\n _defined,\n SYMBOL,\n ''[KEY],\n function maybeCallNative(nativeMethod, regexp, str, arg2, forceStringMethod) {\n if (regexp.exec === _regexpExec) {\n if (DELEGATES_TO_SYMBOL && !forceStringMethod) {\n // The native String method already delegates to @@method (this\n // polyfilled function), leasing to infinite recursion.\n // We avoid it by directly calling the native @@method method.\n return { done: true, value: nativeRegExpMethod.call(regexp, str, arg2) };\n }\n return { done: true, value: nativeMethod.call(str, regexp, arg2) };\n }\n return { done: false };\n }\n );\n var strfn = fns[0];\n var rxfn = fns[1];\n\n _redefine(String.prototype, KEY, strfn);\n _hide(RegExp.prototype, SYMBOL, length == 2\n // 21.2.5.8 RegExp.prototype[@@replace](string, replaceValue)\n // 21.2.5.11 RegExp.prototype[@@split](string, limit)\n ? function (string, arg) { return rxfn.call(string, this, arg); }\n // 21.2.5.6 RegExp.prototype[@@match](string)\n // 21.2.5.9 RegExp.prototype[@@search](string)\n : function (string) { return rxfn.call(string, this); }\n );\n }\n};\n\nvar $min = Math.min;\nvar $push = [].push;\nvar $SPLIT = 'split';\nvar LENGTH = 'length';\nvar LAST_INDEX$1 = 'lastIndex';\nvar MAX_UINT32 = 0xffffffff;\n\n// babel-minify transpiles RegExp('x', 'y') -> /x/y and it causes SyntaxError\nvar SUPPORTS_Y = !_fails(function () { RegExp(MAX_UINT32, 'y'); });\n\n// @@split logic\n_fixReWks('split', 2, function (defined, SPLIT, $split, maybeCallNative) {\n var internalSplit;\n if (\n 'abbc'[$SPLIT](/(b)*/)[1] == 'c' ||\n 'test'[$SPLIT](/(?:)/, -1)[LENGTH] != 4 ||\n 'ab'[$SPLIT](/(?:ab)*/)[LENGTH] != 2 ||\n '.'[$SPLIT](/(.?)(.?)/)[LENGTH] != 4 ||\n '.'[$SPLIT](/()()/)[LENGTH] > 1 ||\n ''[$SPLIT](/.?/)[LENGTH]\n ) {\n // based on es5-shim implementation, need to rework it\n internalSplit = function (separator, limit) {\n var string = String(this);\n if (separator === undefined && limit === 0) return [];\n // If `separator` is not a regex, use native split\n if (!_isRegexp(separator)) return $split.call(string, separator, limit);\n var output = [];\n var flags = (separator.ignoreCase ? 'i' : '') +\n (separator.multiline ? 'm' : '') +\n (separator.unicode ? 'u' : '') +\n (separator.sticky ? 'y' : '');\n var lastLastIndex = 0;\n var splitLimit = limit === undefined ? MAX_UINT32 : limit >>> 0;\n // Make `global` and avoid `lastIndex` issues by working with a copy\n var separatorCopy = new RegExp(separator.source, flags + 'g');\n var match, lastIndex, lastLength;\n while (match = _regexpExec.call(separatorCopy, string)) {\n lastIndex = separatorCopy[LAST_INDEX$1];\n if (lastIndex > lastLastIndex) {\n output.push(string.slice(lastLastIndex, match.index));\n if (match[LENGTH] > 1 && match.index < string[LENGTH]) $push.apply(output, match.slice(1));\n lastLength = match[0][LENGTH];\n lastLastIndex = lastIndex;\n if (output[LENGTH] >= splitLimit) break;\n }\n if (separatorCopy[LAST_INDEX$1] === match.index) separatorCopy[LAST_INDEX$1]++; // Avoid an infinite loop\n }\n if (lastLastIndex === string[LENGTH]) {\n if (lastLength || !separatorCopy.test('')) output.push('');\n } else output.push(string.slice(lastLastIndex));\n return output[LENGTH] > splitLimit ? output.slice(0, splitLimit) : output;\n };\n // Chakra, V8\n } else if ('0'[$SPLIT](undefined, 0)[LENGTH]) {\n internalSplit = function (separator, limit) {\n return separator === undefined && limit === 0 ? [] : $split.call(this, separator, limit);\n };\n } else {\n internalSplit = $split;\n }\n\n return [\n // `String.prototype.split` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.split\n function split(separator, limit) {\n var O = defined(this);\n var splitter = separator == undefined ? undefined : separator[SPLIT];\n return splitter !== undefined\n ? splitter.call(separator, O, limit)\n : internalSplit.call(String(O), separator, limit);\n },\n // `RegExp.prototype[@@split]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@split\n //\n // NOTE: This cannot be properly polyfilled in engines that don't support\n // the 'y' flag.\n function (regexp, limit) {\n var res = maybeCallNative(internalSplit, regexp, this, limit, internalSplit !== $split);\n if (res.done) return res.value;\n\n var rx = _anObject(regexp);\n var S = String(this);\n var C = _speciesConstructor(rx, RegExp);\n\n var unicodeMatching = rx.unicode;\n var flags = (rx.ignoreCase ? 'i' : '') +\n (rx.multiline ? 'm' : '') +\n (rx.unicode ? 'u' : '') +\n (SUPPORTS_Y ? 'y' : 'g');\n\n // ^(? + rx + ) is needed, in combination with some S slicing, to\n // simulate the 'y' flag.\n var splitter = new C(SUPPORTS_Y ? rx : '^(?:' + rx.source + ')', flags);\n var lim = limit === undefined ? MAX_UINT32 : limit >>> 0;\n if (lim === 0) return [];\n if (S.length === 0) return _regexpExecAbstract(splitter, S) === null ? [S] : [];\n var p = 0;\n var q = 0;\n var A = [];\n while (q < S.length) {\n splitter.lastIndex = SUPPORTS_Y ? q : 0;\n var z = _regexpExecAbstract(splitter, SUPPORTS_Y ? S : S.slice(q));\n var e;\n if (\n z === null ||\n (e = $min(_toLength(splitter.lastIndex + (SUPPORTS_Y ? 0 : q)), S.length)) === p\n ) {\n q = _advanceStringIndex(S, q, unicodeMatching);\n } else {\n A.push(S.slice(p, q));\n if (A.length === lim) return A;\n for (var i = 1; i <= z.length - 1; i++) {\n A.push(z[i]);\n if (A.length === lim) return A;\n }\n q = p = e;\n }\n }\n A.push(S.slice(p));\n return A;\n }\n ];\n});\n\n// 7.2.2 IsArray(argument)\n\nvar _isArray = Array.isArray || function isArray(arg) {\n return _cof(arg) == 'Array';\n};\n\nvar SPECIES$2 = _wks('species');\n\nvar _arraySpeciesConstructor = function (original) {\n var C;\n if (_isArray(original)) {\n C = original.constructor;\n // cross-realm fallback\n if (typeof C == 'function' && (C === Array || _isArray(C.prototype))) C = undefined;\n if (_isObject(C)) {\n C = C[SPECIES$2];\n if (C === null) C = undefined;\n }\n } return C === undefined ? Array : C;\n};\n\n// 9.4.2.3 ArraySpeciesCreate(originalArray, length)\n\n\nvar _arraySpeciesCreate = function (original, length) {\n return new (_arraySpeciesConstructor(original))(length);\n};\n\n// 0 -> Array#forEach\n// 1 -> Array#map\n// 2 -> Array#filter\n// 3 -> Array#some\n// 4 -> Array#every\n// 5 -> Array#find\n// 6 -> Array#findIndex\n\n\n\n\n\nvar _arrayMethods = function (TYPE, $create) {\n var IS_MAP = TYPE == 1;\n var IS_FILTER = TYPE == 2;\n var IS_SOME = TYPE == 3;\n var IS_EVERY = TYPE == 4;\n var IS_FIND_INDEX = TYPE == 6;\n var NO_HOLES = TYPE == 5 || IS_FIND_INDEX;\n var create = $create || _arraySpeciesCreate;\n return function ($this, callbackfn, that) {\n var O = _toObject($this);\n var self = _iobject(O);\n var f = _ctx(callbackfn, that, 3);\n var length = _toLength(self.length);\n var index = 0;\n var result = IS_MAP ? create($this, length) : IS_FILTER ? create($this, 0) : undefined;\n var val, res;\n for (;length > index; index++) if (NO_HOLES || index in self) {\n val = self[index];\n res = f(val, index, O);\n if (TYPE) {\n if (IS_MAP) result[index] = res; // map\n else if (res) switch (TYPE) {\n case 3: return true; // some\n case 5: return val; // find\n case 6: return index; // findIndex\n case 2: result.push(val); // filter\n } else if (IS_EVERY) return false; // every\n }\n }\n return IS_FIND_INDEX ? -1 : IS_SOME || IS_EVERY ? IS_EVERY : result;\n };\n};\n\nvar _strictMethod = function (method, arg) {\n return !!method && _fails(function () {\n // eslint-disable-next-line no-useless-call\n arg ? method.call(null, function () { /* empty */ }, 1) : method.call(null);\n });\n};\n\nvar $map = _arrayMethods(1);\n\n_export(_export.P + _export.F * !_strictMethod([].map, true), 'Array', {\n // 22.1.3.15 / 15.4.4.19 Array.prototype.map(callbackfn [, thisArg])\n map: function map(callbackfn /* , thisArg */) {\n return $map(this, callbackfn, arguments[1]);\n }\n});\n\nvar max$1 = Math.max;\nvar min$2 = Math.min;\nvar floor$1 = Math.floor;\nvar SUBSTITUTION_SYMBOLS = /\\$([$&`']|\\d\\d?|<[^>]*>)/g;\nvar SUBSTITUTION_SYMBOLS_NO_NAMED = /\\$([$&`']|\\d\\d?)/g;\n\nvar maybeToString = function (it) {\n return it === undefined ? it : String(it);\n};\n\n// @@replace logic\n_fixReWks('replace', 2, function (defined, REPLACE, $replace, maybeCallNative) {\n return [\n // `String.prototype.replace` method\n // https://tc39.github.io/ecma262/#sec-string.prototype.replace\n function replace(searchValue, replaceValue) {\n var O = defined(this);\n var fn = searchValue == undefined ? undefined : searchValue[REPLACE];\n return fn !== undefined\n ? fn.call(searchValue, O, replaceValue)\n : $replace.call(String(O), searchValue, replaceValue);\n },\n // `RegExp.prototype[@@replace]` method\n // https://tc39.github.io/ecma262/#sec-regexp.prototype-@@replace\n function (regexp, replaceValue) {\n var res = maybeCallNative($replace, regexp, this, replaceValue);\n if (res.done) return res.value;\n\n var rx = _anObject(regexp);\n var S = String(this);\n var functionalReplace = typeof replaceValue === 'function';\n if (!functionalReplace) replaceValue = String(replaceValue);\n var global = rx.global;\n if (global) {\n var fullUnicode = rx.unicode;\n rx.lastIndex = 0;\n }\n var results = [];\n while (true) {\n var result = _regexpExecAbstract(rx, S);\n if (result === null) break;\n results.push(result);\n if (!global) break;\n var matchStr = String(result[0]);\n if (matchStr === '') rx.lastIndex = _advanceStringIndex(S, _toLength(rx.lastIndex), fullUnicode);\n }\n var accumulatedResult = '';\n var nextSourcePosition = 0;\n for (var i = 0; i < results.length; i++) {\n result = results[i];\n var matched = String(result[0]);\n var position = max$1(min$2(_toInteger(result.index), S.length), 0);\n var captures = [];\n // NOTE: This is equivalent to\n // captures = result.slice(1).map(maybeToString)\n // but for some reason `nativeSlice.call(result, 1, result.length)` (called in\n // the slice polyfill when slicing native arrays) \"doesn't work\" in safari 9 and\n // causes a crash (https://pastebin.com/N21QzeQA) when trying to debug it.\n for (var j = 1; j < result.length; j++) captures.push(maybeToString(result[j]));\n var namedCaptures = result.groups;\n if (functionalReplace) {\n var replacerArgs = [matched].concat(captures, position, S);\n if (namedCaptures !== undefined) replacerArgs.push(namedCaptures);\n var replacement = String(replaceValue.apply(undefined, replacerArgs));\n } else {\n replacement = getSubstitution(matched, S, position, captures, namedCaptures, replaceValue);\n }\n if (position >= nextSourcePosition) {\n accumulatedResult += S.slice(nextSourcePosition, position) + replacement;\n nextSourcePosition = position + matched.length;\n }\n }\n return accumulatedResult + S.slice(nextSourcePosition);\n }\n ];\n\n // https://tc39.github.io/ecma262/#sec-getsubstitution\n function getSubstitution(matched, str, position, captures, namedCaptures, replacement) {\n var tailPos = position + matched.length;\n var m = captures.length;\n var symbols = SUBSTITUTION_SYMBOLS_NO_NAMED;\n if (namedCaptures !== undefined) {\n namedCaptures = _toObject(namedCaptures);\n symbols = SUBSTITUTION_SYMBOLS;\n }\n return $replace.call(replacement, symbols, function (match, ch) {\n var capture;\n switch (ch.charAt(0)) {\n case '$': return '$';\n case '&': return matched;\n case '`': return str.slice(0, position);\n case \"'\": return str.slice(tailPos);\n case '<':\n capture = namedCaptures[ch.slice(1, -1)];\n break;\n default: // \\d\\d?\n var n = +ch;\n if (n === 0) return match;\n if (n > m) {\n var f = floor$1(n / 10);\n if (f === 0) return match;\n if (f <= m) return captures[f - 1] === undefined ? ch.charAt(1) : captures[f - 1] + ch.charAt(1);\n return match;\n }\n capture = captures[n - 1];\n }\n return capture === undefined ? '' : capture;\n });\n }\n});\n\nvar incrementalDomCjs = createCommonjsModule(function (module, exports) {\n\nObject.defineProperty(exports, '__esModule', { value: true });\n\n/**\n * Copyright 2018 The Incremental DOM Authors. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS-IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Copyright 2018 The Incremental DOM Authors. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS-IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * The name of the HTML attribute that holds the element key\n * (e.g. `
`). The attribute value, if it exists, is then used\n * as the default key when importing an element.\n * If null, no attribute value is used as the default key.\n */\nlet keyAttributeName = \"key\";\nfunction getKeyAttributeName() {\n return keyAttributeName;\n}\nfunction setKeyAttributeName(name) {\n keyAttributeName = name;\n}\n\n/**\n * Copyright 2018 The Incremental DOM Authors. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS-IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Keeps track whether or not we are in an attributes declaration (after\n * elementOpenStart, but before elementOpenEnd).\n */\nlet inAttributes = false;\n/**\n * Keeps track whether or not we are in an element that should not have its\n * children cleared.\n */\nlet inSkip = false;\n/**\n * Keeps track of whether or not we are in a patch.\n */\nlet inPatch = false;\n/**\n * Asserts that a value exists and is not null or undefined. goog.asserts\n * is not used in order to avoid dependencies on external code.\n * @param val The value to assert is truthy.\n * @returns The value.\n */\nfunction assert(val) {\n if (!val) {\n throw new Error(\"Expected value to be defined\");\n }\n // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n return val;\n}\n/**\n * Makes sure that there is a current patch context.\n * @param functionName The name of the caller, for the error message.\n */\nfunction assertInPatch(functionName) {\n if (!inPatch) {\n throw new Error(\"Cannot call \" + functionName + \"() unless in patch.\");\n }\n}\n/**\n * Makes sure that a patch closes every node that it opened.\n * @param openElement\n * @param root\n */\nfunction assertNoUnclosedTags(openElement, root) {\n if (openElement === root) {\n return;\n }\n let currentElement = openElement;\n const openTags = [];\n while (currentElement && currentElement !== root) {\n openTags.push(currentElement.nodeName.toLowerCase());\n currentElement = currentElement.parentNode;\n }\n throw new Error(\"One or more tags were not closed:\\n\" + openTags.join(\"\\n\"));\n}\n/**\n * Makes sure that node being outer patched has a parent node.\n * @param parent\n */\nfunction assertPatchOuterHasParentNode(parent) {\n if (!parent) {\n console.warn(\"patchOuter requires the node have a parent if there is a key.\");\n }\n}\n/**\n * Makes sure that the caller is not where attributes are expected.\n * @param functionName The name of the caller, for the error message.\n */\nfunction assertNotInAttributes(functionName) {\n if (inAttributes) {\n throw new Error(functionName +\n \"() can not be called between \" +\n \"elementOpenStart() and elementOpenEnd().\");\n }\n}\n/**\n * Makes sure that the caller is not inside an element that has declared skip.\n * @param functionName The name of the caller, for the error message.\n */\nfunction assertNotInSkip(functionName) {\n if (inSkip) {\n throw new Error(functionName +\n \"() may not be called inside an element \" +\n \"that has called skip().\");\n }\n}\n/**\n * Makes sure that the caller is where attributes are expected.\n * @param functionName The name of the caller, for the error message.\n */\nfunction assertInAttributes(functionName) {\n if (!inAttributes) {\n throw new Error(functionName +\n \"() can only be called after calling \" +\n \"elementOpenStart().\");\n }\n}\n/**\n * Makes sure the patch closes virtual attributes call\n */\nfunction assertVirtualAttributesClosed() {\n if (inAttributes) {\n throw new Error(\"elementOpenEnd() must be called after calling \" + \"elementOpenStart().\");\n }\n}\n/**\n * Makes sure that tags are correctly nested.\n * @param currentNameOrCtor\n * @param nameOrCtor\n */\nfunction assertCloseMatchesOpenTag(currentNameOrCtor, nameOrCtor) {\n if (currentNameOrCtor !== nameOrCtor) {\n throw new Error('Received a call to close \"' +\n nameOrCtor +\n '\" but \"' +\n currentNameOrCtor +\n '\" was open.');\n }\n}\n/**\n * Makes sure that no children elements have been declared yet in the current\n * element.\n * @param functionName The name of the caller, for the error message.\n * @param previousNode\n */\nfunction assertNoChildrenDeclaredYet(functionName, previousNode) {\n if (previousNode !== null) {\n throw new Error(functionName +\n \"() must come before any child \" +\n \"declarations inside the current element.\");\n }\n}\n/**\n * Checks that a call to patchOuter actually patched the element.\n * @param maybeStartNode The value for the currentNode when the patch\n * started.\n * @param maybeCurrentNode The currentNode when the patch finished.\n * @param expectedNextNode The Node that is expected to follow the\n * currentNode after the patch;\n * @param expectedPrevNode The Node that is expected to preceed the\n * currentNode after the patch.\n */\nfunction assertPatchElementNoExtras(maybeStartNode, maybeCurrentNode, expectedNextNode, expectedPrevNode) {\n const startNode = assert(maybeStartNode);\n const currentNode = assert(maybeCurrentNode);\n const wasUpdated = currentNode.nextSibling === expectedNextNode &&\n currentNode.previousSibling === expectedPrevNode;\n const wasChanged = currentNode.nextSibling === startNode.nextSibling &&\n currentNode.previousSibling === expectedPrevNode;\n const wasRemoved = currentNode === startNode;\n if (!wasUpdated && !wasChanged && !wasRemoved) {\n throw new Error(\"There must be exactly one top level call corresponding \" +\n \"to the patched element.\");\n }\n}\n/**\n * @param newContext The current patch context.\n */\nfunction updatePatchContext(newContext) {\n inPatch = newContext != null;\n}\n/**\n * Updates the state of being in an attribute declaration.\n * @param value Whether or not the patch is in an attribute declaration.\n * @return the previous value.\n */\nfunction setInAttributes(value) {\n const previous = inAttributes;\n inAttributes = value;\n return previous;\n}\n/**\n * Updates the state of being in a skip element.\n * @param value Whether or not the patch is skipping the children of a\n * parent node.\n * @return the previous value.\n */\nfunction setInSkip(value) {\n const previous = inSkip;\n inSkip = value;\n return previous;\n}\n\n/**\n * Copyright 2018 The Incremental DOM Authors. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS-IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * A cached reference to the hasOwnProperty function.\n */\nconst hasOwnProperty = Object.prototype.hasOwnProperty;\n/**\n * A constructor function that will create blank objects.\n */\nfunction Blank() { }\nBlank.prototype = Object.create(null);\n/**\n * Used to prevent property collisions between our \"map\" and its prototype.\n * @param map The map to check.\n * @param property The property to check.\n * @return Whether map has property.\n */\nfunction has(map, property) {\n return hasOwnProperty.call(map, property);\n}\n/**\n * Creates an map object without a prototype.\n * @returns An Object that can be used as a map.\n */\nfunction createMap() {\n return new Blank();\n}\n/**\n * Truncates an array, removing items up until length.\n * @param arr The array to truncate.\n * @param length The new length of the array.\n */\nfunction truncateArray(arr, length) {\n while (arr.length > length) {\n arr.pop();\n }\n}\n/**\n * Creates an array for a desired initial size. Note that the array will still\n * be empty.\n * @param initialAllocationSize The initial size to allocate.\n * @returns An empty array, with an initial allocation for the desired size.\n */\nfunction createArray(initialAllocationSize) {\n const arr = new Array(initialAllocationSize);\n truncateArray(arr, 0);\n return arr;\n}\n\n/**\n * Copyright 2018 The Incremental DOM Authors. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS-IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst symbols = {\n default: \"__default\"\n};\n\n/**\n * Copyright 2018 The Incremental DOM Authors. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS-IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * @param name The name of the attribute. For example \"tabindex\" or\n * \"xlink:href\".\n * @returns The namespace to use for the attribute, or null if there is\n * no namespace.\n */\nfunction getNamespace(name) {\n if (name.lastIndexOf(\"xml:\", 0) === 0) {\n return \"http://www.w3.org/XML/1998/namespace\";\n }\n if (name.lastIndexOf(\"xlink:\", 0) === 0) {\n return \"http://www.w3.org/1999/xlink\";\n }\n return null;\n}\n/**\n * Applies an attribute or property to a given Element. If the value is null\n * or undefined, it is removed from the Element. Otherwise, the value is set\n * as an attribute.\n * @param el The element to apply the attribute to.\n * @param name The attribute's name.\n * @param value The attribute's value.\n */\nfunction applyAttr(el, name, value) {\n if (value == null) {\n el.removeAttribute(name);\n }\n else {\n const attrNS = getNamespace(name);\n if (attrNS) {\n el.setAttributeNS(attrNS, name, String(value));\n }\n else {\n el.setAttribute(name, String(value));\n }\n }\n}\n/**\n * Applies a property to a given Element.\n * @param el The element to apply the property to.\n * @param name The property's name.\n * @param value The property's value.\n */\nfunction applyProp(el, name, value) {\n el[name] = value;\n}\n/**\n * Applies a value to a style declaration. Supports CSS custom properties by\n * setting properties containing a dash using CSSStyleDeclaration.setProperty.\n * @param style A style declaration.\n * @param prop The property to apply. This can be either camelcase or dash\n * separated. For example: \"backgroundColor\" and \"background-color\" are both\n * supported.\n * @param value The value of the property.\n */\nfunction setStyleValue(style, prop, value) {\n if (prop.indexOf(\"-\") >= 0) {\n style.setProperty(prop, value);\n }\n else {\n style[prop] = value;\n }\n}\n/**\n * Applies a style to an Element. No vendor prefix expansion is done for\n * property names/values.\n * @param el The Element to apply the style for.\n * @param name The attribute's name.\n * @param style The style to set. Either a string of css or an object\n * containing property-value pairs.\n */\nfunction applyStyle(el, name, style) {\n // MathML elements inherit from Element, which does not have style. We cannot\n // do `instanceof HTMLElement` / `instanceof SVGElement`, since el can belong\n // to a different document, so just check that it has a style.\n assert(\"style\" in el);\n const elStyle = el.style;\n if (typeof style === \"string\") {\n elStyle.cssText = style;\n }\n else {\n elStyle.cssText = \"\";\n for (const prop in style) {\n if (has(style, prop)) {\n setStyleValue(elStyle, prop, style[prop]);\n }\n }\n }\n}\n/**\n * Updates a single attribute on an Element.\n * @param el The Element to apply the attribute to.\n * @param name The attribute's name.\n * @param value The attribute's value. If the value is an object or\n * function it is set on the Element, otherwise, it is set as an HTML\n * attribute.\n */\nfunction applyAttributeTyped(el, name, value) {\n const type = typeof value;\n if (type === \"object\" || type === \"function\") {\n applyProp(el, name, value);\n }\n else {\n applyAttr(el, name, value);\n }\n}\n/**\n * A publicly mutable object to provide custom mutators for attributes.\n * NB: The result of createMap() has to be recast since closure compiler\n * will just assume attributes is \"any\" otherwise and throws away\n * the type annotation set by tsickle.\n */\nconst attributes = createMap();\n// Special generic mutator that's called for any attribute that does not\n// have a specific mutator.\nattributes[symbols.default] = applyAttributeTyped;\nattributes[\"style\"] = applyStyle;\n/**\n * Calls the appropriate attribute mutator for this attribute.\n * @param el The Element to apply the attribute to.\n * @param name The attribute's name.\n * @param value The attribute's value. If the value is an object or\n * function it is set on the Element, otherwise, it is set as an HTML\n * attribute.\n */\nfunction updateAttribute(el, name, value) {\n const mutator = attributes[name] || attributes[symbols.default];\n mutator(el, name, value);\n}\n\n/**\n * Copyright 2018 The Incremental DOM Authors. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS-IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst notifications = {\n nodesCreated: null,\n nodesDeleted: null\n};\n\n/**\n * Copyright 2018 The Incremental DOM Authors. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS-IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * A context object keeps track of the state of a patch.\n */\nclass Context {\n constructor() {\n this.created = [];\n this.deleted = [];\n }\n markCreated(node) {\n this.created.push(node);\n }\n markDeleted(node) {\n this.deleted.push(node);\n }\n /**\n * Notifies about nodes that were created during the patch operation.\n */\n notifyChanges() {\n if (notifications.nodesCreated && this.created.length > 0) {\n notifications.nodesCreated(this.created);\n }\n if (notifications.nodesDeleted && this.deleted.length > 0) {\n notifications.nodesDeleted(this.deleted);\n }\n }\n}\n\n/**\n * Copyright 2018 The Incremental DOM Authors. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS-IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Checks if the node is the root of a document. This is either a Document\n * or ShadowRoot. DocumentFragments are included for simplicity of the\n * implementation, though we only want to consider Documents or ShadowRoots.\n * @param node The node to check.\n * @return True if the node the root of a document, false otherwise.\n */\nfunction isDocumentRoot(node) {\n return node.nodeType === 11 || node.nodeType === 9;\n}\n/**\n * Checks if the node is an Element. This is faster than an instanceof check.\n * @param node The node to check.\n * @return Whether or not the node is an Element.\n */\nfunction isElement(node) {\n return node.nodeType === 1;\n}\n/**\n * @param node The node to start at, inclusive.\n * @param root The root ancestor to get until, exclusive.\n * @return The ancestry of DOM nodes.\n */\nfunction getAncestry(node, root) {\n const ancestry = [];\n let cur = node;\n while (cur !== root) {\n const n = assert(cur);\n ancestry.push(n);\n cur = n.parentNode;\n }\n return ancestry;\n}\n/**\n * @param this\n * @returns The root node of the DOM tree that contains this node.\n */\nconst getRootNode = (typeof Node !== \"undefined\" && Node.prototype.getRootNode) ||\n function () {\n let cur = this;\n let prev = cur;\n while (cur) {\n prev = cur;\n cur = cur.parentNode;\n }\n return prev;\n };\n/**\n * @param node The node to get the activeElement for.\n * @returns The activeElement in the Document or ShadowRoot\n * corresponding to node, if present.\n */\nfunction getActiveElement(node) {\n const root = getRootNode.call(node);\n return isDocumentRoot(root) ? root.activeElement : null;\n}\n/**\n * Gets the path of nodes that contain the focused node in the same document as\n * a reference node, up until the root.\n * @param node The reference node to get the activeElement for.\n * @param root The root to get the focused path until.\n * @returns The path of focused parents, if any exist.\n */\nfunction getFocusedPath(node, root) {\n const activeElement = getActiveElement(node);\n if (!activeElement || !node.contains(activeElement)) {\n return [];\n }\n return getAncestry(activeElement, root);\n}\n/**\n * Like insertBefore, but instead instead of moving the desired node, instead\n * moves all the other nodes after.\n * @param parentNode\n * @param node\n * @param referenceNode\n */\nfunction moveBefore(parentNode, node, referenceNode) {\n const insertReferenceNode = node.nextSibling;\n let cur = referenceNode;\n while (cur !== null && cur !== node) {\n const next = cur.nextSibling;\n parentNode.insertBefore(cur, insertReferenceNode);\n cur = next;\n }\n}\n\n/**\n * Copyright 2018 The Incremental DOM Authors. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS-IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Keeps track of information needed to perform diffs for a given DOM node.\n */\nclass NodeData {\n constructor(nameOrCtor, key, text) {\n /**\n * An array of attribute name/value pairs, used for quickly diffing the\n * incomming attributes to see if the DOM node's attributes need to be\n * updated.\n */\n this._attrsArr = null;\n /**\n * Whether or not the statics have been applied for the node yet.\n */\n this.staticsApplied = false;\n this.nameOrCtor = nameOrCtor;\n this.key = key;\n this.text = text;\n }\n hasEmptyAttrsArr() {\n const attrs = this._attrsArr;\n return !attrs || !attrs.length;\n }\n getAttrsArr(length) {\n return this._attrsArr || (this._attrsArr = createArray(length));\n }\n}\n/**\n * Initializes a NodeData object for a Node.\n * @param node The Node to initialized data for.\n * @param nameOrCtor The NameOrCtorDef to use when diffing.\n * @param key The Key for the Node.\n * @param text The data of a Text node, if importing a Text node.\n * @returns A NodeData object with the existing attributes initialized.\n */\nfunction initData(node, nameOrCtor, key, text) {\n const data = new NodeData(nameOrCtor, key, text);\n node[\"__incrementalDOMData\"] = data;\n return data;\n}\n/**\n * @param node The node to check.\n * @returns True if the NodeData already exists, false otherwise.\n */\nfunction isDataInitialized(node) {\n return Boolean(node[\"__incrementalDOMData\"]);\n}\n/**\n * Records the element's attributes.\n * @param node The Element that may have attributes\n * @param data The Element's data\n */\nfunction recordAttributes(node, data) {\n const attributes = node.attributes;\n const length = attributes.length;\n if (!length) {\n return;\n }\n const attrsArr = data.getAttrsArr(length);\n // Use a cached length. The attributes array is really a live NamedNodeMap,\n // which exists as a DOM \"Host Object\" (probably as C++ code). This makes the\n // usual constant length iteration very difficult to optimize in JITs.\n for (let i = 0, j = 0; i < length; i += 1, j += 2) {\n const attr = attributes[i];\n const name = attr.name;\n const value = attr.value;\n attrsArr[j] = name;\n attrsArr[j + 1] = value;\n }\n}\n/**\n * Imports single node and its subtree, initializing caches, if it has not\n * already been imported.\n * @param node The node to import.\n * @param fallbackKey A key to use if importing and no key was specified.\n * Useful when not transmitting keys from serverside render and doing an\n * immediate no-op diff.\n * @returns The NodeData for the node.\n */\nfunction importSingleNode(node, fallbackKey) {\n if (node[\"__incrementalDOMData\"]) {\n return node[\"__incrementalDOMData\"];\n }\n const nodeName = isElement(node) ? node.localName : node.nodeName;\n const keyAttrName = getKeyAttributeName();\n const keyAttr = isElement(node) && keyAttrName != null\n ? node.getAttribute(keyAttrName)\n : null;\n const key = isElement(node) ? keyAttr || fallbackKey : null;\n const data = initData(node, nodeName, key);\n if (isElement(node)) {\n recordAttributes(node, data);\n }\n return data;\n}\n/**\n * Imports node and its subtree, initializing caches.\n * @param node The Node to import.\n */\nfunction importNode(node) {\n importSingleNode(node);\n for (let child = node.firstChild; child; child = child.nextSibling) {\n importNode(child);\n }\n}\n/**\n * Retrieves the NodeData object for a Node, creating it if necessary.\n * @param node The node to get data for.\n * @param fallbackKey A key to use if importing and no key was specified.\n * Useful when not transmitting keys from serverside render and doing an\n * immediate no-op diff.\n * @returns The NodeData for the node.\n */\nfunction getData(node, fallbackKey) {\n return importSingleNode(node, fallbackKey);\n}\n/**\n * Gets the key for a Node. note that the Node should have been imported\n * by now.\n * @param node The node to check.\n * @returns The key used to create the node.\n */\nfunction getKey(node) {\n assert(node[\"__incrementalDOMData\"]);\n return getData(node).key;\n}\n/**\n * Clears all caches from a node and all of its children.\n * @param node The Node to clear the cache for.\n */\nfunction clearCache(node) {\n node[\"__incrementalDOMData\"] = null;\n for (let child = node.firstChild; child; child = child.nextSibling) {\n clearCache(child);\n }\n}\n\n/**\n * Copyright 2018 The Incremental DOM Authors. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS-IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Gets the namespace to create an element (of a given tag) in.\n * @param tag The tag to get the namespace for.\n * @param parent The current parent Node, if any.\n * @returns The namespace to use,\n */\nfunction getNamespaceForTag(tag, parent) {\n if (tag === \"svg\") {\n return \"http://www.w3.org/2000/svg\";\n }\n if (tag === \"math\") {\n return \"http://www.w3.org/1998/Math/MathML\";\n }\n if (parent == null) {\n return null;\n }\n if (getData(parent).nameOrCtor === \"foreignObject\") {\n return null;\n }\n return parent.namespaceURI;\n}\n/**\n * Creates an Element and initializes the NodeData.\n * @param doc The document with which to create the Element.\n * @param parent The parent of new Element.\n * @param nameOrCtor The tag or constructor for the Element.\n * @param key A key to identify the Element.\n * @returns The newly created Element.\n */\nfunction createElement(doc, parent, nameOrCtor, key) {\n let el;\n if (typeof nameOrCtor === \"function\") {\n el = new nameOrCtor();\n }\n else {\n const namespace = getNamespaceForTag(nameOrCtor, parent);\n if (namespace) {\n el = doc.createElementNS(namespace, nameOrCtor);\n }\n else {\n el = doc.createElement(nameOrCtor);\n }\n }\n initData(el, nameOrCtor, key);\n return el;\n}\n/**\n * Creates a Text Node.\n * @param doc The document with which to create the Element.\n * @returns The newly created Text.\n */\nfunction createText(doc) {\n const node = doc.createTextNode(\"\");\n initData(node, \"#text\", null);\n return node;\n}\n\n/**\n * Copyright 2018 The Incremental DOM Authors. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS-IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * The default match function to use, if one was not specified when creating\n * the patcher.\n * @param matchNode The node to match against, unused.\n * @param nameOrCtor The name or constructor as declared.\n * @param expectedNameOrCtor The name or constructor of the existing node.\n * @param key The key as declared.\n * @param expectedKey The key of the existing node.\n * @returns True if the node matches, false otherwise.\n */\nfunction defaultMatchFn(matchNode, nameOrCtor, expectedNameOrCtor, key, expectedKey) {\n // Key check is done using double equals as we want to treat a null key the\n // same as undefined. This should be okay as the only values allowed are\n // strings, null and undefined so the == semantics are not too weird.\n return nameOrCtor == expectedNameOrCtor && key == expectedKey;\n}\nlet context = null;\nlet currentNode = null;\nlet currentParent = null;\nlet doc = null;\nlet focusPath = [];\nlet matchFn = defaultMatchFn;\n/**\n * Used to build up call arguments. Each patch call gets a separate copy, so\n * this works with nested calls to patch.\n */\nlet argsBuilder = [];\n/**\n * Used to build up attrs for the an element.\n */\nlet attrsBuilder = [];\n/**\n * TODO(sparhami) We should just export argsBuilder directly when Closure\n * Compiler supports ES6 directly.\n * @returns The Array used for building arguments.\n */\nfunction getArgsBuilder() {\n return argsBuilder;\n}\n/**\n * TODO(sparhami) We should just export attrsBuilder directly when Closure\n * Compiler supports ES6 directly.\n * @returns The Array used for building arguments.\n */\nfunction getAttrsBuilder() {\n return attrsBuilder;\n}\n/**\n * Checks whether or not the current node matches the specified nameOrCtor and\n * key. This uses the specified match function when creating the patcher.\n * @param matchNode A node to match the data to.\n * @param nameOrCtor The name or constructor to check for.\n * @param key The key used to identify the Node.\n * @return True if the node matches, false otherwise.\n */\nfunction matches(matchNode, nameOrCtor, key) {\n const data = getData(matchNode, key);\n return matchFn(matchNode, nameOrCtor, data.nameOrCtor, key, data.key);\n}\n/**\n * Finds the matching node, starting at `node` and looking at the subsequent\n * siblings if a key is used.\n * @param matchNode The node to start looking at.\n * @param nameOrCtor The name or constructor for the Node.\n * @param key The key used to identify the Node.\n * @returns The matching Node, if any exists.\n */\nfunction getMatchingNode(matchNode, nameOrCtor, key) {\n if (!matchNode) {\n return null;\n }\n let cur = matchNode;\n do {\n if (matches(cur, nameOrCtor, key)) {\n return cur;\n }\n } while (key && (cur = cur.nextSibling));\n return null;\n}\n/**\n * Clears out any unvisited Nodes in a given range.\n * @param maybeParentNode\n * @param startNode The node to start clearing from, inclusive.\n * @param endNode The node to clear until, exclusive.\n */\nfunction clearUnvisitedDOM(maybeParentNode, startNode, endNode) {\n const parentNode = maybeParentNode;\n let child = startNode;\n while (child !== endNode) {\n const next = child.nextSibling;\n parentNode.removeChild(child);\n context.markDeleted(child);\n child = next;\n }\n}\n/**\n * @return The next Node to be patched.\n */\nfunction getNextNode() {\n if (currentNode) {\n return currentNode.nextSibling;\n }\n else {\n return currentParent.firstChild;\n }\n}\n/**\n * Changes to the first child of the current node.\n */\nfunction enterNode() {\n currentParent = currentNode;\n currentNode = null;\n}\n/**\n * Changes to the parent of the current node, removing any unvisited children.\n */\nfunction exitNode() {\n clearUnvisitedDOM(currentParent, getNextNode(), null);\n currentNode = currentParent;\n currentParent = currentParent.parentNode;\n}\n/**\n * Changes to the next sibling of the current node.\n */\nfunction nextNode() {\n currentNode = getNextNode();\n}\n/**\n * Creates a Node and marking it as created.\n * @param nameOrCtor The name or constructor for the Node.\n * @param key The key used to identify the Node.\n * @return The newly created node.\n */\nfunction createNode(nameOrCtor, key) {\n let node;\n if (nameOrCtor === \"#text\") {\n node = createText(doc);\n }\n else {\n node = createElement(doc, currentParent, nameOrCtor, key);\n }\n context.markCreated(node);\n return node;\n}\n/**\n * Aligns the virtual Node definition with the actual DOM, moving the\n * corresponding DOM node to the correct location or creating it if necessary.\n * @param nameOrCtor The name or constructor for the Node.\n * @param key The key used to identify the Node.\n */\nfunction alignWithDOM(nameOrCtor, key) {\n nextNode();\n const existingNode = getMatchingNode(currentNode, nameOrCtor, key);\n const node = existingNode || createNode(nameOrCtor, key);\n // If we are at the matching node, then we are done.\n if (node === currentNode) {\n return;\n }\n // Re-order the node into the right position, preserving focus if either\n // node or currentNode are focused by making sure that they are not detached\n // from the DOM.\n if (focusPath.indexOf(node) >= 0) {\n // Move everything else before the node.\n moveBefore(currentParent, node, currentNode);\n }\n else {\n currentParent.insertBefore(node, currentNode);\n }\n currentNode = node;\n}\n/**\n * Makes sure that the current node is an Element with a matching nameOrCtor and\n * key.\n *\n * @param nameOrCtor The tag or constructor for the Element.\n * @param key The key used to identify this element. This can be an\n * empty string, but performance may be better if a unique value is used\n * when iterating over an array of items.\n * @return The corresponding Element.\n */\nfunction open(nameOrCtor, key) {\n alignWithDOM(nameOrCtor, key);\n enterNode();\n return currentParent;\n}\n/**\n * Closes the currently open Element, removing any unvisited children if\n * necessary.\n * @returns The Element that was just closed.\n */\nfunction close() {\n {\n setInSkip(false);\n }\n exitNode();\n return currentNode;\n}\n/**\n * Makes sure the current node is a Text node and creates a Text node if it is\n * not.\n * @returns The Text node that was aligned or created.\n */\nfunction text() {\n alignWithDOM(\"#text\", null);\n return currentNode;\n}\n/**\n * @returns The current Element being patched.\n */\nfunction currentElement() {\n {\n assertInPatch(\"currentElement\");\n assertNotInAttributes(\"currentElement\");\n }\n return currentParent;\n}\n/**\n * @return The Node that will be evaluated for the next instruction.\n */\nfunction currentPointer() {\n {\n assertInPatch(\"currentPointer\");\n assertNotInAttributes(\"currentPointer\");\n }\n // TODO(tomnguyen): assert that this is not null\n return getNextNode();\n}\n/**\n * Skips the children in a subtree, allowing an Element to be closed without\n * clearing out the children.\n */\nfunction skip() {\n {\n assertNoChildrenDeclaredYet(\"skip\", currentNode);\n setInSkip(true);\n }\n currentNode = currentParent.lastChild;\n}\n/**\n * Returns a patcher function that sets up and restores a patch context,\n * running the run function with the provided data.\n * @param run The function that will run the patch.\n * @param patchConfig The configuration to use for the patch.\n * @returns The created patch function.\n */\nfunction createPatcher(run, patchConfig = {}) {\n const { matches = defaultMatchFn } = patchConfig;\n const f = (node, fn, data) => {\n const prevContext = context;\n const prevDoc = doc;\n const prevFocusPath = focusPath;\n const prevArgsBuilder = argsBuilder;\n const prevAttrsBuilder = attrsBuilder;\n const prevCurrentNode = currentNode;\n const prevCurrentParent = currentParent;\n const prevMatchFn = matchFn;\n let previousInAttributes = false;\n let previousInSkip = false;\n doc = node.ownerDocument;\n context = new Context();\n matchFn = matches;\n argsBuilder = [];\n attrsBuilder = [];\n currentNode = null;\n currentParent = node.parentNode;\n focusPath = getFocusedPath(node, currentParent);\n {\n previousInAttributes = setInAttributes(false);\n previousInSkip = setInSkip(false);\n updatePatchContext(context);\n }\n try {\n const retVal = run(node, fn, data);\n {\n assertVirtualAttributesClosed();\n }\n return retVal;\n }\n finally {\n context.notifyChanges();\n doc = prevDoc;\n context = prevContext;\n matchFn = prevMatchFn;\n argsBuilder = prevArgsBuilder;\n attrsBuilder = prevAttrsBuilder;\n currentNode = prevCurrentNode;\n currentParent = prevCurrentParent;\n focusPath = prevFocusPath;\n // Needs to be done after assertions because assertions rely on state\n // from these methods.\n {\n setInAttributes(previousInAttributes);\n setInSkip(previousInSkip);\n updatePatchContext(context);\n }\n }\n };\n return f;\n}\n/**\n * Creates a patcher that patches the document starting at node with a\n * provided function. This function may be called during an existing patch operation.\n * @param patchConfig The config to use for the patch.\n * @returns The created function for patching an Element's children.\n */\nfunction createPatchInner(patchConfig) {\n return createPatcher((node, fn, data) => {\n currentNode = node;\n enterNode();\n fn(data);\n exitNode();\n {\n assertNoUnclosedTags(currentNode, node);\n }\n return node;\n }, patchConfig);\n}\n/**\n * Creates a patcher that patches an Element with the the provided function.\n * Exactly one top level element call should be made corresponding to `node`.\n * @param patchConfig The config to use for the patch.\n * @returns The created function for patching an Element.\n */\nfunction createPatchOuter(patchConfig) {\n return createPatcher((node, fn, data) => {\n const startNode = { nextSibling: node };\n let expectedNextNode = null;\n let expectedPrevNode = null;\n {\n expectedNextNode = node.nextSibling;\n expectedPrevNode = node.previousSibling;\n }\n currentNode = startNode;\n fn(data);\n {\n assertPatchOuterHasParentNode(currentParent);\n assertPatchElementNoExtras(startNode, currentNode, expectedNextNode, expectedPrevNode);\n }\n if (currentParent) {\n clearUnvisitedDOM(currentParent, getNextNode(), node.nextSibling);\n }\n return startNode === currentNode ? null : currentNode;\n }, patchConfig);\n}\nconst patchInner = createPatchInner();\nconst patchOuter = createPatchOuter();\n\n/**\n * Copyright 2018 The Incremental DOM Authors. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS-IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\nconst buffer = [];\nlet bufferStart = 0;\n/**\n * TODO(tomnguyen): This is a bit silly and really needs to be better typed.\n * @param fn A function to call.\n * @param a The first argument to the function.\n * @param b The second argument to the function.\n * @param c The third argument to the function.\n */\nfunction queueChange(fn, a, b, c) {\n buffer.push(fn);\n buffer.push(a);\n buffer.push(b);\n buffer.push(c);\n}\n/**\n * Flushes the changes buffer, calling the functions for each change.\n */\nfunction flush() {\n // A change may cause this function to be called re-entrantly. Keep track of\n // the portion of the buffer we are consuming. Updates the start pointer so\n // that the next call knows where to start from.\n const start = bufferStart;\n const end = buffer.length;\n bufferStart = end;\n for (let i = start; i < end; i += 4) {\n const fn = buffer[i];\n fn(buffer[i + 1], buffer[i + 2], buffer[i + 3]);\n }\n bufferStart = start;\n truncateArray(buffer, start);\n}\n\n/**\n * Copyright 2018 The Incremental DOM Authors. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS-IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * Used to keep track of the previous values when a 2-way diff is necessary.\n * This object is cleared out and reused.\n */\nconst prevValuesMap = createMap();\n/**\n * Calculates the diff between previous and next values, calling the update\n * function when an item has changed value. If an item from the previous values\n * is not present in the the next values, the update function is called with a\n * value of `undefined`.\n * @param prev The previous values, alternating name, value pairs.\n * @param next The next values, alternating name, value pairs.\n * @param updateCtx The context for the updateFn.\n * @param updateFn A function to call when a value has changed.\n */\nfunction calculateDiff(prev, next, updateCtx, updateFn) {\n const isNew = !prev.length;\n let i = 0;\n for (; i < next.length; i += 2) {\n const name = next[i];\n if (isNew) {\n prev[i] = name;\n }\n else if (prev[i] !== name) {\n break;\n }\n const value = next[i + 1];\n if (isNew || prev[i + 1] !== value) {\n prev[i + 1] = value;\n queueChange(updateFn, updateCtx, name, value);\n }\n }\n // Items did not line up exactly as before, need to make sure old items are\n // removed. This should be a rare case.\n if (i < next.length || i < prev.length) {\n const startIndex = i;\n for (i = startIndex; i < prev.length; i += 2) {\n prevValuesMap[prev[i]] = prev[i + 1];\n }\n for (i = startIndex; i < next.length; i += 2) {\n const name = next[i];\n const value = next[i + 1];\n if (prevValuesMap[name] !== value) {\n queueChange(updateFn, updateCtx, name, value);\n }\n prev[i] = name;\n prev[i + 1] = value;\n delete prevValuesMap[name];\n }\n truncateArray(prev, next.length);\n for (const name in prevValuesMap) {\n queueChange(updateFn, updateCtx, name, undefined);\n delete prevValuesMap[name];\n }\n }\n flush();\n}\n\n/**\n * Copyright 2018 The Incremental DOM Authors. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS-IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n/**\n * The offset in the virtual element declaration where the attributes are\n * specified.\n */\nconst ATTRIBUTES_OFFSET = 3;\n/**\n * Used to keep track of the previous values when a 2-way diff is necessary.\n * This object is reused.\n * TODO(sparhamI) Scope this to a patch so you can call patch from an attribute\n * update.\n */\nconst prevAttrsMap = createMap();\n/**\n * @param element The Element to diff the attrs for.\n * @param data The NodeData associated with the Element.\n */\nfunction diffAttrs(element, data) {\n const attrsBuilder = getAttrsBuilder();\n const prevAttrsArr = data.getAttrsArr(attrsBuilder.length);\n calculateDiff(prevAttrsArr, attrsBuilder, element, updateAttribute);\n truncateArray(attrsBuilder, 0);\n}\n/**\n * Applies the statics. When importing an Element, any existing attributes that\n * match a static are converted into a static attribute.\n * @param node The Element to apply statics for.\n * @param data The NodeData associated with the Element.\n * @param statics The statics array.\n */\nfunction diffStatics(node, data, statics) {\n if (data.staticsApplied) {\n return;\n }\n data.staticsApplied = true;\n if (!statics || !statics.length) {\n return;\n }\n if (data.hasEmptyAttrsArr()) {\n for (let i = 0; i < statics.length; i += 2) {\n updateAttribute(node, statics[i], statics[i + 1]);\n }\n return;\n }\n for (let i = 0; i < statics.length; i += 2) {\n prevAttrsMap[statics[i]] = i + 1;\n }\n const attrsArr = data.getAttrsArr(0);\n let j = 0;\n for (let i = 0; i < attrsArr.length; i += 2) {\n const name = attrsArr[i];\n const value = attrsArr[i + 1];\n const staticsIndex = prevAttrsMap[name];\n if (staticsIndex) {\n // For any attrs that are static and have the same value, make sure we do\n // not set them again.\n if (statics[staticsIndex] === value) {\n delete prevAttrsMap[name];\n }\n continue;\n }\n // For any attrs that are dynamic, move them up to the right place.\n attrsArr[j] = name;\n attrsArr[j + 1] = value;\n j += 2;\n }\n // Anything after `j` was either moved up already or static.\n truncateArray(attrsArr, j);\n for (const name in prevAttrsMap) {\n updateAttribute(node, name, statics[prevAttrsMap[name]]);\n delete prevAttrsMap[name];\n }\n}\n/**\n * Declares a virtual Element at the current location in the document. This\n * corresponds to an opening tag and a elementClose tag is required. This is\n * like elementOpen, but the attributes are defined using the attr function\n * rather than being passed as arguments. Must be folllowed by 0 or more calls\n * to attr, then a call to elementOpenEnd.\n * @param nameOrCtor The Element's tag or constructor.\n * @param key The key used to identify this element. This can be an\n * empty string, but performance may be better if a unique value is used\n * when iterating over an array of items.\n * @param statics An array of attribute name/value pairs of the static\n * attributes for the Element. Attributes will only be set once when the\n * Element is created.\n */\nfunction elementOpenStart(nameOrCtor, key, statics) {\n const argsBuilder = getArgsBuilder();\n {\n assertNotInAttributes(\"elementOpenStart\");\n setInAttributes(true);\n }\n argsBuilder[0] = nameOrCtor;\n argsBuilder[1] = key;\n argsBuilder[2] = statics;\n}\n/**\n * Allows you to define a key after an elementOpenStart. This is useful in\n * templates that define key after an element has been opened ie\n * `
`.\n * @param key The key to use for the next call.\n */\nfunction key(key) {\n const argsBuilder = getArgsBuilder();\n {\n assertInAttributes(\"key\");\n assert(argsBuilder);\n }\n argsBuilder[1] = key;\n}\n/**\n * Buffers an attribute, which will get applied during the next call to\n * `elementOpen`, `elementOpenEnd` or `applyAttrs`.\n * @param name The of the attribute to buffer.\n * @param value The value of the attribute to buffer.\n */\nfunction attr(name, value) {\n const attrsBuilder = getAttrsBuilder();\n {\n assertInPatch(\"attr\");\n }\n attrsBuilder.push(name);\n attrsBuilder.push(value);\n}\n/**\n * Closes an open tag started with elementOpenStart.\n * @return The corresponding Element.\n */\nfunction elementOpenEnd() {\n const argsBuilder = getArgsBuilder();\n {\n assertInAttributes(\"elementOpenEnd\");\n setInAttributes(false);\n }\n const node = open(argsBuilder[0], argsBuilder[1]);\n const data = getData(node);\n diffStatics(node, data, argsBuilder[2]);\n diffAttrs(node, data);\n truncateArray(argsBuilder, 0);\n return node;\n}\n/**\n * @param nameOrCtor The Element's tag or constructor.\n * @param key The key used to identify this element. This can be an\n * empty string, but performance may be better if a unique value is used\n * when iterating over an array of items.\n * @param statics An array of attribute name/value pairs of the static\n * attributes for the Element. Attributes will only be set once when the\n * Element is created.\n * @param varArgs, Attribute name/value pairs of the dynamic attributes\n * for the Element.\n * @return The corresponding Element.\n */\nfunction elementOpen(nameOrCtor, key, \n// Ideally we could tag statics and varArgs as an array where every odd\n// element is a string and every even element is any, but this is hard.\nstatics, ...varArgs) {\n {\n assertNotInAttributes(\"elementOpen\");\n assertNotInSkip(\"elementOpen\");\n }\n elementOpenStart(nameOrCtor, key, statics);\n for (let i = ATTRIBUTES_OFFSET; i < arguments.length; i += 2) {\n attr(arguments[i], arguments[i + 1]);\n }\n return elementOpenEnd();\n}\n/**\n * Applies the currently buffered attrs to the currently open element. This\n * clears the buffered attributes.\n */\nfunction applyAttrs() {\n const node = currentElement();\n const data = getData(node);\n diffAttrs(node, data);\n}\n/**\n * Applies the current static attributes to the currently open element. Note:\n * statics should be applied before calling `applyAtrs`.\n * @param statics The statics to apply to the current element.\n */\nfunction applyStatics(statics) {\n const node = currentElement();\n const data = getData(node);\n diffStatics(node, data, statics);\n}\n/**\n * Closes an open virtual Element.\n *\n * @param nameOrCtor The Element's tag or constructor.\n * @return The corresponding Element.\n */\nfunction elementClose(nameOrCtor) {\n {\n assertNotInAttributes(\"elementClose\");\n }\n const node = close();\n {\n assertCloseMatchesOpenTag(getData(node).nameOrCtor, nameOrCtor);\n }\n return node;\n}\n/**\n * Declares a virtual Element at the current location in the document that has\n * no children.\n * @param nameOrCtor The Element's tag or constructor.\n * @param key The key used to identify this element. This can be an\n * empty string, but performance may be better if a unique value is used\n * when iterating over an array of items.\n * @param statics An array of attribute name/value pairs of the static\n * attributes for the Element. Attributes will only be set once when the\n * Element is created.\n * @param varArgs Attribute name/value pairs of the dynamic attributes\n * for the Element.\n * @return The corresponding Element.\n */\nfunction elementVoid(nameOrCtor, key, \n// Ideally we could tag statics and varArgs as an array where every odd\n// element is a string and every even element is any, but this is hard.\nstatics, ...varArgs) {\n elementOpen.apply(null, arguments);\n return elementClose(nameOrCtor);\n}\n/**\n * Declares a virtual Text at this point in the document.\n *\n * @param value The value of the Text.\n * @param varArgs\n * Functions to format the value which are called only when the value has\n * changed.\n * @return The corresponding text node.\n */\nfunction text$1(value, ...varArgs) {\n {\n assertNotInAttributes(\"text\");\n assertNotInSkip(\"text\");\n }\n const node = text();\n const data = getData(node);\n if (data.text !== value) {\n data.text = value;\n let formatted = value;\n for (let i = 1; i < arguments.length; i += 1) {\n /*\n * Call the formatter function directly to prevent leaking arguments.\n * https://github.com/google/incremental-dom/pull/204#issuecomment-178223574\n */\n const fn = arguments[i];\n formatted = fn(formatted);\n }\n // Setting node.data resets the cursor in IE/Edge.\n if (node.data !== formatted) {\n node.data = formatted;\n }\n }\n return node;\n}\n\n/**\n * Copyright 2018 The Incremental DOM Authors. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS-IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nexports.applyAttr = applyAttr;\nexports.applyProp = applyProp;\nexports.attributes = attributes;\nexports.alignWithDOM = alignWithDOM;\nexports.close = close;\nexports.createPatchInner = createPatchInner;\nexports.createPatchOuter = createPatchOuter;\nexports.currentElement = currentElement;\nexports.currentPointer = currentPointer;\nexports.open = open;\nexports.patch = patchInner;\nexports.patchInner = patchInner;\nexports.patchOuter = patchOuter;\nexports.skip = skip;\nexports.skipNode = nextNode;\nexports.setKeyAttributeName = setKeyAttributeName;\nexports.clearCache = clearCache;\nexports.getKey = getKey;\nexports.importNode = importNode;\nexports.isDataInitialized = isDataInitialized;\nexports.notifications = notifications;\nexports.symbols = symbols;\nexports.applyAttrs = applyAttrs;\nexports.applyStatics = applyStatics;\nexports.attr = attr;\nexports.elementClose = elementClose;\nexports.elementOpen = elementOpen;\nexports.elementOpenEnd = elementOpenEnd;\nexports.elementOpenStart = elementOpenStart;\nexports.elementVoid = elementVoid;\nexports.key = key;\nexports.text = text$1;\n\n});\n\nunwrapExports(incrementalDomCjs);\nvar incrementalDomCjs_1 = incrementalDomCjs.applyAttr;\nvar incrementalDomCjs_2 = incrementalDomCjs.applyProp;\nvar incrementalDomCjs_3 = incrementalDomCjs.attributes;\nvar incrementalDomCjs_4 = incrementalDomCjs.alignWithDOM;\nvar incrementalDomCjs_5 = incrementalDomCjs.close;\nvar incrementalDomCjs_6 = incrementalDomCjs.createPatchInner;\nvar incrementalDomCjs_7 = incrementalDomCjs.createPatchOuter;\nvar incrementalDomCjs_8 = incrementalDomCjs.currentElement;\nvar incrementalDomCjs_9 = incrementalDomCjs.currentPointer;\nvar incrementalDomCjs_10 = incrementalDomCjs.open;\nvar incrementalDomCjs_11 = incrementalDomCjs.patch;\nvar incrementalDomCjs_12 = incrementalDomCjs.patchInner;\nvar incrementalDomCjs_13 = incrementalDomCjs.patchOuter;\nvar incrementalDomCjs_14 = incrementalDomCjs.skip;\nvar incrementalDomCjs_15 = incrementalDomCjs.skipNode;\nvar incrementalDomCjs_16 = incrementalDomCjs.setKeyAttributeName;\nvar incrementalDomCjs_17 = incrementalDomCjs.clearCache;\nvar incrementalDomCjs_18 = incrementalDomCjs.getKey;\nvar incrementalDomCjs_19 = incrementalDomCjs.importNode;\nvar incrementalDomCjs_20 = incrementalDomCjs.isDataInitialized;\nvar incrementalDomCjs_21 = incrementalDomCjs.notifications;\nvar incrementalDomCjs_22 = incrementalDomCjs.symbols;\nvar incrementalDomCjs_23 = incrementalDomCjs.applyAttrs;\nvar incrementalDomCjs_24 = incrementalDomCjs.applyStatics;\nvar incrementalDomCjs_25 = incrementalDomCjs.attr;\nvar incrementalDomCjs_26 = incrementalDomCjs.elementClose;\nvar incrementalDomCjs_27 = incrementalDomCjs.elementOpen;\nvar incrementalDomCjs_28 = incrementalDomCjs.elementOpenEnd;\nvar incrementalDomCjs_29 = incrementalDomCjs.elementOpenStart;\nvar incrementalDomCjs_30 = incrementalDomCjs.elementVoid;\nvar incrementalDomCjs_31 = incrementalDomCjs.key;\nvar incrementalDomCjs_32 = incrementalDomCjs.text;\n\nincrementalDomCjs_3.caretpos = function (element, name, value) {\n element.setSelectionRange(value, value);\n};\nincrementalDomCjs_3.value = incrementalDomCjs_2;\nvar renderIncrementalDOM = function renderIncrementalDOM(data, onSelect, multiline) {\n if (data.suggestions.length > 0 && data.focused) {\n // unselectable=on is a IE11 workaround,\n // which makes it possible to use an eventual scroll bar on suggestions list.\n incrementalDomCjs_27('ul', '', ['class', 'dawa-autocomplete-suggestions', 'role', 'listbox', 'unselectable', 'on']);\n var _loop = function _loop(i) {\n var suggestion = data.suggestions[i];\n var className = 'dawa-autocomplete-suggestion';\n if (data.selected === i) {\n className += ' dawa-selected';\n }\n incrementalDomCjs_27('li', '', ['role', 'option'], 'class', className, 'onmousedown', function (e) {\n onSelect(i);\n e.preventDefault();\n });\n var rows = suggestion.forslagstekst.split('\\n');\n rows = rows.map(function (row) {\n return row.replace(/ /g, \"\\xA0\");\n });\n if (multiline) {\n incrementalDomCjs_32(rows[0]);\n for (var _i = 1; _i < rows.length; ++_i) {\n incrementalDomCjs_30('br');\n incrementalDomCjs_32(rows[_i]);\n }\n } else {\n incrementalDomCjs_32(rows.join(', '));\n }\n incrementalDomCjs_26('li');\n };\n for (var i = 0; i < data.suggestions.length; ++i) {\n _loop(i);\n }\n incrementalDomCjs_26('ul');\n }\n};\nvar defaultRender = function defaultRender(containerElm, data, onSelect, multiline) {\n incrementalDomCjs_11(containerElm, function () {\n renderIncrementalDOM(data, onSelect, multiline);\n });\n};\nvar autocompleteUi = function autocompleteUi(inputElm, options) {\n var onSelect = options.onSelect;\n var onTextChange = options.onTextChange;\n var render = options.render || defaultRender;\n var destroyed = false;\n var lastEmittedText = '';\n var lastEmittedCaretpos = 0;\n var suggestionContainerElm = document.createElement('div');\n inputElm.parentNode.insertBefore(suggestionContainerElm, inputElm.nextSibling);\n var emitTextChange = function emitTextChange(newText, newCaretpos) {\n if (lastEmittedText !== newText || lastEmittedCaretpos !== newCaretpos) {\n onTextChange(newText, newCaretpos);\n lastEmittedText = newText;\n lastEmittedCaretpos = newCaretpos;\n }\n };\n var data = {\n caretpos: 2,\n inputText: '',\n selected: 0,\n focused: document.activeElement === inputElm,\n suggestions: []\n };\n var handleInputChanged = function handleInputChanged(inputElm) {\n var newText = inputElm.value;\n var newCaretPos = inputElm.selectionStart;\n data.caretpos = newCaretPos;\n data.inputText = newText;\n emitTextChange(newText, newCaretPos);\n };\n var update;\n var selectSuggestion = function selectSuggestion(index) {\n var selectedSuggestion = data.suggestions[index];\n data.inputText = selectedSuggestion.tekst;\n data.caretpos = selectedSuggestion.caretpos;\n data.suggestions = [];\n onSelect(selectedSuggestion);\n update(true);\n };\n var keydownHandler = function keydownHandler(e) {\n var key = window.event ? e.keyCode : e.which;\n if (data.suggestions.length > 0 && data.focused) {\n // down (40)\n if (key === 40) {\n data.selected = (data.selected + 1) % data.suggestions.length;\n update();\n }\n //up (38)\n else if (key === 38) {\n data.selected = (data.selected - 1 + data.suggestions.length) % data.suggestions.length;\n update();\n }\n // enter\n else if (key === 13 || key === 9) {\n selectSuggestion(data.selected);\n } else {\n return true;\n }\n e.preventDefault();\n return false;\n }\n };\n var focusHandler = function focusHandler() {\n data.focused = true;\n update();\n };\n var blurHandler = function blurHandler() {\n data.focused = false;\n update();\n return false;\n };\n var inputChangeHandler = function inputChangeHandler(e) {\n handleInputChanged(e.target);\n };\n var inputMouseUpHandler = function inputMouseUpHandler(e) {\n return handleInputChanged(e.target);\n };\n var updateScheduled = false;\n var updateInput = false;\n update = function update(shouldUpdateInput) {\n if (shouldUpdateInput) {\n updateInput = true;\n }\n if (!updateScheduled) {\n updateScheduled = true;\n requestAnimationFrame(function () {\n if (destroyed) {\n return;\n }\n updateScheduled = false;\n if (updateInput) {\n inputElm.value = data.inputText;\n inputElm.setSelectionRange(data.caretpos, data.caretpos);\n }\n updateInput = false;\n render(suggestionContainerElm, data, function (i) {\n return selectSuggestion(i);\n }, options.multiline);\n });\n }\n };\n update();\n var destroy = function destroy() {\n destroyed = true;\n inputElm.removeEventListener('keydown', keydownHandler);\n inputElm.removeEventListener('blur', blurHandler);\n inputElm.removeEventListener('focus', focusHandler);\n inputElm.removeEventListener('input', inputChangeHandler);\n inputElm.removeEventListener('mouseup', inputMouseUpHandler);\n incrementalDomCjs_11(suggestionContainerElm, function () {});\n suggestionContainerElm.remove();\n };\n var setSuggestions = function setSuggestions(suggestions) {\n data.suggestions = suggestions;\n data.selected = 0;\n update();\n };\n var selectAndClose = function selectAndClose(text) {\n data.inputText = text;\n data.caretpos = text.length;\n data.suggestions = [];\n data.selected = 0;\n update(true);\n };\n inputElm.addEventListener('keydown', keydownHandler);\n inputElm.addEventListener('blur', blurHandler);\n inputElm.addEventListener('focus', focusHandler);\n inputElm.addEventListener('input', inputChangeHandler);\n inputElm.addEventListener('mouseup', inputMouseUpHandler);\n inputElm.setAttribute('aria-autocomplete', 'list');\n inputElm.setAttribute('autocomplete', 'off');\n return {\n destroy: destroy,\n setSuggestions: setSuggestions,\n selectAndClose: selectAndClose\n };\n};\n\nfunction _classCallCheck(instance, Constructor) {\n if (!(instance instanceof Constructor)) {\n throw new TypeError(\"Cannot call a class as a function\");\n }\n}\nfunction _defineProperties(target, props) {\n for (var i = 0; i < props.length; i++) {\n var descriptor = props[i];\n descriptor.enumerable = descriptor.enumerable || false;\n descriptor.configurable = true;\n if (\"value\" in descriptor) descriptor.writable = true;\n Object.defineProperty(target, _toPropertyKey(descriptor.key), descriptor);\n }\n}\nfunction _createClass(Constructor, protoProps, staticProps) {\n if (protoProps) _defineProperties(Constructor.prototype, protoProps);\n if (staticProps) _defineProperties(Constructor, staticProps);\n Object.defineProperty(Constructor, \"prototype\", {\n writable: false\n });\n return Constructor;\n}\nfunction _toPrimitive$1(input, hint) {\n if (typeof input !== \"object\" || input === null) return input;\n var prim = input[Symbol.toPrimitive];\n if (prim !== undefined) {\n var res = prim.call(input, hint || \"default\");\n if (typeof res !== \"object\") return res;\n throw new TypeError(\"@@toPrimitive must return a primitive value.\");\n }\n return (hint === \"string\" ? String : Number)(input);\n}\nfunction _toPropertyKey(arg) {\n var key = _toPrimitive$1(arg, \"string\");\n return typeof key === \"symbol\" ? key : String(key);\n}\n\n// most Object methods by ES6 should accept primitives\n\n\n\nvar _objectSap = function (KEY, exec) {\n var fn = (_core.Object || {})[KEY] || Object[KEY];\n var exp = {};\n exp[KEY] = exec(fn);\n _export(_export.S + _export.F * _fails(function () { fn(1); }), 'Object', exp);\n};\n\n// 19.1.2.14 Object.keys(O)\n\n\n\n_objectSap('keys', function () {\n return function keys(it) {\n return _objectKeys(_toObject(it));\n };\n});\n\n// 19.1.3.6 Object.prototype.toString()\n\nvar test = {};\ntest[_wks('toStringTag')] = 'z';\nif (test + '' != '[object z]') {\n _redefine(Object.prototype, 'toString', function toString() {\n return '[object ' + _classof(this) + ']';\n }, true);\n}\n\nvar _anInstance = function (it, Constructor, name, forbiddenField) {\n if (!(it instanceof Constructor) || (forbiddenField !== undefined && forbiddenField in it)) {\n throw TypeError(name + ': incorrect invocation!');\n } return it;\n};\n\n// call something on iterator step with safe closing on error\n\nvar _iterCall = function (iterator, fn, value, entries) {\n try {\n return entries ? fn(_anObject(value)[0], value[1]) : fn(value);\n // 7.4.6 IteratorClose(iterator, completion)\n } catch (e) {\n var ret = iterator['return'];\n if (ret !== undefined) _anObject(ret.call(iterator));\n throw e;\n }\n};\n\nvar _iterators = {};\n\n// check on default Array iterator\n\nvar ITERATOR = _wks('iterator');\nvar ArrayProto = Array.prototype;\n\nvar _isArrayIter = function (it) {\n return it !== undefined && (_iterators.Array === it || ArrayProto[ITERATOR] === it);\n};\n\nvar ITERATOR$1 = _wks('iterator');\n\nvar core_getIteratorMethod = _core.getIteratorMethod = function (it) {\n if (it != undefined) return it[ITERATOR$1]\n || it['@@iterator']\n || _iterators[_classof(it)];\n};\n\nvar _forOf = createCommonjsModule(function (module) {\nvar BREAK = {};\nvar RETURN = {};\nvar exports = module.exports = function (iterable, entries, fn, that, ITERATOR) {\n var iterFn = ITERATOR ? function () { return iterable; } : core_getIteratorMethod(iterable);\n var f = _ctx(fn, that, entries ? 2 : 1);\n var index = 0;\n var length, step, iterator, result;\n if (typeof iterFn != 'function') throw TypeError(iterable + ' is not iterable!');\n // fast case for arrays with default iterator\n if (_isArrayIter(iterFn)) for (length = _toLength(iterable.length); length > index; index++) {\n result = entries ? f(_anObject(step = iterable[index])[0], step[1]) : f(iterable[index]);\n if (result === BREAK || result === RETURN) return result;\n } else for (iterator = iterFn.call(iterable); !(step = iterator.next()).done;) {\n result = _iterCall(iterator, f, step.value, entries);\n if (result === BREAK || result === RETURN) return result;\n }\n};\nexports.BREAK = BREAK;\nexports.RETURN = RETURN;\n});\n\n// fast apply, http://jsperf.lnkit.com/fast-apply/5\nvar _invoke = function (fn, args, that) {\n var un = that === undefined;\n switch (args.length) {\n case 0: return un ? fn()\n : fn.call(that);\n case 1: return un ? fn(args[0])\n : fn.call(that, args[0]);\n case 2: return un ? fn(args[0], args[1])\n : fn.call(that, args[0], args[1]);\n case 3: return un ? fn(args[0], args[1], args[2])\n : fn.call(that, args[0], args[1], args[2]);\n case 4: return un ? fn(args[0], args[1], args[2], args[3])\n : fn.call(that, args[0], args[1], args[2], args[3]);\n } return fn.apply(that, args);\n};\n\nvar document$2 = _global.document;\nvar _html = document$2 && document$2.documentElement;\n\nvar process = _global.process;\nvar setTask = _global.setImmediate;\nvar clearTask = _global.clearImmediate;\nvar MessageChannel = _global.MessageChannel;\nvar Dispatch = _global.Dispatch;\nvar counter = 0;\nvar queue = {};\nvar ONREADYSTATECHANGE = 'onreadystatechange';\nvar defer, channel, port;\nvar run = function () {\n var id = +this;\n // eslint-disable-next-line no-prototype-builtins\n if (queue.hasOwnProperty(id)) {\n var fn = queue[id];\n delete queue[id];\n fn();\n }\n};\nvar listener = function (event) {\n run.call(event.data);\n};\n// Node.js 0.9+ & IE10+ has setImmediate, otherwise:\nif (!setTask || !clearTask) {\n setTask = function setImmediate(fn) {\n var args = [];\n var i = 1;\n while (arguments.length > i) args.push(arguments[i++]);\n queue[++counter] = function () {\n // eslint-disable-next-line no-new-func\n _invoke(typeof fn == 'function' ? fn : Function(fn), args);\n };\n defer(counter);\n return counter;\n };\n clearTask = function clearImmediate(id) {\n delete queue[id];\n };\n // Node.js 0.8-\n if (_cof(process) == 'process') {\n defer = function (id) {\n process.nextTick(_ctx(run, id, 1));\n };\n // Sphere (JS game engine) Dispatch API\n } else if (Dispatch && Dispatch.now) {\n defer = function (id) {\n Dispatch.now(_ctx(run, id, 1));\n };\n // Browsers with MessageChannel, includes WebWorkers\n } else if (MessageChannel) {\n channel = new MessageChannel();\n port = channel.port2;\n channel.port1.onmessage = listener;\n defer = _ctx(port.postMessage, port, 1);\n // Browsers with postMessage, skip WebWorkers\n // IE8 has postMessage, but it's sync & typeof its postMessage is 'object'\n } else if (_global.addEventListener && typeof postMessage == 'function' && !_global.importScripts) {\n defer = function (id) {\n _global.postMessage(id + '', '*');\n };\n _global.addEventListener('message', listener, false);\n // IE8-\n } else if (ONREADYSTATECHANGE in _domCreate('script')) {\n defer = function (id) {\n _html.appendChild(_domCreate('script'))[ONREADYSTATECHANGE] = function () {\n _html.removeChild(this);\n run.call(id);\n };\n };\n // Rest old browsers\n } else {\n defer = function (id) {\n setTimeout(_ctx(run, id, 1), 0);\n };\n }\n}\nvar _task = {\n set: setTask,\n clear: clearTask\n};\n\nvar macrotask = _task.set;\nvar Observer = _global.MutationObserver || _global.WebKitMutationObserver;\nvar process$1 = _global.process;\nvar Promise$1 = _global.Promise;\nvar isNode = _cof(process$1) == 'process';\n\nvar _microtask = function () {\n var head, last, notify;\n\n var flush = function () {\n var parent, fn;\n if (isNode && (parent = process$1.domain)) parent.exit();\n while (head) {\n fn = head.fn;\n head = head.next;\n try {\n fn();\n } catch (e) {\n if (head) notify();\n else last = undefined;\n throw e;\n }\n } last = undefined;\n if (parent) parent.enter();\n };\n\n // Node.js\n if (isNode) {\n notify = function () {\n process$1.nextTick(flush);\n };\n // browsers with MutationObserver, except iOS Safari - https://github.com/zloirock/core-js/issues/339\n } else if (Observer && !(_global.navigator && _global.navigator.standalone)) {\n var toggle = true;\n var node = document.createTextNode('');\n new Observer(flush).observe(node, { characterData: true }); // eslint-disable-line no-new\n notify = function () {\n node.data = toggle = !toggle;\n };\n // environments with maybe non-completely correct, but existent Promise\n } else if (Promise$1 && Promise$1.resolve) {\n // Promise.resolve without an argument throws an error in LG WebOS 2\n var promise = Promise$1.resolve(undefined);\n notify = function () {\n promise.then(flush);\n };\n // for other environments - macrotask based on:\n // - setImmediate\n // - MessageChannel\n // - window.postMessag\n // - onreadystatechange\n // - setTimeout\n } else {\n notify = function () {\n // strange IE + webpack dev server bug - use .call(global)\n macrotask.call(_global, flush);\n };\n }\n\n return function (fn) {\n var task = { fn: fn, next: undefined };\n if (last) last.next = task;\n if (!head) {\n head = task;\n notify();\n } last = task;\n };\n};\n\n// 25.4.1.5 NewPromiseCapability(C)\n\n\nfunction PromiseCapability(C) {\n var resolve, reject;\n this.promise = new C(function ($$resolve, $$reject) {\n if (resolve !== undefined || reject !== undefined) throw TypeError('Bad Promise constructor');\n resolve = $$resolve;\n reject = $$reject;\n });\n this.resolve = _aFunction(resolve);\n this.reject = _aFunction(reject);\n}\n\nvar f$3 = function (C) {\n return new PromiseCapability(C);\n};\n\nvar _newPromiseCapability = {\n\tf: f$3\n};\n\nvar _perform = function (exec) {\n try {\n return { e: false, v: exec() };\n } catch (e) {\n return { e: true, v: e };\n }\n};\n\nvar navigator = _global.navigator;\n\nvar _userAgent = navigator && navigator.userAgent || '';\n\nvar _promiseResolve = function (C, x) {\n _anObject(C);\n if (_isObject(x) && x.constructor === C) return x;\n var promiseCapability = _newPromiseCapability.f(C);\n var resolve = promiseCapability.resolve;\n resolve(x);\n return promiseCapability.promise;\n};\n\nvar _redefineAll = function (target, src, safe) {\n for (var key in src) _redefine(target, key, src[key], safe);\n return target;\n};\n\nvar def = _objectDp.f;\n\nvar TAG$1 = _wks('toStringTag');\n\nvar _setToStringTag = function (it, tag, stat) {\n if (it && !_has(it = stat ? it : it.prototype, TAG$1)) def(it, TAG$1, { configurable: true, value: tag });\n};\n\nvar SPECIES$3 = _wks('species');\n\nvar _setSpecies = function (KEY) {\n var C = _global[KEY];\n if (_descriptors && C && !C[SPECIES$3]) _objectDp.f(C, SPECIES$3, {\n configurable: true,\n get: function () { return this; }\n });\n};\n\nvar ITERATOR$2 = _wks('iterator');\nvar SAFE_CLOSING = false;\n\ntry {\n var riter = [7][ITERATOR$2]();\n riter['return'] = function () { SAFE_CLOSING = true; };\n // eslint-disable-next-line no-throw-literal\n Array.from(riter, function () { throw 2; });\n} catch (e) { /* empty */ }\n\nvar _iterDetect = function (exec, skipClosing) {\n if (!skipClosing && !SAFE_CLOSING) return false;\n var safe = false;\n try {\n var arr = [7];\n var iter = arr[ITERATOR$2]();\n iter.next = function () { return { done: safe = true }; };\n arr[ITERATOR$2] = function () { return iter; };\n exec(arr);\n } catch (e) { /* empty */ }\n return safe;\n};\n\nvar task = _task.set;\nvar microtask = _microtask();\n\n\n\n\nvar PROMISE = 'Promise';\nvar TypeError$1 = _global.TypeError;\nvar process$2 = _global.process;\nvar versions = process$2 && process$2.versions;\nvar v8 = versions && versions.v8 || '';\nvar $Promise = _global[PROMISE];\nvar isNode$1 = _classof(process$2) == 'process';\nvar empty = function () { /* empty */ };\nvar Internal, newGenericPromiseCapability, OwnPromiseCapability, Wrapper;\nvar newPromiseCapability = newGenericPromiseCapability = _newPromiseCapability.f;\n\nvar USE_NATIVE = !!function () {\n try {\n // correct subclassing with @@species support\n var promise = $Promise.resolve(1);\n var FakePromise = (promise.constructor = {})[_wks('species')] = function (exec) {\n exec(empty, empty);\n };\n // unhandled rejections tracking support, NodeJS Promise without it fails @@species test\n return (isNode$1 || typeof PromiseRejectionEvent == 'function')\n && promise.then(empty) instanceof FakePromise\n // v8 6.6 (Node 10 and Chrome 66) have a bug with resolving custom thenables\n // https://bugs.chromium.org/p/chromium/issues/detail?id=830565\n // we can't detect it synchronously, so just check versions\n && v8.indexOf('6.6') !== 0\n && _userAgent.indexOf('Chrome/66') === -1;\n } catch (e) { /* empty */ }\n}();\n\n// helpers\nvar isThenable = function (it) {\n var then;\n return _isObject(it) && typeof (then = it.then) == 'function' ? then : false;\n};\nvar notify = function (promise, isReject) {\n if (promise._n) return;\n promise._n = true;\n var chain = promise._c;\n microtask(function () {\n var value = promise._v;\n var ok = promise._s == 1;\n var i = 0;\n var run = function (reaction) {\n var handler = ok ? reaction.ok : reaction.fail;\n var resolve = reaction.resolve;\n var reject = reaction.reject;\n var domain = reaction.domain;\n var result, then, exited;\n try {\n if (handler) {\n if (!ok) {\n if (promise._h == 2) onHandleUnhandled(promise);\n promise._h = 1;\n }\n if (handler === true) result = value;\n else {\n if (domain) domain.enter();\n result = handler(value); // may throw\n if (domain) {\n domain.exit();\n exited = true;\n }\n }\n if (result === reaction.promise) {\n reject(TypeError$1('Promise-chain cycle'));\n } else if (then = isThenable(result)) {\n then.call(result, resolve, reject);\n } else resolve(result);\n } else reject(value);\n } catch (e) {\n if (domain && !exited) domain.exit();\n reject(e);\n }\n };\n while (chain.length > i) run(chain[i++]); // variable length - can't use forEach\n promise._c = [];\n promise._n = false;\n if (isReject && !promise._h) onUnhandled(promise);\n });\n};\nvar onUnhandled = function (promise) {\n task.call(_global, function () {\n var value = promise._v;\n var unhandled = isUnhandled(promise);\n var result, handler, console;\n if (unhandled) {\n result = _perform(function () {\n if (isNode$1) {\n process$2.emit('unhandledRejection', value, promise);\n } else if (handler = _global.onunhandledrejection) {\n handler({ promise: promise, reason: value });\n } else if ((console = _global.console) && console.error) {\n console.error('Unhandled promise rejection', value);\n }\n });\n // Browsers should not trigger `rejectionHandled` event if it was handled here, NodeJS - should\n promise._h = isNode$1 || isUnhandled(promise) ? 2 : 1;\n } promise._a = undefined;\n if (unhandled && result.e) throw result.v;\n });\n};\nvar isUnhandled = function (promise) {\n return promise._h !== 1 && (promise._a || promise._c).length === 0;\n};\nvar onHandleUnhandled = function (promise) {\n task.call(_global, function () {\n var handler;\n if (isNode$1) {\n process$2.emit('rejectionHandled', promise);\n } else if (handler = _global.onrejectionhandled) {\n handler({ promise: promise, reason: promise._v });\n }\n });\n};\nvar $reject = function (value) {\n var promise = this;\n if (promise._d) return;\n promise._d = true;\n promise = promise._w || promise; // unwrap\n promise._v = value;\n promise._s = 2;\n if (!promise._a) promise._a = promise._c.slice();\n notify(promise, true);\n};\nvar $resolve = function (value) {\n var promise = this;\n var then;\n if (promise._d) return;\n promise._d = true;\n promise = promise._w || promise; // unwrap\n try {\n if (promise === value) throw TypeError$1(\"Promise can't be resolved itself\");\n if (then = isThenable(value)) {\n microtask(function () {\n var wrapper = { _w: promise, _d: false }; // wrap\n try {\n then.call(value, _ctx($resolve, wrapper, 1), _ctx($reject, wrapper, 1));\n } catch (e) {\n $reject.call(wrapper, e);\n }\n });\n } else {\n promise._v = value;\n promise._s = 1;\n notify(promise, false);\n }\n } catch (e) {\n $reject.call({ _w: promise, _d: false }, e); // wrap\n }\n};\n\n// constructor polyfill\nif (!USE_NATIVE) {\n // 25.4.3.1 Promise(executor)\n $Promise = function Promise(executor) {\n _anInstance(this, $Promise, PROMISE, '_h');\n _aFunction(executor);\n Internal.call(this);\n try {\n executor(_ctx($resolve, this, 1), _ctx($reject, this, 1));\n } catch (err) {\n $reject.call(this, err);\n }\n };\n // eslint-disable-next-line no-unused-vars\n Internal = function Promise(executor) {\n this._c = []; // <- awaiting reactions\n this._a = undefined; // <- checked in isUnhandled reactions\n this._s = 0; // <- state\n this._d = false; // <- done\n this._v = undefined; // <- value\n this._h = 0; // <- rejection state, 0 - default, 1 - handled, 2 - unhandled\n this._n = false; // <- notify\n };\n Internal.prototype = _redefineAll($Promise.prototype, {\n // 25.4.5.3 Promise.prototype.then(onFulfilled, onRejected)\n then: function then(onFulfilled, onRejected) {\n var reaction = newPromiseCapability(_speciesConstructor(this, $Promise));\n reaction.ok = typeof onFulfilled == 'function' ? onFulfilled : true;\n reaction.fail = typeof onRejected == 'function' && onRejected;\n reaction.domain = isNode$1 ? process$2.domain : undefined;\n this._c.push(reaction);\n if (this._a) this._a.push(reaction);\n if (this._s) notify(this, false);\n return reaction.promise;\n },\n // 25.4.5.1 Promise.prototype.catch(onRejected)\n 'catch': function (onRejected) {\n return this.then(undefined, onRejected);\n }\n });\n OwnPromiseCapability = function () {\n var promise = new Internal();\n this.promise = promise;\n this.resolve = _ctx($resolve, promise, 1);\n this.reject = _ctx($reject, promise, 1);\n };\n _newPromiseCapability.f = newPromiseCapability = function (C) {\n return C === $Promise || C === Wrapper\n ? new OwnPromiseCapability(C)\n : newGenericPromiseCapability(C);\n };\n}\n\n_export(_export.G + _export.W + _export.F * !USE_NATIVE, { Promise: $Promise });\n_setToStringTag($Promise, PROMISE);\n_setSpecies(PROMISE);\nWrapper = _core[PROMISE];\n\n// statics\n_export(_export.S + _export.F * !USE_NATIVE, PROMISE, {\n // 25.4.4.5 Promise.reject(r)\n reject: function reject(r) {\n var capability = newPromiseCapability(this);\n var $$reject = capability.reject;\n $$reject(r);\n return capability.promise;\n }\n});\n_export(_export.S + _export.F * ( !USE_NATIVE), PROMISE, {\n // 25.4.4.6 Promise.resolve(x)\n resolve: function resolve(x) {\n return _promiseResolve( this, x);\n }\n});\n_export(_export.S + _export.F * !(USE_NATIVE && _iterDetect(function (iter) {\n $Promise.all(iter)['catch'](empty);\n})), PROMISE, {\n // 25.4.4.1 Promise.all(iterable)\n all: function all(iterable) {\n var C = this;\n var capability = newPromiseCapability(C);\n var resolve = capability.resolve;\n var reject = capability.reject;\n var result = _perform(function () {\n var values = [];\n var index = 0;\n var remaining = 1;\n _forOf(iterable, false, function (promise) {\n var $index = index++;\n var alreadyCalled = false;\n values.push(undefined);\n remaining++;\n C.resolve(promise).then(function (value) {\n if (alreadyCalled) return;\n alreadyCalled = true;\n values[$index] = value;\n --remaining || resolve(values);\n }, reject);\n });\n --remaining || resolve(values);\n });\n if (result.e) reject(result.v);\n return capability.promise;\n },\n // 25.4.4.4 Promise.race(iterable)\n race: function race(iterable) {\n var C = this;\n var capability = newPromiseCapability(C);\n var reject = capability.reject;\n var result = _perform(function () {\n _forOf(iterable, false, function (promise) {\n C.resolve(promise).then(capability.resolve, reject);\n });\n });\n if (result.e) reject(result.v);\n return capability.promise;\n }\n});\n\nfunction fetch(e,n){return n=n||{},new Promise(function(t,r){var s=new XMLHttpRequest,o=[],u=[],i={},a=function(){return {ok:2==(s.status/100|0),statusText:s.statusText,status:s.status,url:s.responseURL,text:function(){return Promise.resolve(s.responseText)},json:function(){return Promise.resolve(s.responseText).then(JSON.parse)},blob:function(){return Promise.resolve(new Blob([s.response]))},clone:a,headers:{keys:function(){return o},entries:function(){return u},get:function(e){return i[e.toLowerCase()]},has:function(e){return e.toLowerCase()in i}}}};for(var l in s.open(n.method||\"get\",e,!0),s.onload=function(){s.getAllResponseHeaders().replace(/^(.*?):[^\\S\\n]*([\\s\\S]*?)$/gm,function(e,n,t){o.push(n=n.toLowerCase()),u.push([n,t]),i[n]=i[n]?i[n]+\",\"+t:t;}),t(a());},s.onerror=r,s.withCredentials=\"include\"==n.credentials,n.headers)s.setRequestHeader(l,n.headers[l]);s.send(n.body||null);})}\n\nvar formatParams = function formatParams(params) {\n return Object.keys(params).map(function (paramName) {\n var paramValue = params[paramName];\n return \"\".concat(paramName, \"=\").concat(encodeURIComponent(paramValue));\n }).join('&');\n};\nvar delay = function delay(ms) {\n return new Promise(function (resolve) {\n return setTimeout(resolve, ms);\n });\n};\nvar defaultOptions = {\n params: {},\n minLength: 2,\n retryDelay: 500,\n renderCallback: function renderCallback() {\n /*eslint no-console: 0*/\n console.error('No renderCallback supplied');\n },\n initialRenderCallback: function initialRenderCallback() {\n /*eslint no-console: 0*/\n console.error('No initialRenderCallback supplied');\n },\n type: 'adresse',\n baseUrl: 'https://dawa.aws.dk',\n adgangsadresserOnly: false,\n stormodtagerpostnumre: true,\n supplerendebynavn: true,\n fuzzy: true,\n fetchImpl: function fetchImpl(url, params) {\n return fetch(\"\".concat(url, \"?\").concat(formatParams(params)), {\n mode: 'cors'\n }).then(function (result) {\n return result.json();\n });\n }\n};\nvar AutocompleteController = /*#__PURE__*/function () {\n function AutocompleteController(options) {\n _classCallCheck(this, AutocompleteController);\n options = Object.assign({}, defaultOptions, options || {});\n this.options = options;\n this.state = {\n currentRequest: null,\n pendingRequest: null\n };\n this.selected = null;\n }\n _createClass(AutocompleteController, [{\n key: \"_getAutocompleteResponse\",\n value: function _getAutocompleteResponse(text, caretpos, skipVejnavn, adgangsadresseid, supplerendebynavn, stormodtagerpostnumre) {\n var params = Object.assign({}, this.options.params, {\n q: text,\n type: this.options.type,\n caretpos: caretpos,\n supplerendebynavn: supplerendebynavn,\n stormodtagerpostnumre: stormodtagerpostnumre,\n multilinje: true\n });\n if (this.options.fuzzy) {\n params.fuzzy = '';\n }\n if (adgangsadresseid) {\n params.adgangsadresseid = adgangsadresseid;\n }\n if (skipVejnavn) {\n params.startfra = 'adgangsadresse';\n }\n return this.options.fetchImpl(\"\".concat(this.options.baseUrl, \"/autocomplete\"), params);\n }\n }, {\n key: \"_scheduleRequest\",\n value: function _scheduleRequest(request) {\n if (this.state.currentRequest !== null) {\n this.state.pendingRequest = request;\n } else {\n this.state.currentRequest = request;\n this._executeRequest();\n }\n }\n }, {\n key: \"_executeRequest\",\n value: function _executeRequest() {\n var _this = this;\n var request = this.state.currentRequest;\n var adgangsadresseid = null;\n var skipVejnavn = false;\n var text, caretpos;\n if (request.selected) {\n var item = request.selected;\n if (item.type !== this.options.type) {\n adgangsadresseid = item.type === 'adgangsadresse' ? item.data.id : null;\n skipVejnavn = item.type === 'vejnavn';\n text = item.tekst;\n caretpos = item.caretpos;\n } else {\n this.options.selectCallback(item);\n this.selected = item;\n this._requestCompleted();\n return;\n }\n } else {\n text = request.text;\n caretpos = request.caretpos;\n }\n if (request.selectedId) {\n var params = {\n id: request.selectedId,\n type: this.options.type\n };\n return this.options.fetchImpl(\"\".concat(this.options.baseUrl, \"/autocomplete\"), params).then(function (result) {\n return _this._handleResponse(request, result);\n }, function (error) {\n return _this._handleFailedRequest(request, error);\n });\n } else if (request.selected || request.text.length >= this.options.minLength) {\n this._getAutocompleteResponse(text, caretpos, skipVejnavn, adgangsadresseid, this.options.supplerendebynavn, this.options.stormodtagerpostnumre).then(function (result) {\n return _this._handleResponse(request, result);\n }, function (error) {\n return _this._handleFailedRequest(request, error);\n });\n } else {\n this._handleResponse(request, []);\n }\n }\n }, {\n key: \"_handleFailedRequest\",\n value: function _handleFailedRequest(request, error) {\n var _this2 = this;\n console.error('DAWA request failed', error);\n return delay(this.options.retryDelay).then(function () {\n if (!_this2.state.pendingRequest) {\n _this2._scheduleRequest(request);\n }\n _this2._requestCompleted();\n });\n }\n }, {\n key: \"_handleResponse\",\n value: function _handleResponse(request, result) {\n if (request.selected) {\n if (result.length === 1) {\n var item = result[0];\n if (item.type === this.options.type) {\n this.options.selectCallback(item);\n } else {\n if (!this.state.pendingRequest) {\n this.state.pendingRequest = {\n selected: item\n };\n }\n }\n } else if (this.options.renderCallback) {\n this.options.renderCallback(result);\n }\n } else if (request.selectedId) {\n if (result.length === 1) {\n this.selected = result[0];\n this.options.initialRenderCallback(result[0].tekst);\n }\n } else {\n if (this.options.renderCallback) {\n this.options.renderCallback(result);\n }\n }\n this._requestCompleted();\n }\n }, {\n key: \"_requestCompleted\",\n value: function _requestCompleted() {\n this.state.currentRequest = this.state.pendingRequest;\n this.state.pendingRequest = null;\n if (this.state.currentRequest) {\n this._executeRequest();\n }\n }\n }, {\n key: \"setRenderCallback\",\n value: function setRenderCallback(renderCallback) {\n this.options.renderCallback = renderCallback;\n }\n }, {\n key: \"setInitialRenderCallback\",\n value: function setInitialRenderCallback(renderCallback) {\n this.options.initialRenderCallback = renderCallback;\n }\n }, {\n key: \"setSelectCallback\",\n value: function setSelectCallback(selectCallback) {\n this.options.selectCallback = selectCallback;\n }\n }, {\n key: \"update\",\n value: function update(text, caretpos) {\n var request = {\n text: text,\n caretpos: caretpos\n };\n this._scheduleRequest(request);\n }\n }, {\n key: \"select\",\n value: function select(item) {\n var request = {\n selected: item\n };\n this._scheduleRequest(request);\n }\n }, {\n key: \"selectInitial\",\n value: function selectInitial(id) {\n var request = {\n selectedId: id\n };\n this._scheduleRequest(request);\n }\n }, {\n key: \"destroy\",\n value: function destroy() {}\n }]);\n return AutocompleteController;\n}();\n\n/**\n * lodash (Custom Build) \n * Build: `lodash modularize exports=\"npm\" -o ./`\n * Copyright jQuery Foundation and other contributors \n * Released under MIT license \n * Based on Underscore.js 1.8.3 \n * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors\n */\n\n/** Used as the `TypeError` message for \"Functions\" methods. */\nvar FUNC_ERROR_TEXT = 'Expected a function';\n\n/** Used as references for various `Number` constants. */\nvar NAN = 0 / 0;\n\n/** `Object#toString` result references. */\nvar symbolTag = '[object Symbol]';\n\n/** Used to match leading and trailing whitespace. */\nvar reTrim = /^\\s+|\\s+$/g;\n\n/** Used to detect bad signed hexadecimal string values. */\nvar reIsBadHex = /^[-+]0x[0-9a-f]+$/i;\n\n/** Used to detect binary string values. */\nvar reIsBinary = /^0b[01]+$/i;\n\n/** Used to detect octal string values. */\nvar reIsOctal = /^0o[0-7]+$/i;\n\n/** Built-in method references without a dependency on `root`. */\nvar freeParseInt = parseInt;\n\n/** Detect free variable `global` from Node.js. */\nvar freeGlobal = typeof commonjsGlobal == 'object' && commonjsGlobal && commonjsGlobal.Object === Object && commonjsGlobal;\n\n/** Detect free variable `self`. */\nvar freeSelf = typeof self == 'object' && self && self.Object === Object && self;\n\n/** Used as a reference to the global object. */\nvar root = freeGlobal || freeSelf || Function('return this')();\n\n/** Used for built-in method references. */\nvar objectProto = Object.prototype;\n\n/**\n * Used to resolve the\n * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)\n * of values.\n */\nvar objectToString = objectProto.toString;\n\n/* Built-in method references for those with the same name as other `lodash` methods. */\nvar nativeMax = Math.max,\n nativeMin = Math.min;\n\n/**\n * Gets the timestamp of the number of milliseconds that have elapsed since\n * the Unix epoch (1 January 1970 00:00:00 UTC).\n *\n * @static\n * @memberOf _\n * @since 2.4.0\n * @category Date\n * @returns {number} Returns the timestamp.\n * @example\n *\n * _.defer(function(stamp) {\n * console.log(_.now() - stamp);\n * }, _.now());\n * // => Logs the number of milliseconds it took for the deferred invocation.\n */\nvar now = function() {\n return root.Date.now();\n};\n\n/**\n * Creates a debounced function that delays invoking `func` until after `wait`\n * milliseconds have elapsed since the last time the debounced function was\n * invoked. The debounced function comes with a `cancel` method to cancel\n * delayed `func` invocations and a `flush` method to immediately invoke them.\n * Provide `options` to indicate whether `func` should be invoked on the\n * leading and/or trailing edge of the `wait` timeout. The `func` is invoked\n * with the last arguments provided to the debounced function. Subsequent\n * calls to the debounced function return the result of the last `func`\n * invocation.\n *\n * **Note:** If `leading` and `trailing` options are `true`, `func` is\n * invoked on the trailing edge of the timeout only if the debounced function\n * is invoked more than once during the `wait` timeout.\n *\n * If `wait` is `0` and `leading` is `false`, `func` invocation is deferred\n * until to the next tick, similar to `setTimeout` with a timeout of `0`.\n *\n * See [David Corbacho's article](https://css-tricks.com/debouncing-throttling-explained-examples/)\n * for details over the differences between `_.debounce` and `_.throttle`.\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Function\n * @param {Function} func The function to debounce.\n * @param {number} [wait=0] The number of milliseconds to delay.\n * @param {Object} [options={}] The options object.\n * @param {boolean} [options.leading=false]\n * Specify invoking on the leading edge of the timeout.\n * @param {number} [options.maxWait]\n * The maximum time `func` is allowed to be delayed before it's invoked.\n * @param {boolean} [options.trailing=true]\n * Specify invoking on the trailing edge of the timeout.\n * @returns {Function} Returns the new debounced function.\n * @example\n *\n * // Avoid costly calculations while the window size is in flux.\n * jQuery(window).on('resize', _.debounce(calculateLayout, 150));\n *\n * // Invoke `sendMail` when clicked, debouncing subsequent calls.\n * jQuery(element).on('click', _.debounce(sendMail, 300, {\n * 'leading': true,\n * 'trailing': false\n * }));\n *\n * // Ensure `batchLog` is invoked once after 1 second of debounced calls.\n * var debounced = _.debounce(batchLog, 250, { 'maxWait': 1000 });\n * var source = new EventSource('/stream');\n * jQuery(source).on('message', debounced);\n *\n * // Cancel the trailing debounced invocation.\n * jQuery(window).on('popstate', debounced.cancel);\n */\nfunction debounce(func, wait, options) {\n var lastArgs,\n lastThis,\n maxWait,\n result,\n timerId,\n lastCallTime,\n lastInvokeTime = 0,\n leading = false,\n maxing = false,\n trailing = true;\n\n if (typeof func != 'function') {\n throw new TypeError(FUNC_ERROR_TEXT);\n }\n wait = toNumber(wait) || 0;\n if (isObject(options)) {\n leading = !!options.leading;\n maxing = 'maxWait' in options;\n maxWait = maxing ? nativeMax(toNumber(options.maxWait) || 0, wait) : maxWait;\n trailing = 'trailing' in options ? !!options.trailing : trailing;\n }\n\n function invokeFunc(time) {\n var args = lastArgs,\n thisArg = lastThis;\n\n lastArgs = lastThis = undefined;\n lastInvokeTime = time;\n result = func.apply(thisArg, args);\n return result;\n }\n\n function leadingEdge(time) {\n // Reset any `maxWait` timer.\n lastInvokeTime = time;\n // Start the timer for the trailing edge.\n timerId = setTimeout(timerExpired, wait);\n // Invoke the leading edge.\n return leading ? invokeFunc(time) : result;\n }\n\n function remainingWait(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime,\n result = wait - timeSinceLastCall;\n\n return maxing ? nativeMin(result, maxWait - timeSinceLastInvoke) : result;\n }\n\n function shouldInvoke(time) {\n var timeSinceLastCall = time - lastCallTime,\n timeSinceLastInvoke = time - lastInvokeTime;\n\n // Either this is the first call, activity has stopped and we're at the\n // trailing edge, the system time has gone backwards and we're treating\n // it as the trailing edge, or we've hit the `maxWait` limit.\n return (lastCallTime === undefined || (timeSinceLastCall >= wait) ||\n (timeSinceLastCall < 0) || (maxing && timeSinceLastInvoke >= maxWait));\n }\n\n function timerExpired() {\n var time = now();\n if (shouldInvoke(time)) {\n return trailingEdge(time);\n }\n // Restart the timer.\n timerId = setTimeout(timerExpired, remainingWait(time));\n }\n\n function trailingEdge(time) {\n timerId = undefined;\n\n // Only invoke if we have `lastArgs` which means `func` has been\n // debounced at least once.\n if (trailing && lastArgs) {\n return invokeFunc(time);\n }\n lastArgs = lastThis = undefined;\n return result;\n }\n\n function cancel() {\n if (timerId !== undefined) {\n clearTimeout(timerId);\n }\n lastInvokeTime = 0;\n lastArgs = lastCallTime = lastThis = timerId = undefined;\n }\n\n function flush() {\n return timerId === undefined ? result : trailingEdge(now());\n }\n\n function debounced() {\n var time = now(),\n isInvoking = shouldInvoke(time);\n\n lastArgs = arguments;\n lastThis = this;\n lastCallTime = time;\n\n if (isInvoking) {\n if (timerId === undefined) {\n return leadingEdge(lastCallTime);\n }\n if (maxing) {\n // Handle invocations in a tight loop.\n timerId = setTimeout(timerExpired, wait);\n return invokeFunc(lastCallTime);\n }\n }\n if (timerId === undefined) {\n timerId = setTimeout(timerExpired, wait);\n }\n return result;\n }\n debounced.cancel = cancel;\n debounced.flush = flush;\n return debounced;\n}\n\n/**\n * Checks if `value` is the\n * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)\n * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)\n *\n * @static\n * @memberOf _\n * @since 0.1.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is an object, else `false`.\n * @example\n *\n * _.isObject({});\n * // => true\n *\n * _.isObject([1, 2, 3]);\n * // => true\n *\n * _.isObject(_.noop);\n * // => true\n *\n * _.isObject(null);\n * // => false\n */\nfunction isObject(value) {\n var type = typeof value;\n return !!value && (type == 'object' || type == 'function');\n}\n\n/**\n * Checks if `value` is object-like. A value is object-like if it's not `null`\n * and has a `typeof` result of \"object\".\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is object-like, else `false`.\n * @example\n *\n * _.isObjectLike({});\n * // => true\n *\n * _.isObjectLike([1, 2, 3]);\n * // => true\n *\n * _.isObjectLike(_.noop);\n * // => false\n *\n * _.isObjectLike(null);\n * // => false\n */\nfunction isObjectLike(value) {\n return !!value && typeof value == 'object';\n}\n\n/**\n * Checks if `value` is classified as a `Symbol` primitive or object.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to check.\n * @returns {boolean} Returns `true` if `value` is a symbol, else `false`.\n * @example\n *\n * _.isSymbol(Symbol.iterator);\n * // => true\n *\n * _.isSymbol('abc');\n * // => false\n */\nfunction isSymbol(value) {\n return typeof value == 'symbol' ||\n (isObjectLike(value) && objectToString.call(value) == symbolTag);\n}\n\n/**\n * Converts `value` to a number.\n *\n * @static\n * @memberOf _\n * @since 4.0.0\n * @category Lang\n * @param {*} value The value to process.\n * @returns {number} Returns the number.\n * @example\n *\n * _.toNumber(3.2);\n * // => 3.2\n *\n * _.toNumber(Number.MIN_VALUE);\n * // => 5e-324\n *\n * _.toNumber(Infinity);\n * // => Infinity\n *\n * _.toNumber('3.2');\n * // => 3.2\n */\nfunction toNumber(value) {\n if (typeof value == 'number') {\n return value;\n }\n if (isSymbol(value)) {\n return NAN;\n }\n if (isObject(value)) {\n var other = typeof value.valueOf == 'function' ? value.valueOf() : value;\n value = isObject(other) ? (other + '') : other;\n }\n if (typeof value != 'string') {\n return value === 0 ? value : +value;\n }\n value = value.replace(reTrim, '');\n var isBinary = reIsBinary.test(value);\n return (isBinary || reIsOctal.test(value))\n ? freeParseInt(value.slice(2), isBinary ? 2 : 8)\n : (reIsBadHex.test(value) ? NAN : +value);\n}\n\nvar lodash_debounce = debounce;\n\nfunction dawaAutocomplete(inputElm, options) {\n options = Object.assign({\n select: function select() {\n return null;\n }\n }, options);\n var controllerOptions = ['baseUrl', 'minLength', 'params', 'fuzzy', 'stormodtagerpostnumre', 'supplerendebynavn', 'type'].reduce(function (memo, optionName) {\n if (options.hasOwnProperty(optionName)) {\n memo[optionName] = options[optionName];\n }\n return memo;\n }, {});\n if (!controllerOptions.type) {\n if (options.adgangsadresserOnly) {\n controllerOptions.type = 'adgangsadresse';\n } else {\n controllerOptions.type = 'adresse';\n }\n }\n var controller = new AutocompleteController(controllerOptions);\n var updateControllerOnTextChange = function updateControllerOnTextChange(newText, newCaretpos) {\n return controller.update(newText, newCaretpos);\n };\n updateControllerOnTextChange = options.debounce ? lodash_debounce(updateControllerOnTextChange, options.debounce, {\n maxWait: 500\n }) : updateControllerOnTextChange;\n var ui = autocompleteUi(inputElm, {\n onSelect: function onSelect(suggestion) {\n controller.select(suggestion);\n },\n onTextChange: updateControllerOnTextChange,\n render: options.render,\n multiline: options.multiline || false\n });\n controller.setRenderCallback(function (suggestions) {\n return ui.setSuggestions(suggestions);\n });\n controller.setSelectCallback(function (selected) {\n ui.selectAndClose(selected.tekst);\n options.select(selected);\n });\n controller.setInitialRenderCallback(function (text) {\n return ui.selectAndClose(text);\n });\n if (options.id) {\n controller.selectInitial(options.id);\n }\n return {\n id: function id(_id) {\n return controller.selectInitial(_id);\n },\n destroy: function destroy() {\n return ui.destroy();\n },\n selected: function selected() {\n return controller.selected;\n }\n };\n}\n\nexport { dawaAutocomplete };\n", "\uFEFF\"use strict\";\r\n\r\nimport * as dawaAutocomplete2 from 'dawa-autocomplete2';\r\nconst utmgeoconv = require(\"utmgeoconv\");\r\n\r\nclass ConnectionCalculator {\r\n constructor(calculator) {\r\n this.calculator = calculator;\r\n if (!this.calculator) return;\r\n\r\n this.step1 = calculator.querySelector(\"#connectioncalculator__step1\");\r\n this.step2 = calculator.querySelector(\"#connectioncalculator__step2\");\r\n this.step3 = calculator.querySelector(\"#connectioncalculator__step3\");\r\n\r\n if (!this.step1 || !this.step2 || !this.step3) {\r\n this.calculator.remove();\r\n console.error(\"ConnectionCalculator: Steps not found\");\r\n return;\r\n }\r\n\r\n if (!window.jQuery) {\r\n this.calculator.remove();\r\n console.error(\"ConnectionCalculator: jQuery not found\");\r\n return;\r\n }\r\n\r\n this.doAllTheJQueryStuff();\r\n\r\n this.addressInput = calculator.querySelector(\"#addressSearch\");\r\n\r\n if (this.addressInput) {\r\n\r\n dawaAutocomplete2.dawaAutocomplete(this.addressInput, {\r\n select: selected => {\r\n this.getCoordinatesBySelected(selected);\r\n }\r\n });\r\n }\r\n }\r\n\r\n doAllTheJQueryStuff() {\r\n\r\n\r\n this.$ = window.jQuery;\r\n\r\n var that = this;\r\n\r\n this.$(\"#connectioncalculator__step2, #connectioncalculator__step2-1, #connectioncalculator__step2-9, #connectioncalculator__step3\").hide();\r\n\r\n this.$(\"#connectioncalculator__step1 form\").validate({\r\n rules: {\r\n arealKaelderplan: {\r\n required: true,\r\n depends: function (element) {\r\n that.$(\"#kaelder1Sal-kaelder\").is(\":checked\");\r\n }\r\n },\r\n areal1salsplan: {\r\n required: true,\r\n depends: function (element) {\r\n that.$(\"#kaelder1Sal-1sal\").is(\":checked\");\r\n }\r\n }\r\n }\r\n });\r\n\r\n this.$(\"#kaelder1Sal-kaelder\").click(function () {\r\n if (that.$(this).is(\":checked\")) {\r\n that.$(\"#inp__arealKaelderplan\").show();\r\n }\r\n else {\r\n that.$(\"#inp__arealKaelderplan\").hide();\r\n }\r\n });\r\n\r\n this.$(\"#connectioncalculator__step1 form\").on(\"submit\", function (e) {\r\n\r\n e.preventDefault();\r\n\r\n var errors = [];\r\n var isExtension = that.$(this).find(\"#eksisterendeNet-ja-udvidelse:checked\").length > 0;\r\n if (that.$(this).find(\"[name=eksisterendeNet]:checked\").length == 0) {\r\n that.$(this).find(\"#eksisterendeNet-vedikke\").attr(\"checked\", \"checked\");\r\n }\r\n\r\n if (that.$(this).valid()) {\r\n var antalMeter = parseInt(that.$(this).find(\"[name=antalMeter]\").val());\r\n var arealGrund = parseFloat(that.$(this).find(\"[name=arealGrundplan]\").val().replace(/\\./g, \"\").replace(/\\,/g, \".\"));\r\n var arealKaelder = that.$(this).find(\"#kaelder1Sal-kaelder:checked\").length > 0 ? parseFloat(\"0\" + that.$(this).find(\"[name=arealKaelderplan]\").val().replace(/\\./g, \"\").replace(/\\,/g, \".\")) * .25 : 0;\r\n\r\n var arealTotal = arealGrund + arealKaelder;\r\n\r\n var price = 0;\r\n\r\n // investeringsbidrag\r\n for (let i = 0; i < prices.length; i++) {\r\n\r\n // find hvor grundareal er mere en fra og mindre end til\r\n if (parseFloat(\"0\" + prices[i].from) <= arealTotal && parseFloat(\"0\" + prices[i].to) >= arealTotal) {\r\n\r\n // effektbidrag\r\n price = parseFloat(prices[i].baseprice.replace(/\\./g, \"\").replace(/\\,/g, \".\"));\r\n console.log(\"effektbidrag\", price);\r\n\r\n // hvis fra er mere end nul, l\u00E6gges der pris pr. yderligere m2 p\u00E5\r\n // alt udover \"fra\" ganges med unitprice\r\n if (parseInt(prices[i].from) > 0) {\r\n var extensionSqMeters = arealTotal - parseInt(prices[i].from);\r\n var unitPrice = parseFloat(prices[i].unitprice.replace(/\\./g, \"\").replace(/\\,/g, \".\"));\r\n var extensionAmount = (extensionSqMeters * unitPrice);\r\n console.log(\"yderligere m2\", extensionSqMeters, unitPrice, extensionAmount);\r\n price = price + extensionAmount;\r\n }\r\n }\r\n\r\n }\r\n\r\n // stikledningsbidrag\r\n var tenPct = price * 0.1;\r\n console.log(\"10% till\u00E6g\", tenPct);\r\n var pipeMeters = Math.max(antalMeter, 5);\r\n var pipeAmount = pipeMeters * pipePrice;\r\n console.log(\"stikledning\", pipeMeters, pipePrice, pipeAmount);\r\n console.log(\"afslutning i hus\", housePrice);\r\n console.log(\"opstartstill\u00E6g\", initialPrice);\r\n \r\n var extensionAmount = (isExtension ? arealTotal * extensionPrice : 0);\r\n var newAreaDiscountAmount = (isExtension ? discountNewArea : 0);\r\n \r\n console.log(\"byggemodning\", arealTotal, extensionPrice, extensionAmount);\r\n console.log(\"rabat ved nye omr\u00E5der\", newAreaDiscountAmount);\r\n \r\n price = price + tenPct + pipeAmount + housePrice + initialPrice + extensionAmount + newAreaDiscountAmount;\r\n \r\n console.log(\"total pris\", price);\r\n\r\n // afrund pris til n\u00E6rmeste 100\r\n price = Math.round(price / 100) * 100;\r\n \r\n console.log(\"n\u00E6rmeste 100\", price);\r\n\r\n that.$(\"#connectioncalculator__price\").text(that.formatNumber(price, 0, 3, '.', ',') + \" kr.\");\r\n that.$(\"#connectioncalculator__arealGrund\").text(arealGrund);\r\n that.$(\"#connectioncalculator__antalMeter\").text(antalMeter);\r\n\r\n that.$(\"#connectioncalculator__boligHar\").text(\"\");\r\n\r\n that.$(this).find(\"[name=kaelder1Sal]:checked\").each(function (index) {\r\n\r\n if (index > 0) {\r\n $(\"#connectioncalculator__boligHar\").html($(\"#connectioncalculator__boligHar\").html() + \" og \");\r\n }\r\n if (index == 0) {\r\n $(\"#connectioncalculator__boligHar\").html(\"Boligen har \");\r\n }\r\n\r\n that.$(\"#connectioncalculator__boligHar\").html($(\"#connectioncalculator__boligHar\").html() + that.$(this).val());\r\n\r\n var input = \"\";\r\n\r\n input = (that.$(this).val() == \"k\u00E6lder\" ? \"#inp__kaelder\" : input);\r\n\r\n that.$(\"#connectioncalculator__boligHar\").html($(\"#connectioncalculator__boligHar\").html() + \" (\" + that.$(input).val() + \" m2)\");\r\n });\r\n\r\n if (that.$(\"#connectioncalculator__boligHar\").html() != \"\") {\r\n\r\n that.$(\"#connectioncalculator__boligHar\").html($(\"#connectioncalculator__boligHar\").html() + \".\");\r\n }\r\n\r\n if (that.$(this).find(\"[name=eksisterendeNet]:checked\").val() == \"Ja\") {\r\n that.$(\"#connectioncalculator__boligStik\").text(\"gammelt fjernvarmeomr\u00E5de\");\r\n }\r\n\r\n if (that.$(this).find(\"[name=eksisterendeNet]:checked\").val() == \"Ja, udvidelsesomr\u00E5de\") {\r\n that.$(\"#connectioncalculator__boligStik\").text(\"nyetableret fjernvarmeomr\u00E5de\");\r\n }\r\n\r\n if (that.$(this).find(\"[name=eksisterendeNet]:checked\").val() == \"Nej\") {\r\n that.$(\"#connectioncalculator__boligStik\").text(\"ikke\");\r\n }\r\n\r\n if (that.$(this).find(\"[name=eksisterendeNet]:checked\").val() == \"Ved ikke\") {\r\n that.$(\"#connectioncalculator__boligStik\").text(\"m\u00E5ske\");\r\n }\r\n\r\n\r\n that.$(\"#connectioncalculator__step1 type[submit]\").html(\" Beregner\");\r\n\r\n setTimeout(\r\n function () {\r\n // preudfyld formular i step 3\r\n that.$(\".umbraco-forms-field.boligoplysninger textarea\").val(that.$(\"#connectioncalculator__result\").text().replace(/^\\s+|\\s+$/gm, '').replace(/( {2,})/g, \" \").replace(\"\\r\\n\", \"\"));\r\n\r\n // go to result\r\n that.$(\"#connectioncalculator__step1\").slideUp(200).fadeOut(200);\r\n\r\n that.$(\"#connectioncalculator__step2\").slideDown(200).fadeIn(200);\r\n\r\n\r\n that.$(\"#connectioncalculator__step1 .connectioncalculator__button\").html(\"Udregn pris\");\r\n }, 350);\r\n\r\n //}\r\n }\r\n return false;\r\n\r\n });\r\n\r\n that.$(\"[data-connectioncalculator__go]\").on(\"click\", function () {\r\n var goto = that.$(this).attr(\"data-connectioncalculator__go\").split(\",\");\r\n that.goToStep(goto[0], goto[1]);\r\n });\r\n }\r\n\r\n goToStep(to, from) {\r\n this.$(\"#connectioncalculator__\" + from).slideUp(200).fadeOut(200);\r\n this.$(\"#connectioncalculator__\" + to).slideDown(200).fadeIn(200);\r\n }\r\n\r\n formatNumber(inp, n, x, s, c) {\r\n var re = '\\\\d(?=(\\\\d{' + (x || 3) + '})+' + (n > 0 ? '\\\\D' : '$') + ')',\r\n num = inp.toFixed(Math.max(0, ~~n));\r\n\r\n return (c ? num.replace('.', c) : num).replace(new RegExp(re, 'g'), '$&' + (s || ','));\r\n }\r\n\r\n getCoordinatesBySelected(selected) {\r\n\r\n let url = new URL(\"https://dawa.aws.dk/adgangsadresser\");\r\n url.search = new URLSearchParams({\r\n vejnavn: selected.data.vejnavn,\r\n husnr: selected.data.husnr,\r\n postnr: selected.data.postnr,\r\n struktur: \"mini\"\r\n }).toString();\r\n\r\n fetch(url, {\r\n method: \"GET\",\r\n headers: {\r\n \"Accept\": \"application/json\"\r\n }\r\n })\r\n .then(response => response.json())\r\n .then(json => {\r\n\r\n if (json[0]) {\r\n var coords = this.calculateUtm32Coords(json[0]);\r\n this.searchInGis(coords, json[0]);\r\n\r\n this.$(\".umbraco-forms-field.adresse input\").val(selected.data.vejnavn + \" \" + selected.data.husnr);\r\n this.$(\".umbraco-forms-field.postnrogby input\").val(selected.data.postnr + \" \" + selected.data.postnrnavn);\r\n }\r\n })\r\n .catch(err => console.log(err));\r\n }\r\n\r\n\r\n calculateUtm32Coords(selectedItem) {\r\n return utmgeoconv.latLonToUtm(selectedItem.y, selectedItem.x, 32);\r\n }\r\n\r\n searchInGis(coords, selectedItem) {\r\n this.$(\"#connectioncalculator__step1 [type=submit]\").removeClass(\"hidden\");\r\n this.$(\"#connectioncalculator__step1-1:visible\").slideUp(200).fadeOut(200);\r\n this.$(\"#connectioncalculator__step1-9:visible\").slideUp(200).fadeOut(200);\r\n this.$(\"#connectioncalculator__step1-3:visible\").slideUp(200).fadeOut(200);\r\n this.$(\"#connectioncalculator__step1 [type=submit]\").prop(\"disabled\", true).addClass(\"opacity-50\");\r\n this.$(\"#connectioncalculator__step1 [type=submit]>span\").text(\"Vent, finder omr\u00E5de for din adresse\");\r\n\r\n fetch(`/umbraco/api/AreaMap/GetArea?x=${coords.x}&y=${coords.y}`)\r\n .then(response => response.json())\r\n .then(data => {\r\n this.$(\"#connectioncalculator__step1 [type=submit]>span\").text(\"Udregn pris\");\r\n this.setAndShowResult(data);\r\n })\r\n .catch(err => console.log(err));\r\n }\r\n\r\n\r\n setAndShowResult(status) {\r\n this.$(\"#connectioncalculator__step1 [type=submit]\").removeClass(\"hidden\");\r\n \r\n /*\r\n \u2022\tLag 0 = eksisterende omr\u00E5der = Aktiv HER SKAL DET V\u00C6RE MULIGT AT KLIKKE P\u00C5 KNAPPEN UDREGN PRIS\r\n \u2022\tLag 1 = konverterings omr\u00E5der = Aktiv (er der noget med prisen der) HER SKAL DET V\u00C6RE MULIGT AT KLIKKE P\u00C5 KNAPPEN UDREGN PRIS\r\n \u2022\tLag 2 = tilmeldings omr\u00E5der = Aktiv? Skal de selv kunne beregne en pris? SKAL V\u00C6RE AKTIV OG LINKE TIL DENNE SIDE: https://www.fjernvarmefyn.dk/overvejer-du-fjernvarme/omraader\r\n \u2022\tLag 3 = unders\u00F8gelses omr\u00E5der inaktiv? SKAL V\u00C6RE AKTIV OG LINKE TIL DENNE SIDE: https://www.fjernvarmefyn.dk/overvejer-du-fjernvarme/overblik/undersogelsesomraader\r\n\r\n */\r\n\r\n if (status.status === 8 || status.status === 0) {\r\n // eksisterende\r\n this.$(\"#eksisterendeNet-ja\").prop(\"checked\", true);\r\n }\r\n else if (status.status === 9 || status.status === 1) {\r\n // nyt eller unders\u00F8gelse\r\n this.$(\"#eksisterendeNet-ja-udvidelse\").prop(\"checked\", true);\r\n }\r\n\r\n if (status.status === 8 || status.status === 9 || status.status === 0 || status.status === 1) {\r\n this.$(\"#connectioncalculator__step1 [type=submit]\").prop(\"disabled\", false).removeClass(\"opacity-50\");\r\n }\r\n else {\r\n this.$(\"#connectioncalculator__step1 [type=submit]\").prop(\"disabled\", true).addClass(\"opacity-50\");\r\n this.$(\"#eksisterendeNet-ja\").prop(\"checked\", false);\r\n this.$(\"#eksisterendeNet-ja-udvidelse\").prop(\"checked\", false);\r\n }\r\n\r\n if (status.status === -1) {\r\n this.$(\"#connectioncalculator__step1-1\").slideDown(200).fadeIn(200);\r\n }\r\n\r\n if (status.status === 10 || status.status === 2) {\r\n\r\n this.$(\"#connectioncalculator__step1 [type=submit]\").addClass(\"hidden\");\r\n\r\n var link = status.nextStepLink;\r\n if (!link) {\r\n link = this.$(\"#connectioncalculator__step1-9-link\").attr(\"href\");\r\n }\r\n\r\n if (link) {\r\n this.$(\"#connectioncalculator__step1-9-link\").attr(\"href\", link).removeClass(\"hidden\");\r\n }\r\n else {\r\n this.$(\"#connectioncalculator__step1-9-link\").addClass(\"hidden\");\r\n }\r\n this.$(\"#connectioncalculator__step1-9\").slideDown(200).fadeIn(200);\r\n }\r\n\r\n if (status.status === 3) {\r\n\r\n this.$(\"#connectioncalculator__step1 [type=submit]\").addClass(\"hidden\");\r\n\r\n var link = status.nextStepLink;\r\n if (!link) {\r\n link = this.$(\"#connectioncalculator__step1-3-link\").attr(\"href\");\r\n }\r\n\r\n if (link) {\r\n this.$(\"#connectioncalculator__step1-3-link\").attr(\"href\", link).removeClass(\"hidden\");\r\n }\r\n else {\r\n this.$(\"#connectioncalculator__step1-3-link\").addClass(\"hidden\");\r\n }\r\n this.$(\"#connectioncalculator__step1-3\").slideDown(200).fadeIn(200);\r\n }\r\n\r\n }\r\n}\r\n\r\nconst connectionCalculatorInit = function () {\r\n [...document.querySelectorAll(\".connectioncalculator\")].map(cc => new ConnectionCalculator(cc));\r\n}\r\nexport default connectionCalculatorInit();\r\n", "var win = window;\n\nexport var raf = win.requestAnimationFrame\n || win.webkitRequestAnimationFrame\n || win.mozRequestAnimationFrame\n || win.msRequestAnimationFrame\n || function(cb) { return setTimeout(cb, 16); };\n", "var win = window;\n\nexport var caf = win.cancelAnimationFrame\n || win.mozCancelAnimationFrame\n || function(id){ clearTimeout(id); };\n", "export function extend() {\n var obj, name, copy,\n target = arguments[0] || {},\n i = 1,\n length = arguments.length;\n\n for (; i < length; i++) {\n if ((obj = arguments[i]) !== null) {\n for (name in obj) {\n copy = obj[name];\n\n if (target === copy) {\n continue;\n } else if (copy !== undefined) {\n target[name] = copy;\n }\n }\n }\n }\n return target;\n}", "export function checkStorageValue (value) {\n return ['true', 'false'].indexOf(value) >= 0 ? JSON.parse(value) : value;\n}", "export function setLocalStorage(storage, key, value, access) {\n if (access) {\n try { storage.setItem(key, value); } catch (e) {}\n }\n return value;\n}", "export function getSlideId() {\n var id = window.tnsId;\n window.tnsId = !id ? 1 : id + 1;\n \n return 'tns' + window.tnsId;\n}", "export function getBody () {\n var doc = document,\n body = doc.body;\n\n if (!body) {\n body = doc.createElement('body');\n body.fake = true;\n }\n\n return body;\n}", "export var docElement = document.documentElement;", "import { docElement } from './docElement.js';\n\nexport function setFakeBody (body) {\n var docOverflow = '';\n if (body.fake) {\n docOverflow = docElement.style.overflow;\n //avoid crashing IE8, if background image is used\n body.style.background = '';\n //Safari 5.13/5.1.4 OSX stops loading if ::-webkit-scrollbar is used and scrollbars are visible\n body.style.overflow = docElement.style.overflow = 'hidden';\n docElement.appendChild(body);\n }\n\n return docOverflow;\n}", "import { docElement } from './docElement.js';\n\nexport function resetFakeBody (body, docOverflow) {\n if (body.fake) {\n body.remove();\n docElement.style.overflow = docOverflow;\n // Trigger layout so kinetic scrolling isn't disabled in iOS6+\n // eslint-disable-next-line\n docElement.offsetHeight;\n }\n}", "// get css-calc \n// @return - false | calc | -webkit-calc | -moz-calc\n// @usage - var calc = getCalc(); \nimport { getBody } from './getBody.js';\nimport { setFakeBody } from './setFakeBody.js';\nimport { resetFakeBody } from './resetFakeBody.js';\n\nexport function calc() {\n var doc = document, \n body = getBody(),\n docOverflow = setFakeBody(body),\n div = doc.createElement('div'), \n result = false;\n\n body.appendChild(div);\n try {\n var str = '(10px * 10)',\n vals = ['calc' + str, '-moz-calc' + str, '-webkit-calc' + str],\n val;\n for (var i = 0; i < 3; i++) {\n val = vals[i];\n div.style.width = val;\n if (div.offsetWidth === 100) { \n result = val.replace(str, ''); \n break;\n }\n }\n } catch (e) {}\n \n body.fake ? resetFakeBody(body, docOverflow) : div.remove();\n\n return result;\n}", "// get subpixel support value\n// @return - boolean\nimport { getBody } from './getBody.js';\nimport { setFakeBody } from './setFakeBody.js';\nimport { resetFakeBody } from './resetFakeBody.js';\n\nexport function percentageLayout() {\n // check subpixel layout supporting\n var doc = document,\n body = getBody(),\n docOverflow = setFakeBody(body),\n wrapper = doc.createElement('div'),\n outer = doc.createElement('div'),\n str = '',\n count = 70,\n perPage = 3,\n supported = false;\n\n wrapper.className = \"tns-t-subp2\";\n outer.className = \"tns-t-ct\";\n\n for (var i = 0; i < count; i++) {\n str += '
';\n }\n\n outer.innerHTML = str;\n wrapper.appendChild(outer);\n body.appendChild(wrapper);\n\n supported = Math.abs(wrapper.getBoundingClientRect().left - outer.children[count - perPage].getBoundingClientRect().left) < 2;\n\n body.fake ? resetFakeBody(body, docOverflow) : wrapper.remove();\n\n return supported;\n}", "import { getBody } from './getBody.js';\nimport { setFakeBody } from './setFakeBody.js';\nimport { resetFakeBody } from './resetFakeBody.js';\n\nexport function mediaquerySupport () {\n if (window.matchMedia || window.msMatchMedia) {\n return true;\n }\n \n var doc = document,\n body = getBody(),\n docOverflow = setFakeBody(body),\n div = doc.createElement('div'),\n style = doc.createElement('style'),\n rule = '@media all and (min-width:1px){.tns-mq-test{position:absolute}}',\n position;\n\n style.type = 'text/css';\n div.className = 'tns-mq-test';\n\n body.appendChild(style);\n body.appendChild(div);\n\n if (style.styleSheet) {\n style.styleSheet.cssText = rule;\n } else {\n style.appendChild(doc.createTextNode(rule));\n }\n\n position = window.getComputedStyle ? window.getComputedStyle(div).position : div.currentStyle['position'];\n\n body.fake ? resetFakeBody(body, docOverflow) : div.remove();\n\n return position === \"absolute\";\n}\n", "// create and append style sheet\nexport function createStyleSheet (media, nonce) {\n // Create the