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EAClC,GACD,CAhDD1D,oBACE7D,KAAKyH,SACLzH,KAAKwE,iBAAiB,8BAA6BgD,EAAExH,KAAIkH,GAAAA,IACzDlH,KAAKwE,iBAAiB,8BAA6BgD,EAAExH,KAAImH,GAAAA,GAC3D,CAEAnD,uBAC4B,MAA1Bd,MAAMc,sBAANd,MAAMc,uBACNhE,KAAK6E,oBAAoB,8BAA6B2C,EAAExH,KAAIkH,GAAAA,IAC5DlH,KAAK6E,oBAAoB,8BAA6B2C,EAAExH,KAAImH,GAAAA,GAC9D,CAEAM,SACE,IA5BgBC,EA6BH,kCA7BgB1K,EA6BmB2K,OA5BH,IAApCC,eAAeC,IAAIH,IAC5BE,eAAeE,OAAOJ,EAAa1K,GA6BjC,MAAM+K,EAAsB/H,KAAKgI,cAAc,qBAGvB,IAAIpI,EAC1B,CAACmI,IACA7H,IACC,MAAMyB,EAAUzB,EAAc,GACxB+H,EAA0BF,EAAoBtB,aAAajE,GAC7Db,EAAQvB,gBAA8C,oBAA5B6H,GAC5BF,EAAoB5C,aAAa3C,EAAwB,eAEtDb,EAAQvB,gBAA8C,gBAA5B6H,GAC7BF,EAAoB5C,aAAa3C,EAAwB,kBAC3D,GAGN,CAAE,MAAO0F,GAEP/B,QAAQC,MAAO,yBAAwBS,IAAOqB,EAChD,CAlDJ,IAAoBR,EAAa1K,CAmD/B,EAeG4K,eAAeC,IAAIhB,IACtBe,eAAeE,OAAOjB,EAAKO,E","sources":["webpack://levende-stillbilde/./node_modules/@nrk/dh-server-libs/get-element-tag.js","webpack://levende-stillbilde/./node_modules/@nrk/dh-server-libs/src/get-element-tag.js","webpack://levende-stillbilde/webpack/bootstrap","webpack://levende-stillbilde/./node_modules/@babel/runtime/helpers/esm/typeof.js","webpack://levende-stillbilde/./node_modules/@babel/runtime/helpers/esm/toPropertyKey.js","webpack://levende-stillbilde/./node_modules/@babel/runtime/helpers/esm/toPrimitive.js","webpack://levende-stillbilde/./node_modules/@babel/runtime/helpers/esm/defineProperty.js","webpack://levende-stillbilde/./node_modules/@nrk/dh-basis-common/dh-basis-common.esm.js","webpack://levende-stillbilde/./node_modules/@nrk/dh-basis-levende-stillbilde/dh-basis-levende-stillbilde.esm.js","webpack://levende-stillbilde/./src/article/client.js"],"sourcesContent":["module.exports = require('./src/get-element-tag')\n","/**\n * Creates a valid custom element name that is versioned (major)\n */\nfunction getElementTag(name, version) {\n const formattedVersion = version ? `-v${version.split('.')[0]}` : ''\n return name + formattedVersion\n}\n\nmodule.exports.getElementTag = getElementTag\n","// The module cache\nvar __webpack_module_cache__ = {};\n\n// The require function\nfunction __webpack_require__(moduleId) {\n\t// Check if module is in cache\n\tvar cachedModule = __webpack_module_cache__[moduleId];\n\tif (cachedModule !== undefined) {\n\t\treturn cachedModule.exports;\n\t}\n\t// Create a new module (and put it into the cache)\n\tvar module = __webpack_module_cache__[moduleId] = {\n\t\t// no module.id needed\n\t\t// no module.loaded needed\n\t\texports: {}\n\t};\n\n\t// Execute the module function\n\t__webpack_modules__[moduleId](module, module.exports, __webpack_require__);\n\n\t// Return the exports of the module\n\treturn module.exports;\n}\n\n","export default function _typeof(obj) {\n \"@babel/helpers - typeof\";\n\n return _typeof = \"function\" == typeof Symbol && \"symbol\" == typeof Symbol.iterator ? function (obj) {\n return typeof obj;\n } : function (obj) {\n return obj && \"function\" == typeof Symbol && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj;\n }, _typeof(obj);\n}","import _typeof from \"./typeof.js\";\nimport toPrimitive from \"./toPrimitive.js\";\nexport default function _toPropertyKey(arg) {\n var key = toPrimitive(arg, \"string\");\n return _typeof(key) === \"symbol\" ? key : String(key);\n}","import _typeof from \"./typeof.js\";\nexport default function _toPrimitive(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}","import toPropertyKey from \"./toPropertyKey.js\";\nexport default function _defineProperty(obj, key, value) {\n key = toPropertyKey(key);\n if (key in obj) {\n Object.defineProperty(obj, key, {\n value: value,\n enumerable: true,\n configurable: true,\n writable: true\n });\n } else {\n obj[key] = value;\n }\n return obj;\n}","import _defineProperty from '@babel/runtime/helpers/defineProperty';\n\n/* eslint-disable compat/compat */\nfunction getDefaultRoot() {\n /*\n Use document if supported\n IntersectionObserver will otherwise default to top level document,\n and IntersectionObserver will not work as expected in an iframe.\n https://github.com/w3c/IntersectionObserver/issues/372\n */\n\n /*\n Safari does not throw error on root: document, but does not trigger events as expected\n returning null for now until better feature detection is possible\n */\n return null;\n /*\n try {\n // eslint-disable-next-line no-new\n new IntersectionObserver(() => {}, { root: document })\n return document\n } catch (e) {\n return null\n }\n */\n}\n\nfunction ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }\n\nfunction _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }\nvar defaultConfig = {\n rootMargin: '0px 0px 0px 0px',\n threshold: [0, 0.5, 1],\n root: getDefaultRoot()\n};\nclass ElementIntersectionObserver {\n constructor(elements, onChange, config) {\n _defineProperty(this, \"intersections\", void 0);\n\n _defineProperty(this, \"elements\", void 0);\n\n this.elements = elements.slice(0);\n this.intersections = elements.map(target => ({\n target,\n isIntersecting: false,\n ratio: null\n }));\n this.intersectionObserver = new IntersectionObserver(entries => {\n var intersections = this.intersections.slice(0);\n entries.forEach(entry => {\n var idx = elements.indexOf(entry.target);\n intersections.splice(idx, 1, {\n target: entry.target,\n isIntersecting: entry.isIntersecting,\n ratio: entry.intersectionRatio\n });\n });\n this.intersections = intersections;\n onChange(this.intersections);\n }, _objectSpread(_objectSpread({}, defaultConfig), config));\n elements.forEach(elm => this.intersectionObserver.observe(elm));\n }\n\n disconnect() {\n // Unregister trigger elements\n this.elements.forEach(elm => this.intersectionObserver.unobserve(elm)); // Disconnect intersection observer\n\n this.intersectionObserver.disconnect();\n }\n\n}\n\nfunction toggleAttribute(el, name, boolValue) {\n if (!el) {\n return;\n }\n\n var nextValue;\n\n if (typeof boolValue !== 'undefined') {\n nextValue = !!boolValue;\n } else {\n nextValue = el.hasAttribute(name);\n }\n\n if (nextValue) {\n el.setAttribute(name, '');\n } else {\n el.removeAttribute(name);\n }\n}\nfunction setAttribute(el, name, nextValue) {\n if (!el) {\n return;\n }\n\n if (nextValue) {\n el.setAttribute(name, nextValue);\n } else {\n el.removeAttribute(name);\n }\n}\nvar closest = (() => {\n var proto = typeof window === 'undefined' ? {} : window.Element.prototype;\n var match = proto.matches || proto.msMatchesSelector || proto.webkitMatchesSelector;\n\n if (proto.closest) {\n return (el, css) => el.closest(css);\n } else {\n return (el, css) => {\n for (; el; el = el.parentElement) {\n if (match.call(el, css)) return el;\n }\n\n return null;\n };\n }\n})();\nfunction addStyle(nodeName, css) {\n var key = \"style-\".concat(nodeName.toLowerCase());\n var min = css.replace(/\\/\\*[^!][^*]*\\*\\//g, '').replace(/\\s*(^|[:;,{}]|$)\\s*/g, '$1');\n document.getElementById(key) || document.head.insertAdjacentHTML('afterbegin', \"\"));\n}\nfunction toArray(nodeList) {\n return [].slice.call(nodeList);\n}\nfunction dispatchEvent(element, name) {\n var detail = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};\n var ignore = \"prevent_recursive_dispatch_maximum_callstack\".concat(name);\n var event;\n if (element[ignore]) return true; // We are already processing this event, so skip sending a new one\n else element[ignore] = true; // Add name to dispatching ignore\n\n if (typeof window.CustomEvent === 'function') {\n event = new window.CustomEvent(name, {\n bubbles: true,\n cancelable: true,\n detail\n });\n } else {\n event = document.createEvent('CustomEvent');\n event.initCustomEvent(name, true, true, detail);\n } // IE reports incorrect event.defaultPrevented\n // but correct return value on element.dispatchEvent\n\n\n var result = element.dispatchEvent(event);\n element[ignore] = null; // Remove name from dispatching ignore\n\n return result; // Follow W3C standard for return value\n}\n\nfunction easeOutQuint(t) {\n return 1 + --t * t * t * t * t;\n}\n\nclass VerticalScroll {\n constructor(container) {\n _defineProperty(this, \"container\", void 0);\n\n this.container = container;\n }\n\n cancel() {\n this._cancelled = true;\n }\n\n to(top) {\n var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;\n var callback = arguments.length > 2 ? arguments[2] : undefined;\n var from = this.container.scrollTop;\n var distance = top - from;\n var startTime = null;\n\n var loop = currentTime => {\n if (this._cancelled) {\n return;\n }\n\n if (!startTime) {\n startTime = currentTime - 1;\n }\n\n var timeElapsed = currentTime - startTime;\n\n if (timeElapsed < duration) {\n this.container.scrollTop = from + distance * easeOutQuint(timeElapsed / duration);\n window.requestAnimationFrame(loop);\n } else {\n this.container.scrollTop = top;\n callback && callback();\n }\n };\n\n window.requestAnimationFrame(loop);\n }\n\n}\nclass HorizontalScroll {\n constructor(container) {\n _defineProperty(this, \"container\", void 0);\n\n this.container = container;\n }\n\n cancel() {\n this._cancelled = true;\n }\n\n to(left) {\n var duration = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1000;\n var callback = arguments.length > 2 ? arguments[2] : undefined;\n var from = this.container.scrollLeft;\n var distance = left - from;\n var startTime = null;\n\n var loop = currentTime => {\n if (this._cancelled) {\n return;\n }\n\n if (!startTime) {\n startTime = currentTime - 1;\n }\n\n var timeElapsed = currentTime - startTime;\n\n if (timeElapsed < duration) {\n this.container.scrollLeft = from + distance * easeOutQuint(timeElapsed / duration);\n window.requestAnimationFrame(loop);\n } else {\n this.container.scrollLeft = left;\n callback && callback();\n }\n };\n\n window.requestAnimationFrame(loop);\n }\n\n}\n\nfunction testReducedMotion() {\n if (typeof window !== 'undefined') {\n return !!window.matchMedia && window.matchMedia('(prefers-reduced-motion)').matches;\n }\n\n return false;\n}\n\nvar MAX_SAFE_INTEGER = 9007199254740991;\nfunction withinRange(current) {\n var start = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0;\n var stop = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : MAX_SAFE_INTEGER;\n return current >= start && current <= stop;\n}\nfunction withinStops(currentTime, stops, targetStop) {\n var nrOfStops = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 1;\n var uniqueStops = stops.filter(unique);\n var targetTime = stops[targetStop];\n var prevTime = uniqueStops[uniqueStops.indexOf(targetTime) - nrOfStops];\n var nextTime = uniqueStops[uniqueStops.indexOf(targetTime) + nrOfStops];\n return withinRange(currentTime, prevTime, nextTime);\n}\n\nfunction unique(value, index, self) {\n return self.indexOf(value) === index;\n}\n\n/*\n * 'loading=\"lazy\"' is defined in terms of IntersectionObserver and the initial root.\n * As a result images with 'loading=\"lazy\"' inside a scroll container will not load\n * until they at least have one pixel visible in the viewport.\n *\n * This will hopefully fixed in a future version of the spec:\n * https://github.com/w3c/IntersectionObserver/issues/431\n *\n * scroll-container-lazy-load observes images and a scroll container.\n * Once images are close to intersecting it will change 'loading=\"lazy\"' to 'loading=\"eager\"'.\n * */\n\nfunction loadImage(image) {\n if (image.loading === 'lazy') {\n image.loading = 'eager';\n }\n}\n\nfunction connectScrollContainerLazyLoad(container, images) {\n var containerIntersecting = false;\n var deferredImages = []; // eslint-disable-next-line compat/compat\n\n var containerObserver = new IntersectionObserver(entries => {\n containerIntersecting = entries === null || entries === void 0 ? void 0 : entries[0].isIntersecting;\n\n if (containerIntersecting) {\n deferredImages.forEach(image => loadImage(image));\n deferredImages = [];\n }\n }, {\n root: getDefaultRoot(),\n threshold: [0.0]\n });\n containerObserver.observe(container); // eslint-disable-next-line compat/compat\n\n var imageObserver = new IntersectionObserver(entries => {\n for (var entry of entries) {\n if (entry.isIntersecting) {\n var image = entry.target;\n imageObserver.unobserve(image);\n\n if (containerIntersecting) {\n loadImage(image);\n } else {\n /* Defer loading of if the container is not intersecting the viewport */\n deferredImages.push(image);\n }\n }\n }\n }, {\n root: container,\n rootMargin: '300px',\n threshold: 0.0\n });\n\n for (var image of images) {\n imageObserver.observe(image);\n }\n\n return () => {\n containerObserver.disconnect();\n imageObserver.disconnect();\n };\n}\n\nfunction debounce(fn, delay) {\n var timeout;\n return function () {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n clearTimeout(timeout);\n timeout = setTimeout(() => fn(...args), delay);\n };\n}\n\nexport { ElementIntersectionObserver, HorizontalScroll, VerticalScroll, addStyle, closest, connectScrollContainerLazyLoad, debounce, dispatchEvent, setAttribute, testReducedMotion, toArray, toggleAttribute, withinRange, withinStops };\n//# sourceMappingURL=dh-basis-common.esm.js.map\n","import _defineProperty from '@babel/runtime/helpers/defineProperty';\nimport { dispatchEvent, testReducedMotion, toArray, toggleAttribute } from '@nrk/dh-basis-common';\n\nvar STATE_ATTR = 'data-state';\nvar VIEWPORT_POSITION_ATTR = 'data-viewport-position';\nvar DISABLE_FORCED_ATTRIBUTES_ATTR = 'disable-forced-attributes';\nvar IS_PAUSED = 'is-paused';\nvar AUTOPLAY_BLOCKED = 'autoplay-blocked';\nvar READY_STATE = {\n HAVE_NOTHING: 0,\n HAVE_METADATA: 1,\n HAVE_CURRENT_DATA: 2,\n HAVE_FUTURE_DATA: 3,\n HAVE_ENOUGH_DATA: 4 // Can play through\n\n};\n\nvar isVisible = child => !!child.offsetParent;\n\nclass LevendeStillbilde extends HTMLElement {\n constructor() {\n super(...arguments);\n\n _defineProperty(this, \"_disconnecting\", false);\n\n _defineProperty(this, \"_visibleVideoElement\", void 0);\n\n _defineProperty(this, \"_handlePlayChange\", e => {\n if (e.type === 'play') {\n dispatchEvent(this, 'dh-basis-autoplay-succeeded');\n }\n\n if (e.target === this._visibleVideoElement) {\n this.isPaused = this._visibleVideoElement.paused;\n }\n });\n\n _defineProperty(this, \"_updatePlayState\", () => {\n if (!this._visibleVideoElement) {\n return;\n }\n\n if (this._shouldPlay()) {\n this._playVideo();\n } else {\n this._pauseVideo();\n }\n });\n\n _defineProperty(this, \"_handleResize\", () => {\n this._updateVisibleVideoElement();\n });\n }\n\n static get observedAttributes() {\n return [STATE_ATTR, DISABLE_FORCED_ATTRIBUTES_ATTR, VIEWPORT_POSITION_ATTR];\n }\n\n connectedCallback() {\n this._setVideoAttributes();\n\n this._setEventListeners();\n\n this._updateVisibleVideoElement();\n }\n\n disconnectedCallback() {\n this._disconnecting = true;\n\n this._removeEventListeners();\n }\n\n attributeChangedCallback(name, prevValue, newValue) {\n var valueChanged = prevValue !== newValue;\n\n if (name === STATE_ATTR || name === VIEWPORT_POSITION_ATTR) {\n if (valueChanged) {\n this._updateVisibleVideoElement();\n\n this._updatePlayState();\n\n if (name === VIEWPORT_POSITION_ATTR && newValue === 'IN-VIEWPORT') {\n this._preload();\n }\n }\n }\n }\n\n _setEventListeners() {\n window.addEventListener('resize', this._handleResize);\n this.videoElements.forEach(el => {\n el.addEventListener('pause', this._handlePlayChange);\n el.addEventListener('play', this._handlePlayChange);\n el.addEventListener('canplaythrough', this._updatePlayState);\n });\n }\n\n _removeEventListeners() {\n window.removeEventListener('resize', this._handleResize);\n this.videoElements.forEach(el => {\n el.removeEventListener('pause', this._handlePlayChange);\n el.removeEventListener('play', this._handlePlayChange);\n el.removeEventListener('canplaythrough', this._updatePlayState);\n });\n }\n\n _updateVisibleVideoElement() {\n requestAnimationFrame(() => {\n var nextVisibleVideo = this.videoElements.find(isVisible);\n\n if (nextVisibleVideo !== this._visibleVideoElement) {\n // Pause previous video\n this._pauseVideo();\n\n this._visibleVideoElement = nextVisibleVideo;\n\n if (this._shouldPreload()) {\n this._preload();\n }\n\n this._updatePlayState();\n }\n });\n }\n\n _setVideoAttributes() {\n if (!this.disableForcedAttributes) {\n this.videoElements.forEach(el => {\n el.setAttribute('playsInline', '');\n el.setAttribute('loop', '');\n el.setAttribute('disableRemotePlayback', '');\n el.setAttribute('x-webkit-airplay', 'deny');\n });\n }\n }\n\n _shouldPlay() {\n var _this$_visibleVideoEl;\n\n /*\n * Safari 14-15.5 hides poster on play, leaving a transparent element until enough data is available to play through.\n * We have to wait for the canplaythrough event and readystate = READY_STATE.HAVE_ENOUGH_DATA before calling `.play()`\n * */\n return ((_this$_visibleVideoEl = this._visibleVideoElement) === null || _this$_visibleVideoEl === void 0 ? void 0 : _this$_visibleVideoEl.readyState) >= READY_STATE.HAVE_ENOUGH_DATA && this.state === 'ACTIVE' && this.viewportPosition === 'IN-VIEWPORT';\n }\n\n _shouldPreload() {\n return this.viewportPosition === 'IN-VIEWPORT';\n }\n\n _preload() {\n var _this$_visibleVideoEl2;\n\n if (((_this$_visibleVideoEl2 = this._visibleVideoElement) === null || _this$_visibleVideoEl2 === void 0 ? void 0 : _this$_visibleVideoEl2.readyState) < READY_STATE.HAVE_ENOUGH_DATA) {\n var _this$_visibleVideoEl3;\n\n (_this$_visibleVideoEl3 = this._visibleVideoElement) === null || _this$_visibleVideoEl3 === void 0 ? void 0 : _this$_visibleVideoEl3.load();\n }\n }\n\n _playVideo() {\n dispatchEvent(this, 'dh-basis-autoplay-attempted');\n var reducedMotion = testReducedMotion();\n var videoElement = this._visibleVideoElement;\n\n if (videoElement.paused && !reducedMotion && !this.autoplayBlocked) {\n var playPromise = videoElement.play() || Promise.resolve();\n playPromise.catch(e => {\n console.error(e);\n this.autoplayBlocked = true;\n });\n }\n }\n\n _pauseVideo() {\n var videoElement = this._visibleVideoElement;\n\n if (videoElement && !videoElement.paused) {\n videoElement.pause();\n }\n }\n\n get videoElements() {\n return toArray(this.querySelectorAll('video'));\n }\n\n get disableForcedAttributes() {\n return this.hasAttribute(DISABLE_FORCED_ATTRIBUTES_ATTR);\n }\n\n get state() {\n return this.getAttribute(STATE_ATTR);\n }\n\n set state(val) {\n this.setAttribute(STATE_ATTR, val);\n }\n\n get isPaused() {\n return this.getAttribute(IS_PAUSED);\n }\n\n set isPaused(val) {\n if (val) {\n this.setAttribute(IS_PAUSED, '');\n } else {\n this.removeAttribute(IS_PAUSED);\n }\n }\n\n get autoplayBlocked() {\n return this.hasAttribute(AUTOPLAY_BLOCKED) || false;\n }\n\n set autoplayBlocked(val) {\n toggleAttribute(this, AUTOPLAY_BLOCKED, val);\n }\n\n get viewportPosition() {\n return this.getAttribute(VIEWPORT_POSITION_ATTR);\n }\n\n set viewportPosition(val) {\n this.setAttribute(VIEWPORT_POSITION_ATTR, val);\n }\n\n}\n\nexport { LevendeStillbilde as default };\n//# sourceMappingURL=dh-basis-levende-stillbilde.esm.js.map\n","import { getElementTag } from '@nrk/dh-server-libs/get-element-tag'\n\nimport levendeStillbilde from '@nrk/dh-basis-levende-stillbilde'\nimport { ElementIntersectionObserver } from '@nrk/dh-basis-common'\nimport './components/VideoLoop.module.css'\nimport './components/Byline.module.css'\nimport './client.module.css'\n\nconst tag = getElementTag(__APP_NAME__, __APP_VERSION__)\n\nfunction safeDefine(elementName, constructor) {\n if (typeof customElements.get(elementName) === 'undefined') {\n customElements.define(elementName, constructor)\n }\n}\n\nconst VIEWPORT_POSITION_ATTR = 'data-viewport-position'\n\nclass AppElement extends HTMLElement {\n name = tag\n #logStatus = {\n playAttempted: false,\n playSucceeded: false,\n }\n\n connectedCallback() {\n this.render()\n this.addEventListener('dh-basis-autoplay-attempted', this.#logPlayAttempted)\n this.addEventListener('dh-basis-autoplay-succeeded', this.#logPlaySucceeded)\n }\n\n disconnectedCallback() {\n super.disconnectedCallback?.()\n this.removeEventListener('dh-basis-autoplay-attempted', this.#logPlayAttempted)\n this.removeEventListener('dh-basis-autoplay-succeeded', this.#logPlaySucceeded)\n }\n\n render() {\n try {\n safeDefine('dh-lvs-basis-levende-stillbilde', levendeStillbilde)\n\n const videoWrapperElement = this.querySelector('.dh-video-wrapper')\n\n // eslint-disable-next-line no-unused-vars\n const elementObserver = new ElementIntersectionObserver(\n [videoWrapperElement],\n (intersections) => {\n const element = intersections[0]\n const elementViewportPosition = videoWrapperElement.getAttribute(VIEWPORT_POSITION_ATTR)\n if (element.isIntersecting && elementViewportPosition === 'OUT-OF-VIEWPORT') {\n videoWrapperElement.setAttribute(VIEWPORT_POSITION_ATTR, 'IN-VIEWPORT')\n }\n if (!element.isIntersecting && elementViewportPosition === 'IN-VIEWPORT') {\n videoWrapperElement.setAttribute(VIEWPORT_POSITION_ATTR, 'OUT-OF-VIEWPORT')\n }\n }\n )\n } catch (err) {\n // fail silently\n console.error(`Error while rendering ${tag}`, err)\n }\n }\n\n #logPlayAttempted = () => {\n if (!this.#logStatus.playAttempted) {\n this.#logStatus.playAttempted = true\n }\n }\n\n #logPlaySucceeded = () => {\n if (!this.#logStatus.playSucceeded) {\n this.#logStatus.playSucceeded = true\n }\n }\n}\n\nif (!customElements.get(tag)) {\n customElements.define(tag, AppElement)\n}\n"],"names":["module","exports","getElementTag","name","version","split","__webpack_module_cache__","__webpack_require__","moduleId","cachedModule","undefined","__webpack_modules__","_typeof","obj","Symbol","iterator","constructor","prototype","_toPropertyKey","arg","key","input","hint","prim","toPrimitive","res","call","TypeError","String","Number","value","Object","defineProperty","enumerable","configurable","writable","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","push","apply","_objectSpread","target","i","arguments","length","source","forEach","getOwnPropertyDescriptors","defineProperties","defaultConfig","rootMargin","threshold","root","ElementIntersectionObserver","elements","onChange","config","this","slice","intersections","map","isIntersecting","ratio","intersectionObserver","IntersectionObserver","entries","entry","idx","indexOf","splice","intersectionRatio","elm","observe","disconnect","unobserve","proto","match","window","Element","matches","msMatchesSelector","webkitMatchesSelector","closest","dispatchEvent","element","event","detail","ignore","concat","CustomEvent","bubbles","cancelable","document","createEvent","initCustomEvent","result","STATE_ATTR","VIEWPORT_POSITION_ATTR","DISABLE_FORCED_ATTRIBUTES_ATTR","IS_PAUSED","AUTOPLAY_BLOCKED","READY_STATE","isVisible","child","offsetParent","LevendeStillbilde","HTMLElement","super","e","type","_visibleVideoElement","isPaused","paused","_shouldPlay","_playVideo","_pauseVideo","_updateVisibleVideoElement","observedAttributes","connectedCallback","_setVideoAttributes","_setEventListeners","disconnectedCallback","_disconnecting","_removeEventListeners","attributeChangedCallback","prevValue","newValue","_updatePlayState","_preload","addEventListener","_handleResize","videoElements","el","_handlePlayChange","removeEventListener","requestAnimationFrame","nextVisibleVideo","find","_shouldPreload","disableForcedAttributes","setAttribute","_this$_visibleVideoEl","readyState","state","viewportPosition","_this$_visibleVideoEl2","_this$_visibleVideoEl3","load","reducedMotion","matchMedia","videoElement","autoplayBlocked","play","Promise","resolve","catch","console","error","pause","nodeList","querySelectorAll","hasAttribute","getAttribute","val","removeAttribute","boolValue","tag","__APP_NAME__","__APP_VERSION__","_logStatus","_classPrivateFieldLooseKey","_logPlayAttempted","_logPlaySucceeded","AppElement","args","playAttempted","playSucceeded","_classPrivateFieldLooseBase","render","elementName","levendeStillbilde","customElements","get","define","videoWrapperElement","querySelector","elementViewportPosition","err"],"sourceRoot":""}